angular-intlayer 6.1.6 → 7.0.0-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.
- package/dist/cjs/UI/ContentSelector.component.cjs +94 -121
- package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -1
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/client/index.cjs +19 -35
- package/dist/cjs/client/installIntlayer.cjs +39 -68
- package/dist/cjs/client/installIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs +13 -36
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +23 -48
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +24 -52
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +16 -36
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useLoadDynamic.cjs +26 -42
- package/dist/cjs/client/useLoadDynamic.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +35 -67
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +61 -0
- package/dist/cjs/client/useLocaleStorage.cjs.map +1 -0
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +41 -63
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -1
- package/dist/cjs/editor/EditedContentRenderer.component.cjs +44 -75
- package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +25 -45
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -1
- package/dist/cjs/editor/communicator.cjs +55 -73
- package/dist/cjs/editor/communicator.cjs.map +1 -1
- package/dist/cjs/editor/configuration.cjs +21 -54
- package/dist/cjs/editor/configuration.cjs.map +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +46 -63
- package/dist/cjs/editor/createSharedComposable.cjs.map +1 -1
- package/dist/cjs/editor/dictionariesRecord.cjs +47 -77
- package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -1
- package/dist/cjs/editor/editedContent.cjs +58 -71
- package/dist/cjs/editor/editedContent.cjs.map +1 -1
- package/dist/cjs/editor/editorEnabled.cjs +45 -70
- package/dist/cjs/editor/editorEnabled.cjs.map +1 -1
- package/dist/cjs/editor/editorLocale.cjs +21 -45
- package/dist/cjs/editor/editorLocale.cjs.map +1 -1
- package/dist/cjs/editor/focusDictionary.cjs +58 -74
- package/dist/cjs/editor/focusDictionary.cjs.map +1 -1
- package/dist/cjs/editor/index.cjs +9 -38
- package/dist/cjs/editor/installIntlayerEditor.cjs +46 -64
- package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +63 -72
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -1
- package/dist/cjs/editor/useCrossFrameState.cjs +108 -88
- package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -1
- package/dist/cjs/editor/useCrossURLPathState.cjs +64 -69
- package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +25 -54
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/cjs/editor/useEditor.cjs +22 -44
- package/dist/cjs/editor/useEditor.cjs.map +1 -1
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +38 -59
- package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -1
- package/dist/cjs/getDictionary.cjs +14 -39
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +14 -35
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +32 -31
- package/dist/cjs/markdown/index.cjs +6 -23
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs +33 -60
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +77 -108
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/renderIntlayerNode.cjs +16 -56
- package/dist/cjs/renderIntlayerNode.cjs.map +1 -1
- package/dist/cjs/webpack/index.cjs +3 -23
- package/dist/cjs/webpack/mergeConfig.cjs +33 -68
- package/dist/cjs/webpack/mergeConfig.cjs.map +1 -1
- package/dist/esm/UI/ContentSelector.component.mjs +89 -104
- package/dist/esm/UI/ContentSelector.component.mjs.map +1 -1
- package/dist/esm/client/index.mjs +9 -8
- package/dist/esm/client/installIntlayer.mjs +29 -27
- package/dist/esm/client/installIntlayer.mjs.map +1 -1
- package/dist/esm/client/useDictionary.mjs +10 -11
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +18 -12
- package/dist/esm/client/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +18 -15
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.mjs +12 -10
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/client/useLoadDynamic.mjs +23 -17
- package/dist/esm/client/useLoadDynamic.mjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +30 -31
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleStorage.mjs +54 -0
- package/dist/esm/client/useLocaleStorage.mjs.map +1 -0
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs +32 -34
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -1
- package/dist/esm/editor/EditedContentRenderer.component.mjs +38 -49
- package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -1
- package/dist/esm/editor/EditorSelectorRenderer.component.mjs +19 -18
- package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -1
- package/dist/esm/editor/communicator.mjs +48 -35
- package/dist/esm/editor/communicator.mjs.map +1 -1
- package/dist/esm/editor/configuration.mjs +15 -18
- package/dist/esm/editor/configuration.mjs.map +1 -1
- package/dist/esm/editor/createSharedComposable.mjs +42 -37
- package/dist/esm/editor/createSharedComposable.mjs.map +1 -1
- package/dist/esm/editor/dictionariesRecord.mjs +38 -38
- package/dist/esm/editor/dictionariesRecord.mjs.map +1 -1
- package/dist/esm/editor/editedContent.mjs +49 -42
- package/dist/esm/editor/editedContent.mjs.map +1 -1
- package/dist/esm/editor/editorEnabled.mjs +37 -41
- package/dist/esm/editor/editorEnabled.mjs.map +1 -1
- package/dist/esm/editor/editorLocale.mjs +15 -18
- package/dist/esm/editor/editorLocale.mjs.map +1 -1
- package/dist/esm/editor/focusDictionary.mjs +50 -45
- package/dist/esm/editor/focusDictionary.mjs.map +1 -1
- package/dist/esm/editor/index.mjs +3 -7
- package/dist/esm/editor/installIntlayerEditor.mjs +40 -26
- package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -1
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +58 -46
- package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -1
- package/dist/esm/editor/useCrossFrameState.mjs +104 -62
- package/dist/esm/editor/useCrossFrameState.mjs.map +1 -1
- package/dist/esm/editor/useCrossURLPathState.mjs +57 -41
- package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -1
- package/dist/esm/editor/useEditedContentRenderer.mjs +21 -33
- package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
- package/dist/esm/editor/useEditor.mjs +16 -14
- package/dist/esm/editor/useEditor.mjs.map +1 -1
- package/dist/esm/editor/useIframeClickInterceptor.mjs +30 -30
- package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -1
- package/dist/esm/getDictionary.mjs +12 -20
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs +12 -16
- package/dist/esm/getIntlayer.mjs.map +1 -1
- package/dist/esm/index.mjs +13 -6
- package/dist/esm/markdown/index.mjs +3 -2
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +27 -32
- package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -1
- package/dist/esm/plugins.mjs +70 -83
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/renderIntlayerNode.mjs +15 -32
- package/dist/esm/renderIntlayerNode.mjs.map +1 -1
- package/dist/esm/webpack/index.mjs +3 -2
- package/dist/esm/webpack/mergeConfig.mjs +25 -31
- package/dist/esm/webpack/mergeConfig.mjs.map +1 -1
- package/dist/types/UI/ContentSelector.component.d.ts +32 -30
- package/dist/types/UI/ContentSelector.component.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +8 -8
- package/dist/types/client/installIntlayer.d.ts +15 -9
- package/dist/types/client/installIntlayer.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +7 -4
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryAsync.d.ts +7 -3
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +9 -3
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +9 -7
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useLoadDynamic.d.ts +4 -1
- package/dist/types/client/useLoadDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +17 -8
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +49 -0
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -0
- package/dist/types/editor/ContentSelectorWrapper.component.d.ts +18 -12
- package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -1
- package/dist/types/editor/EditedContentRenderer.component.d.ts +20 -16
- package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -1
- package/dist/types/editor/EditorSelectorRenderer.component.d.ts +11 -6
- package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +1 -1
- package/dist/types/editor/communicator.d.ts +14 -9
- package/dist/types/editor/communicator.d.ts.map +1 -1
- package/dist/types/editor/configuration.d.ts +4 -1
- package/dist/types/editor/configuration.d.ts.map +1 -1
- package/dist/types/editor/createSharedComposable.d.ts +6 -4
- package/dist/types/editor/createSharedComposable.d.ts.map +1 -1
- package/dist/types/editor/dictionariesRecord.d.ts +13 -10
- package/dist/types/editor/dictionariesRecord.d.ts.map +1 -1
- package/dist/types/editor/editedContent.d.ts +13 -10
- package/dist/types/editor/editedContent.d.ts.map +1 -1
- package/dist/types/editor/editorEnabled.d.ts +12 -8
- package/dist/types/editor/editorEnabled.d.ts.map +1 -1
- package/dist/types/editor/editorLocale.d.ts +6 -2
- package/dist/types/editor/editorLocale.d.ts.map +1 -1
- package/dist/types/editor/focusDictionary.d.ts +16 -13
- package/dist/types/editor/focusDictionary.d.ts.map +1 -1
- package/dist/types/editor/index.d.ts +5 -5
- package/dist/types/editor/installIntlayerEditor.d.ts +7 -2
- package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -1
- package/dist/types/editor/useCrossFrameMessageListener.d.ts +7 -2
- package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -1
- package/dist/types/editor/useCrossFrameState.d.ts +12 -8
- package/dist/types/editor/useCrossFrameState.d.ts.map +1 -1
- package/dist/types/editor/useCrossURLPathState.d.ts +9 -3
- package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +15 -11
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
- package/dist/types/editor/useEditor.d.ts +4 -1
- package/dist/types/editor/useEditor.d.ts.map +1 -1
- package/dist/types/editor/useIframeClickInterceptor.d.ts +5 -2
- package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -1
- package/dist/types/getDictionary.d.ts +8 -4
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +8 -4
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/index.d.ts +16 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +2 -2
- package/dist/types/markdown/installIntlayerMarkdown.d.ts +15 -12
- package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +29 -23
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/renderIntlayerNode.d.ts +16 -10
- package/dist/types/renderIntlayerNode.d.ts.map +1 -1
- package/dist/types/webpack/index.d.ts +2 -2
- package/dist/types/webpack/mergeConfig.d.ts +5 -2
- package/dist/types/webpack/mergeConfig.d.ts.map +1 -1
- package/package.json +43 -49
- package/LICENSE +0 -202
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/client/useLocaleCookie.cjs +0 -60
- package/dist/cjs/client/useLocaleCookie.cjs.map +0 -1
- package/dist/cjs/editor/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/markdown/index.cjs.map +0 -1
- package/dist/cjs/webpack/index.cjs.map +0 -1
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/client/useLocaleCookie.mjs +0 -24
- package/dist/esm/client/useLocaleCookie.mjs.map +0 -1
- package/dist/esm/editor/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/markdown/index.mjs.map +0 -1
- package/dist/esm/webpack/index.mjs.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/client/useLocaleCookie.d.ts +0 -17
- package/dist/types/client/useLocaleCookie.d.ts.map +0 -1
- package/dist/types/editor/index.d.ts.map +0 -1
- package/dist/types/markdown/index.d.ts.map +0 -1
- package/dist/types/webpack/index.d.ts.map +0 -1
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
}))
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Helper to install the Intlayer provider
|
|
33
|
+
*/
|
|
34
|
+
const installIntlayer = (locale, isCookieEnabled = true) => {
|
|
35
|
+
return createIntlayerClient(locale, isCookieEnabled);
|
|
64
36
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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/
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 {
|
|
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"}
|