@intlayer/next-i18next 8.12.5-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/README.md +330 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/appWithTranslation.cjs +31 -0
- package/dist/cjs/appWithTranslation.cjs.map +1 -0
- package/dist/cjs/index.cjs +69 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/compareUrls.cjs +39 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/compareUrls.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/ContentSelector.cjs +161 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/ContentSelector.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.cjs +269 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/EditedContent.cjs +161 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/EditedContent.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/IntlayerEditorElement.cjs +88 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/IntlayerEditorElement.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/defineIntlayerElements.cjs +27 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/components/defineIntlayerElements.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/CrossFrameMessenger.cjs +80 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/CrossFrameMessenger.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/CrossFrameStateManager.cjs +75 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/CrossFrameStateManager.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/EditorStateManager.cjs +383 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/EditorStateManager.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/IframeClickInterceptor.cjs +45 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/IframeClickInterceptor.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/UrlStateManager.cjs +59 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/UrlStateManager.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/editedContentBus.cjs +36 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/editedContentBus.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/focusedContentBus.cjs +42 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/focusedContentBus.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/globalManager.cjs +82 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/globalManager.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/initEditorClient.cjs +55 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/core/initEditorClient.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/index.cjs +19 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/isEnabled.cjs +9 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/isEnabled.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/mergeIframeClick.cjs +22 -0
- package/dist/cjs/packages/@intlayer/editor/dist/esm/mergeIframeClick.cjs.map +1 -0
- package/dist/cjs/packages/@intlayer/unmerged-dictionaries-entry/dist/esm/index.cjs +32 -0
- package/dist/cjs/packages/@intlayer/unmerged-dictionaries-entry/dist/esm/index.cjs.map +1 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/IntlayerContext.cjs +25 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/IntlayerContext.cjs.map +1 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/IntlayerProvider.cjs +78 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/IntlayerProvider.cjs.map +1 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/useLocaleStorage.cjs +24 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/client/useLocaleStorage.cjs.map +1 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/editor/EditorProvider.cjs +11 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/editor/EditorProvider.cjs.map +1 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/editor/useEditor.cjs +39 -0
- package/dist/cjs/packages/react-intlayer/dist/esm/editor/useEditor.cjs.map +1 -0
- package/dist/cjs/plugin/index.cjs +170 -0
- package/dist/cjs/plugin/index.cjs.map +1 -0
- package/dist/cjs/serverSideTranslations.cjs +46 -0
- package/dist/cjs/serverSideTranslations.cjs.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/esm/appWithTranslation.mjs +29 -0
- package/dist/esm/appWithTranslation.mjs.map +1 -0
- package/dist/esm/index.mjs +11 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/compareUrls.mjs +38 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/compareUrls.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/ContentSelector.mjs +160 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/ContentSelector.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.mjs +266 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/EditedContent.mjs +159 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/EditedContent.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/IntlayerEditorElement.mjs +88 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/IntlayerEditorElement.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/defineIntlayerElements.mjs +26 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/components/defineIntlayerElements.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/CrossFrameMessenger.mjs +80 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/CrossFrameMessenger.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/CrossFrameStateManager.mjs +74 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/CrossFrameStateManager.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/EditorStateManager.mjs +381 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/EditorStateManager.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/IframeClickInterceptor.mjs +45 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/IframeClickInterceptor.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/UrlStateManager.mjs +58 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/UrlStateManager.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/editedContentBus.mjs +33 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/editedContentBus.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/focusedContentBus.mjs +39 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/focusedContentBus.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/globalManager.mjs +79 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/globalManager.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/initEditorClient.mjs +52 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/core/initEditorClient.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/index.mjs +18 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/isEnabled.mjs +8 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/isEnabled.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/mergeIframeClick.mjs +21 -0
- package/dist/esm/packages/@intlayer/editor/dist/esm/mergeIframeClick.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/unmerged-dictionaries-entry/dist/esm/index.browser.mjs +6 -0
- package/dist/esm/packages/@intlayer/unmerged-dictionaries-entry/dist/esm/index.browser.mjs.map +1 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/IntlayerContext.mjs +23 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/IntlayerContext.mjs.map +1 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/IntlayerProvider.mjs +77 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/IntlayerProvider.mjs.map +1 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/useLocaleStorage.mjs +22 -0
- package/dist/esm/packages/react-intlayer/dist/esm/client/useLocaleStorage.mjs.map +1 -0
- package/dist/esm/packages/react-intlayer/dist/esm/editor/EditorProvider.mjs +11 -0
- package/dist/esm/packages/react-intlayer/dist/esm/editor/EditorProvider.mjs.map +1 -0
- package/dist/esm/packages/react-intlayer/dist/esm/editor/useEditor.mjs +38 -0
- package/dist/esm/packages/react-intlayer/dist/esm/editor/useEditor.mjs.map +1 -0
- package/dist/esm/plugin/index.mjs +165 -0
- package/dist/esm/plugin/index.mjs.map +1 -0
- package/dist/esm/serverSideTranslations.mjs +44 -0
- package/dist/esm/serverSideTranslations.mjs.map +1 -0
- package/dist/types/appWithTranslation.d.ts +18 -0
- package/dist/types/appWithTranslation.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/plugin/index.d.ts +23 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/serverSideTranslations.d.ts +33 -0
- package/dist/types/serverSideTranslations.d.ts.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../packages/@intlayer/editor/dist/esm/components/ContentSelector.mjs
|
|
3
|
+
const DEFAULT_PRESS_DURATION = 250;
|
|
4
|
+
const STYLES = `
|
|
5
|
+
:host {
|
|
6
|
+
display: contents;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wrapper {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
user-select: none;
|
|
13
|
+
border-radius: 0.375rem;
|
|
14
|
+
outline-width: 2px;
|
|
15
|
+
outline-offset: 4px;
|
|
16
|
+
outline-style: solid;
|
|
17
|
+
outline-color: transparent;
|
|
18
|
+
transition: all 100ms 50ms ease-in-out;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wrapper[data-active] {
|
|
22
|
+
outline-color: inherit;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const _HTMLElement = typeof HTMLElement !== "undefined" ? HTMLElement : class {};
|
|
26
|
+
/**
|
|
27
|
+
* <intlayer-content-selector>
|
|
28
|
+
*
|
|
29
|
+
* A framework-agnostic web component that wraps content with Intlayer editor
|
|
30
|
+
* selection UI (hover outline, long-press to select, click-outside to deselect).
|
|
31
|
+
*
|
|
32
|
+
* @fires intlayer:press - Fired after a long press (pressDuration ms). Bubbles.
|
|
33
|
+
* @fires intlayer:hover - Fired on mouseenter. Bubbles.
|
|
34
|
+
* @fires intlayer:unhover - Fired on mouseleave / mouseup. Bubbles.
|
|
35
|
+
* @fires intlayer:click-outside - Fired when a click occurs outside the element. Bubbles.
|
|
36
|
+
*
|
|
37
|
+
* @prop {boolean} isSelecting - Whether this element is currently selected (external state)
|
|
38
|
+
* @prop {number} pressDuration - Long-press threshold in ms. Default: 250
|
|
39
|
+
*/
|
|
40
|
+
var IntlayerContentSelectorElement = class extends _HTMLElement {
|
|
41
|
+
_isSelecting = false;
|
|
42
|
+
_pressDuration = DEFAULT_PRESS_DURATION;
|
|
43
|
+
_isHovered = false;
|
|
44
|
+
_isSelectingState = false;
|
|
45
|
+
_wrapper;
|
|
46
|
+
_pressTimer = null;
|
|
47
|
+
_clickOutsideHandler = null;
|
|
48
|
+
static get observedAttributes() {
|
|
49
|
+
return ["is-selecting", "press-duration"];
|
|
50
|
+
}
|
|
51
|
+
get isSelecting() {
|
|
52
|
+
return this._isSelecting;
|
|
53
|
+
}
|
|
54
|
+
set isSelecting(v) {
|
|
55
|
+
this._isSelecting = v;
|
|
56
|
+
this._updateActiveState();
|
|
57
|
+
}
|
|
58
|
+
get pressDuration() {
|
|
59
|
+
return this._pressDuration;
|
|
60
|
+
}
|
|
61
|
+
set pressDuration(v) {
|
|
62
|
+
this._pressDuration = v;
|
|
63
|
+
}
|
|
64
|
+
constructor() {
|
|
65
|
+
super();
|
|
66
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
67
|
+
const style = document.createElement("style");
|
|
68
|
+
style.textContent = STYLES;
|
|
69
|
+
shadow.appendChild(style);
|
|
70
|
+
const wrapper = document.createElement("span");
|
|
71
|
+
wrapper.className = "wrapper";
|
|
72
|
+
wrapper.setAttribute("role", "button");
|
|
73
|
+
wrapper.setAttribute("tabindex", "0");
|
|
74
|
+
wrapper.appendChild(document.createElement("slot"));
|
|
75
|
+
shadow.appendChild(wrapper);
|
|
76
|
+
this._wrapper = wrapper;
|
|
77
|
+
wrapper.addEventListener("mousedown", () => this._handleMouseDown());
|
|
78
|
+
wrapper.addEventListener("mouseup", () => this._handleMouseUpOrLeave());
|
|
79
|
+
wrapper.addEventListener("mouseleave", () => this._handleMouseUpOrLeave());
|
|
80
|
+
wrapper.addEventListener("mouseenter", () => this._handleMouseEnter());
|
|
81
|
+
wrapper.addEventListener("click", (e) => this._handleClick(e));
|
|
82
|
+
wrapper.addEventListener("touchstart", () => this._handleMouseDown());
|
|
83
|
+
wrapper.addEventListener("touchend", () => this._handleMouseUpOrLeave());
|
|
84
|
+
wrapper.addEventListener("touchcancel", () => this._handleMouseUpOrLeave());
|
|
85
|
+
wrapper.addEventListener("blur", () => this._handleBlur());
|
|
86
|
+
}
|
|
87
|
+
attributeChangedCallback(name, _oldVal, newVal) {
|
|
88
|
+
if (name === "is-selecting") {
|
|
89
|
+
this._isSelecting = newVal !== null;
|
|
90
|
+
this._updateActiveState();
|
|
91
|
+
} else if (name === "press-duration") this._pressDuration = newVal !== null ? parseInt(newVal, 10) : DEFAULT_PRESS_DURATION;
|
|
92
|
+
}
|
|
93
|
+
connectedCallback() {
|
|
94
|
+
this._clickOutsideHandler = (e) => {
|
|
95
|
+
if (!e.composedPath().includes(this)) {
|
|
96
|
+
this._isSelectingState = false;
|
|
97
|
+
this._dispatch("intlayer:click-outside");
|
|
98
|
+
this._updateActiveState();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
document.addEventListener("mousedown", this._clickOutsideHandler);
|
|
102
|
+
}
|
|
103
|
+
disconnectedCallback() {
|
|
104
|
+
if (this._clickOutsideHandler) {
|
|
105
|
+
document.removeEventListener("mousedown", this._clickOutsideHandler);
|
|
106
|
+
this._clickOutsideHandler = null;
|
|
107
|
+
}
|
|
108
|
+
this._clearPressTimer();
|
|
109
|
+
}
|
|
110
|
+
_updateActiveState() {
|
|
111
|
+
if (this._isSelecting || this._isSelectingState || this._isHovered) this._wrapper.setAttribute("data-active", "");
|
|
112
|
+
else this._wrapper.removeAttribute("data-active");
|
|
113
|
+
}
|
|
114
|
+
_clearPressTimer() {
|
|
115
|
+
if (this._pressTimer !== null) {
|
|
116
|
+
clearTimeout(this._pressTimer);
|
|
117
|
+
this._pressTimer = null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
_dispatch(eventName) {
|
|
121
|
+
this.dispatchEvent(new CustomEvent(eventName, {
|
|
122
|
+
bubbles: true,
|
|
123
|
+
composed: true
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
_handleMouseDown() {
|
|
127
|
+
this._clearPressTimer();
|
|
128
|
+
this._pressTimer = setTimeout(() => {
|
|
129
|
+
this._isSelectingState = true;
|
|
130
|
+
this._updateActiveState();
|
|
131
|
+
this._dispatch("intlayer:press");
|
|
132
|
+
}, this._pressDuration);
|
|
133
|
+
}
|
|
134
|
+
_handleMouseEnter() {
|
|
135
|
+
this._isHovered = true;
|
|
136
|
+
this._updateActiveState();
|
|
137
|
+
this._dispatch("intlayer:hover");
|
|
138
|
+
}
|
|
139
|
+
_handleMouseUpOrLeave() {
|
|
140
|
+
if (this._isHovered) {
|
|
141
|
+
this._isHovered = false;
|
|
142
|
+
this._dispatch("intlayer:unhover");
|
|
143
|
+
}
|
|
144
|
+
this._clearPressTimer();
|
|
145
|
+
this._updateActiveState();
|
|
146
|
+
}
|
|
147
|
+
_handleClick(e) {
|
|
148
|
+
if (this._isSelecting || this._isSelectingState) {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
_handleBlur() {
|
|
154
|
+
this._isSelectingState = false;
|
|
155
|
+
this._updateActiveState();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
exports.IntlayerContentSelectorElement = IntlayerContentSelectorElement;
|
|
161
|
+
//# sourceMappingURL=ContentSelector.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSelector.cjs","names":[],"sources":["../../../../../../../../../../packages/@intlayer/editor/dist/esm/components/ContentSelector.mjs"],"sourcesContent":["//#region src/components/ContentSelector.ts\nconst DEFAULT_PRESS_DURATION = 250;\nconst STYLES = `\n :host {\n display: contents;\n }\n\n .wrapper {\n display: inline-block;\n cursor: pointer;\n user-select: none;\n border-radius: 0.375rem;\n outline-width: 2px;\n outline-offset: 4px;\n outline-style: solid;\n outline-color: transparent;\n transition: all 100ms 50ms ease-in-out;\n }\n\n .wrapper[data-active] {\n outline-color: inherit;\n }\n`;\nconst _HTMLElement = typeof HTMLElement !== \"undefined\" ? HTMLElement : class {};\n/**\n* <intlayer-content-selector>\n*\n* A framework-agnostic web component that wraps content with Intlayer editor\n* selection UI (hover outline, long-press to select, click-outside to deselect).\n*\n* @fires intlayer:press - Fired after a long press (pressDuration ms). Bubbles.\n* @fires intlayer:hover - Fired on mouseenter. Bubbles.\n* @fires intlayer:unhover - Fired on mouseleave / mouseup. Bubbles.\n* @fires intlayer:click-outside - Fired when a click occurs outside the element. Bubbles.\n*\n* @prop {boolean} isSelecting - Whether this element is currently selected (external state)\n* @prop {number} pressDuration - Long-press threshold in ms. Default: 250\n*/\nvar IntlayerContentSelectorElement = class extends _HTMLElement {\n\t_isSelecting = false;\n\t_pressDuration = DEFAULT_PRESS_DURATION;\n\t_isHovered = false;\n\t_isSelectingState = false;\n\t_wrapper;\n\t_pressTimer = null;\n\t_clickOutsideHandler = null;\n\tstatic get observedAttributes() {\n\t\treturn [\"is-selecting\", \"press-duration\"];\n\t}\n\tget isSelecting() {\n\t\treturn this._isSelecting;\n\t}\n\tset isSelecting(v) {\n\t\tthis._isSelecting = v;\n\t\tthis._updateActiveState();\n\t}\n\tget pressDuration() {\n\t\treturn this._pressDuration;\n\t}\n\tset pressDuration(v) {\n\t\tthis._pressDuration = v;\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: \"open\" });\n\t\tconst style = document.createElement(\"style\");\n\t\tstyle.textContent = STYLES;\n\t\tshadow.appendChild(style);\n\t\tconst wrapper = document.createElement(\"span\");\n\t\twrapper.className = \"wrapper\";\n\t\twrapper.setAttribute(\"role\", \"button\");\n\t\twrapper.setAttribute(\"tabindex\", \"0\");\n\t\twrapper.appendChild(document.createElement(\"slot\"));\n\t\tshadow.appendChild(wrapper);\n\t\tthis._wrapper = wrapper;\n\t\twrapper.addEventListener(\"mousedown\", () => this._handleMouseDown());\n\t\twrapper.addEventListener(\"mouseup\", () => this._handleMouseUpOrLeave());\n\t\twrapper.addEventListener(\"mouseleave\", () => this._handleMouseUpOrLeave());\n\t\twrapper.addEventListener(\"mouseenter\", () => this._handleMouseEnter());\n\t\twrapper.addEventListener(\"click\", (e) => this._handleClick(e));\n\t\twrapper.addEventListener(\"touchstart\", () => this._handleMouseDown());\n\t\twrapper.addEventListener(\"touchend\", () => this._handleMouseUpOrLeave());\n\t\twrapper.addEventListener(\"touchcancel\", () => this._handleMouseUpOrLeave());\n\t\twrapper.addEventListener(\"blur\", () => this._handleBlur());\n\t}\n\tattributeChangedCallback(name, _oldVal, newVal) {\n\t\tif (name === \"is-selecting\") {\n\t\t\tthis._isSelecting = newVal !== null;\n\t\t\tthis._updateActiveState();\n\t\t} else if (name === \"press-duration\") this._pressDuration = newVal !== null ? parseInt(newVal, 10) : DEFAULT_PRESS_DURATION;\n\t}\n\tconnectedCallback() {\n\t\tthis._clickOutsideHandler = (e) => {\n\t\t\tif (!e.composedPath().includes(this)) {\n\t\t\t\tthis._isSelectingState = false;\n\t\t\t\tthis._dispatch(\"intlayer:click-outside\");\n\t\t\t\tthis._updateActiveState();\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener(\"mousedown\", this._clickOutsideHandler);\n\t}\n\tdisconnectedCallback() {\n\t\tif (this._clickOutsideHandler) {\n\t\t\tdocument.removeEventListener(\"mousedown\", this._clickOutsideHandler);\n\t\t\tthis._clickOutsideHandler = null;\n\t\t}\n\t\tthis._clearPressTimer();\n\t}\n\t_updateActiveState() {\n\t\tif (this._isSelecting || this._isSelectingState || this._isHovered) this._wrapper.setAttribute(\"data-active\", \"\");\n\t\telse this._wrapper.removeAttribute(\"data-active\");\n\t}\n\t_clearPressTimer() {\n\t\tif (this._pressTimer !== null) {\n\t\t\tclearTimeout(this._pressTimer);\n\t\t\tthis._pressTimer = null;\n\t\t}\n\t}\n\t_dispatch(eventName) {\n\t\tthis.dispatchEvent(new CustomEvent(eventName, {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\t_handleMouseDown() {\n\t\tthis._clearPressTimer();\n\t\tthis._pressTimer = setTimeout(() => {\n\t\t\tthis._isSelectingState = true;\n\t\t\tthis._updateActiveState();\n\t\t\tthis._dispatch(\"intlayer:press\");\n\t\t}, this._pressDuration);\n\t}\n\t_handleMouseEnter() {\n\t\tthis._isHovered = true;\n\t\tthis._updateActiveState();\n\t\tthis._dispatch(\"intlayer:hover\");\n\t}\n\t_handleMouseUpOrLeave() {\n\t\tif (this._isHovered) {\n\t\t\tthis._isHovered = false;\n\t\t\tthis._dispatch(\"intlayer:unhover\");\n\t\t}\n\t\tthis._clearPressTimer();\n\t\tthis._updateActiveState();\n\t}\n\t_handleClick(e) {\n\t\tif (this._isSelecting || this._isSelectingState) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\t_handleBlur() {\n\t\tthis._isSelectingState = false;\n\t\tthis._updateActiveState();\n\t}\n};\n\n//#endregion\nexport { IntlayerContentSelectorElement };\n//# sourceMappingURL=ContentSelector.mjs.map"],"mappings":";;AACA,MAAM,yBAAyB;AAC/B,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;AAqBf,MAAM,eAAe,OAAO,gBAAgB,cAAc,cAAc,MAAM;;;;;;;;;;;;;;;AAe9E,IAAI,iCAAiC,cAAc,aAAa;CAC/D,eAAe;CACf,iBAAiB;CACjB,aAAa;CACb,oBAAoB;CACpB;CACA,cAAc;CACd,uBAAuB;CACvB,WAAW,qBAAqB;AAC/B,SAAO,CAAC,gBAAgB,iBAAiB;;CAE1C,IAAI,cAAc;AACjB,SAAO,KAAK;;CAEb,IAAI,YAAY,GAAG;AAClB,OAAK,eAAe;AACpB,OAAK,oBAAoB;;CAE1B,IAAI,gBAAgB;AACnB,SAAO,KAAK;;CAEb,IAAI,cAAc,GAAG;AACpB,OAAK,iBAAiB;;CAEvB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tB,MAAI,KAAK,sBAAsB;AAC9B,YAAS,oBAAoB,aAAa,KAAK,qBAAqB;AACpE,QAAK,uBAAuB;;AAE7B,OAAK,kBAAkB;;CAExB,qBAAqB;AACpB,MAAI,KAAK,gBAAgB,KAAK,qBAAqB,KAAK,WAAY,MAAK,SAAS,aAAa,eAAe,GAAG;MAC5G,MAAK,SAAS,gBAAgB,cAAc;;CAElD,mBAAmB;AAClB,MAAI,KAAK,gBAAgB,MAAM;AAC9B,gBAAa,KAAK,YAAY;AAC9B,QAAK,cAAc;;;CAGrB,UAAU,WAAW;AACpB,OAAK,cAAc,IAAI,YAAY,WAAW;GAC7C,SAAS;GACT,UAAU;GACV,CAAC,CAAC;;CAEJ,mBAAmB;AAClB,OAAK,kBAAkB;AACvB,OAAK,cAAc,iBAAiB;AACnC,QAAK,oBAAoB;AACzB,QAAK,oBAAoB;AACzB,QAAK,UAAU,iBAAiB;KAC9B,KAAK,eAAe;;CAExB,oBAAoB;AACnB,OAAK,aAAa;AAClB,OAAK,oBAAoB;AACzB,OAAK,UAAU,iBAAiB;;CAEjC,wBAAwB;AACvB,MAAI,KAAK,YAAY;AACpB,QAAK,aAAa;AAClB,QAAK,UAAU,mBAAmB;;AAEnC,OAAK,kBAAkB;AACvB,OAAK,oBAAoB;;CAE1B,aAAa,GAAG;AACf,MAAI,KAAK,gBAAgB,KAAK,mBAAmB;AAChD,KAAE,gBAAgB;AAClB,KAAE,iBAAiB;;;CAGrB,cAAc;AACb,OAAK,oBAAoB;AACzB,OAAK,oBAAoB"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
const require_runtime = require('../../../../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_globalManager = require('../core/globalManager.cjs');
|
|
3
|
+
let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
|
|
4
|
+
_intlayer_types_nodeType = require_runtime.__toESM(_intlayer_types_nodeType, 1);
|
|
5
|
+
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
6
|
+
|
|
7
|
+
//#region ../../packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.mjs
|
|
8
|
+
const _HTMLElement = typeof HTMLElement !== "undefined" ? HTMLElement : class {};
|
|
9
|
+
/**
|
|
10
|
+
* <intlayer-content-selector-wrapper>
|
|
11
|
+
*
|
|
12
|
+
* Framework-agnostic web component that wraps content with the Intlayer editor
|
|
13
|
+
* selection UI. It replaces the per-framework ContentSelectorWrapper components
|
|
14
|
+
* (Vue, Svelte, Solid, Preact).
|
|
15
|
+
*
|
|
16
|
+
* It reads from the global EditorStateManager singleton (set by initEditorClient)
|
|
17
|
+
* and conditionally renders <intlayer-content-selector> around its slot content
|
|
18
|
+
* when the editor is active and the app is running inside an iframe.
|
|
19
|
+
*
|
|
20
|
+
* @attr {string} key-path - JSON-serialized KeyPath[] for this content node
|
|
21
|
+
* @attr {string} dictionary-key - The dictionary key owning this content node
|
|
22
|
+
*/
|
|
23
|
+
var IntlayerContentSelectorWrapperElement = class extends _HTMLElement {
|
|
24
|
+
_keyPathJson = "[]";
|
|
25
|
+
_dictionaryKey = "";
|
|
26
|
+
_editorEnabled = false;
|
|
27
|
+
_isInIframe = false;
|
|
28
|
+
_isSelected = false;
|
|
29
|
+
_editedValue = void 0;
|
|
30
|
+
_renderState = null;
|
|
31
|
+
_selector = null;
|
|
32
|
+
_unsubManager = null;
|
|
33
|
+
_unsubEnabled = null;
|
|
34
|
+
_unsubFocused = null;
|
|
35
|
+
_unsubEditedContent = null;
|
|
36
|
+
static get observedAttributes() {
|
|
37
|
+
return ["key-path", "dictionary-key"];
|
|
38
|
+
}
|
|
39
|
+
get keyPathJson() {
|
|
40
|
+
return this._keyPathJson;
|
|
41
|
+
}
|
|
42
|
+
set keyPathJson(v) {
|
|
43
|
+
this._keyPathJson = v;
|
|
44
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
45
|
+
if (manager) this._updateEditedValue(manager);
|
|
46
|
+
}
|
|
47
|
+
get dictionaryKey() {
|
|
48
|
+
return this._dictionaryKey;
|
|
49
|
+
}
|
|
50
|
+
set dictionaryKey(v) {
|
|
51
|
+
this._dictionaryKey = v;
|
|
52
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
53
|
+
if (manager) this._updateEditedValue(manager);
|
|
54
|
+
}
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
58
|
+
const style = document.createElement("style");
|
|
59
|
+
style.textContent = ":host { display: contents; }";
|
|
60
|
+
shadow.appendChild(style);
|
|
61
|
+
}
|
|
62
|
+
attributeChangedCallback(name, _oldVal, newVal) {
|
|
63
|
+
if (name === "key-path") {
|
|
64
|
+
this._keyPathJson = newVal ?? "[]";
|
|
65
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
66
|
+
if (manager) this._updateEditedValue(manager);
|
|
67
|
+
} else if (name === "dictionary-key") {
|
|
68
|
+
this._dictionaryKey = newVal ?? "";
|
|
69
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
70
|
+
if (manager) this._updateEditedValue(manager);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
if (typeof window !== "undefined") this._isInIframe = window.self !== window.top;
|
|
75
|
+
this._subscribeToManager();
|
|
76
|
+
this._render();
|
|
77
|
+
}
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
this._teardown();
|
|
80
|
+
}
|
|
81
|
+
_teardown() {
|
|
82
|
+
this._unsubManager?.();
|
|
83
|
+
this._unsubEnabled?.();
|
|
84
|
+
this._unsubFocused?.();
|
|
85
|
+
this._unsubEditedContent?.();
|
|
86
|
+
this._unsubManager = null;
|
|
87
|
+
this._unsubEnabled = null;
|
|
88
|
+
this._unsubFocused = null;
|
|
89
|
+
this._unsubEditedContent = null;
|
|
90
|
+
}
|
|
91
|
+
_getRawKeyPath() {
|
|
92
|
+
try {
|
|
93
|
+
return JSON.parse(this._keyPathJson);
|
|
94
|
+
} catch {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
_getFilteredKeyPath() {
|
|
99
|
+
return this._getRawKeyPath().filter((keyPath) => keyPath.type !== _intlayer_types_nodeType.TRANSLATION);
|
|
100
|
+
}
|
|
101
|
+
_updateEditedValue(manager) {
|
|
102
|
+
const filteredKeyPath = this._getFilteredKeyPath();
|
|
103
|
+
if (!this._dictionaryKey || filteredKeyPath.length === 0) {
|
|
104
|
+
this._editedValue = void 0;
|
|
105
|
+
this._render();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const rawKeyPath = this._getRawKeyPath();
|
|
109
|
+
const lastStepType = rawKeyPath[rawKeyPath.length - 1]?.type;
|
|
110
|
+
if (lastStepType === _intlayer_types_nodeType.MARKDOWN || lastStepType === _intlayer_types_nodeType.HTML || lastStepType === _intlayer_types_nodeType.INSERTION || lastStepType === _intlayer_types_nodeType.FILE) {
|
|
111
|
+
this._editedValue = void 0;
|
|
112
|
+
this._render();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let value = manager.getContentValue(this._dictionaryKey, filteredKeyPath);
|
|
116
|
+
if (value !== null && value !== void 0 && typeof value === "object" && value.nodeType === _intlayer_types_nodeType.TRANSLATION) {
|
|
117
|
+
const locale = manager.currentLocale.value;
|
|
118
|
+
value = locale ? value[_intlayer_types_nodeType.TRANSLATION][locale] : void 0;
|
|
119
|
+
}
|
|
120
|
+
this._editedValue = value;
|
|
121
|
+
this._render();
|
|
122
|
+
}
|
|
123
|
+
_updateIsSelected(focusedContent) {
|
|
124
|
+
if (!focusedContent) {
|
|
125
|
+
this._isSelected = false;
|
|
126
|
+
this._updateSelectorAttr();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const keyPath = this._getFilteredKeyPath();
|
|
130
|
+
const wasSelected = this._isSelected;
|
|
131
|
+
this._isSelected = focusedContent.dictionaryKey === this._dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && (0, _intlayer_core_utils.isSameKeyPath)(focusedContent.keyPath ?? [], keyPath);
|
|
132
|
+
this._updateSelectorAttr();
|
|
133
|
+
if (this._isSelected && !wasSelected) this._scrollIntoViewIfNeeded();
|
|
134
|
+
}
|
|
135
|
+
_scrollIntoViewIfNeeded() {
|
|
136
|
+
try {
|
|
137
|
+
let rect;
|
|
138
|
+
if (this._selector) {
|
|
139
|
+
const innerWrapper = this._selector.shadowRoot?.querySelector(".wrapper");
|
|
140
|
+
if (innerWrapper) {
|
|
141
|
+
const r = innerWrapper.getBoundingClientRect();
|
|
142
|
+
if (r.width > 0 || r.height > 0) rect = r;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!rect && this.childNodes.length > 0) {
|
|
146
|
+
const range = document.createRange();
|
|
147
|
+
range.selectNodeContents(this);
|
|
148
|
+
const r = range.getBoundingClientRect();
|
|
149
|
+
if (r.width > 0 || r.height > 0) rect = r;
|
|
150
|
+
}
|
|
151
|
+
if (!rect) rect = this.getBoundingClientRect();
|
|
152
|
+
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
153
|
+
const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
154
|
+
if (!(rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth)) {
|
|
155
|
+
const scrollY = window.scrollY ?? document.documentElement.scrollTop;
|
|
156
|
+
const targetScrollY = rect.top + scrollY - viewportHeight * .25;
|
|
157
|
+
window.scrollTo({
|
|
158
|
+
top: Math.max(0, targetScrollY),
|
|
159
|
+
behavior: "smooth"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
} catch {}
|
|
163
|
+
}
|
|
164
|
+
_updateSelectorAttr() {
|
|
165
|
+
if (!this._selector) return;
|
|
166
|
+
if (this._isSelected) this._selector.setAttribute("is-selecting", "");
|
|
167
|
+
else this._selector.removeAttribute("is-selecting");
|
|
168
|
+
}
|
|
169
|
+
_subscribeToManager() {
|
|
170
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
171
|
+
if (manager) this._setupManagerSubscriptions(manager);
|
|
172
|
+
this._unsubManager = require_globalManager.onGlobalEditorManagerChange((m) => {
|
|
173
|
+
this._unsubEnabled?.();
|
|
174
|
+
this._unsubFocused?.();
|
|
175
|
+
this._unsubEditedContent?.();
|
|
176
|
+
this._unsubEnabled = null;
|
|
177
|
+
this._unsubFocused = null;
|
|
178
|
+
this._unsubEditedContent = null;
|
|
179
|
+
if (m) this._setupManagerSubscriptions(m);
|
|
180
|
+
else {
|
|
181
|
+
this._editorEnabled = false;
|
|
182
|
+
this._isSelected = false;
|
|
183
|
+
this._editedValue = void 0;
|
|
184
|
+
this._render();
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
_setupManagerSubscriptions(manager) {
|
|
189
|
+
this._editorEnabled = manager.editorEnabled.value ?? false;
|
|
190
|
+
this._updateIsSelected(manager.focusedContent.value);
|
|
191
|
+
this._updateEditedValue(manager);
|
|
192
|
+
const handleEnabledChange = (e) => {
|
|
193
|
+
this._editorEnabled = e.detail;
|
|
194
|
+
this._render();
|
|
195
|
+
};
|
|
196
|
+
const handleFocusedChange = (e) => {
|
|
197
|
+
this._updateIsSelected(e.detail);
|
|
198
|
+
};
|
|
199
|
+
const handleEditedContentChange = () => {
|
|
200
|
+
this._updateEditedValue(manager);
|
|
201
|
+
};
|
|
202
|
+
manager.editorEnabled.addEventListener("change", handleEnabledChange);
|
|
203
|
+
manager.focusedContent.addEventListener("change", handleFocusedChange);
|
|
204
|
+
manager.editedContent.addEventListener("change", handleEditedContentChange);
|
|
205
|
+
this._unsubEnabled = () => manager.editorEnabled.removeEventListener("change", handleEnabledChange);
|
|
206
|
+
this._unsubFocused = () => manager.focusedContent.removeEventListener("change", handleFocusedChange);
|
|
207
|
+
this._unsubEditedContent = () => manager.editedContent.removeEventListener("change", handleEditedContentChange);
|
|
208
|
+
}
|
|
209
|
+
_handlePress(e) {
|
|
210
|
+
e.stopPropagation();
|
|
211
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
212
|
+
if (!manager) return;
|
|
213
|
+
manager.focusedContent.set({
|
|
214
|
+
dictionaryKey: this._dictionaryKey,
|
|
215
|
+
keyPath: this._getFilteredKeyPath()
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
_handleHover(e) {
|
|
219
|
+
e.stopPropagation();
|
|
220
|
+
require_globalManager.getGlobalEditorManager()?.messenger.send(`INTLAYER_HOVERED_CONTENT_CHANGED/post`, {
|
|
221
|
+
dictionaryKey: this._dictionaryKey,
|
|
222
|
+
keyPath: this._getFilteredKeyPath()
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
_handleUnhover(e) {
|
|
226
|
+
e.stopPropagation();
|
|
227
|
+
require_globalManager.getGlobalEditorManager()?.messenger.send(`INTLAYER_HOVERED_CONTENT_CHANGED/post`, null);
|
|
228
|
+
}
|
|
229
|
+
_render() {
|
|
230
|
+
const useWrapper = this._isInIframe && this._editorEnabled;
|
|
231
|
+
const editedValue = this._editedValue;
|
|
232
|
+
const newState = !useWrapper ? "simple" : typeof editedValue === "string" || typeof editedValue === "number" || typeof editedValue === "boolean" ? "wrapped-text" : "wrapped-slot";
|
|
233
|
+
if (this._renderState !== newState) {
|
|
234
|
+
this._rebuildContent(newState);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (newState !== "simple" && this._selector) {
|
|
238
|
+
this._updateSelectorAttr();
|
|
239
|
+
if (newState === "wrapped-text" && this._selector.firstChild?.nodeType === Node.TEXT_NODE) this._selector.firstChild.data = String(editedValue);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
_rebuildContent(state) {
|
|
243
|
+
const shadow = this.shadowRoot;
|
|
244
|
+
while (shadow.childNodes.length > 1) shadow.removeChild(shadow.lastChild);
|
|
245
|
+
this._selector = null;
|
|
246
|
+
if (state === "simple") shadow.appendChild(document.createElement("slot"));
|
|
247
|
+
else {
|
|
248
|
+
const selector = document.createElement("intlayer-content-selector");
|
|
249
|
+
this._selector = selector;
|
|
250
|
+
if (this._isSelected) selector.setAttribute("is-selecting", "");
|
|
251
|
+
selector.addEventListener("intlayer:press", (e) => this._handlePress(e));
|
|
252
|
+
selector.addEventListener("intlayer:hover", (e) => this._handleHover(e));
|
|
253
|
+
selector.addEventListener("intlayer:unhover", (e) => this._handleUnhover(e));
|
|
254
|
+
if (state === "wrapped-text") selector.appendChild(document.createTextNode(String(this._editedValue)));
|
|
255
|
+
else selector.appendChild(document.createElement("slot"));
|
|
256
|
+
shadow.appendChild(selector);
|
|
257
|
+
}
|
|
258
|
+
this._renderState = state;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const defineIntlayerContentSelectorWrapper = () => {
|
|
262
|
+
if (typeof customElements === "undefined") return;
|
|
263
|
+
if (!customElements.get("intlayer-content-selector-wrapper")) customElements.define("intlayer-content-selector-wrapper", IntlayerContentSelectorWrapperElement);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
//#endregion
|
|
267
|
+
exports.IntlayerContentSelectorWrapperElement = IntlayerContentSelectorWrapperElement;
|
|
268
|
+
exports.defineIntlayerContentSelectorWrapper = defineIntlayerContentSelectorWrapper;
|
|
269
|
+
//# sourceMappingURL=ContentSelectorWrapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.cjs","names":["getGlobalEditorManager","NodeTypes","onGlobalEditorManagerChange"],"sources":["../../../../../../../../../../packages/@intlayer/editor/dist/esm/components/ContentSelectorWrapper.mjs"],"sourcesContent":["import { MessageKey } from \"../messageKey.mjs\";\nimport { getGlobalEditorManager, onGlobalEditorManagerChange } from \"../core/globalManager.mjs\";\nimport { isSameKeyPath } from \"@intlayer/core/utils\";\nimport * as NodeTypes from \"@intlayer/types/nodeType\";\n\n//#region src/components/ContentSelectorWrapper.ts\nconst _HTMLElement = typeof HTMLElement !== \"undefined\" ? HTMLElement : class {};\n/**\n* <intlayer-content-selector-wrapper>\n*\n* Framework-agnostic web component that wraps content with the Intlayer editor\n* selection UI. It replaces the per-framework ContentSelectorWrapper components\n* (Vue, Svelte, Solid, Preact).\n*\n* It reads from the global EditorStateManager singleton (set by initEditorClient)\n* and conditionally renders <intlayer-content-selector> around its slot content\n* when the editor is active and the app is running inside an iframe.\n*\n* @attr {string} key-path - JSON-serialized KeyPath[] for this content node\n* @attr {string} dictionary-key - The dictionary key owning this content node\n*/\nvar IntlayerContentSelectorWrapperElement = class extends _HTMLElement {\n\t_keyPathJson = \"[]\";\n\t_dictionaryKey = \"\";\n\t_editorEnabled = false;\n\t_isInIframe = false;\n\t_isSelected = false;\n\t_editedValue = void 0;\n\t_renderState = null;\n\t_selector = null;\n\t_unsubManager = null;\n\t_unsubEnabled = null;\n\t_unsubFocused = null;\n\t_unsubEditedContent = null;\n\tstatic get observedAttributes() {\n\t\treturn [\"key-path\", \"dictionary-key\"];\n\t}\n\tget keyPathJson() {\n\t\treturn this._keyPathJson;\n\t}\n\tset keyPathJson(v) {\n\t\tthis._keyPathJson = v;\n\t\tconst manager = getGlobalEditorManager();\n\t\tif (manager) this._updateEditedValue(manager);\n\t}\n\tget dictionaryKey() {\n\t\treturn this._dictionaryKey;\n\t}\n\tset dictionaryKey(v) {\n\t\tthis._dictionaryKey = v;\n\t\tconst manager = getGlobalEditorManager();\n\t\tif (manager) this._updateEditedValue(manager);\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: \"open\" });\n\t\tconst style = document.createElement(\"style\");\n\t\tstyle.textContent = \":host { display: contents; }\";\n\t\tshadow.appendChild(style);\n\t}\n\tattributeChangedCallback(name, _oldVal, newVal) {\n\t\tif (name === \"key-path\") {\n\t\t\tthis._keyPathJson = newVal ?? \"[]\";\n\t\t\tconst manager = getGlobalEditorManager();\n\t\t\tif (manager) this._updateEditedValue(manager);\n\t\t} else if (name === \"dictionary-key\") {\n\t\t\tthis._dictionaryKey = newVal ?? \"\";\n\t\t\tconst manager = getGlobalEditorManager();\n\t\t\tif (manager) this._updateEditedValue(manager);\n\t\t}\n\t}\n\tconnectedCallback() {\n\t\tif (typeof window !== \"undefined\") this._isInIframe = window.self !== window.top;\n\t\tthis._subscribeToManager();\n\t\tthis._render();\n\t}\n\tdisconnectedCallback() {\n\t\tthis._teardown();\n\t}\n\t_teardown() {\n\t\tthis._unsubManager?.();\n\t\tthis._unsubEnabled?.();\n\t\tthis._unsubFocused?.();\n\t\tthis._unsubEditedContent?.();\n\t\tthis._unsubManager = null;\n\t\tthis._unsubEnabled = null;\n\t\tthis._unsubFocused = null;\n\t\tthis._unsubEditedContent = null;\n\t}\n\t_getRawKeyPath() {\n\t\ttry {\n\t\t\treturn JSON.parse(this._keyPathJson);\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t}\n\t_getFilteredKeyPath() {\n\t\treturn this._getRawKeyPath().filter((keyPath) => keyPath.type !== NodeTypes.TRANSLATION);\n\t}\n\t_updateEditedValue(manager) {\n\t\tconst filteredKeyPath = this._getFilteredKeyPath();\n\t\tif (!this._dictionaryKey || filteredKeyPath.length === 0) {\n\t\t\tthis._editedValue = void 0;\n\t\t\tthis._render();\n\t\t\treturn;\n\t\t}\n\t\tconst rawKeyPath = this._getRawKeyPath();\n\t\tconst lastStepType = rawKeyPath[rawKeyPath.length - 1]?.type;\n\t\tif (lastStepType === NodeTypes.MARKDOWN || lastStepType === NodeTypes.HTML || lastStepType === NodeTypes.INSERTION || lastStepType === NodeTypes.FILE) {\n\t\t\tthis._editedValue = void 0;\n\t\t\tthis._render();\n\t\t\treturn;\n\t\t}\n\t\tlet value = manager.getContentValue(this._dictionaryKey, filteredKeyPath);\n\t\tif (value !== null && value !== void 0 && typeof value === \"object\" && value.nodeType === NodeTypes.TRANSLATION) {\n\t\t\tconst locale = manager.currentLocale.value;\n\t\t\tvalue = locale ? value[NodeTypes.TRANSLATION][locale] : void 0;\n\t\t}\n\t\tthis._editedValue = value;\n\t\tthis._render();\n\t}\n\t_updateIsSelected(focusedContent) {\n\t\tif (!focusedContent) {\n\t\t\tthis._isSelected = false;\n\t\t\tthis._updateSelectorAttr();\n\t\t\treturn;\n\t\t}\n\t\tconst keyPath = this._getFilteredKeyPath();\n\t\tconst wasSelected = this._isSelected;\n\t\tthis._isSelected = focusedContent.dictionaryKey === this._dictionaryKey && (focusedContent.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent.keyPath ?? [], keyPath);\n\t\tthis._updateSelectorAttr();\n\t\tif (this._isSelected && !wasSelected) this._scrollIntoViewIfNeeded();\n\t}\n\t_scrollIntoViewIfNeeded() {\n\t\ttry {\n\t\t\tlet rect;\n\t\t\tif (this._selector) {\n\t\t\t\tconst innerWrapper = this._selector.shadowRoot?.querySelector(\".wrapper\");\n\t\t\t\tif (innerWrapper) {\n\t\t\t\t\tconst r = innerWrapper.getBoundingClientRect();\n\t\t\t\t\tif (r.width > 0 || r.height > 0) rect = r;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!rect && this.childNodes.length > 0) {\n\t\t\t\tconst range = document.createRange();\n\t\t\t\trange.selectNodeContents(this);\n\t\t\t\tconst r = range.getBoundingClientRect();\n\t\t\t\tif (r.width > 0 || r.height > 0) rect = r;\n\t\t\t}\n\t\t\tif (!rect) rect = this.getBoundingClientRect();\n\t\t\tconst viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n\t\t\tconst viewportWidth = window.innerWidth || document.documentElement.clientWidth;\n\t\t\tif (!(rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth)) {\n\t\t\t\tconst scrollY = window.scrollY ?? document.documentElement.scrollTop;\n\t\t\t\tconst targetScrollY = rect.top + scrollY - viewportHeight * .25;\n\t\t\t\twindow.scrollTo({\n\t\t\t\t\ttop: Math.max(0, targetScrollY),\n\t\t\t\t\tbehavior: \"smooth\"\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {}\n\t}\n\t_updateSelectorAttr() {\n\t\tif (!this._selector) return;\n\t\tif (this._isSelected) this._selector.setAttribute(\"is-selecting\", \"\");\n\t\telse this._selector.removeAttribute(\"is-selecting\");\n\t}\n\t_subscribeToManager() {\n\t\tconst manager = getGlobalEditorManager();\n\t\tif (manager) this._setupManagerSubscriptions(manager);\n\t\tthis._unsubManager = onGlobalEditorManagerChange((m) => {\n\t\t\tthis._unsubEnabled?.();\n\t\t\tthis._unsubFocused?.();\n\t\t\tthis._unsubEditedContent?.();\n\t\t\tthis._unsubEnabled = null;\n\t\t\tthis._unsubFocused = null;\n\t\t\tthis._unsubEditedContent = null;\n\t\t\tif (m) this._setupManagerSubscriptions(m);\n\t\t\telse {\n\t\t\t\tthis._editorEnabled = false;\n\t\t\t\tthis._isSelected = false;\n\t\t\t\tthis._editedValue = void 0;\n\t\t\t\tthis._render();\n\t\t\t}\n\t\t});\n\t}\n\t_setupManagerSubscriptions(manager) {\n\t\tthis._editorEnabled = manager.editorEnabled.value ?? false;\n\t\tthis._updateIsSelected(manager.focusedContent.value);\n\t\tthis._updateEditedValue(manager);\n\t\tconst handleEnabledChange = (e) => {\n\t\t\tthis._editorEnabled = e.detail;\n\t\t\tthis._render();\n\t\t};\n\t\tconst handleFocusedChange = (e) => {\n\t\t\tthis._updateIsSelected(e.detail);\n\t\t};\n\t\tconst handleEditedContentChange = () => {\n\t\t\tthis._updateEditedValue(manager);\n\t\t};\n\t\tmanager.editorEnabled.addEventListener(\"change\", handleEnabledChange);\n\t\tmanager.focusedContent.addEventListener(\"change\", handleFocusedChange);\n\t\tmanager.editedContent.addEventListener(\"change\", handleEditedContentChange);\n\t\tthis._unsubEnabled = () => manager.editorEnabled.removeEventListener(\"change\", handleEnabledChange);\n\t\tthis._unsubFocused = () => manager.focusedContent.removeEventListener(\"change\", handleFocusedChange);\n\t\tthis._unsubEditedContent = () => manager.editedContent.removeEventListener(\"change\", handleEditedContentChange);\n\t}\n\t_handlePress(e) {\n\t\te.stopPropagation();\n\t\tconst manager = getGlobalEditorManager();\n\t\tif (!manager) return;\n\t\tmanager.focusedContent.set({\n\t\t\tdictionaryKey: this._dictionaryKey,\n\t\t\tkeyPath: this._getFilteredKeyPath()\n\t\t});\n\t}\n\t_handleHover(e) {\n\t\te.stopPropagation();\n\t\tgetGlobalEditorManager()?.messenger.send(`${\"INTLAYER_HOVERED_CONTENT_CHANGED\"}/post`, {\n\t\t\tdictionaryKey: this._dictionaryKey,\n\t\t\tkeyPath: this._getFilteredKeyPath()\n\t\t});\n\t}\n\t_handleUnhover(e) {\n\t\te.stopPropagation();\n\t\tgetGlobalEditorManager()?.messenger.send(`${\"INTLAYER_HOVERED_CONTENT_CHANGED\"}/post`, null);\n\t}\n\t_render() {\n\t\tconst useWrapper = this._isInIframe && this._editorEnabled;\n\t\tconst editedValue = this._editedValue;\n\t\tconst newState = !useWrapper ? \"simple\" : typeof editedValue === \"string\" || typeof editedValue === \"number\" || typeof editedValue === \"boolean\" ? \"wrapped-text\" : \"wrapped-slot\";\n\t\tif (this._renderState !== newState) {\n\t\t\tthis._rebuildContent(newState);\n\t\t\treturn;\n\t\t}\n\t\tif (newState !== \"simple\" && this._selector) {\n\t\t\tthis._updateSelectorAttr();\n\t\t\tif (newState === \"wrapped-text\" && this._selector.firstChild?.nodeType === Node.TEXT_NODE) this._selector.firstChild.data = String(editedValue);\n\t\t}\n\t}\n\t_rebuildContent(state) {\n\t\tconst shadow = this.shadowRoot;\n\t\twhile (shadow.childNodes.length > 1) shadow.removeChild(shadow.lastChild);\n\t\tthis._selector = null;\n\t\tif (state === \"simple\") shadow.appendChild(document.createElement(\"slot\"));\n\t\telse {\n\t\t\tconst selector = document.createElement(\"intlayer-content-selector\");\n\t\t\tthis._selector = selector;\n\t\t\tif (this._isSelected) selector.setAttribute(\"is-selecting\", \"\");\n\t\t\tselector.addEventListener(\"intlayer:press\", (e) => this._handlePress(e));\n\t\t\tselector.addEventListener(\"intlayer:hover\", (e) => this._handleHover(e));\n\t\t\tselector.addEventListener(\"intlayer:unhover\", (e) => this._handleUnhover(e));\n\t\t\tif (state === \"wrapped-text\") selector.appendChild(document.createTextNode(String(this._editedValue)));\n\t\t\telse selector.appendChild(document.createElement(\"slot\"));\n\t\t\tshadow.appendChild(selector);\n\t\t}\n\t\tthis._renderState = state;\n\t}\n};\nconst defineIntlayerContentSelectorWrapper = () => {\n\tif (typeof customElements === \"undefined\") return;\n\tif (!customElements.get(\"intlayer-content-selector-wrapper\")) customElements.define(\"intlayer-content-selector-wrapper\", IntlayerContentSelectorWrapperElement);\n};\n\n//#endregion\nexport { IntlayerContentSelectorWrapperElement, defineIntlayerContentSelectorWrapper };\n//# sourceMappingURL=ContentSelectorWrapper.mjs.map"],"mappings":";;;;;;;AAMA,MAAM,eAAe,OAAO,gBAAgB,cAAc,cAAc,MAAM;;;;;;;;;;;;;;;AAe9E,IAAI,wCAAwC,cAAc,aAAa;CACtE,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,cAAc;CACd,cAAc;CACd,eAAe,KAAK;CACpB,eAAe;CACf,YAAY;CACZ,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,sBAAsB;CACtB,WAAW,qBAAqB;AAC/B,SAAO,CAAC,YAAY,iBAAiB;;CAEtC,IAAI,cAAc;AACjB,SAAO,KAAK;;CAEb,IAAI,YAAY,GAAG;AAClB,OAAK,eAAe;EACpB,MAAM,UAAUA,8CAAwB;AACxC,MAAI,QAAS,MAAK,mBAAmB,QAAQ;;CAE9C,IAAI,gBAAgB;AACnB,SAAO,KAAK;;CAEb,IAAI,cAAc,GAAG;AACpB,OAAK,iBAAiB;EACtB,MAAM,UAAUA,8CAAwB;AACxC,MAAI,QAAS,MAAK,mBAAmB,QAAQ;;CAE9C,cAAc;AACb,SAAO;EACP,MAAM,SAAS,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;EAClD,MAAM,QAAQ,SAAS,cAAc,QAAQ;AAC7C,QAAM,cAAc;AACpB,SAAO,YA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C;AACxE,YAAS,iBAAiB,mBAAmB,MAAM,KAAK,aAAa,EAAE,CAAC;AACxE,YAAS,iBAAiB,qBAAqB,MAAM,KAAK,eAAe,EAAE,CAAC;AAC5E,OAAI,UAAU,eAAgB,UAAS,YAAY,SAAS,eAAe,OAAO,KAAK,aAAa,CAAC,CAAC;OACjG,UAAS,YAAY,SAAS,cAAc,OAAO,CAAC;AACzD,UAAO,YAAY,SAAS;;AAE7B,OAAK,eAAe;;;AAGtB,MAAM,6CAA6C;AAClD,KAAI,OAAO,mBAAmB,YAAa;AAC3C,KAAI,CAAC,eAAe,IAAI,oCAAoC,CAAE,gBAAe,OAAO,qCAAqC,sCAAsC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const require_runtime = require('../../../../../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_globalManager = require('../core/globalManager.cjs');
|
|
3
|
+
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
4
|
+
|
|
5
|
+
//#region ../../packages/@intlayer/editor/dist/esm/components/EditedContent.mjs
|
|
6
|
+
const _HTMLElement = typeof HTMLElement !== "undefined" ? HTMLElement : class {};
|
|
7
|
+
/**
|
|
8
|
+
* <intlayer-edited-content>
|
|
9
|
+
*
|
|
10
|
+
* Framework-agnostic web component that displays edited content from the Intlayer
|
|
11
|
+
* editor. When the editor has an edited value for the given dictionary key and
|
|
12
|
+
* key path, it renders the edited value; otherwise it renders the original
|
|
13
|
+
* content via a slot.
|
|
14
|
+
*
|
|
15
|
+
* Always wraps content in <intlayer-content-selector-wrapper> for selection UI.
|
|
16
|
+
*
|
|
17
|
+
* @attr {string} dictionary-key - The dictionary key owning this content node
|
|
18
|
+
* @attr {string} key-path - JSON-serialized KeyPath[] for this content node
|
|
19
|
+
* @attr {string} locale - The current locale string
|
|
20
|
+
*/
|
|
21
|
+
var IntlayerEditedContentElement = class extends _HTMLElement {
|
|
22
|
+
_dictionaryKey = "";
|
|
23
|
+
_keyPathJson = "[]";
|
|
24
|
+
_locale = "";
|
|
25
|
+
_editedText = null;
|
|
26
|
+
_unsubManager = null;
|
|
27
|
+
_unsubEditedContent = null;
|
|
28
|
+
_selectorWrapper;
|
|
29
|
+
_slot;
|
|
30
|
+
static get observedAttributes() {
|
|
31
|
+
return [
|
|
32
|
+
"dictionary-key",
|
|
33
|
+
"key-path",
|
|
34
|
+
"locale"
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
get dictionaryKey() {
|
|
38
|
+
return this._dictionaryKey;
|
|
39
|
+
}
|
|
40
|
+
set dictionaryKey(v) {
|
|
41
|
+
this._dictionaryKey = v;
|
|
42
|
+
this._selectorWrapper.setAttribute("dictionary-key", v);
|
|
43
|
+
}
|
|
44
|
+
get keyPathJson() {
|
|
45
|
+
return this._keyPathJson;
|
|
46
|
+
}
|
|
47
|
+
set keyPathJson(v) {
|
|
48
|
+
this._keyPathJson = v;
|
|
49
|
+
this._selectorWrapper.setAttribute("key-path", v);
|
|
50
|
+
}
|
|
51
|
+
get locale() {
|
|
52
|
+
return this._locale;
|
|
53
|
+
}
|
|
54
|
+
set locale(v) {
|
|
55
|
+
this._locale = v;
|
|
56
|
+
}
|
|
57
|
+
constructor() {
|
|
58
|
+
super();
|
|
59
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
60
|
+
const style = document.createElement("style");
|
|
61
|
+
style.textContent = ":host { display: contents; }";
|
|
62
|
+
shadow.appendChild(style);
|
|
63
|
+
this._selectorWrapper = document.createElement("intlayer-content-selector-wrapper");
|
|
64
|
+
this._slot = document.createElement("slot");
|
|
65
|
+
this._selectorWrapper.appendChild(this._slot);
|
|
66
|
+
shadow.appendChild(this._selectorWrapper);
|
|
67
|
+
}
|
|
68
|
+
attributeChangedCallback(name, _oldVal, newVal) {
|
|
69
|
+
const val = newVal ?? "";
|
|
70
|
+
if (name === "dictionary-key") {
|
|
71
|
+
this._dictionaryKey = val;
|
|
72
|
+
this._selectorWrapper.setAttribute("dictionary-key", val);
|
|
73
|
+
} else if (name === "key-path") {
|
|
74
|
+
this._keyPathJson = val || "[]";
|
|
75
|
+
this._selectorWrapper.setAttribute("key-path", this._keyPathJson);
|
|
76
|
+
} else if (name === "locale") this._locale = val;
|
|
77
|
+
}
|
|
78
|
+
connectedCallback() {
|
|
79
|
+
this._subscribeToManager();
|
|
80
|
+
}
|
|
81
|
+
disconnectedCallback() {
|
|
82
|
+
this._teardown();
|
|
83
|
+
}
|
|
84
|
+
_teardown() {
|
|
85
|
+
this._unsubManager?.();
|
|
86
|
+
this._unsubEditedContent?.();
|
|
87
|
+
this._unsubManager = null;
|
|
88
|
+
this._unsubEditedContent = null;
|
|
89
|
+
}
|
|
90
|
+
_getKeyPath() {
|
|
91
|
+
try {
|
|
92
|
+
return JSON.parse(this._keyPathJson);
|
|
93
|
+
} catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_render() {
|
|
98
|
+
while (this._selectorWrapper.firstChild) this._selectorWrapper.removeChild(this._selectorWrapper.firstChild);
|
|
99
|
+
if (this._editedText !== null) this._selectorWrapper.appendChild(document.createTextNode(this._editedText));
|
|
100
|
+
else this._selectorWrapper.appendChild(this._slot);
|
|
101
|
+
}
|
|
102
|
+
_resolveEditedText(manager) {
|
|
103
|
+
const keyPath = this._getKeyPath();
|
|
104
|
+
const editedValue = manager.getContentValue(this._dictionaryKey, keyPath);
|
|
105
|
+
if (editedValue === void 0 || editedValue === null) {
|
|
106
|
+
this._editedText = null;
|
|
107
|
+
this._render();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (typeof editedValue === "string" || typeof editedValue === "number") {
|
|
111
|
+
this._editedText = String(editedValue);
|
|
112
|
+
this._render();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (typeof editedValue === "object") {
|
|
116
|
+
const locale = this._locale || void 0;
|
|
117
|
+
const transformed = (0, _intlayer_core_interpreter.getContent)(editedValue, {
|
|
118
|
+
locale,
|
|
119
|
+
dictionaryKey: this._dictionaryKey,
|
|
120
|
+
keyPath
|
|
121
|
+
}, (0, _intlayer_core_interpreter.getBasePlugins)(locale));
|
|
122
|
+
if (typeof transformed === "string" || typeof transformed === "number") this._editedText = String(transformed);
|
|
123
|
+
else {
|
|
124
|
+
console.error(`[intlayer-edited-content] Incorrect edited content format. Expected string. Value: ${JSON.stringify(transformed)}`);
|
|
125
|
+
this._editedText = null;
|
|
126
|
+
}
|
|
127
|
+
this._render();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this._editedText = null;
|
|
131
|
+
this._render();
|
|
132
|
+
}
|
|
133
|
+
_setupManagerSubscriptions(manager) {
|
|
134
|
+
this._resolveEditedText(manager);
|
|
135
|
+
const handleChange = () => this._resolveEditedText(manager);
|
|
136
|
+
manager.editedContent.addEventListener("change", handleChange);
|
|
137
|
+
this._unsubEditedContent = () => manager.editedContent.removeEventListener("change", handleChange);
|
|
138
|
+
}
|
|
139
|
+
_subscribeToManager() {
|
|
140
|
+
const manager = require_globalManager.getGlobalEditorManager();
|
|
141
|
+
if (manager) this._setupManagerSubscriptions(manager);
|
|
142
|
+
this._unsubManager = require_globalManager.onGlobalEditorManagerChange((m) => {
|
|
143
|
+
this._unsubEditedContent?.();
|
|
144
|
+
this._unsubEditedContent = null;
|
|
145
|
+
if (m) this._setupManagerSubscriptions(m);
|
|
146
|
+
else {
|
|
147
|
+
this._editedText = null;
|
|
148
|
+
this._render();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const defineIntlayerEditedContent = () => {
|
|
154
|
+
if (typeof customElements === "undefined") return;
|
|
155
|
+
if (!customElements.get("intlayer-edited-content")) customElements.define("intlayer-edited-content", IntlayerEditedContentElement);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
exports.IntlayerEditedContentElement = IntlayerEditedContentElement;
|
|
160
|
+
exports.defineIntlayerEditedContent = defineIntlayerEditedContent;
|
|
161
|
+
//# sourceMappingURL=EditedContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditedContent.cjs","names":["getGlobalEditorManager","onGlobalEditorManagerChange"],"sources":["../../../../../../../../../../packages/@intlayer/editor/dist/esm/components/EditedContent.mjs"],"sourcesContent":["import { getGlobalEditorManager, onGlobalEditorManagerChange } from \"../core/globalManager.mjs\";\nimport { getBasePlugins, getContent } from \"@intlayer/core/interpreter\";\n\n//#region src/components/EditedContent.ts\nconst _HTMLElement = typeof HTMLElement !== \"undefined\" ? HTMLElement : class {};\n/**\n* <intlayer-edited-content>\n*\n* Framework-agnostic web component that displays edited content from the Intlayer\n* editor. When the editor has an edited value for the given dictionary key and\n* key path, it renders the edited value; otherwise it renders the original\n* content via a slot.\n*\n* Always wraps content in <intlayer-content-selector-wrapper> for selection UI.\n*\n* @attr {string} dictionary-key - The dictionary key owning this content node\n* @attr {string} key-path - JSON-serialized KeyPath[] for this content node\n* @attr {string} locale - The current locale string\n*/\nvar IntlayerEditedContentElement = class extends _HTMLElement {\n\t_dictionaryKey = \"\";\n\t_keyPathJson = \"[]\";\n\t_locale = \"\";\n\t_editedText = null;\n\t_unsubManager = null;\n\t_unsubEditedContent = null;\n\t_selectorWrapper;\n\t_slot;\n\tstatic get observedAttributes() {\n\t\treturn [\n\t\t\t\"dictionary-key\",\n\t\t\t\"key-path\",\n\t\t\t\"locale\"\n\t\t];\n\t}\n\tget dictionaryKey() {\n\t\treturn this._dictionaryKey;\n\t}\n\tset dictionaryKey(v) {\n\t\tthis._dictionaryKey = v;\n\t\tthis._selectorWrapper.setAttribute(\"dictionary-key\", v);\n\t}\n\tget keyPathJson() {\n\t\treturn this._keyPathJson;\n\t}\n\tset keyPathJson(v) {\n\t\tthis._keyPathJson = v;\n\t\tthis._selectorWrapper.setAttribute(\"key-path\", v);\n\t}\n\tget locale() {\n\t\treturn this._locale;\n\t}\n\tset locale(v) {\n\t\tthis._locale = v;\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tconst shadow = this.attachShadow({ mode: \"open\" });\n\t\tconst style = document.createElement(\"style\");\n\t\tstyle.textContent = \":host { display: contents; }\";\n\t\tshadow.appendChild(style);\n\t\tthis._selectorWrapper = document.createElement(\"intlayer-content-selector-wrapper\");\n\t\tthis._slot = document.createElement(\"slot\");\n\t\tthis._selectorWrapper.appendChild(this._slot);\n\t\tshadow.appendChild(this._selectorWrapper);\n\t}\n\tattributeChangedCallback(name, _oldVal, newVal) {\n\t\tconst val = newVal ?? \"\";\n\t\tif (name === \"dictionary-key\") {\n\t\t\tthis._dictionaryKey = val;\n\t\t\tthis._selectorWrapper.setAttribute(\"dictionary-key\", val);\n\t\t} else if (name === \"key-path\") {\n\t\t\tthis._keyPathJson = val || \"[]\";\n\t\t\tthis._selectorWrapper.setAttribute(\"key-path\", this._keyPathJson);\n\t\t} else if (name === \"locale\") this._locale = val;\n\t}\n\tconnectedCallback() {\n\t\tthis._subscribeToManager();\n\t}\n\tdisconnectedCallback() {\n\t\tthis._teardown();\n\t}\n\t_teardown() {\n\t\tthis._unsubManager?.();\n\t\tthis._unsubEditedContent?.();\n\t\tthis._unsubManager = null;\n\t\tthis._unsubEditedContent = null;\n\t}\n\t_getKeyPath() {\n\t\ttry {\n\t\t\treturn JSON.parse(this._keyPathJson);\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t}\n\t_render() {\n\t\twhile (this._selectorWrapper.firstChild) this._selectorWrapper.removeChild(this._selectorWrapper.firstChild);\n\t\tif (this._editedText !== null) this._selectorWrapper.appendChild(document.createTextNode(this._editedText));\n\t\telse this._selectorWrapper.appendChild(this._slot);\n\t}\n\t_resolveEditedText(manager) {\n\t\tconst keyPath = this._getKeyPath();\n\t\tconst editedValue = manager.getContentValue(this._dictionaryKey, keyPath);\n\t\tif (editedValue === void 0 || editedValue === null) {\n\t\t\tthis._editedText = null;\n\t\t\tthis._render();\n\t\t\treturn;\n\t\t}\n\t\tif (typeof editedValue === \"string\" || typeof editedValue === \"number\") {\n\t\t\tthis._editedText = String(editedValue);\n\t\t\tthis._render();\n\t\t\treturn;\n\t\t}\n\t\tif (typeof editedValue === \"object\") {\n\t\t\tconst locale = this._locale || void 0;\n\t\t\tconst transformed = getContent(editedValue, {\n\t\t\t\tlocale,\n\t\t\t\tdictionaryKey: this._dictionaryKey,\n\t\t\t\tkeyPath\n\t\t\t}, getBasePlugins(locale));\n\t\t\tif (typeof transformed === \"string\" || typeof transformed === \"number\") this._editedText = String(transformed);\n\t\t\telse {\n\t\t\t\tconsole.error(`[intlayer-edited-content] Incorrect edited content format. Expected string. Value: ${JSON.stringify(transformed)}`);\n\t\t\t\tthis._editedText = null;\n\t\t\t}\n\t\t\tthis._render();\n\t\t\treturn;\n\t\t}\n\t\tthis._editedText = null;\n\t\tthis._render();\n\t}\n\t_setupManagerSubscriptions(manager) {\n\t\tthis._resolveEditedText(manager);\n\t\tconst handleChange = () => this._resolveEditedText(manager);\n\t\tmanager.editedContent.addEventListener(\"change\", handleChange);\n\t\tthis._unsubEditedContent = () => manager.editedContent.removeEventListener(\"change\", handleChange);\n\t}\n\t_subscribeToManager() {\n\t\tconst manager = getGlobalEditorManager();\n\t\tif (manager) this._setupManagerSubscriptions(manager);\n\t\tthis._unsubManager = onGlobalEditorManagerChange((m) => {\n\t\t\tthis._unsubEditedContent?.();\n\t\t\tthis._unsubEditedContent = null;\n\t\t\tif (m) this._setupManagerSubscriptions(m);\n\t\t\telse {\n\t\t\t\tthis._editedText = null;\n\t\t\t\tthis._render();\n\t\t\t}\n\t\t});\n\t}\n};\nconst defineIntlayerEditedContent = () => {\n\tif (typeof customElements === \"undefined\") return;\n\tif (!customElements.get(\"intlayer-edited-content\")) customElements.define(\"intlayer-edited-content\", IntlayerEditedContentElement);\n};\n\n//#endregion\nexport { IntlayerEditedContentElement, defineIntlayerEditedContent };\n//# sourceMappingURL=EditedContent.mjs.map"],"mappings":";;;;;AAIA,MAAM,eAAe,OAAO,gBAAgB,cAAc,cAA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