@cratis/event-models 0.249.0 → 0.250.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,9 +10,10 @@ export declare const slotIndexOf: (parentId: string, index: number) => number;
|
|
|
10
10
|
* The slots of a template as the sections they are drawn in.
|
|
11
11
|
*
|
|
12
12
|
* @param template The template being authored.
|
|
13
|
+
* @param labelled Whether each section starts with the name of its slot - the editor says what each place is; a preview draws only what is in it.
|
|
13
14
|
* @returns The elements the template is drawn as, and the id of the section a component goes into when no place is named - the first slot it declares.
|
|
14
15
|
*/
|
|
15
|
-
export declare function slotSectionsOf(template: ScreenTemplate): {
|
|
16
|
+
export declare function slotSectionsOf(template: ScreenTemplate, labelled?: boolean): {
|
|
16
17
|
elements: SceneElement[];
|
|
17
18
|
entry: string | undefined;
|
|
18
19
|
};
|
|
@@ -7527,9 +7527,9 @@ var rs = "template-slot:", wg = "template-slot-label:", kg = 280, Sg = (e) => {
|
|
|
7527
7527
|
function ss(e, t) {
|
|
7528
7528
|
return t !== void 0 && qe(e) ? bl(gl(t), Cg(e)) : void 0;
|
|
7529
7529
|
}
|
|
7530
|
-
var ls = (e, t) => qe(e) ? Math.max(0, t - 1) : t, cs = (e, t) => {
|
|
7531
|
-
const
|
|
7532
|
-
return je(K.Stack, as(t), t, [n, ...e.content?.[t] ?? []]);
|
|
7530
|
+
var ls = (e, t) => qe(e) ? Math.max(0, t - 1) : t, cs = (e, t, n) => {
|
|
7531
|
+
const o = ue(`${wg}${t}`, t, "core:text", { text: `slot: ${t}` });
|
|
7532
|
+
return je(K.Stack, as(t), t, [...n ? [o] : [], ...e.content?.[t] ?? []]);
|
|
7533
7533
|
}, lr = (e) => ({
|
|
7534
7534
|
unitType: fo.Star,
|
|
7535
7535
|
value: e
|
|
@@ -7537,42 +7537,42 @@ var ls = (e, t) => qe(e) ? Math.max(0, t - 1) : t, cs = (e, t) => {
|
|
|
7537
7537
|
unitType: fo.Absolute,
|
|
7538
7538
|
value: e
|
|
7539
7539
|
});
|
|
7540
|
-
function ds(e, t, n) {
|
|
7541
|
-
const
|
|
7542
|
-
if (typeof
|
|
7543
|
-
return n.has(
|
|
7544
|
-
const
|
|
7545
|
-
child:
|
|
7546
|
-
element: ds(e,
|
|
7547
|
-
})).filter((
|
|
7548
|
-
if (
|
|
7549
|
-
const
|
|
7550
|
-
return
|
|
7551
|
-
...je(K.Stack, `template-flow:${
|
|
7552
|
-
spacing:
|
|
7540
|
+
function ds(e, t, n, o) {
|
|
7541
|
+
const i = t;
|
|
7542
|
+
if (typeof i.slotName == "string")
|
|
7543
|
+
return n.has(i.slotName) || !e.slots.some((c) => c.name === i.slotName) ? void 0 : (n.add(i.slotName), cs(e, i.slotName, o));
|
|
7544
|
+
const r = t, l = (r.children ?? []).map((c) => ({
|
|
7545
|
+
child: c,
|
|
7546
|
+
element: ds(e, c, n, o)
|
|
7547
|
+
})).filter((c) => c.element !== void 0);
|
|
7548
|
+
if (l.length === 0) return;
|
|
7549
|
+
const s = r.kind === "Row" ? "row" : "column";
|
|
7550
|
+
return r.kind !== "Row" ? {
|
|
7551
|
+
...je(K.Stack, `template-flow:${s}-${[...n].join("-")}`, s, l.map((c) => c.element)),
|
|
7552
|
+
spacing: r.gap ?? 8
|
|
7553
7553
|
} : {
|
|
7554
|
-
...je(K.Grid, `template-flow:${
|
|
7555
|
-
...
|
|
7554
|
+
...je(K.Grid, `template-flow:${s}-${[...n].join("-")}`, s, l.map((c, u) => ({
|
|
7555
|
+
...c.element,
|
|
7556
7556
|
properties: {
|
|
7557
|
-
...
|
|
7558
|
-
"Grid.Column":
|
|
7557
|
+
...c.element.properties,
|
|
7558
|
+
"Grid.Column": u,
|
|
7559
7559
|
"Grid.Row": 0
|
|
7560
7560
|
}
|
|
7561
7561
|
}))),
|
|
7562
7562
|
rows: [],
|
|
7563
|
-
columns:
|
|
7564
|
-
width: (
|
|
7563
|
+
columns: l.map((c) => ({
|
|
7564
|
+
width: (c.child.grow ?? 0) > 0 ? lr(c.child.grow) : c.child.slotName !== void 0 ? Tg(kg) : lr(1),
|
|
7565
7565
|
minimumWidth: 0,
|
|
7566
7566
|
maximumWidth: Number.POSITIVE_INFINITY
|
|
7567
7567
|
}))
|
|
7568
7568
|
};
|
|
7569
7569
|
}
|
|
7570
|
-
function Ig(e) {
|
|
7571
|
-
const
|
|
7572
|
-
|
|
7573
|
-
for (const
|
|
7570
|
+
function Ig(e, t = !0) {
|
|
7571
|
+
const n = /* @__PURE__ */ new Set(), o = Sg(e), i = [], r = o ? ds(e, o, n, t) : void 0;
|
|
7572
|
+
r && i.push(r);
|
|
7573
|
+
for (const l of e.slots) n.has(l.name) || (n.add(l.name), i.push(cs(e, l.name, t)));
|
|
7574
7574
|
return {
|
|
7575
|
-
elements:
|
|
7575
|
+
elements: i,
|
|
7576
7576
|
entry: e.slots[0] ? as(e.slots[0].name) : void 0
|
|
7577
7577
|
};
|
|
7578
7578
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/event-models",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.250.0",
|
|
4
4
|
"description": "The Cratis event model board as a configurable React component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Cratis",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@cratis/components": "^4.26.2",
|
|
70
70
|
"@cratis/fundamentals": "^7.22.0",
|
|
71
|
-
"@cratis/scene": "^0.
|
|
71
|
+
"@cratis/scene": "^0.250.0",
|
|
72
72
|
"@cratis/scene.blueprint.approvals": "^4.12.0",
|
|
73
73
|
"@cratis/scene.blueprint.bookings": "^4.12.0",
|
|
74
74
|
"@cratis/scene.blueprint.catalog": "^4.12.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@cratis/components": "^4.29.1",
|
|
106
106
|
"@cratis/fundamentals": "^7.25.1",
|
|
107
|
-
"@cratis/scene": "0.
|
|
107
|
+
"@cratis/scene": "0.250.0",
|
|
108
108
|
"@cratis/scene.blueprint.approvals": "4.71.0",
|
|
109
109
|
"@cratis/scene.blueprint.bookings": "4.71.0",
|
|
110
110
|
"@cratis/scene.blueprint.catalog": "4.71.0",
|