@cratis/event-models 0.248.1 → 0.249.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.
@@ -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 n = ue(`${wg}${t}`, t, "core:text", { text: `slot: ${t}` });
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 o = t;
7542
- if (typeof o.slotName == "string")
7543
- return n.has(o.slotName) || !e.slots.some((s) => s.name === o.slotName) ? void 0 : (n.add(o.slotName), cs(e, o.slotName));
7544
- const i = t, r = (i.children ?? []).map((s) => ({
7545
- child: s,
7546
- element: ds(e, s, n)
7547
- })).filter((s) => s.element !== void 0);
7548
- if (r.length === 0) return;
7549
- const l = i.kind === "Row" ? "row" : "column";
7550
- return i.kind !== "Row" ? {
7551
- ...je(K.Stack, `template-flow:${l}-${[...n].join("-")}`, l, r.map((s) => s.element)),
7552
- spacing: i.gap ?? 8
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:${l}-${[...n].join("-")}`, l, r.map((s, c) => ({
7555
- ...s.element,
7554
+ ...je(K.Grid, `template-flow:${s}-${[...n].join("-")}`, s, l.map((c, u) => ({
7555
+ ...c.element,
7556
7556
  properties: {
7557
- ...s.element.properties,
7558
- "Grid.Column": c,
7557
+ ...c.element.properties,
7558
+ "Grid.Column": u,
7559
7559
  "Grid.Row": 0
7560
7560
  }
7561
7561
  }))),
7562
7562
  rows: [],
7563
- columns: r.map((s) => ({
7564
- width: (s.child.grow ?? 0) > 0 ? lr(s.child.grow) : s.child.slotName !== void 0 ? Tg(kg) : lr(1),
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 t = /* @__PURE__ */ new Set(), n = Sg(e), o = [], i = n ? ds(e, n, t) : void 0;
7572
- i && o.push(i);
7573
- for (const r of e.slots) t.has(r.name) || (t.add(r.name), o.push(cs(e, r.name)));
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: o,
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.248.1",
3
+ "version": "0.249.1",
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.248.1",
71
+ "@cratis/scene": "^0.249.1",
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.248.1",
107
+ "@cratis/scene": "0.249.1",
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",