@syntrologie/runtime-sdk 2.4.0-canary.2 → 2.4.0-canary.21

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.
Files changed (62) hide show
  1. package/CAPABILITIES.md +116 -1
  2. package/dist/SmartCanvasApp.d.ts +5 -3
  3. package/dist/actions/executors/index.d.ts +1 -2
  4. package/dist/actions/index.d.ts +2 -2
  5. package/dist/actions/schema.d.ts +58243 -201
  6. package/dist/actions/schema.js +5 -2
  7. package/dist/actions/types.d.ts +45 -48
  8. package/dist/anchor/AnchorResolver.d.ts +18 -0
  9. package/dist/anchor/index.d.ts +2 -0
  10. package/dist/api.d.ts +3 -8
  11. package/dist/apps/examples/gamification-app.example.d.ts +8 -8
  12. package/dist/chunk-2UYZ5DWI.js +126 -0
  13. package/dist/chunk-2UYZ5DWI.js.map +7 -0
  14. package/dist/{chunk-DOJR7R46.js → chunk-HF3D7YFQ.js} +49 -31
  15. package/dist/chunk-HF3D7YFQ.js.map +7 -0
  16. package/dist/{chunk-ZDZ3IYFN.js → chunk-IPU3WVPY.js} +3449 -2110
  17. package/dist/chunk-IPU3WVPY.js.map +7 -0
  18. package/dist/{chunk-BIYMC56J.js → chunk-P5G4KT2U.js} +54 -6
  19. package/dist/chunk-P5G4KT2U.js.map +7 -0
  20. package/dist/components/ShadowCanvasOverlay.d.ts +1 -20
  21. package/dist/config/schema.d.ts +1797 -267
  22. package/dist/config/schema.js +19 -62
  23. package/dist/config/schema.js.map +3 -3
  24. package/dist/context/schema.d.ts +8 -8
  25. package/dist/decisions/schema.d.ts +506 -1490
  26. package/dist/decisions/schema.js +5 -2
  27. package/dist/decisions/types.d.ts +22 -0
  28. package/dist/events/registerConfigPredicates.d.ts +7 -10
  29. package/dist/events/schema.d.ts +12 -12
  30. package/dist/experiments/adapters/growthbook.d.ts +2 -0
  31. package/dist/experiments/types.d.ts +7 -0
  32. package/dist/hooks/useShadowCanvasConfig.d.ts +4 -2
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +72 -98
  35. package/dist/index.js.map +3 -3
  36. package/dist/overlays/schema.d.ts +48 -48
  37. package/dist/react.js +4 -3
  38. package/dist/react.js.map +1 -1
  39. package/dist/runtime.d.ts +3 -0
  40. package/dist/smart-canvas.esm.js +62 -66
  41. package/dist/smart-canvas.esm.js.map +4 -4
  42. package/dist/smart-canvas.js +2591 -1167
  43. package/dist/smart-canvas.js.map +4 -4
  44. package/dist/smart-canvas.min.js +62 -66
  45. package/dist/smart-canvas.min.js.map +4 -4
  46. package/dist/surfaces/types.d.ts +2 -1
  47. package/dist/theme/ThemeProvider.d.ts +11 -16
  48. package/dist/theme/defaultTheme.d.ts +6 -1
  49. package/dist/theme/index.d.ts +3 -4
  50. package/dist/theme/types.d.ts +10 -0
  51. package/dist/version.d.ts +1 -1
  52. package/package.json +7 -7
  53. package/schema/canvas-config.schema.json +9418 -790
  54. package/scripts/validate-config.mjs +78 -0
  55. package/dist/actions/executors/tour.d.ts +0 -18
  56. package/dist/chunk-BIYMC56J.js.map +0 -7
  57. package/dist/chunk-DOJR7R46.js.map +0 -7
  58. package/dist/chunk-JMHRHAEL.js +0 -18
  59. package/dist/chunk-JMHRHAEL.js.map +0 -7
  60. package/dist/chunk-ZDZ3IYFN.js.map +0 -7
  61. package/dist/hooks/useHostPatches.d.ts +0 -9
  62. package/dist/theme/extractHostTheme.d.ts +0 -14
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  AddClassZ,
3
+ AnchorIdZ,
3
4
  BadgePositionZ,
4
5
  BadgeZ,
5
6
  CtaButtonZ,
@@ -30,10 +31,12 @@ import {
30
31
  WaitZ,
31
32
  WidgetConfigZ,
32
33
  coreActionStepSchemas
33
- } from "../chunk-DOJR7R46.js";
34
- import "../chunk-JMHRHAEL.js";
34
+ } from "../chunk-HF3D7YFQ.js";
35
+ import "../chunk-2UYZ5DWI.js";
36
+ import "../chunk-P5G4KT2U.js";
35
37
  export {
36
38
  AddClassZ,
39
+ AnchorIdZ,
37
40
  BadgePositionZ,
38
41
  BadgeZ,
39
42
  CtaButtonZ,
@@ -5,6 +5,8 @@
5
5
  * (highlight, tooltip, badge, DOM modifications, navigation).
6
6
  */
7
7
  import type { Placement } from '@floating-ui/dom';
8
+ import type { BadgePosition, CtaButton, HighlightStyle, InsertPosition, ModalContent, ModalWaitFor, TooltipTrigger, TooltipWaitFor } from '@syntrologie/sdk-contracts';
9
+ export type { BadgePosition, CtaButton, HighlightStyle, InsertPosition, ModalContent, ModalWaitFor, TooltipTrigger, TooltipWaitFor, };
8
10
  /** Static surface slots with fixed positioning */
9
11
  export type StaticSurfaceSlot = 'drawer_right' | 'drawer_left' | 'drawer_bottom' | 'overlay_center' | 'overlay_corner_br' | 'overlay_corner_bl' | 'toast_top' | 'toast_bottom';
10
12
  /** Dynamic inline slot (rendered inside anchor) */
@@ -13,31 +15,7 @@ export type InlineSurfaceSlot = `inline:${string}`;
13
15
  export type AdjacentSurfaceSlot = `adjacent:${string}`;
14
16
  /** All surface slot types */
15
17
  export type SurfaceSlot = StaticSurfaceSlot | InlineSurfaceSlot | AdjacentSurfaceSlot;
16
- /** Highlight style configuration */
17
- export interface HighlightStyle {
18
- /** Ring color (default: "#5b8cff") */
19
- color?: string;
20
- /** Backdrop scrim opacity 0-1 (default: 0.55, set to 0 to hide) */
21
- scrimOpacity?: number;
22
- /** Space between element and ring in pixels (default: 12) */
23
- paddingPx?: number;
24
- /** Ring corner radius in pixels (default: 12) */
25
- radiusPx?: number;
26
- }
27
- /** Badge position relative to anchor */
28
- export type BadgePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
29
- /** CTA button configuration for tooltips/modals */
30
- export interface CtaButton {
31
- label: string;
32
- actionId: string;
33
- primary?: boolean;
34
- }
35
- /** Modal content configuration */
36
- export interface ModalContent {
37
- title?: string;
38
- body: string;
39
- }
40
- /** Tooltip content configuration */
18
+ /** Tooltip content configuration (uses ActionStep for cta.action, narrower than sdk-contracts' unknown) */
41
19
  export interface TooltipContent {
42
20
  title?: string;
43
21
  body: string;
@@ -47,25 +25,30 @@ export interface TooltipContent {
47
25
  };
48
26
  ctaButtons?: CtaButton[];
49
27
  }
50
- /** Tooltip trigger mode */
51
- export type TooltipTrigger = 'immediate' | 'hover' | 'click';
52
- /** Position where HTML/content should be inserted */
53
- export type InsertPosition = 'before' | 'after' | 'prepend' | 'append' | 'replace';
54
28
  /** Widget configuration for surface mounting */
55
29
  export interface WidgetConfig {
56
30
  widgetId: string;
57
31
  props?: Record<string, unknown>;
58
32
  priority?: number;
59
33
  }
34
+ /** Route-scoped anchor identifier */
35
+ export interface AnchorId {
36
+ /** CSS selector for the anchor element */
37
+ selector: string;
38
+ /** Route pattern(s) where this anchor applies. Uses matchRoutePattern (**, *, :param). Use "**" for all routes. */
39
+ route: string | string[];
40
+ }
60
41
  /** Base action with common properties */
61
42
  interface BaseAction {
62
43
  /** Optional label for debugging/telemetry */
63
44
  label?: string;
45
+ /** Optional conditional trigger — when present, action only fires if strategy evaluates to true */
46
+ triggerWhen?: import('../decisions/types').DecisionStrategy<boolean>;
64
47
  }
65
48
  /** Highlight an anchor element with spotlight effect */
66
49
  export interface HighlightAction extends BaseAction {
67
50
  kind: 'overlays:highlight';
68
- anchorId: string;
51
+ anchorId: AnchorId;
69
52
  style?: HighlightStyle;
70
53
  /** Duration in ms before auto-cleanup (for use in sequences) */
71
54
  duration?: number;
@@ -73,30 +56,26 @@ export interface HighlightAction extends BaseAction {
73
56
  /** Pulse animation on an anchor element */
74
57
  export interface PulseAction extends BaseAction {
75
58
  kind: 'overlays:pulse';
76
- anchorId: string;
59
+ anchorId: AnchorId;
77
60
  duration?: number;
78
61
  }
79
62
  /** Add a badge near an anchor element */
80
63
  export interface BadgeAction extends BaseAction {
81
64
  kind: 'overlays:badge';
82
- anchorId: string;
65
+ anchorId: AnchorId;
83
66
  content: string;
84
67
  position?: BadgePosition;
85
68
  }
86
- /** Tooltip lifecycle - when the action completes (for sequences) */
87
- export type TooltipWaitFor = 'dismissed' | 'cta-click' | `timeout:${number}`;
88
69
  /** Show a tooltip near an anchor element */
89
70
  export interface TooltipAction extends BaseAction {
90
71
  kind: 'overlays:tooltip';
91
- anchorId: string;
72
+ anchorId: AnchorId;
92
73
  content: TooltipContent;
93
74
  trigger?: TooltipTrigger;
94
75
  placement?: Placement;
95
76
  /** When the action completes (for use in sequences). Publishes event to EventBus. */
96
77
  waitFor?: TooltipWaitFor;
97
78
  }
98
- /** Modal lifecycle - when the action completes (for sequences) */
99
- export type ModalWaitFor = 'dismissed' | 'cta-click' | `timeout:${number}`;
100
79
  /** Show a centered modal dialog */
101
80
  export interface ModalAction extends BaseAction {
102
81
  kind: 'overlays:modal';
@@ -118,39 +97,39 @@ export interface ModalAction extends BaseAction {
118
97
  /** Insert HTML content relative to anchor */
119
98
  export interface InsertHtmlAction extends BaseAction {
120
99
  kind: 'content:insertHtml';
121
- anchorId: string;
100
+ anchorId: AnchorId;
122
101
  html: string;
123
102
  position: InsertPosition;
124
103
  }
125
104
  /** Set text content of an anchor */
126
105
  export interface SetTextAction extends BaseAction {
127
106
  kind: 'content:setText';
128
- anchorId: string;
107
+ anchorId: AnchorId;
129
108
  text: string;
130
109
  }
131
110
  /** Set an attribute on an anchor */
132
111
  export interface SetAttrAction extends BaseAction {
133
112
  kind: 'content:setAttr';
134
- anchorId: string;
113
+ anchorId: AnchorId;
135
114
  attr: string;
136
115
  value: string;
137
116
  }
138
117
  /** Add a CSS class to an anchor */
139
118
  export interface AddClassAction extends BaseAction {
140
119
  kind: 'content:addClass';
141
- anchorId: string;
120
+ anchorId: AnchorId;
142
121
  className: string;
143
122
  }
144
123
  /** Remove a CSS class from an anchor */
145
124
  export interface RemoveClassAction extends BaseAction {
146
125
  kind: 'content:removeClass';
147
- anchorId: string;
126
+ anchorId: AnchorId;
148
127
  className: string;
149
128
  }
150
129
  /** Set inline styles on an anchor */
151
130
  export interface SetStyleAction extends BaseAction {
152
131
  kind: 'content:setStyle';
153
- anchorId: string;
132
+ anchorId: AnchorId;
154
133
  styles: Record<string, string>;
155
134
  }
156
135
  /** Mount a widget to a surface slot */
@@ -162,7 +141,7 @@ export interface MountWidgetAction extends BaseAction {
162
141
  /** Scroll to an anchor element */
163
142
  export interface ScrollToAction extends BaseAction {
164
143
  kind: 'navigation:scrollTo';
165
- anchorId: string;
144
+ anchorId: AnchorId;
166
145
  behavior?: ScrollBehavior;
167
146
  block?: ScrollLogicalPosition;
168
147
  inline?: ScrollLogicalPosition;
@@ -213,7 +192,7 @@ export type ActionStep = HighlightAction | PulseAction | BadgeAction | TooltipAc
213
192
  /** Extract action kind literal types */
214
193
  export type ActionKind = ActionStep['kind'];
215
194
  /** State of an action */
216
- export type ActionState = 'pending' | 'applied' | 'reverted' | 'failed';
195
+ export type ActionState = 'pending' | 'applied' | 'reverted' | 'failed' | 'deferred';
217
196
  /** Handle returned when an action is applied */
218
197
  export interface ActionHandle {
219
198
  /** Unique ID for this action instance */
@@ -289,13 +268,18 @@ export interface ExecutorContext {
289
268
  /** Overlay root element for rendering */
290
269
  overlayRoot: HTMLElement;
291
270
  /** Resolve an anchor ID to an element */
292
- resolveAnchor: (anchorId: string) => HTMLElement | null;
271
+ resolveAnchor: (anchorId: AnchorId) => HTMLElement | null;
293
272
  /** Generate unique IDs */
294
273
  generateId: () => string;
295
274
  /** Publish events to EventBus */
296
275
  publishEvent: (name: string, props?: Record<string, unknown>) => void;
297
276
  /** Get the current adaptive ID (if any) */
298
277
  adaptiveId?: string;
278
+ /**
279
+ * Async anchor resolver — waits for a DOM element to appear.
280
+ * Returns null on timeout or route mismatch (never throws).
281
+ */
282
+ waitForAnchor?: (anchorId: AnchorId, timeoutMs?: number) => Promise<HTMLElement | null>;
299
283
  /**
300
284
  * Execute a nested action (for composite executors like tours).
301
285
  * Returns a handle that can be used to revert the action.
@@ -337,13 +321,27 @@ export interface ActionEngineOptions {
337
321
  mount: (slot: SurfaceSlot, content: RenderableContent, opts?: MountOptions) => MountHandle;
338
322
  };
339
323
  /** Function to resolve anchor IDs to elements */
340
- anchorResolver: (anchorId: string) => HTMLElement | null;
324
+ anchorResolver: (anchorId: AnchorId) => HTMLElement | null;
325
+ /** Async anchor resolver — waits for a DOM element to appear */
326
+ waitForAnchor?: (anchorId: AnchorId, timeoutMs?: number) => Promise<HTMLElement | null>;
341
327
  /** Current adaptive ID for attribution */
342
328
  adaptiveId?: string;
343
329
  /** Optional executor registry (uses default singleton if not provided) */
344
330
  executorRegistry?: ActionEngineExecutorRegistry;
345
331
  /** Subscribe to navigation changes (from NavigationMonitor) */
346
332
  subscribeNavigation?: (callback: (url: string, method: string) => void) => () => void;
333
+ /** Runtime for evaluating DecisionStrategy conditions (e.g., triggerWhen) */
334
+ runtime?: {
335
+ evaluateSync: <T>(strategy: import('../decisions/types').DecisionStrategy<T>) => {
336
+ value: T;
337
+ };
338
+ context?: {
339
+ subscribe: (cb: () => void) => () => void;
340
+ };
341
+ accumulator?: {
342
+ subscribe: (cb: () => void) => () => void;
343
+ };
344
+ };
347
345
  }
348
346
  /** The ActionEngine interface */
349
347
  export interface ActionEngine {
@@ -403,4 +401,3 @@ export interface MountHandle {
403
401
  isMounted: () => boolean;
404
402
  getContainer: () => HTMLElement | null;
405
403
  }
406
- export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * AnchorResolver — Centralized DOM observation for anchor element resolution.
3
+ *
4
+ * Provides a single MutationObserver that multiple callers share to wait for
5
+ * DOM elements to appear. Replaces scattered observation mechanisms.
6
+ */
7
+ export interface AnchorResolverOptions {
8
+ root?: HTMLElement;
9
+ defaultTimeoutMs?: number;
10
+ }
11
+ export interface AnchorResolver {
12
+ resolve(selector: string): HTMLElement | null;
13
+ waitFor(selector: string, timeoutMs?: number): Promise<HTMLElement>;
14
+ onAppear(selector: string, cb: (el: HTMLElement) => void): () => void;
15
+ pendingCount(): number;
16
+ destroy(): void;
17
+ }
18
+ export declare function createAnchorResolver(opts?: AnchorResolverOptions): AnchorResolver;
@@ -0,0 +1,2 @@
1
+ export type { AnchorResolver, AnchorResolverOptions } from './AnchorResolver';
2
+ export { createAnchorResolver } from './AnchorResolver';
package/dist/api.d.ts CHANGED
@@ -4,13 +4,13 @@
4
4
  * Entry point for the SmartCanvas SDK. Creates and manages the canvas element,
5
5
  * handles configuration, and coordinates between the ActionEngine and UI.
6
6
  */
7
- import type { CanvasTheme } from './components/ShadowCanvasOverlay';
8
7
  import type { ExperimentClient } from './experiments/types';
9
8
  import type { OverlayRecipeFetcher } from './overlays/fetcher';
10
9
  import type { ActionHandler, AppearanceConfig, RenderProps } from './render/types';
11
10
  import type { SmartCanvasRuntime } from './runtime';
12
11
  import { type SmartCanvasElement } from './SmartCanvasElement';
13
12
  import type { TelemetryClient } from './telemetry/types';
13
+ import type { CanvasThemeConfig } from './theme';
14
14
  import type { CanvasConfigFetcher, CanvasConfigResponse } from './types';
15
15
  export interface SmartCanvasIntegrations {
16
16
  experiments?: ExperimentClient;
@@ -35,16 +35,16 @@ export interface SmartCanvasConfig {
35
35
  className?: string;
36
36
  };
37
37
  editorUrl?: string;
38
- theme?: Partial<CanvasTheme>;
39
38
  /**
40
39
  * v2 Runtime instance.
41
40
  * Required for action execution. If not provided, actions will not be applied.
42
41
  */
43
42
  runtime?: SmartCanvasRuntime;
44
- autoDetectTheme?: boolean;
45
43
  appearance?: AppearanceConfig;
46
44
  renderProps?: RenderProps;
47
45
  actionHandlers?: ActionHandler;
46
+ /** Workspace-level theme for 3-layer inheritance (defaults → workspace → config) */
47
+ workspaceTheme?: CanvasThemeConfig;
48
48
  }
49
49
  /**
50
50
  * Handle for interacting with a SmartCanvas instance.
@@ -59,11 +59,6 @@ export interface SmartCanvasHandle {
59
59
  * Get the current config.
60
60
  */
61
61
  getConfig(): Promise<CanvasConfigResponse>;
62
- /**
63
- * Update the config and re-apply actions.
64
- * This is the primary way to modify what the canvas displays.
65
- */
66
- updateConfig(newConfig: CanvasConfigResponse): Promise<void>;
67
62
  /**
68
63
  * Enable or disable the canvas.
69
64
  * When disabled, all actions are reverted.
@@ -40,8 +40,8 @@ export declare const configSchema: z.ZodObject<{
40
40
  count?: number | undefined;
41
41
  };
42
42
  id: string;
43
- name: string;
44
43
  icon: string;
44
+ name: string;
45
45
  description?: string | undefined;
46
46
  }, {
47
47
  trigger: {
@@ -49,8 +49,8 @@ export declare const configSchema: z.ZodObject<{
49
49
  count?: number | undefined;
50
50
  };
51
51
  id: string;
52
- name: string;
53
52
  icon: string;
53
+ name: string;
54
54
  description?: string | undefined;
55
55
  }>, "many">>;
56
56
  showProgress: z.ZodDefault<z.ZodBoolean>;
@@ -62,8 +62,8 @@ export declare const configSchema: z.ZodObject<{
62
62
  count?: number | undefined;
63
63
  };
64
64
  id: string;
65
- name: string;
66
65
  icon: string;
66
+ name: string;
67
67
  description?: string | undefined;
68
68
  }[];
69
69
  showProgress: boolean;
@@ -75,8 +75,8 @@ export declare const configSchema: z.ZodObject<{
75
75
  count?: number | undefined;
76
76
  };
77
77
  id: string;
78
- name: string;
79
78
  icon: string;
79
+ name: string;
80
80
  description?: string | undefined;
81
81
  }[] | undefined;
82
82
  showProgress?: boolean | undefined;
@@ -247,8 +247,8 @@ export declare const manifest: {
247
247
  count?: number | undefined;
248
248
  };
249
249
  id: string;
250
- name: string;
251
250
  icon: string;
251
+ name: string;
252
252
  description?: string | undefined;
253
253
  }, {
254
254
  trigger: {
@@ -256,8 +256,8 @@ export declare const manifest: {
256
256
  count?: number | undefined;
257
257
  };
258
258
  id: string;
259
- name: string;
260
259
  icon: string;
260
+ name: string;
261
261
  description?: string | undefined;
262
262
  }>, "many">>;
263
263
  showProgress: z.ZodDefault<z.ZodBoolean>;
@@ -269,8 +269,8 @@ export declare const manifest: {
269
269
  count?: number | undefined;
270
270
  };
271
271
  id: string;
272
- name: string;
273
272
  icon: string;
273
+ name: string;
274
274
  description?: string | undefined;
275
275
  }[];
276
276
  showProgress: boolean;
@@ -282,8 +282,8 @@ export declare const manifest: {
282
282
  count?: number | undefined;
283
283
  };
284
284
  id: string;
285
- name: string;
286
285
  icon: string;
286
+ name: string;
287
287
  description?: string | undefined;
288
288
  }[] | undefined;
289
289
  showProgress?: boolean | undefined;
@@ -0,0 +1,126 @@
1
+ import {
2
+ ActivationConfigZ
3
+ } from "./chunk-P5G4KT2U.js";
4
+
5
+ // src/config/schema.ts
6
+ import { z } from "zod";
7
+ var NotificationDeepLinkZ = z.object({
8
+ tileId: z.string(),
9
+ itemId: z.string().optional()
10
+ }).strict();
11
+ var TileNotificationRuleZ = z.object({
12
+ on: z.string(),
13
+ title: z.string(),
14
+ body: z.string().optional(),
15
+ icon: z.string().optional(),
16
+ ttl: z.number().optional(),
17
+ cooldown: z.number().optional(),
18
+ deepLink: NotificationDeepLinkZ.optional()
19
+ }).strict();
20
+ var TileZ = z.object({
21
+ id: z.string(),
22
+ title: z.string().optional(),
23
+ priority: z.number().optional(),
24
+ widget: z.string(),
25
+ props: z.record(z.unknown()).optional(),
26
+ activation: ActivationConfigZ.optional(),
27
+ notifications: z.array(TileNotificationRuleZ).optional()
28
+ }).strict();
29
+ var CanvasElementConfigZ = z.object({
30
+ position: z.enum(["left", "right"]).optional(),
31
+ background: z.string().optional(),
32
+ blur: z.string().optional(),
33
+ border: z.string().optional(),
34
+ width: z.string().optional()
35
+ });
36
+ var LauncherElementConfigZ = z.object({
37
+ background: z.string().optional(),
38
+ backgroundHover: z.string().optional(),
39
+ color: z.string().optional(),
40
+ size: z.string().optional(),
41
+ shadow: z.string().optional()
42
+ });
43
+ var TileElementConfigZ = z.object({
44
+ background: z.string().optional(),
45
+ backgroundHover: z.string().optional(),
46
+ border: z.string().optional(),
47
+ borderRadius: z.string().optional(),
48
+ shadow: z.string().optional(),
49
+ titleColor: z.string().optional(),
50
+ textColor: z.string().optional(),
51
+ iconBackground: z.string().optional(),
52
+ iconShadow: z.string().optional()
53
+ });
54
+ var OverlayElementConfigZ = z.object({
55
+ background: z.string().optional(),
56
+ textColor: z.string().optional(),
57
+ border: z.string().optional(),
58
+ borderRadius: z.string().optional(),
59
+ scrimOpacity: z.string().optional(),
60
+ highlightRing: z.string().optional()
61
+ });
62
+ var NotificationElementConfigZ = z.object({
63
+ background: z.string().optional(),
64
+ textColor: z.string().optional(),
65
+ textSecondaryColor: z.string().optional(),
66
+ border: z.string().optional(),
67
+ borderRadius: z.string().optional(),
68
+ successColor: z.string().optional(),
69
+ warningColor: z.string().optional(),
70
+ errorColor: z.string().optional(),
71
+ iconBackground: z.string().optional(),
72
+ progressGradient: z.string().optional()
73
+ });
74
+ var CanvasThemeConfigZ = z.object({
75
+ mode: z.enum(["dark", "light"]).optional(),
76
+ fontFamily: z.string().optional(),
77
+ colorPrimary: z.string().optional(),
78
+ colorPrimaryHover: z.string().optional(),
79
+ borderRadius: z.string().optional(),
80
+ canvas: CanvasElementConfigZ.optional(),
81
+ launcher: LauncherElementConfigZ.optional(),
82
+ tile: TileElementConfigZ.optional(),
83
+ overlay: OverlayElementConfigZ.optional(),
84
+ notification: NotificationElementConfigZ.optional()
85
+ }).strict();
86
+ var LauncherConfigZ = z.object({
87
+ enabled: z.boolean().optional(),
88
+ label: z.string().optional(),
89
+ position: z.string().optional(),
90
+ animate: z.boolean().optional(),
91
+ animationStyle: z.enum(["pulse", "bounce", "glow"]).optional(),
92
+ notificationCount: z.number().optional()
93
+ }).strict();
94
+ var CanvasConfigResponseZ = z.object({
95
+ schemaVersion: z.string().optional(),
96
+ fetchedAt: z.string().datetime(),
97
+ configVersion: z.string().optional(),
98
+ canvasTitle: z.string().optional(),
99
+ tiles: z.array(TileZ),
100
+ actions: z.array(z.any()),
101
+ theme: CanvasThemeConfigZ.optional(),
102
+ launcher: LauncherConfigZ.optional(),
103
+ verificationSteps: z.array(z.string()).optional()
104
+ }).strict();
105
+ var configSchemas = [
106
+ { defName: "tile", schema: TileZ },
107
+ { defName: "themeConfig", schema: CanvasThemeConfigZ },
108
+ { defName: "launcherConfig", schema: LauncherConfigZ },
109
+ { defName: "canvasConfigResponse", schema: CanvasConfigResponseZ }
110
+ ];
111
+
112
+ export {
113
+ NotificationDeepLinkZ,
114
+ TileNotificationRuleZ,
115
+ TileZ,
116
+ CanvasElementConfigZ,
117
+ LauncherElementConfigZ,
118
+ TileElementConfigZ,
119
+ OverlayElementConfigZ,
120
+ NotificationElementConfigZ,
121
+ CanvasThemeConfigZ,
122
+ LauncherConfigZ,
123
+ CanvasConfigResponseZ,
124
+ configSchemas
125
+ };
126
+ //# sourceMappingURL=chunk-2UYZ5DWI.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/config/schema.ts"],
4
+ "sourcesContent": ["/**\n * Zod schemas for canvas configuration types.\n *\n * Single source of truth for tile, theme, launcher, and top-level\n * CanvasConfigResponse shapes. These schemas are converted to JSON Schema\n * during build and merged into the unified canvas-config.schema.json.\n *\n * Design decisions:\n * - `.strict()` on top-level objects \u2192 `additionalProperties: false` in JSON Schema\n * - Element sub-schemas (canvas, tile, etc.) are NOT strict to allow future expansion\n */\n\nimport { z } from 'zod';\nimport { ActivationConfigZ } from '../decisions/schema';\n\n// ============================================================================\n// Tile Notification Sub-Types\n// ============================================================================\n\nconst NotificationDeepLinkZ = z\n .object({\n tileId: z.string(),\n itemId: z.string().optional(),\n })\n .strict();\n\nconst TileNotificationRuleZ = z\n .object({\n on: z.string(),\n title: z.string(),\n body: z.string().optional(),\n icon: z.string().optional(),\n ttl: z.number().optional(),\n cooldown: z.number().optional(),\n deepLink: NotificationDeepLinkZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Tile\n// ============================================================================\n\nexport const TileZ = z\n .object({\n id: z.string(),\n title: z.string().optional(),\n priority: z.number().optional(),\n widget: z.string(),\n props: z.record(z.unknown()).optional(),\n activation: ActivationConfigZ.optional(),\n notifications: z.array(TileNotificationRuleZ).optional(),\n })\n .strict();\n\n// ============================================================================\n// Theme Config \u2014 Element Sub-Schemas\n// ============================================================================\n\nexport const CanvasElementConfigZ = z.object({\n position: z.enum(['left', 'right']).optional(),\n background: z.string().optional(),\n blur: z.string().optional(),\n border: z.string().optional(),\n width: z.string().optional(),\n});\n\nexport const LauncherElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n color: z.string().optional(),\n size: z.string().optional(),\n shadow: z.string().optional(),\n});\n\nexport const TileElementConfigZ = z.object({\n background: z.string().optional(),\n backgroundHover: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n shadow: z.string().optional(),\n titleColor: z.string().optional(),\n textColor: z.string().optional(),\n iconBackground: z.string().optional(),\n iconShadow: z.string().optional(),\n});\n\nexport const OverlayElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n scrimOpacity: z.string().optional(),\n highlightRing: z.string().optional(),\n});\n\nexport const NotificationElementConfigZ = z.object({\n background: z.string().optional(),\n textColor: z.string().optional(),\n textSecondaryColor: z.string().optional(),\n border: z.string().optional(),\n borderRadius: z.string().optional(),\n successColor: z.string().optional(),\n warningColor: z.string().optional(),\n errorColor: z.string().optional(),\n iconBackground: z.string().optional(),\n progressGradient: z.string().optional(),\n});\n\n// ============================================================================\n// Theme Config \u2014 Top-Level\n// ============================================================================\n\nexport const CanvasThemeConfigZ = z\n .object({\n mode: z.enum(['dark', 'light']).optional(),\n fontFamily: z.string().optional(),\n colorPrimary: z.string().optional(),\n colorPrimaryHover: z.string().optional(),\n borderRadius: z.string().optional(),\n canvas: CanvasElementConfigZ.optional(),\n launcher: LauncherElementConfigZ.optional(),\n tile: TileElementConfigZ.optional(),\n overlay: OverlayElementConfigZ.optional(),\n notification: NotificationElementConfigZ.optional(),\n })\n .strict();\n\n// ============================================================================\n// Launcher Config\n// ============================================================================\n\nexport const LauncherConfigZ = z\n .object({\n enabled: z.boolean().optional(),\n label: z.string().optional(),\n position: z.string().optional(),\n animate: z.boolean().optional(),\n animationStyle: z.enum(['pulse', 'bounce', 'glow']).optional(),\n notificationCount: z.number().optional(),\n })\n .strict();\n\n// ============================================================================\n// Canvas Config Response (top-level)\n// ============================================================================\n\nexport const CanvasConfigResponseZ = z\n .object({\n schemaVersion: z.string().optional(),\n fetchedAt: z.string().datetime(),\n configVersion: z.string().optional(),\n canvasTitle: z.string().optional(),\n tiles: z.array(TileZ),\n actions: z.array(z.any()),\n theme: CanvasThemeConfigZ.optional(),\n launcher: LauncherConfigZ.optional(),\n verificationSteps: z.array(z.string()).optional(),\n })\n .strict();\n\n// ============================================================================\n// Export: Array for unified schema generation\n// ============================================================================\n\n/**\n * Config schemas for unified JSON Schema generation.\n * The generator imports this array and converts each to a JSON Schema $def.\n */\nexport const configSchemas = [\n { defName: 'tile', schema: TileZ },\n { defName: 'themeConfig', schema: CanvasThemeConfigZ },\n { defName: 'launcherConfig', schema: LauncherConfigZ },\n { defName: 'canvasConfigResponse', schema: CanvasConfigResponseZ },\n];\n\n// ============================================================================\n// Named Exports\n// ============================================================================\n\nexport { NotificationDeepLinkZ, TileNotificationRuleZ };\n"],
5
+ "mappings": ";;;;;AAYA,SAAS,SAAS;AAOlB,IAAM,wBAAwB,EAC3B,OAAO;AAAA,EACN,QAAQ,EAAE,OAAO;AAAA,EACjB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC,EACA,OAAO;AAEV,IAAM,wBAAwB,EAC3B,OAAO;AAAA,EACN,IAAI,EAAE,OAAO;AAAA,EACb,OAAO,EAAE,OAAO;AAAA,EAChB,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EACzB,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,UAAU,sBAAsB,SAAS;AAC3C,CAAC,EACA,OAAO;AAMH,IAAM,QAAQ,EAClB,OAAO;AAAA,EACN,IAAI,EAAE,OAAO;AAAA,EACb,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,UAAU,EAAE,OAAO,EAAE,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