angular-intlayer 5.5.9 → 5.5.10
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/README.md +42 -9
- package/dist/cjs/UI/ContentSelector.component.cjs +141 -0
- package/dist/cjs/UI/ContentSelector.component.cjs.map +1 -0
- package/dist/cjs/client/index.cjs +13 -27
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/installIntlayer.cjs +72 -0
- package/dist/cjs/client/installIntlayer.cjs.map +1 -0
- package/dist/cjs/client/{getDictionary.cjs → useDictionary.cjs} +15 -19
- package/dist/cjs/client/useDictionary.cjs.map +1 -0
- package/dist/cjs/client/useDictionaryDynamic.cjs +42 -0
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/client/{getBrowserLocale.cjs → useIntlayer.cjs} +17 -11
- package/dist/cjs/client/useIntlayer.cjs.map +1 -0
- package/dist/cjs/client/{intlayer.service.cjs → useLoadDynamic.cjs} +21 -19
- package/dist/cjs/client/useLoadDynamic.cjs.map +1 -0
- package/dist/cjs/client/useLocale.cjs +69 -0
- package/dist/cjs/client/useLocale.cjs.map +1 -0
- package/dist/cjs/client/useLocaleCookie.cjs +60 -0
- package/dist/cjs/client/useLocaleCookie.cjs.map +1 -0
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs +73 -0
- package/dist/cjs/editor/ContentSelectorWrapper.component.cjs.map +1 -0
- package/dist/cjs/editor/EditedContentRenderer.component.cjs +77 -0
- package/dist/cjs/editor/EditedContentRenderer.component.cjs.map +1 -0
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs +58 -0
- package/dist/cjs/editor/EditorSelectorRenderer.component.cjs.map +1 -0
- package/dist/cjs/editor/changedContent.cjs +62 -0
- package/dist/cjs/editor/changedContent.cjs.map +1 -0
- package/dist/cjs/editor/communicator.cjs +82 -0
- package/dist/cjs/editor/communicator.cjs.map +1 -0
- package/dist/cjs/editor/configuration.cjs +57 -0
- package/dist/cjs/editor/configuration.cjs.map +1 -0
- package/dist/cjs/editor/createSharedComposable.cjs +68 -0
- package/dist/cjs/editor/createSharedComposable.cjs.map +1 -0
- package/dist/cjs/editor/dictionariesRecord.cjs +83 -0
- package/dist/cjs/editor/dictionariesRecord.cjs.map +1 -0
- package/dist/cjs/editor/editedContent.cjs +77 -0
- package/dist/cjs/editor/editedContent.cjs.map +1 -0
- package/dist/cjs/editor/editorEnabled.cjs +76 -0
- package/dist/cjs/editor/editorEnabled.cjs.map +1 -0
- package/dist/cjs/editor/editorLocale.cjs +47 -0
- package/dist/cjs/editor/editorLocale.cjs.map +1 -0
- package/dist/cjs/editor/focusDictionary.cjs +80 -0
- package/dist/cjs/editor/focusDictionary.cjs.map +1 -0
- package/dist/cjs/editor/index.cjs +38 -0
- package/dist/cjs/editor/index.cjs.map +1 -0
- package/dist/cjs/editor/installIntlayerEditor.cjs +72 -0
- package/dist/cjs/editor/installIntlayerEditor.cjs.map +1 -0
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +83 -0
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs.map +1 -0
- package/dist/cjs/editor/useCrossFrameState.cjs +95 -0
- package/dist/cjs/editor/useCrossFrameState.cjs.map +1 -0
- package/dist/cjs/editor/useCrossURLPathState.cjs +72 -0
- package/dist/cjs/editor/useCrossURLPathState.cjs.map +1 -0
- package/dist/cjs/editor/useEditedContentRenderer.cjs +58 -0
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -0
- package/dist/cjs/editor/useEditor.cjs +46 -0
- package/dist/cjs/editor/useEditor.cjs.map +1 -0
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +62 -0
- package/dist/cjs/editor/useIframeClickInterceptor.cjs.map +1 -0
- package/dist/cjs/getDictionary.cjs +15 -2
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +9 -2
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/markdown/index.cjs +3 -16
- package/dist/cjs/markdown/index.cjs.map +1 -1
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs +66 -0
- package/dist/cjs/markdown/installIntlayerMarkdown.cjs.map +1 -0
- package/dist/cjs/plugins.cjs +27 -18
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/cjs/renderIntlayerNode.cjs +58 -0
- package/dist/cjs/renderIntlayerNode.cjs.map +1 -0
- package/dist/cjs/{client/getLocale.cjs → webpack/index.cjs} +6 -14
- package/dist/cjs/webpack/index.cjs.map +1 -0
- package/dist/cjs/webpack/mergeConfig.cjs +83 -0
- package/dist/cjs/webpack/mergeConfig.cjs.map +1 -0
- package/dist/esm/UI/ContentSelector.component.mjs +126 -0
- package/dist/esm/UI/ContentSelector.component.mjs.map +1 -0
- package/dist/esm/client/index.mjs +6 -16
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/installIntlayer.mjs +35 -0
- package/dist/esm/client/installIntlayer.mjs.map +1 -0
- package/dist/esm/client/useDictionary.mjs +15 -0
- package/dist/esm/client/useDictionary.mjs.map +1 -0
- package/dist/esm/client/useDictionaryDynamic.mjs +18 -0
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/client/useIntlayer.mjs +15 -0
- package/dist/esm/client/useIntlayer.mjs.map +1 -0
- package/dist/esm/client/useLoadDynamic.mjs +21 -0
- package/dist/esm/client/useLoadDynamic.mjs.map +1 -0
- package/dist/esm/client/useLocale.mjs +35 -0
- package/dist/esm/client/useLocale.mjs.map +1 -0
- package/dist/esm/client/useLocaleCookie.mjs +24 -0
- package/dist/esm/client/useLocaleCookie.mjs.map +1 -0
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs +49 -0
- package/dist/esm/editor/ContentSelectorWrapper.component.mjs.map +1 -0
- package/dist/esm/editor/EditedContentRenderer.component.mjs +53 -0
- package/dist/esm/editor/EditedContentRenderer.component.mjs.map +1 -0
- package/dist/esm/editor/EditorSelectorRenderer.component.mjs +34 -0
- package/dist/esm/editor/EditorSelectorRenderer.component.mjs.map +1 -0
- package/dist/esm/editor/changedContent.mjs +36 -0
- package/dist/esm/editor/changedContent.mjs.map +1 -0
- package/dist/esm/editor/communicator.mjs +46 -0
- package/dist/esm/editor/communicator.mjs.map +1 -0
- package/dist/esm/editor/configuration.mjs +23 -0
- package/dist/esm/editor/configuration.mjs.map +1 -0
- package/dist/esm/editor/createSharedComposable.mjs +43 -0
- package/dist/esm/editor/createSharedComposable.mjs.map +1 -0
- package/dist/esm/editor/dictionariesRecord.mjs +47 -0
- package/dist/esm/editor/dictionariesRecord.mjs.map +1 -0
- package/dist/esm/editor/editedContent.mjs +51 -0
- package/dist/esm/editor/editedContent.mjs.map +1 -0
- package/dist/esm/editor/editorEnabled.mjs +50 -0
- package/dist/esm/editor/editorEnabled.mjs.map +1 -0
- package/dist/esm/editor/editorLocale.mjs +23 -0
- package/dist/esm/editor/editorLocale.mjs.map +1 -0
- package/dist/esm/editor/focusDictionary.mjs +54 -0
- package/dist/esm/editor/focusDictionary.mjs.map +1 -0
- package/dist/esm/editor/index.mjs +10 -0
- package/dist/esm/editor/index.mjs.map +1 -0
- package/dist/esm/editor/installIntlayerEditor.mjs +38 -0
- package/dist/esm/editor/installIntlayerEditor.mjs.map +1 -0
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +59 -0
- package/dist/esm/editor/useCrossFrameMessageListener.mjs.map +1 -0
- package/dist/esm/editor/useCrossFrameState.mjs +71 -0
- package/dist/esm/editor/useCrossFrameState.mjs.map +1 -0
- package/dist/esm/editor/useCrossURLPathState.mjs +47 -0
- package/dist/esm/editor/useCrossURLPathState.mjs.map +1 -0
- package/dist/esm/editor/useEditedContentRenderer.mjs +37 -0
- package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -0
- package/dist/esm/editor/useEditor.mjs +22 -0
- package/dist/esm/editor/useEditor.mjs.map +1 -0
- package/dist/esm/editor/useIframeClickInterceptor.mjs +37 -0
- package/dist/esm/editor/useIframeClickInterceptor.mjs.map +1 -0
- package/dist/esm/getDictionary.mjs +19 -1
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs +14 -2
- package/dist/esm/getIntlayer.mjs.map +1 -1
- package/dist/esm/markdown/index.mjs +1 -10
- package/dist/esm/markdown/index.mjs.map +1 -1
- package/dist/esm/markdown/installIntlayerMarkdown.mjs +39 -0
- package/dist/esm/markdown/installIntlayerMarkdown.mjs.map +1 -0
- package/dist/esm/plugins.mjs +27 -17
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/esm/renderIntlayerNode.mjs +34 -0
- package/dist/esm/renderIntlayerNode.mjs.map +1 -0
- package/dist/esm/webpack/index.mjs +2 -0
- package/dist/esm/webpack/index.mjs.map +1 -0
- package/dist/esm/webpack/mergeConfig.mjs +49 -0
- package/dist/esm/webpack/mergeConfig.mjs.map +1 -0
- package/dist/types/UI/ContentSelector.component.d.ts +32 -0
- package/dist/types/UI/ContentSelector.component.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +6 -7
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/installIntlayer.d.ts +17 -0
- package/dist/types/client/installIntlayer.d.ts.map +1 -0
- package/dist/types/client/useDictionary.d.ts +5 -0
- package/dist/types/client/useDictionary.d.ts.map +1 -0
- package/dist/types/client/useDictionaryDynamic.d.ts +9 -0
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/client/useIntlayer.d.ts +10 -0
- package/dist/types/client/useIntlayer.d.ts.map +1 -0
- package/dist/types/client/useLoadDynamic.d.ts +8 -0
- package/dist/types/client/useLoadDynamic.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +15 -0
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useLocaleCookie.d.ts +17 -0
- package/dist/types/client/useLocaleCookie.d.ts.map +1 -0
- package/dist/types/editor/ContentSelectorWrapper.component.d.ts +19 -0
- package/dist/types/editor/ContentSelectorWrapper.component.d.ts.map +1 -0
- package/dist/types/editor/EditedContentRenderer.component.d.ts +19 -0
- package/dist/types/editor/EditedContentRenderer.component.d.ts.map +1 -0
- package/dist/types/editor/EditorSelectorRenderer.component.d.ts +13 -0
- package/dist/types/editor/EditorSelectorRenderer.component.d.ts.map +1 -0
- package/dist/types/editor/changedContent.d.ts +14 -0
- package/dist/types/editor/changedContent.d.ts.map +1 -0
- package/dist/types/editor/communicator.d.ts +28 -0
- package/dist/types/editor/communicator.d.ts.map +1 -0
- package/dist/types/editor/configuration.d.ts +2 -0
- package/dist/types/editor/configuration.d.ts.map +1 -0
- package/dist/types/editor/createSharedComposable.d.ts +14 -0
- package/dist/types/editor/createSharedComposable.d.ts.map +1 -0
- package/dist/types/editor/dictionariesRecord.d.ts +16 -0
- package/dist/types/editor/dictionariesRecord.d.ts.map +1 -0
- package/dist/types/editor/editedContent.d.ts +19 -0
- package/dist/types/editor/editedContent.d.ts.map +1 -0
- package/dist/types/editor/editorEnabled.d.ts +16 -0
- package/dist/types/editor/editorEnabled.d.ts.map +1 -0
- package/dist/types/editor/editorLocale.d.ts +3 -0
- package/dist/types/editor/editorLocale.d.ts.map +1 -0
- package/dist/types/editor/focusDictionary.d.ts +24 -0
- package/dist/types/editor/focusDictionary.d.ts.map +1 -0
- package/dist/types/editor/index.d.ts +5 -0
- package/dist/types/editor/index.d.ts.map +1 -0
- package/dist/types/editor/installIntlayerEditor.d.ts +18 -0
- package/dist/types/editor/installIntlayerEditor.d.ts.map +1 -0
- package/dist/types/editor/useCrossFrameMessageListener.d.ts +11 -0
- package/dist/types/editor/useCrossFrameMessageListener.d.ts.map +1 -0
- package/dist/types/editor/useCrossFrameState.d.ts +24 -0
- package/dist/types/editor/useCrossFrameState.d.ts.map +1 -0
- package/dist/types/editor/useCrossURLPathState.d.ts +16 -0
- package/dist/types/editor/useCrossURLPathState.d.ts.map +1 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts +17 -0
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -0
- package/dist/types/editor/useEditor.d.ts +2 -0
- package/dist/types/editor/useEditor.d.ts.map +1 -0
- package/dist/types/editor/useIframeClickInterceptor.d.ts +11 -0
- package/dist/types/editor/useIframeClickInterceptor.d.ts.map +1 -0
- package/dist/types/getDictionary.d.ts +4 -1
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +4 -6
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/markdown/index.d.ts +1 -4
- package/dist/types/markdown/index.d.ts.map +1 -1
- package/dist/types/markdown/installIntlayerMarkdown.d.ts +26 -0
- package/dist/types/markdown/installIntlayerMarkdown.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +0 -9
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/renderIntlayerNode.d.ts +13 -0
- package/dist/types/renderIntlayerNode.d.ts.map +1 -0
- package/dist/types/webpack/index.d.ts +2 -0
- package/dist/types/webpack/index.d.ts.map +1 -0
- package/dist/types/webpack/mergeConfig.d.ts +3 -0
- package/dist/types/webpack/mergeConfig.d.ts.map +1 -0
- package/package.json +23 -9
- package/dist/cjs/client/dictionary.service.cjs +0 -70
- package/dist/cjs/client/dictionary.service.cjs.map +0 -1
- package/dist/cjs/client/getBrowserLocale.cjs.map +0 -1
- package/dist/cjs/client/getDictionary.cjs.map +0 -1
- package/dist/cjs/client/getLocale.cjs.map +0 -1
- package/dist/cjs/client/intlayer.service.cjs.map +0 -1
- package/dist/cjs/client/locale.service.cjs +0 -66
- package/dist/cjs/client/locale.service.cjs.map +0 -1
- package/dist/cjs/client/t.cjs +0 -32
- package/dist/cjs/client/t.cjs.map +0 -1
- package/dist/esm/client/dictionary.service.mjs +0 -46
- package/dist/esm/client/dictionary.service.mjs.map +0 -1
- package/dist/esm/client/getBrowserLocale.mjs +0 -10
- package/dist/esm/client/getBrowserLocale.mjs.map +0 -1
- package/dist/esm/client/getDictionary.mjs +0 -25
- package/dist/esm/client/getDictionary.mjs.map +0 -1
- package/dist/esm/client/getLocale.mjs +0 -7
- package/dist/esm/client/getLocale.mjs.map +0 -1
- package/dist/esm/client/intlayer.service.mjs +0 -19
- package/dist/esm/client/intlayer.service.mjs.map +0 -1
- package/dist/esm/client/locale.service.mjs +0 -42
- package/dist/esm/client/locale.service.mjs.map +0 -1
- package/dist/esm/client/t.mjs +0 -8
- package/dist/esm/client/t.mjs.map +0 -1
- package/dist/types/client/dictionary.service.d.ts +0 -21
- package/dist/types/client/dictionary.service.d.ts.map +0 -1
- package/dist/types/client/getBrowserLocale.d.ts +0 -6
- package/dist/types/client/getBrowserLocale.d.ts.map +0 -1
- package/dist/types/client/getDictionary.d.ts +0 -8
- package/dist/types/client/getDictionary.d.ts.map +0 -1
- package/dist/types/client/getLocale.d.ts +0 -7
- package/dist/types/client/getLocale.d.ts.map +0 -1
- package/dist/types/client/intlayer.service.d.ts +0 -8
- package/dist/types/client/intlayer.service.d.ts.map +0 -1
- package/dist/types/client/locale.service.d.ts +0 -12
- package/dist/types/client/locale.service.d.ts.map +0 -1
- package/dist/types/client/t.d.ts +0 -8
- package/dist/types/client/t.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -5,15 +5,48 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/angular-intlayer"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
<a href="https://www.npmjs.com/package/angular-intlayer" target="blank"><img
|
|
9
|
+
align="center"
|
|
10
|
+
alt="npm"
|
|
11
|
+
src="https://img.shields.io/npm/v/angular-intlayer.svg?labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
12
|
+
height="30" /></a>
|
|
13
|
+
<a href="https://npmjs.org/package/angular-intlayer" target="blank"><img
|
|
14
|
+
align="center"
|
|
15
|
+
src="https://img.shields.io/npm/dm/angular-intlayer?labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
16
|
+
alt="monthly downloads"
|
|
17
|
+
height="30"
|
|
18
|
+
/></a>
|
|
19
|
+
<a href="https://npmjs.org/package/angular-intlayer" target="blank"><img
|
|
20
|
+
align="center"
|
|
21
|
+
src="https://img.shields.io/npm/types/angular-intlayer?label=types%20included&labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
22
|
+
alt="types included"
|
|
23
|
+
height="30"
|
|
24
|
+
/></a>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div>
|
|
28
|
+
<br/>
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="https://www.linkedin.com/company/intlayerorg" target="blank"><img align="center"
|
|
31
|
+
src="https://img.shields.io/badge/linkedin-%231DA1F2.svg?style=for-the-badge&logo=linkedin&logoColor=white"
|
|
32
|
+
alt="Intlayer LinkedIn" height="30"/></a>
|
|
33
|
+
<a href="https://www.facebook.com/intlayer" target="blank"><img align="center"
|
|
34
|
+
src="https://img.shields.io/badge/facebook-4267B2.svg?style=for-the-badge&logo=facebook&logoColor=white"
|
|
35
|
+
alt="Intlayer Facebook" height="30"/></a>
|
|
36
|
+
<a href="https://www.instagram.com/intlayer_org/" target="blank"><img align="center"
|
|
37
|
+
src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white"
|
|
38
|
+
alt="Intlayer Instagram" height="30"/></a>
|
|
39
|
+
<a href="https://x.com/Intlayer183096" target="blank"><img align="center"
|
|
40
|
+
src="https://img.shields.io/badge/x-1DA1F2.svg?style=for-the-badge&logo=x&logoColor=white"
|
|
41
|
+
alt="Intlayer X" height="30"/></a>
|
|
42
|
+
<a href="https://www.youtube.com/@intlayer" target="blank"><img align="center"
|
|
43
|
+
src="https://img.shields.io/badge/youtube-FF0000.svg?style=for-the-badge&logo=youtube&logoColor=white"
|
|
44
|
+
alt="Intlayer YouTube" height="30"/></a>
|
|
45
|
+
<a href="https://www.tiktok.com/@intlayer" target="blank"><img align="center"
|
|
46
|
+
src="https://img.shields.io/badge/tiktok-000000.svg?style=for-the-badge&logo=tiktok&logoColor=white"
|
|
47
|
+
alt="Intlayer TikTok" height="30"/></a>
|
|
48
|
+
<br>
|
|
49
|
+
</p>
|
|
17
50
|
</div>
|
|
18
51
|
|
|
19
52
|
> This package is in development.
|
|
@@ -0,0 +1,141 @@
|
|
|
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");
|
|
26
|
+
const DEFAULT_PRESS_DETECT_DURATION = 250;
|
|
27
|
+
@((0, import_core.Component)({
|
|
28
|
+
selector: "app-content-selector",
|
|
29
|
+
template: `
|
|
30
|
+
<span
|
|
31
|
+
#containerRef
|
|
32
|
+
role="button"
|
|
33
|
+
tabindex="0"
|
|
34
|
+
(click)="handleClick($event)"
|
|
35
|
+
(mousedown)="handleMouseDown()"
|
|
36
|
+
(mouseup)="handleMouseUp()"
|
|
37
|
+
(mouseleave)="handleMouseUp()"
|
|
38
|
+
(touchstart)="handleMouseDown()"
|
|
39
|
+
(touchend)="handleMouseUp()"
|
|
40
|
+
(touchcancel)="handleMouseUp()"
|
|
41
|
+
(blur)="handleBlur()"
|
|
42
|
+
(mouseenter)="onMouseEnter()"
|
|
43
|
+
[ngStyle]="getContainerStyle()"
|
|
44
|
+
>
|
|
45
|
+
<ng-content></ng-content>
|
|
46
|
+
</span>
|
|
47
|
+
`,
|
|
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
|
+
});
|
|
141
|
+
//# sourceMappingURL=ContentSelector.component.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
6
|
var __copyProps = (to, from, except, desc) => {
|
|
11
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -15,33 +11,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
11
|
}
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
16
|
var client_exports = {};
|
|
20
|
-
__export(client_exports, {
|
|
21
|
-
DictionaryService: () => import_dictionary.DictionaryService,
|
|
22
|
-
IntlayerService: () => import_intlayer.IntlayerService,
|
|
23
|
-
LocaleService: () => import_locale.LocaleService,
|
|
24
|
-
getBrowserLocale: () => import_getBrowserLocale.getBrowserLocale,
|
|
25
|
-
getDictionary: () => import_getDictionary.getDictionary,
|
|
26
|
-
getLocale: () => import_getLocale.getLocale,
|
|
27
|
-
t: () => import_t.t
|
|
28
|
-
});
|
|
29
17
|
module.exports = __toCommonJS(client_exports);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var import_t = require('./t.cjs');
|
|
18
|
+
__reExport(client_exports, require('./installIntlayer.cjs'), module.exports);
|
|
19
|
+
__reExport(client_exports, require('./useDictionary.cjs'), module.exports);
|
|
20
|
+
__reExport(client_exports, require('./useDictionaryDynamic.cjs'), module.exports);
|
|
21
|
+
__reExport(client_exports, require('./useIntlayer.cjs'), module.exports);
|
|
22
|
+
__reExport(client_exports, require('./useLoadDynamic.cjs'), module.exports);
|
|
23
|
+
__reExport(client_exports, require('./useLocale.cjs'), module.exports);
|
|
37
24
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
25
|
0 && (module.exports = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
t
|
|
26
|
+
...require('./installIntlayer.cjs'),
|
|
27
|
+
...require('./useDictionary.cjs'),
|
|
28
|
+
...require('./useDictionaryDynamic.cjs'),
|
|
29
|
+
...require('./useIntlayer.cjs'),
|
|
30
|
+
...require('./useLoadDynamic.cjs'),
|
|
31
|
+
...require('./useLocale.cjs')
|
|
46
32
|
});
|
|
47
33
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './installIntlayer';\nexport * from './useDictionary';\nexport * from './useDictionaryDynamic';\nexport * from './useIntlayer';\nexport * from './useLoadDynamic';\nexport * from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,8BAAd;AACA,2BAAc,4BADd;AAEA,2BAAc,mCAFd;AAGA,2BAAc,0BAHd;AAIA,2BAAc,6BAJd;AAKA,2BAAc,wBALd;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
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");
|
|
40
|
+
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;
|
|
60
|
+
};
|
|
61
|
+
const installIntlayer = (locale) => {
|
|
62
|
+
const client = createIntlayerClient(locale);
|
|
63
|
+
return client;
|
|
64
|
+
};
|
|
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
|
+
});
|
|
72
|
+
//# sourceMappingURL=installIntlayer.cjs.map
|
|
@@ -0,0 +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"]}
|
|
@@ -16,28 +16,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var useDictionary_exports = {};
|
|
20
|
+
__export(useDictionary_exports, {
|
|
21
|
+
useDictionary: () => useDictionary
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var import_core = require("@
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
];
|
|
33
|
-
return (0, import_core.getDictionary)(
|
|
34
|
-
dictionary,
|
|
35
|
-
locale,
|
|
36
|
-
plugins
|
|
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');
|
|
27
|
+
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())
|
|
37
32
|
);
|
|
33
|
+
return content();
|
|
38
34
|
};
|
|
39
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
36
|
0 && (module.exports = {
|
|
41
|
-
|
|
37
|
+
useDictionary
|
|
42
38
|
});
|
|
43
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=useDictionary.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var useDictionaryDynamic_exports = {};
|
|
21
|
+
__export(useDictionaryDynamic_exports, {
|
|
22
|
+
useDictionaryDynamic: () => useDictionaryDynamic
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useDictionaryDynamic_exports);
|
|
25
|
+
var import_core = require("@angular/core");
|
|
26
|
+
var import_installIntlayer = require('./installIntlayer.cjs');
|
|
27
|
+
var import_useDictionary = require('./useDictionary.cjs');
|
|
28
|
+
var import_useLoadDynamic = require('./useLoadDynamic.cjs');
|
|
29
|
+
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
|
|
30
|
+
const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
|
|
31
|
+
const localeTarget = (0, import_core.computed)(() => locale ?? intlayer?.locale());
|
|
32
|
+
const dictionary = (0, import_useLoadDynamic.useLoadDynamic)(
|
|
33
|
+
`${String(key)}.${localeTarget()}`,
|
|
34
|
+
dictionaryPromise[localeTarget()]()
|
|
35
|
+
);
|
|
36
|
+
return (0, import_useDictionary.useDictionary)(dictionary, localeTarget());
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useDictionaryDynamic
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=useDictionaryDynamic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(() => locale ?? intlayer?.locale());\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n dictionaryPromise[localeTarget()]!()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiC;AAOjC,6BAAiD;AACjD,2BAA8B;AAC9B,4BAA+B;AAOxB,MAAM,uBAAuB,CAIlC,mBACA,KACA,WACG;AACH,QAAM,eAAW,oBAAyB,qCAAc;AAExD,QAAM,mBAAe,sBAAS,MAAM,UAAU,UAAU,OAAO,CAAC;AAEhE,QAAM,iBAAa;AAAA,IACjB,GAAG,OAAO,GAAG,CAAC,IAAI,aAAa,CAAC;AAAA,IAChC,kBAAkB,aAAa,CAAC,EAAG;AAAA,EACrC;AAEA,aAAO,oCAAc,YAAY,aAAa,CAAQ;AACxD;","names":[]}
|
|
@@ -16,19 +16,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var useIntlayer_exports = {};
|
|
20
|
+
__export(useIntlayer_exports, {
|
|
21
|
+
isUpdatableNode: () => isUpdatableNode,
|
|
22
|
+
useIntlayer: () => useIntlayer
|
|
22
23
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
module.exports = __toCommonJS(useIntlayer_exports);
|
|
25
|
+
var import_core = require("@angular/core");
|
|
26
|
+
var import_getIntlayer = require('../getIntlayer.cjs');
|
|
27
|
+
var import_installIntlayer = require('./installIntlayer.cjs');
|
|
28
|
+
const isUpdatableNode = (val) => !!val && typeof val === "object" && typeof val.__update === "function";
|
|
29
|
+
const useIntlayer = (key, locale) => {
|
|
30
|
+
const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
|
|
31
|
+
const localeTarget = (0, import_core.computed)(() => locale ?? intlayer.locale());
|
|
32
|
+
const content = (0, import_core.computed)(() => (0, import_getIntlayer.getIntlayer)(key, localeTarget()));
|
|
33
|
+
return content();
|
|
29
34
|
};
|
|
30
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
36
|
0 && (module.exports = {
|
|
32
|
-
|
|
37
|
+
isUpdatableNode,
|
|
38
|
+
useIntlayer
|
|
33
39
|
});
|
|
34
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=useIntlayer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { DictionaryKeys } from '@intlayer/core';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport { getIntlayer } from '../getIntlayer';\nimport { DeepTransformContent } from '../plugins';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\n\n/** guard utility — true only for objects generated by `renderIntlayerNode()` */\nexport const isUpdatableNode = (\n val: unknown\n): val is { __update: (n: unknown) => void } =>\n !!val &&\n typeof val === 'object' &&\n typeof (val as any).__update === 'function';\n\nexport const useIntlayer = <T extends DictionaryKeys>(\n key: T,\n locale?: LocalesValues\n): DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']> => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN)!;\n\n /** which locale should we use right now? */\n const localeTarget = computed(() => locale ?? intlayer.locale());\n\n /** a *stable* reactive dictionary object */\n const content = computed(() => getIntlayer(key, localeTarget()));\n\n return content() as DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n >; // all consumers keep full reactivity\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAKjC,yBAA4B;AAE5B,6BAAiD;AAG1C,MAAM,kBAAkB,CAC7B,QAEA,CAAC,CAAC,OACF,OAAO,QAAQ,YACf,OAAQ,IAAY,aAAa;AAE5B,MAAM,cAAc,CACzB,KACA,WACyE;AACzE,QAAM,eAAW,oBAAyB,qCAAc;AAGxD,QAAM,mBAAe,sBAAS,MAAM,UAAU,SAAS,OAAO,CAAC;AAG/D,QAAM,cAAU,sBAAS,UAAM,gCAAY,KAAK,aAAa,CAAC,CAAC;AAE/D,SAAO,QAAQ;AAGjB;","names":[]}
|
|
@@ -16,28 +16,30 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var useLoadDynamic_exports = {};
|
|
20
|
+
__export(useLoadDynamic_exports, {
|
|
21
|
+
useLoadDynamic: () => useLoadDynamic
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(useLoadDynamic_exports);
|
|
24
24
|
var import_core = require("@angular/core");
|
|
25
|
-
|
|
26
|
-
@(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const useLoadDynamic = (key, promise) => {
|
|
26
|
+
const cache = useLoadDynamic._cache || (useLoadDynamic._cache = /* @__PURE__ */ new Map());
|
|
27
|
+
const container = (0, import_core.signal)({});
|
|
28
|
+
if (!cache.has(key)) {
|
|
29
|
+
const p = promise.then((real) => {
|
|
30
|
+
container.set(real);
|
|
31
|
+
return real;
|
|
32
|
+
});
|
|
33
|
+
cache.set(key, p);
|
|
34
|
+
} else {
|
|
35
|
+
cache.get(key).then((real) => {
|
|
36
|
+
container.set(real);
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
+
return container();
|
|
40
|
+
};
|
|
39
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
42
|
0 && (module.exports = {
|
|
41
|
-
|
|
43
|
+
useLoadDynamic
|
|
42
44
|
});
|
|
43
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=useLoadDynamic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLoadDynamic.ts"],"sourcesContent":["import { signal } from '@angular/core';\n\n/**\n * A \"synchronous\" loader for a dynamically‐imported JSON (or anything).\n *\n * - Immediately returns a reactive signal so that Angular can properly track changes.\n * - When the Promise resolves, it replaces the signal's value with the real data.\n */\nexport const useLoadDynamic = <T extends Record<string, any>>(\n key: string,\n promise: Promise<T>\n): T => {\n // A module‐level cache of Promises, so we only import once per key.\n const cache: Map<string, Promise<T>> = (useLoadDynamic as any)._cache ||\n ((useLoadDynamic as any)._cache = new Map());\n\n // Hold the \"current\" value as a reactive signal\n // This starts as an empty object but Angular can track changes to it\n const container = signal({} as T);\n\n if (!cache.has(key)) {\n // Kick off the dynamic import & cache it\n const p = promise.then((real) => {\n // As soon as the import resolves, update the signal with the real data\n container.set(real);\n return real;\n });\n cache.set(key, p);\n } else {\n // If it's already in flight (or done), hook into it so that the container still updates\n cache.get(key)!.then((real) => {\n container.set(real);\n });\n }\n\n // Return the current signal value directly - Angular can track all changes to it\n return container();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AAQhB,MAAM,iBAAiB,CAC5B,KACA,YACM;AAEN,QAAM,QAAkC,eAAuB,WAC7D,eAAuB,SAAS,oBAAI,IAAI;AAI1C,QAAM,gBAAY,oBAAO,CAAC,CAAM;AAEhC,MAAI,CAAC,MAAM,IAAI,GAAG,GAAG;AAEnB,UAAM,IAAI,QAAQ,KAAK,CAAC,SAAS;AAE/B,gBAAU,IAAI,IAAI;AAClB,aAAO;AAAA,IACT,CAAC;AACD,UAAM,IAAI,KAAK,CAAC;AAAA,EAClB,OAAO;AAEL,UAAM,IAAI,GAAG,EAAG,KAAK,CAAC,SAAS;AAC7B,gBAAU,IAAI,IAAI;AAAA,IACpB,CAAC;AAAA,EACH;AAGA,SAAO,UAAU;AACnB;","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 useLocale_exports = {};
|
|
30
|
+
__export(useLocale_exports, {
|
|
31
|
+
useLocale: () => useLocale
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useLocale_exports);
|
|
34
|
+
var import_core = require("@angular/core");
|
|
35
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
36
|
+
var import_installIntlayer = require('./installIntlayer.cjs');
|
|
37
|
+
var import_useLocaleCookie = require('./useLocaleCookie.cjs');
|
|
38
|
+
const useLocale = ({ onLocaleChange } = {}) => {
|
|
39
|
+
const { defaultLocale, locales: availableLocales } = import_built.default?.internationalization ?? {};
|
|
40
|
+
const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
|
|
41
|
+
const { setLocaleCookie } = (0, import_useLocaleCookie.useLocaleCookie)();
|
|
42
|
+
const locale = (0, import_core.computed)(() => intlayer?.locale() ?? defaultLocale);
|
|
43
|
+
const setLocale = (newLocale) => {
|
|
44
|
+
if (!availableLocales?.map(String).includes(newLocale)) {
|
|
45
|
+
console.error(`Locale ${newLocale} is not available`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (intlayer) {
|
|
49
|
+
intlayer.setLocale(newLocale);
|
|
50
|
+
}
|
|
51
|
+
setLocaleCookie(newLocale);
|
|
52
|
+
onLocaleChange?.(newLocale);
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
locale,
|
|
56
|
+
// Current locale
|
|
57
|
+
defaultLocale,
|
|
58
|
+
// Principal locale defined in config
|
|
59
|
+
availableLocales,
|
|
60
|
+
// List of the available locales defined in config
|
|
61
|
+
setLocale
|
|
62
|
+
// Function to set the locale
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
useLocale
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=useLocale.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useLocaleCookie } from './useLocaleCookie';\n\ntype useLocaleProps = {\n onLocaleChange?: (locale: LocalesValues) => void;\n};\n\n/**\n * On the client side, composable to get the current locale and all related fields\n */\nexport const useLocale = ({ onLocaleChange }: useLocaleProps = {}) => {\n const { defaultLocale, locales: availableLocales } =\n configuration?.internationalization ?? {};\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n const { setLocaleCookie } = useLocaleCookie();\n\n // Create a reactive reference for the locale\n const locale = computed(() => intlayer?.locale() ?? defaultLocale);\n\n const setLocale = (newLocale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n if (intlayer) {\n intlayer.setLocale(newLocale);\n }\n setLocaleCookie(newLocale);\n onLocaleChange?.(newLocale);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AACjC,mBAA0B;AAE1B,6BAAiD;AACjD,6BAAgC;AASzB,MAAM,YAAY,CAAC,EAAE,eAAe,IAAoB,CAAC,MAAM;AACpE,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAC/C,aAAAA,SAAe,wBAAwB,CAAC;AAC1C,QAAM,eAAW,oBAAyB,qCAAc;AACxD,QAAM,EAAE,gBAAgB,QAAI,wCAAgB;AAG5C,QAAM,aAAS,sBAAS,MAAM,UAAU,OAAO,KAAK,aAAa;AAEjE,QAAM,YAAY,CAAC,cAA6B;AAC9C,QAAI,CAAC,kBAAkB,IAAI,MAAM,EAAE,SAAS,SAAS,GAAG;AACtD,cAAQ,MAAM,UAAU,SAAS,mBAAmB;AACpD;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,eAAS,UAAU,SAAS;AAAA,IAC9B;AACA,oBAAgB,SAAS;AACzB,qBAAiB,SAAS;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":["configuration"]}
|