@juo/blocks 1.4.1 → 1.4.3
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-M8g3HxCp.js → ExtensionRoot-B27vHVGI.js} +24 -10
- package/dist/block.d.ts +3 -1
- package/dist/block.d.ts.map +1 -1
- package/dist/core.js +22 -7
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor.js +1 -3
- package/dist/{juo-workflow-BJUBbrar.js → juo-workflow-BXGQS82N.js} +1 -1
- package/dist/observability.d.ts +21 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +1381 -0
- package/dist/observability.test.d.ts +2 -0
- package/dist/observability.test.d.ts.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.test.d.ts +2 -0
- package/dist/registry.test.d.ts.map +1 -0
- package/dist/{theme-state-wwW6UU3i.js → theme-state-BpmgtjdC.js} +77 -21
- package/dist/theme-state.d.ts.map +1 -1
- package/dist/theme-state.resolve.test.d.ts +2 -0
- package/dist/theme-state.resolve.test.d.ts.map +1 -0
- package/dist/vue/block.d.ts +4 -2
- package/dist/vue/block.d.ts.map +1 -1
- package/dist/vue/block.test.d.ts +2 -0
- package/dist/vue/block.test.d.ts.map +1 -0
- package/dist/vue.js +60 -16
- package/dist/web-components/Block.d.ts.map +1 -1
- package/dist/web-components/ExtensionRoot.d.ts +1 -0
- package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
- package/dist/web-components/ExtensionRoot.test.d.ts +2 -0
- package/dist/web-components/ExtensionRoot.test.d.ts.map +1 -0
- package/dist/web-components-editor.js +3 -3
- package/dist/web-components-runtime.js +3 -3
- package/package.json +7 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.test.d.ts","sourceRoot":"","sources":["../src/observability.test.ts"],"names":[],"mappings":""}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AA6BA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwB1E;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE;IACP,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACL,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../src/registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +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 { reportBlockError, reportBlockWarning } from "./observability.js";
|
|
4
5
|
const createContext = (key) => key;
|
|
5
6
|
class ContextRequestEvent extends Event {
|
|
6
7
|
constructor(context, callback, subscribe) {
|
|
@@ -528,7 +529,20 @@ function withWrapper(fn) {
|
|
|
528
529
|
let wrapper = null;
|
|
529
530
|
return (block) => {
|
|
530
531
|
var _a;
|
|
531
|
-
let rendered
|
|
532
|
+
let rendered;
|
|
533
|
+
try {
|
|
534
|
+
rendered = fn(block);
|
|
535
|
+
} catch (error) {
|
|
536
|
+
reportBlockError(error, {
|
|
537
|
+
site: "block.withWrapper",
|
|
538
|
+
block: { id: block.id, type: block.type, definition: block.definition },
|
|
539
|
+
keys: {
|
|
540
|
+
props: Object.keys(block.props ?? {}),
|
|
541
|
+
slots: Object.keys(block.slots ?? {})
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
rendered = createStubDefinition(block.type).render(block);
|
|
545
|
+
}
|
|
532
546
|
if (wrapper === null) {
|
|
533
547
|
if (isInEditorIframe()) {
|
|
534
548
|
wrapper = document.createElement("juo-editor-block-wrapper");
|
|
@@ -591,26 +605,39 @@ function createCeRenderer(name) {
|
|
|
591
605
|
}
|
|
592
606
|
return Object.entries(slots).flatMap(([key, value]) => {
|
|
593
607
|
const values = Array.isArray(value) ? value : [value];
|
|
594
|
-
return values.
|
|
608
|
+
return values.flatMap((value2) => {
|
|
595
609
|
if (typeof value2 === "string") {
|
|
596
|
-
const
|
|
610
|
+
const el = document.createElement("span");
|
|
597
611
|
if (key !== "default") {
|
|
598
|
-
|
|
612
|
+
el.slot = key;
|
|
599
613
|
}
|
|
600
|
-
|
|
601
|
-
return
|
|
614
|
+
el.innerText = value2;
|
|
615
|
+
return [el];
|
|
602
616
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
617
|
+
try {
|
|
618
|
+
const el = value2.definition.render({
|
|
619
|
+
...value2,
|
|
620
|
+
props: {
|
|
621
|
+
...value2.props,
|
|
622
|
+
parentProps: block.props
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
if (key !== "default") {
|
|
626
|
+
el.slot = key;
|
|
608
627
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
628
|
+
return [el];
|
|
629
|
+
} catch (error) {
|
|
630
|
+
reportBlockError(error, {
|
|
631
|
+
site: "block.createCeRenderer.renderSlots",
|
|
632
|
+
block: { id: value2.id, type: value2.type, definition: value2.definition },
|
|
633
|
+
extra: {
|
|
634
|
+
parentBlockId: block.id,
|
|
635
|
+
parentBlockType: block.type,
|
|
636
|
+
slotKey: key
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
return [];
|
|
612
640
|
}
|
|
613
|
-
return el;
|
|
614
641
|
});
|
|
615
642
|
});
|
|
616
643
|
}
|
|
@@ -651,6 +678,10 @@ function createStubDefinition(name) {
|
|
|
651
678
|
}
|
|
652
679
|
};
|
|
653
680
|
stubDefinitionCache.set(name, stub);
|
|
681
|
+
reportBlockWarning(`Block definition '${name}' not found`, {
|
|
682
|
+
site: "block.createStubDefinition",
|
|
683
|
+
block: { id: "(none)", type: name }
|
|
684
|
+
});
|
|
654
685
|
console.warn(
|
|
655
686
|
`[juo/blocks] Block definition '${name}' not found. This block may have been removed or renamed. Rendering a hidden stub.`
|
|
656
687
|
);
|
|
@@ -675,9 +706,14 @@ function createBlockInstance(name, opts) {
|
|
|
675
706
|
return value;
|
|
676
707
|
})();
|
|
677
708
|
if ((opts == null ? void 0 : opts.props) == null && initialValue == null) {
|
|
678
|
-
|
|
679
|
-
`Block '${name} cannot be created without value in runtime mode`
|
|
709
|
+
const error = new Error(
|
|
710
|
+
`Block '${name}' cannot be created without value in runtime mode`
|
|
680
711
|
);
|
|
712
|
+
reportBlockError(error, {
|
|
713
|
+
site: "block.createBlockInstance",
|
|
714
|
+
block: { id: "(none)", type: name }
|
|
715
|
+
});
|
|
716
|
+
throw error;
|
|
681
717
|
}
|
|
682
718
|
const slots = {
|
|
683
719
|
...initialValue.slots,
|
|
@@ -714,7 +750,15 @@ function createBlockInstanceFromObject(input) {
|
|
|
714
750
|
});
|
|
715
751
|
}
|
|
716
752
|
function createBlockInstanceFromJSON(input) {
|
|
717
|
-
|
|
753
|
+
try {
|
|
754
|
+
return createBlockInstanceFromObject(JSON.parse(input));
|
|
755
|
+
} catch (error) {
|
|
756
|
+
reportBlockError(error, {
|
|
757
|
+
site: "block.createBlockInstanceFromJSON",
|
|
758
|
+
extra: { inputLength: input.length }
|
|
759
|
+
});
|
|
760
|
+
throw error;
|
|
761
|
+
}
|
|
718
762
|
}
|
|
719
763
|
const DEFAULT_GLOBAL_STYLES = {
|
|
720
764
|
volume: "comfort",
|
|
@@ -844,9 +888,21 @@ function createThemeState(deps) {
|
|
|
844
888
|
surfaces[surface].blocks.value = [];
|
|
845
889
|
const stored = await deps.resolve(surface, path);
|
|
846
890
|
if (stored != null) {
|
|
847
|
-
surfaces[surface].blocks.value = stored.blocks.
|
|
848
|
-
|
|
849
|
-
|
|
891
|
+
surfaces[surface].blocks.value = stored.blocks.flatMap((block) => {
|
|
892
|
+
try {
|
|
893
|
+
return [createBlockInstanceFromObject(block)];
|
|
894
|
+
} catch (error) {
|
|
895
|
+
reportBlockError(error, {
|
|
896
|
+
site: "theme-state.resolve.hydrate",
|
|
897
|
+
extra: {
|
|
898
|
+
surface,
|
|
899
|
+
path,
|
|
900
|
+
blockType: typeof (block == null ? void 0 : block.type) === "string" ? block.type : "(unknown)"
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
return [];
|
|
904
|
+
}
|
|
905
|
+
});
|
|
850
906
|
return stored;
|
|
851
907
|
}
|
|
852
908
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-state.d.ts","sourceRoot":"","sources":["../src/theme-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"theme-state.d.ts","sourceRoot":"","sources":["../src/theme-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAA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AE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAA2C,CAAC;AA0C1E,wBAAgB,cAAc,CAAC,SAAS,EAAE,mBAAmB,EAAE,GAAG;IAChE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAmBA;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,CACP,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;KACzE,CAAC;IACF,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;CAC9E,GAAG,UAAU,CA+Jb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-state.resolve.test.d.ts","sourceRoot":"","sources":["../src/theme-state.resolve.test.ts"],"names":[],"mappings":""}
|
package/dist/vue/block.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
1
|
+
import { App, Component } from 'vue';
|
|
2
2
|
import { BlockInstance } from '../main.ts';
|
|
3
|
-
export declare function createVueRenderer(component: Component
|
|
3
|
+
export declare function createVueRenderer(component: Component, options?: {
|
|
4
|
+
hostApp?: App;
|
|
5
|
+
}): (block: BlockInstance) => HTMLElement;
|
|
4
6
|
export declare function createVueCeRenderer(name: string, component: Component, { shadowRoot }?: {
|
|
5
7
|
shadowRoot?: boolean;
|
|
6
8
|
}): (block: BlockInstance) => HTMLDivElement;
|
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,SAAS,
|
|
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;AA6B9D,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,WAuCZ,aAAa,iBAyD7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,4CAoCrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.test.d.ts","sourceRoot":"","sources":["../../src/vue/block.test.ts"],"names":[],"mappings":""}
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement,
|
|
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
3
|
import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-B8cVa2-2.js";
|
|
4
4
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -141,35 +141,79 @@ const VueSlotWrapper = defineComponent({
|
|
|
141
141
|
return h("div");
|
|
142
142
|
},
|
|
143
143
|
mounted() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this
|
|
144
|
+
this.syncSlotChildren();
|
|
145
|
+
},
|
|
146
|
+
updated() {
|
|
147
|
+
this.syncSlotChildren();
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
syncSlotChildren() {
|
|
151
|
+
const children = (Array.isArray(this.$props.block) ? this.$props.block : [this.$props.block]).map(
|
|
152
|
+
(block) => typeof block === "string" ? block : block.definition.render(block)
|
|
153
|
+
);
|
|
154
|
+
this.$el.replaceChildren(...children);
|
|
155
|
+
}
|
|
148
156
|
}
|
|
149
157
|
});
|
|
150
|
-
function createVueRenderer(component) {
|
|
158
|
+
function createVueRenderer(component, options) {
|
|
159
|
+
const cache = /* @__PURE__ */ new Map();
|
|
151
160
|
function renderSlots(slots) {
|
|
152
161
|
if (!slots) {
|
|
153
162
|
return slots;
|
|
154
163
|
}
|
|
155
|
-
|
|
164
|
+
return Object.fromEntries(
|
|
156
165
|
Object.entries(slots).map(([key2, value]) => [
|
|
157
166
|
key2,
|
|
158
|
-
//
|
|
167
|
+
// Known limitation: if a nested block's props are mutated without changing
|
|
168
|
+
// the slot array reference, VueSlotWrapper won't re-render (updated() won't fire).
|
|
169
|
+
// Not an issue today — all block trees are flat (root → first-level blocks),
|
|
170
|
+
// and first-level blocks are re-rendered directly by ExtensionRoot's effect,
|
|
171
|
+
// bypassing VueSlotWrapper entirely.
|
|
159
172
|
typeof value === "string" ? value : h(VueSlotWrapper, { block: value })
|
|
160
173
|
])
|
|
161
174
|
);
|
|
162
|
-
return renderedSlots;
|
|
163
175
|
}
|
|
164
176
|
return (block) => {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
const parentInstance = block.__vueInstance;
|
|
178
|
+
const existing = cache.get(block.id);
|
|
179
|
+
if (existing && existing.parentInstance === parentInstance) {
|
|
180
|
+
existing.propsRef.value = block.props;
|
|
181
|
+
existing.slotsRef.value = block.slots;
|
|
182
|
+
triggerRef(existing.slotsRef);
|
|
183
|
+
return existing.wrapper;
|
|
184
|
+
}
|
|
185
|
+
if (existing) {
|
|
186
|
+
render(null, existing.wrapper);
|
|
187
|
+
}
|
|
188
|
+
const propsRef = shallowRef(block.props);
|
|
189
|
+
const slotsRef = shallowRef(
|
|
190
|
+
block.slots
|
|
169
191
|
);
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
192
|
+
const parentProvides = parentInstance == null ? void 0 : parentInstance.provides;
|
|
193
|
+
const Root = defineComponent({
|
|
194
|
+
setup() {
|
|
195
|
+
if (parentProvides) {
|
|
196
|
+
const instance = getCurrentInstance();
|
|
197
|
+
if (instance) {
|
|
198
|
+
instance.provides = parentProvides;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return () => h(ContextProvider, {}, [
|
|
202
|
+
h(component, propsRef.value, renderSlots(slotsRef.value))
|
|
203
|
+
]);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
const wrapper = (existing == null ? void 0 : existing.wrapper) ?? document.createElement("div");
|
|
207
|
+
if (!existing) {
|
|
208
|
+
wrapper.setAttribute("data-block-id", block.id);
|
|
209
|
+
wrapper.style.display = "contents";
|
|
210
|
+
}
|
|
211
|
+
const vnode = h(Root);
|
|
212
|
+
if (options == null ? void 0 : options.hostApp) {
|
|
213
|
+
vnode.appContext = options.hostApp._context;
|
|
214
|
+
}
|
|
215
|
+
render(vnode, wrapper);
|
|
216
|
+
cache.set(block.id, { wrapper, propsRef, slotsRef, parentInstance });
|
|
173
217
|
return wrapper;
|
|
174
218
|
};
|
|
175
219
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../src/web-components/Block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../src/web-components/Block.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW;IAC5C,4CAA4C;IAC5C,OAAO,CAAC,IAAI,CAA+B;IAE3C,OAAO,CAAC,aAAa,CAAC,CAAa;IAEnC,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IAQjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;IAOpB,OAAO,CAAC,WAAW;CAyBpB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,KAAK,CAAC;KACpB;CACF"}
|
|
@@ -3,6 +3,7 @@ export default class ExtensionRoot extends HTMLElement {
|
|
|
3
3
|
private themeState;
|
|
4
4
|
private unsubscribeThemeContext?;
|
|
5
5
|
private disposeEffect?;
|
|
6
|
+
private __vueInstance;
|
|
6
7
|
/**
|
|
7
8
|
* Optional function to wrap each rendered block element.
|
|
8
9
|
* Called with the rendered block HTMLElement, must return an HTMLElement.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionRoot.d.ts","sourceRoot":"","sources":["../../src/web-components/ExtensionRoot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionRoot.d.ts","sourceRoot":"","sources":["../../src/web-components/ExtensionRoot.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,OAAO,CAAC,aAAa,CAAC,CAAa;IACnC,OAAO,CAAC,aAAa,CAA0C;IAE/D;;;;;;OAMG;IACI,YAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,WAAW,CAAC,GAAG,IAAI,CAAQ;IAE5E,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,OAAO,CAAC,YAAY,CAGhB;IAEJ,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,sBAAsB;IAM9B,iBAAiB;IAwDjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAiBzB,oBAAoB;CAWrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,aAAa,CAAC;KACrC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionRoot.test.d.ts","sourceRoot":"","sources":["../../src/web-components/ExtensionRoot.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 { n as injectContext, E, y as ContextRoot } from "./theme-state-
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { n as injectContext, E, y as ContextRoot } from "./theme-state-BpmgtjdC.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-B27vHVGI.js";
|
|
6
6
|
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-B8cVa2-2.js";
|
|
7
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
7
|
+
import { T as TranslationContext } from "./juo-workflow-BXGQS82N.js";
|
|
8
8
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
@@ -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 { n as injectContext, E, y as ContextRoot } from "./theme-state-
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
6
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
4
|
+
import { n as injectContext, E, y as ContextRoot } from "./theme-state-BpmgtjdC.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-B27vHVGI.js";
|
|
6
|
+
import { T as TranslationContext } from "./juo-workflow-BXGQS82N.js";
|
|
7
7
|
class InlineText extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juo/blocks",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -48,10 +48,15 @@
|
|
|
48
48
|
"./web-components/runtime": {
|
|
49
49
|
"types": "./dist/web-components/runtime/main.d.ts",
|
|
50
50
|
"default": "./dist/web-components-runtime.js"
|
|
51
|
+
},
|
|
52
|
+
"./observability": {
|
|
53
|
+
"types": "./dist/observability.d.ts",
|
|
54
|
+
"default": "./dist/observability.js"
|
|
51
55
|
}
|
|
52
56
|
},
|
|
53
57
|
"dependencies": {
|
|
54
|
-
"@preact/signals-core": "1.11.0"
|
|
58
|
+
"@preact/signals-core": "1.11.0",
|
|
59
|
+
"@sentry/core": "7.79.0"
|
|
55
60
|
},
|
|
56
61
|
"scripts": {
|
|
57
62
|
"dev": "vite build -w",
|