@talex-touch/tuffex-wc 0.0.0-stage → 0.1.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.
Files changed (43) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +47 -2
  3. package/dist/chunks/TxImageGeneration.js +28478 -0
  4. package/dist/chunks/base-a.js +1223 -0
  5. package/dist/chunks/base-b.js +1648 -0
  6. package/dist/chunks/core.esm.js +2327 -0
  7. package/dist/chunks/glyphs-ai-1.js +33 -0
  8. package/dist/chunks/glyphs-ai-2.js +55 -0
  9. package/dist/chunks/glyphs-brand-1.js +23 -0
  10. package/dist/chunks/glyphs-brand-2.js +33 -0
  11. package/dist/chunks/glyphs-brand-3.js +40 -0
  12. package/dist/chunks/glyphs-icon-1.js +144 -0
  13. package/dist/chunks/glyphs-icon-2.js +124 -0
  14. package/dist/chunks/pinyin.js +4 -0
  15. package/dist/chunks/pull-down.esm.js +336 -0
  16. package/dist/chunks/pull-up.esm.js +234 -0
  17. package/dist/chunks/scroll-bar.esm.js +768 -0
  18. package/dist/chunks/tier-a.js +426 -0
  19. package/dist/chunks/tier-b.js +897 -0
  20. package/dist/chunks/tier-c.js +72 -0
  21. package/dist/chunks/tuffex-data.js +9757 -0
  22. package/dist/chunks/tuffex-extras.js +11692 -0
  23. package/dist/chunks/tuffex-media.js +13475 -0
  24. package/dist/chunks/tuffex-shared.js +17671 -0
  25. package/dist/chunks/vue-export-helper.js +10 -0
  26. package/dist/chunks/wc-runtime.js +922 -0
  27. package/dist/elements/base-a.d.ts +145 -0
  28. package/dist/elements/base-b.d.ts +129 -0
  29. package/dist/elements/index.d.ts +22 -0
  30. package/dist/elements/tier-a.d.ts +55 -0
  31. package/dist/elements/tier-b.d.ts +58 -0
  32. package/dist/elements/tier-c.d.ts +7 -0
  33. package/dist/index.d.ts +12 -0
  34. package/dist/index.js +320 -0
  35. package/dist/manifest.d.ts +19 -0
  36. package/dist/manifest.js +1377 -0
  37. package/dist/runtime/coerce.d.ts +38 -0
  38. package/dist/runtime/events.d.ts +17 -0
  39. package/dist/runtime/factory.d.ts +129 -0
  40. package/dist/runtime/styles.d.ts +20 -0
  41. package/dist/style.css +1 -0
  42. package/dist/types.d.ts +1861 -0
  43. package/package.json +75 -3
@@ -0,0 +1,897 @@
1
+ import { l as TxInput, I as TxCheckbox, w as TxTooltip, h as TxPopover, V as TxModal, S as _sfc_main$3, aD as TxSelectItem, b as TxSelect } from "./tuffex-shared.js";
2
+ import { J as TxTextarea, K as TxRadio, L as TxRadioGroup, M as _sfc_main, N as TxTabItem, O as TxTabs, P as TxCollapse, Q as TxCollapseItem, R as TxBottomDialog, S as _sfc_main$1, U as _sfc_main$2, V as TxTouchTip } from "./tuffex-extras.js";
3
+ import { defineComponent, useHost, ref, computed, watch, h, onBeforeUnmount, getCurrentInstance } from "vue";
4
+ import { c as createTxCustomElement, a as createTxCustomElementFromComponent, b as coercePropsBySchema, e as buildRawVueProps, u as useNativeAttrProps, h as hasHostSlotContent, f as createSlotVNode, g as getHostSlotNodes, k as coerceBoolean, d as dispatchHostEvent, p as promoteChildProvides } from "./wc-runtime.js";
5
+ const inputBundle = createTxCustomElement({
6
+ tag: "tx-input",
7
+ component: TxInput,
8
+ props: {
9
+ modelValue: "string-or-number",
10
+ value: "string-or-number",
11
+ placeholder: "string",
12
+ type: "string",
13
+ disabled: "boolean",
14
+ readonly: "boolean",
15
+ clearable: "boolean",
16
+ rows: "number",
17
+ prefixIcon: "string",
18
+ suffixIcon: "string",
19
+ capsLockText: "string"
20
+ },
21
+ model: {
22
+ prop: "modelValue",
23
+ aliasProp: "value",
24
+ event: "update:modelValue"
25
+ },
26
+ emits: ["update:modelValue", "input", "focus", "blur", "clear"],
27
+ suppressNativeEvents: ["input"],
28
+ slots: ["prefix", "suffix"]
29
+ });
30
+ const textareaBundle = createTxCustomElement({
31
+ tag: "tx-textarea",
32
+ component: TxTextarea,
33
+ props: {
34
+ modelValue: "string",
35
+ value: "string",
36
+ placeholder: "string",
37
+ rows: "number",
38
+ disabled: "boolean",
39
+ readonly: "boolean",
40
+ maxLength: "number",
41
+ showCount: "boolean",
42
+ resize: "string",
43
+ status: "string"
44
+ },
45
+ model: {
46
+ prop: "modelValue",
47
+ aliasProp: "value",
48
+ event: "update:modelValue"
49
+ },
50
+ emits: ["update:modelValue", "input", "focus", "blur"],
51
+ suppressNativeEvents: ["input"]
52
+ });
53
+ const checkboxBundle = createTxCustomElement({
54
+ tag: "tx-checkbox",
55
+ component: TxCheckbox,
56
+ props: {
57
+ modelValue: "boolean",
58
+ checked: "boolean",
59
+ disabled: "boolean",
60
+ loading: "boolean",
61
+ label: "string",
62
+ labelPlacement: "string",
63
+ variant: "string",
64
+ ariaLabel: "string",
65
+ indeterminate: "boolean"
66
+ },
67
+ model: {
68
+ prop: "modelValue",
69
+ aliasProp: "checked",
70
+ event: "update:modelValue"
71
+ },
72
+ emits: ["update:modelValue", "change"],
73
+ slots: ["default"]
74
+ });
75
+ const radioBundle = createTxCustomElement({
76
+ tag: "tx-radio",
77
+ component: TxRadio,
78
+ props: {
79
+ value: "string-or-number",
80
+ disabled: "boolean",
81
+ label: "string",
82
+ type: "string",
83
+ modelValue: "boolean"
84
+ },
85
+ transformProps: (coerced) => ({
86
+ value: "",
87
+ ...coerced
88
+ }),
89
+ emits: ["click", "update:modelValue"],
90
+ suppressNativeEvents: ["click"],
91
+ slots: ["default"]
92
+ });
93
+ const radioGroupBundle = createTxCustomElement({
94
+ tag: "tx-radio-group",
95
+ component: TxRadioGroup,
96
+ props: {
97
+ modelValue: "string-or-number",
98
+ value: "string-or-number",
99
+ disabled: "boolean",
100
+ type: "string",
101
+ direction: "string",
102
+ indicatorVariant: "string",
103
+ glass: "boolean",
104
+ blur: "boolean",
105
+ updateOnSettled: "boolean",
106
+ stiffness: "number",
107
+ damping: "number",
108
+ blurAmount: "number",
109
+ elastic: "boolean"
110
+ },
111
+ model: {
112
+ prop: "modelValue",
113
+ aliasProp: "value",
114
+ event: "update:modelValue"
115
+ },
116
+ emits: ["update:modelValue", "change"],
117
+ promoteProvides: true,
118
+ slots: ["default"]
119
+ });
120
+ const sliderBundle = createTxCustomElement({
121
+ tag: "tx-slider",
122
+ component: _sfc_main,
123
+ props: {
124
+ modelValue: "number",
125
+ value: "number",
126
+ min: "number",
127
+ max: "number",
128
+ step: "number",
129
+ disabled: "boolean",
130
+ active: "boolean",
131
+ overdrag: "boolean",
132
+ ariaLabel: "string",
133
+ ariaLabelledby: "string",
134
+ showValue: "boolean",
135
+ formatValue: "any",
136
+ thumbSurface: "boolean",
137
+ thumbVariant: "string",
138
+ showTooltip: "boolean",
139
+ tooltipTrigger: "string",
140
+ tooltipFormatter: "any",
141
+ tooltipPlacement: "string",
142
+ tooltipTilt: "boolean",
143
+ tooltipTiltMaxDeg: "number",
144
+ tooltipOffsetMaxPx: "number",
145
+ tooltipAccelBoost: "number",
146
+ tooltipSpringStiffness: "number",
147
+ tooltipSpringDamping: "number",
148
+ tooltipMotion: "string",
149
+ tooltipMotionDuration: "number",
150
+ tooltipMotionBlurPx: "number",
151
+ tooltipDistortSkewDeg: "number",
152
+ tooltipJelly: "boolean",
153
+ tooltipJellyFrequency: "number",
154
+ tooltipJellyDecay: "number",
155
+ tooltipJellyRotateDeg: "number",
156
+ tooltipJellySkewDeg: "number",
157
+ tooltipJellySquash: "number",
158
+ tooltipJellyTriggerAccel: "number"
159
+ },
160
+ model: {
161
+ prop: "modelValue",
162
+ aliasProp: "value",
163
+ event: "update:modelValue"
164
+ },
165
+ emits: ["update:modelValue", "change"],
166
+ suppressNativeEvents: ["input", "change"]
167
+ });
168
+ const tabItemBundle = createTxCustomElement({
169
+ tag: "tx-tab-item",
170
+ component: TxTabItem,
171
+ props: {
172
+ name: "string",
173
+ label: "string",
174
+ iconClass: "string",
175
+ disabled: "boolean",
176
+ activation: "boolean",
177
+ active: "boolean"
178
+ },
179
+ transformProps: (coerced) => {
180
+ const { label: _label, ...rest } = coerced;
181
+ return {
182
+ name: "",
183
+ ...rest
184
+ };
185
+ },
186
+ emits: ["click"],
187
+ suppressNativeEvents: ["click"],
188
+ slots: ["icon", "name"]
189
+ });
190
+ const TABS_PROP_SCHEMA = {
191
+ modelValue: "string",
192
+ value: "string",
193
+ defaultValue: "string",
194
+ placement: "string",
195
+ offset: "number",
196
+ navMinWidth: "number",
197
+ navMaxWidth: "number",
198
+ contentPadding: "number",
199
+ contentScrollable: "boolean",
200
+ borderless: "boolean",
201
+ autoHeight: "boolean",
202
+ autoWidth: "boolean",
203
+ showIndicator: "boolean",
204
+ indicatorVariant: "string",
205
+ indicatorMotion: "string",
206
+ indicatorMotionStrength: "number",
207
+ autoHeightDurationMs: "number",
208
+ autoHeightEasing: "string",
209
+ animation: "json",
210
+ items: "json"
211
+ };
212
+ function extractTabSpecsFromHost(host) {
213
+ const nodes = getHostSlotNodes(host, "default");
214
+ const specs = [];
215
+ for (const node of nodes) {
216
+ if (node.nodeType !== 1)
217
+ continue;
218
+ const el = node;
219
+ if (el.tagName.toLowerCase() !== "tx-tab-item")
220
+ continue;
221
+ const name = el.getAttribute("name") ?? (typeof el.name === "string" ? el.name : "");
222
+ if (!name)
223
+ continue;
224
+ const labelAttr = el.getAttribute("label") ?? (typeof el.label === "string" ? el.label : void 0);
225
+ const iconClass = el.getAttribute("icon-class") ?? (typeof el.iconClass === "string" ? el.iconClass : "");
226
+ const disabled = coerceBoolean(el.hasAttribute("disabled") ? el.getAttribute("disabled") : el.disabled) ?? false;
227
+ const activation = coerceBoolean(el.hasAttribute("activation") ? el.getAttribute("activation") : el.activation) ?? false;
228
+ const rawPanelNodes = el._slots?.default ? [...el._slots.default] : Array.from(el.childNodes);
229
+ for (const child of rawPanelNodes) {
230
+ if (child.parentNode === el)
231
+ el.removeChild(child);
232
+ }
233
+ specs.push({
234
+ name,
235
+ label: labelAttr || void 0,
236
+ iconClass,
237
+ disabled,
238
+ activation,
239
+ panelNodes: rawPanelNodes
240
+ });
241
+ }
242
+ return specs;
243
+ }
244
+ const TxTabsWcWrapper = defineComponent({
245
+ name: "Wc_tx-tabs",
246
+ props: buildRawVueProps(TABS_PROP_SCHEMA),
247
+ setup(rawProps) {
248
+ const host = useHost();
249
+ const slottedTabs = ref(extractTabSpecsFromHost(host));
250
+ const coercedProps = computed(() => coercePropsBySchema(rawProps, TABS_PROP_SCHEMA));
251
+ const hasLocalModel = ref(false);
252
+ const localModel = ref(void 0);
253
+ watch(
254
+ () => coercedProps.value.modelValue ?? coercedProps.value.value,
255
+ (next) => {
256
+ if (next !== void 0) {
257
+ hasLocalModel.value = true;
258
+ localModel.value = next;
259
+ }
260
+ },
261
+ { immediate: true }
262
+ );
263
+ const resolvedTabs = computed(() => {
264
+ const propItems = coercedProps.value.items;
265
+ if (Array.isArray(propItems) && propItems.length > 0)
266
+ return propItems;
267
+ return slottedTabs.value;
268
+ });
269
+ function handleModelUpdate(next) {
270
+ hasLocalModel.value = true;
271
+ localModel.value = next;
272
+ if (host) {
273
+ const hostObj = host;
274
+ if (hostObj.modelValue !== next)
275
+ hostObj.modelValue = next;
276
+ }
277
+ dispatchHostEvent(host, "update:modelValue", next);
278
+ }
279
+ function handleChange(next) {
280
+ dispatchHostEvent(host, "change", next);
281
+ }
282
+ function mountPanelNodes(nodes) {
283
+ return (el) => {
284
+ if (!(el instanceof HTMLElement))
285
+ return;
286
+ for (const node of nodes) {
287
+ if (node.parentNode !== el)
288
+ el.appendChild(node);
289
+ }
290
+ };
291
+ }
292
+ return () => {
293
+ const { items: _items, value: _value, ...restProps } = coercedProps.value;
294
+ const forwarded = {
295
+ ...restProps,
296
+ "onUpdate:modelValue": handleModelUpdate,
297
+ "onChange": handleChange
298
+ };
299
+ if (hasLocalModel.value)
300
+ forwarded.modelValue = localModel.value;
301
+ const tabs = resolvedTabs.value;
302
+ const tabVNodes = tabs.map((tab) => {
303
+ const slots = {};
304
+ if (tab.label)
305
+ slots.name = () => tab.label;
306
+ if (tab.panelNodes && tab.panelNodes.length > 0) {
307
+ slots.default = () => h("div", {
308
+ class: "tx-wc-tab-panel",
309
+ key: `panel-${tab.name}`,
310
+ ref: mountPanelNodes(tab.panelNodes)
311
+ });
312
+ } else if (tab.content !== void 0) {
313
+ slots.default = () => tab.content;
314
+ }
315
+ return h(TxTabItem, {
316
+ key: tab.name,
317
+ name: tab.name,
318
+ iconClass: tab.iconClass ?? "",
319
+ disabled: Boolean(tab.disabled),
320
+ activation: Boolean(tab.activation)
321
+ }, slots);
322
+ });
323
+ return h(TxTabs, forwarded, {
324
+ default: () => tabVNodes
325
+ });
326
+ };
327
+ }
328
+ });
329
+ const tabsBundle = createTxCustomElementFromComponent("tx-tabs", TxTabsWcWrapper);
330
+ const collapseBundle = createTxCustomElement({
331
+ tag: "tx-collapse",
332
+ component: TxCollapse,
333
+ props: {
334
+ accordion: "boolean",
335
+ modelValue: "string-or-json",
336
+ value: "string-or-json"
337
+ },
338
+ model: {
339
+ prop: "modelValue",
340
+ aliasProp: "value",
341
+ event: "update:modelValue"
342
+ },
343
+ emits: ["update:modelValue", "change"],
344
+ promoteProvides: true,
345
+ slots: ["default"]
346
+ });
347
+ const collapseItemBundle = createTxCustomElement({
348
+ tag: "tx-collapse-item",
349
+ component: TxCollapseItem,
350
+ props: {
351
+ title: "string",
352
+ name: "string",
353
+ disabled: "boolean",
354
+ arrowIcon: "string"
355
+ },
356
+ slots: ["title", "default"]
357
+ });
358
+ const tooltipBundle = createTxCustomElement({
359
+ tag: "tx-tooltip",
360
+ component: TxTooltip,
361
+ props: {
362
+ modelValue: "boolean",
363
+ content: "string",
364
+ disabled: "boolean",
365
+ trigger: "string",
366
+ openDelay: "number",
367
+ closeDelay: "number",
368
+ maxHeight: "number",
369
+ referenceFullWidth: "boolean",
370
+ interactive: "boolean",
371
+ keepAliveContent: "boolean",
372
+ closeOnClickOutside: "boolean",
373
+ toggleOnReferenceClick: "boolean",
374
+ layer: "string",
375
+ role: "string",
376
+ unstyled: "boolean",
377
+ anchor: "json"
378
+ },
379
+ emits: ["update:modelValue", "open", "close"],
380
+ teleportSlots: true,
381
+ slots: ["default", "content"]
382
+ });
383
+ const popoverBundle = createTxCustomElement({
384
+ tag: "tx-popover",
385
+ component: TxPopover,
386
+ props: {
387
+ modelValue: "boolean",
388
+ disabled: "boolean",
389
+ eager: "boolean",
390
+ placement: "string",
391
+ offset: "number",
392
+ width: "number",
393
+ minWidth: "number",
394
+ maxWidth: "number",
395
+ maxHeight: "number",
396
+ unlimitedHeight: "boolean",
397
+ referenceFullWidth: "boolean",
398
+ referenceClass: "any",
399
+ showArrow: "boolean",
400
+ arrowSize: "number",
401
+ trigger: "string",
402
+ openDelay: "number",
403
+ closeDelay: "number",
404
+ animation: "json",
405
+ virtualReference: "any",
406
+ matchReferenceWidth: "boolean",
407
+ keepAliveContent: "boolean",
408
+ toggleOnReferenceClick: "boolean",
409
+ panelVariant: "string",
410
+ panelBackground: "string",
411
+ panelShadow: "string",
412
+ panelRadius: "number",
413
+ panelPadding: "number",
414
+ panelCard: "json",
415
+ closeOnClickOutside: "boolean",
416
+ closeOnEsc: "boolean"
417
+ },
418
+ emits: ["update:modelValue", "open", "close"],
419
+ teleportSlots: true,
420
+ slots: ["reference", "default"]
421
+ });
422
+ const DIALOG_PROP_SCHEMA = {
423
+ open: "boolean",
424
+ modelValue: "boolean",
425
+ visible: "boolean",
426
+ variant: "string",
427
+ title: "string",
428
+ message: "string",
429
+ confirmText: "string",
430
+ width: "string",
431
+ fullscreen: "boolean",
432
+ closeLabel: "string",
433
+ stay: "number",
434
+ index: "number",
435
+ icon: "string",
436
+ btns: "json",
437
+ buttons: "json",
438
+ surface: "string",
439
+ surfaceColor: "string",
440
+ surfaceOpacity: "number",
441
+ beforeClose: "any"
442
+ };
443
+ const TxDialogWcWrapper = defineComponent({
444
+ name: "Wc_tx-dialog",
445
+ props: buildRawVueProps(DIALOG_PROP_SCHEMA),
446
+ setup(rawProps) {
447
+ const host = useHost();
448
+ const nativeAttrs = useNativeAttrProps(host, DIALOG_PROP_SCHEMA);
449
+ onBeforeUnmount(() => nativeAttrs.cleanup());
450
+ const coercedProps = computed(() => ({
451
+ ...nativeAttrs.nativeValues,
452
+ ...coercePropsBySchema(rawProps, DIALOG_PROP_SCHEMA)
453
+ }));
454
+ const isOpen = ref(false);
455
+ watch(
456
+ () => {
457
+ const p = coercedProps.value;
458
+ if (typeof p.open === "boolean")
459
+ return p.open;
460
+ if (typeof p.modelValue === "boolean")
461
+ return p.modelValue;
462
+ if (typeof p.visible === "boolean")
463
+ return p.visible;
464
+ return false;
465
+ },
466
+ (next) => {
467
+ isOpen.value = next;
468
+ },
469
+ { immediate: true }
470
+ );
471
+ function emitClosed() {
472
+ isOpen.value = false;
473
+ if (host) {
474
+ const hostObj = host;
475
+ if (coerceBoolean(hostObj.open) === true)
476
+ hostObj.open = false;
477
+ if (coerceBoolean(hostObj.modelValue) === true)
478
+ hostObj.modelValue = false;
479
+ if (coerceBoolean(hostObj.visible) === true)
480
+ hostObj.visible = false;
481
+ }
482
+ dispatchHostEvent(host, "update:open", false);
483
+ dispatchHostEvent(host, "update:modelValue", false);
484
+ dispatchHostEvent(host, "close");
485
+ }
486
+ function normalizeDialogButtons(rawList) {
487
+ if (!Array.isArray(rawList))
488
+ return [];
489
+ return rawList.map((entry, idx) => {
490
+ const btn = entry && typeof entry === "object" ? entry : {};
491
+ const userOnClick = typeof btn.onClick === "function" ? btn.onClick : void 0;
492
+ return {
493
+ content: String(btn.content ?? ""),
494
+ type: btn.type,
495
+ icon: btn.icon,
496
+ time: btn.time,
497
+ onClick: async () => {
498
+ dispatchHostEvent(host, "action", { button: btn, index: idx });
499
+ if (userOnClick)
500
+ return await userOnClick();
501
+ return true;
502
+ }
503
+ };
504
+ });
505
+ }
506
+ function normalizeTipButtons(rawList) {
507
+ if (!Array.isArray(rawList))
508
+ return [];
509
+ return rawList.map((entry, idx) => {
510
+ const btn = entry && typeof entry === "object" ? entry : {};
511
+ const userOnClick = typeof btn.onClick === "function" ? btn.onClick : void 0;
512
+ return {
513
+ content: String(btn.content ?? ""),
514
+ type: btn.type,
515
+ onClick: async () => {
516
+ dispatchHostEvent(host, "action", { button: btn, index: idx });
517
+ if (userOnClick)
518
+ return await userOnClick();
519
+ return true;
520
+ }
521
+ };
522
+ });
523
+ }
524
+ const resolvedVariant = computed(() => {
525
+ const explicit = coercedProps.value.variant;
526
+ if (explicit === "modal" || explicit === "bottom" || explicit === "blow" || explicit === "popper" || explicit === "tip")
527
+ return explicit;
528
+ if (Array.isArray(coercedProps.value.btns) && coercedProps.value.btns.length > 0)
529
+ return "bottom";
530
+ if (Array.isArray(coercedProps.value.buttons) && coercedProps.value.buttons.length > 0)
531
+ return "tip";
532
+ return "modal";
533
+ });
534
+ return () => {
535
+ const p = coercedProps.value;
536
+ const variant = resolvedVariant.value;
537
+ const surfaceMode = p.surface ?? "refraction";
538
+ if (variant === "modal") {
539
+ const modalSlots = {};
540
+ if (hasHostSlotContent(host, "header"))
541
+ modalSlots.header = () => createSlotVNode(host, "header", true);
542
+ if (hasHostSlotContent(host, "default"))
543
+ modalSlots.default = () => createSlotVNode(host, "default", true);
544
+ else if (typeof p.message === "string" && p.message.length > 0)
545
+ modalSlots.default = () => h("p", { class: "tx-dialog__message" }, p.message);
546
+ if (hasHostSlotContent(host, "footer"))
547
+ modalSlots.footer = () => createSlotVNode(host, "footer", true);
548
+ return h(TxModal, {
549
+ "modelValue": isOpen.value,
550
+ "title": p.title ?? "",
551
+ "width": p.width ?? "480px",
552
+ "fullscreen": Boolean(p.fullscreen),
553
+ "closeLabel": p.closeLabel ?? "Close",
554
+ "surface": surfaceMode,
555
+ "surfaceColor": p.surfaceColor ?? "",
556
+ "surfaceOpacity": p.surfaceOpacity,
557
+ "beforeClose": p.beforeClose,
558
+ "onUpdate:modelValue": (next) => {
559
+ if (!next)
560
+ emitClosed();
561
+ else
562
+ isOpen.value = true;
563
+ }
564
+ }, modalSlots);
565
+ }
566
+ if (!isOpen.value)
567
+ return null;
568
+ if (variant === "bottom") {
569
+ return h(TxBottomDialog, {
570
+ title: p.title ?? "",
571
+ message: p.message ?? "",
572
+ stay: p.stay ?? 0,
573
+ btns: normalizeDialogButtons(p.btns),
574
+ icon: p.icon ?? "",
575
+ index: p.index ?? 0,
576
+ closeLabel: p.closeLabel ?? "Close",
577
+ surface: surfaceMode,
578
+ surfaceColor: p.surfaceColor ?? "",
579
+ surfaceOpacity: p.surfaceOpacity,
580
+ close: emitClosed
581
+ });
582
+ }
583
+ if (variant === "blow") {
584
+ return h(_sfc_main$1, {
585
+ title: p.title ?? "",
586
+ message: p.message ?? "",
587
+ confirmText: p.confirmText ?? "Confirm",
588
+ surface: surfaceMode,
589
+ surfaceColor: p.surfaceColor ?? "",
590
+ surfaceOpacity: p.surfaceOpacity,
591
+ ...hasHostSlotContent(host, "default") ? { render: () => createSlotVNode(host, "default", true) } : {},
592
+ close: emitClosed
593
+ });
594
+ }
595
+ if (variant === "popper") {
596
+ return h(_sfc_main$2, {
597
+ title: p.title ?? "",
598
+ message: p.message ?? "",
599
+ confirmText: p.confirmText ?? "Confirm",
600
+ surface: surfaceMode,
601
+ surfaceColor: p.surfaceColor ?? "",
602
+ surfaceOpacity: p.surfaceOpacity,
603
+ ...hasHostSlotContent(host, "default") ? { render: () => createSlotVNode(host, "default", true) } : {},
604
+ close: emitClosed
605
+ });
606
+ }
607
+ return h(TxTouchTip, {
608
+ title: p.title ?? "",
609
+ message: p.message ?? "",
610
+ buttons: normalizeTipButtons(p.buttons ?? p.btns),
611
+ surface: surfaceMode,
612
+ surfaceColor: p.surfaceColor ?? "",
613
+ surfaceOpacity: p.surfaceOpacity,
614
+ close: emitClosed
615
+ });
616
+ };
617
+ }
618
+ });
619
+ const dialogBundle = createTxCustomElementFromComponent("tx-dialog", TxDialogWcWrapper);
620
+ const drawerBundle = createTxCustomElement({
621
+ tag: "tx-drawer",
622
+ component: _sfc_main$3,
623
+ props: {
624
+ visible: "boolean",
625
+ modelValue: "boolean",
626
+ open: "boolean",
627
+ title: "string",
628
+ size: "string-or-number",
629
+ full: "boolean",
630
+ width: "string-or-number",
631
+ direction: "string",
632
+ showHeader: "boolean",
633
+ showFooter: "boolean",
634
+ showClose: "boolean",
635
+ closeLabel: "string",
636
+ closeOnClickMask: "boolean",
637
+ closeOnPressEscape: "boolean",
638
+ beforeClose: "any",
639
+ maskEffect: "string",
640
+ panelTransparent: "boolean",
641
+ surface: "string",
642
+ surfaceColor: "string",
643
+ surfaceOpacity: "number",
644
+ mobileAdapt: "boolean",
645
+ zIndex: "number",
646
+ lazy: "boolean"
647
+ },
648
+ transformProps: (coerced) => {
649
+ const { open, ...rest } = coerced;
650
+ const resolvedVisible = typeof rest.visible === "boolean" ? rest.visible : typeof rest.modelValue === "boolean" ? rest.modelValue : typeof open === "boolean" ? open : false;
651
+ return {
652
+ ...rest,
653
+ visible: resolvedVisible
654
+ };
655
+ },
656
+ model: {
657
+ prop: "visible",
658
+ aliasProp: "modelValue",
659
+ event: "update:visible",
660
+ extraDomEvents: ["update:model-value"]
661
+ },
662
+ emits: ["update:visible", "open", "close"],
663
+ teleportSlots: true,
664
+ slots: ["header", "default", "footer"]
665
+ });
666
+ const selectItemBundle = createTxCustomElement({
667
+ tag: "tx-select-item",
668
+ component: TxSelectItem,
669
+ props: {
670
+ value: "string-or-number",
671
+ label: "string",
672
+ disabled: "boolean",
673
+ icon: "string",
674
+ description: "string"
675
+ },
676
+ transformProps: (coerced) => ({
677
+ value: "",
678
+ ...coerced
679
+ }),
680
+ slots: ["default"]
681
+ });
682
+ const SELECT_PROP_SCHEMA = {
683
+ modelValue: "string-or-json",
684
+ value: "string-or-json",
685
+ placeholder: "string",
686
+ disabled: "boolean",
687
+ multiple: "boolean",
688
+ status: "string",
689
+ eager: "boolean",
690
+ options: "json",
691
+ maxTagCount: "number",
692
+ maxTagTextLength: "number",
693
+ searchable: "boolean",
694
+ searchThreshold: "number",
695
+ searchPlaceholder: "string",
696
+ editable: "boolean",
697
+ remote: "boolean",
698
+ allowCreate: "boolean",
699
+ createText: "string",
700
+ loading: "boolean",
701
+ loadingText: "string",
702
+ emptyText: "string",
703
+ searchDebounce: "number",
704
+ dropdownMaxHeight: "number",
705
+ dropdownOffset: "number",
706
+ contentPadding: "number",
707
+ optionPadding: "number",
708
+ animation: "json",
709
+ panelVariant: "string",
710
+ panelBackground: "string",
711
+ panelShadow: "string",
712
+ panelRadius: "number",
713
+ panelPadding: "number",
714
+ panelCard: "json"
715
+ };
716
+ function extractSelectOptionsFromHost(host) {
717
+ const nodes = getHostSlotNodes(host, "default");
718
+ const options = [];
719
+ for (const node of nodes) {
720
+ if (node.nodeType !== 1)
721
+ continue;
722
+ const el = node;
723
+ if (el.tagName.toLowerCase() !== "tx-select-item")
724
+ continue;
725
+ const attrVal = el.getAttribute("value");
726
+ const rawVal = attrVal ?? el.value;
727
+ if (rawVal === void 0 || rawVal === null)
728
+ continue;
729
+ const slotText = el._slots?.default ? el._slots.default.map((n) => n.textContent ?? "").join("").trim() : (el.textContent ?? "").trim();
730
+ const label = el.getAttribute("label") ?? (typeof el.label === "string" && el.label ? el.label : slotText || String(rawVal));
731
+ const disabled = coerceBoolean(el.hasAttribute("disabled") ? el.getAttribute("disabled") : el.disabled) ?? false;
732
+ const icon = el.getAttribute("icon") ?? (typeof el.icon === "string" ? el.icon : void 0);
733
+ const description = el.getAttribute("description") ?? (typeof el.description === "string" ? el.description : void 0);
734
+ options.push({
735
+ value: rawVal,
736
+ label,
737
+ disabled: disabled || void 0,
738
+ icon: icon || void 0,
739
+ description: description || void 0
740
+ });
741
+ }
742
+ return options;
743
+ }
744
+ const TxSelectWcWrapper = defineComponent({
745
+ name: "Wc_tx-select",
746
+ props: buildRawVueProps(SELECT_PROP_SCHEMA),
747
+ setup(rawProps, { expose }) {
748
+ const host = useHost();
749
+ const wrapperInstance = getCurrentInstance();
750
+ const innerRef = ref(null);
751
+ const slottedOptions = ref(extractSelectOptionsFromHost(host));
752
+ const coercedProps = computed(() => coercePropsBySchema(rawProps, SELECT_PROP_SCHEMA));
753
+ const hasLocalModel = ref(false);
754
+ const localModel = ref(void 0);
755
+ watch(
756
+ () => coercedProps.value.modelValue ?? coercedProps.value.value,
757
+ (next) => {
758
+ if (next !== void 0) {
759
+ hasLocalModel.value = true;
760
+ localModel.value = next;
761
+ }
762
+ },
763
+ { immediate: true }
764
+ );
765
+ const resolvedOptions = computed(() => {
766
+ const propOpts = coercedProps.value.options;
767
+ if (Array.isArray(propOpts) && propOpts.length > 0)
768
+ return propOpts;
769
+ return slottedOptions.value;
770
+ });
771
+ expose({
772
+ open: () => innerRef.value?.open?.(),
773
+ close: () => innerRef.value?.close?.(),
774
+ toggle: () => innerRef.value?.toggle?.(),
775
+ focus: () => innerRef.value?.focus?.(),
776
+ blur: () => innerRef.value?.blur?.(),
777
+ clear: () => innerRef.value?.clear?.()
778
+ });
779
+ return () => {
780
+ const { value: _value, options: _options, ...rest } = coercedProps.value;
781
+ const forwarded = {
782
+ ...rest,
783
+ "options": resolvedOptions.value,
784
+ "ref": innerRef,
785
+ "onUpdate:modelValue": (next) => {
786
+ hasLocalModel.value = true;
787
+ localModel.value = next;
788
+ if (host) {
789
+ const hostObj = host;
790
+ if (hostObj.modelValue !== next)
791
+ hostObj.modelValue = next;
792
+ }
793
+ dispatchHostEvent(host, "update:modelValue", next);
794
+ },
795
+ "onChange": (next) => dispatchHostEvent(host, "change", next),
796
+ "onSearch": (query) => dispatchHostEvent(host, "search", query),
797
+ "onCreate": (option) => dispatchHostEvent(host, "create", option),
798
+ "onVnodeBeforeMount": (vnode) => promoteChildProvides(wrapperInstance, vnode.component),
799
+ "onVnodeMounted": (vnode) => promoteChildProvides(wrapperInstance, vnode.component)
800
+ };
801
+ if (hasLocalModel.value)
802
+ forwarded.modelValue = localModel.value;
803
+ const slots = {};
804
+ for (const slotName of ["loading", "empty", "footer"]) {
805
+ if (hasHostSlotContent(host, slotName))
806
+ slots[slotName] = () => createSlotVNode(host, slotName, true);
807
+ }
808
+ return h(TxSelect, forwarded, Object.keys(slots).length > 0 ? slots : void 0);
809
+ };
810
+ }
811
+ });
812
+ const selectBundle = createTxCustomElementFromComponent("tx-select", TxSelectWcWrapper);
813
+ const TxInputElement = inputBundle.ElementClass;
814
+ const defineTxInput = inputBundle.define;
815
+ const TxTextareaElement = textareaBundle.ElementClass;
816
+ const defineTxTextarea = textareaBundle.define;
817
+ const TxCheckboxElement = checkboxBundle.ElementClass;
818
+ const defineTxCheckbox = checkboxBundle.define;
819
+ const TxRadioElement = radioBundle.ElementClass;
820
+ const defineTxRadio = radioBundle.define;
821
+ const TxRadioGroupElement = radioGroupBundle.ElementClass;
822
+ const defineTxRadioGroup = radioGroupBundle.define;
823
+ const TxSliderElement = sliderBundle.ElementClass;
824
+ const defineTxSlider = sliderBundle.define;
825
+ const TxTabsElement = tabsBundle.ElementClass;
826
+ const defineTxTabs = tabsBundle.define;
827
+ const TxTabItemElement = tabItemBundle.ElementClass;
828
+ const defineTxTabItem = tabItemBundle.define;
829
+ const TxCollapseElement = collapseBundle.ElementClass;
830
+ const defineTxCollapse = collapseBundle.define;
831
+ const TxCollapseItemElement = collapseItemBundle.ElementClass;
832
+ const defineTxCollapseItem = collapseItemBundle.define;
833
+ const TxTooltipElement = tooltipBundle.ElementClass;
834
+ const defineTxTooltip = tooltipBundle.define;
835
+ const TxPopoverElement = popoverBundle.ElementClass;
836
+ const defineTxPopover = popoverBundle.define;
837
+ const TxDialogElement = dialogBundle.ElementClass;
838
+ const defineTxDialog = dialogBundle.define;
839
+ const TxDrawerElement = drawerBundle.ElementClass;
840
+ const defineTxDrawer = drawerBundle.define;
841
+ const TxSelectElement = selectBundle.ElementClass;
842
+ const defineTxSelect = selectBundle.define;
843
+ const TxSelectItemElement = selectItemBundle.ElementClass;
844
+ const defineTxSelectItem = selectItemBundle.define;
845
+ const TIER_B_BUNDLES = [
846
+ inputBundle,
847
+ textareaBundle,
848
+ checkboxBundle,
849
+ radioBundle,
850
+ radioGroupBundle,
851
+ sliderBundle,
852
+ tabsBundle,
853
+ tabItemBundle,
854
+ collapseBundle,
855
+ collapseItemBundle,
856
+ tooltipBundle,
857
+ popoverBundle,
858
+ dialogBundle,
859
+ drawerBundle,
860
+ selectBundle,
861
+ selectItemBundle
862
+ ];
863
+ export {
864
+ defineTxSelectItem as A,
865
+ defineTxSlider as B,
866
+ defineTxTabItem as C,
867
+ defineTxTabs as D,
868
+ defineTxTextarea as E,
869
+ defineTxTooltip as F,
870
+ TIER_B_BUNDLES as T,
871
+ TxCheckboxElement as a,
872
+ TxCollapseElement as b,
873
+ TxCollapseItemElement as c,
874
+ TxDialogElement as d,
875
+ TxDrawerElement as e,
876
+ TxInputElement as f,
877
+ TxPopoverElement as g,
878
+ TxRadioElement as h,
879
+ TxRadioGroupElement as i,
880
+ TxSelectElement as j,
881
+ TxSelectItemElement as k,
882
+ TxSliderElement as l,
883
+ TxTabItemElement as m,
884
+ TxTabsElement as n,
885
+ TxTextareaElement as o,
886
+ TxTooltipElement as p,
887
+ defineTxCheckbox as q,
888
+ defineTxCollapse as r,
889
+ defineTxCollapseItem as s,
890
+ defineTxDialog as t,
891
+ defineTxDrawer as u,
892
+ defineTxInput as v,
893
+ defineTxPopover as w,
894
+ defineTxRadio as x,
895
+ defineTxRadioGroup as y,
896
+ defineTxSelect as z
897
+ };