@olonjs/core 1.1.9 → 1.1.11
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 +122 -8
- package/dist/olonjs-core-runtime.js +1228 -1075
- package/dist/olonjs-core.js +5659 -5287
- package/dist/olonjs-core.umd.cjs +42 -42
- package/dist/runtime.d.ts +122 -8
- package/package.json +1 -1
package/dist/runtime.d.ts
CHANGED
|
@@ -98,6 +98,11 @@ declare interface AdminSidebarProps {
|
|
|
98
98
|
onPageChange?: (slug: string) => void;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
declare function applyCollectionRefBindingsToDraft(authoredSectionData: unknown, nextData: Record<string, unknown>, collectionsDraft: JsonPagesConfig['collections'] | undefined, collectionContext?: CollectionResolutionContext | null, collectionSchemas?: JsonPagesConfig['collectionSchemas']): {
|
|
102
|
+
normalizedData: Record<string, unknown>;
|
|
103
|
+
collectionsDraft: JsonPagesConfig['collections'];
|
|
104
|
+
};
|
|
105
|
+
|
|
101
106
|
export declare function applyMenuRefBindingsToDraft(authoredSectionData: unknown, nextData: Record<string, unknown>, menuDraft: MenuConfig): {
|
|
102
107
|
normalizedData: Record<string, unknown>;
|
|
103
108
|
menuDraft: MenuConfig;
|
|
@@ -137,6 +142,14 @@ export declare const BaseArrayItem: z.ZodObject<{
|
|
|
137
142
|
id?: string | undefined;
|
|
138
143
|
}>;
|
|
139
144
|
|
|
145
|
+
export declare const BaseCollectionItem: z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
id: string;
|
|
149
|
+
}, {
|
|
150
|
+
id: string;
|
|
151
|
+
}>;
|
|
152
|
+
|
|
140
153
|
export declare interface BaseSection<K extends keyof SectionDataRegistry> {
|
|
141
154
|
id: string;
|
|
142
155
|
type: K;
|
|
@@ -231,6 +244,32 @@ export declare function buildWebMcpToolName(): string;
|
|
|
231
244
|
|
|
232
245
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
233
246
|
|
|
247
|
+
export declare type CollectionDocument<TItem = CollectionItem> = Record<string, TItem>;
|
|
248
|
+
|
|
249
|
+
declare type CollectionDocuments = NonNullable<JsonPagesConfig['collections']>;
|
|
250
|
+
|
|
251
|
+
export declare interface CollectionItem {
|
|
252
|
+
id: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export declare interface CollectionItemRegistry {
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare interface CollectionRefBinding {
|
|
259
|
+
fieldKey: string;
|
|
260
|
+
source: string;
|
|
261
|
+
itemId?: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare interface CollectionResolutionContext {
|
|
265
|
+
source: string;
|
|
266
|
+
paramKey: string;
|
|
267
|
+
paramValue: string;
|
|
268
|
+
currentItem: unknown;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export declare type CollectionType = keyof CollectionItemRegistry extends never ? string : keyof CollectionItemRegistry;
|
|
272
|
+
|
|
234
273
|
export declare interface ConfigContextValue {
|
|
235
274
|
registry: Registry;
|
|
236
275
|
schemas: Schemas;
|
|
@@ -251,13 +290,18 @@ export declare namespace contract {
|
|
|
251
290
|
BaseSectionSettings,
|
|
252
291
|
SectionDataRegistry,
|
|
253
292
|
SectionSettingsRegistry,
|
|
293
|
+
CollectionItemRegistry,
|
|
254
294
|
BaseSection,
|
|
255
295
|
FallbackSection,
|
|
256
296
|
Section,
|
|
257
297
|
SectionType,
|
|
298
|
+
CollectionItem,
|
|
299
|
+
CollectionType,
|
|
300
|
+
CollectionDocument,
|
|
258
301
|
MenuItem,
|
|
259
302
|
MenuConfig,
|
|
260
303
|
PageMeta,
|
|
304
|
+
PageCollectionBinding,
|
|
261
305
|
PageConfig,
|
|
262
306
|
SiteIdentity,
|
|
263
307
|
SiteConfig,
|
|
@@ -279,14 +323,20 @@ export declare namespace contract {
|
|
|
279
323
|
AssetsConfig,
|
|
280
324
|
WebMcpConfig,
|
|
281
325
|
JsonPagesConfig,
|
|
326
|
+
validateCollectionDocuments,
|
|
327
|
+
resolveCollectionContext,
|
|
282
328
|
getMenuRefBindings,
|
|
283
329
|
applyMenuRefBindingsToDraft,
|
|
330
|
+
getCollectionRefBindings,
|
|
331
|
+
applyCollectionRefBindingsToDraft,
|
|
284
332
|
applySiteMenuRefBindingsToDraft,
|
|
285
333
|
resolveHeaderMenuItems,
|
|
286
334
|
resolveSectionMenuItems,
|
|
287
335
|
resolveRuntimeConfig,
|
|
288
336
|
RefDocuments,
|
|
337
|
+
CollectionResolutionContext,
|
|
289
338
|
MenuRefBinding,
|
|
339
|
+
CollectionRefBinding,
|
|
290
340
|
buildPageContractHref,
|
|
291
341
|
buildPageManifestHref,
|
|
292
342
|
buildPageContract,
|
|
@@ -399,6 +449,8 @@ export declare interface FormState {
|
|
|
399
449
|
|
|
400
450
|
export declare type FormStatus = 'idle' | 'submitting' | 'success' | 'error';
|
|
401
451
|
|
|
452
|
+
declare function getCollectionRefBindings(sectionData: unknown, collectionContext?: CollectionResolutionContext | null): CollectionRefBinding[];
|
|
453
|
+
|
|
402
454
|
export declare function getMenuRefBindings(sectionData: unknown): MenuRefBinding[];
|
|
403
455
|
|
|
404
456
|
/**
|
|
@@ -435,10 +487,7 @@ export declare interface JsonPagesConfig {
|
|
|
435
487
|
tenantId: string;
|
|
436
488
|
basePath?: string;
|
|
437
489
|
registry: Record<string, default_2.ComponentType<unknown>>;
|
|
438
|
-
schemas: Record<string,
|
|
439
|
-
parse: (v: unknown) => unknown;
|
|
440
|
-
shape?: Record<string, unknown>;
|
|
441
|
-
}>;
|
|
490
|
+
schemas: Record<string, SchemaLike>;
|
|
442
491
|
/**
|
|
443
492
|
* Optional registry of Zod submission schemas for sections that can be filled
|
|
444
493
|
* by external agents (e.g. MCP-connected AI clients).
|
|
@@ -460,14 +509,13 @@ export declare interface JsonPagesConfig {
|
|
|
460
509
|
* See `docs/decisions/ADR-0002-form-submission-schemas.md` for rationale,
|
|
461
510
|
* tenant convention, and the full emission contract.
|
|
462
511
|
*/
|
|
463
|
-
submissionSchemas?: Record<string,
|
|
464
|
-
|
|
465
|
-
shape?: Record<string, unknown>;
|
|
466
|
-
}>;
|
|
512
|
+
submissionSchemas?: Record<string, SchemaLike>;
|
|
513
|
+
collectionSchemas?: Record<string, SchemaLike>;
|
|
467
514
|
pages: Record<string, PageConfig>;
|
|
468
515
|
siteConfig: SiteConfig;
|
|
469
516
|
themeConfig: ThemeConfig;
|
|
470
517
|
menuConfig: MenuConfig;
|
|
518
|
+
collections?: Record<string, CollectionDocument<unknown>>;
|
|
471
519
|
refDocuments?: Record<string, unknown>;
|
|
472
520
|
persistence?: Partial<PersistenceConfig>;
|
|
473
521
|
themeCss: ThemeCssConfig;
|
|
@@ -497,13 +545,18 @@ export declare namespace kernel {
|
|
|
497
545
|
BaseSectionSettings,
|
|
498
546
|
SectionDataRegistry,
|
|
499
547
|
SectionSettingsRegistry,
|
|
548
|
+
CollectionItemRegistry,
|
|
500
549
|
BaseSection,
|
|
501
550
|
FallbackSection,
|
|
502
551
|
Section,
|
|
503
552
|
SectionType,
|
|
553
|
+
CollectionItem,
|
|
554
|
+
CollectionType,
|
|
555
|
+
CollectionDocument,
|
|
504
556
|
MenuItem,
|
|
505
557
|
MenuConfig,
|
|
506
558
|
PageMeta,
|
|
559
|
+
PageCollectionBinding,
|
|
507
560
|
PageConfig,
|
|
508
561
|
SiteIdentity,
|
|
509
562
|
SiteConfig,
|
|
@@ -651,11 +704,17 @@ declare interface OlonJsSiteManifestIndex {
|
|
|
651
704
|
/** Used by the section-settings modal to update a section without changing Inspector selection. */
|
|
652
705
|
export declare type OnUpdateSection = (sectionId: string, scope: 'global' | 'local', sectionType: string, newData: Record<string, unknown>) => void;
|
|
653
706
|
|
|
707
|
+
export declare interface PageCollectionBinding {
|
|
708
|
+
source: CollectionType;
|
|
709
|
+
paramKey: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
654
712
|
export declare interface PageConfig {
|
|
655
713
|
id: string;
|
|
656
714
|
slug: string;
|
|
657
715
|
meta: PageMeta;
|
|
658
716
|
sections: Section[];
|
|
717
|
+
collection?: PageCollectionBinding;
|
|
659
718
|
/** When `false`, Core does not render the global header from `site.json` for this page. Omitted = default (show if configured). */
|
|
660
719
|
'global-header'?: boolean;
|
|
661
720
|
}
|
|
@@ -674,6 +733,13 @@ export declare interface PageRendererProps {
|
|
|
674
733
|
selectedId?: string | null;
|
|
675
734
|
}
|
|
676
735
|
|
|
736
|
+
export declare interface PageRouteMatch {
|
|
737
|
+
page: PageConfig;
|
|
738
|
+
registrySlug: string;
|
|
739
|
+
requestedSlug: string;
|
|
740
|
+
params: Record<string, string>;
|
|
741
|
+
}
|
|
742
|
+
|
|
677
743
|
/**
|
|
678
744
|
* Enterprise-grade page switcher: popover trigger + list, a11y, single source of styling.
|
|
679
745
|
* Use in Inspector header when multiple pages exist and onPageChange is provided.
|
|
@@ -727,6 +793,7 @@ export declare interface ProjectState {
|
|
|
727
793
|
site: SiteConfig;
|
|
728
794
|
menu: MenuConfig;
|
|
729
795
|
theme: ThemeConfig;
|
|
796
|
+
collections?: Record<string, CollectionDocument<unknown>>;
|
|
730
797
|
}
|
|
731
798
|
|
|
732
799
|
declare type Props = PageRendererProps & {
|
|
@@ -743,12 +810,38 @@ declare type Registry = JsonPagesConfig['registry'];
|
|
|
743
810
|
|
|
744
811
|
export declare const resolveAssetUrl: (path: string, tenantId?: string, basePath?: string) => string;
|
|
745
812
|
|
|
813
|
+
declare function resolveCollectionContext(page: PageConfig, params: Record<string, string | undefined>, collections?: JsonPagesConfig['collections']): CollectionResolutionContext | null;
|
|
814
|
+
|
|
815
|
+
export declare interface ResolvedPublicPageDocument {
|
|
816
|
+
page: PageConfig;
|
|
817
|
+
siteConfig: SiteConfig;
|
|
818
|
+
themeConfig: JsonPagesConfig['themeConfig'];
|
|
819
|
+
menuConfig: MenuConfig;
|
|
820
|
+
pageMatch: PageRouteMatch;
|
|
821
|
+
collectionContext: CollectionResolutionContext | null;
|
|
822
|
+
}
|
|
823
|
+
|
|
746
824
|
export declare function resolveHeaderMenuItems(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
|
|
747
825
|
|
|
748
826
|
export declare function resolveMenuMainFromHeaderData(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
|
|
749
827
|
|
|
750
828
|
export declare function resolvePageFromRegistry(pageRegistry: Record<string, PageConfig>, requestedSlug: string): PageConfig | undefined;
|
|
751
829
|
|
|
830
|
+
export declare function resolvePageMatchFromRegistry(pageRegistry: Record<string, PageConfig>, requestedSlug: string): PageRouteMatch | undefined;
|
|
831
|
+
|
|
832
|
+
export declare function resolvePublicPageDocument(input: ResolvePublicPageDocumentInput): ResolvedPublicPageDocument | null;
|
|
833
|
+
|
|
834
|
+
export declare interface ResolvePublicPageDocumentInput {
|
|
835
|
+
slug: string;
|
|
836
|
+
pages: Record<string, PageConfig>;
|
|
837
|
+
siteConfig: SiteConfig;
|
|
838
|
+
themeConfig: JsonPagesConfig['themeConfig'];
|
|
839
|
+
menuConfig: MenuConfig;
|
|
840
|
+
collections?: JsonPagesConfig['collections'];
|
|
841
|
+
collectionSchemas?: JsonPagesConfig['collectionSchemas'];
|
|
842
|
+
refDocuments?: JsonPagesConfig['refDocuments'];
|
|
843
|
+
}
|
|
844
|
+
|
|
752
845
|
export declare function resolveRuntimeConfig(input: RuntimeResolutionInput): RuntimeResolutionResult;
|
|
753
846
|
|
|
754
847
|
export declare function resolveSectionMenuItems(section: Section, fallbackMain: MenuItem[]): MenuItem[] | undefined;
|
|
@@ -787,9 +880,14 @@ export declare namespace runtime {
|
|
|
787
880
|
syncWebMcpJsonLd,
|
|
788
881
|
isRecord,
|
|
789
882
|
normalizeSlugSegments,
|
|
883
|
+
resolvePageMatchFromRegistry,
|
|
790
884
|
resolveMenuMainFromHeaderData,
|
|
791
885
|
resolvePageFromRegistry,
|
|
792
886
|
resolveSlugFromPathname,
|
|
887
|
+
PageRouteMatch,
|
|
888
|
+
resolvePublicPageDocument,
|
|
889
|
+
ResolvedPublicPageDocument,
|
|
890
|
+
ResolvePublicPageDocumentInput,
|
|
793
891
|
isCanonicalAssetUrl,
|
|
794
892
|
isTransientAssetUrl,
|
|
795
893
|
resolveAssetUrl,
|
|
@@ -806,6 +904,9 @@ declare interface RuntimeResolutionInput {
|
|
|
806
904
|
siteConfig: SiteConfig;
|
|
807
905
|
themeConfig: ThemeConfig;
|
|
808
906
|
menuConfig: MenuConfig;
|
|
907
|
+
collections?: JsonPagesConfig['collections'];
|
|
908
|
+
collectionSchemas?: JsonPagesConfig['collectionSchemas'];
|
|
909
|
+
collectionContext?: CollectionResolutionContext | null;
|
|
809
910
|
refDocuments?: JsonPagesConfig['refDocuments'];
|
|
810
911
|
}
|
|
811
912
|
|
|
@@ -814,6 +915,8 @@ declare interface RuntimeResolutionResult {
|
|
|
814
915
|
siteConfig: SiteConfig;
|
|
815
916
|
themeConfig: ThemeConfig;
|
|
816
917
|
menuConfig: MenuConfig;
|
|
918
|
+
collections: CollectionDocuments;
|
|
919
|
+
collectionContext: CollectionResolutionContext | null;
|
|
817
920
|
}
|
|
818
921
|
|
|
819
922
|
declare interface SaveStreamDoneEvent {
|
|
@@ -832,6 +935,11 @@ declare interface SaveStreamStepEvent {
|
|
|
832
935
|
label?: string;
|
|
833
936
|
}
|
|
834
937
|
|
|
938
|
+
declare type SchemaLike = {
|
|
939
|
+
parse: (v: unknown) => unknown;
|
|
940
|
+
shape?: Record<string, unknown>;
|
|
941
|
+
};
|
|
942
|
+
|
|
835
943
|
declare type Schemas = JsonPagesConfig['schemas'];
|
|
836
944
|
|
|
837
945
|
/** Computed union of all registered section types. */
|
|
@@ -946,6 +1054,8 @@ export declare interface StudioRouteProps {
|
|
|
946
1054
|
siteConfig: SiteConfig;
|
|
947
1055
|
menuConfig: MenuConfig;
|
|
948
1056
|
themeConfig: JsonPagesConfig['themeConfig'];
|
|
1057
|
+
collections?: JsonPagesConfig['collections'];
|
|
1058
|
+
collectionSchemas?: JsonPagesConfig['collectionSchemas'];
|
|
949
1059
|
refDocuments?: JsonPagesConfig['refDocuments'];
|
|
950
1060
|
tenantCss: string;
|
|
951
1061
|
adminCss: string;
|
|
@@ -1043,6 +1153,8 @@ export declare function useFormState(formId: string): FormState;
|
|
|
1043
1153
|
|
|
1044
1154
|
export declare const useStudio: () => StudioContextType;
|
|
1045
1155
|
|
|
1156
|
+
declare function validateCollectionDocuments(collections?: JsonPagesConfig['collections'], collectionSchemas?: JsonPagesConfig['collectionSchemas']): CollectionDocuments;
|
|
1157
|
+
|
|
1046
1158
|
export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
|
|
1047
1159
|
|
|
1048
1160
|
export declare interface VisitorRouteProps {
|
|
@@ -1050,6 +1162,8 @@ export declare interface VisitorRouteProps {
|
|
|
1050
1162
|
siteConfig: SiteConfig;
|
|
1051
1163
|
menuConfig: MenuConfig;
|
|
1052
1164
|
themeConfig: JsonPagesConfig['themeConfig'];
|
|
1165
|
+
collections?: JsonPagesConfig['collections'];
|
|
1166
|
+
collectionSchemas?: JsonPagesConfig['collectionSchemas'];
|
|
1053
1167
|
refDocuments?: JsonPagesConfig['refDocuments'];
|
|
1054
1168
|
tenantCss: string;
|
|
1055
1169
|
adminCss: string;
|