angular-intlayer 8.2.4 → 8.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/installIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntl.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
- package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/configuration.cjs.map +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
- package/dist/cjs/editor/editedContent.cjs.map +1 -1
- package/dist/cjs/editor/editorLocale.cjs.map +1 -1
- package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
- package/dist/esm/client/installIntlayer.mjs.map +1 -1
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/client/useIntl.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
- package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
- package/dist/esm/editor/configuration.mjs.map +1 -1
- package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
- package/dist/esm/editor/editedContent.mjs.map +1 -1
- package/dist/esm/editor/editorLocale.mjs.map +1 -1
- package/dist/esm/editor/focusDictionary.mjs.map +1 -1
- package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/plugins.mjs +1 -1
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
- package/dist/types/client/installIntlayer.d.ts +1 -1
- package/dist/types/client/useDictionary.d.ts +2 -1
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryAsync.d.ts +2 -1
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +4 -3
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntl.d.ts +1 -1
- package/dist/types/client/useIntlayer.d.ts +1 -1
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +5 -5
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +6 -6
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/editor/EditedContentRenderer.component.d.ts +2 -1
- package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -1
- package/dist/types/editor/dictionariesRecord.d.ts +1 -1
- package/dist/types/editor/editedContent.d.ts +2 -1
- package/dist/types/editor/editedContent.d.ts.map +1 -1
- package/dist/types/editor/editorLocale.d.ts.map +1 -1
- package/dist/types/editor/focusDictionary.d.ts +1 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +1 -1
- package/dist/types/getDictionary.d.ts +2 -1
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +1 -1
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/intlayer/dist/types/index.d.ts +3 -0
- package/dist/types/plugins.d.ts +2 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentRenderer.component.mjs","names":[],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, signal } from '@angular/core';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { ContentNode
|
|
1
|
+
{"version":3,"file":"EditedContentRenderer.component.mjs","names":[],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, signal } from '@angular/core';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useEditedContentRenderer } from './useEditedContentRenderer';\n\nexport interface EditedContentRendererProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: Locale;\n}\n\n@Component({\n selector: 'app-edited-content-renderer',\n standalone: true,\n imports: [CommonModule],\n template: ` <span [innerHTML]=\"renderedContent()\"></span> `,\n})\nexport class EditedContentRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: KeyPath[];\n @Input() locale?: Locale;\n\n private fallback = signal('');\n\n private rawContent = computed(() => {\n return useEditedContentRenderer(\n this.dictionaryKey,\n this.keyPath,\n this.fallback\n );\n });\n\n /**\n * Object → getContent → string, same as the React version.\n */\n renderedContent = computed(() => {\n const rawContentValue = this.rawContent();\n\n if (typeof rawContentValue === 'object' && rawContentValue !== null) {\n const transformed = getContent(\n rawContentValue as ContentNode,\n {\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath,\n },\n this.locale\n );\n\n if (typeof transformed !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformed}. Expected string. Value ${JSON.stringify(\n transformed\n )}`\n );\n return this.fallback();\n }\n return transformed;\n }\n\n return rawContentValue() as string;\n });\n}\n"],"mappings":"wcAoBO,IAAA,EAAA,KAAqC,CAC1C,cACA,QACA,OAEA,SAAmB,EAAO,GAAG,CAE7B,WAAqB,MACZ,EACL,KAAK,cACL,KAAK,QACL,KAAK,SACN,CACD,CAKF,gBAAkB,MAAe,CAC/B,IAAM,EAAkB,KAAK,YAAY,CAEzC,GAAI,OAAO,GAAoB,UAAY,EAA0B,CACnE,IAAM,EAAc,EAClB,EACA,CACE,cAAe,KAAK,cACpB,QAAS,KAAK,QACf,CACD,KAAK,OACN,CAUD,OARI,OAAO,GAAgB,SAQpB,GAPL,QAAQ,MACN,kDAAkD,OAAO,EAAY,2BAA2B,KAAK,UACnG,EACD,GACF,CACM,KAAK,UAAU,EAK1B,OAAO,GAAiB,EACxB,KA1CD,GAAO,CAAA,EAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,gBAAA,IAAA,GAAA,IACP,GAAO,CAAA,EAAA,cAAA,MAAA,CAAA,CAAA,EAAA,UAAA,UAAA,IAAA,GAAA,IACP,GAAO,CAAA,EAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,SAAA,IAAA,GAAA,MATT,EAAU,CACT,SAAU,8BACV,WAAY,GACZ,QAAS,CAAC,EAAa,CACvB,SAAU,kDACX,CAAC,CAAA,CAAA,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.mjs","names":[],"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { MessageKey } from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useConfiguration = () => {\n const [pushedConfiguration, setConfiguration] =\n useCrossFrameState<IntlayerConfig>(MessageKey.INTLAYER_CONFIGURATION);\n\n // Use Angular's injection context instead of Vue's onMounted\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef) {\n // Execute immediately since Angular doesn't have the same lifecycle hooks\n if (!pushedConfiguration()) {\n setConfiguration(configuration);\n }\n }\n } catch {\n console.warn(\n 'useConfiguration called outside injection context; ' +\n 'configuration may not be synchronized.'\n );\n }\n};\n"],"mappings":"yMAMA,MAAa,MAAyB,CACpC,GAAM,CAAC,EAAqB,GAC1B,EAAmC,EAAW,uBAAuB,CAGvE,GAAI,CACiB,EAAO,EAAY,CAAE,SAAU,GAAM,CAAC,GAIlD,GAAqB,EACxB,EAAiB,EAAc,OAG7B,CACN,QAAQ,KACN,4FAED"}
|
|
1
|
+
{"version":3,"file":"configuration.mjs","names":[],"sources":["../../../src/editor/configuration.ts"],"sourcesContent":["import { DestroyRef, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport { MessageKey } from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useConfiguration = () => {\n const [pushedConfiguration, setConfiguration] =\n useCrossFrameState<IntlayerConfig>(MessageKey.INTLAYER_CONFIGURATION);\n\n // Use Angular's injection context instead of Vue's onMounted\n try {\n const destroyRef = inject(DestroyRef, { optional: true });\n\n if (destroyRef) {\n // Execute immediately since Angular doesn't have the same lifecycle hooks\n if (!pushedConfiguration()) {\n setConfiguration(configuration);\n }\n }\n } catch {\n console.warn(\n 'useConfiguration called outside injection context; ' +\n 'configuration may not be synchronized.'\n );\n }\n};\n"],"mappings":"yMAMA,MAAa,MAAyB,CACpC,GAAM,CAAC,EAAqB,GAC1B,EAAmC,EAAW,uBAAuB,CAGvE,GAAI,CACiB,EAAO,EAAY,CAAE,SAAU,GAAM,CAAC,GAIlD,GAAqB,EACxB,EAAiB,EAAc,OAG7B,CACN,QAAQ,KACN,4FAED"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionariesRecord.mjs","names":[],"sources":["../../../src/editor/dictionariesRecord.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\n/**\n * Singleton instance\n */\nlet instance: DictionariesRecordClient | null = null;\n\nexport type DictionaryContent = Record<Dictionary['key'], Dictionary>;\n\ntype DictionariesRecordClient = {\n localeDictionaries: Signal<DictionaryContent>;\n setLocaleDictionaries: (newValue: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\nexport const createDictionaryRecordClient = () => {\n if (instance) return instance;\n\n const localeDictionariesSignal = signal<DictionaryContent | undefined>(\n undefined\n );\n\n instance = {\n localeDictionaries:\n localeDictionariesSignal.asReadonly() as Signal<DictionaryContent>,\n\n setLocaleDictionaries: (newValue) => {\n localeDictionariesSignal.set(newValue ?? {});\n },\n\n setLocaleDictionary(dictionary) {\n const current = localeDictionariesSignal();\n localeDictionariesSignal.set({\n ...current,\n [dictionary.localId!]: dictionary,\n });\n },\n };\n\n return instance;\n};\n\n/**\n * Helper to install the provider into the injector\n */\nexport const installDictionariesRecord = (_injector: Injector) => {\n const _client = createDictionaryRecordClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createDictionaryRecordClient\n};\n\nexport const useDictionariesRecord = createSharedComposable(() => {\n const client = createDictionaryRecordClient();\n\n if (!client) {\n throw new Error('DictionariesRecord state not found');\n }\n\n const [_dictionariesRecord, setDictionariesRecord] =\n useCrossFrameState<DictionaryContent>(\n MessageKey.INTLAYER_LOCALE_DICTIONARIES_CHANGED,\n undefined\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = client.localeDictionaries();\n setDictionariesRecord(newValue); // its undefined but shouldnt\n });\n});\n"],"mappings":"qOASA,IAAI,EAA4C,KAUhD,MAAa,MAAqC,CAChD,GAAI,EAAU,OAAO,EAErB,IAAM,EAA2B,EAC/B,IAAA,GACD,CAmBD,MAjBA,GAAW,CACT,mBACE,EAAyB,YAAY,CAEvC,sBAAwB,GAAa,CACnC,EAAyB,IAAI,GAAY,EAAE,CAAC,EAG9C,oBAAoB,EAAY,CAC9B,IAAM,EAAU,GAA0B,CAC1C,EAAyB,IAAI,CAC3B,GAAG,GACF,EAAW,SAAW,EACxB,CAAC,EAEL,CAEM,GAMI,EAA6B,GAAwB,CAChD,GAA8B,EAMnC,EAAwB,MAA6B,CAChE,IAAM,EAAS,GAA8B,CAE7C,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,GAAM,CAAC,EAAqB,GAC1B,EACE,EAAW,qCACX,IAAA,GACD,CAGH,MAAa,CAEX,EADiB,EAAO,oBAAoB,CACb,EAC/B,EACF"}
|
|
1
|
+
{"version":3,"file":"dictionariesRecord.mjs","names":[],"sources":["../../../src/editor/dictionariesRecord.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\n/**\n * Singleton instance\n */\nlet instance: DictionariesRecordClient | null = null;\n\nexport type DictionaryContent = Record<Dictionary['key'], Dictionary>;\n\ntype DictionariesRecordClient = {\n localeDictionaries: Signal<DictionaryContent>;\n setLocaleDictionaries: (newValue: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\nexport const createDictionaryRecordClient = () => {\n if (instance) return instance;\n\n const localeDictionariesSignal = signal<DictionaryContent | undefined>(\n undefined\n );\n\n instance = {\n localeDictionaries:\n localeDictionariesSignal.asReadonly() as Signal<DictionaryContent>,\n\n setLocaleDictionaries: (newValue) => {\n localeDictionariesSignal.set(newValue ?? {});\n },\n\n setLocaleDictionary(dictionary) {\n const current = localeDictionariesSignal();\n localeDictionariesSignal.set({\n ...current,\n [dictionary.localId!]: dictionary,\n });\n },\n };\n\n return instance;\n};\n\n/**\n * Helper to install the provider into the injector\n */\nexport const installDictionariesRecord = (_injector: Injector) => {\n const _client = createDictionaryRecordClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createDictionaryRecordClient\n};\n\nexport const useDictionariesRecord = createSharedComposable(() => {\n const client = createDictionaryRecordClient();\n\n if (!client) {\n throw new Error('DictionariesRecord state not found');\n }\n\n const [_dictionariesRecord, setDictionariesRecord] =\n useCrossFrameState<DictionaryContent>(\n MessageKey.INTLAYER_LOCALE_DICTIONARIES_CHANGED,\n undefined\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = client.localeDictionaries();\n setDictionariesRecord(newValue); // its undefined but shouldnt\n });\n});\n"],"mappings":"qOASA,IAAI,EAA4C,KAUhD,MAAa,MAAqC,CAChD,GAAI,EAAU,OAAO,EAErB,IAAM,EAA2B,EAC/B,IAAA,GACD,CAmBD,MAjBA,GAAW,CACT,mBACE,EAAyB,YAAY,CAEvC,sBAAwB,GAAa,CACnC,EAAyB,IAAI,GAAY,EAAE,CAAC,EAG9C,oBAAoB,EAAY,CAC9B,IAAM,EAAU,GAA0B,CAC1C,EAAyB,IAAI,CAC3B,GAAG,GACF,EAAW,SAAW,EACxB,CAAC,EAEL,CAEM,GAMI,EAA6B,GAAwB,CAChD,GAA8B,EAMnC,EAAwB,MAA6B,CAChE,IAAM,EAAS,GAA8B,CAE7C,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,GAAM,CAAC,EAAqB,GAC1B,EACE,EAAW,qCACX,IAAA,GACD,CAGH,MAAa,CAEX,EADiB,EAAO,oBAAoB,CACb,EAC/B,EACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editedContent.mjs","names":[],"sources":["../../../src/editor/editedContent.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { MessageKey } from '@intlayer/editor';\nimport type {
|
|
1
|
+
{"version":3,"file":"editedContent.mjs","names":[],"sources":["../../../src/editor/editedContent.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { MessageKey } from '@intlayer/editor';\nimport type { ContentNode, Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type EditedContent = Record<Dictionary['key'], Dictionary>;\n\ntype EditedContentClient = {\n editedContent: Signal<EditedContent>;\n setEditedContent: (editedContent: EditedContent) => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\n/**\n * Singleton instance\n */\nlet instance: EditedContentClient | null = null;\n\nconst _INTLAYER_EDITED_CONTENT_SYMBOL = Symbol('EditedContent');\n\n/**\n * Creates an edited content client\n */\nexport const createEditedContentClient = () => {\n if (instance) return instance;\n\n const editedContentSignal = signal<EditedContent>({});\n\n instance = {\n editedContent: editedContentSignal.asReadonly(),\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ): ContentNode | undefined => {\n const editedContent = editedContentSignal();\n\n if (!editedContent) return undefined;\n\n const isDictionaryId =\n localDictionaryIdOrKey.includes(':local:') ||\n localDictionaryIdOrKey.includes(':remote:');\n\n if (isDictionaryId) {\n const currentContent =\n editedContent?.[localDictionaryIdOrKey as LocalDictionaryId]\n ?.content ?? {};\n\n const contentNode = getContentNodeByKeyPath(currentContent, keyPath);\n\n return contentNode;\n }\n\n const filteredDictionariesLocalId = Object.keys(editedContent).filter(\n (key) => key.startsWith(`${localDictionaryIdOrKey}:`)\n );\n\n for (const localDictionaryId of filteredDictionariesLocalId) {\n const currentContent =\n editedContent?.[localDictionaryId as LocalDictionaryId]?.content ??\n {};\n const contentNode = getContentNodeByKeyPath(currentContent, keyPath);\n\n if (contentNode) return contentNode;\n }\n\n return undefined;\n },\n setEditedContent: (editedContent: EditedContent) => {\n editedContentSignal.set(editedContent);\n },\n };\n\n return instance;\n};\n\n/**\n * Helper to install the edited content into the injector\n */\nexport const installEditedContent = (_injector: Injector) => {\n const _client = createEditedContentClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createEditedContentClient\n};\n\nexport const useEditedContent = createSharedComposable(() => {\n const client = createEditedContentClient();\n\n if (!client) {\n throw new Error('EditedContent state not found');\n }\n\n const [edited, setEdited] = useCrossFrameState<EditedContent>(\n MessageKey.INTLAYER_EDITED_CONTENT_CHANGED,\n {}\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = edited();\n client.setEditedContent(newValue ?? {});\n });\n\n effect(() => {\n const newValue = client.editedContent();\n setEdited(newValue);\n });\n\n return client;\n});\n"],"mappings":"oTAsBA,IAAI,EAAuC,KAO3C,MAAa,MAAkC,CAC7C,GAAI,EAAU,OAAO,EAErB,IAAM,EAAsB,EAAsB,EAAE,CAAC,CA8CrD,MA5CA,GAAW,CACT,cAAe,EAAoB,YAAY,CAC/C,uBACE,EACA,IAC4B,CAC5B,IAAM,EAAgB,GAAqB,CAE3C,GAAI,CAAC,EAAe,OAMpB,GAHE,EAAuB,SAAS,UAAU,EAC1C,EAAuB,SAAS,WAAW,CAS3C,OAFoB,EAHlB,IAAgB,IACZ,SAAW,EAAE,CAEyC,EAAQ,CAKtE,IAAM,EAA8B,OAAO,KAAK,EAAc,CAAC,OAC5D,GAAQ,EAAI,WAAW,GAAG,EAAuB,GAAG,CACtD,CAED,IAAK,IAAM,KAAqB,EAA6B,CAI3D,IAAM,EAAc,EAFlB,IAAgB,IAAyC,SACzD,EAAE,CACwD,EAAQ,CAEpE,GAAI,EAAa,OAAO,IAK5B,iBAAmB,GAAiC,CAClD,EAAoB,IAAI,EAAc,EAEzC,CAEM,GAMI,EAAwB,GAAwB,CAC3C,GAA2B,EAMhC,EAAmB,MAA6B,CAC3D,IAAM,EAAS,GAA2B,CAE1C,GAAI,CAAC,EACH,MAAU,MAAM,gCAAgC,CAGlD,GAAM,CAAC,EAAQ,GAAa,EAC1B,EAAW,gCACX,EAAE,CACH,CAaD,OAVA,MAAa,CACX,IAAM,EAAW,GAAQ,CACzB,EAAO,iBAAiB,GAAY,EAAE,CAAC,EACvC,CAEF,MAAa,CAEX,EADiB,EAAO,eAAe,CACpB,EACnB,CAEK,GACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorLocale.mjs","names":[],"sources":["../../../src/editor/editorLocale.ts"],"sourcesContent":["import { effect, inject } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type {
|
|
1
|
+
{"version":3,"file":"editorLocale.mjs","names":[],"sources":["../../../src/editor/editorLocale.ts"],"sourcesContent":["import { effect, inject } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from '../client';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport const useEditorLocale = createSharedComposable(() => {\n const client = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n if (!client) {\n throw new Error('IntlayerEditor state not found');\n }\n\n const [_data, setData] = useCrossFrameState<LocalesValues>(\n MessageKey.INTLAYER_CURRENT_LOCALE\n );\n\n // Use Angular effects instead of Vue watchers\n effect(() => {\n const newValue = client.locale();\n setData(newValue as Locale);\n });\n\n return client;\n});\n"],"mappings":"oSAQA,MAAa,EAAkB,MAA6B,CAC1D,IAAM,EAAS,EAAyB,EAAe,CAEvD,GAAI,CAAC,EACH,MAAU,MAAM,iCAAiC,CAGnD,GAAM,CAAC,EAAO,GAAW,EACvB,EAAW,wBACZ,CAQD,OALA,MAAa,CAEX,EADiB,EAAO,QAAQ,CACL,EAC3B,CAEK,GACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusDictionary.mjs","names":[],"sources":["../../../src/editor/focusDictionary.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type FileContent = {\n dictionaryKey: string;\n keyPath?: KeyPath[];\n dictionaryPath?: string;\n};\n\ntype FocusDictionaryClient = {\n focusedContent: Signal<FileContent | null>;\n setFocusedContent: (focussedContent: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Singleton instance\n */\nlet instance: FocusDictionaryClient | null = null;\n\n/**\n * Creates a focus dictionary client\n */\nexport const createFocusDictionaryClient = () => {\n if (instance) return instance;\n\n const focusedContentSignal = signal<FileContent | null>(null);\n\n const setFocusedContent = (focussedContent: FileContent | null) => {\n focusedContentSignal.set(focussedContent);\n };\n\n const setFocusedContentKeyPath = (keyPath: KeyPath[]) => {\n const current = focusedContentSignal();\n if (!current) return;\n setFocusedContent({ ...current, keyPath });\n };\n\n instance = {\n focusedContent: focusedContentSignal.asReadonly(),\n setFocusedContent,\n setFocusedContentKeyPath,\n } as FocusDictionaryClient;\n\n return instance;\n};\n\n/**\n * Helper to install the focus dictionary into the injector\n */\nexport const installFocusDictionary = (_injector: Injector) => {\n const _client = createFocusDictionaryClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createFocusDictionaryClient\n};\n\n/** consumer */\nexport const useFocusDictionary = createSharedComposable(() => {\n const client = createFocusDictionaryClient();\n const [focusedContent, setFocusedContent] =\n useCrossFrameState<FileContent | null>(\n MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED\n );\n\n if (!client) {\n throw new Error('FocusDictionary state not found');\n }\n\n // Use Angular effects instead of Vue watchers\n // Watch local (client) and update cross-frame\n effect(() => {\n const newValue = client.focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(focusedContent())) {\n setFocusedContent(newValue);\n }\n });\n\n // Watch cross-frame and update local\n effect(() => {\n const newValue = focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(client.focusedContent())) {\n client.setFocusedContent(newValue ?? null);\n }\n });\n\n return client;\n});\n"],"mappings":"qOAqBA,IAAI,EAAyC,KAK7C,MAAa,MAAoC,CAC/C,GAAI,EAAU,OAAO,EAErB,IAAM,EAAuB,EAA2B,KAAK,CAEvD,EAAqB,GAAwC,CACjE,EAAqB,IAAI,EAAgB,EAe3C,MANA,GAAW,CACT,eAAgB,EAAqB,YAAY,CACjD,oBACA,yBATgC,GAAuB,CACvD,IAAM,EAAU,GAAsB,CACjC,GACL,EAAkB,CAAE,GAAG,EAAS,UAAS,CAAC,EAO3C,CAEM,GAMI,EAA0B,GAAwB,CAC7C,GAA6B,EAOlC,EAAqB,MAA6B,CAC7D,IAAM,EAAS,GAA6B,CACtC,CAAC,EAAgB,GACrB,EACE,EAAW,iCACZ,CAEH,GAAI,CAAC,EACH,MAAU,MAAM,kCAAkC,CAoBpD,OAfA,MAAa,CACX,IAAM,EAAW,EAAO,gBAAgB,CACpC,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,GAAgB,CAAC,EAC/D,EAAkB,EAAS,EAE7B,CAGF,MAAa,CACX,IAAM,EAAW,GAAgB,CAC7B,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,EAAO,gBAAgB,CAAC,EACtE,EAAO,kBAAkB,GAAY,KAAK,EAE5C,CAEK,GACP"}
|
|
1
|
+
{"version":3,"file":"focusDictionary.mjs","names":[],"sources":["../../../src/editor/focusDictionary.ts"],"sourcesContent":["import { effect, type Injector, type Signal, signal } from '@angular/core';\nimport { MessageKey } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { createSharedComposable } from './createSharedComposable';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type FileContent = {\n dictionaryKey: string;\n keyPath?: KeyPath[];\n dictionaryPath?: string;\n};\n\ntype FocusDictionaryClient = {\n focusedContent: Signal<FileContent | null>;\n setFocusedContent: (focussedContent: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Singleton instance\n */\nlet instance: FocusDictionaryClient | null = null;\n\n/**\n * Creates a focus dictionary client\n */\nexport const createFocusDictionaryClient = () => {\n if (instance) return instance;\n\n const focusedContentSignal = signal<FileContent | null>(null);\n\n const setFocusedContent = (focussedContent: FileContent | null) => {\n focusedContentSignal.set(focussedContent);\n };\n\n const setFocusedContentKeyPath = (keyPath: KeyPath[]) => {\n const current = focusedContentSignal();\n if (!current) return;\n setFocusedContent({ ...current, keyPath });\n };\n\n instance = {\n focusedContent: focusedContentSignal.asReadonly(),\n setFocusedContent,\n setFocusedContentKeyPath,\n } as FocusDictionaryClient;\n\n return instance;\n};\n\n/**\n * Helper to install the focus dictionary into the injector\n */\nexport const installFocusDictionary = (_injector: Injector) => {\n const _client = createFocusDictionaryClient();\n\n // Angular doesn't have a direct equivalent to Vue's app.provide\n // The client is stored as a singleton and accessed via createFocusDictionaryClient\n};\n\n/** consumer */\nexport const useFocusDictionary = createSharedComposable(() => {\n const client = createFocusDictionaryClient();\n const [focusedContent, setFocusedContent] =\n useCrossFrameState<FileContent | null>(\n MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED\n );\n\n if (!client) {\n throw new Error('FocusDictionary state not found');\n }\n\n // Use Angular effects instead of Vue watchers\n // Watch local (client) and update cross-frame\n effect(() => {\n const newValue = client.focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(focusedContent())) {\n setFocusedContent(newValue);\n }\n });\n\n // Watch cross-frame and update local\n effect(() => {\n const newValue = focusedContent();\n if (JSON.stringify(newValue) !== JSON.stringify(client.focusedContent())) {\n client.setFocusedContent(newValue ?? null);\n }\n });\n\n return client;\n});\n"],"mappings":"qOAqBA,IAAI,EAAyC,KAK7C,MAAa,MAAoC,CAC/C,GAAI,EAAU,OAAO,EAErB,IAAM,EAAuB,EAA2B,KAAK,CAEvD,EAAqB,GAAwC,CACjE,EAAqB,IAAI,EAAgB,EAe3C,MANA,GAAW,CACT,eAAgB,EAAqB,YAAY,CACjD,oBACA,yBATgC,GAAuB,CACvD,IAAM,EAAU,GAAsB,CACjC,GACL,EAAkB,CAAE,GAAG,EAAS,UAAS,CAAC,EAO3C,CAEM,GAMI,EAA0B,GAAwB,CAC7C,GAA6B,EAOlC,EAAqB,MAA6B,CAC7D,IAAM,EAAS,GAA6B,CACtC,CAAC,EAAgB,GACrB,EACE,EAAW,iCACZ,CAEH,GAAI,CAAC,EACH,MAAU,MAAM,kCAAkC,CAoBpD,OAfA,MAAa,CACX,IAAM,EAAW,EAAO,gBAAgB,CACpC,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,GAAgB,CAAC,EAC/D,EAAkB,EAAS,EAE7B,CAGF,MAAa,CACX,IAAM,EAAW,GAAgB,CAC7B,KAAK,UAAU,EAAS,GAAK,KAAK,UAAU,EAAO,gBAAgB,CAAC,EACtE,EAAO,kBAAkB,GAAY,KAAK,EAE5C,CAEK,GACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n InjectionToken,\n inject,\n type Signal,\n} from '@angular/core';\nimport type { KeyPath } from '@intlayer/types';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":"qLAaA,MAAa,EACX,IAAI,EAA4C,uBAAuB,CAKlE,IAAA,EAAA,KAAmC,CAIxC,yBACE,EACA,EACA,EACiB,CACjB,IAAM,EAAuB,EAAO,EAA8B,CAChE,SAAU,GACX,CAAC,CAEF,OAAO,MACU,GAAsB,sBACnC,EACA,EACD,EAEgB,EACjB,QAvBL,EAAW,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CA4BF,MAAa,GACX,EACA,EACA,IAEgB,EAAO,EAA6B,CACrC,yBAAyB,EAAe,EAAS,EAAS"}
|
|
1
|
+
{"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n InjectionToken,\n inject,\n type Signal,\n} from '@angular/core';\nimport type { KeyPath } from '@intlayer/types/keyPath';\n\nexport interface EditedContentActions {\n getEditedContentValue(dictionaryKey: string, keyPath: KeyPath[]): unknown;\n}\n\nexport const EDITED_CONTENT_ACTIONS_TOKEN =\n new InjectionToken<EditedContentActions | null>('editedContentActions');\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EditedContentRendererService {\n /**\n * Mirrors the React hook one-for-one.\n */\n useEditedContentRenderer(\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n ): Signal<unknown> {\n const editedContentContext = inject(EDITED_CONTENT_ACTIONS_TOKEN, {\n optional: true,\n });\n\n return computed(() => {\n const edited = editedContentContext?.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string | undefined;\n\n return edited ?? fallback;\n });\n }\n}\n\n/**\n * Standalone function that can be used like the Vue composable\n */\nexport const useEditedContentRenderer = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n fallback: unknown\n): Signal<unknown> => {\n const service = inject(EditedContentRendererService);\n return service.useEditedContentRenderer(dictionaryKey, keyPath, fallback);\n};\n"],"mappings":"qLAaA,MAAa,EACX,IAAI,EAA4C,uBAAuB,CAKlE,IAAA,EAAA,KAAmC,CAIxC,yBACE,EACA,EACA,EACiB,CACjB,IAAM,EAAuB,EAAO,EAA8B,CAChE,SAAU,GACX,CAAC,CAEF,OAAO,MACU,GAAsB,sBACnC,EACA,EACD,EAEgB,EACjB,QAvBL,EAAW,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CA4BF,MAAa,GACX,EACA,EACA,IAEgB,EAAO,EAA6B,CACrC,yBAAyB,EAAe,EAAS,EAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type {
|
|
1
|
+
{"version":3,"file":"getDictionary.mjs","names":["getDictionaryCore"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import {\n getDictionary as getDictionaryCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { htmlPlugin, intlayerNodePlugins, markdownPlugin } from './plugins';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore<T, L>(dictionary, locale, plugins);\n};\n"],"mappings":"mJAQA,MAAa,GAIX,EACA,EACA,IASOA,EAAwB,EAAY,EAPhB,CACzB,EACA,EACA,EACA,GAAI,GAAqB,EAAE,CAC5B,CAE0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import {\n getIntlayer as getIntlayerCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type {
|
|
1
|
+
{"version":3,"file":"getIntlayer.mjs","names":["getIntlayerCore"],"sources":["../../src/getIntlayer.ts"],"sourcesContent":["import {\n getIntlayer as getIntlayerCore,\n type Plugins,\n} from '@intlayer/core/interpreter';\nimport type { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from '@intlayer/types/module_augmentation';\nimport {\n type DeepTransformContent,\n htmlPlugin,\n insertionPlugin,\n intlayerNodePlugins,\n markdownPlugin,\n} from './plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n markdownPlugin,\n htmlPlugin,\n insertionPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n return getIntlayerCore<T, L>(key, locale, plugins) as DeepTransformContent<\n DictionaryRegistryContent<T>\n >;\n};\n"],"mappings":"sKAaA,MAAa,GAIX,EACA,EACA,IAWOA,EAAsB,EAAK,EATP,CACzB,EACA,EACA,EACA,EACA,GAAI,GAAqB,EAAE,CAC5B,CAGiD"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{INTLAYER_TOKEN as e,IntlayerProvider as t,createIntlayerClient as n,installIntlayer as r,provideIntlayer as i}from"./client/installIntlayer.mjs";import{
|
|
1
|
+
import{INTLAYER_TOKEN as e,IntlayerProvider as t,createIntlayerClient as n,installIntlayer as r,provideIntlayer as i}from"./client/installIntlayer.mjs";import{getDictionary as a}from"./getDictionary.mjs";import{useDictionary as o}from"./client/useDictionary.mjs";import{useDictionaryAsync as s}from"./client/useDictionaryAsync.mjs";import{useLoadDynamic as c}from"./client/useLoadDynamic.mjs";import{useDictionaryDynamic as l}from"./client/useDictionaryDynamic.mjs";import{useIntl as u}from"./client/useIntl.mjs";import{isUpdatableNode as d,useIntlayer as f}from"./client/useIntlayer.mjs";import{useLocale as p}from"./client/useLocale.mjs";import{INTLAYER_MARKDOWN_TOKEN as m,IntlayerMarkdownService as h,createIntlayerMarkdownProvider as g,htmlRuntime as _,useMarkdown as v}from"./markdown/installIntlayerMarkdown.mjs";import{htmlPlugin as y,insertionPlugin as b,intlayerNodePlugins as x,markdownPlugin as S,markdownStringPlugin as C}from"./plugins.mjs";import{getIntlayer as w}from"./getIntlayer.mjs";export{m as INTLAYER_MARKDOWN_TOKEN,e as INTLAYER_TOKEN,h as IntlayerMarkdownService,t as IntlayerProvider,n as createIntlayerClient,g as createIntlayerMarkdownProvider,a as getDictionary,w as getIntlayer,y as htmlPlugin,_ as htmlRuntime,b as insertionPlugin,r as installIntlayer,x as intlayerNodePlugins,d as isUpdatableNode,S as markdownPlugin,C as markdownStringPlugin,i as provideIntlayer,o as useDictionary,s as useDictionaryAsync,l as useDictionaryDynamic,u as useIntl,f as useIntlayer,c as useLoadDynamic,p as useLocale,v as useMarkdown};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{renderIntlayerNode as e}from"./renderIntlayerNode.mjs";import{ContentSelectorWrapperComponent as t}from"./editor/ContentSelectorWrapper.component.mjs";import{htmlRuntime as n,useMarkdown as r}from"./markdown/installIntlayerMarkdown.mjs";import{compile as i,getMarkdownMetadata as a}from"@intlayer/core/markdown";import{NodeType as o}from"@intlayer/types/nodeType";const s=(e,t)=>({...e,createElement:(n,r,...i)=>{let a=t?.[n];if(a){let t={...r,...a},o=r?.class||r?.className,s=a.class||a.className;return o&&s&&(t.class=`${o} ${s}`,t.className=void 0),e.createElement(n,t,...i)}return e.createElement(n,r,...i)}}),c={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(n,{children:r,...i})=>e({...i,value:r,children:()=>({component:t,props:{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},children:r})})},l={id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(o,c,l)=>{let{plugins:u,...d}=c,f=l(a(o),{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>e({...n,value:t,children:o})}],dictionaryKey:d.dictionaryKey,keyPath:[]}),p=n=>e({...d,value:o,children:()=>({component:t,props:{dictionaryKey:d.dictionaryKey,keyPath:d.keyPath,...n},children:()=>{let{renderMarkdown:e}=r();return e(o,n)}}),additionalProps:{metadata:f}}),m=(e,t)=>new Proxy(e,{get(e,r,a){return r===`value`?o:r===`metadata`?f:r===`toString`||r===Symbol.toPrimitive?()=>i(o,{runtime:t?s(n,t):n}):r===`use`?e=>{let n={...t,...e};return m(p(n),n)}:Reflect.get(e,r,a)}});return m(p())}},u={id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.Markdown,transform:(e,t,n)=>{let r=[...t.keyPath,{type:o.Markdown}],i=e[o.Markdown];return n(i,{...t,children:i,keyPath:r,plugins:[l,...t.plugins??[]]})}},d={id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.HTML,transform:(r,a)=>{let c=r[o.HTML],{plugins:l,...u}=a,d=n=>e({...u,value:c,children:()=>({component:t,props:{dictionaryKey:u.dictionaryKey,keyPath:u.keyPath,...n},children:c})}),f=(e,t)=>new Proxy(e,{get(e,r,a){return r===`value`?c:r===`toString`||r===Symbol.toPrimitive?()=>!t||typeof t==`object`&&Object.keys(t).length===0?String(c):i(c,{runtime:s(n,t)}):r===`use`?e=>{let n={...t,...e};return f(d(n),n)}:Reflect.get(e,r,a)}});return f(d())}},f={id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===o.Insertion,transform:(t,n)=>{let{plugins:r,...i}=n,a=(e={})=>{let n=t.insertion;return e&&Object.entries(e).forEach(([e,t])=>{n=n.replace(RegExp(`{{\\s*${e}\\s*}}`,`g`),String(t))}),n};return e({...i,value:a,children:a})}};export{d as htmlPlugin,f as insertionPlugin,c as intlayerNodePlugins,u as markdownPlugin,l as markdownStringPlugin};
|
|
2
2
|
//# sourceMappingURL=plugins.mjs.map
|
package/dist/esm/plugins.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import type {\n DeepTransformContent as DeepTransformContentCore,\n IInterpreterPluginState as IInterpreterPluginStateCore,\n Plugins,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport {\n type DeclaredLocales,\n type KeyPath,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/plugins.ts"],"sourcesContent":["import type {\n DeepTransformContent as DeepTransformContentCore,\n IInterpreterPluginState as IInterpreterPluginStateCore,\n Plugins,\n} from '@intlayer/core/interpreter';\nimport {\n compile,\n getMarkdownMetadata,\n type MarkdownContent,\n} from '@intlayer/core/markdown';\nimport type { HTMLContent, InsertionContent } from '@intlayer/core/transpiler';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { ContentSelectorWrapperComponent } from './editor';\nimport { htmlRuntime, useMarkdown } from './markdown/installIntlayerMarkdown';\nimport { renderIntlayerNode } from './renderIntlayerNode';\n\n/** ---------------------------------------------\n * UTILS\n * --------------------------------------------- */\n\nconst createRuntimeWithOverides = (baseRuntime: any, overrides: any) => ({\n ...baseRuntime,\n createElement: (tag: string, props: any, ...children: any[]) => {\n const override = overrides?.[tag];\n\n if (override) {\n const newProps = { ...props, ...override };\n\n // Merge class attributes intelligently\n const originalClass = props?.class || props?.className;\n const overrideClass = override.class || override.className;\n\n if (originalClass && overrideClass) {\n newProps.class = `${originalClass} ${overrideClass}`;\n newProps.className = undefined;\n }\n\n return baseRuntime.createElement(tag, newProps, ...children);\n }\n\n return baseRuntime.createElement(tag, props, ...children);\n },\n});\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\nexport interface IntlayerNode<T, P = {}> {\n value: T;\n children?: any;\n additionalProps?: P;\n}\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n id: 'intlayer-node-plugin',\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (_node, { children, ...rest }) =>\n renderIntlayerNode({\n ...rest,\n value: children,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n },\n children: children,\n }),\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownStringCond<T> = T extends string\n ? IntlayerNode<string, { metadata: DeepTransformContent<string> }>\n : never;\n\n/** Markdown string plugin. Replaces string node with a component that render the markdown. */\nexport const markdownStringPlugin: Plugins = {\n id: 'markdown-string-plugin',\n canHandle: (node) => typeof node === 'string',\n transform: (node: string, props, deepTransformNode) => {\n const {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n } = props;\n\n const metadata = getMarkdownMetadata(node);\n\n const metadataPlugins: Plugins = {\n id: 'markdown-metadata-plugin',\n canHandle: (metadataNode) =>\n typeof metadataNode === 'string' ||\n typeof metadataNode === 'number' ||\n typeof metadataNode === 'boolean' ||\n !metadataNode,\n transform: (metadataNode, props) =>\n renderIntlayerNode({\n ...props,\n value: metadataNode,\n children: node,\n }),\n };\n\n // Transform metadata while keeping the same structure\n const metadataNodes = deepTransformNode(metadata, {\n plugins: [metadataPlugins],\n dictionaryKey: rest.dictionaryKey,\n keyPath: [],\n });\n\n const render = (components?: any) =>\n renderIntlayerNode({\n ...rest,\n value: node,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...components,\n },\n children: () => {\n const { renderMarkdown } = useMarkdown();\n return renderMarkdown(node, components);\n },\n }),\n additionalProps: {\n metadata: metadataNodes,\n },\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return node;\n }\n if (prop === 'metadata') {\n return metadataNodes;\n }\n\n if (prop === 'toString') {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n const runtime = components\n ? createRuntimeWithOverides(htmlRuntime, components)\n : htmlRuntime;\n return compile(node, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n return (newComponents?: any) => {\n const mergedComponents = { ...components, ...newComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\nexport type MarkdownCond<T, _S, _L extends LocalesValues> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: infer M;\n tags?: infer U;\n metadata?: infer V;\n}\n ? IntlayerNode<\n M,\n {\n use: (components?: Record<keyof U, any>) => any;\n metadata: DeepTransformContent<V>;\n }\n >\n : never;\n\nexport const markdownPlugin: Plugins = {\n id: 'markdown-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const newKeyPath: KeyPath[] = [\n ...props.keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const children = node[NodeType.Markdown];\n\n return deepTransformNode(children, {\n ...props,\n children,\n keyPath: newKeyPath,\n plugins: [markdownStringPlugin, ...(props.plugins ?? [])],\n });\n },\n};\n\n/** ---------------------------------------------\n * HTML PLUGIN\n * --------------------------------------------- */\n\n/**\n * HTML conditional type.\n *\n * This ensures type safety:\n * - `html('<div>Hello <CustomComponent /></div>').use({ CustomComponent: ... })` - optional but typed\n */\nexport type HTMLPluginCond<T, _S, _L> = T extends {\n nodeType: NodeType | string;\n [NodeType.HTML]: infer I;\n tags?: infer U;\n}\n ? IntlayerNode<\n I,\n {\n use: (components?: Record<keyof U, any>) => any;\n }\n >\n : never;\n\n/** HTML plugin. Replaces node with a function that takes components => IntlayerNode. */\nexport const htmlPlugin: Plugins = {\n id: 'html-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.HTML,\n\n transform: (node: HTMLContent<string>, props) => {\n const html = node[NodeType.HTML];\n const { plugins, ...rest } = props;\n\n // Type-safe render function that accepts properly typed components\n const render = (userComponents?: any) =>\n renderIntlayerNode({\n ...rest,\n value: html,\n children: () => ({\n component: ContentSelectorWrapperComponent,\n props: {\n dictionaryKey: rest.dictionaryKey,\n keyPath: rest.keyPath,\n ...userComponents,\n },\n children: html,\n }),\n });\n\n const createProxy = (element: any, components?: any) =>\n new Proxy(element, {\n get(target, prop, receiver) {\n if (prop === 'value') {\n return html;\n }\n\n if (prop === 'toString') {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === Symbol.toPrimitive) {\n return () => {\n if (\n !components ||\n (typeof components === 'object' &&\n Object.keys(components).length === 0)\n ) {\n return String(html);\n }\n const runtime = createRuntimeWithOverides(\n htmlRuntime,\n components\n );\n return compile(html, {\n runtime,\n }) as string;\n };\n }\n\n if (prop === 'use') {\n // Return a properly typed function based on custom components\n return (userComponents?: any) => {\n const mergedComponents = { ...components, ...userComponents };\n return createProxy(render(mergedComponents), mergedComponents);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n }) as any;\n\n return createProxy(render() as any);\n },\n};\n\n/** ---------------------------------------------\n * INSERTION PLUGIN\n * --------------------------------------------- */\n\n/**\n * Insertion conditional type.\n */\nexport type InsertionPluginCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Insertion]: infer _I;\n}\n ? (args: Record<string, string | number>) => string\n : never;\n\nexport const insertionPlugin: Plugins = {\n id: 'insertion-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props) => {\n const { plugins, ...rest } = props;\n\n // Return a function that performs the interpolation\n const render = (args: Record<string, string | number> = {}) => {\n let text = node.insertion as string;\n if (args) {\n Object.entries(args).forEach(([key, value]) => {\n text = text.replace(\n new RegExp(`{{\\\\s*${key}\\\\s*}}`, 'g'),\n String(value)\n );\n });\n }\n return text;\n };\n\n return renderIntlayerNode({\n ...rest,\n value: render as any,\n children: render,\n });\n },\n};\n\nexport interface IInterpreterPluginAngular<T, S, L extends LocalesValues> {\n angularIntlayerNode: IntlayerNodeCond<T>;\n angularMarkdown: MarkdownCond<T, S, L>;\n angularHtml: HTMLPluginCond<T, S, L>;\n angularInsertion: InsertionPluginCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `angular-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = Omit<\n IInterpreterPluginStateCore,\n 'insertion' // Remove insertion type from core package\n> & {\n angularIntlayerNode: true;\n angularMarkdown: true;\n angularHtml: true;\n angularInsertion: true;\n};\n\nexport type DeepTransformContent<\n T,\n L extends LocalesValues = DeclaredLocales,\n> = DeepTransformContentCore<T, IInterpreterPluginState, L>;\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeConfig.mjs","names":[],"sources":["../../../src/webpack/mergeConfig.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { IntlayerPlugin } from '@intlayer/webpack'; // adjust path if needed\nimport { defu } from 'defu';\
|
|
1
|
+
{"version":3,"file":"mergeConfig.mjs","names":[],"sources":["../../../src/webpack/mergeConfig.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { IntlayerPlugin } from '@intlayer/webpack'; // adjust path if needed\nimport { defu } from 'defu';\nimport type { Configuration as WebpackConfig } from 'webpack';\n\nexport const mergeConfig = (baseConfig: WebpackConfig): WebpackConfig => {\n const intlayerConfig = getConfiguration();\n\n const config = {\n resolve: {\n alias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n },\n externals: {\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n },\n module: {\n rules: [\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n\n // Fix `import _48DQ2FD8DPGT8SPgqAmt from '../dictionary/app.json' with { type: 'json' };` syntax\n {\n test: /\\.mjs$/,\n include: [/[\\\\/]\\.intlayer[\\\\/]/],\n type: 'javascript/auto',\n enforce: 'pre',\n use: {\n loader: 'babel-loader',\n options: {\n presets: [['@babel/preset-env', { modules: 'commonjs' }]],\n plugins: [\n [\n '@babel/plugin-syntax-import-attributes',\n { deprecatedAssert: true },\n ],\n ],\n },\n },\n },\n ],\n },\n plugins: [new IntlayerPlugin(intlayerConfig)],\n };\n\n return defu(config, baseConfig) as WebpackConfig;\n};\n"],"mappings":"8NAOA,MAAa,EAAe,GAA6C,CACvE,IAAM,EAAiB,GAAkB,CA+CzC,OAAO,EA7CQ,CACb,QAAS,CACP,MAAO,EAAS,CACd,cAAe,EACf,UAAY,GAAkB,EAAQ,EAAM,CAC7C,CAAC,CACH,CACD,UAAW,CACT,QAAS,UACT,OAAQ,SACR,GAAI,KACJ,SAAU,WACV,SAAU,WACX,CACD,OAAQ,CACN,MAAO,CACL,CACE,KAAM,UACN,OAAQ,cACT,CAGD,CACE,KAAM,SACN,QAAS,CAAC,uBAAuB,CACjC,KAAM,kBACN,QAAS,MACT,IAAK,CACH,OAAQ,eACR,QAAS,CACP,QAAS,CAAC,CAAC,oBAAqB,CAAE,QAAS,WAAY,CAAC,CAAC,CACzD,QAAS,CACP,CACE,yCACA,CAAE,iBAAkB,GAAM,CAC3B,CACF,CACF,CACF,CACF,CACF,CACF,CACD,QAAS,CAAC,IAAI,EAAe,EAAe,CAAC,CAC9C,CAEmB,EAAW"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _angular_core0 from "@angular/core";
|
|
2
2
|
import { InjectionToken, Signal } from "@angular/core";
|
|
3
|
-
import { LocalesValues } from "@intlayer/types";
|
|
3
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
4
|
|
|
5
5
|
//#region src/client/installIntlayer.d.ts
|
|
6
6
|
declare const INTLAYER_TOKEN: InjectionToken<IntlayerProvider>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DeepTransformContent } from "../plugins.js";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
import {
|
|
3
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
5
|
|
|
5
6
|
//#region src/client/useDictionary.d.ts
|
|
6
7
|
declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => Signal<DeepTransformContent<T["content"]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/client/useDictionary.ts"],"mappings":";;;;;;cAOa,aAAA,aAA2B,UAAA,EACtC,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,aAAA,KACR,MAAA,CAAO,oBAAA,CAAqB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _angular_core0 from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
4
|
|
|
4
5
|
//#region src/client/useDictionaryAsync.d.ts
|
|
5
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/client/useDictionaryAsync.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.d.ts","names":[],"sources":["../../../src/client/useDictionaryAsync.ts"],"mappings":";;;;;;;;AAcA;;cAAa,kBAAA,aAAsC,UAAA,EACjD,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,MAAA,GAAS,aAAA,KAAa,OAAA,CAAA,cAAA,CAAA,MAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
|
|
2
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
3
|
import * as _angular_core0 from "@angular/core";
|
|
3
|
-
import
|
|
4
|
-
import { Dictionary
|
|
4
|
+
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
5
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
5
6
|
import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
6
7
|
|
|
7
8
|
//#region src/client/useDictionaryDynamic.d.ts
|
|
@@ -10,7 +11,7 @@ import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
|
10
11
|
*
|
|
11
12
|
* If the locale is not provided, it will use the locale from the client context
|
|
12
13
|
*/
|
|
13
|
-
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1,
|
|
14
|
+
declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, locale?: LocalesValues) => _angular_core0.Signal<_intlayer_core_interpreter0.DeepTransformContent<T["content"], IInterpreterPluginState$1, Locale>>;
|
|
14
15
|
//#endregion
|
|
15
16
|
export { useDictionaryDynamic };
|
|
16
17
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/client/useDictionaryDynamic.ts"],"mappings":";;;;;;;;;;;;;cAea,oBAAA,aACD,UAAA,YACA,cAAA,EAEV,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KAAa,cAAA,CAAA,MAAA,CAAA,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,yBAAA,EAAA,MAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepTransformContent } from "../plugins.js";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
import { DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types";
|
|
3
|
+
import { DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
4
|
|
|
5
5
|
//#region src/client/useIntlayer.d.ts
|
|
6
6
|
/** guard utility - true only for objects generated by `renderIntlayerNode()` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","names":[],"sources":["../../../src/client/useIntlayer.ts"],"mappings":";;;;;;cAOa,eAAA,GACX,GAAA,cACC,GAAA;EAAS,QAAA,GAAW,CAAA;AAAA;;;;;;;;;AA8BvB;;;;;;;;;;;;;;;;;cAAa,WAAA,aAAyB,cAAA,YAA0B,aAAA,EAC9D,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,aAAA,KACR,MAAA,CAAO,oBAAA,CAAqB,yBAAA,CAA0B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import * as _angular_core0 from "@angular/core";
|
|
2
|
-
import
|
|
3
|
-
import { LocalesValues } from "@intlayer/types";
|
|
3
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
4
4
|
|
|
5
5
|
//#region src/client/useLocale.d.ts
|
|
6
6
|
type useLocaleProps = {
|
|
@@ -38,9 +38,9 @@ declare const useLocale: ({
|
|
|
38
38
|
isCookieEnabled,
|
|
39
39
|
onLocaleChange
|
|
40
40
|
}?: useLocaleProps) => {
|
|
41
|
-
locale: _angular_core0.Signal<"af" | "af-ZA" | "ar" | "ar-
|
|
42
|
-
defaultLocale:
|
|
43
|
-
availableLocales:
|
|
41
|
+
locale: _angular_core0.Signal<"af" | "af-ZA" | "sq" | "sq-AL" | "am" | "am-ET" | "ar" | "ar-DZ" | "ar-BH" | "ar-TD" | "ar-KM" | "ar-DJ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MR" | "ar-MA" | "ar-OM" | "ar-PS" | "ar-QA" | "ar-SA" | "ar-SO" | "ar-SD" | "ar-SY" | "ar-TN" | "ar-AE" | "ar-YE" | "hy" | "hy-AM" | "az" | "az-AZ" | "eu" | "eu-ES" | "be" | "be-BY" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "bs" | "bs-BA" | "bg" | "bg-BG" | "my" | "my-MM" | "ca" | "ca-ES" | "zh" | "zh-HK" | "zh-MO" | "zh-Hans" | "zh-CN" | "zh-SG" | "zh-TW" | "zh-Hant" | "hr" | "hr-BA" | "hr-HR" | "cs" | "cs-CZ" | "da" | "da-DK" | "dv" | "dv-MV" | "nl" | "nl-BE" | "nl-NL" | "en" | "en-AU" | "en-BZ" | "en-BW" | "en-CA" | "en-CB" | "en-GH" | "en-HK" | "en-IN" | "en-IE" | "en-JM" | "en-KE" | "en-MY" | "en-NZ" | "en-NG" | "en-PK" | "en-PH" | "en-SG" | "en-ZA" | "en-TZ" | "en-TT" | "en-UG" | "en-GB" | "en-US" | "en-ZW" | "eo" | "et" | "et-EE" | "fo" | "fo-FO" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fr" | "fr-BE" | "fr-CA" | "fr-FR" | "fr-LU" | "fr-MC" | "fr-CH" | "mk" | "mk-MK" | "gl" | "gl-ES" | "ka" | "ka-GE" | "de" | "de-AT" | "de-DE" | "de-LI" | "de-LU" | "de-CH" | "el" | "el-GR" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hu" | "hu-HU" | "is" | "is-IS" | "id" | "id-ID" | "ga" | "ga-IE" | "it" | "it-IT" | "it-CH" | "ja" | "ja-JP" | "kn" | "kn-IN" | "kk" | "kk-KZ" | "km" | "km-KH" | "kok" | "kok-IN" | "ko" | "ko-KR" | "ku" | "ku-TR" | "ky" | "ky-KG" | "lo" | "lo-LA" | "lv" | "lv-LV" | "lt" | "lt-LT" | "dsb" | "dsb-DE" | "mg-MG" | "ms" | "ml" | "ml-IN" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "mi" | "mi-NZ" | "mr" | "mr-IN" | "mn" | "mn-MN" | "ne" | "ne-NP" | "ns" | "ns-ZA" | "no" | "nb" | "nb-NO" | "nn" | "nn-NO" | "ps" | "ps-AR" | "pl" | "pl-PL" | "pt" | "pt-BR" | "pt-CV" | "pt-GW" | "pt-MO" | "pt-MZ" | "pt-PT" | "pt-ST" | "pt-TL" | "pa" | "pa-IN" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-MD" | "ro-RO" | "rm" | "rm-CH" | "ru" | "ru-MD" | "ru-RU" | "se" | "se-FI" | "se-NO" | "se-SE" | "sa" | "sa-IN" | "gd" | "gd-GB" | "sr-Cyrl" | "sr-BA" | "sr-RS" | "sr" | "sr-SP" | "si" | "si-LK" | "sk" | "sk-SK" | "sl" | "sl-SI" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-CU" | "es-DO" | "es-EC" | "es-SV" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PY" | "es-PE" | "es-PR" | "es-ES" | "es-US" | "es-UY" | "es-VE" | "sw" | "sw-KE" | "sv" | "sv-FI" | "sv-SE" | "syr" | "syr-SY" | "tl" | "tl-PH" | "ta" | "ta-IN" | "tt" | "tt-RU" | "te" | "te-IN" | "th" | "th-TH" | "ts" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "uk" | "uk-UA" | "hsb" | "hsb-DE" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "ve" | "ve-ZA" | "vi" | "vi-VN" | "cy" | "cy-GB" | "xh" | "xh-ZA" | "yi" | "yi-001" | "yo" | "yo-NG" | "zu" | "zu-ZA" | (string & {})>;
|
|
42
|
+
defaultLocale: Locale;
|
|
43
|
+
availableLocales: Locale[];
|
|
44
44
|
setLocale: (newLocale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;KAMK,cAAA;EACH,eAAA;EACA,cAAA,IAAkB,MAAA,EAAQ,aAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;KAMK,cAAA;EACH,eAAA;EACA,cAAA,IAAkB,MAAA,EAAQ,aAAA;AAAA;AAN6C;;;;;;;;;;AAoCzE;;;;;;;;;;;;;;;;;AApCyE,cAoC5D,SAAA;EAAa,eAAA;EAAA;AAAA,IAGvB,cAAA;UAAmB,cAAA,CAAA,MAAA;;;yBAWU,aAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LocalesValues } from "@intlayer/types";
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
2
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.d.ts
|
|
5
5
|
/**
|
|
@@ -8,13 +8,13 @@ import { LocalesValues } from "@intlayer/types";
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
declare const localeInStorage:
|
|
11
|
+
declare const localeInStorage: Locale;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use localeInStorage instead
|
|
14
14
|
*
|
|
15
15
|
* Get the locale cookie
|
|
16
16
|
*/
|
|
17
|
-
declare const localeCookie:
|
|
17
|
+
declare const localeCookie: Locale;
|
|
18
18
|
/**
|
|
19
19
|
* Set the locale cookie
|
|
20
20
|
*/
|
|
@@ -29,7 +29,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
|
|
|
29
29
|
* Hook that provides the locale storage and a function to set it
|
|
30
30
|
*/
|
|
31
31
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
32
|
-
getLocale: () =>
|
|
32
|
+
getLocale: () => Locale;
|
|
33
33
|
setLocale: (locale: LocalesValues) => void;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
@@ -40,7 +40,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
40
40
|
* Hook that provides the locale cookie and a function to set it
|
|
41
41
|
*/
|
|
42
42
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
43
|
-
localeCookie:
|
|
43
|
+
localeCookie: Locale;
|
|
44
44
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAA4D,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;AAcA;;;AAAA,cAAa,eAAA,EAA4D,MAAA;;AAMzE;;;;cAAa,YAAA,EAA8B,MAAA;AAK3C;;;AAAA,cAAa,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;;cAkBV,gBAAA,GAAoB,eAAA;mBAI7B,MAAA;sBAAA,aAAA;AAAA;;AAJJ;;;;;;cAaa,eAAA,GAAmB,eAAA;gBAO/B,MAAA;4BAAA,aAAA;AAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _angular_core0 from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { Locale } from "@intlayer/types/allLocales";
|
|
3
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
3
4
|
|
|
4
5
|
//#region src/editor/EditedContentRenderer.component.d.ts
|
|
5
6
|
interface EditedContentRendererProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentRenderer.component.d.ts","names":[],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditedContentRenderer.component.d.ts","names":[],"sources":["../../../src/editor/EditedContentRenderer.component.ts"],"mappings":";;;;;UAQiB,0BAAA;EACf,aAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,GAAS,MAAA;AAAA;AAAA,cASE,8BAAA;EACF,aAAA;EACA,OAAA,EAAU,OAAA;EACV,MAAA,GAAS,MAAA;EAAA,QAEV,QAAA;EAAA,QAEA,UAAA;EAhBC;;;EA2BT,eAAA,EAfwB,cAAA,CAeT,MAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injector, Signal } from "@angular/core";
|
|
2
|
-
import { Dictionary } from "@intlayer/types";
|
|
2
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
3
|
|
|
4
4
|
//#region src/editor/dictionariesRecord.d.ts
|
|
5
5
|
type DictionaryContent = Record<Dictionary['key'], Dictionary>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Injector, Signal } from "@angular/core";
|
|
2
|
-
import { ContentNode, Dictionary,
|
|
2
|
+
import { ContentNode, Dictionary, LocalDictionaryId } from "@intlayer/types/dictionary";
|
|
3
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
3
4
|
|
|
4
5
|
//#region src/editor/editedContent.d.ts
|
|
5
6
|
type EditedContent = Record<Dictionary['key'], Dictionary>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editedContent.d.ts","names":[],"sources":["../../../src/editor/editedContent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"editedContent.d.ts","names":[],"sources":["../../../src/editor/editedContent.ts"],"mappings":";;;;;KAQY,aAAA,GAAgB,MAAA,CAAO,UAAA,SAAmB,UAAA;AAAA,KAEjD,mBAAA;EACH,aAAA,EAAe,MAAA,CAAO,aAAA;EACtB,gBAAA,GAAmB,aAAA,EAAe,aAAA;EAClC,qBAAA,GACE,sBAAA,EAAwB,iBAAA,GAAoB,UAAA,kBAC5C,OAAA,EAAS,OAAA,OACN,WAAA;AAAA;;;;cAaM,yBAAA,QAAyB,mBAAA;;;;cAuDzB,oBAAA,GAAwB,SAAA,EAAW,QAAA;AAAA,cAOnC,gBAAA,QAAgB,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorLocale.d.ts","names":[],"sources":["../../../src/editor/editorLocale.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"editorLocale.d.ts","names":[],"sources":["../../../src/editor/editorLocale.ts"],"mappings":";;cAQa,eAAA,QAAe,gBAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DeclaredLocales,
|
|
1
|
+
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
2
3
|
import * as _intlayer_core_interpreter0 from "@intlayer/core/interpreter";
|
|
3
4
|
import { Plugins } from "@intlayer/core/interpreter";
|
|
4
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;cAQa,aAAA,aACD,UAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,UAAA,EAAY,CAAA,EACZ,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAAS,2BAAA,CAAA,oBAAA,CAAA,CAAA,aAAA,2BAAA,CAAA,uBAAA,EAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeepTransformContent as DeepTransformContent$1 } from "./plugins.js";
|
|
2
|
-
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types";
|
|
2
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
3
|
import { Plugins } from "@intlayer/core/interpreter";
|
|
4
4
|
|
|
5
5
|
//#region src/getIntlayer.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../src/getIntlayer.ts"],"mappings":";;;;;cAaa,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,EACT,iBAAA,GAAoB,OAAA,OAWkC,sBAAA,CACpD,yBAAA,CAA0B,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { useIntl } from "./client/useIntl.js";
|
|
|
10
10
|
import { isUpdatableNode, useIntlayer } from "./client/useIntlayer.js";
|
|
11
11
|
import { useLoadDynamic } from "./client/useLoadDynamic.js";
|
|
12
12
|
import { useLocale } from "./client/useLocale.js";
|
|
13
|
-
import { LocalesValues } from "@intlayer/types";
|
|
13
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
14
14
|
|
|
15
15
|
//#region src/index.d.ts
|
|
16
16
|
declare module '@intlayer/core/interpreter' {
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DeclaredLocales, LocalesValues
|
|
1
|
+
import { DeclaredLocales, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
2
|
import { DeepTransformContent as DeepTransformContent$1, IInterpreterPluginState as IInterpreterPluginState$1, Plugins } from "@intlayer/core/interpreter";
|
|
3
|
+
import { NodeType } from "@intlayer/types/nodeType";
|
|
3
4
|
|
|
4
5
|
//#region src/plugins.d.ts
|
|
5
6
|
/** ---------------------------------------------
|