@kubuild/renderer 0.8.0 → 0.8.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.
- package/dist/action-dispatcher.d.cts +42 -0
- package/dist/action-dispatcher.d.cts.map +1 -0
- package/dist/action-dispatcher.d.ts +2 -2
- package/dist/action-dispatcher.d.ts.map +1 -1
- package/dist/action-runners/api-request.d.cts +89 -0
- package/dist/action-runners/api-request.d.cts.map +1 -0
- package/dist/action-runners/index.d.cts +25 -0
- package/dist/action-runners/index.d.cts.map +1 -0
- package/dist/action-runners/index.d.ts +8 -8
- package/dist/action-runners/index.d.ts.map +1 -1
- package/dist/action-runners/modal-manager.d.cts +73 -0
- package/dist/action-runners/modal-manager.d.cts.map +1 -0
- package/dist/action-runners/navigation-utils.d.cts +62 -0
- package/dist/action-runners/navigation-utils.d.cts.map +1 -0
- package/dist/action-runners/toast-container.d.cts +20 -0
- package/dist/action-runners/toast-container.d.cts.map +1 -0
- package/dist/action-runners/toast-container.d.ts +1 -1
- package/dist/action-runners/toast-container.d.ts.map +1 -1
- package/dist/action-runners/toast-manager.d.cts +74 -0
- package/dist/action-runners/toast-manager.d.cts.map +1 -0
- package/dist/action-runners/tracking.d.cts +25 -0
- package/dist/action-runners/tracking.d.cts.map +1 -0
- package/dist/action-runners/ui-feedback.d.cts +37 -0
- package/dist/action-runners/ui-feedback.d.cts.map +1 -0
- package/dist/action-runners/ui-feedback.d.ts +1 -1
- package/dist/action-runners/ui-feedback.d.ts.map +1 -1
- package/dist/animation.d.cts +26 -0
- package/dist/animation.d.cts.map +1 -0
- package/dist/artboard-portal-host.d.cts +70 -0
- package/dist/artboard-portal-host.d.cts.map +1 -0
- package/dist/artboard-portal-host.d.ts +4 -4
- package/dist/artboard-portal-host.d.ts.map +1 -1
- package/dist/code-generator.d.cts +51 -0
- package/dist/code-generator.d.cts.map +1 -0
- package/dist/error-boundary.d.cts +22 -0
- package/dist/error-boundary.d.cts.map +1 -0
- package/dist/error-boundary.d.ts +1 -1
- package/dist/error-boundary.d.ts.map +1 -1
- package/dist/form-context.d.cts +114 -0
- package/dist/form-context.d.cts.map +1 -0
- package/dist/index.cjs +68 -68
- package/dist/index.d.cts +17 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -61
- package/dist/legacy-actions.d.cts +19 -0
- package/dist/legacy-actions.d.cts.map +1 -0
- package/dist/nodes/editable-text.d.cts +15 -0
- package/dist/nodes/editable-text.d.cts.map +1 -0
- package/dist/nodes/editable-text.d.ts.map +1 -1
- package/dist/nodes/extended-form-nodes.d.cts +118 -0
- package/dist/nodes/extended-form-nodes.d.cts.map +1 -0
- package/dist/nodes/extended-form-nodes.d.ts +1 -1
- package/dist/nodes/extended-form-nodes.d.ts.map +1 -1
- package/dist/nodes/form-nodes.d.cts +186 -0
- package/dist/nodes/form-nodes.d.cts.map +1 -0
- package/dist/nodes/form-nodes.d.ts +2 -2
- package/dist/nodes/form-nodes.d.ts.map +1 -1
- package/dist/nodes/html-embed.d.cts +15 -0
- package/dist/nodes/html-embed.d.cts.map +1 -0
- package/dist/nodes/index.d.cts +7 -0
- package/dist/nodes/index.d.cts.map +1 -0
- package/dist/nodes/index.d.ts +6 -6
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/media-utils.d.cts +17 -0
- package/dist/nodes/media-utils.d.cts.map +1 -0
- package/dist/nodes/radio-group-context.d.cts +12 -0
- package/dist/nodes/radio-group-context.d.cts.map +1 -0
- package/dist/preview-adapter.d.cts +128 -0
- package/dist/preview-adapter.d.cts.map +1 -0
- package/dist/preview-adapter.d.ts +1 -1
- package/dist/preview-adapter.d.ts.map +1 -1
- package/dist/prop-resolution.d.cts +16 -0
- package/dist/prop-resolution.d.cts.map +1 -0
- package/dist/render-context.d.cts +117 -0
- package/dist/render-context.d.cts.map +1 -0
- package/dist/renderer.d.cts +77 -0
- package/dist/renderer.d.cts.map +1 -0
- package/dist/renderer.d.ts +4 -4
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderers/conversion/accordion.d.cts +20 -0
- package/dist/renderers/conversion/accordion.d.cts.map +1 -0
- package/dist/renderers/conversion/accordion.d.ts +1 -1
- package/dist/renderers/conversion/accordion.d.ts.map +1 -1
- package/dist/renderers/conversion/carousel.d.cts +13 -0
- package/dist/renderers/conversion/carousel.d.cts.map +1 -0
- package/dist/renderers/conversion/carousel.d.ts +1 -1
- package/dist/renderers/conversion/carousel.d.ts.map +1 -1
- package/dist/renderers/conversion/countdown.d.cts +50 -0
- package/dist/renderers/conversion/countdown.d.cts.map +1 -0
- package/dist/renderers/conversion/countdown.d.ts +1 -1
- package/dist/renderers/conversion/countdown.d.ts.map +1 -1
- package/dist/renderers/conversion/divider.d.cts +9 -0
- package/dist/renderers/conversion/divider.d.cts.map +1 -0
- package/dist/renderers/conversion/divider.d.ts +1 -1
- package/dist/renderers/conversion/divider.d.ts.map +1 -1
- package/dist/renderers/conversion/index.d.cts +13 -0
- package/dist/renderers/conversion/index.d.cts.map +1 -0
- package/dist/renderers/conversion/index.d.ts +6 -6
- package/dist/renderers/conversion/index.d.ts.map +1 -1
- package/dist/renderers/conversion/rating.d.cts +14 -0
- package/dist/renderers/conversion/rating.d.cts.map +1 -0
- package/dist/renderers/conversion/rating.d.ts +1 -1
- package/dist/renderers/conversion/rating.d.ts.map +1 -1
- package/dist/renderers/conversion/shared.d.cts +17 -0
- package/dist/renderers/conversion/shared.d.cts.map +1 -0
- package/dist/renderers/conversion/shared.d.ts +1 -1
- package/dist/renderers/conversion/shared.d.ts.map +1 -1
- package/dist/renderers/conversion/tabs.d.cts +7 -0
- package/dist/renderers/conversion/tabs.d.cts.map +1 -0
- package/dist/renderers/conversion/tabs.d.ts +1 -1
- package/dist/renderers/conversion/tabs.d.ts.map +1 -1
- package/dist/renderers/extended-form-renderers.d.cts +8 -0
- package/dist/renderers/extended-form-renderers.d.cts.map +1 -0
- package/dist/renderers/extended-form-renderers.d.ts +1 -1
- package/dist/renderers/extended-form-renderers.d.ts.map +1 -1
- package/dist/renderers/index.d.cts +5 -0
- package/dist/renderers/index.d.cts.map +1 -0
- package/dist/renderers/index.d.ts +4 -4
- package/dist/renderers/index.d.ts.map +1 -1
- package/dist/renderers/interactive-renderers.d.cts +7 -0
- package/dist/renderers/interactive-renderers.d.cts.map +1 -0
- package/dist/renderers/interactive-renderers.d.ts +1 -1
- package/dist/renderers/interactive-renderers.d.ts.map +1 -1
- package/dist/renderers/render-node-content.d.cts +74 -0
- package/dist/renderers/render-node-content.d.cts.map +1 -0
- package/dist/renderers/render-node-content.d.ts +1 -1
- package/dist/renderers/render-node-content.d.ts.map +1 -1
- package/dist/styles.d.cts +95 -0
- package/dist/styles.d.cts.map +1 -0
- package/dist/theme.d.cts +20 -0
- package/dist/theme.d.cts.map +1 -0
- package/dist/tracking/tracking-manager.d.cts +40 -0
- package/dist/tracking/tracking-manager.d.cts.map +1 -0
- package/package.json +17 -12
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PageDocument, type Artboard } from '@kubuild/schema';
|
|
3
|
+
import type { ComponentRegistry } from '@kubuild/components';
|
|
4
|
+
import { RenderContext, Diagnostic } from './render-context.cjs';
|
|
5
|
+
/**
|
|
6
|
+
* Standard supported viewport devices
|
|
7
|
+
*/
|
|
8
|
+
export type ViewportDevice = 'desktop' | 'tablet' | 'mobile';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for a specific viewport device
|
|
11
|
+
*/
|
|
12
|
+
export interface ViewportConfig {
|
|
13
|
+
/** Width in pixels or CSS dimension (e.g. 768, '768px', '100%') */
|
|
14
|
+
width: number | string;
|
|
15
|
+
/** Optional fixed or min height (e.g. 1024, '1024px', '100%') */
|
|
16
|
+
height?: number | string;
|
|
17
|
+
/** Optional minimum width */
|
|
18
|
+
minWidth?: number | string;
|
|
19
|
+
/** Optional maximum width */
|
|
20
|
+
maxWidth?: number | string;
|
|
21
|
+
/** Optional minimum height */
|
|
22
|
+
minHeight?: number | string;
|
|
23
|
+
/** Optional maximum height */
|
|
24
|
+
maxHeight?: number | string;
|
|
25
|
+
/** User-facing label for the viewport */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Custom CSS aspect ratio (e.g. '16/9', '9/16') */
|
|
28
|
+
aspectRatio?: string;
|
|
29
|
+
/** Scale factor applied to the preview canvas (e.g. 0.8, 1) */
|
|
30
|
+
scale?: number;
|
|
31
|
+
/** Whether the viewport width stretches fluidly up to maxWidth */
|
|
32
|
+
isFluid?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Configurable host breakpoints for responsive viewport resolution
|
|
36
|
+
*/
|
|
37
|
+
export interface ViewportBreakpoints {
|
|
38
|
+
/** Maximum screen width considered mobile (default: `BREAKPOINTS.mobile.maxWidth`, 767) */
|
|
39
|
+
mobile: number;
|
|
40
|
+
/** Maximum screen width considered tablet (default: `BREAKPOINTS.tablet.maxWidth`, 1023) */
|
|
41
|
+
tablet: number;
|
|
42
|
+
/** Screen width threshold considered desktop (default: `BREAKPOINTS.desktop.minWidth`, 1024) */
|
|
43
|
+
desktop: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Default viewport device configurations
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_VIEWPORT_CONFIGS: Record<ViewportDevice, ViewportConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Default breakpoint thresholds, derived from the shared `BREAKPOINTS` (STORA-541) so the
|
|
51
|
+
* preview picks the same layer the runtime `@media` rules and the code generator do.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_BREAKPOINTS: ViewportBreakpoints;
|
|
54
|
+
/**
|
|
55
|
+
* Resolves active viewport device category from a numeric pixel width using host-configurable breakpoints
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveViewportFromWidth(width: number, breakpoints?: Partial<ViewportBreakpoints>): ViewportDevice;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves combined viewport configuration merging defaults with host customizations
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveViewportDimensions(viewport: ViewportDevice, customConfigs?: Partial<Record<ViewportDevice, ViewportConfig>>): ViewportConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves CSS properties for the preview canvas wrapper
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveViewportContainerStyle(viewport: ViewportDevice, customConfigs?: Partial<Record<ViewportDevice, ViewportConfig>>, customScale?: number): React.CSSProperties;
|
|
66
|
+
/**
|
|
67
|
+
* Props for PreviewViewportAdapter
|
|
68
|
+
*/
|
|
69
|
+
export interface PreviewViewportAdapterProps {
|
|
70
|
+
/** The portable Page Document to render (remains immutable) */
|
|
71
|
+
document: PageDocument;
|
|
72
|
+
/** Active viewport device mode */
|
|
73
|
+
viewport?: ViewportDevice;
|
|
74
|
+
/** Callback fired when viewport is changed via built-in chrome controls */
|
|
75
|
+
onViewportChange?: (viewport: ViewportDevice) => void;
|
|
76
|
+
/** Host-configurable dimensions & overrides per viewport device */
|
|
77
|
+
viewportConfigs?: Partial<Record<ViewportDevice, ViewportConfig>>;
|
|
78
|
+
/** Host-configurable breakpoint boundaries */
|
|
79
|
+
breakpoints?: Partial<ViewportBreakpoints>;
|
|
80
|
+
/** Component registry providing renderers & schemas */
|
|
81
|
+
registry?: ComponentRegistry;
|
|
82
|
+
/** Immutable runtime context for variable, asset, & action resolution */
|
|
83
|
+
context?: RenderContext;
|
|
84
|
+
/** Rendering mode: 'runtime' or 'editor' */
|
|
85
|
+
mode?: 'editor' | 'runtime';
|
|
86
|
+
/** Whether to render device frame / chrome toolbar */
|
|
87
|
+
showChrome?: boolean;
|
|
88
|
+
/** Optional custom title displayed on device chrome */
|
|
89
|
+
chromeTitle?: string;
|
|
90
|
+
/** Non-destructive editor overlay slot (selection, bounds, grid, etc.) */
|
|
91
|
+
editorOverlay?: React.ReactNode;
|
|
92
|
+
/** Custom zoom/scale factor */
|
|
93
|
+
scale?: number;
|
|
94
|
+
/** Outer container CSS class */
|
|
95
|
+
className?: string;
|
|
96
|
+
/** Outer container inline styles */
|
|
97
|
+
style?: React.CSSProperties;
|
|
98
|
+
/** Inner canvas container CSS class */
|
|
99
|
+
canvasClassName?: string;
|
|
100
|
+
/** Inner canvas container inline styles */
|
|
101
|
+
canvasStyle?: React.CSSProperties;
|
|
102
|
+
/** Optional click handler for canvas nodes */
|
|
103
|
+
onNodeClick?: (nodeId: string, event: React.MouseEvent) => void;
|
|
104
|
+
/** Optional diagnostic handler for action or render issues */
|
|
105
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
106
|
+
/** Optional action dispatch handler */
|
|
107
|
+
onActionDispatch?: (actionType: string, payload: Record<string, unknown> | undefined, nodeId: string) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Component artboards (detached modals/drawers) belonging to the same project as
|
|
110
|
+
* `document`. Passing them lets a trigger in the page open its detached overlay inside
|
|
111
|
+
* this preview, exactly as it will on a published page. Defaults to
|
|
112
|
+
* `context.componentArtboards`.
|
|
113
|
+
*/
|
|
114
|
+
componentArtboards?: readonly Artboard[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Preview Viewport Adapter Component
|
|
118
|
+
*
|
|
119
|
+
* Provides an isolated, host-configurable desktop/tablet/mobile preview container that uses
|
|
120
|
+
* the exact same KubuildRenderer and RenderContext as production runtime, differing only in
|
|
121
|
+
* viewport dimensions and optional device chrome/editor overlays.
|
|
122
|
+
*/
|
|
123
|
+
export declare const PreviewViewportAdapter: React.FC<PreviewViewportAdapterProps>;
|
|
124
|
+
/**
|
|
125
|
+
* Alias for PreviewViewportAdapter
|
|
126
|
+
*/
|
|
127
|
+
export declare const KubuildPreviewViewport: React.FC<PreviewViewportAdapterProps>;
|
|
128
|
+
//# sourceMappingURL=preview-adapter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-adapter.d.cts","sourceRoot":"","sources":["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;IAC1E,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAChE,8DAA8D;IAC9D,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAChD,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9G;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAuNxE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,uCAAyB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PageDocument, type Artboard } from '@kubuild/schema';
|
|
3
3
|
import type { ComponentRegistry } from '@kubuild/components';
|
|
4
|
-
import { RenderContext, Diagnostic } from './render-context';
|
|
4
|
+
import { RenderContext, Diagnostic } from './render-context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Standard supported viewport devices
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-adapter.d.ts","sourceRoot":"","sources":["../src/preview-adapter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"preview-adapter.d.ts","sourceRoot":"","sources":["../src/preview-adapter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIhE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,KA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ACH,eAAO,MAAM,sBAAsB,uCAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Node } from '@kubuild/schema';
|
|
2
|
+
import { ComponentDefinition } from '@kubuild/components';
|
|
3
|
+
import { Diagnostic, RenderContext } from '@kubuild/core';
|
|
4
|
+
export interface ResolvedNodeProps {
|
|
5
|
+
props: Record<string, unknown>;
|
|
6
|
+
diagnostics: Diagnostic[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves every binding-compatible prop on a node up front, before the component
|
|
10
|
+
* receives its render props — centralizes what was previously ad hoc per-field
|
|
11
|
+
* `resolveVariable` calls scattered across the renderer switch. Non-bindable
|
|
12
|
+
* fields (select/image/action/json) and fields absent from `propFields` pass
|
|
13
|
+
* through unchanged; validating their static shape remains `validateProps`' job.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolvePropsForNode(node: Node, definition: ComponentDefinition | undefined, context: RenderContext | undefined): ResolvedNodeProps;
|
|
16
|
+
//# sourceMappingURL=prop-resolution.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-resolution.d.cts","sourceRoot":"","sources":["../src/prop-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgD,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAmD,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAkB,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG1E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AA2DD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,OAAO,EAAE,aAAa,GAAG,SAAS,GACjC,iBAAiB,CAwCnB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AssetProvider, ActionRegistry, ActionHandler, ActionDiagnostic, Diagnostic, RenderContext, RuntimeContext, RuntimeTrackingOptions } from '@kubuild/core';
|
|
3
|
+
import { ActionBinding, Artboard, ArtboardType, PageDocument } from '@kubuild/schema';
|
|
4
|
+
export type { RenderContext, RuntimeContext, ActionDiagnostic, Diagnostic, RuntimeTrackingOptions };
|
|
5
|
+
/**
|
|
6
|
+
* Empty default frozen context
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_RENDER_CONTEXT: RenderContext;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an immutable (frozen) RenderContext.
|
|
11
|
+
* Guarantees that components cannot mutate the runtime context during rendering.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createRenderContext(options?: {
|
|
14
|
+
variables?: Record<string, unknown>;
|
|
15
|
+
assetProvider?: AssetProvider;
|
|
16
|
+
actionRegistry?: ActionRegistry;
|
|
17
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Component artboards reachable from this render. Passing them lets a trigger in one
|
|
20
|
+
* artboard open content that physically lives in another (see ArtboardPortalHost).
|
|
21
|
+
* A default `resolveArtboard` is derived from this list when one isn't supplied.
|
|
22
|
+
*/
|
|
23
|
+
componentArtboards?: readonly Artboard[];
|
|
24
|
+
resolveArtboard?: (triggerId: string) => Artboard | undefined;
|
|
25
|
+
/** 'component' when this render is a node being authored alone on its own artboard. */
|
|
26
|
+
artboardSurface?: ArtboardType;
|
|
27
|
+
/** Host tracking runtime options (e.g. `relayUrl`). Host config, never document data. */
|
|
28
|
+
tracking?: RuntimeTrackingOptions;
|
|
29
|
+
/** Host theme override merged over `PageDocument.theme` at render time (STORA-551). */
|
|
30
|
+
theme?: RenderContext['theme'];
|
|
31
|
+
}): RenderContext;
|
|
32
|
+
/**
|
|
33
|
+
* Minimal offline in-memory context factory.
|
|
34
|
+
* Can be safely injected into unit tests, local mock playgrounds, or SSR without any network calls.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMinimalRenderContext(options?: {
|
|
37
|
+
variables?: Record<string, unknown>;
|
|
38
|
+
assets?: Record<string, string>;
|
|
39
|
+
actions?: Record<string, ActionHandler>;
|
|
40
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
41
|
+
}): RenderContext;
|
|
42
|
+
/**
|
|
43
|
+
* Provider component to make RenderContext available anywhere in the component tree
|
|
44
|
+
*/
|
|
45
|
+
export interface RenderContextProviderProps {
|
|
46
|
+
value?: RenderContext;
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export declare const RenderContextProvider: React.FC<RenderContextProviderProps>;
|
|
50
|
+
/**
|
|
51
|
+
* Hook to access the current RenderContext
|
|
52
|
+
*/
|
|
53
|
+
export declare function useRenderContext(): RenderContext;
|
|
54
|
+
/**
|
|
55
|
+
* Asset resolution helper.
|
|
56
|
+
* Computes asset URLs synchronously for React render cycles.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveAssetSync(assetProvider?: AssetProvider, assetIdOrUri?: string): string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Variable resolution helper.
|
|
61
|
+
* Resolves VariableBinding objects and template strings like "{{ title }}" using context variables.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveVariable(context?: RenderContext, value?: unknown): unknown;
|
|
64
|
+
/**
|
|
65
|
+
* Result of resolving an action payload: the resolved (serializable) value, plus any
|
|
66
|
+
* binding paths that failed to resolve (missing key, no author-declared fallback).
|
|
67
|
+
* `invalidPaths` is what lets dispatchAction refuse to run a handler with an
|
|
68
|
+
* unexpected/garbage value instead of silently passing through an empty string.
|
|
69
|
+
*/
|
|
70
|
+
export interface ActionPayloadResolution {
|
|
71
|
+
value: Record<string, unknown> | undefined;
|
|
72
|
+
invalidPaths: string[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Recursively resolves variables within an action payload without mutating the input object.
|
|
76
|
+
* Tracks dotted field paths (e.g. "item.id") whose binding resolved to the "empty" outcome —
|
|
77
|
+
* i.e. an invalid/missing path with no fallback declared — as opposed to `fallback`, which is
|
|
78
|
+
* an author-declared safe default and never treated as invalid.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveActionPayloadDetailed(context: RenderContext | undefined, payload: Record<string, unknown> | undefined): ActionPayloadResolution;
|
|
81
|
+
/**
|
|
82
|
+
* Recursively resolves variables within an action payload without mutating the input object.
|
|
83
|
+
* Back-compat convenience wrapper over resolveActionPayloadDetailed for callers that only
|
|
84
|
+
* need the resolved value (e.g. previewing a payload) and not invalid-path enforcement.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveActionPayload(context?: RenderContext, payload?: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Action resolution helper.
|
|
89
|
+
* Checks whether an action type is registered with the current action registry.
|
|
90
|
+
*/
|
|
91
|
+
export declare function isActionRegistered(actionRegistry?: ActionRegistry, actionType?: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Safe action dispatch options
|
|
94
|
+
*/
|
|
95
|
+
export interface DispatchActionOptions {
|
|
96
|
+
action: ActionBinding | unknown;
|
|
97
|
+
nodeId?: string;
|
|
98
|
+
document: PageDocument;
|
|
99
|
+
context?: RenderContext;
|
|
100
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Whether built-in handlers for legacy types (navigate, open_modal, …) may run when the host
|
|
103
|
+
* registered none. Defaults to true; the renderer passes false in editor mode so clicking a
|
|
104
|
+
* button on the canvas never navigates the editor away.
|
|
105
|
+
*/
|
|
106
|
+
allowBuiltinHandlers?: boolean;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Dispatches an action safely from the renderer to registered host handlers.
|
|
111
|
+
* Guarantees that:
|
|
112
|
+
* 1. Payload variables are resolved safely.
|
|
113
|
+
* 2. Unregistered / unknown actions are not executed and trigger diagnostics.
|
|
114
|
+
* 3. No arbitrary JS code (eval, Function, script injection) from document/props is ever executed.
|
|
115
|
+
*/
|
|
116
|
+
export declare function dispatchAction(options: DispatchActionOptions): boolean;
|
|
117
|
+
//# sourceMappingURL=render-context.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-context.d.cts","sourceRoot":"","sources":["../src/render-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EAEb,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,cAAc,EACd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACb,MAAM,iBAAiB,CAAC;AAIzB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,sBAAsB,EAAE,CAAC;AAEpG;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAAiC,CAAC;AAOvE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IAC9D,uFAAuF;IACvF,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,EAAE,sBAAsB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AAG,SAAS,GAC3C,uBAAuB,CAkDzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAErC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAKhG;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CA8GtE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PageDocument, Node } from '@kubuild/schema';
|
|
3
|
+
import { type ComponentRegistry } from '@kubuild/components';
|
|
4
|
+
import { RenderContext, Diagnostic } from './render-context.cjs';
|
|
5
|
+
import { type ResponsiveMode } from './styles.cjs';
|
|
6
|
+
export * from './nodes/index.cjs';
|
|
7
|
+
export * from './renderers/index.cjs';
|
|
8
|
+
export interface KubuildRendererProps {
|
|
9
|
+
document: PageDocument;
|
|
10
|
+
registry?: ComponentRegistry;
|
|
11
|
+
context?: RenderContext;
|
|
12
|
+
/**
|
|
13
|
+
* Preview a single viewport's styles (merged into inline styles). Passing it selects
|
|
14
|
+
* `responsive: 'viewport'` unless `responsive` is set explicitly.
|
|
15
|
+
*/
|
|
16
|
+
viewport?: 'desktop' | 'tablet' | 'mobile';
|
|
17
|
+
mode?: 'editor' | 'runtime';
|
|
18
|
+
/**
|
|
19
|
+
* How `styles.desktop/tablet/mobile` are applied (STORA-540):
|
|
20
|
+
* - `'css'`: base inline + scoped `@media` rules, so the real screen width decides
|
|
21
|
+
* (SSR-safe, no viewport guessing). Default for `mode="runtime"` without `viewport`.
|
|
22
|
+
* - `'viewport'`: merge the layer named by `viewport` inline. Default for `mode="editor"`
|
|
23
|
+
* or whenever `viewport` is passed (device-frame previews).
|
|
24
|
+
*/
|
|
25
|
+
responsive?: ResponsiveMode;
|
|
26
|
+
className?: string;
|
|
27
|
+
showToastContainer?: boolean;
|
|
28
|
+
onNodeClick?: (nodeId: string, event: React.MouseEvent) => void;
|
|
29
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
30
|
+
onActionDispatch?: (actionType: string, payload: Record<string, unknown> | undefined, nodeId: string) => void;
|
|
31
|
+
onNodePropChange?: (nodeId: string, propName: string, value: unknown, isBlur?: boolean) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Id of the currently-selected node (editor mode only). Typography/button/form-label
|
|
34
|
+
* nodes only become `contentEditable` once they're already selected, so a first tap/click
|
|
35
|
+
* always just selects instead of immediately opening edit mode underneath it.
|
|
36
|
+
*/
|
|
37
|
+
selectedNodeId?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface NodeRendererProps {
|
|
40
|
+
node: Node;
|
|
41
|
+
document: PageDocument;
|
|
42
|
+
registry: ComponentRegistry;
|
|
43
|
+
context?: RenderContext;
|
|
44
|
+
viewport?: 'desktop' | 'tablet' | 'mobile';
|
|
45
|
+
mode?: 'editor' | 'runtime';
|
|
46
|
+
/**
|
|
47
|
+
* `'css'` renders only the base layer inline; the caller must also emit
|
|
48
|
+
* `collectResponsiveStylesCss(document)` (KubuildRenderer does). Defaults to `'viewport'`.
|
|
49
|
+
*/
|
|
50
|
+
responsive?: ResponsiveMode;
|
|
51
|
+
onNodeClick?: (nodeId: string, event: React.MouseEvent) => void;
|
|
52
|
+
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
53
|
+
onActionDispatch?: (actionType: string, payload: Record<string, unknown> | undefined, nodeId: string) => void;
|
|
54
|
+
onNodePropChange?: (nodeId: string, propName: string, value: unknown, isBlur?: boolean) => void;
|
|
55
|
+
selectedNodeId?: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Suffix appended to the HTML `id` attribute (never to `data-kubuild-node`, the
|
|
58
|
+
* canonical template-node reference) so a `collection` node's repeated child
|
|
59
|
+
* template produces unique DOM ids per iteration instead of duplicates.
|
|
60
|
+
*/
|
|
61
|
+
instanceSuffix?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare function NodeRenderer({ node, document, registry, context: propContext, viewport, mode, responsive, onNodeClick, onDiagnostic, onActionDispatch, onNodePropChange, selectedNodeId, instanceSuffix, }: NodeRendererProps): React.ReactElement;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the action type of a legacy `props.action` binding that no host handler and no
|
|
66
|
+
* built-in handler will execute (or `'invalid'` for a malformed binding); `null` when it
|
|
67
|
+
* resolves.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getUnresolvedLegacyActionType(action: unknown, context?: RenderContext): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Pick the responsive strategy: an explicit `responsive` wins; otherwise published pages
|
|
72
|
+
* (`mode="runtime"` with no `viewport`) use real `@media` rules, while the editor canvas and
|
|
73
|
+
* device-frame previews (which pass `viewport`) keep the per-viewport inline merge.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveResponsiveMode(responsive: ResponsiveMode | undefined, mode: 'editor' | 'runtime', viewport: 'desktop' | 'tablet' | 'mobile' | undefined): ResponsiveMode;
|
|
76
|
+
export declare const KubuildRenderer: React.NamedExoticComponent<KubuildRendererProps>;
|
|
77
|
+
//# sourceMappingURL=renderer.d.cts.map
|
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EACd,cAAmB,GACpB,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAoNxC;AAgCD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAKrG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,GAAG,SAAS,EACtC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GACpD,cAAc,CAGhB;AA2FD,eAAO,MAAM,eAAe,kDAAuC,CAAC"}
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PageDocument, Node } from '@kubuild/schema';
|
|
3
3
|
import { type ComponentRegistry } from '@kubuild/components';
|
|
4
|
-
import { RenderContext, Diagnostic } from './render-context';
|
|
5
|
-
import { type ResponsiveMode } from './styles';
|
|
6
|
-
export * from './nodes';
|
|
7
|
-
export * from './renderers';
|
|
4
|
+
import { RenderContext, Diagnostic } from './render-context.js';
|
|
5
|
+
import { type ResponsiveMode } from './styles.js';
|
|
6
|
+
export * from './nodes/index.js';
|
|
7
|
+
export * from './renderers/index.js';
|
|
8
8
|
export interface KubuildRendererProps {
|
|
9
9
|
document: PageDocument;
|
|
10
10
|
registry?: ComponentRegistry;
|
package/dist/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,IAAI,EAEL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,iBAAiB,EAAkC,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EACL,aAAa,EAKb,UAAU,EACX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ACpB,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAoNxC;AAgCD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAKrG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,GAAG,SAAS,EACtC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GACpD,cAAc,CAGhB;AA2FD,eAAO,MAAM,eAAe,kDAAuC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Node } from '@kubuild/schema';
|
|
3
|
+
import type { RenderNodeContentOptions } from '../render-node-content.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* Pure open-state transition for an accordion (exported for tests). In single-open
|
|
6
|
+
* mode opening an item closes every other item; toggling an open item closes it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toggleAccordionIndex(open: ReadonlySet<number>, index: number, allowMultiple: boolean): Set<number>;
|
|
9
|
+
/**
|
|
10
|
+
* Builds schema.org `FAQPage` structured data from an accordion node: each
|
|
11
|
+
* `accordion-item`'s `title` is the question and the plain text of its children is
|
|
12
|
+
* the answer. Items without a literal title or answer are skipped. Returns `null`
|
|
13
|
+
* when nothing usable remains.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildFaqJsonLd(accordion: Node): Record<string, unknown> | null;
|
|
16
|
+
/** Serializes JSON for a `<script>` body so document text can never close the tag. */
|
|
17
|
+
export declare function serializeJsonForScript(value: unknown): string;
|
|
18
|
+
export declare function renderAccordion(options: RenderNodeContentOptions): React.ReactElement;
|
|
19
|
+
export declare function renderAccordionItem(options: RenderNodeContentOptions): React.ReactElement;
|
|
20
|
+
//# sourceMappingURL=accordion.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.cts","sourceRoot":"","sources":["../../../src/renderers/conversion/accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAa1E;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,OAAO,GACrB,GAAG,CAAC,MAAM,CAAC,CAUb;AAgBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAkB9E;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAO7D;AA0KD,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAErF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAEzF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Node } from '@kubuild/schema';
|
|
3
|
-
import type { RenderNodeContentOptions } from '../render-node-content';
|
|
3
|
+
import type { RenderNodeContentOptions } from '../render-node-content.js';
|
|
4
4
|
/**
|
|
5
5
|
* Pure open-state transition for an accordion (exported for tests). In single-open
|
|
6
6
|
* mode opening an item closes every other item; toggling an open item closes it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAa1E;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,OAAO,GACrB,GAAG,CAAC,MAAM,CAAC,CAUb;AAgBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAkB9E;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAO7D;AA0KD,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAErF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAEzF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.cjs';
|
|
3
|
+
/** Minimum horizontal travel (px) for a touch gesture to count as a swipe. */
|
|
4
|
+
export declare const CAROUSEL_SWIPE_THRESHOLD = 40;
|
|
5
|
+
/**
|
|
6
|
+
* Pure slide-index step (exported for tests). With `loop` the index wraps around;
|
|
7
|
+
* without it, it stops at the first/last slide.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stepCarouselIndex(current: number, delta: number, count: number, loop: boolean): number;
|
|
10
|
+
/** Direction of a completed touch gesture: -1 (swipe left → next), 1 (swipe right → prev) or 0. */
|
|
11
|
+
export declare function swipeDirection(startX: number, endX: number, threshold?: number): -1 | 0 | 1;
|
|
12
|
+
export declare function renderCarousel(options: RenderNodeContentOptions): React.ReactElement;
|
|
13
|
+
//# sourceMappingURL=carousel.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.d.cts","sourceRoot":"","sources":["../../../src/renderers/conversion/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,GACZ,MAAM,CAKR;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,SAA2B,GACnC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAIZ;AAwMD,wBAAgB,cAAc,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAEpF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RenderNodeContentOptions } from '../render-node-content';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.js';
|
|
3
3
|
/** Minimum horizontal travel (px) for a touch gesture to count as a swipe. */
|
|
4
4
|
export declare const CAROUSEL_SWIPE_THRESHOLD = 40;
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,GACZ,MAAM,CAKR;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,SAA2B,GACnC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAIZ;AAwMD,wBAAgB,cAAc,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAEpF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.cjs';
|
|
3
|
+
export type CountdownFormat = 'mm:ss' | 'hh:mm:ss' | 'd h m s';
|
|
4
|
+
export interface CountdownParts {
|
|
5
|
+
days: number;
|
|
6
|
+
hours: number;
|
|
7
|
+
minutes: number;
|
|
8
|
+
seconds: number;
|
|
9
|
+
totalSeconds: number;
|
|
10
|
+
}
|
|
11
|
+
/** Splits a millisecond duration into whole d/h/m/s parts (never negative). */
|
|
12
|
+
export declare function splitCountdown(ms: number): CountdownParts;
|
|
13
|
+
/**
|
|
14
|
+
* Formats a remaining duration. `mm:ss` rolls hours into minutes and `hh:mm:ss`
|
|
15
|
+
* rolls days into hours, so no time is ever hidden by the chosen format.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatCountdown(ms: number, format: CountdownFormat): string;
|
|
18
|
+
/** Offset (ms) of `timeZone` from UTC at the instant `utcMs`. Throws on an unknown zone. */
|
|
19
|
+
export declare function getTimeZoneOffsetMs(utcMs: number, timeZone: string): number;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves a fixed countdown target to a UTC epoch. A value carrying an explicit
|
|
22
|
+
* offset (`...Z`, `...+07:00`) is used as-is; a bare wall-clock value is interpreted
|
|
23
|
+
* in `timeZone` (DST-aware). An invalid timezone falls back to UTC. Returns `null`
|
|
24
|
+
* for an empty or unparseable target.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveFixedDeadline(targetDate: string, timeZone?: string): number | null;
|
|
27
|
+
export interface CountdownStorageLike {
|
|
28
|
+
getItem(key: string): string | null;
|
|
29
|
+
setItem(key: string, value: string): void;
|
|
30
|
+
}
|
|
31
|
+
/** Test hook: clears the in-memory evergreen fallback store. */
|
|
32
|
+
export declare function resetCountdownMemoryStore(): void;
|
|
33
|
+
/** Returns the requested Web Storage, or `null` when unavailable (SSR, privacy mode, sandbox). */
|
|
34
|
+
export declare function getCountdownStorage(kind: 'session' | 'local'): CountdownStorageLike | null;
|
|
35
|
+
/**
|
|
36
|
+
* Resolves (and persists) the per-visitor evergreen deadline. A stored deadline is
|
|
37
|
+
* reused only when it was created for the same duration, so editing the duration
|
|
38
|
+
* restarts the timer instead of keeping a stale deadline. Every storage access is
|
|
39
|
+
* guarded: when reading or writing throws, the in-memory store is used instead.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveEvergreenDeadline(options: {
|
|
42
|
+
key: string;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
now: number;
|
|
45
|
+
storage: CountdownStorageLike | null;
|
|
46
|
+
}): number;
|
|
47
|
+
/** Fires the node's `expire` action pipelines (STORA-543). */
|
|
48
|
+
export declare function fireCountdownExpire(options: RenderNodeContentOptions): Promise<unknown>;
|
|
49
|
+
export declare function renderCountdown(options: RenderNodeContentOptions): React.ReactElement;
|
|
50
|
+
//# sourceMappingURL=countdown.d.cts.map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AAwB,CAAC,OAAO,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACtC,GAAG,MAAM,CAsCT;AAED,8DAA8D;AAC9D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CASvF;AA6LD,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAErF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RenderNodeContentOptions } from '../render-node-content';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.js';
|
|
3
3
|
export type CountdownFormat = 'mm:ss' | 'hh:mm:ss' | 'd h m s';
|
|
4
4
|
export interface CountdownParts {
|
|
5
5
|
days: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countdown.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/countdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"countdown.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/countdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAI1E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB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|
|
3
|
+
export declare function renderDivider(options: RenderNodeContentOptions): React.ReactElement;
|
|
4
|
+
/**
|
|
5
|
+
* Spacer: its height comes from the node's (per-breakpoint) styles. In the editor it
|
|
6
|
+
* gets a dashed outline so an otherwise invisible node can still be found and selected.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderSpacer(options: RenderNodeContentOptions): React.ReactElement;
|
|
9
|
+
//# sourceMappingURL=divider.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.d.cts","sourceRoot":"","sources":["../../../src/renderers/conversion/divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,wBAAgB,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAqCnF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAiBlF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RenderNodeContentOptions } from '../render-node-content';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.js';
|
|
3
3
|
export declare function renderDivider(options: RenderNodeContentOptions): React.ReactElement;
|
|
4
4
|
/**
|
|
5
5
|
* Spacer: its height comes from the node's (per-breakpoint) styles. In the editor it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../../src/renderers/conversion/divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,wBAAgB,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAqCnF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAiBlF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { RenderNodeContentOptions } from '../render-node-content.cjs';
|
|
3
|
+
export { splitCountdown, formatCountdown, getTimeZoneOffsetMs, resolveFixedDeadline, resolveEvergreenDeadline, getCountdownStorage, resetCountdownMemoryStore, fireCountdownExpire, type CountdownFormat, type CountdownParts, type CountdownStorageLike, } from './countdown.cjs';
|
|
4
|
+
export { toggleAccordionIndex, buildFaqJsonLd, serializeJsonForScript } from './accordion.cjs';
|
|
5
|
+
export { clampTabIndex } from './tabs.cjs';
|
|
6
|
+
export { stepCarouselIndex, swipeDirection, CAROUSEL_SWIPE_THRESHOLD } from './carousel.cjs';
|
|
7
|
+
export { normalizeRating, ratingStarFills, formatRatingLabel, RATING_MAX_STARS } from './rating.cjs';
|
|
8
|
+
/**
|
|
9
|
+
* Conversion components (Epic 60): countdown, accordion/accordion-item, tabs/tab-panel,
|
|
10
|
+
* carousel, rating, divider, spacer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderConversionNode(options: RenderNodeContentOptions): React.ReactElement | null;
|
|
13
|
+
//# sourceMappingURL=index.d.cts.map
|