@juo/blocks 1.6.0 → 1.7.1
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-sq31lwIQ.js → ExtensionRoot-CY2JksJh.js} +3 -2
- package/dist/{theme-state-D3w_B6gQ.js → block-C8lPBCF8.js} +46 -209
- package/dist/block.d.ts +43 -1
- package/dist/block.d.ts.map +1 -1
- package/dist/core.js +16 -13
- package/dist/editor/components.d.ts +7 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor.js +45 -1
- package/dist/flows/WorkflowService.d.ts.map +1 -1
- package/dist/{juo-workflow-BVrh5lpE.js → juo-workflow-Dqr1lB1k.js} +6 -4
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/preact/block.d.ts.map +1 -1
- package/dist/preact.js +3 -1
- package/dist/react/block.d.ts.map +1 -1
- package/dist/react.js +3 -1
- package/dist/theme-state-LZS5T-Xb.js +202 -0
- package/dist/vue/block.d.ts +2 -1
- package/dist/vue/block.d.ts.map +1 -1
- package/dist/vue/setupTests.d.ts +2 -0
- package/dist/vue/setupTests.d.ts.map +1 -0
- package/dist/vue.js +6 -1
- package/dist/web-components/editor/InlineText.d.ts +2 -0
- package/dist/web-components/editor/InlineText.d.ts.map +1 -1
- package/dist/web-components/editor/InlineText.test.d.ts +2 -0
- package/dist/web-components/editor/InlineText.test.d.ts.map +1 -0
- package/dist/web-components-editor.js +15 -4
- package/dist/web-components-runtime.js +3 -3
- package/package.json +1 -1
|
@@ -3,8 +3,9 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { signal, effect, createBlockInstance } from "@juo/blocks";
|
|
5
5
|
import { reportBlockWarning, reportBlockError } from "./observability.js";
|
|
6
|
-
import { d, v as subscribeContext,
|
|
7
|
-
import "./
|
|
6
|
+
import { d, v as subscribeContext, E, y as withWrapper, x as n, e as backfillInstanceDefaults, p as isStubDefinition, q as onRegisterBlock } from "./block-C8lPBCF8.js";
|
|
7
|
+
import { T as ThemeStateContext } from "./theme-state-LZS5T-Xb.js";
|
|
8
|
+
import "./juo-workflow-Dqr1lB1k.js";
|
|
8
9
|
class Block extends HTMLElement {
|
|
9
10
|
constructor() {
|
|
10
11
|
super();
|
|
@@ -469,6 +469,42 @@ function E(i2) {
|
|
|
469
469
|
r[Symbol.dispose] = r;
|
|
470
470
|
return r;
|
|
471
471
|
}
|
|
472
|
+
function hasRenderedContent(scope) {
|
|
473
|
+
var _a;
|
|
474
|
+
for (const child of scope.children) {
|
|
475
|
+
if (!(child instanceof HTMLElement)) {
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const display = (_a = child.ownerDocument.defaultView) == null ? void 0 : _a.getComputedStyle(child).display;
|
|
479
|
+
if (display === "contents") {
|
|
480
|
+
if (hasRenderedContent(child)) {
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
if (child.checkVisibility()) {
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
function attachEmptyTracking(host, scope) {
|
|
492
|
+
let observer = null;
|
|
493
|
+
let disposed = false;
|
|
494
|
+
queueMicrotask(() => {
|
|
495
|
+
if (disposed) return;
|
|
496
|
+
const observed = scope ?? host.shadowRoot ?? host;
|
|
497
|
+
const sync = () => host.toggleAttribute("data-empty", !hasRenderedContent(observed));
|
|
498
|
+
observer = new MutationObserver(sync);
|
|
499
|
+
observer.observe(observed, { childList: true, subtree: true });
|
|
500
|
+
sync();
|
|
501
|
+
});
|
|
502
|
+
return () => {
|
|
503
|
+
disposed = true;
|
|
504
|
+
observer == null ? void 0 : observer.disconnect();
|
|
505
|
+
observer = null;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
472
508
|
function serializeBlocks(blocks) {
|
|
473
509
|
return blocks.map((block) => serializeBlock(block));
|
|
474
510
|
}
|
|
@@ -647,9 +683,6 @@ function createCeRenderer(name) {
|
|
|
647
683
|
});
|
|
648
684
|
}
|
|
649
685
|
return (block) => {
|
|
650
|
-
const wrapper = document.createElement("div");
|
|
651
|
-
wrapper.setAttribute("data-block-id", block.id);
|
|
652
|
-
wrapper.setAttribute("data-block-type", block.type);
|
|
653
686
|
const el = document.createElement(name);
|
|
654
687
|
el.setAttribute("data-block-id", block.id);
|
|
655
688
|
el.setAttribute("data-block-type", block.type);
|
|
@@ -657,8 +690,8 @@ function createCeRenderer(name) {
|
|
|
657
690
|
el[key] = value;
|
|
658
691
|
});
|
|
659
692
|
el.replaceChildren(...renderSlots(block.slots, block));
|
|
660
|
-
|
|
661
|
-
return
|
|
693
|
+
attachEmptyTracking(el);
|
|
694
|
+
return el;
|
|
662
695
|
};
|
|
663
696
|
}
|
|
664
697
|
const stubDefinitionCache = /* @__PURE__ */ new Map();
|
|
@@ -789,221 +822,25 @@ function createBlockInstanceFromJSON(input) {
|
|
|
789
822
|
throw error;
|
|
790
823
|
}
|
|
791
824
|
}
|
|
792
|
-
const DEFAULT_GLOBAL_STYLES = {
|
|
793
|
-
volume: "comfort",
|
|
794
|
-
style: "ghost",
|
|
795
|
-
corners: "round",
|
|
796
|
-
buttonCorners: "round",
|
|
797
|
-
thumbnailCorners: "circle",
|
|
798
|
-
theme: "preset",
|
|
799
|
-
themeType: "neutral",
|
|
800
|
-
colors: {
|
|
801
|
-
accent: "#000000",
|
|
802
|
-
secondary: "#000000",
|
|
803
|
-
tint: "#111111",
|
|
804
|
-
callout: "#F5F5F5",
|
|
805
|
-
success: "#287a25",
|
|
806
|
-
error: "#a93c3c",
|
|
807
|
-
information: "#0075a3",
|
|
808
|
-
warning: "#8a5e00",
|
|
809
|
-
background: "#FFFFFF"
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
const ThemeStateContext = createContext("theme-state");
|
|
813
|
-
function normalizeLocale(locale) {
|
|
814
|
-
return locale.trim().toLowerCase().split("-")[0] || "en";
|
|
815
|
-
}
|
|
816
|
-
function toStringRecord(input) {
|
|
817
|
-
if (input == null) return {};
|
|
818
|
-
return Object.fromEntries(
|
|
819
|
-
Object.entries(input).filter(([, value]) => typeof value === "string")
|
|
820
|
-
);
|
|
821
|
-
}
|
|
822
|
-
function parseBlockLocaleFile(file) {
|
|
823
|
-
if (file == null) {
|
|
824
|
-
return { defaults: {}, modes: {} };
|
|
825
|
-
}
|
|
826
|
-
const entries = Object.entries(file).filter(
|
|
827
|
-
([key, value]) => key !== "overrides" && typeof value === "string"
|
|
828
|
-
);
|
|
829
|
-
const topLevel = Object.fromEntries(entries);
|
|
830
|
-
const overrides = toStringRecord(file.overrides);
|
|
831
|
-
return {
|
|
832
|
-
defaults: { ...topLevel, ...overrides },
|
|
833
|
-
modes: {
|
|
834
|
-
...Object.fromEntries(
|
|
835
|
-
Object.keys(topLevel).map((key) => [key, "default"])
|
|
836
|
-
),
|
|
837
|
-
...Object.fromEntries(
|
|
838
|
-
Object.keys(overrides).map((key) => [key, "override"])
|
|
839
|
-
)
|
|
840
|
-
}
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
function indexOverrides(overrides) {
|
|
844
|
-
const indexed = {
|
|
845
|
-
theme: {},
|
|
846
|
-
blocks: {}
|
|
847
|
-
};
|
|
848
|
-
for (const item of overrides) {
|
|
849
|
-
if (item.scope.kind === "theme") {
|
|
850
|
-
indexed.theme[item.key] = item.value;
|
|
851
|
-
continue;
|
|
852
|
-
}
|
|
853
|
-
if (indexed.blocks[item.scope.blockId] == null) {
|
|
854
|
-
indexed.blocks[item.scope.blockId] = {};
|
|
855
|
-
}
|
|
856
|
-
indexed.blocks[item.scope.blockId][item.key] = item.value;
|
|
857
|
-
}
|
|
858
|
-
return indexed;
|
|
859
|
-
}
|
|
860
|
-
function createThemeState(deps) {
|
|
861
|
-
var _a;
|
|
862
|
-
const surfaces = {
|
|
863
|
-
page: { blocks: d([]) },
|
|
864
|
-
overlay: { blocks: d([]) }
|
|
865
|
-
};
|
|
866
|
-
const locale = d("en");
|
|
867
|
-
const catalogs = d(null);
|
|
868
|
-
const globalStyles = d(
|
|
869
|
-
deps.initialGlobalStyles ?? DEFAULT_GLOBAL_STYLES
|
|
870
|
-
);
|
|
871
|
-
function setGlobalStyles(styles) {
|
|
872
|
-
globalStyles.value = styles;
|
|
873
|
-
}
|
|
874
|
-
async function collectBlockDefaults(loc) {
|
|
875
|
-
const nextDefaults = {};
|
|
876
|
-
const nextModes = {};
|
|
877
|
-
for (const block of getDefinedBlocks()) {
|
|
878
|
-
if (block.locales == null) continue;
|
|
879
|
-
let file = null;
|
|
880
|
-
try {
|
|
881
|
-
file = await block.locales.load(loc);
|
|
882
|
-
} catch {
|
|
883
|
-
file = null;
|
|
884
|
-
}
|
|
885
|
-
const parsed = parseBlockLocaleFile(file);
|
|
886
|
-
nextDefaults[block.name] = parsed.defaults;
|
|
887
|
-
nextModes[block.name] = parsed.modes;
|
|
888
|
-
}
|
|
889
|
-
return { defaults: nextDefaults, modes: nextModes };
|
|
890
|
-
}
|
|
891
|
-
async function setLocale(nextLocaleRaw) {
|
|
892
|
-
var _a2;
|
|
893
|
-
const nextLocale = normalizeLocale(nextLocaleRaw);
|
|
894
|
-
const [blockData, loadedOverrides] = await Promise.all([
|
|
895
|
-
collectBlockDefaults(nextLocale),
|
|
896
|
-
((_a2 = deps.translations) == null ? void 0 : _a2.resolveTranslations(nextLocale).catch(() => [])) ?? Promise.resolve([])
|
|
897
|
-
]);
|
|
898
|
-
const overrides = loadedOverrides.filter(
|
|
899
|
-
(item) => normalizeLocale(item.locale) === nextLocale
|
|
900
|
-
);
|
|
901
|
-
const indexed = indexOverrides(overrides);
|
|
902
|
-
catalogs.value = {
|
|
903
|
-
theme: {
|
|
904
|
-
defaults: {},
|
|
905
|
-
overrides: indexed.theme
|
|
906
|
-
},
|
|
907
|
-
blocks: {
|
|
908
|
-
defaults: blockData.defaults,
|
|
909
|
-
modes: blockData.modes,
|
|
910
|
-
overrides: indexed.blocks
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
locale.value = nextLocale;
|
|
914
|
-
}
|
|
915
|
-
async function resolve(surface, path) {
|
|
916
|
-
var _a2, _b, _c, _d;
|
|
917
|
-
surfaces[surface].blocks.value = [];
|
|
918
|
-
const stored = await deps.resolve(surface, path);
|
|
919
|
-
if (stored != null) {
|
|
920
|
-
surfaces[surface].blocks.value = stored.blocks.flatMap((block) => {
|
|
921
|
-
try {
|
|
922
|
-
return [createBlockInstanceFromObject(block)];
|
|
923
|
-
} catch (error) {
|
|
924
|
-
reportBlockError(error, {
|
|
925
|
-
site: "theme-state.resolve.hydrate",
|
|
926
|
-
extra: {
|
|
927
|
-
surface,
|
|
928
|
-
path,
|
|
929
|
-
blockType: typeof (block == null ? void 0 : block.type) === "string" ? block.type : "(unknown)"
|
|
930
|
-
}
|
|
931
|
-
});
|
|
932
|
-
return [];
|
|
933
|
-
}
|
|
934
|
-
});
|
|
935
|
-
return stored;
|
|
936
|
-
}
|
|
937
|
-
const blockToUse = surface === "page" ? (_b = (_a2 = deps.routerService) == null ? void 0 : _a2.getPages().find((p2) => p2.path === path)) == null ? void 0 : _b.block : (_c = getDefinedBlocks().find((b2) => b2.name === path)) == null ? void 0 : _c.name;
|
|
938
|
-
if (blockToUse != null) {
|
|
939
|
-
const instance = createBlockInstance(blockToUse);
|
|
940
|
-
surfaces[surface].blocks.value = [instance];
|
|
941
|
-
const serialized = serializeBlocks([instance]);
|
|
942
|
-
(_d = deps.upsertState) == null ? void 0 : _d.call(deps, surface, path, serialized);
|
|
943
|
-
return { blocks: serialized };
|
|
944
|
-
}
|
|
945
|
-
return { blocks: [] };
|
|
946
|
-
}
|
|
947
|
-
onRegisterBlock(async (_2, block) => {
|
|
948
|
-
if (block.locales == null || catalogs.value == null) return;
|
|
949
|
-
const localeAtLoadStart = locale.value;
|
|
950
|
-
let file = null;
|
|
951
|
-
try {
|
|
952
|
-
file = await block.locales.load(localeAtLoadStart);
|
|
953
|
-
} catch {
|
|
954
|
-
file = null;
|
|
955
|
-
}
|
|
956
|
-
if (catalogs.value == null || locale.value !== localeAtLoadStart) return;
|
|
957
|
-
const parsed = parseBlockLocaleFile(file);
|
|
958
|
-
const current = catalogs.value;
|
|
959
|
-
catalogs.value = {
|
|
960
|
-
...current,
|
|
961
|
-
blocks: {
|
|
962
|
-
...current.blocks,
|
|
963
|
-
defaults: {
|
|
964
|
-
...current.blocks.defaults,
|
|
965
|
-
[block.name]: parsed.defaults
|
|
966
|
-
},
|
|
967
|
-
modes: {
|
|
968
|
-
...current.blocks.modes,
|
|
969
|
-
[block.name]: parsed.modes
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
});
|
|
974
|
-
(_a = deps.routerService) == null ? void 0 : _a.subscribe(({ path }) => {
|
|
975
|
-
resolve("page", path);
|
|
976
|
-
});
|
|
977
|
-
return {
|
|
978
|
-
page: surfaces.page,
|
|
979
|
-
overlay: surfaces.overlay,
|
|
980
|
-
locales: { locale, catalogs, setLocale },
|
|
981
|
-
globalStyles,
|
|
982
|
-
setGlobalStyles,
|
|
983
|
-
resolve
|
|
984
|
-
};
|
|
985
|
-
}
|
|
986
825
|
export {
|
|
987
826
|
BlockWrapperEvent as B,
|
|
988
827
|
ContextProvideEvent as C,
|
|
989
|
-
DEFAULT_GLOBAL_STYLES as D,
|
|
990
828
|
E,
|
|
991
829
|
SelectedBlockContext as S,
|
|
992
|
-
ThemeStateContext as T,
|
|
993
830
|
ContextRequestEvent as a,
|
|
994
|
-
|
|
831
|
+
attachEmptyTracking as b,
|
|
995
832
|
createContext as c,
|
|
996
833
|
d,
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
834
|
+
backfillInstanceDefaults as e,
|
|
835
|
+
createBlockInstance as f,
|
|
836
|
+
createBlockInstanceFromJSON as g,
|
|
837
|
+
createBlockInstanceFromObject as h,
|
|
838
|
+
createCeRenderer as i,
|
|
839
|
+
createSelectedBlock as j,
|
|
1003
840
|
defineBlock as k,
|
|
1004
841
|
defineBlockRuntime as l,
|
|
1005
842
|
getDefinedBlocks as m,
|
|
1006
|
-
|
|
843
|
+
hasRenderedContent as n,
|
|
1007
844
|
injectContext as o,
|
|
1008
845
|
isStubDefinition as p,
|
|
1009
846
|
onRegisterBlock as q,
|
package/dist/block.d.ts
CHANGED
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
import { JSONSchema } from 'json-schema-to-ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if `scope` has at least one visible direct element child.
|
|
4
|
+
* "Visible" follows the platform's `Element.checkVisibility()` rule
|
|
5
|
+
* (not `display: none`, not `visibility: hidden`, not `[hidden]`).
|
|
6
|
+
*
|
|
7
|
+
* Direct children that are themselves `display: contents` are traversed
|
|
8
|
+
* transparently — those elements generate no box of their own, so their
|
|
9
|
+
* own children are what the browser actually paints in the parent's flow.
|
|
10
|
+
* This matches the platform's rendering model: framework-injected
|
|
11
|
+
* `display: contents` wrappers (e.g. `<ContextProvider>`) don't make
|
|
12
|
+
* their host scope falsely appear non-empty.
|
|
13
|
+
*
|
|
14
|
+
* UA-default `display: none` on `<style>` / `<script>` / `<template>` /
|
|
15
|
+
* `<link>` / `<meta>` / `<noscript>` means those never count.
|
|
16
|
+
*
|
|
17
|
+
* Authoring convention: blocks that may render nothing must do so via
|
|
18
|
+
* `v-if`, `v-show`, or `hidden` on the template root — an always-rendered
|
|
19
|
+
* empty wrapper element (with any `display` other than `contents`) will
|
|
20
|
+
* be reported as non-empty.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasRenderedContent(scope: ParentNode): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Wire `data-empty` tracking on a block host element.
|
|
25
|
+
*
|
|
26
|
+
* - host: the element on which to toggle `data-empty`.
|
|
27
|
+
* - scope: optional override for what to observe. If omitted, the
|
|
28
|
+
* helper picks `host.shadowRoot ?? host` lazily inside its deferred
|
|
29
|
+
* setup — so CE hosts whose shadow root is attached in
|
|
30
|
+
* connectedCallback (Preact/React) are observed correctly.
|
|
31
|
+
*
|
|
32
|
+
* Behavior:
|
|
33
|
+
* - Defers initial observe+sync via `queueMicrotask`. The microtask
|
|
34
|
+
* fires after the current synchronous task completes, which is
|
|
35
|
+
* after the caller (e.g. ExtensionRoot) has appended the host
|
|
36
|
+
* and any CE's connectedCallback has run.
|
|
37
|
+
* - Uses `MutationObserver` with `{ childList: true, subtree: true }`.
|
|
38
|
+
* - Sets/removes the `data-empty` attribute as a boolean attribute
|
|
39
|
+
* (no value).
|
|
40
|
+
*
|
|
41
|
+
* Returns a teardown function that disconnects the observer.
|
|
42
|
+
*/
|
|
43
|
+
export declare function attachEmptyTracking(host: HTMLElement, scope?: ParentNode): () => void;
|
|
2
44
|
type Schema = {} | (JSONSchema & {
|
|
3
45
|
type: "object";
|
|
4
46
|
});
|
|
@@ -87,7 +129,7 @@ export declare function defineBlockRuntime<T = never>(name: string, opts: {
|
|
|
87
129
|
renderer: (block: BlockInstance) => HTMLElement;
|
|
88
130
|
}): BlockDefinition<T>;
|
|
89
131
|
export declare function getDefinedBlocks(): BlockDefinition[];
|
|
90
|
-
export declare function createCeRenderer(name: string): (block: BlockInstance) =>
|
|
132
|
+
export declare function createCeRenderer(name: string): (block: BlockInstance) => HTMLElement;
|
|
91
133
|
export declare function isStubDefinition(definition: BlockDefinition): boolean;
|
|
92
134
|
/**
|
|
93
135
|
* Backfill an empty block instance with `props`/`slots` defaults sourced
|
package/dist/block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../src/block.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,KAAK,MAAM,GAAG,EAAE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IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAAC;CACjD,GACA,eAAe,CAAC,CAAC,CAAC,CAYpB;AAED,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAEpD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,WA+C5B,aAAa,iBAoB7B;AAwCD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAErE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CA6BtE;AAWD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C,aAAa,CA2Cf;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAczE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAUxE"}
|
package/dist/core.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { c as createContext, d, w, r as registerBlock, E, u } from "./
|
|
5
|
-
import { B, C, a,
|
|
6
|
-
import {
|
|
4
|
+
import { c as createContext, d, w, r as registerBlock, E, u } from "./block-C8lPBCF8.js";
|
|
5
|
+
import { B, C, a, S, b, e, f, g, h, i, j, k, l, m, n, o, p, q, s, t, v, x, y } from "./block-C8lPBCF8.js";
|
|
6
|
+
import { D, T, c, i as i2 } from "./theme-state-LZS5T-Xb.js";
|
|
7
|
+
import { T as T2, W, c as c2, a as a2, b as b2, g as g2, h as h2 } from "./juo-workflow-Dqr1lB1k.js";
|
|
7
8
|
import { reportBlockWarning, reportBlockError } from "./observability.js";
|
|
8
9
|
function createState() {
|
|
9
10
|
const discountCode = d(null);
|
|
@@ -177,7 +178,7 @@ const PARAMS = {
|
|
|
177
178
|
function uuid() {
|
|
178
179
|
return ("10000000-1000-4000-8000" + -1e11).replace(
|
|
179
180
|
/[018]/g,
|
|
180
|
-
(
|
|
181
|
+
(c3) => (c3 ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c3 / 4).toString(16)
|
|
181
182
|
);
|
|
182
183
|
}
|
|
183
184
|
var AuthenticationErrorReason = /* @__PURE__ */ ((AuthenticationErrorReason2) => {
|
|
@@ -1318,12 +1319,13 @@ export {
|
|
|
1318
1319
|
T as ThemeStateContext,
|
|
1319
1320
|
T2 as TranslationContext,
|
|
1320
1321
|
W as WorkflowServiceContext,
|
|
1321
|
-
b as
|
|
1322
|
+
b as attachEmptyTracking,
|
|
1323
|
+
e as backfillInstanceDefaults,
|
|
1322
1324
|
w as computed,
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1325
|
+
f as createBlockInstance,
|
|
1326
|
+
g as createBlockInstanceFromJSON,
|
|
1327
|
+
h as createBlockInstanceFromObject,
|
|
1328
|
+
i as createCeRenderer,
|
|
1327
1329
|
createContext,
|
|
1328
1330
|
createCustomerService,
|
|
1329
1331
|
createMockProductAdapter,
|
|
@@ -1332,11 +1334,11 @@ export {
|
|
|
1332
1334
|
createMockWorkflowApiAdapter,
|
|
1333
1335
|
createProductService,
|
|
1334
1336
|
createRouterService,
|
|
1335
|
-
|
|
1337
|
+
j as createSelectedBlock,
|
|
1336
1338
|
createState,
|
|
1337
1339
|
createSubscriptionService,
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
+
c as createThemeState,
|
|
1341
|
+
c2 as createTranslationService,
|
|
1340
1342
|
a2 as createWorkflowApiAdapter,
|
|
1341
1343
|
b2 as createWorkflowService,
|
|
1342
1344
|
k as defineBlock,
|
|
@@ -1345,7 +1347,8 @@ export {
|
|
|
1345
1347
|
g2 as getDefaultBlockForAction,
|
|
1346
1348
|
m as getDefinedBlocks,
|
|
1347
1349
|
h2 as hasDefaultBlockForAction,
|
|
1348
|
-
n as
|
|
1350
|
+
n as hasRenderedContent,
|
|
1351
|
+
i2 as indexOverrides,
|
|
1349
1352
|
o as injectContext,
|
|
1350
1353
|
p as isStubDefinition,
|
|
1351
1354
|
loadBlockRegistry,
|
|
@@ -6,11 +6,18 @@ export declare class BlockWrapper extends HTMLElement {
|
|
|
6
6
|
private menuElement;
|
|
7
7
|
private isMenuOpen;
|
|
8
8
|
private closeMenuOnOutsideClick;
|
|
9
|
+
private emptyObserver;
|
|
9
10
|
static get observedAttributes(): string[];
|
|
10
11
|
constructor();
|
|
11
12
|
private setupStyles;
|
|
12
13
|
private setupTemplate;
|
|
13
14
|
connectedCallback(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Mirror `data-empty` from the slotted block wrapper onto this editor
|
|
17
|
+
* wrapper so page-level divider CSS (and live-data preview) treat empty
|
|
18
|
+
* blocks the same as in view mode.
|
|
19
|
+
*/
|
|
20
|
+
private observeSlotEmptyState;
|
|
14
21
|
disconnectedCallback(): void;
|
|
15
22
|
private toggleMenu;
|
|
16
23
|
private openMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/editor/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAiQ9C,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,uBAAuB,CAA0C;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/editor/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAiQ9C,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,uBAAuB,CAA0C;IACzE,OAAO,CAAC,aAAa,CAAiC;IAEtD,MAAM,KAAK,kBAAkB,aAE5B;;IASD,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;IAiFrB,iBAAiB;IAiCjB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAqC7B,oBAAoB;IAYpB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,SAAS;IAWjB,QAAQ,CAAC,KAAK,EAAE,aAAa;IAQ7B,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,iBAAiB;CAmD1B;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,0BAA0B,EAAE,YAAY,CAAC;KAC1C;CACF"}
|
package/dist/editor.js
CHANGED
|
@@ -4,7 +4,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import { onRegisterBlock, getDefinedBlocks } from "@juo/blocks";
|
|
5
5
|
import { a as createEditorBridge, f as createRemoveBlockMessage, g as createRegisterBlocksMessage, h as createRegisterRoutesMessage } from "./bridge-DAUIcGuq.js";
|
|
6
6
|
import { i, b, j, k, l, m, n, c, o, p, q, r, s, e, t, u, v, w, d, x, y, z, A } from "./bridge-DAUIcGuq.js";
|
|
7
|
-
import {
|
|
7
|
+
import { h as createBlockInstanceFromObject } from "./block-C8lPBCF8.js";
|
|
8
|
+
import { i as indexOverrides } from "./theme-state-LZS5T-Xb.js";
|
|
8
9
|
function createEditorHandler(options) {
|
|
9
10
|
const { themeState, onBlockSelection } = options;
|
|
10
11
|
const blockSurfaceIndex = /* @__PURE__ */ new Map();
|
|
@@ -549,6 +550,7 @@ class BlockWrapper extends HTMLElement {
|
|
|
549
550
|
__publicField(this, "menuElement", null);
|
|
550
551
|
__publicField(this, "isMenuOpen", false);
|
|
551
552
|
__publicField(this, "closeMenuOnOutsideClick", null);
|
|
553
|
+
__publicField(this, "emptyObserver", null);
|
|
552
554
|
this.attachShadow({ mode: "open" });
|
|
553
555
|
this.setupStyles();
|
|
554
556
|
this.setupTemplate();
|
|
@@ -648,8 +650,50 @@ class BlockWrapper extends HTMLElement {
|
|
|
648
650
|
if (isWorkflowPreview && !isInOverlay) {
|
|
649
651
|
this.style.pointerEvents = "none";
|
|
650
652
|
}
|
|
653
|
+
this.observeSlotEmptyState();
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Mirror `data-empty` from the slotted block wrapper onto this editor
|
|
657
|
+
* wrapper so page-level divider CSS (and live-data preview) treat empty
|
|
658
|
+
* blocks the same as in view mode.
|
|
659
|
+
*/
|
|
660
|
+
observeSlotEmptyState() {
|
|
661
|
+
var _a;
|
|
662
|
+
(_a = this.emptyObserver) == null ? void 0 : _a.disconnect();
|
|
663
|
+
const sync = () => {
|
|
664
|
+
const slotted = this.firstElementChild;
|
|
665
|
+
const empty = slotted == null || slotted.hasAttribute("data-empty");
|
|
666
|
+
this.toggleAttribute("data-empty", empty);
|
|
667
|
+
};
|
|
668
|
+
const bindObservers = () => {
|
|
669
|
+
this.emptyObserver.observe(this, { childList: true });
|
|
670
|
+
const slotted = this.firstElementChild;
|
|
671
|
+
if (slotted) {
|
|
672
|
+
this.emptyObserver.observe(slotted, {
|
|
673
|
+
attributes: true,
|
|
674
|
+
attributeFilter: ["data-empty"]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
sync();
|
|
679
|
+
this.emptyObserver = new MutationObserver((records) => {
|
|
680
|
+
const slottedChildChanged = records.some(
|
|
681
|
+
(record) => record.type === "childList" && record.target === this
|
|
682
|
+
);
|
|
683
|
+
if (slottedChildChanged) {
|
|
684
|
+
this.emptyObserver.disconnect();
|
|
685
|
+
sync();
|
|
686
|
+
bindObservers();
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
sync();
|
|
690
|
+
});
|
|
691
|
+
bindObservers();
|
|
651
692
|
}
|
|
652
693
|
disconnectedCallback() {
|
|
694
|
+
var _a;
|
|
695
|
+
(_a = this.emptyObserver) == null ? void 0 : _a.disconnect();
|
|
696
|
+
this.emptyObserver = null;
|
|
653
697
|
this.closeMenu();
|
|
654
698
|
}
|
|
655
699
|
toggleMenu() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowService.d.ts","sourceRoot":"","sources":["../../src/flows/WorkflowService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAS5C,eAAO,MAAM,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"WorkflowService.d.ts","sourceRoot":"","sources":["../../src/flows/WorkflowService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAS5C,eAAO,MAAM,sBAAsB;;eA6jBd,cAAc,CAAC,aAAa,CAAC;QAE9C;qFAC6E;;;;;;;;;4BAcjE,MAAM,WACP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eACnB,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;8BA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EAAE,OAAO,CAAC,EACtC,kBAAkB,CAAC,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,GAAG,CAAC;CACX,GAAG,kBAAkB,CAgDrB;AAMD,MAAM,WAAW,2BAA2B;IAC1C,iDAAiD;IACjD,GAAG,EAAE,kBAAkB,CAAC;IACxB,4DAA4D;IAC5D,UAAU,EAAE,UAAU,CAAC;IACvB,kHAAkH;IAClH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,2BAA2B;WA2VlD,cAAc,CAAC,aAAa,CAAC;IAE9C;iFAC6E;;;;;;;;;wBAcjE,MAAM,WACP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eACnB,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;0BAyDA,MAAM,iBACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC;cAgCA,OAAO,CAAC,IAAI,CAAC;aA4CpB,IAAI;eAqBI,OAAO,CAAC,IAAI,CAAC;EAsBjC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { c as createContext, d, E, m as getDefinedBlocks,
|
|
4
|
+
import { c as createContext, d, E, m as getDefinedBlocks, f as createBlockInstance, w, r as registerBlock, k as defineBlock, v as subscribeContext } from "./block-C8lPBCF8.js";
|
|
5
5
|
import { a as createEditorBridge, e as createSelectBlockMessage } from "./bridge-DAUIcGuq.js";
|
|
6
6
|
const TranslationContext = createContext("translation");
|
|
7
7
|
function toStringRecord(input) {
|
|
@@ -179,7 +179,7 @@ function createWorkflowService(deps) {
|
|
|
179
179
|
return `wf-${shortenId(workflowId)}-${shortenId(stepId)}`;
|
|
180
180
|
}
|
|
181
181
|
function handleFlowResponse(data) {
|
|
182
|
-
var _a, _b, _c, _d, _e, _f;
|
|
182
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
183
183
|
const mergedInvalidated = [
|
|
184
184
|
..._state.value.invalidatedResources,
|
|
185
185
|
...data.invalidatedResources ?? []
|
|
@@ -187,6 +187,7 @@ function createWorkflowService(deps) {
|
|
|
187
187
|
if (data.status === "waiting_interaction") {
|
|
188
188
|
const currentStepId = ((_a = data.pendingInteraction) == null ? void 0 : _a.stepId) ?? (isEditorMode ? (_c = (_b = data.interactiveSteps) == null ? void 0 : _b[0]) == null ? void 0 : _c.stepId : null);
|
|
189
189
|
_backendInteractionId.value = ((_d = data.pendingInteraction) == null ? void 0 : _d.interactionId) ?? null;
|
|
190
|
+
const isInitialResponse = _state.value.runId == null;
|
|
190
191
|
updateState({
|
|
191
192
|
status: "active",
|
|
192
193
|
workflowId: data.workflowId,
|
|
@@ -199,9 +200,10 @@ function createWorkflowService(deps) {
|
|
|
199
200
|
outcome: null
|
|
200
201
|
});
|
|
201
202
|
if (editor.isEditorMode) {
|
|
203
|
+
const displayStepId = isInitialResponse && previewStepId && ((_e = data.interactiveSteps) == null ? void 0 : _e.some((s) => s.stepId === previewStepId)) ? previewStepId : currentStepId;
|
|
202
204
|
const overlayBlocks = deps.themeState.overlay.blocks.value;
|
|
203
205
|
const rootBlock = overlayBlocks[0];
|
|
204
|
-
const stepSlot =
|
|
206
|
+
const stepSlot = displayStepId ? (_f = rootBlock == null ? void 0 : rootBlock.slots) == null ? void 0 : _f[displayStepId] : null;
|
|
205
207
|
const stepBlock = Array.isArray(stepSlot) ? stepSlot[0] : null;
|
|
206
208
|
const blockId = stepBlock && typeof stepBlock === "object" && "id" in stepBlock ? stepBlock.id : null;
|
|
207
209
|
if (blockId) {
|
|
@@ -224,7 +226,7 @@ function createWorkflowService(deps) {
|
|
|
224
226
|
});
|
|
225
227
|
} else if (data.status === "failed") {
|
|
226
228
|
_backendInteractionId.value = null;
|
|
227
|
-
handleError(new Error(((
|
|
229
|
+
handleError(new Error(((_g = data.error) == null ? void 0 : _g.message) || "Flow failed"));
|
|
228
230
|
} else if (data.status === "cancelled") {
|
|
229
231
|
_backendInteractionId.value = null;
|
|
230
232
|
updateState({
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { Block, BlockInstance, BlockDefinition, BlockLocaleFile, BlockRenderer, BlockPreset, BlockPresets, } from './block';
|
|
2
|
-
export { backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, } from './block';
|
|
2
|
+
export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, } from './block';
|
|
3
3
|
export { ThemeStateContext, createThemeState, indexOverrides, type TranslationCatalogs, type TranslationMode, type TranslationScope, type TranslationOverride, type ThemeLocaleState, type ThemeState, type ThemeSurface, type ThemeSurfaceState, type GlobalStyles, type GlobalStyleColors, type ThemeType, DEFAULT_GLOBAL_STYLES, } from './theme-state';
|
|
4
4
|
export { TranslationContext, createTranslationService, type TranslationServiceOptions, type TranslationService, } from './translation';
|
|
5
5
|
export { ContextRequestEvent, ContextProvideEvent, type ContextCallback, createContext, injectContext, provideContext, subscribeContext, type ContextType, type UnknownContext, } from './context';
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/preact/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyBjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAC1C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/preact/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyBjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAC1C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAmCvC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAC5C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAoEvC"}
|
package/dist/preact.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { effect, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
|
|
4
|
+
import { effect, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
5
5
|
import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from "preact/hooks";
|
|
6
6
|
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
|
|
7
7
|
import { t } from "./block-VhmfGB3N.js";
|
|
@@ -121,6 +121,7 @@ function createPreactRenderer(component) {
|
|
|
121
121
|
return (block) => {
|
|
122
122
|
const wrapper = document.createElement("div");
|
|
123
123
|
wrapper.setAttribute("data-block-id", block.id);
|
|
124
|
+
wrapper.setAttribute("data-block-type", block.type);
|
|
124
125
|
render(
|
|
125
126
|
h(ContextProvider, {
|
|
126
127
|
children: h(
|
|
@@ -130,6 +131,7 @@ function createPreactRenderer(component) {
|
|
|
130
131
|
}),
|
|
131
132
|
wrapper
|
|
132
133
|
);
|
|
134
|
+
attachEmptyTracking(wrapper);
|
|
133
135
|
return wrapper;
|
|
134
136
|
};
|
|
135
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/react/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuBjD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,GAAG,EACzC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAChC,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/react/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuBjD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,GAAG,EACzC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAChC,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAmCvC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,GAAG,EAC3C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAyEvC"}
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { effect, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
|
|
4
|
+
import { effect, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
5
5
|
import React, { useSyncExternalStore, createContext, useState, useContext as useContext$1, useMemo, useRef, useEffect } from "react";
|
|
6
6
|
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
|
|
7
7
|
import { t } from "./block-VhmfGB3N.js";
|
|
@@ -103,6 +103,7 @@ function createReactRenderer(component) {
|
|
|
103
103
|
return (block) => {
|
|
104
104
|
const wrapper = document.createElement("div");
|
|
105
105
|
wrapper.setAttribute("data-block-id", block.id);
|
|
106
|
+
wrapper.setAttribute("data-block-type", block.type);
|
|
106
107
|
const root = createRoot(wrapper);
|
|
107
108
|
root.render(
|
|
108
109
|
React.createElement(ContextProvider, {
|
|
@@ -112,6 +113,7 @@ function createReactRenderer(component) {
|
|
|
112
113
|
)
|
|
113
114
|
})
|
|
114
115
|
);
|
|
116
|
+
attachEmptyTracking(wrapper);
|
|
115
117
|
return wrapper;
|
|
116
118
|
};
|
|
117
119
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { c as createContext, d, h as createBlockInstanceFromObject, m as getDefinedBlocks, f as createBlockInstance, t as serializeBlocks, q as onRegisterBlock } from "./block-C8lPBCF8.js";
|
|
2
|
+
import { reportBlockError } from "./observability.js";
|
|
3
|
+
const DEFAULT_GLOBAL_STYLES = {
|
|
4
|
+
volume: "comfort",
|
|
5
|
+
style: "ghost",
|
|
6
|
+
corners: "round",
|
|
7
|
+
buttonCorners: "round",
|
|
8
|
+
thumbnailCorners: "circle",
|
|
9
|
+
theme: "preset",
|
|
10
|
+
themeType: "neutral",
|
|
11
|
+
colors: {
|
|
12
|
+
accent: "#000000",
|
|
13
|
+
secondary: "#000000",
|
|
14
|
+
tint: "#111111",
|
|
15
|
+
callout: "#F5F5F5",
|
|
16
|
+
success: "#287a25",
|
|
17
|
+
error: "#a93c3c",
|
|
18
|
+
information: "#0075a3",
|
|
19
|
+
warning: "#8a5e00",
|
|
20
|
+
background: "#FFFFFF"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const ThemeStateContext = createContext("theme-state");
|
|
24
|
+
function normalizeLocale(locale) {
|
|
25
|
+
return locale.trim().toLowerCase().split("-")[0] || "en";
|
|
26
|
+
}
|
|
27
|
+
function toStringRecord(input) {
|
|
28
|
+
if (input == null) return {};
|
|
29
|
+
return Object.fromEntries(
|
|
30
|
+
Object.entries(input).filter(([, value]) => typeof value === "string")
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function parseBlockLocaleFile(file) {
|
|
34
|
+
if (file == null) {
|
|
35
|
+
return { defaults: {}, modes: {} };
|
|
36
|
+
}
|
|
37
|
+
const entries = Object.entries(file).filter(
|
|
38
|
+
([key, value]) => key !== "overrides" && typeof value === "string"
|
|
39
|
+
);
|
|
40
|
+
const topLevel = Object.fromEntries(entries);
|
|
41
|
+
const overrides = toStringRecord(file.overrides);
|
|
42
|
+
return {
|
|
43
|
+
defaults: { ...topLevel, ...overrides },
|
|
44
|
+
modes: {
|
|
45
|
+
...Object.fromEntries(
|
|
46
|
+
Object.keys(topLevel).map((key) => [key, "default"])
|
|
47
|
+
),
|
|
48
|
+
...Object.fromEntries(
|
|
49
|
+
Object.keys(overrides).map((key) => [key, "override"])
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function indexOverrides(overrides) {
|
|
55
|
+
const indexed = {
|
|
56
|
+
theme: {},
|
|
57
|
+
blocks: {}
|
|
58
|
+
};
|
|
59
|
+
for (const item of overrides) {
|
|
60
|
+
if (item.scope.kind === "theme") {
|
|
61
|
+
indexed.theme[item.key] = item.value;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (indexed.blocks[item.scope.blockId] == null) {
|
|
65
|
+
indexed.blocks[item.scope.blockId] = {};
|
|
66
|
+
}
|
|
67
|
+
indexed.blocks[item.scope.blockId][item.key] = item.value;
|
|
68
|
+
}
|
|
69
|
+
return indexed;
|
|
70
|
+
}
|
|
71
|
+
function createThemeState(deps) {
|
|
72
|
+
var _a;
|
|
73
|
+
const surfaces = {
|
|
74
|
+
page: { blocks: d([]) },
|
|
75
|
+
overlay: { blocks: d([]) }
|
|
76
|
+
};
|
|
77
|
+
const locale = d("en");
|
|
78
|
+
const catalogs = d(null);
|
|
79
|
+
const globalStyles = d(
|
|
80
|
+
deps.initialGlobalStyles ?? DEFAULT_GLOBAL_STYLES
|
|
81
|
+
);
|
|
82
|
+
function setGlobalStyles(styles) {
|
|
83
|
+
globalStyles.value = styles;
|
|
84
|
+
}
|
|
85
|
+
async function collectBlockDefaults(loc) {
|
|
86
|
+
const nextDefaults = {};
|
|
87
|
+
const nextModes = {};
|
|
88
|
+
for (const block of getDefinedBlocks()) {
|
|
89
|
+
if (block.locales == null) continue;
|
|
90
|
+
let file = null;
|
|
91
|
+
try {
|
|
92
|
+
file = await block.locales.load(loc);
|
|
93
|
+
} catch {
|
|
94
|
+
file = null;
|
|
95
|
+
}
|
|
96
|
+
const parsed = parseBlockLocaleFile(file);
|
|
97
|
+
nextDefaults[block.name] = parsed.defaults;
|
|
98
|
+
nextModes[block.name] = parsed.modes;
|
|
99
|
+
}
|
|
100
|
+
return { defaults: nextDefaults, modes: nextModes };
|
|
101
|
+
}
|
|
102
|
+
async function setLocale(nextLocaleRaw) {
|
|
103
|
+
var _a2;
|
|
104
|
+
const nextLocale = normalizeLocale(nextLocaleRaw);
|
|
105
|
+
const [blockData, loadedOverrides] = await Promise.all([
|
|
106
|
+
collectBlockDefaults(nextLocale),
|
|
107
|
+
((_a2 = deps.translations) == null ? void 0 : _a2.resolveTranslations(nextLocale).catch(() => [])) ?? Promise.resolve([])
|
|
108
|
+
]);
|
|
109
|
+
const overrides = loadedOverrides.filter(
|
|
110
|
+
(item) => normalizeLocale(item.locale) === nextLocale
|
|
111
|
+
);
|
|
112
|
+
const indexed = indexOverrides(overrides);
|
|
113
|
+
catalogs.value = {
|
|
114
|
+
theme: {
|
|
115
|
+
defaults: {},
|
|
116
|
+
overrides: indexed.theme
|
|
117
|
+
},
|
|
118
|
+
blocks: {
|
|
119
|
+
defaults: blockData.defaults,
|
|
120
|
+
modes: blockData.modes,
|
|
121
|
+
overrides: indexed.blocks
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
locale.value = nextLocale;
|
|
125
|
+
}
|
|
126
|
+
async function resolve(surface, path) {
|
|
127
|
+
var _a2, _b, _c, _d;
|
|
128
|
+
surfaces[surface].blocks.value = [];
|
|
129
|
+
const stored = await deps.resolve(surface, path);
|
|
130
|
+
if (stored != null) {
|
|
131
|
+
surfaces[surface].blocks.value = stored.blocks.flatMap((block) => {
|
|
132
|
+
try {
|
|
133
|
+
return [createBlockInstanceFromObject(block)];
|
|
134
|
+
} catch (error) {
|
|
135
|
+
reportBlockError(error, {
|
|
136
|
+
site: "theme-state.resolve.hydrate",
|
|
137
|
+
extra: {
|
|
138
|
+
surface,
|
|
139
|
+
path,
|
|
140
|
+
blockType: typeof (block == null ? void 0 : block.type) === "string" ? block.type : "(unknown)"
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return stored;
|
|
147
|
+
}
|
|
148
|
+
const blockToUse = surface === "page" ? (_b = (_a2 = deps.routerService) == null ? void 0 : _a2.getPages().find((p) => p.path === path)) == null ? void 0 : _b.block : (_c = getDefinedBlocks().find((b) => b.name === path)) == null ? void 0 : _c.name;
|
|
149
|
+
if (blockToUse != null) {
|
|
150
|
+
const instance = createBlockInstance(blockToUse);
|
|
151
|
+
surfaces[surface].blocks.value = [instance];
|
|
152
|
+
const serialized = serializeBlocks([instance]);
|
|
153
|
+
(_d = deps.upsertState) == null ? void 0 : _d.call(deps, surface, path, serialized);
|
|
154
|
+
return { blocks: serialized };
|
|
155
|
+
}
|
|
156
|
+
return { blocks: [] };
|
|
157
|
+
}
|
|
158
|
+
onRegisterBlock(async (_, block) => {
|
|
159
|
+
if (block.locales == null || catalogs.value == null) return;
|
|
160
|
+
const localeAtLoadStart = locale.value;
|
|
161
|
+
let file = null;
|
|
162
|
+
try {
|
|
163
|
+
file = await block.locales.load(localeAtLoadStart);
|
|
164
|
+
} catch {
|
|
165
|
+
file = null;
|
|
166
|
+
}
|
|
167
|
+
if (catalogs.value == null || locale.value !== localeAtLoadStart) return;
|
|
168
|
+
const parsed = parseBlockLocaleFile(file);
|
|
169
|
+
const current = catalogs.value;
|
|
170
|
+
catalogs.value = {
|
|
171
|
+
...current,
|
|
172
|
+
blocks: {
|
|
173
|
+
...current.blocks,
|
|
174
|
+
defaults: {
|
|
175
|
+
...current.blocks.defaults,
|
|
176
|
+
[block.name]: parsed.defaults
|
|
177
|
+
},
|
|
178
|
+
modes: {
|
|
179
|
+
...current.blocks.modes,
|
|
180
|
+
[block.name]: parsed.modes
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
(_a = deps.routerService) == null ? void 0 : _a.subscribe(({ path }) => {
|
|
186
|
+
resolve("page", path);
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
page: surfaces.page,
|
|
190
|
+
overlay: surfaces.overlay,
|
|
191
|
+
locales: { locale, catalogs, setLocale },
|
|
192
|
+
globalStyles,
|
|
193
|
+
setGlobalStyles,
|
|
194
|
+
resolve
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
DEFAULT_GLOBAL_STYLES as D,
|
|
199
|
+
ThemeStateContext as T,
|
|
200
|
+
createThemeState as c,
|
|
201
|
+
indexOverrides as i
|
|
202
|
+
};
|
package/dist/vue/block.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { App, Component } from 'vue';
|
|
2
2
|
import { BlockInstance } from '../main.ts';
|
|
3
|
+
export { hasRenderedContent } from '../block';
|
|
3
4
|
export declare function createVueRenderer(component: Component, options?: {
|
|
4
5
|
hostApp?: App;
|
|
5
6
|
}): (block: BlockInstance) => HTMLElement;
|
|
6
7
|
export declare function createVueCeRenderer(name: string, component: Component, { shadowRoot }?: {
|
|
7
8
|
shadowRoot?: boolean;
|
|
8
|
-
}): (block: BlockInstance) =>
|
|
9
|
+
}): (block: BlockInstance) => HTMLElement;
|
|
9
10
|
//# sourceMappingURL=block.d.ts.map
|
package/dist/vue/block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAK9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA2B9C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,WAuCZ,aAAa,iBA6D7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,yCAoCrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../../src/vue/setupTests.ts"],"names":[],"mappings":""}
|
package/dist/vue.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
|
|
2
2
|
import { effect, signal, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
|
|
3
|
+
import { b as attachEmptyTracking } from "./block-C8lPBCF8.js";
|
|
4
|
+
import { n } from "./block-C8lPBCF8.js";
|
|
3
5
|
import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-DAUIcGuq.js";
|
|
4
6
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
5
7
|
function toSignal(ref2) {
|
|
@@ -207,13 +209,15 @@ function createVueRenderer(component, options) {
|
|
|
207
209
|
if (!existing) {
|
|
208
210
|
wrapper.setAttribute("data-block-id", block.id);
|
|
209
211
|
wrapper.setAttribute("data-block-type", block.type);
|
|
210
|
-
wrapper.style.display = "contents";
|
|
211
212
|
}
|
|
212
213
|
const vnode = h(Root);
|
|
213
214
|
if (options == null ? void 0 : options.hostApp) {
|
|
214
215
|
vnode.appContext = options.hostApp._context;
|
|
215
216
|
}
|
|
216
217
|
render(vnode, wrapper);
|
|
218
|
+
if (!existing) {
|
|
219
|
+
attachEmptyTracking(wrapper);
|
|
220
|
+
}
|
|
217
221
|
cache.set(block.id, { wrapper, propsRef, slotsRef, parentInstance });
|
|
218
222
|
return wrapper;
|
|
219
223
|
};
|
|
@@ -286,6 +290,7 @@ export {
|
|
|
286
290
|
ContextProvider,
|
|
287
291
|
createVueCeRenderer,
|
|
288
292
|
createVueRenderer,
|
|
293
|
+
n as hasRenderedContent,
|
|
289
294
|
toRef,
|
|
290
295
|
toSignal,
|
|
291
296
|
useBlockId,
|
|
@@ -6,6 +6,7 @@ export default class InlineText extends HTMLElement {
|
|
|
6
6
|
private blockType;
|
|
7
7
|
private boundHandleBlur;
|
|
8
8
|
private boundHandlePointerDown;
|
|
9
|
+
private boundHandleClick;
|
|
9
10
|
private lastValue;
|
|
10
11
|
private dispose?;
|
|
11
12
|
static get observedAttributes(): string[];
|
|
@@ -14,6 +15,7 @@ export default class InlineText extends HTMLElement {
|
|
|
14
15
|
private get isReadonly();
|
|
15
16
|
private initializeEditorMode;
|
|
16
17
|
private handlePointerDown;
|
|
18
|
+
private handleClick;
|
|
17
19
|
private handleBlur;
|
|
18
20
|
private static injectedRoots;
|
|
19
21
|
private injectStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IAiD5B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CASrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineText.test.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { o as injectContext, E, z as ContextRoot } from "./
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { o as injectContext, E, z as ContextRoot } from "./block-C8lPBCF8.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-CY2JksJh.js";
|
|
6
6
|
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-DAUIcGuq.js";
|
|
7
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
7
|
+
import { T as TranslationContext } from "./juo-workflow-Dqr1lB1k.js";
|
|
8
8
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
@@ -15,6 +15,7 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
15
15
|
__publicField(this, "blockType", null);
|
|
16
16
|
__publicField(this, "boundHandleBlur", this.handleBlur.bind(this));
|
|
17
17
|
__publicField(this, "boundHandlePointerDown", this.handlePointerDown.bind(this));
|
|
18
|
+
__publicField(this, "boundHandleClick", this.handleClick.bind(this));
|
|
18
19
|
__publicField(this, "lastValue", null);
|
|
19
20
|
__publicField(this, "dispose");
|
|
20
21
|
}
|
|
@@ -75,6 +76,7 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
75
76
|
}
|
|
76
77
|
this.addEventListener("blur", this.boundHandleBlur);
|
|
77
78
|
this.addEventListener("pointerdown", this.boundHandlePointerDown);
|
|
79
|
+
this.addEventListener("click", this.boundHandleClick);
|
|
78
80
|
this.lastValue = this.textContent || "";
|
|
79
81
|
if (this.translationService && this.propName && this.blockType && this.blockId) {
|
|
80
82
|
const key = this.propName;
|
|
@@ -91,9 +93,10 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
handlePointerDown() {
|
|
96
|
+
handlePointerDown(event) {
|
|
95
97
|
if (this.isReadonly) return;
|
|
96
98
|
if (this.contentEditable === "plaintext-only") return;
|
|
99
|
+
event.stopPropagation();
|
|
97
100
|
if (this.editorBridge && this.blockId && this.propName) {
|
|
98
101
|
this.editorBridge.sendMessage(
|
|
99
102
|
createFocusInlineTextMessage(
|
|
@@ -105,6 +108,10 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
105
108
|
this.textContent = this.lastValue ?? "";
|
|
106
109
|
this.contentEditable = "plaintext-only";
|
|
107
110
|
}
|
|
111
|
+
handleClick(event) {
|
|
112
|
+
if (this.isReadonly) return;
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
}
|
|
108
115
|
handleBlur() {
|
|
109
116
|
this.contentEditable = "false";
|
|
110
117
|
this.sendUpdate();
|
|
@@ -123,6 +130,9 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
123
130
|
juo-text:focus {
|
|
124
131
|
outline-color: #717171 !important;
|
|
125
132
|
}
|
|
133
|
+
:is(button, a):has(juo-text[contenteditable="plaintext-only"]):active {
|
|
134
|
+
transform: none !important;
|
|
135
|
+
}
|
|
126
136
|
`;
|
|
127
137
|
if (root instanceof ShadowRoot) {
|
|
128
138
|
root.appendChild(style);
|
|
@@ -162,6 +172,7 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
162
172
|
var _a;
|
|
163
173
|
this.removeEventListener("blur", this.boundHandleBlur);
|
|
164
174
|
this.removeEventListener("pointerdown", this.boundHandlePointerDown);
|
|
175
|
+
this.removeEventListener("click", this.boundHandleClick);
|
|
165
176
|
(_a = this.dispose) == null ? void 0 : _a.call(this);
|
|
166
177
|
this.dispose = void 0;
|
|
167
178
|
this.editorBridge = null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { o as injectContext, E, z as ContextRoot } from "./
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
6
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
4
|
+
import { o as injectContext, E, z as ContextRoot } from "./block-C8lPBCF8.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-CY2JksJh.js";
|
|
6
|
+
import { T as TranslationContext } from "./juo-workflow-Dqr1lB1k.js";
|
|
7
7
|
class InlineText extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|