@syntrologie/runtime-sdk 2.14.0 → 2.16.0

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 (74) hide show
  1. package/README.md +1 -0
  2. package/dist/SmartCanvasApp.d.ts +4 -1
  3. package/dist/SmartCanvasElementLit.d.ts +166 -0
  4. package/dist/actions/schema.js +4 -3
  5. package/dist/actions/types.d.ts +8 -2
  6. package/dist/anchor/AnchorResolver.d.ts +1 -0
  7. package/dist/api-lit.d.ts +84 -0
  8. package/dist/api.d.ts +3 -0
  9. package/dist/apps/builtinRuntimeModules-lit.d.ts +20 -0
  10. package/dist/bootstrap-init.d.ts +2 -0
  11. package/dist/bootstrap-types.d.ts +10 -0
  12. package/dist/chunk-2IQ2PTLJ.js +871 -0
  13. package/dist/chunk-2IQ2PTLJ.js.map +7 -0
  14. package/dist/{chunk-YLLWLUQX.js → chunk-4HXPGXUC.js} +1 -16
  15. package/dist/{chunk-YLLWLUQX.js.map → chunk-4HXPGXUC.js.map} +1 -1
  16. package/dist/{chunk-IR6UOR63.js → chunk-GX7BBYX6.js} +2 -2
  17. package/dist/chunk-JMHRHAEL.js +18 -0
  18. package/dist/chunk-JMHRHAEL.js.map +7 -0
  19. package/dist/{chunk-JCDCANR7.js → chunk-NVV7IWJC.js} +1301 -1084
  20. package/dist/chunk-NVV7IWJC.js.map +7 -0
  21. package/dist/{chunk-77TNZ66J.js → chunk-XVRDKBYF.js} +3 -3
  22. package/dist/components/SyntroCanvasOverlay.d.ts +100 -0
  23. package/dist/components/SyntroDrawer.d.ts +110 -0
  24. package/dist/components/SyntroLauncher.d.ts +105 -0
  25. package/dist/components/SyntroTileCard.d.ts +74 -0
  26. package/dist/components/SyntroTileWheel.d.ts +51 -0
  27. package/dist/config/schema.js +3 -2
  28. package/dist/controllers/DecisionController.d.ts +48 -0
  29. package/dist/controllers/NotificationsController.d.ts +59 -0
  30. package/dist/controllers/RuntimeController.d.ts +52 -0
  31. package/dist/controllers/RuntimeEventsController.d.ts +42 -0
  32. package/dist/controllers/ThemeController.d.ts +110 -0
  33. package/dist/controllers/index.d.ts +13 -0
  34. package/dist/decisions/schema.js +2 -1
  35. package/dist/decisions/types.d.ts +4 -0
  36. package/dist/editorLoader.d.ts +5 -0
  37. package/dist/index-lit.d.ts +40 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +1338 -19
  40. package/dist/index.js.map +4 -4
  41. package/dist/interop/LitInReact.d.ts +27 -0
  42. package/dist/interop/ReactInLit.d.ts +42 -0
  43. package/dist/interop/index.d.ts +7 -0
  44. package/dist/metrics/sessionMetrics.d.ts +4 -0
  45. package/dist/notifications/SyntroToastStack.d.ts +43 -0
  46. package/dist/platform/PlatformAdapter.d.ts +46 -0
  47. package/dist/platform/ShopifyAdapter.d.ts +36 -0
  48. package/dist/platform/ShopifyAnchorResolver.d.ts +31 -0
  49. package/dist/platform/ShopifyAntiFlicker.d.ts +21 -0
  50. package/dist/platform/ShopifyPixelBridge.d.ts +37 -0
  51. package/dist/platform/detect.d.ts +9 -0
  52. package/dist/platform/index.d.ts +10 -0
  53. package/dist/platform/shopify-cookie-contract.d.ts +39 -0
  54. package/dist/react-compat.d.ts +114 -0
  55. package/dist/react.js +6 -4
  56. package/dist/react.js.map +1 -1
  57. package/dist/shopify-pixel-entry.d.ts +68 -0
  58. package/dist/shopify-pixel.js +77 -0
  59. package/dist/shopify-pixel.js.map +7 -0
  60. package/dist/shopify-pixel.min.js +2 -0
  61. package/dist/shopify-pixel.min.js.map +7 -0
  62. package/dist/smart-canvas.esm.js +856 -240
  63. package/dist/smart-canvas.esm.js.map +4 -4
  64. package/dist/smart-canvas.js +28769 -37080
  65. package/dist/smart-canvas.js.map +4 -4
  66. package/dist/smart-canvas.min.js +855 -240
  67. package/dist/smart-canvas.min.js.map +4 -4
  68. package/dist/theme/index.js +30 -0
  69. package/dist/theme/index.js.map +7 -0
  70. package/dist/version.d.ts +1 -1
  71. package/package.json +10 -1
  72. package/dist/chunk-JCDCANR7.js.map +0 -7
  73. /package/dist/{chunk-IR6UOR63.js.map → chunk-GX7BBYX6.js.map} +0 -0
  74. /package/dist/{chunk-77TNZ66J.js.map → chunk-XVRDKBYF.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  NotificationDeepLinkZ
3
- } from "./chunk-IR6UOR63.js";
3
+ } from "./chunk-GX7BBYX6.js";
4
4
  import {
5
5
  TriggerWhenZ
6
- } from "./chunk-YLLWLUQX.js";
6
+ } from "./chunk-4HXPGXUC.js";
7
7
 
8
8
  // src/actions/schema.ts
9
9
  import { z } from "zod";
@@ -249,4 +249,4 @@ export {
249
249
  TourZ,
250
250
  coreActionStepSchemas
251
251
  };
252
- //# sourceMappingURL=chunk-77TNZ66J.js.map
252
+ //# sourceMappingURL=chunk-XVRDKBYF.js.map
@@ -0,0 +1,100 @@
1
+ /**
2
+ * SyntroCanvasOverlay — Lit web component equivalent of ShadowCanvasOverlay.tsx.
3
+ *
4
+ * Composes three child custom elements:
5
+ * - <syntro-launcher> FAB button
6
+ * - <syntro-drawer> Side panel
7
+ * - <syntro-toast-stack> Notification toasts
8
+ *
9
+ * Wiring responsibilities:
10
+ * - Manages open/closed state via isOpen property
11
+ * - Runs NotifyWatcher loop (equivalent of useNotifyWatcher) to fire
12
+ * notification events even when the drawer is closed
13
+ * - Handles notification clicks: publish telemetry events, open canvas,
14
+ * deep-link, dismiss toast
15
+ * - Tracks tile viewed telemetry when canvas opens
16
+ * - Publishes canvas.opened / canvas.closed on each toggle
17
+ * - Forwards all properties to child elements via Lit bindings
18
+ *
19
+ * Uses light DOM (createRenderRoot returns this) so that host-page CSS
20
+ * variables reach the child elements without piercing shadow boundaries.
21
+ *
22
+ * Decorator-free: uses `static override properties` (tsconfig has no
23
+ * experimentalDecorators).
24
+ */
25
+ import { LitElement } from 'lit';
26
+ import type { SmartCanvasRuntime } from '../runtime.js';
27
+ import type { TelemetryClient } from '../telemetry/types.js';
28
+ import type { TileConfig } from '../types.js';
29
+ export declare class SyntroCanvasOverlay extends LitElement {
30
+ static properties: {
31
+ isOpen: {
32
+ type: BooleanConstructor;
33
+ };
34
+ tiles: {
35
+ attribute: boolean;
36
+ };
37
+ isLoading: {
38
+ type: BooleanConstructor;
39
+ };
40
+ error: {
41
+ type: StringConstructor;
42
+ };
43
+ canvasTitle: {
44
+ type: StringConstructor;
45
+ };
46
+ displayMode: {
47
+ type: StringConstructor;
48
+ };
49
+ runtimeRef: {
50
+ attribute: boolean;
51
+ };
52
+ telemetry: {
53
+ attribute: boolean;
54
+ };
55
+ themeConfig: {
56
+ attribute: boolean;
57
+ };
58
+ launcherAnimate: {
59
+ type: BooleanConstructor;
60
+ };
61
+ };
62
+ isOpen: boolean;
63
+ tiles: TileConfig[];
64
+ isLoading: boolean;
65
+ error: string | undefined;
66
+ canvasTitle: string | undefined;
67
+ displayMode: 'standard' | 'focused';
68
+ runtimeRef: SmartCanvasRuntime | null;
69
+ telemetry: TelemetryClient | null;
70
+ themeConfig: Record<string, any>;
71
+ launcherAnimate: boolean;
72
+ private _notifications;
73
+ /** Prev-state map: entry.id → last evaluated boolean */
74
+ private _notifyPrevState;
75
+ /** Unsubscribe for the EventBus notify-watcher subscription */
76
+ private _notifyUnsub;
77
+ /** Unsubscribe for the sessionMetrics notify-watcher subscription */
78
+ private _notifyUnsubMetrics;
79
+ constructor();
80
+ createRenderRoot(): this;
81
+ connectedCallback(): void;
82
+ disconnectedCallback(): void;
83
+ updated(changed: Map<string, unknown>): void;
84
+ private _syncNotificationsController;
85
+ private _startNotifyWatcher;
86
+ private _stopNotifyWatcher;
87
+ private _restartNotifyWatcher;
88
+ private _trackTilesViewed;
89
+ private _toggle;
90
+ private _handleNotificationClick;
91
+ private _handleNotificationDismiss;
92
+ private _onLauncherToggle;
93
+ private _onDrawerClose;
94
+ render(): import("lit-html").TemplateResult<1>;
95
+ }
96
+ declare global {
97
+ interface HTMLElementTagNameMap {
98
+ 'syntro-canvas-overlay': SyntroCanvasOverlay;
99
+ }
100
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * SyntroDrawer — Lit web component equivalent of the drawer panel from
3
+ * ShadowCanvasOverlay.tsx.
4
+ *
5
+ * Renders the slide-in/out side panel with:
6
+ * - CSS transform (translateX) + opacity transition
7
+ * - Configurable position (left/right), width, blur, border, border-radius
8
+ * - Tile cards (standard: stacked, focused: single full-width)
9
+ * - Loading and error states
10
+ * - Optional canvas title header (focused mode)
11
+ * - Push-mode margin on document.documentElement
12
+ * - ResizeObserver to keep push margin in sync
13
+ * - Outside-click-to-close via document mousedown + composedPath()
14
+ * - Configurable transition duration / easing from theme config
15
+ * - Mask-image fade at leading edge (disabled when border is visible)
16
+ *
17
+ * Decorator-free: uses static `properties` (tsconfig has no experimentalDecorators).
18
+ *
19
+ * Usage:
20
+ * <syntro-drawer
21
+ * .isOpen=${true}
22
+ * .tiles=${tiles}
23
+ * .isLoading=${false}
24
+ * .error=${undefined}
25
+ * .canvasTitle=${'My Canvas'}
26
+ * .displayMode=${'standard'}
27
+ * .runtimeRef=${runtime}
28
+ * .telemetry=${telemetry}
29
+ * .themeConfig=${themeConfig}
30
+ * @drawer-close=${handleClose}
31
+ * ></syntro-drawer>
32
+ */
33
+ import { LitElement } from 'lit';
34
+ import type { SmartCanvasRuntime } from '../runtime.js';
35
+ import type { TelemetryClient } from '../telemetry/types.js';
36
+ import type { TileConfig } from '../types.js';
37
+ export interface DrawerThemeConfig {
38
+ canvas: {
39
+ position?: string;
40
+ width?: string;
41
+ layout?: string;
42
+ blur?: string;
43
+ border?: string;
44
+ transitionDuration?: string;
45
+ transitionEasing?: string;
46
+ transitionFade?: string;
47
+ };
48
+ }
49
+ export declare class SyntroDrawer extends LitElement {
50
+ static properties: {
51
+ isOpen: {
52
+ type: BooleanConstructor;
53
+ };
54
+ tiles: {
55
+ attribute: boolean;
56
+ };
57
+ isLoading: {
58
+ type: BooleanConstructor;
59
+ };
60
+ error: {
61
+ type: StringConstructor;
62
+ };
63
+ canvasTitle: {
64
+ type: StringConstructor;
65
+ };
66
+ displayMode: {
67
+ type: StringConstructor;
68
+ };
69
+ runtimeRef: {
70
+ attribute: boolean;
71
+ };
72
+ telemetry: {
73
+ attribute: boolean;
74
+ };
75
+ themeConfig: {
76
+ attribute: boolean;
77
+ };
78
+ };
79
+ isOpen: boolean;
80
+ tiles: TileConfig[];
81
+ isLoading: boolean;
82
+ error: string | undefined;
83
+ canvasTitle: string | undefined;
84
+ displayMode: 'standard' | 'focused';
85
+ runtimeRef: SmartCanvasRuntime | null;
86
+ telemetry: TelemetryClient | null;
87
+ themeConfig: DrawerThemeConfig;
88
+ private _containerEl;
89
+ private _resizeObserver;
90
+ private _onDocumentMousedown;
91
+ createRenderRoot(): this;
92
+ private get _canvas();
93
+ private get _isRight();
94
+ private get _isPush();
95
+ private get _isFocused();
96
+ private get _canvasBorder();
97
+ private get _duration();
98
+ private get _easing();
99
+ connectedCallback(): void;
100
+ updated(changed: Map<string, unknown>): void;
101
+ disconnectedCallback(): void;
102
+ private _teardownResizeObserver;
103
+ private _cleanupPushMargin;
104
+ render(): import("lit-html").TemplateResult<1>;
105
+ }
106
+ declare global {
107
+ interface HTMLElementTagNameMap {
108
+ 'syntro-drawer': SyntroDrawer;
109
+ }
110
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * SyntroLauncher — Lit web component equivalent of the launcher FAB
3
+ * from ShadowCanvasOverlay.tsx.
4
+ *
5
+ * Renders a floating action button that:
6
+ * - Toggles the canvas open/closed (fires `launcher-toggle`)
7
+ * - Supports drag-to-reposition (pointerdown/move/up with 5px threshold)
8
+ * - Shows different icons: X when open, custom image if configured, sparkles default
9
+ * - Pulse/glow animation when `launcherAnimate` is true and canvas is closed
10
+ * - Notification badge with count, ping ring, glow pulse, and bounce animation
11
+ * - Hover changes background color using theme config values
12
+ * - CSS keyframe animations built dynamically using theme colors
13
+ *
14
+ * Usage:
15
+ * <syntro-launcher
16
+ * .isOpen=${false}
17
+ * .launcherAnimate=${true}
18
+ * .notificationCount=${3}
19
+ * .position=${'right'}
20
+ * .launcherIcon=${null}
21
+ * .colorPrimary=${primaryHex}
22
+ * .colorPrimaryHover=${primaryHoverHex}
23
+ * .launcherConfig=${{ background: bgHex, backgroundHover: hoverHex }}
24
+ * ></syntro-launcher>
25
+ *
26
+ * element.addEventListener('launcher-toggle', () => { ... });
27
+ *
28
+ * Decorator-free: uses `static override properties` (tsconfig has no experimentalDecorators).
29
+ * Light DOM: uses `createRenderRoot() { return this; }` to inherit parent shadow CSS vars.
30
+ */
31
+ import { LitElement } from 'lit';
32
+ import type { LauncherElementConfig } from '../theme/types.js';
33
+ export declare class SyntroLauncher extends LitElement {
34
+ static properties: {
35
+ isOpen: {
36
+ type: BooleanConstructor;
37
+ };
38
+ launcherAnimate: {
39
+ type: BooleanConstructor;
40
+ };
41
+ notificationCount: {
42
+ type: NumberConstructor;
43
+ };
44
+ position: {
45
+ type: StringConstructor;
46
+ };
47
+ launcherIcon: {
48
+ attribute: boolean;
49
+ };
50
+ colorPrimary: {
51
+ type: StringConstructor;
52
+ };
53
+ colorPrimaryHover: {
54
+ type: StringConstructor;
55
+ };
56
+ launcherConfig: {
57
+ attribute: boolean;
58
+ };
59
+ _launcherPos: {
60
+ state: boolean;
61
+ };
62
+ _hovered: {
63
+ state: boolean;
64
+ };
65
+ };
66
+ isOpen: boolean;
67
+ launcherAnimate: boolean;
68
+ notificationCount: number;
69
+ position: 'left' | 'right';
70
+ launcherIcon: string | null;
71
+ colorPrimary: string;
72
+ colorPrimaryHover: string;
73
+ launcherConfig: LauncherElementConfig;
74
+ _launcherPos: {
75
+ x: number;
76
+ y: number;
77
+ } | null;
78
+ _hovered: boolean;
79
+ private _drag;
80
+ private _styleEl;
81
+ createRenderRoot(): this;
82
+ connectedCallback(): void;
83
+ updated(changed: Map<string, unknown>): void;
84
+ disconnectedCallback(): void;
85
+ /**
86
+ * Inject/update a <style> element with dynamic keyframe CSS that uses
87
+ * the current colorPrimary and colorPrimaryHover values.
88
+ * These cannot live in `static styles` because keyframe values
89
+ * need to be literal colors (var() is unreliable in keyframes).
90
+ */
91
+ private _ensureDynamicStyles;
92
+ private _onPointerDown;
93
+ private _onPointerMove;
94
+ private _onPointerUp;
95
+ private _onMouseEnter;
96
+ private _onMouseLeave;
97
+ render(): import("lit-html").TemplateResult<1>;
98
+ private _renderIcon;
99
+ private _renderBadge;
100
+ }
101
+ declare global {
102
+ interface HTMLElementTagNameMap {
103
+ 'syntro-launcher': SyntroLauncher;
104
+ }
105
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * SyntroTileCard — Lit web component equivalent of TileCard.tsx.
3
+ *
4
+ * Renders a tile card with header (icon + title + subtitle) and body
5
+ * (imperatively mounted widget). Preserves:
6
+ * - IntersectionObserver tracking for `syntro_intervention_seen`
7
+ * - EventBus subscription for `syntro_intervention_interacted`
8
+ * - Hover effects (scale + background change)
9
+ * - CSS variable theming (var(--sc-tile-*))
10
+ * - Imperative widget mounting via WidgetRegistry
11
+ * - Late widget registration (subscribes to registry for re-render)
12
+ * - Prop forwarding without remounting
13
+ *
14
+ * Usage:
15
+ * <syntro-tile-card
16
+ * .config=${tileConfig}
17
+ * .surface=${'overlay'}
18
+ * .runtimeRef=${runtime}
19
+ * ></syntro-tile-card>
20
+ *
21
+ * Decorator-free: uses static `properties` (tsconfig has no experimentalDecorators).
22
+ */
23
+ import { LitElement, nothing } from 'lit';
24
+ import type { SmartCanvasRuntime } from '../runtime.js';
25
+ import type { TileConfig } from '../types.js';
26
+ export declare class SyntroTileCard extends LitElement {
27
+ static properties: {
28
+ config: {
29
+ attribute: boolean;
30
+ };
31
+ surface: {
32
+ type: StringConstructor;
33
+ };
34
+ runtimeRef: {
35
+ attribute: boolean;
36
+ };
37
+ _hovered: {
38
+ state: boolean;
39
+ };
40
+ };
41
+ config: TileConfig | null;
42
+ surface: 'overlay' | 'wheel';
43
+ runtimeRef: SmartCanvasRuntime | null;
44
+ _hovered: boolean;
45
+ private _widgetHandle;
46
+ private _widgetContainer;
47
+ private _mountedWidgetId;
48
+ private _registryUnsub;
49
+ private _eventBusUnsub;
50
+ private _intersectionObserver;
51
+ private _prevPropsJson;
52
+ createRenderRoot(): this;
53
+ connectedCallback(): void;
54
+ updated(changed: Map<string, unknown>): void;
55
+ disconnectedCallback(): void;
56
+ private _mountWidgetIfReady;
57
+ private _unmountWidget;
58
+ private _forwardPropUpdates;
59
+ private _setupRegistrySubscription;
60
+ private _setupIntersectionObserver;
61
+ private _setupEventBusSubscription;
62
+ private _teardownSubscriptions;
63
+ private get _registration();
64
+ private get _resolvedIcon();
65
+ private get _resolvedSubtitle();
66
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
67
+ private _onMouseEnter;
68
+ private _onMouseLeave;
69
+ }
70
+ declare global {
71
+ interface HTMLElementTagNameMap {
72
+ 'syntro-tile-card': SyntroTileCard;
73
+ }
74
+ }
@@ -0,0 +1,51 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ import type { SmartCanvasRuntime } from '../runtime.js';
3
+ import type { TelemetryClient } from '../telemetry/types.js';
4
+ import type { TileConfig } from '../types.js';
5
+ /**
6
+ * <syntro-tile-wheel>
7
+ *
8
+ * Lit port of TileWheel.tsx — a carousel that auto-rotates through a sorted
9
+ * list of tiles, tracks telemetry, and shows clickable dot indicators.
10
+ *
11
+ * Uses static properties (no decorators) — tsconfig has no experimentalDecorators.
12
+ */
13
+ export declare class SyntroTileWheel extends LitElement {
14
+ static styles: import("lit").CSSResult;
15
+ static properties: {
16
+ tiles: {
17
+ type: ArrayConstructor;
18
+ };
19
+ intervalMs: {
20
+ type: NumberConstructor;
21
+ };
22
+ telemetry: {
23
+ type: ObjectConstructor;
24
+ };
25
+ runtimeRef: {
26
+ type: ObjectConstructor;
27
+ };
28
+ _index: {
29
+ type: NumberConstructor;
30
+ state: boolean;
31
+ };
32
+ };
33
+ tiles: TileConfig[];
34
+ intervalMs: number;
35
+ telemetry: TelemetryClient | null;
36
+ runtimeRef: SmartCanvasRuntime | null;
37
+ private _index;
38
+ private _ordered;
39
+ private _intervalId;
40
+ private _canvasOpenedTracked;
41
+ connectedCallback(): void;
42
+ disconnectedCallback(): void;
43
+ updated(changed: Map<string, unknown>): void;
44
+ private _syncOrdered;
45
+ private _trackCanvasOpened;
46
+ private _trackRectangleViewed;
47
+ private _startInterval;
48
+ private _stopInterval;
49
+ private _goTo;
50
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
51
+ }
@@ -12,8 +12,9 @@ import {
12
12
  TileNotificationRuleZ,
13
13
  TileZ,
14
14
  configSchemas
15
- } from "../chunk-IR6UOR63.js";
16
- import "../chunk-YLLWLUQX.js";
15
+ } from "../chunk-GX7BBYX6.js";
16
+ import "../chunk-4HXPGXUC.js";
17
+ import "../chunk-JMHRHAEL.js";
17
18
  export {
18
19
  CanvasConfigResponseZ,
19
20
  CanvasElementConfigZ,
@@ -0,0 +1,48 @@
1
+ /**
2
+ * DecisionController
3
+ *
4
+ * A Lit ReactiveController that replaces the `useDecision()` React hook
5
+ * from RuntimeProvider.tsx. Evaluates a DecisionStrategy against the runtime
6
+ * when the host element connects and exposes the result as reactive properties.
7
+ *
8
+ * Usage:
9
+ * ```ts
10
+ * class MyElement extends LitElement {
11
+ * private _decision = new DecisionController(
12
+ * this,
13
+ * runtime,
14
+ * strategy,
15
+ * false // defaultValue
16
+ * );
17
+ *
18
+ * render() {
19
+ * if (this._decision.isLoading) return html`...`;
20
+ * return this._decision.value ? html`<shown-content>` : html``;
21
+ * }
22
+ * }
23
+ * ```
24
+ */
25
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
26
+ import type { DecisionStrategy } from '../decisions/types.js';
27
+ import type { SmartCanvasRuntime } from '../runtime.js';
28
+ export declare class DecisionController<T> implements ReactiveController {
29
+ private _host;
30
+ private _runtime;
31
+ private _strategy;
32
+ private _defaultValue;
33
+ private _value;
34
+ private _isFallback;
35
+ private _isLoading;
36
+ private _cancelled;
37
+ constructor(host: ReactiveControllerHost, runtime: SmartCanvasRuntime | null | undefined, strategy: DecisionStrategy<T> | null | undefined, defaultValue: T);
38
+ get value(): T;
39
+ get isFallback(): boolean;
40
+ get isLoading(): boolean;
41
+ hostConnected(): void;
42
+ hostDisconnected(): void;
43
+ /**
44
+ * Update the strategy and re-evaluate. Triggers a host update when done.
45
+ */
46
+ setStrategy(strategy: DecisionStrategy<T> | null | undefined): void;
47
+ private _evaluate;
48
+ }
@@ -0,0 +1,59 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import type { EventBus } from '../events/EventBus.js';
3
+ import type { ActiveNotification } from '../notifications/types.js';
4
+ import type { TileConfig } from '../types.js';
5
+ /**
6
+ * NotificationsController — Lit ReactiveController equivalent of useNotifications().
7
+ *
8
+ * Subscribes to the EventBus, evaluates notification rules from tile configs,
9
+ * and manages the active toast queue.
10
+ *
11
+ * Features:
12
+ * - Max 3 visible toasts (FIFO eviction when exceeded)
13
+ * - Deduplication by tileId + itemId
14
+ * - Cooldown per rule (prevents rapid re-firing)
15
+ * - Auto-dismiss after TTL
16
+ * - Publishes NOTIFICATION_SHOWN / NOTIFICATION_DISMISSED telemetry events
17
+ *
18
+ * Usage (decorator-free):
19
+ * class MyElement extends LitElement {
20
+ * private _notifications: NotificationsController;
21
+ *
22
+ * constructor() {
23
+ * super();
24
+ * this._notifications = new NotificationsController(this, eventBus, tiles);
25
+ * }
26
+ *
27
+ * render() {
28
+ * return html`${this._notifications.notifications.map(...)}`;
29
+ * }
30
+ * }
31
+ */
32
+ export declare class NotificationsController implements ReactiveController {
33
+ private host;
34
+ private eventBus;
35
+ private tiles;
36
+ private _notifications;
37
+ private _cooldownMap;
38
+ private _timerIds;
39
+ private _unsubscribe;
40
+ constructor(host: ReactiveControllerHost, eventBus: EventBus | null, tiles: TileConfig[]);
41
+ /** Returns the current list of active (visible) notifications. */
42
+ get notifications(): ActiveNotification[];
43
+ /** Update the tile configs (and thus notification rules) after construction. */
44
+ setTiles(tiles: TileConfig[]): void;
45
+ /**
46
+ * Swap the EventBus after construction (e.g. when runtimeRef changes).
47
+ * Tears down the existing subscription and re-subscribes on the new bus.
48
+ */
49
+ setEventBus(eventBus: EventBus | null): void;
50
+ hostConnected(): void;
51
+ hostDisconnected(): void;
52
+ /**
53
+ * Manually dismiss a notification by ID.
54
+ * Cancels its auto-dismiss timer and publishes NOTIFICATION_DISMISSED.
55
+ */
56
+ dismiss(id: string): void;
57
+ private _publishDismissed;
58
+ private _scheduleDismiss;
59
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * RuntimeController — Lit ReactiveController equivalent of the React runtime hooks.
3
+ *
4
+ * Replaces the following hooks from RuntimeProvider.tsx for Lit-based components:
5
+ * useRuntime() → controller.runtime
6
+ * useRuntimeContext() → controller.context
7
+ * usePageContext() → controller.page
8
+ * useSessionContext() → controller.session
9
+ * useViewportContext() → controller.viewport
10
+ *
11
+ * Usage:
12
+ * class MyElement extends LitElement {
13
+ * static override properties = { ... };
14
+ *
15
+ * #runtimeCtrl = new RuntimeController(this, myRuntime);
16
+ *
17
+ * override render() {
18
+ * const page = this.#runtimeCtrl.page;
19
+ * return html`<p>${page?.url}</p>`;
20
+ * }
21
+ * }
22
+ *
23
+ * The controller subscribes to runtime.context.subscribe() when the host connects
24
+ * to the DOM and calls host.requestUpdate() on every context change, mirroring
25
+ * the React useState/useEffect pattern in RuntimeProvider.
26
+ *
27
+ * Decorator-free: relies on static `properties` declarations on the host element
28
+ * instead of @property / @state decorators (tsconfig does not enable
29
+ * experimentalDecorators).
30
+ */
31
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
32
+ import type { PageContext, RuntimeContext, SessionContext, ViewportContext } from '../context/types.js';
33
+ import type { SmartCanvasRuntime } from '../runtime.js';
34
+ export declare class RuntimeController implements ReactiveController {
35
+ readonly host: ReactiveControllerHost;
36
+ private readonly _runtime;
37
+ private _context;
38
+ private _unsubscribe;
39
+ constructor(host: ReactiveControllerHost, runtime: SmartCanvasRuntime);
40
+ hostConnected(): void;
41
+ hostDisconnected(): void;
42
+ /** The SmartCanvasRuntime instance (equivalent to useRuntime()). */
43
+ get runtime(): SmartCanvasRuntime;
44
+ /** Current reactive RuntimeContext snapshot (equivalent to useRuntimeContext()). */
45
+ get context(): RuntimeContext | null;
46
+ /** Current page context (equivalent to usePageContext()). */
47
+ get page(): PageContext | null;
48
+ /** Current session context (equivalent to useSessionContext()). */
49
+ get session(): SessionContext | null;
50
+ /** Current viewport context (equivalent to useViewportContext()). */
51
+ get viewport(): ViewportContext | null;
52
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * RuntimeEventsController
3
+ *
4
+ * A Lit ReactiveController that replaces the `useRuntimeEvents()` React hook
5
+ * from RuntimeProvider.tsx. Subscribes to the runtime event bus when the host
6
+ * element connects to the DOM and unsubscribes when it disconnects.
7
+ *
8
+ * Usage:
9
+ * ```ts
10
+ * class MyElement extends LitElement {
11
+ * private _events = new RuntimeEventsController(
12
+ * this,
13
+ * runtime,
14
+ * { names: ['ui.click'] },
15
+ * (event) => { ... }
16
+ * );
17
+ * }
18
+ * ```
19
+ */
20
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
21
+ import type { EventFilter, NormalizedEvent } from '../events/types.js';
22
+ import type { SmartCanvasRuntime } from '../runtime.js';
23
+ export type { EventFilter };
24
+ export declare class RuntimeEventsController implements ReactiveController {
25
+ private _host;
26
+ private _runtime;
27
+ private _filter;
28
+ private _callback;
29
+ private _unsubscribe;
30
+ constructor(host: ReactiveControllerHost, runtime: SmartCanvasRuntime | null | undefined, filter: EventFilter | undefined, callback: (event: NormalizedEvent) => void);
31
+ hostConnected(): void;
32
+ hostDisconnected(): void;
33
+ /**
34
+ * Update the event filter. Resubscribes immediately if the host is connected.
35
+ */
36
+ setFilter(filter: EventFilter | undefined): void;
37
+ /**
38
+ * Update the event callback. Resubscribes immediately if the host is connected.
39
+ */
40
+ setCallback(callback: (event: NormalizedEvent) => void): void;
41
+ private _subscribe;
42
+ }