@syntrologie/runtime-sdk 2.4.0-canary.23 → 2.4.0-canary.24

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.
@@ -3,7 +3,7 @@ import {
3
3
  __privateGet,
4
4
  __privateSet,
5
5
  __publicField
6
- } from "./chunk-P5G4KT2U.js";
6
+ } from "./chunk-BU4Z6PD7.js";
7
7
 
8
8
  // ../adaptives/adaptive-content/dist/reconciliation-guard.js
9
9
  function guardAgainstReconciliation(container, anchor, reinsertFn, opts) {
@@ -784,7 +784,7 @@ var CelebrationEngine = class {
784
784
  };
785
785
 
786
786
  // ../adaptives/adaptive-overlays/dist/celebrations/index.js
787
- var DEFAULT_COLORS2 = [
787
+ var FALLBACK_COLORS = [
788
788
  "#ff0000",
789
789
  "#00ff00",
790
790
  "#0000ff",
@@ -794,6 +794,22 @@ var DEFAULT_COLORS2 = [
794
794
  "#ff8800",
795
795
  "#8800ff"
796
796
  ];
797
+ function buildThemePalette(primary, hover) {
798
+ return [primary, hover, `${primary}cc`, `${hover}cc`, "#ffffff", `${primary}80`];
799
+ }
800
+ function readThemeColors(overlayRoot) {
801
+ var _a2, _b;
802
+ try {
803
+ const styles = getComputedStyle(overlayRoot);
804
+ const primary = (_a2 = styles.getPropertyValue("--sc-color-primary")) == null ? void 0 : _a2.trim();
805
+ const hover = (_b = styles.getPropertyValue("--sc-color-primary-hover")) == null ? void 0 : _b.trim();
806
+ if ((primary == null ? void 0 : primary.startsWith("#")) && primary.length >= 7) {
807
+ return buildThemePalette(primary, hover || primary);
808
+ }
809
+ } catch {
810
+ }
811
+ return null;
812
+ }
797
813
  var effectRegistry = /* @__PURE__ */ new Map([
798
814
  ["confetti", confettiEffect],
799
815
  ["fireworks", fireworksEffect],
@@ -801,17 +817,18 @@ var effectRegistry = /* @__PURE__ */ new Map([
801
817
  ["emoji-rain", emojiRainEffect]
802
818
  ]);
803
819
  var executeCelebrate = async (action, context) => {
804
- var _a2, _b, _c;
820
+ var _a2, _b, _c, _d;
805
821
  const effect = effectRegistry.get(action.effect);
806
822
  if (!effect) {
807
823
  console.warn(`[adaptive-overlays] Unknown celebration effect: "${action.effect}". Available: ${[...effectRegistry.keys()].join(", ")}`);
808
824
  return { cleanup: () => {
809
825
  } };
810
826
  }
827
+ const colors = (_b = (_a2 = action.colors) != null ? _a2 : readThemeColors(context.overlayRoot)) != null ? _b : FALLBACK_COLORS;
811
828
  const config = {
812
- duration: (_a2 = action.duration) != null ? _a2 : 3e3,
813
- intensity: (_b = action.intensity) != null ? _b : "medium",
814
- colors: (_c = action.colors) != null ? _c : DEFAULT_COLORS2,
829
+ duration: (_c = action.duration) != null ? _c : 3e3,
830
+ intensity: (_d = action.intensity) != null ? _d : "medium",
831
+ colors,
815
832
  props: action.props
816
833
  };
817
834
  const engine = new CelebrationEngine();
@@ -1684,6 +1701,13 @@ function sanitizeHtml2(html) {
1684
1701
  }
1685
1702
 
1686
1703
  // ../adaptives/adaptive-overlays/dist/modal.js
1704
+ var V = {
1705
+ bg: "var(--sc-overlay-background, #ffffff)",
1706
+ title: "var(--sc-overlay-title-color, var(--sc-overlay-text-color, #111827))",
1707
+ text: "var(--sc-overlay-text-color, #4b5563)",
1708
+ accent: "var(--sc-color-primary, #4f46e5)",
1709
+ radius: "var(--sc-border-radius, 12px)"
1710
+ };
1687
1711
  var executeModal = async (action, context) => {
1688
1712
  var _a2, _b;
1689
1713
  const { content, size = "md", blocking = false, scrim, dismiss, ctaButtons } = action;
@@ -1710,8 +1734,8 @@ var executeModal = async (action, context) => {
1710
1734
  transform: translate(-50%, -50%) scale(0.95);
1711
1735
  max-width: ${sizeMap[size]};
1712
1736
  width: 90%;
1713
- background: ${base.white};
1714
- border-radius: 12px;
1737
+ background: ${V.bg};
1738
+ border-radius: ${V.radius};
1715
1739
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
1716
1740
  z-index: 2147483646;
1717
1741
  opacity: 0;
@@ -1720,9 +1744,9 @@ var executeModal = async (action, context) => {
1720
1744
  `;
1721
1745
  let html = "";
1722
1746
  if (content.title) {
1723
- html += `<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: #111827;">${sanitizeHtml2(content.title)}</h2>`;
1747
+ html += `<h2 class="syntro-modal-title" style="margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: ${V.title};">${sanitizeHtml2(content.title)}</h2>`;
1724
1748
  }
1725
- html += `<div class="syntro-modal-body" style="color: #4b5563; line-height: 1.5;">${sanitizeHtml2(content.body)}</div>`;
1749
+ html += `<div class="syntro-modal-body" style="color: ${V.text}; line-height: 1.5;">${sanitizeHtml2(content.body)}</div>`;
1726
1750
  if ((dismiss == null ? void 0 : dismiss.closeButton) !== false) {
1727
1751
  html += `
1728
1752
  <button class="syntro-modal-close" data-syntro-action="dismiss" style="
@@ -1733,7 +1757,8 @@ var executeModal = async (action, context) => {
1733
1757
  border: none;
1734
1758
  cursor: pointer;
1735
1759
  padding: 4px;
1736
- color: #6b7280;
1760
+ color: ${V.text};
1761
+ opacity: 0.6;
1737
1762
  " aria-label="Close">
1738
1763
  <svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
1739
1764
  <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
@@ -1756,7 +1781,7 @@ var executeModal = async (action, context) => {
1756
1781
  font-weight: 500;
1757
1782
  cursor: pointer;
1758
1783
  transition: background 150ms ease;
1759
- ${isPrimary ? "background: #4f46e5; color: white; border: none;" : "background: white; color: #374151; border: 1px solid #d1d5db;"}
1784
+ ${isPrimary ? `background: ${V.accent}; color: white; border: none;` : `background: transparent; color: ${V.accent}; border: 1px solid currentColor; opacity: 0.7;`}
1760
1785
  "
1761
1786
  >
1762
1787
  ${sanitizeHtml2(btn.label)}
@@ -2673,7 +2698,7 @@ var runtime2 = {
2673
2698
  executors: executors2,
2674
2699
  widgets: [
2675
2700
  {
2676
- id: "workflow:tracker",
2701
+ id: "adaptive-overlays:workflow-tracker",
2677
2702
  component: WorkflowMountableWidget,
2678
2703
  metadata: {
2679
2704
  name: "Workflow Tracker",
@@ -3291,7 +3316,7 @@ function getAntiFlickerSnippet(config = {}) {
3291
3316
  }
3292
3317
 
3293
3318
  // src/version.ts
3294
- var SDK_VERSION = "2.4.0-canary.23";
3319
+ var SDK_VERSION = "2.4.0-canary.24";
3295
3320
 
3296
3321
  // src/types.ts
3297
3322
  var SDK_SCHEMA_VERSION = "2.0";
@@ -4246,8 +4271,51 @@ function useDecision(strategy, defaultValue) {
4246
4271
  }
4247
4272
 
4248
4273
  // src/components/TileCard.tsx
4249
- import { useCallback as useCallback3, useEffect as useEffect5, useReducer, useRef as useRef4, useState as useState4 } from "react";
4250
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
4274
+ import {
4275
+ useCallback as useCallback3,
4276
+ useEffect as useEffect5,
4277
+ useMemo as useMemo3,
4278
+ useReducer,
4279
+ useRef as useRef4,
4280
+ useState as useState4
4281
+ } from "react";
4282
+
4283
+ // src/components/TileIcon.tsx
4284
+ import {
4285
+ Compass,
4286
+ FileText,
4287
+ Gamepad2,
4288
+ HelpCircle,
4289
+ Layers,
4290
+ MessageCircle,
4291
+ Sparkles,
4292
+ Trophy
4293
+ } from "lucide-react";
4294
+ import { jsx as jsx4 } from "react/jsx-runtime";
4295
+ var ICON_MAP = {
4296
+ "\u2753": HelpCircle,
4297
+ "\u{1F9ED}": Compass,
4298
+ "\u{1F4DD}": FileText,
4299
+ "\u{1F3AF}": Layers,
4300
+ "\u{1F3C6}": Trophy,
4301
+ "\u2728": Sparkles,
4302
+ "\u{1F4AC}": MessageCircle,
4303
+ "\u{1F3AE}": Gamepad2
4304
+ };
4305
+ function TileIcon({
4306
+ emoji,
4307
+ size = 18,
4308
+ color = "currentColor"
4309
+ }) {
4310
+ const Icon = ICON_MAP[emoji];
4311
+ if (!Icon) {
4312
+ return /* @__PURE__ */ jsx4("span", { children: emoji });
4313
+ }
4314
+ return /* @__PURE__ */ jsx4(Icon, { size, color });
4315
+ }
4316
+
4317
+ // src/components/TileCard.tsx
4318
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
4251
4319
  function WidgetMount({ widgetId, props }) {
4252
4320
  var _a2;
4253
4321
  const runtime3 = useRuntime();
@@ -4290,7 +4358,7 @@ function WidgetMount({ widgetId, props }) {
4290
4358
  }
4291
4359
  );
4292
4360
  }
4293
- return /* @__PURE__ */ jsx4("div", { ref: containerRef, style: { width: "100%", minHeight: "40px" } });
4361
+ return /* @__PURE__ */ jsx5("div", { ref: containerRef, style: { width: "100%", minHeight: "40px" } });
4294
4362
  }
4295
4363
  function TileCard({
4296
4364
  config,
@@ -4298,12 +4366,29 @@ function TileCard({
4298
4366
  telemetry: _telemetry,
4299
4367
  style
4300
4368
  }) {
4301
- const { title, widget, props } = config;
4369
+ const { title, subtitle, widget, props, icon } = config;
4302
4370
  const [, setTick] = useState4(0);
4303
4371
  const runtime3 = useRuntime();
4304
4372
  useEffect5(() => {
4305
4373
  if (runtime3) setTick((t) => t + 1);
4306
4374
  }, [runtime3]);
4375
+ const registration = useMemo3(
4376
+ () => {
4377
+ var _a2, _b;
4378
+ return (_b = (_a2 = runtime3 == null ? void 0 : runtime3.widgets) == null ? void 0 : _a2.getRegistration) == null ? void 0 : _b.call(_a2, widget);
4379
+ },
4380
+ [runtime3 == null ? void 0 : runtime3.widgets, widget]
4381
+ );
4382
+ const resolvedIcon = useMemo3(() => {
4383
+ var _a2, _b;
4384
+ if (icon) return icon;
4385
+ return (_b = (_a2 = registration == null ? void 0 : registration.metadata) == null ? void 0 : _a2.icon) != null ? _b : "+";
4386
+ }, [icon, registration]);
4387
+ const resolvedSubtitle = useMemo3(() => {
4388
+ var _a2;
4389
+ if (subtitle) return subtitle;
4390
+ return (_a2 = registration == null ? void 0 : registration.metadata) == null ? void 0 : _a2.subtitle;
4391
+ }, [subtitle, registration]);
4307
4392
  const [hovered, setHovered] = useState4(false);
4308
4393
  const onMouseEnter = useCallback3(() => setHovered(true), []);
4309
4394
  const onMouseLeave = useCallback3(() => setHovered(false), []);
@@ -4327,21 +4412,15 @@ function TileCard({
4327
4412
  const headerStyle = {
4328
4413
  display: "flex",
4329
4414
  alignItems: "center",
4330
- gap: "0.75rem",
4331
- padding: "0.875rem 1rem",
4332
- minHeight: "72px"
4415
+ gap: "var(--sc-tile-gap, 0.25rem)",
4416
+ padding: "var(--sc-tile-header-padding, 0.375rem 0.75rem)",
4417
+ minHeight: "44px"
4333
4418
  };
4334
4419
  const iconStyle = {
4335
- width: "40px",
4336
- height: "40px",
4337
- borderRadius: "10px",
4338
- background: "var(--sc-tile-icon-background)",
4339
4420
  display: "flex",
4340
4421
  alignItems: "center",
4341
4422
  justifyContent: "center",
4342
- fontSize: "1.25rem",
4343
- flexShrink: 0,
4344
- boxShadow: "var(--sc-tile-icon-shadow)"
4423
+ flexShrink: 0
4345
4424
  };
4346
4425
  return /* @__PURE__ */ jsxs2(
4347
4426
  "article",
@@ -4352,31 +4431,48 @@ function TileCard({
4352
4431
  onMouseLeave,
4353
4432
  children: [
4354
4433
  /* @__PURE__ */ jsxs2("div", { style: headerStyle, children: [
4355
- /* @__PURE__ */ jsx4("div", { style: iconStyle, children: "+" }),
4356
- /* @__PURE__ */ jsx4("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx4(
4357
- "h3",
4358
- {
4359
- style: {
4360
- fontSize: "0.95rem",
4361
- fontWeight: 600,
4362
- color: "var(--sc-tile-title-color)",
4363
- margin: "0.125rem 0 0",
4364
- whiteSpace: "nowrap",
4365
- overflow: "hidden",
4366
- textOverflow: "ellipsis"
4367
- },
4368
- children: title != null ? title : widget
4369
- }
4370
- ) })
4434
+ /* @__PURE__ */ jsx5("div", { style: iconStyle, children: /* @__PURE__ */ jsx5(TileIcon, { emoji: resolvedIcon, size: resolvedSubtitle ? 36 : 24 }) }),
4435
+ /* @__PURE__ */ jsxs2("div", { style: { flex: 1, minWidth: 0 }, children: [
4436
+ /* @__PURE__ */ jsx5(
4437
+ "h3",
4438
+ {
4439
+ style: {
4440
+ fontSize: "1.14rem",
4441
+ fontWeight: 600,
4442
+ color: "var(--sc-tile-title-color)",
4443
+ margin: "0.125rem 0 0",
4444
+ whiteSpace: "nowrap",
4445
+ overflow: "hidden",
4446
+ textOverflow: "ellipsis"
4447
+ },
4448
+ children: title != null ? title : widget
4449
+ }
4450
+ ),
4451
+ resolvedSubtitle && /* @__PURE__ */ jsx5(
4452
+ "p",
4453
+ {
4454
+ style: {
4455
+ fontSize: "0.8rem",
4456
+ fontWeight: 400,
4457
+ color: "var(--sc-tile-text-color)",
4458
+ margin: "0.125rem 0 0",
4459
+ whiteSpace: "nowrap",
4460
+ overflow: "hidden",
4461
+ textOverflow: "ellipsis"
4462
+ },
4463
+ children: resolvedSubtitle
4464
+ }
4465
+ )
4466
+ ] })
4371
4467
  ] }),
4372
- /* @__PURE__ */ jsx4(
4468
+ /* @__PURE__ */ jsx5(
4373
4469
  "div",
4374
4470
  {
4375
4471
  style: {
4376
- padding: "0 1rem 1rem",
4472
+ padding: "var(--sc-tile-body-padding, 0 0.75rem 0.5rem)",
4377
4473
  borderTop: "1px solid rgba(255, 255, 255, 0.06)"
4378
4474
  },
4379
- children: /* @__PURE__ */ jsx4("div", { style: { paddingTop: "0.875rem" }, children: /* @__PURE__ */ jsx4(WidgetMount, { widgetId: widget, props: { ...props, instanceId: config.id } }) })
4475
+ children: /* @__PURE__ */ jsx5("div", { style: { paddingTop: "var(--sc-tile-gap, 0.25rem)" }, children: /* @__PURE__ */ jsx5(WidgetMount, { widgetId: widget, props: { ...props, instanceId: config.id } }) })
4380
4476
  }
4381
4477
  )
4382
4478
  ]
@@ -4385,7 +4481,7 @@ function TileCard({
4385
4481
  }
4386
4482
 
4387
4483
  // src/components/ShadowCanvasOverlay.tsx
4388
- import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef5, useState as useState5 } from "react";
4484
+ import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef5, useState as useState5 } from "react";
4389
4485
  import { createPortal } from "react-dom";
4390
4486
 
4391
4487
  // src/theme/defaultTheme.ts
@@ -4777,8 +4873,8 @@ function flattenThemeConfig(config) {
4777
4873
  }
4778
4874
 
4779
4875
  // src/theme/ThemeProvider.tsx
4780
- import { createContext as createContext3, useContext as useContext3, useEffect as useEffect6, useMemo as useMemo3 } from "react";
4781
- import { jsx as jsx5 } from "react/jsx-runtime";
4876
+ import { createContext as createContext3, useContext as useContext3, useEffect as useEffect6, useMemo as useMemo4 } from "react";
4877
+ import { jsx as jsx6 } from "react/jsx-runtime";
4782
4878
  var ThemeContext = createContext3(null);
4783
4879
  function ThemeProvider({
4784
4880
  children,
@@ -4786,11 +4882,11 @@ function ThemeProvider({
4786
4882
  workspaceTheme,
4787
4883
  shadowRoot
4788
4884
  }) {
4789
- const merged = useMemo3(
4885
+ const merged = useMemo4(
4790
4886
  () => workspaceTheme ? mergeThemeWithWorkspace(workspaceTheme, themeConfig != null ? themeConfig : {}) : mergeThemeConfig(themeConfig != null ? themeConfig : {}),
4791
4887
  [themeConfig, workspaceTheme]
4792
4888
  );
4793
- const cssVariables = useMemo3(() => flattenThemeConfig(merged), [merged]);
4889
+ const cssVariables = useMemo4(() => flattenThemeConfig(merged), [merged]);
4794
4890
  useEffect6(() => {
4795
4891
  if (!shadowRoot) return;
4796
4892
  let styleEl = shadowRoot.querySelector("#sc-theme-vars");
@@ -4809,7 +4905,7 @@ ${cssRules}
4809
4905
  mode: merged.mode,
4810
4906
  cssVariables
4811
4907
  };
4812
- return /* @__PURE__ */ jsx5(ThemeContext.Provider, { value, children });
4908
+ return /* @__PURE__ */ jsx6(ThemeContext.Provider, { value, children });
4813
4909
  }
4814
4910
  function useTheme() {
4815
4911
  const context = useContext3(ThemeContext);
@@ -4820,7 +4916,7 @@ function useTheme() {
4820
4916
  }
4821
4917
 
4822
4918
  // src/components/ShadowCanvasOverlay.tsx
4823
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
4919
+ import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
4824
4920
  var LAUNCHER_STYLES_ID = "syntro-launcher-styles";
4825
4921
  function ensureLauncherStyles(target, css) {
4826
4922
  if (target.querySelector(`#${LAUNCHER_STYLES_ID}`)) return;
@@ -4879,7 +4975,7 @@ function ShadowCanvasOverlay({
4879
4975
  },
4880
4976
  [runtime3, isOpen, onToggle, dismissNotification]
4881
4977
  );
4882
- const launcherCss = useMemo4(
4978
+ const launcherCss = useMemo5(
4883
4979
  () => `
4884
4980
  @keyframes syntro-launcher-pulse {
4885
4981
  0%, 100% {
@@ -5046,7 +5142,7 @@ function ShadowCanvasOverlay({
5046
5142
  pointerEvents: "none",
5047
5143
  padding: "0"
5048
5144
  };
5049
- const content = /* @__PURE__ */ jsx6(
5145
+ const content = /* @__PURE__ */ jsx7(
5050
5146
  "div",
5051
5147
  {
5052
5148
  "data-shadow-canvas-id": "overlay-root",
@@ -5058,7 +5154,7 @@ function ShadowCanvasOverlay({
5058
5154
  },
5059
5155
  children: /* @__PURE__ */ jsxs3("div", { style: wrapperStyle, children: [
5060
5156
  /* @__PURE__ */ jsxs3("div", { ref: containerRef, "data-shadow-canvas-id": "overlay-container", style: containerStyle, children: [
5061
- isFocused && canvasTitle && /* @__PURE__ */ jsx6("header", { style: { color: "white", padding: "1.5rem 1.5rem 0" }, children: /* @__PURE__ */ jsx6(
5157
+ isFocused && canvasTitle && /* @__PURE__ */ jsx7("header", { style: { color: "white", padding: "1.5rem 1.5rem 0" }, children: /* @__PURE__ */ jsx7(
5062
5158
  "p",
5063
5159
  {
5064
5160
  style: {
@@ -5071,7 +5167,7 @@ function ShadowCanvasOverlay({
5071
5167
  children: canvasTitle
5072
5168
  }
5073
5169
  ) }),
5074
- /* @__PURE__ */ jsx6("div", { style: { flex: 1, overflowY: "auto", padding: isFocused ? "0" : "1rem" }, children: isLoading ? /* @__PURE__ */ jsx6(
5170
+ /* @__PURE__ */ jsx7("div", { style: { flex: 1, overflowY: "auto", padding: isFocused ? "0" : "1rem" }, children: isLoading ? /* @__PURE__ */ jsx7(
5075
5171
  "div",
5076
5172
  {
5077
5173
  style: { color: "var(--sc-overlay-text-color)", padding: isFocused ? "1rem" : "0" },
@@ -5091,7 +5187,7 @@ function ShadowCanvasOverlay({
5091
5187
  }
5092
5188
  ) : isFocused ? (
5093
5189
  /* Focused Mode: Render first tile full size */
5094
- tiles.length > 0 ? /* @__PURE__ */ jsx6(
5190
+ tiles.length > 0 ? /* @__PURE__ */ jsx7(
5095
5191
  TileCard,
5096
5192
  {
5097
5193
  config: tiles[0],
@@ -5102,7 +5198,7 @@ function ShadowCanvasOverlay({
5102
5198
  ) : null
5103
5199
  ) : (
5104
5200
  /* Standard Mode: Stacked cards — widgets always visible */
5105
- /* @__PURE__ */ jsx6(
5201
+ /* @__PURE__ */ jsx7(
5106
5202
  "div",
5107
5203
  {
5108
5204
  style: {
@@ -5111,7 +5207,7 @@ function ShadowCanvasOverlay({
5111
5207
  gap: "0.75rem",
5112
5208
  width: "100%"
5113
5209
  },
5114
- children: tiles.map((tile) => /* @__PURE__ */ jsx6(
5210
+ children: tiles.map((tile) => /* @__PURE__ */ jsx7(
5115
5211
  TileCard,
5116
5212
  {
5117
5213
  config: tile,
@@ -5126,7 +5222,7 @@ function ShadowCanvasOverlay({
5126
5222
  ) }),
5127
5223
  footerSlot
5128
5224
  ] }),
5129
- /* @__PURE__ */ jsx6(
5225
+ /* @__PURE__ */ jsx7(
5130
5226
  "div",
5131
5227
  {
5132
5228
  onClick: toggle2,
@@ -5154,7 +5250,7 @@ function ShadowCanvasOverlay({
5154
5250
  zIndex: zIndex + 47
5155
5251
  },
5156
5252
  children: [
5157
- /* @__PURE__ */ jsx6(
5253
+ /* @__PURE__ */ jsx7(
5158
5254
  NotificationToastStack,
5159
5255
  {
5160
5256
  notifications,
@@ -5224,11 +5320,11 @@ function ShadowCanvasOverlay({
5224
5320
  focusable: "false",
5225
5321
  style: { transition: "transform 200ms ease" },
5226
5322
  children: [
5227
- /* @__PURE__ */ jsx6("path", { d: "M18 6L6 18" }),
5228
- /* @__PURE__ */ jsx6("path", { d: "M6 6l12 12" })
5323
+ /* @__PURE__ */ jsx7("path", { d: "M18 6L6 18" }),
5324
+ /* @__PURE__ */ jsx7("path", { d: "M6 6l12 12" })
5229
5325
  ]
5230
5326
  }
5231
- ) : launcherIcon ? /* @__PURE__ */ jsx6(
5327
+ ) : launcherIcon ? /* @__PURE__ */ jsx7(
5232
5328
  "img",
5233
5329
  {
5234
5330
  src: launcherIcon,
@@ -5256,16 +5352,16 @@ function ShadowCanvasOverlay({
5256
5352
  focusable: "false",
5257
5353
  style: { transition: "transform 200ms ease" },
5258
5354
  children: [
5259
- /* @__PURE__ */ jsx6("path", { d: "M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3Z" }),
5260
- /* @__PURE__ */ jsx6("path", { d: "M5 3v4" }),
5261
- /* @__PURE__ */ jsx6("path", { d: "M3 5h4" }),
5262
- /* @__PURE__ */ jsx6("path", { d: "M19 17v4" }),
5263
- /* @__PURE__ */ jsx6("path", { d: "M17 19h4" })
5355
+ /* @__PURE__ */ jsx7("path", { d: "M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3Z" }),
5356
+ /* @__PURE__ */ jsx7("path", { d: "M5 3v4" }),
5357
+ /* @__PURE__ */ jsx7("path", { d: "M3 5h4" }),
5358
+ /* @__PURE__ */ jsx7("path", { d: "M19 17v4" }),
5359
+ /* @__PURE__ */ jsx7("path", { d: "M17 19h4" })
5264
5360
  ]
5265
5361
  }
5266
5362
  ),
5267
5363
  !isOpen && notifications.length > 0 && /* @__PURE__ */ jsxs3("div", { style: { position: "absolute", top: -2, right: -2, pointerEvents: "none" }, children: [
5268
- /* @__PURE__ */ jsx6(
5364
+ /* @__PURE__ */ jsx7(
5269
5365
  "span",
5270
5366
  {
5271
5367
  className: "syntro-badge-ping",
@@ -5277,7 +5373,7 @@ function ShadowCanvasOverlay({
5277
5373
  }
5278
5374
  }
5279
5375
  ),
5280
- /* @__PURE__ */ jsx6(
5376
+ /* @__PURE__ */ jsx7(
5281
5377
  "span",
5282
5378
  {
5283
5379
  className: "syntro-badge-glow",
@@ -5288,7 +5384,7 @@ function ShadowCanvasOverlay({
5288
5384
  }
5289
5385
  }
5290
5386
  ),
5291
- /* @__PURE__ */ jsx6(
5387
+ /* @__PURE__ */ jsx7(
5292
5388
  "span",
5293
5389
  {
5294
5390
  className: "syntro-badge-bounce",
@@ -5322,7 +5418,7 @@ function ShadowCanvasOverlay({
5322
5418
  }
5323
5419
 
5324
5420
  // src/hooks/useShadowCanvasConfig.ts
5325
- import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef6, useState as useState6 } from "react";
5421
+ import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef6, useState as useState6 } from "react";
5326
5422
  var sortTiles = (tiles) => [...tiles].sort((a, b) => {
5327
5423
  var _a2, _b;
5328
5424
  return ((_a2 = b.priority) != null ? _a2 : 0) - ((_b = a.priority) != null ? _b : 0);
@@ -5340,11 +5436,23 @@ function useShadowCanvasConfig({
5340
5436
  isLoading: true
5341
5437
  });
5342
5438
  const prevActionsJsonRef = useRef6("[]");
5439
+ const rawConfigRef = useRef6(null);
5440
+ const refilter = useCallback5(async () => {
5441
+ const raw = rawConfigRef.current;
5442
+ if (!raw || !runtime3) return;
5443
+ let tiles = raw.tiles || [];
5444
+ tiles = await runtime3.filterTiles(tiles);
5445
+ if (experiments) {
5446
+ tiles = tiles.filter((tile) => experiments.shouldRenderRectangle(tile));
5447
+ }
5448
+ setState((prev) => ({ ...prev, tiles: sortTiles(tiles) }));
5449
+ }, [runtime3, experiments]);
5343
5450
  const load = useCallback5(async () => {
5344
5451
  try {
5345
5452
  setState((prev) => ({ ...prev, isLoading: true, error: void 0 }));
5346
5453
  const response = await fetcher();
5347
5454
  debug("SmartCanvas Config", "Raw config response", response);
5455
+ rawConfigRef.current = response;
5348
5456
  let tiles = response.tiles || [];
5349
5457
  if (runtime3) {
5350
5458
  tiles = await runtime3.filterTiles(tiles);
@@ -5387,6 +5495,18 @@ function useShadowCanvasConfig({
5387
5495
  return experiments.onFeaturesChanged(() => load());
5388
5496
  }
5389
5497
  }, [load, experiments, pageUrl]);
5498
+ useEffect8(() => {
5499
+ if (!(runtime3 == null ? void 0 : runtime3.accumulator)) return;
5500
+ return runtime3.accumulator.subscribe(() => {
5501
+ refilter();
5502
+ });
5503
+ }, [runtime3, refilter]);
5504
+ useEffect8(() => {
5505
+ if (!(runtime3 == null ? void 0 : runtime3.context)) return;
5506
+ return runtime3.context.subscribe(() => {
5507
+ refilter();
5508
+ });
5509
+ }, [runtime3, refilter]);
5390
5510
  useEffect8(() => {
5391
5511
  if (!pollIntervalMs) return;
5392
5512
  const id = setInterval(() => {
@@ -5394,12 +5514,12 @@ function useShadowCanvasConfig({
5394
5514
  }, pollIntervalMs);
5395
5515
  return () => clearInterval(id);
5396
5516
  }, [load, pollIntervalMs]);
5397
- return useMemo5(() => state, [state]);
5517
+ return useMemo6(() => state, [state]);
5398
5518
  }
5399
5519
 
5400
5520
  // src/SmartCanvasApp.tsx
5401
- import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState7 } from "react";
5402
- import { jsx as jsx7 } from "react/jsx-runtime";
5521
+ import { useEffect as useEffect9, useMemo as useMemo7, useRef as useRef7, useState as useState7 } from "react";
5522
+ import { jsx as jsx8 } from "react/jsx-runtime";
5403
5523
  function SmartCanvasApp({
5404
5524
  controller,
5405
5525
  fetcher,
@@ -5422,7 +5542,7 @@ function SmartCanvasApp({
5422
5542
  workspaceTheme
5423
5543
  }) {
5424
5544
  if (runtime3) {
5425
- return /* @__PURE__ */ jsx7(RuntimeProvider, { runtime: runtime3, children: /* @__PURE__ */ jsx7(
5545
+ return /* @__PURE__ */ jsx8(RuntimeProvider, { runtime: runtime3, children: /* @__PURE__ */ jsx8(
5426
5546
  SmartCanvasAppInner,
5427
5547
  {
5428
5548
  controller,
@@ -5447,7 +5567,7 @@ function SmartCanvasApp({
5447
5567
  }
5448
5568
  ) });
5449
5569
  }
5450
- return /* @__PURE__ */ jsx7(
5570
+ return /* @__PURE__ */ jsx8(
5451
5571
  SmartCanvasAppInner,
5452
5572
  {
5453
5573
  controller,
@@ -5492,7 +5612,7 @@ function SmartCanvasAppInner({
5492
5612
  initialBatchHandle,
5493
5613
  workspaceTheme
5494
5614
  }) {
5495
- var _a2, _b, _c, _d, _e, _f;
5615
+ var _a2, _b, _c, _d, _e, _f, _g;
5496
5616
  const [open, setOpen] = useState7(controller.getState().open);
5497
5617
  const pageContext = usePageContext();
5498
5618
  const [localUrl, setLocalUrl] = useState7(
@@ -5522,7 +5642,7 @@ function SmartCanvasAppInner({
5522
5642
  history.replaceState = originalReplaceState;
5523
5643
  };
5524
5644
  }, [runtime3]);
5525
- const derivedFetcher = useMemo6(() => {
5645
+ const derivedFetcher = useMemo7(() => {
5526
5646
  if (fetcher) return fetcher;
5527
5647
  return createCanvasConfigFetcher({
5528
5648
  configUri,
@@ -5604,13 +5724,13 @@ function SmartCanvasAppInner({
5604
5724
  if (!configState.isLoading && !hasContent) {
5605
5725
  return null;
5606
5726
  }
5607
- return /* @__PURE__ */ jsx7(
5727
+ return /* @__PURE__ */ jsx8(
5608
5728
  ThemeProvider,
5609
5729
  {
5610
5730
  themeConfig,
5611
5731
  workspaceTheme,
5612
5732
  shadowRoot,
5613
- children: /* @__PURE__ */ jsx7(
5733
+ children: /* @__PURE__ */ jsx8(
5614
5734
  ShadowCanvasOverlay,
5615
5735
  {
5616
5736
  tiles: configState.tiles,
@@ -5619,9 +5739,10 @@ function SmartCanvasAppInner({
5619
5739
  canvasTitle: configState.canvasTitle,
5620
5740
  telemetry,
5621
5741
  launcherLabel: launcherLabel != null ? launcherLabel : (_b = configState.launcher) == null ? void 0 : _b.label,
5622
- launcherAnimate: (_c = configState.launcher) == null ? void 0 : _c.animate,
5623
- launcherAnimationStyle: (_d = configState.launcher) == null ? void 0 : _d.animationStyle,
5624
- notificationCount: (_f = (_e = configState.launcher) == null ? void 0 : _e.notificationCount) != null ? _f : configState.tiles.length,
5742
+ launcherIcon: (_c = configState.launcher) == null ? void 0 : _c.icon,
5743
+ launcherAnimate: (_d = configState.launcher) == null ? void 0 : _d.animate,
5744
+ launcherAnimationStyle: (_e = configState.launcher) == null ? void 0 : _e.animationStyle,
5745
+ notificationCount: (_g = (_f = configState.launcher) == null ? void 0 : _f.notificationCount) != null ? _g : configState.tiles.length,
5625
5746
  footerSlot,
5626
5747
  isOpen: open,
5627
5748
  onToggle: () => controller.toggle(),
@@ -5634,7 +5755,7 @@ function SmartCanvasAppInner({
5634
5755
 
5635
5756
  // src/SmartCanvasElement.tsx
5636
5757
  import { createRoot as createRoot2 } from "react-dom/client";
5637
- import { jsx as jsx8 } from "react/jsx-runtime";
5758
+ import { jsx as jsx9 } from "react/jsx-runtime";
5638
5759
  var TAG_NAME = "smart-canvas";
5639
5760
  var BASE_CSS = `
5640
5761
  :host {
@@ -5735,13 +5856,13 @@ var SmartCanvasElement = class extends HTMLElement {
5735
5856
  __privateSet(this, _root, createRoot2(__privateGet(this, _mount)));
5736
5857
  }
5737
5858
  __privateGet(this, _root).render(
5738
- /* @__PURE__ */ jsx8(
5859
+ /* @__PURE__ */ jsx9(
5739
5860
  ShadowRootProvider,
5740
5861
  {
5741
5862
  shadowRoot: __privateGet(this, _shadow),
5742
5863
  portalRoot: __privateGet(this, _portalRoot),
5743
5864
  overlayContainer: __privateGet(this, _overlayContainer),
5744
- children: /* @__PURE__ */ jsx8(SmartCanvasApp, { ...__privateGet(this, _lastAppProps), controller: __privateGet(this, _controller), canvasHost: this })
5865
+ children: /* @__PURE__ */ jsx9(SmartCanvasApp, { ...__privateGet(this, _lastAppProps), controller: __privateGet(this, _controller), canvasHost: this })
5745
5866
  }
5746
5867
  )
5747
5868
  );
@@ -6007,6 +6128,9 @@ function injectBaseStyles(target) {
6007
6128
  --syntro-border: var(--sc-overlay-border, #2b333f);
6008
6129
  --syntro-tooltip-bg: var(--syntro-surface);
6009
6130
  --syntro-tooltip-fg: var(--syntro-fg);
6131
+ --syntro-tooltip-title-color: var(--sc-overlay-title-color, var(--syntro-fg));
6132
+ --syntro-tooltip-arrow-bg: var(--sc-overlay-arrow-color, var(--syntro-tooltip-bg));
6133
+ --syntro-tooltip-arrow-size: var(--sc-overlay-arrow-size, 8px);
6010
6134
  --syntro-tooltip-radius: var(--syntro-radius);
6011
6135
  --syntro-tooltip-padding: 12px 16px;
6012
6136
  --syntro-tooltip-shadow: var(--syntro-shadow);
@@ -6033,14 +6157,13 @@ function injectBaseStyles(target) {
6033
6157
  transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
6034
6158
  }
6035
6159
 
6036
- /* Tooltip arrow */
6160
+ /* Tooltip arrow \u2014 triangle via clip-path (square box so rotation is symmetric) */
6037
6161
  .syntro-tooltip-arrow {
6038
6162
  position: absolute;
6039
- width: 8px;
6040
- height: 8px;
6041
- background: inherit;
6042
- transform: rotate(45deg);
6043
- z-index: -1;
6163
+ width: var(--syntro-tooltip-arrow-size);
6164
+ height: var(--syntro-tooltip-arrow-size);
6165
+ background: var(--syntro-tooltip-arrow-bg);
6166
+ clip-path: polygon(0 0, 100% 0, 50% 100%);
6044
6167
  }
6045
6168
 
6046
6169
  /* Tooltip content */
@@ -6048,6 +6171,7 @@ function injectBaseStyles(target) {
6048
6171
  font-weight: 600;
6049
6172
  font-size: 15px;
6050
6173
  margin-bottom: 6px;
6174
+ color: var(--syntro-tooltip-title-color);
6051
6175
  }
6052
6176
 
6053
6177
  .syntro-tt-body {
@@ -10327,6 +10451,7 @@ function createSmartCanvasRuntime(options = {}) {
10327
10451
  return decisionEngine.evaluateSync(strategy, context.get());
10328
10452
  },
10329
10453
  async filterTiles(tiles) {
10454
+ var _a3, _b2;
10330
10455
  const currentUrl = context.get().page.url;
10331
10456
  const results = [];
10332
10457
  for (const tile of tiles) {
@@ -10338,14 +10463,20 @@ function createSmartCanvasRuntime(options = {}) {
10338
10463
  if (!matchesRouteFilter(currentUrl, activation.routes)) {
10339
10464
  continue;
10340
10465
  }
10341
- if (!activation.strategy) {
10342
- results.push(tile);
10343
- continue;
10344
- }
10345
- const result = await this.evaluate(activation.strategy);
10346
- if (result.value) {
10347
- results.push(tile);
10466
+ if (activation.onlyIfPopulated) {
10467
+ const actions2 = (_b2 = (_a3 = tile.props) == null ? void 0 : _a3.actions) != null ? _b2 : [];
10468
+ if (actions2.length > 0) {
10469
+ const hasVisible = actions2.some((a) => {
10470
+ if (!a.triggerWhen) return true;
10471
+ return decisionEngine.evaluateSync(
10472
+ a.triggerWhen,
10473
+ context.get()
10474
+ ).value;
10475
+ });
10476
+ if (!hasVisible) continue;
10477
+ }
10348
10478
  }
10479
+ results.push(tile);
10349
10480
  }
10350
10481
  return results;
10351
10482
  },
@@ -11118,4 +11249,4 @@ export {
11118
11249
  encodeToken,
11119
11250
  Syntro
11120
11251
  };
11121
- //# sourceMappingURL=chunk-FFIHKDHW.js.map
11252
+ //# sourceMappingURL=chunk-LD22WJ44.js.map