@juo/orion-core 0.11.0 → 0.12.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/{web-components.js → ExtensionRoot-BuoY5H2A.js} +10 -10
- package/dist/{bridge-eS7Tvd4V.js → bridge-BPfBHSPI.js} +7 -7
- package/dist/editor.js +24 -27
- package/dist/preact.js +1 -1
- package/dist/react.js +1 -1
- package/dist/vue.js +1 -1
- package/dist/web-components/editor/InlineText.d.ts +24 -0
- package/dist/web-components/runtime/InlineText.d.ts +4 -0
- package/dist/web-components/runtime/main.d.ts +1 -0
- package/dist/web-components-editor.js +140 -0
- package/dist/web-components-runtime.js +23 -0
- package/package.json +8 -4
- /package/dist/web-components/{main.d.ts → editor/main.d.ts} +0 -0
|
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { j as withWrapper, o as ContextRoot } from "./block-CFJIpH_9.js";
|
|
8
7
|
import { signal, effect, createBlockInstance, subscribeContext, untracked } from "@juo/orion-core";
|
|
9
8
|
import { P as PageContext } from "./page-DFFhF7j8.js";
|
|
9
|
+
import { j as withWrapper } from "./block-CFJIpH_9.js";
|
|
10
10
|
class Block extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
@@ -72,6 +72,11 @@ class ExtensionRoot extends HTMLElement {
|
|
|
72
72
|
}
|
|
73
73
|
connectedCallback() {
|
|
74
74
|
this.state.value = null;
|
|
75
|
+
this.style.display = "flex";
|
|
76
|
+
this.style.flexDirection = "column";
|
|
77
|
+
this.style.gap = "16px";
|
|
78
|
+
this.style.width = "fit-content";
|
|
79
|
+
this.style.justifySelf = "center";
|
|
75
80
|
this.unsubscribeContext = subscribeContext(
|
|
76
81
|
this,
|
|
77
82
|
PageContext,
|
|
@@ -123,12 +128,7 @@ class ExtensionRoot extends HTMLElement {
|
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
customElements.define("juo-extension-root", ExtensionRoot);
|
|
131
|
-
}
|
|
132
|
-
if (customElements.get("juo-block") == null) {
|
|
133
|
-
customElements.define("juo-block", Block);
|
|
134
|
-
}
|
|
131
|
+
export {
|
|
132
|
+
Block as B,
|
|
133
|
+
ExtensionRoot as E
|
|
134
|
+
};
|
|
@@ -230,14 +230,14 @@ function createEditorBridge() {
|
|
|
230
230
|
return bridgeInstance;
|
|
231
231
|
}
|
|
232
232
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
createUpdateBlockPropsMessage as a,
|
|
234
|
+
createRemoveBlockMessage as b,
|
|
235
235
|
createEditorBridge as c,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
createRegisterBlocksMessage as d,
|
|
237
|
+
createRegisterRoutesMessage as e,
|
|
238
|
+
isIframeMessage as f,
|
|
239
|
+
createSyncPageStateMessage as g,
|
|
240
|
+
createSelectBlockMessage as h,
|
|
241
241
|
isEditorMessage as i,
|
|
242
242
|
createAddBlockMessage as j,
|
|
243
243
|
createMoveBlockMessage as k,
|
package/dist/editor.js
CHANGED
|
@@ -4,8 +4,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { c as createEditorBridge,
|
|
8
|
-
import { j, k,
|
|
7
|
+
import { c as createEditorBridge, b as createRemoveBlockMessage, d as createRegisterBlocksMessage, e as createRegisterRoutesMessage } from "./bridge-BPfBHSPI.js";
|
|
8
|
+
import { j, k, h, l, g, a, i, f } from "./bridge-BPfBHSPI.js";
|
|
9
9
|
import { e as createBlockInstanceFromObject } from "./block-CFJIpH_9.js";
|
|
10
10
|
function createEditorHandler(options) {
|
|
11
11
|
const { page, onBlockSelection } = options;
|
|
@@ -211,17 +211,17 @@ function createEditorHandler(options) {
|
|
|
211
211
|
const styles = `
|
|
212
212
|
<style>
|
|
213
213
|
.block-wrapper {
|
|
214
|
-
margin: 1rem 0;
|
|
215
|
-
position: relative;
|
|
216
214
|
padding: 12px;
|
|
217
215
|
background-color: white;
|
|
218
216
|
border: 1px solid #B5B5B5;
|
|
219
217
|
border-radius: 8px;
|
|
218
|
+
width: fit-content;
|
|
219
|
+
justify-self: center;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.block-wrapper:hover,
|
|
223
223
|
.block-wrapper.active {
|
|
224
|
-
border-color: #
|
|
224
|
+
border-color: #000000;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
.block-wrapper__name {
|
|
@@ -230,21 +230,26 @@ const styles = `
|
|
|
230
230
|
align-items: center;
|
|
231
231
|
gap: 6.82px;
|
|
232
232
|
margin-bottom: 12px;
|
|
233
|
-
font-size:
|
|
233
|
+
font-size: 12px;
|
|
234
234
|
font-weight: 500;
|
|
235
235
|
color: #8A8A8A;
|
|
236
|
+
line-height: 100%;
|
|
237
|
+
height: 15px
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
.block-wrapper__actions {
|
|
239
241
|
display: flex;
|
|
240
242
|
align-items: center;
|
|
241
243
|
justify-content: flex-end;
|
|
244
|
+
height: 100%;
|
|
242
245
|
flex-grow: 1;
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
.block-wrapper__actions button {
|
|
249
|
+
height: 100%;
|
|
246
250
|
display: flex;
|
|
247
251
|
align-items: center;
|
|
252
|
+
color: #C4C4C4;
|
|
248
253
|
justify-content: center;
|
|
249
254
|
appearance: none;
|
|
250
255
|
border: none;
|
|
@@ -254,10 +259,6 @@ const styles = `
|
|
|
254
259
|
cursor: pointer;
|
|
255
260
|
}
|
|
256
261
|
|
|
257
|
-
.block-wrapper__icon {
|
|
258
|
-
width: 17px;
|
|
259
|
-
height: 15px;
|
|
260
|
-
}
|
|
261
262
|
|
|
262
263
|
.block-wrapper__remove-icon {
|
|
263
264
|
width: 10px;
|
|
@@ -266,19 +267,16 @@ const styles = `
|
|
|
266
267
|
</style>
|
|
267
268
|
`;
|
|
268
269
|
const blockIconSvg = `
|
|
269
|
-
<svg width="
|
|
270
|
-
|
|
271
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0554 6.17734H1.41074V8.45145H15.0554V6.17734ZM1.41074 5.04028C0.782759 5.04028 0.273682 5.54936 0.273682 6.17734V8.45145C0.273682 9.07943 0.782759 9.58851 1.41074 9.58851H15.0554C15.6834 9.58851 16.1925 9.07943 16.1925 8.45145V6.17734C16.1925 5.54936 15.6834 5.04028 15.0554 5.04028H1.41074Z" fill="#8A8A8A"/>
|
|
272
|
-
<rect x="6.52747" y="0.491943" width="3.41117" height="1.13706" fill="#8A8A8A"/>
|
|
273
|
-
<rect x="6.52747" y="12.9998" width="3.41117" height="1.13706" fill="#8A8A8A"/>
|
|
270
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
271
|
+
<path d="M4.36328 6.5459C4.96626 6.5459 5.4541 7.03374 5.4541 7.63672V10.9092C5.45405 11.5121 4.96623 12 4.36328 12H1.09082C0.96088 12 0.834934 11.9772 0.717773 11.9346C0.626296 11.9016 0.540642 11.8561 0.461914 11.8008C0.182984 11.6037 3.23667e-05 11.2776 0 10.9092V7.63672C0 7.03377 0.487878 6.54595 1.09082 6.5459H4.36328ZM10.9092 6.5459C11.5122 6.5459 12 7.03374 12 7.63672V10.9092C11.9999 11.5121 11.5121 12 10.9092 12H7.63672C7.50675 12 7.38086 11.9772 7.26367 11.9346C7.17215 11.9016 7.08658 11.8561 7.00781 11.8008C6.72883 11.6037 6.54593 11.2777 6.5459 10.9092V7.63672C6.5459 7.03374 7.03374 6.5459 7.63672 6.5459H10.9092ZM1.09082 7.63672V10.9092H4.36328V7.63672H1.09082ZM7.63672 10.9092H10.9092V7.63672H7.63672V10.9092ZM4.36328 0C4.96623 0 5.45405 0.487878 5.4541 1.09082V4.36328C5.4541 4.96626 4.96626 5.4541 4.36328 5.4541H1.09082C0.96088 5.45409 0.834934 5.43225 0.717773 5.38965C0.626233 5.35663 0.54069 5.31024 0.461914 5.25488C0.183079 5.05776 0 4.73167 0 4.36328V1.09082C4.77994e-05 0.487908 0.487908 4.79046e-05 1.09082 0H4.36328ZM10.9092 0C11.5121 0 12 0.487878 12 1.09082V4.36328C12 4.96626 11.5122 5.4541 10.9092 5.4541H7.63672C7.50675 5.4541 7.38086 5.43226 7.26367 5.38965C7.17208 5.35663 7.08662 5.31026 7.00781 5.25488C6.72893 5.05777 6.5459 4.73171 6.5459 4.36328V1.09082C6.54595 0.487878 7.03377 0 7.63672 0H10.9092ZM1.09082 4.36328H4.36328V1.09082H1.09082V4.36328ZM7.63672 4.36328H10.9092V1.09082H7.63672V4.36328Z" fill="currentColor"/>
|
|
274
272
|
</svg>
|
|
273
|
+
|
|
275
274
|
`;
|
|
276
275
|
const removeIconSvg = `
|
|
277
|
-
<svg width="
|
|
278
|
-
|
|
279
|
-
<path d="M4.8345 2.11865C4.36031 2.11865 3.9759 1.74162 3.9759 1.27652C3.9759 0.811427 4.36031 0.434393 4.8345 0.434393C5.30869 0.434393 5.69309 0.811427 5.69309 1.27652C5.69309 1.74162 5.30869 2.11865 4.8345 2.11865Z" fill="black"/>
|
|
280
|
-
<path d="M8.26915 2.11865C7.79496 2.11865 7.41055 1.74162 7.41055 1.27652C7.41055 0.811427 7.79496 0.434393 8.26915 0.434393C8.74334 0.434393 9.12774 0.811427 9.12774 1.27652C9.12774 1.74162 8.74334 2.11865 8.26915 2.11865Z" fill="black"/>
|
|
276
|
+
<svg width="13" height="3" viewBox="0 0 13 3" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
277
|
+
<path d="M1.5 0C2.32843 2.0934e-07 3 0.671573 3 1.5C3 2.32843 2.32843 3 1.5 3C0.671573 3 3.62117e-08 2.32843 0 1.5C6.04266e-08 0.671573 0.671573 3.62117e-08 1.5 0ZM6.5 0C7.32843 2.0934e-07 8 0.671573 8 1.5C8 2.32843 7.32843 3 6.5 3C5.67157 3 5 2.32843 5 1.5C5 0.671573 5.67157 3.62117e-08 6.5 0ZM11.5 0C12.3284 2.0934e-07 13 0.671573 13 1.5C13 2.32843 12.3284 3 11.5 3C10.6716 3 10 2.32843 10 1.5C10 0.671573 10.6716 3.62117e-08 11.5 0Z" fill="currentColor"/>
|
|
281
278
|
</svg>
|
|
279
|
+
|
|
282
280
|
`;
|
|
283
281
|
class BlockWrapper extends HTMLElement {
|
|
284
282
|
constructor() {
|
|
@@ -304,6 +302,7 @@ class BlockWrapper extends HTMLElement {
|
|
|
304
302
|
const nameDiv = document.createElement("div");
|
|
305
303
|
nameDiv.className = "block-wrapper__name";
|
|
306
304
|
const iconContainer = document.createElement("div");
|
|
305
|
+
iconContainer.style.display = "flex";
|
|
307
306
|
iconContainer.className = "block-wrapper__icon";
|
|
308
307
|
iconContainer.innerHTML = blockIconSvg;
|
|
309
308
|
const nameSpan = document.createElement("span");
|
|
@@ -313,8 +312,8 @@ class BlockWrapper extends HTMLElement {
|
|
|
313
312
|
const removeBtn = document.createElement("button");
|
|
314
313
|
removeBtn.type = "button";
|
|
315
314
|
removeBtn.innerHTML = removeIconSvg;
|
|
316
|
-
removeBtn.addEventListener("click", (
|
|
317
|
-
|
|
315
|
+
removeBtn.addEventListener("click", (e) => {
|
|
316
|
+
e.stopPropagation();
|
|
318
317
|
this.handleRemoveBlock();
|
|
319
318
|
});
|
|
320
319
|
actionsDiv.appendChild(removeBtn);
|
|
@@ -334,8 +333,6 @@ class BlockWrapper extends HTMLElement {
|
|
|
334
333
|
});
|
|
335
334
|
}
|
|
336
335
|
connectedCallback() {
|
|
337
|
-
this.getAttribute("data-block-id");
|
|
338
|
-
this.setAttribute("draggable", "true");
|
|
339
336
|
}
|
|
340
337
|
disconnectedCallback() {
|
|
341
338
|
}
|
|
@@ -443,11 +440,11 @@ export {
|
|
|
443
440
|
createRegisterBlocksMessage,
|
|
444
441
|
createRegisterRoutesMessage,
|
|
445
442
|
createRemoveBlockMessage,
|
|
446
|
-
|
|
443
|
+
h as createSelectBlockMessage,
|
|
447
444
|
l as createSetBlockPresetMessage,
|
|
448
|
-
|
|
449
|
-
|
|
445
|
+
g as createSyncPageStateMessage,
|
|
446
|
+
a as createUpdateBlockPropsMessage,
|
|
450
447
|
i as isEditorMessage,
|
|
451
|
-
|
|
448
|
+
f as isIframeMessage,
|
|
452
449
|
setupEditorMode
|
|
453
450
|
};
|
package/dist/preact.js
CHANGED
|
@@ -9,7 +9,7 @@ import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from
|
|
|
9
9
|
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DPjf_G7G.js";
|
|
10
10
|
import { t } from "./block-DPjf_G7G.js";
|
|
11
11
|
import { createContext, h, render } from "preact";
|
|
12
|
-
import { c as createEditorBridge } from "./bridge-
|
|
12
|
+
import { c as createEditorBridge } from "./bridge-BPfBHSPI.js";
|
|
13
13
|
function toState(signal) {
|
|
14
14
|
const [value, setValue] = useState(() => getSignalValue(signal));
|
|
15
15
|
const disposeRef = useRef(null);
|
package/dist/react.js
CHANGED
|
@@ -9,7 +9,7 @@ import React, { useSyncExternalStore, createContext, useState, useContext as use
|
|
|
9
9
|
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DPjf_G7G.js";
|
|
10
10
|
import { t } from "./block-DPjf_G7G.js";
|
|
11
11
|
import { createRoot } from "react-dom/client";
|
|
12
|
-
import { c as createEditorBridge } from "./bridge-
|
|
12
|
+
import { c as createEditorBridge } from "./bridge-BPfBHSPI.js";
|
|
13
13
|
function toState(signal) {
|
|
14
14
|
const subscribe = (callback) => {
|
|
15
15
|
const dispose = effect(() => {
|
package/dist/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toValue, watchEffect, customRef, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, createApp, useHost, defineCustomElement } from "vue";
|
|
2
2
|
import { signal, effect, injectContext, provideContext, createCeRenderer } from "@juo/orion-core";
|
|
3
|
-
import { c as createEditorBridge } from "./bridge-
|
|
3
|
+
import { c as createEditorBridge } from "./bridge-BPfBHSPI.js";
|
|
4
4
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function toSignal(ref2) {
|
|
6
6
|
if (!signalsMap.has(ref2)) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default class InlineText extends HTMLElement {
|
|
2
|
+
private editorBridge;
|
|
3
|
+
private propName;
|
|
4
|
+
private blockId;
|
|
5
|
+
private boundHandleBlur;
|
|
6
|
+
private boundHandlePointerDown;
|
|
7
|
+
private lastValue;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
private initializeEditorMode;
|
|
12
|
+
private handlePointerDown;
|
|
13
|
+
private handleBlur;
|
|
14
|
+
private static injectedRoots;
|
|
15
|
+
private injectStyles;
|
|
16
|
+
private sendUpdate;
|
|
17
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
"juo-text": InlineText;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { o as ContextRoot } from "./block-CFJIpH_9.js";
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BuoY5H2A.js";
|
|
9
|
+
import { c as createEditorBridge, a as createUpdateBlockPropsMessage } from "./bridge-BPfBHSPI.js";
|
|
10
|
+
const _InlineText = class _InlineText extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
__publicField(this, "editorBridge", null);
|
|
14
|
+
__publicField(this, "propName", null);
|
|
15
|
+
__publicField(this, "blockId", null);
|
|
16
|
+
__publicField(this, "boundHandleBlur", this.handleBlur.bind(this));
|
|
17
|
+
__publicField(this, "boundHandlePointerDown", this.handlePointerDown.bind(this));
|
|
18
|
+
__publicField(this, "lastValue", null);
|
|
19
|
+
}
|
|
20
|
+
static get observedAttributes() {
|
|
21
|
+
return ["prop"];
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this.style.display = "inline-block";
|
|
25
|
+
this.propName = this.getAttribute("prop");
|
|
26
|
+
if (!this.propName) {
|
|
27
|
+
console.warn("juo-text: 'prop' attribute is required");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let blockWrapper = this.closest("[data-block-id]");
|
|
31
|
+
if (!blockWrapper) {
|
|
32
|
+
const rootNode = this.getRootNode();
|
|
33
|
+
if (rootNode instanceof ShadowRoot && rootNode.host) {
|
|
34
|
+
blockWrapper = rootNode.host.closest("[data-block-id]");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!blockWrapper) {
|
|
38
|
+
console.warn("juo-text: Could not find parent block with data-block-id");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.blockId = blockWrapper.getAttribute("data-block-id");
|
|
42
|
+
if (!this.blockId) {
|
|
43
|
+
console.warn("juo-text: Parent block has no data-block-id attribute");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.initializeEditorMode();
|
|
47
|
+
}
|
|
48
|
+
initializeEditorMode() {
|
|
49
|
+
this.editorBridge = createEditorBridge();
|
|
50
|
+
this.contentEditable = "false";
|
|
51
|
+
this.style.cursor = "text";
|
|
52
|
+
this.style.width = "100%";
|
|
53
|
+
this.style.borderRadius = "2px";
|
|
54
|
+
this.style.outline = "0.5px solid transparent";
|
|
55
|
+
this.style.outlineOffset = "2px";
|
|
56
|
+
this.style.overflowWrap = "anywhere";
|
|
57
|
+
this.style.whiteSpace = "pre-wrap";
|
|
58
|
+
this.injectStyles();
|
|
59
|
+
this.addEventListener("blur", this.boundHandleBlur);
|
|
60
|
+
this.addEventListener("pointerdown", this.boundHandlePointerDown);
|
|
61
|
+
this.lastValue = this.textContent || "";
|
|
62
|
+
}
|
|
63
|
+
handlePointerDown() {
|
|
64
|
+
this.contentEditable = "plaintext-only";
|
|
65
|
+
}
|
|
66
|
+
handleBlur() {
|
|
67
|
+
this.contentEditable = "false";
|
|
68
|
+
this.sendUpdate();
|
|
69
|
+
}
|
|
70
|
+
injectStyles() {
|
|
71
|
+
const rootNode = this.getRootNode();
|
|
72
|
+
const root = rootNode instanceof ShadowRoot ? rootNode : document;
|
|
73
|
+
if (_InlineText.injectedRoots.has(root)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const style = document.createElement("style");
|
|
77
|
+
style.textContent = `
|
|
78
|
+
juo-text:hover {
|
|
79
|
+
outline-color: #CACACA !important;
|
|
80
|
+
}
|
|
81
|
+
juo-text:focus {
|
|
82
|
+
outline-color: #717171 !important;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
if (root instanceof ShadowRoot) {
|
|
86
|
+
root.appendChild(style);
|
|
87
|
+
} else {
|
|
88
|
+
document.head.appendChild(style);
|
|
89
|
+
}
|
|
90
|
+
_InlineText.injectedRoots.add(root);
|
|
91
|
+
}
|
|
92
|
+
sendUpdate() {
|
|
93
|
+
if (!this.editorBridge || !this.blockId || !this.propName) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const newValue = this.textContent ?? "";
|
|
97
|
+
if (newValue.trim() === "" && this.lastValue !== null && this.lastValue !== "") {
|
|
98
|
+
this.textContent = this.lastValue;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (this.lastValue === newValue) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const message = createUpdateBlockPropsMessage(
|
|
105
|
+
{
|
|
106
|
+
blockId: this.blockId,
|
|
107
|
+
props: {
|
|
108
|
+
[this.propName]: newValue
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
this.blockId
|
|
112
|
+
);
|
|
113
|
+
this.editorBridge.sendMessage(message);
|
|
114
|
+
this.lastValue = newValue;
|
|
115
|
+
}
|
|
116
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
117
|
+
if (name === "prop" && oldValue !== newValue) {
|
|
118
|
+
this.propName = newValue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
disconnectedCallback() {
|
|
122
|
+
this.removeEventListener("blur", this.boundHandleBlur);
|
|
123
|
+
this.removeEventListener("pointerdown", this.boundHandlePointerDown);
|
|
124
|
+
this.editorBridge = null;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
__publicField(_InlineText, "injectedRoots", /* @__PURE__ */ new WeakSet());
|
|
128
|
+
let InlineText = _InlineText;
|
|
129
|
+
if (customElements.get("juo-context-root") == null) {
|
|
130
|
+
customElements.define("juo-context-root", ContextRoot);
|
|
131
|
+
}
|
|
132
|
+
if (customElements.get("juo-extension-root") == null) {
|
|
133
|
+
customElements.define("juo-extension-root", ExtensionRoot);
|
|
134
|
+
}
|
|
135
|
+
if (customElements.get("juo-block") == null) {
|
|
136
|
+
customElements.define("juo-block", Block);
|
|
137
|
+
}
|
|
138
|
+
if (customElements.get("juo-text") == null) {
|
|
139
|
+
customElements.define("juo-text", InlineText);
|
|
140
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { o as ContextRoot } from "./block-CFJIpH_9.js";
|
|
2
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BuoY5H2A.js";
|
|
3
|
+
class InlineText extends HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
this.style.display = "inline-block";
|
|
9
|
+
this.style.overflowWrap = "anywhere";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (customElements.get("juo-context-root") == null) {
|
|
13
|
+
customElements.define("juo-context-root", ContextRoot);
|
|
14
|
+
}
|
|
15
|
+
if (customElements.get("juo-extension-root") == null) {
|
|
16
|
+
customElements.define("juo-extension-root", ExtensionRoot);
|
|
17
|
+
}
|
|
18
|
+
if (customElements.get("juo-block") == null) {
|
|
19
|
+
customElements.define("juo-block", Block);
|
|
20
|
+
}
|
|
21
|
+
if (customElements.get("juo-text") == null) {
|
|
22
|
+
customElements.define("juo-text", InlineText);
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juo/orion-core",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -41,9 +41,13 @@
|
|
|
41
41
|
"types": "./dist/editor/main.d.ts",
|
|
42
42
|
"default": "./dist/editor.js"
|
|
43
43
|
},
|
|
44
|
-
"./web-components": {
|
|
45
|
-
"types": "./dist/web-components/main.d.ts",
|
|
46
|
-
"
|
|
44
|
+
"./web-components/editor": {
|
|
45
|
+
"types": "./dist/web-components/editor/main.d.ts",
|
|
46
|
+
"default": "./dist/web-components-editor.js"
|
|
47
|
+
},
|
|
48
|
+
"./web-components/runtime": {
|
|
49
|
+
"types": "./dist/web-components/runtime/main.d.ts",
|
|
50
|
+
"default": "./dist/web-components-runtime.js"
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
"dependencies": {
|
|
File without changes
|