@syntrologie/runtime-sdk 2.8.0-canary.166 → 2.8.0-canary.168

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.
@@ -161,6 +161,12 @@ export declare class SmartCanvasElementLit extends LitElement {
161
161
  getOverlayContainer(): HTMLDivElement | null;
162
162
  /** Direct access to the shadow root (for style injection) */
163
163
  getShadowRoot(): ShadowRoot;
164
+ previewNotification(opts: {
165
+ title: string;
166
+ body?: string;
167
+ icon?: string;
168
+ ttl?: number;
169
+ }): void;
164
170
  /**
165
171
  * Set properties directly on the element. The Lit property change triggers
166
172
  * re-render and re-fetch without React.
package/dist/api.d.ts CHANGED
@@ -71,6 +71,13 @@ export interface SmartCanvasHandle {
71
71
  startSessionRecording(): void;
72
72
  /** Track a custom event. Returns true if telemetry is available and event was sent. */
73
73
  track(eventName: string, properties?: Record<string, unknown>): boolean;
74
+ /** Push a preview toast notification (used by theme editor to preview notification styles). */
75
+ previewNotification(opts: {
76
+ title: string;
77
+ body?: string;
78
+ icon?: string;
79
+ ttl?: number;
80
+ }): void;
74
81
  /**
75
82
  * v2 Runtime instance for context, events, state, and decisions.
76
83
  */
@@ -103,6 +103,12 @@ export declare class SyntroCanvasOverlay extends LitElement {
103
103
  private _toggle;
104
104
  private _handleNotificationClick;
105
105
  private _handleNotificationDismiss;
106
+ previewNotification(opts: {
107
+ title: string;
108
+ body?: string;
109
+ icon?: string;
110
+ ttl?: number;
111
+ }): void;
106
112
  private _onLauncherToggle;
107
113
  private _onDrawerClose;
108
114
  render(): import("lit-html").TemplateResult<1>;
@@ -49,6 +49,11 @@ export declare class NotificationsController implements ReactiveController {
49
49
  setEventBus(eventBus: EventBus | null): void;
50
50
  hostConnected(): void;
51
51
  hostDisconnected(): void;
52
+ /**
53
+ * Push a notification directly into the visible queue (bypasses EventBus matching).
54
+ * Used by the theme editor to preview toast styling.
55
+ */
56
+ push(notif: ActiveNotification): void;
52
57
  /**
53
58
  * Manually dismiss a notification by ID.
54
59
  * Cancels its auto-dismiss timer and publishes NOTIFICATION_DISMISSED.
package/dist/index.js CHANGED
@@ -8820,6 +8820,24 @@ var NotificationsController = class {
8820
8820
  // ---------------------------------------------------------------------------
8821
8821
  // Public methods
8822
8822
  // ---------------------------------------------------------------------------
8823
+ /**
8824
+ * Push a notification directly into the visible queue (bypasses EventBus matching).
8825
+ * Used by the theme editor to preview toast styling.
8826
+ */
8827
+ push(notif) {
8828
+ const next = [...this._notifications, notif];
8829
+ if (next.length > MAX_VISIBLE_TOASTS) {
8830
+ const evicted = next.shift();
8831
+ const timerId = this._timerIds.get(evicted.id);
8832
+ if (timerId) {
8833
+ clearTimeout(timerId);
8834
+ this._timerIds.delete(evicted.id);
8835
+ }
8836
+ }
8837
+ this._notifications = next;
8838
+ this.host.requestUpdate();
8839
+ this._scheduleDismiss(notif);
8840
+ }
8823
8841
  /**
8824
8842
  * Manually dismiss a notification by ID.
8825
8843
  * Cancels its auto-dismiss timer and publishes NOTIFICATION_DISMISSED.
@@ -9159,6 +9177,21 @@ var SyntroCanvasOverlay = class extends LitElement7 {
9159
9177
  this._notifications.dismiss(id);
9160
9178
  }
9161
9179
  }
9180
+ // ---- Public API ---------------------------------------------------------
9181
+ previewNotification(opts) {
9182
+ var _a3, _b;
9183
+ const ttl = (_a3 = opts.ttl) != null ? _a3 : 6e3;
9184
+ this._notifications.push({
9185
+ id: `preview-${Date.now()}`,
9186
+ title: opts.title,
9187
+ body: opts.body,
9188
+ icon: (_b = opts.icon) != null ? _b : "\u{1F514}",
9189
+ tileId: "__preview__",
9190
+ createdAt: Date.now(),
9191
+ expiresAt: Date.now() + ttl,
9192
+ ttl
9193
+ });
9194
+ }
9162
9195
  // ---- Child event handlers ----------------------------------------------
9163
9196
  _onLauncherToggle() {
9164
9197
  this._toggle();
@@ -9402,7 +9435,7 @@ function error(prefix, message, data) {
9402
9435
  }
9403
9436
 
9404
9437
  // src/version.ts
9405
- var SDK_VERSION = "2.8.0-canary.166";
9438
+ var SDK_VERSION = "2.8.0-canary.168";
9406
9439
 
9407
9440
  // src/types.ts
9408
9441
  var SDK_SCHEMA_VERSION = "2.0";
@@ -10048,6 +10081,11 @@ var SmartCanvasElementLit = class extends LitElement9 {
10048
10081
  getShadowRoot() {
10049
10082
  return this.shadowRoot;
10050
10083
  }
10084
+ previewNotification(opts) {
10085
+ var _a3, _b;
10086
+ const overlay = (_a3 = this.shadowRoot) == null ? void 0 : _a3.querySelector("syntro-canvas-overlay");
10087
+ (_b = overlay == null ? void 0 : overlay.previewNotification) == null ? void 0 : _b.call(overlay, opts);
10088
+ }
10051
10089
  // =========================================================================
10052
10090
  // mountLitApp — entry point for the SmartCanvas API
10053
10091
  // =========================================================================
@@ -10394,6 +10432,13 @@ var SyntroDrawer = class extends LitElement10 {
10394
10432
  }
10395
10433
  );
10396
10434
  if (isLauncherClick) return;
10435
+ const isEditorClick = path.some(
10436
+ (el) => {
10437
+ var _a3, _b, _c;
10438
+ return el instanceof HTMLElement && (((_a3 = el.closest) == null ? void 0 : _a3.call(el, "[data-syntro-editor-panel]")) != null || ((_b = el.closest) == null ? void 0 : _b.call(el, "[data-syntro-tool-panel]")) != null || ((_c = el.closest) == null ? void 0 : _c.call(el, "[data-syntro-fab]")) != null);
10439
+ }
10440
+ );
10441
+ if (isEditorClick) return;
10397
10442
  if (this._containerEl && !path.includes(this._containerEl)) {
10398
10443
  this.dispatchEvent(new CustomEvent("drawer-close", { bubbles: true, composed: true }));
10399
10444
  }
@@ -13495,6 +13540,7 @@ var createSmartCanvas = async (config = {}) => {
13495
13540
  telemetry.track(eventName, properties);
13496
13541
  return true;
13497
13542
  },
13543
+ previewNotification: (opts) => host.previewNotification(opts),
13498
13544
  runtime: runtime5
13499
13545
  };
13500
13546
  if (typeof window !== "undefined") {