angular-intlayer 7.5.0-canary.1 → 7.5.0
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/UI/ContentSelector.component.cjs +15 -15
- package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
- package/dist/cjs/client/installIntlayer.cjs +7 -7
- package/dist/cjs/client/installIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs +4 -4
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +5 -5
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +5 -5
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +4 -4
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useLoadDynamic.cjs +2 -2
- package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +7 -7
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +6 -6
- package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +12 -12
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
- package/dist/cjs/editor/EditedContentRenderer.component.cjs +12 -12
- package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +6 -6
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/communicator.cjs +3 -3
- package/dist/cjs/editor/configuration.cjs +7 -7
- package/dist/cjs/editor/configuration.cjs.map +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +2 -2
- package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs +5 -5
- package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
- package/dist/cjs/editor/editedContent.cjs +9 -9
- package/dist/cjs/editor/editedContent.cjs.map +1 -1
- package/dist/cjs/editor/editorEnabled.cjs +7 -7
- package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
- package/dist/cjs/editor/editorLocale.cjs +5 -5
- package/dist/cjs/editor/editorLocale.cjs.map +1 -1
- package/dist/cjs/editor/focusDictionary.cjs +6 -6
- package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
- package/dist/cjs/editor/installIntlayerEditor.cjs +3 -3
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +4 -4
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
- package/dist/cjs/editor/useCrossFrameState.cjs +2 -2
- package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
- package/dist/cjs/editor/useCrossURLPathState.cjs +4 -4
- package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +6 -6
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +5 -5
- package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
- package/dist/cjs/getDictionary.cjs +2 -2
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +2 -2
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs +5 -5
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +6 -6
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/webpack/mergeConfig.cjs +5 -5
- package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
- package/dist/types/client/installIntlayer.d.ts +2 -2
- package/dist/types/client/useLocale.d.ts +2 -2
- package/dist/types/editor/ContentSelectorWrapper.component.d.ts +3 -3
- package/dist/types/editor/EditedContentRenderer.component.d.ts +2 -2
- package/dist/types/editor/useCrossURLPathState.d.ts +3 -3
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
3
|
-
let
|
|
2
|
+
let _angular_common = require("@angular/common");
|
|
3
|
+
let _angular_core = require("@angular/core");
|
|
4
4
|
|
|
5
5
|
//#region src/UI/ContentSelector.component.ts
|
|
6
6
|
const DEFAULT_PRESS_DETECT_DURATION = 250;
|
|
7
|
-
var ContentSelectorComponent = @((0,
|
|
7
|
+
var ContentSelectorComponent = @((0, _angular_core.Component)({
|
|
8
8
|
selector: "app-content-selector",
|
|
9
9
|
template: `
|
|
10
10
|
<span
|
|
@@ -26,19 +26,19 @@ var ContentSelectorComponent = @((0, __angular_core.Component)({
|
|
|
26
26
|
</span>
|
|
27
27
|
`,
|
|
28
28
|
standalone: true,
|
|
29
|
-
imports: [
|
|
29
|
+
imports: [_angular_common.CommonModule]
|
|
30
30
|
})) class {
|
|
31
|
-
@((0,
|
|
32
|
-
@((0,
|
|
33
|
-
@((0,
|
|
34
|
-
@((0,
|
|
35
|
-
@((0,
|
|
36
|
-
@((0,
|
|
37
|
-
isHovered = (0,
|
|
38
|
-
isSelectingState = (0,
|
|
31
|
+
@((0, _angular_core.Input)()) onClickOutside;
|
|
32
|
+
@((0, _angular_core.Input)()) pressDuration;
|
|
33
|
+
@((0, _angular_core.Input)()) isSelecting;
|
|
34
|
+
@((0, _angular_core.Output)()) click = new _angular_core.EventEmitter();
|
|
35
|
+
@((0, _angular_core.Output)()) press = new _angular_core.EventEmitter();
|
|
36
|
+
@((0, _angular_core.ViewChild)("containerRef", { static: true })) containerRef;
|
|
37
|
+
isHovered = (0, _angular_core.signal)(false);
|
|
38
|
+
isSelectingState = (0, _angular_core.signal)(false);
|
|
39
39
|
pressTimerRef = null;
|
|
40
|
-
isSelectingComputed = (0,
|
|
41
|
-
isStringSlot = (0,
|
|
40
|
+
isSelectingComputed = (0, _angular_core.computed)(() => this.isSelecting ?? this.isSelectingState());
|
|
41
|
+
isStringSlot = (0, _angular_core.computed)(() => {
|
|
42
42
|
return true;
|
|
43
43
|
});
|
|
44
44
|
ngOnInit() {
|
|
@@ -47,7 +47,7 @@ var ContentSelectorComponent = @((0, __angular_core.Component)({
|
|
|
47
47
|
ngOnDestroy() {
|
|
48
48
|
this.clearPressTimer();
|
|
49
49
|
}
|
|
50
|
-
@((0,
|
|
50
|
+
@((0, _angular_core.HostListener)("document:mousedown", ["$event"])) onDocumentMouseDown(event) {
|
|
51
51
|
this.handleClickOutside(event);
|
|
52
52
|
}
|
|
53
53
|
handleOnLongPress() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelector.component.cjs","names":["CommonModule","EventEmitter"],"sources":["../../../src/UI/ContentSelector.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n computed,\n type ElementRef,\n EventEmitter,\n HostListener,\n Input,\n type OnDestroy,\n type OnInit,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 250;\n\n@Component({\n selector: 'app-content-selector',\n template: `\n <span\n #containerRef\n role=\"button\"\n tabindex=\"0\"\n (click)=\"handleClick($event)\"\n (mousedown)=\"handleMouseDown()\"\n (mouseup)=\"handleMouseUp()\"\n (mouseleave)=\"handleMouseUp()\"\n (touchstart)=\"handleMouseDown()\"\n (touchend)=\"handleMouseUp()\"\n (touchcancel)=\"handleMouseUp()\"\n (blur)=\"handleBlur()\"\n (mouseenter)=\"onMouseEnter()\"\n [ngStyle]=\"getContainerStyle()\"\n >\n <ng-content></ng-content>\n </span>\n `,\n standalone: true,\n imports: [CommonModule],\n})\nexport class ContentSelectorComponent implements OnInit, OnDestroy {\n @Input() onClickOutside?: () => void;\n @Input() pressDuration?: number;\n @Input() isSelecting?: boolean;\n\n @Output() click = new EventEmitter<MouseEvent>();\n @Output() press = new EventEmitter<void>();\n\n @ViewChild('containerRef', { static: true })\n containerRef!: ElementRef<HTMLSpanElement>;\n\n private isHovered = signal(false);\n private isSelectingState = signal(false);\n private pressTimerRef: ReturnType<typeof setTimeout> | null = null;\n\n private readonly isSelectingComputed = computed(\n () => this.isSelecting ?? this.isSelectingState()\n );\n\n private readonly isStringSlot = computed(() => {\n // In Angular, we can't easily detect if content is just text\n // This would need to be determined differently or simplified\n return true; // Simplified for now\n });\n\n ngOnInit(): void {\n this.isSelectingState.set(this.isSelecting ?? false);\n }\n\n ngOnDestroy(): void {\n this.clearPressTimer();\n }\n\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(event: MouseEvent): void {\n this.handleClickOutside(event);\n }\n\n private handleOnLongPress(): void {\n this.isSelectingState.set(true);\n this.press.emit();\n }\n\n private startPressTimer(): void {\n this.pressTimerRef = setTimeout(() => {\n this.handleOnLongPress();\n }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);\n }\n\n private clearPressTimer(): void {\n if (this.pressTimerRef) {\n clearTimeout(this.pressTimerRef);\n this.pressTimerRef = null;\n }\n }\n\n handleMouseDown(): void {\n this.clearPressTimer();\n this.startPressTimer();\n }\n\n handleMouseUp(): void {\n this.isHovered.set(false);\n this.clearPressTimer();\n }\n\n private handleClickOutside(event: MouseEvent): void {\n if (\n this.containerRef?.nativeElement &&\n !this.containerRef.nativeElement.contains(event.target as Node)\n ) {\n this.isSelectingState.set(false);\n this.onClickOutside?.();\n }\n }\n\n handleClick(e: MouseEvent): void {\n if (this.isSelectingComputed()) {\n e.preventDefault();\n e.stopPropagation();\n }\n this.click.emit(e);\n }\n\n handleBlur(): void {\n this.isSelectingState.set(false);\n }\n\n onMouseEnter(): void {\n this.isHovered.set(true);\n }\n\n getContainerStyle(): { [key: string]: any } {\n return {\n display: this.isStringSlot() ? 'inline' : 'inline-block',\n cursor: 'pointer',\n userSelect: 'none',\n borderRadius: '0.375rem',\n outlineWidth: '2px',\n outlineOffset: '4px',\n outlineStyle: 'solid',\n outlineColor:\n this.isSelectingComputed() || this.isHovered()\n ? 'inherit'\n : 'transparent',\n transition: 'all 100ms 50ms ease-in-out',\n };\n }\n}\n"],"mappings":";;;;;AAeA,MAAM,gCAAgC;AA0BtC,IAAa,2BAxBb
|
|
1
|
+
{"version":3,"file":"ContentSelector.component.cjs","names":["CommonModule","EventEmitter"],"sources":["../../../src/UI/ContentSelector.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n computed,\n type ElementRef,\n EventEmitter,\n HostListener,\n Input,\n type OnDestroy,\n type OnInit,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 250;\n\n@Component({\n selector: 'app-content-selector',\n template: `\n <span\n #containerRef\n role=\"button\"\n tabindex=\"0\"\n (click)=\"handleClick($event)\"\n (mousedown)=\"handleMouseDown()\"\n (mouseup)=\"handleMouseUp()\"\n (mouseleave)=\"handleMouseUp()\"\n (touchstart)=\"handleMouseDown()\"\n (touchend)=\"handleMouseUp()\"\n (touchcancel)=\"handleMouseUp()\"\n (blur)=\"handleBlur()\"\n (mouseenter)=\"onMouseEnter()\"\n [ngStyle]=\"getContainerStyle()\"\n >\n <ng-content></ng-content>\n </span>\n `,\n standalone: true,\n imports: [CommonModule],\n})\nexport class ContentSelectorComponent implements OnInit, OnDestroy {\n @Input() onClickOutside?: () => void;\n @Input() pressDuration?: number;\n @Input() isSelecting?: boolean;\n\n @Output() click = new EventEmitter<MouseEvent>();\n @Output() press = new EventEmitter<void>();\n\n @ViewChild('containerRef', { static: true })\n containerRef!: ElementRef<HTMLSpanElement>;\n\n private isHovered = signal(false);\n private isSelectingState = signal(false);\n private pressTimerRef: ReturnType<typeof setTimeout> | null = null;\n\n private readonly isSelectingComputed = computed(\n () => this.isSelecting ?? this.isSelectingState()\n );\n\n private readonly isStringSlot = computed(() => {\n // In Angular, we can't easily detect if content is just text\n // This would need to be determined differently or simplified\n return true; // Simplified for now\n });\n\n ngOnInit(): void {\n this.isSelectingState.set(this.isSelecting ?? false);\n }\n\n ngOnDestroy(): void {\n this.clearPressTimer();\n }\n\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(event: MouseEvent): void {\n this.handleClickOutside(event);\n }\n\n private handleOnLongPress(): void {\n this.isSelectingState.set(true);\n this.press.emit();\n }\n\n private startPressTimer(): void {\n this.pressTimerRef = setTimeout(() => {\n this.handleOnLongPress();\n }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);\n }\n\n private clearPressTimer(): void {\n if (this.pressTimerRef) {\n clearTimeout(this.pressTimerRef);\n this.pressTimerRef = null;\n }\n }\n\n handleMouseDown(): void {\n this.clearPressTimer();\n this.startPressTimer();\n }\n\n handleMouseUp(): void {\n this.isHovered.set(false);\n this.clearPressTimer();\n }\n\n private handleClickOutside(event: MouseEvent): void {\n if (\n this.containerRef?.nativeElement &&\n !this.containerRef.nativeElement.contains(event.target as Node)\n ) {\n this.isSelectingState.set(false);\n this.onClickOutside?.();\n }\n }\n\n handleClick(e: MouseEvent): void {\n if (this.isSelectingComputed()) {\n e.preventDefault();\n e.stopPropagation();\n }\n this.click.emit(e);\n }\n\n handleBlur(): void {\n this.isSelectingState.set(false);\n }\n\n onMouseEnter(): void {\n this.isHovered.set(true);\n }\n\n getContainerStyle(): { [key: string]: any } {\n return {\n display: this.isStringSlot() ? 'inline' : 'inline-block',\n cursor: 'pointer',\n userSelect: 'none',\n borderRadius: '0.375rem',\n outlineWidth: '2px',\n outlineOffset: '4px',\n outlineStyle: 'solid',\n outlineColor:\n this.isSelectingComputed() || this.isHovered()\n ? 'inherit'\n : 'transparent',\n transition: 'all 100ms 50ms ease-in-out',\n };\n }\n}\n"],"mappings":";;;;;AAeA,MAAM,gCAAgC;AA0BtC,IAAa,2BAxBb,+BAAW;CACT,UAAU;CACV,UAAU;;;;;;;;;;;;;;;;;;;CAmBV,YAAY;CACZ,SAAS,CAACA,6BAAa;CACxB,CAAC,EACF,MAAmE;CACjE,4BAAQ,EAAC;CACT,4BAAQ,EAAC;CACT,4BAAQ,EAAC;CAET,6BAAS,EAAC,QAAQ,IAAIC,4BAA0B;CAChD,6BAAS,EAAC,QAAQ,IAAIA,4BAAoB;CAE1C,+BAAW,gBAAgB,EAAE,QAAQ,MAAM,CAAC,EAC5C;CAEA,AAAQ,sCAAmB,MAAM;CACjC,AAAQ,6CAA0B,MAAM;CACxC,AAAQ,gBAAsD;CAE9D,AAAiB,wDACT,KAAK,eAAe,KAAK,kBAAkB,CAClD;CAED,AAAiB,iDAA8B;AAG7C,SAAO;GACP;CAEF,WAAiB;AACf,OAAK,iBAAiB,IAAI,KAAK,eAAe,MAAM;;CAGtD,cAAoB;AAClB,OAAK,iBAAiB;;CAGxB,kCAAc,sBAAsB,CAAC,SAAS,CAAC,EAC/C,oBAAoB,OAAyB;AAC3C,OAAK,mBAAmB,MAAM;;CAGhC,AAAQ,oBAA0B;AAChC,OAAK,iBAAiB,IAAI,KAAK;AAC/B,OAAK,MAAM,MAAM;;CAGnB,AAAQ,kBAAwB;AAC9B,OAAK,gBAAgB,iBAAiB;AACpC,QAAK,mBAAmB;KACvB,KAAK,iBAAiB,8BAA8B;;CAGzD,AAAQ,kBAAwB;AAC9B,MAAI,KAAK,eAAe;AACtB,gBAAa,KAAK,cAAc;AAChC,QAAK,gBAAgB;;;CAIzB,kBAAwB;AACtB,OAAK,iBAAiB;AACtB,OAAK,iBAAiB;;CAGxB,gBAAsB;AACpB,OAAK,UAAU,IAAI,MAAM;AACzB,OAAK,iBAAiB;;CAGxB,AAAQ,mBAAmB,OAAyB;AAClD,MACE,KAAK,cAAc,iBACnB,CAAC,KAAK,aAAa,cAAc,SAAS,MAAM,OAAe,EAC/D;AACA,QAAK,iBAAiB,IAAI,MAAM;AAChC,QAAK,kBAAkB;;;CAI3B,YAAY,GAAqB;AAC/B,MAAI,KAAK,qBAAqB,EAAE;AAC9B,KAAE,gBAAgB;AAClB,KAAE,iBAAiB;;AAErB,OAAK,MAAM,KAAK,EAAE;;CAGpB,aAAmB;AACjB,OAAK,iBAAiB,IAAI,MAAM;;CAGlC,eAAqB;AACnB,OAAK,UAAU,IAAI,KAAK;;CAG1B,oBAA4C;AAC1C,SAAO;GACL,SAAS,KAAK,cAAc,GAAG,WAAW;GAC1C,QAAQ;GACR,YAAY;GACZ,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;GACd,cACE,KAAK,qBAAqB,IAAI,KAAK,WAAW,GAC1C,YACA;GACN,YAAY;GACb"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
3
|
-
let
|
|
4
|
-
|
|
2
|
+
let _angular_core = require("@angular/core");
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
5
5
|
|
|
6
6
|
//#region src/client/installIntlayer.ts
|
|
7
|
-
const INTLAYER_TOKEN = new
|
|
7
|
+
const INTLAYER_TOKEN = new _angular_core.InjectionToken("intlayer");
|
|
8
8
|
/**
|
|
9
9
|
* Singleton instance
|
|
10
10
|
*/
|
|
11
11
|
let instance = null;
|
|
12
|
-
var IntlayerProvider = @((0,
|
|
13
|
-
isCookieEnabled = (0,
|
|
14
|
-
_locale = (0,
|
|
12
|
+
var IntlayerProvider = @((0, _angular_core.Injectable)({ providedIn: "root" })) class {
|
|
13
|
+
isCookieEnabled = (0, _angular_core.signal)(true);
|
|
14
|
+
_locale = (0, _angular_core.signal)(_intlayer_config_built.default.internationalization?.defaultLocale);
|
|
15
15
|
locale = this._locale.asReadonly();
|
|
16
16
|
setLocale = (locale) => {
|
|
17
17
|
this._locale.set(locale);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installIntlayer.cjs","names":["InjectionToken","instance: IntlayerProvider | null","configuration"],"sources":["../../../src/client/installIntlayer.ts"],"sourcesContent":["import { Injectable, InjectionToken, type Signal, signal } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\n\nexport const INTLAYER_TOKEN = new InjectionToken<IntlayerProvider>('intlayer');\n\n/**\n * Singleton instance\n */\nlet instance: IntlayerProvider | null = null;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerProvider {\n isCookieEnabled = signal(true);\n private _locale = signal<LocalesValues>(\n configuration.internationalization?.defaultLocale as LocalesValues\n );\n\n readonly locale: Signal<LocalesValues> = this._locale.asReadonly();\n\n setLocale = (locale: LocalesValues) => {\n this._locale.set(locale);\n };\n}\n\n/**\n * Create and return a single IntlayerProvider instance\n */\nexport const createIntlayerClient = (\n locale?: LocalesValues,\n isCookieEnabled = true\n): IntlayerProvider => {\n if (instance) return instance;\n\n instance = new IntlayerProvider();\n\n if (locale) {\n instance.setLocale(locale);\n }\n instance.isCookieEnabled.set(isCookieEnabled);\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer provider\n */\nexport const installIntlayer = (\n locale?: LocalesValues,\n isCookieEnabled = true\n) => {\n const client = createIntlayerClient(locale, isCookieEnabled);\n\n // Note: Angular editor installation will be handled differently\n // installIntlayerEditor();\n\n return client;\n};\n"],"mappings":";;;;;;AAIA,MAAa,iBAAiB,IAAIA,
|
|
1
|
+
{"version":3,"file":"installIntlayer.cjs","names":["InjectionToken","instance: IntlayerProvider | null","configuration"],"sources":["../../../src/client/installIntlayer.ts"],"sourcesContent":["import { Injectable, InjectionToken, type Signal, signal } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\n\nexport const INTLAYER_TOKEN = new InjectionToken<IntlayerProvider>('intlayer');\n\n/**\n * Singleton instance\n */\nlet instance: IntlayerProvider | null = null;\n\n@Injectable({\n providedIn: 'root',\n})\nexport class IntlayerProvider {\n isCookieEnabled = signal(true);\n private _locale = signal<LocalesValues>(\n configuration.internationalization?.defaultLocale as LocalesValues\n );\n\n readonly locale: Signal<LocalesValues> = this._locale.asReadonly();\n\n setLocale = (locale: LocalesValues) => {\n this._locale.set(locale);\n };\n}\n\n/**\n * Create and return a single IntlayerProvider instance\n */\nexport const createIntlayerClient = (\n locale?: LocalesValues,\n isCookieEnabled = true\n): IntlayerProvider => {\n if (instance) return instance;\n\n instance = new IntlayerProvider();\n\n if (locale) {\n instance.setLocale(locale);\n }\n instance.isCookieEnabled.set(isCookieEnabled);\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer provider\n */\nexport const installIntlayer = (\n locale?: LocalesValues,\n isCookieEnabled = true\n) => {\n const client = createIntlayerClient(locale, isCookieEnabled);\n\n // Note: Angular editor installation will be handled differently\n // installIntlayerEditor();\n\n return client;\n};\n"],"mappings":";;;;;;AAIA,MAAa,iBAAiB,IAAIA,6BAAiC,WAAW;;;;AAK9E,IAAIC,WAAoC;AAKxC,IAAa,mBAHb,gCAAY,EACV,YAAY,QACb,CAAC,EACF,MAA8B;CAC5B,4CAAyB,KAAK;CAC9B,AAAQ,oCACNC,+BAAc,sBAAsB,cACrC;CAED,AAAS,SAAgC,KAAK,QAAQ,YAAY;CAElE,aAAa,WAA0B;AACrC,OAAK,QAAQ,IAAI,OAAO;;;;;;AAO5B,MAAa,wBACX,QACA,kBAAkB,SACG;AACrB,KAAI,SAAU,QAAO;AAErB,YAAW,IAAI,kBAAkB;AAEjC,KAAI,OACF,UAAS,UAAU,OAAO;AAE5B,UAAS,gBAAgB,IAAI,gBAAgB;AAE7C,QAAO;;;;;AAMT,MAAa,mBACX,QACA,kBAAkB,SACf;AAMH,QALe,qBAAqB,QAAQ,gBAAgB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_client_installIntlayer = require('./installIntlayer.cjs');
|
|
3
3
|
const require_getDictionary = require('../getDictionary.cjs');
|
|
4
|
-
let
|
|
4
|
+
let _angular_core = require("@angular/core");
|
|
5
5
|
|
|
6
6
|
//#region src/client/useDictionary.ts
|
|
7
7
|
const useDictionary = (dictionary, locale) => {
|
|
8
|
-
const intlayer = (0,
|
|
9
|
-
const localeTarget = (0,
|
|
10
|
-
return (0,
|
|
8
|
+
const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
|
|
9
|
+
const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale());
|
|
10
|
+
return (0, _angular_core.computed)(() => require_getDictionary.getDictionary(dictionary, localeTarget()))();
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type { Dictionary, LocalesValues } from '@intlayer/types';\nimport { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n): DeepTransformContent<T['content']> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(() => locale ?? intlayer?.locale());\n\n /** a *stable* reactive dictionary object */\n const content = computed(() =>\n getDictionary<T, LocalesValues>(dictionary, localeTarget())\n );\n\n return content() as DeepTransformContent<T['content']>; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;AAMA,MAAa,iBACX,YACA,WACuC;CACvC,MAAM,
|
|
1
|
+
{"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type { Dictionary, LocalesValues } from '@intlayer/types';\nimport { getDictionary } from '../getDictionary';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n): DeepTransformContent<T['content']> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(() => locale ?? intlayer?.locale());\n\n /** a *stable* reactive dictionary object */\n const content = computed(() =>\n getDictionary<T, LocalesValues>(dictionary, localeTarget())\n );\n\n return content() as DeepTransformContent<T['content']>; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;AAMA,MAAa,iBACX,YACA,WACuC;CACvC,MAAM,qCAAoCA,8CAAe;CAEzD,MAAM,iDAA8B,UAAU,UAAU,QAAQ,CAAC;AAOjE,0CAHEC,oCAAgC,YAAY,cAAc,CAAC,CAC5D,EAEe"}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
4
4
|
const require_client_installIntlayer = require('./installIntlayer.cjs');
|
|
5
5
|
const require_client_useDictionary = require('./useDictionary.cjs');
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
|
|
6
|
+
let _angular_core = require("@angular/core");
|
|
7
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
8
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
9
9
|
|
|
10
10
|
//#region src/client/useDictionaryAsync.ts
|
|
11
11
|
/**
|
|
@@ -14,8 +14,8 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
14
14
|
* If the locale is not provided, it will use the locale from the client context
|
|
15
15
|
*/
|
|
16
16
|
const useDictionaryAsync = async (dictionaryPromise, locale) => {
|
|
17
|
-
const intlayer = (0,
|
|
18
|
-
const localeTarget = (0,
|
|
17
|
+
const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
|
|
18
|
+
const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale() ?? _intlayer_config_built.default?.internationalization.defaultLocale);
|
|
19
19
|
return require_client_useDictionary.useDictionary(await dictionaryPromise[localeTarget()]?.(), localeTarget());
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryAsync.cjs","names":["INTLAYER_TOKEN","configuration","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = await dictionaryPromise[localeTarget()]?.();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,qBAAqB,OAChC,mBACA,WACG;CACH,MAAM,
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.cjs","names":["INTLAYER_TOKEN","configuration","useDictionary"],"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = await dictionaryPromise[localeTarget()]?.();\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,qBAAqB,OAChC,mBACA,WACG;CACH,MAAM,qCAAoCA,8CAAe;CAEzD,MAAM,iDAEF,UACA,UAAU,QAAQ,IAClBC,gCAAe,qBAAqB,cACvC;AAID,QAAOC,2CAFY,MAAM,kBAAkB,cAAc,KAAK,EAE7B,cAAc,CAAQ"}
|
|
@@ -4,9 +4,9 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
4
4
|
const require_client_installIntlayer = require('./installIntlayer.cjs');
|
|
5
5
|
const require_client_useDictionary = require('./useDictionary.cjs');
|
|
6
6
|
const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
|
|
7
|
+
let _angular_core = require("@angular/core");
|
|
8
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
9
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
10
10
|
|
|
11
11
|
//#region src/client/useDictionaryDynamic.ts
|
|
12
12
|
/**
|
|
@@ -15,8 +15,8 @@ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_bui
|
|
|
15
15
|
* If the locale is not provided, it will use the locale from the client context
|
|
16
16
|
*/
|
|
17
17
|
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
|
|
18
|
-
const intlayer = (0,
|
|
19
|
-
const localeTarget = (0,
|
|
18
|
+
const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
|
|
19
|
+
const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale() ?? _intlayer_config_built.default?.internationalization.defaultLocale);
|
|
20
20
|
return require_client_useDictionary.useDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget()}`, dictionaryPromise[localeTarget()]?.()), localeTarget());
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.cjs","names":["INTLAYER_TOKEN","configuration","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n dictionaryPromise[localeTarget()]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.cjs","names":["INTLAYER_TOKEN","configuration","useDictionary","useLoadDynamic"],"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type {\n Dictionary,\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n dictionaryPromise[localeTarget()]?.()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,wBAIX,mBACA,KACA,WACG;CACH,MAAM,qCAAoCA,8CAAe;CAEzD,MAAM,iDAEF,UACA,UAAU,QAAQ,IAClBC,gCAAe,qBAAqB,cACvC;AAOD,QAAOC,2CALYC,6CACjB,GAAG,OAAO,IAAI,CAAC,GAAG,cAAc,IAChC,kBAAkB,cAAc,KAAK,CACtC,EAEgC,cAAc,CAAQ"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_client_installIntlayer = require('./installIntlayer.cjs');
|
|
3
3
|
const require_getIntlayer = require('../getIntlayer.cjs');
|
|
4
|
-
let
|
|
4
|
+
let _angular_core = require("@angular/core");
|
|
5
5
|
|
|
6
6
|
//#region src/client/useIntlayer.ts
|
|
7
7
|
/** guard utility - true only for objects generated by `renderIntlayerNode()` */
|
|
8
8
|
const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.__update === "function";
|
|
9
9
|
const useIntlayer = (key, locale) => {
|
|
10
|
-
const intlayer = (0,
|
|
10
|
+
const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
|
|
11
11
|
/** which locale should we use right now? */
|
|
12
|
-
const localeTarget = (0,
|
|
13
|
-
return (0,
|
|
12
|
+
const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer.locale());
|
|
13
|
+
return (0, _angular_core.computed)(() => require_getIntlayer.getIntlayer(key, localeTarget()))();
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type {\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\nexport const useIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: LocalesValues\n): DeepTransformContent<DictionaryRegistryContent<T>> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n /** which locale should we use right now? */\n const localeTarget = computed(() => locale ?? intlayer.locale());\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => getIntlayer<T, L>(key, localeTarget() as L));\n\n return content() as DeepTransformContent<DictionaryRegistryContent<T>>; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;AAWA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;AAEnC,MAAa,eACX,KACA,WACuD;CACvD,MAAM,
|
|
1
|
+
{"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type {\n DictionaryKeys,\n DictionaryRegistryContent,\n LocalesValues,\n} from '@intlayer/types';\nimport { getIntlayer } from '../getIntlayer';\nimport type { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\n\n/** guard utility - true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\nexport const useIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: LocalesValues\n): DeepTransformContent<DictionaryRegistryContent<T>> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n /** which locale should we use right now? */\n const localeTarget = computed(() => locale ?? intlayer.locale());\n\n /** a *stable* reactive dictionary object */\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const content = computed(() => getIntlayer<T, L>(key, localeTarget() as L));\n\n return content() as DeepTransformContent<DictionaryRegistryContent<T>>; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;AAWA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;AAEnC,MAAa,eACX,KACA,WACuD;CACvD,MAAM,qCAAoCA,8CAAe;;CAGzD,MAAM,iDAA8B,UAAU,SAAS,QAAQ,CAAC;AAMhE,0CAF+BC,gCAAkB,KAAK,cAAc,CAAM,CAAC,EAE3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let _angular_core = require("@angular/core");
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLoadDynamic.ts
|
|
5
5
|
/**
|
|
@@ -10,7 +10,7 @@ let __angular_core = require("@angular/core");
|
|
|
10
10
|
*/
|
|
11
11
|
const useLoadDynamic = (key, promise) => {
|
|
12
12
|
const cache = useLoadDynamic._cache || (useLoadDynamic._cache = /* @__PURE__ */ new Map());
|
|
13
|
-
const container = (0,
|
|
13
|
+
const container = (0, _angular_core.signal)({});
|
|
14
14
|
if (!cache.has(key)) {
|
|
15
15
|
const p = promise.then((real) => {
|
|
16
16
|
container.set(real);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLoadDynamic.cjs","names":["cache: Map<string, Promise<T>>"],"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["import { signal } from '@angular/core';\n\n/**\n * A \"synchronous\" loader for a dynamically‐imported JSON (or anything).\n *\n * - Immediately returns a reactive signal so that Angular can properly track changes.\n * - When the Promise resolves, it replaces the signal's value with the real data.\n */\nexport const useLoadDynamic = <T extends Record<string, any>>(\n key: string,\n promise: Promise<T>\n): T => {\n // A module‐level cache of Promises, so we only import once per key.\n const cache: Map<string, Promise<T>> = (useLoadDynamic as any)._cache ||\n ((useLoadDynamic as any)._cache = new Map());\n\n // Hold the \"current\" value as a reactive signal\n // This starts as an empty object but Angular can track changes to it\n const container = signal({} as T);\n\n if (!cache.has(key)) {\n // Kick off the dynamic import & cache it\n const p = promise.then((real) => {\n // As soon as the import resolves, update the signal with the real data\n container.set(real);\n return real;\n });\n cache.set(key, p);\n } else {\n // If it's already in flight (or done), hook into it so that the container still updates\n cache.get(key)?.then((real) => {\n container.set(real);\n });\n }\n\n // Return the current signal value directly - Angular can track all changes to it\n return container();\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBACX,KACA,YACM;CAEN,MAAMA,QAAkC,eAAuB,WAC9D,AAAC,eAAuB,yBAAS,IAAI,KAAK;CAI3C,MAAM,
|
|
1
|
+
{"version":3,"file":"useLoadDynamic.cjs","names":["cache: Map<string, Promise<T>>"],"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["import { signal } from '@angular/core';\n\n/**\n * A \"synchronous\" loader for a dynamically‐imported JSON (or anything).\n *\n * - Immediately returns a reactive signal so that Angular can properly track changes.\n * - When the Promise resolves, it replaces the signal's value with the real data.\n */\nexport const useLoadDynamic = <T extends Record<string, any>>(\n key: string,\n promise: Promise<T>\n): T => {\n // A module‐level cache of Promises, so we only import once per key.\n const cache: Map<string, Promise<T>> = (useLoadDynamic as any)._cache ||\n ((useLoadDynamic as any)._cache = new Map());\n\n // Hold the \"current\" value as a reactive signal\n // This starts as an empty object but Angular can track changes to it\n const container = signal({} as T);\n\n if (!cache.has(key)) {\n // Kick off the dynamic import & cache it\n const p = promise.then((real) => {\n // As soon as the import resolves, update the signal with the real data\n container.set(real);\n return real;\n });\n cache.set(key, p);\n } else {\n // If it's already in flight (or done), hook into it so that the container still updates\n cache.get(key)?.then((real) => {\n container.set(real);\n });\n }\n\n // Return the current signal value directly - Angular can track all changes to it\n return container();\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBACX,KACA,YACM;CAEN,MAAMA,QAAkC,eAAuB,WAC9D,AAAC,eAAuB,yBAAS,IAAI,KAAK;CAI3C,MAAM,sCAAmB,EAAE,CAAM;AAEjC,KAAI,CAAC,MAAM,IAAI,IAAI,EAAE;EAEnB,MAAM,IAAI,QAAQ,MAAM,SAAS;AAE/B,aAAU,IAAI,KAAK;AACnB,UAAO;IACP;AACF,QAAM,IAAI,KAAK,EAAE;OAGjB,OAAM,IAAI,IAAI,EAAE,MAAM,SAAS;AAC7B,YAAU,IAAI,KAAK;GACnB;AAIJ,QAAO,WAAW"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_client_installIntlayer = require('./installIntlayer.cjs');
|
|
3
3
|
const require_client_useLocaleStorage = require('./useLocaleStorage.cjs');
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
|
|
4
|
+
let _angular_core = require("@angular/core");
|
|
5
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
6
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
7
7
|
|
|
8
8
|
//#region src/client/useLocale.ts
|
|
9
9
|
/**
|
|
10
10
|
* On the client side, composable to get the current locale and all related fields
|
|
11
11
|
*/
|
|
12
12
|
const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
|
|
13
|
-
const { defaultLocale, locales: availableLocales } =
|
|
14
|
-
const intlayer = (0,
|
|
15
|
-
const locale = (0,
|
|
16
|
-
const isCookieEnabledContext = (0,
|
|
13
|
+
const { defaultLocale, locales: availableLocales } = _intlayer_config_built.default?.internationalization ?? {};
|
|
14
|
+
const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
|
|
15
|
+
const locale = (0, _angular_core.computed)(() => intlayer?.locale() ?? defaultLocale);
|
|
16
|
+
const isCookieEnabledContext = (0, _angular_core.computed)(() => intlayer?.isCookieEnabled() ?? true);
|
|
17
17
|
const setLocale = (newLocale) => {
|
|
18
18
|
if (!availableLocales?.map(String).includes(newLocale)) {
|
|
19
19
|
console.error(`Locale ${newLocale} is not available`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.cjs","names":["configuration","INTLAYER_TOKEN"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype useLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, composable to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n // Create a reactive reference for the locale\n const locale = computed(() => intlayer?.locale() ?? defaultLocale);\n const isCookieEnabledContext = computed(\n () => intlayer?.isCookieEnabled() ?? true\n );\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleInStorage(\n newLocale,\n isCookieEnabled ?? isCookieEnabledContext() ?? true\n );\n onLocaleChange?.(newLocale);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAK;CACzB,MAAM,EAAE,eAAe,SAAS,qBAC9BA,
|
|
1
|
+
{"version":3,"file":"useLocale.cjs","names":["configuration","INTLAYER_TOKEN"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype useLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, composable to get the current locale and all related fields\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n // Create a reactive reference for the locale\n const locale = computed(() => intlayer?.locale() ?? defaultLocale);\n const isCookieEnabledContext = computed(\n () => intlayer?.isCookieEnabled() ?? true\n );\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleInStorage(\n newLocale,\n isCookieEnabled ?? isCookieEnabledContext() ?? true\n );\n onLocaleChange?.(newLocale);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,aAAa,EACxB,iBACA,mBACkB,EAAE,KAAK;CACzB,MAAM,EAAE,eAAe,SAAS,qBAC9BA,gCAAe,wBAAwB,EAAE;CAC3C,MAAM,qCAAoCC,8CAAe;CAGzD,MAAM,2CAAwB,UAAU,QAAQ,IAAI,cAAc;CAClE,MAAM,2DACE,UAAU,iBAAiB,IAAI,KACtC;CAED,MAAM,aAAa,cAA6B;AAC9C,MAAI,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE;AACtD,WAAQ,MAAM,UAAU,UAAU,mBAAmB;AACrD;;AAGF,MAAI,SACF,UAAS,UAAU,UAAU;AAE/B,qDACE,WACA,mBAAmB,wBAAwB,IAAI,KAChD;AACD,mBAAiB,UAAU;;AAG7B,QAAO;EACL;EACA;EACA;EACA;EACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
2
|
+
let _intlayer_core = require("@intlayer/core");
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.ts
|
|
5
5
|
/**
|
|
@@ -8,7 +8,7 @@ let __intlayer_core = require("@intlayer/core");
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
const localeInStorage = (0,
|
|
11
|
+
const localeInStorage = (0, _intlayer_core.getLocaleFromStorage)(_intlayer_core.localeStorageOptions);
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use localeInStorage instead
|
|
14
14
|
*
|
|
@@ -18,8 +18,8 @@ const localeCookie = localeInStorage;
|
|
|
18
18
|
/**
|
|
19
19
|
* Set the locale cookie
|
|
20
20
|
*/
|
|
21
|
-
const setLocaleInStorage = (locale, isCookieEnabled) => (0,
|
|
22
|
-
...
|
|
21
|
+
const setLocaleInStorage = (locale, isCookieEnabled) => (0, _intlayer_core.setLocaleInStorage)(locale, {
|
|
22
|
+
..._intlayer_core.localeStorageOptions,
|
|
23
23
|
isCookieEnabled
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
@@ -31,8 +31,8 @@ const setLocaleCookie = setLocaleInStorage;
|
|
|
31
31
|
/**
|
|
32
32
|
* Hook that provides the locale storage and a function to set it
|
|
33
33
|
*/
|
|
34
|
-
const useLocaleStorage = (isCookieEnabled) => (0,
|
|
35
|
-
...
|
|
34
|
+
const useLocaleStorage = (isCookieEnabled) => (0, _intlayer_core.LocaleStorage)({
|
|
35
|
+
..._intlayer_core.localeStorageOptions,
|
|
36
36
|
isCookieEnabled
|
|
37
37
|
});
|
|
38
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorage,\n LocaleStorage,\n localeStorageOptions,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorage(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale storage and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n LocaleStorage({\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.cjs","names":["localeStorageOptions"],"sources":["../../../src/client/useLocaleStorage.ts"],"sourcesContent":["import {\n getLocaleFromStorage,\n LocaleStorage,\n localeStorageOptions,\n setLocaleInStorage as setLocaleInStorageCore,\n} from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\n\n/**\n * Get the locale cookie\n */\n/**\n * Get the locale cookie\n */\nexport const localeInStorage = getLocaleFromStorage(localeStorageOptions);\n/**\n * @deprecated Use localeInStorage instead\n *\n * Get the locale cookie\n */\nexport const localeCookie = localeInStorage;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleInStorage = (\n locale: LocalesValues,\n isCookieEnabled: boolean\n) =>\n setLocaleInStorageCore(locale, {\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use setLocaleInStorage instead\n *\n * Set the locale cookie\n */\nexport const setLocaleCookie = setLocaleInStorage;\n\n/**\n * Hook that provides the locale storage and a function to set it\n */\nexport const useLocaleStorage = (isCookieEnabled?: boolean) =>\n LocaleStorage({\n ...localeStorageOptions,\n isCookieEnabled,\n });\n\n/**\n * @deprecated Use useLocaleStorage instead\n *\n * For GDPR compliance, use useLocaleStorage instead\n *\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = (isCookieEnabled?: boolean) => {\n const storage = useLocaleStorage(isCookieEnabled);\n\n return {\n localeCookie: storage.getLocale(),\n setLocaleCookie: storage.setLocale,\n };\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,2DAAuCA,oCAAqB;;;;;;AAMzE,MAAa,eAAe;;;;AAK5B,MAAa,sBACX,QACA,2DAEuB,QAAQ;CAC7B,GAAGA;CACH;CACD,CAAC;;;;;;AAOJ,MAAa,kBAAkB;;;;AAK/B,MAAa,oBAAoB,sDACjB;CACZ,GAAGA;CACH;CACD,CAAC;;;;;;;;AASJ,MAAa,mBAAmB,oBAA8B;CAC5D,MAAM,UAAU,iBAAiB,gBAAgB;AAEjD,QAAO;EACL,cAAc,QAAQ,WAAW;EACjC,iBAAiB,QAAQ;EAC1B"}
|
|
@@ -3,16 +3,16 @@ const require_UI_ContentSelector_component = require('../UI/ContentSelector.comp
|
|
|
3
3
|
const require_editor_editorEnabled = require('./editorEnabled.cjs');
|
|
4
4
|
const require_editor_focusDictionary = require('./focusDictionary.cjs');
|
|
5
5
|
const require_editor_useEditor = require('./useEditor.cjs');
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
6
|
+
let _intlayer_core = require("@intlayer/core");
|
|
7
|
+
let _intlayer_types = require("@intlayer/types");
|
|
8
|
+
let _angular_common = require("@angular/common");
|
|
9
|
+
let _angular_core = require("@angular/core");
|
|
10
10
|
|
|
11
11
|
//#region src/editor/ContentSelectorWrapper.component.ts
|
|
12
|
-
var ContentSelectorWrapperComponent = @((0,
|
|
12
|
+
var ContentSelectorWrapperComponent = @((0, _angular_core.Component)({
|
|
13
13
|
selector: "app-content-selector-wrapper",
|
|
14
14
|
standalone: true,
|
|
15
|
-
imports: [
|
|
15
|
+
imports: [_angular_common.CommonModule, require_UI_ContentSelector_component.ContentSelectorComponent],
|
|
16
16
|
template: `
|
|
17
17
|
<app-content-selector
|
|
18
18
|
*ngIf="enabled()"
|
|
@@ -24,22 +24,22 @@ var ContentSelectorWrapperComponent = @((0, __angular_core.Component)({
|
|
|
24
24
|
<ng-content *ngIf="!enabled()"></ng-content>
|
|
25
25
|
`
|
|
26
26
|
})) class {
|
|
27
|
-
@((0,
|
|
28
|
-
@((0,
|
|
27
|
+
@((0, _angular_core.Input)()) dictionaryKey;
|
|
28
|
+
@((0, _angular_core.Input)()) keyPath;
|
|
29
29
|
focusDictionary = require_editor_focusDictionary.useFocusDictionary();
|
|
30
30
|
editorEnabled = require_editor_editorEnabled.useEditorEnabled();
|
|
31
31
|
constructor() {
|
|
32
32
|
require_editor_useEditor.useEditor();
|
|
33
33
|
}
|
|
34
|
-
isSelected = (0,
|
|
34
|
+
isSelected = (0, _angular_core.computed)(() => {
|
|
35
35
|
const focusedContent = this.focusDictionary.focusedContent();
|
|
36
|
-
return focusedContent?.dictionaryKey === this.dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && (0,
|
|
36
|
+
return focusedContent?.dictionaryKey === this.dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && (0, _intlayer_core.isSameKeyPath)(focusedContent.keyPath ?? [], this.keyPath);
|
|
37
37
|
});
|
|
38
|
-
enabled = (0,
|
|
38
|
+
enabled = (0, _angular_core.computed)(() => this.editorEnabled.enabled());
|
|
39
39
|
handleSelect() {
|
|
40
40
|
this.focusDictionary.setFocusedContent({
|
|
41
41
|
dictionaryKey: this.dictionaryKey,
|
|
42
|
-
keyPath: this.keyPath.filter((key) => key.type !==
|
|
42
|
+
keyPath: this.keyPath.filter((key) => key.type !== _intlayer_types.NodeType.Translation)
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.component.cjs","names":["CommonModule","ContentSelectorComponent","useFocusDictionary","useEditorEnabled","NodeType"],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input } from '@angular/core';\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport { NodeType } from '@intlayer/types';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath.filter((key) => key.type !== NodeType.Translation),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAgCA,IAAa,kCAfb
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.component.cjs","names":["CommonModule","ContentSelectorComponent","useFocusDictionary","useEditorEnabled","NodeType"],"sources":["../../../src/editor/ContentSelectorWrapper.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, Input } from '@angular/core';\nimport { isSameKeyPath, type NodeProps } from '@intlayer/core';\nimport { NodeType } from '@intlayer/types';\nimport { ContentSelectorComponent } from '../UI/ContentSelector.component';\nimport { useEditorEnabled } from './editorEnabled';\nimport { useFocusDictionary } from './focusDictionary';\nimport { useEditor } from './useEditor';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface ContentSelectorWrapperProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-content-selector-wrapper',\n standalone: true,\n imports: [CommonModule, ContentSelectorComponent],\n template: `\n <app-content-selector\n *ngIf=\"enabled()\"\n (press)=\"handleSelect()\"\n [isSelecting]=\"isSelected()\"\n >\n <ng-content></ng-content>\n </app-content-selector>\n <ng-content *ngIf=\"!enabled()\"></ng-content>\n `,\n})\nexport class ContentSelectorWrapperComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n\n // pull in the editor state & focus API\n private focusDictionary = useFocusDictionary();\n private editorEnabled = useEditorEnabled();\n\n constructor() {\n useEditor();\n }\n\n // compute whether this node is the current focus\n isSelected = computed(() => {\n const focusedContent = this.focusDictionary.focusedContent();\n return (\n focusedContent?.dictionaryKey === this.dictionaryKey &&\n (focusedContent.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent.keyPath ?? [], this.keyPath)\n );\n });\n\n enabled = computed(() => this.editorEnabled.enabled());\n\n // when the selector is clicked, update focus\n handleSelect() {\n this.focusDictionary.setFocusedContent({\n dictionaryKey: this.dictionaryKey,\n keyPath: this.keyPath.filter((key) => key.type !== NodeType.Translation),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAgCA,IAAa,kCAfb,+BAAW;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAACA,8BAAcC,8DAAyB;CACjD,UAAU;;;;;;;;;;CAUX,CAAC,EACF,MAA6C;CAC3C,4BAAQ,EAAC;CACT,4BAAQ,EAAC;CAGT,AAAQ,kBAAkBC,mDAAoB;CAC9C,AAAQ,gBAAgBC,+CAAkB;CAE1C,cAAc;AACZ,sCAAW;;CAIb,+CAA4B;EAC1B,MAAM,iBAAiB,KAAK,gBAAgB,gBAAgB;AAC5D,SACE,gBAAgB,kBAAkB,KAAK,kBACtC,eAAe,SAAS,UAAU,KAAK,uCAC1B,eAAe,WAAW,EAAE,EAAE,KAAK,QAAQ;GAE3D;CAEF,4CAAyB,KAAK,cAAc,SAAS,CAAC;CAGtD,eAAe;AACb,OAAK,gBAAgB,kBAAkB;GACrC,eAAe,KAAK;GACpB,SAAS,KAAK,QAAQ,QAAQ,QAAQ,IAAI,SAASC,yBAAS,YAAY;GACzE,CAAC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_editor_useEditedContentRenderer = require('./useEditedContentRenderer.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
3
|
+
let _intlayer_core = require("@intlayer/core");
|
|
4
|
+
let _angular_common = require("@angular/common");
|
|
5
|
+
let _angular_core = require("@angular/core");
|
|
6
6
|
|
|
7
7
|
//#region src/editor/EditedContentRenderer.component.ts
|
|
8
|
-
var EditedContentRendererComponent = @((0,
|
|
8
|
+
var EditedContentRendererComponent = @((0, _angular_core.Component)({
|
|
9
9
|
selector: "app-edited-content-renderer",
|
|
10
10
|
standalone: true,
|
|
11
|
-
imports: [
|
|
11
|
+
imports: [_angular_common.CommonModule],
|
|
12
12
|
template: ` <span [innerHTML]="renderedContent()"></span> `
|
|
13
13
|
})) class {
|
|
14
|
-
@((0,
|
|
15
|
-
@((0,
|
|
16
|
-
@((0,
|
|
17
|
-
fallback = (0,
|
|
18
|
-
rawContent = (0,
|
|
14
|
+
@((0, _angular_core.Input)()) dictionaryKey;
|
|
15
|
+
@((0, _angular_core.Input)()) keyPath;
|
|
16
|
+
@((0, _angular_core.Input)()) locale;
|
|
17
|
+
fallback = (0, _angular_core.signal)("");
|
|
18
|
+
rawContent = (0, _angular_core.computed)(() => {
|
|
19
19
|
return require_editor_useEditedContentRenderer.useEditedContentRenderer(this.dictionaryKey, this.keyPath, this.fallback);
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
22
|
* Object → getContent → string, same as the React version.
|
|
23
23
|
*/
|
|
24
|
-
renderedContent = (0,
|
|
24
|
+
renderedContent = (0, _angular_core.computed)(() => {
|
|
25
25
|
const rawContentValue = this.rawContent();
|
|
26
26
|
if (typeof rawContentValue === "object" && rawContentValue !== null) {
|
|
27
|
-
const transformed = (0,
|
|
27
|
+
const transformed = (0, _intlayer_core.getContent)(rawContentValue, {
|
|
28
28
|
dictionaryKey: this.dictionaryKey,
|
|
29
29
|
keyPath: this.keyPath
|
|
30
30
|
}, this.locale);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentRenderer.component.cjs","names":["CommonModule","useEditedContentRenderer"],"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';\nimport type { ContentNode, KeyPath, Locale } from '@intlayer/types';\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":";;;;;;;AAkBA,IAAa,iCANb
|
|
1
|
+
{"version":3,"file":"EditedContentRenderer.component.cjs","names":["CommonModule","useEditedContentRenderer"],"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';\nimport type { ContentNode, KeyPath, Locale } from '@intlayer/types';\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":";;;;;;;AAkBA,IAAa,iCANb,+BAAW;CACT,UAAU;CACV,YAAY;CACZ,SAAS,CAACA,6BAAa;CACvB,UAAU;CACX,CAAC,EACF,MAA4C;CAC1C,4BAAQ,EAAC;CACT,4BAAQ,EAAC;CACT,4BAAQ,EAAC;CAET,AAAQ,qCAAkB,GAAG;CAE7B,AAAQ,+CAA4B;AAClC,SAAOC,iEACL,KAAK,eACL,KAAK,SACL,KAAK,SACN;GACD;;;;CAKF,oDAAiC;EAC/B,MAAM,kBAAkB,KAAK,YAAY;AAEzC,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;GACnE,MAAM,6CACJ,iBACA;IACE,eAAe,KAAK;IACpB,SAAS,KAAK;IACf,EACD,KAAK,OACN;AAED,OAAI,OAAO,gBAAgB,UAAU;AACnC,YAAQ,MACN,kDAAkD,OAAO,YAAY,2BAA2B,KAAK,UACnG,YACD,GACF;AACD,WAAO,KAAK,UAAU;;AAExB,UAAO;;AAGT,SAAO,iBAAiB;GACxB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_editor_ContentSelectorWrapper_component = require('./ContentSelectorWrapper.component.cjs');
|
|
3
3
|
const require_editor_EditedContentRenderer_component = require('./EditedContentRenderer.component.cjs');
|
|
4
|
-
let
|
|
5
|
-
let
|
|
4
|
+
let _angular_common = require("@angular/common");
|
|
5
|
+
let _angular_core = require("@angular/core");
|
|
6
6
|
|
|
7
7
|
//#region src/editor/EditorSelectorRenderer.component.ts
|
|
8
|
-
var EditorSelectorRendererComponent = @((0,
|
|
8
|
+
var EditorSelectorRendererComponent = @((0, _angular_core.Component)({
|
|
9
9
|
selector: "app-editor-selector-renderer",
|
|
10
10
|
standalone: true,
|
|
11
11
|
imports: [
|
|
12
|
-
|
|
12
|
+
_angular_common.CommonModule,
|
|
13
13
|
require_editor_ContentSelectorWrapper_component.ContentSelectorWrapperComponent,
|
|
14
14
|
require_editor_EditedContentRenderer_component.EditedContentRendererComponent
|
|
15
15
|
],
|
|
@@ -27,8 +27,8 @@ var EditorSelectorRendererComponent = @((0, __angular_core.Component)({
|
|
|
27
27
|
</app-content-selector-wrapper>
|
|
28
28
|
`
|
|
29
29
|
})) class {
|
|
30
|
-
@((0,
|
|
31
|
-
@((0,
|
|
30
|
+
@((0, _angular_core.Input)()) dictionaryKey;
|
|
31
|
+
@((0, _angular_core.Input)()) keyPath;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSelectorRenderer.component.cjs","names":["CommonModule","ContentSelectorWrapperComponent","EditedContentRendererComponent"],"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":";;;;;;;AAoCA,IAAa,kCAtBb
|
|
1
|
+
{"version":3,"file":"EditorSelectorRenderer.component.cjs","names":["CommonModule","ContentSelectorWrapperComponent","EditedContentRendererComponent"],"sources":["../../../src/editor/EditorSelectorRenderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport type { NodeProps } from '@intlayer/core';\nimport { ContentSelectorWrapperComponent } from './ContentSelectorWrapper.component';\nimport { EditedContentRendererComponent } from './EditedContentRenderer.component';\n\n/**\n * Combine your NodeProps (which include dictionaryKey & keyPath)\n * with any other div-like attributes.\n */\nexport interface EditorSelectorRendererProps extends NodeProps {\n [key: string]: any;\n}\n\n@Component({\n selector: 'app-editor-selector-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ContentSelectorWrapperComponent,\n EditedContentRendererComponent,\n ],\n template: `\n <app-content-selector-wrapper\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <app-edited-content-renderer\n [dictionaryKey]=\"dictionaryKey\"\n [keyPath]=\"keyPath\"\n >\n <ng-content></ng-content>\n </app-edited-content-renderer>\n </app-content-selector-wrapper>\n `,\n})\nexport class EditorSelectorRendererComponent {\n @Input() dictionaryKey!: string;\n @Input() keyPath!: any[];\n}\n"],"mappings":";;;;;;;AAoCA,IAAa,kCAtBb,+BAAW;CACT,UAAU;CACV,YAAY;CACZ,SAAS;EACPA;EACAC;EACAC;EACD;CACD,UAAU;;;;;;;;;;;;;CAaX,CAAC,EACF,MAA6C;CAC3C,4BAAQ,EAAC;CACT,4BAAQ,EAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let
|
|
3
|
-
|
|
2
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
3
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
4
4
|
|
|
5
5
|
//#region src/editor/communicator.ts
|
|
6
6
|
const randomUUID = () => Math.random().toString(36).slice(2);
|
|
7
|
-
const { editor } =
|
|
7
|
+
const { editor } = _intlayer_config_built.default;
|
|
8
8
|
/**
|
|
9
9
|
* Default values for the communicator
|
|
10
10
|
*/
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_editor_useCrossFrameState = require('./useCrossFrameState.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
|
|
3
|
+
let _angular_core = require("@angular/core");
|
|
4
|
+
let _intlayer_editor = require("@intlayer/editor");
|
|
5
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
6
|
+
_intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
|
|
7
7
|
|
|
8
8
|
//#region src/editor/configuration.ts
|
|
9
9
|
const useConfiguration = () => {
|
|
10
|
-
const [pushedConfiguration, setConfiguration] = require_editor_useCrossFrameState.useCrossFrameState(
|
|
10
|
+
const [pushedConfiguration, setConfiguration] = require_editor_useCrossFrameState.useCrossFrameState(_intlayer_editor.MessageKey.INTLAYER_CONFIGURATION);
|
|
11
11
|
try {
|
|
12
|
-
if ((0,
|
|
13
|
-
if (!pushedConfiguration()) setConfiguration(
|
|
12
|
+
if ((0, _angular_core.inject)(_angular_core.DestroyRef, { optional: true })) {
|
|
13
|
+
if (!pushedConfiguration()) setConfiguration(_intlayer_config_built.default);
|
|
14
14
|
}
|
|
15
15
|
} catch {
|
|
16
16
|
console.warn("useConfiguration called outside injection context; configuration may not be synchronized.");
|