angular-intlayer 6.1.6 → 7.0.0-canary.2

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 (237) hide show
  1. package/dist/cjs/UI/ContentSelector.component.cjs +94 -121
  2. package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
  3. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/cjs/client/index.cjs +19 -35
  5. package/dist/cjs/client/installIntlayer.cjs +39 -68
  6. package/dist/cjs/client/installIntlayer.cjs.map +1 -1
  7. package/dist/cjs/client/useDictionary.cjs +13 -36
  8. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  9. package/dist/cjs/client/useDictionaryAsync.cjs +23 -48
  10. package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
  11. package/dist/cjs/client/useDictionaryDynamic.cjs +24 -52
  12. package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
  13. package/dist/cjs/client/useIntlayer.cjs +16 -36
  14. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  15. package/dist/cjs/client/useLoadDynamic.cjs +26 -42
  16. package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
  17. package/dist/cjs/client/useLocale.cjs +35 -67
  18. package/dist/cjs/client/useLocale.cjs.map +1 -1
  19. package/dist/cjs/client/useLocaleStorage.cjs +61 -0
  20. package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
  21. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +41 -63
  22. package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
  23. package/dist/cjs/editor/EditedContentRenderer.component.cjs +44 -75
  24. package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
  25. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +25 -45
  26. package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
  27. package/dist/cjs/editor/communicator.cjs +55 -73
  28. package/dist/cjs/editor/communicator.cjs.map +1 -1
  29. package/dist/cjs/editor/configuration.cjs +21 -54
  30. package/dist/cjs/editor/configuration.cjs.map +1 -1
  31. package/dist/cjs/editor/createSharedComposable.cjs +46 -63
  32. package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
  33. package/dist/cjs/editor/dictionariesRecord.cjs +47 -77
  34. package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
  35. package/dist/cjs/editor/editedContent.cjs +58 -71
  36. package/dist/cjs/editor/editedContent.cjs.map +1 -1
  37. package/dist/cjs/editor/editorEnabled.cjs +45 -70
  38. package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
  39. package/dist/cjs/editor/editorLocale.cjs +21 -45
  40. package/dist/cjs/editor/editorLocale.cjs.map +1 -1
  41. package/dist/cjs/editor/focusDictionary.cjs +58 -74
  42. package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
  43. package/dist/cjs/editor/index.cjs +9 -38
  44. package/dist/cjs/editor/installIntlayerEditor.cjs +46 -64
  45. package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
  46. package/dist/cjs/editor/useCrossFrameMessageListener.cjs +63 -72
  47. package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
  48. package/dist/cjs/editor/useCrossFrameState.cjs +108 -88
  49. package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
  50. package/dist/cjs/editor/useCrossURLPathState.cjs +64 -69
  51. package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
  52. package/dist/cjs/editor/useEditedContentRenderer.cjs +25 -54
  53. package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
  54. package/dist/cjs/editor/useEditor.cjs +22 -44
  55. package/dist/cjs/editor/useEditor.cjs.map +1 -1
  56. package/dist/cjs/editor/useIframeClickInterceptor.cjs +38 -59
  57. package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
  58. package/dist/cjs/getDictionary.cjs +14 -39
  59. package/dist/cjs/getDictionary.cjs.map +1 -1
  60. package/dist/cjs/getIntlayer.cjs +14 -35
  61. package/dist/cjs/getIntlayer.cjs.map +1 -1
  62. package/dist/cjs/index.cjs +32 -31
  63. package/dist/cjs/markdown/index.cjs +6 -23
  64. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +33 -60
  65. package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
  66. package/dist/cjs/plugins.cjs +77 -108
  67. package/dist/cjs/plugins.cjs.map +1 -1
  68. package/dist/cjs/renderIntlayerNode.cjs +16 -56
  69. package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
  70. package/dist/cjs/webpack/index.cjs +3 -23
  71. package/dist/cjs/webpack/mergeConfig.cjs +33 -68
  72. package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
  73. package/dist/esm/UI/ContentSelector.component.mjs +89 -104
  74. package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
  75. package/dist/esm/client/index.mjs +9 -8
  76. package/dist/esm/client/installIntlayer.mjs +29 -27
  77. package/dist/esm/client/installIntlayer.mjs.map +1 -1
  78. package/dist/esm/client/useDictionary.mjs +10 -11
  79. package/dist/esm/client/useDictionary.mjs.map +1 -1
  80. package/dist/esm/client/useDictionaryAsync.mjs +18 -12
  81. package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
  82. package/dist/esm/client/useDictionaryDynamic.mjs +18 -15
  83. package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
  84. package/dist/esm/client/useIntlayer.mjs +12 -10
  85. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  86. package/dist/esm/client/useLoadDynamic.mjs +23 -17
  87. package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
  88. package/dist/esm/client/useLocale.mjs +30 -31
  89. package/dist/esm/client/useLocale.mjs.map +1 -1
  90. package/dist/esm/client/useLocaleStorage.mjs +54 -0
  91. package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
  92. package/dist/esm/editor/ContentSelectorWrapper.component.mjs +32 -34
  93. package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
  94. package/dist/esm/editor/EditedContentRenderer.component.mjs +38 -49
  95. package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
  96. package/dist/esm/editor/EditorSelectorRenderer.component.mjs +19 -18
  97. package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
  98. package/dist/esm/editor/communicator.mjs +48 -35
  99. package/dist/esm/editor/communicator.mjs.map +1 -1
  100. package/dist/esm/editor/configuration.mjs +15 -18
  101. package/dist/esm/editor/configuration.mjs.map +1 -1
  102. package/dist/esm/editor/createSharedComposable.mjs +42 -37
  103. package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
  104. package/dist/esm/editor/dictionariesRecord.mjs +38 -38
  105. package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
  106. package/dist/esm/editor/editedContent.mjs +49 -42
  107. package/dist/esm/editor/editedContent.mjs.map +1 -1
  108. package/dist/esm/editor/editorEnabled.mjs +37 -41
  109. package/dist/esm/editor/editorEnabled.mjs.map +1 -1
  110. package/dist/esm/editor/editorLocale.mjs +15 -18
  111. package/dist/esm/editor/editorLocale.mjs.map +1 -1
  112. package/dist/esm/editor/focusDictionary.mjs +50 -45
  113. package/dist/esm/editor/focusDictionary.mjs.map +1 -1
  114. package/dist/esm/editor/index.mjs +3 -7
  115. package/dist/esm/editor/installIntlayerEditor.mjs +40 -26
  116. package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
  117. package/dist/esm/editor/useCrossFrameMessageListener.mjs +58 -46
  118. package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
  119. package/dist/esm/editor/useCrossFrameState.mjs +104 -62
  120. package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
  121. package/dist/esm/editor/useCrossURLPathState.mjs +57 -41
  122. package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
  123. package/dist/esm/editor/useEditedContentRenderer.mjs +21 -33
  124. package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
  125. package/dist/esm/editor/useEditor.mjs +16 -14
  126. package/dist/esm/editor/useEditor.mjs.map +1 -1
  127. package/dist/esm/editor/useIframeClickInterceptor.mjs +30 -30
  128. package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
  129. package/dist/esm/getDictionary.mjs +12 -20
  130. package/dist/esm/getDictionary.mjs.map +1 -1
  131. package/dist/esm/getIntlayer.mjs +12 -16
  132. package/dist/esm/getIntlayer.mjs.map +1 -1
  133. package/dist/esm/index.mjs +13 -6
  134. package/dist/esm/markdown/index.mjs +3 -2
  135. package/dist/esm/markdown/installIntlayerMarkdown.mjs +27 -32
  136. package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
  137. package/dist/esm/plugins.mjs +70 -83
  138. package/dist/esm/plugins.mjs.map +1 -1
  139. package/dist/esm/renderIntlayerNode.mjs +15 -32
  140. package/dist/esm/renderIntlayerNode.mjs.map +1 -1
  141. package/dist/esm/webpack/index.mjs +3 -2
  142. package/dist/esm/webpack/mergeConfig.mjs +25 -31
  143. package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
  144. package/dist/types/UI/ContentSelector.component.d.ts +32 -30
  145. package/dist/types/UI/ContentSelector.component.d.ts.map +1 -1
  146. package/dist/types/client/index.d.ts +8 -8
  147. package/dist/types/client/installIntlayer.d.ts +15 -9
  148. package/dist/types/client/installIntlayer.d.ts.map +1 -1
  149. package/dist/types/client/useDictionary.d.ts +7 -4
  150. package/dist/types/client/useDictionary.d.ts.map +1 -1
  151. package/dist/types/client/useDictionaryAsync.d.ts +7 -3
  152. package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
  153. package/dist/types/client/useDictionaryDynamic.d.ts +9 -3
  154. package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
  155. package/dist/types/client/useIntlayer.d.ts +9 -7
  156. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  157. package/dist/types/client/useLoadDynamic.d.ts +4 -1
  158. package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
  159. package/dist/types/client/useLocale.d.ts +17 -8
  160. package/dist/types/client/useLocale.d.ts.map +1 -1
  161. package/dist/types/client/useLocaleStorage.d.ts +49 -0
  162. package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
  163. package/dist/types/editor/ContentSelectorWrapper.component.d.ts +18 -12
  164. package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
  165. package/dist/types/editor/EditedContentRenderer.component.d.ts +20 -16
  166. package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -1
  167. package/dist/types/editor/EditorSelectorRenderer.component.d.ts +11 -6
  168. package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +1 -1
  169. package/dist/types/editor/communicator.d.ts +14 -9
  170. package/dist/types/editor/communicator.d.ts.map +1 -1
  171. package/dist/types/editor/configuration.d.ts +4 -1
  172. package/dist/types/editor/configuration.d.ts.map +1 -1
  173. package/dist/types/editor/createSharedComposable.d.ts +6 -4
  174. package/dist/types/editor/createSharedComposable.d.ts.map +1 -1
  175. package/dist/types/editor/dictionariesRecord.d.ts +13 -10
  176. package/dist/types/editor/dictionariesRecord.d.ts.map +1 -1
  177. package/dist/types/editor/editedContent.d.ts +13 -10
  178. package/dist/types/editor/editedContent.d.ts.map +1 -1
  179. package/dist/types/editor/editorEnabled.d.ts +12 -8
  180. package/dist/types/editor/editorEnabled.d.ts.map +1 -1
  181. package/dist/types/editor/editorLocale.d.ts +6 -2
  182. package/dist/types/editor/editorLocale.d.ts.map +1 -1
  183. package/dist/types/editor/focusDictionary.d.ts +16 -13
  184. package/dist/types/editor/focusDictionary.d.ts.map +1 -1
  185. package/dist/types/editor/index.d.ts +5 -5
  186. package/dist/types/editor/installIntlayerEditor.d.ts +7 -2
  187. package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -1
  188. package/dist/types/editor/useCrossFrameMessageListener.d.ts +7 -2
  189. package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -1
  190. package/dist/types/editor/useCrossFrameState.d.ts +12 -8
  191. package/dist/types/editor/useCrossFrameState.d.ts.map +1 -1
  192. package/dist/types/editor/useCrossURLPathState.d.ts +9 -3
  193. package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -1
  194. package/dist/types/editor/useEditedContentRenderer.d.ts +15 -11
  195. package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
  196. package/dist/types/editor/useEditor.d.ts +4 -1
  197. package/dist/types/editor/useEditor.d.ts.map +1 -1
  198. package/dist/types/editor/useIframeClickInterceptor.d.ts +5 -2
  199. package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -1
  200. package/dist/types/getDictionary.d.ts +8 -4
  201. package/dist/types/getDictionary.d.ts.map +1 -1
  202. package/dist/types/getIntlayer.d.ts +8 -4
  203. package/dist/types/getIntlayer.d.ts.map +1 -1
  204. package/dist/types/index.d.ts +16 -8
  205. package/dist/types/index.d.ts.map +1 -1
  206. package/dist/types/markdown/index.d.ts +2 -2
  207. package/dist/types/markdown/installIntlayerMarkdown.d.ts +15 -12
  208. package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
  209. package/dist/types/plugins.d.ts +29 -23
  210. package/dist/types/plugins.d.ts.map +1 -1
  211. package/dist/types/renderIntlayerNode.d.ts +16 -10
  212. package/dist/types/renderIntlayerNode.d.ts.map +1 -1
  213. package/dist/types/webpack/index.d.ts +2 -2
  214. package/dist/types/webpack/mergeConfig.d.ts +5 -2
  215. package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
  216. package/package.json +43 -49
  217. package/LICENSE +0 -202
  218. package/dist/cjs/client/index.cjs.map +0 -1
  219. package/dist/cjs/client/useLocaleCookie.cjs +0 -60
  220. package/dist/cjs/client/useLocaleCookie.cjs.map +0 -1
  221. package/dist/cjs/editor/index.cjs.map +0 -1
  222. package/dist/cjs/index.cjs.map +0 -1
  223. package/dist/cjs/markdown/index.cjs.map +0 -1
  224. package/dist/cjs/webpack/index.cjs.map +0 -1
  225. package/dist/esm/client/index.mjs.map +0 -1
  226. package/dist/esm/client/useLocaleCookie.mjs +0 -24
  227. package/dist/esm/client/useLocaleCookie.mjs.map +0 -1
  228. package/dist/esm/editor/index.mjs.map +0 -1
  229. package/dist/esm/index.mjs.map +0 -1
  230. package/dist/esm/markdown/index.mjs.map +0 -1
  231. package/dist/esm/webpack/index.mjs.map +0 -1
  232. package/dist/types/client/index.d.ts.map +0 -1
  233. package/dist/types/client/useLocaleCookie.d.ts +0 -17
  234. package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
  235. package/dist/types/editor/index.d.ts.map +0 -1
  236. package/dist/types/markdown/index.d.ts.map +0 -1
  237. package/dist/types/webpack/index.d.ts.map +0 -1
@@ -1,32 +1,14 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var ContentSelector_component_exports = {};
20
- __export(ContentSelector_component_exports, {
21
- ContentSelectorComponent: () => ContentSelectorComponent
22
- });
23
- module.exports = __toCommonJS(ContentSelector_component_exports);
24
- var import_common = require("@angular/common");
25
- var import_core = require("@angular/core");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __angular_common = require("@angular/common");
3
+ __angular_common = require_rolldown_runtime.__toESM(__angular_common);
4
+ let __angular_core = require("@angular/core");
5
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
6
+
7
+ //#region src/UI/ContentSelector.component.ts
26
8
  const DEFAULT_PRESS_DETECT_DURATION = 250;
27
- @((0, import_core.Component)({
28
- selector: "app-content-selector",
29
- template: `
9
+ var ContentSelectorComponent = @((0, __angular_core.Component)({
10
+ selector: "app-content-selector",
11
+ template: `
30
12
  <span
31
13
  #containerRef
32
14
  role="button"
@@ -45,97 +27,88 @@ const DEFAULT_PRESS_DETECT_DURATION = 250;
45
27
  <ng-content></ng-content>
46
28
  </span>
47
29
  `,
48
- standalone: true,
49
- imports: [import_common.CommonModule]
50
- }))
51
- class ContentSelectorComponent {
52
- constructor(cdr) {
53
- this.cdr = cdr;
54
- }
55
- @((0, import_core.Input)()) onClickOutside;
56
- @((0, import_core.Input)()) pressDuration;
57
- @((0, import_core.Input)()) isSelecting;
58
- @((0, import_core.Output)()) click = new import_core.EventEmitter();
59
- @((0, import_core.Output)()) press = new import_core.EventEmitter();
60
- @((0, import_core.ViewChild)("containerRef", { static: true }))
61
- containerRef;
62
- isHovered = (0, import_core.signal)(false);
63
- isSelectingState = (0, import_core.signal)(false);
64
- pressTimerRef = null;
65
- isSelectingComputed = (0, import_core.computed)(
66
- () => this.isSelecting ?? this.isSelectingState()
67
- );
68
- isStringSlot = (0, import_core.computed)(() => {
69
- return true;
70
- });
71
- ngOnInit() {
72
- this.isSelectingState.set(this.isSelecting ?? false);
73
- }
74
- ngOnDestroy() {
75
- this.clearPressTimer();
76
- }
77
- @((0, import_core.HostListener)("document:mousedown", ["$event"]))
78
- onDocumentMouseDown(event) {
79
- this.handleClickOutside(event);
80
- }
81
- handleOnLongPress() {
82
- this.isSelectingState.set(true);
83
- this.press.emit();
84
- }
85
- startPressTimer() {
86
- this.pressTimerRef = setTimeout(() => {
87
- this.handleOnLongPress();
88
- }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);
89
- }
90
- clearPressTimer() {
91
- if (this.pressTimerRef) {
92
- clearTimeout(this.pressTimerRef);
93
- this.pressTimerRef = null;
94
- }
95
- }
96
- handleMouseDown() {
97
- this.clearPressTimer();
98
- this.startPressTimer();
99
- }
100
- handleMouseUp() {
101
- this.isHovered.set(false);
102
- this.clearPressTimer();
103
- }
104
- handleClickOutside(event) {
105
- if (this.containerRef?.nativeElement && !this.containerRef.nativeElement.contains(event.target)) {
106
- this.isSelectingState.set(false);
107
- this.onClickOutside?.();
108
- }
109
- }
110
- handleClick(e) {
111
- if (this.isSelectingComputed()) {
112
- e.preventDefault();
113
- e.stopPropagation();
114
- }
115
- this.click.emit(e);
116
- }
117
- handleBlur() {
118
- this.isSelectingState.set(false);
119
- }
120
- onMouseEnter() {
121
- this.isHovered.set(true);
122
- }
123
- getContainerStyle() {
124
- return {
125
- display: this.isStringSlot() ? "inline" : "inline-block",
126
- cursor: "pointer",
127
- userSelect: "none",
128
- borderRadius: "0.375rem",
129
- outlineWidth: "2px",
130
- outlineOffset: "4px",
131
- outlineStyle: "solid",
132
- outlineColor: this.isSelectingComputed() || this.isHovered() ? "inherit" : "transparent",
133
- transition: "all 100ms 50ms ease-in-out"
134
- };
135
- }
136
- }
137
- // Annotate the CommonJS export names for ESM import in node:
138
- 0 && (module.exports = {
139
- ContentSelectorComponent
140
- });
30
+ standalone: true,
31
+ imports: [__angular_common.CommonModule]
32
+ })) class {
33
+ @((0, __angular_core.Input)()) onClickOutside;
34
+ @((0, __angular_core.Input)()) pressDuration;
35
+ @((0, __angular_core.Input)()) isSelecting;
36
+ @((0, __angular_core.Output)()) click = new __angular_core.EventEmitter();
37
+ @((0, __angular_core.Output)()) press = new __angular_core.EventEmitter();
38
+ @((0, __angular_core.ViewChild)("containerRef", { static: true })) containerRef;
39
+ isHovered = (0, __angular_core.signal)(false);
40
+ isSelectingState = (0, __angular_core.signal)(false);
41
+ pressTimerRef = null;
42
+ isSelectingComputed = (0, __angular_core.computed)(() => this.isSelecting ?? this.isSelectingState());
43
+ isStringSlot = (0, __angular_core.computed)(() => {
44
+ return true;
45
+ });
46
+ ngOnInit() {
47
+ this.isSelectingState.set(this.isSelecting ?? false);
48
+ }
49
+ ngOnDestroy() {
50
+ this.clearPressTimer();
51
+ }
52
+ @((0, __angular_core.HostListener)("document:mousedown", ["$event"])) onDocumentMouseDown(event) {
53
+ this.handleClickOutside(event);
54
+ }
55
+ handleOnLongPress() {
56
+ this.isSelectingState.set(true);
57
+ this.press.emit();
58
+ }
59
+ startPressTimer() {
60
+ this.pressTimerRef = setTimeout(() => {
61
+ this.handleOnLongPress();
62
+ }, this.pressDuration ?? DEFAULT_PRESS_DETECT_DURATION);
63
+ }
64
+ clearPressTimer() {
65
+ if (this.pressTimerRef) {
66
+ clearTimeout(this.pressTimerRef);
67
+ this.pressTimerRef = null;
68
+ }
69
+ }
70
+ handleMouseDown() {
71
+ this.clearPressTimer();
72
+ this.startPressTimer();
73
+ }
74
+ handleMouseUp() {
75
+ this.isHovered.set(false);
76
+ this.clearPressTimer();
77
+ }
78
+ handleClickOutside(event) {
79
+ if (this.containerRef?.nativeElement && !this.containerRef.nativeElement.contains(event.target)) {
80
+ this.isSelectingState.set(false);
81
+ this.onClickOutside?.();
82
+ }
83
+ }
84
+ handleClick(e) {
85
+ if (this.isSelectingComputed()) {
86
+ e.preventDefault();
87
+ e.stopPropagation();
88
+ }
89
+ this.click.emit(e);
90
+ }
91
+ handleBlur() {
92
+ this.isSelectingState.set(false);
93
+ }
94
+ onMouseEnter() {
95
+ this.isHovered.set(true);
96
+ }
97
+ getContainerStyle() {
98
+ return {
99
+ display: this.isStringSlot() ? "inline" : "inline-block",
100
+ cursor: "pointer",
101
+ userSelect: "none",
102
+ borderRadius: "0.375rem",
103
+ outlineWidth: "2px",
104
+ outlineOffset: "4px",
105
+ outlineStyle: "solid",
106
+ outlineColor: this.isSelectingComputed() || this.isHovered() ? "inherit" : "transparent",
107
+ transition: "all 100ms 50ms ease-in-out"
108
+ };
109
+ }
110
+ };
111
+
112
+ //#endregion
113
+ exports.ContentSelectorComponent = ContentSelectorComponent;
141
114
  //# sourceMappingURL=ContentSelector.component.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/UI/ContentSelector.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectorRef,\n Component,\n computed,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnDestroy,\n 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 constructor(private cdr: ChangeDetectorRef) {}\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,kBAaO;AAEP,MAAM,gCAAgC;AAEtC,MAAC,uBAAU;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBV,YAAY;AAAA,EACZ,SAAS,CAAC,0BAAY;AACxB,CAAC;AACM,MAAM,yBAAsD;AAAA,EAyBjE,YAAoB,KAAwB;AAAxB;AAAA,EAAyB;AAxB7C,QAAC,mBAAM,GAAE;AACT,QAAC,mBAAM,GAAE;AACT,QAAC,mBAAM,GAAE;AAET,QAAC,oBAAO,GAAE,QAAQ,IAAI,yBAAyB;AAC/C,QAAC,oBAAO,GAAE,QAAQ,IAAI,yBAAmB;AAEzC,QAAC,uBAAU,gBAAgB,EAAE,QAAQ,KAAK,CAAC;AAAA,EAC3C;AAAA,EAEQ,gBAAY,oBAAO,KAAK;AAAA,EACxB,uBAAmB,oBAAO,KAAK;AAAA,EAC/B,gBAAsD;AAAA,EAE7C,0BAAsB;AAAA,IACrC,MAAM,KAAK,eAAe,KAAK,iBAAiB;AAAA,EAClD;AAAA,EAEiB,mBAAe,sBAAS,MAAM;AAG7C,WAAO;AAAA,EACT,CAAC;AAAA,EAID,WAAiB;AACf,SAAK,iBAAiB,IAAI,KAAK,eAAe,KAAK;AAAA,EACrD;AAAA,EAEA,cAAoB;AAClB,SAAK,gBAAgB;AAAA,EACvB;AAEA,QAAC,0BAAa,sBAAsB,CAAC,QAAQ,CAAC;AAAA,EAC9C,oBAAoB,OAAyB;AAC3C,SAAK,mBAAmB,KAAK;AAAA,EAC/B;AAAA,EAEQ,oBAA0B;AAChC,SAAK,iBAAiB,IAAI,IAAI;AAC9B,SAAK,MAAM,KAAK;AAAA,EAClB;AAAA,EAEQ,kBAAwB;AAC9B,SAAK,gBAAgB,WAAW,MAAM;AACpC,WAAK,kBAAkB;AAAA,IACzB,GAAG,KAAK,iBAAiB,6BAA6B;AAAA,EACxD;AAAA,EAEQ,kBAAwB;AAC9B,QAAI,KAAK,eAAe;AACtB,mBAAa,KAAK,aAAa;AAC/B,WAAK,gBAAgB;AAAA,IACvB;AAAA,EACF;AAAA,EAEA,kBAAwB;AACtB,SAAK,gBAAgB;AACrB,SAAK,gBAAgB;AAAA,EACvB;AAAA,EAEA,gBAAsB;AACpB,SAAK,UAAU,IAAI,KAAK;AACxB,SAAK,gBAAgB;AAAA,EACvB;AAAA,EAEQ,mBAAmB,OAAyB;AAClD,QACE,KAAK,cAAc,iBACnB,CAAC,KAAK,aAAa,cAAc,SAAS,MAAM,MAAc,GAC9D;AACA,WAAK,iBAAiB,IAAI,KAAK;AAC/B,WAAK,iBAAiB;AAAA,IACxB;AAAA,EACF;AAAA,EAEA,YAAY,GAAqB;AAC/B,QAAI,KAAK,oBAAoB,GAAG;AAC9B,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAAA,IACpB;AACA,SAAK,MAAM,KAAK,CAAC;AAAA,EACnB;AAAA,EAEA,aAAmB;AACjB,SAAK,iBAAiB,IAAI,KAAK;AAAA,EACjC;AAAA,EAEA,eAAqB;AACnB,SAAK,UAAU,IAAI,IAAI;AAAA,EACzB;AAAA,EAEA,oBAA4C;AAC1C,WAAO;AAAA,MACL,SAAS,KAAK,aAAa,IAAI,WAAW;AAAA,MAC1C,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,MACf,cAAc;AAAA,MACd,cACE,KAAK,oBAAoB,KAAK,KAAK,UAAU,IACzC,YACA;AAAA,MACN,YAAY;AAAA,IACd;AAAA,EACF;AACF;","names":[]}
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,gCAAW;CACT,UAAU;CACV,UAAU;;;;;;;;;;;;;;;;;;;CAmBV,YAAY;CACZ,SAAS,CAACA,8BAAa;CACxB,CAAC,EACF,MAAmE;CACjE,6BAAQ,EAAC;CACT,6BAAQ,EAAC;CACT,6BAAQ,EAAC;CAET,8BAAS,EAAC,QAAQ,IAAIC,6BAA0B;CAChD,8BAAS,EAAC,QAAQ,IAAIA,6BAAoB;CAE1C,gCAAW,gBAAgB,EAAE,QAAQ,MAAM,CAAC,EAC5C;CAEA,AAAQ,uCAAmB,MAAM;CACjC,AAAQ,8CAA0B,MAAM;CACxC,AAAQ,gBAAsD;CAE9D,AAAiB,yDACT,KAAK,eAAe,KAAK,kBAAkB,CAClD;CAED,AAAiB,kDAA8B;AAG7C,SAAO;GACP;CAEF,WAAiB;AACf,OAAK,iBAAiB,IAAI,KAAK,eAAe,MAAM;;CAGtD,cAAoB;AAClB,OAAK,iBAAiB;;CAGxB,mCAAc,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"}
@@ -0,0 +1,25 @@
1
+ //#region rolldown:runtime
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") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+
25
+ exports.__toESM = __toESM;
@@ -1,35 +1,19 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var client_exports = {};
17
- module.exports = __toCommonJS(client_exports);
18
- __reExport(client_exports, require('./installIntlayer.cjs'), module.exports);
19
- __reExport(client_exports, require('./useDictionary.cjs'), module.exports);
20
- __reExport(client_exports, require('./useDictionaryAsync.cjs'), module.exports);
21
- __reExport(client_exports, require('./useDictionaryDynamic.cjs'), module.exports);
22
- __reExport(client_exports, require('./useIntlayer.cjs'), module.exports);
23
- __reExport(client_exports, require('./useLoadDynamic.cjs'), module.exports);
24
- __reExport(client_exports, require('./useLocale.cjs'), module.exports);
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- ...require('./installIntlayer.cjs'),
28
- ...require('./useDictionary.cjs'),
29
- ...require('./useDictionaryAsync.cjs'),
30
- ...require('./useDictionaryDynamic.cjs'),
31
- ...require('./useIntlayer.cjs'),
32
- ...require('./useLoadDynamic.cjs'),
33
- ...require('./useLocale.cjs')
34
- });
35
- //# sourceMappingURL=index.cjs.map
1
+ const require_client_installIntlayer = require('./installIntlayer.cjs');
2
+ const require_client_useDictionary = require('./useDictionary.cjs');
3
+ const require_client_useDictionaryAsync = require('./useDictionaryAsync.cjs');
4
+ const require_client_useLoadDynamic = require('./useLoadDynamic.cjs');
5
+ const require_client_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
6
+ const require_client_useIntlayer = require('./useIntlayer.cjs');
7
+ const require_client_useLocale = require('./useLocale.cjs');
8
+
9
+ exports.INTLAYER_TOKEN = require_client_installIntlayer.INTLAYER_TOKEN;
10
+ exports.IntlayerProvider = require_client_installIntlayer.IntlayerProvider;
11
+ exports.createIntlayerClient = require_client_installIntlayer.createIntlayerClient;
12
+ exports.installIntlayer = require_client_installIntlayer.installIntlayer;
13
+ exports.isUpdatableNode = require_client_useIntlayer.isUpdatableNode;
14
+ exports.useDictionary = require_client_useDictionary.useDictionary;
15
+ exports.useDictionaryAsync = require_client_useDictionaryAsync.useDictionaryAsync;
16
+ exports.useDictionaryDynamic = require_client_useDictionaryDynamic.useDictionaryDynamic;
17
+ exports.useIntlayer = require_client_useIntlayer.useIntlayer;
18
+ exports.useLoadDynamic = require_client_useLoadDynamic.useLoadDynamic;
19
+ exports.useLocale = require_client_useLocale.useLocale;
@@ -1,72 +1,43 @@
1
- "use strict";
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var installIntlayer_exports = {};
30
- __export(installIntlayer_exports, {
31
- INTLAYER_TOKEN: () => INTLAYER_TOKEN,
32
- IntlayerProvider: () => IntlayerProvider,
33
- createIntlayerClient: () => createIntlayerClient,
34
- installIntlayer: () => installIntlayer
35
- });
36
- module.exports = __toCommonJS(installIntlayer_exports);
37
- var import_core = require("@angular/core");
38
- var import_built = __toESM(require("@intlayer/config/built"));
39
- const INTLAYER_TOKEN = new import_core.InjectionToken("intlayer");
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __angular_core = require("@angular/core");
3
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
4
+ let __intlayer_config_built = require("@intlayer/config/built");
5
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
6
+
7
+ //#region src/client/installIntlayer.ts
8
+ const INTLAYER_TOKEN = new __angular_core.InjectionToken("intlayer");
9
+ /**
10
+ * Singleton instance
11
+ */
40
12
  let instance = null;
41
- @((0, import_core.Injectable)({
42
- providedIn: "root"
43
- }))
44
- class IntlayerProvider {
45
- _locale = (0, import_core.signal)(
46
- import_built.default.internationalization?.defaultLocale
47
- );
48
- locale = this._locale.asReadonly();
49
- setLocale = (locale) => {
50
- this._locale.set(locale);
51
- };
52
- }
53
- const createIntlayerClient = (locale) => {
54
- if (instance) return instance;
55
- instance = new IntlayerProvider();
56
- if (locale) {
57
- instance.setLocale(locale);
58
- }
59
- return instance;
13
+ var IntlayerProvider = @((0, __angular_core.Injectable)({ providedIn: "root" })) class {
14
+ isCookieEnabled = (0, __angular_core.signal)(true);
15
+ _locale = (0, __angular_core.signal)(__intlayer_config_built.default.internationalization?.defaultLocale);
16
+ locale = this._locale.asReadonly();
17
+ setLocale = (locale) => {
18
+ this._locale.set(locale);
19
+ };
20
+ };
21
+ /**
22
+ * Create and return a single IntlayerProvider instance
23
+ */
24
+ const createIntlayerClient = (locale, isCookieEnabled = true) => {
25
+ if (instance) return instance;
26
+ instance = new IntlayerProvider();
27
+ if (locale) instance.setLocale(locale);
28
+ instance.isCookieEnabled.set(isCookieEnabled);
29
+ return instance;
60
30
  };
61
- const installIntlayer = (locale) => {
62
- const client = createIntlayerClient(locale);
63
- return client;
31
+ /**
32
+ * Helper to install the Intlayer provider
33
+ */
34
+ const installIntlayer = (locale, isCookieEnabled = true) => {
35
+ return createIntlayerClient(locale, isCookieEnabled);
64
36
  };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- INTLAYER_TOKEN,
68
- IntlayerProvider,
69
- createIntlayerClient,
70
- installIntlayer
71
- });
37
+
38
+ //#endregion
39
+ exports.INTLAYER_TOKEN = INTLAYER_TOKEN;
40
+ exports.IntlayerProvider = IntlayerProvider;
41
+ exports.createIntlayerClient = createIntlayerClient;
42
+ exports.installIntlayer = installIntlayer;
72
43
  //# sourceMappingURL=installIntlayer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/installIntlayer.ts"],"sourcesContent":["import { Injectable, InjectionToken, signal, Signal } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\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 private _locale = signal<Locales>(\n configuration.internationalization?.defaultLocale as Locales\n );\n\n readonly locale: Signal<Locales> = this._locale.asReadonly();\n\n setLocale = (locale: LocalesValues) => {\n this._locale.set(locale as Locales);\n };\n}\n\n/**\n * Create and return a single IntlayerProvider instance\n */\nexport const createIntlayerClient = (\n locale?: LocalesValues\n): IntlayerProvider => {\n if (instance) return instance;\n\n instance = new IntlayerProvider();\n\n if (locale) {\n instance.setLocale(locale);\n }\n\n return instance;\n};\n\n/**\n * Helper to install the Intlayer provider\n */\nexport const installIntlayer = (locale?: LocalesValues) => {\n const client = createIntlayerClient(locale);\n\n // Note: Angular editor installation will be handled differently\n // installIntlayerEditor();\n\n return client;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2D;AAC3D,mBAA0B;AAGnB,MAAM,iBAAiB,IAAI,2BAAiC,UAAU;AAK7E,IAAI,WAAoC;AAExC,MAAC,wBAAW;AAAA,EACV,YAAY;AACd,CAAC;AACM,MAAM,iBAAiB;AAAA,EACpB,cAAU;AAAA,IAChB,aAAAA,QAAc,sBAAsB;AAAA,EACtC;AAAA,EAES,SAA0B,KAAK,QAAQ,WAAW;AAAA,EAE3D,YAAY,CAAC,WAA0B;AACrC,SAAK,QAAQ,IAAI,MAAiB;AAAA,EACpC;AACF;AAKO,MAAM,uBAAuB,CAClC,WACqB;AACrB,MAAI,SAAU,QAAO;AAErB,aAAW,IAAI,iBAAiB;AAEhC,MAAI,QAAQ;AACV,aAAS,UAAU,MAAM;AAAA,EAC3B;AAEA,SAAO;AACT;AAKO,MAAM,kBAAkB,CAAC,WAA2B;AACzD,QAAM,SAAS,qBAAqB,MAAM;AAK1C,SAAO;AACT;","names":["configuration"]}
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,8BAAiC,WAAW;;;;AAK9E,IAAIC,WAAoC;AAKxC,IAAa,mBAHb,iCAAY,EACV,YAAY,QACb,CAAC,EACF,MAA8B;CAC5B,6CAAyB,KAAK;CAC9B,AAAQ,qCACNC,gCAAc,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,39 +1,16 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useDictionary_exports = {};
20
- __export(useDictionary_exports, {
21
- useDictionary: () => useDictionary
22
- });
23
- module.exports = __toCommonJS(useDictionary_exports);
24
- var import_core = require("@angular/core");
25
- var import_getDictionary = require('../getDictionary.cjs');
26
- var import_installIntlayer = require('./installIntlayer.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_client_installIntlayer = require('./installIntlayer.cjs');
3
+ const require_getDictionary = require('../getDictionary.cjs');
4
+ let __angular_core = require("@angular/core");
5
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
6
+
7
+ //#region src/client/useDictionary.ts
27
8
  const useDictionary = (dictionary, locale) => {
28
- const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
29
- const localeTarget = (0, import_core.computed)(() => locale ?? intlayer?.locale());
30
- const content = (0, import_core.computed)(
31
- () => (0, import_getDictionary.getDictionary)(dictionary, localeTarget())
32
- );
33
- return content();
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()))();
34
12
  };
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- useDictionary
38
- });
13
+
14
+ //#endregion
15
+ exports.useDictionary = useDictionary;
39
16
  //# sourceMappingURL=useDictionary.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { getDictionary } from '../getDictionary';\nimport { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAGjC,2BAA8B;AAE9B,6BAAiD;AAE1C,MAAM,gBAAgB,CAC3B,YACA,WACuC;AACvC,QAAM,eAAW,oBAAyB,qCAAc;AAExD,QAAM,mBAAe,sBAAS,MAAM,UAAU,UAAU,OAAO,CAAC;AAGhE,QAAM,cAAU;AAAA,IAAS,UACvB,oCAAgC,YAAY,aAAa,CAAC;AAAA,EAC5D;AAEA,SAAO,QAAQ;AACjB;","names":[]}
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,sCAAoCA,8CAAe;CAEzD,MAAM,kDAA8B,UAAU,UAAU,QAAQ,CAAC;AAOjE,2CAHEC,oCAAgC,YAAY,cAAc,CAAC,CAC5D,EAEe"}
@@ -1,51 +1,26 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var useDictionaryAsync_exports = {};
31
- __export(useDictionaryAsync_exports, {
32
- useDictionaryAsync: () => useDictionaryAsync
33
- });
34
- module.exports = __toCommonJS(useDictionaryAsync_exports);
35
- var import_core = require("@angular/core");
36
- var import_built = __toESM(require("@intlayer/config/built"));
37
- var import_installIntlayer = require('./installIntlayer.cjs');
38
- var import_useDictionary = require('./useDictionary.cjs');
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_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
+ __angular_core = require_rolldown_runtime.__toESM(__angular_core);
9
+ let __intlayer_config_built = require("@intlayer/config/built");
10
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
11
+
12
+ //#region src/client/useDictionaryAsync.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
+ */
39
18
  const useDictionaryAsync = async (dictionaryPromise, locale) => {
40
- const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
41
- const localeTarget = (0, import_core.computed)(
42
- () => locale ?? intlayer?.locale() ?? import_built.default?.internationalization.defaultLocale
43
- );
44
- const dictionary = await dictionaryPromise[localeTarget()]();
45
- return (0, import_useDictionary.useDictionary)(dictionary, localeTarget());
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(await dictionaryPromise[localeTarget()]?.(), localeTarget());
46
22
  };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- useDictionaryAsync
50
- });
23
+
24
+ //#endregion
25
+ exports.useDictionaryAsync = useDictionaryAsync;
51
26
  //# sourceMappingURL=useDictionaryAsync.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { Dictionary, LanguageContent } from '@intlayer/core';\nimport { INTLAYER_TOKEN, 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: LanguageContent<() => 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiC;AACjC,mBAA0B;AAG1B,6BAAiD;AACjD,2BAA8B;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,eAAW,oBAAyB,qCAAc;AAExD,QAAM,mBAAe;AAAA,IACnB,MACE,UACA,UAAU,OAAO,KACjB,aAAAA,SAAe,qBAAqB;AAAA,EACxC;AAEA,QAAM,aAAa,MAAM,kBAAkB,aAAa,CAAC,EAAG;AAE5D,aAAO,oCAAc,YAAY,aAAa,CAAQ;AACxD;","names":["configuration"]}
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,sCAAoCA,8CAAe;CAEzD,MAAM,kDAEF,UACA,UAAU,QAAQ,IAClBC,iCAAe,qBAAqB,cACvC;AAID,QAAOC,2CAFY,MAAM,kBAAkB,cAAc,KAAK,EAE7B,cAAc,CAAQ"}