@nextcloud/vue
Version:
Nextcloud vue components
1 lines • 2.2 kB
Source Map (JSON)
{"version":3,"file":"appName-DtnLUijR.mjs","sources":["../../src/utils/utils.ts","../../src/utils/appName.ts"],"sourcesContent":["/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\n/**\n * Single tone function decorator\n *\n * @param func - Function\n */\nexport function once<T extends unknown[], K>(func: (...args: T) => K): ((...args: T) => K) {\n\tlet wasCalled = false\n\tlet result: K\n\n\treturn (...args: T): K => {\n\t\tif (!wasCalled) {\n\t\t\twasCalled = true\n\t\t\tresult = func(...args)\n\t\t}\n\t\treturn result\n\t}\n}\n","/**\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { loadState } from '@nextcloud/initial-state'\nimport { logger } from './logger.ts'\nimport { once } from './utils.ts'\n\nlet realAppName = 'missing-app-name'\ntry {\n\trealAppName = appName\n} catch {\n\tlogger.error('The `@nextcloud/vue` library was used without setting / replacing the `appName`.')\n}\nexport const APP_NAME = realAppName\n\nlet realAppVersion = ''\ntry {\n\trealAppVersion = appVersion\n} catch {\n\tlogger.error('The `@nextcloud/vue` library was used without setting / replacing the `appVersion`.')\n}\nexport const APP_VERSION = realAppVersion\n\n/**\n * Get localized app name from the initial state\n */\nexport const getLocalizedAppName = once(() => {\n\tconst activeApp = loadState<string>('core', 'active-app', APP_NAME)\n\treturn loadState<{ id: string, name: string }[]>('core', 'apps', []).find(({ id }) => id === activeApp)?.name ?? APP_NAME\n})\n"],"names":[],"mappings":";;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,KAA6B,MAA8C;AAC1F,MAAI,YAAY;AAChB,MAAI;AAEJ,SAAO,IAAI,SAAe;AACzB,QAAI,CAAC,WAAW;AACf,kBAAY;AACZ,eAAS,KAAK,GAAG,IAAI;AAAA,IACtB;AACA,WAAO;AAAA,EACR;AACD;ACZA,IAAI,cAAc;AAClB,IAAI;AACH,gBAAc;AACf,QAAQ;AACP,SAAO,MAAM,kFAAkF;AAChG;AACO,MAAM,WAAW;AAExB,IAAI,iBAAiB;AACrB,IAAI;AACH,mBAAiB;AAClB,QAAQ;AACP,SAAO,MAAM,qFAAqF;AACnG;AACO,MAAM,cAAc;AAKpB,MAAM,sBAAsB,KAAK,MAAM;AAC7C,QAAM,YAAY,UAAkB,QAAQ,cAAc,QAAQ;AAClE,SAAO,UAA0C,QAAQ,QAAQ,CAAA,CAAE,EAAE,KAAK,CAAC,EAAE,GAAA,MAAS,OAAO,SAAS,GAAG,QAAQ;AAClH,CAAC;"}