angular-intlayer 8.1.1 → 8.1.3-canary.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.
Files changed (168) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +2 -116
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs +1 -11
  4. package/dist/cjs/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.cjs +1 -8
  5. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
  6. package/dist/cjs/client/index.cjs +1 -28
  7. package/dist/cjs/client/installIntlayer.cjs +1 -77
  8. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionary.cjs +1 -15
  10. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryAsync.cjs +1 -24
  12. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  13. package/dist/cjs/client/useDictionaryDynamic.cjs +1 -25
  14. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  15. package/dist/cjs/client/useIntl.cjs +1 -40
  16. package/dist/cjs/client/useIntl.cjs.map +1 -1
  17. package/dist/cjs/client/useIntlayer.cjs +1 -44
  18. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  19. package/dist/cjs/client/useLoadDynamic.cjs +1 -28
  20. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  21. package/dist/cjs/client/useLocale.cjs +1 -60
  22. package/dist/cjs/client/useLocale.cjs.map +1 -1
  23. package/dist/cjs/client/useLocaleStorage.cjs +1 -60
  24. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -1
  25. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +2 -51
  26. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  27. package/dist/cjs/editor/EditedContentRenderer.component.cjs +1 -54
  28. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  29. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +2 -35
  30. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  31. package/dist/cjs/editor/communicator.cjs +1 -63
  32. package/dist/cjs/editor/communicator.cjs.map +1 -1
  33. package/dist/cjs/editor/configuration.cjs +1 -22
  34. package/dist/cjs/editor/configuration.cjs.map +1 -1
  35. package/dist/cjs/editor/createSharedComposable.cjs +1 -50
  36. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  37. package/dist/cjs/editor/dictionariesRecord.cjs +1 -49
  38. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  39. package/dist/cjs/editor/editedContent.cjs +1 -61
  40. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  41. package/dist/cjs/editor/editorEnabled.cjs +1 -49
  42. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  43. package/dist/cjs/editor/editorLocale.cjs +1 -21
  44. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  45. package/dist/cjs/editor/focusDictionary.cjs +1 -62
  46. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  47. package/dist/cjs/editor/index.cjs +1 -25
  48. package/dist/cjs/editor/installIntlayerEditor.cjs +1 -52
  49. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -73
  51. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  52. package/dist/cjs/editor/useCrossFrameState.cjs +1 -114
  53. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  54. package/dist/cjs/editor/useCrossURLPathState.cjs +1 -65
  55. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  56. package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -35
  57. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  58. package/dist/cjs/editor/useEditor.cjs +1 -24
  59. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  60. package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -39
  61. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  62. package/dist/cjs/getDictionary.cjs +1 -17
  63. package/dist/cjs/getDictionary.cjs.map +1 -1
  64. package/dist/cjs/getIntlayer.cjs +1 -18
  65. package/dist/cjs/getIntlayer.cjs.map +1 -1
  66. package/dist/cjs/index.cjs +1 -49
  67. package/dist/cjs/markdown/index.cjs +1 -13
  68. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -79
  69. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  70. package/dist/cjs/plugins.cjs +1 -188
  71. package/dist/cjs/plugins.cjs.map +1 -1
  72. package/dist/cjs/renderIntlayerNode.cjs +1 -28
  73. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  74. package/dist/cjs/webpack/index.cjs +1 -4
  75. package/dist/cjs/webpack/mergeConfig.cjs +1 -44
  76. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  77. package/dist/esm/UI/ContentSelector.component.mjs +2 -109
  78. package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
  79. package/dist/esm/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs +1 -10
  80. package/dist/esm/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs +1 -7
  81. package/dist/esm/client/index.mjs +1 -10
  82. package/dist/esm/client/installIntlayer.mjs +1 -65
  83. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  84. package/dist/esm/client/useDictionary.mjs +1 -13
  85. package/dist/esm/client/useDictionary.mjs.map +1 -1
  86. package/dist/esm/client/useDictionaryAsync.mjs +1 -21
  87. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  88. package/dist/esm/client/useDictionaryDynamic.mjs +1 -22
  89. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  90. package/dist/esm/client/useIntl.mjs +1 -38
  91. package/dist/esm/client/useIntl.mjs.map +1 -1
  92. package/dist/esm/client/useIntlayer.mjs +1 -41
  93. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  94. package/dist/esm/client/useLoadDynamic.mjs +1 -26
  95. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  96. package/dist/esm/client/useLocale.mjs +1 -57
  97. package/dist/esm/client/useLocale.mjs.map +1 -1
  98. package/dist/esm/client/useLocaleStorage.mjs +1 -53
  99. package/dist/esm/client/useLocaleStorage.mjs.map +1 -1
  100. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +2 -44
  101. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  102. package/dist/esm/editor/EditedContentRenderer.component.mjs +1 -47
  103. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  104. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +2 -28
  105. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
  106. package/dist/esm/editor/communicator.mjs +1 -58
  107. package/dist/esm/editor/communicator.mjs.map +1 -1
  108. package/dist/esm/editor/configuration.mjs +1 -19
  109. package/dist/esm/editor/configuration.mjs.map +1 -1
  110. package/dist/esm/editor/createSharedComposable.mjs +1 -47
  111. package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
  112. package/dist/esm/editor/dictionariesRecord.mjs +1 -45
  113. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  114. package/dist/esm/editor/editedContent.mjs +1 -57
  115. package/dist/esm/editor/editedContent.mjs.map +1 -1
  116. package/dist/esm/editor/editorEnabled.mjs +1 -45
  117. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  118. package/dist/esm/editor/editorLocale.mjs +1 -19
  119. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  120. package/dist/esm/editor/focusDictionary.mjs +1 -58
  121. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  122. package/dist/esm/editor/index.mjs +1 -6
  123. package/dist/esm/editor/installIntlayerEditor.mjs +1 -49
  124. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  125. package/dist/esm/editor/useCrossFrameMessageListener.mjs +1 -71
  126. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  127. package/dist/esm/editor/useCrossFrameState.mjs +1 -112
  128. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  129. package/dist/esm/editor/useCrossURLPathState.mjs +1 -62
  130. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  131. package/dist/esm/editor/useEditedContentRenderer.mjs +1 -26
  132. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  133. package/dist/esm/editor/useEditor.mjs +1 -23
  134. package/dist/esm/editor/useEditor.mjs.map +1 -1
  135. package/dist/esm/editor/useIframeClickInterceptor.mjs +1 -36
  136. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  137. package/dist/esm/getDictionary.mjs +1 -15
  138. package/dist/esm/getDictionary.mjs.map +1 -1
  139. package/dist/esm/getIntlayer.mjs +1 -16
  140. package/dist/esm/getIntlayer.mjs.map +1 -1
  141. package/dist/esm/index.mjs +1 -14
  142. package/dist/esm/markdown/index.mjs +1 -3
  143. package/dist/esm/markdown/installIntlayerMarkdown.mjs +1 -68
  144. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  145. package/dist/esm/plugins.mjs +1 -182
  146. package/dist/esm/plugins.mjs.map +1 -1
  147. package/dist/esm/renderIntlayerNode.mjs +1 -26
  148. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  149. package/dist/esm/webpack/index.mjs +1 -3
  150. package/dist/esm/webpack/mergeConfig.mjs +1 -42
  151. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  152. package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
  153. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  154. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +1 -1
  155. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  156. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +1 -1
  157. package/dist/types/getDictionary.d.ts +3 -3
  158. package/dist/types/getDictionary.d.ts.map +1 -1
  159. package/dist/types/getIntlayer.d.ts +1 -1
  160. package/dist/types/getIntlayer.d.ts.map +1 -1
  161. package/dist/types/index.d.ts +1 -1
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/markdown/installIntlayerMarkdown.d.ts +1 -1
  164. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
  165. package/dist/types/plugins.d.ts +1 -1
  166. package/dist/types/plugins.d.ts.map +1 -1
  167. package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
  168. package/package.json +9 -9
@@ -1,107 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_decorateMetadata = require('../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.cjs');
4
- const require_decorate = require('../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs');
5
- let _angular_common = require("@angular/common");
6
- let _angular_core = require("@angular/core");
7
-
8
- //#region src/UI/ContentSelector.component.ts
9
- var _ref;
10
- const DEFAULT_PRESS_DETECT_DURATION = 250;
11
- let ContentSelectorComponent = class ContentSelectorComponent {
12
- onClickOutside;
13
- pressDuration;
14
- isSelecting;
15
- click = new _angular_core.EventEmitter();
16
- press = new _angular_core.EventEmitter();
17
- containerRef;
18
- isHovered = (0, _angular_core.signal)(false);
19
- isSelectingState = (0, _angular_core.signal)(false);
20
- pressTimerRef = null;
21
- isSelectingComputed = (0, _angular_core.computed)(() => this.isSelecting ?? this.isSelectingState());
22
- isStringSlot = (0, _angular_core.computed)(() => {
23
- return true;
24
- });
25
- ngOnInit() {
26
- this.isSelectingState.set(this.isSelecting ?? false);
27
- }
28
- ngOnDestroy() {
29
- this.clearPressTimer();
30
- }
31
- onDocumentMouseDown(event) {
32
- this.handleClickOutside(event);
33
- }
34
- handleOnLongPress() {
35
- this.isSelectingState.set(true);
36
- this.press.emit();
37
- }
38
- startPressTimer() {
39
- this.pressTimerRef = setTimeout(() => {
40
- this.handleOnLongPress();
41
- }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);
42
- }
43
- clearPressTimer() {
44
- if (this.pressTimerRef) {
45
- clearTimeout(this.pressTimerRef);
46
- this.pressTimerRef = null;
47
- }
48
- }
49
- handleMouseDown() {
50
- this.clearPressTimer();
51
- this.startPressTimer();
52
- }
53
- handleMouseUp() {
54
- this.isHovered.set(false);
55
- this.clearPressTimer();
56
- }
57
- handleClickOutside(event) {
58
- if (this.containerRef?.nativeElement && !this.containerRef.nativeElement.contains(event.target)) {
59
- this.isSelectingState.set(false);
60
- this.onClickOutside?.();
61
- }
62
- }
63
- handleClick(e) {
64
- if (this.isSelectingComputed()) {
65
- e.preventDefault();
66
- e.stopPropagation();
67
- }
68
- this.click.emit(e);
69
- }
70
- handleBlur() {
71
- this.isSelectingState.set(false);
72
- }
73
- onMouseEnter() {
74
- this.isHovered.set(true);
75
- }
76
- getContainerStyle() {
77
- return {
78
- display: this.isStringSlot() ? "inline" : "inline-block",
79
- cursor: "pointer",
80
- userSelect: "none",
81
- borderRadius: "0.375rem",
82
- outlineWidth: "2px",
83
- outlineOffset: "4px",
84
- outlineStyle: "solid",
85
- outlineColor: this.isSelectingComputed() || this.isHovered() ? "inherit" : "transparent",
86
- transition: "all 100ms 50ms ease-in-out"
87
- };
88
- }
89
- };
90
- require_decorate.__decorate([(0, _angular_core.Input)(), require_decorateMetadata.__decorateMetadata("design:type", Function)], ContentSelectorComponent.prototype, "onClickOutside", void 0);
91
- require_decorate.__decorate([(0, _angular_core.Input)(), require_decorateMetadata.__decorateMetadata("design:type", Number)], ContentSelectorComponent.prototype, "pressDuration", void 0);
92
- require_decorate.__decorate([(0, _angular_core.Input)(), require_decorateMetadata.__decorateMetadata("design:type", Boolean)], ContentSelectorComponent.prototype, "isSelecting", void 0);
93
- require_decorate.__decorate([(0, _angular_core.Output)(), require_decorateMetadata.__decorateMetadata("design:type", Object)], ContentSelectorComponent.prototype, "click", void 0);
94
- require_decorate.__decorate([(0, _angular_core.Output)(), require_decorateMetadata.__decorateMetadata("design:type", Object)], ContentSelectorComponent.prototype, "press", void 0);
95
- require_decorate.__decorate([(0, _angular_core.ViewChild)("containerRef", { static: true }), require_decorateMetadata.__decorateMetadata("design:type", Object)], ContentSelectorComponent.prototype, "containerRef", void 0);
96
- require_decorate.__decorate([
97
- (0, _angular_core.HostListener)("document:mousedown", ["$event"]),
98
- require_decorateMetadata.__decorateMetadata("design:type", Function),
99
- require_decorateMetadata.__decorateMetadata("design:paramtypes", [typeof (_ref = typeof MouseEvent !== "undefined" && MouseEvent) === "function" ? _ref : Object]),
100
- require_decorateMetadata.__decorateMetadata("design:returntype", void 0)
101
- ], ContentSelectorComponent.prototype, "onDocumentMouseDown", null);
102
- ContentSelectorComponent = require_decorate.__decorate([(0, _angular_core.Component)({
103
- selector: "app-content-selector",
104
- template: `
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.cjs`),t=require(`../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs`);let n=require(`@angular/common`),r=require(`@angular/core`);var i;let a=class{onClickOutside;pressDuration;isSelecting;click=new r.EventEmitter;press=new r.EventEmitter;containerRef;isHovered=(0,r.signal)(!1);isSelectingState=(0,r.signal)(!1);pressTimerRef=null;isSelectingComputed=(0,r.computed)(()=>this.isSelecting??this.isSelectingState());isStringSlot=(0,r.computed)(()=>!0);ngOnInit(){this.isSelectingState.set(this.isSelecting??!1)}ngOnDestroy(){this.clearPressTimer()}onDocumentMouseDown(e){this.handleClickOutside(e)}handleOnLongPress(){this.isSelectingState.set(!0),this.press.emit()}startPressTimer(){this.pressTimerRef=setTimeout(()=>{this.handleOnLongPress()},this.pressDuration??250)}clearPressTimer(){this.pressTimerRef&&=(clearTimeout(this.pressTimerRef),null)}handleMouseDown(){this.clearPressTimer(),this.startPressTimer()}handleMouseUp(){this.isHovered.set(!1),this.clearPressTimer()}handleClickOutside(e){this.containerRef?.nativeElement&&!this.containerRef.nativeElement.contains(e.target)&&(this.isSelectingState.set(!1),this.onClickOutside?.())}handleClick(e){this.isSelectingComputed()&&(e.preventDefault(),e.stopPropagation()),this.click.emit(e)}handleBlur(){this.isSelectingState.set(!1)}onMouseEnter(){this.isHovered.set(!0)}getContainerStyle(){return{display:this.isStringSlot()?`inline`:`inline-block`,cursor:`pointer`,userSelect:`none`,borderRadius:`0.375rem`,outlineWidth:`2px`,outlineOffset:`4px`,outlineStyle:`solid`,outlineColor:this.isSelectingComputed()||this.isHovered()?`inherit`:`transparent`,transition:`all 100ms 50ms ease-in-out`}}};t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Function)],a.prototype,`onClickOutside`,void 0),t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Number)],a.prototype,`pressDuration`,void 0),t.__decorate([(0,r.Input)(),e.__decorateMetadata(`design:type`,Boolean)],a.prototype,`isSelecting`,void 0),t.__decorate([(0,r.Output)(),e.__decorateMetadata(`design:type`,Object)],a.prototype,`click`,void 0),t.__decorate([(0,r.Output)(),e.__decorateMetadata(`design:type`,Object)],a.prototype,`press`,void 0),t.__decorate([(0,r.ViewChild)(`containerRef`,{static:!0}),e.__decorateMetadata(`design:type`,Object)],a.prototype,`containerRef`,void 0),t.__decorate([(0,r.HostListener)(`document:mousedown`,[`$event`]),e.__decorateMetadata(`design:type`,Function),e.__decorateMetadata(`design:paramtypes`,[typeof(i=typeof MouseEvent<`u`&&MouseEvent)==`function`?i:Object]),e.__decorateMetadata(`design:returntype`,void 0)],a.prototype,`onDocumentMouseDown`,null),a=t.__decorate([(0,r.Component)({selector:`app-content-selector`,template:`
105
2
  <span
106
3
  #containerRef
107
4
  role="button"
@@ -119,16 +16,5 @@ ContentSelectorComponent = require_decorate.__decorate([(0, _angular_core.Compon
119
16
  >
120
17
  <ng-content></ng-content>
121
18
  </span>
122
- `,
123
- standalone: true,
124
- imports: [_angular_common.CommonModule]
125
- })], ContentSelectorComponent);
126
-
127
- //#endregion
128
- Object.defineProperty(exports, 'ContentSelectorComponent', {
129
- enumerable: true,
130
- get: function () {
131
- return ContentSelectorComponent;
132
- }
133
- });
19
+ `,standalone:!0,imports:[n.CommonModule]})],a),Object.defineProperty(exports,`ContentSelectorComponent`,{enumerable:!0,get:function(){return a}});
134
20
  //# sourceMappingURL=ContentSelector.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelector.component.cjs","names":["EventEmitter","CommonModule"],"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;AA0B/B,qCAAM,yBAAsD;CACjE,AAAS;CACT,AAAS;CACT,AAAS;CAET,AAAU,QAAQ,IAAIA,4BAA0B;CAChD,AAAU,QAAQ,IAAIA,4BAAoB;CAE1C,AACA;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,AACA,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;;;uDAzGK;uDACA;uDACA;wDAEC;wDACA;0DAEE,gBAAgB,EAAE,QAAQ,MAAM,CAAC;;iCAyB9B,sBAAsB,CAAC,SAAS,CAAC;;;;;qFAzDtC;CACT,UAAU;CACV,UAAU;;;;;;;;;;;;;;;;;;;CAmBV,YAAY;CACZ,SAAS,CAACC,6BAAa;CACxB,CAAC"}
1
+ {"version":3,"file":"ContentSelector.component.cjs","names":["EventEmitter","CommonModule"],"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":"wVAyCO,IAAA,EAAA,KAA4D,CACjE,eACA,cACA,YAEA,MAAkB,IAAIA,EAAAA,aACtB,MAAkB,IAAIA,EAAAA,aAEtB,aAGA,WAAQ,EAAA,EAAA,QAAmB,GAAM,CACjC,kBAAQ,EAAA,EAAA,QAA0B,GAAM,CACxC,cAA8D,KAE9D,qBAAiB,EAAA,EAAA,cACT,KAAK,aAAe,KAAK,kBAAkB,CAClD,CAED,cAAiB,EAAA,EAAA,cAGR,GACP,CAEF,UAAiB,CACf,KAAK,iBAAiB,IAAI,KAAK,aAAe,GAAM,CAGtD,aAAoB,CAClB,KAAK,iBAAiB,CAGxB,oBACoB,EAAyB,CAC3C,KAAK,mBAAmB,EAAM,CAGhC,mBAAkC,CAChC,KAAK,iBAAiB,IAAI,GAAK,CAC/B,KAAK,MAAM,MAAM,CAGnB,iBAAgC,CAC9B,KAAK,cAAgB,eAAiB,CACpC,KAAK,mBAAmB,EACvB,KAAK,eAAiB,IAA8B,CAGzD,iBAAgC,CAC9B,AAEE,KAAK,iBADL,aAAa,KAAK,cAAc,CACX,MAIzB,iBAAwB,CACtB,KAAK,iBAAiB,CACtB,KAAK,iBAAiB,CAGxB,eAAsB,CACpB,KAAK,UAAU,IAAI,GAAM,CACzB,KAAK,iBAAiB,CAGxB,mBAA2B,EAAyB,CAEhD,KAAK,cAAc,eACnB,CAAC,KAAK,aAAa,cAAc,SAAS,EAAM,OAAe,GAE/D,KAAK,iBAAiB,IAAI,GAAM,CAChC,KAAK,kBAAkB,EAI3B,YAAY,EAAqB,CAC3B,KAAK,qBAAqB,GAC5B,EAAE,gBAAgB,CAClB,EAAE,iBAAiB,EAErB,KAAK,MAAM,KAAK,EAAE,CAGpB,YAAmB,CACjB,KAAK,iBAAiB,IAAI,GAAM,CAGlC,cAAqB,CACnB,KAAK,UAAU,IAAI,GAAK,CAG1B,mBAA4C,CAC1C,MAAO,CACL,QAAS,KAAK,cAAc,CAAG,SAAW,eAC1C,OAAQ,UACR,WAAY,OACZ,aAAc,WACd,aAAc,MACd,cAAe,MACf,aAAc,QACd,aACE,KAAK,qBAAqB,EAAI,KAAK,WAAW,CAC1C,UACA,cACN,WAAY,6BACb,8BAzGK,CAAA,EAAA,mBAAA,cAAA,SAAA,CAAA,CAAA,EAAA,UAAA,iBAAA,IAAA,GAAA,4BACA,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,gBAAA,IAAA,GAAA,4BACA,CAAA,EAAA,mBAAA,cAAA,QAAA,CAAA,CAAA,EAAA,UAAA,cAAA,IAAA,GAAA,6BAEC,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,QAAA,IAAA,GAAA,6BACA,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,QAAA,IAAA,GAAA,+BAEE,eAAgB,CAAE,OAAQ,GAAM,CAAC,CAAA,EAAA,mBAAA,cAAA,OAAA,CAAA,CAAA,EAAA,UAAA,eAAA,IAAA,GAAA,kCAyB9B,qBAAsB,CAAC,SAAS,CAAC,qRAzDtC,CACT,SAAU,uBACV,SAAU;;;;;;;;;;;;;;;;;;IAmBV,WAAY,GACZ,QAAS,CAACC,EAAAA,aAAa,CACxB,CAAC,CAAA,CAAA,EAAA"}
@@ -1,11 +1 @@
1
-
2
- //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
3
- function __decorate(decorators, target, key, desc) {
4
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
- return c > 3 && r && Object.defineProperty(target, key, r), r;
8
- }
9
-
10
- //#endregion
11
- exports.__decorate = __decorate;
1
+ function e(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}exports.__decorate=e;
@@ -1,8 +1 @@
1
-
2
- //#region \0@oxc-project+runtime@0.112.0/helpers/decorateMetadata.js
3
- function __decorateMetadata(k, v) {
4
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5
- }
6
-
7
- //#endregion
8
- exports.__decorateMetadata = __decorateMetadata;
1
+ function e(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}exports.__decorateMetadata=e;
@@ -1,29 +1 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -1,28 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_client_installIntlayer = require('./installIntlayer.cjs');
3
- const require_client_useDictionary = require('./useDictionary.cjs');
4
- const require_client_useDictionaryAsync = require('./useDictionaryAsync.cjs');
5
- const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
6
- const require_client_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
7
- const require_client_useIntl = require('./useIntl.cjs');
8
- const require_client_useIntlayer = require('./useIntlayer.cjs');
9
- const require_client_useLocale = require('./useLocale.cjs');
10
-
11
- exports.INTLAYER_TOKEN = require_client_installIntlayer.INTLAYER_TOKEN;
12
- Object.defineProperty(exports, 'IntlayerProvider', {
13
- enumerable: true,
14
- get: function () {
15
- return require_client_installIntlayer.IntlayerProvider;
16
- }
17
- });
18
- exports.createIntlayerClient = require_client_installIntlayer.createIntlayerClient;
19
- exports.installIntlayer = require_client_installIntlayer.installIntlayer;
20
- exports.isUpdatableNode = require_client_useIntlayer.isUpdatableNode;
21
- exports.provideIntlayer = require_client_installIntlayer.provideIntlayer;
22
- exports.useDictionary = require_client_useDictionary.useDictionary;
23
- exports.useDictionaryAsync = require_client_useDictionaryAsync.useDictionaryAsync;
24
- exports.useDictionaryDynamic = require_client_useDictionaryDynamic.useDictionaryDynamic;
25
- exports.useIntl = require_client_useIntl.useIntl;
26
- exports.useIntlayer = require_client_useIntlayer.useIntlayer;
27
- exports.useLoadDynamic = require_client_useLoadDynamic.useLoadDynamic;
28
- exports.useLocale = require_client_useLocale.useLocale;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./installIntlayer.cjs`),t=require(`./useDictionary.cjs`),n=require(`./useDictionaryAsync.cjs`),r=require(`./useLoadDynamic.cjs`),i=require(`./useDictionaryDynamic.cjs`),a=require(`./useIntl.cjs`),o=require(`./useIntlayer.cjs`),s=require(`./useLocale.cjs`);exports.INTLAYER_TOKEN=e.INTLAYER_TOKEN,Object.defineProperty(exports,`IntlayerProvider`,{enumerable:!0,get:function(){return e.IntlayerProvider}}),exports.createIntlayerClient=e.createIntlayerClient,exports.installIntlayer=e.installIntlayer,exports.isUpdatableNode=o.isUpdatableNode,exports.provideIntlayer=e.provideIntlayer,exports.useDictionary=t.useDictionary,exports.useDictionaryAsync=n.useDictionaryAsync,exports.useDictionaryDynamic=i.useDictionaryDynamic,exports.useIntl=a.useIntl,exports.useIntlayer=o.useIntlayer,exports.useLoadDynamic=r.useLoadDynamic,exports.useLocale=s.useLocale;
@@ -1,78 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_decorate = require('../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs');
4
- let _angular_core = require("@angular/core");
5
- let _intlayer_config_built = require("@intlayer/config/built");
6
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
7
-
8
- //#region src/client/installIntlayer.ts
9
- const INTLAYER_TOKEN = new _angular_core.InjectionToken("intlayer");
10
- /**
11
- * Singleton instance
12
- */
13
- let instance = null;
14
- let IntlayerProvider = class IntlayerProvider {
15
- isCookieEnabled = (0, _angular_core.signal)(true);
16
- _locale = (0, _angular_core.signal)(_intlayer_config_built.default.internationalization?.defaultLocale);
17
- locale = this._locale.asReadonly();
18
- setLocale = (locale) => {
19
- this._locale.set(locale);
20
- };
21
- };
22
- IntlayerProvider = require_decorate.__decorate([(0, _angular_core.Injectable)({ providedIn: "root" })], IntlayerProvider);
23
- /**
24
- * Create and return a single IntlayerProvider instance
25
- */
26
- const createIntlayerClient = (locale, isCookieEnabled = true) => {
27
- if (instance) return instance;
28
- instance = new IntlayerProvider();
29
- if (locale) instance.setLocale(locale);
30
- instance.isCookieEnabled.set(isCookieEnabled);
31
- return instance;
32
- };
33
- /**
34
- * Provides Intlayer to your Angular application.
35
- *
36
- * This function should be used in your application's provider list (e.g., in `app.config.ts`)
37
- * to initialize the Intlayer service.
38
- *
39
- * @param locale - Initial locale to use.
40
- * @param isCookieEnabled - Whether to store the locale in cookies.
41
- * @returns A provider configuration for Intlayer.
42
- *
43
- * @example
44
- * ```ts
45
- * // app.config.ts
46
- * import { ApplicationConfig } from '@angular/core';
47
- * import { provideIntlayer } from 'angular-intlayer';
48
- *
49
- * export const appConfig: ApplicationConfig = {
50
- * providers: [
51
- * provideIntlayer({ locale: 'en' }),
52
- * ],
53
- * };
54
- * ```
55
- */
56
- const provideIntlayer = (locale, isCookieEnabled = true) => ({
57
- provide: INTLAYER_TOKEN,
58
- useValue: installIntlayer(locale, isCookieEnabled)
59
- });
60
- /**
61
- * Helper to install the Intlayer provider.
62
- */
63
- const installIntlayer = (locale, isCookieEnabled = true) => {
64
- return createIntlayerClient(locale, isCookieEnabled);
65
- };
66
-
67
- //#endregion
68
- exports.INTLAYER_TOKEN = INTLAYER_TOKEN;
69
- Object.defineProperty(exports, 'IntlayerProvider', {
70
- enumerable: true,
71
- get: function () {
72
- return IntlayerProvider;
73
- }
74
- });
75
- exports.createIntlayerClient = createIntlayerClient;
76
- exports.installIntlayer = installIntlayer;
77
- exports.provideIntlayer = provideIntlayer;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.cjs`);let n=require(`@angular/core`),r=require(`@intlayer/config/built`);r=e.__toESM(r);const i=new n.InjectionToken(`intlayer`);let a=null,o=class{isCookieEnabled=(0,n.signal)(!0);_locale=(0,n.signal)(r.default.internationalization?.defaultLocale);locale=this._locale.asReadonly();setLocale=e=>{this._locale.set(e)}};o=t.__decorate([(0,n.Injectable)({providedIn:`root`})],o);const s=(e,t=!0)=>a||(a=new o,e&&a.setLocale(e),a.isCookieEnabled.set(t),a),c=(e,t=!0)=>({provide:i,useValue:l(e,t)}),l=(e,t=!0)=>s(e,t);exports.INTLAYER_TOKEN=i,Object.defineProperty(exports,`IntlayerProvider`,{enumerable:!0,get:function(){return o}}),exports.createIntlayerClient=s,exports.installIntlayer=l,exports.provideIntlayer=c;
78
2
  //# sourceMappingURL=installIntlayer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"installIntlayer.cjs","names":["InjectionToken","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 * Provides Intlayer to your Angular application.\n *\n * This function should be used in your application's provider list (e.g., in `app.config.ts`)\n * to initialize the Intlayer service.\n *\n * @param locale - Initial locale to use.\n * @param isCookieEnabled - Whether to store the locale in cookies.\n * @returns A provider configuration for Intlayer.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { ApplicationConfig } from '@angular/core';\n * import { provideIntlayer } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideIntlayer({ locale: 'en' }),\n * ],\n * };\n * ```\n */\nexport const provideIntlayer = (\n locale?: LocalesValues,\n isCookieEnabled = true\n) => ({\n provide: INTLAYER_TOKEN,\n useValue: installIntlayer(locale, isCookieEnabled),\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,IAAI,WAAoC;AAKjC,6BAAM,iBAAiB;CAC5B,4CAAyB,KAAK;CAC9B,AAAQ,oCACNC,+BAAc,sBAAsB,cACrC;CAED,AAAS,SAAgC,KAAK,QAAQ,YAAY;CAElE,aAAa,WAA0B;AACrC,OAAK,QAAQ,IAAI,OAAO;;;8EAZhB,EACV,YAAY,QACb,CAAC;;;;AAiBF,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;;;;;;;;;;;;;;;;;;;;;;;;;AA0BT,MAAa,mBACX,QACA,kBAAkB,UACd;CACJ,SAAS;CACT,UAAU,gBAAgB,QAAQ,gBAAgB;CACnD;;;;AAKD,MAAa,mBACX,QACA,kBAAkB,SACf;AAMH,QALe,qBAAqB,QAAQ,gBAAgB"}
1
+ {"version":3,"file":"installIntlayer.cjs","names":["InjectionToken","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 * Provides Intlayer to your Angular application.\n *\n * This function should be used in your application's provider list (e.g., in `app.config.ts`)\n * to initialize the Intlayer service.\n *\n * @param locale - Initial locale to use.\n * @param isCookieEnabled - Whether to store the locale in cookies.\n * @returns A provider configuration for Intlayer.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { ApplicationConfig } from '@angular/core';\n * import { provideIntlayer } from 'angular-intlayer';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideIntlayer({ locale: 'en' }),\n * ],\n * };\n * ```\n */\nexport const provideIntlayer = (\n locale?: LocalesValues,\n isCookieEnabled = true\n) => ({\n provide: INTLAYER_TOKEN,\n useValue: installIntlayer(locale, isCookieEnabled),\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":"sRAIA,MAAa,EAAiB,IAAIA,EAAAA,eAAiC,WAAW,CAK9E,IAAI,EAAoC,KAKjC,EAAA,KAAuB,CAC5B,iBAAA,EAAA,EAAA,QAAyB,GAAK,CAC9B,SAAQ,EAAA,EAAA,QACNC,EAAAA,QAAc,sBAAsB,cACrC,CAED,OAAyC,KAAK,QAAQ,YAAY,CAElE,UAAa,GAA0B,CACrC,KAAK,QAAQ,IAAI,EAAO,oCAZhB,CACV,WAAY,OACb,CAAC,CAAA,CAAA,EAAA,CAiBF,MAAa,GACX,EACA,EAAkB,KAEd,IAEJ,EAAW,IAAI,EAEX,GACF,EAAS,UAAU,EAAO,CAE5B,EAAS,gBAAgB,IAAI,EAAgB,CAEtC,GA0BI,GACX,EACA,EAAkB,MACd,CACJ,QAAS,EACT,SAAU,EAAgB,EAAQ,EAAgB,CACnD,EAKY,GACX,EACA,EAAkB,KAEH,EAAqB,EAAQ,EAAgB"}
@@ -1,16 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_client_installIntlayer = require('./installIntlayer.cjs');
4
- const require_getDictionary = require('../getDictionary.cjs');
5
- let _angular_core = require("@angular/core");
6
-
7
- //#region src/client/useDictionary.ts
8
- const useDictionary = (dictionary, locale) => {
9
- const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
10
- const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale());
11
- return (0, _angular_core.computed)(() => require_getDictionary.getDictionary(dictionary, localeTarget()));
12
- };
13
-
14
- //#endregion
15
- exports.useDictionary = useDictionary;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayer.cjs`),t=require(`../getDictionary.cjs`);let n=require(`@angular/core`);const r=(r,i)=>{let a=(0,n.inject)(e.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a?.locale());return(0,n.computed)(()=>t.getDictionary(r,o()))};exports.useDictionary=r;
16
2
  //# sourceMappingURL=useDictionary.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } 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): Signal<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; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;AAMA,MAAa,iBACX,YACA,WAC+C;CAC/C,MAAM,qCAAoCA,8CAAe;CAEzD,MAAM,iDAA8B,UAAU,UAAU,QAAQ,CAAC;AAOjE,0CAHEC,oCAAgC,YAAY,cAAc,CAAC,CAC5D"}
1
+ {"version":3,"file":"useDictionary.cjs","names":["INTLAYER_TOKEN","getDictionary"],"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject, type Signal } 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): Signal<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; // all consumers keep full reactivity\n};\n"],"mappings":"0NAMA,MAAa,GACX,EACA,IAC+C,CAC/C,IAAM,GAAA,EAAA,EAAA,QAAoCA,EAAAA,eAAe,CAEnD,GAAA,EAAA,EAAA,cAA8B,GAAU,GAAU,QAAQ,CAAC,CAOjE,OAAA,EAAA,EAAA,cAHEC,EAAAA,cAAgC,EAAY,GAAc,CAAC,CAC5D"}
@@ -1,25 +1,2 @@
1
- 'use client';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
- const require_client_installIntlayer = require('./installIntlayer.cjs');
6
- const require_client_useDictionary = require('./useDictionary.cjs');
7
- let _angular_core = require("@angular/core");
8
- let _intlayer_config_built = require("@intlayer/config/built");
9
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
10
-
11
- //#region src/client/useDictionaryAsync.ts
12
- /**
13
- * On the server side, Hook that transform a dictionary and return the content
14
- *
15
- * If the locale is not provided, it will use the locale from the client context
16
- */
17
- const useDictionaryAsync = async (dictionaryPromise, locale) => {
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
- return require_client_useDictionary.useDictionary(await dictionaryPromise[localeTarget()]?.(), localeTarget());
21
- };
22
-
23
- //#endregion
24
- exports.useDictionaryAsync = useDictionaryAsync;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./installIntlayer.cjs`),n=require(`./useDictionary.cjs`);let r=require(`@angular/core`),i=require(`@intlayer/config/built`);i=e.__toESM(i);const a=async(e,a)=>{let o=(0,r.inject)(t.INTLAYER_TOKEN),s=(0,r.computed)(()=>a??o?.locale()??i.default?.internationalization.defaultLocale);return n.useDictionary(await e[s()]?.(),s())};exports.useDictionaryAsync=a;
25
2
  //# sourceMappingURL=useDictionaryAsync.cjs.map
@@ -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,qCAAoCA,8CAAe;CAEzD,MAAM,iDAEF,UACA,UAAU,QAAQ,IAClBC,gCAAe,qBAAqB,cACvC;AAID,QAAOC,2CAFY,MAAM,kBAAkB,cAAc,KAAK,EAE7B,cAAc,CAAQ"}
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":"2RAiBA,MAAa,EAAqB,MAChC,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,QAAoCA,EAAAA,eAAe,CAEnD,GAAA,EAAA,EAAA,cAEF,GACA,GAAU,QAAQ,EAClBC,EAAAA,SAAe,qBAAqB,cACvC,CAID,OAAOC,EAAAA,cAFY,MAAM,EAAkB,GAAc,KAAK,CAE7B,GAAc,CAAQ"}
@@ -1,26 +1,2 @@
1
- 'use client';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
- const require_client_installIntlayer = require('./installIntlayer.cjs');
6
- const require_client_useDictionary = require('./useDictionary.cjs');
7
- const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
8
- let _angular_core = require("@angular/core");
9
- let _intlayer_config_built = require("@intlayer/config/built");
10
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
11
-
12
- //#region src/client/useDictionaryDynamic.ts
13
- /**
14
- * On the server side, Hook that transform a dictionary and return the content
15
- *
16
- * If the locale is not provided, it will use the locale from the client context
17
- */
18
- const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
19
- const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
20
- const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer?.locale() ?? _intlayer_config_built.default?.internationalization.defaultLocale);
21
- return require_client_useDictionary.useDictionary(require_client_useLoadDynamic.useLoadDynamic(`${String(key)}.${localeTarget()}`, dictionaryPromise[localeTarget()]?.()), localeTarget());
22
- };
23
-
24
- //#endregion
25
- exports.useDictionaryDynamic = useDictionaryDynamic;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./installIntlayer.cjs`),n=require(`./useDictionary.cjs`),r=require(`./useLoadDynamic.cjs`);let i=require(`@angular/core`),a=require(`@intlayer/config/built`);a=e.__toESM(a);const o=(e,o,s)=>{let c=(0,i.inject)(t.INTLAYER_TOKEN),l=(0,i.computed)(()=>s??c?.locale()??a.default?.internationalization.defaultLocale);return n.useDictionary(r.useLoadDynamic(`${String(o)}.${l()}`,e[l()]?.()),l())};exports.useDictionaryDynamic=o;
26
2
  //# sourceMappingURL=useDictionaryDynamic.cjs.map
@@ -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,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
+ {"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":"6TAmBA,MAAa,GAIX,EACA,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,QAAoCA,EAAAA,eAAe,CAEnD,GAAA,EAAA,EAAA,cAEF,GACA,GAAU,QAAQ,EAClBC,EAAAA,SAAe,qBAAqB,cACvC,CAOD,OAAOC,EAAAA,cALYC,EAAAA,eACjB,GAAG,OAAO,EAAI,CAAC,GAAG,GAAc,GAChC,EAAkB,GAAc,KAAK,CACtC,CAEgC,GAAc,CAAQ"}
@@ -1,41 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_client_installIntlayer = require('./installIntlayer.cjs');
4
- let _intlayer_core = require("@intlayer/core");
5
- let _angular_core = require("@angular/core");
6
-
7
- //#region src/client/useIntl.ts
8
- /**
9
- * Angular composable that provides a locale-bound `Intl` object.
10
- *
11
- * It acts exactly like the native `Intl` object, but acts as a proxy to:
12
- * 1. Inject the current locale automatically if none is provided.
13
- * 2. Use the performance-optimized `CachedIntl` under the hood.
14
- *
15
- * @example
16
- * ```typescript
17
- * import { Component, computed } from '@angular/core';
18
- * import { useIntl } from 'angular-intlayer';
19
- *
20
- * @Component({ ... })
21
- * export class MyComponent {
22
- * intl = useIntl();
23
- * formattedPrice = computed(() =>
24
- * new this.intl().NumberFormat({
25
- * style: 'currency',
26
- * currency: 'USD'
27
- * }).format(123.45)
28
- * );
29
- * }
30
- * ```
31
- */
32
- const useIntl = (locale) => {
33
- const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.IntlayerProvider);
34
- return (0, _angular_core.computed)(() => {
35
- return (0, _intlayer_core.bindIntl)(locale ?? intlayer.locale());
36
- });
37
- };
38
-
39
- //#endregion
40
- exports.useIntl = useIntl;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayer.cjs`);let t=require(`@angular/core`),n=require(`@intlayer/core/formatters`);const r=r=>{let i=(0,t.inject)(e.IntlayerProvider);return(0,t.computed)(()=>(0,n.bindIntl)(r??i.locale()))};exports.useIntl=r;
41
2
  //# sourceMappingURL=useIntl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/useIntl.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport { bindIntl } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular composable that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```typescript\n * import { Component, computed } from '@angular/core';\n * import { useIntl } from 'angular-intlayer';\n *\n * @Component({ ... })\n * export class MyComponent {\n * intl = useIntl();\n * formattedPrice = computed(() =>\n * new this.intl().NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45)\n * );\n * }\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const intlayer = inject(IntlayerProvider);\n\n return computed(() => {\n const currentLocale = locale ?? intlayer.locale();\n\n return bindIntl(currentLocale);\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,WAAW,WAA2B;CACjD,MAAM,qCAAkBA,gDAAiB;AAEzC,0CAAsB;AAGpB,sCAFsB,UAAU,SAAS,QAAQ,CAEnB;GAC9B"}
1
+ {"version":3,"file":"useIntl.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/useIntl.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport { bindIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types';\nimport { IntlayerProvider } from './installIntlayer';\n\n/**\n * Angular composable that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```typescript\n * import { Component, computed } from '@angular/core';\n * import { useIntl } from 'angular-intlayer';\n *\n * @Component({ ... })\n * export class MyComponent {\n * intl = useIntl();\n * formattedPrice = computed(() =>\n * new this.intl().NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45)\n * );\n * }\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const intlayer = inject(IntlayerProvider);\n\n return computed(() => {\n const currentLocale = locale ?? intlayer.locale();\n\n return bindIntl(currentLocale);\n });\n};\n"],"mappings":"+NA6BA,MAAa,EAAW,GAA2B,CACjD,IAAM,GAAA,EAAA,EAAA,QAAkBA,EAAAA,iBAAiB,CAEzC,OAAA,EAAA,EAAA,eAGE,EAAA,EAAA,UAFsB,GAAU,EAAS,QAAQ,CAEnB,CAC9B"}
@@ -1,45 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_client_installIntlayer = require('./installIntlayer.cjs');
4
- const require_getIntlayer = require('../getIntlayer.cjs');
5
- let _angular_core = require("@angular/core");
6
-
7
- //#region src/client/useIntlayer.ts
8
- /** guard utility - true only for objects generated by `renderIntlayerNode()` */
9
- const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.__update === "function";
10
- /**
11
- * Angular hook that picks one dictionary by its key and returns its reactive content.
12
- *
13
- * It utilizes Angular signals to provide deep reactivity, ensuring your components
14
- * update automatically when the locale changes.
15
- *
16
- * @param key - The unique key of the dictionary to retrieve.
17
- * @param locale - Optional locale to override the current context locale.
18
- * @returns The transformed dictionary content.
19
- *
20
- * @example
21
- * ```ts
22
- * import { Component } from '@angular/core';
23
- * import { useIntlayer } from 'angular-intlayer';
24
- *
25
- * @Component({
26
- * standalone: true,
27
- * selector: 'app-my-component',
28
- * template: `<div>{{ content().myField.value }}</div>`,
29
- * })
30
- * export class MyComponent {
31
- * content = useIntlayer('my-dictionary-key');
32
- * }
33
- * ```
34
- */
35
- const useIntlayer = (key, locale) => {
36
- const intlayer = (0, _angular_core.inject)(require_client_installIntlayer.INTLAYER_TOKEN);
37
- /** which locale should we use right now? */
38
- const localeTarget = (0, _angular_core.computed)(() => locale ?? intlayer.locale());
39
- return (0, _angular_core.computed)(() => require_getIntlayer.getIntlayer(key, localeTarget()));
40
- };
41
-
42
- //#endregion
43
- exports.isUpdatableNode = isUpdatableNode;
44
- exports.useIntlayer = useIntlayer;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./installIntlayer.cjs`),t=require(`../getIntlayer.cjs`);let n=require(`@angular/core`);const r=e=>!!e&&typeof e==`object`&&typeof e.__update==`function`,i=(r,i)=>{let a=(0,n.inject)(e.INTLAYER_TOKEN),o=(0,n.computed)(()=>i??a.locale());return(0,n.computed)(()=>t.getIntlayer(r,o()))};exports.isUpdatableNode=r,exports.useIntlayer=i;
45
2
  //# sourceMappingURL=useIntlayer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } 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\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\n * }\n * ```\n */\nexport const useIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: LocalesValues\n): Signal<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; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;AAWA,MAAa,mBACX,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BnC,MAAa,eACX,KACA,WAC+D;CAC/D,MAAM,qCAAoCA,8CAAe;;CAGzD,MAAM,iDAA8B,UAAU,SAAS,QAAQ,CAAC;AAMhE,0CAF+BC,gCAAkB,KAAK,cAAc,CAAM,CAAC"}
1
+ {"version":3,"file":"useIntlayer.cjs","names":["INTLAYER_TOKEN","getIntlayer"],"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject, type Signal } 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\n/**\n * Angular hook that picks one dictionary by its key and returns its reactive content.\n *\n * It utilizes Angular signals to provide deep reactivity, ensuring your components\n * update automatically when the locale changes.\n *\n * @param key - The unique key of the dictionary to retrieve.\n * @param locale - Optional locale to override the current context locale.\n * @returns The transformed dictionary content.\n *\n * @example\n * ```ts\n * import { Component } from '@angular/core';\n * import { useIntlayer } from 'angular-intlayer';\n *\n * @Component({\n * standalone: true,\n * selector: 'app-my-component',\n * template: `<div>{{ content().myField.value }}</div>`,\n * })\n * export class MyComponent {\n * content = useIntlayer('my-dictionary-key');\n * }\n * ```\n */\nexport const useIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n key: T,\n locale?: LocalesValues\n): Signal<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; // all consumers keep full reactivity\n};\n"],"mappings":"wNAWA,MAAa,EACX,GAEA,CAAC,CAAC,GACF,OAAO,GAAQ,UACf,OAAQ,EAAY,UAAa,WA2BtB,GACX,EACA,IAC+D,CAC/D,IAAM,GAAA,EAAA,EAAA,QAAoCA,EAAAA,eAAe,CAGnD,GAAA,EAAA,EAAA,cAA8B,GAAU,EAAS,QAAQ,CAAC,CAMhE,OAAA,EAAA,EAAA,cAF+BC,EAAAA,YAAkB,EAAK,GAAc,CAAM,CAAC"}
@@ -1,29 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _angular_core = require("@angular/core");
4
-
5
- //#region src/client/useLoadDynamic.ts
6
- /**
7
- * A "synchronous" loader for a dynamically‐imported JSON (or anything).
8
- *
9
- * - Immediately returns a reactive signal so that Angular can properly track changes.
10
- * - When the Promise resolves, it replaces the signal's value with the real data.
11
- */
12
- const useLoadDynamic = (key, promise) => {
13
- const cache = useLoadDynamic._cache || (useLoadDynamic._cache = /* @__PURE__ */ new Map());
14
- const container = (0, _angular_core.signal)({});
15
- if (!cache.has(key)) {
16
- const p = promise.then((real) => {
17
- container.set(real);
18
- return real;
19
- });
20
- cache.set(key, p);
21
- } else cache.get(key)?.then((real) => {
22
- container.set(real);
23
- });
24
- return container();
25
- };
26
-
27
- //#endregion
28
- exports.useLoadDynamic = useLoadDynamic;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@angular/core`);const t=(n,r)=>{let i=t._cache||=new Map,a=(0,e.signal)({});if(i.has(n))i.get(n)?.then(e=>{a.set(e)});else{let e=r.then(e=>(a.set(e),e));i.set(n,e)}return a()};exports.useLoadDynamic=t;
29
2
  //# sourceMappingURL=useLoadDynamic.cjs.map