@juo/blocks 1.4.4 → 1.4.6
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-CQa6unFH.js → ExtensionRoot-CoDMQ-Gw.js} +21 -4
- package/dist/block.d.ts +19 -0
- package/dist/block.d.ts.map +1 -1
- package/dist/core.js +22 -21
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/components.test.d.ts +1 -0
- package/dist/editor/components.test.d.ts.map +1 -0
- package/dist/editor/main.d.ts.map +1 -1
- package/dist/editor.js +128 -27
- package/dist/{juo-workflow-1EMEURtn.js → juo-workflow-ZGS5rbZi.js} +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/{theme-state-CItCtH5l.js → theme-state-D3w_B6gQ.js} +44 -19
- package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
- package/dist/web-components-editor.js +3 -3
- package/dist/web-components-runtime.js +3 -3
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ 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,
|
|
7
|
-
import "./juo-workflow-
|
|
6
|
+
import { d, v as subscribeContext, T as ThemeStateContext, E, y as withWrapper, x as n, b as backfillInstanceDefaults, p as isStubDefinition, q as onRegisterBlock } from "./theme-state-D3w_B6gQ.js";
|
|
7
|
+
import "./juo-workflow-ZGS5rbZi.js";
|
|
8
8
|
class Block extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
@@ -139,6 +139,11 @@ class ExtensionRoot extends HTMLElement {
|
|
|
139
139
|
let extensionBlocks = [];
|
|
140
140
|
try {
|
|
141
141
|
extensionBlocks = (((_a = blocks.at(0)) == null ? void 0 : _a.slots) ?? {})[name] ?? [];
|
|
142
|
+
for (const block of extensionBlocks) {
|
|
143
|
+
if (block != null && typeof block === "object") {
|
|
144
|
+
backfillInstanceDefaults(block);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
142
147
|
const children = extensionBlocks.map(
|
|
143
148
|
(block) => this.withWrapper(block)
|
|
144
149
|
);
|
|
@@ -162,9 +167,21 @@ class ExtensionRoot extends HTMLElement {
|
|
|
162
167
|
}
|
|
163
168
|
if (this.unresolvedNames.size > 0 && !this.unregisterListener) {
|
|
164
169
|
this.unregisterListener = onRegisterBlock((name2) => {
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
var _a2;
|
|
171
|
+
if (!this.unresolvedNames.has(name2)) return;
|
|
172
|
+
const stateRef = this.state.value;
|
|
173
|
+
if (stateRef == null) return;
|
|
174
|
+
const surfaceBlocks = stateRef.blocks.value;
|
|
175
|
+
const slotName = this.getAttribute("name");
|
|
176
|
+
if (slotName != null) {
|
|
177
|
+
const children = (((_a2 = surfaceBlocks.at(0)) == null ? void 0 : _a2.slots) ?? {})[slotName] ?? [];
|
|
178
|
+
for (const child of children) {
|
|
179
|
+
if (child != null && typeof child === "object" && child.type === name2) {
|
|
180
|
+
backfillInstanceDefaults(child);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
167
183
|
}
|
|
184
|
+
this.state.value = { ...stateRef };
|
|
168
185
|
});
|
|
169
186
|
}
|
|
170
187
|
});
|
package/dist/block.d.ts
CHANGED
|
@@ -89,6 +89,25 @@ export declare function defineBlockRuntime<T = never>(name: string, opts: {
|
|
|
89
89
|
export declare function getDefinedBlocks(): BlockDefinition[];
|
|
90
90
|
export declare function createCeRenderer(name: string): (block: BlockInstance) => HTMLDivElement;
|
|
91
91
|
export declare function isStubDefinition(definition: BlockDefinition): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Backfill an empty block instance with `props`/`slots` defaults sourced
|
|
94
|
+
* from its (now-resolved) definition's `initialValue`.
|
|
95
|
+
*
|
|
96
|
+
* Why this exists: when `createBlockInstance(name)` runs before the real
|
|
97
|
+
* definition for `name` is registered, it falls back to a stub whose
|
|
98
|
+
* `initialValue` is `{ props: {}, slots: {} }`. The instance ends up with
|
|
99
|
+
* empty `props`/`slots` and keeps them — those fields are captured at
|
|
100
|
+
* instantiation time, only `definition` is a getter that re-resolves.
|
|
101
|
+
* Once the real definition lands, this helper fills the instance from it
|
|
102
|
+
* so a single render nudge picks up the real defaults.
|
|
103
|
+
*
|
|
104
|
+
* Returns `false` (no-op) when:
|
|
105
|
+
* - `props` or `slots` already have entries (nothing to backfill), or
|
|
106
|
+
* - `definition` is still a stub (no real defaults to source from yet).
|
|
107
|
+
*
|
|
108
|
+
* Returns `true` when the instance was mutated in place.
|
|
109
|
+
*/
|
|
110
|
+
export declare function backfillInstanceDefaults(block: BlockInstance): boolean;
|
|
92
111
|
export declare function createBlockInstance(name: string, opts?: {
|
|
93
112
|
props?: any;
|
|
94
113
|
slots?: any;
|
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,GAAG,CAAC,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAErD,MAAM,WAAW,WAAW,CAC1B,MAAM,GAAG,OAAO,EAChB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAElE,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,QAAQ,CAAC;CACnB;A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AoB7B;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,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 { c as createContext, d, w, r as registerBlock, E, u } from "./theme-state-
|
|
5
|
-
import { B, C, a, D, S, T, b, e, f, g, h, i, j, k, l, m, n, o, p, q, s, t, v, x } from "./theme-state-
|
|
6
|
-
import { T as T2, W, c, a as a2, b as b2, g as g2, h as h2 } from "./juo-workflow-
|
|
4
|
+
import { c as createContext, d, w, r as registerBlock, E, u } from "./theme-state-D3w_B6gQ.js";
|
|
5
|
+
import { B, C, a, D, S, T, b, e, f, g, h, i, j, k, l, m, n, o, p, q, s, t, v, x, y } from "./theme-state-D3w_B6gQ.js";
|
|
6
|
+
import { T as T2, W, c, a as a2, b as b2, g as g2, h as h2 } from "./juo-workflow-ZGS5rbZi.js";
|
|
7
7
|
import { reportBlockWarning, reportBlockError } from "./observability.js";
|
|
8
8
|
function createState() {
|
|
9
9
|
const discountCode = d(null);
|
|
@@ -1264,42 +1264,43 @@ export {
|
|
|
1264
1264
|
T as ThemeStateContext,
|
|
1265
1265
|
T2 as TranslationContext,
|
|
1266
1266
|
W as WorkflowServiceContext,
|
|
1267
|
+
b as backfillInstanceDefaults,
|
|
1267
1268
|
w as computed,
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1269
|
+
e as createBlockInstance,
|
|
1270
|
+
f as createBlockInstanceFromJSON,
|
|
1271
|
+
g as createBlockInstanceFromObject,
|
|
1272
|
+
h as createCeRenderer,
|
|
1272
1273
|
createContext,
|
|
1273
1274
|
createCustomerService,
|
|
1274
1275
|
createMockProductAdapter,
|
|
1275
1276
|
createMockSubscriptionAdapter,
|
|
1276
1277
|
createMockWorkflowApiAdapter,
|
|
1277
1278
|
createProductService,
|
|
1278
|
-
|
|
1279
|
+
i as createSelectedBlock,
|
|
1279
1280
|
createState,
|
|
1280
1281
|
createSubscriptionService,
|
|
1281
|
-
|
|
1282
|
+
j as createThemeState,
|
|
1282
1283
|
c as createTranslationService,
|
|
1283
1284
|
a2 as createWorkflowApiAdapter,
|
|
1284
1285
|
b2 as createWorkflowService,
|
|
1285
|
-
|
|
1286
|
-
|
|
1286
|
+
k as defineBlock,
|
|
1287
|
+
l as defineBlockRuntime,
|
|
1287
1288
|
E as effect,
|
|
1288
1289
|
g2 as getDefaultBlockForAction,
|
|
1289
|
-
|
|
1290
|
+
m as getDefinedBlocks,
|
|
1290
1291
|
h2 as hasDefaultBlockForAction,
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1292
|
+
n as indexOverrides,
|
|
1293
|
+
o as injectContext,
|
|
1294
|
+
p as isStubDefinition,
|
|
1294
1295
|
loadBlockRegistry,
|
|
1295
1296
|
loginService,
|
|
1296
|
-
|
|
1297
|
-
|
|
1297
|
+
q as onRegisterBlock,
|
|
1298
|
+
s as provideContext,
|
|
1298
1299
|
registerBlock,
|
|
1299
|
-
|
|
1300
|
+
t as serializeBlocks,
|
|
1300
1301
|
d as signal,
|
|
1301
|
-
|
|
1302
|
-
|
|
1302
|
+
v as subscribeContext,
|
|
1303
|
+
x as untracked,
|
|
1303
1304
|
waitForDevBlocksUrl,
|
|
1304
|
-
|
|
1305
|
+
y as withWrapper
|
|
1305
1306
|
};
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/editor/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA6O9C,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;IAEzE,MAAM,KAAK,kBAAkB,aAE5B;;IASD,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;IAiFrB,iBAAiB;IAWjB,oBAAoB;IAUpB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=components.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.test.d.ts","sourceRoot":"","sources":["../../src/editor/components.test.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/editor/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AAQrB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/editor/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AAQrB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAoD7B;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,aAAa,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,CA4CrB"}
|
package/dist/editor.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import { getDefinedBlocks, onRegisterBlock } from "@juo/blocks";
|
|
5
5
|
import { a as createEditorBridge, f as createRemoveBlockMessage, g as createRegisterBlocksMessage, h as createRegisterRoutesMessage } from "./bridge-B8cVa2-2.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-B8cVa2-2.js";
|
|
7
|
-
import {
|
|
7
|
+
import { g as createBlockInstanceFromObject, n as indexOverrides } from "./theme-state-D3w_B6gQ.js";
|
|
8
8
|
function createEditorHandler(options) {
|
|
9
9
|
const { themeState, onBlockSelection } = options;
|
|
10
10
|
const blockSurfaceIndex = /* @__PURE__ */ new Map();
|
|
@@ -293,32 +293,126 @@ function createEditorHandler(options) {
|
|
|
293
293
|
}
|
|
294
294
|
const styles = `
|
|
295
295
|
<style>
|
|
296
|
+
:host {
|
|
297
|
+
display: block;
|
|
298
|
+
position: relative;
|
|
299
|
+
}
|
|
300
|
+
|
|
296
301
|
.block-wrapper {
|
|
297
302
|
position: relative;
|
|
298
|
-
padding: 12px;
|
|
299
|
-
background-color: white;
|
|
300
|
-
border: 1px solid #B5B5B5;
|
|
301
|
-
border-radius: 8px;
|
|
302
303
|
box-sizing: border-box;
|
|
303
304
|
}
|
|
304
305
|
|
|
305
|
-
.block-wrapper
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
:host(:hover:not(.active)) .block-wrapper {
|
|
307
|
+
outline: 1px dashed #060606;
|
|
308
|
+
/* 4px gap between the block content and the dashed outline so the
|
|
309
|
+
* outline reads as a hover affordance rather than a touching border.
|
|
310
|
+
* Outline doesn't participate in layout, so this stays layout-neutral. */
|
|
311
|
+
outline-offset: 4px;
|
|
308
312
|
}
|
|
309
313
|
|
|
310
|
-
|
|
314
|
+
/*
|
|
315
|
+
* Stacking model for the active state (no negative z-index, no isolation):
|
|
316
|
+
* - .block-wrapper__chrome z-index: 100 → visual frame above neighbours
|
|
317
|
+
* and any in-block UI that
|
|
318
|
+
* creates its own stacking
|
|
319
|
+
* context (overlays, sticky
|
|
320
|
+
* headers, etc.)
|
|
321
|
+
* - .block-wrapper__slot-host z-index: 101 → block content above chrome bg
|
|
322
|
+
* so blocks without their own
|
|
323
|
+
* background stay visible
|
|
324
|
+
* - .block-wrapper__name z-index: 102 → title bar above everything,
|
|
325
|
+
* always clickable
|
|
326
|
+
*
|
|
327
|
+
* IMPORTANT: every z-index here is scoped to :host(.active). Otherwise
|
|
328
|
+
* inactive sibling wrappers' slot-host (z-index: 101) would create
|
|
329
|
+
* stacking contexts at root level and paint *above* the active wrapper's
|
|
330
|
+
* chrome (z-index: 100), hiding it. Scoping ensures only the active
|
|
331
|
+
* wrapper participates in this stacking layer.
|
|
332
|
+
* Neighbouring wrappers stay at default (auto / 0) and naturally sit below.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
/*
|
|
336
|
+
* Active-mode chrome — a card frame that visually wraps the block
|
|
337
|
+
* (white bg, gray border, drop shadow, padding around the block, and
|
|
338
|
+
* room at the top for the title bar). Drawn as a position:absolute
|
|
339
|
+
* overlay extending beyond the wrapper bounds so adjacent blocks are
|
|
340
|
+
* never pushed (it overlays them with the shadow effect instead).
|
|
341
|
+
*/
|
|
342
|
+
.block-wrapper__chrome {
|
|
343
|
+
display: none;
|
|
344
|
+
position: absolute;
|
|
345
|
+
/* Top extends 44px above the block to fit a 12px / 20px / 12px stack:
|
|
346
|
+
* 12px gap, 20px title bar, 12px gap to the block. Sides + bottom keep
|
|
347
|
+
* the original 12px gap around the block. */
|
|
348
|
+
top: -44px;
|
|
349
|
+
left: -12px;
|
|
350
|
+
right: -12px;
|
|
351
|
+
bottom: -12px;
|
|
352
|
+
background: #ffffff;
|
|
353
|
+
border: 0.5px solid #b5b5b5;
|
|
354
|
+
border-radius: 6px;
|
|
355
|
+
box-shadow: 0 0 14px 0 rgba(0, 0, 0, 0.10);
|
|
356
|
+
/* No pointer-events: none here — otherwise clicks on the chrome's
|
|
357
|
+
* overflow padding (the 12px ring around the block and the 44px
|
|
358
|
+
* title-bar strip above it) would fall through to whatever's behind:
|
|
359
|
+
* a sibling wrapper (re-targeting selection) or empty body
|
|
360
|
+
* (deselecting the current block). Block content still receives
|
|
361
|
+
* clicks because slot-host (z-index: 101) paints above the chrome
|
|
362
|
+
* (z-index: 100), and the title bar wins via its own z-index: 102. */
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
:host(.active) .block-wrapper__chrome {
|
|
366
|
+
display: block;
|
|
367
|
+
z-index: 100;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/*
|
|
371
|
+
* Wraps the slotted block content. Stays as a plain in-flow div when
|
|
372
|
+
* inactive (no stacking context). Only when the host is .active do we
|
|
373
|
+
* promote it to z-index: 101 so block content paints above the chrome's
|
|
374
|
+
* white fill. Without this scoping, every inactive neighbour's slot-host
|
|
375
|
+
* would also be at z-index: 101 and would cover the active chrome.
|
|
376
|
+
*/
|
|
377
|
+
:host(.active) .block-wrapper__slot-host {
|
|
311
378
|
position: relative;
|
|
312
|
-
|
|
313
|
-
|
|
379
|
+
z-index: 101;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/*
|
|
383
|
+
* Title bar lives in the top region of the chrome with symmetric 12px
|
|
384
|
+
* padding from every chrome edge it touches and from the block:
|
|
385
|
+
* - top: -32 → 12px below chrome's top edge (-44),
|
|
386
|
+
* 12px above the block (height: 20 → bottom at -12)
|
|
387
|
+
* - left/right: 0 → 12px inside chrome's -12 left/right edges,
|
|
388
|
+
* visually flush with the block's horizontal edges
|
|
389
|
+
*/
|
|
390
|
+
.block-wrapper__name {
|
|
391
|
+
position: absolute;
|
|
392
|
+
top: -32px;
|
|
393
|
+
left: 0;
|
|
394
|
+
right: 0;
|
|
395
|
+
display: none;
|
|
314
396
|
align-items: center;
|
|
315
|
-
gap:
|
|
316
|
-
margin-bottom: 12px;
|
|
397
|
+
gap: 7px;
|
|
317
398
|
font-size: 12px;
|
|
318
399
|
font-weight: 500;
|
|
319
|
-
color: #
|
|
400
|
+
color: #8a8a8a;
|
|
320
401
|
line-height: 100%;
|
|
321
|
-
height:
|
|
402
|
+
height: 20px;
|
|
403
|
+
box-sizing: border-box;
|
|
404
|
+
white-space: nowrap;
|
|
405
|
+
pointer-events: auto;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
:host(.active) .block-wrapper__name {
|
|
409
|
+
display: flex;
|
|
410
|
+
z-index: 102;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.block-wrapper__icon {
|
|
414
|
+
display: inline-flex;
|
|
415
|
+
align-items: center;
|
|
322
416
|
}
|
|
323
417
|
|
|
324
418
|
.block-wrapper__actions {
|
|
@@ -326,7 +420,7 @@ const styles = `
|
|
|
326
420
|
align-items: center;
|
|
327
421
|
justify-content: flex-end;
|
|
328
422
|
height: 100%;
|
|
329
|
-
|
|
423
|
+
margin-left: auto;
|
|
330
424
|
}
|
|
331
425
|
|
|
332
426
|
.block-wrapper__actions button {
|
|
@@ -347,7 +441,6 @@ const styles = `
|
|
|
347
441
|
color: #8A8A8A;
|
|
348
442
|
}
|
|
349
443
|
|
|
350
|
-
|
|
351
444
|
.block-wrapper__menu {
|
|
352
445
|
display: none;
|
|
353
446
|
position: absolute;
|
|
@@ -451,6 +544,8 @@ class BlockWrapper extends HTMLElement {
|
|
|
451
544
|
setupTemplate() {
|
|
452
545
|
const wrapper = document.createElement("div");
|
|
453
546
|
wrapper.className = "block-wrapper";
|
|
547
|
+
const chrome = document.createElement("div");
|
|
548
|
+
chrome.className = "block-wrapper__chrome";
|
|
454
549
|
const nameDiv = document.createElement("div");
|
|
455
550
|
nameDiv.className = "block-wrapper__name";
|
|
456
551
|
const iconContainer = document.createElement("div");
|
|
@@ -493,9 +588,13 @@ class BlockWrapper extends HTMLElement {
|
|
|
493
588
|
nameDiv.appendChild(nameSpan);
|
|
494
589
|
nameDiv.appendChild(actionsDiv);
|
|
495
590
|
nameDiv.appendChild(menuEl);
|
|
591
|
+
wrapper.appendChild(chrome);
|
|
496
592
|
wrapper.appendChild(nameDiv);
|
|
593
|
+
const slotHost = document.createElement("div");
|
|
594
|
+
slotHost.className = "block-wrapper__slot-host";
|
|
497
595
|
const slot = document.createElement("slot");
|
|
498
|
-
|
|
596
|
+
slotHost.appendChild(slot);
|
|
597
|
+
wrapper.appendChild(slotHost);
|
|
499
598
|
this.shadowRoot.appendChild(wrapper);
|
|
500
599
|
this.nameElement = nameSpan;
|
|
501
600
|
this.menuElement = menuEl;
|
|
@@ -509,10 +608,10 @@ class BlockWrapper extends HTMLElement {
|
|
|
509
608
|
connectedCallback() {
|
|
510
609
|
const isInOverlay = this.closest('juo-extension-root[surface="overlay"]') !== null;
|
|
511
610
|
if (isInOverlay) {
|
|
512
|
-
const
|
|
513
|
-
".block-
|
|
611
|
+
const name = this.shadowRoot.querySelector(
|
|
612
|
+
".block-wrapper__name"
|
|
514
613
|
);
|
|
515
|
-
if (
|
|
614
|
+
if (name) name.style.visibility = "hidden";
|
|
516
615
|
}
|
|
517
616
|
}
|
|
518
617
|
disconnectedCallback() {
|
|
@@ -553,14 +652,11 @@ class BlockWrapper extends HTMLElement {
|
|
|
553
652
|
}
|
|
554
653
|
}
|
|
555
654
|
updateActiveState(isActive) {
|
|
556
|
-
const wrapper = this.shadowRoot.querySelector(
|
|
557
|
-
".block-wrapper"
|
|
558
|
-
);
|
|
559
|
-
if (!wrapper) return;
|
|
560
655
|
if (isActive) {
|
|
561
|
-
|
|
656
|
+
this.classList.add("active");
|
|
562
657
|
} else {
|
|
563
|
-
|
|
658
|
+
this.classList.remove("active");
|
|
659
|
+
this.closeMenu();
|
|
564
660
|
}
|
|
565
661
|
}
|
|
566
662
|
/**
|
|
@@ -651,8 +747,12 @@ async function serializeBlock(block) {
|
|
|
651
747
|
locales
|
|
652
748
|
};
|
|
653
749
|
}
|
|
750
|
+
const EDITOR_BODY_TOP_PADDING_PX = 32;
|
|
654
751
|
async function setupEditorMode(deps) {
|
|
655
752
|
const { routerService, themeState } = deps;
|
|
753
|
+
const padStyle = document.createElement("style");
|
|
754
|
+
padStyle.textContent = `body { padding-top: ${EDITOR_BODY_TOP_PADDING_PX}px; }`;
|
|
755
|
+
document.head.appendChild(padStyle);
|
|
656
756
|
const editor = createEditorBridge();
|
|
657
757
|
const handler = createEditorHandler({
|
|
658
758
|
themeState
|
|
@@ -676,6 +776,7 @@ async function setupEditorMode(deps) {
|
|
|
676
776
|
);
|
|
677
777
|
});
|
|
678
778
|
return () => {
|
|
779
|
+
padStyle.remove();
|
|
679
780
|
unsubscribe();
|
|
680
781
|
editor.destroy();
|
|
681
782
|
};
|
|
@@ -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,
|
|
4
|
+
import { c as createContext, d, E, m as getDefinedBlocks, e as createBlockInstance, w, r as registerBlock, k as defineBlock, v as subscribeContext } from "./theme-state-D3w_B6gQ.js";
|
|
5
5
|
import { a as createEditorBridge, e as createSelectBlockMessage } from "./bridge-B8cVa2-2.js";
|
|
6
6
|
const TranslationContext = createContext("translation");
|
|
7
7
|
function toStringRecord(input) {
|
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 { createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, } from './block';
|
|
2
|
+
export { backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, 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,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,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"}
|
|
@@ -695,6 +695,30 @@ function createStubDefinition(name) {
|
|
|
695
695
|
function isStubDefinition(definition) {
|
|
696
696
|
return definition.__stub === true;
|
|
697
697
|
}
|
|
698
|
+
function backfillInstanceDefaults(block) {
|
|
699
|
+
if (Object.keys(block.props ?? {}).length > 0) return false;
|
|
700
|
+
if (Object.keys(block.slots ?? {}).length > 0) return false;
|
|
701
|
+
if (isStubDefinition(block.definition)) return false;
|
|
702
|
+
let defaults;
|
|
703
|
+
try {
|
|
704
|
+
const iv = block.definition.initialValue;
|
|
705
|
+
defaults = (typeof iv === "function" ? iv() : iv) ?? {};
|
|
706
|
+
} catch (error) {
|
|
707
|
+
reportBlockError(error, {
|
|
708
|
+
site: "block.backfillInstanceDefaults",
|
|
709
|
+
block: { id: block.id, type: block.type, definition: block.definition }
|
|
710
|
+
});
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
const propsDefault = defaults.props ?? {};
|
|
714
|
+
const slotsDefault = defaults.slots ?? {};
|
|
715
|
+
const hasProps = Object.keys(propsDefault).length > 0;
|
|
716
|
+
const hasSlots = Object.keys(slotsDefault).length > 0;
|
|
717
|
+
if (!hasProps && !hasSlots) return false;
|
|
718
|
+
if (hasProps) Object.assign(block.props, propsDefault);
|
|
719
|
+
if (hasSlots) Object.assign(block.slots, slotsDefault);
|
|
720
|
+
return true;
|
|
721
|
+
}
|
|
698
722
|
function getDefinitionByName(name) {
|
|
699
723
|
const definition = blockDefinitions.get(name);
|
|
700
724
|
if (definition != null) {
|
|
@@ -967,28 +991,29 @@ export {
|
|
|
967
991
|
SelectedBlockContext as S,
|
|
968
992
|
ThemeStateContext as T,
|
|
969
993
|
ContextRequestEvent as a,
|
|
970
|
-
|
|
994
|
+
backfillInstanceDefaults as b,
|
|
971
995
|
createContext as c,
|
|
972
996
|
d,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
997
|
+
createBlockInstance as e,
|
|
998
|
+
createBlockInstanceFromJSON as f,
|
|
999
|
+
createBlockInstanceFromObject as g,
|
|
1000
|
+
createCeRenderer as h,
|
|
1001
|
+
createSelectedBlock as i,
|
|
1002
|
+
createThemeState as j,
|
|
1003
|
+
defineBlock as k,
|
|
1004
|
+
defineBlockRuntime as l,
|
|
1005
|
+
getDefinedBlocks as m,
|
|
1006
|
+
indexOverrides as n,
|
|
1007
|
+
injectContext as o,
|
|
1008
|
+
isStubDefinition as p,
|
|
1009
|
+
onRegisterBlock as q,
|
|
986
1010
|
registerBlock as r,
|
|
987
|
-
|
|
988
|
-
|
|
1011
|
+
provideContext as s,
|
|
1012
|
+
serializeBlocks as t,
|
|
989
1013
|
u,
|
|
990
|
-
|
|
1014
|
+
subscribeContext as v,
|
|
991
1015
|
w,
|
|
992
|
-
|
|
993
|
-
|
|
1016
|
+
n as x,
|
|
1017
|
+
withWrapper as y,
|
|
1018
|
+
ContextRoot as z
|
|
994
1019
|
};
|
|
@@ -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":"AAmBA,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;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAa;IAExC;;;;;;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;IAuHjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAiBzB,oBAAoB;CAkBrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,aAAa,CAAC;KACrC;CACF"}
|
|
@@ -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 {
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { o as injectContext, E, z as ContextRoot } from "./theme-state-D3w_B6gQ.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-CoDMQ-Gw.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-ZGS5rbZi.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 {
|
|
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 "./theme-state-D3w_B6gQ.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-CoDMQ-Gw.js";
|
|
6
|
+
import { T as TranslationContext } from "./juo-workflow-ZGS5rbZi.js";
|
|
7
7
|
class InlineText extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|