@iyulab/u-widgets 0.4.1
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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/formdown-BWJ6QGJs.js +94 -0
- package/dist/formdown-BWJ6QGJs.js.map +1 -0
- package/dist/infer-CNOiD2dS.js +91 -0
- package/dist/infer-CNOiD2dS.js.map +1 -0
- package/dist/tokens-x1kDxgG8.js +78 -0
- package/dist/tokens-x1kDxgG8.js.map +1 -0
- package/dist/u-widgets-charts.d.ts +227 -0
- package/dist/u-widgets-charts.js +502 -0
- package/dist/u-widgets-charts.js.map +1 -0
- package/dist/u-widgets-forms.d.ts +81 -0
- package/dist/u-widgets-forms.js +59 -0
- package/dist/u-widgets-forms.js.map +1 -0
- package/dist/u-widgets-tools.d.ts +400 -0
- package/dist/u-widgets-tools.js +1372 -0
- package/dist/u-widgets-tools.js.map +1 -0
- package/dist/u-widgets.d.ts +478 -0
- package/dist/u-widgets.js +4073 -0
- package/dist/u-widgets.js.map +1 -0
- package/package.json +97 -0
- package/schema/u-widget.schema.json +375 -0
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iyulab/u-widgets",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Declarative, data-driven widget system for visualization and input",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./dist/u-widgets.js",
|
|
7
|
+
"types": "./dist/u-widgets.d.ts",
|
|
8
|
+
"unpkg": "./dist/u-widgets.global.js",
|
|
9
|
+
"jsdelivr": "./dist/u-widgets.global.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/u-widgets.d.ts",
|
|
13
|
+
"import": "./dist/u-widgets.js"
|
|
14
|
+
},
|
|
15
|
+
"./charts": {
|
|
16
|
+
"types": "./dist/u-widgets-charts.d.ts",
|
|
17
|
+
"import": "./dist/u-widgets-charts.js"
|
|
18
|
+
},
|
|
19
|
+
"./forms": {
|
|
20
|
+
"types": "./dist/u-widgets-forms.d.ts",
|
|
21
|
+
"import": "./dist/u-widgets-forms.js"
|
|
22
|
+
},
|
|
23
|
+
"./tools": {
|
|
24
|
+
"types": "./dist/u-widgets-tools.d.ts",
|
|
25
|
+
"import": "./dist/u-widgets-tools.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": [
|
|
29
|
+
"./src/elements/*.ts",
|
|
30
|
+
"./dist/u-widgets.js",
|
|
31
|
+
"./dist/u-widgets-charts.js",
|
|
32
|
+
"./dist/u-widgets-forms.js"
|
|
33
|
+
],
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"schema"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "vite",
|
|
40
|
+
"build": "vite build",
|
|
41
|
+
"build:cdn": "vite build --config vite.cdn.config.ts",
|
|
42
|
+
"build:demo": "vite build --config vite.demo.config.ts",
|
|
43
|
+
"preview": "vite preview",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:watch": "vitest",
|
|
46
|
+
"test:coverage": "vitest run --coverage",
|
|
47
|
+
"lint": "eslint src/",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test:e2e": "playwright test"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"widgets",
|
|
53
|
+
"web-components",
|
|
54
|
+
"lit",
|
|
55
|
+
"data-driven",
|
|
56
|
+
"declarative",
|
|
57
|
+
"visualization",
|
|
58
|
+
"chart",
|
|
59
|
+
"form"
|
|
60
|
+
],
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "https://github.com/iyulab/u-widgets"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"lit": "^3.2.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@formdown/core": "^0.4.0",
|
|
74
|
+
"echarts": "^5.5.0 || ^6.0.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"echarts": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@formdown/core": {
|
|
81
|
+
"optional": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@open-wc/testing": "^4.0.0",
|
|
86
|
+
"@playwright/test": "^1.58.2",
|
|
87
|
+
"echarts": "^6.0.0",
|
|
88
|
+
"eslint": "^9.0.0",
|
|
89
|
+
"globals": "^15.0.0",
|
|
90
|
+
"happy-dom": "^15.0.0",
|
|
91
|
+
"typescript": "~5.7.0",
|
|
92
|
+
"typescript-eslint": "^8.0.0",
|
|
93
|
+
"vite": "^6.0.0",
|
|
94
|
+
"vite-plugin-dts": "^4.0.0",
|
|
95
|
+
"vitest": "^3.0.0"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/iyulab/u-widgets/schema/u-widget.schema.json",
|
|
4
|
+
"title": "u-widget",
|
|
5
|
+
"description": "Declarative, data-driven widget specification for u-widgets v0.4",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{ "$ref": "#/$defs/widget" },
|
|
8
|
+
{ "$ref": "#/$defs/composeWidget" }
|
|
9
|
+
],
|
|
10
|
+
"$defs": {
|
|
11
|
+
"widgetType": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"metric", "stat-group", "gauge", "progress",
|
|
15
|
+
"table", "list",
|
|
16
|
+
"chart.bar", "chart.line", "chart.area", "chart.pie",
|
|
17
|
+
"chart.scatter", "chart.radar", "chart.heatmap", "chart.box",
|
|
18
|
+
"chart.funnel", "chart.waterfall", "chart.treemap",
|
|
19
|
+
"form", "confirm",
|
|
20
|
+
"markdown", "image", "callout",
|
|
21
|
+
"kv", "code", "citation", "status", "steps",
|
|
22
|
+
"rating", "video", "gallery",
|
|
23
|
+
"actions", "divider", "header"
|
|
24
|
+
],
|
|
25
|
+
"description": "Widget type identifier"
|
|
26
|
+
},
|
|
27
|
+
"widget": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"type": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"const": "u-widget"
|
|
33
|
+
},
|
|
34
|
+
"version": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"widget": {
|
|
38
|
+
"$ref": "#/$defs/widgetType"
|
|
39
|
+
},
|
|
40
|
+
"id": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Optional unique identifier for the widget"
|
|
43
|
+
},
|
|
44
|
+
"title": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
},
|
|
47
|
+
"description": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"data": {
|
|
51
|
+
"oneOf": [
|
|
52
|
+
{ "type": "object" },
|
|
53
|
+
{ "type": "array", "items": { "type": "object" } }
|
|
54
|
+
],
|
|
55
|
+
"description": "Inline data (object or array of objects)"
|
|
56
|
+
},
|
|
57
|
+
"mapping": {
|
|
58
|
+
"$ref": "#/$defs/mapping"
|
|
59
|
+
},
|
|
60
|
+
"fields": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": { "$ref": "#/$defs/fieldDefinition" },
|
|
63
|
+
"description": "Form/confirm field definitions (input widgets only)"
|
|
64
|
+
},
|
|
65
|
+
"formdown": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "Form/confirm field definitions in formdown syntax. Mutually exclusive with fields."
|
|
68
|
+
},
|
|
69
|
+
"options": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"description": "Widget-specific rendering options"
|
|
72
|
+
},
|
|
73
|
+
"actions": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": { "$ref": "#/$defs/action" }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": ["widget"],
|
|
79
|
+
"additionalProperties": false
|
|
80
|
+
},
|
|
81
|
+
"composeWidget": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"type": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"const": "u-widget"
|
|
87
|
+
},
|
|
88
|
+
"version": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
},
|
|
91
|
+
"widget": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"const": "compose"
|
|
94
|
+
},
|
|
95
|
+
"id": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Optional unique identifier for the widget"
|
|
98
|
+
},
|
|
99
|
+
"title": {
|
|
100
|
+
"type": "string"
|
|
101
|
+
},
|
|
102
|
+
"description": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
},
|
|
105
|
+
"layout": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"enum": ["stack", "row", "grid"],
|
|
108
|
+
"default": "stack",
|
|
109
|
+
"description": "Layout mode for children"
|
|
110
|
+
},
|
|
111
|
+
"columns": {
|
|
112
|
+
"type": "integer",
|
|
113
|
+
"minimum": 1,
|
|
114
|
+
"default": 2,
|
|
115
|
+
"description": "Number of columns for grid layout"
|
|
116
|
+
},
|
|
117
|
+
"children": {
|
|
118
|
+
"type": "array",
|
|
119
|
+
"items": { "$ref": "#/$defs/childWidget" }
|
|
120
|
+
},
|
|
121
|
+
"options": {
|
|
122
|
+
"type": "object"
|
|
123
|
+
},
|
|
124
|
+
"actions": {
|
|
125
|
+
"type": "array",
|
|
126
|
+
"items": { "$ref": "#/$defs/action" }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": ["widget", "children"],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
},
|
|
132
|
+
"childWidget": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"widget": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"description": "Widget type (inherits type/version from parent)"
|
|
138
|
+
},
|
|
139
|
+
"id": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
"title": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
},
|
|
145
|
+
"description": {
|
|
146
|
+
"type": "string"
|
|
147
|
+
},
|
|
148
|
+
"span": {
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"minimum": 1,
|
|
151
|
+
"description": "Grid span width"
|
|
152
|
+
},
|
|
153
|
+
"collapsed": {
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"default": false,
|
|
156
|
+
"description": "Whether the child widget is initially collapsed (rendered in a details/summary element)"
|
|
157
|
+
},
|
|
158
|
+
"data": {
|
|
159
|
+
"oneOf": [
|
|
160
|
+
{ "type": "object" },
|
|
161
|
+
{ "type": "array", "items": { "type": "object" } }
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"mapping": {
|
|
165
|
+
"$ref": "#/$defs/mapping"
|
|
166
|
+
},
|
|
167
|
+
"fields": {
|
|
168
|
+
"type": "array",
|
|
169
|
+
"items": { "$ref": "#/$defs/fieldDefinition" }
|
|
170
|
+
},
|
|
171
|
+
"formdown": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"description": "Form/confirm field definitions in formdown syntax"
|
|
174
|
+
},
|
|
175
|
+
"options": {
|
|
176
|
+
"type": "object"
|
|
177
|
+
},
|
|
178
|
+
"actions": {
|
|
179
|
+
"type": "array",
|
|
180
|
+
"items": { "$ref": "#/$defs/action" }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"required": ["widget"],
|
|
184
|
+
"additionalProperties": false
|
|
185
|
+
},
|
|
186
|
+
"mapping": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"description": "Data field to visual channel mapping",
|
|
189
|
+
"properties": {
|
|
190
|
+
"x": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"description": "X-axis field"
|
|
193
|
+
},
|
|
194
|
+
"y": {
|
|
195
|
+
"oneOf": [
|
|
196
|
+
{ "type": "string" },
|
|
197
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
198
|
+
],
|
|
199
|
+
"description": "Y-axis field(s). Single string is normalized to array internally."
|
|
200
|
+
},
|
|
201
|
+
"label": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"description": "Label field (pie charts etc.)"
|
|
204
|
+
},
|
|
205
|
+
"value": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"description": "Value field (pie charts etc.)"
|
|
208
|
+
},
|
|
209
|
+
"color": {
|
|
210
|
+
"type": "string",
|
|
211
|
+
"description": "Color grouping field"
|
|
212
|
+
},
|
|
213
|
+
"size": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"description": "Size encoding field (scatter)"
|
|
216
|
+
},
|
|
217
|
+
"opacity": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "Opacity encoding field (scatter, maps values to 0.1-1.0)"
|
|
220
|
+
},
|
|
221
|
+
"axis": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "Axis field (radar)"
|
|
224
|
+
},
|
|
225
|
+
"columns": {
|
|
226
|
+
"type": "array",
|
|
227
|
+
"items": { "$ref": "#/$defs/columnDefinition" },
|
|
228
|
+
"description": "Table column definitions"
|
|
229
|
+
},
|
|
230
|
+
"primary": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"description": "Primary text field (list)"
|
|
233
|
+
},
|
|
234
|
+
"secondary": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"description": "Secondary text field (list)"
|
|
237
|
+
},
|
|
238
|
+
"icon": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"description": "Icon field (list)"
|
|
241
|
+
},
|
|
242
|
+
"avatar": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"description": "Avatar image URL field (list)"
|
|
245
|
+
},
|
|
246
|
+
"trailing": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"description": "Trailing text field (list)"
|
|
249
|
+
},
|
|
250
|
+
"badge": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"description": "Badge/tag field (list)"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"additionalProperties": false
|
|
256
|
+
},
|
|
257
|
+
"columnDefinition": {
|
|
258
|
+
"type": "object",
|
|
259
|
+
"properties": {
|
|
260
|
+
"field": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"description": "Data key"
|
|
263
|
+
},
|
|
264
|
+
"label": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"description": "Column header (defaults to field name)"
|
|
267
|
+
},
|
|
268
|
+
"format": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"enum": ["number", "currency", "percent", "date", "datetime", "bytes"],
|
|
271
|
+
"description": "Format hint"
|
|
272
|
+
},
|
|
273
|
+
"align": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"enum": ["left", "center", "right"],
|
|
276
|
+
"description": "Column alignment"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"required": ["field"],
|
|
280
|
+
"additionalProperties": false
|
|
281
|
+
},
|
|
282
|
+
"fieldDefinition": {
|
|
283
|
+
"type": "object",
|
|
284
|
+
"properties": {
|
|
285
|
+
"field": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"description": "Key name in submitted data"
|
|
288
|
+
},
|
|
289
|
+
"label": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"description": "Display label"
|
|
292
|
+
},
|
|
293
|
+
"type": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"enum": [
|
|
296
|
+
"text", "email", "password", "tel", "url",
|
|
297
|
+
"textarea", "number", "select", "multiselect",
|
|
298
|
+
"date", "datetime", "time",
|
|
299
|
+
"toggle", "range", "radio", "checkbox"
|
|
300
|
+
],
|
|
301
|
+
"description": "Input type"
|
|
302
|
+
},
|
|
303
|
+
"required": {
|
|
304
|
+
"type": "boolean"
|
|
305
|
+
},
|
|
306
|
+
"placeholder": {
|
|
307
|
+
"type": "string"
|
|
308
|
+
},
|
|
309
|
+
"options": {
|
|
310
|
+
"type": "array",
|
|
311
|
+
"items": { "type": "string" },
|
|
312
|
+
"description": "Choices for select/multiselect/radio/checkbox"
|
|
313
|
+
},
|
|
314
|
+
"minLength": {
|
|
315
|
+
"type": "integer",
|
|
316
|
+
"description": "Minimum character length for text inputs"
|
|
317
|
+
},
|
|
318
|
+
"maxLength": {
|
|
319
|
+
"type": "integer"
|
|
320
|
+
},
|
|
321
|
+
"pattern": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"description": "Custom regex pattern for validation"
|
|
324
|
+
},
|
|
325
|
+
"rows": {
|
|
326
|
+
"type": "integer",
|
|
327
|
+
"description": "Number of rows for textarea"
|
|
328
|
+
},
|
|
329
|
+
"min": {
|
|
330
|
+
"description": "Minimum value (number or date string)"
|
|
331
|
+
},
|
|
332
|
+
"max": {
|
|
333
|
+
"description": "Maximum value (number or date string)"
|
|
334
|
+
},
|
|
335
|
+
"step": {
|
|
336
|
+
"type": "number"
|
|
337
|
+
},
|
|
338
|
+
"message": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"description": "Custom validation error message (overrides locale default)"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"required": ["field"],
|
|
344
|
+
"additionalProperties": false
|
|
345
|
+
},
|
|
346
|
+
"action": {
|
|
347
|
+
"type": "object",
|
|
348
|
+
"properties": {
|
|
349
|
+
"label": {
|
|
350
|
+
"type": "string",
|
|
351
|
+
"description": "Button text"
|
|
352
|
+
},
|
|
353
|
+
"action": {
|
|
354
|
+
"type": "string",
|
|
355
|
+
"description": "Action identifier (submit, cancel, navigate, or custom)"
|
|
356
|
+
},
|
|
357
|
+
"style": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"enum": ["primary", "danger", "default"],
|
|
360
|
+
"default": "default"
|
|
361
|
+
},
|
|
362
|
+
"disabled": {
|
|
363
|
+
"type": "boolean",
|
|
364
|
+
"default": false
|
|
365
|
+
},
|
|
366
|
+
"url": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"description": "URL for navigate action"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"required": ["label", "action"],
|
|
372
|
+
"additionalProperties": false
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|