@iyulab/u-widgets 0.4.1 → 0.5.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/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # u-widgets
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@iyulab/u-widgets)](https://www.npmjs.com/package/@iyulab/u-widgets)
4
+ [![npm MCP](https://img.shields.io/npm/v/@iyulab/u-widgets-mcp?label=mcp)](https://www.npmjs.com/package/@iyulab/u-widgets-mcp)
5
+ [![license](https://img.shields.io/npm/l/@iyulab/u-widgets)](LICENSE)
6
+ [![jsdelivr](https://data.jsdelivr.com/v1/package/npm/@iyulab/u-widgets/badge)](https://www.jsdelivr.com/package/npm/@iyulab/u-widgets)
7
+
3
8
  Declarative, data-driven widget system for visualization and input.
4
9
 
5
10
  Define your data. Map it to visual channels. The renderer does the rest.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * u-widgets Shadcn/ui + Tailwind CSS v4 Theme Preset
3
+ *
4
+ * Usage (CSS/PostCSS):
5
+ * @import "@iyulab/u-widgets/themes/shadcn.css";
6
+ *
7
+ * Or (JavaScript):
8
+ * import "@iyulab/u-widgets/themes/shadcn.css";
9
+ *
10
+ * Apply AFTER your Shadcn globals.css.
11
+ * Requires Shadcn/ui globals.css to define --primary, --background, etc.
12
+ */
13
+
14
+ :root {
15
+ --u-widget-bg: hsl(var(--background));
16
+ --u-widget-surface: hsl(var(--muted));
17
+ --u-widget-text: hsl(var(--foreground));
18
+ --u-widget-text-secondary: hsl(var(--muted-foreground));
19
+ --u-widget-border: hsl(var(--border));
20
+ --u-widget-primary: hsl(var(--primary));
21
+ --u-widget-negative: hsl(var(--destructive));
22
+ /* Shadcn does not define --success / --warning; u-widget defaults remain */
23
+ --u-widget-radius: var(--radius, 6px);
24
+ }
25
+
26
+ /* Dark mode: syncs with Shadcn .dark class */
27
+ .dark {
28
+ --u-widget-bg: hsl(var(--background));
29
+ --u-widget-surface: hsl(var(--muted));
30
+ --u-widget-text: hsl(var(--foreground));
31
+ --u-widget-text-secondary: hsl(var(--muted-foreground));
32
+ --u-widget-border: hsl(var(--border));
33
+ --u-widget-primary: hsl(var(--primary));
34
+ --u-widget-negative: hsl(var(--destructive));
35
+ --u-widget-radius: var(--radius, 6px);
36
+ }
@@ -206,7 +206,16 @@ declare interface UWidgetSpec {
206
206
  fields?: UWidgetFieldDefinition[];
207
207
  /** Formdown shorthand syntax for form fields (mutually exclusive with `fields`). */
208
208
  formdown?: string;
209
- /** Widget-specific rendering options. */
209
+ /**
210
+ * Widget-specific rendering options.
211
+ *
212
+ * Chart widgets support an `echarts` sub-key for native ECharts option passthrough:
213
+ * ```json
214
+ * { "options": { "echarts": { "tooltip": { "trigger": "axis" } } } }
215
+ * ```
216
+ * All keys in `options.echarts` are deep-merged into the generated ECharts option.
217
+ * @see https://echarts.apache.org/en/option.html
218
+ */
210
219
  options?: Record<string, unknown>;
211
220
  /** Action buttons displayed below the widget. */
212
221
  actions?: UWidgetAction[];
@@ -327,7 +327,16 @@ declare interface UWidgetSpec {
327
327
  fields?: UWidgetFieldDefinition[];
328
328
  /** Formdown shorthand syntax for form fields (mutually exclusive with `fields`). */
329
329
  formdown?: string;
330
- /** Widget-specific rendering options. */
330
+ /**
331
+ * Widget-specific rendering options.
332
+ *
333
+ * Chart widgets support an `echarts` sub-key for native ECharts option passthrough:
334
+ * ```json
335
+ * { "options": { "echarts": { "tooltip": { "trigger": "axis" } } } }
336
+ * ```
337
+ * All keys in `options.echarts` are deep-merged into the generated ECharts option.
338
+ * @see https://echarts.apache.org/en/option.html
339
+ */
331
340
  options?: Record<string, unknown>;
332
341
  /** Action buttons displayed below the widget. */
333
342
  actions?: UWidgetAction[];
@@ -6,6 +6,7 @@ const v = {
6
6
  value: "Value field (pie/funnel/heatmap)",
7
7
  color: "Color grouping field (scatter)",
8
8
  size: "Size encoding field (scatter bubble)",
9
+ opacity: "Opacity encoding field (scatter bubble)",
9
10
  axis: "Axis field (radar indicators)",
10
11
  columns: "Column definitions (table)",
11
12
  primary: "Primary text field (list)",
@@ -336,7 +337,7 @@ const y = [
336
337
  // Composition
337
338
  { widget: "compose", category: "composition", description: "Combine multiple widgets with layout hints", mappingKeys: [], dataShape: "none" }
338
339
  ];
339
- function E(e) {
340
+ function O(e) {
340
341
  if (!e) return [...y];
341
342
  const i = y.find((o) => o.widget === e);
342
343
  if (i) return T(i);
@@ -1130,7 +1131,7 @@ function T(e) {
1130
1131
  examples: s
1131
1132
  };
1132
1133
  }
1133
- function O(e) {
1134
+ function E(e) {
1134
1135
  const i = A[e];
1135
1136
  if (i)
1136
1137
  return JSON.parse(JSON.stringify(i));
@@ -1364,9 +1365,9 @@ export {
1364
1365
  N as WIDGET_OPTIONS,
1365
1366
  j as autoSpec,
1366
1367
  S as getWidgetEvents,
1367
- E as help,
1368
+ O as help,
1368
1369
  I as specSurface,
1369
1370
  q as suggestMapping,
1370
- O as template
1371
+ E as template
1371
1372
  };
1372
1373
  //# sourceMappingURL=u-widgets-tools.js.map