@olonjs/core 1.0.127 → 1.1.2

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.
@@ -0,0 +1,1117 @@
1
+ import { ClassValue } from 'clsx';
2
+ import { Component } from 'react';
3
+ import { Context } from 'react';
4
+ import { default as default_2 } from 'react';
5
+ import { ErrorInfo } from 'react';
6
+ import { JSX } from 'react/jsx-runtime';
7
+ import { LucideIcon } from 'lucide-react';
8
+ import { ReactNode } from 'react';
9
+ import { z } from 'zod';
10
+
11
+ export declare interface AddSectionConfig {
12
+ addableSectionTypes?: string[];
13
+ sectionTypeLabels?: Record<string, string>;
14
+ getDefaultSectionData?: (sectionType: string) => Record<string, unknown>;
15
+ }
16
+
17
+ export declare const AddSectionLibrary: default_2.FC<AddSectionLibraryProps>;
18
+
19
+ declare interface AddSectionLibraryProps {
20
+ open: boolean;
21
+ onClose: () => void;
22
+ /** Section type ids that can be added (e.g. from config.addSection.addableSectionTypes or derived). */
23
+ sectionTypes: string[];
24
+ /** Optional display label per type; falls back to humanized type id. */
25
+ sectionTypeLabels?: Record<string, string>;
26
+ onSelect: (sectionType: string) => void;
27
+ }
28
+
29
+ export declare namespace admin {
30
+ export {
31
+ AddSectionLibrary,
32
+ AdminSidebar,
33
+ LayerItem,
34
+ FormFactory,
35
+ InputWidgets,
36
+ WidgetType,
37
+ PageSelector,
38
+ PreviewEntry,
39
+ buildSelectionPath,
40
+ StudioStage
41
+ }
42
+ }
43
+
44
+ export declare const AdminSidebar: default_2.FC<AdminSidebarProps>;
45
+
46
+ declare interface AdminSidebarProps {
47
+ selectedSection: SelectedSectionInfo | null;
48
+ pageData: PageConfig | {
49
+ sections: Section[];
50
+ };
51
+ /** All sections (header + page sections + footer) for resolving modal section data. */
52
+ allSectionsData?: Section[];
53
+ onUpdate: (newData: Record<string, unknown>) => void;
54
+ /** Update a section by id/scope (e.g. from settings modal). When provided with allSectionsData, gear opens modal. */
55
+ onUpdateSection?: OnUpdateSection;
56
+ onClose: () => void;
57
+ /** Root-to-leaf path for deep focus (e.g. silos -> blocks). When null, no canvas selection. */
58
+ expandedItemPath?: Array<{
59
+ fieldKey: string;
60
+ itemId?: string;
61
+ }> | null;
62
+ onReorderSection?: (sectionId: string, newIndex: number) => void;
63
+ allLayers?: LayerItem[];
64
+ activeSectionId?: string | null;
65
+ onRequestScrollToSection?: (sectionId: string) => void;
66
+ onDeleteSection?: (sectionId: string) => void;
67
+ /** When provided, shows an "Add section" button in the inspector header that opens the section library. */
68
+ onAddSection?: () => void;
69
+ /** Whether there are unsaved changes for the current draft. */
70
+ hasChanges?: boolean;
71
+ /** Save to file (writes JSON to repo via server). */
72
+ onSaveToFile?: () => void;
73
+ /** Hot Save callback (typically cloud save2edge). */
74
+ onHotSave?: () => void;
75
+ /** Cold Save callback (typically save2repo / deploy pipeline). */
76
+ onColdSave?: () => void;
77
+ /** When true, show "Salvato" in the status bar (e.g. for 2s after save-to-file succeeds). */
78
+ saveSuccessFeedback?: boolean;
79
+ /** When true, show "Saved" feedback for hot save (e.g. for 2s after success). */
80
+ hotSaveSuccessFeedback?: boolean;
81
+ /** When true, hot save action is currently running. */
82
+ hotSaveInProgress?: boolean;
83
+ /** Controls visibility of the local Save button. */
84
+ showLocalSave?: boolean;
85
+ /** Controls visibility of Hot Save button. */
86
+ showHotSave?: boolean;
87
+ /** Controls visibility of Save2Repo / Cold Save button. */
88
+ showColdSave?: boolean;
89
+ /** Restore page from file (resets in-memory draft for current slug). Hidden by default; set showResetToFile to display. */
90
+ onResetToFile?: () => void;
91
+ /** When true, shows the "Ripristina da file" button (default false = hidden). */
92
+ showResetToFile?: boolean;
93
+ /** Available page slugs. When length > 0 and onPageChange set, shows page selector under Inspector header. */
94
+ pageSlugs?: string[];
95
+ /** Current page slug. */
96
+ currentSlug?: string;
97
+ /** Called when user selects another page; engine should navigate to /admin/:slug. */
98
+ onPageChange?: (slug: string) => void;
99
+ }
100
+
101
+ export declare function applyValueAtSelectionPath(rootData: Record<string, unknown>, selectionPath: SelectionPath, value: unknown): Record<string, unknown>;
102
+
103
+ export declare interface AssetsConfig {
104
+ assetsBaseUrl?: string;
105
+ assetsManifest?: LibraryImageEntry[];
106
+ /**
107
+ * Uploads an image and returns the final canonical URL that must be persisted in JSON.
108
+ *
109
+ * Valid examples:
110
+ * - /assets/images/foo.png
111
+ * - /assets/tenant-a/foo.png
112
+ * - https://cdn.example.com/foo.png
113
+ *
114
+ * Invalid examples:
115
+ * - public/assets/foo.png
116
+ * - C:\\foo\\bar.png
117
+ * - data:image/png;base64,...
118
+ */
119
+ onAssetUpload?: (file: File) => Promise<string>;
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
+
130
+ export declare interface BaseSection<K extends keyof SectionDataRegistry> {
131
+ id: string;
132
+ type: K;
133
+ data: SectionDataRegistry[K];
134
+ settings?: K extends keyof SectionSettingsRegistry ? SectionSettingsRegistry[K] : BaseSectionSettings;
135
+ }
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
+
152
+ /**
153
+ * KERNEL: The Base Contract (MTRP)
154
+ * Core is self-contained; structural types live here.
155
+ */
156
+ export declare interface BaseSectionSettings {
157
+ [key: string]: unknown;
158
+ }
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" | "md" | "lg" | "xl" | "2xl";
167
+ paddingBottom: "none" | "sm" | "md" | "lg" | "xl" | "2xl";
168
+ theme: "dark" | "light" | "accent";
169
+ container: "boxed" | "fluid";
170
+ }, {
171
+ paddingTop?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | undefined;
172
+ paddingBottom?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | undefined;
173
+ theme?: "dark" | "light" | "accent" | undefined;
174
+ container?: "boxed" | "fluid" | undefined;
175
+ }>;
176
+
177
+ /**
178
+ * Shared types between Admin Engine and Input Registry.
179
+ */
180
+ export declare interface BaseWidgetProps<T = unknown> {
181
+ label: string;
182
+ value: T;
183
+ onChange: (val: T) => void;
184
+ options?: string[];
185
+ }
186
+
187
+ declare function buildLlmsTxt(input: BuildSiteManifestInput): string;
188
+
189
+ declare function buildPageContract({ slug, pageConfig, schemas, submissionSchemas, siteConfig, }: BuildPageContractInput): OlonJsPageContract;
190
+
191
+ export declare function buildPageContractHref(slug: string): string;
192
+
193
+ declare interface BuildPageContractInput {
194
+ slug: string;
195
+ pageConfig: PageConfig;
196
+ schemas: JsonPagesConfig['schemas'];
197
+ submissionSchemas?: JsonPagesConfig['submissionSchemas'];
198
+ siteConfig: SiteConfig;
199
+ }
200
+
201
+ declare function buildPageManifest(input: BuildPageContractInput): OlonJsPageManifest;
202
+
203
+ export declare function buildPageManifestHref(slug: string): string;
204
+
205
+ declare function buildSelectionPath(root: HTMLElement, sectionEl: HTMLElement): SelectionPath;
206
+
207
+ declare function buildSiteManifest({ pages, schemas, submissionSchemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
208
+
209
+ declare interface BuildSiteManifestInput {
210
+ pages: Record<string, PageConfig>;
211
+ schemas: JsonPagesConfig['schemas'];
212
+ submissionSchemas?: JsonPagesConfig['submissionSchemas'];
213
+ siteConfig: SiteConfig;
214
+ }
215
+
216
+ export declare function buildThemeVariableMap(theme: ThemeConfig): Record<string, string>;
217
+
218
+ export declare function buildWebMcpSaveToolName(): string;
219
+
220
+ export declare function buildWebMcpToolName(): string;
221
+
222
+ export declare function cn(...inputs: ClassValue[]): string;
223
+
224
+ export declare interface ConfigContextValue {
225
+ registry: Registry;
226
+ schemas: Schemas;
227
+ tenantId?: string;
228
+ basePath?: string;
229
+ assets?: AssetsConfig;
230
+ overlayDisabledSectionTypes?: string[];
231
+ }
232
+
233
+ export declare const ConfigProvider: default_2.FC<{
234
+ config: Pick<JsonPagesConfig, 'registry' | 'schemas' | 'tenantId' | 'basePath' | 'assets' | 'overlayDisabledSectionTypes'>;
235
+ children: default_2.ReactNode;
236
+ }>;
237
+
238
+ export declare namespace contract {
239
+ export {
240
+ shouldRenderSiteGlobalHeader,
241
+ BaseSectionSettings,
242
+ SectionDataRegistry,
243
+ SectionSettingsRegistry,
244
+ BaseSection,
245
+ FallbackSection,
246
+ Section,
247
+ SectionType,
248
+ MenuItem,
249
+ MenuConfig,
250
+ PageMeta,
251
+ PageConfig,
252
+ SiteIdentity,
253
+ SiteConfig,
254
+ ThemeTokenMap,
255
+ ThemeColors,
256
+ ThemeFontFamily,
257
+ ThemeTypography,
258
+ ThemeBorderRadius,
259
+ ThemeTokens,
260
+ ThemeConfig,
261
+ ProjectState,
262
+ PageRendererProps,
263
+ SelectionPathSegment,
264
+ SelectionPath,
265
+ PersistenceConfig,
266
+ ThemeCssConfig,
267
+ AddSectionConfig,
268
+ LibraryImageEntry,
269
+ AssetsConfig,
270
+ WebMcpConfig,
271
+ JsonPagesConfig,
272
+ resolveHeaderMenuItems,
273
+ resolveSectionMenuItems,
274
+ resolveRuntimeConfig,
275
+ RefDocuments,
276
+ buildPageContractHref,
277
+ buildPageManifestHref,
278
+ buildPageContract,
279
+ buildPageManifest,
280
+ buildSiteManifest,
281
+ buildLlmsTxt,
282
+ WebMcpToolContract,
283
+ WebMcpSectionInstance,
284
+ OlonJsPageContract,
285
+ OlonJsPageManifest,
286
+ OlonJsSiteManifestIndex,
287
+ BuildPageContractInput,
288
+ BuildSiteManifestInput,
289
+ BaseWidgetProps
290
+ }
291
+ }
292
+
293
+ export declare function createWebMcpSaveToolInputSchema(): Record<string, unknown>;
294
+
295
+ export declare function createWebMcpToolInputSchema(): Record<string, unknown>;
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
+
314
+ export declare const DefaultNotFound: default_2.FC;
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
+
330
+ /**
331
+ * Engine-level error boundary: prevents black screen on any render error
332
+ * and surfaces a visible error UI.
333
+ */
334
+ export declare class EngineErrorBoundary extends Component<{
335
+ children: ReactNode;
336
+ }, {
337
+ hasError: boolean;
338
+ error: Error | null;
339
+ }> {
340
+ constructor(props: {
341
+ children: ReactNode;
342
+ });
343
+ static getDerivedStateFromError(error: Error): {
344
+ hasError: boolean;
345
+ error: Error;
346
+ };
347
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
348
+ render(): string | number | bigint | boolean | JSX.Element | Iterable<default_2.ReactNode> | Promise<string | number | bigint | boolean | default_2.ReactPortal | default_2.ReactElement<unknown, string | default_2.JSXElementConstructor<any>> | Iterable<default_2.ReactNode> | null | undefined> | null | undefined;
349
+ }
350
+
351
+ export declare function ensureWebMcpRuntime(): void;
352
+
353
+ /** Structural shape used when no tenant has augmented the registries. */
354
+ export declare interface FallbackSection {
355
+ id: string;
356
+ type: string;
357
+ data: Record<string, unknown>;
358
+ settings?: Record<string, unknown>;
359
+ }
360
+
361
+ export declare const FormFactory: default_2.FC<FormFactoryProps>;
362
+
363
+ declare interface FormFactoryProps {
364
+ schema: z.ZodObject<z.ZodRawShape>;
365
+ data: Record<string, unknown>;
366
+ onChange: (newData: Record<string, unknown>) => void;
367
+ /** When set, only render fields whose key is in this array (e.g. Content vs Settings tabs). */
368
+ keys?: string[] | null;
369
+ /** Root-to-leaf path for deep focus (e.g. silos -> blocks). First segment applies to this level. */
370
+ expandedItemPath?: Array<{
371
+ fieldKey: string;
372
+ itemId?: string;
373
+ }> | null;
374
+ /** Called when user expands/collapses an array item in the sidebar (so parent can drive fade). */
375
+ onSidebarExpandedItemChange?: (item: {
376
+ fieldKey: string;
377
+ itemId?: string;
378
+ } | null) => void;
379
+ }
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
+
403
+ export declare const InputWidgets: {
404
+ readonly 'ui:text': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
405
+ readonly 'ui:textarea': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
406
+ readonly 'ui:select': ({ label, value, onChange, options }: BaseWidgetProps<string>) => JSX.Element;
407
+ readonly 'ui:checkbox': ({ label, value, onChange }: BaseWidgetProps<boolean>) => JSX.Element;
408
+ readonly 'ui:image-picker': ({ label, value, onChange }: BaseWidgetProps<unknown>) => JSX.Element;
409
+ readonly 'ui:icon-picker': ({ label, value, onChange }: BaseWidgetProps<string>) => JSX.Element;
410
+ };
411
+
412
+ export declare const isCanonicalAssetUrl: (path: string) => boolean;
413
+
414
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
415
+
416
+ export declare const isTransientAssetUrl: (path: string) => boolean;
417
+
418
+ export declare interface JsonPagesConfig {
419
+ tenantId: string;
420
+ basePath?: string;
421
+ registry: Record<string, default_2.ComponentType<unknown>>;
422
+ schemas: Record<string, {
423
+ parse: (v: unknown) => unknown;
424
+ shape?: Record<string, unknown>;
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
+ }>;
451
+ pages: Record<string, PageConfig>;
452
+ siteConfig: SiteConfig;
453
+ themeConfig: ThemeConfig;
454
+ menuConfig: MenuConfig;
455
+ refDocuments?: Record<string, unknown>;
456
+ persistence?: Partial<PersistenceConfig>;
457
+ themeCss: ThemeCssConfig;
458
+ NotFoundComponent?: default_2.ComponentType;
459
+ addSection?: AddSectionConfig;
460
+ assets?: AssetsConfig;
461
+ overlayDisabledSectionTypes?: string[];
462
+ webmcp?: WebMcpConfig;
463
+ iconRegistry?: Record<string, LucideIcon>;
464
+ }
465
+
466
+ export declare function JsonPagesEngine({ config }: JsonPagesEngineProps): JSX.Element;
467
+
468
+ export declare interface JsonPagesEngineProps {
469
+ config: JsonPagesConfig;
470
+ }
471
+
472
+ export declare namespace kernel {
473
+ export {
474
+ resolveHeaderMenuItems,
475
+ resolveRuntimeConfig,
476
+ resolveSectionMenuItems,
477
+ shouldRenderSiteGlobalHeader,
478
+ BaseSectionSettings,
479
+ SectionDataRegistry,
480
+ SectionSettingsRegistry,
481
+ BaseSection,
482
+ FallbackSection,
483
+ Section,
484
+ SectionType,
485
+ MenuItem,
486
+ MenuConfig,
487
+ PageMeta,
488
+ PageConfig,
489
+ SiteIdentity,
490
+ SiteConfig,
491
+ ThemeTokenMap,
492
+ ThemeColors,
493
+ ThemeFontFamily,
494
+ ThemeTypography,
495
+ ThemeBorderRadius,
496
+ ThemeTokens,
497
+ ThemeConfig,
498
+ ProjectState,
499
+ PageRendererProps,
500
+ SelectionPathSegment,
501
+ SelectionPath,
502
+ PersistenceConfig,
503
+ ThemeCssConfig,
504
+ AddSectionConfig,
505
+ LibraryImageEntry,
506
+ AssetsConfig,
507
+ WebMcpConfig,
508
+ JsonPagesConfig,
509
+ BaseWidgetProps
510
+ }
511
+ }
512
+
513
+ export declare interface LayerItem {
514
+ id: string;
515
+ type: string;
516
+ scope: string;
517
+ title?: string;
518
+ }
519
+
520
+ export declare interface LibraryImageEntry {
521
+ id: string;
522
+ url: string;
523
+ alt: string;
524
+ tags?: string[];
525
+ }
526
+
527
+ export declare interface MenuConfig {
528
+ main?: MenuItem[];
529
+ [key: string]: MenuItem[] | undefined;
530
+ }
531
+
532
+ export declare interface MenuItem {
533
+ label: string;
534
+ href: string;
535
+ icon?: string;
536
+ external?: boolean;
537
+ isCta?: boolean;
538
+ children?: MenuItem[];
539
+ }
540
+
541
+ export declare function normalizeBasePath(value?: string): string;
542
+
543
+ export declare function normalizeSlugSegments(value: string): string;
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
+
552
+ export declare function OlonJSEngine({ config }: OlonJSEngineProps): JSX.Element;
553
+
554
+ export declare interface OlonJSEngineProps {
555
+ config: JsonPagesConfig;
556
+ }
557
+
558
+ declare interface OlonJsPageContract {
559
+ version: '1.0.0';
560
+ kind: 'olonjs-page-contract';
561
+ slug: string;
562
+ title: string;
563
+ description: string;
564
+ manifestHref: string;
565
+ systemPrompt: string;
566
+ sectionTypes: string[];
567
+ sectionInstances: WebMcpSectionInstance[];
568
+ sectionSchemas: Record<string, Record<string, unknown>>;
569
+ /**
570
+ * Optional JSON Schema representations of submission payloads for form-capable
571
+ * sections present on this page. Keyed by section type.
572
+ *
573
+ * Emitted only for section types that (a) actually appear on this page AND
574
+ * (b) have an entry in `JsonPagesConfig.submissionSchemas`. Absent (not `{}`)
575
+ * when no section on the page qualifies, to keep the contract tight.
576
+ *
577
+ * MCP agents consuming this contract can discover form shapes directly from
578
+ * reading the page, without requiring a separate tool call.
579
+ *
580
+ * See `docs/decisions/ADR-0002-form-submission-schemas.md` (emission contract).
581
+ */
582
+ sectionSubmissionSchemas?: Record<string, Record<string, unknown>>;
583
+ tools: WebMcpToolContract[];
584
+ }
585
+
586
+ declare interface OlonJsPageManifest {
587
+ version: '1.0.0';
588
+ kind: 'olonjs-page-mcp-manifest';
589
+ generatedAt: string;
590
+ slug: string;
591
+ title: string;
592
+ description: string;
593
+ contractHref: string;
594
+ transport: {
595
+ kind: 'window-message';
596
+ requestType: string;
597
+ resultType: string;
598
+ target: 'window';
599
+ };
600
+ capabilities: {
601
+ resources: Array<{
602
+ uri: string;
603
+ name: string;
604
+ mimeType: string;
605
+ description: string;
606
+ }>;
607
+ };
608
+ sectionTypes: string[];
609
+ sectionInstances: WebMcpSectionInstance[];
610
+ tools: Array<Pick<WebMcpToolContract, 'name' | 'description'>>;
611
+ }
612
+
613
+ declare interface OlonJsSiteManifestIndex {
614
+ version: '1.0.0';
615
+ kind: 'olonjs-mcp-manifest-index';
616
+ generatedAt: string;
617
+ pages: Array<{
618
+ slug: string;
619
+ title: string;
620
+ description: string;
621
+ manifestHref: string;
622
+ contractHref: string;
623
+ sectionTypes: string[];
624
+ }>;
625
+ }
626
+
627
+ /** Used by the section-settings modal to update a section without changing Inspector selection. */
628
+ export declare type OnUpdateSection = (sectionId: string, scope: 'global' | 'local', sectionType: string, newData: Record<string, unknown>) => void;
629
+
630
+ export declare interface PageConfig {
631
+ id: string;
632
+ slug: string;
633
+ meta: PageMeta;
634
+ sections: Section[];
635
+ /** When `false`, Core does not render the global header from `site.json` for this page. Omitted = default (show if configured). */
636
+ 'global-header'?: boolean;
637
+ }
638
+
639
+ export declare interface PageMeta {
640
+ title: string;
641
+ description: string;
642
+ }
643
+
644
+ export declare const PageRenderer: default_2.FC<Props>;
645
+
646
+ export declare interface PageRendererProps {
647
+ pageConfig: PageConfig;
648
+ siteConfig: SiteConfig;
649
+ menuConfig: MenuConfig;
650
+ selectedId?: string | null;
651
+ }
652
+
653
+ /**
654
+ * Enterprise-grade page switcher: popover trigger + list, a11y, single source of styling.
655
+ * Use in Inspector header when multiple pages exist and onPageChange is provided.
656
+ */
657
+ declare const PageSelector: default_2.FC<PageSelectorProps>;
658
+
659
+ declare interface PageSelectorProps {
660
+ /** Available page slugs. */
661
+ pageSlugs: string[];
662
+ /** Current page slug. */
663
+ currentSlug: string;
664
+ /** Called when user selects another page. */
665
+ onPageChange: (slug: string) => void;
666
+ /** Optional: show section count per page (e.g. "9s"). Omit to hide. */
667
+ sectionCount?: number;
668
+ /** Optional: when set, shows "New page" and calls this on click. Omit to hide (no dead UI). */
669
+ onNewPage?: () => void;
670
+ /** Optional class for the wrapper (e.g. spacing). */
671
+ className?: string;
672
+ /** Optional: override label for current page (default: capitalized slug). */
673
+ currentPageLabel?: string;
674
+ }
675
+
676
+ export declare function parseWebMcpMutationArgs(rawArgs: unknown): WebMcpMutationArgs;
677
+
678
+ export declare interface PersistenceConfig {
679
+ saveToFile?: (state: ProjectState, slug: string) => Promise<void>;
680
+ hotSave?: (state: ProjectState, slug: string) => Promise<void>;
681
+ coldSave?: (state: ProjectState, slug: string) => Promise<void>;
682
+ showLocalSave?: boolean;
683
+ showHotSave?: boolean;
684
+ showColdSave?: boolean;
685
+ flushUploadedAssets?: (urls: string[]) => Promise<Record<string, string>>;
686
+ }
687
+
688
+ export declare const PreviewEntry: default_2.FC;
689
+
690
+ export declare const PreviewRoute: default_2.FC<PreviewRouteProps>;
691
+
692
+ export declare interface PreviewRouteProps {
693
+ tenantCss: string;
694
+ adminCss: string;
695
+ }
696
+
697
+ /**
698
+ * PROJECT STATE (The Universal Data Bundle)
699
+ * Moved to Kernel to serve as SSOT for Engine and Persistence.
700
+ */
701
+ export declare interface ProjectState {
702
+ page: PageConfig;
703
+ site: SiteConfig;
704
+ menu: MenuConfig;
705
+ theme: ThemeConfig;
706
+ }
707
+
708
+ declare type Props = PageRendererProps & {
709
+ onReorder?: (sectionId: string, newIndex: number) => void;
710
+ scrollToSectionId?: string | null;
711
+ onActiveSectionChange?: (sectionId: string | null) => void;
712
+ };
713
+
714
+ declare type RefDocuments = NonNullable<JsonPagesConfig['refDocuments']>;
715
+
716
+ export declare function registerWebMcpTool(tool: WebMcpTool): () => void;
717
+
718
+ declare type Registry = JsonPagesConfig['registry'];
719
+
720
+ export declare const resolveAssetUrl: (path: string, tenantId?: string, basePath?: string) => string;
721
+
722
+ export declare function resolveHeaderMenuItems(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
723
+
724
+ export declare function resolveMenuMainFromHeaderData(headerData: unknown, fallbackMain: MenuItem[]): MenuItem[];
725
+
726
+ export declare function resolvePageFromRegistry(pageRegistry: Record<string, PageConfig>, requestedSlug: string): PageConfig | undefined;
727
+
728
+ export declare function resolveRuntimeConfig(input: RuntimeResolutionInput): RuntimeResolutionResult;
729
+
730
+ export declare function resolveSectionMenuItems(section: Section, fallbackMain: MenuItem[]): MenuItem[] | undefined;
731
+
732
+ export declare function resolveSlugFromPathname(pathname: string, prefix?: string): string;
733
+
734
+ export declare function resolveWebMcpMutationData(currentData: Record<string, unknown>, args: WebMcpMutationArgs): Record<string, unknown>;
735
+
736
+ export declare namespace runtime {
737
+ export {
738
+ PageRenderer,
739
+ SectionRenderer,
740
+ JsonPagesEngine,
741
+ JsonPagesEngineProps,
742
+ StudioProvider,
743
+ useStudio,
744
+ ConfigProvider,
745
+ useConfig,
746
+ ConfigContextValue,
747
+ ThemeLoader,
748
+ ThemeLoaderProps,
749
+ DefaultNotFound,
750
+ STUDIO_EVENTS,
751
+ EngineErrorBoundary,
752
+ OlonJSEngine,
753
+ OlonJSEngineProps,
754
+ PreviewRoute,
755
+ PreviewRouteProps,
756
+ StudioRoute,
757
+ StudioRouteProps,
758
+ VisitorRoute,
759
+ VisitorRouteProps,
760
+ buildPageContractHref,
761
+ buildPageManifestHref,
762
+ syncHeadLink,
763
+ syncWebMcpJsonLd,
764
+ isRecord,
765
+ normalizeSlugSegments,
766
+ resolveMenuMainFromHeaderData,
767
+ resolvePageFromRegistry,
768
+ resolveSlugFromPathname,
769
+ isCanonicalAssetUrl,
770
+ isTransientAssetUrl,
771
+ resolveAssetUrl,
772
+ useDocumentMeta,
773
+ buildThemeVariableMap,
774
+ themeManager,
775
+ normalizeBasePath,
776
+ withBasePath
777
+ }
778
+ }
779
+
780
+ declare interface RuntimeResolutionInput {
781
+ pages: Record<string, PageConfig>;
782
+ siteConfig: SiteConfig;
783
+ themeConfig: ThemeConfig;
784
+ menuConfig: MenuConfig;
785
+ refDocuments?: JsonPagesConfig['refDocuments'];
786
+ }
787
+
788
+ declare interface RuntimeResolutionResult {
789
+ pages: Record<string, PageConfig>;
790
+ siteConfig: SiteConfig;
791
+ themeConfig: ThemeConfig;
792
+ menuConfig: MenuConfig;
793
+ }
794
+
795
+ declare interface SaveStreamDoneEvent {
796
+ deployUrl?: string;
797
+ commitSha?: string;
798
+ }
799
+
800
+ declare interface SaveStreamLogEvent {
801
+ stepId: StepId;
802
+ message: string;
803
+ }
804
+
805
+ declare interface SaveStreamStepEvent {
806
+ id: StepId;
807
+ status: 'running' | 'done';
808
+ label?: string;
809
+ }
810
+
811
+ declare type Schemas = JsonPagesConfig['schemas'];
812
+
813
+ /** Computed union of all registered section types. */
814
+ export declare type Section = keyof SectionDataRegistry extends never ? FallbackSection : {
815
+ [K in keyof SectionDataRegistry]: BaseSection<K>;
816
+ }[keyof SectionDataRegistry];
817
+
818
+ export declare interface SectionDataRegistry {
819
+ }
820
+
821
+ export declare const SectionRenderer: default_2.FC<SectionRendererProps>;
822
+
823
+ declare interface SectionRendererProps {
824
+ section: Section;
825
+ menu?: MenuItem[];
826
+ selectedId?: string | null;
827
+ reorderable?: boolean;
828
+ sectionIndex?: number;
829
+ totalSections?: number;
830
+ onReorder?: (sectionId: string, newIndex: number) => void;
831
+ }
832
+
833
+ export declare interface SectionSettingsRegistry {
834
+ }
835
+
836
+ export declare type SectionType = keyof SectionDataRegistry extends never ? string : keyof SectionDataRegistry;
837
+
838
+ declare interface SelectedSectionInfo {
839
+ id: string;
840
+ type: string;
841
+ scope: string;
842
+ }
843
+
844
+ export declare type SelectionPath = SelectionPathSegment[];
845
+
846
+ export declare interface SelectionPathSegment {
847
+ fieldKey: string;
848
+ itemId?: string;
849
+ }
850
+
851
+ /** Whether the global `site.json` header should be rendered for this page. */
852
+ export declare function shouldRenderSiteGlobalHeader(page: PageConfig, site: SiteConfig): boolean;
853
+
854
+ export declare interface SiteConfig {
855
+ identity: SiteIdentity;
856
+ header?: Section;
857
+ footer: Section;
858
+ }
859
+
860
+ export declare interface SiteIdentity {
861
+ title: string;
862
+ logoUrl?: string;
863
+ }
864
+
865
+ export declare function startCloudSaveStream(input: StartCloudSaveStreamInput): Promise<void>;
866
+
867
+ declare interface StartCloudSaveStreamInput {
868
+ apiBaseUrl: string;
869
+ apiKey: string;
870
+ path: string;
871
+ content: unknown;
872
+ message?: string;
873
+ signal?: AbortSignal;
874
+ onStep: (event: SaveStreamStepEvent) => void;
875
+ onLog?: (event: SaveStreamLogEvent) => void;
876
+ onDone: (event: SaveStreamDoneEvent) => void;
877
+ }
878
+
879
+ export declare type StepId = 'commit' | 'push' | 'build' | 'live';
880
+
881
+ export declare type StepState = 'pending' | 'active' | 'done';
882
+
883
+ export declare namespace studio {
884
+ export {
885
+ STUDIO_EVENTS,
886
+ StudioProvider,
887
+ useStudio,
888
+ admin
889
+ }
890
+ }
891
+
892
+ export declare const STUDIO_EVENTS: {
893
+ readonly UPDATE_DRAFTS: "jsonpages:update-drafts";
894
+ readonly SYNC_SELECTION: "jsonpages:sync-selection";
895
+ readonly SECTION_SELECT: "jsonpages:section-select";
896
+ readonly INLINE_FIELD_UPDATE: "jsonpages:inline-field-update";
897
+ readonly INLINE_FLUSHED: "jsonpages:inline-flushed";
898
+ readonly REQUEST_SCROLL_TO_SECTION: "jsonpages:request-scroll-to-section";
899
+ readonly REQUEST_INLINE_FLUSH: "jsonpages:request-inline-flush";
900
+ readonly ACTIVE_SECTION_CHANGED: "jsonpages:active-section-changed";
901
+ readonly STAGE_READY: "jsonpages:stage-ready";
902
+ readonly WEBMCP_TOOL_CALL: "olonjs:webmcp:tool-call";
903
+ readonly WEBMCP_TOOL_RESULT: "olonjs:webmcp:tool-result";
904
+ };
905
+
906
+ declare interface StudioContextType {
907
+ mode: StudioMode;
908
+ }
909
+
910
+ declare type StudioMode = 'visitor' | 'studio';
911
+
912
+ export declare const StudioProvider: default_2.FC<{
913
+ mode: StudioMode;
914
+ children: ReactNode;
915
+ }>;
916
+
917
+ export declare const StudioRoute: default_2.FC<StudioRouteProps>;
918
+
919
+ export declare interface StudioRouteProps {
920
+ pageRegistry: Record<string, PageConfig>;
921
+ schemas: JsonPagesConfig['schemas'];
922
+ siteConfig: SiteConfig;
923
+ menuConfig: MenuConfig;
924
+ themeConfig: JsonPagesConfig['themeConfig'];
925
+ refDocuments?: JsonPagesConfig['refDocuments'];
926
+ tenantCss: string;
927
+ adminCss: string;
928
+ addSectionConfig: JsonPagesConfig['addSection'];
929
+ addableSectionTypes: string[];
930
+ webMcp?: JsonPagesConfig['webmcp'];
931
+ saveToFile?: (state: ProjectState, slug: string) => Promise<void>;
932
+ hotSave?: (state: ProjectState, slug: string) => Promise<void>;
933
+ coldSave?: (state: ProjectState, slug: string) => Promise<void>;
934
+ showLocalSave?: boolean;
935
+ showHotSave?: boolean;
936
+ showColdSave?: boolean;
937
+ }
938
+
939
+ /**
940
+ * 📺 STUDIO STAGE (Full Preview Mode)
941
+ * Manages the Iframe and the PostMessage protocol.
942
+ * NOW INCLUDES: Handshake Listener to fix the "Waiting..." race condition.
943
+ */
944
+ export declare const StudioStage: default_2.FC<StudioStageProps>;
945
+
946
+ declare interface StudioStageProps {
947
+ draft: PageConfig;
948
+ globalDraft: SiteConfig;
949
+ menuConfig: MenuConfig;
950
+ themeConfig: ThemeConfig;
951
+ slug: string;
952
+ selectedId?: string | null;
953
+ scrollToSectionId?: string | null;
954
+ onScrollRequested?: () => void;
955
+ }
956
+
957
+ export declare function syncHeadLink(rel: string, href: string): void;
958
+
959
+ export declare function syncWebMcpJsonLd(title: string, description: string, url: string): void;
960
+
961
+ export declare interface ThemeBorderRadius {
962
+ [key: string]: string;
963
+ }
964
+
965
+ export declare interface ThemeColors {
966
+ [key: string]: string;
967
+ }
968
+
969
+ export declare interface ThemeConfig {
970
+ name: string;
971
+ tokens: ThemeTokens;
972
+ }
973
+
974
+ export declare interface ThemeCssConfig {
975
+ tenant: string;
976
+ admin?: string;
977
+ }
978
+
979
+ export declare interface ThemeFontFamily {
980
+ [key: string]: string | undefined;
981
+ }
982
+
983
+ export declare const ThemeLoader: default_2.FC<ThemeLoaderProps>;
984
+
985
+ export declare interface ThemeLoaderProps {
986
+ mode: 'tenant' | 'admin';
987
+ tenantCss: string;
988
+ adminCss: string;
989
+ children: default_2.ReactNode;
990
+ }
991
+
992
+ export declare const themeManager: {
993
+ setTheme: (theme: ThemeConfig) => void;
994
+ };
995
+
996
+ export declare interface ThemeTokenMap {
997
+ [key: string]: string;
998
+ }
999
+
1000
+ export declare interface ThemeTokens {
1001
+ colors: ThemeColors;
1002
+ typography: ThemeTypography;
1003
+ borderRadius: ThemeBorderRadius;
1004
+ }
1005
+
1006
+ export declare interface ThemeTypography {
1007
+ fontFamily: ThemeFontFamily;
1008
+ }
1009
+
1010
+ export declare function useConfig(): ConfigContextValue;
1011
+
1012
+ export declare const useDocumentMeta: (meta: PageMeta) => void;
1013
+
1014
+ /**
1015
+ * Read the submission state for a specific form.
1016
+ * @param formId - must match the id attribute on the <form> element.
1017
+ */
1018
+ export declare function useFormState(formId: string): FormState;
1019
+
1020
+ export declare const useStudio: () => StudioContextType;
1021
+
1022
+ export declare const VisitorRoute: default_2.FC<VisitorRouteProps>;
1023
+
1024
+ export declare interface VisitorRouteProps {
1025
+ pageRegistry: Record<string, PageConfig>;
1026
+ siteConfig: SiteConfig;
1027
+ menuConfig: MenuConfig;
1028
+ themeConfig: JsonPagesConfig['themeConfig'];
1029
+ refDocuments?: JsonPagesConfig['refDocuments'];
1030
+ tenantCss: string;
1031
+ adminCss: string;
1032
+ NotFoundComponent: default_2.ComponentType;
1033
+ }
1034
+
1035
+ export declare namespace webmcp {
1036
+ export {
1037
+ applyValueAtSelectionPath,
1038
+ buildWebMcpToolName,
1039
+ buildWebMcpSaveToolName,
1040
+ createWebMcpToolInputSchema,
1041
+ createWebMcpSaveToolInputSchema,
1042
+ ensureWebMcpRuntime,
1043
+ parseWebMcpMutationArgs,
1044
+ registerWebMcpTool,
1045
+ resolveWebMcpMutationData,
1046
+ WebMcpMutationArgs,
1047
+ buildLlmsTxt,
1048
+ buildPageContract,
1049
+ buildPageContractHref,
1050
+ buildPageManifest,
1051
+ buildPageManifestHref,
1052
+ buildSiteManifest,
1053
+ BuildPageContractInput,
1054
+ BuildSiteManifestInput,
1055
+ OlonJsPageContract,
1056
+ OlonJsPageManifest,
1057
+ OlonJsSiteManifestIndex,
1058
+ WebMcpSectionInstance,
1059
+ WebMcpToolContract
1060
+ }
1061
+ }
1062
+
1063
+ export declare interface WebMcpConfig {
1064
+ enabled?: boolean;
1065
+ namespace?: string;
1066
+ }
1067
+
1068
+ export declare interface WebMcpMutationArgs {
1069
+ slug?: string;
1070
+ sectionId: string;
1071
+ sectionType?: string;
1072
+ scope?: 'global' | 'local';
1073
+ data?: Record<string, unknown>;
1074
+ itemPath?: SelectionPath;
1075
+ fieldKey?: string;
1076
+ value?: unknown;
1077
+ }
1078
+
1079
+ declare interface WebMcpSectionInstance {
1080
+ id: string;
1081
+ type: string;
1082
+ scope: 'global' | 'local';
1083
+ label: string;
1084
+ }
1085
+
1086
+ declare type WebMcpTool = {
1087
+ name: string;
1088
+ description: string;
1089
+ inputSchema: Record<string, unknown>;
1090
+ execute: (args: unknown) => Promise<unknown> | unknown;
1091
+ };
1092
+
1093
+ declare interface WebMcpToolContract {
1094
+ name: string;
1095
+ description: string;
1096
+ inputSchema: Record<string, unknown>;
1097
+ }
1098
+
1099
+ export declare type WidgetType = keyof typeof InputWidgets;
1100
+
1101
+ export declare function withBasePath(pathname: string, basePath?: string): string;
1102
+
1103
+ /**
1104
+ * Mixin for any section capsule that includes a contact form.
1105
+ * Merge into the section data schema to expose recipientEmail
1106
+ * as an editable field in the Studio inspector.
1107
+ * The View must set data-olon-recipient={data.recipientEmail} on the <form>.
1108
+ */
1109
+ export declare const WithFormRecipient: z.ZodObject<{
1110
+ recipientEmail: z.ZodOptional<z.ZodString>;
1111
+ }, "strip", z.ZodTypeAny, {
1112
+ recipientEmail?: string | undefined;
1113
+ }, {
1114
+ recipientEmail?: string | undefined;
1115
+ }>;
1116
+
1117
+ export { }