@olonjs/core 1.0.117 → 1.0.121

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
@@ -1,8 +1,10 @@
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';
7
+ import { LucideIcon } from 'lucide-react';
6
8
  import { ReactNode } from 'react';
7
9
  import { z } from 'zod';
8
10
 
@@ -117,6 +119,14 @@ export declare interface AssetsConfig {
117
119
  onAssetUpload?: (file: File) => Promise<string>;
118
120
  }
119
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
+
120
130
  export declare interface BaseSection<K extends keyof SectionDataRegistry> {
121
131
  id: string;
122
132
  type: K;
@@ -124,6 +134,21 @@ export declare interface BaseSection<K extends keyof SectionDataRegistry> {
124
134
  settings?: K extends keyof SectionSettingsRegistry ? SectionSettingsRegistry[K] : BaseSectionSettings;
125
135
  }
126
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
+
127
152
  /**
128
153
  * KERNEL: The Base Contract (MTRP)
129
154
  * Core is self-contained; structural types live here.
@@ -132,6 +157,23 @@ export declare interface BaseSectionSettings {
132
157
  [key: string]: unknown;
133
158
  }
134
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
+
135
177
  /**
136
178
  * Shared types between Admin Engine and Input Registry.
137
179
  */
@@ -144,7 +186,7 @@ export declare interface BaseWidgetProps<T = unknown> {
144
186
 
145
187
  declare function buildLlmsTxt(input: BuildSiteManifestInput): string;
146
188
 
147
- declare function buildPageContract({ slug, pageConfig, schemas, siteConfig, }: BuildPageContractInput): OlonJsPageContract;
189
+ declare function buildPageContract({ slug, pageConfig, schemas, submissionSchemas, siteConfig, }: BuildPageContractInput): OlonJsPageContract;
148
190
 
149
191
  export declare function buildPageContractHref(slug: string): string;
150
192
 
@@ -152,6 +194,7 @@ declare interface BuildPageContractInput {
152
194
  slug: string;
153
195
  pageConfig: PageConfig;
154
196
  schemas: JsonPagesConfig['schemas'];
197
+ submissionSchemas?: JsonPagesConfig['submissionSchemas'];
155
198
  siteConfig: SiteConfig;
156
199
  }
157
200
 
@@ -161,11 +204,12 @@ export declare function buildPageManifestHref(slug: string): string;
161
204
 
162
205
  declare function buildSelectionPath(root: HTMLElement, sectionEl: HTMLElement): SelectionPath;
163
206
 
164
- declare function buildSiteManifest({ pages, schemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
207
+ declare function buildSiteManifest({ pages, schemas, submissionSchemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
165
208
 
166
209
  declare interface BuildSiteManifestInput {
167
210
  pages: Record<string, PageConfig>;
168
211
  schemas: JsonPagesConfig['schemas'];
212
+ submissionSchemas?: JsonPagesConfig['submissionSchemas'];
169
213
  siteConfig: SiteConfig;
170
214
  }
171
215
 
@@ -206,7 +250,6 @@ export declare namespace contract {
206
250
  PageMeta,
207
251
  PageConfig,
208
252
  SiteIdentity,
209
- SitePageEntry,
210
253
  SiteConfig,
211
254
  ThemeTokenMap,
212
255
  ThemeColors,
@@ -251,8 +294,39 @@ export declare function createWebMcpSaveToolInputSchema(): Record<string, unknow
251
294
 
252
295
  export declare function createWebMcpToolInputSchema(): Record<string, unknown>;
253
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
+
254
314
  export declare const DefaultNotFound: default_2.FC;
255
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
+
256
330
  /**
257
331
  * Engine-level error boundary: prevents black screen on any render error
258
332
  * and surfaces a visible error UI.
@@ -304,6 +378,28 @@ declare interface FormFactoryProps {
304
378
  } | null) => void;
305
379
  }
306
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
+
307
403
  export declare const InputWidgets: {
308
404
  readonly 'ui:text': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
309
405
  readonly 'ui:textarea': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
@@ -327,6 +423,31 @@ export declare interface JsonPagesConfig {
327
423
  parse: (v: unknown) => unknown;
328
424
  shape?: Record<string, unknown>;
329
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
+ }>;
330
451
  pages: Record<string, PageConfig>;
331
452
  siteConfig: SiteConfig;
332
453
  themeConfig: ThemeConfig;
@@ -339,6 +460,7 @@ export declare interface JsonPagesConfig {
339
460
  assets?: AssetsConfig;
340
461
  overlayDisabledSectionTypes?: string[];
341
462
  webmcp?: WebMcpConfig;
463
+ iconRegistry?: Record<string, LucideIcon>;
342
464
  }
343
465
 
344
466
  export declare function JsonPagesEngine({ config }: JsonPagesEngineProps): JSX.Element;
@@ -365,7 +487,6 @@ export declare namespace kernel {
365
487
  PageMeta,
366
488
  PageConfig,
367
489
  SiteIdentity,
368
- SitePageEntry,
369
490
  SiteConfig,
370
491
  ThemeTokenMap,
371
492
  ThemeColors,
@@ -421,6 +542,13 @@ export declare function normalizeBasePath(value?: string): string;
421
542
 
422
543
  export declare function normalizeSlugSegments(value: string): string;
423
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
+
424
552
  declare interface OlonJsPageContract {
425
553
  version: '1.0.0';
426
554
  kind: 'olonjs-page-contract';
@@ -432,6 +560,20 @@ declare interface OlonJsPageContract {
432
560
  sectionTypes: string[];
433
561
  sectionInstances: WebMcpSectionInstance[];
434
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>>;
435
577
  tools: WebMcpToolContract[];
436
578
  }
437
579
 
@@ -642,6 +784,22 @@ declare interface RuntimeResolutionResult {
642
784
  menuConfig: MenuConfig;
643
785
  }
644
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
+
645
803
  declare type Schemas = JsonPagesConfig['schemas'];
646
804
 
647
805
  /** Computed union of all registered section types. */
@@ -689,7 +847,6 @@ export declare interface SiteConfig {
689
847
  identity: SiteIdentity;
690
848
  header?: Section;
691
849
  footer: Section;
692
- pages: SitePageEntry[];
693
850
  }
694
851
 
695
852
  export declare interface SiteIdentity {
@@ -697,11 +854,24 @@ export declare interface SiteIdentity {
697
854
  logoUrl?: string;
698
855
  }
699
856
 
700
- export declare interface SitePageEntry {
701
- slug: string;
702
- label: string;
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;
703
869
  }
704
870
 
871
+ export declare type StepId = 'commit' | 'push' | 'build' | 'live';
872
+
873
+ export declare type StepState = 'pending' | 'active' | 'done';
874
+
705
875
  export declare namespace studio {
706
876
  export {
707
877
  STUDIO_EVENTS,
@@ -833,6 +1003,12 @@ export declare function useConfig(): ConfigContextValue;
833
1003
 
834
1004
  export declare const useDocumentMeta: (meta: PageMeta) => void;
835
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
+
836
1012
  export declare const useStudio: () => StudioContextType;
837
1013
 
838
1014
  export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
@@ -916,4 +1092,18 @@ export declare type WidgetType = keyof typeof InputWidgets;
916
1092
 
917
1093
  export declare function withBasePath(pathname: string, basePath?: string): string;
918
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
+
919
1109
  export { }