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