@iyulab/u-widgets 0.4.1 → 0.6.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 +45 -0
- package/dist/themes/shadcn.css +36 -0
- package/dist/u-widgets-charts.d.ts +10 -1
- package/dist/u-widgets-tools.d.ts +10 -1
- package/dist/u-widgets-tools.js +5 -4
- package/dist/u-widgets-tools.js.map +1 -1
- package/dist/u-widgets.d.ts +72 -1
- package/dist/u-widgets.js +734 -677
- package/dist/u-widgets.js.map +1 -1
- package/package.json +4 -2
package/dist/u-widgets.d.ts
CHANGED
|
@@ -71,6 +71,12 @@ export declare interface FormdownResult {
|
|
|
71
71
|
*/
|
|
72
72
|
export declare function getDefaultLocale(): UWidgetLocaleStrings;
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Get the active global default locale set via setDefaultLocale().
|
|
76
|
+
* Returns undefined if not set.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getEffectiveLocale(): string | undefined;
|
|
79
|
+
|
|
74
80
|
export declare function getFormdownParser(): FormdownParser;
|
|
75
81
|
|
|
76
82
|
/**
|
|
@@ -143,6 +149,30 @@ export declare function registerFormdownParser(parser: FormdownParser): void;
|
|
|
143
149
|
*/
|
|
144
150
|
export declare function registerLocale(lang: string, strings: Partial<UWidgetLocaleStrings>): void;
|
|
145
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Resolve the locale to use for a widget.
|
|
154
|
+
*
|
|
155
|
+
* Priority: widgetLocale > setDefaultLocale() > document.lang > undefined
|
|
156
|
+
*/
|
|
157
|
+
export declare function resolveLocale(widgetLocale?: string | null): string | undefined;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Set the global default locale for all u-widgets.
|
|
161
|
+
*
|
|
162
|
+
* Resolution order (highest priority first):
|
|
163
|
+
* 1. Per-widget `locale` attribute/property
|
|
164
|
+
* 2. setDefaultLocale() value
|
|
165
|
+
* 3. document.documentElement.lang (browser only)
|
|
166
|
+
* 4. English fallback
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { setDefaultLocale } from '@iyulab/u-widgets';
|
|
171
|
+
* setDefaultLocale('ko-KR');
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare function setDefaultLocale(lang: string | undefined): void;
|
|
175
|
+
|
|
146
176
|
/**
|
|
147
177
|
* Widget name suggestion for typo detection.
|
|
148
178
|
*
|
|
@@ -252,6 +282,19 @@ export declare interface UWidgetColumnDefinition {
|
|
|
252
282
|
align?: 'left' | 'center' | 'right';
|
|
253
283
|
}
|
|
254
284
|
|
|
285
|
+
export declare interface UWidgetElementProps {
|
|
286
|
+
/** Widget spec — object (via property binding) or JSON string (via attribute). */
|
|
287
|
+
spec?: UWidgetSpec | string;
|
|
288
|
+
/** Theme override. Omit for prefers-color-scheme auto-detection. */
|
|
289
|
+
theme?: 'light' | 'dark';
|
|
290
|
+
/** BCP 47 locale tag, e.g. 'ko-KR'. */
|
|
291
|
+
locale?: string;
|
|
292
|
+
id?: string;
|
|
293
|
+
class?: string;
|
|
294
|
+
style?: string;
|
|
295
|
+
[key: string]: unknown;
|
|
296
|
+
}
|
|
297
|
+
|
|
255
298
|
/**
|
|
256
299
|
* Event payload emitted by `<u-widget>` via the `u-widget-event` custom event.
|
|
257
300
|
*
|
|
@@ -419,7 +462,16 @@ export declare interface UWidgetSpec {
|
|
|
419
462
|
fields?: UWidgetFieldDefinition[];
|
|
420
463
|
/** Formdown shorthand syntax for form fields (mutually exclusive with `fields`). */
|
|
421
464
|
formdown?: string;
|
|
422
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* Widget-specific rendering options.
|
|
467
|
+
*
|
|
468
|
+
* Chart widgets support an `echarts` sub-key for native ECharts option passthrough:
|
|
469
|
+
* ```json
|
|
470
|
+
* { "options": { "echarts": { "tooltip": { "trigger": "axis" } } } }
|
|
471
|
+
* ```
|
|
472
|
+
* All keys in `options.echarts` are deep-merged into the generated ECharts option.
|
|
473
|
+
* @see https://echarts.apache.org/en/option.html
|
|
474
|
+
*/
|
|
423
475
|
options?: Record<string, unknown>;
|
|
424
476
|
/** Action buttons displayed below the widget. */
|
|
425
477
|
actions?: UWidgetAction[];
|
|
@@ -476,3 +528,22 @@ export declare interface ValidationResult {
|
|
|
476
528
|
export declare type WidgetType = ChartType | 'metric' | 'stat-group' | 'gauge' | 'progress' | 'table' | 'list' | 'form' | 'confirm' | 'compose' | 'markdown' | 'image' | 'callout' | 'kv' | 'code' | 'citation' | 'status' | 'steps' | 'rating' | 'video' | 'gallery' | 'actions' | 'divider' | 'header';
|
|
477
529
|
|
|
478
530
|
export { }
|
|
531
|
+
|
|
532
|
+
declare global {
|
|
533
|
+
interface HTMLElementTagNameMap {
|
|
534
|
+
'u-widget': import('@iyulab/u-widgets').UWidget;
|
|
535
|
+
}
|
|
536
|
+
namespace JSX {
|
|
537
|
+
interface IntrinsicElements {
|
|
538
|
+
'u-widget': UWidgetElementProps;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
declare module "react" {
|
|
544
|
+
namespace JSX {
|
|
545
|
+
interface IntrinsicElements {
|
|
546
|
+
"u-widget": UWidgetElementProps;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|