@vinicunca/taman-ui 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 (296) hide show
  1. package/README.md +95 -0
  2. package/dist/_virtual/_/plugin-vue/export-helper.mjs +8 -0
  3. package/dist/components/auth/index.d.ts +2 -0
  4. package/dist/components/auth/index.mjs +2 -0
  5. package/dist/components/auth/taman-auth-form.mjs +67 -0
  6. package/dist/components/auth/taman-auth-form.vue.d.ts +31 -0
  7. package/dist/components/back-to-top/index.mjs +2 -0
  8. package/dist/components/back-to-top/taman-back-to-top.mjs +70 -0
  9. package/dist/components/back-to-top/taman-back-to-top.vue.d.ts +18 -0
  10. package/dist/components/button/check-group-selection.mjs +17 -0
  11. package/dist/components/button/index.d.ts +4 -0
  12. package/dist/components/button/index.mjs +3 -0
  13. package/dist/components/button/taman-button-check-group.mjs +132 -0
  14. package/dist/components/button/taman-button-check-group.types.d.ts +22 -0
  15. package/dist/components/button/taman-button-check-group.vue.d.ts +41 -0
  16. package/dist/components/button/taman-button-icon.mjs +105 -0
  17. package/dist/components/button/taman-button-icon.vue.d.ts +17 -0
  18. package/dist/components/descriptions/index.d.ts +4 -0
  19. package/dist/components/descriptions/index.mjs +3 -0
  20. package/dist/components/descriptions/taman-description-cell.mjs +116 -0
  21. package/dist/components/descriptions/taman-description-item.mjs +10 -0
  22. package/dist/components/descriptions/taman-description-item.vue.d.ts +5 -0
  23. package/dist/components/descriptions/taman-description-row.mjs +131 -0
  24. package/dist/components/descriptions/taman-description.mjs +78 -0
  25. package/dist/components/descriptions/taman-description.types.d.ts +51 -0
  26. package/dist/components/descriptions/taman-description.vue.d.ts +23 -0
  27. package/dist/components/descriptions/use-taman-description.mjs +161 -0
  28. package/dist/components/file-upload/index.d.ts +3 -0
  29. package/dist/components/file-upload/index.mjs +2 -0
  30. package/dist/components/file-upload/taman-file-upload.mjs +88 -0
  31. package/dist/components/file-upload/taman-file-upload.types.d.ts +10 -0
  32. package/dist/components/file-upload/taman-file-upload.vue.d.ts +21 -0
  33. package/dist/components/full-screen/full-screen.mjs +27 -0
  34. package/dist/components/full-screen/full-screen.vue.d.ts +8 -0
  35. package/dist/components/full-screen/index.mjs +2 -0
  36. package/dist/components/icon/icon.mjs +27 -0
  37. package/dist/components/icon/icon.vue.d.ts +9 -0
  38. package/dist/components/icon/index.d.ts +2 -0
  39. package/dist/components/icon/index.mjs +2 -0
  40. package/dist/components/index.d.ts +34 -0
  41. package/dist/components/index.mjs +31 -0
  42. package/dist/components/input/index.d.ts +5 -0
  43. package/dist/components/input/index.mjs +4 -0
  44. package/dist/components/input/password-strength.d.ts +7 -0
  45. package/dist/components/input/password-strength.mjs +21 -0
  46. package/dist/components/input/taman-input-currency.mjs +76 -0
  47. package/dist/components/input/taman-input-currency.types.d.ts +8 -0
  48. package/dist/components/input/taman-input-currency.vue.d.ts +15 -0
  49. package/dist/components/input/taman-input-password.mjs +99 -0
  50. package/dist/components/input/taman-input-password.vue.d.ts +17 -0
  51. package/dist/components/input-date/format-calendar-input-value.mjs +26 -0
  52. package/dist/components/input-date/index.d.ts +3 -0
  53. package/dist/components/input-date/index.mjs +2 -0
  54. package/dist/components/input-date/taman-input-date.mjs +116 -0
  55. package/dist/components/input-date/taman-input-date.types.d.ts +14 -0
  56. package/dist/components/input-date/taman-input-date.vue.d.ts +21 -0
  57. package/dist/components/loading/index.d.ts +3 -0
  58. package/dist/components/loading/index.mjs +2 -0
  59. package/dist/components/loading/taman-loading.mjs +64 -0
  60. package/dist/components/loading/taman-loading.vue.d.ts +25 -0
  61. package/dist/components/loading/types.d.ts +13 -0
  62. package/dist/components/logo/index.mjs +2 -0
  63. package/dist/components/logo/taman-logo.mjs +60 -0
  64. package/dist/components/logo/taman-logo.vue.d.ts +32 -0
  65. package/dist/components/render-content/index.d.ts +2 -0
  66. package/dist/components/render-content/index.mjs +2 -0
  67. package/dist/components/render-content/render-content.mjs +42 -0
  68. package/dist/components/render-content/render-content.vue.d.ts +31 -0
  69. package/dist/components/scrollbar/index.d.ts +2 -0
  70. package/dist/components/scrollbar/index.mjs +2 -0
  71. package/dist/components/scrollbar/scrollbar.mjs +136 -0
  72. package/dist/components/scrollbar/scrollbar.vue.d.ts +50 -0
  73. package/dist/form/components/form-actions.mjs +151 -0
  74. package/dist/form/components/form-field-array.mjs +154 -0
  75. package/dist/form/components/form-field-array.types.d.ts +18 -0
  76. package/dist/form/form-render/form-render-field-collapsible.mjs +32 -0
  77. package/dist/form/form-render/form-render-field-control.mjs +44 -0
  78. package/dist/form/form-render/form-render-form-field.mjs +408 -0
  79. package/dist/form/form-render/form-render-form-label.mjs +46 -0
  80. package/dist/form/form-render/form-render-form.mjs +163 -0
  81. package/dist/form/form-render/form-render-group.mjs +89 -0
  82. package/dist/form/form-render/form-render.context.mjs +10 -0
  83. package/dist/form/form-render/form-render.dependencies.mjs +101 -0
  84. package/dist/form/form-render/form-render.helper.mjs +31 -0
  85. package/dist/form/form-render/form-render.schema.mjs +209 -0
  86. package/dist/form/form-render/index.mjs +4 -0
  87. package/dist/form/form.api.d.ts +54 -0
  88. package/dist/form/form.api.mjs +324 -0
  89. package/dist/form/form.built-ins.d.ts +36 -0
  90. package/dist/form/form.built-ins.mjs +48 -0
  91. package/dist/form/form.codec.d.ts +17 -0
  92. package/dist/form/form.codec.mjs +45 -0
  93. package/dist/form/form.config.d.ts +6 -0
  94. package/dist/form/form.config.mjs +43 -0
  95. package/dist/form/form.empty-value.d.ts +4 -0
  96. package/dist/form/form.empty-value.mjs +20 -0
  97. package/dist/form/form.field-name.mjs +25 -0
  98. package/dist/form/form.rule-registry.mjs +10 -0
  99. package/dist/form/form.runtime-field.mjs +56 -0
  100. package/dist/form/form.runtime.mjs +235 -0
  101. package/dist/form/form.schema-defaults.mjs +36 -0
  102. package/dist/form/form.types.d.ts +315 -0
  103. package/dist/form/form.use-delayed-flag.mjs +35 -0
  104. package/dist/form/form.use-form-context.mjs +44 -0
  105. package/dist/form/form.use-taman-form.d.ts +7 -0
  106. package/dist/form/form.use-taman-form.mjs +36 -0
  107. package/dist/form/index.d.ts +8 -0
  108. package/dist/form/index.mjs +6 -0
  109. package/dist/form/taman-use-form.mjs +146 -0
  110. package/dist/index.d.ts +63 -0
  111. package/dist/index.mjs +56 -0
  112. package/dist/layout/components/index.mjs +6 -0
  113. package/dist/layout/components/taman-core-button-collapse.mjs +38 -0
  114. package/dist/layout/components/taman-core-button-fixed.mjs +29 -0
  115. package/dist/layout/components/taman-core-layout-content.mjs +50 -0
  116. package/dist/layout/components/taman-core-layout-footer.mjs +38 -0
  117. package/dist/layout/components/taman-core-layout-header.mjs +48 -0
  118. package/dist/layout/components/taman-core-layout-sidebar.mjs +319 -0
  119. package/dist/layout/components/taman-core-layout-tabbar.mjs +21 -0
  120. package/dist/layout/composables/use-layout.mjs +31 -0
  121. package/dist/layout/composables/use-sidebar-drag.mjs +103 -0
  122. package/dist/layout/header-scroll-state.mjs +9 -0
  123. package/dist/layout/index.d.ts +3 -0
  124. package/dist/layout/index.mjs +2 -0
  125. package/dist/layout/taman-core-layout.d.ts +41 -0
  126. package/dist/layout/taman-core-layout.mjs +603 -0
  127. package/dist/layout/taman-core-layout.vue.d.ts +99 -0
  128. package/dist/menu/components/collapse-transition.mjs +82 -0
  129. package/dist/menu/components/index.mjs +5 -0
  130. package/dist/menu/components/normal-menu/index.d.ts +3 -0
  131. package/dist/menu/components/normal-menu/index.mjs +2 -0
  132. package/dist/menu/components/normal-menu/normal-menu.d.ts +11 -0
  133. package/dist/menu/components/normal-menu/normal-menu.mjs +50 -0
  134. package/dist/menu/components/normal-menu/normal-menu.vue.d.ts +19 -0
  135. package/dist/menu/components/taman-menu-badge-dot.mjs +23 -0
  136. package/dist/menu/components/taman-menu-badge.mjs +49 -0
  137. package/dist/menu/components/taman-menu-badge.vue.d.ts +9 -0
  138. package/dist/menu/components/taman-menu-item.mjs +124 -0
  139. package/dist/menu/components/taman-menu-root.mjs +250 -0
  140. package/dist/menu/components/taman-menu-sub-menu-content.mjs +83 -0
  141. package/dist/menu/components/taman-menu-sub-menu.mjs +216 -0
  142. package/dist/menu/composables/index.mjs +3 -0
  143. package/dist/menu/composables/use-menu-context.mjs +36 -0
  144. package/dist/menu/composables/use-menu-scroll.mjs +23 -0
  145. package/dist/menu/composables/use-menu.mjs +33 -0
  146. package/dist/menu/index.d.ts +7 -0
  147. package/dist/menu/index.mjs +5 -0
  148. package/dist/menu/menu.constants.mjs +5 -0
  149. package/dist/menu/menu.types.d.ts +63 -0
  150. package/dist/menu/menu.utils.mjs +27 -0
  151. package/dist/menu/taman-menu.mjs +41 -0
  152. package/dist/menu/taman-menu.vue.d.ts +12 -0
  153. package/dist/menu/taman-sub-menu.mjs +75 -0
  154. package/dist/popup/alert/alert-builder.d.ts +8 -0
  155. package/dist/popup/alert/alert-builder.mjs +98 -0
  156. package/dist/popup/alert/alert-overlay.mjs +55 -0
  157. package/dist/popup/alert/alert.d.ts +43 -0
  158. package/dist/popup/alert/alert.mjs +10 -0
  159. package/dist/popup/alert/alert.vue.d.ts +26 -0
  160. package/dist/popup/alert/alert2.mjs +238 -0
  161. package/dist/popup/alert/index.d.ts +4 -0
  162. package/dist/popup/alert/index.mjs +4 -0
  163. package/dist/popup/dialog/dialog.api.d.ts +23 -0
  164. package/dist/popup/dialog/dialog.api.mjs +133 -0
  165. package/dist/popup/dialog/dialog.mjs +336 -0
  166. package/dist/popup/dialog/dialog.types.d.ts +60 -0
  167. package/dist/popup/dialog/dialog.vue.d.ts +46 -0
  168. package/dist/popup/dialog/index.d.ts +4 -0
  169. package/dist/popup/dialog/index.mjs +3 -0
  170. package/dist/popup/dialog/use-dialog-draggable.mjs +93 -0
  171. package/dist/popup/dialog/use-taman-dialog.d.ts +13 -0
  172. package/dist/popup/dialog/use-taman-dialog.mjs +106 -0
  173. package/dist/popup/drawer/drawer.api.d.ts +23 -0
  174. package/dist/popup/drawer/drawer.api.mjs +124 -0
  175. package/dist/popup/drawer/drawer.mjs +277 -0
  176. package/dist/popup/drawer/drawer.types.d.ts +56 -0
  177. package/dist/popup/drawer/drawer.vue.d.ts +47 -0
  178. package/dist/popup/drawer/index.d.ts +4 -0
  179. package/dist/popup/drawer/index.mjs +3 -0
  180. package/dist/popup/drawer/use-taman-drawer.d.ts +13 -0
  181. package/dist/popup/drawer/use-taman-drawer.mjs +109 -0
  182. package/dist/popup/index.d.ts +13 -0
  183. package/dist/popup/index.mjs +11 -0
  184. package/dist/tabs/components/index.mjs +2 -0
  185. package/dist/tabs/components/taman-tabs.mjs +158 -0
  186. package/dist/tabs/components/widgets/index.d.ts +4 -0
  187. package/dist/tabs/components/widgets/index.mjs +4 -0
  188. package/dist/tabs/components/widgets/tool-more.mjs +45 -0
  189. package/dist/tabs/components/widgets/tool-more.vue.d.ts +7 -0
  190. package/dist/tabs/components/widgets/tool-refresh.mjs +25 -0
  191. package/dist/tabs/components/widgets/tool-refresh.vue.d.ts +9 -0
  192. package/dist/tabs/components/widgets/tool-screen.mjs +29 -0
  193. package/dist/tabs/components/widgets/tool-screen.vue.d.ts +12 -0
  194. package/dist/tabs/index.d.ts +8 -0
  195. package/dist/tabs/index.mjs +6 -0
  196. package/dist/tabs/strict-context-menu.d.ts +10 -0
  197. package/dist/tabs/tabs.types.d.ts +30 -0
  198. package/dist/tabs/taman-tabs-view.mjs +101 -0
  199. package/dist/tabs/taman-tabs-view.vue.d.ts +18 -0
  200. package/dist/tabs/use-tabs-drag.mjs +69 -0
  201. package/dist/tabs/use-tabs-view-scroll.mjs +114 -0
  202. package/dist/ui/alert-dialog/alert-dialog-action.mjs +21 -0
  203. package/dist/ui/alert-dialog/alert-dialog-action.vue.d.ts +16 -0
  204. package/dist/ui/alert-dialog/alert-dialog-cancel.mjs +21 -0
  205. package/dist/ui/alert-dialog/alert-dialog-cancel.vue.d.ts +16 -0
  206. package/dist/ui/alert-dialog/alert-dialog-content.mjs +111 -0
  207. package/dist/ui/alert-dialog/alert-dialog-content.vue.d.ts +49 -0
  208. package/dist/ui/alert-dialog/alert-dialog-description.mjs +30 -0
  209. package/dist/ui/alert-dialog/alert-dialog-description.vue.d.ts +20 -0
  210. package/dist/ui/alert-dialog/alert-dialog-footer.mjs +14 -0
  211. package/dist/ui/alert-dialog/alert-dialog-footer.vue.d.ts +15 -0
  212. package/dist/ui/alert-dialog/alert-dialog-header.mjs +14 -0
  213. package/dist/ui/alert-dialog/alert-dialog-header.vue.d.ts +15 -0
  214. package/dist/ui/alert-dialog/alert-dialog-overlay.mjs +29 -0
  215. package/dist/ui/alert-dialog/alert-dialog-root.mjs +23 -0
  216. package/dist/ui/alert-dialog/alert-dialog-root.vue.d.ts +23 -0
  217. package/dist/ui/alert-dialog/alert-dialog-title.mjs +30 -0
  218. package/dist/ui/alert-dialog/alert-dialog-title.vue.d.ts +20 -0
  219. package/dist/ui/alert-dialog/alert-dialog-trigger.mjs +21 -0
  220. package/dist/ui/alert-dialog/alert-dialog-trigger.vue.d.ts +16 -0
  221. package/dist/ui/alert-dialog/index.d.ts +10 -0
  222. package/dist/ui/alert-dialog/index.mjs +10 -0
  223. package/dist/ui/dialog/dialog-close.mjs +21 -0
  224. package/dist/ui/dialog/dialog-close.vue.d.ts +16 -0
  225. package/dist/ui/dialog/dialog-content.mjs +111 -0
  226. package/dist/ui/dialog/dialog-content.vue.d.ts +51 -0
  227. package/dist/ui/dialog/dialog-description.mjs +31 -0
  228. package/dist/ui/dialog/dialog-description.vue.d.ts +20 -0
  229. package/dist/ui/dialog/dialog-footer.mjs +14 -0
  230. package/dist/ui/dialog/dialog-footer.vue.d.ts +15 -0
  231. package/dist/ui/dialog/dialog-header.mjs +14 -0
  232. package/dist/ui/dialog/dialog-header.vue.d.ts +15 -0
  233. package/dist/ui/dialog/dialog-overlay.mjs +34 -0
  234. package/dist/ui/dialog/dialog-overlay.vue.d.ts +14 -0
  235. package/dist/ui/dialog/dialog-root.mjs +24 -0
  236. package/dist/ui/dialog/dialog-root.vue.d.ts +23 -0
  237. package/dist/ui/dialog/dialog-title.mjs +31 -0
  238. package/dist/ui/dialog/dialog-title.vue.d.ts +20 -0
  239. package/dist/ui/dialog/dialog-trigger.mjs +21 -0
  240. package/dist/ui/dialog/dialog-trigger.vue.d.ts +16 -0
  241. package/dist/ui/dialog/index.d.ts +10 -0
  242. package/dist/ui/dialog/index.mjs +10 -0
  243. package/dist/ui/dialog/use-dialog-state-events.mjs +60 -0
  244. package/dist/ui/form/form-control.mjs +27 -0
  245. package/dist/ui/form/form-control.vue.d.ts +15 -0
  246. package/dist/ui/form/form-description.mjs +27 -0
  247. package/dist/ui/form/form-description.vue.d.ts +19 -0
  248. package/dist/ui/form/form-field.mjs +37 -0
  249. package/dist/ui/form/form-field.vue.d.ts +27 -0
  250. package/dist/ui/form/form-item.mjs +27 -0
  251. package/dist/ui/form/form-item.vue.d.ts +19 -0
  252. package/dist/ui/form/form-label.mjs +41 -0
  253. package/dist/ui/form/form-label.vue.d.ts +20 -0
  254. package/dist/ui/form/form-message.mjs +28 -0
  255. package/dist/ui/form/form-message.vue.d.ts +9 -0
  256. package/dist/ui/form/index.d.ts +8 -0
  257. package/dist/ui/form/index.mjs +8 -0
  258. package/dist/ui/form/injection-keys.d.ts +13 -0
  259. package/dist/ui/form/injection-keys.mjs +5 -0
  260. package/dist/ui/form/use-form-field.mjs +27 -0
  261. package/dist/ui/index.d.ts +42 -0
  262. package/dist/ui/index.mjs +42 -0
  263. package/dist/ui/label/index.d.ts +2 -0
  264. package/dist/ui/label/index.mjs +2 -0
  265. package/dist/ui/label/label.mjs +31 -0
  266. package/dist/ui/label/label.vue.d.ts +20 -0
  267. package/dist/ui/scroll-area/index.d.ts +3 -0
  268. package/dist/ui/scroll-area/index.mjs +3 -0
  269. package/dist/ui/scroll-area/scroll-area.mjs +47 -0
  270. package/dist/ui/scroll-area/scroll-area.vue.d.ts +21 -0
  271. package/dist/ui/scroll-area/scroll-bar.mjs +38 -0
  272. package/dist/ui/scroll-area/scroll-bar.vue.d.ts +12 -0
  273. package/dist/ui/sheet/index.d.ts +8 -0
  274. package/dist/ui/sheet/index.mjs +8 -0
  275. package/dist/ui/sheet/sheet-close.mjs +21 -0
  276. package/dist/ui/sheet/sheet-close.vue.d.ts +16 -0
  277. package/dist/ui/sheet/sheet-content.mjs +105 -0
  278. package/dist/ui/sheet/sheet-content.vue.d.ts +48 -0
  279. package/dist/ui/sheet/sheet-description.mjs +30 -0
  280. package/dist/ui/sheet/sheet-description.vue.d.ts +20 -0
  281. package/dist/ui/sheet/sheet-footer.mjs +14 -0
  282. package/dist/ui/sheet/sheet-footer.vue.d.ts +15 -0
  283. package/dist/ui/sheet/sheet-header.mjs +14 -0
  284. package/dist/ui/sheet/sheet-header.vue.d.ts +15 -0
  285. package/dist/ui/sheet/sheet-overlay.mjs +32 -0
  286. package/dist/ui/sheet/sheet-root.mjs +24 -0
  287. package/dist/ui/sheet/sheet-root.vue.d.ts +23 -0
  288. package/dist/ui/sheet/sheet-title.mjs +31 -0
  289. package/dist/ui/sheet/sheet-title.vue.d.ts +20 -0
  290. package/dist/ui/sheet/sheet.variants.d.ts +27 -0
  291. package/dist/ui/sheet/sheet.variants.mjs +12 -0
  292. package/dist/unocss/content.d.ts +4 -0
  293. package/dist/unocss/content.mjs +9 -0
  294. package/dist/unocss/index.d.ts +2 -0
  295. package/dist/unocss/index.mjs +2 -0
  296. package/package.json +78 -0
@@ -0,0 +1,336 @@
1
+ import _sfc_main$1 from "../../components/button/taman-button-icon.mjs";
2
+ import _sfc_main$2 from "../../components/loading/taman-loading.mjs";
3
+ import _sfc_main$3 from "../../ui/dialog/dialog-close.mjs";
4
+ import _sfc_main$4 from "../../ui/dialog/dialog-content.mjs";
5
+ import _sfc_main$5 from "../../ui/dialog/dialog-description.mjs";
6
+ import dialog_footer_default from "../../ui/dialog/dialog-footer.mjs";
7
+ import dialog_header_default from "../../ui/dialog/dialog-header.mjs";
8
+ import _sfc_main$6 from "../../ui/dialog/dialog-root.mjs";
9
+ import _sfc_main$7 from "../../ui/dialog/dialog-title.mjs";
10
+ import { VisuallyHidden } from "../../index.mjs";
11
+ import { useDialogDraggable } from "./use-dialog-draggable.mjs";
12
+ import { computed, createBlock, createCommentVNode, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, onDeactivated, openBlock, provide, ref, renderSlot, toDisplayString, unref, useId, watch, withCtx } from "vue";
13
+ import PButton from "pohon-ui/components/Button.vue";
14
+ import PTooltip from "pohon-ui/components/Tooltip.vue";
15
+ import { useOverlayZIndex, usePriorityValues, useSimpleLocale } from "@vinicunca/taman-core/composables";
16
+ import PIcon from "pohon-ui/components/Icon.vue";
17
+ import { DISMISSABLE_DIALOG_ID, ELEMENT_ID_MAIN_CONTENT } from "@vinicunca/taman-core/constants";
18
+ //#region src/popup/dialog/dialog.vue
19
+ const _hoisted_1 = { class: "flex flex-col gap-1" };
20
+ const _hoisted_2 = { class: "flex-center gap-2" };
21
+ const _sfc_main = /*@__PURE__*/ defineComponent({
22
+ __name: "dialog",
23
+ props: {
24
+ dialogApi: { default: void 0 },
25
+ closeDisabled: { type: Boolean },
26
+ closeClass: {},
27
+ animationType: {},
28
+ appendToMain: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ bordered: { type: Boolean },
33
+ cancelText: {},
34
+ centered: { type: Boolean },
35
+ class: { type: [
36
+ Boolean,
37
+ null,
38
+ String,
39
+ Object,
40
+ Array
41
+ ] },
42
+ closable: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ closeOnClickModal: { type: Boolean },
47
+ closeOnPressEscape: { type: Boolean },
48
+ confirmDisabled: { type: Boolean },
49
+ confirmLoading: { type: Boolean },
50
+ confirmText: {},
51
+ contentClass: { type: [
52
+ Boolean,
53
+ null,
54
+ String,
55
+ Object,
56
+ Array
57
+ ] },
58
+ description: {},
59
+ destroyOnClose: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ draggable: { type: Boolean },
64
+ footer: { type: Boolean },
65
+ footerClass: { type: [
66
+ Boolean,
67
+ null,
68
+ String,
69
+ Object,
70
+ Array
71
+ ] },
72
+ fullscreen: { type: Boolean },
73
+ fullscreenButton: { type: Boolean },
74
+ header: { type: Boolean },
75
+ headerClass: { type: [
76
+ Boolean,
77
+ null,
78
+ String,
79
+ Object,
80
+ Array
81
+ ] },
82
+ loading: { type: Boolean },
83
+ modal: { type: Boolean },
84
+ openAutoFocus: { type: Boolean },
85
+ overflow: { type: Boolean },
86
+ overlayBlur: {},
87
+ showCancelButton: { type: Boolean },
88
+ showConfirmButton: { type: Boolean },
89
+ submitting: { type: Boolean },
90
+ title: {},
91
+ titleTooltip: {},
92
+ zIndex: {}
93
+ },
94
+ setup(__props) {
95
+ const props = __props;
96
+ const contentRef = ref();
97
+ const dialogRef = ref();
98
+ const headerRef = ref();
99
+ const { $t } = useSimpleLocale();
100
+ const state = props.dialogApi?.useStore?.();
101
+ const id = useId();
102
+ provide(DISMISSABLE_DIALOG_ID, id);
103
+ const { appendToMain, bordered, cancelText, centered, class: dialogClass, closable, closeOnClickModal, closeOnPressEscape, confirmDisabled, confirmLoading, confirmText, contentClass, description, destroyOnClose, draggable, overflow, footer: showFooter, footerClass, fullscreen: shouldFullscreen, fullscreenButton, header, headerClass, loading: showLoading, modal, openAutoFocus, overlayBlur, showCancelButton, showConfirmButton, submitting, title, titleTooltip, animationType, zIndex } = usePriorityValues(props, state);
104
+ const openZIndex = useOverlayZIndex(() => state?.value?.isOpen);
105
+ const layerZIndex = computed(() => zIndex.value ?? openZIndex.value);
106
+ const shouldDraggable = computed(() => draggable.value && !shouldFullscreen.value && header.value);
107
+ const shouldCentered = computed(() => centered.value && !shouldFullscreen.value);
108
+ const getAppendTo = computed(() => {
109
+ return appendToMain.value ? `#${ELEMENT_ID_MAIN_CONTENT}` : void 0;
110
+ });
111
+ const { dragging, transform } = useDialogDraggable({
112
+ targetRef: dialogRef,
113
+ dragRef: headerRef,
114
+ draggable: shouldDraggable,
115
+ containerSelector: getAppendTo,
116
+ centered: shouldCentered,
117
+ isOverflow: overflow
118
+ });
119
+ const firstOpened = ref(false);
120
+ const isClosed = ref(true);
121
+ watch(() => state?.value?.isOpen, async (isOpen_) => {
122
+ if (!contentRef.value) return;
123
+ if (isOpen_) {
124
+ isClosed.value = false;
125
+ if (!firstOpened.value) firstOpened.value = true;
126
+ await nextTick();
127
+ if (!contentRef.value) return;
128
+ const innerContentRef = contentRef.value.getContentRef();
129
+ dialogRef.value = innerContentRef?.$el;
130
+ const { offsetX, offsetY } = transform;
131
+ dialogRef.value.style.transform = shouldCentered.value ? `translate(${offsetX}px, calc(-50% + ${offsetY}px))` : `translate(${offsetX}px, ${offsetY}px)`;
132
+ }
133
+ }, { immediate: true });
134
+ /**
135
+ * With keepAlive enabled, browser back/gesture navigation does not close the modal
136
+ */
137
+ onDeactivated(() => {
138
+ if (!appendToMain.value) props.dialogApi?.close();
139
+ });
140
+ function handleFullscreen() {
141
+ props.dialogApi?.setState((prev) => {
142
+ return {
143
+ ...prev,
144
+ fullscreen: !shouldFullscreen.value
145
+ };
146
+ });
147
+ }
148
+ function handleInteractOutside(event) {
149
+ if (!closeOnClickModal.value || submitting.value) {
150
+ event.preventDefault();
151
+ event.stopPropagation();
152
+ }
153
+ }
154
+ function handleEscapeKeydown(event) {
155
+ if (!closeOnPressEscape.value || submitting.value) event.preventDefault();
156
+ }
157
+ function handleOpenAutoFocus(event) {
158
+ if (!openAutoFocus.value) event?.preventDefault();
159
+ }
160
+ function handlePointerDownOutside(event) {
161
+ const isDismissableModal = event.target?.dataset.dismissableModal;
162
+ if (!closeOnClickModal.value || isDismissableModal !== id || submitting.value) {
163
+ event.preventDefault();
164
+ event.stopPropagation();
165
+ }
166
+ }
167
+ function handleFocusOutside(event) {
168
+ event.preventDefault();
169
+ event.stopPropagation();
170
+ }
171
+ function handleCloseAutoFocus(_event) {}
172
+ const getForceMount = computed(() => {
173
+ return !unref(destroyOnClose) && unref(firstOpened);
174
+ });
175
+ function handleOpened() {
176
+ requestAnimationFrame(() => {
177
+ props.dialogApi?.onOpened();
178
+ });
179
+ }
180
+ function handleClosed() {
181
+ isClosed.value = true;
182
+ props.dialogApi?.onClosed();
183
+ }
184
+ return (_ctx, _cache) => {
185
+ return openBlock(), createBlock(unref(_sfc_main$6), {
186
+ modal: false,
187
+ open: unref(state)?.isOpen,
188
+ "onUpdate:open": _cache[2] || (_cache[2] = () => !unref(submitting) ? __props.dialogApi?.close() : void 0)
189
+ }, {
190
+ default: withCtx(() => [createVNode(unref(_sfc_main$4), {
191
+ ref_key: "contentRef",
192
+ ref: contentRef,
193
+ "append-to": getAppendTo.value,
194
+ class: normalizeClass(["mx-auto flex flex-col w-130 inset-x-0 top-10vh", [{
195
+ "pohon:rounded-none": unref(shouldFullscreen),
196
+ "border border-border": unref(bordered),
197
+ "shadow-3xl": !unref(bordered),
198
+ "max-h-[min(80%,calc(100dvh-20px))] max-w-[calc(100vw-20px)]": !unref(shouldFullscreen),
199
+ "top-0 left-0 size-full! max-h-full! max-w-full! translate-0!": unref(shouldFullscreen),
200
+ "top-1/2": unref(centered) && !unref(shouldFullscreen),
201
+ "duration-300": !unref(dragging),
202
+ "hidden": isClosed.value
203
+ }, unref(dialogClass)]]),
204
+ "force-mount": getForceMount.value,
205
+ modal: unref(modal),
206
+ open: unref(state)?.isOpen,
207
+ "animation-type": unref(animationType),
208
+ "z-index": layerZIndex.value,
209
+ "overlay-blur": unref(overlayBlur),
210
+ onCloseAutoFocus: handleCloseAutoFocus,
211
+ onClosed: handleClosed,
212
+ onEscapeKeyDown: handleEscapeKeydown,
213
+ onFocusOutside: handleFocusOutside,
214
+ onInteractOutside: handleInteractOutside,
215
+ onOpenAutoFocus: handleOpenAutoFocus,
216
+ onOpened: handleOpened,
217
+ onPointerDownOutside: handlePointerDownOutside
218
+ }, {
219
+ default: withCtx(() => [
220
+ createVNode(unref(dialog_header_default), {
221
+ ref_key: "headerRef",
222
+ ref: headerRef,
223
+ class: normalizeClass(["justify-between", [{
224
+ "border-b": unref(bordered),
225
+ "hidden": !unref(header),
226
+ "cursor-move select-none": shouldDraggable.value,
227
+ "items-center": !unref(description),
228
+ "items-start": unref(description)
229
+ }, unref(headerClass)]])
230
+ }, {
231
+ default: withCtx(() => [
232
+ createElementVNode("div", _hoisted_1, [unref(title) ? (openBlock(), createBlock(unref(_sfc_main$7), {
233
+ key: 0,
234
+ class: "text-left flex gap-1 items-center"
235
+ }, {
236
+ default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(unref(title)) + " ", 1), renderSlot(_ctx.$slots, "titleTooltip", {}, () => [unref(titleTooltip) ? (openBlock(), createBlock(PTooltip, {
237
+ key: 0,
238
+ text: unref(titleTooltip)
239
+ }, {
240
+ default: withCtx(() => [createVNode(PIcon, {
241
+ name: "lucide:circle-help",
242
+ class: "color-text-muted"
243
+ })]),
244
+ _: 1
245
+ }, 8, ["text"])) : createCommentVNode("v-if", true)])])]),
246
+ _: 3
247
+ })) : createCommentVNode("v-if", true), unref(description) ? (openBlock(), createBlock(unref(_sfc_main$5), { key: 1 }, {
248
+ default: withCtx(() => [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(unref(description)), 1)])]),
249
+ _: 3
250
+ })) : createCommentVNode("v-if", true)]),
251
+ createElementVNode("div", _hoisted_2, [
252
+ renderSlot(_ctx.$slots, "extra"),
253
+ unref(fullscreenButton) ? (openBlock(), createBlock(PButton, {
254
+ key: 0,
255
+ class: "pohon:rounded-full",
256
+ icon: unref(shouldFullscreen) ? "lucide:shrink" : "lucide:expand",
257
+ color: "neutral",
258
+ variant: "ghost",
259
+ onClick: handleFullscreen
260
+ }, null, 8, ["icon"])) : createCommentVNode("v-if", true),
261
+ unref(closable) ? (openBlock(), createBlock(unref(_sfc_main$3), {
262
+ key: 1,
263
+ "as-child": "",
264
+ onClick: handleClosed
265
+ }, {
266
+ default: withCtx(() => [createVNode(unref(_sfc_main$1), {
267
+ disabled: unref(submitting),
268
+ class: normalizeClass([__props.closeClass]),
269
+ icon: "lucide:x"
270
+ }, null, 8, ["disabled", "class"])]),
271
+ _: 1
272
+ })) : createCommentVNode("v-if", true)
273
+ ]),
274
+ !unref(title) || !unref(description) ? (openBlock(), createBlock(unref(VisuallyHidden), { key: 0 }, {
275
+ default: withCtx(() => [!unref(title) ? (openBlock(), createBlock(unref(_sfc_main$7), { key: 0 })) : createCommentVNode("v-if", true), !unref(description) ? (openBlock(), createBlock(unref(_sfc_main$5), { key: 1 })) : createCommentVNode("v-if", true)]),
276
+ _: 1
277
+ })) : createCommentVNode("v-if", true)
278
+ ]),
279
+ _: 3
280
+ }, 8, ["class"]),
281
+ createElementVNode("div", { class: normalizeClass(["p-3 flex-1 relative overflow-y-auto", [unref(contentClass), { "pointer-events-none": unref(showLoading) || unref(submitting) }]]) }, [renderSlot(_ctx.$slots, "default")], 2),
282
+ unref(showLoading) || unref(submitting) ? (openBlock(), createBlock(unref(_sfc_main$2), {
283
+ key: 0,
284
+ spinning: ""
285
+ })) : createCommentVNode("v-if", true),
286
+ unref(showFooter) ? (openBlock(), createBlock(unref(dialog_footer_default), {
287
+ key: 1,
288
+ class: normalizeClass(["p-2 flex-row items-center justify-end", [{ "border-t": unref(bordered) }, unref(footerClass)]])
289
+ }, {
290
+ default: withCtx(() => [
291
+ renderSlot(_ctx.$slots, "leading-footer"),
292
+ renderSlot(_ctx.$slots, "footer", {}, () => [
293
+ unref(showCancelButton) ? (openBlock(), createBlock(PButton, {
294
+ key: 0,
295
+ variant: "outline",
296
+ color: "neutral",
297
+ disabled: unref(submitting),
298
+ onClick: _cache[0] || (_cache[0] = () => __props.dialogApi?.onCancel())
299
+ }, {
300
+ default: withCtx(() => [renderSlot(_ctx.$slots, "cancelText", {}, () => [createTextVNode(toDisplayString(unref(cancelText) || unref($t)("cancel")), 1)])]),
301
+ _: 3
302
+ }, 8, ["disabled"])) : createCommentVNode("v-if", true),
303
+ renderSlot(_ctx.$slots, "center-footer"),
304
+ unref(showConfirmButton) ? (openBlock(), createBlock(PButton, {
305
+ key: 1,
306
+ disabled: unref(confirmDisabled),
307
+ loading: unref(confirmLoading) || unref(submitting),
308
+ onClick: _cache[1] || (_cache[1] = () => __props.dialogApi?.onConfirm())
309
+ }, {
310
+ default: withCtx(() => [renderSlot(_ctx.$slots, "confirmText", {}, () => [createTextVNode(toDisplayString(unref(confirmText) || unref($t)("confirm")), 1)])]),
311
+ _: 3
312
+ }, 8, ["disabled", "loading"])) : createCommentVNode("v-if", true)
313
+ ]),
314
+ renderSlot(_ctx.$slots, "trailing-footer")
315
+ ]),
316
+ _: 3
317
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
318
+ ]),
319
+ _: 3
320
+ }, 8, [
321
+ "append-to",
322
+ "class",
323
+ "force-mount",
324
+ "modal",
325
+ "open",
326
+ "animation-type",
327
+ "z-index",
328
+ "overlay-blur"
329
+ ])]),
330
+ _: 3
331
+ }, 8, ["open"]);
332
+ };
333
+ }
334
+ });
335
+ //#endregion
336
+ export { _sfc_main as default };
@@ -0,0 +1,60 @@
1
+ import { DialogApi } from "./dialog.api.js";
2
+ import { Component, HTMLAttributes, Ref } from "vue";
3
+ import { MaybePromise } from "@vinicunca/taman-core/typings";
4
+ //#region src/popup/dialog/dialog.types.d.ts
5
+ interface DialogProps {
6
+ animationType?: 'scale' | 'slide';
7
+ appendToMain?: boolean;
8
+ bordered?: boolean;
9
+ cancelText?: string;
10
+ centered?: boolean;
11
+ class?: HTMLAttributes['class'];
12
+ closable?: boolean;
13
+ closeOnClickModal?: boolean;
14
+ closeOnPressEscape?: boolean;
15
+ confirmDisabled?: boolean;
16
+ confirmLoading?: boolean;
17
+ confirmText?: string;
18
+ contentClass?: HTMLAttributes['class'];
19
+ description?: string;
20
+ destroyOnClose?: boolean;
21
+ draggable?: boolean;
22
+ footer?: boolean;
23
+ footerClass?: HTMLAttributes['class'];
24
+ fullscreen?: boolean;
25
+ fullscreenButton?: boolean;
26
+ header?: boolean;
27
+ headerClass?: HTMLAttributes['class'];
28
+ loading?: boolean;
29
+ modal?: boolean;
30
+ openAutoFocus?: boolean;
31
+ overflow?: boolean;
32
+ overlayBlur?: number;
33
+ showCancelButton?: boolean;
34
+ showConfirmButton?: boolean;
35
+ submitting?: boolean;
36
+ title?: string;
37
+ titleTooltip?: string;
38
+ zIndex?: number;
39
+ }
40
+ interface DialogState extends DialogProps {
41
+ isOpen?: boolean;
42
+ }
43
+ type ExtendedDialogApi<TData = unknown> = DialogApi<TData> & {
44
+ useStore: <T = NoInfer<DialogState>>(selector?: (state: NoInfer<DialogState>) => T) => Readonly<Ref<T>>;
45
+ };
46
+ type DialogComponentInstance<TComponent extends Component> = TComponent extends (abstract new (...args: Array<any>) => infer TInstance) ? TInstance : never;
47
+ type InferDialogData<TComponent extends Component> = [DialogComponentInstance<TComponent>] extends [never] ? unknown : DialogComponentInstance<TComponent> extends {
48
+ dialogApi: ExtendedDialogApi<infer TData>;
49
+ } ? TData : unknown;
50
+ interface DialogApiOptions<TConnectedComponent extends Component = Component> extends DialogState {
51
+ connectedComponent?: TConnectedComponent;
52
+ onBeforeClose?: () => MaybePromise<boolean | undefined>;
53
+ onCancel?: () => void;
54
+ onClosed?: () => void;
55
+ onConfirm?: () => void;
56
+ onOpenChange?: (isOpen: boolean) => void;
57
+ onOpened?: () => void;
58
+ }
59
+ //#endregion
60
+ export { DialogApiOptions, DialogProps, DialogState, ExtendedDialogApi, InferDialogData };
@@ -0,0 +1,46 @@
1
+ import { DialogProps, ExtendedDialogApi } from "./dialog.types.js";
2
+ //#region src/popup/dialog/dialog.vue.d.ts
3
+ interface Props extends DialogProps {
4
+ dialogApi?: ExtendedDialogApi;
5
+ closeDisabled?: boolean;
6
+ closeClass?: string;
7
+ }
8
+ declare var __VLS_41: {}, __VLS_43: {}, __VLS_62: {}, __VLS_64: {}, __VLS_102: {}, __VLS_115: {}, __VLS_117: {}, __VLS_127: {}, __VLS_129: {}, __VLS_139: {}, __VLS_141: {};
9
+ type __VLS_Slots = {} & {
10
+ title?: (props: typeof __VLS_41) => any;
11
+ } & {
12
+ titleTooltip?: (props: typeof __VLS_43) => any;
13
+ } & {
14
+ description?: (props: typeof __VLS_62) => any;
15
+ } & {
16
+ extra?: (props: typeof __VLS_64) => any;
17
+ } & {
18
+ default?: (props: typeof __VLS_102) => any;
19
+ } & {
20
+ 'leading-footer'?: (props: typeof __VLS_115) => any;
21
+ } & {
22
+ footer?: (props: typeof __VLS_117) => any;
23
+ } & {
24
+ cancelText?: (props: typeof __VLS_127) => any;
25
+ } & {
26
+ 'center-footer'?: (props: typeof __VLS_129) => any;
27
+ } & {
28
+ confirmText?: (props: typeof __VLS_139) => any;
29
+ } & {
30
+ 'trailing-footer'?: (props: typeof __VLS_141) => any;
31
+ };
32
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
33
+ appendToMain: boolean;
34
+ closable: boolean;
35
+ destroyOnClose: boolean;
36
+ dialogApi: ExtendedDialogApi;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
39
+ declare const _default: typeof __VLS_export;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
45
+ //#endregion
46
+ export { _default as default };
@@ -0,0 +1,4 @@
1
+ import { DialogApiOptions, DialogProps, DialogState, ExtendedDialogApi, InferDialogData } from "./dialog.types.js";
2
+ import _default from "./dialog.vue.js";
3
+ import { createTamanDialog, setDefaultDialogProps, useTamanDialog } from "./use-taman-dialog.js";
4
+ export { type DialogApiOptions, type DialogProps, type DialogState, type ExtendedDialogApi, type InferDialogData, _default as TamanDialog, createTamanDialog, setDefaultDialogProps, useTamanDialog };
@@ -0,0 +1,3 @@
1
+ import _sfc_main from "./dialog.mjs";
2
+ import { createTamanDialog, setDefaultDialogProps, useTamanDialog } from "./use-taman-dialog.mjs";
3
+ export { _sfc_main as TamanDialog, createTamanDialog, setDefaultDialogProps, useTamanDialog };
@@ -0,0 +1,93 @@
1
+ import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from "vue";
2
+ import { unrefElement } from "@vueuse/core";
3
+ //#region src/popup/dialog/use-dialog-draggable.ts
4
+ function useDialogDraggable({ targetRef, dragRef, draggable, containerSelector, centered, isOverflow }) {
5
+ const transform = reactive({
6
+ offsetX: 0,
7
+ offsetY: 0
8
+ });
9
+ const dragging = ref(false);
10
+ function onMousedown(event) {
11
+ const downX = event.clientX;
12
+ const downY = event.clientY;
13
+ if (!targetRef.value) return;
14
+ const targetRect = targetRef.value.getBoundingClientRect();
15
+ const { offsetX, offsetY } = transform;
16
+ const targetLeft = targetRect.left;
17
+ const targetTop = targetRect.top;
18
+ const targetWidth = targetRect.width;
19
+ const targetHeight = targetRect.height;
20
+ let containerRect = null;
21
+ if (containerSelector?.value) {
22
+ const container = document.querySelector(containerSelector.value);
23
+ if (container) containerRect = container.getBoundingClientRect();
24
+ }
25
+ let maxLeft, maxTop, minLeft, minTop;
26
+ if (containerRect) {
27
+ minLeft = containerRect.left - targetLeft + offsetX;
28
+ maxLeft = containerRect.right - targetLeft - targetWidth + offsetX;
29
+ minTop = containerRect.top - targetTop + offsetY;
30
+ maxTop = containerRect.bottom - targetTop - targetHeight + offsetY;
31
+ } else {
32
+ const docElement = document.documentElement;
33
+ const clientWidth = docElement.clientWidth;
34
+ const clientHeight = docElement.clientHeight;
35
+ minLeft = -targetLeft + offsetX;
36
+ minTop = -targetTop + offsetY;
37
+ maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
38
+ maxTop = clientHeight - targetTop - targetHeight + offsetY;
39
+ }
40
+ const onMousemove = (event) => {
41
+ let moveX = offsetX + event.clientX - downX;
42
+ let moveY = offsetY + event.clientY - downY;
43
+ if (!isOverflow?.value) {
44
+ moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
45
+ moveY = Math.min(Math.max(moveY, minTop), maxTop);
46
+ }
47
+ transform.offsetX = moveX;
48
+ transform.offsetY = moveY;
49
+ if (targetRef.value) {
50
+ const isCentered = centered?.value;
51
+ targetRef.value.style.transform = isCentered ? `translate(${moveX}px, calc(-50% + ${moveY}px))` : `translate(${moveX}px, ${moveY}px)`;
52
+ dragging.value = true;
53
+ }
54
+ };
55
+ const onMouseup = () => {
56
+ dragging.value = false;
57
+ document.removeEventListener("mousemove", onMousemove);
58
+ document.removeEventListener("mouseup", onMouseup);
59
+ };
60
+ document.addEventListener("mousemove", onMousemove);
61
+ document.addEventListener("mouseup", onMouseup);
62
+ }
63
+ function onDraggable() {
64
+ const dragDom = unrefElement(dragRef);
65
+ if (dragDom && targetRef.value) dragDom.addEventListener("mousedown", onMousedown);
66
+ }
67
+ function offDraggable() {
68
+ const dragDom = unrefElement(dragRef);
69
+ if (dragDom && targetRef.value) dragDom.removeEventListener("mousedown", onMousedown);
70
+ }
71
+ function resetPosition() {
72
+ transform.offsetX = 0;
73
+ transform.offsetY = 0;
74
+ const target = unrefElement(targetRef);
75
+ if (target) target.style.transform = "";
76
+ }
77
+ onMounted(() => {
78
+ watchEffect(() => {
79
+ if (draggable.value) onDraggable();
80
+ else offDraggable();
81
+ });
82
+ });
83
+ onBeforeUnmount(() => {
84
+ offDraggable();
85
+ });
86
+ return {
87
+ dragging,
88
+ resetPosition,
89
+ transform
90
+ };
91
+ }
92
+ //#endregion
93
+ export { useDialogDraggable };
@@ -0,0 +1,13 @@
1
+ import { DialogApiOptions, DialogProps, ExtendedDialogApi, InferDialogData } from "./dialog.types.js";
2
+ import { Component } from "vue";
3
+ //#region src/popup/dialog/use-taman-dialog.d.ts
4
+ declare const DIALOG_DATA_NOT_PROVIDED: unique symbol;
5
+ interface DialogDataNotProvided {
6
+ readonly [DIALOG_DATA_NOT_PROVIDED]: true;
7
+ }
8
+ type ResolvedDialogData<TData, TConnectedComponent extends Component> = TData extends DialogDataNotProvided ? InferDialogData<TConnectedComponent> : TData;
9
+ declare function setDefaultDialogProps(props: Partial<DialogProps>): void;
10
+ declare function useTamanDialog<TData = DialogDataNotProvided, TConnectedComponent extends Component = Component>(options?: DialogApiOptions<TConnectedComponent>): readonly [import("vue").DefineSetupFnComponent<DialogProps, {}, {}, DialogProps & {}, import("vue").PublicProps>, ExtendedDialogApi<ResolvedDialogData<TData, TConnectedComponent>>];
11
+ declare function createTamanDialog<TData = unknown>(): <TConnectedComponent extends Component = Component>(options?: DialogApiOptions<TConnectedComponent>) => readonly [import("vue").DefineSetupFnComponent<DialogProps, {}, {}, DialogProps & {}, import("vue").PublicProps>, ExtendedDialogApi<ResolvedDialogData<TData, TConnectedComponent>>];
12
+ //#endregion
13
+ export { createTamanDialog, setDefaultDialogProps, useTamanDialog };
@@ -0,0 +1,106 @@
1
+ import _sfc_main from "./dialog.mjs";
2
+ import { DialogApi } from "./dialog.api.mjs";
3
+ import { defineComponent, h, inject, markRaw, nextTick, onBeforeUnmount, provide, ref, shallowReactive } from "vue";
4
+ import { useSelector } from "@vinicunca/taman-core/store";
5
+ import { usePreferences } from "@vinicunca/taman-core/preferences";
6
+ //#region src/popup/dialog/use-taman-dialog.ts
7
+ const TAMAN_DIALOG_INJECT_KEY = Symbol("TAMAN_DIALOG_INJECT");
8
+ const { globalEscapeShortcutKey } = usePreferences();
9
+ const DEFAULT_DIALOG_PROPS = {};
10
+ function setDefaultDialogProps(props) {
11
+ Object.assign(DEFAULT_DIALOG_PROPS, props);
12
+ }
13
+ function useTamanDialog(options = {}) {
14
+ const defaultOptions = {
15
+ closeOnPressEscape: globalEscapeShortcutKey.value,
16
+ ...options
17
+ };
18
+ const { connectedComponent } = options;
19
+ if (connectedComponent) {
20
+ const extendedApi = shallowReactive({});
21
+ const isDialogReady = ref(true);
22
+ return [defineComponent((props, { attrs, slots }) => {
23
+ function rebindApi(api) {
24
+ Object.setPrototypeOf(extendedApi, markRaw(api));
25
+ }
26
+ provide(TAMAN_DIALOG_INJECT_KEY, {
27
+ extendApi: rebindApi,
28
+ consumed: false,
29
+ options: defaultOptions,
30
+ async reCreateDialog() {
31
+ isDialogReady.value = false;
32
+ await nextTick();
33
+ isDialogReady.value = true;
34
+ }
35
+ });
36
+ checkProps(extendedApi, {
37
+ ...props,
38
+ ...attrs,
39
+ ...slots
40
+ });
41
+ return () => h(isDialogReady.value ? connectedComponent : "div", {
42
+ ...props,
43
+ ...attrs
44
+ }, slots);
45
+ }, {
46
+ name: "TamanParentDialog",
47
+ inheritAttrs: false
48
+ }), extendedApi];
49
+ }
50
+ const injectData = inject(TAMAN_DIALOG_INJECT_KEY, {});
51
+ const isConsumed = injectData.consumed;
52
+ const effectiveOptions = isConsumed ? {} : injectData.options;
53
+ if (!isConsumed && injectData.consumed !== void 0) injectData.consumed = true;
54
+ onBeforeUnmount(() => {
55
+ if (!isConsumed && injectData.consumed !== void 0) injectData.consumed = false;
56
+ });
57
+ const mergedOptions = {
58
+ ...DEFAULT_DIALOG_PROPS,
59
+ ...effectiveOptions,
60
+ ...defaultOptions
61
+ };
62
+ mergedOptions.onOpenChange = (isOpen) => {
63
+ options.onOpenChange?.(isOpen);
64
+ if (!isConsumed) injectData.options?.onOpenChange?.(isOpen);
65
+ };
66
+ const onClosed = mergedOptions.onClosed;
67
+ mergedOptions.onClosed = () => {
68
+ onClosed?.();
69
+ if (mergedOptions.destroyOnClose && !isConsumed) {
70
+ if (injectData.consumed !== void 0) injectData.consumed = false;
71
+ injectData.reCreateModal?.();
72
+ }
73
+ };
74
+ const api = new DialogApi(mergedOptions);
75
+ const extendedApi = api;
76
+ extendedApi.useStore = (selector) => {
77
+ return useSelector(api.store, selector);
78
+ };
79
+ const Dialog = defineComponent((props, { attrs, slots }) => {
80
+ return () => h(_sfc_main, {
81
+ ...props,
82
+ ...attrs,
83
+ dialogApi: extendedApi
84
+ }, slots);
85
+ }, {
86
+ name: "TamanDialog",
87
+ inheritAttrs: false
88
+ });
89
+ injectData.extendApi?.(extendedApi);
90
+ return [Dialog, extendedApi];
91
+ }
92
+ function createTamanDialog() {
93
+ return function useTypedTamanDialog(options = {}) {
94
+ return useTamanDialog(options);
95
+ };
96
+ }
97
+ async function checkProps(api, attrs) {
98
+ if (!attrs || Object.keys(attrs).length === 0) return;
99
+ await nextTick();
100
+ const state = api?.store?.state;
101
+ if (!state) return;
102
+ const stateKeys = new Set(Object.keys(state));
103
+ for (const attr of Object.keys(attrs)) if (stateKeys.has(attr) && !["class"].includes(attr)) console.warn(`[Taman Dialog]: When 'connectedComponent' exists, do not set props or slots '${attr}', which will increase complexity. If you need to modify the props of Modal, please use useTamanDialog or api.`);
104
+ }
105
+ //#endregion
106
+ export { createTamanDialog, setDefaultDialogProps, useTamanDialog };