@middag-io/react 0.35.3 → 0.36.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.
@@ -12,5 +12,5 @@
12
12
  */
13
13
  import { type ReactElement } from "react";
14
14
  import type { ContractPageProps } from "../contracts/page-contract";
15
- export declare function ContractPage({ contract, overlay }: ContractPageProps): ReactElement;
15
+ export declare function ContractPage({ contract, overlay, shellMode, }: ContractPageProps): ReactElement;
16
16
  //# sourceMappingURL=ContractPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContractPage.d.ts","sourceRoot":"","sources":["../../src/app/ContractPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1E,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAOpF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAwInF"}
1
+ {"version":3,"file":"ContractPage.d.ts","sourceRoot":"","sources":["../../src/app/ContractPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1E,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAOpF,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,SAAkB,GACnB,EAAE,iBAAiB,GAAG,YAAY,CAkJlC"}
@@ -41,5 +41,15 @@ export interface ContractPageProps {
41
41
  contract: PageContract;
42
42
  /** When true, page renders in a full-screen overlay with X close. */
43
43
  overlay?: boolean;
44
+ /**
45
+ * Shell rendering mode:
46
+ * - `"full"` (default): resolve and mount the contract's shell around the
47
+ * layout — the standalone/self-contained rendering used by Inertia pages.
48
+ * - `"content-only"`: render only `EntityRoutesProvider + Layout`, WITHOUT
49
+ * the shell. For hosts that mount a persistent shell once (e.g. a React
50
+ * Router layout route) and swap page content beneath it, avoiding the shell
51
+ * remount that flashes the sidebar on every navigation.
52
+ */
53
+ shellMode?: "full" | "content-only";
44
54
  }
45
55
  //# sourceMappingURL=page-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/page-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,UAAU,IAAI,cAAc,EAC5B,gBAAgB,IAAI,oBAAoB,EACxC,YAAY,IAAI,gBAAgB,EAChC,QAAQ,IAAI,YAAY,EACxB,aAAa,IAAI,iBAAiB,EACnC,MAAM,uBAAuB,CAAC;AAI/B,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AAExC,+DAA+D;AAC/D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG;IACrD,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CACjE,mBAAmB,EACnB,MAAM,GAAG,SAAS,CACnB,GAAG;IACF,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG;IACrE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;CAC5C,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;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AAS,CAAC,GAAG;IACrE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;CAC5C,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC,GAAG;IACnF,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,aAAa,CAAC;CAG3B,CAAC;AAIF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,CAAC;IACvB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACrC"}
@@ -1590,8 +1590,8 @@ function Di({ children: e, onClose: t }) {
1590
1590
  }
1591
1591
  //#endregion
1592
1592
  //#region src/app/ContractPage.tsx
1593
- function Oi({ contract: e, overlay: t }) {
1594
- let { t: n } = I(), r = Ar(() => Yr(e), [e]), i = Ar(() => ui(e?.shell) ?? ui("immersive"), [e?.shell]), a = Ar(() => di(e?.layout?.template) || di("stack"), [e?.layout?.template]), o = H((e) => {
1593
+ function Oi({ contract: e, overlay: t, shellMode: n = "full" }) {
1594
+ let { t: r } = I(), i = Ar(() => Yr(e), [e]), a = Ar(() => ui(e?.shell) ?? ui("immersive"), [e?.shell]), o = Ar(() => di(e?.layout?.template) || di("stack"), [e?.layout?.template]), s = H((e) => {
1595
1595
  let t = fi(e.type);
1596
1596
  return t ? ri(e) ? /* @__PURE__ */ q(yi, { children: /* @__PURE__ */ q(ni, {
1597
1597
  block: e,
@@ -1602,35 +1602,43 @@ function Oi({ contract: e, overlay: t }) {
1602
1602
  }) }, e.key) : /* @__PURE__ */ J("div", {
1603
1603
  role: "alert",
1604
1604
  className: "border-muted-foreground/30 text-muted-foreground rounded border border-dashed p-2 text-xs",
1605
- children: [n("middag.ui.block.unknown_type"), null]
1605
+ children: [r("middag.ui.block.unknown_type"), null]
1606
1606
  }, e.key);
1607
- }, [n]);
1608
- if (r) return /* @__PURE__ */ J("div", {
1607
+ }, [r]);
1608
+ if (i) return /* @__PURE__ */ J("div", {
1609
1609
  role: "alert",
1610
1610
  className: "border-destructive/20 bg-destructive/10 text-destructive m-4 rounded-md border p-4 text-sm",
1611
1611
  children: [/* @__PURE__ */ q("p", {
1612
1612
  className: "font-semibold",
1613
- children: n("middag.ui.contract.invalid")
1613
+ children: r("middag.ui.contract.invalid")
1614
1614
  }), null]
1615
1615
  });
1616
- if (!i) return /* @__PURE__ */ J("div", {
1616
+ if (!o) return /* @__PURE__ */ J("div", {
1617
1617
  role: "alert",
1618
1618
  className: "border-destructive/20 bg-destructive/10 text-destructive m-4 rounded-md border p-4 text-sm",
1619
- children: [n("middag.ui.shell.unknown_type"), null]
1619
+ children: [r("middag.ui.layout.unknown_type"), null]
1620
+ });
1621
+ let c = /* @__PURE__ */ q(o, {
1622
+ layout: e.layout,
1623
+ renderBlock: s
1620
1624
  });
1625
+ if (n === "content-only") {
1626
+ let n = /* @__PURE__ */ q(Zr, {
1627
+ entities: e.entities ?? {},
1628
+ children: c
1629
+ });
1630
+ return t ? /* @__PURE__ */ q(Di, { children: n }) : n;
1631
+ }
1621
1632
  if (!a) return /* @__PURE__ */ J("div", {
1622
1633
  role: "alert",
1623
1634
  className: "border-destructive/20 bg-destructive/10 text-destructive m-4 rounded-md border p-4 text-sm",
1624
- children: [n("middag.ui.layout.unknown_type"), null]
1635
+ children: [r("middag.ui.shell.unknown_type"), null]
1625
1636
  });
1626
- let s = /* @__PURE__ */ q(Zr, {
1637
+ let l = /* @__PURE__ */ q(Zr, {
1627
1638
  entities: e.entities ?? {},
1628
- children: /* @__PURE__ */ q(i, { children: /* @__PURE__ */ q(a, {
1629
- layout: e.layout,
1630
- renderBlock: o
1631
- }) })
1639
+ children: /* @__PURE__ */ q(a, { children: c })
1632
1640
  });
1633
- return t ? /* @__PURE__ */ q(Di, { children: s }) : s;
1641
+ return t ? /* @__PURE__ */ q(Di, { children: l }) : l;
1634
1642
  }
1635
1643
  //#endregion
1636
1644
  //#region src/base/form/fields/field-registry.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middag-io/react",
3
- "version": "0.35.3",
3
+ "version": "0.36.0",
4
4
  "type": "module",
5
5
  "description": "MIDDAG shared React UI library for Moodle, WordPress and other Inertia hosts",
6
6
  "license": "Apache-2.0",