@ac-design/design-system 1.0.3 → 2.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 (235) hide show
  1. package/README.md +27 -18
  2. package/dist/lib/charts/ChartFrame.js +5 -0
  3. package/dist/lib/charts/ChartFrame.vue.d.ts +71 -0
  4. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +173 -0
  5. package/dist/lib/charts/cartesian.d.ts +324 -0
  6. package/dist/lib/charts/cartesian.js +137 -0
  7. package/dist/lib/charts/echarts.d.ts +86 -0
  8. package/dist/lib/charts/echarts.js +173 -0
  9. package/dist/lib/charts/graph.d.ts +77 -0
  10. package/dist/lib/charts/graph.js +155 -0
  11. package/dist/lib/charts/index.d.ts +11 -0
  12. package/dist/lib/charts/index.js +7 -0
  13. package/dist/lib/charts/shared.d.ts +53 -0
  14. package/dist/lib/charts/shared.js +96 -0
  15. package/dist/lib/charts/xy.d.ts +69 -0
  16. package/dist/lib/charts/xy.js +73 -0
  17. package/dist/lib/compat.css +2770 -1061
  18. package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +2 -2
  19. package/dist/lib/components/AcAccordionItem.vue.d.ts +1 -1
  20. package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +5 -5
  21. package/dist/lib/components/AcAlert.vue.d.ts +10 -1
  22. package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +139 -45
  23. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +19 -19
  24. package/dist/lib/components/AcAreaChart.js +5 -0
  25. package/dist/lib/components/AcAreaChart.vue.d.ts +47 -0
  26. package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +205 -0
  27. package/dist/lib/components/AcAvatar.vue.d.ts +7 -4
  28. package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +66 -61
  29. package/dist/lib/components/AcBadge.vue.d.ts +20 -7
  30. package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +67 -44
  31. package/dist/lib/components/AcBanner.vue.d.ts +1 -1
  32. package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +30 -30
  33. package/dist/lib/components/AcBarChart.js +5 -0
  34. package/dist/lib/components/AcBarChart.vue.d.ts +46 -0
  35. package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +213 -0
  36. package/dist/lib/components/AcBreadcrumb.vue.d.ts +4 -1
  37. package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +36 -34
  38. package/dist/lib/components/AcBulkActionBar.js +5 -0
  39. package/dist/lib/components/AcBulkActionBar.vue.d.ts +45 -0
  40. package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +84 -0
  41. package/dist/lib/components/AcButton.vue.d.ts +13 -7
  42. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +93 -47
  43. package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +1 -1
  44. package/dist/lib/components/AcCard.vue.d.ts +42 -3
  45. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +175 -14
  46. package/dist/lib/components/AcCellValue.vue.d.ts +6 -3
  47. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +219 -178
  48. package/dist/lib/components/AcCheckBox.vue.d.ts +17 -3
  49. package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +113 -30
  50. package/dist/lib/components/AcCheckList.js +5 -0
  51. package/dist/lib/components/AcCheckList.vue.d.ts +45 -0
  52. package/dist/lib/components/AcCheckList.vue_vue_type_script_setup_true_lang.js +64 -0
  53. package/dist/lib/components/AcCheckRadio.vue.d.ts +30 -5
  54. package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +102 -26
  55. package/dist/lib/components/AcCircularProgress.js +5 -0
  56. package/dist/lib/components/AcCircularProgress.vue.d.ts +44 -0
  57. package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +114 -0
  58. package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +142 -167
  59. package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +9 -9
  60. package/dist/lib/components/AcColorInput.js +5 -0
  61. package/dist/lib/components/AcColorInput.vue.d.ts +57 -0
  62. package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +217 -0
  63. package/dist/lib/components/AcCommandBlock.js +5 -0
  64. package/dist/lib/components/AcCommandBlock.vue.d.ts +34 -0
  65. package/dist/lib/components/AcCommandBlock.vue_vue_type_script_setup_true_lang.js +88 -0
  66. package/dist/lib/components/AcConfirmModal.js +5 -0
  67. package/dist/lib/components/AcConfirmModal.vue.d.ts +56 -0
  68. package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +96 -0
  69. package/dist/lib/components/AcContentHeader.vue.d.ts +1 -1
  70. package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +5 -4
  71. package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +2 -2
  72. package/dist/lib/components/AcCopyButton.js +5 -0
  73. package/dist/lib/components/AcCopyButton.vue.d.ts +43 -0
  74. package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +92 -0
  75. package/dist/lib/components/AcCostSummary.js +5 -0
  76. package/dist/lib/components/AcCostSummary.vue.d.ts +102 -0
  77. package/dist/lib/components/AcCostSummary.vue_vue_type_script_setup_true_lang.js +179 -0
  78. package/dist/lib/components/AcDatePicker.vue.d.ts +8 -8
  79. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +634 -417
  80. package/dist/lib/components/AcDeleteModal.vue.d.ts +4 -4
  81. package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +57 -60
  82. package/dist/lib/components/AcDonutChart.js +5 -0
  83. package/dist/lib/components/AcDonutChart.vue.d.ts +83 -0
  84. package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +237 -0
  85. package/dist/lib/components/AcDropdown.vue.d.ts +5 -2
  86. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +91 -78
  87. package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +11 -10
  88. package/dist/lib/components/AcDropdownItem.vue.d.ts +2 -2
  89. package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +18 -18
  90. package/dist/lib/components/AcEmptyState.vue.d.ts +4 -1
  91. package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +50 -39
  92. package/dist/lib/components/AcErrorState.js +5 -0
  93. package/dist/lib/components/AcErrorState.vue.d.ts +46 -0
  94. package/dist/lib/components/AcErrorState.vue_vue_type_script_setup_true_lang.js +66 -0
  95. package/dist/lib/components/AcFeatureCard.vue.d.ts +6 -0
  96. package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +139 -116
  97. package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +16 -16
  98. package/dist/lib/components/AcFileUpload.vue.d.ts +2 -2
  99. package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +55 -53
  100. package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +2 -2
  101. package/dist/lib/components/AcFooter.js +5 -0
  102. package/dist/lib/components/AcFooter.vue.d.ts +37 -0
  103. package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +107 -0
  104. package/dist/lib/components/AcForm.vue.d.ts +3 -0
  105. package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +4 -2
  106. package/dist/lib/components/AcFormArray.vue.d.ts +2 -2
  107. package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +149 -147
  108. package/dist/lib/components/AcFormFooter.vue.d.ts +3 -3
  109. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +2 -2
  110. package/dist/lib/components/AcFormSection.vue.d.ts +8 -1
  111. package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +31 -21
  112. package/dist/lib/components/AcGraphChart.js +5 -0
  113. package/dist/lib/components/AcGraphChart.vue.d.ts +124 -0
  114. package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +578 -0
  115. package/dist/lib/components/AcHeader.vue.d.ts +20 -5
  116. package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +82 -28
  117. package/dist/lib/components/AcInfoTable.vue.d.ts +1 -1
  118. package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +17 -13
  119. package/dist/lib/components/AcInput.vue.d.ts +4 -4
  120. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +99 -91
  121. package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +1 -1
  122. package/dist/lib/components/AcKeyValueInput.js +5 -0
  123. package/dist/lib/components/AcKeyValueInput.vue.d.ts +114 -0
  124. package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +336 -0
  125. package/dist/lib/components/AcLineChart.js +5 -0
  126. package/dist/lib/components/AcLineChart.vue.d.ts +44 -0
  127. package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +175 -0
  128. package/dist/lib/components/AcLoader.js +5 -0
  129. package/dist/lib/components/AcLoader.vue.d.ts +15 -0
  130. package/dist/lib/components/AcLoader.vue_vue_type_script_setup_true_lang.js +66 -0
  131. package/dist/lib/components/AcLocaleSwitcher.js +5 -0
  132. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +48 -0
  133. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +111 -0
  134. package/dist/lib/components/AcMapChart.js +5 -0
  135. package/dist/lib/components/AcMapChart.vue.d.ts +136 -0
  136. package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +518 -0
  137. package/dist/lib/components/AcModal.vue.d.ts +6 -3
  138. package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +88 -64
  139. package/dist/lib/components/AcNavbar.vue.d.ts +8 -5
  140. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +29 -21
  141. package/dist/lib/components/AcNavbarItem.vue.d.ts +2 -2
  142. package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +23 -24
  143. package/dist/lib/components/AcNotificationMenu.vue.d.ts +3 -3
  144. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +139 -174
  145. package/dist/lib/components/AcNumberInput.js +5 -0
  146. package/dist/lib/components/AcNumberInput.vue.d.ts +79 -0
  147. package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +241 -0
  148. package/dist/lib/components/AcPage.vue.d.ts +2 -2
  149. package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +2 -2
  150. package/dist/lib/components/AcPagination.vue.d.ts +22 -5
  151. package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +87 -56
  152. package/dist/lib/components/AcPreloader.vue.d.ts +3 -3
  153. package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +15 -16
  154. package/dist/lib/components/AcProductHero.js +5 -0
  155. package/dist/lib/components/AcProductHero.vue.d.ts +56 -0
  156. package/dist/lib/components/AcProductHero.vue_vue_type_script_setup_true_lang.js +95 -0
  157. package/dist/lib/components/AcProgress.vue.d.ts +19 -4
  158. package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +85 -31
  159. package/dist/lib/components/AcResourceCard.vue.d.ts +3 -3
  160. package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +17 -17
  161. package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
  162. package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +14 -9
  163. package/dist/lib/components/AcSectionContent.vue.d.ts +2 -2
  164. package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +8 -8
  165. package/dist/lib/components/AcSegmentedControl.vue.d.ts +1 -1
  166. package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +4 -4
  167. package/dist/lib/components/AcSelect.vue.d.ts +6 -6
  168. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +246 -254
  169. package/dist/lib/components/AcSettingsRow.js +5 -0
  170. package/dist/lib/components/AcSettingsRow.vue.d.ts +29 -0
  171. package/dist/lib/components/AcSettingsRow.vue_vue_type_script_setup_true_lang.js +37 -0
  172. package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +32 -32
  173. package/dist/lib/components/AcSideTabs.vue.d.ts +2 -2
  174. package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +37 -37
  175. package/dist/lib/components/AcSidebar.vue.d.ts +6 -3
  176. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +67 -57
  177. package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
  178. package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +46 -45
  179. package/dist/lib/components/AcSidebarSection.vue.d.ts +2 -2
  180. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +23 -18
  181. package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +8 -8
  182. package/dist/lib/components/AcSlider.vue.d.ts +1 -1
  183. package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +174 -172
  184. package/dist/lib/components/AcStatCard.vue.d.ts +3 -3
  185. package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +90 -85
  186. package/dist/lib/components/AcStatusBar.vue.d.ts +1 -1
  187. package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +6 -6
  188. package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +28 -28
  189. package/dist/lib/components/AcSwitch.vue.d.ts +3 -0
  190. package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +31 -19
  191. package/dist/lib/components/AcSwitchCard.js +5 -0
  192. package/dist/lib/components/AcSwitchCard.vue.d.ts +59 -0
  193. package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +121 -0
  194. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +97 -97
  195. package/dist/lib/components/AcTabs.vue.d.ts +9 -2
  196. package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +43 -28
  197. package/dist/lib/components/AcTag.vue.d.ts +2 -2
  198. package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +22 -22
  199. package/dist/lib/components/AcTagInput.js +5 -0
  200. package/dist/lib/components/AcTagInput.vue.d.ts +74 -0
  201. package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +289 -0
  202. package/dist/lib/components/AcTextarea.vue.d.ts +4 -4
  203. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +85 -63
  204. package/dist/lib/components/AcThemeMode.vue.d.ts +3 -3
  205. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +56 -24
  206. package/dist/lib/components/AcTimePicker.js +5 -0
  207. package/dist/lib/components/AcTimePicker.vue.d.ts +65 -0
  208. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +455 -0
  209. package/dist/lib/components/AcToaster.vue.d.ts +6 -3
  210. package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +115 -82
  211. package/dist/lib/components/AcTooltip.vue.d.ts +34 -14
  212. package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +203 -79
  213. package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +27 -27
  214. package/dist/lib/components/AcUserMenu.vue.d.ts +23 -1
  215. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +166 -115
  216. package/dist/lib/components/index.d.ts +21 -2
  217. package/dist/lib/components/status.d.ts +28 -0
  218. package/dist/lib/components/status.js +125 -0
  219. package/dist/lib/composables/copyText.d.ts +2 -1
  220. package/dist/lib/composables/copyText.js +2 -2
  221. package/dist/lib/composables/useApiPagination.d.ts +55 -0
  222. package/dist/lib/composables/useApiPagination.js +58 -0
  223. package/dist/lib/composables/useBulkSelection.d.ts +44 -0
  224. package/dist/lib/composables/useBulkSelection.js +41 -0
  225. package/dist/lib/composables/useFormValidation.d.ts +65 -0
  226. package/dist/lib/composables/useFormValidation.js +148 -0
  227. package/dist/lib/composables/useTablePagination.d.ts +49 -0
  228. package/dist/lib/composables/useTablePagination.js +41 -0
  229. package/dist/lib/composables/useToast.d.ts +17 -1
  230. package/dist/lib/composables/useToast.js +10 -2
  231. package/dist/lib/editor/theme.js +65 -62
  232. package/dist/lib/index.d.ts +21 -3
  233. package/dist/lib/index.js +99 -75
  234. package/dist/lib/theme.css +377 -273
  235. package/package.json +20 -4
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Copies text to the clipboard. Uses the async Clipboard API, which browsers only expose on
3
3
  * HTTPS and localhost, and falls back to a hidden textarea + `execCommand("copy")` so copying
4
- * still works on plain-HTTP hosts such as `http://bb.test`. Throws when both are blocked.
4
+ * still works on plain-HTTP hosts such as `http://bb.test`, or when the API rejects (permission denied).
5
+ * Throws when both are blocked.
5
6
  */
6
7
  export declare function copyText(text: string): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  //#region src/lib/composables/copyText.ts
2
2
  async function e(e) {
3
- if (navigator.clipboard?.writeText) {
3
+ if (navigator.clipboard?.writeText) try {
4
4
  await navigator.clipboard.writeText(e);
5
5
  return;
6
- }
6
+ } catch {}
7
7
  let t = document.createElement("textarea");
8
8
  t.value = e, t.setAttribute("readonly", ""), t.style.cssText = "position:fixed;top:0;left:0;opacity:0", document.body.appendChild(t), t.select();
9
9
  try {
@@ -0,0 +1,55 @@
1
+ import type { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
2
+ export interface UseApiPaginationOptions {
3
+ /** Rows per page to start with. Default 10. */
4
+ pageSize?: number;
5
+ /** The next-page token of the latest response, e.g. `() => data.value?.pagination?.nextPageToken`. An empty string means it's the last page; `undefined` (still loading) is ignored. Without it, call `setNextToken` yourself. */
6
+ nextToken?: MaybeRefOrGetter<string | null | undefined>;
7
+ /** Total rows, when the API returns one. Passed on to AcPagination's `total`; bigint is accepted. */
8
+ total?: MaybeRefOrGetter<number | bigint | null | undefined>;
9
+ /** Rows in the latest response, for the "Showing 41–60" summary when there's no total. */
10
+ itemsOnPage?: MaybeRefOrGetter<number | bigint | null | undefined>;
11
+ }
12
+ export interface ApiPaginationProps {
13
+ total?: number;
14
+ hasNext: boolean;
15
+ hasPrev: boolean;
16
+ knownPages: number[];
17
+ itemsOnPage?: number;
18
+ }
19
+ export interface ApiPagination {
20
+ /** The current page, from 1. Bind to AcPagination with `v-model:page`; pages without a cached token are refused. */
21
+ page: Ref<number>;
22
+ /** Rows per page. Bind with `v-model:page-size`; a change goes back to page 1 and forgets the tokens. */
23
+ pageSize: Ref<number>;
24
+ /** The token to request the current page with. Empty on page 1. */
25
+ pageToken: ComputedRef<string>;
26
+ /** Cached tokens by page number. Page 1 is always `""`. */
27
+ tokens: Readonly<Ref<Readonly<Record<number, string>>>>;
28
+ /** Pages with a cached token, so the viewer can jump to them. */
29
+ knownPages: ComputedRef<number[]>;
30
+ hasNext: ComputedRef<boolean>;
31
+ hasPrev: ComputedRef<boolean>;
32
+ /** Moves to the next page if its token is known. */
33
+ next: () => void;
34
+ /** Moves to the previous page. */
35
+ prev: () => void;
36
+ /** Moves to `page` if its token is known; returns whether it moved. */
37
+ goTo: (page: number) => boolean;
38
+ /** Goes back to page 1 and forgets every token. Call it when a filter or search changes. */
39
+ reset: () => void;
40
+ /** Records the next-page token from a response for `forPage` (default the current page). `""` marks it as the last page. */
41
+ setNextToken: (token: string | null | undefined, forPage?: number) => void;
42
+ /** AcPagination props that aren't models: `v-bind="paginationProps"`. */
43
+ paginationProps: ComputedRef<ApiPaginationProps>;
44
+ }
45
+ /**
46
+ * Tracks token (cursor) paging for an API that returns a next-page token instead of offsets.
47
+ *
48
+ * It doesn't fetch. Request the page with `pageSize` and `pageToken`, and feed the response's
49
+ * next-page token back through `nextToken` (or `setNextToken`). Each token is cached under its page
50
+ * number, so visited pages can be jumped to. Bind it to AcPagination:
51
+ * `<AcPagination v-model:page="page" v-model:page-size="pageSize" v-bind="paginationProps" />`.
52
+ *
53
+ * @param options Start page size, and getters for the response's next token, total and row count. A number sets only the page size.
54
+ */
55
+ export declare function useApiPagination(options?: UseApiPaginationOptions | number): ApiPagination;
@@ -0,0 +1,58 @@
1
+ import { computed as e, getCurrentScope as t, ref as n, toValue as r, watch as i } from "vue";
2
+ //#region src/lib/composables/useApiPagination.ts
3
+ function a(e) {
4
+ return e == null ? void 0 : Number(e);
5
+ }
6
+ function o(o = {}) {
7
+ let s = typeof o == "number" ? { pageSize: o } : o, c = n(1), l = n(s.pageSize ?? 10), u = n({ 1: "" }), d = e(() => u.value[c.value] ?? ""), f = e(() => Object.keys(u.value).map(Number).sort((e, t) => e - t)), p = e(() => u.value[c.value + 1] !== void 0), m = e(() => c.value > 1), h = e(() => ({
8
+ total: a(r(s.total)),
9
+ hasNext: p.value,
10
+ hasPrev: m.value,
11
+ knownPages: f.value,
12
+ itemsOnPage: a(r(s.itemsOnPage))
13
+ }));
14
+ function g(e, t = c.value) {
15
+ if (e == null) return;
16
+ let n = { ...u.value };
17
+ if (e) n[t + 1] = e;
18
+ else for (let e of Object.keys(n).map(Number)) e > t && delete n[e];
19
+ u.value = n;
20
+ }
21
+ function _(e) {
22
+ return u.value[e] !== void 0 && (c.value = e, !0);
23
+ }
24
+ function v() {
25
+ _(c.value + 1);
26
+ }
27
+ function y() {
28
+ _(c.value - 1);
29
+ }
30
+ function b() {
31
+ u.value = { 1: "" }, c.value = 1;
32
+ }
33
+ i(c, (e, t) => {
34
+ u.value[e] === void 0 && (c.value = t);
35
+ }, { flush: "sync" }), i(l, b, { flush: "sync" });
36
+ let x = s.nextToken;
37
+ if (x !== void 0) {
38
+ let e = () => i(() => r(x), (e) => g(e), { immediate: !0 }), n = t();
39
+ n ? Promise.resolve().then(() => n.active && n.run(e)) : e();
40
+ }
41
+ return {
42
+ page: c,
43
+ pageSize: l,
44
+ pageToken: d,
45
+ tokens: u,
46
+ knownPages: f,
47
+ hasNext: p,
48
+ hasPrev: m,
49
+ next: v,
50
+ prev: y,
51
+ goTo: _,
52
+ reset: b,
53
+ setNextToken: g,
54
+ paginationProps: h
55
+ };
56
+ }
57
+ //#endregion
58
+ export { o as useApiPagination };
@@ -0,0 +1,44 @@
1
+ import type { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
2
+ export interface UseBulkSelectionOptions<T, K = unknown> {
3
+ /** How to identify a row: a property name, the same as AcTable's `row-key`, or a function. Default `"id"`. Cloud-ui rows use `"uuid"`. */
4
+ key?: string | ((row: T) => K);
5
+ /** Decides per row whether it can be picked, e.g. not platform-managed and not already deleting. Pair it with AcTable's `row-disabled`. */
6
+ selectable?: (row: T) => boolean;
7
+ /** Drops picked keys whose rows leave `rows` or stop being selectable (deleted, filtered out, gone after a refetch). Default `true`. Turn it off when `rows` is one page of a server list and the selection spans pages; call `prune` yourself then. */
8
+ autoPrune?: boolean;
9
+ }
10
+ export interface BulkSelection<T, K = unknown> {
11
+ /** Keys of the picked rows. Bind to AcTable with `v-model:selected`. */
12
+ selected: Ref<K[]>;
13
+ /** The picked rows that are in `rows`, for the confirm dialog and the batch request. */
14
+ selectedRows: ComputedRef<T[]>;
15
+ /** The rows that pass `selectable`. */
16
+ selectableRows: ComputedRef<T[]>;
17
+ /** Number of picked rows, for AcBulkActionBar's `count`. */
18
+ count: ComputedRef<number>;
19
+ hasSelection: ComputedRef<boolean>;
20
+ /** Every selectable row is picked. Drives a select-all checkbox. */
21
+ allSelected: ComputedRef<boolean>;
22
+ /** Some, but not all, selectable rows are picked. Drives the checkbox's `indeterminate`. */
23
+ someSelected: ComputedRef<boolean>;
24
+ isSelected: (key: K) => boolean;
25
+ /** Picks or unpicks one row by key. Keys of rows that aren't selectable are ignored. */
26
+ toggle: (key: K) => void;
27
+ /** Picks every selectable row, or clears when they're all picked already. */
28
+ toggleAll: () => void;
29
+ selectAll: () => void;
30
+ /** Empties the selection, e.g. on AcBulkActionBar's `clear` or after the batch request succeeds. */
31
+ clear: () => void;
32
+ /** Drops picked keys that aren't among `rows` (default: the current selectable rows). */
33
+ prune: (rows?: T[]) => void;
34
+ }
35
+ /**
36
+ * Tracks which rows are picked for a bulk action, for AcTable's `v-model:selected`, AcCheckBox and AcBulkActionBar.
37
+ *
38
+ * Pass the whole list (every page, when paging in the browser) so picks survive a page change.
39
+ * Keys whose rows disappear are dropped automatically, so a stale key never reaches a batch request.
40
+ *
41
+ * @param rows The list the selection is made from, as an array, ref or getter.
42
+ * @param options `key`, `selectable` and `autoPrune`.
43
+ */
44
+ export declare function useBulkSelection<T extends object, K = unknown>(rows: MaybeRefOrGetter<T[]>, options?: UseBulkSelectionOptions<T, K>): BulkSelection<T, K>;
@@ -0,0 +1,41 @@
1
+ import { computed as e, ref as t, toValue as n, watch as r } from "vue";
2
+ //#region src/lib/composables/useBulkSelection.ts
3
+ function i(i, a = {}) {
4
+ let { key: o = "id", selectable: s = () => !0, autoPrune: c = !0 } = a, l = typeof o == "function" ? o : (e) => e[o], u = t([]), d = e(() => n(i).filter(s)), f = e(() => d.value.map(l)), p = e(() => new Set(u.value)), m = e(() => d.value.filter((e) => p.value.has(l(e)))), h = e(() => u.value.length), g = e(() => u.value.length > 0), _ = e(() => f.value.length > 0 && f.value.every((e) => p.value.has(e))), v = e(() => g.value && !_.value);
5
+ function y(e) {
6
+ return p.value.has(e);
7
+ }
8
+ function b(e) {
9
+ y(e) ? u.value = u.value.filter((t) => t !== e) : f.value.includes(e) && (u.value = [...u.value, e]);
10
+ }
11
+ function x() {
12
+ u.value = [...f.value];
13
+ }
14
+ function S() {
15
+ u.value = [];
16
+ }
17
+ function C() {
18
+ _.value ? S() : x();
19
+ }
20
+ function w(e) {
21
+ let t = new Set(e ? e.map(l) : f.value), n = u.value.filter((e) => t.has(e));
22
+ n.length !== u.value.length && (u.value = n);
23
+ }
24
+ return c && r(f, () => w()), {
25
+ selected: u,
26
+ selectedRows: m,
27
+ selectableRows: d,
28
+ count: h,
29
+ hasSelection: g,
30
+ allSelected: _,
31
+ someSelected: v,
32
+ isSelected: y,
33
+ toggle: b,
34
+ toggleAll: C,
35
+ selectAll: x,
36
+ clear: S,
37
+ prune: w
38
+ };
39
+ }
40
+ //#endregion
41
+ export { i as useBulkSelection };
@@ -0,0 +1,65 @@
1
+ import type { MaybeRefOrGetter } from "vue";
2
+ /** Field names of a form, with dots for nested objects: `name`, `spec.replicas`. */
3
+ export type FieldPath<T> = T extends object ? {
4
+ [K in keyof T & string]: NonNullable<T[K]> extends readonly unknown[] | Date | ((...args: never[]) => unknown) ? K : NonNullable<T[K]> extends object ? K | `${K}.${FieldPath<NonNullable<T[K]>>}` : K;
5
+ }[keyof T & string] : never;
6
+ /** A rule that needs no setting. `k8sName` is a Kubernetes name (RFC 1123 label); `alphanumericDash` only checks the characters. */
7
+ export type SimpleRuleName = "required" | "email" | "url" | "k8sName" | "alphanumericDash" | "integer" | "nonEmptyList";
8
+ /** Checks a value and returns a message when it's wrong. Return nothing (or `""`) when it's fine. */
9
+ export type RuleFn<T = Record<string, unknown>> = (value: unknown, values: T) => string | false | null | undefined | void;
10
+ /**
11
+ * One check on a field. Write it as:
12
+ * - a name: `"required"`, `"email"`, `"url"`, `"k8sName"`, `"alphanumericDash"`, `"integer"`, `"nonEmptyList"`;
13
+ * - cloud-ui's shorthand: `"minLength|3"`, `"maxLength|63"`, `"min|1"`, `"max|9"`, `"pattern|^v\\d+$|Start with v"`;
14
+ * - an object, to set the message: `{ required: true, message: "Choose a database." }`, `{ minLength: 8 }`, `{ pattern: /^v\d+$/, message: "…" }`;
15
+ * - a function `(value, values) => message | undefined`, e.g. to compare two fields.
16
+ */
17
+ export type Rule<T = Record<string, unknown>> = SimpleRuleName | `minLength|${number}` | `maxLength|${number}` | `min|${number}` | `max|${number}` | `pattern|${string}` | ({
18
+ [K in SimpleRuleName]: {
19
+ [P in K]: true;
20
+ } & {
21
+ message?: string;
22
+ };
23
+ }[SimpleRuleName]) | {
24
+ minLength: number;
25
+ message?: string;
26
+ } | {
27
+ maxLength: number;
28
+ message?: string;
29
+ } | {
30
+ min: number;
31
+ message?: string;
32
+ } | {
33
+ max: number;
34
+ message?: string;
35
+ } | {
36
+ pattern: RegExp | string;
37
+ message?: string;
38
+ } | RuleFn<T>;
39
+ /** Rules per field, checked in order; the first failing rule's message is shown. */
40
+ export type FormRules<T> = {
41
+ [K in FieldPath<T>]?: Rule<T>[];
42
+ };
43
+ export interface FormValidationOptions {
44
+ /**
45
+ * Re-checks a field as it changes once it has been checked: a fixed error clears straight away,
46
+ * and a field that was fine waits for the next `validateField` (on blur) before showing a new one. Default `true`.
47
+ */
48
+ live?: boolean;
49
+ }
50
+ /**
51
+ * Validates a form object field by field and keeps one message per field in `errors`,
52
+ * ready for `:error-msg="errors.name"` on AcInput, AcSelect, AcTextarea and the other fields.
53
+ *
54
+ * Empty values pass every rule except `required` and `nonEmptyList`, so optional fields can still have a format.
55
+ */
56
+ export declare function useFormValidation<T extends object>(values: MaybeRefOrGetter<T>, rules: MaybeRefOrGetter<FormRules<T>>, options?: FormValidationOptions): {
57
+ errors: { [K in FieldPath<T>]?: string | undefined; };
58
+ touched: { [K_1 in FieldPath<T>]?: boolean | undefined; };
59
+ errorCount: import("vue").ComputedRef<number>;
60
+ validate: () => boolean;
61
+ validateField: (field: FieldPath<T>) => string;
62
+ reset: (...only: FieldPath<T>[]) => void;
63
+ /** cloud-ui's name for `validate`. */
64
+ validateForm: () => boolean;
65
+ };
@@ -0,0 +1,148 @@
1
+ import { computed as e, reactive as t, toValue as n, watch as r } from "vue";
2
+ //#region src/lib/composables/useFormValidation.ts
3
+ var i = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, a = /^[a-z0-9-]+$/, o = {
4
+ required: (e) => Array.isArray(e) ? "Add at least one item." : e === !1 ? "Check this box to continue." : e == null ? "Choose an option." : "Enter a value.",
5
+ email: () => "Enter an email address like name@example.com.",
6
+ url: () => "Enter a full URL that starts with https:// or http://.",
7
+ alphanumericDash: () => "Use lowercase letters, numbers and hyphens.",
8
+ integer: () => "Enter a whole number.",
9
+ nonEmptyList: () => "Add at least one item.",
10
+ number: () => "Enter a number.",
11
+ minLength: (e) => `Enter at least ${e} characters.`,
12
+ maxLength: (e) => `Use ${e} characters or fewer.`,
13
+ min: (e) => `Enter ${e} or more.`,
14
+ max: (e) => `Enter ${e} or less.`,
15
+ pattern: () => "Check the format of this value."
16
+ };
17
+ function s(e) {
18
+ return e == null || e === !1 ? !0 : typeof e == "string" ? e.trim() === "" : typeof e == "number" ? Number.isNaN(e) : Array.isArray(e) ? e.length === 0 : !1;
19
+ }
20
+ function c(e) {
21
+ return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
22
+ }
23
+ function l(e) {
24
+ try {
25
+ let t = new URL(e);
26
+ return (t.protocol === "https:" || t.protocol === "http:") && !!t.hostname;
27
+ } catch {
28
+ return !1;
29
+ }
30
+ }
31
+ function u(e) {
32
+ return a.test(e) ? !/^[a-z0-9]/.test(e) || !/[a-z0-9]$/.test(e) ? "Start and end with a lowercase letter or number." : e.length > 63 ? o.maxLength(63) : "" : o.alphanumericDash();
33
+ }
34
+ function d(e) {
35
+ return typeof e == "string" ? new RegExp(e) : e;
36
+ }
37
+ function f(e) {
38
+ if (typeof e == "function") return {
39
+ required: !1,
40
+ check: (t, n) => e(t, n) || ""
41
+ };
42
+ if (typeof e == "string") {
43
+ let [t, ...n] = e.split("|");
44
+ return f(t === "pattern" ? {
45
+ pattern: n[0] ?? "",
46
+ message: n.slice(1).join("|") || void 0
47
+ } : t === "minLength" || t === "maxLength" || t === "min" || t === "max" ? { [t]: Number(n[0]) } : { [t]: !0 });
48
+ }
49
+ let t = e.message, n = (e) => t || e;
50
+ if ("required" in e) return {
51
+ required: !0,
52
+ check: (e) => s(e) ? n(o.required(e)) : ""
53
+ };
54
+ if ("nonEmptyList" in e) return {
55
+ required: !0,
56
+ check: (e) => Array.isArray(e) && !e.length ? n(o.nonEmptyList()) : ""
57
+ };
58
+ if ("email" in e) return {
59
+ required: !1,
60
+ check: (e) => i.test(String(e).trim()) ? "" : n(o.email())
61
+ };
62
+ if ("url" in e) return {
63
+ required: !1,
64
+ check: (e) => l(String(e).trim()) ? "" : n(o.url())
65
+ };
66
+ if ("alphanumericDash" in e) return {
67
+ required: !1,
68
+ check: (e) => a.test(String(e)) ? "" : n(o.alphanumericDash())
69
+ };
70
+ if ("k8sName" in e) return {
71
+ required: !1,
72
+ check: (e) => u(String(e)) ? n(u(String(e))) : ""
73
+ };
74
+ if ("integer" in e) return {
75
+ required: !1,
76
+ check: (e) => Number.isInteger(c(e)) ? "" : n(o.integer())
77
+ };
78
+ if ("minLength" in e) return {
79
+ required: !1,
80
+ check: (t) => String(t).length < e.minLength ? n(o.minLength(e.minLength)) : ""
81
+ };
82
+ if ("maxLength" in e) return {
83
+ required: !1,
84
+ check: (t) => String(t).length > e.maxLength ? n(o.maxLength(e.maxLength)) : ""
85
+ };
86
+ if ("min" in e || "max" in e) return {
87
+ required: !1,
88
+ check: (t) => {
89
+ let r = c(t);
90
+ return Number.isNaN(r) ? n(o.number()) : "min" in e && r < e.min ? n(o.min(e.min)) : "max" in e && r > e.max ? n(o.max(e.max)) : "";
91
+ }
92
+ };
93
+ if ("pattern" in e) {
94
+ let t = d(e.pattern);
95
+ return {
96
+ required: !1,
97
+ check: (e) => t.test(String(e)) ? "" : n(o.pattern())
98
+ };
99
+ }
100
+ return {
101
+ required: !1,
102
+ check: () => ""
103
+ };
104
+ }
105
+ function p(e, t) {
106
+ return t.split(".").reduce((e, t) => typeof e == "object" && e ? e[t] : void 0, e);
107
+ }
108
+ function m(i, a, o = {}) {
109
+ let c = t({}), l = t({}), u = e(() => Object.keys(n(a))), d = e(() => Object.values(c).filter(Boolean).length);
110
+ function m(e) {
111
+ let t = n(a)[e] ?? [], r = n(i), o = p(r, e), c = s(o);
112
+ for (let e of t) {
113
+ let { required: t, check: n } = f(e);
114
+ if (c && !t && typeof e != "function") continue;
115
+ let i = n(o, r);
116
+ if (i) return i;
117
+ }
118
+ return "";
119
+ }
120
+ function h(e) {
121
+ let t = m(e);
122
+ return c[e] = t, l[e] = !0, t;
123
+ }
124
+ function g() {
125
+ return u.value.map(h).every((e) => !e);
126
+ }
127
+ function _(...e) {
128
+ let t = e.length ? e : Object.keys(c);
129
+ for (let e of t) delete c[e], delete l[e];
130
+ }
131
+ return o.live !== !1 && r(() => u.value.map((e) => l[e] ? p(n(i), e) : void 0), () => {
132
+ for (let e of u.value) {
133
+ if (!l[e]) continue;
134
+ let t = m(e);
135
+ (!t || c[e]) && (c[e] = t);
136
+ }
137
+ }, { deep: !0 }), {
138
+ errors: c,
139
+ touched: l,
140
+ errorCount: d,
141
+ validate: g,
142
+ validateField: h,
143
+ reset: _,
144
+ validateForm: g
145
+ };
146
+ }
147
+ //#endregion
148
+ export { m as useFormValidation };
@@ -0,0 +1,49 @@
1
+ import type { ComputedRef, MaybeRefOrGetter, Ref, WatchSource } from "vue";
2
+ export interface UseTablePaginationOptions {
3
+ /** Page to start on, from 1. Default 1. */
4
+ page?: number;
5
+ /** Goes back to page 1 when this changes, e.g. a search query, a filter or the table's `sortBy`. */
6
+ resetOn?: WatchSource | WatchSource[];
7
+ }
8
+ export interface TablePagination<T> {
9
+ /** The current page, from 1. Bind to AcPagination with `v-model:page`. */
10
+ page: Ref<number>;
11
+ /** Rows per page. Bind to AcPagination with `v-model:page-size`. */
12
+ pageSize: Ref<number>;
13
+ /** The rows on the current page; pass them to AcTable's `rows`. */
14
+ pageRows: ComputedRef<T[]>;
15
+ /** Number of rows across all pages. */
16
+ total: ComputedRef<number>;
17
+ /** Number of pages, at least 1. */
18
+ pageCount: ComputedRef<number>;
19
+ /** The current page's slice of the list, 0-based and end-exclusive. */
20
+ range: ComputedRef<{
21
+ start: number;
22
+ end: number;
23
+ }>;
24
+ hasNext: ComputedRef<boolean>;
25
+ hasPrev: ComputedRef<boolean>;
26
+ next: () => void;
27
+ prev: () => void;
28
+ /** Moves to `page`, clamped to the first and last page. */
29
+ goTo: (page: number) => void;
30
+ /** Goes back to page 1. */
31
+ reset: () => void;
32
+ /** AcPagination props that aren't models: `v-bind="paginationProps"`. */
33
+ paginationProps: ComputedRef<{
34
+ total: number;
35
+ }>;
36
+ }
37
+ /**
38
+ * Pages a list in the browser, for AcTable plus AcPagination.
39
+ *
40
+ * Pass the whole list (already filtered and sorted) and bind the result:
41
+ * `<AcTable :rows="pageRows" />` and
42
+ * `<AcPagination v-model:page="page" v-model:page-size="pageSize" v-bind="paginationProps" />`.
43
+ * When the list shrinks below the current page (rows deleted, a refetch), the page moves back to the last one.
44
+ * Pass `resetOn` to go back to page 1 when a search or filter changes.
45
+ *
46
+ * @param rows The full list, as an array, ref or getter.
47
+ * @param pageSize Rows per page. Pass a writable ref to share it; a number or getter starts an internal ref. Default 10.
48
+ */
49
+ export declare function useTablePagination<T>(rows: MaybeRefOrGetter<T[]>, pageSize?: MaybeRefOrGetter<number>, options?: UseTablePaginationOptions): TablePagination<T>;
@@ -0,0 +1,41 @@
1
+ import { computed as e, isReadonly as t, isRef as n, ref as r, toValue as i, watch as a } from "vue";
2
+ //#region src/lib/composables/useTablePagination.ts
3
+ function o(o, s = 10, c = {}) {
4
+ let l = r(c.page ?? 1), u = n(s) && !t(s), d = u ? s : r(i(s));
5
+ !u && typeof s != "number" && a(() => i(s), (e) => d.value = e);
6
+ let f = e(() => i(o).length), p = e(() => Math.max(1, d.value)), m = e(() => Math.max(1, Math.ceil(f.value / p.value))), h = e(() => Math.min(Math.max(1, l.value), m.value)), g = e(() => ({
7
+ start: Math.min((h.value - 1) * p.value, f.value),
8
+ end: Math.min(h.value * p.value, f.value)
9
+ })), _ = e(() => i(o).slice(g.value.start, g.value.end)), v = e(() => h.value < m.value), y = e(() => h.value > 1), b = e(() => ({ total: f.value }));
10
+ function x(e) {
11
+ l.value = Math.min(Math.max(1, Math.trunc(e)), m.value);
12
+ }
13
+ function S() {
14
+ x(h.value + 1);
15
+ }
16
+ function C() {
17
+ x(h.value - 1);
18
+ }
19
+ function w() {
20
+ l.value = 1;
21
+ }
22
+ return a(m, (e) => {
23
+ l.value > e && (l.value = e);
24
+ }), c.resetOn && a(c.resetOn, w), {
25
+ page: l,
26
+ pageSize: d,
27
+ pageRows: _,
28
+ total: f,
29
+ pageCount: m,
30
+ range: g,
31
+ hasNext: v,
32
+ hasPrev: y,
33
+ next: S,
34
+ prev: C,
35
+ goTo: x,
36
+ reset: w,
37
+ paginationProps: b
38
+ };
39
+ }
40
+ //#endregion
41
+ export { o as useTablePagination };
@@ -6,12 +6,14 @@ export interface ToastAction {
6
6
  export interface ToastOptions {
7
7
  /** A second line under the title. */
8
8
  description?: string;
9
- /** Milliseconds before it closes on its own. 0 keeps it until dismissed. Default 5000. */
9
+ /** Milliseconds before it closes on its own. 0 keeps it until dismissed. Default 4500, as cloud-ui. */
10
10
  duration?: number;
11
11
  /** One button in the toast, e.g. `{ label: "Undo", onClick }`. Clicking it also closes the toast. */
12
12
  action?: ToastAction;
13
13
  /** Shows the close button. Default true. */
14
14
  dismissible?: boolean;
15
+ /** Shows a 2px bar along the bottom that shrinks with the time left and pauses on hover. Default: AcToaster's `progress` prop (off). cloud-ui's `showProgress`. */
16
+ progress?: boolean;
15
17
  /** Reuse an id to update a toast in place, e.g. "Backing up…" → "Backup complete". */
16
18
  id?: string;
17
19
  }
@@ -21,6 +23,8 @@ export interface Toast extends Required<Pick<ToastOptions, "duration" | "dismiss
21
23
  title: string;
22
24
  description?: string;
23
25
  action?: ToastAction;
26
+ /** Set only when the caller chose; otherwise AcToaster's `progress` prop decides. */
27
+ progress?: boolean;
24
28
  /** Bumped on every update so the toaster restarts the timer. */
25
29
  version: number;
26
30
  }
@@ -41,6 +45,7 @@ export declare function useToast(): {
41
45
  readonly label: string;
42
46
  readonly onClick: () => void;
43
47
  } | undefined;
48
+ readonly progress?: boolean | undefined;
44
49
  readonly version: number;
45
50
  readonly dismissible: boolean;
46
51
  readonly duration: number;
@@ -53,6 +58,7 @@ export declare function useToast(): {
53
58
  readonly label: string;
54
59
  readonly onClick: () => void;
55
60
  } | undefined;
61
+ readonly progress?: boolean | undefined;
56
62
  readonly version: number;
57
63
  readonly dismissible: boolean;
58
64
  readonly duration: number;
@@ -65,4 +71,14 @@ export declare function useToast(): {
65
71
  dismiss: typeof dismiss;
66
72
  clear: typeof clear;
67
73
  };
74
+ /** cloud-ui's toast options: `showProgress` is `progress`, and `width` is ignored (toasts are 384px). */
75
+ export interface CloudToastOptions extends ToastOptions {
76
+ showProgress?: boolean;
77
+ width?: number | string;
78
+ }
79
+ /**
80
+ * cloud-ui's `showToast(title, type, options)`, so its calls work unchanged. A number as `options` is the duration.
81
+ * Shows in `<AcToaster />` like `useToast()`, and returns the toast's id.
82
+ */
83
+ export declare function showToast(title: string, type: "success" | "info" | "warning" | "error", options?: number | CloudToastOptions): string;
68
84
  export {};
@@ -1,6 +1,6 @@
1
1
  import { readonly as e, ref as t } from "vue";
2
2
  //#region src/lib/composables/useToast.ts
3
- var n = 5e3, r = t([]), i = 0;
3
+ var n = 4500, r = t([]), i = 0;
4
4
  function a(e, t, a = {}) {
5
5
  let o = a.id ?? `toast-${++i}`, s = r.value.find((e) => e.id === o), c = {
6
6
  id: o,
@@ -10,6 +10,7 @@ function a(e, t, a = {}) {
10
10
  action: a.action,
11
11
  duration: a.duration ?? n,
12
12
  dismissible: a.dismissible ?? !0,
13
+ progress: a.progress,
13
14
  version: (s?.version ?? 0) + 1
14
15
  };
15
16
  return r.value = s ? r.value.map((e) => e.id === o ? c : e) : [...r.value, c], o;
@@ -32,5 +33,12 @@ function c() {
32
33
  clear: s
33
34
  };
34
35
  }
36
+ function l(e, t, n) {
37
+ let { showProgress: r, width: i, ...o } = typeof n == "number" ? { duration: n } : n ?? {};
38
+ return a(t, e, {
39
+ ...o,
40
+ progress: o.progress ?? r
41
+ });
42
+ }
35
43
  //#endregion
36
- export { c as useToast };
44
+ export { l as showToast, c as useToast };