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