yuyeon 0.3.5 → 0.3.6-beta.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 (139) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/yuyeon.js +2394 -2332
  3. package/dist/yuyeon.umd.cjs +3 -3
  4. package/lib/abstract/items.js.map +1 -1
  5. package/lib/components/alert/YAlert.js +2 -2
  6. package/lib/components/alert/YAlert.js.map +1 -1
  7. package/lib/components/badge/YBadge.js.map +1 -1
  8. package/lib/components/badge/YBadge.scss +87 -87
  9. package/lib/components/card/YCard.js.map +1 -1
  10. package/lib/components/checkbox/YCheckbox.js.map +1 -1
  11. package/lib/components/date-picker/YDateCalendar.js.map +1 -1
  12. package/lib/components/date-picker/YDatePicker.js.map +1 -1
  13. package/lib/components/date-picker/YDatePickerControl.js.map +1 -1
  14. package/lib/components/date-picker/YMonthPicker.js.map +1 -1
  15. package/lib/components/date-picker/YYearPicker.js.map +1 -1
  16. package/lib/components/dialog/YDialog.js.map +1 -1
  17. package/lib/components/divider/YDivider.js.map +1 -1
  18. package/lib/components/draggable/YDraggable.js.map +1 -1
  19. package/lib/components/draggable/index.js.map +1 -1
  20. package/lib/components/dropdown/YDropdown.js.map +1 -1
  21. package/lib/components/field-input/YFieldInput.js.map +1 -1
  22. package/lib/components/form/YForm.js.map +1 -1
  23. package/lib/components/hover/YHover.js.map +1 -1
  24. package/lib/components/icon/YIcon.js.map +1 -1
  25. package/lib/components/icons/YIconCheckbox.js.map +1 -1
  26. package/lib/components/icons/YIconCheckbox.scss +4 -5
  27. package/lib/components/icons/YIconClear.js.map +1 -1
  28. package/lib/components/icons/YIconDropdown.js.map +1 -1
  29. package/lib/components/icons/YIconExpand.js.map +1 -1
  30. package/lib/components/icons/YIconPageControl.js.map +1 -1
  31. package/lib/components/icons/YIconSort.js.map +1 -1
  32. package/lib/components/img/YImg.js +4 -4
  33. package/lib/components/img/YImg.js.map +1 -1
  34. package/lib/components/img/index.js.map +1 -1
  35. package/lib/components/index.js.map +1 -1
  36. package/lib/components/input/YInput.js.map +1 -1
  37. package/lib/components/layer/YLayer.js.map +1 -1
  38. package/lib/components/layer/base.js +2 -2
  39. package/lib/components/layer/base.js.map +1 -1
  40. package/lib/components/layer/content.js.map +1 -1
  41. package/lib/components/list/YListItem.js.map +1 -1
  42. package/lib/components/menu/YMenu.js +2 -2
  43. package/lib/components/menu/YMenu.js.map +1 -1
  44. package/lib/components/panel/YDividePanel.js.map +1 -1
  45. package/lib/components/panel/YDividePanel.scss +44 -44
  46. package/lib/components/plate/YPlate.js +2 -2
  47. package/lib/components/plate/YPlate.js.map +1 -1
  48. package/lib/components/radio/YRadio.js.map +1 -1
  49. package/lib/components/radio/YRadioIcon.js.map +1 -1
  50. package/lib/components/radio/index.js.map +1 -1
  51. package/lib/components/select/YSelect.js.map +1 -1
  52. package/lib/components/slider/YSlider.js.map +1 -1
  53. package/lib/components/slider/index.js.map +1 -1
  54. package/lib/components/switch/YSwitch.js.map +1 -1
  55. package/lib/components/tab/YTab.js.map +1 -1
  56. package/lib/components/tab/YTabs.js.map +1 -1
  57. package/lib/components/table/YDataTable.js.map +1 -1
  58. package/lib/components/table/YDataTableBody.js.map +1 -1
  59. package/lib/components/table/YDataTableControl.js.map +1 -1
  60. package/lib/components/table/YDataTableControl.scss +17 -17
  61. package/lib/components/table/YDataTableLayerRows.js.map +1 -1
  62. package/lib/components/table/YDataTableServer.js.map +1 -1
  63. package/lib/components/table/YTable.js.map +1 -1
  64. package/lib/components/table/composables/expand.js.map +1 -1
  65. package/lib/components/table/composables/header.js.map +1 -1
  66. package/lib/components/table/composables/items.js.map +1 -1
  67. package/lib/components/table/composables/measure.js.map +1 -1
  68. package/lib/components/table/composables/provides.js.map +1 -1
  69. package/lib/components/table/types/item.js.map +1 -1
  70. package/lib/components/text-ellipsis/YTextEllipsis.js.map +1 -1
  71. package/lib/components/text-highlighter/YTextHighlighter.js.map +1 -1
  72. package/lib/components/text-interpolation/YTi.js.map +1 -1
  73. package/lib/components/tooltip/YTooltip.js +2 -2
  74. package/lib/components/tooltip/YTooltip.js.map +1 -1
  75. package/lib/components/tree-view/YTreeView.js +23 -28
  76. package/lib/components/tree-view/YTreeView.js.map +1 -1
  77. package/lib/components/tree-view/YTreeViewNode.js +58 -20
  78. package/lib/components/tree-view/YTreeViewNode.js.map +1 -1
  79. package/lib/components/tree-view/tree-view.js +61 -8
  80. package/lib/components/tree-view/tree-view.js.map +1 -1
  81. package/lib/components/tree-view/types.js.map +1 -1
  82. package/lib/composables/choice.js.map +1 -1
  83. package/lib/composables/coordinate/index.js.map +1 -1
  84. package/lib/composables/coordinate/levitation.js +2 -2
  85. package/lib/composables/coordinate/levitation.js.map +1 -1
  86. package/lib/composables/coordinate/types.js.map +1 -1
  87. package/lib/composables/defaults/types.js.map +1 -1
  88. package/lib/composables/form.js.map +1 -1
  89. package/lib/composables/style-color.js.map +1 -1
  90. package/lib/composables/theme/index.js.map +1 -1
  91. package/lib/composables/theme/types.js.map +1 -1
  92. package/lib/composables/timing.js.map +1 -1
  93. package/lib/composables/validation.js.map +1 -1
  94. package/lib/directives/index.js.map +1 -1
  95. package/lib/directives/plate-wave/index.js +2 -2
  96. package/lib/directives/plate-wave/index.js.map +1 -1
  97. package/lib/directives/plate-wave/plate-wave.scss +44 -44
  98. package/lib/directives/theme-class/index.js.map +1 -1
  99. package/lib/etc/index.js.map +1 -1
  100. package/lib/i18n/built-in.js.map +1 -1
  101. package/lib/i18n/config.js.map +1 -1
  102. package/lib/i18n/types.js.map +1 -1
  103. package/lib/index.js.map +1 -1
  104. package/lib/locales/en.js.map +1 -1
  105. package/lib/locales/ko.js.map +1 -1
  106. package/lib/styles/settings/_provided.scss +33 -33
  107. package/lib/styles/theme/index.scss +4 -4
  108. package/lib/types/index.js.map +1 -1
  109. package/lib/util/color/apca.js +30 -30
  110. package/lib/util/color/apca.js.map +1 -1
  111. package/lib/util/color/const.js.map +1 -1
  112. package/lib/util/color/hct/cam16.js +95 -95
  113. package/lib/util/color/hct/cam16.js.map +1 -1
  114. package/lib/util/color/hct/hct-solver.js +107 -107
  115. package/lib/util/color/hct/hct-solver.js.map +1 -1
  116. package/lib/util/color/hct/hct.js +71 -71
  117. package/lib/util/color/hct/hct.js.map +1 -1
  118. package/lib/util/color/index.js +12 -12
  119. package/lib/util/color/index.js.map +1 -1
  120. package/lib/util/common.js.map +1 -1
  121. package/lib/util/component/component.js.map +1 -1
  122. package/lib/util/component/inject-self.js.map +1 -1
  123. package/lib/util/component/props.js.map +1 -1
  124. package/lib/util/component/types.js.map +1 -1
  125. package/lib/util/date/built-in.js.map +1 -1
  126. package/lib/util/date/index.js.map +1 -1
  127. package/lib/util/date/types.js.map +1 -1
  128. package/lib/util/debounce.js.map +1 -1
  129. package/lib/util/dom.js.map +1 -1
  130. package/lib/util/index.js.map +1 -1
  131. package/lib/util/string.js.map +1 -1
  132. package/lib/util/ui.js.map +1 -1
  133. package/package.json +132 -132
  134. package/types/components/tree-view/YTreeView.d.ts +18 -26
  135. package/types/components/tree-view/YTreeViewNode.d.ts +71 -1
  136. package/types/components/tree-view/tree-view.d.ts +17 -1
  137. package/types/declares.d.ts +1 -1
  138. package/types/globals.d.ts +19 -19
  139. package/types/shims.d.ts +64 -64
@@ -1,4 +1,4 @@
1
- import { inject, provide, ref, shallowRef } from 'vue';
1
+ import { computed, inject, provide, ref, shallowRef } from 'vue';
2
2
  import { useModelDuplex } from "../../composables/index.js";
3
3
  import { getObjectValueByPath } from "../../util/index.js";
4
4
  export const Y_TREE_VIEW = Symbol.for('YTreeView');
@@ -14,6 +14,18 @@ export function provideTreeView(props) {
14
14
  const activeSet = ref(new Set());
15
15
  const searchLoading = shallowRef(false);
16
16
  const excludedSet = ref(new Set());
17
+ const selectedState = computed(() => {
18
+ let all = false;
19
+ let some = false;
20
+ return (key, children) => {
21
+ all = children.every(child => selectedSet.value.has(child));
22
+ some = getDescendants(key).some(child => selectedSet.value.has(child));
23
+ return {
24
+ all: all,
25
+ some: some
26
+ };
27
+ };
28
+ });
17
29
 
18
30
  // Utils
19
31
  function getDescendants(key) {
@@ -115,7 +127,11 @@ export function provideTreeView(props) {
115
127
  if (!(key in nodes.value)) return;
116
128
  const node = nodes.value[key];
117
129
  if (to) {
118
- selectedSet.value.add(key);
130
+ if (props.selectStrategy !== 'leaf') {
131
+ selectedSet.value.add(key);
132
+ } else if (!node.childKeys.length) {
133
+ selectedSet.value.add(key);
134
+ }
119
135
  node.selected = true;
120
136
  }
121
137
  if (!to && key in nodes.value) {
@@ -123,14 +139,32 @@ export function provideTreeView(props) {
123
139
  nodes.value[key].selected = false;
124
140
  issueVnodeState(key);
125
141
  }
126
- if (props.selectStrategy === 'cascade') {
142
+ if (props.selectStrategy === 'cascade' || props.selectStrategy === 'relative' || props.selectStrategy === 'leaf') {
127
143
  for (const descendant of getDescendants(key)) {
128
144
  if (descendant in nodes.value) {
129
- to ? selectedSet.value.add(descendant) : selectedSet.value.delete(descendant);
130
- nodes.value[descendant].selected = to;
131
- issueVnodeState(descendant);
145
+ if (props.selectStrategy === 'leaf' && !!nodes.value[descendant]?.childKeys?.length) {
146
+ continue;
147
+ }
148
+ setSelected(descendant, to);
132
149
  }
133
150
  }
151
+ if (props.selectStrategy === 'relative') {
152
+ let grand = node.parentKey;
153
+ do {
154
+ const parentKey = grand;
155
+ grand = null;
156
+ if (!parentKey) continue;
157
+ const parent = nodes.value[parentKey];
158
+ if (!parent) continue;
159
+ const all = isChildrenAll(parentKey, 'selected', to);
160
+ if (all || !to) {
161
+ setSelected(parentKey, to);
162
+ if (parent.parentKey) {
163
+ grand = parent.parentKey;
164
+ }
165
+ }
166
+ } while (grand != null);
167
+ }
134
168
  }
135
169
  }
136
170
  function isChildrenAll(key, stateKey, to) {
@@ -143,11 +177,26 @@ export function provideTreeView(props) {
143
177
  return nodes.value[childKey]?.[stateKey] === to;
144
178
  });
145
179
  }
180
+ function isChildrenSome(key, stateKey) {
181
+ const node = nodes.value[key];
182
+ if (!node) return false;
183
+ const {
184
+ childKeys
185
+ } = node;
186
+ return childKeys.some(childKey => {
187
+ return nodes.value[childKey]?.[stateKey] === true;
188
+ });
189
+ }
146
190
  function setActive(key, to) {
147
191
  to ? activeSet.value.add(key) : activeSet.value.delete(key);
148
192
  nodes.value[key].active = to;
149
193
  issueVnodeState(key);
150
194
  }
195
+ function setSelected(key, to) {
196
+ to ? selectedSet.value.add(key) : selectedSet.value.delete(key);
197
+ nodes.value[key].selected = to;
198
+ issueVnodeState(key);
199
+ }
151
200
 
152
201
  // Emit
153
202
  function emitExpanded() {
@@ -179,7 +228,10 @@ export function provideTreeView(props) {
179
228
  isExcluded,
180
229
  emitExpanded,
181
230
  emitActive,
182
- emitSelected
231
+ emitSelected,
232
+ isChildrenAll,
233
+ isChildrenSome,
234
+ selectedState
183
235
  });
184
236
  return {
185
237
  nodes,
@@ -198,7 +250,8 @@ export function provideTreeView(props) {
198
250
  activeSet,
199
251
  searchLoading,
200
252
  excludedSet,
201
- isExcluded
253
+ isExcluded,
254
+ selectedState
202
255
  };
203
256
  }
204
257
  export function useTreeView() {
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view.js","names":["inject","provide","ref","shallowRef","useModelDuplex","getObjectValueByPath","Y_TREE_VIEW","Symbol","for","provideTreeView","props","nodes","expanded","active","selected","expandedSet","Set","selectedSet","activeSet","searchLoading","excludedSet","getDescendants","key","descendants","childKeys","value","push","remains","slice","length","childKey","splice","item","isExcluded","search","has","issueVnodeState","node","vnode","indeterminate","updateExpanded","to","children","itemChildren","Array","isArray","add","delete","updateActive","event","inactiveKey","multipleActive","requiredActive","size","activeSingleModifier","getModifierState","onlyEventActiveStrategy","activeStrategy","descendant","setActive","grand","parentKey","parent","all","isChildrenAll","updateSelected","selectStrategy","stateKey","every","emitExpanded","arr","returnItem","map","emitActive","emitSelected","register","useTreeView","instance","Error"],"sources":["../../../src/components/tree-view/tree-view.ts"],"sourcesContent":["import { InjectionKey, Ref, inject, provide, ref, shallowRef } from 'vue';\n\nimport { NodeState } from '@/components/tree-view/types';\nimport { useModelDuplex } from '@/composables';\nimport { CandidateKey } from '@/types';\nimport { getObjectValueByPath } from '@/util';\n\nexport const Y_TREE_VIEW: InjectionKey<{\n register: (key: CandidateKey, vnode: any) => void;\n updateExpanded: (key: CandidateKey, to: boolean) => void;\n updateActive: (key: CandidateKey, to: boolean, event?: MouseEvent) => void;\n updateSelected: (key: CandidateKey, to: boolean) => void;\n searchLoading: Ref<boolean>;\n isExcluded: (key: CandidateKey) => boolean;\n emitExpanded: () => void;\n emitActive: () => void;\n emitSelected: () => void;\n}> = Symbol.for('YTreeView');\n\n// TODO: props type\nexport function provideTreeView(props: any) {\n const nodes = ref<Record<CandidateKey, NodeState>>({});\n const expanded = useModelDuplex(props, 'expanded');\n const active = useModelDuplex(props, 'active');\n const selected = useModelDuplex(props, 'selected');\n\n const expandedSet = ref(new Set<CandidateKey>());\n const selectedSet = ref(new Set<CandidateKey>());\n const activeSet = ref(new Set<CandidateKey>());\n const searchLoading = shallowRef(false);\n const excludedSet = ref(new Set<CandidateKey>());\n\n // Utils\n function getDescendants(key: CandidateKey) {\n const descendants: CandidateKey[] = [];\n const { childKeys } = nodes.value[key];\n descendants.push(...childKeys);\n const remains: CandidateKey[] = childKeys.slice();\n\n while (remains.length > 0) {\n const childKey: CandidateKey = remains.splice(0, 1)[0];\n const item = nodes.value[childKey];\n if (item) {\n descendants.push(...item.childKeys);\n remains.push(...item.childKeys);\n }\n }\n\n return descendants;\n }\n\n // Search\n function isExcluded(key: CandidateKey) {\n return !!props.search && excludedSet.value.has(key);\n }\n\n //\n function issueVnodeState(key: CandidateKey) {\n const node = nodes.value[key];\n if (node?.vnode) {\n node.vnode.active = node.active;\n node.vnode.selected = node.selected;\n node.vnode.indeterminate = node.indeterminate;\n node.vnode.expanded = node.expanded;\n }\n }\n\n // Update\n function updateExpanded(key: CandidateKey, to: boolean) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n const children = getObjectValueByPath(\n node.item,\n props.itemChildren as string,\n );\n if (Array.isArray(children) && children.length > 0) {\n to ? expandedSet.value.add(key) : expandedSet.value.delete(key);\n node.expanded = to;\n issueVnodeState(key);\n }\n }\n\n function updateActive(key: CandidateKey, to: boolean, event?: MouseEvent) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n let inactiveKey = !to ? key : '';\n if (!props.multipleActive && to && !activeSet.value.has(key)) {\n [inactiveKey] = [...activeSet.value];\n }\n if (to) {\n activeSet.value.add(key);\n node.active = true;\n issueVnodeState(key);\n } else {\n if (\n props.requiredActive &&\n activeSet.value.size === 1 &&\n key === inactiveKey\n ) {\n issueVnodeState(key);\n return;\n }\n }\n if (inactiveKey && inactiveKey in nodes.value) {\n activeSet.value.delete(inactiveKey);\n nodes.value[inactiveKey].active = false;\n issueVnodeState(inactiveKey);\n }\n\n if (\n props.activeSingleModifier &&\n event?.getModifierState(props.activeSingleModifier)\n ) {\n return;\n }\n\n if (\n props.multipleActive &&\n (!props.onlyEventActiveStrategy ||\n (props.onlyEventActiveStrategy && event)) &&\n (props.activeStrategy === 'cascade' ||\n props.activeStrategy === 'relative')\n ) {\n for (const descendant of getDescendants(key)) {\n if (descendant in nodes.value) {\n setActive(descendant, to);\n }\n }\n if (props.activeStrategy === 'relative') {\n let grand: CandidateKey | null = node.parentKey;\n do {\n const parentKey = grand;\n grand = null;\n if (!parentKey) continue;\n const parent = nodes.value[parentKey];\n if (!parent) continue;\n const all = isChildrenAll(parentKey, 'active', to);\n if (all || !to) {\n setActive(parentKey, to);\n if (parent.parentKey) {\n grand = parent.parentKey;\n }\n }\n } while (grand != null);\n }\n }\n }\n\n function updateSelected(key: CandidateKey, to: boolean) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n\n if (to) {\n selectedSet.value.add(key);\n node.selected = true;\n }\n\n if (!to && key in nodes.value) {\n selectedSet.value.delete(key);\n nodes.value[key].selected = false;\n issueVnodeState(key);\n }\n\n if (props.selectStrategy === 'cascade') {\n for (const descendant of getDescendants(key)) {\n if (descendant in nodes.value) {\n to\n ? selectedSet.value.add(descendant)\n : selectedSet.value.delete(descendant);\n nodes.value[descendant].selected = to;\n issueVnodeState(descendant);\n }\n }\n }\n }\n\n function isChildrenAll(key: CandidateKey, stateKey: string, to: boolean) {\n const node = nodes.value[key];\n if (!node) return false;\n const { childKeys } = node;\n return childKeys.every((childKey) => {\n return (nodes.value[childKey] as any)?.[stateKey] === to;\n });\n }\n\n function setActive(key: CandidateKey, to: boolean) {\n to ? activeSet.value.add(key) : activeSet.value.delete(key);\n nodes.value[key].active = to;\n issueVnodeState(key);\n }\n\n // Emit\n function emitExpanded() {\n const arr = [...expandedSet.value];\n expanded.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n function emitActive() {\n const arr = [...activeSet.value];\n active.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n function emitSelected() {\n const arr = [...selectedSet.value];\n selected.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n // Inject\n function register(key: CandidateKey, vnode: any) {\n if (nodes.value[key]) {\n nodes.value[key].vnode = vnode;\n }\n\n issueVnodeState(key);\n }\n\n provide(Y_TREE_VIEW, {\n register,\n updateExpanded,\n updateActive,\n updateSelected,\n searchLoading,\n isExcluded,\n emitExpanded,\n emitActive,\n emitSelected,\n });\n\n return {\n nodes,\n expanded,\n active,\n selected,\n issueVnodeState,\n updateExpanded,\n updateActive,\n updateSelected,\n emitExpanded,\n emitActive,\n emitSelected,\n expandedSet,\n selectedSet,\n activeSet,\n searchLoading,\n excludedSet,\n isExcluded,\n };\n}\n\nexport function useTreeView() {\n const instance = inject(Y_TREE_VIEW);\n if (!instance) throw new Error('Not found provided YTreeView');\n return instance;\n}\n"],"mappings":"AAAA,SAA4BA,MAAM,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAC,SAGjEC,cAAc;AAAA,SAEdC,oBAAo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Ae,CAACd,GAAG,CAAC;EACtB;EAEArB,OAAO,CAACK,WAAW,EAAE;IACnBqE,QAAQ;IACRnC,cAAc;IACdQ,YAAY;IACZiB,cAAc;IACd9C,aAAa;IACbc,UAAU;IACVoC,YAAY;IACZI,UAAU;IACVC;EACF,CAAC,CAAC;EAEF,OAAO;IACL/D,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,QAAQ;IACRsB,eAAe;IACfI,cAAc;IACdQ,YAAY;IACZiB,cAAc;IACdI,YAAY;IACZI,UAAU;IACVC,YAAY;IACZ3D,WAAW;IACXE,WAAW;IACXC,SAAS;IACTC,aAAa;IACbC,WAAW;IACXa;EACF,CAAC;AACH;AAEA,OAAO,SAAS2C,WAAWA,CAAA,EAAG;EAC5B,MAAMC,QAAQ,GAAG7E,MAAM,CAACM,WAAW,CAAC;EACpC,IAAI,CAACuE,QAAQ,EAAE,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;EAC9D,OAAOD,QAAQ;AACjB","ignoreList":[]}
1
+ {"version":3,"file":"tree-view.js","names":["computed","inject","provide","ref","shallowRef","useModelDuplex","getObjectValueByPath","Y_TREE_VIEW","Symbol","for","provideTreeView","props","nodes","expanded","active","selected","expandedSet","Set","selectedSet","activeSet","searchLoading","excludedSet","selectedState","all","some","key","children","every","child","value","has","getDescendants","descendants","childKeys","push","remains","slice","length","childKey","splice","item","isExcluded","search","issueVnodeState","node","vnode","indeterminate","updateExpanded","to","itemChildren","Array","isArray","add","delete","updateActive","event","inactiveKey","multipleActive","requiredActive","size","activeSingleModifier","getModifierState","onlyEventActiveStrategy","activeStrategy","descendant","setActive","grand","parentKey","parent","isChildrenAll","updateSelected","selectStrategy","setSelected","stateKey","isChildrenSome","emitExpanded","arr","returnItem","map","emitActive","emitSelected","register","useTreeView","instance","Error"],"sources":["../../../src/components/tree-view/tree-view.ts"],"sourcesContent":["import {\n type ComputedRef,\n computed,\n type InjectionKey,\n inject,\n provide,\n type Ref,\n ref,\n shallowRef,\n} from 'vue';\n\nimport type { NodeState } from '@/components/tree-view/types';\nimport { useModelDuplex } from '@/composables';\nimport type { CandidateKey } from '@/types';\nimport { getObjectValueByPath } from '@/util';\n\nexport const Y_TREE_VIEW: InjectionKey<{\n register: (key: CandidateKey, vnode: any) => void;\n updateExpanded: (key: CandidateKey, to: boolean) => void;\n updateActive: (key: CandidateKey, to: boolean, event?: MouseEvent) => void;\n updateSelected: (key: CandidateKey, to: boolean) => void;\n searchLoading: Ref<boolean>;\n isExcluded: (key: CandidateKey) => boolean;\n emitExpanded: () => void;\n emitActive: () => void;\n emitSelected: () => void;\n isChildrenAll: (key: CandidateKey, stateKey: string, to: boolean) => boolean;\n isChildrenSome: (key: CandidateKey, stateKey: string) => boolean;\n selectedState: ComputedRef<\n (key: CandidateKey, children: CandidateKey[]) => { all: boolean; some: boolean }\n >;\n}> = Symbol.for('YTreeView');\n\n// TODO: props type\nexport function provideTreeView(props: any) {\n const nodes = ref<Record<CandidateKey, NodeState>>({});\n const expanded = useModelDuplex(props, 'expanded');\n const active = useModelDuplex(props, 'active');\n const selected = useModelDuplex(props, 'selected');\n\n const expandedSet = ref(new Set<CandidateKey>());\n const selectedSet = ref(new Set<CandidateKey>());\n const activeSet = ref(new Set<CandidateKey>());\n const searchLoading = shallowRef(false);\n const excludedSet = ref(new Set<CandidateKey>());\n\n const selectedState = computed(() => {\n let all = false;\n let some = false;\n\n return (key: CandidateKey, children: CandidateKey[]) => {\n all = children.every((child) => selectedSet.value.has(child));\n some = getDescendants(key).some((child) => selectedSet.value.has(child));\n return {\n all: all,\n some: some,\n };\n };\n });\n\n // Utils\n function getDescendants(key: CandidateKey) {\n const descendants: CandidateKey[] = [];\n const { childKeys } = nodes.value[key];\n descendants.push(...childKeys);\n const remains: CandidateKey[] = childKeys.slice();\n\n while (remains.length > 0) {\n const childKey: CandidateKey = remains.splice(0, 1)[0];\n const item = nodes.value[childKey];\n if (item) {\n descendants.push(...item.childKeys);\n remains.push(...item.childKeys);\n }\n }\n\n return descendants;\n }\n\n // Search\n function isExcluded(key: CandidateKey) {\n return !!props.search && excludedSet.value.has(key);\n }\n\n //\n function issueVnodeState(key: CandidateKey) {\n const node = nodes.value[key];\n if (node?.vnode) {\n node.vnode.active = node.active;\n node.vnode.selected = node.selected;\n node.vnode.indeterminate = node.indeterminate;\n node.vnode.expanded = node.expanded;\n }\n }\n\n // Update\n function updateExpanded(key: CandidateKey, to: boolean) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n const children = getObjectValueByPath(\n node.item,\n props.itemChildren as string,\n );\n if (Array.isArray(children) && children.length > 0) {\n to ? expandedSet.value.add(key) : expandedSet.value.delete(key);\n node.expanded = to;\n issueVnodeState(key);\n }\n }\n\n function updateActive(key: CandidateKey, to: boolean, event?: MouseEvent) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n let inactiveKey = !to ? key : '';\n if (!props.multipleActive && to && !activeSet.value.has(key)) {\n [inactiveKey] = [...activeSet.value];\n }\n if (to) {\n activeSet.value.add(key);\n node.active = true;\n issueVnodeState(key);\n } else {\n if (\n props.requiredActive &&\n activeSet.value.size === 1 &&\n key === inactiveKey\n ) {\n issueVnodeState(key);\n return;\n }\n }\n if (inactiveKey && inactiveKey in nodes.value) {\n activeSet.value.delete(inactiveKey);\n nodes.value[inactiveKey].active = false;\n issueVnodeState(inactiveKey);\n }\n\n if (\n props.activeSingleModifier &&\n event?.getModifierState(props.activeSingleModifier)\n ) {\n return;\n }\n\n if (\n props.multipleActive &&\n (!props.onlyEventActiveStrategy ||\n (props.onlyEventActiveStrategy && event)) &&\n (props.activeStrategy === 'cascade' ||\n props.activeStrategy === 'relative')\n ) {\n for (const descendant of getDescendants(key)) {\n if (descendant in nodes.value) {\n setActive(descendant, to);\n }\n }\n if (props.activeStrategy === 'relative') {\n let grand: CandidateKey | null = node.parentKey;\n do {\n const parentKey = grand;\n grand = null;\n if (!parentKey) continue;\n const parent = nodes.value[parentKey];\n if (!parent) continue;\n const all = isChildrenAll(parentKey, 'active', to);\n if (all || !to) {\n setActive(parentKey, to);\n if (parent.parentKey) {\n grand = parent.parentKey;\n }\n }\n } while (grand != null);\n }\n }\n }\n\n function updateSelected(key: CandidateKey, to: boolean) {\n if (!(key in nodes.value)) return;\n const node = nodes.value[key];\n\n if (to) {\n if (props.selectStrategy !== 'leaf') {\n selectedSet.value.add(key);\n } else if (!node.childKeys.length) {\n selectedSet.value.add(key);\n }\n node.selected = true;\n }\n\n if (!to && key in nodes.value) {\n selectedSet.value.delete(key);\n nodes.value[key].selected = false;\n issueVnodeState(key);\n }\n\n if (\n props.selectStrategy === 'cascade' ||\n props.selectStrategy === 'relative' ||\n props.selectStrategy === 'leaf'\n ) {\n for (const descendant of getDescendants(key)) {\n if (descendant in nodes.value) {\n if (props.selectStrategy === 'leaf' && !!nodes.value[descendant]?.childKeys?.length) {\n continue;\n }\n setSelected(descendant, to);\n }\n }\n if (props.selectStrategy === 'relative') {\n let grand: CandidateKey | null = node.parentKey;\n do {\n const parentKey = grand;\n grand = null;\n if (!parentKey) continue;\n const parent = nodes.value[parentKey];\n if (!parent) continue;\n const all = isChildrenAll(parentKey, 'selected', to);\n if (all || !to) {\n setSelected(parentKey, to);\n if (parent.parentKey) {\n grand = parent.parentKey;\n }\n }\n } while (grand != null);\n }\n }\n }\n\n function isChildrenAll(key: CandidateKey, stateKey: string, to: boolean) {\n const node = nodes.value[key];\n if (!node) return false;\n const { childKeys } = node;\n return childKeys.every((childKey) => {\n return (nodes.value[childKey] as any)?.[stateKey] === to;\n });\n }\n\n function isChildrenSome(key: CandidateKey, stateKey: string) {\n const node = nodes.value[key];\n if (!node) return false;\n const { childKeys } = node;\n return childKeys.some((childKey) => {\n return (nodes.value[childKey] as any)?.[stateKey] === true;\n });\n }\n\n function setActive(key: CandidateKey, to: boolean) {\n to ? activeSet.value.add(key) : activeSet.value.delete(key);\n nodes.value[key].active = to;\n issueVnodeState(key);\n }\n\n function setSelected(key: CandidateKey, to: boolean) {\n to ? selectedSet.value.add(key) : selectedSet.value.delete(key);\n nodes.value[key].selected = to;\n issueVnodeState(key);\n }\n\n // Emit\n function emitExpanded() {\n const arr = [...expandedSet.value];\n expanded.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n function emitActive() {\n const arr = [...activeSet.value];\n active.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n function emitSelected() {\n const arr = [...selectedSet.value];\n selected.value = props.returnItem\n ? arr.map((key) => nodes.value[key].item)\n : arr;\n }\n\n // Inject\n function register(key: CandidateKey, vnode: any) {\n if (nodes.value[key]) {\n nodes.value[key].vnode = vnode;\n }\n\n issueVnodeState(key);\n }\n\n provide(Y_TREE_VIEW, {\n register,\n updateExpanded,\n updateActive,\n updateSelected,\n searchLoading,\n isExcluded,\n emitExpanded,\n emitActive,\n emitSelected,\n isChildrenAll,\n isChildrenSome,\n selectedState,\n });\n\n return {\n nodes,\n expanded,\n active,\n selected,\n issueVnodeState,\n updateExpanded,\n updateActive,\n updateSelected,\n emitExpanded,\n emitActive,\n emitSelected,\n expandedSet,\n selectedSet,\n activeSet,\n searchLoading,\n excludedSet,\n isExcluded,\n selectedState,\n };\n}\n\nexport function useTreeView() {\n const instance = inject(Y_TREE_VIEW);\n if (!instance) throw new Error('Not found provided YTreeView');\n return instance;\n}\n"],"mappings":"AAAA,SAEEA,QAAQ,EAERC,MAAM,EACNC,OAAO,EAEPC,GAAG,EACHC,UAAU,QACL,KAAK;AAAC,SAGJC,cAAc;AAAA,SAEdC,oBAAoB;AAE7B,OAAO,MAAMC,WAeX,GAAGC,MAAM,CAACC,GAAG,CAAC,WAAW,CAAC;;AAE5B;AACA,OAAO,SAASC,eAAeA,CAACC,KAAU,EAAE;EAC1C,MAAMC,KAAK,GAAGT,GAAG,CAAkC,CAAC,CAAC,CAAC;EACtD,MAAMU,QAAQ,GAAGR,cAAc,CAACM,KAAK,EAAE,UAAU,CAAC;EAClD,MAAMG,MAAM,GAAGT,cAAc,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AACjB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/tree-view/types.ts"],"sourcesContent":["import { type ComponentPublicInstance } from 'vue';\n\nimport type { CandidateKey } from '@/types';\n\nexport interface ItemState {\n selected: boolean;\n indeterminate: boolean;\n active: boolean;\n expanded: boolean;\n}\n\nexport interface NodeState extends ItemState {\n childKeys: CandidateKey[];\n item: any;\n parentKey: null | CandidateKey;\n vnode: null | (ComponentPublicInstance & ItemState);\n level: number;\n}\n\nexport type TreeviewFilterFn = (\n item: any,\n search: string,\n itemText: string,\n) => boolean;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/tree-view/types.ts"],"sourcesContent":["import { type ComponentPublicInstance } from 'vue';\r\n\r\nimport type { CandidateKey } from '@/types';\r\n\r\nexport interface ItemState {\r\n selected: boolean;\r\n indeterminate: boolean;\r\n active: boolean;\r\n expanded: boolean;\r\n}\r\n\r\nexport interface NodeState extends ItemState {\r\n childKeys: CandidateKey[];\r\n item: any;\r\n parentKey: null | CandidateKey;\r\n vnode: null | (ComponentPublicInstance & ItemState);\r\n level: number;\r\n}\r\n\r\nexport type TreeviewFilterFn = (\r\n item: any,\r\n search: string,\r\n itemText: string,\r\n) => boolean;\r\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"choice.js","names":["computed","getCurrentInstance","inject","onBeforeUnmount","onMounted","provide","reactive","toRef","watch","wrapInArray","deepEqual","findChildrenWithProvide","getUid","propsFactory","useModelDuplex","pressChoicePropsOptions","modelValue","type","default","undefined","multiple","Boolean","mandatory","String","max","Number","selectedClass","disabled","returnItem","pressChoiceItemPropsOptions","value","useChoiceItem","props","injectKey","required","arguments","length","vm","Error","id","Symbol","for","description","choiceProvider","register","unregister","isSelected","emit","toggle","select","provider","useChoice","isUnmounted","items","selected","v","getIds","arr","getValues","groupVm","item","unwrapped","key","children","vnode","index","indexOf","splice","push","forceMandatoryValue","findIndex","find","internalValue","slice","includes","step","offset","currentId","currentIndex","i","newIndex","newItem","state","prev","next","getItemIndex","ids","forEach","itemByIndex","values","itemIndex"],"sources":["../../src/composables/choice.ts"],"sourcesContent":["import type {\n ComponentInternalInstance,\n ComputedRef,\n ExtractPropTypes,\n InjectionKey,\n PropType,\n Ref,\n UnwrapRef,\n} from 'vue';\nimport {\n computed,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n toRef,\n watch,\n} from 'vue';\n\nimport { wrapInArray } from '@/util/array';\nimport { deepEqual } from '@/util/common';\nimport {\n findChildrenWithProvide,\n getUid,\n propsFactory,\n} from '@/util/component';\n\nimport { useModelDuplex } from './communication';\n\nexport interface ChoiceItem {\n id: number;\n value: Ref<unknown>;\n disabled: Ref<boolean | undefined>;\n}\n\nexport interface ChoiceProps {\n disabled: boolean;\n modelValue: unknown;\n multiple?: boolean;\n mandatory?: boolean | 'force' | undefined;\n max?: number | undefined;\n selectedClass?: string | undefined;\n 'onUpdate:modelValue': ((value: unknown) => void) | undefined;\n}\n\nexport interface ChoiceProvide {\n register: (item: ChoiceItem, instance: ComponentInternalInstance) => void;\n unregister: (id: number) => void;\n select: (id: number, value: boolean) => void;\n selected: Ref<Readonly<number[]>>;\n selectedClass: Ref<string | undefined>;\n isSelected: (id: number) => boolean;\n disabled: Ref<boolean | undefined>;\n getItemIndex: (value: unknown) => number;\n prev: () => void;\n next: () => void;\n items: ComputedRef<\n { id: number; value: unknown; disabled: boolean | undefined }[]\n >;\n}\n\nexport interface ChoiceItemProvide {\n id: number;\n isSelected: Ref<boolean>;\n toggle: () => void;\n select: (value: boolean) => void;\n selectedClass: Ref<(string | undefined)[] | false>;\n value: Ref<unknown>;\n disabled: Ref<boolean | undefined>;\n provider: ChoiceProvide;\n}\n\nexport const pressChoicePropsOptions = propsFactory(\n {\n modelValue: {\n type: null,\n default: undefined,\n },\n multiple: Boolean,\n mandatory: [Boolean, String] as PropType<boolean | 'force'>,\n max: Number,\n selectedClass: String as PropType<string>,\n disabled: Boolean,\n returnItem: Boolean as PropType<boolean>,\n },\n 'choice',\n);\n\nexport const pressChoiceItemPropsOptions = propsFactory(\n {\n value: null,\n disabled: Boolean,\n selectedClass: String,\n },\n 'choice-item',\n);\n\nexport interface ChoiceItemProps\n extends ExtractPropTypes<ReturnType<typeof pressChoiceItemPropsOptions>> {\n 'onChoice:selected': ((val: { value: boolean }) => void) | undefined;\n}\n\nexport function useChoiceItem(\n props: ChoiceItemProps,\n injectKey: InjectionKey<ChoiceProvide>,\n required?: true,\n): ChoiceItemProvide;\nexport function useChoiceItem(\n props: ChoiceItemProps,\n injectKey: InjectionKey<ChoiceProvide>,\n required: false,\n): ChoiceItemProvide | null;\nexport function useChoiceItem(\n props: ChoiceItemProps,\n injectKey: InjectionKey<ChoiceProvide>,\n required = true,\n): ChoiceItemProvide | null {\n const vm = getCurrentInstance();\n\n if (!vm) {\n throw new Error(\n '\"useChoiceItem\" must be used inside a component setup function',\n );\n }\n\n const id = getUid() as number;\n\n provide(Symbol.for(`${injectKey.description}:id`), id);\n\n const choiceProvider = inject(injectKey, null);\n\n if (!choiceProvider) {\n if (!required) return choiceProvider as null;\n\n throw new Error(`Not found provider`);\n }\n\n const value = toRef(props, 'value');\n const disabled = computed(\n () => !!(choiceProvider.disabled.value || props.disabled),\n );\n\n choiceProvider.register(\n {\n id,\n value,\n disabled,\n },\n vm,\n );\n\n onBeforeUnmount(() => {\n choiceProvider.unregister(id);\n });\n\n const isSelected = computed(() => {\n return choiceProvider.isSelected(id);\n });\n\n const selectedClass = computed(\n () =>\n isSelected.value && [\n choiceProvider.selectedClass.value,\n props.selectedClass,\n ],\n );\n\n watch(isSelected, (value) => {\n vm.emit('choice:selected', { value });\n });\n\n return {\n id,\n isSelected,\n toggle: () => choiceProvider.select(id, !isSelected.value),\n select: (value: boolean) => choiceProvider.select(id, value),\n selectedClass,\n value,\n disabled,\n provider: choiceProvider,\n };\n}\n\nexport function useChoice(\n props: ChoiceProps,\n injectKey: InjectionKey<ChoiceProvide>,\n) {\n let isUnmounted = false;\n const items = reactive<ChoiceItem[]>([]);\n const selected = useModelDuplex(\n props,\n 'modelValue',\n [],\n (v) => {\n if (v == null) return [];\n\n return getIds(items, wrapInArray(v));\n },\n (v) => {\n const arr = getValues(items, v);\n\n return props.multiple ? arr : arr[0];\n },\n );\n\n const groupVm = getCurrentInstance();\n\n function register(item: ChoiceItem, vm: ComponentInternalInstance) {\n const unwrapped = item as unknown as UnwrapRef<ChoiceItem>;\n\n const key = Symbol.for(`${injectKey.description}:id`);\n const children = findChildrenWithProvide(key, groupVm?.vnode);\n const index = children.indexOf(vm);\n\n if (index > -1) {\n items.splice(index, 0, unwrapped);\n } else {\n items.push(unwrapped);\n }\n }\n\n function unregister(id: number) {\n if (isUnmounted) return;\n forceMandatoryValue();\n const index = items.findIndex((item) => item.id === id);\n items.splice(index, 1);\n }\n\n function forceMandatoryValue() {\n const item = items.find((item) => !item.disabled);\n if (item && props.mandatory === 'force' && !selected.value.length) {\n selected.value = [item.id];\n }\n }\n\n onMounted(() => {\n forceMandatoryValue();\n });\n\n onBeforeUnmount(() => {\n isUnmounted = true;\n });\n\n function select(id: number, value?: boolean) {\n const item = items.find((item) => item.id === id);\n if (value && item?.disabled) return;\n\n if (props.multiple) {\n const internalValue = selected.value.slice();\n const index = internalValue.findIndex((v: any) => v === id);\n const isSelected = ~index;\n value = value ?? !isSelected;\n if (isSelected && props.mandatory && internalValue.length <= 1) return;\n if (\n !isSelected &&\n props.max != null &&\n internalValue.length + 1 > props.max\n )\n return;\n\n if (index < 0 && value) internalValue.push(id);\n else if (index >= 0 && !value) internalValue.splice(index, 1);\n\n selected.value = internalValue;\n } else {\n const isSelected = selected.value.includes(id);\n if (props.mandatory && isSelected) return;\n selected.value = (value ?? !isSelected) ? [id] : [];\n }\n }\n\n function step(offset: number) {\n if (props.multiple) {\n }\n\n if (!selected.value.length) {\n const item = items.find((item) => !item.disabled);\n item && (selected.value = [item.id]);\n } else {\n const currentId = selected.value[0];\n const currentIndex = items.findIndex((i) => i.id === currentId);\n\n let newIndex = (currentIndex + offset) % items.length;\n let newItem = items[newIndex];\n\n while (newItem.disabled && newIndex !== currentIndex) {\n newIndex = (newIndex + offset) % items.length;\n newItem = items[newIndex];\n }\n\n if (newItem.disabled) return;\n\n selected.value = [items[newIndex].id];\n }\n }\n\n const state: ChoiceProvide = {\n register,\n unregister,\n selected,\n select,\n disabled: toRef(props, 'disabled'),\n prev: () => step(items.length - 1),\n next: () => step(1),\n isSelected: (id: number) => selected.value.includes(id),\n selectedClass: computed(() => props.selectedClass),\n items: computed(() => items),\n getItemIndex: (value: unknown) => getItemIndex(items, value),\n };\n\n provide(injectKey, state);\n\n return state;\n}\n\nfunction getItemIndex(items: UnwrapRef<ChoiceItem[]>, value: unknown) {\n const ids = getIds(items, [value]);\n\n if (!ids.length) return -1;\n\n return items.findIndex((item) => item.id === ids[0]);\n}\n\nfunction getIds(items: UnwrapRef<ChoiceItem[]>, modelValue: any[]) {\n const ids: number[] = [];\n\n modelValue.forEach((value) => {\n const item = items.find((item) => deepEqual(value, item.value));\n const itemByIndex = items[value];\n\n if (item?.value != null) {\n ids.push(item.id);\n } else if (itemByIndex != null) {\n ids.push(itemByIndex.id);\n }\n });\n\n return ids;\n}\n\nfunction getValues(items: UnwrapRef<ChoiceItem[]>, ids: any[]) {\n const values: unknown[] = [];\n ids.forEach((id) => {\n const itemIndex = items.findIndex((item) => item.id === id);\n if (~itemIndex) {\n const item = items[itemIndex];\n values.push(item.value != null ? item.value : itemIndex);\n }\n });\n\n return values;\n}\n"],"mappings":"AASA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,MAAM,EACNC,eAAe,EACfC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,KAAK,QACA,KAAK;AAAC,SAEJC,WAAW;AAAA,SACXC,SAAS;AAAA,SAEhBC,uBAAuB,EACvBC,MAAM,EACNC,YAAY;AAAA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AAO,CAAEzD,KAAK,IAAK;IAC5B,MAAM8B,IAAI,GAAGP,KAAK,CAACkB,IAAI,CAAEX,IAAI,IAAKlD,SAAS,CAACoB,KAAK,EAAE8B,IAAI,CAAC9B,KAAK,CAAC,CAAC;IAC/D,MAAM0D,WAAW,GAAGnC,KAAK,CAACvB,KAAK,CAAC;IAEhC,IAAI8B,IAAI,EAAE9B,KAAK,IAAI,IAAI,EAAE;MACvBwD,GAAG,CAAClB,IAAI,CAACR,IAAI,CAACrB,EAAE,CAAC;IACnB,CAAC,MAAM,IAAIiD,WAAW,IAAI,IAAI,EAAE;MAC9BF,GAAG,CAAClB,IAAI,CAACoB,WAAW,CAACjD,EAAE,CAAC;IAC1B;EACF,CAAC,CAAC;EAEF,OAAO+C,GAAG;AACZ;AAEA,SAAS5B,SAASA,CAACL,KAA8B,EAAEiC,GAAU,EAAE;EAC7D,MAAMG,MAAiB,GAAG,EAAE;EAC5BH,GAAG,CAACC,OAAO,CAAEhD,EAAE,IAAK;IAClB,MAAMmD,SAAS,GAAGrC,KAAK,CAACiB,SAAS,CAAEV,IAAI,IAAKA,IAAI,CAACrB,EAAE,KAAKA,EAAE,CAAC;IAC3D,IAAI,CAACmD,SAAS,EAAE;MACd,MAAM9B,IAAI,GAAGP,KAAK,CAACqC,SAAS,CAAC;MAC7BD,MAAM,CAACrB,IAAI,CAACR,IAAI,CAAC9B,KAAK,IAAI,IAAI,GAAG8B,IAAI,CAAC9B,KAAK,GAAG4D,SAAS,CAAC;IAC1D;EACF,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"choice.js","names":["computed","getCurrentInstance","inject","onBeforeUnmount","onMounted","provide","reactive","toRef","watch","wrapInArray","deepEqual","findChildrenWithProvide","getUid","propsFactory","useModelDuplex","pressChoicePropsOptions","modelValue","type","default","undefined","multiple","Boolean","mandatory","String","max","Number","selectedClass","disabled","returnItem","pressChoiceItemPropsOptions","value","useChoiceItem","props","injectKey","required","arguments","length","vm","Error","id","Symbol","for","description","choiceProvider","register","unregister","isSelected","emit","toggle","select","provider","useChoice","isUnmounted","items","selected","v","getIds","arr","getValues","groupVm","item","unwrapped","key","children","vnode","index","indexOf","splice","push","forceMandatoryValue","findIndex","find","internalValue","slice","includes","step","offset","currentId","currentIndex","i","newIndex","newItem","state","prev","next","getItemIndex","ids","forEach","itemByIndex","values","itemIndex"],"sources":["../../src/composables/choice.ts"],"sourcesContent":["import type {\r\n ComponentInternalInstance,\r\n ComputedRef,\r\n ExtractPropTypes,\r\n InjectionKey,\r\n PropType,\r\n Ref,\r\n UnwrapRef,\r\n} from 'vue';\r\nimport {\r\n computed,\r\n getCurrentInstance,\r\n inject,\r\n onBeforeUnmount,\r\n onMounted,\r\n provide,\r\n reactive,\r\n toRef,\r\n watch,\r\n} from 'vue';\r\n\r\nimport { wrapInArray } from '@/util/array';\r\nimport { deepEqual } from '@/util/common';\r\nimport {\r\n findChildrenWithProvide,\r\n getUid,\r\n propsFactory,\r\n} from '@/util/component';\r\n\r\nimport { useModelDuplex } from './communication';\r\n\r\nexport interface ChoiceItem {\r\n id: number;\r\n value: Ref<unknown>;\r\n disabled: Ref<boolean | undefined>;\r\n}\r\n\r\nexport interface ChoiceProps {\r\n disabled: boolean;\r\n modelValue: unknown;\r\n multiple?: boolean;\r\n mandatory?: boolean | 'force' | undefined;\r\n max?: number | undefined;\r\n selectedClass?: string | undefined;\r\n 'onUpdate:modelValue': ((value: unknown) => void) | undefined;\r\n}\r\n\r\nexport interface ChoiceProvide {\r\n register: (item: ChoiceItem, instance: ComponentInternalInstance) => void;\r\n unregister: (id: number) => void;\r\n select: (id: number, value: boolean) => void;\r\n selected: Ref<Readonly<number[]>>;\r\n selectedClass: Ref<string | undefined>;\r\n isSelected: (id: number) => boolean;\r\n disabled: Ref<boolean | undefined>;\r\n getItemIndex: (value: unknown) => number;\r\n prev: () => void;\r\n next: () => void;\r\n items: ComputedRef<\r\n { id: number; value: unknown; disabled: boolean | undefined }[]\r\n >;\r\n}\r\n\r\nexport interface ChoiceItemProvide {\r\n id: number;\r\n isSelected: Ref<boolean>;\r\n toggle: () => void;\r\n select: (value: boolean) => void;\r\n selectedClass: Ref<(string | undefined)[] | false>;\r\n value: Ref<unknown>;\r\n disabled: Ref<boolean | undefined>;\r\n provider: ChoiceProvide;\r\n}\r\n\r\nexport const pressChoicePropsOptions = propsFactory(\r\n {\r\n modelValue: {\r\n type: null,\r\n default: undefined,\r\n },\r\n multiple: Boolean,\r\n mandatory: [Boolean, String] as PropType<boolean | 'force'>,\r\n max: Number,\r\n selectedClass: String as PropType<string>,\r\n disabled: Boolean,\r\n returnItem: Boolean as PropType<boolean>,\r\n },\r\n 'choice',\r\n);\r\n\r\nexport const pressChoiceItemPropsOptions = propsFactory(\r\n {\r\n value: null,\r\n disabled: Boolean,\r\n selectedClass: String,\r\n },\r\n 'choice-item',\r\n);\r\n\r\nexport interface ChoiceItemProps\r\n extends ExtractPropTypes<ReturnType<typeof pressChoiceItemPropsOptions>> {\r\n 'onChoice:selected': ((val: { value: boolean }) => void) | undefined;\r\n}\r\n\r\nexport function useChoiceItem(\r\n props: ChoiceItemProps,\r\n injectKey: InjectionKey<ChoiceProvide>,\r\n required?: true,\r\n): ChoiceItemProvide;\r\nexport function useChoiceItem(\r\n props: ChoiceItemProps,\r\n injectKey: InjectionKey<ChoiceProvide>,\r\n required: false,\r\n): ChoiceItemProvide | null;\r\nexport function useChoiceItem(\r\n props: ChoiceItemProps,\r\n injectKey: InjectionKey<ChoiceProvide>,\r\n required = true,\r\n): ChoiceItemProvide | null {\r\n const vm = getCurrentInstance();\r\n\r\n if (!vm) {\r\n throw new Error(\r\n '\"useChoiceItem\" must be used inside a component setup function',\r\n );\r\n }\r\n\r\n const id = getUid() as number;\r\n\r\n provide(Symbol.for(`${injectKey.description}:id`), id);\r\n\r\n const choiceProvider = inject(injectKey, null);\r\n\r\n if (!choiceProvider) {\r\n if (!required) return choiceProvider as null;\r\n\r\n throw new Error(`Not found provider`);\r\n }\r\n\r\n const value = toRef(props, 'value');\r\n const disabled = computed(\r\n () => !!(choiceProvider.disabled.value || props.disabled),\r\n );\r\n\r\n choiceProvider.register(\r\n {\r\n id,\r\n value,\r\n disabled,\r\n },\r\n vm,\r\n );\r\n\r\n onBeforeUnmount(() => {\r\n choiceProvider.unregister(id);\r\n });\r\n\r\n const isSelected = computed(() => {\r\n return choiceProvider.isSelected(id);\r\n });\r\n\r\n const selectedClass = computed(\r\n () =>\r\n isSelected.value && [\r\n choiceProvider.selectedClass.value,\r\n props.selectedClass,\r\n ],\r\n );\r\n\r\n watch(isSelected, (value) => {\r\n vm.emit('choice:selected', { value });\r\n });\r\n\r\n return {\r\n id,\r\n isSelected,\r\n toggle: () => choiceProvider.select(id, !isSelected.value),\r\n select: (value: boolean) => choiceProvider.select(id, value),\r\n selectedClass,\r\n value,\r\n disabled,\r\n provider: choiceProvider,\r\n };\r\n}\r\n\r\nexport function useChoice(\r\n props: ChoiceProps,\r\n injectKey: InjectionKey<ChoiceProvide>,\r\n) {\r\n let isUnmounted = false;\r\n const items = reactive<ChoiceItem[]>([]);\r\n const selected = useModelDuplex(\r\n props,\r\n 'modelValue',\r\n [],\r\n (v) => {\r\n if (v == null) return [];\r\n\r\n return getIds(items, wrapInArray(v));\r\n },\r\n (v) => {\r\n const arr = getValues(items, v);\r\n\r\n return props.multiple ? arr : arr[0];\r\n },\r\n );\r\n\r\n const groupVm = getCurrentInstance();\r\n\r\n function register(item: ChoiceItem, vm: ComponentInternalInstance) {\r\n const unwrapped = item as unknown as UnwrapRef<ChoiceItem>;\r\n\r\n const key = Symbol.for(`${injectKey.description}:id`);\r\n const children = findChildrenWithProvide(key, groupVm?.vnode);\r\n const index = children.indexOf(vm);\r\n\r\n if (index > -1) {\r\n items.splice(index, 0, unwrapped);\r\n } else {\r\n items.push(unwrapped);\r\n }\r\n }\r\n\r\n function unregister(id: number) {\r\n if (isUnmounted) return;\r\n forceMandatoryValue();\r\n const index = items.findIndex((item) => item.id === id);\r\n items.splice(index, 1);\r\n }\r\n\r\n function forceMandatoryValue() {\r\n const item = items.find((item) => !item.disabled);\r\n if (item && props.mandatory === 'force' && !selected.value.length) {\r\n selected.value = [item.id];\r\n }\r\n }\r\n\r\n onMounted(() => {\r\n forceMandatoryValue();\r\n });\r\n\r\n onBeforeUnmount(() => {\r\n isUnmounted = true;\r\n });\r\n\r\n function select(id: number, value?: boolean) {\r\n const item = items.find((item) => item.id === id);\r\n if (value && item?.disabled) return;\r\n\r\n if (props.multiple) {\r\n const internalValue = selected.value.slice();\r\n const index = internalValue.findIndex((v: any) => v === id);\r\n const isSelected = ~index;\r\n value = value ?? !isSelected;\r\n if (isSelected && props.mandatory && internalValue.length <= 1) return;\r\n if (\r\n !isSelected &&\r\n props.max != null &&\r\n internalValue.length + 1 > props.max\r\n )\r\n return;\r\n\r\n if (index < 0 && value) internalValue.push(id);\r\n else if (index >= 0 && !value) internalValue.splice(index, 1);\r\n\r\n selected.value = internalValue;\r\n } else {\r\n const isSelected = selected.value.includes(id);\r\n if (props.mandatory && isSelected) return;\r\n selected.value = (value ?? !isSelected) ? [id] : [];\r\n }\r\n }\r\n\r\n function step(offset: number) {\r\n if (props.multiple) {\r\n }\r\n\r\n if (!selected.value.length) {\r\n const item = items.find((item) => !item.disabled);\r\n item && (selected.value = [item.id]);\r\n } else {\r\n const currentId = selected.value[0];\r\n const currentIndex = items.findIndex((i) => i.id === currentId);\r\n\r\n let newIndex = (currentIndex + offset) % items.length;\r\n let newItem = items[newIndex];\r\n\r\n while (newItem.disabled && newIndex !== currentIndex) {\r\n newIndex = (newIndex + offset) % items.length;\r\n newItem = items[newIndex];\r\n }\r\n\r\n if (newItem.disabled) return;\r\n\r\n selected.value = [items[newIndex].id];\r\n }\r\n }\r\n\r\n const state: ChoiceProvide = {\r\n register,\r\n unregister,\r\n selected,\r\n select,\r\n disabled: toRef(props, 'disabled'),\r\n prev: () => step(items.length - 1),\r\n next: () => step(1),\r\n isSelected: (id: number) => selected.value.includes(id),\r\n selectedClass: computed(() => props.selectedClass),\r\n items: computed(() => items),\r\n getItemIndex: (value: unknown) => getItemIndex(items, value),\r\n };\r\n\r\n provide(injectKey, state);\r\n\r\n return state;\r\n}\r\n\r\nfunction getItemIndex(items: UnwrapRef<ChoiceItem[]>, value: unknown) {\r\n const ids = getIds(items, [value]);\r\n\r\n if (!ids.length) return -1;\r\n\r\n return items.findIndex((item) => item.id === ids[0]);\r\n}\r\n\r\nfunction getIds(items: UnwrapRef<ChoiceItem[]>, modelValue: any[]) {\r\n const ids: number[] = [];\r\n\r\n modelValue.forEach((value) => {\r\n const item = items.find((item) => deepEqual(value, item.value));\r\n const itemByIndex = items[value];\r\n\r\n if (item?.value != null) {\r\n ids.push(item.id);\r\n } else if (itemByIndex != null) {\r\n ids.push(itemByIndex.id);\r\n }\r\n });\r\n\r\n return ids;\r\n}\r\n\r\nfunction getValues(items: UnwrapRef<ChoiceItem[]>, ids: any[]) {\r\n const values: unknown[] = [];\r\n ids.forEach((id) => {\r\n const itemIndex = items.findIndex((item) => item.id === id);\r\n if (~itemIndex) {\r\n const item = items[itemIndex];\r\n values.push(item.value != null ? item.value : itemIndex);\r\n }\r\n });\r\n\r\n return values;\r\n}\r\n"],"mappings":"AASA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,MAAM,EACNC,eAAe,EACfC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,KAAK,QACA,KAAK;AAAC,SAEJC,WAAW;AAAA,SACXC,SAAS;AAAA,SAEhBC,uBAAuB,EACvBC,MAAM,EACNC,YAAY;AAAA,SAGLC,cAAc;AA6CvB,OAAO,MAAMC,uBAAuB,GAAGF,YAAY,CACjD;EACEG,UAAU,EAAE;IACVC,IAAI,EAAE,IAAI;IACVC,OAAO,EAAEC;EACX,CAAC;EACDC,QAAQ,EAAEC,OAAO;EACjBC,SAAS,EAAE,CAACD,OAAO,EAAEE,MAAM,CAAgC;EAC3DC,GAAG,EAAEC,M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9B,KAAK,IAAI,IAAI,EAAE;MACvBwD,GAAG,CAAClB,IAAI,CAACR,IAAI,CAACrB,EAAE,CAAC;IACnB,CAAC,MAAM,IAAIiD,WAAW,IAAI,IAAI,EAAE;MAC9BF,GAAG,CAAClB,IAAI,CAACoB,WAAW,CAACjD,EAAE,CAAC;IAC1B;EACF,CAAC,CAAC;EAEF,OAAO+C,GAAG;AACZ;AAEA,SAAS5B,SAASA,CAACL,KAA8B,EAAEiC,GAAU,EAAE;EAC7D,MAAMG,MAAiB,GAAG,EAAE;EAC5BH,GAAG,CAACC,OAAO,CAAEhD,EAAE,IAAK;IAClB,MAAMmD,SAAS,GAAGrC,KAAK,CAACiB,SAAS,CAAEV,IAAI,IAAKA,IAAI,CAACrB,EAAE,KAAKA,EAAE,CAAC;IAC3D,IAAI,CAACmD,SAAS,EAAE;MACd,MAAM9B,IAAI,GAAGP,KAAK,CAACqC,SAAS,CAAC;MAC7BD,MAAM,CAACrB,IAAI,CAACR,IAAI,CAAC9B,KAAK,IAAI,IAAI,GAAG8B,IAAI,CAAC9B,KAAK,GAAG4D,SAAS,CAAC;IAC1D;EACF,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["onScopeDispose","ref","watch","propsFactory","useToggleScope","applyArrangement","applyLevitation","coordinateStrategies","levitation","arrangement","pressCoordinateProps","coordinateStrategy","type","String","Function","default","position","align","origin","offset","Number","Array","viewportMargin","useCoordinate","props","state","updateCoordinate","coordination","side","rect","x","y","width","height","coordinateStyles","active","value","reset","undefined","strategy","window","addEventListener","onResize","passive","removeEventListener","e"],"sources":["../../../src/composables/coordinate/index.ts"],"sourcesContent":["import type { PropType, Ref } from \"vue\";\nimport { onScopeDispose, ref, watch } from \"vue\";\n\nimport type { CssProperties } from \"@/types\";\n\nimport { propsFactory } from \"../../util/component\";\nimport type { Rect } from \"../../util/rect\";\nimport { useToggleScope } from \"../scope\";\nimport { applyArrangement } from \"./arrangement\";\nimport { applyLevitation } from \"./levitation\";\nimport type { CoordinateState } from \"./types\";\n\nconst coordinateStrategies = {\n\tlevitation: applyLevitation,\n\tarrangement: applyArrangement,\n};\n\nexport type CoordinateStrategyFn = (\n\tprops: any,\n\tstate: CoordinateState,\n\tcoordination: Ref<any>,\n\tcoordinateStyles: Ref<CssProperties>,\n) => undefined | { updateCoordinate: (e: Event) => void };\n\nexport const pressCoordinateProps = propsFactory(\n\t{\n\t\tcoordinateStrategy: {\n\t\t\ttype: [String, Function] as PropType<\n\t\t\t\tkeyof typeof coordinateStrategies | CoordinateStrategyFn\n\t\t\t>,\n\t\t\tdefault: \"arrangement\",\n\t\t},\n\t\tposition: {\n\t\t\ttype: String as PropType<\n\t\t\t\t\"default\" | \"top\" | \"end\" | \"right\" | \"bottom\" | \"left\" | \"start\"\n\t\t\t>,\n\t\t\tdefault: \"default\",\n\t\t},\n\t\talign: {\n\t\t\ttype: String as PropType<\"start\" | \"center\" | \"end\" | \"top\" | \"bottom\">,\n\t\t\tdefault: \"start\",\n\t\t},\n\t\torigin: {\n\t\t\ttype: String,\n\t\t\tdefault: \"auto\",\n\t\t},\n\t\toffset: {\n\t\t\ttype: [Number, String, Array] as PropType<number | string | number[]>,\n\t\t},\n\t\tviewportMargin: {\n\t\t\ttype: [Number, String, Array],\n\t\t\tdefault: 16,\n\t\t},\n\t},\n\t\"Coordinate\",\n);\n\nexport function useCoordinate(props: any, state: CoordinateState) {\n\tconst updateCoordinate = ref<(e: Event) => void>();\n\tconst coordination = ref<any>({\n\t\tside: '',\n\t\talign: '',\n\t\toffset: [0, 0],\n\t\trect: {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0\n\t\t}\n\t});\n\tconst coordinateStyles = ref<CssProperties>({});\n\n\tuseToggleScope(\n\t\t() => !!(state.active.value && props.coordinateStrategy),\n\t\t(reset) => {\n\t\t\twatch(() => props.coordinateStrategy, reset);\n\t\t\tonScopeDispose(() => {\n\t\t\t\tupdateCoordinate.value = undefined;\n\t\t\t});\n\n\t\t\tif (typeof props.coordinateStrategy === \"function\") {\n\t\t\t\tupdateCoordinate.value = props.coordinateStrategy(\n\t\t\t\t\tprops,\n\t\t\t\t\tstate,\n\t\t\t\t\tcoordination,\n\t\t\t\t\tcoordinateStyles,\n\t\t\t\t)?.updateCoordinate;\n\t\t\t} else {\n\t\t\t\tconst strategy =\n\t\t\t\t\tcoordinateStrategies[\n\t\t\t\t\t\tprops.coordinateStrategy as keyof typeof coordinateStrategies\n\t\t\t\t\t];\n\t\t\t\tupdateCoordinate.value = strategy?.(\n\t\t\t\t\tprops,\n\t\t\t\t\tstate,\n\t\t\t\t\tcoordination,\n\t\t\t\t\tcoordinateStyles,\n\t\t\t\t)?.updateCoordinate;\n\t\t\t}\n\t\t},\n\t);\n\n\twindow.addEventListener(\"resize\", onResize, { passive: true });\n\n\tonScopeDispose(() => {\n\t\twindow.removeEventListener(\"resize\", onResize);\n\t\tupdateCoordinate.value = undefined;\n\t});\n\n\tfunction onResize(e: Event) {\n\t\tupdateCoordinate.value?.(e);\n\t}\n\n\treturn {\n\t\tcoordination,\n\t\tcoordinateStyles,\n\t\tupdateCoordinate,\n\t};\n}\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAIxCC,YAAY;AAAA,SAEZC,cAAc;AAAA,SACdC,gBAAgB;AAAA,SAChBC,eAAe;AAGxB,MAAMC,oBAAoB,GAAG;EAC5BC,UAAU,EAAEF,eAAe;EAC3BG,WAAW,EAAEJ;AACd,CAAC;AASD,OAAO,MAAMK,oBAAoB,GAAGP,YAAY,CAC/C;EACCQ,kBAAkB,EAAE;IACnBC,IAAI,EAAE,CAACC,MAAM,EAAEC,QAAQ,CAEtB;IACDC,OAAO,EAAE;EACV,CAAC;EACDC,QAAQ,EAAE;IACTJ,IAAI,EAAEC,MAEL;IACDE,OAAO,EAAE;EACV,CAAC;EACDE,K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AY,EACZO,gBACD,CAAC,EAAER,gBAAgB;IACpB,CAAC,MAAM;MACN,MAAMa,QAAQ,GACbhC,oBAAoB,CACnBiB,KAAK,CAACb,kBAAkB,CACxB;MACFe,gBAAgB,CAACU,KAAK,GAAGG,QAAQ,GAChCf,KAAK,EACLC,KAAK,EACLE,YAAY,EACZO,gBACD,CAAC,EAAER,gBAAgB;IACpB;EACD,CACD,CAAC;EAEDc,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAEC,QAAQ,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;EAE9D3C,cAAc,CAAC,MAAM;IACpBwC,MAAM,CAACI,mBAAmB,CAAC,QAAQ,EAAEF,QAAQ,CAAC;IAC9ChB,gBAAgB,CAACU,KAAK,GAAGE,SAAS;EACnC,CAAC,CAAC;EAEF,SAASI,QAAQA,CAACG,CAAQ,EAAE;IAC3BnB,gBAAgB,CAACU,KAAK,GAAGS,CAAC,CAAC;EAC5B;EAEA,OAAO;IACNlB,YAAY;IACZO,gBAAgB;IAChBR;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["onScopeDispose","ref","watch","propsFactory","useToggleScope","applyArrangement","applyLevitation","coordinateStrategies","levitation","arrangement","pressCoordinateProps","coordinateStrategy","type","String","Function","default","position","align","origin","offset","Number","Array","viewportMargin","useCoordinate","props","state","updateCoordinate","coordination","side","rect","x","y","width","height","coordinateStyles","active","value","reset","undefined","strategy","window","addEventListener","onResize","passive","removeEventListener","e"],"sources":["../../../src/composables/coordinate/index.ts"],"sourcesContent":["import type { PropType, Ref } from \"vue\";\r\nimport { onScopeDispose, ref, watch } from \"vue\";\r\n\r\nimport type { CssProperties } from \"@/types\";\r\n\r\nimport { propsFactory } from \"../../util/component\";\r\nimport type { Rect } from \"../../util/rect\";\r\nimport { useToggleScope } from \"../scope\";\r\nimport { applyArrangement } from \"./arrangement\";\r\nimport { applyLevitation } from \"./levitation\";\r\nimport type { CoordinateState } from \"./types\";\r\n\r\nconst coordinateStrategies = {\r\n\tlevitation: applyLevitation,\r\n\tarrangement: applyArrangement,\r\n};\r\n\r\nexport type CoordinateStrategyFn = (\r\n\tprops: any,\r\n\tstate: CoordinateState,\r\n\tcoordination: Ref<any>,\r\n\tcoordinateStyles: Ref<CssProperties>,\r\n) => undefined | { updateCoordinate: (e: Event) => void };\r\n\r\nexport const pressCoordinateProps = propsFactory(\r\n\t{\r\n\t\tcoordinateStrategy: {\r\n\t\t\ttype: [String, Function] as PropType<\r\n\t\t\t\tkeyof typeof coordinateStrategies | CoordinateStrategyFn\r\n\t\t\t>,\r\n\t\t\tdefault: \"arrangement\",\r\n\t\t},\r\n\t\tposition: {\r\n\t\t\ttype: String as PropType<\r\n\t\t\t\t\"default\" | \"top\" | \"end\" | \"right\" | \"bottom\" | \"left\" | \"start\"\r\n\t\t\t>,\r\n\t\t\tdefault: \"default\",\r\n\t\t},\r\n\t\talign: {\r\n\t\t\ttype: String as PropType<\"start\" | \"center\" | \"end\" | \"top\" | \"bottom\">,\r\n\t\t\tdefault: \"start\",\r\n\t\t},\r\n\t\torigin: {\r\n\t\t\ttype: String,\r\n\t\t\tdefault: \"auto\",\r\n\t\t},\r\n\t\toffset: {\r\n\t\t\ttype: [Number, String, Array] as PropType<number | string | number[]>,\r\n\t\t},\r\n\t\tviewportMargin: {\r\n\t\t\ttype: [Number, String, Array],\r\n\t\t\tdefault: 16,\r\n\t\t},\r\n\t},\r\n\t\"Coordinate\",\r\n);\r\n\r\nexport function useCoordinate(props: any, state: CoordinateState) {\r\n\tconst updateCoordinate = ref<(e: Event) => void>();\r\n\tconst coordination = ref<any>({\r\n\t\tside: '',\r\n\t\talign: '',\r\n\t\toffset: [0, 0],\r\n\t\trect: {\r\n\t\t\tx: 0,\r\n\t\t\ty: 0,\r\n\t\t\twidth: 0,\r\n\t\t\theight: 0\r\n\t\t}\r\n\t});\r\n\tconst coordinateStyles = ref<CssProperties>({});\r\n\r\n\tuseToggleScope(\r\n\t\t() => !!(state.active.value && props.coordinateStrategy),\r\n\t\t(reset) => {\r\n\t\t\twatch(() => props.coordinateStrategy, reset);\r\n\t\t\tonScopeDispose(() => {\r\n\t\t\t\tupdateCoordinate.value = undefined;\r\n\t\t\t});\r\n\r\n\t\t\tif (typeof props.coordinateStrategy === \"function\") {\r\n\t\t\t\tupdateCoordinate.value = props.coordinateStrategy(\r\n\t\t\t\t\tprops,\r\n\t\t\t\t\tstate,\r\n\t\t\t\t\tcoordination,\r\n\t\t\t\t\tcoordinateStyles,\r\n\t\t\t\t)?.updateCoordinate;\r\n\t\t\t} else {\r\n\t\t\t\tconst strategy =\r\n\t\t\t\t\tcoordinateStrategies[\r\n\t\t\t\t\t\tprops.coordinateStrategy as keyof typeof coordinateStrategies\r\n\t\t\t\t\t];\r\n\t\t\t\tupdateCoordinate.value = strategy?.(\r\n\t\t\t\t\tprops,\r\n\t\t\t\t\tstate,\r\n\t\t\t\t\tcoordination,\r\n\t\t\t\t\tcoordinateStyles,\r\n\t\t\t\t)?.updateCoordinate;\r\n\t\t\t}\r\n\t\t},\r\n\t);\r\n\r\n\twindow.addEventListener(\"resize\", onResize, { passive: true });\r\n\r\n\tonScopeDispose(() => {\r\n\t\twindow.removeEventListener(\"resize\", onResize);\r\n\t\tupdateCoordinate.value = undefined;\r\n\t});\r\n\r\n\tfunction onResize(e: Event) {\r\n\t\tupdateCoordinate.value?.(e);\r\n\t}\r\n\r\n\treturn {\r\n\t\tcoordination,\r\n\t\tcoordinateStyles,\r\n\t\tupdateCoordinate,\r\n\t};\r\n}\r\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAIxCC,YAAY;AAAA,SAEZC,cAAc;AAAA,SACdC,gBAAgB;AAAA,SAChBC,eAAe;AAGxB,MAAMC,oBAAoB,GAAG;EAC5BC,UAAU,EAAEF,eAAe;EAC3BG,WAAW,EAAEJ;AACd,CAAC;AASD,OAAO,MAAMK,oBAAoB,GAAGP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gBAAgB,CAACU,KAAK,GAAGE,SAAS;IACnC,CAAC,CAAC;IAEF,IAAI,OAAOd,KAAK,CAACb,kBAAkB,KAAK,UAAU,EAAE;MACnDe,gBAAgB,CAACU,KAAK,GAAGZ,KAAK,CAACb,kBAAkB,CAChDa,KAAK,EACLC,KAAK,EACLE,YAAY,EACZO,gBACD,CAAC,EAAER,gBAAgB;IACpB,CAAC,MAAM;MACN,MAAMa,QAAQ,GACbhC,oBAAoB,CACnBiB,KAAK,CAACb,kBAAkB,CACxB;MACFe,gBAAgB,CAACU,KAAK,GAAGG,QAAQ,GAChCf,KAAK,EACLC,KAAK,EACLE,YAAY,EACZO,gBACD,CAAC,EAAER,gBAAgB;IACpB;EACD,CACD,CAAC;EAEDc,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAEC,QAAQ,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;EAE9D3C,cAAc,CAAC,MAAM;IACpBwC,MAAM,CAACI,mBAAmB,CAAC,QAAQ,EAAEF,QAAQ,CAAC;IAC9ChB,gBAAgB,CAACU,KAAK,GAAGE,SAAS;EACnC,CAAC,CAAC;EAEF,SAASI,QAAQA,CAACG,CAAQ,EAAE;IAC3BnB,gBAAgB,CAACU,KAAK,GAAGS,CAAC,CAAC;EAC5B;EAEA,OAAO;IACNlB,YAAY;IACZO,gBAAgB;IAChBR;EACD,CAAC;AACF","ignoreList":[]}
@@ -116,8 +116,8 @@ export function applyLevitation(props, state, coordination, coordinateStyles) {
116
116
  scrollParents.push(document.documentElement);
117
117
  }
118
118
 
119
- /**
120
- * Viewport area
119
+ /**
120
+ * Viewport area
121
121
  */
122
122
  const viewport = scrollParents.reduce((box, el) => {
123
123
  const rect = el.getBoundingClientRect();
@@ -1 +1 @@
1
- {"version":3,"file":"levitation.js","names":["computed","nextTick","onScopeDispose","ref","watch","flipAlign","flipCorner","flipSide","getAxis","parseAnchor","clamp","$computed","getOverflow","MutableRect","getScrollParents","getBoundingPureRect","pixelCeil","pixelRound","toStyleSizeValue","anchorToPoint","getOffset","applyLevitation","props","state","coordination","coordinateStyles","contentEl","base","active","isRtl","isFlipped","minWidth","minHeight","maxWidth","maxHeight","map","key","val","parseFloat","isNaN","Infinity","preferredAnchor","preferredOrigin","location","position","align","parsedAnchor","parsedOrigin","origin","side","offset","Array","isArray","split","length","push","viewportMargin","observe","resizeObserver","ResizeObserver","updateCoordinate","_ref","_ref2","neoBaseEl","neoContentEl","oldBaseEl","oldContentEl","nodeType","unobserve","immediate","disconnect","getIgnoreInsetRect","el","rect","x","style","left","y","top","$base","value","$content","requestAnimationFrame","baseRect","width","height","getBoundingClientRect","contentRect","scrollParents","document","documentElement","viewport","reduce","box","scrollBox","clientWidth","clientHeight","Math","max","min","right","bottom","undefined","placement","anchor","checkOverflow","_placement","targetPoint","contentPoint","overflows","available","flipped","resets","_x","_y","axis","hasOverflowX","before","after","hasOverflowY","reset","forEach","newPlacement","flip","newOverflows","Object","assign","transformOrigin","result"],"sources":["../../../src/composables/coordinate/levitation.ts"],"sourcesContent":["import type { CSSProperties, Ref } from \"vue\";\nimport { computed, nextTick, onScopeDispose, ref, watch } from \"vue\";\n\nimport {\n\ttype Anchor,\n\tflipAlign,\n\tflipCorner,\n\tflipSide,\n\tgetAxis,\n\tparseAnchor,\n} from \"@/util/anchor\";\nimport { clamp } from \"@/util/common\";\nimport { $computed } from \"@/util/reactivity\";\nimport { getOverflow, MutableRect } from \"@/util/rect\";\nimport { getScrollParents } from \"@/util/scroll\";\nimport {\n\tgetBoundingPureRect,\n\tpixelCeil,\n\tpixelRound,\n\ttoStyleSizeValue,\n} from \"@/util/ui\";\n\nimport type { CoordinateState } from \"./types\";\nimport { anchorToPoint, getOffset } from \"./utils/point\";\n\nexport function applyLevitation(\n\tprops: any,\n\tstate: CoordinateState,\n\tcoordination: Ref<any>,\n\tcoordinateStyles: Ref<CSSProperties>,\n) {\n\tconst { contentEl, base, active } = state;\n\n\tconst isRtl = ref(false);\n\tconst isFlipped = ref([false, false]);\n\n\t/* Content Limitations */\n\tconst [minWidth, minHeight, maxWidth, maxHeight] = (\n\t\t[\"minWidth\", \"minHeight\", \"maxWidth\", \"maxHeight\"] as const\n\t).map((key) => {\n\t\treturn computed(() => {\n\t\t\tconst val = parseFloat(props[key]!);\n\t\t\treturn isNaN(val) ? Infinity : val;\n\t\t});\n\t});\n\n\tconst { preferredAnchor, preferredOrigin } = $computed(() => {\n\t\tconst location = `${props.position} ${props.align}` as Anchor;\n\t\tconst parsedAnchor = parseAnchor(location, false);\n\t\tconst parsedOrigin =\n\t\t\tprops.origin === \"overlap\"\n\t\t\t\t? parsedAnchor\n\t\t\t\t: props.origin === \"auto\"\n\t\t\t\t\t? flipSide(parsedAnchor)\n\t\t\t\t\t: parseAnchor(props.origin, false);\n\n\t\t// Some combinations of props may produce an invalid origin\n\t\tif (\n\t\t\tparsedAnchor.side === parsedOrigin.side &&\n\t\t\tparsedAnchor.align === flipAlign(parsedOrigin).align\n\t\t) {\n\t\t\treturn {\n\t\t\t\tpreferredAnchor: flipCorner(parsedAnchor),\n\t\t\t\tpreferredOrigin: flipCorner(parsedOrigin),\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tpreferredAnchor: parsedAnchor,\n\t\t\t\tpreferredOrigin: parsedOrigin,\n\t\t\t};\n\t\t}\n\t});\n\n\t/* Offset */\n\tconst offset = computed(() => {\n\t\tif (Array.isArray(props.offset)) {\n\t\t\treturn props.offset;\n\t\t}\n\t\tif (typeof props.offset === \"string\") {\n\t\t\tconst offset = props.offset.split(\" \").map(parseFloat);\n\t\t\tif (offset.length < 2) offset.push(0);\n\t\t\treturn offset;\n\t\t}\n\t\treturn typeof props.offset === \"number\" ? [props.offset, 0] : [0, 0];\n\t});\n\n\t/* Viewport Margin */\n\tconst viewportMargin = computed(() => {\n\t\tif (Array.isArray(props.viewportMargin)) {\n\t\t\treturn props.viewportMargin;\n\t\t}\n\t\tif (typeof props.viewportMargin === \"string\") {\n\t\t\tconst offset = props.viewportMargin.split(\" \").map(parseFloat);\n\t\t\tif (offset.length < 2) offset.push(0);\n\t\t\treturn offset;\n\t\t}\n\t\treturn typeof props.viewportMargin === \"number\"\n\t\t\t? [props.viewportMargin, 0]\n\t\t\t: [0, 0];\n\t});\n\n\t/* Observing Update */\n\tlet observe = false;\n\tconst resizeObserver = new ResizeObserver(() => {\n\t\tif (observe) updateCoordinate();\n\t});\n\n\twatch(\n\t\t[state.base, state.contentEl],\n\t\t([neoBaseEl, neoContentEl], [oldBaseEl, oldContentEl]) => {\n\t\t\tif (oldBaseEl && !Array.isArray(oldBaseEl) && oldBaseEl.nodeType === 1)\n\t\t\t\tresizeObserver.unobserve(oldBaseEl);\n\t\t\tif (neoBaseEl && !Array.isArray(neoBaseEl) && neoBaseEl.nodeType === 1)\n\t\t\t\tresizeObserver.observe(neoBaseEl);\n\n\t\t\tif (oldContentEl) resizeObserver.unobserve(oldContentEl);\n\t\t\tif (neoContentEl) resizeObserver.observe(neoContentEl);\n\t\t},\n\t\t{ immediate: true },\n\t);\n\n\tonScopeDispose(() => {\n\t\tresizeObserver.disconnect();\n\t});\n\n\tfunction getIgnoreInsetRect(el: HTMLElement) {\n\t\tconst rect = getBoundingPureRect(el);\n\t\trect.x -= parseFloat(el.style.left || \"0\");\n\t\trect.y -= parseFloat(el.style.top || \"0\");\n\t\treturn rect;\n\t}\n\n\tfunction updateCoordinate(): any {\n\t\tobserve = false;\n\t\tconst $base = base.value;\n\t\tconst $content = contentEl.value;\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tobserve = true;\n\t\t\t});\n\t\t});\n\n\t\tif (!$base || !$content) return;\n\n\t\tconst baseRect = Array.isArray($base)\n\t\t\t? new MutableRect({\n\t\t\t\t\tx: $base?.[0] ?? 0,\n\t\t\t\t\ty: $base?.[1] ?? 0,\n\t\t\t\t\twidth: 0,\n\t\t\t\t\theight: 0,\n\t\t\t\t})\n\t\t\t: $base.getBoundingClientRect();\n\t\tconst contentRect = getIgnoreInsetRect($content);\n\t\tconst scrollParents = getScrollParents($content);\n\n\t\tif (scrollParents.length < 1) {\n\t\t\tscrollParents.push(document.documentElement);\n\t\t}\n\n\t\t/**\n\t\t * Viewport area\n\t\t */\n\t\tconst viewport = scrollParents.reduce<MutableRect>(\n\t\t\t(box: MutableRect | undefined, el) => {\n\t\t\t\tconst rect = el.getBoundingClientRect();\n\t\t\t\tconst scrollBox = new MutableRect({\n\t\t\t\t\tx: el === document.documentElement ? 0 : rect.x,\n\t\t\t\t\ty: el === document.documentElement ? 0 : rect.y,\n\t\t\t\t\twidth: el.clientWidth,\n\t\t\t\t\theight: el.clientHeight,\n\t\t\t\t});\n\n\t\t\t\tif (box) {\n\t\t\t\t\treturn new MutableRect({\n\t\t\t\t\t\tx: Math.max(box.left, scrollBox.left),\n\t\t\t\t\t\ty: Math.max(box.top, scrollBox.top),\n\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\tMath.min(box.right, scrollBox.right) -\n\t\t\t\t\t\t\tMath.max(box.left, scrollBox.left),\n\t\t\t\t\t\theight:\n\t\t\t\t\t\t\tMath.min(box.bottom, scrollBox.bottom) -\n\t\t\t\t\t\t\tMath.max(box.top, scrollBox.top),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn scrollBox;\n\t\t\t},\n\t\t\tundefined!,\n\t\t);\n\t\tviewport.x += viewportMargin.value[0];\n\t\tviewport.y += viewportMargin.value[1];\n\t\tviewport.width -= viewportMargin.value[0] * 2;\n\t\tviewport.height -= viewportMargin.value[1] * 2;\n\n\t\tlet placement = {\n\t\t\tanchor: preferredAnchor.value,\n\t\t\torigin: preferredOrigin.value,\n\t\t};\n\n\t\tfunction checkOverflow(_placement: typeof placement) {\n\t\t\tconst box = new MutableRect(contentRect);\n\t\t\tconst targetPoint = anchorToPoint(_placement.anchor, baseRect);\n\t\t\tconst contentPoint = anchorToPoint(_placement.origin, box);\n\n\t\t\tlet { x, y } = getOffset(targetPoint, contentPoint);\n\n\t\t\tswitch (_placement.anchor.side) {\n\t\t\t\tcase \"top\":\n\t\t\t\t\ty -= offset.value[0];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bottom\":\n\t\t\t\t\ty += offset.value[0];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"left\":\n\t\t\t\t\tx -= offset.value[0];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"right\":\n\t\t\t\t\tx += offset.value[0];\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (_placement.anchor.align) {\n\t\t\t\tcase \"top\":\n\t\t\t\t\ty -= offset.value[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bottom\":\n\t\t\t\t\ty += offset.value[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"left\":\n\t\t\t\t\tx -= offset.value[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"right\":\n\t\t\t\t\tx += offset.value[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"center\": {\n\t\t\t\t\tif (\n\t\t\t\t\t\t_placement.anchor.side === \"top\" ||\n\t\t\t\t\t\t_placement.anchor.side === \"bottom\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tx += offset.value[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\ty += offset.value[1];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbox.x += x;\n\t\t\tbox.y += y;\n\n\t\t\tbox.width = Math.min(box.width, maxWidth.value);\n\t\t\tbox.height = Math.min(box.height, maxHeight.value);\n\n\t\t\tconst overflows = getOverflow(box, viewport);\n\n\t\t\treturn { overflows, x, y };\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\tconst available = { x: 0, y: 0 };\n\t\tconst flipped = { x: false, y: false };\n\t\tlet resets = -1;\n\t\twhile (true) {\n\t\t\tif (resets++ > 10) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst { x: _x, y: _y, overflows } = checkOverflow(placement);\n\n\t\t\tx += _x;\n\t\t\ty += _y;\n\n\t\t\tcontentRect.x += _x;\n\t\t\tcontentRect.y += _y;\n\n\t\t\t// flip\n\t\t\t{\n\t\t\t\tconst axis = getAxis(placement.anchor);\n\t\t\t\tconst hasOverflowX = overflows.x.before || overflows.x.after;\n\t\t\t\tconst hasOverflowY = overflows.y.before || overflows.y.after;\n\n\t\t\t\tlet reset = false;\n\t\t\t\t[\"x\", \"y\"].forEach((key) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(key === \"x\" && hasOverflowX && !flipped.x) ||\n\t\t\t\t\t\t(key === \"y\" && hasOverflowY && !flipped.y)\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst newPlacement = {\n\t\t\t\t\t\t\tanchor: { ...placement.anchor },\n\t\t\t\t\t\t\torigin: { ...placement.origin },\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst flip =\n\t\t\t\t\t\t\tkey === \"x\"\n\t\t\t\t\t\t\t\t? axis === \"y\"\n\t\t\t\t\t\t\t\t\t? flipAlign\n\t\t\t\t\t\t\t\t\t: flipSide\n\t\t\t\t\t\t\t\t: axis === \"y\"\n\t\t\t\t\t\t\t\t\t? flipSide\n\t\t\t\t\t\t\t\t\t: flipAlign;\n\t\t\t\t\t\tnewPlacement.anchor = flip(newPlacement.anchor);\n\t\t\t\t\t\tnewPlacement.origin = flip(newPlacement.origin);\n\t\t\t\t\t\tconst { overflows: newOverflows } = checkOverflow(newPlacement);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(newOverflows[key].before <= overflows[key].before &&\n\t\t\t\t\t\t\t\tnewOverflows[key].after <= overflows[key].after) ||\n\t\t\t\t\t\t\tnewOverflows[key].before + newOverflows[key].after <\n\t\t\t\t\t\t\t\t(overflows[key].before + overflows[key].after) / 2\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tplacement = newPlacement;\n\t\t\t\t\t\t\treset = flipped[key] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif (reset) continue;\n\t\t\t}\n\n\t\t\t// shift\n\t\t\tif (overflows.x.before) {\n\t\t\t\tx += overflows.x.before;\n\t\t\t\tcontentRect.x += overflows.x.before;\n\t\t\t}\n\t\t\tif (overflows.x.after) {\n\t\t\t\tx -= overflows.x.after;\n\t\t\t\tcontentRect.x -= overflows.x.after;\n\t\t\t}\n\t\t\tif (overflows.y.before) {\n\t\t\t\ty += overflows.y.before;\n\t\t\t\tcontentRect.y += overflows.y.before;\n\t\t\t}\n\t\t\tif (overflows.y.after) {\n\t\t\t\ty -= overflows.y.after;\n\t\t\t\tcontentRect.y -= overflows.y.after;\n\t\t\t}\n\n\t\t\t// size\n\t\t\t{\n\t\t\t\tconst overflows = getOverflow(contentRect, viewport);\n\t\t\t\tavailable.x = viewport.width - overflows.x.before - overflows.x.after;\n\t\t\t\tavailable.y = viewport.height - overflows.y.before - overflows.y.after;\n\n\t\t\t\tx += overflows.x.before;\n\t\t\t\tcontentRect.x += overflows.x.before;\n\t\t\t\ty += overflows.y.before;\n\t\t\t\tcontentRect.y += overflows.y.before;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tconst axis = getAxis(placement.anchor);\n\n\t\tcoordination.value = {\n\t\t\tside: placement.anchor.side,\n\t\t\talign: placement.anchor.align,\n\t\t\trect: new MutableRect({\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\twidth: contentRect.width,\n\t\t\t\theight: contentRect.height,\n\t\t\t}),\n\t\t\toffset: [0, 0],\n\t\t};\n\n\t\tObject.assign(coordinateStyles.value, {\n\t\t\t\"--y-levitation-anchor-origin\": `${placement.anchor.side} ${placement.anchor.align}`,\n\t\t\ttransformOrigin: `${placement.origin.side} ${placement.origin.align}`,\n\t\t\ttop: toStyleSizeValue(pixelRound(y)),\n\t\t\tleft: isRtl.value ? undefined : toStyleSizeValue(pixelRound(x)),\n\t\t\tright: isRtl.value ? toStyleSizeValue(pixelRound(-x)) : undefined,\n\t\t\tminWidth: toStyleSizeValue(\n\t\t\t\taxis === \"y\"\n\t\t\t\t\t? Math.min(minWidth.value, baseRect.width)\n\t\t\t\t\t: minWidth.value,\n\t\t\t),\n\t\t\tmaxWidth: toStyleSizeValue(\n\t\t\t\tpixelCeil(\n\t\t\t\t\tclamp(\n\t\t\t\t\t\tavailable.x,\n\t\t\t\t\t\tminWidth.value === Infinity ? 0 : minWidth.value,\n\t\t\t\t\t\tmaxWidth.value,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\tmaxHeight: toStyleSizeValue(\n\t\t\t\tpixelCeil(\n\t\t\t\t\tclamp(\n\t\t\t\t\t\tavailable.y,\n\t\t\t\t\t\tminHeight.value === Infinity ? 0 : minHeight.value,\n\t\t\t\t\t\tmaxHeight.value,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t});\n\n\t\tisFlipped.value = [flipped.x, flipped.y];\n\n\t\treturn {\n\t\t\tavailable,\n\t\t\tcontentRect,\n\t\t\tflipped,\n\t\t\tplacement,\n\t\t};\n\t}\n\n\twatch(\n\t\t() => [\n\t\t\tprops.offset,\n\t\t\tprops.minWidth,\n\t\t\tprops.minHeight,\n\t\t\tprops.maxWidth,\n\t\t\tprops.maxHeight,\n\t\t\tpreferredAnchor.value,\n\t\t\tpreferredOrigin.value,\n\t\t],\n\t\t() => updateCoordinate(),\n\t);\n\n\tnextTick(() => {\n\t\tconst result = updateCoordinate();\n\t\tif (!result) return;\n\t\tconst { available, contentRect } = result;\n\t\tif (contentRect.height > available.y) {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tupdateCoordinate();\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tupdateCoordinate();\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t});\n\n\treturn {\n\t\tupdateCoordinate,\n\t\tisFlipped,\n\t\tpreferredAnchor,\n\t\tpreferredOrigin,\n\t};\n}\n"],"mappings":"AACA,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,CACRN,KAAK,CACJoG,SAAS,CAACjC,CAAC,EACX7C,SAAS,CAACgD,KAAK,KAAKxC,QAAQ,GAAG,CAAC,GAAGR,SAAS,CAACgD,KAAK,EAClD9C,SAAS,CAAC8C,KACX,CACD,CACD;IACD,CAAC,CAAC;IAEFlD,SAAS,CAACkD,KAAK,GAAG,CAAC+B,OAAO,CAACrC,CAAC,EAAEqC,OAAO,CAAClC,CAAC,CAAC;IAExC,OAAO;MACNiC,SAAS;MACTvB,WAAW;MACXwB,OAAO;MACPR;IACD,CAAC;EACF;EAEAnG,KAAK,CACJ,MAAM,CACLkB,KAAK,CAAC4B,MAAM,EACZ5B,KAAK,CAACS,QAAQ,EACdT,KAAK,CAACU,SAAS,EACfV,KAAK,CAACW,QAAQ,EACdX,KAAK,CAACY,SAAS,EACfO,eAAe,CAACuC,KAAK,EACrBtC,eAAe,CAACsC,KAAK,CACrB,EACD,MAAMpB,gBAAgB,CAAC,CACxB,CAAC;EAED3D,QAAQ,CAAC,MAAM;IACd,MAAM+H,MAAM,GAAGpE,gBAAgB,CAAC,CAAC;IACjC,IAAI,CAACoE,MAAM,EAAE;IACb,MAAM;MAAElB,SAAS;MAAEvB;IAAY,CAAC,GAAGyC,MAAM;IACzC,IAAIzC,WAAW,CAACF,MAAM,GAAGyB,SAAS,CAACjC,CAAC,EAAE;MACrCK,qBAAqB,CAAC,MAAM;QAC3BtB,gBAAgB,CAAC,CAAC;QAClBsB,qBAAqB,CAAC,MAAM;UAC3BtB,gBAAgB,CAAC,CAAC;QACnB,CAAC,CAAC;MACH,CAAC,CAAC;IACH;EACD,CAAC,CAAC;EAEF,OAAO;IACNA,gBAAgB;IAChB9B,SAAS;IACTW,eAAe;IACfC;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"levitation.js","names":["computed","nextTick","onScopeDispose","ref","watch","flipAlign","flipCorner","flipSide","getAxis","parseAnchor","clamp","$computed","getOverflow","MutableRect","getScrollParents","getBoundingPureRect","pixelCeil","pixelRound","toStyleSizeValue","anchorToPoint","getOffset","applyLevitation","props","state","coordination","coordinateStyles","contentEl","base","active","isRtl","isFlipped","minWidth","minHeight","maxWidth","maxHeight","map","key","val","parseFloat","isNaN","Infinity","preferredAnchor","preferredOrigin","location","position","align","parsedAnchor","parsedOrigin","origin","side","offset","Array","isArray","split","length","push","viewportMargin","observe","resizeObserver","ResizeObserver","updateCoordinate","_ref","_ref2","neoBaseEl","neoContentEl","oldBaseEl","oldContentEl","nodeType","unobserve","immediate","disconnect","getIgnoreInsetRect","el","rect","x","style","left","y","top","$base","value","$content","requestAnimationFrame","baseRect","width","height","getBoundingClientRect","contentRect","scrollParents","document","documentElement","viewport","reduce","box","scrollBox","clientWidth","clientHeight","Math","max","min","right","bottom","undefined","placement","anchor","checkOverflow","_placement","targetPoint","contentPoint","overflows","available","flipped","resets","_x","_y","axis","hasOverflowX","before","after","hasOverflowY","reset","forEach","newPlacement","flip","newOverflows","Object","assign","transformOrigin","result"],"sources":["../../../src/composables/coordinate/levitation.ts"],"sourcesContent":["import type { CSSProperties, Ref } from \"vue\";\r\nimport { computed, nextTick, onScopeDispose, ref, watch } from \"vue\";\r\n\r\nimport {\r\n\ttype Anchor,\r\n\tflipAlign,\r\n\tflipCorner,\r\n\tflipSide,\r\n\tgetAxis,\r\n\tparseAnchor,\r\n} from \"@/util/anchor\";\r\nimport { clamp } from \"@/util/common\";\r\nimport { $computed } from \"@/util/reactivity\";\r\nimport { getOverflow, MutableRect } from \"@/util/rect\";\r\nimport { getScrollParents } from \"@/util/scroll\";\r\nimport {\r\n\tgetBoundingPureRect,\r\n\tpixelCeil,\r\n\tpixelRound,\r\n\ttoStyleSizeValue,\r\n} from \"@/util/ui\";\r\n\r\nimport type { CoordinateState } from \"./types\";\r\nimport { anchorToPoint, getOffset } from \"./utils/point\";\r\n\r\nexport function applyLevitation(\r\n\tprops: any,\r\n\tstate: CoordinateState,\r\n\tcoordination: Ref<any>,\r\n\tcoordinateStyles: Ref<CSSProperties>,\r\n) {\r\n\tconst { contentEl, base, active } = state;\r\n\r\n\tconst isRtl = ref(false);\r\n\tconst isFlipped = ref([false, false]);\r\n\r\n\t/* Content Limitations */\r\n\tconst [minWidth, minHeight, maxWidth, maxHeight] = (\r\n\t\t[\"minWidth\", \"minHeight\", \"maxWidth\", \"maxHeight\"] as const\r\n\t).map((key) => {\r\n\t\treturn computed(() => {\r\n\t\t\tconst val = parseFloat(props[key]!);\r\n\t\t\treturn isNaN(val) ? Infinity : val;\r\n\t\t});\r\n\t});\r\n\r\n\tconst { preferredAnchor, preferredOrigin } = $computed(() => {\r\n\t\tconst location = `${props.position} ${props.align}` as Anchor;\r\n\t\tconst parsedAnchor = parseAnchor(location, false);\r\n\t\tconst parsedOrigin =\r\n\t\t\tprops.origin === \"overlap\"\r\n\t\t\t\t? parsedAnchor\r\n\t\t\t\t: props.origin === \"auto\"\r\n\t\t\t\t\t? flipSide(parsedAnchor)\r\n\t\t\t\t\t: parseAnchor(props.origin, false);\r\n\r\n\t\t// Some combinations of props may produce an invalid origin\r\n\t\tif (\r\n\t\t\tparsedAnchor.side === parsedOrigin.side &&\r\n\t\t\tparsedAnchor.align === flipAlign(parsedOrigin).align\r\n\t\t) {\r\n\t\t\treturn {\r\n\t\t\t\tpreferredAnchor: flipCorner(parsedAnchor),\r\n\t\t\t\tpreferredOrigin: flipCorner(parsedOrigin),\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\treturn {\r\n\t\t\t\tpreferredAnchor: parsedAnchor,\r\n\t\t\t\tpreferredOrigin: parsedOrigin,\r\n\t\t\t};\r\n\t\t}\r\n\t});\r\n\r\n\t/* Offset */\r\n\tconst offset = computed(() => {\r\n\t\tif (Array.isArray(props.offset)) {\r\n\t\t\treturn props.offset;\r\n\t\t}\r\n\t\tif (typeof props.offset === \"string\") {\r\n\t\t\tconst offset = props.offset.split(\" \").map(parseFloat);\r\n\t\t\tif (offset.length < 2) offset.push(0);\r\n\t\t\treturn offset;\r\n\t\t}\r\n\t\treturn typeof props.offset === \"number\" ? [props.offset, 0] : [0, 0];\r\n\t});\r\n\r\n\t/* Viewport Margin */\r\n\tconst viewportMargin = computed(() => {\r\n\t\tif (Array.isArray(props.viewportMargin)) {\r\n\t\t\treturn props.viewportMargin;\r\n\t\t}\r\n\t\tif (typeof props.viewportMargin === \"string\") {\r\n\t\t\tconst offset = props.viewportMargin.split(\" \").map(parseFloat);\r\n\t\t\tif (offset.length < 2) offset.push(0);\r\n\t\t\treturn offset;\r\n\t\t}\r\n\t\treturn typeof props.viewportMargin === \"number\"\r\n\t\t\t? [props.viewportMargin, 0]\r\n\t\t\t: [0, 0];\r\n\t});\r\n\r\n\t/* Observing Update */\r\n\tlet observe = false;\r\n\tconst resizeObserver = new ResizeObserver(() => {\r\n\t\tif (observe) updateCoordinate();\r\n\t});\r\n\r\n\twatch(\r\n\t\t[state.base, state.contentEl],\r\n\t\t([neoBaseEl, neoContentEl], [oldBaseEl, oldContentEl]) => {\r\n\t\t\tif (oldBaseEl && !Array.isArray(oldBaseEl) && oldBaseEl.nodeType === 1)\r\n\t\t\t\tresizeObserver.unobserve(oldBaseEl);\r\n\t\t\tif (neoBaseEl && !Array.isArray(neoBaseEl) && neoBaseEl.nodeType === 1)\r\n\t\t\t\tresizeObserver.observe(neoBaseEl);\r\n\r\n\t\t\tif (oldContentEl) resizeObserver.unobserve(oldContentEl);\r\n\t\t\tif (neoContentEl) resizeObserver.observe(neoContentEl);\r\n\t\t},\r\n\t\t{ immediate: true },\r\n\t);\r\n\r\n\tonScopeDispose(() => {\r\n\t\tresizeObserver.disconnect();\r\n\t});\r\n\r\n\tfunction getIgnoreInsetRect(el: HTMLElement) {\r\n\t\tconst rect = getBoundingPureRect(el);\r\n\t\trect.x -= parseFloat(el.style.left || \"0\");\r\n\t\trect.y -= parseFloat(el.style.top || \"0\");\r\n\t\treturn rect;\r\n\t}\r\n\r\n\tfunction updateCoordinate(): any {\r\n\t\tobserve = false;\r\n\t\tconst $base = base.value;\r\n\t\tconst $content = contentEl.value;\r\n\t\trequestAnimationFrame(() => {\r\n\t\t\trequestAnimationFrame(() => {\r\n\t\t\t\tobserve = true;\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tif (!$base || !$content) return;\r\n\r\n\t\tconst baseRect = Array.isArray($base)\r\n\t\t\t? new MutableRect({\r\n\t\t\t\t\tx: $base?.[0] ?? 0,\r\n\t\t\t\t\ty: $base?.[1] ?? 0,\r\n\t\t\t\t\twidth: 0,\r\n\t\t\t\t\theight: 0,\r\n\t\t\t\t})\r\n\t\t\t: $base.getBoundingClientRect();\r\n\t\tconst contentRect = getIgnoreInsetRect($content);\r\n\t\tconst scrollParents = getScrollParents($content);\r\n\r\n\t\tif (scrollParents.length < 1) {\r\n\t\t\tscrollParents.push(document.documentElement);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Viewport area\r\n\t\t */\r\n\t\tconst viewport = scrollParents.reduce<MutableRect>(\r\n\t\t\t(box: MutableRect | undefined, el) => {\r\n\t\t\t\tconst rect = el.getBoundingClientRect();\r\n\t\t\t\tconst scrollBox = new MutableRect({\r\n\t\t\t\t\tx: el === document.documentElement ? 0 : rect.x,\r\n\t\t\t\t\ty: el === document.documentElement ? 0 : rect.y,\r\n\t\t\t\t\twidth: el.clientWidth,\r\n\t\t\t\t\theight: el.clientHeight,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (box) {\r\n\t\t\t\t\treturn new MutableRect({\r\n\t\t\t\t\t\tx: Math.max(box.left, scrollBox.left),\r\n\t\t\t\t\t\ty: Math.max(box.top, scrollBox.top),\r\n\t\t\t\t\t\twidth:\r\n\t\t\t\t\t\t\tMath.min(box.right, scrollBox.right) -\r\n\t\t\t\t\t\t\tMath.max(box.left, scrollBox.left),\r\n\t\t\t\t\t\theight:\r\n\t\t\t\t\t\t\tMath.min(box.bottom, scrollBox.bottom) -\r\n\t\t\t\t\t\t\tMath.max(box.top, scrollBox.top),\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn scrollBox;\r\n\t\t\t},\r\n\t\t\tundefined!,\r\n\t\t);\r\n\t\tviewport.x += viewportMargin.value[0];\r\n\t\tviewport.y += viewportMargin.value[1];\r\n\t\tviewport.width -= viewportMargin.value[0] * 2;\r\n\t\tviewport.height -= viewportMargin.value[1] * 2;\r\n\r\n\t\tlet placement = {\r\n\t\t\tanchor: preferredAnchor.value,\r\n\t\t\torigin: preferredOrigin.value,\r\n\t\t};\r\n\r\n\t\tfunction checkOverflow(_placement: typeof placement) {\r\n\t\t\tconst box = new MutableRect(contentRect);\r\n\t\t\tconst targetPoint = anchorToPoint(_placement.anchor, baseRect);\r\n\t\t\tconst contentPoint = anchorToPoint(_placement.origin, box);\r\n\r\n\t\t\tlet { x, y } = getOffset(targetPoint, contentPoint);\r\n\r\n\t\t\tswitch (_placement.anchor.side) {\r\n\t\t\t\tcase \"top\":\r\n\t\t\t\t\ty -= offset.value[0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"bottom\":\r\n\t\t\t\t\ty += offset.value[0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"left\":\r\n\t\t\t\t\tx -= offset.value[0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"right\":\r\n\t\t\t\t\tx += offset.value[0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tswitch (_placement.anchor.align) {\r\n\t\t\t\tcase \"top\":\r\n\t\t\t\t\ty -= offset.value[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"bottom\":\r\n\t\t\t\t\ty += offset.value[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"left\":\r\n\t\t\t\t\tx -= offset.value[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"right\":\r\n\t\t\t\t\tx += offset.value[1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"center\": {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t_placement.anchor.side === \"top\" ||\r\n\t\t\t\t\t\t_placement.anchor.side === \"bottom\"\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tx += offset.value[1];\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ty += offset.value[1];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tbox.x += x;\r\n\t\t\tbox.y += y;\r\n\r\n\t\t\tbox.width = Math.min(box.width, maxWidth.value);\r\n\t\t\tbox.height = Math.min(box.height, maxHeight.value);\r\n\r\n\t\t\tconst overflows = getOverflow(box, viewport);\r\n\r\n\t\t\treturn { overflows, x, y };\r\n\t\t}\r\n\r\n\t\tlet x = 0;\r\n\t\tlet y = 0;\r\n\t\tconst available = { x: 0, y: 0 };\r\n\t\tconst flipped = { x: false, y: false };\r\n\t\tlet resets = -1;\r\n\t\twhile (true) {\r\n\t\t\tif (resets++ > 10) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tconst { x: _x, y: _y, overflows } = checkOverflow(placement);\r\n\r\n\t\t\tx += _x;\r\n\t\t\ty += _y;\r\n\r\n\t\t\tcontentRect.x += _x;\r\n\t\t\tcontentRect.y += _y;\r\n\r\n\t\t\t// flip\r\n\t\t\t{\r\n\t\t\t\tconst axis = getAxis(placement.anchor);\r\n\t\t\t\tconst hasOverflowX = overflows.x.before || overflows.x.after;\r\n\t\t\t\tconst hasOverflowY = overflows.y.before || overflows.y.after;\r\n\r\n\t\t\t\tlet reset = false;\r\n\t\t\t\t[\"x\", \"y\"].forEach((key) => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t(key === \"x\" && hasOverflowX && !flipped.x) ||\r\n\t\t\t\t\t\t(key === \"y\" && hasOverflowY && !flipped.y)\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tconst newPlacement = {\r\n\t\t\t\t\t\t\tanchor: { ...placement.anchor },\r\n\t\t\t\t\t\t\torigin: { ...placement.origin },\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tconst flip =\r\n\t\t\t\t\t\t\tkey === \"x\"\r\n\t\t\t\t\t\t\t\t? axis === \"y\"\r\n\t\t\t\t\t\t\t\t\t? flipAlign\r\n\t\t\t\t\t\t\t\t\t: flipSide\r\n\t\t\t\t\t\t\t\t: axis === \"y\"\r\n\t\t\t\t\t\t\t\t\t? flipSide\r\n\t\t\t\t\t\t\t\t\t: flipAlign;\r\n\t\t\t\t\t\tnewPlacement.anchor = flip(newPlacement.anchor);\r\n\t\t\t\t\t\tnewPlacement.origin = flip(newPlacement.origin);\r\n\t\t\t\t\t\tconst { overflows: newOverflows } = checkOverflow(newPlacement);\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t(newOverflows[key].before <= overflows[key].before &&\r\n\t\t\t\t\t\t\t\tnewOverflows[key].after <= overflows[key].after) ||\r\n\t\t\t\t\t\t\tnewOverflows[key].before + newOverflows[key].after <\r\n\t\t\t\t\t\t\t\t(overflows[key].before + overflows[key].after) / 2\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tplacement = newPlacement;\r\n\t\t\t\t\t\t\treset = flipped[key] = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tif (reset) continue;\r\n\t\t\t}\r\n\r\n\t\t\t// shift\r\n\t\t\tif (overflows.x.before) {\r\n\t\t\t\tx += overflows.x.before;\r\n\t\t\t\tcontentRect.x += overflows.x.before;\r\n\t\t\t}\r\n\t\t\tif (overflows.x.after) {\r\n\t\t\t\tx -= overflows.x.after;\r\n\t\t\t\tcontentRect.x -= overflows.x.after;\r\n\t\t\t}\r\n\t\t\tif (overflows.y.before) {\r\n\t\t\t\ty += overflows.y.before;\r\n\t\t\t\tcontentRect.y += overflows.y.before;\r\n\t\t\t}\r\n\t\t\tif (overflows.y.after) {\r\n\t\t\t\ty -= overflows.y.after;\r\n\t\t\t\tcontentRect.y -= overflows.y.after;\r\n\t\t\t}\r\n\r\n\t\t\t// size\r\n\t\t\t{\r\n\t\t\t\tconst overflows = getOverflow(contentRect, viewport);\r\n\t\t\t\tavailable.x = viewport.width - overflows.x.before - overflows.x.after;\r\n\t\t\t\tavailable.y = viewport.height - overflows.y.before - overflows.y.after;\r\n\r\n\t\t\t\tx += overflows.x.before;\r\n\t\t\t\tcontentRect.x += overflows.x.before;\r\n\t\t\t\ty += overflows.y.before;\r\n\t\t\t\tcontentRect.y += overflows.y.before;\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tconst axis = getAxis(placement.anchor);\r\n\r\n\t\tcoordination.value = {\r\n\t\t\tside: placement.anchor.side,\r\n\t\t\talign: placement.anchor.align,\r\n\t\t\trect: new MutableRect({\r\n\t\t\t\tx,\r\n\t\t\t\ty,\r\n\t\t\t\twidth: contentRect.width,\r\n\t\t\t\theight: contentRect.height,\r\n\t\t\t}),\r\n\t\t\toffset: [0, 0],\r\n\t\t};\r\n\r\n\t\tObject.assign(coordinateStyles.value, {\r\n\t\t\t\"--y-levitation-anchor-origin\": `${placement.anchor.side} ${placement.anchor.align}`,\r\n\t\t\ttransformOrigin: `${placement.origin.side} ${placement.origin.align}`,\r\n\t\t\ttop: toStyleSizeValue(pixelRound(y)),\r\n\t\t\tleft: isRtl.value ? undefined : toStyleSizeValue(pixelRound(x)),\r\n\t\t\tright: isRtl.value ? toStyleSizeValue(pixelRound(-x)) : undefined,\r\n\t\t\tminWidth: toStyleSizeValue(\r\n\t\t\t\taxis === \"y\"\r\n\t\t\t\t\t? Math.min(minWidth.value, baseRect.width)\r\n\t\t\t\t\t: minWidth.value,\r\n\t\t\t),\r\n\t\t\tmaxWidth: toStyleSizeValue(\r\n\t\t\t\tpixelCeil(\r\n\t\t\t\t\tclamp(\r\n\t\t\t\t\t\tavailable.x,\r\n\t\t\t\t\t\tminWidth.value === Infinity ? 0 : minWidth.value,\r\n\t\t\t\t\t\tmaxWidth.value,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t\tmaxHeight: toStyleSizeValue(\r\n\t\t\t\tpixelCeil(\r\n\t\t\t\t\tclamp(\r\n\t\t\t\t\t\tavailable.y,\r\n\t\t\t\t\t\tminHeight.value === Infinity ? 0 : minHeight.value,\r\n\t\t\t\t\t\tmaxHeight.value,\r\n\t\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t),\r\n\t\t});\r\n\r\n\t\tisFlipped.value = [flipped.x, flipped.y];\r\n\r\n\t\treturn {\r\n\t\t\tavailable,\r\n\t\t\tcontentRect,\r\n\t\t\tflipped,\r\n\t\t\tplacement,\r\n\t\t};\r\n\t}\r\n\r\n\twatch(\r\n\t\t() => [\r\n\t\t\tprops.offset,\r\n\t\t\tprops.minWidth,\r\n\t\t\tprops.minHeight,\r\n\t\t\tprops.maxWidth,\r\n\t\t\tprops.maxHeight,\r\n\t\t\tpreferredAnchor.value,\r\n\t\t\tpreferredOrigin.value,\r\n\t\t],\r\n\t\t() => updateCoordinate(),\r\n\t);\r\n\r\n\tnextTick(() => {\r\n\t\tconst result = updateCoordinate();\r\n\t\tif (!result) return;\r\n\t\tconst { available, contentRect } = result;\r\n\t\tif (contentRect.height > available.y) {\r\n\t\t\trequestAnimationFrame(() => {\r\n\t\t\t\tupdateCoordinate();\r\n\t\t\t\trequestAnimationFrame(() => {\r\n\t\t\t\t\tupdateCoordinate();\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\treturn {\r\n\t\tupdateCoordinate,\r\n\t\tisFlipped,\r\n\t\tpreferredAnchor,\r\n\t\tpreferredOrigin,\r\n\t};\r\n}\r\n"],"mappings":"AACA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAIpEC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,OAAO,EACPC,WAAW;AAAA,SAEHC,KAAK;AAAA,SACLC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D,SAAS,CAACkD,KAAK,GAAG,CAAC+B,OAAO,CAACrC,CAAC,EAAEqC,OAAO,CAAClC,CAAC,CAAC;IAExC,OAAO;MACNiC,SAAS;MACTvB,WAAW;MACXwB,OAAO;MACPR;IACD,CAAC;EACF;EAEAnG,KAAK,CACJ,MAAM,CACLkB,KAAK,CAAC4B,MAAM,EACZ5B,KAAK,CAACS,QAAQ,EACdT,KAAK,CAACU,SAAS,EACfV,KAAK,CAACW,QAAQ,EACdX,KAAK,CAACY,SAAS,EACfO,eAAe,CAACuC,KAAK,EACrBtC,eAAe,CAACsC,KAAK,CACrB,EACD,MAAMpB,gBAAgB,CAAC,CACxB,CAAC;EAED3D,QAAQ,CAAC,MAAM;IACd,MAAM+H,MAAM,GAAGpE,gBAAgB,CAAC,CAAC;IACjC,IAAI,CAACoE,MAAM,EAAE;IACb,MAAM;MAAElB,SAAS;MAAEvB;IAAY,CAAC,GAAGyC,MAAM;IACzC,IAAIzC,WAAW,CAACF,MAAM,GAAGyB,SAAS,CAACjC,CAAC,EAAE;MACrCK,qBAAqB,CAAC,MAAM;QAC3BtB,gBAAgB,CAAC,CAAC;QAClBsB,qBAAqB,CAAC,MAAM;UAC3BtB,gBAAgB,CAAC,CAAC;QACnB,CAAC,CAAC;MACH,CAAC,CAAC;IACH;EACD,CAAC,CAAC;EAEF,OAAO;IACNA,gBAAgB;IAChB9B,SAAS;IACTW,eAAe;IACfC;EACD,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/composables/coordinate/types.ts"],"sourcesContent":["import type { Ref } from 'vue';\n\nexport interface CoordinateState {\n contentEl: Ref<HTMLElement | undefined>;\n base: Ref<HTMLElement | [x: number, y: number] | undefined>;\n active: Ref<boolean>;\n placement?: Ref<any>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/composables/coordinate/types.ts"],"sourcesContent":["import type { Ref } from 'vue';\r\n\r\nexport interface CoordinateState {\r\n contentEl: Ref<HTMLElement | undefined>;\r\n base: Ref<HTMLElement | [x: number, y: number] | undefined>;\r\n active: Ref<boolean>;\r\n placement?: Ref<any>;\r\n}\r\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/composables/defaults/types.ts"],"sourcesContent":["import { type MaybeRef } from 'vue';\n\nexport type DefaultsModuleInstance =\n | undefined\n | {\n [key: string]: any;\n };\n\nexport type DefaultsOptions = Partial<DefaultsModuleInstance>;\n\nexport type ProvideDefaultsOptions = {\n disabled?: MaybeRef<boolean | undefined>;\n reset?: MaybeRef<number | string | undefined>;\n root?: MaybeRef<boolean | string | undefined>;\n scoped?: MaybeRef<boolean | undefined>;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/composables/defaults/types.ts"],"sourcesContent":["import { type MaybeRef } from 'vue';\r\n\r\nexport type DefaultsModuleInstance =\r\n | undefined\r\n | {\r\n [key: string]: any;\r\n };\r\n\r\nexport type DefaultsOptions = Partial<DefaultsModuleInstance>;\r\n\r\nexport type ProvideDefaultsOptions = {\r\n disabled?: MaybeRef<boolean | undefined>;\r\n reset?: MaybeRef<number | string | undefined>;\r\n root?: MaybeRef<boolean | string | undefined>;\r\n scoped?: MaybeRef<boolean | undefined>;\r\n};\r\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","names":["computed","inject","provide","ref","shallowRef","toRef","propsFactory","useModelDuplex","YUYEON_FORM_KEY","Symbol","for","pressFormPropsOptions","readonly","Boolean","disabled","loading","modelValue","type","default","validateOn","String","createForm","props","model","isValidating","inputs","errors","isReadonly","isDisabled","isLoading","validate","results","valid","value","item","itemErrors","length","push","id","vnode","exposed","component","register","input","isError","unregister","filter","update","found","find","provideInstance","isValid","useForm"],"sources":["../../src/composables/form.ts"],"sourcesContent":["import {\n\ttype ComputedRef,\n\tcomputed,\n\ttype InjectionKey,\n\tinject,\n\ttype PropType,\n\tprovide,\n\ttype Ref,\n\tref,\n\tshallowRef,\n\ttoRef,\n\ttype VNode,\n} from \"vue\";\n\nimport { type EventProp, propsFactory } from \"@/util/component\";\n\nimport { useModelDuplex } from \"./communication\";\nimport type { ValidationProps } from \"./validation\";\n\nexport interface FormInput {\n\tid: number | string;\n\tvnode: VNode;\n\tvalidate: () => Promise<any[]>;\n\tisError: boolean | undefined | null;\n\terrors: any[];\n}\n\nexport interface InputValidationResult {\n\tid: number | string;\n\tvnode: VNode;\n\texposed: any;\n\terrors: any[];\n}\n\nexport interface FormValidationResult {\n\tvalid: boolean;\n\terrors: InputValidationResult[];\n}\n\nexport interface SubmitEventPromise\n\textends SubmitEvent,\n\t\tPromise<FormValidationResult> {}\n\nexport interface FormInstance {\n\tregister: (input: {\n\t\tid: number | string;\n\t\tvnode: VNode;\n\t\tvalidate: () => Promise<any[]>;\n\t\tresetValidation: () => Promise<void>;\n\t}) => void;\n\tunregister: (id: number | string) => void;\n\tupdate: (\n\t\tid: number | string,\n\t\tisError: boolean | undefined | null,\n\t\terrors: any[],\n\t) => void;\n\tinputs: Ref<FormInput[]>;\n\tisDisabled: ComputedRef<boolean>;\n\tisReadonly: ComputedRef<boolean>;\n\tisLoading: ComputedRef<boolean>;\n\tisValidating: Ref<boolean>;\n\tisValid: Ref<boolean | null>;\n\tvalidateOn: Ref<FormProps[\"validateOn\"]>;\n}\n\nexport const YUYEON_FORM_KEY: InjectionKey<FormInstance> =\n\tSymbol.for(\"yuyeon.form\");\n\nexport interface FormProps {\n\treadonly: boolean;\n\tdisabled: boolean;\n\tloading: boolean;\n\tmodelValue: boolean | null;\n\t\"onUpdate:modelValue\": EventProp<[boolean | null]> | undefined;\n\tvalidateOn: ValidationProps[\"validateOn\"];\n}\n\nexport const pressFormPropsOptions = propsFactory(\n\t{\n\t\treadonly: Boolean,\n\t\tdisabled: Boolean,\n\t\tloading: Boolean,\n\t\tmodelValue: {\n\t\t\ttype: Boolean as PropType<boolean | null>,\n\t\t\tdefault: null,\n\t\t},\n\t\tvalidateOn: {\n\t\t\ttype: String as PropType<ValidationProps[\"validateOn\"]>,\n\t\t\tdefault: \"input\",\n\t\t},\n\t},\n\t\"form\",\n);\n\nexport function createForm(props: FormProps) {\n\tconst model = useModelDuplex(props);\n\tconst isValidating = shallowRef(false);\n\tconst inputs = ref<FormInput[]>([]);\n\tconst errors = ref<InputValidationResult[]>([]);\n\n\tconst isReadonly = computed(() => props.readonly);\n\tconst isDisabled = computed(() => props.disabled);\n\tconst isLoading = computed(() => props.loading);\n\n\tasync function validate() {\n\t\tconst results: InputValidationResult[] = [];\n\t\tlet valid = true;\n\n\t\terrors.value = [];\n\t\tisValidating.value = true;\n\n\t\tfor (const item of inputs.value) {\n\t\t\tconst itemErrors = await item.validate();\n\n\t\t\tif (itemErrors.length > 0) {\n\t\t\t\tvalid = false;\n\n\t\t\t\tresults.push({\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tvnode: item.vnode,\n\t\t\t\t\texposed: item.vnode.component?.exposed,\n\t\t\t\t\terrors: itemErrors,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\terrors.value = results;\n\t\tisValidating.value = false;\n\n\t\treturn { valid, errors: errors.value };\n\t}\n\n\tfunction register(input: {\n\t\tid: number | string;\n\t\tvnode: VNode;\n\t\tvalidate: () => Promise<any[]>;\n\t}) {\n\t\tconst { id, validate, vnode } = input;\n\t\tinputs.value.push({\n\t\t\tid,\n\t\t\tvalidate,\n\t\t\tvnode,\n\t\t\tisError: null,\n\t\t\terrors: [],\n\t\t});\n\t}\n\n\tfunction unregister(id: number | string) {\n\t\tinputs.value = inputs.value.filter((input) => input.id !== id);\n\t}\n\n\tfunction update(\n\t\tid: number | string,\n\t\tisError: boolean | undefined | null,\n\t\terrors: any[],\n\t) {\n\t\tconst found = inputs.value.find((item) => item.id === id);\n\n\t\tif (!found) return;\n\n\t\tfound.isError = isError;\n\t\tfound.errors = errors;\n\t}\n\n\tconst provideInstance: FormInstance = {\n\t\tinputs,\n\t\tisDisabled,\n\t\tisReadonly,\n\t\tisLoading,\n\t\tisValid: model,\n\t\tisValidating,\n\t\tregister,\n\t\tunregister,\n\t\tupdate,\n\t\tvalidateOn: toRef(props, \"validateOn\"),\n\t};\n\n\tprovide(YUYEON_FORM_KEY, provideInstance);\n\n\treturn {\n\t\tinputs,\n\t\terrors,\n\t\tisValid: model,\n\t\tisDisabled,\n\t\tisReadonly,\n\t\tisLoading,\n\t\tisValidating,\n\t\tvalidate,\n\t};\n}\n\nexport function useForm() {\n\treturn inject(YUYEON_FORM_KEY, null);\n}\n"],"mappings":"AAAA,SAECA,QAAQ,EAERC,MAAM,EAENC,OAAO,EAEPC,GAAG,EACHC,UAAU,EACVC,KAAK,QAEC,KAAK;AAAC,SAEYC,YAAY;AAAA,SAE5BC,cAAc;AAiDvB,OAAO,MAAMC,eAA2C,GACvDC,MAAM,CAACC,GAAG,CAAC,aAAa,CAAC;AAW1B,OAAO,MAAMC,qBAAqB,GAAGL,YAAY,CAChD;EACCM,QAAQ,EAAEC,OAAO;EACjBC,QAAQ,EAAED,OAAO;EACjBE,OAAO,EAAEF,OAAO;EAChBG,UAAU,EAAE;IACXC,IAAI,EAAEJ,OAAmC;IACzCK,OAAO,EAAE;EACV,CAAC;EACDC,UAAU,EAAE;IACXF,IAAI,EAAEG,MAAiD;IACvDF,OAAO,EAAE;EACV;AACD,CAAC,EACD,MACD,CAAC;AAED,OAAO,SAASG,UAAUA,CAACC,KAAgB,EAAE;EAC5C,MAAMC,KAAK,GAAGhB,cAAc,CAACe,KAAK,CAAC;EACnC,MAAME,YAAY,GAAGpB,UAAU,CAAC,KAAK,CAAC;EACtC,MAAMqB,MAAM,GAAGtB,GAAG,CAAc,EAAE,CAAC;EACnC,MAAMuB,MAAM,GAAGvB,GAAG,CAA0B,EAAE,CAAC;EAE/C,MAAMwB,UAAU,GAAG3B,QAAQ,CAAC,MAAMsB,KAAK,CAACV,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AM,CAACQ,KAAK,CAACa,MAAM,CAAEH,KAAK,IAAKA,KAAK,CAACL,EAAE,KAAKA,EAAE,CAAC;EAC/D;EAEA,SAASS,MAAMA,CACdT,EAAmB,EACnBM,OAAmC,EACnClB,MAAa,EACZ;IACD,MAAMsB,KAAK,GAAGvB,MAAM,CAACQ,KAAK,CAACgB,IAAI,CAAEf,IAAI,IAAKA,IAAI,CAACI,EAAE,KAAKA,EAAE,CAAC;IAEzD,IAAI,CAACU,KAAK,EAAE;IAEZA,KAAK,CAACJ,OAAO,GAAGA,OAAO;IACvBI,KAAK,CAACtB,MAAM,GAAGA,MAAM;EACtB;EAEA,MAAMwB,eAA6B,GAAG;IACrCzB,MAAM;IACNG,UAAU;IACVD,UAAU;IACVE,SAAS;IACTsB,OAAO,EAAE5B,KAAK;IACdC,YAAY;IACZkB,QAAQ;IACRG,UAAU;IACVE,MAAM;IACN5B,UAAU,EAAEd,KAAK,CAACiB,KAAK,EAAE,YAAY;EACtC,CAAC;EAEDpB,OAAO,CAACM,eAAe,EAAE0C,eAAe,CAAC;EAEzC,OAAO;IACNzB,MAAM;IACNC,MAAM;IACNyB,OAAO,EAAE5B,KAAK;IACdK,UAAU;IACVD,UAAU;IACVE,SAAS;IACTL,YAAY;IACZM;EACD,CAAC;AACF;AAEA,OAAO,SAASsB,OAAOA,CAAA,EAAG;EACzB,OAAOnD,MAAM,CAACO,eAAe,EAAE,IAAI,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"file":"form.js","names":["computed","inject","provide","ref","shallowRef","toRef","propsFactory","useModelDuplex","YUYEON_FORM_KEY","Symbol","for","pressFormPropsOptions","readonly","Boolean","disabled","loading","modelValue","type","default","validateOn","String","createForm","props","model","isValidating","inputs","errors","isReadonly","isDisabled","isLoading","validate","results","valid","value","item","itemErrors","length","push","id","vnode","exposed","component","register","input","isError","unregister","filter","update","found","find","provideInstance","isValid","useForm"],"sources":["../../src/composables/form.ts"],"sourcesContent":["import {\r\n\ttype ComputedRef,\r\n\tcomputed,\r\n\ttype InjectionKey,\r\n\tinject,\r\n\ttype PropType,\r\n\tprovide,\r\n\ttype Ref,\r\n\tref,\r\n\tshallowRef,\r\n\ttoRef,\r\n\ttype VNode,\r\n} from \"vue\";\r\n\r\nimport { type EventProp, propsFactory } from \"@/util/component\";\r\n\r\nimport { useModelDuplex } from \"./communication\";\r\nimport type { ValidationProps } from \"./validation\";\r\n\r\nexport interface FormInput {\r\n\tid: number | string;\r\n\tvnode: VNode;\r\n\tvalidate: () => Promise<any[]>;\r\n\tisError: boolean | undefined | null;\r\n\terrors: any[];\r\n}\r\n\r\nexport interface InputValidationResult {\r\n\tid: number | string;\r\n\tvnode: VNode;\r\n\texposed: any;\r\n\terrors: any[];\r\n}\r\n\r\nexport interface FormValidationResult {\r\n\tvalid: boolean;\r\n\terrors: InputValidationResult[];\r\n}\r\n\r\nexport interface SubmitEventPromise\r\n\textends SubmitEvent,\r\n\t\tPromise<FormValidationResult> {}\r\n\r\nexport interface FormInstance {\r\n\tregister: (input: {\r\n\t\tid: number | string;\r\n\t\tvnode: VNode;\r\n\t\tvalidate: () => Promise<any[]>;\r\n\t\tresetValidation: () => Promise<void>;\r\n\t}) => void;\r\n\tunregister: (id: number | string) => void;\r\n\tupdate: (\r\n\t\tid: number | string,\r\n\t\tisError: boolean | undefined | null,\r\n\t\terrors: any[],\r\n\t) => void;\r\n\tinputs: Ref<FormInput[]>;\r\n\tisDisabled: ComputedRef<boolean>;\r\n\tisReadonly: ComputedRef<boolean>;\r\n\tisLoading: ComputedRef<boolean>;\r\n\tisValidating: Ref<boolean>;\r\n\tisValid: Ref<boolean | null>;\r\n\tvalidateOn: Ref<FormProps[\"validateOn\"]>;\r\n}\r\n\r\nexport const YUYEON_FORM_KEY: InjectionKey<FormInstance> =\r\n\tSymbol.for(\"yuyeon.form\");\r\n\r\nexport interface FormProps {\r\n\treadonly: boolean;\r\n\tdisabled: boolean;\r\n\tloading: boolean;\r\n\tmodelValue: boolean | null;\r\n\t\"onUpdate:modelValue\": EventProp<[boolean | null]> | undefined;\r\n\tvalidateOn: ValidationProps[\"validateOn\"];\r\n}\r\n\r\nexport const pressFormPropsOptions = propsFactory(\r\n\t{\r\n\t\treadonly: Boolean,\r\n\t\tdisabled: Boolean,\r\n\t\tloading: Boolean,\r\n\t\tmodelValue: {\r\n\t\t\ttype: Boolean as PropType<boolean | null>,\r\n\t\t\tdefault: null,\r\n\t\t},\r\n\t\tvalidateOn: {\r\n\t\t\ttype: String as PropType<ValidationProps[\"validateOn\"]>,\r\n\t\t\tdefault: \"input\",\r\n\t\t},\r\n\t},\r\n\t\"form\",\r\n);\r\n\r\nexport function createForm(props: FormProps) {\r\n\tconst model = useModelDuplex(props);\r\n\tconst isValidating = shallowRef(false);\r\n\tconst inputs = ref<FormInput[]>([]);\r\n\tconst errors = ref<InputValidationResult[]>([]);\r\n\r\n\tconst isReadonly = computed(() => props.readonly);\r\n\tconst isDisabled = computed(() => props.disabled);\r\n\tconst isLoading = computed(() => props.loading);\r\n\r\n\tasync function validate() {\r\n\t\tconst results: InputValidationResult[] = [];\r\n\t\tlet valid = true;\r\n\r\n\t\terrors.value = [];\r\n\t\tisValidating.value = true;\r\n\r\n\t\tfor (const item of inputs.value) {\r\n\t\t\tconst itemErrors = await item.validate();\r\n\r\n\t\t\tif (itemErrors.length > 0) {\r\n\t\t\t\tvalid = false;\r\n\r\n\t\t\t\tresults.push({\r\n\t\t\t\t\tid: item.id,\r\n\t\t\t\t\tvnode: item.vnode,\r\n\t\t\t\t\texposed: item.vnode.component?.exposed,\r\n\t\t\t\t\terrors: itemErrors,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\terrors.value = results;\r\n\t\tisValidating.value = false;\r\n\r\n\t\treturn { valid, errors: errors.value };\r\n\t}\r\n\r\n\tfunction register(input: {\r\n\t\tid: number | string;\r\n\t\tvnode: VNode;\r\n\t\tvalidate: () => Promise<any[]>;\r\n\t}) {\r\n\t\tconst { id, validate, vnode } = input;\r\n\t\tinputs.value.push({\r\n\t\t\tid,\r\n\t\t\tvalidate,\r\n\t\t\tvnode,\r\n\t\t\tisError: null,\r\n\t\t\terrors: [],\r\n\t\t});\r\n\t}\r\n\r\n\tfunction unregister(id: number | string) {\r\n\t\tinputs.value = inputs.value.filter((input) => input.id !== id);\r\n\t}\r\n\r\n\tfunction update(\r\n\t\tid: number | string,\r\n\t\tisError: boolean | undefined | null,\r\n\t\terrors: any[],\r\n\t) {\r\n\t\tconst found = inputs.value.find((item) => item.id === id);\r\n\r\n\t\tif (!found) return;\r\n\r\n\t\tfound.isError = isError;\r\n\t\tfound.errors = errors;\r\n\t}\r\n\r\n\tconst provideInstance: FormInstance = {\r\n\t\tinputs,\r\n\t\tisDisabled,\r\n\t\tisReadonly,\r\n\t\tisLoading,\r\n\t\tisValid: model,\r\n\t\tisValidating,\r\n\t\tregister,\r\n\t\tunregister,\r\n\t\tupdate,\r\n\t\tvalidateOn: toRef(props, \"validateOn\"),\r\n\t};\r\n\r\n\tprovide(YUYEON_FORM_KEY, provideInstance);\r\n\r\n\treturn {\r\n\t\tinputs,\r\n\t\terrors,\r\n\t\tisValid: model,\r\n\t\tisDisabled,\r\n\t\tisReadonly,\r\n\t\tisLoading,\r\n\t\tisValidating,\r\n\t\tvalidate,\r\n\t};\r\n}\r\n\r\nexport function useForm() {\r\n\treturn inject(YUYEON_FORM_KEY, null);\r\n}\r\n"],"mappings":"AAAA,SAECA,QAAQ,EAERC,MAAM,EAENC,OAAO,EAEPC,GAAG,EACHC,UAAU,EACVC,KAAK,QAEC,KAAK;AAAC,SAEYC,YAAY;AAAA,SAE5BC,cAAc;AAiDvB,OAAO,MAAMC,eAA2C,GACvDC,MAAM,CAACC,GAAG,CAAC,aAAa,CAAC;AAW1B,OAAO,MAAMC,qBAAqB,GAAGL,YAAY,CAChD;EACCM,QAAQ,EAAEC,OAAO;EACjBC,QAAQ,EAAED,OAAO;EACjBE,OAAO,EAAEF,OAAO;EAChBG,UAAU,E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,SAAS;IACTL,YAAY;IACZM;EACD,CAAC;AACF;AAEA,OAAO,SAASsB,OAAOA,CAAA,EAAG;EACzB,OAAOnD,MAAM,CAACO,eAAe,EAAE,IAAI,CAAC;AACrC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"style-color.js","names":["computed","colorRgb","isColorValue","propsFactory","styleColorPropsOptions","color","String","background","backgroundOpacity","type","Number","pressColorPropsOptions","useStyleColor","props","name","colorVars","startsWith"],"sources":["../../src/composables/style-color.ts"],"sourcesContent":["import { computed, type ExtractPropTypes } from \"vue\";\n\nimport { colorRgb, isColorValue } from \"@/util/color\";\nimport { propsFactory } from \"@/util/component/props\";\n\nexport const styleColorPropsOptions = {\n\tcolor: String,\n\tbackground: String,\n\tbackgroundOpacity: {\n\t\ttype: Number,\n\t},\n};\n\nexport const pressColorPropsOptions = propsFactory(styleColorPropsOptions, 'style-color');\n\nexport function useStyleColor(\n\tprops: ExtractPropTypes<typeof styleColorPropsOptions>,\n\tname: string,\n) {\n\tconst colorVars = computed(() => {\n\t\tlet { color, background } = props;\n\t\tif (!background) background = color;\n\n\t\tif (color && !isColorValue(color)) {\n\t\t\tcolor = `var(--y-theme-${color})`;\n\t\t}\n\n\t\tif (background) {\n\t\t\tif (isColorValue(background)) {\n\t\t\t\tbackground = `rgba(${colorRgb(background)}, ${props.backgroundOpacity})`;\n\t\t\t} else if (!background.startsWith(\"var(\")) {\n\t\t\t\tbackground = `rgba(${`var(--y-theme-${background}-rgb)`}, ${props.backgroundOpacity})`;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t[`--y-${name}__color`]: color,\n\t\t\t[`--y-${name}__background`]: background,\n\t\t};\n\t});\n\n\treturn {\n\t\tcolorVars,\n\t};\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAA+B,KAAK;AAAC,SAE7CC,QAAQ,EAAEC,YAAY;AAAA,SACtBC,YAAY;AAErB,OAAO,MAAMC,sBAAsB,GAAG;EACrCC,KAAK,EAAEC,MAAM;EACbC,UAAU,EAAED,MAAM;EAClBE,iBAAiB,EAAE;IAClBC,IAAI,EAAEC;EACP;AACD,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAGR,YAAY,CAACC,sBAAsB,EAAE,aAAa,CAAC;AAEzF,OAAO,SAASQ,aAAaA,CAC5BC,KAAsD,EACtDC,IAAY,EACX;EACD,MAAMC,SAAS,GAAGf,QAAQ,CAAC,MAAM;IAChC,IAAI;MAAEK,KAAK;MAAEE;IAAW,CAAC,GAAGM,KAAK;IACjC,IAAI,CAACN,UAAU,EAAEA,UAAU,GAAGF,KAAK;IAEnC,IAAIA,KAAK,IAAI,CAACH,YAAY,CAACG,KAAK,CAAC,EAAE;MAClCA,KAAK,GAAG,iBAAiBA,KAAK,GAAG;IAClC;IAEA,IAAIE,UAAU,EAAE;MACf,IAAIL,YAAY,CAACK,UAAU,CAAC,EAAE;QAC7BA,UAAU,GAAG,QAAQN,QAAQ,CAACM,UAAU,CAAC,KAAKM,KAAK,CAACL,iBAAiB,GAAG;MACzE,CAAC,MAAM,IAAI,CAACD,UAAU,CAACS,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1CT,UAAU,GAAG,QAAQ,iBAAiBA,UAAU,OAAO,KAAKM,KAAK,CAACL,iBAAiB,GAAG;MACvF;IACD;IAEA,OAAO;MACN,CAAC,OAAOM,IAAI,SAAS,GAAGT,KAAK;MAC7B,CAAC,OAAOS,IAAI,cAAc,GAAGP;IAC9B,CAAC;EACF,CAAC,CAAC;EAEF,OAAO;IACNQ;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"style-color.js","names":["computed","colorRgb","isColorValue","propsFactory","styleColorPropsOptions","color","String","background","backgroundOpacity","type","Number","pressColorPropsOptions","useStyleColor","props","name","colorVars","startsWith"],"sources":["../../src/composables/style-color.ts"],"sourcesContent":["import { computed, type ExtractPropTypes } from \"vue\";\r\n\r\nimport { colorRgb, isColorValue } from \"@/util/color\";\r\nimport { propsFactory } from \"@/util/component/props\";\r\n\r\nexport const styleColorPropsOptions = {\r\n\tcolor: String,\r\n\tbackground: String,\r\n\tbackgroundOpacity: {\r\n\t\ttype: Number,\r\n\t},\r\n};\r\n\r\nexport const pressColorPropsOptions = propsFactory(styleColorPropsOptions, 'style-color');\r\n\r\nexport function useStyleColor(\r\n\tprops: ExtractPropTypes<typeof styleColorPropsOptions>,\r\n\tname: string,\r\n) {\r\n\tconst colorVars = computed(() => {\r\n\t\tlet { color, background } = props;\r\n\t\tif (!background) background = color;\r\n\r\n\t\tif (color && !isColorValue(color)) {\r\n\t\t\tcolor = `var(--y-theme-${color})`;\r\n\t\t}\r\n\r\n\t\tif (background) {\r\n\t\t\tif (isColorValue(background)) {\r\n\t\t\t\tbackground = `rgba(${colorRgb(background)}, ${props.backgroundOpacity})`;\r\n\t\t\t} else if (!background.startsWith(\"var(\")) {\r\n\t\t\t\tbackground = `rgba(${`var(--y-theme-${background}-rgb)`}, ${props.backgroundOpacity})`;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\t[`--y-${name}__color`]: color,\r\n\t\t\t[`--y-${name}__background`]: background,\r\n\t\t};\r\n\t});\r\n\r\n\treturn {\r\n\t\tcolorVars,\r\n\t};\r\n}\r\n"],"mappings":"AAAA,SAASA,QAAQ,QAA+B,KAAK;AAAC,SAE7CC,QAAQ,EAAEC,YAAY;AAAA,SACtBC,YAAY;AAErB,OAAO,MAAMC,sBAAsB,GAAG;EACrCC,KAAK,EAAEC,MAAM;EACbC,UAAU,EAAED,MAAM;EAClBE,iBAAiB,EAAE;IAClBC,IAAI,EAAEC;EACP;AACD,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAGR,YAAY,CAACC,sBAAsB,EAAE,aAAa,CAAC;AAEzF,OAAO,SAASQ,aAAaA,CAC5BC,KAAsD,EACtDC,IAAY,EACX;EACD,MAAMC,SAAS,GAAGf,QAAQ,CAAC,MAAM;IAChC,IAAI;MAAEK,KAAK;MAAEE;IAAW,CA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