@juo/orion-core 0.17.1 → 0.19.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-BifGkf1W.js → ExtensionRoot-Cd9xPgd2.js} +2 -2
- package/dist/{bridge-D-0V6_BT.js → bridge-SZyjoSJS.js} +35 -26
- package/dist/core.js +1 -1
- package/dist/editor/messages.d.ts +13 -2
- package/dist/editor.js +25 -23
- package/dist/{juo-workflow-CtWyuHD6.js → juo-workflow-BAC3Lblr.js} +24 -4
- package/dist/preact.js +1 -1
- package/dist/react.js +1 -1
- package/dist/vue/context.d.ts +9 -0
- package/dist/vue.js +30 -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-BAC3Lblr.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,
|
|
@@ -2,7 +2,7 @@ function isEditorMessage(message) {
|
|
|
2
2
|
return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES" || message.type === "SCROLL_SYNC" || message.type === "REQUEST_CONTENT_HEIGHT";
|
|
3
3
|
}
|
|
4
4
|
function isIframeMessage(message) {
|
|
5
|
-
return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "PROVIDE_INITIAL_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC";
|
|
5
|
+
return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "REGISTER_BLOCK_TRANSLATION_KEYS" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "PROVIDE_INITIAL_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC";
|
|
6
6
|
}
|
|
7
7
|
function createProvideThemeStateMessage(payload) {
|
|
8
8
|
return {
|
|
@@ -86,7 +86,8 @@ function createRegisterBlocksMessage(payload) {
|
|
|
86
86
|
group: block.group,
|
|
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
|
-
presets: block.presets == null ? block.presets : JSON.parse(JSON.stringify(block.presets))
|
|
89
|
+
presets: block.presets == null ? block.presets : JSON.parse(JSON.stringify(block.presets)),
|
|
90
|
+
localeDefaults: block.localeDefaults == null ? block.localeDefaults : JSON.parse(JSON.stringify(block.localeDefaults))
|
|
90
91
|
}));
|
|
91
92
|
return {
|
|
92
93
|
type: "REGISTER_BLOCKS",
|
|
@@ -110,6 +111,13 @@ function createSetLocaleMessage(payload) {
|
|
|
110
111
|
timestamp: Date.now()
|
|
111
112
|
};
|
|
112
113
|
}
|
|
114
|
+
function createRegisterBlockTranslationKeysMessage(payload) {
|
|
115
|
+
return {
|
|
116
|
+
type: "REGISTER_BLOCK_TRANSLATION_KEYS",
|
|
117
|
+
payload,
|
|
118
|
+
timestamp: Date.now()
|
|
119
|
+
};
|
|
120
|
+
}
|
|
113
121
|
function createFocusInlineTextMessage(payload, blockId) {
|
|
114
122
|
return {
|
|
115
123
|
type: "FOCUS_INLINE_TEXT",
|
|
@@ -458,29 +466,30 @@ function createEditorBridge() {
|
|
|
458
466
|
return bridgeInstance;
|
|
459
467
|
}
|
|
460
468
|
export {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
+
createEditorBridge as a,
|
|
470
|
+
createFocusInlineTextMessage as b,
|
|
471
|
+
createRegisterBlockTranslationKeysMessage as c,
|
|
472
|
+
createUpdateBlockTranslationMessage as d,
|
|
473
|
+
createRemoveBlockMessage as e,
|
|
474
|
+
createRegisterBlocksMessage as f,
|
|
475
|
+
createRegisterRoutesMessage as g,
|
|
476
|
+
isIframeMessage as h,
|
|
469
477
|
isEditorMessage as i,
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
478
|
+
createProvideThemeStateMessage as j,
|
|
479
|
+
createRequestThemeStateMessage as k,
|
|
480
|
+
createRequestTranslationOverridesMessage as l,
|
|
481
|
+
createProvideTranslationOverridesMessage as m,
|
|
482
|
+
createSelectBlockMessage as n,
|
|
483
|
+
createUpdateBlockPropsMessage as o,
|
|
484
|
+
createAddBlockMessage as p,
|
|
485
|
+
createMoveBlockMessage as q,
|
|
486
|
+
createSetBlockPresetMessage as r,
|
|
487
|
+
createSetLocaleMessage as s,
|
|
488
|
+
createSetGlobalStylesMessage as t,
|
|
489
|
+
createRequestGlobalStylesMessage as u,
|
|
490
|
+
createProvideGlobalStylesMessage as v,
|
|
491
|
+
createProvideInitialGlobalStylesMessage as w,
|
|
492
|
+
createScrollSyncMessage as x,
|
|
493
|
+
createReportContentHeightMessage as y,
|
|
494
|
+
getEditorBridge as z
|
|
486
495
|
};
|
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-BAC3Lblr.js";
|
|
10
10
|
function createState() {
|
|
11
11
|
const discountCode = d(null);
|
|
12
12
|
const products = d([]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Block, BlockPresets } from '../block';
|
|
2
2
|
import { GlobalStyles, ThemeSurface, TranslationOverride } from '../theme-state';
|
|
3
|
-
export type MessageType = "PROVIDE_THEME_STATE" | "SELECT_BLOCK" | "UPDATE_BLOCK_PROPS" | "ADD_BLOCK" | "REMOVE_BLOCK" | "MOVE_BLOCK" | "IFRAME_READY" | "REGISTER_BLOCKS" | "REGISTER_ROUTES" | "SET_BLOCK_PRESET" | "SET_LOCALE" | "REQUEST_THEME_STATE" | "REQUEST_TRANSLATION_OVERRIDES" | "PROVIDE_TRANSLATION_OVERRIDES" | "UPDATE_BLOCK_TRANSLATION" | "FOCUS_INLINE_TEXT" | "SET_GLOBAL_STYLES" | "REQUEST_GLOBAL_STYLES" | "PROVIDE_GLOBAL_STYLES" | "PROVIDE_INITIAL_GLOBAL_STYLES" | "SCROLL_SYNC" | "REPORT_CONTENT_HEIGHT" | "REQUEST_CONTENT_HEIGHT";
|
|
3
|
+
export type MessageType = "PROVIDE_THEME_STATE" | "SELECT_BLOCK" | "UPDATE_BLOCK_PROPS" | "ADD_BLOCK" | "REMOVE_BLOCK" | "MOVE_BLOCK" | "IFRAME_READY" | "REGISTER_BLOCKS" | "REGISTER_ROUTES" | "SET_BLOCK_PRESET" | "SET_LOCALE" | "REQUEST_THEME_STATE" | "REQUEST_TRANSLATION_OVERRIDES" | "PROVIDE_TRANSLATION_OVERRIDES" | "UPDATE_BLOCK_TRANSLATION" | "REGISTER_BLOCK_TRANSLATION_KEYS" | "FOCUS_INLINE_TEXT" | "SET_GLOBAL_STYLES" | "REQUEST_GLOBAL_STYLES" | "PROVIDE_GLOBAL_STYLES" | "PROVIDE_INITIAL_GLOBAL_STYLES" | "SCROLL_SYNC" | "REPORT_CONTENT_HEIGHT" | "REQUEST_CONTENT_HEIGHT";
|
|
4
4
|
export interface BaseMessage {
|
|
5
5
|
type: MessageType;
|
|
6
6
|
timestamp: number;
|
|
@@ -63,6 +63,15 @@ export interface UpdateBlockTranslationMessage extends BaseMessage {
|
|
|
63
63
|
};
|
|
64
64
|
blockId: string;
|
|
65
65
|
}
|
|
66
|
+
export interface RegisterBlockTranslationKeysMessage extends BaseMessage {
|
|
67
|
+
type: "REGISTER_BLOCK_TRANSLATION_KEYS";
|
|
68
|
+
payload: {
|
|
69
|
+
blockId: string;
|
|
70
|
+
blockType: string;
|
|
71
|
+
/** Map of translation key to its default/fallback value */
|
|
72
|
+
keys: Record<string, string>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
66
75
|
export interface AddBlockMessage extends BaseMessage {
|
|
67
76
|
type: "ADD_BLOCK";
|
|
68
77
|
payload: {
|
|
@@ -114,6 +123,7 @@ export interface RegisterBlocksMessage extends BaseMessage {
|
|
|
114
123
|
schema: unknown;
|
|
115
124
|
initialValue: unknown;
|
|
116
125
|
presets?: BlockPresets;
|
|
126
|
+
localeDefaults?: Record<string, string>;
|
|
117
127
|
}>;
|
|
118
128
|
};
|
|
119
129
|
}
|
|
@@ -177,7 +187,7 @@ export interface ProvideInitialGlobalStylesMessage extends BaseMessage {
|
|
|
177
187
|
};
|
|
178
188
|
}
|
|
179
189
|
export type EditorMessage = ProvideThemeStateMessage | ProvideTranslationOverridesMessage | SelectBlockMessage | UpdateBlockPropsMessage | AddBlockMessage | RemoveBlockMessage | MoveBlockMessage | SetBlockPresetMessage | SetLocaleMessage | SetGlobalStylesMessage | ProvideGlobalStylesMessage | ScrollSyncMessage | RequestContentHeightMessage;
|
|
180
|
-
export type IframeMessage = SelectBlockMessage | IframeReadyMessage | RegisterBlocksMessage | RegisterRoutesMessage | RemoveBlockMessage | UpdateBlockPropsMessage | RequestThemeStateMessage | RequestTranslationOverridesMessage | UpdateBlockTranslationMessage | FocusInlineTextMessage | RequestGlobalStylesMessage | ProvideInitialGlobalStylesMessage | ReportContentHeightMessage | ScrollSyncMessage;
|
|
190
|
+
export type IframeMessage = SelectBlockMessage | IframeReadyMessage | RegisterBlocksMessage | RegisterRoutesMessage | RemoveBlockMessage | UpdateBlockPropsMessage | RequestThemeStateMessage | RequestTranslationOverridesMessage | UpdateBlockTranslationMessage | RegisterBlockTranslationKeysMessage | FocusInlineTextMessage | RequestGlobalStylesMessage | ProvideInitialGlobalStylesMessage | ReportContentHeightMessage | ScrollSyncMessage;
|
|
181
191
|
export type AnyMessage = EditorMessage | IframeMessage;
|
|
182
192
|
export declare function isEditorMessage(message: AnyMessage): message is EditorMessage;
|
|
183
193
|
export declare function isIframeMessage(message: AnyMessage): message is IframeMessage;
|
|
@@ -194,6 +204,7 @@ export declare function createMoveBlockMessage(payload: MoveBlockMessage["payloa
|
|
|
194
204
|
export declare function createRegisterBlocksMessage(payload: RegisterBlocksMessage["payload"]): RegisterBlocksMessage;
|
|
195
205
|
export declare function createSetBlockPresetMessage(payload: SetBlockPresetMessage["payload"]): SetBlockPresetMessage;
|
|
196
206
|
export declare function createSetLocaleMessage(payload: SetLocaleMessage["payload"]): SetLocaleMessage;
|
|
207
|
+
export declare function createRegisterBlockTranslationKeysMessage(payload: RegisterBlockTranslationKeysMessage["payload"]): RegisterBlockTranslationKeysMessage;
|
|
197
208
|
export declare function createFocusInlineTextMessage(payload: FocusInlineTextMessage["payload"], blockId: string): FocusInlineTextMessage;
|
|
198
209
|
export declare function createRegisterRoutesMessage(payload: RegisterRoutesMessage["payload"]): RegisterRoutesMessage;
|
|
199
210
|
export declare function createSetGlobalStylesMessage(payload: SetGlobalStylesMessage["payload"]): SetGlobalStylesMessage;
|
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 {
|
|
9
|
-
import {
|
|
8
|
+
import { a as createEditorBridge, e as createRemoveBlockMessage, f as createRegisterBlocksMessage, g as createRegisterRoutesMessage } from "./bridge-SZyjoSJS.js";
|
|
9
|
+
import { p, b, q, v, w, j, m, c, y, u, k, l, x, n, r, t, s, o, d, z, i, h } from "./bridge-SZyjoSJS.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,
|
|
@@ -663,31 +664,32 @@ async function setupEditorMode(routes, themeState) {
|
|
|
663
664
|
}
|
|
664
665
|
export {
|
|
665
666
|
BlockWrapper,
|
|
666
|
-
|
|
667
|
+
p as createAddBlockMessage,
|
|
667
668
|
createEditorBridge,
|
|
668
669
|
createEditorHandler,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
670
|
+
b as createFocusInlineTextMessage,
|
|
671
|
+
q as createMoveBlockMessage,
|
|
672
|
+
v as createProvideGlobalStylesMessage,
|
|
673
|
+
w as createProvideInitialGlobalStylesMessage,
|
|
674
|
+
j as createProvideThemeStateMessage,
|
|
675
|
+
m as createProvideTranslationOverridesMessage,
|
|
676
|
+
c as createRegisterBlockTranslationKeysMessage,
|
|
675
677
|
createRegisterBlocksMessage,
|
|
676
678
|
createRegisterRoutesMessage,
|
|
677
679
|
createRemoveBlockMessage,
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
680
|
+
y as createReportContentHeightMessage,
|
|
681
|
+
u as createRequestGlobalStylesMessage,
|
|
682
|
+
k as createRequestThemeStateMessage,
|
|
683
|
+
l as createRequestTranslationOverridesMessage,
|
|
684
|
+
x as createScrollSyncMessage,
|
|
685
|
+
n as createSelectBlockMessage,
|
|
686
|
+
r as createSetBlockPresetMessage,
|
|
687
|
+
t as createSetGlobalStylesMessage,
|
|
688
|
+
s as createSetLocaleMessage,
|
|
689
|
+
o as createUpdateBlockPropsMessage,
|
|
690
|
+
d as createUpdateBlockTranslationMessage,
|
|
691
|
+
z as getEditorBridge,
|
|
690
692
|
i as isEditorMessage,
|
|
691
|
-
|
|
693
|
+
h as isIframeMessage,
|
|
692
694
|
setupEditorMode
|
|
693
695
|
};
|
|
@@ -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 {
|
|
8
|
+
import { a as createEditorBridge } from "./bridge-SZyjoSJS.js";
|
|
9
9
|
const TranslationContext = createContext("translation");
|
|
10
10
|
function toStringRecord(input) {
|
|
11
11
|
if (input == null)
|
|
@@ -190,7 +190,8 @@ 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
|
});
|
|
195
196
|
} else if (data.status === "completed") {
|
|
196
197
|
updateState({
|
|
@@ -230,7 +231,7 @@ function createWorkflowService(deps) {
|
|
|
230
231
|
}
|
|
231
232
|
function maybeApplyPreviewStep(flowType, data) {
|
|
232
233
|
var _a;
|
|
233
|
-
if (!previewWorkflowTrigger
|
|
234
|
+
if (!previewWorkflowTrigger)
|
|
234
235
|
return;
|
|
235
236
|
if (flowType !== previewWorkflowTrigger)
|
|
236
237
|
return;
|
|
@@ -415,7 +416,26 @@ function createWorkflowService(deps) {
|
|
|
415
416
|
const isTerminal = status === "completed" || status === "error";
|
|
416
417
|
if (runId && !isTerminal) {
|
|
417
418
|
try {
|
|
418
|
-
await api.cancel(runId);
|
|
419
|
+
const data = await api.cancel(runId);
|
|
420
|
+
if (data.outcome) {
|
|
421
|
+
updateState({
|
|
422
|
+
status: "completed",
|
|
423
|
+
flowType: null,
|
|
424
|
+
workflowId: null,
|
|
425
|
+
workflowVersion: null,
|
|
426
|
+
runId: null,
|
|
427
|
+
runVersion: null,
|
|
428
|
+
currentStepId: null,
|
|
429
|
+
currentInteraction: null,
|
|
430
|
+
error: null,
|
|
431
|
+
result: null,
|
|
432
|
+
flowParams: null,
|
|
433
|
+
invalidatedResources: data.invalidatedResources ?? [],
|
|
434
|
+
outcome: data.outcome || null,
|
|
435
|
+
dryRun: null
|
|
436
|
+
});
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
419
439
|
} catch {
|
|
420
440
|
}
|
|
421
441
|
}
|
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 {
|
|
12
|
+
import { a as createEditorBridge } from "./bridge-SZyjoSJS.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 {
|
|
12
|
+
import { a as createEditorBridge } from "./bridge-SZyjoSJS.js";
|
|
13
13
|
function toState(signal) {
|
|
14
14
|
const subscribe = (callback) => {
|
|
15
15
|
const dispose = effect(() => {
|
package/dist/vue/context.d.ts
CHANGED
|
@@ -4,6 +4,15 @@ import { Signal } from '@preact/signals-core';
|
|
|
4
4
|
export declare const ContextProvider: import('vue').DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import('vue').PublicProps>;
|
|
5
5
|
export declare function useProvideContextProvider(root: Ref<HTMLElement | null>): void;
|
|
6
6
|
export declare function useBlockId(): Ref<string | null>;
|
|
7
|
+
export declare function useBlockType(): Ref<string | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a function that blocks can call to register dynamic translation keys
|
|
10
|
+
* with the editor. The editor uses these keys to show a translation panel UI.
|
|
11
|
+
*
|
|
12
|
+
* The `keys` argument is a Record mapping translation key to its default value.
|
|
13
|
+
* This is a no-op when not running inside an editor iframe.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRegisterTranslationKeys(): (keys: Record<string, string>) => void;
|
|
7
16
|
export declare function useContext<C extends UnknownContext>(context: C): Wrap<ContextType<C>>;
|
|
8
17
|
export declare function useProvideContext<C extends UnknownContext>(context: C, init: ContextType<C>): void;
|
|
9
18
|
type Wrap<T> = T extends Signal<infer V> ? Ref<V> : T extends Function ? T : T extends Record<any, any> ? {
|
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 createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-SZyjoSJS.js";
|
|
4
4
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function toSignal(ref2) {
|
|
6
6
|
if (!signalsMap.has(ref2)) {
|
|
@@ -76,6 +76,33 @@ function useBlockId() {
|
|
|
76
76
|
return parent.getAttribute("data-block-id");
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
+
function useBlockType() {
|
|
80
|
+
const root = inject(key);
|
|
81
|
+
return computed(() => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!((_a = root == null ? void 0 : root.value) == null ? void 0 : _a.parentElement)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const parent = root.value.parentElement;
|
|
87
|
+
return parent.getAttribute("data-block-type");
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function useRegisterTranslationKeys() {
|
|
91
|
+
const blockId = useBlockId();
|
|
92
|
+
const blockType = useBlockType();
|
|
93
|
+
return (keys) => {
|
|
94
|
+
const id = blockId.value;
|
|
95
|
+
const type = blockType.value;
|
|
96
|
+
if (!id || !type)
|
|
97
|
+
return;
|
|
98
|
+
if (typeof window === "undefined" || window.parent === window)
|
|
99
|
+
return;
|
|
100
|
+
window.parent.postMessage(
|
|
101
|
+
createRegisterBlockTranslationKeysMessage({ blockId: id, blockType: type, keys }),
|
|
102
|
+
"*"
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
79
106
|
function useContext(context) {
|
|
80
107
|
const root = inject(key);
|
|
81
108
|
if ((root == null ? void 0 : root.value) == null) {
|
|
@@ -220,9 +247,11 @@ export {
|
|
|
220
247
|
toRef,
|
|
221
248
|
toSignal,
|
|
222
249
|
useBlockId,
|
|
250
|
+
useBlockType,
|
|
223
251
|
useBridge,
|
|
224
252
|
useContext,
|
|
225
253
|
useProvideContext,
|
|
226
254
|
useProvideContextProvider,
|
|
255
|
+
useRegisterTranslationKeys,
|
|
227
256
|
useTarget
|
|
228
257
|
};
|
|
@@ -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 {
|
|
10
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-Cd9xPgd2.js";
|
|
9
|
+
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-SZyjoSJS.js";
|
|
10
|
+
import { T as TranslationContext } from "./juo-workflow-BAC3Lblr.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-Cd9xPgd2.js";
|
|
9
|
+
import { T as TranslationContext } from "./juo-workflow-BAC3Lblr.js";
|
|
10
10
|
class InlineText extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|