@syntrologie/runtime-sdk 2.0.0 → 2.0.1-canary.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.
- package/CAPABILITIES.md +232 -138
- package/README.md +76 -57
- package/dist/RuntimeProvider.d.ts +6 -6
- package/dist/RuntimeProvider.js +2 -3
- package/dist/RuntimeProvider.js.map +1 -1
- package/dist/SmartCanvasApp.d.ts +8 -8
- package/dist/SmartCanvasApp.js +16 -18
- package/dist/SmartCanvasApp.js.map +1 -1
- package/dist/SmartCanvasElement.d.ts +5 -5
- package/dist/SmartCanvasElement.js +13 -13
- package/dist/SmartCanvasElement.js.map +1 -1
- package/dist/SmartCanvasPortal.d.ts +2 -2
- package/dist/SmartCanvasPortal.js +2 -2
- package/dist/actions/ActionEngine.d.ts +1 -1
- package/dist/actions/ActionEngine.js +24 -24
- package/dist/actions/ActionEngine.js.map +1 -1
- package/dist/actions/executors/index.d.ts +6 -6
- package/dist/actions/executors/index.js +22 -22
- package/dist/actions/executors/index.js.map +1 -1
- package/dist/actions/executors/tour.d.ts +1 -1
- package/dist/actions/executors/tour.js +19 -19
- package/dist/actions/executors/tour.js.map +1 -1
- package/dist/actions/index.d.ts +5 -5
- package/dist/actions/index.js +3 -3
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/types.d.ts +37 -37
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.js +195 -196
- package/dist/actions/validation.js.map +1 -1
- package/dist/antiFlicker.js +1 -1
- package/dist/api.d.ts +10 -10
- package/dist/api.js +11 -11
- package/dist/api.js.map +1 -1
- package/dist/apps/AppContext.d.ts +2 -2
- package/dist/apps/AppContext.js +1 -1
- package/dist/apps/AppContext.js.map +1 -1
- package/dist/apps/AppLoader.d.ts +2 -2
- package/dist/apps/AppLoader.js +24 -24
- package/dist/apps/AppLoader.js.map +1 -1
- package/dist/apps/AppRegistry.d.ts +2 -2
- package/dist/apps/AppRegistry.js +28 -28
- package/dist/apps/AppRegistry.js.map +1 -1
- package/dist/apps/adaptive-chatbot/index.js +7 -0
- package/dist/apps/adaptive-chatbot/index.js.map +7 -0
- package/dist/apps/examples/gamification-app.example.d.ts +3 -3
- package/dist/apps/examples/gamification-app.example.js +94 -94
- package/dist/apps/examples/gamification-app.example.js.map +1 -1
- package/dist/apps/faq/index.js.map +3 -3
- package/dist/apps/gamification/index.js.map +3 -3
- package/dist/apps/index.d.ts +10 -10
- package/dist/apps/index.js +6 -6
- package/dist/apps/nav/index.js.map +3 -3
- package/dist/apps/types.d.ts +10 -10
- package/dist/blocks/data/ComparisonBlock.d.ts +1 -1
- package/dist/blocks/data/ComparisonBlock.js +40 -40
- package/dist/blocks/data/ComparisonBlock.js.map +1 -1
- package/dist/blocks/data/StatsBlock.d.ts +1 -1
- package/dist/blocks/data/StatsBlock.js +41 -41
- package/dist/blocks/data/StatsBlock.js.map +1 -1
- package/dist/blocks/data/index.d.ts +2 -2
- package/dist/blocks/data/index.js +2 -2
- package/dist/blocks/index.d.ts +5 -5
- package/dist/blocks/index.js +29 -29
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/interactive/ChecklistBlock.d.ts +1 -1
- package/dist/blocks/interactive/ChecklistBlock.js +60 -60
- package/dist/blocks/interactive/ChecklistBlock.js.map +1 -1
- package/dist/blocks/interactive/RatingBlock.d.ts +1 -1
- package/dist/blocks/interactive/RatingBlock.js +75 -65
- package/dist/blocks/interactive/RatingBlock.js.map +1 -1
- package/dist/blocks/interactive/index.d.ts +2 -2
- package/dist/blocks/interactive/index.js +2 -2
- package/dist/blocks/notification/NotificationBlock.d.ts +2 -2
- package/dist/blocks/notification/NotificationBlock.js +67 -63
- package/dist/blocks/notification/NotificationBlock.js.map +1 -1
- package/dist/blocks/notification/index.d.ts +1 -1
- package/dist/blocks/notification/index.js +1 -1
- package/dist/bootstrap.d.ts +10 -10
- package/dist/bootstrap.js +54 -40
- package/dist/bootstrap.js.map +1 -1
- package/dist/components/ShadowCanvasOverlay.d.ts +6 -6
- package/dist/components/ShadowCanvasOverlay.js +117 -107
- package/dist/components/ShadowCanvasOverlay.js.map +1 -1
- package/dist/components/TileCard.d.ts +5 -5
- package/dist/components/TileCard.js +174 -143
- package/dist/components/TileCard.js.map +1 -1
- package/dist/components/TileWheel.d.ts +3 -3
- package/dist/components/TileWheel.js +7 -7
- package/dist/components/TileWheel.js.map +1 -1
- package/dist/configFetcher.d.ts +2 -2
- package/dist/configFetcher.js +10 -7
- package/dist/configFetcher.js.map +1 -1
- package/dist/context/ContextManager.d.ts +3 -3
- package/dist/context/ContextManager.js +15 -15
- package/dist/context/ContextManager.js.map +1 -1
- package/dist/context/index.d.ts +4 -4
- package/dist/context/index.js +3 -3
- package/dist/context/schema.d.ts +1 -1
- package/dist/context/schema.js +1 -1
- package/dist/decisions/engine.d.ts +5 -5
- package/dist/decisions/engine.js +13 -13
- package/dist/decisions/index.d.ts +6 -6
- package/dist/decisions/index.js +5 -5
- package/dist/decisions/schema.d.ts +1 -1
- package/dist/decisions/schema.js +20 -20
- package/dist/decisions/strategies/rules.d.ts +1 -1
- package/dist/decisions/strategies/rules.js +24 -24
- package/dist/decisions/strategies/rules.js.map +1 -1
- package/dist/decisions/strategies/score.d.ts +1 -1
- package/dist/decisions/strategies/score.js +3 -3
- package/dist/decisions/types.d.ts +19 -19
- package/dist/editorLoader.js +20 -20
- package/dist/editorLoader.js.map +1 -1
- package/dist/events/EventBus.d.ts +3 -3
- package/dist/events/EventBus.js +5 -7
- package/dist/events/EventBus.js.map +1 -1
- package/dist/events/index.d.ts +6 -6
- package/dist/events/index.js +5 -5
- package/dist/events/normalizers/canvas.d.ts +2 -2
- package/dist/events/normalizers/canvas.js +3 -3
- package/dist/events/normalizers/canvas.js.map +1 -1
- package/dist/events/normalizers/posthog.d.ts +1 -1
- package/dist/events/normalizers/posthog.js +34 -27
- package/dist/events/normalizers/posthog.js.map +1 -1
- package/dist/events/schema.d.ts +1 -1
- package/dist/events/schema.js +2 -2
- package/dist/events/types.d.ts +1 -1
- package/dist/events/types.js +27 -27
- package/dist/experiments/adapters/growthbook.d.ts +4 -4
- package/dist/experiments/adapters/growthbook.js +5 -5
- package/dist/experiments/adapters/growthbook.js.map +1 -1
- package/dist/experiments/index.d.ts +3 -3
- package/dist/experiments/index.js +1 -1
- package/dist/experiments/registry.d.ts +2 -2
- package/dist/experiments/registry.js +2 -2
- package/dist/experiments/types.d.ts +5 -1
- package/dist/fetchers/cdnFetcher.d.ts +1 -1
- package/dist/fetchers/cdnFetcher.js +4 -8
- package/dist/fetchers/cdnFetcher.js.map +1 -1
- package/dist/fetchers/experimentsFetcher.d.ts +2 -2
- package/dist/fetchers/experimentsFetcher.js +7 -7
- package/dist/fetchers/experimentsFetcher.js.map +1 -1
- package/dist/fetchers/index.d.ts +3 -3
- package/dist/fetchers/index.js +2 -2
- package/dist/fetchers/index.js.map +1 -1
- package/dist/fetchers/registry.d.ts +1 -1
- package/dist/fetchers/registry.js +4 -4
- package/dist/fetchers/types.d.ts +1 -1
- package/dist/hooks/useCanvasOverlays.d.ts +5 -5
- package/dist/hooks/useCanvasOverlays.js +15 -13
- package/dist/hooks/useCanvasOverlays.js.map +1 -1
- package/dist/hooks/useHostPatches.d.ts +2 -2
- package/dist/hooks/useHostPatches.js +8 -8
- package/dist/hooks/useHostPatches.js.map +1 -1
- package/dist/hooks/useShadowCanvasConfig.d.ts +3 -3
- package/dist/hooks/useShadowCanvasConfig.js +5 -2
- package/dist/hooks/useShadowCanvasConfig.js.map +1 -1
- package/dist/hostPatcher/core/patcher.d.ts +1 -1
- package/dist/hostPatcher/core/patcher.js +18 -9
- package/dist/hostPatcher/core/patcher.js.map +1 -1
- package/dist/hostPatcher/core/sanitizer.js +24 -3
- package/dist/hostPatcher/core/sanitizer.js.map +1 -1
- package/dist/hostPatcher/policy/defaultPolicy.js +15 -5
- package/dist/hostPatcher/policy/defaultPolicy.js.map +1 -1
- package/dist/hostPatcher/utils/anchors.js +4 -6
- package/dist/hostPatcher/utils/anchors.js.map +1 -1
- package/dist/index.d.ts +32 -32
- package/dist/index.js +29 -29
- package/dist/index.js.map +1 -1
- package/dist/metrics/index.d.ts +1 -1
- package/dist/metrics/index.js +1 -1
- package/dist/metrics/sessionMetrics.d.ts +1 -1
- package/dist/metrics/sessionMetrics.js +6 -6
- package/dist/overlays/fetcher.d.ts +2 -2
- package/dist/overlays/fetcher.js +4 -4
- package/dist/overlays/recipeRegistry.js +2 -2
- package/dist/overlays/recipeRegistry.js.map +1 -1
- package/dist/overlays/runtime/anchor/resolve.js +1 -1
- package/dist/overlays/runtime/anchor/resolve.js.map +1 -1
- package/dist/overlays/runtime/index.d.ts +7 -7
- package/dist/overlays/runtime/index.js +7 -7
- package/dist/overlays/runtime/overlay/highlight.js +39 -39
- package/dist/overlays/runtime/overlay/highlight.js.map +1 -1
- package/dist/overlays/runtime/overlay/modal.js +5 -5
- package/dist/overlays/runtime/overlay/modal.js.map +1 -1
- package/dist/overlays/runtime/overlay/root.js +1 -1
- package/dist/overlays/runtime/overlay/runner.js +70 -23
- package/dist/overlays/runtime/overlay/runner.js.map +1 -1
- package/dist/overlays/runtime/overlay/tooltip.d.ts +1 -1
- package/dist/overlays/runtime/overlay/tooltip.js +10 -10
- package/dist/overlays/runtime/overlay/tooltip.js.map +1 -1
- package/dist/overlays/runtime/utils/dom.js +4 -1
- package/dist/overlays/runtime/utils/dom.js.map +1 -1
- package/dist/overlays/schema.js +12 -8
- package/dist/overlays/schema.js.map +1 -1
- package/dist/react.d.ts +7 -7
- package/dist/react.js +4 -4
- package/dist/react.js.map +1 -1
- package/dist/render/RenderContext.d.ts +2 -2
- package/dist/render/RenderContext.js +5 -5
- package/dist/render/RenderContext.js.map +1 -1
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.js +1 -1
- package/dist/render/types.d.ts +4 -4
- package/dist/runtime.d.ts +12 -12
- package/dist/runtime.js +20 -20
- package/dist/runtime.js.map +1 -1
- package/dist/smart-canvas.esm.js +16 -16
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +644 -491
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +15 -15
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/state/StateStore.d.ts +1 -1
- package/dist/state/StateStore.js +9 -9
- package/dist/state/StateStore.js.map +1 -1
- package/dist/state/helpers/cooldowns.d.ts +1 -1
- package/dist/state/helpers/cooldowns.js +1 -1
- package/dist/state/helpers/dismissals.d.ts +1 -1
- package/dist/state/helpers/dismissals.js +1 -1
- package/dist/state/helpers/frequency.d.ts +1 -1
- package/dist/state/helpers/frequency.js +1 -1
- package/dist/state/index.d.ts +4 -4
- package/dist/state/index.js +3 -3
- package/dist/state/schema.d.ts +1 -1
- package/dist/state/schema.js +1 -1
- package/dist/store/example.js +13 -13
- package/dist/store/example.js.map +1 -1
- package/dist/store/mini-effector.js +6 -8
- package/dist/store/mini-effector.js.map +1 -1
- package/dist/surfaces/Surfaces.d.ts +1 -1
- package/dist/surfaces/Surfaces.js +25 -25
- package/dist/surfaces/Surfaces.js.map +1 -1
- package/dist/surfaces/index.d.ts +4 -4
- package/dist/surfaces/index.js +3 -3
- package/dist/surfaces/positioning.d.ts +2 -2
- package/dist/surfaces/positioning.js +74 -77
- package/dist/surfaces/positioning.js.map +1 -1
- package/dist/surfaces/types.d.ts +9 -9
- package/dist/surfaces/types.js +7 -7
- package/dist/surfaces/types.js.map +1 -1
- package/dist/telemetry/adapters/noop.d.ts +12 -0
- package/dist/telemetry/adapters/noop.js +42 -0
- package/dist/telemetry/adapters/noop.js.map +1 -0
- package/dist/telemetry/adapters/posthog.d.ts +2 -2
- package/dist/telemetry/adapters/posthog.js +29 -16
- package/dist/telemetry/adapters/posthog.js.map +1 -1
- package/dist/telemetry/index.d.ts +4 -3
- package/dist/telemetry/index.js +3 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/registry.d.ts +2 -2
- package/dist/telemetry/registry.js +4 -2
- package/dist/telemetry/registry.js.map +1 -1
- package/dist/telemetry/types.d.ts +1 -1
- package/dist/theme/ThemeProvider.d.ts +2 -2
- package/dist/theme/ThemeProvider.js +21 -21
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/defaultTheme.d.ts +2 -2
- package/dist/theme/defaultTheme.js +111 -111
- package/dist/theme/defaultTheme.js.map +1 -1
- package/dist/theme/extractHostTheme.d.ts +1 -1
- package/dist/theme/extractHostTheme.js +42 -44
- package/dist/theme/extractHostTheme.js.map +1 -1
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.js +3 -3
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/types.d.ts +2 -2
- package/dist/token.js +3 -6
- package/dist/token.js.map +1 -1
- package/dist/types-only.d.ts +1 -1
- package/dist/types.d.ts +43 -43
- package/dist/widgets/WidgetRegistry.d.ts +2 -2
- package/dist/widgets/WidgetRegistry.js +11 -11
- package/dist/widgets/WidgetRegistry.js.map +1 -1
- package/dist/widgets/index.d.ts +2 -2
- package/dist/widgets/index.js +1 -1
- package/dist/widgets/index.js.map +1 -1
- package/package.json +4 -2
- package/schema/canvas-config.schema.json +51 -7
- package/schema/runtime-context.schema.json +1 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { darkTheme, lightTheme } from
|
|
1
|
+
import { darkTheme, lightTheme } from './defaultTheme';
|
|
2
2
|
/**
|
|
3
3
|
* Common CSS variable prefixes used by popular frameworks
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const _CSS_VAR_PATTERNS = [
|
|
6
6
|
// Tailwind
|
|
7
7
|
/^--color-/,
|
|
8
8
|
/^--tw-/,
|
|
@@ -35,7 +35,7 @@ const CSS_VAR_PATTERNS = [
|
|
|
35
35
|
*/
|
|
36
36
|
function extractCssVariables() {
|
|
37
37
|
const variables = {};
|
|
38
|
-
if (typeof document ===
|
|
38
|
+
if (typeof document === 'undefined')
|
|
39
39
|
return variables;
|
|
40
40
|
try {
|
|
41
41
|
const root = document.documentElement;
|
|
@@ -44,9 +44,9 @@ function extractCssVariables() {
|
|
|
44
44
|
for (const sheet of document.styleSheets) {
|
|
45
45
|
try {
|
|
46
46
|
for (const rule of sheet.cssRules) {
|
|
47
|
-
if (rule instanceof CSSStyleRule && rule.selectorText ===
|
|
47
|
+
if (rule instanceof CSSStyleRule && rule.selectorText === ':root') {
|
|
48
48
|
for (const prop of rule.style) {
|
|
49
|
-
if (prop.startsWith(
|
|
49
|
+
if (prop.startsWith('--')) {
|
|
50
50
|
const value = rule.style.getPropertyValue(prop).trim();
|
|
51
51
|
if (value) {
|
|
52
52
|
variables[prop] = value;
|
|
@@ -62,7 +62,7 @@ function extractCssVariables() {
|
|
|
62
62
|
}
|
|
63
63
|
// Also check computed style for inline CSS variables
|
|
64
64
|
for (const prop of computedStyle) {
|
|
65
|
-
if (prop.startsWith(
|
|
65
|
+
if (prop.startsWith('--') && !variables[prop]) {
|
|
66
66
|
const value = computedStyle.getPropertyValue(prop).trim();
|
|
67
67
|
if (value) {
|
|
68
68
|
variables[prop] = value;
|
|
@@ -71,7 +71,7 @@ function extractCssVariables() {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
catch (err) {
|
|
74
|
-
console.warn(
|
|
74
|
+
console.warn('[SmartCanvas] Error extracting CSS variables:', err);
|
|
75
75
|
}
|
|
76
76
|
return variables;
|
|
77
77
|
}
|
|
@@ -82,7 +82,7 @@ function getComputedColor(element, property) {
|
|
|
82
82
|
try {
|
|
83
83
|
const style = getComputedStyle(element);
|
|
84
84
|
const value = style.getPropertyValue(property);
|
|
85
|
-
return value && value !==
|
|
85
|
+
return value && value !== 'rgba(0, 0, 0, 0)' ? value.trim() : null;
|
|
86
86
|
}
|
|
87
87
|
catch {
|
|
88
88
|
return null;
|
|
@@ -92,24 +92,24 @@ function getComputedColor(element, property) {
|
|
|
92
92
|
* Find primary color by analyzing interactive elements
|
|
93
93
|
*/
|
|
94
94
|
function findPrimaryColor() {
|
|
95
|
-
if (typeof document ===
|
|
95
|
+
if (typeof document === 'undefined')
|
|
96
96
|
return null;
|
|
97
97
|
// Look for common button/link patterns
|
|
98
98
|
const selectors = [
|
|
99
99
|
'button[class*="primary"]',
|
|
100
100
|
'button[class*="brand"]',
|
|
101
|
-
|
|
101
|
+
'.btn-primary',
|
|
102
102
|
"[data-variant='primary']",
|
|
103
103
|
"a[class*='primary']",
|
|
104
|
-
|
|
104
|
+
'.cta',
|
|
105
105
|
'button:not([disabled]):not([class*="secondary"]):not([class*="ghost"])',
|
|
106
106
|
];
|
|
107
107
|
for (const selector of selectors) {
|
|
108
108
|
try {
|
|
109
109
|
const element = document.querySelector(selector);
|
|
110
110
|
if (element) {
|
|
111
|
-
const bgColor = getComputedColor(element,
|
|
112
|
-
if (bgColor && bgColor !==
|
|
111
|
+
const bgColor = getComputedColor(element, 'background-color');
|
|
112
|
+
if (bgColor && bgColor !== 'transparent' && !bgColor.includes('255, 255, 255')) {
|
|
113
113
|
return bgColor;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -119,9 +119,9 @@ function findPrimaryColor() {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
// Fallback: check links
|
|
122
|
-
const link = document.querySelector(
|
|
122
|
+
const link = document.querySelector('a:not([class])') || document.querySelector('a');
|
|
123
123
|
if (link) {
|
|
124
|
-
const color = getComputedColor(link,
|
|
124
|
+
const color = getComputedColor(link, 'color');
|
|
125
125
|
if (color)
|
|
126
126
|
return color;
|
|
127
127
|
}
|
|
@@ -132,15 +132,15 @@ function findPrimaryColor() {
|
|
|
132
132
|
*/
|
|
133
133
|
function detectDarkMode() {
|
|
134
134
|
var _a, _b;
|
|
135
|
-
if (typeof document ===
|
|
135
|
+
if (typeof document === 'undefined')
|
|
136
136
|
return true;
|
|
137
137
|
// Check prefers-color-scheme
|
|
138
|
-
if ((_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window,
|
|
138
|
+
if ((_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)')) === null || _b === void 0 ? void 0 : _b.matches) {
|
|
139
139
|
return true;
|
|
140
140
|
}
|
|
141
141
|
// Check body background luminance
|
|
142
142
|
const body = document.body;
|
|
143
|
-
const bgColor = getComputedColor(body,
|
|
143
|
+
const bgColor = getComputedColor(body, 'background-color');
|
|
144
144
|
if (bgColor) {
|
|
145
145
|
const match = bgColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
146
146
|
if (match) {
|
|
@@ -151,9 +151,9 @@ function detectDarkMode() {
|
|
|
151
151
|
}
|
|
152
152
|
// Check for dark mode classes
|
|
153
153
|
const html = document.documentElement;
|
|
154
|
-
if (html.classList.contains(
|
|
155
|
-
html.dataset.theme ===
|
|
156
|
-
body.classList.contains(
|
|
154
|
+
if (html.classList.contains('dark') ||
|
|
155
|
+
html.dataset.theme === 'dark' ||
|
|
156
|
+
body.classList.contains('dark')) {
|
|
157
157
|
return true;
|
|
158
158
|
}
|
|
159
159
|
return false;
|
|
@@ -167,12 +167,12 @@ export function extractHostTheme() {
|
|
|
167
167
|
let primaryColor = null;
|
|
168
168
|
// First check CSS variables
|
|
169
169
|
const primaryVarNames = [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
'--primary',
|
|
171
|
+
'--color-primary',
|
|
172
|
+
'--brand-color',
|
|
173
|
+
'--accent-color',
|
|
174
|
+
'--theme-primary',
|
|
175
|
+
'--app-primary',
|
|
176
176
|
];
|
|
177
177
|
for (const varName of primaryVarNames) {
|
|
178
178
|
if (cssVariables[varName]) {
|
|
@@ -185,25 +185,21 @@ export function extractHostTheme() {
|
|
|
185
185
|
primaryColor = findPrimaryColor();
|
|
186
186
|
}
|
|
187
187
|
// Extract other colors
|
|
188
|
-
const backgroundColor = cssVariables[
|
|
189
|
-
cssVariables[
|
|
190
|
-
getComputedColor(document.body,
|
|
191
|
-
const textColor = cssVariables[
|
|
192
|
-
cssVariables[
|
|
193
|
-
getComputedColor(document.body,
|
|
194
|
-
const borderColor = cssVariables[
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const borderRadius = cssVariables["--radius"] ||
|
|
198
|
-
cssVariables["--border-radius"] ||
|
|
199
|
-
null;
|
|
200
|
-
const fontFamily = getComputedColor(document.body, "font-family");
|
|
188
|
+
const backgroundColor = cssVariables['--background'] ||
|
|
189
|
+
cssVariables['--color-background'] ||
|
|
190
|
+
getComputedColor(document.body, 'background-color');
|
|
191
|
+
const textColor = cssVariables['--foreground'] ||
|
|
192
|
+
cssVariables['--color-text'] ||
|
|
193
|
+
getComputedColor(document.body, 'color');
|
|
194
|
+
const borderColor = cssVariables['--border'] || cssVariables['--color-border'] || null;
|
|
195
|
+
const borderRadius = cssVariables['--radius'] || cssVariables['--border-radius'] || null;
|
|
196
|
+
const fontFamily = getComputedColor(document.body, 'font-family');
|
|
201
197
|
return {
|
|
202
198
|
primaryColor,
|
|
203
199
|
backgroundColor,
|
|
204
|
-
surfaceColor: cssVariables[
|
|
200
|
+
surfaceColor: cssVariables['--card'] || cssVariables['--surface'] || null,
|
|
205
201
|
textColor,
|
|
206
|
-
textSecondaryColor: cssVariables[
|
|
202
|
+
textSecondaryColor: cssVariables['--muted-foreground'] || cssVariables['--color-text-secondary'] || null,
|
|
207
203
|
borderColor,
|
|
208
204
|
borderRadius,
|
|
209
205
|
fontFamily,
|
|
@@ -222,7 +218,9 @@ export function mergeWithExtractedTheme(extracted, baseTheme) {
|
|
|
222
218
|
merged.colorPrimary = extracted.primaryColor;
|
|
223
219
|
// Generate hover variant (slightly lighter)
|
|
224
220
|
merged.colorPrimaryHover = extracted.primaryColor; // TODO: compute lighter variant
|
|
225
|
-
merged.colorPrimaryMuted = extracted.primaryColor
|
|
221
|
+
merged.colorPrimaryMuted = extracted.primaryColor
|
|
222
|
+
.replace(')', ', 0.15)')
|
|
223
|
+
.replace('rgb', 'rgba');
|
|
226
224
|
}
|
|
227
225
|
if (extracted.backgroundColor) {
|
|
228
226
|
merged.colorBackground = extracted.backgroundColor;
|
|
@@ -252,7 +250,7 @@ export function mergeWithExtractedTheme(extracted, baseTheme) {
|
|
|
252
250
|
* Returns merged theme tokens ready to use
|
|
253
251
|
*/
|
|
254
252
|
export function autoDetectTheme(baseTheme) {
|
|
255
|
-
if (typeof document ===
|
|
253
|
+
if (typeof document === 'undefined') {
|
|
256
254
|
return baseTheme !== null && baseTheme !== void 0 ? baseTheme : darkTheme;
|
|
257
255
|
}
|
|
258
256
|
const extracted = extractHostTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractHostTheme.js","sourceRoot":"","sources":["../../src/theme/extractHostTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"extractHostTheme.js","sourceRoot":"","sources":["../../src/theme/extractHostTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACxB,WAAW;IACX,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,MAAM;IACN,SAAS;IACT,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,eAAe;IACf,eAAe;IACf,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,SAAS;IACT,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,yBAAyB;IACzB,UAAU;IACV,UAAU;IACV,SAAS;CACV,CAAC;AAEF;;GAEG;AACH,SAAS,mBAAmB;IAC1B,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC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ED,IAAI,SAAS,CAAC,kBAAkB,EAAE,CAAC;QACjC,MAAM,CAAC,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,CAAC;IAC3D,CAAC;IAED,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QAC3B,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC;IACjD,CAAC;IAED,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,SAA6B;IAC3D,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,SAAS,CAAC;IAChC,CAAC;IAED,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IACrC,OAAO,uBAAuB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { CanvasThemeTokens, ExtractedTheme, ThemeMode, ThemeAppearance
|
|
2
|
-
export { darkTheme, lightTheme, getDefaultTheme, themeToCssVariables
|
|
3
|
-
export { extractHostTheme, mergeWithExtractedTheme, autoDetectTheme
|
|
4
|
-
export { ThemeProvider, useTheme, useThemeToken, useThemeVar
|
|
5
|
-
export type { ThemeProviderProps } from
|
|
1
|
+
export type { CanvasThemeTokens, ExtractedTheme, ThemeMode, ThemeAppearance } from './types';
|
|
2
|
+
export { darkTheme, lightTheme, getDefaultTheme, themeToCssVariables } from './defaultTheme';
|
|
3
|
+
export { extractHostTheme, mergeWithExtractedTheme, autoDetectTheme } from './extractHostTheme';
|
|
4
|
+
export { ThemeProvider, useTheme, useThemeToken, useThemeVar } from './ThemeProvider';
|
|
5
|
+
export type { ThemeProviderProps } from './ThemeProvider';
|
package/dist/theme/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Default themes
|
|
2
|
-
export { darkTheme, lightTheme, getDefaultTheme, themeToCssVariables
|
|
2
|
+
export { darkTheme, lightTheme, getDefaultTheme, themeToCssVariables } from './defaultTheme';
|
|
3
3
|
// Theme extraction
|
|
4
|
-
export { extractHostTheme, mergeWithExtractedTheme, autoDetectTheme
|
|
4
|
+
export { extractHostTheme, mergeWithExtractedTheme, autoDetectTheme } from './extractHostTheme';
|
|
5
5
|
// Theme provider and hooks
|
|
6
|
-
export { ThemeProvider, useTheme, useThemeToken, useThemeVar
|
|
6
|
+
export { ThemeProvider, useTheme, useThemeToken, useThemeVar } from './ThemeProvider';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAGA,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7F,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhG,2BAA2B;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -80,12 +80,12 @@ export interface ExtractedTheme {
|
|
|
80
80
|
/**
|
|
81
81
|
* Theme mode
|
|
82
82
|
*/
|
|
83
|
-
export type ThemeMode =
|
|
83
|
+
export type ThemeMode = 'light' | 'dark' | 'auto';
|
|
84
84
|
/**
|
|
85
85
|
* User-provided theme overrides via appearance config
|
|
86
86
|
*/
|
|
87
87
|
export interface ThemeAppearance {
|
|
88
88
|
mode?: ThemeMode;
|
|
89
89
|
variables?: Partial<Record<`--sc-${string}`, string>>;
|
|
90
|
-
baseTheme?:
|
|
90
|
+
baseTheme?: 'system' | 'light' | 'dark';
|
|
91
91
|
}
|
package/dist/token.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* It bundles all necessary credentials (experiments, telemetry, config) into
|
|
6
6
|
* a single string that clients can use to initialize the SDK.
|
|
7
7
|
*/
|
|
8
|
-
const TOKEN_PREFIX =
|
|
8
|
+
const TOKEN_PREFIX = 'syn_';
|
|
9
9
|
/**
|
|
10
10
|
* Decode a Syntro token into its payload.
|
|
11
11
|
*
|
|
@@ -19,7 +19,7 @@ export function decodeToken(token) {
|
|
|
19
19
|
}
|
|
20
20
|
const base64 = token.slice(TOKEN_PREFIX.length);
|
|
21
21
|
// Convert base64url to standard base64
|
|
22
|
-
const standardBase64 = base64.replace(/-/g,
|
|
22
|
+
const standardBase64 = base64.replace(/-/g, '+').replace(/_/g, '/');
|
|
23
23
|
const json = atob(standardBase64);
|
|
24
24
|
const payload = JSON.parse(json);
|
|
25
25
|
if (payload.v !== 1) {
|
|
@@ -38,10 +38,7 @@ export function decodeToken(token) {
|
|
|
38
38
|
export function encodeToken(payload) {
|
|
39
39
|
const json = JSON.stringify(payload);
|
|
40
40
|
// Convert to base64url (URL-safe, no padding)
|
|
41
|
-
const base64 = btoa(json)
|
|
42
|
-
.replace(/\+/g, "-")
|
|
43
|
-
.replace(/\//g, "_")
|
|
44
|
-
.replace(/=+$/, "");
|
|
41
|
+
const base64 = btoa(json).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
45
42
|
return TOKEN_PREFIX + base64;
|
|
46
43
|
}
|
|
47
44
|
//# sourceMappingURL=token.js.map
|
package/dist/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC;AA4B5B;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAChD,uCAAuC;IACvC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAEvD,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,8CAA8C;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC;AA4B5B;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAChD,uCAAuC;IACvC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAEvD,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,8CAA8C;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrF,OAAO,YAAY,GAAG,MAAM,CAAC;AAC/B,CAAC"}
|
package/dist/types-only.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export interface EditorPanelProps {
|
|
|
29
29
|
/** Platform client for API calls (optional) */
|
|
30
30
|
platformClient?: unknown;
|
|
31
31
|
}
|
|
32
|
-
export type { StaticSurfaceSlot, InlineSurfaceSlot, AdjacentSurfaceSlot, SurfaceSlot, HighlightStyle, BadgePosition, TooltipContent, TooltipTrigger, InsertPosition, WidgetConfig, HighlightAction, PulseAction, BadgeAction, TooltipAction, InsertHtmlAction, SetTextAction, SetAttrAction, AddClassAction, RemoveClassAction, SetStyleAction, MountWidgetAction, ScrollToAction, NavigateAction, ActionStep, ActionKind, ActionState, ActionHandle, BatchActionHandle, ActiveAction, ValidationError, ValidationWarning, ValidationResult, ExecutorCleanup, ExecutorUpdate, ExecutorResult, ActionExecutor, ExecutorContext, } from
|
|
32
|
+
export type { StaticSurfaceSlot, InlineSurfaceSlot, AdjacentSurfaceSlot, SurfaceSlot, HighlightStyle, BadgePosition, TooltipContent, TooltipTrigger, InsertPosition, WidgetConfig, HighlightAction, PulseAction, BadgeAction, TooltipAction, InsertHtmlAction, SetTextAction, SetAttrAction, AddClassAction, RemoveClassAction, SetStyleAction, MountWidgetAction, ScrollToAction, NavigateAction, ActionStep, ActionKind, ActionState, ActionHandle, BatchActionHandle, ActiveAction, ValidationError, ValidationWarning, ValidationResult, ExecutorCleanup, ExecutorUpdate, ExecutorResult, ActionExecutor, ExecutorContext, } from './actions/types';
|
package/dist/types.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export type { ActionStep } from './actions/types';
|
|
|
5
5
|
export interface TileComponentProps {
|
|
6
6
|
config: TileConfig;
|
|
7
7
|
isExpanded: boolean;
|
|
8
|
-
surface:
|
|
9
|
-
telemetry?: import(
|
|
8
|
+
surface: 'overlay' | 'wheel';
|
|
9
|
+
telemetry?: import('./telemetry/types').TelemetryClient;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Interface for registering custom tile components
|
|
@@ -17,15 +17,15 @@ export interface TileComponent {
|
|
|
17
17
|
/**
|
|
18
18
|
* All available block types organized by category
|
|
19
19
|
*/
|
|
20
|
-
export type NotificationBlockType =
|
|
21
|
-
export type MediaBlockType =
|
|
22
|
-
export type InteractiveBlockType =
|
|
23
|
-
export type DataBlockType =
|
|
24
|
-
export type LegacyBlockType =
|
|
20
|
+
export type NotificationBlockType = 'alert' | 'success' | 'warning' | 'info' | 'error';
|
|
21
|
+
export type MediaBlockType = 'video' | 'gallery' | 'code';
|
|
22
|
+
export type InteractiveBlockType = 'form' | 'rating' | 'progress' | 'survey' | 'checklist';
|
|
23
|
+
export type DataBlockType = 'stats' | 'comparison' | 'chart' | 'table';
|
|
24
|
+
export type LegacyBlockType = 'text' | 'metric' | 'chatbot' | 'embed';
|
|
25
25
|
/**
|
|
26
26
|
* Union of all block types
|
|
27
27
|
*/
|
|
28
|
-
export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType |
|
|
28
|
+
export type BlockType = NotificationBlockType | MediaBlockType | InteractiveBlockType | DataBlockType | LegacyBlockType | 'custom';
|
|
29
29
|
export interface NotificationContentBase {
|
|
30
30
|
title: string;
|
|
31
31
|
body?: string;
|
|
@@ -34,49 +34,49 @@ export interface NotificationContentBase {
|
|
|
34
34
|
timestamp?: string;
|
|
35
35
|
}
|
|
36
36
|
export interface AlertContent extends NotificationContentBase {
|
|
37
|
-
type:
|
|
38
|
-
severity?:
|
|
37
|
+
type: 'alert';
|
|
38
|
+
severity?: 'low' | 'medium' | 'high' | 'critical';
|
|
39
39
|
}
|
|
40
40
|
export interface SuccessContent extends NotificationContentBase {
|
|
41
|
-
type:
|
|
41
|
+
type: 'success';
|
|
42
42
|
confetti?: boolean;
|
|
43
43
|
}
|
|
44
44
|
export interface WarningContent extends NotificationContentBase {
|
|
45
|
-
type:
|
|
45
|
+
type: 'warning';
|
|
46
46
|
countdown?: number;
|
|
47
47
|
}
|
|
48
48
|
export interface InfoContent extends NotificationContentBase {
|
|
49
|
-
type:
|
|
49
|
+
type: 'info';
|
|
50
50
|
learnMoreUrl?: string;
|
|
51
51
|
}
|
|
52
52
|
export interface ErrorContent extends NotificationContentBase {
|
|
53
|
-
type:
|
|
53
|
+
type: 'error';
|
|
54
54
|
errorCode?: string;
|
|
55
55
|
retryable?: boolean;
|
|
56
56
|
}
|
|
57
57
|
export type NotificationContent = AlertContent | SuccessContent | WarningContent | InfoContent | ErrorContent;
|
|
58
58
|
export interface VideoContent {
|
|
59
|
-
type:
|
|
59
|
+
type: 'video';
|
|
60
60
|
src: string;
|
|
61
|
-
provider?:
|
|
61
|
+
provider?: 'youtube' | 'vimeo' | 'custom';
|
|
62
62
|
poster?: string;
|
|
63
63
|
autoplay?: boolean;
|
|
64
64
|
muted?: boolean;
|
|
65
65
|
loop?: boolean;
|
|
66
|
-
aspectRatio?:
|
|
66
|
+
aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
|
|
67
67
|
}
|
|
68
68
|
export interface GalleryContent {
|
|
69
|
-
type:
|
|
69
|
+
type: 'gallery';
|
|
70
70
|
images: Array<{
|
|
71
71
|
src: string;
|
|
72
72
|
alt?: string;
|
|
73
73
|
caption?: string;
|
|
74
74
|
}>;
|
|
75
|
-
layout?:
|
|
75
|
+
layout?: 'carousel' | 'grid' | 'masonry';
|
|
76
76
|
columns?: 2 | 3 | 4;
|
|
77
77
|
}
|
|
78
78
|
export interface CodeContent {
|
|
79
|
-
type:
|
|
79
|
+
type: 'code';
|
|
80
80
|
code: string;
|
|
81
81
|
language?: string;
|
|
82
82
|
lineNumbers?: boolean;
|
|
@@ -87,7 +87,7 @@ export interface CodeContent {
|
|
|
87
87
|
export type MediaContent = VideoContent | GalleryContent | CodeContent;
|
|
88
88
|
export interface FormField {
|
|
89
89
|
id: string;
|
|
90
|
-
type:
|
|
90
|
+
type: 'text' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea';
|
|
91
91
|
label: string;
|
|
92
92
|
placeholder?: string;
|
|
93
93
|
required?: boolean;
|
|
@@ -98,21 +98,21 @@ export interface FormField {
|
|
|
98
98
|
defaultValue?: string | boolean;
|
|
99
99
|
}
|
|
100
100
|
export interface FormContent {
|
|
101
|
-
type:
|
|
101
|
+
type: 'form';
|
|
102
102
|
fields: FormField[];
|
|
103
103
|
submitLabel?: string;
|
|
104
104
|
submitActionId?: string;
|
|
105
105
|
}
|
|
106
106
|
export interface RatingContent {
|
|
107
|
-
type:
|
|
108
|
-
variant:
|
|
107
|
+
type: 'rating';
|
|
108
|
+
variant: 'stars' | 'thumbs' | 'nps' | 'emoji';
|
|
109
109
|
question?: string;
|
|
110
110
|
maxValue?: number;
|
|
111
111
|
submitActionId?: string;
|
|
112
112
|
}
|
|
113
113
|
export interface ProgressContent {
|
|
114
|
-
type:
|
|
115
|
-
variant:
|
|
114
|
+
type: 'progress';
|
|
115
|
+
variant: 'bar' | 'steps' | 'circular';
|
|
116
116
|
value: number;
|
|
117
117
|
max?: number;
|
|
118
118
|
steps?: Array<{
|
|
@@ -127,7 +127,7 @@ export interface SurveyChoice {
|
|
|
127
127
|
icon?: string;
|
|
128
128
|
}
|
|
129
129
|
export interface SurveyContent {
|
|
130
|
-
type:
|
|
130
|
+
type: 'survey';
|
|
131
131
|
question: string;
|
|
132
132
|
choices: SurveyChoice[];
|
|
133
133
|
multiSelect?: boolean;
|
|
@@ -144,19 +144,19 @@ export interface ChecklistItem {
|
|
|
144
144
|
completed?: boolean;
|
|
145
145
|
}
|
|
146
146
|
export interface ChecklistContent {
|
|
147
|
-
type:
|
|
147
|
+
type: 'checklist';
|
|
148
148
|
items: ChecklistItem[];
|
|
149
149
|
title?: string;
|
|
150
150
|
showProgress?: boolean;
|
|
151
151
|
}
|
|
152
152
|
export type InteractiveContent = FormContent | RatingContent | ProgressContent | SurveyContent | ChecklistContent;
|
|
153
153
|
export interface TrendIndicator {
|
|
154
|
-
direction:
|
|
154
|
+
direction: 'up' | 'down' | 'neutral';
|
|
155
155
|
value: string;
|
|
156
156
|
timeframe?: string;
|
|
157
157
|
}
|
|
158
158
|
export interface StatsContent {
|
|
159
|
-
type:
|
|
159
|
+
type: 'stats';
|
|
160
160
|
value: string;
|
|
161
161
|
label: string;
|
|
162
162
|
trend?: TrendIndicator;
|
|
@@ -171,15 +171,15 @@ export interface ComparisonItem {
|
|
|
171
171
|
icon?: string;
|
|
172
172
|
}
|
|
173
173
|
export interface ComparisonContent {
|
|
174
|
-
type:
|
|
174
|
+
type: 'comparison';
|
|
175
175
|
items: ComparisonItem[];
|
|
176
|
-
layout?:
|
|
176
|
+
layout?: 'grid' | 'list' | 'table';
|
|
177
177
|
columns?: 2 | 3 | 4;
|
|
178
178
|
highlightBest?: boolean;
|
|
179
179
|
}
|
|
180
180
|
export interface ChartContent {
|
|
181
|
-
type:
|
|
182
|
-
chartType:
|
|
181
|
+
type: 'chart';
|
|
182
|
+
chartType: 'bar' | 'line' | 'pie' | 'donut';
|
|
183
183
|
data: Array<{
|
|
184
184
|
label: string;
|
|
185
185
|
value: number;
|
|
@@ -196,7 +196,7 @@ export interface TableColumn {
|
|
|
196
196
|
width?: string;
|
|
197
197
|
}
|
|
198
198
|
export interface TableContent {
|
|
199
|
-
type:
|
|
199
|
+
type: 'table';
|
|
200
200
|
columns: TableColumn[];
|
|
201
201
|
rows: Array<Record<string, string | number>>;
|
|
202
202
|
sortable?: boolean;
|
|
@@ -207,12 +207,12 @@ export type DataContent = StatsContent | ComparisonContent | ChartContent | Tabl
|
|
|
207
207
|
/**
|
|
208
208
|
* Grid width: "full" = spans both columns, "half" = one column
|
|
209
209
|
*/
|
|
210
|
-
export type TileSize =
|
|
210
|
+
export type TileSize = 'full' | 'half';
|
|
211
211
|
/**
|
|
212
212
|
* Built-in tile types (convenience components we ship)
|
|
213
213
|
* @deprecated Use BlockType instead
|
|
214
214
|
*/
|
|
215
|
-
export type BuiltInTileType =
|
|
215
|
+
export type BuiltInTileType = 'text' | 'metric' | 'chatbot' | 'embed';
|
|
216
216
|
/**
|
|
217
217
|
* Content configuration for built-in tile types
|
|
218
218
|
* @deprecated Use specific content types (NotificationContent, MediaContent, etc.)
|
|
@@ -230,7 +230,7 @@ export interface BuiltInTileContent {
|
|
|
230
230
|
* Content configuration for custom tile components
|
|
231
231
|
*/
|
|
232
232
|
export interface CustomTileContent {
|
|
233
|
-
type:
|
|
233
|
+
type: 'custom';
|
|
234
234
|
component: string;
|
|
235
235
|
props?: Record<string, unknown>;
|
|
236
236
|
actions?: TileAction[];
|
|
@@ -250,7 +250,7 @@ export interface TileAction {
|
|
|
250
250
|
label: string;
|
|
251
251
|
href?: string;
|
|
252
252
|
onClickId?: string;
|
|
253
|
-
style?:
|
|
253
|
+
style?: 'primary' | 'secondary';
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* Visual styling for tile chrome
|
|
@@ -270,7 +270,7 @@ export interface TileExperiment {
|
|
|
270
270
|
variationValue?: string | number | boolean;
|
|
271
271
|
predicate?: (value: unknown) => boolean;
|
|
272
272
|
}
|
|
273
|
-
export type { ActivationConfig, RouteFilter, DecisionStrategy } from
|
|
273
|
+
export type { ActivationConfig, RouteFilter, DecisionStrategy } from './decisions/types';
|
|
274
274
|
/**
|
|
275
275
|
* Full tile configuration
|
|
276
276
|
*/
|
|
@@ -293,9 +293,9 @@ export interface TileConfig {
|
|
|
293
293
|
* Activation configuration for conditional rendering.
|
|
294
294
|
* Replaces the experiment field with more flexible context-aware decisions.
|
|
295
295
|
*/
|
|
296
|
-
activation?: import(
|
|
296
|
+
activation?: import('./decisions/types').ActivationConfig;
|
|
297
297
|
}
|
|
298
|
-
import type { ActionStep } from
|
|
298
|
+
import type { ActionStep } from './actions/types';
|
|
299
299
|
/**
|
|
300
300
|
* Theme configuration for the SmartCanvas overlay.
|
|
301
301
|
*/
|
|
@@ -316,7 +316,7 @@ export interface CanvasThemeConfig {
|
|
|
316
316
|
export interface LauncherConfig {
|
|
317
317
|
label?: string;
|
|
318
318
|
animate?: boolean;
|
|
319
|
-
animationStyle?:
|
|
319
|
+
animationStyle?: 'pulse' | 'bounce' | 'glow';
|
|
320
320
|
}
|
|
321
321
|
/**
|
|
322
322
|
* Route filtering - control where canvas appears.
|
|
@@ -41,7 +41,7 @@ export interface WidgetRegistration {
|
|
|
41
41
|
/** The widget component */
|
|
42
42
|
widget: MountableWidget;
|
|
43
43
|
/** Source app ID or "built-in" */
|
|
44
|
-
source:
|
|
44
|
+
source: 'built-in' | string;
|
|
45
45
|
/** Optional metadata */
|
|
46
46
|
metadata?: {
|
|
47
47
|
name?: string;
|
|
@@ -81,7 +81,7 @@ export declare class WidgetRegistry {
|
|
|
81
81
|
* @param source - The source app ID (for tracking)
|
|
82
82
|
* @param metadata - Optional metadata about the widget
|
|
83
83
|
*/
|
|
84
|
-
register(id: string, widget: MountableWidget, source?: string, metadata?: WidgetRegistration[
|
|
84
|
+
register(id: string, widget: MountableWidget, source?: string, metadata?: WidgetRegistration['metadata']): void;
|
|
85
85
|
/**
|
|
86
86
|
* Unregister a widget.
|
|
87
87
|
*
|