@rizom/site-rizom 0.2.0-alpha.159 → 0.2.0-alpha.160

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/index.d.ts CHANGED
@@ -107,6 +107,25 @@ interface SiteContentDefinition {
107
107
  namespace: string;
108
108
  sections: Record<string, SiteContentSectionDefinition>;
109
109
  }
110
+ /**
111
+ * A schema-first content section, carried opaquely so this base SDK stays
112
+ * zod-free (and free of a dependency cycle with `@rizom/site-sections`). The
113
+ * `schema` is a zod schema the brain-side builder introspects; authoring is
114
+ * done via `@rizom/site-sections`'s `defineSection`, whose typed result is
115
+ * structurally assignable to this.
116
+ */
117
+ interface SiteSectionDefinition {
118
+ schema: unknown;
119
+ component: ComponentType<unknown>;
120
+ title: string;
121
+ description: string;
122
+ requiredPermission?: UserPermissionLevel;
123
+ fullscreen?: boolean;
124
+ }
125
+ interface SiteSectionGroup {
126
+ namespace: string;
127
+ sections: Record<string, SiteSectionDefinition>;
128
+ }
110
129
  interface SiteMetadataCTA {
111
130
  heading: string;
112
131
  buttonText: string;
@@ -149,8 +168,10 @@ interface SiteDefinition {
149
168
  layouts: Record<string, unknown>;
150
169
  /** Hand-written route definitions (home, about, etc.). */
151
170
  routes: RouteDefinitionInput[];
152
- /** Optional content definitions owned by this package. */
171
+ /** Optional content definitions owned by this package (field-DSL authored). */
153
172
  content?: SiteContentDefinition | SiteContentDefinition[];
173
+ /** Optional schema-first section groups (authored via @rizom/site-sections). */
174
+ sections?: SiteSectionGroup | SiteSectionGroup[];
154
175
  /** Optional additive CSS owned by the site package. */
155
176
  themeOverride?: string;
156
177
  /** Global head scripts to inject into every rendered page. */
@@ -188,6 +209,12 @@ interface RizomLayoutProps {
188
209
  //#region src/ui/frame.d.ts
189
210
  interface RizomFrameProps {
190
211
  children?: ComponentChildren;
212
+ /**
213
+ * Render the full-page background canvas mount the profile canvas scripts
214
+ * draw into. Sites without a `themeProfile` pass false — the mount would be
215
+ * dead markup.
216
+ */
217
+ canvas?: boolean;
191
218
  }
192
219
  /**
193
220
  * Shared Rizom page frame.
@@ -195,7 +222,7 @@ interface RizomFrameProps {
195
222
  * Owns only the full-page canvas background and the centered page
196
223
  * container. Wrapper sites own their actual chrome/layout composition.
197
224
  */
198
- declare const RizomFrame: ({ children }: RizomFrameProps) => JSX.Element;
225
+ declare const RizomFrame: ({ children, canvas }: RizomFrameProps) => JSX.Element;
199
226
  //#endregion
200
227
  //#region src/ui/Header.d.ts
201
228
  interface HeaderProps {
@@ -291,11 +318,32 @@ interface RizomRuntimeHooks {
291
318
  }
292
319
  interface CreateRizomSiteOptions {
293
320
  packageName: string;
294
- themeProfile: RizomThemeProfile;
321
+ /**
322
+ * Optional profile-driven chrome: sets `data-theme-profile` on the document
323
+ * and loads the matching background canvas (product→tree, editorial→roots,
324
+ * studio→constellation). Omit for sites that draw their own motifs — the
325
+ * boot.js animation runtime always loads regardless. Only the retiring
326
+ * rizom-work/rizom-foundation variants still use profiles; the machinery
327
+ * goes with them at consolidation Phase 6.
328
+ */
329
+ themeProfile?: RizomThemeProfile;
295
330
  layout: unknown;
296
331
  routes: RouteDefinitionInput[];
297
332
  content?: SiteContentDefinition | SiteContentDefinition[];
333
+ /**
334
+ * Schema-first section groups (authored via `@rizom/site-sections`'
335
+ * `defineSection`/`sectionGroup`). Registered as content templates at brain
336
+ * boot exactly like `content`, so the CMS + directory-sync + resolver treat
337
+ * them identically — but the section shape is derived from one zod schema.
338
+ */
339
+ sections?: SiteSectionGroup | SiteSectionGroup[];
298
340
  themeOverride?: string;
341
+ /**
342
+ * Presentation config for entity-backed list/detail routes (labels, plural
343
+ * names, navigation). Merged onto the base site's empty map. Sites that
344
+ * surface plugin lists — e.g. `post`→"Essay", `deck`→"Talk" — set it here.
345
+ */
346
+ entityDisplay?: Record<string, EntityDisplayEntry>;
299
347
  /** Advanced runtime hooks for in-repo sites that need custom template/data-source wiring. */
300
348
  runtime?: RizomRuntimeHooks;
301
349
  }
package/dist/index.js CHANGED
@@ -868,9 +868,12 @@ var require_extend = __commonJS((exports, module) => {
868
868
 
869
869
  // src/ui/frame.tsx
870
870
  import { jsxDEV, Fragment } from "preact/jsx-dev-runtime";
871
- var RizomFrame = ({ children }) => /* @__PURE__ */ jsxDEV(Fragment, {
871
+ var RizomFrame = ({
872
+ children,
873
+ canvas = true
874
+ }) => /* @__PURE__ */ jsxDEV(Fragment, {
872
875
  children: [
873
- /* @__PURE__ */ jsxDEV("div", {
876
+ canvas && /* @__PURE__ */ jsxDEV("div", {
874
877
  id: "bgCanvasWrap",
875
878
  className: "rizom-frame-canvas-wrap fixed top-0 left-0 w-full h-full pointer-events-none",
876
879
  children: /* @__PURE__ */ jsxDEV("canvas", {
@@ -27553,6 +27556,9 @@ class StructuredContentFormatter {
27553
27556
  }
27554
27557
  return error51 instanceof Error ? error51.message : String(error51);
27555
27558
  }
27559
+ escapeBlockMarkup(value) {
27560
+ return value.replace(/^(\s*)#/gm, "$1\\#");
27561
+ }
27556
27562
  formatField(data, mapping, lines, depth) {
27557
27563
  const heading2 = "#".repeat(depth) + " " + mapping.label;
27558
27564
  const value = this.getValueByPath(data, mapping.key);
@@ -27569,7 +27575,9 @@ class StructuredContentFormatter {
27569
27575
  switch (mapping.type) {
27570
27576
  case "string":
27571
27577
  case "number":
27572
- lines.push(heading2, String(value ?? ""), "");
27578
+ if (value === undefined || value === null)
27579
+ break;
27580
+ lines.push(heading2, this.escapeBlockMarkup(String(value)), "");
27573
27581
  break;
27574
27582
  case "object":
27575
27583
  lines.push(heading2);
@@ -30947,6 +30955,18 @@ function mergeContent(baseContent, overrideContent) {
30947
30955
  ];
30948
30956
  return merged.length > 0 ? merged : undefined;
30949
30957
  }
30958
+ function normalizeSections(sections) {
30959
+ if (!sections)
30960
+ return [];
30961
+ return Array.isArray(sections) ? sections : [sections];
30962
+ }
30963
+ function mergeSections(baseSections, overrideSections) {
30964
+ const merged = [
30965
+ ...normalizeSections(baseSections),
30966
+ ...normalizeSections(overrideSections)
30967
+ ];
30968
+ return merged.length > 0 ? merged : undefined;
30969
+ }
30950
30970
  function mergeRoutes(baseRoutes, overrideRoutes) {
30951
30971
  if (!overrideRoutes || overrideRoutes.length === 0) {
30952
30972
  return baseRoutes;
@@ -30990,12 +31010,14 @@ function extendSite(baseSite, overrides = {}) {
30990
31010
  ...overrideHeadScripts ?? []
30991
31011
  ];
30992
31012
  const content3 = mergeContent(baseSite.content, overrides.content);
31013
+ const sections = mergeSections(baseSite.sections, overrides.sections);
30993
31014
  return {
30994
31015
  layouts,
30995
31016
  routes: mergeRoutes(baseSite.routes, overrides.routes),
30996
31017
  ...plugin ? { plugin } : {},
30997
31018
  entityDisplay,
30998
31019
  ...content3 ? { content: content3 } : {},
31020
+ ...sections ? { sections } : {},
30999
31021
  ...themeOverride ? { themeOverride } : {},
31000
31022
  ...headScripts.length > 0 ? { headScripts } : {},
31001
31023
  ...staticAssets && Object.keys(staticAssets).length > 0 ? { staticAssets } : {}
@@ -31053,14 +31075,19 @@ function createRuntimePlugin(options) {
31053
31075
  if (!options.runtime?.templates && !options.runtime?.dataSources?.length) {
31054
31076
  return;
31055
31077
  }
31056
- return (config2) => new RizomVariantPlugin(options.packageName, { themeProfile: options.themeProfile, ...config2 ?? {} }, buildTemplateGroups(options), options.runtime?.dataSources);
31078
+ return (config2) => new RizomVariantPlugin(options.packageName, {
31079
+ ...options.themeProfile ? { themeProfile: options.themeProfile } : {},
31080
+ ...config2 ?? {}
31081
+ }, buildTemplateGroups(options), options.runtime?.dataSources);
31057
31082
  }
31058
31083
  function createRizomSite(options) {
31059
31084
  const plugin = createRuntimePlugin(options);
31060
31085
  return extendSite(rizomBaseSite, {
31061
31086
  layouts: { default: options.layout },
31062
31087
  routes: options.routes,
31088
+ ...options.entityDisplay ? { entityDisplay: options.entityDisplay } : {},
31063
31089
  ...options.content ? { content: options.content } : {},
31090
+ ...options.sections ? { sections: options.sections } : {},
31064
31091
  headScripts: [buildRizomHeadScript(options.themeProfile)],
31065
31092
  ...plugin ? { plugin } : {},
31066
31093
  ...options.themeOverride ? { themeOverride: options.themeOverride } : {}
@@ -31086,4 +31113,4 @@ export {
31086
31113
  Badge2 as Badge
31087
31114
  };
31088
31115
 
31089
- //# debugId=6934BF408C64D2BE64756E2164756E21
31116
+ //# debugId=41486E44A97D407C64756E2164756E21