@olonjs/core 1.0.120 → 1.0.122
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 +196 -8
- package/dist/olonjs-core.js +2081 -1936
- package/dist/olonjs-core.umd.cjs +29 -25
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
+
import { Context } from 'react';
|
|
3
4
|
import { default as default_2 } from 'react';
|
|
4
5
|
import { ErrorInfo } from 'react';
|
|
5
6
|
import { JSX } from 'react/jsx-runtime';
|
|
@@ -118,6 +119,14 @@ export declare interface AssetsConfig {
|
|
|
118
119
|
onAssetUpload?: (file: File) => Promise<string>;
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
export declare const BaseArrayItem: z.ZodObject<{
|
|
123
|
+
id: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
id?: string | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
id?: string | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
|
|
121
130
|
export declare interface BaseSection<K extends keyof SectionDataRegistry> {
|
|
122
131
|
id: string;
|
|
123
132
|
type: K;
|
|
@@ -125,6 +134,21 @@ export declare interface BaseSection<K extends keyof SectionDataRegistry> {
|
|
|
125
134
|
settings?: K extends keyof SectionSettingsRegistry ? SectionSettingsRegistry[K] : BaseSectionSettings;
|
|
126
135
|
}
|
|
127
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Base schemas shared by section capsules (CIP governance).
|
|
139
|
+
* Capsules extend these for consistent anchorId, array items, and settings.
|
|
140
|
+
*/
|
|
141
|
+
export declare const BaseSectionData: z.ZodObject<{
|
|
142
|
+
id: z.ZodOptional<z.ZodString>;
|
|
143
|
+
anchorId: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
id?: string | undefined;
|
|
146
|
+
anchorId?: string | undefined;
|
|
147
|
+
}, {
|
|
148
|
+
id?: string | undefined;
|
|
149
|
+
anchorId?: string | undefined;
|
|
150
|
+
}>;
|
|
151
|
+
|
|
128
152
|
/**
|
|
129
153
|
* KERNEL: The Base Contract (MTRP)
|
|
130
154
|
* Core is self-contained; structural types live here.
|
|
@@ -133,6 +157,23 @@ export declare interface BaseSectionSettings {
|
|
|
133
157
|
[key: string]: unknown;
|
|
134
158
|
}
|
|
135
159
|
|
|
160
|
+
export declare const BaseSectionSettingsSchema: z.ZodObject<{
|
|
161
|
+
paddingTop: z.ZodDefault<z.ZodEnum<["none", "sm", "md", "lg", "xl", "2xl"]>>;
|
|
162
|
+
paddingBottom: z.ZodDefault<z.ZodEnum<["none", "sm", "md", "lg", "xl", "2xl"]>>;
|
|
163
|
+
theme: z.ZodDefault<z.ZodEnum<["dark", "light", "accent"]>>;
|
|
164
|
+
container: z.ZodDefault<z.ZodEnum<["boxed", "fluid"]>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
paddingTop: "none" | "sm" | "lg" | "md" | "xl" | "2xl";
|
|
167
|
+
paddingBottom: "none" | "sm" | "lg" | "md" | "xl" | "2xl";
|
|
168
|
+
theme: "dark" | "light" | "accent";
|
|
169
|
+
container: "boxed" | "fluid";
|
|
170
|
+
}, {
|
|
171
|
+
paddingTop?: "none" | "sm" | "lg" | "md" | "xl" | "2xl" | undefined;
|
|
172
|
+
paddingBottom?: "none" | "sm" | "lg" | "md" | "xl" | "2xl" | undefined;
|
|
173
|
+
theme?: "dark" | "light" | "accent" | undefined;
|
|
174
|
+
container?: "boxed" | "fluid" | undefined;
|
|
175
|
+
}>;
|
|
176
|
+
|
|
136
177
|
/**
|
|
137
178
|
* Shared types between Admin Engine and Input Registry.
|
|
138
179
|
*/
|
|
@@ -145,7 +186,7 @@ export declare interface BaseWidgetProps<T = unknown> {
|
|
|
145
186
|
|
|
146
187
|
declare function buildLlmsTxt(input: BuildSiteManifestInput): string;
|
|
147
188
|
|
|
148
|
-
declare function buildPageContract({ slug, pageConfig, schemas, siteConfig, }: BuildPageContractInput): OlonJsPageContract;
|
|
189
|
+
declare function buildPageContract({ slug, pageConfig, schemas, submissionSchemas, siteConfig, }: BuildPageContractInput): OlonJsPageContract;
|
|
149
190
|
|
|
150
191
|
export declare function buildPageContractHref(slug: string): string;
|
|
151
192
|
|
|
@@ -153,6 +194,7 @@ declare interface BuildPageContractInput {
|
|
|
153
194
|
slug: string;
|
|
154
195
|
pageConfig: PageConfig;
|
|
155
196
|
schemas: JsonPagesConfig['schemas'];
|
|
197
|
+
submissionSchemas?: JsonPagesConfig['submissionSchemas'];
|
|
156
198
|
siteConfig: SiteConfig;
|
|
157
199
|
}
|
|
158
200
|
|
|
@@ -162,11 +204,12 @@ export declare function buildPageManifestHref(slug: string): string;
|
|
|
162
204
|
|
|
163
205
|
declare function buildSelectionPath(root: HTMLElement, sectionEl: HTMLElement): SelectionPath;
|
|
164
206
|
|
|
165
|
-
declare function buildSiteManifest({ pages, schemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
|
|
207
|
+
declare function buildSiteManifest({ pages, schemas, submissionSchemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
|
|
166
208
|
|
|
167
209
|
declare interface BuildSiteManifestInput {
|
|
168
210
|
pages: Record<string, PageConfig>;
|
|
169
211
|
schemas: JsonPagesConfig['schemas'];
|
|
212
|
+
submissionSchemas?: JsonPagesConfig['submissionSchemas'];
|
|
170
213
|
siteConfig: SiteConfig;
|
|
171
214
|
}
|
|
172
215
|
|
|
@@ -207,7 +250,6 @@ export declare namespace contract {
|
|
|
207
250
|
PageMeta,
|
|
208
251
|
PageConfig,
|
|
209
252
|
SiteIdentity,
|
|
210
|
-
SitePageEntry,
|
|
211
253
|
SiteConfig,
|
|
212
254
|
ThemeTokenMap,
|
|
213
255
|
ThemeColors,
|
|
@@ -252,8 +294,39 @@ export declare function createWebMcpSaveToolInputSchema(): Record<string, unknow
|
|
|
252
294
|
|
|
253
295
|
export declare function createWebMcpToolInputSchema(): Record<string, unknown>;
|
|
254
296
|
|
|
297
|
+
export declare const CtaSchema: z.ZodObject<{
|
|
298
|
+
id: z.ZodOptional<z.ZodString>;
|
|
299
|
+
label: z.ZodString;
|
|
300
|
+
href: z.ZodString;
|
|
301
|
+
variant: z.ZodDefault<z.ZodEnum<["primary", "secondary", "accent"]>>;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
label: string;
|
|
304
|
+
href: string;
|
|
305
|
+
variant: "accent" | "primary" | "secondary";
|
|
306
|
+
id?: string | undefined;
|
|
307
|
+
}, {
|
|
308
|
+
label: string;
|
|
309
|
+
href: string;
|
|
310
|
+
id?: string | undefined;
|
|
311
|
+
variant?: "accent" | "primary" | "secondary" | undefined;
|
|
312
|
+
}>;
|
|
313
|
+
|
|
255
314
|
export declare const DefaultNotFound: default_2.FC;
|
|
256
315
|
|
|
316
|
+
export declare const DEPLOY_STEPS: readonly DeployStep[];
|
|
317
|
+
|
|
318
|
+
export declare type DeployPhase = 'idle' | 'running' | 'done' | 'error';
|
|
319
|
+
|
|
320
|
+
export declare interface DeployStep {
|
|
321
|
+
id: StepId;
|
|
322
|
+
label: string;
|
|
323
|
+
verb: string;
|
|
324
|
+
poem: [string, string];
|
|
325
|
+
color: string;
|
|
326
|
+
glyph: string;
|
|
327
|
+
duration: number;
|
|
328
|
+
}
|
|
329
|
+
|
|
257
330
|
/**
|
|
258
331
|
* Engine-level error boundary: prevents black screen on any render error
|
|
259
332
|
* and surfaces a visible error UI.
|
|
@@ -305,6 +378,28 @@ declare interface FormFactoryProps {
|
|
|
305
378
|
} | null) => void;
|
|
306
379
|
}
|
|
307
380
|
|
|
381
|
+
export declare interface FormState {
|
|
382
|
+
status: FormStatus;
|
|
383
|
+
message: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export declare type FormStatus = 'idle' | 'submitting' | 'success' | 'error';
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Image picker field: object { url, alt? } with ui:image-picker for Form Factory.
|
|
390
|
+
* Use in section data and resolve with resolveAssetUrl(url, tenantId) in View.
|
|
391
|
+
*/
|
|
392
|
+
export declare const ImageSelectionSchema: z.ZodObject<{
|
|
393
|
+
url: z.ZodString;
|
|
394
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
395
|
+
}, "strip", z.ZodTypeAny, {
|
|
396
|
+
url: string;
|
|
397
|
+
alt?: string | undefined;
|
|
398
|
+
}, {
|
|
399
|
+
url: string;
|
|
400
|
+
alt?: string | undefined;
|
|
401
|
+
}>;
|
|
402
|
+
|
|
308
403
|
export declare const InputWidgets: {
|
|
309
404
|
readonly 'ui:text': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
|
|
310
405
|
readonly 'ui:textarea': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
|
|
@@ -328,6 +423,31 @@ export declare interface JsonPagesConfig {
|
|
|
328
423
|
parse: (v: unknown) => unknown;
|
|
329
424
|
shape?: Record<string, unknown>;
|
|
330
425
|
}>;
|
|
426
|
+
/**
|
|
427
|
+
* Optional registry of Zod submission schemas for sections that can be filled
|
|
428
|
+
* by external agents (e.g. MCP-connected AI clients).
|
|
429
|
+
*
|
|
430
|
+
* Keyed by the same section-type strings used in `schemas`. Each value is a
|
|
431
|
+
* Zod schema describing the section's *submission payload* (what the user
|
|
432
|
+
* fills in) — distinct from `schemas` entries, which describe the section's
|
|
433
|
+
* *UI configuration* (how the tenant author configures the section).
|
|
434
|
+
*
|
|
435
|
+
* When a section type appears on a page AND has an entry here, its JSON
|
|
436
|
+
* Schema representation is emitted on the page contract as
|
|
437
|
+
* `sectionSubmissionSchemas` (see `OlonJsPageContract`).
|
|
438
|
+
*
|
|
439
|
+
* The shape mirrors `schemas` (duck-typed on `{ parse, shape? }`) so core
|
|
440
|
+
* does not force `zod` on consumers at the type level. In practice tenants
|
|
441
|
+
* pass `z.object(...)` instances; the JSON Schema serializer casts to
|
|
442
|
+
* `z.ZodTypeAny` at its own boundary.
|
|
443
|
+
*
|
|
444
|
+
* See `docs/decisions/ADR-0002-form-submission-schemas.md` for rationale,
|
|
445
|
+
* tenant convention, and the full emission contract.
|
|
446
|
+
*/
|
|
447
|
+
submissionSchemas?: Record<string, {
|
|
448
|
+
parse: (v: unknown) => unknown;
|
|
449
|
+
shape?: Record<string, unknown>;
|
|
450
|
+
}>;
|
|
331
451
|
pages: Record<string, PageConfig>;
|
|
332
452
|
siteConfig: SiteConfig;
|
|
333
453
|
themeConfig: ThemeConfig;
|
|
@@ -367,7 +487,6 @@ export declare namespace kernel {
|
|
|
367
487
|
PageMeta,
|
|
368
488
|
PageConfig,
|
|
369
489
|
SiteIdentity,
|
|
370
|
-
SitePageEntry,
|
|
371
490
|
SiteConfig,
|
|
372
491
|
ThemeTokenMap,
|
|
373
492
|
ThemeColors,
|
|
@@ -423,6 +542,13 @@ export declare function normalizeBasePath(value?: string): string;
|
|
|
423
542
|
|
|
424
543
|
export declare function normalizeSlugSegments(value: string): string;
|
|
425
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Context holding the submission state of every olon-managed form,
|
|
547
|
+
* keyed by the form's id attribute (or anchorId).
|
|
548
|
+
* Provided by App.tsx via useOlonForms().
|
|
549
|
+
*/
|
|
550
|
+
export declare const OlonFormsContext: Context<Record<string, FormState>>;
|
|
551
|
+
|
|
426
552
|
declare interface OlonJsPageContract {
|
|
427
553
|
version: '1.0.0';
|
|
428
554
|
kind: 'olonjs-page-contract';
|
|
@@ -434,6 +560,20 @@ declare interface OlonJsPageContract {
|
|
|
434
560
|
sectionTypes: string[];
|
|
435
561
|
sectionInstances: WebMcpSectionInstance[];
|
|
436
562
|
sectionSchemas: Record<string, Record<string, unknown>>;
|
|
563
|
+
/**
|
|
564
|
+
* Optional JSON Schema representations of submission payloads for form-capable
|
|
565
|
+
* sections present on this page. Keyed by section type.
|
|
566
|
+
*
|
|
567
|
+
* Emitted only for section types that (a) actually appear on this page AND
|
|
568
|
+
* (b) have an entry in `JsonPagesConfig.submissionSchemas`. Absent (not `{}`)
|
|
569
|
+
* when no section on the page qualifies, to keep the contract tight.
|
|
570
|
+
*
|
|
571
|
+
* MCP agents consuming this contract can discover form shapes directly from
|
|
572
|
+
* reading the page, without requiring a separate tool call.
|
|
573
|
+
*
|
|
574
|
+
* See `docs/decisions/ADR-0002-form-submission-schemas.md` (emission contract).
|
|
575
|
+
*/
|
|
576
|
+
sectionSubmissionSchemas?: Record<string, Record<string, unknown>>;
|
|
437
577
|
tools: WebMcpToolContract[];
|
|
438
578
|
}
|
|
439
579
|
|
|
@@ -644,6 +784,22 @@ declare interface RuntimeResolutionResult {
|
|
|
644
784
|
menuConfig: MenuConfig;
|
|
645
785
|
}
|
|
646
786
|
|
|
787
|
+
declare interface SaveStreamDoneEvent {
|
|
788
|
+
deployUrl?: string;
|
|
789
|
+
commitSha?: string;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
declare interface SaveStreamLogEvent {
|
|
793
|
+
stepId: StepId;
|
|
794
|
+
message: string;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
declare interface SaveStreamStepEvent {
|
|
798
|
+
id: StepId;
|
|
799
|
+
status: 'running' | 'done';
|
|
800
|
+
label?: string;
|
|
801
|
+
}
|
|
802
|
+
|
|
647
803
|
declare type Schemas = JsonPagesConfig['schemas'];
|
|
648
804
|
|
|
649
805
|
/** Computed union of all registered section types. */
|
|
@@ -691,7 +847,6 @@ export declare interface SiteConfig {
|
|
|
691
847
|
identity: SiteIdentity;
|
|
692
848
|
header?: Section;
|
|
693
849
|
footer: Section;
|
|
694
|
-
pages: SitePageEntry[];
|
|
695
850
|
}
|
|
696
851
|
|
|
697
852
|
export declare interface SiteIdentity {
|
|
@@ -699,11 +854,24 @@ export declare interface SiteIdentity {
|
|
|
699
854
|
logoUrl?: string;
|
|
700
855
|
}
|
|
701
856
|
|
|
702
|
-
export declare
|
|
703
|
-
|
|
704
|
-
|
|
857
|
+
export declare function startCloudSaveStream(input: StartCloudSaveStreamInput): Promise<void>;
|
|
858
|
+
|
|
859
|
+
declare interface StartCloudSaveStreamInput {
|
|
860
|
+
apiBaseUrl: string;
|
|
861
|
+
apiKey: string;
|
|
862
|
+
path: string;
|
|
863
|
+
content: unknown;
|
|
864
|
+
message?: string;
|
|
865
|
+
signal?: AbortSignal;
|
|
866
|
+
onStep: (event: SaveStreamStepEvent) => void;
|
|
867
|
+
onLog?: (event: SaveStreamLogEvent) => void;
|
|
868
|
+
onDone: (event: SaveStreamDoneEvent) => void;
|
|
705
869
|
}
|
|
706
870
|
|
|
871
|
+
export declare type StepId = 'commit' | 'push' | 'build' | 'live';
|
|
872
|
+
|
|
873
|
+
export declare type StepState = 'pending' | 'active' | 'done';
|
|
874
|
+
|
|
707
875
|
export declare namespace studio {
|
|
708
876
|
export {
|
|
709
877
|
STUDIO_EVENTS,
|
|
@@ -835,6 +1003,12 @@ export declare function useConfig(): ConfigContextValue;
|
|
|
835
1003
|
|
|
836
1004
|
export declare const useDocumentMeta: (meta: PageMeta) => void;
|
|
837
1005
|
|
|
1006
|
+
/**
|
|
1007
|
+
* Read the submission state for a specific form.
|
|
1008
|
+
* @param formId - must match the id attribute on the <form> element.
|
|
1009
|
+
*/
|
|
1010
|
+
export declare function useFormState(formId: string): FormState;
|
|
1011
|
+
|
|
838
1012
|
export declare const useStudio: () => StudioContextType;
|
|
839
1013
|
|
|
840
1014
|
export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
|
|
@@ -918,4 +1092,18 @@ export declare type WidgetType = keyof typeof InputWidgets;
|
|
|
918
1092
|
|
|
919
1093
|
export declare function withBasePath(pathname: string, basePath?: string): string;
|
|
920
1094
|
|
|
1095
|
+
/**
|
|
1096
|
+
* Mixin for any section capsule that includes a contact form.
|
|
1097
|
+
* Merge into the section data schema to expose recipientEmail
|
|
1098
|
+
* as an editable field in the Studio inspector.
|
|
1099
|
+
* The View must set data-olon-recipient={data.recipientEmail} on the <form>.
|
|
1100
|
+
*/
|
|
1101
|
+
export declare const WithFormRecipient: z.ZodObject<{
|
|
1102
|
+
recipientEmail: z.ZodOptional<z.ZodString>;
|
|
1103
|
+
}, "strip", z.ZodTypeAny, {
|
|
1104
|
+
recipientEmail?: string | undefined;
|
|
1105
|
+
}, {
|
|
1106
|
+
recipientEmail?: string | undefined;
|
|
1107
|
+
}>;
|
|
1108
|
+
|
|
921
1109
|
export { }
|