@juo/orion-core 0.18.0 → 0.20.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/{ExtensionRoot-raAaUEVu.js → ExtensionRoot-z_aRSifd.js} +2 -2
- package/dist/block.d.ts +3 -0
- package/dist/{bridge-SZyjoSJS.js → bridge-BHI_2-Xw.js} +10 -10
- package/dist/core.js +1 -1
- package/dist/editor/messages.d.ts +2 -1
- package/dist/editor.js +52 -25
- package/dist/{juo-workflow-rDW9uQPy.js → juo-workflow-BBbsNhY2.js} +37 -5
- package/dist/preact.js +1 -1
- package/dist/react.js +1 -1
- package/dist/vue.js +1 -1
- package/dist/web-components-editor.js +3 -3
- package/dist/web-components-runtime.js +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { signal, effect, createBlockInstance } from "@juo/orion-core";
|
|
8
8
|
import { d, j as withWrapper, t as subscribeContext, T as ThemeStateContext, E, v as n } from "./theme-state-D4n_2n_h.js";
|
|
9
|
-
import "./juo-workflow-
|
|
9
|
+
import "./juo-workflow-BBbsNhY2.js";
|
|
10
10
|
class Block extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
@@ -96,7 +96,7 @@ class ExtensionRoot extends HTMLElement {
|
|
|
96
96
|
this.style.display = "flex";
|
|
97
97
|
this.style.flexDirection = "column";
|
|
98
98
|
this.style.gap = "16px";
|
|
99
|
-
this.style.
|
|
99
|
+
this.style.maxWidth = "100%";
|
|
100
100
|
this.style.justifySelf = "center";
|
|
101
101
|
this.unsubscribeThemeContext = subscribeContext(
|
|
102
102
|
this,
|
package/dist/block.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export type BlockDefinition<T = unknown> = {
|
|
|
23
23
|
render: BlockRenderer;
|
|
24
24
|
presets?: BlockPresets;
|
|
25
25
|
locales?: {
|
|
26
|
+
/** Locale codes supported by this block (e.g. ["en", "de", "nl"]). */
|
|
27
|
+
supported?: string[];
|
|
26
28
|
load: (locale: string) => Promise<BlockLocaleFile>;
|
|
27
29
|
};
|
|
28
30
|
};
|
|
@@ -73,6 +75,7 @@ export declare function defineBlock<T>(name: string, opts: {
|
|
|
73
75
|
renderer: (block: BlockInstance) => HTMLElement;
|
|
74
76
|
presets?: BlockPresets;
|
|
75
77
|
locales?: {
|
|
78
|
+
supported?: string[];
|
|
76
79
|
load: (locale: string) => Promise<BlockLocaleFile>;
|
|
77
80
|
};
|
|
78
81
|
}): BlockDefinition<T>;
|
|
@@ -87,7 +87,7 @@ function createRegisterBlocksMessage(payload) {
|
|
|
87
87
|
schema: block.schema == null ? block.schema : JSON.parse(JSON.stringify(block.schema)),
|
|
88
88
|
initialValue: block.initialValue == null ? block.initialValue : JSON.parse(JSON.stringify(block.initialValue)),
|
|
89
89
|
presets: block.presets == null ? block.presets : JSON.parse(JSON.stringify(block.presets)),
|
|
90
|
-
|
|
90
|
+
locales: block.locales == null ? block.locales : JSON.parse(JSON.stringify(block.locales))
|
|
91
91
|
}));
|
|
92
92
|
return {
|
|
93
93
|
type: "REGISTER_BLOCKS",
|
|
@@ -470,16 +470,16 @@ export {
|
|
|
470
470
|
createFocusInlineTextMessage as b,
|
|
471
471
|
createRegisterBlockTranslationKeysMessage as c,
|
|
472
472
|
createUpdateBlockTranslationMessage as d,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
473
|
+
createSelectBlockMessage as e,
|
|
474
|
+
createRemoveBlockMessage as f,
|
|
475
|
+
createRegisterBlocksMessage as g,
|
|
476
|
+
createRegisterRoutesMessage as h,
|
|
477
477
|
isEditorMessage as i,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
478
|
+
isIframeMessage as j,
|
|
479
|
+
createProvideThemeStateMessage as k,
|
|
480
|
+
createRequestThemeStateMessage as l,
|
|
481
|
+
createRequestTranslationOverridesMessage as m,
|
|
482
|
+
createProvideTranslationOverridesMessage as n,
|
|
483
483
|
createUpdateBlockPropsMessage as o,
|
|
484
484
|
createAddBlockMessage as p,
|
|
485
485
|
createMoveBlockMessage as q,
|
package/dist/core.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { c as createContext, d, w, E, u } from "./theme-state-D4n_2n_h.js";
|
|
8
8
|
import { B, n, C, D, S, T, a, b, e, f, k, l, g, h, i, m, p, o, q, r, s, t, v, j } from "./theme-state-D4n_2n_h.js";
|
|
9
|
-
import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-
|
|
9
|
+
import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-BBbsNhY2.js";
|
|
10
10
|
function createState() {
|
|
11
11
|
const discountCode = d(null);
|
|
12
12
|
const products = d([]);
|
|
@@ -123,7 +123,8 @@ export interface RegisterBlocksMessage extends BaseMessage {
|
|
|
123
123
|
schema: unknown;
|
|
124
124
|
initialValue: unknown;
|
|
125
125
|
presets?: BlockPresets;
|
|
126
|
-
|
|
126
|
+
/** Locale code → flattened translation strings for all supported locales. */
|
|
127
|
+
locales?: Record<string, Record<string, string>>;
|
|
127
128
|
}>;
|
|
128
129
|
};
|
|
129
130
|
}
|
package/dist/editor.js
CHANGED
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { getDefinedBlocks, onRegisterBlock } from "@juo/orion-core";
|
|
8
|
-
import { a as createEditorBridge,
|
|
9
|
-
import { p, b, q, v, w,
|
|
8
|
+
import { a as createEditorBridge, f as createRemoveBlockMessage, g as createRegisterBlocksMessage, h as createRegisterRoutesMessage } from "./bridge-BHI_2-Xw.js";
|
|
9
|
+
import { p, b, q, v, w, k, n, c, y, u, l, m, x, e, r, t, s, o, d, z, i, j } from "./bridge-BHI_2-Xw.js";
|
|
10
10
|
import { e as createBlockInstanceFromObject, m as indexOverrides } from "./theme-state-D4n_2n_h.js";
|
|
11
11
|
function createEditorHandler(options) {
|
|
12
12
|
const { themeState, onBlockSelection } = options;
|
|
@@ -304,8 +304,9 @@ const styles = `
|
|
|
304
304
|
background-color: white;
|
|
305
305
|
border: 1px solid #B5B5B5;
|
|
306
306
|
border-radius: 8px;
|
|
307
|
-
width: fit-content;
|
|
308
307
|
justify-self: center;
|
|
308
|
+
max-width: 100%;
|
|
309
|
+
box-sizing: border-box;
|
|
309
310
|
}
|
|
310
311
|
|
|
311
312
|
.block-wrapper:hover,
|
|
@@ -470,8 +471,8 @@ class BlockWrapper extends HTMLElement {
|
|
|
470
471
|
const moreBtn = document.createElement("button");
|
|
471
472
|
moreBtn.type = "button";
|
|
472
473
|
moreBtn.innerHTML = moreIconSvg;
|
|
473
|
-
moreBtn.addEventListener("click", (
|
|
474
|
-
|
|
474
|
+
moreBtn.addEventListener("click", (e2) => {
|
|
475
|
+
e2.stopPropagation();
|
|
475
476
|
this.toggleMenu();
|
|
476
477
|
});
|
|
477
478
|
const menuEl = document.createElement("div");
|
|
@@ -487,8 +488,8 @@ class BlockWrapper extends HTMLElement {
|
|
|
487
488
|
deleteBtn.className = "block-wrapper__menu-item block-wrapper__menu-item--danger";
|
|
488
489
|
deleteBtn.setAttribute("role", "menuitem");
|
|
489
490
|
deleteBtn.innerHTML = `${trashIconSvg}<span>Delete</span>`;
|
|
490
|
-
deleteBtn.addEventListener("click", (
|
|
491
|
-
|
|
491
|
+
deleteBtn.addEventListener("click", (e2) => {
|
|
492
|
+
e2.stopPropagation();
|
|
492
493
|
this.closeMenu();
|
|
493
494
|
this.handleRemoveBlock();
|
|
494
495
|
});
|
|
@@ -537,8 +538,8 @@ class BlockWrapper extends HTMLElement {
|
|
|
537
538
|
return;
|
|
538
539
|
this.menuElement.classList.add("open");
|
|
539
540
|
this.isMenuOpen = true;
|
|
540
|
-
this.closeMenuOnOutsideClick = (
|
|
541
|
-
if (!this.shadowRoot.contains(
|
|
541
|
+
this.closeMenuOnOutsideClick = (e2) => {
|
|
542
|
+
if (!this.shadowRoot.contains(e2.composedPath()[0])) {
|
|
542
543
|
this.closeMenu();
|
|
543
544
|
}
|
|
544
545
|
};
|
|
@@ -621,7 +622,7 @@ class BlockWrapper extends HTMLElement {
|
|
|
621
622
|
if (customElements.get("juo-editor-block-wrapper") == null) {
|
|
622
623
|
customElements.define("juo-editor-block-wrapper", BlockWrapper);
|
|
623
624
|
}
|
|
624
|
-
function serializeBlock(block) {
|
|
625
|
+
async function serializeBlock(block) {
|
|
625
626
|
let initialValue = block.initialValue;
|
|
626
627
|
if (typeof initialValue === "function") {
|
|
627
628
|
try {
|
|
@@ -630,12 +631,36 @@ function serializeBlock(block) {
|
|
|
630
631
|
initialValue = void 0;
|
|
631
632
|
}
|
|
632
633
|
}
|
|
634
|
+
let locales;
|
|
635
|
+
if (block.locales) {
|
|
636
|
+
const supported = block.locales.supported ?? ["en"];
|
|
637
|
+
const entries = await Promise.all(
|
|
638
|
+
supported.map(async (code) => {
|
|
639
|
+
try {
|
|
640
|
+
const localeFile = await block.locales.load(code);
|
|
641
|
+
const topLevel = Object.fromEntries(
|
|
642
|
+
Object.entries(localeFile).filter(
|
|
643
|
+
([key, value]) => key !== "overrides" && typeof value === "string"
|
|
644
|
+
)
|
|
645
|
+
);
|
|
646
|
+
return [code, { ...topLevel, ...localeFile.overrides ?? {} }];
|
|
647
|
+
} catch {
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
})
|
|
651
|
+
);
|
|
652
|
+
const loaded = entries.filter((e2) => e2 !== null);
|
|
653
|
+
if (loaded.length > 0) {
|
|
654
|
+
locales = Object.fromEntries(loaded);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
633
657
|
return {
|
|
634
658
|
name: block.name,
|
|
635
659
|
group: block.group,
|
|
636
660
|
schema: block.schema,
|
|
637
661
|
initialValue,
|
|
638
|
-
presets: block.presets
|
|
662
|
+
presets: block.presets,
|
|
663
|
+
locales
|
|
639
664
|
};
|
|
640
665
|
}
|
|
641
666
|
async function setupEditorMode(routes, themeState) {
|
|
@@ -646,16 +671,18 @@ async function setupEditorMode(routes, themeState) {
|
|
|
646
671
|
const { unsubscribe } = editor.onMessage((message) => {
|
|
647
672
|
handler.handleMessage(message);
|
|
648
673
|
});
|
|
649
|
-
const blocks = getDefinedBlocks().map(serializeBlock);
|
|
674
|
+
const blocks = await Promise.all(getDefinedBlocks().map(serializeBlock));
|
|
650
675
|
editor.sendMessage(createRegisterBlocksMessage({ blocks }));
|
|
651
676
|
editor.sendMessage(createRegisterRoutesMessage({ routes }));
|
|
652
|
-
onRegisterBlock(
|
|
653
|
-
(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
677
|
+
onRegisterBlock((_, block) => {
|
|
678
|
+
void serializeBlock(block).then(
|
|
679
|
+
(serialized) => editor.sendMessage(
|
|
680
|
+
createRegisterBlocksMessage({
|
|
681
|
+
blocks: [serialized]
|
|
682
|
+
})
|
|
683
|
+
)
|
|
684
|
+
);
|
|
685
|
+
});
|
|
659
686
|
return () => {
|
|
660
687
|
unsubscribe();
|
|
661
688
|
editor.destroy();
|
|
@@ -670,18 +697,18 @@ export {
|
|
|
670
697
|
q as createMoveBlockMessage,
|
|
671
698
|
v as createProvideGlobalStylesMessage,
|
|
672
699
|
w as createProvideInitialGlobalStylesMessage,
|
|
673
|
-
|
|
674
|
-
|
|
700
|
+
k as createProvideThemeStateMessage,
|
|
701
|
+
n as createProvideTranslationOverridesMessage,
|
|
675
702
|
c as createRegisterBlockTranslationKeysMessage,
|
|
676
703
|
createRegisterBlocksMessage,
|
|
677
704
|
createRegisterRoutesMessage,
|
|
678
705
|
createRemoveBlockMessage,
|
|
679
706
|
y as createReportContentHeightMessage,
|
|
680
707
|
u as createRequestGlobalStylesMessage,
|
|
681
|
-
|
|
682
|
-
|
|
708
|
+
l as createRequestThemeStateMessage,
|
|
709
|
+
m as createRequestTranslationOverridesMessage,
|
|
683
710
|
x as createScrollSyncMessage,
|
|
684
|
-
|
|
711
|
+
e as createSelectBlockMessage,
|
|
685
712
|
r as createSetBlockPresetMessage,
|
|
686
713
|
t as createSetGlobalStylesMessage,
|
|
687
714
|
s as createSetLocaleMessage,
|
|
@@ -689,6 +716,6 @@ export {
|
|
|
689
716
|
d as createUpdateBlockTranslationMessage,
|
|
690
717
|
z as getEditorBridge,
|
|
691
718
|
i as isEditorMessage,
|
|
692
|
-
|
|
719
|
+
j as isIframeMessage,
|
|
693
720
|
setupEditorMode
|
|
694
721
|
};
|
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { c as createContext, d, E, i as getDefinedBlocks, a as createBlockInstance, w, r as registerBlock, g as defineBlock, t as subscribeContext } from "./theme-state-D4n_2n_h.js";
|
|
8
|
-
import { a as createEditorBridge } from "./bridge-
|
|
8
|
+
import { a as createEditorBridge, e as createSelectBlockMessage } from "./bridge-BHI_2-Xw.js";
|
|
9
9
|
const TranslationContext = createContext("translation");
|
|
10
10
|
function toStringRecord(input) {
|
|
11
11
|
if (input == null)
|
|
@@ -176,7 +176,7 @@ function createWorkflowService(deps) {
|
|
|
176
176
|
return `wf-${shortenId(workflowId)}-${shortenId(stepId)}`;
|
|
177
177
|
}
|
|
178
178
|
function handleFlowResponse(data) {
|
|
179
|
-
var _a;
|
|
179
|
+
var _a, _b;
|
|
180
180
|
const mergedInvalidated = [
|
|
181
181
|
..._state.value.invalidatedResources,
|
|
182
182
|
...data.invalidatedResources ?? []
|
|
@@ -190,8 +190,21 @@ function createWorkflowService(deps) {
|
|
|
190
190
|
runVersion: data.runVersion,
|
|
191
191
|
currentStepId: data.pendingInteraction.stepId,
|
|
192
192
|
currentInteraction: data.pendingInteraction,
|
|
193
|
-
invalidatedResources: mergedInvalidated
|
|
193
|
+
invalidatedResources: mergedInvalidated,
|
|
194
|
+
outcome: null
|
|
194
195
|
});
|
|
196
|
+
if (editor.isEditorMode) {
|
|
197
|
+
const overlayBlocks = deps.themeState.overlay.blocks.value;
|
|
198
|
+
const rootBlock = overlayBlocks[0];
|
|
199
|
+
const stepSlot = (_a = rootBlock == null ? void 0 : rootBlock.slots) == null ? void 0 : _a[data.pendingInteraction.stepId];
|
|
200
|
+
const stepBlock = Array.isArray(stepSlot) ? stepSlot[0] : null;
|
|
201
|
+
const blockId = stepBlock && typeof stepBlock === "object" && "id" in stepBlock ? stepBlock.id : null;
|
|
202
|
+
if (blockId) {
|
|
203
|
+
editor.sendMessage(
|
|
204
|
+
createSelectBlockMessage({ blockId }, blockId)
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
195
208
|
} else if (data.status === "completed") {
|
|
196
209
|
updateState({
|
|
197
210
|
status: "completed",
|
|
@@ -203,7 +216,7 @@ function createWorkflowService(deps) {
|
|
|
203
216
|
outcome: data.outcome || null
|
|
204
217
|
});
|
|
205
218
|
} else if (data.status === "failed") {
|
|
206
|
-
handleError(new Error(((
|
|
219
|
+
handleError(new Error(((_b = data.error) == null ? void 0 : _b.message) || "Flow failed"));
|
|
207
220
|
} else if (data.status === "cancelled") {
|
|
208
221
|
updateState({
|
|
209
222
|
status: "idle",
|
|
@@ -415,7 +428,26 @@ function createWorkflowService(deps) {
|
|
|
415
428
|
const isTerminal = status === "completed" || status === "error";
|
|
416
429
|
if (runId && !isTerminal) {
|
|
417
430
|
try {
|
|
418
|
-
await api.cancel(runId);
|
|
431
|
+
const data = await api.cancel(runId);
|
|
432
|
+
if (data.outcome) {
|
|
433
|
+
updateState({
|
|
434
|
+
status: "completed",
|
|
435
|
+
flowType: null,
|
|
436
|
+
workflowId: null,
|
|
437
|
+
workflowVersion: null,
|
|
438
|
+
runId: null,
|
|
439
|
+
runVersion: null,
|
|
440
|
+
currentStepId: null,
|
|
441
|
+
currentInteraction: null,
|
|
442
|
+
error: null,
|
|
443
|
+
result: null,
|
|
444
|
+
flowParams: null,
|
|
445
|
+
invalidatedResources: data.invalidatedResources ?? [],
|
|
446
|
+
outcome: data.outcome || null,
|
|
447
|
+
dryRun: null
|
|
448
|
+
});
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
419
451
|
} catch {
|
|
420
452
|
}
|
|
421
453
|
}
|
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 { a as createEditorBridge } from "./bridge-
|
|
12
|
+
import { a as createEditorBridge } from "./bridge-BHI_2-Xw.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 { a as createEditorBridge } from "./bridge-
|
|
12
|
+
import { a as createEditorBridge } from "./bridge-BHI_2-Xw.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 createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-
|
|
3
|
+
import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-BHI_2-Xw.js";
|
|
4
4
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function toSignal(ref2) {
|
|
6
6
|
if (!signalsMap.has(ref2)) {
|
|
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
|
|
8
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
9
|
-
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-
|
|
10
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-z_aRSifd.js";
|
|
9
|
+
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-BHI_2-Xw.js";
|
|
10
|
+
import { T as TranslationContext } from "./juo-workflow-BBbsNhY2.js";
|
|
11
11
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
|
|
8
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
9
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-z_aRSifd.js";
|
|
9
|
+
import { T as TranslationContext } from "./juo-workflow-BBbsNhY2.js";
|
|
10
10
|
class InlineText extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|