@dfosco/storyboard-react 3.11.0-beta.0 → 3.11.0-beta.2

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.
@@ -217,3 +217,67 @@
217
217
  border-color: currentColor;
218
218
  box-shadow: 0 0 0 1px currentColor;
219
219
  }
220
+
221
+ /* Overflow menu */
222
+ .overflowWrapper {
223
+ position: relative;
224
+ display: flex;
225
+ align-items: center;
226
+ }
227
+
228
+ .overflowMenu {
229
+ position: absolute;
230
+ top: calc(100% + 4px);
231
+ right: 0;
232
+ min-width: 180px;
233
+ padding: 4px;
234
+ background: var(--bgColor-default, #ffffff);
235
+ border-radius: 10px;
236
+ box-shadow:
237
+ 0 0 0 1px rgba(0, 0, 0, 0.08),
238
+ 0 4px 12px rgba(0, 0, 0, 0.12);
239
+ z-index: 10;
240
+ }
241
+
242
+ :global([data-sb-canvas-theme^='dark']) .overflowMenu {
243
+ background: var(--bgColor-muted, #161b22);
244
+ box-shadow:
245
+ 0 0 0 1px rgba(255, 255, 255, 0.08),
246
+ 0 4px 12px rgba(0, 0, 0, 0.45);
247
+ }
248
+
249
+ .overflowItem {
250
+ all: unset;
251
+ cursor: pointer;
252
+ display: flex;
253
+ align-items: center;
254
+ gap: 8px;
255
+ width: 100%;
256
+ padding: 6px 10px;
257
+ font-size: 12px;
258
+ color: var(--fgColor-default, #1f2328);
259
+ border-radius: 6px;
260
+ box-sizing: border-box;
261
+ }
262
+
263
+ :global([data-sb-canvas-theme^='dark']) .overflowItem {
264
+ color: var(--fgColor-default, #e6edf3);
265
+ }
266
+
267
+ .overflowItem:hover {
268
+ background: var(--bgColor-neutral-muted, #eaeef2);
269
+ }
270
+
271
+ :global([data-sb-canvas-theme^='dark']) .overflowItem:hover {
272
+ background: var(--bgColor-neutral-muted, #272c33);
273
+ }
274
+
275
+ .overflowItemDanger:hover {
276
+ background: var(--bgColor-danger-muted, #ffebe9);
277
+ color: var(--fgColor-danger, #d1242f);
278
+ }
279
+
280
+ :global([data-sb-canvas-theme^='dark']) .overflowItemDanger:hover {
281
+ background: var(--bgColor-danger-muted, #490202);
282
+ color: var(--fgColor-danger, #f85149);
283
+ }
@@ -6,9 +6,36 @@
6
6
  *
7
7
  * The config is the single source of truth for widget definitions —
8
8
  * prop schemas, feature lists, labels, and icons all come from here.
9
+ *
10
+ * Supports `$variable` references in string values, resolved from
11
+ * the top-level `variables` object in widgets.config.json.
9
12
  */
10
13
  import widgetsConfig from '@dfosco/storyboard-core/widgets.config.json'
11
14
 
15
+ /** Variables defined in config — used to resolve `$key` references. */
16
+ const variables = widgetsConfig.variables || {}
17
+
18
+ /**
19
+ * Resolve `$variable` references in a string value.
20
+ * Returns the original value if it's not a string or doesn't start with `$`.
21
+ */
22
+ function resolveVar(value) {
23
+ if (typeof value !== 'string' || !value.startsWith('$')) return value
24
+ const key = value.slice(1)
25
+ return variables[key] ?? value
26
+ }
27
+
28
+ /**
29
+ * Resolve all string values in a feature object.
30
+ */
31
+ function resolveFeature(feature) {
32
+ const resolved = {}
33
+ for (const [key, val] of Object.entries(feature)) {
34
+ resolved[key] = resolveVar(val)
35
+ }
36
+ return resolved
37
+ }
38
+
12
39
  /**
13
40
  * Convert a config prop definition to the schema shape used by widgetProps.js.
14
41
  * Config uses `"default"`, schema uses `"defaultValue"`.
@@ -42,16 +69,30 @@ function buildSchemas() {
42
69
  return result
43
70
  }
44
71
 
72
+ /**
73
+ * Build resolved widget type entries with variables expanded in features.
74
+ */
75
+ function buildWidgetTypes() {
76
+ const result = {}
77
+ for (const [type, def] of Object.entries(widgetsConfig.widgets)) {
78
+ result[type] = {
79
+ ...def,
80
+ features: (def.features || []).map(resolveFeature),
81
+ }
82
+ }
83
+ return result
84
+ }
85
+
45
86
  /** All widget schemas, keyed by type string. */
46
87
  export const schemas = buildSchemas()
47
88
 
48
- /** Full widget config entries, keyed by type string. */
49
- export const widgetTypes = widgetsConfig.widgets
89
+ /** Full widget config entries (with resolved variables), keyed by type string. */
90
+ export const widgetTypes = buildWidgetTypes()
50
91
 
51
92
  /**
52
93
  * Get the feature list for a widget type.
53
94
  * @param {string} type — widget type string
54
- * @returns {Array} features array from config, or empty array
95
+ * @returns {Array} features array from config (variables resolved), or empty array
55
96
  */
56
97
  export function getFeatures(type) {
57
98
  return widgetTypes[type]?.features ?? []