@falcon-ui/falcon-ui 1.0.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 (289) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/cjs/JsBarcode-BlUjuVmB.cjs +3519 -0
  4. package/cjs/JsBarcode-BlUjuVmB.cjs.map +1 -0
  5. package/cjs/chunk-D4y6LrGi.cjs +40 -0
  6. package/cjs/components/JsBarcode-BOXEZn4Q.cjs +3519 -0
  7. package/cjs/components/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  8. package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs +3519 -0
  9. package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  10. package/cjs/components/barcode/chunk-D4y6LrGi.cjs +40 -0
  11. package/cjs/components/barcode/index.cjs +211 -0
  12. package/cjs/components/barcode/index.cjs.map +1 -0
  13. package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs +3519 -0
  14. package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  15. package/cjs/components/barcode/src/barcode.cjs +102 -0
  16. package/cjs/components/barcode/src/barcode.cjs.map +1 -0
  17. package/cjs/components/barcode/src/barcode.vue.cjs +200 -0
  18. package/cjs/components/barcode/src/barcode.vue.cjs.map +1 -0
  19. package/cjs/components/barcode/src/chunk-D4y6LrGi.cjs +40 -0
  20. package/cjs/components/button/index.cjs +135 -0
  21. package/cjs/components/button/index.cjs.map +1 -0
  22. package/cjs/components/button/src/button.cjs +16 -0
  23. package/cjs/components/button/src/button.cjs.map +1 -0
  24. package/cjs/components/button/src/button.vue.cjs +124 -0
  25. package/cjs/components/button/src/button.vue.cjs.map +1 -0
  26. package/cjs/components/chunk-D4y6LrGi.cjs +40 -0
  27. package/cjs/components/date-picker/index.cjs +164 -0
  28. package/cjs/components/date-picker/index.cjs.map +1 -0
  29. package/cjs/components/date-picker/src/date-picker.cjs +25 -0
  30. package/cjs/components/date-picker/src/date-picker.cjs.map +1 -0
  31. package/cjs/components/date-picker/src/date-picker.vue.cjs +153 -0
  32. package/cjs/components/date-picker/src/date-picker.vue.cjs.map +1 -0
  33. package/cjs/components/dialog/index.cjs +346 -0
  34. package/cjs/components/dialog/index.cjs.map +1 -0
  35. package/cjs/components/dialog/src/dialog.cjs +40 -0
  36. package/cjs/components/dialog/src/dialog.cjs.map +1 -0
  37. package/cjs/components/dialog/src/dialog.vue.cjs +343 -0
  38. package/cjs/components/dialog/src/dialog.vue.cjs.map +1 -0
  39. package/cjs/components/index.cjs +9450 -0
  40. package/cjs/components/index.cjs.map +1 -0
  41. package/cjs/components/input/index.cjs +175 -0
  42. package/cjs/components/input/index.cjs.map +1 -0
  43. package/cjs/components/input/src/input.cjs +27 -0
  44. package/cjs/components/input/src/input.cjs.map +1 -0
  45. package/cjs/components/input/src/input.vue.cjs +164 -0
  46. package/cjs/components/input/src/input.vue.cjs.map +1 -0
  47. package/cjs/components/input-number/index.cjs +374 -0
  48. package/cjs/components/input-number/index.cjs.map +1 -0
  49. package/cjs/components/input-number/src/input-number.cjs +48 -0
  50. package/cjs/components/input-number/src/input-number.cjs.map +1 -0
  51. package/cjs/components/input-number/src/input-number.vue.cjs +363 -0
  52. package/cjs/components/input-number/src/input-number.vue.cjs.map +1 -0
  53. package/cjs/components/input-search/index.cjs +286 -0
  54. package/cjs/components/input-search/index.cjs.map +1 -0
  55. package/cjs/components/input-search/src/input-search.cjs +55 -0
  56. package/cjs/components/input-search/src/input-search.cjs.map +1 -0
  57. package/cjs/components/input-search/src/input-search.vue.cjs +275 -0
  58. package/cjs/components/input-search/src/input-search.vue.cjs.map +1 -0
  59. package/cjs/components/qr-code/index.cjs +1975 -0
  60. package/cjs/components/qr-code/index.cjs.map +1 -0
  61. package/cjs/components/qr-code/src/qr-code.cjs +63 -0
  62. package/cjs/components/qr-code/src/qr-code.cjs.map +1 -0
  63. package/cjs/components/qr-code/src/qr-code.vue.cjs +1964 -0
  64. package/cjs/components/qr-code/src/qr-code.vue.cjs.map +1 -0
  65. package/cjs/components/radial-menu/index.cjs +983 -0
  66. package/cjs/components/radial-menu/index.cjs.map +1 -0
  67. package/cjs/components/radial-menu/src/radial-menu.cjs +96 -0
  68. package/cjs/components/radial-menu/src/radial-menu.cjs.map +1 -0
  69. package/cjs/components/radial-menu/src/radial-menu.vue.cjs +921 -0
  70. package/cjs/components/radial-menu/src/radial-menu.vue.cjs.map +1 -0
  71. package/cjs/components/select/index.cjs +163 -0
  72. package/cjs/components/select/index.cjs.map +1 -0
  73. package/cjs/components/select/src/select.cjs +16 -0
  74. package/cjs/components/select/src/select.cjs.map +1 -0
  75. package/cjs/components/select/src/select.vue.cjs +152 -0
  76. package/cjs/components/select/src/select.vue.cjs.map +1 -0
  77. package/cjs/components/table/index.cjs +3351 -0
  78. package/cjs/components/table/index.cjs.map +1 -0
  79. package/cjs/components/table/src/table.cjs +62 -0
  80. package/cjs/components/table/src/table.cjs.map +1 -0
  81. package/cjs/components/table/src/table.vue.cjs +3085 -0
  82. package/cjs/components/table/src/table.vue.cjs.map +1 -0
  83. package/cjs/dialog-CJU00aEV.cjs +614 -0
  84. package/cjs/dialog-CJU00aEV.cjs.map +1 -0
  85. package/cjs/dialog-DcH26KbE.cjs +2 -0
  86. package/cjs/hooks/dialog-DpYPBcKV.cjs +266 -0
  87. package/cjs/hooks/dialog-DpYPBcKV.cjs.map +1 -0
  88. package/cjs/hooks/hooks-D2Jaq5kO.cjs +328 -0
  89. package/cjs/hooks/hooks-D2Jaq5kO.cjs.map +1 -0
  90. package/cjs/hooks/index.cjs +8 -0
  91. package/cjs/icons/index.cjs +86 -0
  92. package/cjs/icons/index.cjs.map +1 -0
  93. package/cjs/index.cjs +9141 -0
  94. package/cjs/index.cjs.map +1 -0
  95. package/cjs/utils/index.cjs +69 -0
  96. package/cjs/utils/index.cjs.map +1 -0
  97. package/esm/JsBarcode-kVJER62m.js +3514 -0
  98. package/esm/JsBarcode-kVJER62m.js.map +1 -0
  99. package/esm/chunk-BuRq7rDw.js +23 -0
  100. package/esm/components/JsBarcode-CzzxrEd_.js +3514 -0
  101. package/esm/components/JsBarcode-CzzxrEd_.js.map +1 -0
  102. package/esm/components/barcode/JsBarcode-C5ux6wsb.js +3514 -0
  103. package/esm/components/barcode/JsBarcode-C5ux6wsb.js.map +1 -0
  104. package/esm/components/barcode/chunk--em_ddB3.js +23 -0
  105. package/esm/components/barcode/index.mjs +204 -0
  106. package/esm/components/barcode/index.mjs.map +1 -0
  107. package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js +3514 -0
  108. package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js.map +1 -0
  109. package/esm/components/barcode/src/barcode.mjs +98 -0
  110. package/esm/components/barcode/src/barcode.mjs.map +1 -0
  111. package/esm/components/barcode/src/barcode.vue.mjs +194 -0
  112. package/esm/components/barcode/src/barcode.vue.mjs.map +1 -0
  113. package/esm/components/barcode/src/chunk--em_ddB3.js +23 -0
  114. package/esm/components/button/index.mjs +126 -0
  115. package/esm/components/button/index.mjs.map +1 -0
  116. package/esm/components/button/src/button.mjs +14 -0
  117. package/esm/components/button/src/button.mjs.map +1 -0
  118. package/esm/components/button/src/button.vue.mjs +117 -0
  119. package/esm/components/button/src/button.vue.mjs.map +1 -0
  120. package/esm/components/chunk-BuRq7rDw.js +23 -0
  121. package/esm/components/date-picker/index.mjs +155 -0
  122. package/esm/components/date-picker/index.mjs.map +1 -0
  123. package/esm/components/date-picker/src/date-picker.mjs +23 -0
  124. package/esm/components/date-picker/src/date-picker.mjs.map +1 -0
  125. package/esm/components/date-picker/src/date-picker.vue.mjs +146 -0
  126. package/esm/components/date-picker/src/date-picker.vue.mjs.map +1 -0
  127. package/esm/components/dialog/index.mjs +335 -0
  128. package/esm/components/dialog/index.mjs.map +1 -0
  129. package/esm/components/dialog/src/dialog.mjs +38 -0
  130. package/esm/components/dialog/src/dialog.mjs.map +1 -0
  131. package/esm/components/dialog/src/dialog.vue.mjs +334 -0
  132. package/esm/components/dialog/src/dialog.vue.mjs.map +1 -0
  133. package/esm/components/index.mjs +9386 -0
  134. package/esm/components/index.mjs.map +1 -0
  135. package/esm/components/input/index.mjs +166 -0
  136. package/esm/components/input/index.mjs.map +1 -0
  137. package/esm/components/input/src/input.mjs +25 -0
  138. package/esm/components/input/src/input.mjs.map +1 -0
  139. package/esm/components/input/src/input.vue.mjs +157 -0
  140. package/esm/components/input/src/input.vue.mjs.map +1 -0
  141. package/esm/components/input-number/index.mjs +365 -0
  142. package/esm/components/input-number/index.mjs.map +1 -0
  143. package/esm/components/input-number/src/input-number.mjs +45 -0
  144. package/esm/components/input-number/src/input-number.mjs.map +1 -0
  145. package/esm/components/input-number/src/input-number.vue.mjs +356 -0
  146. package/esm/components/input-number/src/input-number.vue.mjs.map +1 -0
  147. package/esm/components/input-search/index.mjs +277 -0
  148. package/esm/components/input-search/index.mjs.map +1 -0
  149. package/esm/components/input-search/src/input-search.mjs +53 -0
  150. package/esm/components/input-search/src/input-search.mjs.map +1 -0
  151. package/esm/components/input-search/src/input-search.vue.mjs +268 -0
  152. package/esm/components/input-search/src/input-search.vue.mjs.map +1 -0
  153. package/esm/components/qr-code/index.mjs +1967 -0
  154. package/esm/components/qr-code/index.mjs.map +1 -0
  155. package/esm/components/qr-code/src/qr-code.mjs +59 -0
  156. package/esm/components/qr-code/src/qr-code.mjs.map +1 -0
  157. package/esm/components/qr-code/src/qr-code.vue.mjs +1958 -0
  158. package/esm/components/qr-code/src/qr-code.vue.mjs.map +1 -0
  159. package/esm/components/radial-menu/index.mjs +974 -0
  160. package/esm/components/radial-menu/index.mjs.map +1 -0
  161. package/esm/components/radial-menu/src/radial-menu.mjs +94 -0
  162. package/esm/components/radial-menu/src/radial-menu.mjs.map +1 -0
  163. package/esm/components/radial-menu/src/radial-menu.vue.mjs +916 -0
  164. package/esm/components/radial-menu/src/radial-menu.vue.mjs.map +1 -0
  165. package/esm/components/select/index.mjs +154 -0
  166. package/esm/components/select/index.mjs.map +1 -0
  167. package/esm/components/select/src/select.mjs +14 -0
  168. package/esm/components/select/src/select.mjs.map +1 -0
  169. package/esm/components/select/src/select.vue.mjs +145 -0
  170. package/esm/components/select/src/select.vue.mjs.map +1 -0
  171. package/esm/components/table/index.mjs +3342 -0
  172. package/esm/components/table/index.mjs.map +1 -0
  173. package/esm/components/table/src/table.mjs +60 -0
  174. package/esm/components/table/src/table.mjs.map +1 -0
  175. package/esm/components/table/src/table.vue.mjs +3080 -0
  176. package/esm/components/table/src/table.vue.mjs.map +1 -0
  177. package/esm/dialog-Cm3Px-Bu.js +537 -0
  178. package/esm/dialog-Cm3Px-Bu.js.map +1 -0
  179. package/esm/dialog-CzZm50XM.js +2 -0
  180. package/esm/hooks/dialog-d4SMZWbw.js +261 -0
  181. package/esm/hooks/dialog-d4SMZWbw.js.map +1 -0
  182. package/esm/hooks/hooks-DdjieG2I.js +281 -0
  183. package/esm/hooks/hooks-DdjieG2I.js.map +1 -0
  184. package/esm/hooks/index.mjs +2 -0
  185. package/esm/icons/index.mjs +79 -0
  186. package/esm/icons/index.mjs.map +1 -0
  187. package/esm/index.mjs +9065 -0
  188. package/esm/index.mjs.map +1 -0
  189. package/esm/utils/index.mjs +65 -0
  190. package/esm/utils/index.mjs.map +1 -0
  191. package/global.d.ts +39 -0
  192. package/package.json +131 -0
  193. package/theme/index.css +1 -0
  194. package/theme/index.scss +16 -0
  195. package/theme/src/barcode.scss +14 -0
  196. package/theme/src/button.scss +65 -0
  197. package/theme/src/date-picker.scss +87 -0
  198. package/theme/src/dialog.scss +146 -0
  199. package/theme/src/ep-vars.scss +11 -0
  200. package/theme/src/input-number.scss +66 -0
  201. package/theme/src/input-search.scss +78 -0
  202. package/theme/src/input.scss +66 -0
  203. package/theme/src/mixins/bem.scss +35 -0
  204. package/theme/src/mixins/color.scss +8 -0
  205. package/theme/src/qr-code.scss +23 -0
  206. package/theme/src/radial-menu.scss +346 -0
  207. package/theme/src/select.scss +44 -0
  208. package/theme/src/table.scss +143 -0
  209. package/theme/src/tokens.scss +26 -0
  210. package/theme/src/tree-select.scss +45 -0
  211. package/theme/src/tree.scss +369 -0
  212. package/types/components/barcode/index.d.ts +183 -0
  213. package/types/components/barcode/src/barcode.d.ts +147 -0
  214. package/types/components/barcode/src/barcode.vue.d.ts +184 -0
  215. package/types/components/button/index.d.ts +135 -0
  216. package/types/components/button/src/button.d.ts +33 -0
  217. package/types/components/button/src/button.vue.d.ts +138 -0
  218. package/types/components/date-picker/index.d.ts +508 -0
  219. package/types/components/date-picker/src/date-picker.d.ts +35 -0
  220. package/types/components/date-picker/src/date-picker.vue.d.ts +509 -0
  221. package/types/components/dialog/index.d.ts +630 -0
  222. package/types/components/dialog/src/dialog.d.ts +70 -0
  223. package/types/components/dialog/src/dialog.vue.d.ts +257 -0
  224. package/types/components/index.d.ts +27 -0
  225. package/types/components/input/index.d.ts +233 -0
  226. package/types/components/input/src/input.d.ts +65 -0
  227. package/types/components/input/src/input.vue.d.ts +239 -0
  228. package/types/components/input-number/index.d.ts +713 -0
  229. package/types/components/input-number/src/input-number.d.ts +101 -0
  230. package/types/components/input-number/src/input-number.vue.d.ts +283 -0
  231. package/types/components/input-search/index.d.ts +113 -0
  232. package/types/components/input-search/src/input-search.d.ts +128 -0
  233. package/types/components/input-search/src/input-search.vue.d.ts +114 -0
  234. package/types/components/qr-code/index.d.ts +109 -0
  235. package/types/components/qr-code/src/qr-code.d.ts +93 -0
  236. package/types/components/qr-code/src/qr-code.vue.d.ts +109 -0
  237. package/types/components/radial-menu/index.d.ts +499 -0
  238. package/types/components/radial-menu/src/radial-menu-item.d.ts +40 -0
  239. package/types/components/radial-menu/src/radial-menu-item.vue.d.ts +95 -0
  240. package/types/components/radial-menu/src/radial-menu.d.ts +92 -0
  241. package/types/components/radial-menu/src/radial-menu.vue.d.ts +200 -0
  242. package/types/components/radial-menu/src/types.d.ts +48 -0
  243. package/types/components/radial-menu/src/use-radial-menu-items.d.ts +19 -0
  244. package/types/components/radial-menu/src/use-radial-menu-keyboard.d.ts +17 -0
  245. package/types/components/radial-menu/src/use-radial-menu-position.d.ts +45 -0
  246. package/types/components/radial-menu/src/use-radial-menu-shortcut.d.ts +8 -0
  247. package/types/components/radial-menu/src/use-radial-menu-state.d.ts +15 -0
  248. package/types/components/select/index.d.ts +5 -0
  249. package/types/components/select/src/select.d.ts +30 -0
  250. package/types/components/select/src/select.vue.d.ts +25 -0
  251. package/types/components/table/index.d.ts +8 -0
  252. package/types/components/table/src/editor-registry.d.ts +24 -0
  253. package/types/components/table/src/proxy-data.d.ts +10 -0
  254. package/types/components/table/src/table-editor.d.ts +18 -0
  255. package/types/components/table/src/table-editor.vue.d.ts +43 -0
  256. package/types/components/table/src/table.d.ts +179 -0
  257. package/types/components/table/src/table.vue.d.ts +121 -0
  258. package/types/components/tree/index.d.ts +5 -0
  259. package/types/components/tree/src/tree-node.vue.d.ts +88 -0
  260. package/types/components/tree/src/tree-types.d.ts +90 -0
  261. package/types/components/tree/src/tree.d.ts +448 -0
  262. package/types/components/tree/src/tree.vue.d.ts +301 -0
  263. package/types/components/tree/src/use-tree-check-conduct.d.ts +43 -0
  264. package/types/components/tree/src/use-tree-checked-state.d.ts +34 -0
  265. package/types/components/tree/src/use-tree-drag.d.ts +45 -0
  266. package/types/components/tree/src/use-tree-expanded-state.d.ts +41 -0
  267. package/types/components/tree/src/use-tree-keyboard.d.ts +21 -0
  268. package/types/components/tree/src/use-tree-load.d.ts +25 -0
  269. package/types/components/tree/src/use-tree-scroll.d.ts +17 -0
  270. package/types/components/tree/src/use-tree-selected-state.d.ts +29 -0
  271. package/types/components/tree-select/index.d.ts +5 -0
  272. package/types/components/tree-select/src/tree-select.d.ts +26 -0
  273. package/types/components/tree-select/src/tree-select.vue.d.ts +25 -0
  274. package/types/falcon-ui/index.d.ts +8 -0
  275. package/types/hooks/index.d.ts +3 -0
  276. package/types/hooks/src/use-clearable-state.d.ts +10 -0
  277. package/types/hooks/src/use-component.d.ts +15 -0
  278. package/types/hooks/src/use-dialog.d.ts +49 -0
  279. package/types/icons/index.d.ts +1 -0
  280. package/types/icons/src/components/holder-outlined.vue.d.ts +3 -0
  281. package/types/icons/src/components/index.d.ts +3 -0
  282. package/types/icons/src/components/minus-square-outlined.vue.d.ts +3 -0
  283. package/types/icons/src/components/plus-square-outlined.vue.d.ts +3 -0
  284. package/types/utils/index.d.ts +3 -0
  285. package/types/utils/src/bem.d.ts +11 -0
  286. package/types/utils/src/component.d.ts +6 -0
  287. package/types/utils/src/install.d.ts +5 -0
  288. package/umd/falcon-ui.umd.js +13297 -0
  289. package/umd/falcon-ui.umd.js.map +1 -0
@@ -0,0 +1,916 @@
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, isVNode, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRef, unref, useSlots, useTemplateRef, watch } from "vue";
2
+ import { useGlobalSize } from "element-plus";
3
+ var defaultNamespace = "fl";
4
+ var statePrefix = "is-";
5
+ var buildBemName = (namespace, block, blockSuffix = "", element = "", modifier = "") => {
6
+ let className = `${namespace}-${block}`;
7
+ if (blockSuffix) className += `-${blockSuffix}`;
8
+ if (element) className += `__${element}`;
9
+ if (modifier) className += `--${modifier}`;
10
+ return className;
11
+ };
12
+ const useNamespace = (block, namespace = defaultNamespace) => {
13
+ const b = (blockSuffix = "") => buildBemName(namespace, block, blockSuffix);
14
+ const e = (element) => element ? buildBemName(namespace, block, "", element) : "";
15
+ const m = (modifier) => modifier ? buildBemName(namespace, block, "", "", modifier) : "";
16
+ const be = (blockSuffix, element) => {
17
+ if (!blockSuffix || !element) return "";
18
+ return buildBemName(namespace, block, blockSuffix, element);
19
+ };
20
+ const em = (element, modifier) => {
21
+ if (!element || !modifier) return "";
22
+ return buildBemName(namespace, block, "", element, modifier);
23
+ };
24
+ const bm = (blockSuffix, modifier) => {
25
+ if (!blockSuffix || !modifier) return "";
26
+ return buildBemName(namespace, block, blockSuffix, "", modifier);
27
+ };
28
+ const bem = (blockSuffix, element, modifier) => {
29
+ if (!blockSuffix && !element && !modifier) return b();
30
+ return buildBemName(namespace, block, blockSuffix, element, modifier);
31
+ };
32
+ const is = (name, state = true) => state ? `${statePrefix}${name}` : "";
33
+ return {
34
+ namespace,
35
+ b,
36
+ e,
37
+ m,
38
+ be,
39
+ em,
40
+ bm,
41
+ bem,
42
+ is
43
+ };
44
+ };
45
+ var radialMenuSizes = [
46
+ "large",
47
+ "medium",
48
+ "small"
49
+ ];
50
+ var radialMenuItemTypes = ["square", "circle"];
51
+ const flRadialMenuProps = {
52
+ items: {
53
+ type: Array,
54
+ default: () => []
55
+ },
56
+ mode: {
57
+ type: String,
58
+ default: "inline"
59
+ },
60
+ trigger: {
61
+ type: String,
62
+ default: "click"
63
+ },
64
+ modelValue: {
65
+ type: Boolean,
66
+ default: void 0
67
+ },
68
+ shortcut: {
69
+ type: String,
70
+ default: ""
71
+ },
72
+ shortcutEnabled: {
73
+ type: Boolean,
74
+ default: true
75
+ },
76
+ centerIcon: {
77
+ type: [Object, String],
78
+ default: void 0
79
+ },
80
+ centerLabel: {
81
+ type: String,
82
+ default: ""
83
+ },
84
+ disabled: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ maxRingItems: {
89
+ type: Number,
90
+ default: 6
91
+ },
92
+ closeOnSelect: {
93
+ type: Boolean,
94
+ default: true
95
+ },
96
+ moreText: {
97
+ type: String,
98
+ default: "More"
99
+ },
100
+ moreMode: {
101
+ type: String,
102
+ default: "text-ellipsis"
103
+ },
104
+ moreDropdownPlacement: {
105
+ type: String,
106
+ default: "bottom"
107
+ },
108
+ size: {
109
+ type: String,
110
+ default: void 0,
111
+ validator: (value) => radialMenuSizes.includes(value)
112
+ },
113
+ itemType: {
114
+ type: String,
115
+ default: "square",
116
+ validator: (value) => radialMenuItemTypes.includes(value)
117
+ },
118
+ teleport: {
119
+ type: [Boolean, String],
120
+ default: true
121
+ },
122
+ zIndex: {
123
+ type: Number,
124
+ default: 2e3
125
+ }
126
+ };
127
+ const flRadialMenuEmits = {
128
+ "update:modelValue": (opened) => typeof opened === "boolean",
129
+ open: (reason) => typeof reason === "string",
130
+ close: (reason) => typeof reason === "string",
131
+ select: (index, indexPath, item, context) => typeof index === "string" && Array.isArray(indexPath) && indexPath.every((path) => typeof path === "string") && item !== void 0 && context !== void 0,
132
+ "active-change": (item) => item === null || item !== void 0,
133
+ "more-open": () => true,
134
+ "more-close": () => true
135
+ };
136
+ const clampRingItemCount = (maxRingItems) => {
137
+ if (!Number.isFinite(maxRingItems)) return 6;
138
+ return Math.min(Math.max(Math.trunc(maxRingItems), 1), 6);
139
+ };
140
+ const resolveRadialMenuItemIndex = (item) => {
141
+ const rawIndex = item.index ?? item.key;
142
+ if (rawIndex === void 0 || rawIndex === null || rawIndex === "") return "";
143
+ return String(rawIndex);
144
+ };
145
+ const normalizeRadialMenuItems = (items, options = {}) => {
146
+ const seenIndexes = /* @__PURE__ */ new Set();
147
+ const normalizedItems = [];
148
+ for (const item of items) {
149
+ const index = resolveRadialMenuItemIndex(item);
150
+ if (!index) {
151
+ options.warn?.("Missing required prop: \"index\"");
152
+ continue;
153
+ }
154
+ if (seenIndexes.has(index)) {
155
+ options.warn?.(`Duplicate item index detected: ${index}`);
156
+ continue;
157
+ }
158
+ seenIndexes.add(index);
159
+ normalizedItems.push({
160
+ ...item,
161
+ index
162
+ });
163
+ }
164
+ return normalizedItems;
165
+ };
166
+ const splitRadialMenuItems = (items, maxRingItems) => {
167
+ const ringLimit = clampRingItemCount(maxRingItems);
168
+ const visibleItems = items.filter((item) => !item.hidden);
169
+ return {
170
+ visibleItems,
171
+ ringItems: visibleItems.slice(0, ringLimit),
172
+ moreItems: visibleItems.slice(ringLimit),
173
+ ringLimit
174
+ };
175
+ };
176
+ var findNextEnabledIndex = (items, currentIndex, direction) => {
177
+ if (items.length === 0) return -1;
178
+ for (let step = 1; step <= items.length; step += 1) {
179
+ const nextIndex = (currentIndex + step * direction + items.length) % items.length;
180
+ if (!items[nextIndex]?.disabled) return nextIndex;
181
+ }
182
+ return -1;
183
+ };
184
+ const useRadialMenuKeyboard = ({ ringItems, moreItems, ringRefs, moreRefs, closeMenu, closeMore, activateFocused }) => {
185
+ const focusRingItem = (index) => {
186
+ ringRefs.value[index]?.focus();
187
+ };
188
+ const focusFirstAvailableRingItem = () => {
189
+ const index = findNextEnabledIndex(ringItems.value, -1, 1);
190
+ if (index >= 0) focusRingItem(index);
191
+ };
192
+ const handleRingKeydown = (event, index) => {
193
+ if (event.key === "ArrowRight" || event.key === "ArrowDown") {
194
+ event.preventDefault();
195
+ const nextIndex = findNextEnabledIndex(ringItems.value, index, 1);
196
+ if (nextIndex >= 0) focusRingItem(nextIndex);
197
+ return;
198
+ }
199
+ if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
200
+ event.preventDefault();
201
+ const nextIndex = findNextEnabledIndex(ringItems.value, index, -1);
202
+ if (nextIndex >= 0) focusRingItem(nextIndex);
203
+ return;
204
+ }
205
+ if (event.key === "Enter" || event.key === " ") {
206
+ event.preventDefault();
207
+ activateFocused(event);
208
+ }
209
+ };
210
+ const handleMoreKeydown = (event, index) => {
211
+ if (event.key === "ArrowDown") {
212
+ event.preventDefault();
213
+ const nextIndex = findNextEnabledIndex(moreItems.value, index, 1);
214
+ moreRefs.value[nextIndex]?.focus();
215
+ return;
216
+ }
217
+ if (event.key === "ArrowUp") {
218
+ event.preventDefault();
219
+ const nextIndex = findNextEnabledIndex(moreItems.value, index, -1);
220
+ moreRefs.value[nextIndex]?.focus();
221
+ return;
222
+ }
223
+ if (event.key === "Enter" || event.key === " ") {
224
+ event.preventDefault();
225
+ activateFocused(event);
226
+ }
227
+ };
228
+ const handleMenuKeydown = (event) => {
229
+ if (event.key === "Escape") {
230
+ event.preventDefault();
231
+ closeMore();
232
+ closeMenu();
233
+ }
234
+ };
235
+ return {
236
+ focusFirstAvailableRingItem,
237
+ handleMenuKeydown,
238
+ handleRingKeydown,
239
+ handleMoreKeydown
240
+ };
241
+ };
242
+ var toRadians = (degree) => degree * Math.PI / 180;
243
+ var normalizeCircleCoordinate = (value) => Math.abs(value) < .001 ? 0 : value;
244
+ const normalizeRadialMenuAngle = (angle) => {
245
+ const normalized = angle % 360;
246
+ return normalized < 0 ? normalized + 360 : normalized;
247
+ };
248
+ var pointOnCircle = (radius, angle) => {
249
+ const radians = toRadians(angle);
250
+ return {
251
+ x: normalizeCircleCoordinate(Math.cos(radians) * radius),
252
+ y: normalizeCircleCoordinate(Math.sin(radians) * radius)
253
+ };
254
+ };
255
+ const getRadialMenuClockwiseArcPoints = ({ radius, targetAngle, startAngle = 0, steps = 7 }) => {
256
+ const safeSteps = Math.max(Math.floor(steps), 2);
257
+ const normalizedStartAngle = normalizeRadialMenuAngle(startAngle);
258
+ const clockwiseSweep = normalizeRadialMenuAngle(targetAngle - normalizedStartAngle);
259
+ return Array.from({ length: safeSteps }, (_, index) => {
260
+ return pointOnCircle(radius, normalizedStartAngle + clockwiseSweep * (index / (safeSteps - 1)));
261
+ });
262
+ };
263
+ const getRadialMenuClockwiseEntryOrder = (layouts, { startAngle = 0 } = {}) => {
264
+ const normalizedStartAngle = normalizeRadialMenuAngle(startAngle);
265
+ return layouts.map((layout, index) => ({
266
+ index,
267
+ distance: normalizeRadialMenuAngle(layout.angle - normalizedStartAngle)
268
+ })).sort((current, next) => next.distance - current.distance || current.index - next.index).map(({ index }) => index);
269
+ };
270
+ var getRadialMenuActiveAngles = ({ activeIndex, count, startAngle = -90 }) => {
271
+ const sectorAngle = 360 / Math.max(count, 1);
272
+ const gap = Math.min(6, sectorAngle / 4);
273
+ const centerAngle = startAngle + sectorAngle * activeIndex;
274
+ const start = centerAngle - sectorAngle / 2 + gap;
275
+ const end = centerAngle + sectorAngle / 2 - gap;
276
+ return {
277
+ start,
278
+ end,
279
+ largeArcFlag: end - start > 180 ? 1 : 0
280
+ };
281
+ };
282
+ const getRadialMenuItemLayout = ({ count, index, radius, startAngle = -90 }) => {
283
+ const angle = startAngle + 360 / Math.max(count, 1) * index;
284
+ const point = pointOnCircle(radius, angle);
285
+ return {
286
+ angle,
287
+ x: point.x,
288
+ y: point.y
289
+ };
290
+ };
291
+ const getRadialMenuSectorPath = ({ activeIndex, count, innerRadius, outerRadius, startAngle = -90 }) => {
292
+ if (outerRadius <= innerRadius) return "";
293
+ const { start, end, largeArcFlag } = getRadialMenuActiveAngles({
294
+ activeIndex,
295
+ count,
296
+ startAngle
297
+ });
298
+ const outerStart = pointOnCircle(outerRadius, start);
299
+ const outerEnd = pointOnCircle(outerRadius, end);
300
+ const innerEnd = pointOnCircle(innerRadius, end);
301
+ const innerStart = pointOnCircle(innerRadius, start);
302
+ return [
303
+ `M ${outerStart.x.toFixed(3)} ${outerStart.y.toFixed(3)}`,
304
+ `A ${outerRadius} ${outerRadius} 0 ${largeArcFlag} 1 ${outerEnd.x.toFixed(3)} ${outerEnd.y.toFixed(3)}`,
305
+ `L ${innerEnd.x.toFixed(3)} ${innerEnd.y.toFixed(3)}`,
306
+ `A ${innerRadius} ${innerRadius} 0 ${largeArcFlag} 0 ${innerStart.x.toFixed(3)} ${innerStart.y.toFixed(3)}`,
307
+ "Z"
308
+ ].join(" ");
309
+ };
310
+ const getRadialMenuTrackArcPath = ({ activeIndex, count, radius, innerRadius = 0, startAngle = -90 }) => {
311
+ if (radius <= innerRadius) return "";
312
+ const { start, end, largeArcFlag } = getRadialMenuActiveAngles({
313
+ activeIndex,
314
+ count,
315
+ startAngle
316
+ });
317
+ const arcStart = pointOnCircle(radius, start);
318
+ const arcEnd = pointOnCircle(radius, end);
319
+ return [`M ${arcStart.x.toFixed(3)} ${arcStart.y.toFixed(3)}`, `A ${radius} ${radius} 0 ${largeArcFlag} 1 ${arcEnd.x.toFixed(3)} ${arcEnd.y.toFixed(3)}`].join(" ");
320
+ };
321
+ const getRadialMenuTipPlacement = ({ x, y }) => {
322
+ if (Math.abs(x) > Math.abs(y)) return x < 0 ? "left" : "right";
323
+ return y < 0 ? "top" : "bottom";
324
+ };
325
+ var modifierKeys = new Set([
326
+ "alt",
327
+ "ctrl",
328
+ "control",
329
+ "meta",
330
+ "shift"
331
+ ]);
332
+ var isEditableTarget = (target) => {
333
+ if (!(target instanceof HTMLElement)) return false;
334
+ const tagName = target.tagName.toLowerCase();
335
+ return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
336
+ };
337
+ var normalizeShortcut = (value) => value.split("+").map((part) => part.trim().toLowerCase()).filter(Boolean);
338
+ var matchesShortcut = (event, shortcut) => {
339
+ const parts = normalizeShortcut(shortcut);
340
+ if (parts.length === 0) return false;
341
+ const key = parts.find((part) => !modifierKeys.has(part));
342
+ const expectsAlt = parts.includes("alt");
343
+ const expectsCtrl = parts.includes("ctrl") || parts.includes("control");
344
+ const expectsMeta = parts.includes("meta");
345
+ const expectsShift = parts.includes("shift");
346
+ return event.altKey === expectsAlt && event.ctrlKey === expectsCtrl && event.metaKey === expectsMeta && event.shiftKey === expectsShift && event.key.toLowerCase() === key;
347
+ };
348
+ var getViewportCenter = () => ({
349
+ x: typeof window === "undefined" ? 0 : window.innerWidth / 2,
350
+ y: typeof window === "undefined" ? 0 : window.innerHeight / 2
351
+ });
352
+ const useRadialMenuShortcut = ({ shortcut, enabled, open }) => {
353
+ const center = getViewportCenter();
354
+ let lastMouseX = center.x;
355
+ let lastMouseY = center.y;
356
+ const handleMouseMove = (event) => {
357
+ lastMouseX = event.clientX;
358
+ lastMouseY = event.clientY;
359
+ };
360
+ const handleKeydown = (event) => {
361
+ if (!enabled.value || !matchesShortcut(event, shortcut.value) || isEditableTarget(event.target)) return;
362
+ event.preventDefault();
363
+ open({
364
+ x: lastMouseX,
365
+ y: lastMouseY,
366
+ reason: "shortcut"
367
+ });
368
+ };
369
+ onMounted(() => {
370
+ window.addEventListener("mousemove", handleMouseMove);
371
+ window.addEventListener("keydown", handleKeydown);
372
+ });
373
+ onUnmounted(() => {
374
+ window.removeEventListener("mousemove", handleMouseMove);
375
+ window.removeEventListener("keydown", handleKeydown);
376
+ });
377
+ };
378
+ const useRadialMenuState = ({ modelValue, disabled, emitUpdate }) => {
379
+ const uncontrolledOpened = ref(false);
380
+ const floatingX = ref();
381
+ const floatingY = ref();
382
+ const isControlled = computed(() => modelValue.value !== void 0);
383
+ const opened = computed(() => isControlled.value ? modelValue.value === true : uncontrolledOpened.value);
384
+ const setOpened = (nextOpened) => {
385
+ if (disabled.value && nextOpened) return;
386
+ if (!isControlled.value) uncontrolledOpened.value = nextOpened;
387
+ emitUpdate(nextOpened);
388
+ };
389
+ const open = (options = {}) => {
390
+ if (options.x !== void 0) floatingX.value = options.x;
391
+ if (options.y !== void 0) floatingY.value = options.y;
392
+ setOpened(true);
393
+ };
394
+ const close = (_reason = "manual") => {
395
+ setOpened(false);
396
+ };
397
+ const toggle = (options = {}) => {
398
+ if (opened.value) close("manual");
399
+ else open(options);
400
+ };
401
+ return {
402
+ opened,
403
+ floatingX,
404
+ floatingY,
405
+ open,
406
+ close,
407
+ toggle
408
+ };
409
+ };
410
+ var _hoisted_1 = ["disabled", "aria-expanded"];
411
+ var _hoisted_2 = ["r"];
412
+ var _hoisted_3 = ["d"];
413
+ var _hoisted_4 = ["d"];
414
+ var _hoisted_5 = [
415
+ "disabled",
416
+ "tabindex",
417
+ "aria-disabled",
418
+ "aria-label",
419
+ "data-radial-menu-index",
420
+ "onMouseenter",
421
+ "onFocus",
422
+ "onClick",
423
+ "onKeydown"
424
+ ];
425
+ var _hoisted_6 = ["aria-expanded"];
426
+ var _hoisted_7 = [
427
+ "disabled",
428
+ "tabindex",
429
+ "aria-disabled",
430
+ "aria-label",
431
+ "data-radial-menu-more-index",
432
+ "onClick",
433
+ "onKeydown"
434
+ ];
435
+ var radialMenuEntryTrackDelay = 120;
436
+ var radialMenuEntryItemMinDuration = 440;
437
+ var radialMenuEntryItemMaxDuration = 600;
438
+ var radialMenuEntryItemStagger = 90;
439
+ var radialMenuEntryArcSteps = 9;
440
+ var radialMenuEntryStartAngle = 180;
441
+ var radialMenuEntryEasing = "cubic-bezier(0.2, 0, 0, 1)";
442
+ var radial_menu_default = /* @__PURE__ */ defineComponent({
443
+ name: "FlRadialMenu",
444
+ __name: "radial-menu",
445
+ props: flRadialMenuProps,
446
+ emits: flRadialMenuEmits,
447
+ setup(__props, { expose: __expose, emit: __emit }) {
448
+ const props = __props;
449
+ const emit = __emit;
450
+ const ns = useNamespace("radial-menu");
451
+ const slots = useSlots();
452
+ const rootRef = useTemplateRef("rootRef");
453
+ const centerRef = useTemplateRef("centerRef");
454
+ const activeRingIndex = ref(null);
455
+ const moreOpened = ref(false);
456
+ const isEntryAnimating = ref(false);
457
+ const ringButtonRefs = ref([]);
458
+ const moreButtonRefs = ref([]);
459
+ const warnedMessages = /* @__PURE__ */ new Set();
460
+ const globalSize = useGlobalSize();
461
+ const radialMenuGeometryBySize = {
462
+ large: {
463
+ radius: 96,
464
+ centerSize: 56
465
+ },
466
+ medium: {
467
+ radius: 80,
468
+ centerSize: 48
469
+ },
470
+ small: {
471
+ radius: 64,
472
+ centerSize: 40
473
+ }
474
+ };
475
+ const mapGlobalSize = (size) => {
476
+ if (size === "large" || size === "small") return size;
477
+ if (size === "default") return "medium";
478
+ return "large";
479
+ };
480
+ const warnRadialMenu = (message) => {
481
+ if (warnedMessages.has(message)) return;
482
+ warnedMessages.add(message);
483
+ console.warn(`[FlRadialMenu] ${message}`);
484
+ };
485
+ const flattenSlotVNodes = (children) => {
486
+ const vnodes = [];
487
+ for (const child of children) {
488
+ if (Array.isArray(child)) {
489
+ vnodes.push(...flattenSlotVNodes(child));
490
+ continue;
491
+ }
492
+ if (!isVNode(child)) continue;
493
+ if (child.type === Fragment && Array.isArray(child.children)) {
494
+ vnodes.push(...flattenSlotVNodes(child.children));
495
+ continue;
496
+ }
497
+ vnodes.push(child);
498
+ }
499
+ return vnodes;
500
+ };
501
+ const isRadialMenuItemVNode = (vnode) => typeof vnode.type === "object" && "name" in vnode.type && vnode.type.name === "FlRadialMenuItem";
502
+ const readBooleanSlotProp = (value) => value === true || value === "";
503
+ const readOptionalBooleanSlotProp = (value) => value === void 0 ? void 0 : readBooleanSlotProp(value);
504
+ const readSlotItemSlots = (children) => {
505
+ if (!children || Array.isArray(children) || typeof children !== "object") return;
506
+ return children;
507
+ };
508
+ const readSlotItemProps = (vnode) => {
509
+ const vnodeProps = vnode.props ?? {};
510
+ const vnodeSlots = readSlotItemSlots(vnode.children);
511
+ return {
512
+ index: typeof vnodeProps.index === "string" ? vnodeProps.index : void 0,
513
+ label: typeof vnodeProps.label === "string" ? vnodeProps.label : "",
514
+ icon: vnodeProps.icon,
515
+ shortcut: typeof vnodeProps.shortcut === "string" ? vnodeProps.shortcut : void 0,
516
+ disabled: readBooleanSlotProp(vnodeProps.disabled),
517
+ hidden: readBooleanSlotProp(vnodeProps.hidden),
518
+ divided: readBooleanSlotProp(vnodeProps.divided),
519
+ closeOnSelect: readOptionalBooleanSlotProp(vnodeProps.closeOnSelect),
520
+ meta: vnodeProps.meta && typeof vnodeProps.meta === "object" ? vnodeProps.meta : void 0,
521
+ iconSlot: vnodeSlots?.icon,
522
+ labelSlot: vnodeSlots?.label
523
+ };
524
+ };
525
+ const slotItems = computed(() => flattenSlotVNodes(slots.default?.() ?? []).filter(isRadialMenuItemVNode).map(readSlotItemProps));
526
+ const resolvedItems = computed(() => normalizeRadialMenuItems(slotItems.value.length > 0 ? slotItems.value : props.items, { warn: warnRadialMenu }));
527
+ const splitItems = computed(() => splitRadialMenuItems(resolvedItems.value, props.maxRingItems));
528
+ const ringItems = computed(() => splitItems.value.ringItems);
529
+ const moreItems = computed(() => splitItems.value.moreItems);
530
+ const resolvedSize = computed(() => props.size ?? mapGlobalSize(globalSize.value));
531
+ const sizeGeometry = computed(() => radialMenuGeometryBySize[resolvedSize.value]);
532
+ const resolvedRadius = computed(() => sizeGeometry.value.radius);
533
+ const resolvedCenterSize = computed(() => sizeGeometry.value.centerSize);
534
+ const activeItem = computed(() => activeRingIndex.value === null ? null : ringItems.value[activeRingIndex.value] ?? null);
535
+ const sectorInnerRadius = computed(() => resolvedCenterSize.value / 2 + 8);
536
+ const sectorPath = computed(() => {
537
+ if (activeRingIndex.value === null || ringItems.value.length === 0) return "";
538
+ return getRadialMenuSectorPath({
539
+ activeIndex: activeRingIndex.value,
540
+ count: ringItems.value.length,
541
+ innerRadius: sectorInnerRadius.value,
542
+ outerRadius: resolvedRadius.value
543
+ });
544
+ });
545
+ const activeTrackPath = computed(() => {
546
+ if (activeRingIndex.value === null || ringItems.value.length === 0) return "";
547
+ return getRadialMenuTrackArcPath({
548
+ activeIndex: activeRingIndex.value,
549
+ count: ringItems.value.length,
550
+ radius: resolvedRadius.value,
551
+ innerRadius: sectorInnerRadius.value
552
+ });
553
+ });
554
+ const { opened, floatingX, floatingY, open, close, toggle } = useRadialMenuState({
555
+ modelValue: toRef(props, "modelValue"),
556
+ disabled: toRef(props, "disabled"),
557
+ emitUpdate: (nextOpened) => emit("update:modelValue", nextOpened)
558
+ });
559
+ useRadialMenuShortcut({
560
+ shortcut: toRef(props, "shortcut"),
561
+ enabled: computed(() => props.shortcutEnabled && Boolean(props.shortcut)),
562
+ open
563
+ });
564
+ const rootClass = computed(() => [
565
+ ns.b(),
566
+ ns.m(props.mode),
567
+ ns.m(resolvedSize.value),
568
+ ns.m(`item-${props.itemType}`),
569
+ ns.is("opened", opened.value),
570
+ ns.is("entering", isEntryAnimating.value),
571
+ ns.is("disabled", props.disabled)
572
+ ]);
573
+ const rootStyle = computed(() => ({
574
+ "--fl-radial-menu-floating-x": `${floatingX.value ?? (typeof window === "undefined" ? 0 : window.innerWidth / 2)}px`,
575
+ "--fl-radial-menu-floating-y": `${floatingY.value ?? (typeof window === "undefined" ? 0 : window.innerHeight / 2)}px`,
576
+ "--fl-radial-menu-z-index": String(props.zIndex),
577
+ "--fl-radial-menu-more-enter-delay": `${radialMenuEntryTrackDelay + Math.max(ringItems.value.length - 1, 0) * radialMenuEntryItemStagger}ms`
578
+ }));
579
+ const getItemIcon = (item) => item.iconSlot ?? item.icon;
580
+ const RadialMenuItemLabel = ({ item }) => item.labelSlot?.() ?? item.label;
581
+ const getItemLayout = (index) => getRadialMenuItemLayout({
582
+ count: ringItems.value.length,
583
+ index,
584
+ radius: resolvedRadius.value
585
+ });
586
+ const formatEntryCoordinate = (value) => {
587
+ return `${Math.abs(value) < .001 ? 0 : Number(value.toFixed(3))}px`;
588
+ };
589
+ const getEntryTransform = (x, y, scale = 1) => `translate(calc(-50% + ${formatEntryCoordinate(x)}), calc(-50% + ${formatEntryCoordinate(y)})) scale(${scale})`;
590
+ const prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
591
+ const canUseWebAnimations = () => typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype.animate === "function";
592
+ const canAnimateElement = (element) => typeof element.animate === "function";
593
+ const getItemStyle = (index) => {
594
+ const layout = getItemLayout(index);
595
+ return {
596
+ "--fl-radial-menu-item-x": `${layout.x}px`,
597
+ "--fl-radial-menu-item-y": `${layout.y}px`,
598
+ "--fl-radial-menu-item-index": String(index)
599
+ };
600
+ };
601
+ const getItemLabelClass = (index) => {
602
+ const placement = getRadialMenuTipPlacement(getItemLayout(index));
603
+ return [
604
+ ns.e("item-label"),
605
+ ns.em("item-label", `tip-${placement}`),
606
+ moreItems.value.length > 0 && placement === "bottom" ? ns.em("item-label", "hidden-by-more") : ""
607
+ ];
608
+ };
609
+ const moreLabel = computed(() => {
610
+ if (props.moreMode === "ellipsis") return "...";
611
+ if (props.moreMode === "text") return props.moreText;
612
+ return `${props.moreText} ...`;
613
+ });
614
+ const setActiveRingIndex = (index) => {
615
+ activeRingIndex.value = index;
616
+ emit("active-change", activeItem.value);
617
+ };
618
+ const setRingButtonRef = (element, index) => {
619
+ if (element instanceof HTMLButtonElement) ringButtonRefs.value[index] = element;
620
+ else delete ringButtonRefs.value[index];
621
+ };
622
+ const setMoreButtonRef = (element, index) => {
623
+ if (element instanceof HTMLButtonElement) moreButtonRefs.value[index] = element;
624
+ else delete moreButtonRefs.value[index];
625
+ };
626
+ const setMoreOpened = (nextOpened) => {
627
+ moreOpened.value = nextOpened;
628
+ if (nextOpened) emit("more-open");
629
+ else emit("more-close");
630
+ };
631
+ let isDocumentPointerdownBound = false;
632
+ const removeDocumentPointerdown = () => {
633
+ if (!isDocumentPointerdownBound || typeof document === "undefined") return;
634
+ document.removeEventListener("pointerdown", handleDocumentPointerdown);
635
+ isDocumentPointerdownBound = false;
636
+ };
637
+ const addDocumentPointerdown = () => {
638
+ if (isDocumentPointerdownBound || typeof document === "undefined") return;
639
+ document.addEventListener("pointerdown", handleDocumentPointerdown);
640
+ isDocumentPointerdownBound = true;
641
+ };
642
+ const handleDocumentPointerdown = (event) => {
643
+ const { target } = event;
644
+ if (!(target instanceof Node)) return;
645
+ if (rootRef.value?.contains(target)) return;
646
+ moreOpened.value = false;
647
+ close("click-outside");
648
+ };
649
+ const activateItem = (item, source, index, event) => {
650
+ if (item.disabled) return;
651
+ emit("select", item.index, [item.index], item, {
652
+ source,
653
+ index,
654
+ event
655
+ });
656
+ if (item.closeOnSelect ?? props.closeOnSelect) {
657
+ moreOpened.value = false;
658
+ close("select");
659
+ }
660
+ };
661
+ const activateKeyboardItem = (event) => {
662
+ const target = event.currentTarget;
663
+ if (!(target instanceof HTMLElement)) return;
664
+ target.click();
665
+ };
666
+ const { focusFirstAvailableRingItem, handleMenuKeydown, handleRingKeydown, handleMoreKeydown } = useRadialMenuKeyboard({
667
+ ringItems,
668
+ moreItems,
669
+ ringRefs: ringButtonRefs,
670
+ moreRefs: moreButtonRefs,
671
+ closeMenu: () => close("escape"),
672
+ closeMore: () => {
673
+ moreOpened.value = false;
674
+ },
675
+ activateFocused: activateKeyboardItem
676
+ });
677
+ let entryAnimations = [];
678
+ let entryAnimationToken = 0;
679
+ let entryFinishTimer;
680
+ const clearEntryFinishTimer = () => {
681
+ if (entryFinishTimer === void 0) return;
682
+ clearTimeout(entryFinishTimer);
683
+ entryFinishTimer = void 0;
684
+ };
685
+ const cancelEntryAnimations = () => {
686
+ entryAnimationToken += 1;
687
+ clearEntryFinishTimer();
688
+ for (const animation of entryAnimations) animation.cancel();
689
+ entryAnimations = [];
690
+ isEntryAnimating.value = false;
691
+ };
692
+ const finishEntryAnimations = (token) => {
693
+ if (token !== entryAnimationToken) return;
694
+ clearEntryFinishTimer();
695
+ for (const animation of entryAnimations) animation.cancel();
696
+ entryAnimations = [];
697
+ isEntryAnimating.value = false;
698
+ };
699
+ const getEntryOrderByIndex = () => {
700
+ const entryOrder = getRadialMenuClockwiseEntryOrder(ringItems.value.map((_, index) => getItemLayout(index)), { startAngle: radialMenuEntryStartAngle });
701
+ return new Map(entryOrder.map((itemIndex, orderIndex) => [itemIndex, orderIndex]));
702
+ };
703
+ const getRingItemEntryDistance = (index) => normalizeRadialMenuAngle(getItemLayout(index).angle - radialMenuEntryStartAngle);
704
+ const getRingItemEntryDuration = (index) => {
705
+ const distanceRatio = Math.min(getRingItemEntryDistance(index), 360) / 360;
706
+ return radialMenuEntryItemMinDuration + (radialMenuEntryItemMaxDuration - radialMenuEntryItemMinDuration) * distanceRatio;
707
+ };
708
+ const getRingItemEntryKeyframes = (index) => {
709
+ const layout = getItemLayout(index);
710
+ const finalOpacity = ringItems.value[index]?.disabled ? .5 : 1;
711
+ const points = getRadialMenuClockwiseArcPoints({
712
+ radius: resolvedRadius.value,
713
+ startAngle: radialMenuEntryStartAngle,
714
+ targetAngle: layout.angle,
715
+ steps: radialMenuEntryArcSteps
716
+ });
717
+ return points.map((point, pointIndex) => ({
718
+ offset: pointIndex / (points.length - 1),
719
+ opacity: pointIndex === 0 ? 0 : finalOpacity,
720
+ transform: getEntryTransform(point.x, point.y, pointIndex === 0 ? .86 : 1)
721
+ }));
722
+ };
723
+ const playEntryAnimations = () => {
724
+ if (prefersReducedMotion() || ringItems.value.length === 0) {
725
+ isEntryAnimating.value = false;
726
+ return;
727
+ }
728
+ const ringButtons = ringButtonRefs.value.slice(0, ringItems.value.length);
729
+ const entryOrderByIndex = getEntryOrderByIndex();
730
+ const animations = [];
731
+ let maxEntryEndTime = 0;
732
+ ringButtons.forEach((button, index) => {
733
+ if (!button || !canAnimateElement(button)) return;
734
+ const delay = radialMenuEntryTrackDelay + (entryOrderByIndex.get(index) ?? index) * radialMenuEntryItemStagger;
735
+ const duration = getRingItemEntryDuration(index);
736
+ const animation = button.animate(getRingItemEntryKeyframes(index), {
737
+ delay,
738
+ duration,
739
+ easing: radialMenuEntryEasing,
740
+ fill: "both"
741
+ });
742
+ maxEntryEndTime = Math.max(maxEntryEndTime, delay + duration);
743
+ animations.push(animation);
744
+ });
745
+ if (animations.length === 0) {
746
+ isEntryAnimating.value = false;
747
+ return;
748
+ }
749
+ entryAnimationToken += 1;
750
+ const token = entryAnimationToken;
751
+ entryAnimations = animations;
752
+ isEntryAnimating.value = true;
753
+ entryFinishTimer = setTimeout(() => finishEntryAnimations(token), Math.ceil(maxEntryEndTime) + 40);
754
+ };
755
+ watch(opened, async (nextOpened) => {
756
+ cancelEntryAnimations();
757
+ if (!nextOpened) return;
758
+ isEntryAnimating.value = canUseWebAnimations() && !prefersReducedMotion() && ringItems.value.length > 0;
759
+ await nextTick();
760
+ if (!opened.value) return;
761
+ playEntryAnimations();
762
+ focusFirstAvailableRingItem();
763
+ });
764
+ watch(opened, (nextOpened) => {
765
+ if (nextOpened) addDocumentPointerdown();
766
+ else removeDocumentPointerdown();
767
+ }, { immediate: true });
768
+ onBeforeUnmount(() => {
769
+ removeDocumentPointerdown();
770
+ cancelEntryAnimations();
771
+ });
772
+ const handleCenterClick = () => {
773
+ if (props.disabled || props.trigger !== "click") return;
774
+ toggle({ reason: "click" });
775
+ };
776
+ const handleMouseEnter = () => {
777
+ if (props.disabled || props.trigger !== "hover") return;
778
+ open({ reason: "hover" });
779
+ };
780
+ const handleMouseLeave = () => {
781
+ if (props.trigger !== "hover") return;
782
+ close("hover-leave");
783
+ };
784
+ const focus = () => {
785
+ centerRef.value?.focus();
786
+ };
787
+ __expose({
788
+ open: (options) => open(options),
789
+ close,
790
+ toggle,
791
+ focus
792
+ });
793
+ return (_ctx, _cache) => {
794
+ return openBlock(), createElementBlock("div", {
795
+ ref_key: "rootRef",
796
+ ref: rootRef,
797
+ class: normalizeClass(rootClass.value),
798
+ style: normalizeStyle(rootStyle.value),
799
+ onMouseenter: handleMouseEnter,
800
+ onMouseleave: handleMouseLeave
801
+ }, [createElementVNode("button", {
802
+ ref_key: "centerRef",
803
+ ref: centerRef,
804
+ type: "button",
805
+ class: normalizeClass(unref(ns).e("center")),
806
+ disabled: props.disabled,
807
+ "aria-expanded": unref(opened),
808
+ "aria-haspopup": "menu",
809
+ onClick: handleCenterClick
810
+ }, [renderSlot(_ctx.$slots, "center", {}, () => [props.centerIcon && typeof props.centerIcon !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(props.centerIcon), { key: 0 })) : props.centerIcon ? (openBlock(), createElementBlock("span", {
811
+ key: 1,
812
+ class: normalizeClass(unref(ns).e("center-icon"))
813
+ }, toDisplayString(props.centerIcon), 3)) : createCommentVNode("v-if", true), props.centerLabel ? (openBlock(), createElementBlock("span", {
814
+ key: 2,
815
+ class: normalizeClass(unref(ns).e("center-label"))
816
+ }, toDisplayString(props.centerLabel), 3)) : createCommentVNode("v-if", true)])], 10, _hoisted_1), unref(opened) ? (openBlock(), createElementBlock("div", {
817
+ key: 0,
818
+ class: normalizeClass(unref(ns).e("panel")),
819
+ role: "menu",
820
+ onKeydown: _cache[2] || (_cache[2] = (...args) => unref(handleMenuKeydown) && unref(handleMenuKeydown)(...args))
821
+ }, [
822
+ (openBlock(), createElementBlock("svg", {
823
+ class: normalizeClass(unref(ns).e("sector")),
824
+ viewBox: "-140 -140 280 280",
825
+ "aria-hidden": "true"
826
+ }, [
827
+ createElementVNode("circle", {
828
+ class: normalizeClass(unref(ns).e("track")),
829
+ cx: "0",
830
+ cy: "0",
831
+ r: resolvedRadius.value
832
+ }, null, 10, _hoisted_2),
833
+ sectorPath.value ? (openBlock(), createElementBlock("path", {
834
+ key: 0,
835
+ class: normalizeClass(unref(ns).e("sector-path")),
836
+ d: sectorPath.value
837
+ }, null, 10, _hoisted_3)) : createCommentVNode("v-if", true),
838
+ activeTrackPath.value ? (openBlock(), createElementBlock("path", {
839
+ key: 1,
840
+ class: normalizeClass(unref(ns).e("track-active")),
841
+ d: activeTrackPath.value
842
+ }, null, 10, _hoisted_4)) : createCommentVNode("v-if", true)
843
+ ], 2)),
844
+ (openBlock(true), createElementBlock(Fragment, null, renderList(ringItems.value, (item, index) => {
845
+ return openBlock(), createElementBlock("button", {
846
+ key: item.index,
847
+ ref_for: true,
848
+ ref: (element) => setRingButtonRef(element, index),
849
+ type: "button",
850
+ role: "menuitem",
851
+ class: normalizeClass([
852
+ unref(ns).e("item"),
853
+ unref(ns).is("active", activeRingIndex.value === index),
854
+ unref(ns).is("disabled", item.disabled === true)
855
+ ]),
856
+ style: normalizeStyle(getItemStyle(index)),
857
+ disabled: item.disabled,
858
+ tabindex: item.disabled ? -1 : 0,
859
+ "aria-disabled": item.disabled === true,
860
+ "aria-label": item.label,
861
+ "data-radial-menu-index": item.index,
862
+ onMouseenter: ($event) => setActiveRingIndex(index),
863
+ onFocus: ($event) => setActiveRingIndex(index),
864
+ onMouseleave: _cache[0] || (_cache[0] = ($event) => setActiveRingIndex(null)),
865
+ onClick: ($event) => activateItem(item, "ring", index, $event),
866
+ onKeydown: ($event) => unref(handleRingKeydown)($event, index)
867
+ }, [getItemIcon(item) && typeof getItemIcon(item) !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(getItemIcon(item)), { key: 0 })) : getItemIcon(item) ? (openBlock(), createElementBlock("span", {
868
+ key: 1,
869
+ class: normalizeClass(unref(ns).e("item-icon"))
870
+ }, toDisplayString(getItemIcon(item)), 3)) : createCommentVNode("v-if", true), createElementVNode("span", { class: normalizeClass(getItemLabelClass(index)) }, [createVNode(RadialMenuItemLabel, { item }, null, 8, ["item"])], 2)], 46, _hoisted_5);
871
+ }), 128)),
872
+ moreItems.value.length > 0 ? (openBlock(), createElementBlock("button", {
873
+ key: 0,
874
+ type: "button",
875
+ class: normalizeClass(unref(ns).e("more")),
876
+ "aria-haspopup": "menu",
877
+ "aria-expanded": moreOpened.value,
878
+ onClick: _cache[1] || (_cache[1] = ($event) => setMoreOpened(!moreOpened.value))
879
+ }, toDisplayString(moreLabel.value), 11, _hoisted_6)) : createCommentVNode("v-if", true),
880
+ moreOpened.value ? (openBlock(), createElementBlock("div", {
881
+ key: 1,
882
+ class: normalizeClass([unref(ns).e("more-dropdown"), unref(ns).m(`more-${props.moreDropdownPlacement}`)]),
883
+ role: "menu"
884
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(moreItems.value, (item, index) => {
885
+ return openBlock(), createElementBlock("button", {
886
+ key: item.index,
887
+ ref_for: true,
888
+ ref: (element) => setMoreButtonRef(element, index),
889
+ type: "button",
890
+ role: "menuitem",
891
+ class: normalizeClass([unref(ns).e("more-item"), unref(ns).is("disabled", item.disabled === true)]),
892
+ disabled: item.disabled,
893
+ tabindex: item.disabled ? -1 : 0,
894
+ "aria-disabled": item.disabled === true,
895
+ "aria-label": item.label,
896
+ "data-radial-menu-more-index": item.index,
897
+ onClick: ($event) => activateItem(item, "more", index, $event),
898
+ onKeydown: ($event) => unref(handleMoreKeydown)($event, index)
899
+ }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("more-content")) }, [getItemIcon(item) && typeof getItemIcon(item) !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(getItemIcon(item)), {
900
+ key: 0,
901
+ class: normalizeClass(unref(ns).e("more-icon"))
902
+ }, null, 8, ["class"])) : getItemIcon(item) ? (openBlock(), createElementBlock("span", {
903
+ key: 1,
904
+ class: normalizeClass(unref(ns).e("more-icon"))
905
+ }, toDisplayString(getItemIcon(item)), 3)) : createCommentVNode("v-if", true), createElementVNode("span", { class: normalizeClass(unref(ns).e("more-label")) }, [createVNode(RadialMenuItemLabel, { item }, null, 8, ["item"])], 2)], 2), item.shortcut ? (openBlock(), createElementBlock("span", {
906
+ key: 0,
907
+ class: normalizeClass(unref(ns).e("shortcut"))
908
+ }, toDisplayString(item.shortcut), 3)) : createCommentVNode("v-if", true)], 42, _hoisted_7);
909
+ }), 128))], 2)) : createCommentVNode("v-if", true)
910
+ ], 34)) : createCommentVNode("v-if", true)], 38);
911
+ };
912
+ }
913
+ });
914
+ export { radial_menu_default as default };
915
+
916
+ //# sourceMappingURL=radial-menu.vue.mjs.map