nuxt-ui-tools 1.7.0 → 1.8.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 (161) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +18 -0
  3. package/dist/runtime/file-preview/components/provider/file-preview-host.d.vue.ts +7 -0
  4. package/dist/runtime/file-preview/components/provider/file-preview-host.vue +147 -0
  5. package/dist/runtime/file-preview/components/provider/file-preview-host.vue.d.ts +7 -0
  6. package/dist/runtime/file-preview/components/provider/file-preview-provider.d.vue.ts +21 -0
  7. package/dist/runtime/file-preview/components/provider/file-preview-provider.vue +23 -0
  8. package/dist/runtime/file-preview/components/provider/file-preview-provider.vue.d.ts +21 -0
  9. package/dist/runtime/file-preview/components/renderers/audio-renderer.d.vue.ts +10 -0
  10. package/dist/runtime/file-preview/components/renderers/audio-renderer.vue +83 -0
  11. package/dist/runtime/file-preview/components/renderers/audio-renderer.vue.d.ts +10 -0
  12. package/dist/runtime/file-preview/components/renderers/csv-renderer.d.vue.ts +10 -0
  13. package/dist/runtime/file-preview/components/renderers/csv-renderer.vue +116 -0
  14. package/dist/runtime/file-preview/components/renderers/csv-renderer.vue.d.ts +10 -0
  15. package/dist/runtime/file-preview/components/renderers/fallback-renderer.d.vue.ts +10 -0
  16. package/dist/runtime/file-preview/components/renderers/fallback-renderer.vue +41 -0
  17. package/dist/runtime/file-preview/components/renderers/fallback-renderer.vue.d.ts +10 -0
  18. package/dist/runtime/file-preview/components/renderers/file-preview-code.d.vue.ts +9 -0
  19. package/dist/runtime/file-preview/components/renderers/file-preview-code.vue +83 -0
  20. package/dist/runtime/file-preview/components/renderers/file-preview-code.vue.d.ts +9 -0
  21. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.d.vue.ts +3 -0
  22. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.vue +14 -0
  23. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.vue.d.ts +3 -0
  24. package/dist/runtime/file-preview/components/renderers/image-renderer.d.vue.ts +10 -0
  25. package/dist/runtime/file-preview/components/renderers/image-renderer.vue +182 -0
  26. package/dist/runtime/file-preview/components/renderers/image-renderer.vue.d.ts +10 -0
  27. package/dist/runtime/file-preview/components/renderers/markdown-renderer.d.vue.ts +10 -0
  28. package/dist/runtime/file-preview/components/renderers/markdown-renderer.vue +78 -0
  29. package/dist/runtime/file-preview/components/renderers/markdown-renderer.vue.d.ts +10 -0
  30. package/dist/runtime/file-preview/components/renderers/media-controls.d.vue.ts +10 -0
  31. package/dist/runtime/file-preview/components/renderers/media-controls.vue +145 -0
  32. package/dist/runtime/file-preview/components/renderers/media-controls.vue.d.ts +10 -0
  33. package/dist/runtime/file-preview/components/renderers/pdf-renderer.d.vue.ts +10 -0
  34. package/dist/runtime/file-preview/components/renderers/pdf-renderer.vue +58 -0
  35. package/dist/runtime/file-preview/components/renderers/pdf-renderer.vue.d.ts +10 -0
  36. package/dist/runtime/file-preview/components/renderers/text-renderer.d.vue.ts +10 -0
  37. package/dist/runtime/file-preview/components/renderers/text-renderer.vue +41 -0
  38. package/dist/runtime/file-preview/components/renderers/text-renderer.vue.d.ts +10 -0
  39. package/dist/runtime/file-preview/components/renderers/video-renderer.d.vue.ts +10 -0
  40. package/dist/runtime/file-preview/components/renderers/video-renderer.vue +110 -0
  41. package/dist/runtime/file-preview/components/renderers/video-renderer.vue.d.ts +10 -0
  42. package/dist/runtime/file-preview/components/shell/file-preview-button.d.vue.ts +16 -0
  43. package/dist/runtime/file-preview/components/shell/file-preview-button.vue +40 -0
  44. package/dist/runtime/file-preview/components/shell/file-preview-button.vue.d.ts +16 -0
  45. package/dist/runtime/{form/components/renderer/form-field-error.d.vue.ts → file-preview/components/shell/file-preview-details.d.vue.ts} +4 -2
  46. package/dist/runtime/file-preview/components/shell/file-preview-details.vue +25 -0
  47. package/dist/runtime/{form/components/renderer/form-field-error.vue.d.ts → file-preview/components/shell/file-preview-details.vue.d.ts} +4 -2
  48. package/dist/runtime/file-preview/components/shell/file-preview-header.d.vue.ts +44 -0
  49. package/dist/runtime/file-preview/components/shell/file-preview-header.vue +163 -0
  50. package/dist/runtime/file-preview/components/shell/file-preview-header.vue.d.ts +44 -0
  51. package/dist/runtime/file-preview/components/shell/file-preview-message.d.vue.ts +21 -0
  52. package/dist/runtime/file-preview/components/shell/file-preview-message.vue +49 -0
  53. package/dist/runtime/file-preview/components/shell/file-preview-message.vue.d.ts +21 -0
  54. package/dist/runtime/file-preview/components/shell/file-preview-shell.d.vue.ts +17 -0
  55. package/dist/runtime/file-preview/components/shell/file-preview-shell.vue +280 -0
  56. package/dist/runtime/file-preview/components/shell/file-preview-shell.vue.d.ts +17 -0
  57. package/dist/runtime/file-preview/components/shell/file-preview-stage.d.vue.ts +37 -0
  58. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +173 -0
  59. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue.d.ts +37 -0
  60. package/dist/runtime/file-preview/components/shell/file-preview-thumb.d.vue.ts +14 -0
  61. package/dist/runtime/file-preview/components/shell/file-preview-thumb.vue +69 -0
  62. package/dist/runtime/file-preview/components/shell/file-preview-thumb.vue.d.ts +14 -0
  63. package/dist/runtime/file-preview/components/shell/file-preview-tools.d.vue.ts +13 -0
  64. package/dist/runtime/file-preview/components/shell/file-preview-tools.vue +10 -0
  65. package/dist/runtime/file-preview/components/shell/file-preview-tools.vue.d.ts +13 -0
  66. package/dist/runtime/file-preview/composables/use-file-preview-api.d.ts +21 -0
  67. package/dist/runtime/file-preview/composables/use-file-preview-api.js +83 -0
  68. package/dist/runtime/file-preview/composables/use-file-preview-shell.d.ts +13 -0
  69. package/dist/runtime/file-preview/composables/use-file-preview-shell.js +30 -0
  70. package/dist/runtime/file-preview/composables/use-file-preview-source.d.ts +17 -0
  71. package/dist/runtime/file-preview/composables/use-file-preview-source.js +51 -0
  72. package/dist/runtime/file-preview/composables/use-file-preview-text.d.ts +14 -0
  73. package/dist/runtime/file-preview/composables/use-file-preview-text.js +79 -0
  74. package/dist/runtime/file-preview/index.d.ts +5 -0
  75. package/dist/runtime/file-preview/index.js +14 -0
  76. package/dist/runtime/file-preview/plugins/file-preview-api.d.ts +11 -0
  77. package/dist/runtime/file-preview/plugins/file-preview-api.js +10 -0
  78. package/dist/runtime/file-preview/types/api.d.ts +74 -0
  79. package/dist/runtime/file-preview/types/api.js +0 -0
  80. package/dist/runtime/file-preview/types/file.d.ts +77 -0
  81. package/dist/runtime/file-preview/types/file.js +0 -0
  82. package/dist/runtime/file-preview/types/index.d.ts +4 -0
  83. package/dist/runtime/file-preview/types/index.js +0 -0
  84. package/dist/runtime/file-preview/types/renderer.d.ts +49 -0
  85. package/dist/runtime/file-preview/types/renderer.js +0 -0
  86. package/dist/runtime/file-preview/types/shell.d.ts +12 -0
  87. package/dist/runtime/file-preview/types/shell.js +0 -0
  88. package/dist/runtime/file-preview/utils/container.d.ts +4 -0
  89. package/dist/runtime/file-preview/utils/container.js +10 -0
  90. package/dist/runtime/file-preview/utils/csv.d.ts +17 -0
  91. package/dist/runtime/file-preview/utils/csv.js +53 -0
  92. package/dist/runtime/file-preview/utils/download.d.ts +8 -0
  93. package/dist/runtime/file-preview/utils/download.js +40 -0
  94. package/dist/runtime/file-preview/utils/files.d.ts +7 -0
  95. package/dist/runtime/file-preview/utils/files.js +53 -0
  96. package/dist/runtime/file-preview/utils/format.d.ts +13 -0
  97. package/dist/runtime/file-preview/utils/format.js +40 -0
  98. package/dist/runtime/file-preview/utils/instance.d.ts +9 -0
  99. package/dist/runtime/file-preview/utils/instance.js +57 -0
  100. package/dist/runtime/file-preview/utils/renderers.d.ts +36 -0
  101. package/dist/runtime/file-preview/utils/renderers.js +247 -0
  102. package/dist/runtime/form/components/page/form-page-header.d.vue.ts +3 -1
  103. package/dist/runtime/form/components/page/form-page-header.vue +4 -4
  104. package/dist/runtime/form/components/page/form-page-header.vue.d.ts +3 -1
  105. package/dist/runtime/form/components/page/form-page-navigation.vue +2 -1
  106. package/dist/runtime/form/components/page/form-page-section.vue +15 -7
  107. package/dist/runtime/form/components/page/form-page.vue +0 -1
  108. package/dist/runtime/form/components/utils/form-file-preview.vue +5 -38
  109. package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
  110. package/dist/runtime/form/composables/use-form-page.js +3 -1
  111. package/dist/runtime/form/composables/use-form-runtime.js +3 -0
  112. package/dist/runtime/form/composables/use-form-upload-registry.d.ts +2 -0
  113. package/dist/runtime/form/composables/use-form-upload-registry.js +11 -6
  114. package/dist/runtime/form/composables/use-form-validation.js +5 -1
  115. package/dist/runtime/form/fields/array-list/use-array-items.d.ts +1 -1
  116. package/dist/runtime/form/fields/array-table/array-table-cell.d.vue.ts +15 -0
  117. package/dist/runtime/form/fields/array-table/array-table-cell.vue +58 -0
  118. package/dist/runtime/form/fields/array-table/array-table-cell.vue.d.ts +15 -0
  119. package/dist/runtime/form/fields/array-table/component.vue +42 -26
  120. package/dist/runtime/form/fields/date/types.d.ts +6 -1
  121. package/dist/runtime/form/fields/date-family/component.vue +7 -1
  122. package/dist/runtime/form/fields/date-family/utils.d.ts +8 -1
  123. package/dist/runtime/form/fields/date-family/utils.js +10 -2
  124. package/dist/runtime/form/fields/hidden/types.d.ts +8 -1
  125. package/dist/runtime/form/fields/upload/component.vue +55 -176
  126. package/dist/runtime/form/fields/upload/types.d.ts +68 -3
  127. package/dist/runtime/form/fields/upload/upload-item.d.vue.ts +24 -0
  128. package/dist/runtime/form/fields/upload/upload-item.vue +158 -0
  129. package/dist/runtime/form/fields/upload/upload-item.vue.d.ts +24 -0
  130. package/dist/runtime/form/fields/upload/use-upload-items.d.ts +44 -0
  131. package/dist/runtime/form/fields/upload/use-upload-items.js +317 -0
  132. package/dist/runtime/form/types/callbacks.d.ts +8 -2
  133. package/dist/runtime/form/types/controller.d.ts +6 -3
  134. package/dist/runtime/form/types/field-base.d.ts +5 -5
  135. package/dist/runtime/form/types/field-output-utils.d.ts +12 -1
  136. package/dist/runtime/form/types/field-output.d.ts +1 -1
  137. package/dist/runtime/form/types/field.d.ts +3 -2
  138. package/dist/runtime/form/types/form-api.d.ts +4 -2
  139. package/dist/runtime/form/types/options-runtime.d.ts +8 -4
  140. package/dist/runtime/form/types/options.d.ts +11 -11
  141. package/dist/runtime/form/types/output.d.ts +33 -10
  142. package/dist/runtime/form/types/page.d.ts +7 -3
  143. package/dist/runtime/form/types/transform.d.ts +5 -2
  144. package/dist/runtime/form/types/ui.d.ts +7 -3
  145. package/dist/runtime/form/types/upload-runtime.d.ts +4 -0
  146. package/dist/runtime/form/utils/page.js +24 -5
  147. package/dist/runtime/form/utils/state.js +14 -11
  148. package/dist/runtime/i18n/locales/en.js +104 -1
  149. package/dist/runtime/i18n/locales/fr.js +104 -1
  150. package/dist/runtime/i18n/types.d.ts +121 -0
  151. package/dist/runtime/query-state/composables.d.ts +2 -2
  152. package/dist/runtime/shared/styles/tokens.css +1 -1
  153. package/dist/runtime/shared/types/utils.d.ts +12 -4
  154. package/dist/runtime/shared/utils/file.d.ts +11 -0
  155. package/dist/runtime/shared/utils/file.js +50 -0
  156. package/dist/runtime/table/components/table/table-renderer.vue +23 -3
  157. package/dist/runtime/table/components/utils/search-query-input.d.vue.ts +5 -1
  158. package/dist/runtime/table/components/utils/search-query-input.vue +17 -3
  159. package/dist/runtime/table/components/utils/search-query-input.vue.d.ts +5 -1
  160. package/package.json +56 -29
  161. package/dist/runtime/form/components/renderer/form-field-error.vue +0 -16
@@ -97,6 +97,101 @@ export default defineUiToolsLocale({
97
97
  retry: "R\xE9essayer"
98
98
  }
99
99
  },
100
+ filePreview: {
101
+ close: "Fermer",
102
+ converted: {
103
+ description: "L\u2019original est un fichier {kind}.",
104
+ download: "T\xE9l\xE9charger l\u2019original",
105
+ title: "Aper\xE7u converti"
106
+ },
107
+ counter: "{current} / {total}",
108
+ csv: {
109
+ bom: "UTF-8 avec BOM",
110
+ columns: "{count} colonnes",
111
+ delimiter: "S\xE9parateur \xAB {value} \xBB",
112
+ rows: "{count} lignes",
113
+ tab: "tabulation"
114
+ },
115
+ details: "D\xE9tails",
116
+ download: "T\xE9l\xE9charger",
117
+ errors: {
118
+ decodeDescription: "T\xE9l\xE9chargez-le pour l\u2019ouvrir dans une autre application.",
119
+ decodeTitle: "Ce navigateur ne peut pas afficher les fichiers {extension}",
120
+ open: "Ouvrir",
121
+ pdfDescription: "Ouvrez-le dans la visionneuse du syst\xE8me ou t\xE9l\xE9chargez-le.",
122
+ pdfTitle: "Cet appareil ne peut pas afficher les PDF ici",
123
+ sourceDescription: "Le lien a peut-\xEAtre expir\xE9. R\xE9essayer le redemande.",
124
+ sourceTitle: "Impossible de charger ce fichier"
125
+ },
126
+ expand: "Agrandir",
127
+ fallback: {
128
+ description: "Les fichiers {extension} ne peuvent pas \xEAtre affich\xE9s ici. T\xE9l\xE9chargez-le pour l\u2019ouvrir dans une autre application.",
129
+ descriptionUnnamed: "Ce fichier ne peut pas \xEAtre affich\xE9 ici. T\xE9l\xE9chargez-le pour l\u2019ouvrir dans une autre application.",
130
+ title: "Aucun aper\xE7u disponible"
131
+ },
132
+ fields: {
133
+ columns: "Colonnes",
134
+ dimensions: "Dimensions",
135
+ duration: "Dur\xE9e",
136
+ lines: "Lignes",
137
+ modified: "Modifi\xE9 le",
138
+ name: "Nom",
139
+ rows: "Lignes",
140
+ size: "Taille",
141
+ type: "Type"
142
+ },
143
+ image: {
144
+ fit: "Ajuster \xE0 l\u2019\xE9cran",
145
+ rotate: "Pivoter",
146
+ zoomIn: "Zoom avant",
147
+ zoomOut: "Zoom arri\xE8re"
148
+ },
149
+ kinds: {
150
+ archive: "Archive",
151
+ audio: "Audio",
152
+ csv: "CSV",
153
+ image: "Image",
154
+ markdown: "Markdown",
155
+ office: "Document bureautique",
156
+ other: "Fichier",
157
+ pdf: "PDF",
158
+ text: "Texte",
159
+ video: "Vid\xE9o"
160
+ },
161
+ markdown: {
162
+ preview: "Aper\xE7u",
163
+ source: "Source"
164
+ },
165
+ media: {
166
+ captions: "Sous-titres",
167
+ exitFullscreen: "Quitter le plein \xE9cran",
168
+ fullscreen: "Plein \xE9cran",
169
+ mute: "Couper le son",
170
+ pause: "Pause",
171
+ pictureInPicture: "Image dans l\u2019image",
172
+ play: "Lecture",
173
+ seek: "Position",
174
+ speed: "Vitesse de lecture",
175
+ unmute: "R\xE9tablir le son",
176
+ volume: "Volume"
177
+ },
178
+ moreActions: "Plus d\u2019actions",
179
+ next: "Suivant",
180
+ openInNewTab: "Ouvrir dans un nouvel onglet",
181
+ position: "{current} sur {total} : {name}",
182
+ previous: "Pr\xE9c\xE9dent",
183
+ restore: "R\xE9duire",
184
+ retry: "R\xE9essayer",
185
+ text: {
186
+ copied: "Copi\xE9",
187
+ copy: "Copier le contenu",
188
+ formatted: "JSON format\xE9",
189
+ lines: "{count} lignes",
190
+ wrap: "Retour \xE0 la ligne"
191
+ },
192
+ truncated: "Affichage des {size} premiers sur {total}.",
193
+ untitled: "Fichier sans nom"
194
+ },
100
195
  form: {
101
196
  actions: {
102
197
  cancelButton: "Annuler",
@@ -144,7 +239,8 @@ export default defineUiToolsLocale({
144
239
  clear: "Effacer la valeur",
145
240
  confirm: "Confirmer",
146
241
  end: "Fin",
147
- start: "D\xE9but"
242
+ start: "D\xE9but",
243
+ tokens: { day: "jj", hour: "hh", minute: "mm", month: "mm", year: "aaaa" }
148
244
  },
149
245
  description: {
150
246
  close: "Fermer",
@@ -195,7 +291,14 @@ export default defineUiToolsLocale({
195
291
  minute: "Minute"
196
292
  },
197
293
  upload: {
294
+ cancel: "Annuler le t\xE9l\xE9versement",
198
295
  failed: "\xC9chec du t\xE9l\xE9versement.",
296
+ open: "Ouvrir le fichier",
297
+ pending: "T\xE9l\xE9versez ou retirez les fichiers s\xE9lectionn\xE9s avant d\u2019enregistrer.",
298
+ queued: "Pr\xEAt \xE0 t\xE9l\xE9verser",
299
+ replace: "Remplacer le fichier",
300
+ retry: "R\xE9essayer le t\xE9l\xE9versement",
301
+ uploading: "T\xE9l\xE9versement\u2026",
199
302
  remove: "Supprimer",
200
303
  upload: "T\xE9l\xE9verser"
201
304
  }
@@ -392,6 +392,13 @@ export interface UiToolsFormMessages {
392
392
  end: string;
393
393
  clear: string;
394
394
  confirm: string;
395
+ tokens: {
396
+ day: string;
397
+ month: string;
398
+ year: string;
399
+ hour: string;
400
+ minute: string;
401
+ };
395
402
  };
396
403
  time: {
397
404
  format: string;
@@ -407,6 +414,13 @@ export interface UiToolsFormMessages {
407
414
  upload: string;
408
415
  remove: string;
409
416
  failed: string;
417
+ open: string;
418
+ cancel: string;
419
+ retry: string;
420
+ replace: string;
421
+ uploading: string;
422
+ queued: string;
423
+ pending: string;
410
424
  };
411
425
  phone: {
412
426
  country: string;
@@ -528,8 +542,115 @@ export interface UiToolsDashboardMessages {
528
542
  };
529
543
  };
530
544
  }
545
+ export interface UiToolsFilePreviewMessages {
546
+ /** Name shown for a file that has none, such as a pasted image. */
547
+ untitled: string;
548
+ close: string;
549
+ expand: string;
550
+ restore: string;
551
+ previous: string;
552
+ next: string;
553
+ /** Gallery position in the header: "{current} / {total}". */
554
+ counter: string;
555
+ /** Announced on navigation: "{current} of {total}: {name}". */
556
+ position: string;
557
+ details: string;
558
+ download: string;
559
+ openInNewTab: string;
560
+ moreActions: string;
561
+ retry: string;
562
+ kinds: {
563
+ image: string;
564
+ video: string;
565
+ audio: string;
566
+ pdf: string;
567
+ text: string;
568
+ csv: string;
569
+ markdown: string;
570
+ office: string;
571
+ archive: string;
572
+ other: string;
573
+ };
574
+ fields: {
575
+ name: string;
576
+ type: string;
577
+ size: string;
578
+ modified: string;
579
+ dimensions: string;
580
+ duration: string;
581
+ lines: string;
582
+ rows: string;
583
+ columns: string;
584
+ };
585
+ converted: {
586
+ title: string;
587
+ /** "The original is a {kind} file." */
588
+ description: string;
589
+ download: string;
590
+ };
591
+ errors: {
592
+ sourceTitle: string;
593
+ sourceDescription: string;
594
+ /** "This browser can't display {extension} files". */
595
+ decodeTitle: string;
596
+ decodeDescription: string;
597
+ pdfTitle: string;
598
+ pdfDescription: string;
599
+ open: string;
600
+ };
601
+ fallback: {
602
+ title: string;
603
+ /** "{extension} files can't be shown here. Download it to open it in another app." */
604
+ description: string;
605
+ descriptionUnnamed: string;
606
+ };
607
+ /** "Showing the first {size} of {total}." */
608
+ truncated: string;
609
+ image: {
610
+ zoomIn: string;
611
+ zoomOut: string;
612
+ fit: string;
613
+ rotate: string;
614
+ };
615
+ media: {
616
+ play: string;
617
+ pause: string;
618
+ mute: string;
619
+ unmute: string;
620
+ volume: string;
621
+ speed: string;
622
+ captions: string;
623
+ pictureInPicture: string;
624
+ fullscreen: string;
625
+ exitFullscreen: string;
626
+ seek: string;
627
+ };
628
+ text: {
629
+ wrap: string;
630
+ copy: string;
631
+ copied: string;
632
+ /** "{count} lines" */
633
+ lines: string;
634
+ formatted: string;
635
+ };
636
+ csv: {
637
+ /** "{count} rows" */
638
+ rows: string;
639
+ /** "{count} columns" */
640
+ columns: string;
641
+ /** "Delimiter “{value}”" */
642
+ delimiter: string;
643
+ tab: string;
644
+ bom: string;
645
+ };
646
+ markdown: {
647
+ preview: string;
648
+ source: string;
649
+ };
650
+ }
531
651
  export interface Messages {
532
652
  dashboard: UiToolsDashboardMessages;
653
+ filePreview: UiToolsFilePreviewMessages;
533
654
  form: UiToolsFormMessages;
534
655
  table: UiToolsTableMessages;
535
656
  spreadsheet: UiToolsSpreadsheetMessages;
@@ -42,7 +42,7 @@ export declare function useQueryStateClient(options?: {
42
42
  /** History mode used by the lazily created client when individual writes omit one. */
43
43
  defaultHistoryMode?: HistoryMode;
44
44
  }): QueryStateClient;
45
- type ResolveDefaultedValue<TValue, TDefault> = undefined extends TDefault ? TValue : Exclude<TValue, undefined>;
45
+ type ResolveDefaultedValue<TValue, TDefault> = undefined extends TDefault ? TValue | undefined : Exclude<TValue, undefined>;
46
46
  interface UseQueryStateBaseOptions<TValue> {
47
47
  /** Query-string key to read from and write to. */
48
48
  key: string;
@@ -65,7 +65,7 @@ export type UseQueryStateOptions<TValue, TDefault = TValue> = UseQueryStateBaseO
65
65
  };
66
66
  export declare function useQueryState<TValue>(options: UseQueryStateBaseOptions<TValue> & {
67
67
  defaultValue: undefined;
68
- }): WritableComputedRef<TValue>;
68
+ }): WritableComputedRef<TValue | undefined>;
69
69
  export declare function useQueryState<TValue, TDefault extends Exclude<TValue, undefined>>(options: UseQueryStateBaseOptions<TValue> & {
70
70
  defaultValue: TDefault;
71
71
  }): WritableComputedRef<Exclude<TValue, undefined>>;
@@ -1 +1 @@
1
- :root{--nut-form-veil:rgba(31,29,26,.18)}.dark{--nut-form-veil:rgba(0,0,0,.45)}:where(:root){--nut-dash-s1:var(--ui-primary);--nut-dash-s2:var(--ui-color-neutral-400);--nut-dash-s3:var(--ui-secondary);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 20%,var(--ui-bg));--nut-dash-s5:var(--ui-warning);--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 35%,var(--ui-bg));--nut-dash-up:var(--ui-success);--nut-dash-up-mark:var(--nut-dash-up);--nut-dash-down:var(--ui-error);--nut-dash-muted:var(--ui-border-accented);--nut-dash-track:var(--ui-bg-elevated);--nut-dash-grid:var(--ui-border-muted);--nut-dash-axis:var(--ui-text-dimmed);--nut-dash-ref:var(--ui-text-dimmed);--nut-dash-ref-label:var(--ui-text-muted);--nut-dash-ghost:var(--ui-bg-accented);--nut-dash-ghost-shine:color-mix(in oklab,var(--ui-bg) 70%,transparent);--nut-dash-filter-active:color-mix(in oklab,var(--ui-primary) 9%,var(--ui-bg));--nut-dash-filter-active-line:color-mix(in oklab,var(--ui-primary) 35%,var(--ui-border));--nut-dash-filter-ink:var(--nut-dl-accent-ink,var(--ui-primary));--nut-dash-row-hover:var(--ui-bg-elevated)}:where(.dark){--nut-dash-s2:var(--ui-color-neutral-500);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 30%,var(--ui-bg));--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 40%,var(--ui-bg))}@supports (color:oklch(from red l c h)){:where(:root){--nut-dash-s4:oklch(from var(--ui-primary) 0.88 calc(c * 0.45) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.8 calc(c * 0.55) h)}:where(.dark){--nut-dash-s4:oklch(from var(--ui-primary) 0.42 calc(c * 0.6) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.45 calc(c * 0.65) h)}}.nut-dash-chart{--vis-font-family:inherit;--vis-axis-tick-label-color:var(--nut-dash-axis);--vis-axis-tick-label-font-size:10px;--vis-axis-grid-color:var(--nut-dash-grid);--vis-axis-domain-color:var(--nut-dash-grid);--vis-crosshair-line-stroke-color:var(--ui-border-accented);--vis-crosshair-circle-stroke-color:var(--ui-bg);--vis-tooltip-background-color:var(--ui-bg);--vis-tooltip-border-color:var(--ui-border);--vis-tooltip-text-color:var(--ui-text);--vis-tooltip-padding:8px 10px;--vis-tooltip-border-radius:calc(var(--ui-radius)*1.5);--vis-tooltip-shadow-color:rgb(0 0 0/8%);--vis-plotline-label-font-size:10px}.nut-dash-chart--bars [data-vis-component] rect:hover{opacity:.8}.nut-dash-tip{display:flex;flex-direction:column;font-size:12px;gap:4px;min-width:9rem}.nut-dash-tip-title{color:var(--ui-text-muted);font-weight:500}.nut-dash-tip-row{align-items:center;display:flex;gap:6px}.nut-dash-tip-row i{border-radius:2px;height:8px;width:8px}.nut-dash-tip-row span{color:var(--ui-text-muted);flex:1}.nut-dash-tip-row b{font-variant-numeric:tabular-nums;font-weight:600}.nut-dash-ghost{background:var(--nut-dash-ghost)}.nut-dash-shimmer{overflow:hidden;position:relative}.nut-dash-shimmer:after{animation:nut-dash-shimmer 1.6s ease-in-out infinite;background:linear-gradient(100deg,transparent 25%,var(--nut-dash-ghost-shine) 50%,transparent 75%);content:"";inset:0;pointer-events:none;position:absolute;transform:translateX(-100%);will-change:transform}@keyframes nut-dash-shimmer{to{transform:translateX(100%)}}.nut-dash-enter{animation:nut-dash-enter .28s ease-out}@keyframes nut-dash-enter{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}.nut-dash-progress{animation:nut-dash-progress 1.1s ease-in-out infinite}@keyframes nut-dash-progress{0%{transform:translateX(-100%)}to{transform:translateX(300%)}}@media (prefers-reduced-motion:reduce){.nut-dash-shimmer:after{display:none}.nut-dash-enter{animation:none}.nut-dash-progress{animation-duration:3s}}
1
+ :root{--nut-form-veil:rgba(31,29,26,.18)}.dark{--nut-form-veil:rgba(0,0,0,.45)}:where(:root){--nut-dash-s1:var(--ui-primary);--nut-dash-s2:var(--ui-color-neutral-400);--nut-dash-s3:var(--ui-secondary);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 20%,var(--ui-bg));--nut-dash-s5:var(--ui-warning);--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 35%,var(--ui-bg));--nut-dash-up:var(--ui-success);--nut-dash-up-mark:var(--nut-dash-up);--nut-dash-down:var(--ui-error);--nut-dash-muted:var(--ui-border-accented);--nut-dash-track:var(--ui-bg-elevated);--nut-dash-grid:var(--ui-border-muted);--nut-dash-axis:var(--ui-text-dimmed);--nut-dash-ref:var(--ui-text-dimmed);--nut-dash-ref-label:var(--ui-text-muted);--nut-dash-ghost:var(--ui-bg-accented);--nut-dash-ghost-shine:color-mix(in oklab,var(--ui-bg) 70%,transparent);--nut-dash-filter-active:color-mix(in oklab,var(--ui-primary) 9%,var(--ui-bg));--nut-dash-filter-active-line:color-mix(in oklab,var(--ui-primary) 35%,var(--ui-border));--nut-dash-filter-ink:var(--nut-dl-accent-ink,var(--ui-primary));--nut-dash-row-hover:var(--ui-bg-elevated)}:where(.dark){--nut-dash-s2:var(--ui-color-neutral-500);--nut-dash-s4:color-mix(in oklab,var(--ui-primary) 30%,var(--ui-bg));--nut-dash-s6:color-mix(in oklab,var(--ui-secondary) 40%,var(--ui-bg))}@supports (color:oklch(from red l c h)){:where(:root){--nut-dash-s4:oklch(from var(--ui-primary) 0.88 calc(c * 0.45) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.8 calc(c * 0.55) h)}:where(.dark){--nut-dash-s4:oklch(from var(--ui-primary) 0.42 calc(c * 0.6) h);--nut-dash-s6:oklch(from var(--ui-secondary) 0.45 calc(c * 0.65) h)}}.nut-dash-chart{--vis-font-family:inherit;--vis-axis-tick-label-color:var(--nut-dash-axis);--vis-axis-tick-label-font-size:10px;--vis-axis-grid-color:var(--nut-dash-grid);--vis-axis-domain-color:var(--nut-dash-grid);--vis-crosshair-line-stroke-color:var(--ui-border-accented);--vis-crosshair-circle-stroke-color:var(--ui-bg);--vis-tooltip-background-color:var(--ui-bg);--vis-tooltip-border-color:var(--ui-border);--vis-tooltip-text-color:var(--ui-text);--vis-tooltip-padding:8px 10px;--vis-tooltip-border-radius:calc(var(--ui-radius)*1.5);--vis-tooltip-shadow-color:rgb(0 0 0/8%);--vis-plotline-label-font-size:10px}.nut-dash-chart--bars [data-vis-component] rect:hover{opacity:.8}.nut-dash-tip{display:flex;flex-direction:column;font-size:12px;gap:4px;min-width:9rem}.nut-dash-tip-title{color:var(--ui-text-muted);font-weight:500}.nut-dash-tip-row{align-items:center;display:flex;gap:6px}.nut-dash-tip-row i{border-radius:2px;height:8px;width:8px}.nut-dash-tip-row span{color:var(--ui-text-muted);flex:1}.nut-dash-tip-row b{font-variant-numeric:tabular-nums;font-weight:600}.nut-dash-ghost{background:var(--nut-dash-ghost)}.nut-dash-shimmer{overflow:hidden;position:relative}.nut-dash-shimmer:after{animation:nut-dash-shimmer 1.6s ease-in-out infinite;background:linear-gradient(100deg,transparent 25%,var(--nut-dash-ghost-shine) 50%,transparent 75%);content:"";inset:0;pointer-events:none;position:absolute;transform:translateX(-100%);will-change:transform}@keyframes nut-dash-shimmer{to{transform:translateX(100%)}}.nut-dash-enter{animation:nut-dash-enter .28s ease-out}@keyframes nut-dash-enter{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}.nut-dash-progress{animation:nut-dash-progress 1.1s ease-in-out infinite}@keyframes nut-dash-progress{0%{transform:translateX(-100%)}to{transform:translateX(300%)}}@media (prefers-reduced-motion:reduce){.nut-dash-shimmer:after{display:none}.nut-dash-enter{animation:none}.nut-dash-progress{animation-duration:3s}}:where(:root){--nut-fp-veil:rgba(31,29,26,.4);--nut-fp-stage:var(--ui-bg-muted);--nut-fp-document:#525659;--nut-fp-checker-a:#fff;--nut-fp-checker-b:#ebe7e2;--nut-fp-token-key:var(--ui-primary);--nut-fp-token-string:var(--ui-success);--nut-fp-token-number:var(--ui-info);--nut-fp-token-literal:var(--ui-error)}:where(.dark){--nut-fp-veil:rgba(0,0,0,.62);--nut-fp-stage:var(--ui-bg);--nut-fp-checker-a:#e9e4dd;--nut-fp-checker-b:#d8d1c7}.nut-fp-checker{background-color:var(--nut-fp-checker-a);background-image:conic-gradient(var(--nut-fp-checker-b) 25%,transparent 0 50%,var(--nut-fp-checker-b) 0 75%,transparent 0);background-size:18px 18px}.nut-fp-code [data-token=key]{color:var(--nut-fp-token-key)}.nut-fp-code [data-token=string]{color:var(--nut-fp-token-string)}.nut-fp-code [data-token=number]{color:var(--nut-fp-token-number)}.nut-fp-code [data-token=literal]{color:var(--nut-fp-token-literal)}[data-file-preview-bottom][data-single]:has([data-file-preview-tools]:empty){display:none}@keyframes nut-fp-progress{0%{transform:translateX(-100%)}to{transform:translateX(300%)}}.nut-fp-progress{animation:nut-fp-progress 1s ease-in-out infinite}@keyframes nut-fp-equalizer{to{transform:scaleY(.45)}}.nut-fp-equalizer{animation:nut-fp-equalizer .9s ease-in-out infinite alternate}@media (prefers-reduced-motion:reduce){.nut-fp-progress{animation-duration:2.4s}.nut-fp-equalizer{animation:none}}.nut-fp-prose{color:var(--ui-text);font-size:.925rem;line-height:1.7}.nut-fp-prose>:first-child{margin-top:0}.nut-fp-prose :where(h1,h2,h3,h4){color:var(--ui-text-highlighted);font-weight:650;letter-spacing:-.01em;line-height:1.25;margin:1.75em 0 .6em}.nut-fp-prose h1{font-size:1.6em}.nut-fp-prose h2{font-size:1.25em}.nut-fp-prose h3{font-size:1.05em}.nut-fp-prose :where(p,ul,ol,pre,table,blockquote){margin:0 0 1em}.nut-fp-prose :where(ul,ol){padding-inline-start:1.4em}.nut-fp-prose ul{list-style:disc}.nut-fp-prose ol{list-style:decimal}.nut-fp-prose a{color:var(--ui-primary);text-decoration:underline;text-underline-offset:2px}.nut-fp-prose :not(pre)>code{background:var(--ui-bg-elevated);border:1px solid var(--ui-border-muted);border-radius:4px;font-size:.86em;padding:.1em .35em}.nut-fp-prose pre{background:var(--ui-bg-elevated);border:1px solid var(--ui-border);border-radius:8px;font-size:.85em;overflow-x:auto;padding:.9em 1.1em}.nut-fp-prose table{border-collapse:collapse;display:block;font-size:.9em;overflow-x:auto}.nut-fp-prose :where(th,td){border:1px solid var(--ui-border);padding:.4em .75em;text-align:start}.nut-fp-prose th{background:var(--ui-bg-elevated);font-weight:600}.nut-fp-prose blockquote{border-inline-start:3px solid var(--ui-primary);color:var(--ui-text-toned);padding-inline-start:1em}.nut-fp-prose img{border-radius:6px;max-width:100%}
@@ -36,7 +36,9 @@ export type InferParams<T> = T extends (params: infer P) => any ? P : never;
36
36
  export type Prettify<T> = {
37
37
  [K in keyof T]: T[K];
38
38
  } & NonNullable<unknown>;
39
- export type DeepPrettify<T> = T extends (infer U)[] ? DeepPrettify<U>[] : T extends object ? {
39
+ export type DeepPrettify<T> = T extends readonly unknown[] ? {
40
+ [K in keyof T]: DeepPrettify<T[K]>;
41
+ } : T extends object ? {
40
42
  [K in keyof T]: DeepPrettify<T[K]>;
41
43
  } & NonNullable<unknown> : T;
42
44
  export type PathToObject<Path extends string, Output> = Path extends `${infer First}.${infer Rest}` ? {
@@ -44,15 +46,21 @@ export type PathToObject<Path extends string, Output> = Path extends `${infer Fi
44
46
  } : {
45
47
  [K in Path]: Output;
46
48
  };
47
- export type RemoveDotKeys<T> = T extends (infer U)[] ? RemoveDotKeys<U>[] : {
49
+ export type RemoveDotKeys<T> = T extends readonly unknown[] ? {
50
+ [I in keyof T]: RemoveDotKeys<T[I]>;
51
+ } : {
48
52
  [K in keyof T as K extends `${string}.${string}` ? never : K]: T[K] extends object ? RemoveDotKeys<T[K]> : T[K];
49
53
  };
50
54
  export type DeepTransformNestedPaths<T> = T extends unknown ? DeepTransformNestedPathsMember<T> : never;
51
55
  type DeepTransformNestedPathsMember<T> = DeepPrettify<RemoveDotKeys<{
52
- [K in keyof T]: T[K] extends (infer U)[] ? DeepTransformNestedPaths<U>[] : T[K] extends object ? DeepTransformNestedPaths<T[K]> : T[K];
56
+ [K in keyof T]: T[K] extends readonly unknown[] ? DeepTransformNestedPathsItems<T[K]> : T[K] extends object ? DeepTransformNestedPaths<T[K]> : T[K];
53
57
  } & UnionToIntersection<{
54
- [K in Extract<keyof T, string>]: PathToObject<K, T[K] extends (infer U)[] ? U extends object ? DeepTransformNestedPaths<U>[] : T[K] : T[K] extends object ? DeepTransformNestedPaths<T[K]> : T[K]>;
58
+ [K in Extract<keyof T, string>]: PathToObject<K, T[K] extends readonly unknown[] ? DeepTransformNestedPathsItems<T[K]> : T[K] extends object ? DeepTransformNestedPaths<T[K]> : T[K]>;
55
59
  }[Extract<keyof T, string>]>>>;
60
+ /** Maps the items of an array or tuple, keeping it an array or tuple and keeping `readonly`. */
61
+ type DeepTransformNestedPathsItems<T extends readonly unknown[]> = {
62
+ [I in keyof T]: T[I] extends object ? DeepTransformNestedPaths<T[I]> : T[I];
63
+ };
56
64
  export type SplitLitteral<String extends string, Divider extends string> = string extends String ? string[] : String extends '' ? [] : String extends `${infer T}${Divider}${infer U}` ? [T, ...SplitLitteral<U, Divider>] : [String];
57
65
  export type HasParameters<T> = T extends (...args: []) => any ? false : true;
58
66
  export type DeepOmit<T, K extends string> = K extends `${infer First}.${infer Rest}` ? First extends keyof T ? T[First] extends (infer U)[] ? Omit<T, First> & {
@@ -0,0 +1,11 @@
1
+ export declare function fileIconName(type: string | null | undefined): "i-lucide-file-spreadsheet" | "i-lucide-file-text" | "i-lucide-file-image" | "i-lucide-file-video" | "i-lucide-file-audio" | "i-lucide-file-type" | "i-lucide-file-archive" | "i-lucide-file";
2
+ /** Lowercase extension of a file name without the dot, or `null` when it has none. */
3
+ export declare function fileExtension(name: string): string | null;
4
+ export declare function fileExtensionLabel(file: {
5
+ name: string;
6
+ type?: string | null;
7
+ }): string;
8
+ /** Formats bytes with the locale's units: "2 kB" in English, "2 ko" in French. */
9
+ export declare function formatFileSize(bytes: number, locale: string): string;
10
+ export declare function fileNameFromUrl(url: string): string;
11
+ export declare function isImageType(type: string | null | undefined): boolean;
@@ -0,0 +1,50 @@
1
+ const FILE_SIZE_UNITS = ["byte", "kilobyte", "megabyte", "gigabyte"];
2
+ export function fileIconName(type) {
3
+ const mime = type ?? "";
4
+ if (mime === "application/pdf") return "i-lucide-file-text";
5
+ if (mime.startsWith("image/")) return "i-lucide-file-image";
6
+ if (mime.startsWith("video/")) return "i-lucide-file-video";
7
+ if (mime.startsWith("audio/")) return "i-lucide-file-audio";
8
+ if (mime.includes("spreadsheet") || mime.includes("excel") || mime === "text/csv")
9
+ return "i-lucide-file-spreadsheet";
10
+ if (mime.includes("word") || mime.includes("document")) return "i-lucide-file-type";
11
+ if (mime.includes("zip") || mime.includes("compressed")) return "i-lucide-file-archive";
12
+ return "i-lucide-file";
13
+ }
14
+ export function fileExtension(name) {
15
+ const dot = name.lastIndexOf(".");
16
+ if (dot === -1 || dot === name.length - 1) return null;
17
+ return name.slice(dot + 1).toLowerCase();
18
+ }
19
+ export function fileExtensionLabel(file) {
20
+ const dot = file.name.lastIndexOf(".");
21
+ if (dot !== -1) return file.name.slice(dot + 1).toUpperCase();
22
+ const subtype = file.type?.split("/")[1]?.split(/[+.;-]/)[0];
23
+ return subtype ? subtype.toUpperCase() : "\u2014";
24
+ }
25
+ export function formatFileSize(bytes, locale) {
26
+ let size = bytes;
27
+ let unit = 0;
28
+ while (size >= 1024 && unit < FILE_SIZE_UNITS.length - 1) {
29
+ size /= 1024;
30
+ unit += 1;
31
+ }
32
+ return new Intl.NumberFormat(locale, {
33
+ maximumFractionDigits: unit > 0 && size < 10 ? 1 : 0,
34
+ style: "unit",
35
+ unit: FILE_SIZE_UNITS[unit],
36
+ unitDisplay: "short"
37
+ }).format(size);
38
+ }
39
+ export function fileNameFromUrl(url) {
40
+ const parts = (url.split(/[?#]/)[0] ?? "").split("/").filter((part) => part.length > 0);
41
+ const segment = parts.at(-1) ?? url;
42
+ try {
43
+ return decodeURIComponent(segment);
44
+ } catch {
45
+ return segment;
46
+ }
47
+ }
48
+ export function isImageType(type) {
49
+ return Boolean(type?.startsWith("image/"));
50
+ }
@@ -182,13 +182,33 @@ const columnVirtualizer = useVirtualizer(
182
182
  }))
183
183
  );
184
184
  const virtualColumns = computed(() => columnVirtualizer.value.getVirtualItems());
185
- const filled = computed(
186
- () => !columnsOverflow.value && bodyWidth.value > 0 && table.getTotalSize() < bodyWidth.value
185
+ const spareWidth = computed(
186
+ () => columnsOverflow.value || bodyWidth.value <= 0 ? 0 : Math.max(0, bodyWidth.value - table.getTotalSize())
187
187
  );
188
+ const growableColumns = computed(
189
+ () => centerColumns.value.filter((column) => !column.columnDef.meta?.internal)
190
+ );
191
+ const columnWidths = computed(() => {
192
+ const widths = new Map(leafColumns.value.map((leaf) => [leaf.id, leaf.getSize()]));
193
+ const spare = spareWidth.value;
194
+ const growable = growableColumns.value;
195
+ const base = growable.reduce((sum, column) => sum + column.getSize(), 0);
196
+ if (spare === 0 || base === 0) {
197
+ return widths;
198
+ }
199
+ let remaining = spare;
200
+ growable.forEach((column, index) => {
201
+ const share = index === growable.length - 1 ? remaining : Math.floor(spare * column.getSize() / base);
202
+ widths.set(column.id, column.getSize() + share);
203
+ remaining -= share;
204
+ });
205
+ return widths;
206
+ });
207
+ const filled = computed(() => spareWidth.value > 0 && growableColumns.value.length === 0);
188
208
  const tableCols = computed(() => {
189
209
  const cols = leafColumns.value.map((leaf) => ({
190
210
  key: leaf.id,
191
- width: `${leaf.getSize()}px`
211
+ width: `${columnWidths.value.get(leaf.id) ?? leaf.getSize()}px`
192
212
  }));
193
213
  if (filled.value) {
194
214
  cols.splice(cols.length - table.getEndVisibleLeafColumns().length, 0, {
@@ -5,6 +5,8 @@ type __VLS_Props = {
5
5
  size: DataListControlSize;
6
6
  ui?: DataListSearchUi;
7
7
  inputProps?: DataListInputProps;
8
+ /** Milliseconds of typing inactivity before the query is applied. */
9
+ debounce?: number;
8
10
  };
9
11
  type __VLS_ModelProps = {
10
12
  modelValue: string;
@@ -14,6 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
16
  "update:modelValue": (value: string) => any;
15
17
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
18
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ }>, {
20
+ debounce: number;
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
22
  declare const _default: typeof __VLS_export;
19
23
  export default _default;
@@ -1,19 +1,21 @@
1
1
  <script setup>
2
2
  import UButton from "@nuxt/ui/components/Button.vue";
3
3
  import UInput from "@nuxt/ui/components/Input.vue";
4
- import { computed, ref, watch } from "vue";
4
+ import { computed, onBeforeUnmount, ref, watch } from "vue";
5
5
  import { useUiToolsLocale } from "#ui-tools/i18n";
6
6
  const props = defineProps({
7
7
  placeholder: { type: String, required: true },
8
8
  loading: { type: Boolean, required: false },
9
9
  size: { type: String, required: true },
10
10
  ui: { type: Object, required: false },
11
- inputProps: { type: Object, required: false }
11
+ inputProps: { type: Object, required: false },
12
+ debounce: { type: Number, required: false, default: 300 }
12
13
  });
13
14
  const model = defineModel({ type: String, ...{ required: true } });
14
15
  const { t } = useUiToolsLocale();
15
16
  const localValue = ref(model.value);
16
17
  const input = ref(null);
18
+ let pending;
17
19
  watch(
18
20
  model,
19
21
  (value) => {
@@ -31,17 +33,29 @@ const inputAttrs = computed(() => ({
31
33
  ...props.inputProps
32
34
  }));
33
35
  const clearable = computed(() => localValue.value.length > 0);
36
+ function cancelPending() {
37
+ clearTimeout(pending);
38
+ pending = void 0;
39
+ }
34
40
  function commitValue() {
41
+ cancelPending();
35
42
  if (localValue.value === model.value) {
36
43
  return;
37
44
  }
38
45
  model.value = localValue.value;
39
46
  }
47
+ function updateValue(value) {
48
+ localValue.value = String(value ?? "");
49
+ cancelPending();
50
+ pending = setTimeout(commitValue, props.debounce);
51
+ }
40
52
  function clear() {
53
+ cancelPending();
41
54
  localValue.value = "";
42
55
  model.value = "";
43
56
  input.value?.inputRef?.focus();
44
57
  }
58
+ onBeforeUnmount(cancelPending);
45
59
  </script>
46
60
 
47
61
  <template>
@@ -54,7 +68,7 @@ function clear() {
54
68
  :placeholder="placeholder"
55
69
  :ui="ui"
56
70
  class="nut-dl-search max-w-full shrink-0"
57
- @update:model-value="localValue = String($event ?? '')"
71
+ @update:model-value="updateValue"
58
72
  @blur="commitValue"
59
73
  @keydown.enter.prevent="commitValue"
60
74
  @keydown.escape="clearable && clear()"
@@ -5,6 +5,8 @@ type __VLS_Props = {
5
5
  size: DataListControlSize;
6
6
  ui?: DataListSearchUi;
7
7
  inputProps?: DataListInputProps;
8
+ /** Milliseconds of typing inactivity before the query is applied. */
9
+ debounce?: number;
8
10
  };
9
11
  type __VLS_ModelProps = {
10
12
  modelValue: string;
@@ -14,6 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
16
  "update:modelValue": (value: string) => any;
15
17
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
18
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ }>, {
20
+ debounce: number;
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
22
  declare const _default: typeof __VLS_export;
19
23
  export default _default;