mirror of
https://github.com/nextcloud/server.git
synced 2026-04-06 09:37:01 -04:00
1 line
No EOL
3.7 KiB
Text
1 line
No EOL
3.7 KiB
Text
{"version":3,"file":"comments-comments-app.mjs","sources":["../build/frontend/apps/comments/src/services/CommentsInstance.ts","../build/frontend/apps/comments/src/comments-app.ts"],"sourcesContent":["/*!\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { App, ComponentPublicInstance } from 'vue'\n\nimport { n, t } from '@nextcloud/l10n'\nimport { createPinia } from 'pinia'\nimport { createApp } from 'vue'\nimport CommentsApp from '../views/CommentsApp.vue'\nimport logger from '../logger.ts'\n\nexport interface CommentsInstanceOptions {\n\tel?: HTMLElement\n\n\tprops?: Record<string, unknown>\n\n\t/** @deprecated use `props` instead */\n\tpropsData?: Record<string, unknown>\n}\n\nexport default class CommentInstance {\n\tprivate app: App\n\tprivate instance: ComponentPublicInstance<typeof CommentsApp> | undefined\n\n\t/**\n\t * Initialize a new Comments instance for the desired type\n\t *\n\t * @param resourceType - The comments endpoint type\n\t * @param options - The vue options (props, parent, el...)\n\t */\n\tconstructor(resourceType = 'files', options: CommentsInstanceOptions = {}) {\n\t\tconst pinia = createPinia()\n\n\t\tthis.app = createApp(\n\t\t\tCommentsApp,\n\t\t\t{\n\t\t\t\t...(options.propsData ?? {}),\n\t\t\t\t...(options.props ?? {}),\n\t\t\t\tresourceType,\n\t\t\t},\n\t\t)\n\n\t\t// Add translates functions\n\t\tthis.app.mixin({\n\t\t\tdata() {\n\t\t\t\treturn {\n\t\t\t\t\tlogger,\n\t\t\t\t}\n\t\t\t},\n\t\t\tmethods: {\n\t\t\t\tt,\n\t\t\t\tn,\n\t\t\t},\n\t\t})\n\n\t\tthis.app.use(pinia)\n\t\tif (options.el) {\n\t\t\tthis.instance = this.app.mount(options.el)\n\t\t}\n\t}\n\n\t/**\n\t * Mount the Comments instance to a new element.\n\t *\n\t * @param el - The element to mount the instance on\n\t */\n\t$mount(el: HTMLElement | string) {\n\t\tif (this.instance) {\n\t\t\tthis.app.unmount()\n\t\t}\n\t\tthis.instance = this.app.mount(el)\n\t}\n\n\t/**\n\t * Unmount the Comments instance from the DOM and destroy it.\n\t */\n\t$unmount() {\n\t\tthis.app.unmount()\n\t\tthis.instance = undefined\n\t}\n\n\t/**\n\t * Update the current resource id.\n\t *\n\t * @param id - The new resource id to load the comments for\n\t */\n\tupdate(id: string | number) {\n\t\tif (this.instance) {\n\t\t\tthis.instance.update(id)\n\t\t}\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport logger from './logger.ts'\nimport CommentsInstance from './services/CommentsInstance.ts'\n\n// Init Comments\nif (window.OCA && !window.OCA.Comments) {\n\tObject.assign(window.OCA, { Comments: {} })\n}\n\n// Init Comments App view\nObject.assign(window.OCA.Comments, { View: CommentsInstance })\nlogger.debug('OCA.Comments.View initialized')\n"],"names":["CommentInstance","resourceType","options","pinia","createPinia","createApp","CommentsApp","logger","t","n","el","id","CommentsInstance"],"mappings":"0vCAsBA,MAAqBA,CAAgB,CAC5B,IACA,SAQR,YAAYC,EAAe,QAASC,EAAmC,CAAA,EAAI,CAC1E,MAAMC,EAAQC,EAAA,EAEd,KAAK,IAAMC,EACVC,EACA,CACC,GAAIJ,EAAQ,WAAa,CAAA,EACzB,GAAIA,EAAQ,OAAS,CAAA,EACrB,aAAAD,CAAA,CACD,EAID,KAAK,IAAI,MAAM,CACd,MAAO,CACN,MAAO,CACN,OAAAM,CAAA,CAEF,EACA,QAAS,CAAA,EACRC,EAAA,EACAC,CAAA,CACD,CACA,EAED,KAAK,IAAI,IAAIN,CAAK,EACdD,EAAQ,KACX,KAAK,SAAW,KAAK,IAAI,MAAMA,EAAQ,EAAE,EAE3C,CAOA,OAAOQ,EAA0B,CAC5B,KAAK,UACR,KAAK,IAAI,QAAA,EAEV,KAAK,SAAW,KAAK,IAAI,MAAMA,CAAE,CAClC,CAKA,UAAW,CACV,KAAK,IAAI,QAAA,EACT,KAAK,SAAW,MACjB,CAOA,OAAOC,EAAqB,CACvB,KAAK,UACR,KAAK,SAAS,OAAOA,CAAE,CAEzB,CACD,CCpFI,OAAO,KAAO,CAAC,OAAO,IAAI,UAC7B,OAAO,OAAO,OAAO,IAAK,CAAE,SAAU,CAAA,EAAI,EAI3C,OAAO,OAAO,OAAO,IAAI,SAAU,CAAE,KAAMC,EAAkB,EAC7DL,EAAO,MAAM,+BAA+B"} |