@olonjs/core 1.1.10 → 1.1.12

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
@@ -50,6 +50,8 @@ declare interface AdminSidebarProps {
50
50
  };
51
51
  /** All sections (header + page sections + footer) for resolving modal section data. */
52
52
  allSectionsData?: Section[];
53
+ collections?: JsonPagesConfig['collections'];
54
+ collectionSource?: string;
53
55
  onUpdate: (newData: Record<string, unknown>) => void;
54
56
  /** Update a section by id/scope (e.g. from settings modal). When provided with allSectionsData, gear opens modal. */
55
57
  onUpdateSection?: OnUpdateSection;
@@ -98,6 +100,11 @@ declare interface AdminSidebarProps {
98
100
  onPageChange?: (slug: string) => void;
99
101
  }
100
102
 
103
+ declare function applyCollectionRefBindingsToDraft(authoredSectionData: unknown, nextData: Record<string, unknown>, collectionsDraft: JsonPagesConfig['collections'] | undefined, collectionContext?: CollectionResolutionContext | null, collectionSchemas?: JsonPagesConfig['collectionSchemas']): {
104
+ normalizedData: Record<string, unknown>;
105
+ collectionsDraft: JsonPagesConfig['collections'];
106
+ };
107
+
101
108
  export declare function applyMenuRefBindingsToDraft(authoredSectionData: unknown, nextData: Record<string, unknown>, menuDraft: MenuConfig): {
102
109
  normalizedData: Record<string, unknown>;
103
110
  menuDraft: MenuConfig;
@@ -137,6 +144,14 @@ export declare const BaseArrayItem: z.ZodObject<{
137
144
  id?: string | undefined;
138
145
  }>;
139
146
 
147
+ export declare const BaseCollectionItem: z.ZodObject<{
148
+ id: z.ZodString;
149
+ }, "strip", z.ZodTypeAny, {
150
+ id: string;
151
+ }, {
152
+ id: string;
153
+ }>;
154
+
140
155
  export declare interface BaseSection<K extends keyof SectionDataRegistry> {
141
156
  id: string;
142
157
  type: K;
@@ -231,6 +246,32 @@ export declare function buildWebMcpToolName(): string;
231
246
 
232
247
  export declare function cn(...inputs: ClassValue[]): string;
233
248
 
249
+ export declare type CollectionDocument<TItem = CollectionItem> = Record<string, TItem>;
250
+
251
+ declare type CollectionDocuments = NonNullable<JsonPagesConfig['collections']>;
252
+
253
+ export declare interface CollectionItem {
254
+ id: string;
255
+ }
256
+
257
+ export declare interface CollectionItemRegistry {
258
+ }
259
+
260
+ declare interface CollectionRefBinding {
261
+ fieldKey: string;
262
+ source: string;
263
+ itemId?: string;
264
+ }
265
+
266
+ declare interface CollectionResolutionContext {
267
+ source: string;
268
+ paramKey: string;
269
+ paramValue: string;
270
+ currentItem: unknown;
271
+ }
272
+
273
+ export declare type CollectionType = keyof CollectionItemRegistry extends never ? string : keyof CollectionItemRegistry;
274
+
234
275
  export declare interface ConfigContextValue {
235
276
  registry: Registry;
236
277
  schemas: Schemas;
@@ -251,13 +292,18 @@ export declare namespace contract {
251
292
  BaseSectionSettings,
252
293
  SectionDataRegistry,
253
294
  SectionSettingsRegistry,
295
+ CollectionItemRegistry,
254
296
  BaseSection,
255
297
  FallbackSection,
256
298
  Section,
257
299
  SectionType,
300
+ CollectionItem,
301
+ CollectionType,
302
+ CollectionDocument,
258
303
  MenuItem,
259
304
  MenuConfig,
260
305
  PageMeta,
306
+ PageCollectionBinding,
261
307
  PageConfig,
262
308
  SiteIdentity,
263
309
  SiteConfig,
@@ -279,14 +325,20 @@ export declare namespace contract {
279
325
  AssetsConfig,
280
326
  WebMcpConfig,
281
327
  JsonPagesConfig,
328
+ validateCollectionDocuments,
329
+ resolveCollectionContext,
282
330
  getMenuRefBindings,
283
331
  applyMenuRefBindingsToDraft,
332
+ getCollectionRefBindings,
333
+ applyCollectionRefBindingsToDraft,
284
334
  applySiteMenuRefBindingsToDraft,
285
335
  resolveHeaderMenuItems,
286
336
  resolveSectionMenuItems,
287
337
  resolveRuntimeConfig,
288
338
  RefDocuments,
339
+ CollectionResolutionContext,
289
340
  MenuRefBinding,
341
+ CollectionRefBinding,
290
342
  buildPageContractHref,
291
343
  buildPageManifestHref,
292
344
  buildPageContract,
@@ -378,6 +430,8 @@ declare interface FormFactoryProps {
378
430
  schema: z.ZodObject<z.ZodRawShape>;
379
431
  data: Record<string, unknown>;
380
432
  onChange: (newData: Record<string, unknown>) => void;
433
+ collections?: JsonPagesConfig['collections'];
434
+ collectionSource?: string;
381
435
  /** When set, only render fields whose key is in this array (e.g. Content vs Settings tabs). */
382
436
  keys?: string[] | null;
383
437
  /** Root-to-leaf path for deep focus (e.g. silos -> blocks). First segment applies to this level. */
@@ -399,6 +453,8 @@ export declare interface FormState {
399
453
 
400
454
  export declare type FormStatus = 'idle' | 'submitting' | 'success' | 'error';
401
455
 
456
+ declare function getCollectionRefBindings(sectionData: unknown, collectionContext?: CollectionResolutionContext | null): CollectionRefBinding[];
457
+
402
458
  export declare function getMenuRefBindings(sectionData: unknown): MenuRefBinding[];
403
459
 
404
460
  /**
@@ -435,10 +491,7 @@ export declare interface JsonPagesConfig {
435
491
  tenantId: string;
436
492
  basePath?: string;
437
493
  registry: Record<string, default_2.ComponentType<unknown>>;
438
- schemas: Record<string, {
439
- parse: (v: unknown) => unknown;
440
- shape?: Record<string, unknown>;
441
- }>;
494
+ schemas: Record<string, SchemaLike>;
442
495
  /**
443
496
  * Optional registry of Zod submission schemas for sections that can be filled
444
497
  * by external agents (e.g. MCP-connected AI clients).
@@ -460,14 +513,13 @@ export declare interface JsonPagesConfig {
460
513
  * See `docs/decisions/ADR-0002-form-submission-schemas.md` for rationale,
461
514
  * tenant convention, and the full emission contract.
462
515
  */
463
- submissionSchemas?: Record<string, {
464
- parse: (v: unknown) => unknown;
465
- shape?: Record<string, unknown>;
466
- }>;
516
+ submissionSchemas?: Record<string, SchemaLike>;
517
+ collectionSchemas?: Record<string, SchemaLike>;
467
518
  pages: Record<string, PageConfig>;
468
519
  siteConfig: SiteConfig;
469
520
  themeConfig: ThemeConfig;
470
521
  menuConfig: MenuConfig;
522
+ collections?: Record<string, CollectionDocument<unknown>>;
471
523
  refDocuments?: Record<string, unknown>;
472
524
  persistence?: Partial<PersistenceConfig>;
473
525
  themeCss: ThemeCssConfig;
@@ -497,13 +549,18 @@ export declare namespace kernel {
497
549
  BaseSectionSettings,
498
550
  SectionDataRegistry,
499
551
  SectionSettingsRegistry,
552
+ CollectionItemRegistry,
500
553
  BaseSection,
501
554
  FallbackSection,
502
555
  Section,
503
556
  SectionType,
557
+ CollectionItem,
558
+ CollectionType,
559
+ CollectionDocument,
504
560
  MenuItem,
505
561
  MenuConfig,
506
562
  PageMeta,
563
+ PageCollectionBinding,
507
564
  PageConfig,
508
565
  SiteIdentity,
509
566
  SiteConfig,
@@ -651,11 +708,17 @@ declare interface OlonJsSiteManifestIndex {
651
708
  /** Used by the section-settings modal to update a section without changing Inspector selection. */
652
709
  export declare type OnUpdateSection = (sectionId: string, scope: 'global' | 'local', sectionType: string, newData: Record<string, unknown>) => void;
653
710
 
711
+ export declare interface PageCollectionBinding {
712
+ source: CollectionType;
713
+ paramKey: string;
714
+ }
715
+
654
716
  export declare interface PageConfig {
655
717
  id: string;
656
718
  slug: string;
657
719
  meta: PageMeta;
658
720
  sections: Section[];
721
+ collection?: PageCollectionBinding;
659
722
  /** When `false`, Core does not render the global header from `site.json` for this page. Omitted = default (show if configured). */
660
723
  'global-header'?: boolean;
661
724
  }
@@ -674,6 +737,13 @@ export declare interface PageRendererProps {
674
737
  selectedId?: string | null;
675
738
  }
676
739
 
740
+ export declare interface PageRouteMatch {
741
+ page: PageConfig;
742
+ registrySlug: string;
743
+ requestedSlug: string;
744
+ params: Record<string, string>;
745
+ }
746
+
677
747
  /**
678
748
  * Enterprise-grade page switcher: popover trigger + list, a11y, single source of styling.
679
749
  * Use in Inspector header when multiple pages exist and onPageChange is provided.
@@ -727,6 +797,7 @@ export declare interface ProjectState {
727
797
  site: SiteConfig;
728
798
  menu: MenuConfig;
729
799
  theme: ThemeConfig;
800
+ collections?: Record<string, CollectionDocument<unknown>>;
730
801
  }
731
802
 
732
803
  declare type Props = PageRendererProps & {
@@ -743,12 +814,38 @@ declare type Registry = JsonPagesConfig['registry'];
743
814
 
744
815
  export declare const resolveAssetUrl: (path: string, tenantId?: string, basePath?: string) => string;
745
816
 
817
+ declare function resolveCollectionContext(page: PageConfig, params: Record<string, string | undefined>, collections?: JsonPagesConfig['collections']): CollectionResolutionContext | null;
818
+
819
+ export declare interface ResolvedPublicPageDocument {
820
+ page: PageConfig;
821
+ siteConfig: SiteConfig;
822
+ themeConfig: JsonPagesConfig['themeConfig'];
823
+ menuConfig: MenuConfig;
824
+ pageMatch: PageRouteMatch;
825
+ collectionContext: CollectionResolutionContext | null;
826
+ }
827
+
746
828
  export declare function resolveHeaderMenuItems(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
747
829
 
748
830
  export declare function resolveMenuMainFromHeaderData(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
749
831
 
750
832
  export declare function resolvePageFromRegistry(pageRegistry: Record<string, PageConfig>, requestedSlug: string): PageConfig | undefined;
751
833
 
834
+ export declare function resolvePageMatchFromRegistry(pageRegistry: Record<string, PageConfig>, requestedSlug: string): PageRouteMatch | undefined;
835
+
836
+ export declare function resolvePublicPageDocument(input: ResolvePublicPageDocumentInput): ResolvedPublicPageDocument | null;
837
+
838
+ export declare interface ResolvePublicPageDocumentInput {
839
+ slug: string;
840
+ pages: Record<string, PageConfig>;
841
+ siteConfig: SiteConfig;
842
+ themeConfig: JsonPagesConfig['themeConfig'];
843
+ menuConfig: MenuConfig;
844
+ collections?: JsonPagesConfig['collections'];
845
+ collectionSchemas?: JsonPagesConfig['collectionSchemas'];
846
+ refDocuments?: JsonPagesConfig['refDocuments'];
847
+ }
848
+
752
849
  export declare function resolveRuntimeConfig(input: RuntimeResolutionInput): RuntimeResolutionResult;
753
850
 
754
851
  export declare function resolveSectionMenuItems(section: Section, fallbackMain: MenuItem[]): MenuItem[] | undefined;
@@ -787,9 +884,14 @@ export declare namespace runtime {
787
884
  syncWebMcpJsonLd,
788
885
  isRecord,
789
886
  normalizeSlugSegments,
887
+ resolvePageMatchFromRegistry,
790
888
  resolveMenuMainFromHeaderData,
791
889
  resolvePageFromRegistry,
792
890
  resolveSlugFromPathname,
891
+ PageRouteMatch,
892
+ resolvePublicPageDocument,
893
+ ResolvedPublicPageDocument,
894
+ ResolvePublicPageDocumentInput,
793
895
  isCanonicalAssetUrl,
794
896
  isTransientAssetUrl,
795
897
  resolveAssetUrl,
@@ -806,6 +908,9 @@ declare interface RuntimeResolutionInput {
806
908
  siteConfig: SiteConfig;
807
909
  themeConfig: ThemeConfig;
808
910
  menuConfig: MenuConfig;
911
+ collections?: JsonPagesConfig['collections'];
912
+ collectionSchemas?: JsonPagesConfig['collectionSchemas'];
913
+ collectionContext?: CollectionResolutionContext | null;
809
914
  refDocuments?: JsonPagesConfig['refDocuments'];
810
915
  }
811
916
 
@@ -814,6 +919,8 @@ declare interface RuntimeResolutionResult {
814
919
  siteConfig: SiteConfig;
815
920
  themeConfig: ThemeConfig;
816
921
  menuConfig: MenuConfig;
922
+ collections: CollectionDocuments;
923
+ collectionContext: CollectionResolutionContext | null;
817
924
  }
818
925
 
819
926
  declare interface SaveStreamDoneEvent {
@@ -832,6 +939,11 @@ declare interface SaveStreamStepEvent {
832
939
  label?: string;
833
940
  }
834
941
 
942
+ declare type SchemaLike = {
943
+ parse: (v: unknown) => unknown;
944
+ shape?: Record<string, unknown>;
945
+ };
946
+
835
947
  declare type Schemas = JsonPagesConfig['schemas'];
836
948
 
837
949
  /** Computed union of all registered section types. */
@@ -946,6 +1058,8 @@ export declare interface StudioRouteProps {
946
1058
  siteConfig: SiteConfig;
947
1059
  menuConfig: MenuConfig;
948
1060
  themeConfig: JsonPagesConfig['themeConfig'];
1061
+ collections?: JsonPagesConfig['collections'];
1062
+ collectionSchemas?: JsonPagesConfig['collectionSchemas'];
949
1063
  refDocuments?: JsonPagesConfig['refDocuments'];
950
1064
  tenantCss: string;
951
1065
  adminCss: string;
@@ -1043,6 +1157,8 @@ export declare function useFormState(formId: string): FormState;
1043
1157
 
1044
1158
  export declare const useStudio: () => StudioContextType;
1045
1159
 
1160
+ declare function validateCollectionDocuments(collections?: JsonPagesConfig['collections'], collectionSchemas?: JsonPagesConfig['collectionSchemas']): CollectionDocuments;
1161
+
1046
1162
  export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
1047
1163
 
1048
1164
  export declare interface VisitorRouteProps {
@@ -1050,6 +1166,8 @@ export declare interface VisitorRouteProps {
1050
1166
  siteConfig: SiteConfig;
1051
1167
  menuConfig: MenuConfig;
1052
1168
  themeConfig: JsonPagesConfig['themeConfig'];
1169
+ collections?: JsonPagesConfig['collections'];
1170
+ collectionSchemas?: JsonPagesConfig['collectionSchemas'];
1053
1171
  refDocuments?: JsonPagesConfig['refDocuments'];
1054
1172
  tenantCss: string;
1055
1173
  adminCss: string;