yuyeon 0.3.3 → 0.3.4-beta.13

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 (687) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/yuyeon.js +3109 -3082
  3. package/dist/yuyeon.umd.cjs +3 -3
  4. package/lib/abstract/items.js.map +1 -1
  5. package/lib/components/alert/YAlert.js +3 -4
  6. package/lib/components/alert/YAlert.js.map +1 -1
  7. package/lib/components/alert/index.js.map +1 -1
  8. package/lib/components/app/YApp.js +2 -2
  9. package/lib/components/app/YApp.js.map +1 -1
  10. package/lib/components/app/index.js.map +1 -1
  11. package/lib/components/badge/YBadge.js +3 -3
  12. package/lib/components/badge/YBadge.js.map +1 -1
  13. package/lib/components/badge/YBadge.scss +3 -2
  14. package/lib/components/badge/index.js.map +1 -1
  15. package/lib/components/bench/YBench.js +3 -4
  16. package/lib/components/bench/YBench.js.map +1 -1
  17. package/lib/components/bench/index.js.map +1 -1
  18. package/lib/components/button/YButton.js +1 -2
  19. package/lib/components/button/YButton.js.map +1 -1
  20. package/lib/components/button/index.js.map +1 -1
  21. package/lib/components/card/YCard.js.map +1 -1
  22. package/lib/components/card/YCard.scss +2 -2
  23. package/lib/components/card/YCardBody.js.map +1 -1
  24. package/lib/components/card/YCardFooter.js.map +1 -1
  25. package/lib/components/card/YCardHeader.js.map +1 -1
  26. package/lib/components/card/index.js.map +1 -1
  27. package/lib/components/checkbox/YCheckbox.js +1 -2
  28. package/lib/components/checkbox/YCheckbox.js.map +1 -1
  29. package/lib/components/checkbox/YInputCheckbox.js +1 -2
  30. package/lib/components/checkbox/YInputCheckbox.js.map +1 -1
  31. package/lib/components/checkbox/index.js.map +1 -1
  32. package/lib/components/chip/YChip.js +1 -2
  33. package/lib/components/chip/YChip.js.map +1 -1
  34. package/lib/components/chip/index.js.map +1 -1
  35. package/lib/components/date-picker/YDateCalendar.js +55 -53
  36. package/lib/components/date-picker/YDateCalendar.js.map +1 -1
  37. package/lib/components/date-picker/YDatePicker.js +24 -25
  38. package/lib/components/date-picker/YDatePicker.js.map +1 -1
  39. package/lib/components/date-picker/YDatePickerControl.js +19 -20
  40. package/lib/components/date-picker/YDatePickerControl.js.map +1 -1
  41. package/lib/components/date-picker/YMonthPicker.js +10 -11
  42. package/lib/components/date-picker/YMonthPicker.js.map +1 -1
  43. package/lib/components/date-picker/YYearPicker.js +11 -13
  44. package/lib/components/date-picker/YYearPicker.js.map +1 -1
  45. package/lib/components/date-picker/index.js.map +1 -1
  46. package/lib/components/default-provider/YDefaultProvider.js.map +1 -1
  47. package/lib/components/default-provider/index.js.map +1 -1
  48. package/lib/components/dialog/YDialog.js +32 -32
  49. package/lib/components/dialog/YDialog.js.map +1 -1
  50. package/lib/components/dialog/index.js.map +1 -1
  51. package/lib/components/divider/YDivider.js +5 -5
  52. package/lib/components/divider/YDivider.js.map +1 -1
  53. package/lib/components/divider/index.js.map +1 -1
  54. package/lib/components/draggable/YDraggable.js +10 -11
  55. package/lib/components/draggable/YDraggable.js.map +1 -1
  56. package/lib/components/draggable/index.js +2 -0
  57. package/lib/components/draggable/index.js.map +1 -0
  58. package/lib/components/dropdown/YDropdown.js +16 -17
  59. package/lib/components/dropdown/YDropdown.js.map +1 -1
  60. package/lib/components/dropdown/index.js.map +1 -1
  61. package/lib/components/field-input/YFieldInput.js +42 -40
  62. package/lib/components/field-input/YFieldInput.js.map +1 -1
  63. package/lib/components/field-input/index.js.map +1 -1
  64. package/lib/components/form/YForm.js +12 -14
  65. package/lib/components/form/YForm.js.map +1 -1
  66. package/lib/components/form/index.js.map +1 -1
  67. package/lib/components/hover/YHover.js +9 -8
  68. package/lib/components/hover/YHover.js.map +1 -1
  69. package/lib/components/hover/index.js.map +1 -1
  70. package/lib/components/icon/YIcon.js +2 -4
  71. package/lib/components/icon/YIcon.js.map +1 -1
  72. package/lib/components/icon/index.js.map +1 -1
  73. package/lib/components/icons/YIconCheckbox.js +7 -6
  74. package/lib/components/icons/YIconCheckbox.js.map +1 -1
  75. package/lib/components/icons/YIconClear.js +2 -1
  76. package/lib/components/icons/YIconClear.js.map +1 -1
  77. package/lib/components/icons/YIconDropdown.js +2 -1
  78. package/lib/components/icons/YIconDropdown.js.map +1 -1
  79. package/lib/components/icons/YIconExpand.js +1 -0
  80. package/lib/components/icons/YIconExpand.js.map +1 -1
  81. package/lib/components/icons/YIconPageControl.js +7 -6
  82. package/lib/components/icons/YIconPageControl.js.map +1 -1
  83. package/lib/components/icons/YIconSort.js +6 -5
  84. package/lib/components/icons/YIconSort.js.map +1 -1
  85. package/lib/components/icons/YIconSort.scss +2 -0
  86. package/lib/components/icons/index.js.map +1 -1
  87. package/lib/components/img/YImg.js +30 -31
  88. package/lib/components/img/YImg.js.map +1 -1
  89. package/lib/components/img/index.js.map +1 -1
  90. package/lib/components/index.js.map +1 -1
  91. package/lib/components/input/YInput.js +1 -2
  92. package/lib/components/input/YInput.js.map +1 -1
  93. package/lib/components/input/YInput.scss +10 -9
  94. package/lib/components/input/index.js.map +1 -1
  95. package/lib/components/ip-field/YIpv4Field.js +1 -2
  96. package/lib/components/ip-field/YIpv4Field.js.map +1 -1
  97. package/lib/components/ip-field/index.js.map +1 -1
  98. package/lib/components/layer/YLayer.js +4 -3
  99. package/lib/components/layer/YLayer.js.map +1 -1
  100. package/lib/components/layer/active-delay.js.map +1 -1
  101. package/lib/components/layer/active-stack.js.map +1 -1
  102. package/lib/components/layer/base.js.map +1 -1
  103. package/lib/components/layer/content.js.map +1 -1
  104. package/lib/components/layer/index.js.map +1 -1
  105. package/lib/components/layer/scroll-strategies.js.map +1 -1
  106. package/lib/components/list/YList.js +1 -2
  107. package/lib/components/list/YList.js.map +1 -1
  108. package/lib/components/list/YListItem.js +1 -2
  109. package/lib/components/list/YListItem.js.map +1 -1
  110. package/lib/components/list/index.js.map +1 -1
  111. package/lib/components/loading/YSpinnerRing.js.map +1 -1
  112. package/lib/components/loading/index.js.map +1 -1
  113. package/lib/components/menu/YMenu.js +5 -8
  114. package/lib/components/menu/YMenu.js.map +1 -1
  115. package/lib/components/menu/YMenu.scss +3 -4
  116. package/lib/components/menu/index.js.map +1 -1
  117. package/lib/components/navigation/YNavigation.js +1 -2
  118. package/lib/components/navigation/YNavigation.js.map +1 -1
  119. package/lib/components/navigation/index.js.map +1 -1
  120. package/lib/components/pagination/YPagination.js +1 -2
  121. package/lib/components/pagination/YPagination.js.map +1 -1
  122. package/lib/components/pagination/index.js.map +1 -1
  123. package/lib/components/panel/YDividePanel.js +1 -2
  124. package/lib/components/panel/YDividePanel.js.map +1 -1
  125. package/lib/components/panel/YDividePanel.scss +1 -0
  126. package/lib/components/panel/index.js.map +1 -1
  127. package/lib/components/plate/YPlate.js +3 -4
  128. package/lib/components/plate/YPlate.js.map +1 -1
  129. package/lib/components/plate/index.js.map +1 -1
  130. package/lib/components/progress-bar/YProgressBar.js +1 -2
  131. package/lib/components/progress-bar/YProgressBar.js.map +1 -1
  132. package/lib/components/progress-bar/index.js.map +1 -1
  133. package/lib/components/progress-ring/YProgressRing.js +3 -4
  134. package/lib/components/progress-ring/YProgressRing.js.map +1 -1
  135. package/lib/components/progress-ring/index.js.map +1 -1
  136. package/lib/components/radio/YRadio.js +58 -0
  137. package/lib/components/radio/YRadio.js.map +1 -0
  138. package/lib/components/radio/YRadio.scss +38 -0
  139. package/lib/components/radio/YRadioIcon.js +33 -0
  140. package/lib/components/radio/YRadioIcon.js.map +1 -0
  141. package/lib/components/radio/YRadioIcon.scss +43 -0
  142. package/lib/components/radio/index.js +3 -0
  143. package/lib/components/radio/index.js.map +1 -0
  144. package/lib/components/select/YSelect.js +41 -43
  145. package/lib/components/select/YSelect.js.map +1 -1
  146. package/lib/components/select/index.js.map +1 -1
  147. package/lib/components/slider/YSlider.js.map +1 -1
  148. package/lib/components/slider/index.js.map +1 -1
  149. package/lib/components/slider/slider.js.map +1 -1
  150. package/lib/components/snackbar/YSnackbar.js +6 -6
  151. package/lib/components/snackbar/YSnackbar.js.map +1 -1
  152. package/lib/components/snackbar/index.js.map +1 -1
  153. package/lib/components/switch/YSwitch.js +1 -2
  154. package/lib/components/switch/YSwitch.js.map +1 -1
  155. package/lib/components/switch/index.js.map +1 -1
  156. package/lib/components/tab/YTab.js +2 -3
  157. package/lib/components/tab/YTab.js.map +1 -1
  158. package/lib/components/tab/YTab.scss +1 -1
  159. package/lib/components/tab/YTabs.js +1 -2
  160. package/lib/components/tab/YTabs.js.map +1 -1
  161. package/lib/components/tab/index.js.map +1 -1
  162. package/lib/components/tab/shared.js.map +1 -1
  163. package/lib/components/tab/types.js.map +1 -1
  164. package/lib/components/table/YDataTable.js +8 -6
  165. package/lib/components/table/YDataTable.js.map +1 -1
  166. package/lib/components/table/YDataTableBody.js +2 -3
  167. package/lib/components/table/YDataTableBody.js.map +1 -1
  168. package/lib/components/table/YDataTableCell.js +1 -2
  169. package/lib/components/table/YDataTableCell.js.map +1 -1
  170. package/lib/components/table/YDataTableControl.js +8 -6
  171. package/lib/components/table/YDataTableControl.js.map +1 -1
  172. package/lib/components/table/YDataTableControl.scss +10 -0
  173. package/lib/components/table/YDataTableHead.js +1 -1
  174. package/lib/components/table/YDataTableHead.js.map +1 -1
  175. package/lib/components/table/YDataTableLayer.js +1 -2
  176. package/lib/components/table/YDataTableLayer.js.map +1 -1
  177. package/lib/components/table/YDataTableLayerRow.js +1 -2
  178. package/lib/components/table/YDataTableLayerRow.js.map +1 -1
  179. package/lib/components/table/YDataTableLayerRows.js +1 -2
  180. package/lib/components/table/YDataTableLayerRows.js.map +1 -1
  181. package/lib/components/table/YDataTableRow.js +1 -2
  182. package/lib/components/table/YDataTableRow.js.map +1 -1
  183. package/lib/components/table/YDataTableServer.js +8 -6
  184. package/lib/components/table/YDataTableServer.js.map +1 -1
  185. package/lib/components/table/YTable.js +1 -2
  186. package/lib/components/table/YTable.js.map +1 -1
  187. package/lib/components/table/composables/expand.js.map +1 -1
  188. package/lib/components/table/composables/header.js.map +1 -1
  189. package/lib/components/table/composables/items.js.map +1 -1
  190. package/lib/components/table/composables/measure.js +1 -1
  191. package/lib/components/table/composables/measure.js.map +1 -1
  192. package/lib/components/table/composables/options.js.map +1 -1
  193. package/lib/components/table/composables/pagination.js.map +1 -1
  194. package/lib/components/table/composables/provides.js.map +1 -1
  195. package/lib/components/table/composables/selection.js.map +1 -1
  196. package/lib/components/table/composables/sorted-items.js.map +1 -1
  197. package/lib/components/table/composables/sorting.js.map +1 -1
  198. package/lib/components/table/index.js.map +1 -1
  199. package/lib/components/table/types/common.js.map +1 -1
  200. package/lib/components/table/types/header.js.map +1 -1
  201. package/lib/components/table/types/index.js.map +1 -1
  202. package/lib/components/table/types/item.js.map +1 -1
  203. package/lib/components/table/types/row.js.map +1 -1
  204. package/lib/components/text-ellipsis/YTextEllipsis.js +1 -2
  205. package/lib/components/text-ellipsis/YTextEllipsis.js.map +1 -1
  206. package/lib/components/text-ellipsis/index.js.map +1 -1
  207. package/lib/components/text-highlighter/YTextHighlighter.js +2 -1
  208. package/lib/components/text-highlighter/YTextHighlighter.js.map +1 -1
  209. package/lib/components/text-highlighter/index.js.map +1 -1
  210. package/lib/components/text-interpolation/YTi.js +2 -2
  211. package/lib/components/text-interpolation/YTi.js.map +1 -1
  212. package/lib/components/text-interpolation/index.js.map +1 -1
  213. package/lib/components/textarea/YTextarea.js +1 -2
  214. package/lib/components/textarea/YTextarea.js.map +1 -1
  215. package/lib/components/textarea/index.js.map +1 -1
  216. package/lib/components/toggle-button/YToggleButton.js.map +1 -1
  217. package/lib/components/toggle-button/index.js.map +1 -1
  218. package/lib/components/tooltip/YTooltip.js +1 -2
  219. package/lib/components/tooltip/YTooltip.js.map +1 -1
  220. package/lib/components/tooltip/index.js.map +1 -1
  221. package/lib/components/transitions/expand-transition.js.map +1 -1
  222. package/lib/components/transitions/index.js.map +1 -1
  223. package/lib/components/tree-view/YTreeView.js +1 -2
  224. package/lib/components/tree-view/YTreeView.js.map +1 -1
  225. package/lib/components/tree-view/YTreeViewNode.js +7 -4
  226. package/lib/components/tree-view/YTreeViewNode.js.map +1 -1
  227. package/lib/components/tree-view/index.js.map +1 -1
  228. package/lib/components/tree-view/tree-view.js.map +1 -1
  229. package/lib/components/tree-view/types.js.map +1 -1
  230. package/lib/components/tree-view/util.js.map +1 -1
  231. package/lib/composables/choice-link.js.map +1 -1
  232. package/lib/composables/choice.js.map +1 -1
  233. package/lib/composables/communication.js.map +1 -1
  234. package/lib/composables/component.js.map +1 -1
  235. package/lib/composables/coordinate/arrangement.js.map +1 -1
  236. package/lib/composables/coordinate/index.js.map +1 -1
  237. package/lib/composables/coordinate/levitation.js +2 -2
  238. package/lib/composables/coordinate/levitation.js.map +1 -1
  239. package/lib/composables/coordinate/types.js.map +1 -1
  240. package/lib/composables/coordinate/utils/point.js.map +1 -1
  241. package/lib/composables/date/factory.js.map +1 -1
  242. package/lib/composables/date/index.js.map +1 -1
  243. package/lib/composables/date/setting.js.map +1 -1
  244. package/lib/composables/date/types.js.map +1 -1
  245. package/lib/composables/defaults/index.js.map +1 -1
  246. package/lib/composables/defaults/share.js.map +1 -1
  247. package/lib/composables/defaults/types.js.map +1 -1
  248. package/lib/composables/dimension.js.map +1 -1
  249. package/lib/composables/focus.js.map +1 -1
  250. package/lib/composables/form.js +5 -5
  251. package/lib/composables/form.js.map +1 -1
  252. package/lib/composables/i18n/index.js.map +1 -1
  253. package/lib/composables/i18n/locale.js.map +1 -1
  254. package/lib/composables/i18n/rtl.js.map +1 -1
  255. package/lib/composables/i18n/share.js.map +1 -1
  256. package/lib/composables/icon.js +1 -2
  257. package/lib/composables/icon.js.map +1 -1
  258. package/lib/composables/index.js.map +1 -1
  259. package/lib/composables/layer-group.js.map +1 -1
  260. package/lib/composables/layout.js.map +1 -1
  261. package/lib/composables/list-items.js.map +1 -1
  262. package/lib/composables/progress.js.map +1 -1
  263. package/lib/composables/ref.js.map +1 -1
  264. package/lib/composables/resize-observer.js.map +1 -1
  265. package/lib/composables/scope.js.map +1 -1
  266. package/lib/composables/style-color.js +1 -2
  267. package/lib/composables/style-color.js.map +1 -1
  268. package/lib/composables/theme/factory.js.map +1 -1
  269. package/lib/composables/theme/helper.js.map +1 -1
  270. package/lib/composables/theme/index.js +8 -1
  271. package/lib/composables/theme/index.js.map +1 -1
  272. package/lib/composables/theme/setting.js.map +1 -1
  273. package/lib/composables/theme/types.js.map +1 -1
  274. package/lib/composables/timing.js.map +1 -1
  275. package/lib/composables/transition.js.map +1 -1
  276. package/lib/composables/validation.js +7 -4
  277. package/lib/composables/validation.js.map +1 -1
  278. package/lib/composables/vue-router.js.map +1 -1
  279. package/lib/directives/complement-click/index.js.map +1 -1
  280. package/lib/directives/index.js +3 -0
  281. package/lib/directives/index.js.map +1 -0
  282. package/lib/directives/plate-wave/index.js +2 -2
  283. package/lib/directives/plate-wave/index.js.map +1 -1
  284. package/lib/directives/plate-wave/plate-wave.scss +17 -6
  285. package/lib/directives/theme-class/index.js +24 -0
  286. package/lib/directives/theme-class/index.js.map +1 -0
  287. package/lib/etc/index.js.map +1 -1
  288. package/lib/i18n/built-in.js.map +1 -1
  289. package/lib/i18n/config.js.map +1 -1
  290. package/lib/i18n/types.js.map +1 -1
  291. package/lib/index.js +3 -3
  292. package/lib/index.js.map +1 -1
  293. package/lib/locales/en.js.map +1 -1
  294. package/lib/locales/index.js.map +1 -1
  295. package/lib/locales/ko.js.map +1 -1
  296. package/lib/mixins/di.js.map +1 -1
  297. package/lib/mixins/rebind-attrs.js +0 -2
  298. package/lib/mixins/rebind-attrs.js.map +1 -1
  299. package/lib/styles/_elevation.scss +0 -1
  300. package/lib/styles/base.scss +3 -1
  301. package/lib/styles/settings/_elevation.scss +12 -12
  302. package/lib/styles/settings/_provided.scss +23 -23
  303. package/lib/styles/theme/dark.scss +3 -3
  304. package/lib/styles/theme/index.scss +0 -1
  305. package/lib/styles/theme/light.scss +3 -3
  306. package/lib/styles/util/_mixin.scss +16 -16
  307. package/lib/types/index.js.map +1 -1
  308. package/lib/util/anchor.js.map +1 -1
  309. package/lib/util/array.js.map +1 -1
  310. package/lib/util/collection.js.map +1 -1
  311. package/lib/util/color/apca.js +1 -0
  312. package/lib/util/color/apca.js.map +1 -1
  313. package/lib/util/color/const.js.map +1 -1
  314. package/lib/util/color/contrast/contrast.js.map +1 -1
  315. package/lib/util/color/conversion.js.map +1 -1
  316. package/lib/util/color/hct/cam16.js.map +1 -1
  317. package/lib/util/color/hct/hct-solver.js +6 -6
  318. package/lib/util/color/hct/hct-solver.js.map +1 -1
  319. package/lib/util/color/hct/hct.js.map +1 -1
  320. package/lib/util/color/hct/viewing-conditions.js +6 -4
  321. package/lib/util/color/hct/viewing-conditions.js.map +1 -1
  322. package/lib/util/color/index.js +13 -13
  323. package/lib/util/color/index.js.map +1 -1
  324. package/lib/util/color/palettes/core-palette.js.map +1 -1
  325. package/lib/util/color/palettes/tonal-palette.js +3 -3
  326. package/lib/util/color/palettes/tonal-palette.js.map +1 -1
  327. package/lib/util/color/types.js.map +1 -1
  328. package/lib/util/color/utils/math-utils.js +62 -62
  329. package/lib/util/color/utils/math-utils.js.map +1 -1
  330. package/lib/util/common.js +28 -13
  331. package/lib/util/common.js.map +1 -1
  332. package/lib/util/component/component.js.map +1 -1
  333. package/lib/util/component/index.js.map +1 -1
  334. package/lib/util/component/inject-self.js.map +1 -1
  335. package/lib/util/component/props.js.map +1 -1
  336. package/lib/util/component/types.js.map +1 -1
  337. package/lib/util/date/adapters/yuyeon-date-adapter.js +3 -3
  338. package/lib/util/date/adapters/yuyeon-date-adapter.js.map +1 -1
  339. package/lib/util/date/built-in.js +2 -0
  340. package/lib/util/date/built-in.js.map +1 -1
  341. package/lib/util/date/index.js +1 -1
  342. package/lib/util/date/index.js.map +1 -1
  343. package/lib/util/date/types.js.map +1 -1
  344. package/lib/util/debounce.js +1 -1
  345. package/lib/util/debounce.js.map +1 -1
  346. package/lib/util/dom.js +10 -1
  347. package/lib/util/dom.js.map +1 -1
  348. package/lib/util/environments.js.map +1 -1
  349. package/lib/util/frame-scheduler.js +3 -3
  350. package/lib/util/frame-scheduler.js.map +1 -1
  351. package/lib/util/index.js +11 -11
  352. package/lib/util/index.js.map +1 -1
  353. package/lib/util/reactivity.js +3 -3
  354. package/lib/util/reactivity.js.map +1 -1
  355. package/lib/util/rect.js.map +1 -1
  356. package/lib/util/scroll.js.map +1 -1
  357. package/lib/util/string.js +6 -1
  358. package/lib/util/string.js.map +1 -1
  359. package/lib/util/ui.js +8 -7
  360. package/lib/util/ui.js.map +1 -1
  361. package/lib/util/validation.js.map +1 -1
  362. package/package.json +132 -123
  363. package/types/abstract/items.d.ts +4 -4
  364. package/types/components/alert/YAlert.d.ts +2 -2
  365. package/types/components/badge/YBadge.d.ts +0 -3
  366. package/types/components/button/YButton.d.ts +3 -3
  367. package/types/components/checkbox/YCheckbox.d.ts +4 -4
  368. package/types/components/chip/YChip.d.ts +0 -3
  369. package/types/components/date-picker/YDateCalendar.d.ts +3 -3
  370. package/types/components/date-picker/YDatePickerControl.d.ts +7 -7
  371. package/types/components/dialog/YDialog.d.ts +108 -6480
  372. package/types/components/draggable/YDraggable.d.ts +6 -6
  373. package/types/components/draggable/index.d.ts +1 -0
  374. package/types/components/dropdown/YDropdown.d.ts +87 -87
  375. package/types/components/field-input/YFieldInput.d.ts +20 -14
  376. package/types/components/form/YForm.d.ts +3 -3
  377. package/types/components/icon/YIcon.d.ts +4 -4
  378. package/types/components/icons/YIconPageControl.d.ts +1 -1
  379. package/types/components/icons/YIconSort.d.ts +1 -1
  380. package/types/components/icons/index.d.ts +4 -4
  381. package/types/components/img/YImg.d.ts +26 -26
  382. package/types/components/input/YInput.d.ts +13 -13
  383. package/types/components/ip-field/YIpv4Field.d.ts +5 -5
  384. package/types/components/layer/YLayer.d.ts +55 -3240
  385. package/types/components/layer/scroll-strategies.d.ts +4 -4
  386. package/types/components/menu/YMenu.d.ts +74 -6446
  387. package/types/components/pagination/YPagination.d.ts +3 -3
  388. package/types/components/radio/YRadio.d.ts +25 -0
  389. package/types/components/radio/YRadioIcon.d.ts +6 -0
  390. package/types/components/radio/index.d.ts +2 -0
  391. package/types/components/select/YSelect.d.ts +178 -496
  392. package/types/components/slider/YSlider.d.ts +1 -1
  393. package/types/components/snackbar/YSnackbar.d.ts +55 -55
  394. package/types/components/tab/YTab.d.ts +3 -3
  395. package/types/components/tab/YTabs.d.ts +1 -1
  396. package/types/components/table/YDataTable.d.ts +33 -87
  397. package/types/components/table/YDataTableBody.d.ts +3 -3
  398. package/types/components/table/YDataTableCell.d.ts +2 -2
  399. package/types/components/table/YDataTableControl.d.ts +18 -6
  400. package/types/components/table/YDataTableLayer.d.ts +2 -2
  401. package/types/components/table/YDataTableRow.d.ts +1 -1
  402. package/types/components/table/YDataTableServer.d.ts +54 -99
  403. package/types/components/table/YTable.d.ts +3 -3
  404. package/types/components/table/composables/expand.d.ts +4 -4
  405. package/types/components/table/composables/header.d.ts +16 -48
  406. package/types/components/table/composables/items.d.ts +2 -2
  407. package/types/components/table/composables/pagination.d.ts +10 -10
  408. package/types/components/table/composables/selection.d.ts +6 -6
  409. package/types/components/table/composables/sorting.d.ts +8 -14
  410. package/types/components/table/types/item.d.ts +1 -1
  411. package/types/components/textarea/YTextarea.d.ts +30 -30
  412. package/types/components/tooltip/YTooltip.d.ts +67 -67
  413. package/types/components/tree-view/YTreeView.d.ts +7 -7
  414. package/types/components/tree-view/YTreeViewNode.d.ts +5 -5
  415. package/types/components/tree-view/tree-view.d.ts +2 -2
  416. package/types/composables/choice.d.ts +2 -2
  417. package/types/composables/coordinate/index.d.ts +27 -3205
  418. package/types/composables/dimension.d.ts +6 -6
  419. package/types/composables/form.d.ts +17 -27
  420. package/types/composables/list-items.d.ts +3 -3
  421. package/types/composables/style-color.d.ts +0 -1
  422. package/types/composables/theme/index.d.ts +1 -0
  423. package/types/composables/transition.d.ts +10 -10
  424. package/types/composables/validation.d.ts +6 -6
  425. package/types/composables/vue-router.d.ts +3 -3
  426. package/types/declares.d.ts +1 -0
  427. package/types/directives/index.d.ts +2 -0
  428. package/types/directives/plate-wave/index.d.ts +7 -1
  429. package/types/globals.d.ts +19 -20
  430. package/types/shims.d.ts +58 -52
  431. package/types/src/abstract/items.d.ts +49 -0
  432. package/types/src/components/alert/YAlert.d.ts +13 -0
  433. package/types/src/components/alert/index.d.ts +1 -0
  434. package/types/src/components/app/YApp.d.ts +8 -0
  435. package/types/src/components/app/index.d.ts +1 -0
  436. package/types/src/components/badge/YBadge.d.ts +126 -0
  437. package/types/src/components/badge/index.d.ts +1 -0
  438. package/types/src/components/bench/YBench.d.ts +4 -0
  439. package/types/src/components/bench/index.d.ts +1 -0
  440. package/types/src/components/button/YButton.d.ts +189 -0
  441. package/types/src/components/button/index.d.ts +1 -0
  442. package/types/src/components/card/YCard.d.ts +9 -0
  443. package/types/src/components/card/YCardBody.d.ts +2 -0
  444. package/types/src/components/card/YCardFooter.d.ts +2 -0
  445. package/types/src/components/card/YCardHeader.d.ts +2 -0
  446. package/types/src/components/card/index.d.ts +4 -0
  447. package/types/src/components/checkbox/YCheckbox.d.ts +23 -0
  448. package/types/src/components/checkbox/YInputCheckbox.d.ts +31 -0
  449. package/types/src/components/checkbox/index.d.ts +4 -0
  450. package/types/src/components/chip/YChip.d.ts +37 -0
  451. package/types/src/components/chip/index.d.ts +1 -0
  452. package/types/src/components/date-picker/YDateCalendar.d.ts +115 -0
  453. package/types/src/components/date-picker/YDatePicker.d.ts +94 -0
  454. package/types/src/components/date-picker/YDatePickerControl.d.ts +97 -0
  455. package/types/src/components/date-picker/YMonthPicker.d.ts +25 -0
  456. package/types/src/components/date-picker/YYearPicker.d.ts +38 -0
  457. package/types/src/components/date-picker/index.d.ts +3 -0
  458. package/types/src/components/default-provider/YDefaultProvider.d.ts +0 -0
  459. package/types/src/components/default-provider/index.d.ts +0 -0
  460. package/types/src/components/dialog/YDialog.d.ts +715 -0
  461. package/types/src/components/dialog/index.d.ts +1 -0
  462. package/types/src/components/divider/YDivider.d.ts +14 -0
  463. package/types/src/components/divider/index.d.ts +1 -0
  464. package/types/src/components/draggable/YDraggable.d.ts +36 -0
  465. package/types/src/components/draggable/index.d.ts +1 -0
  466. package/types/src/components/dropdown/YDropdown.d.ts +574 -0
  467. package/types/src/components/dropdown/index.d.ts +1 -0
  468. package/types/src/components/field-input/YFieldInput.d.ts +322 -0
  469. package/types/src/components/field-input/index.d.ts +1 -0
  470. package/types/src/components/form/YForm.d.ts +20 -0
  471. package/types/src/components/form/index.d.ts +1 -0
  472. package/types/src/components/hover/YHover.d.ts +57 -0
  473. package/types/src/components/hover/index.d.ts +1 -0
  474. package/types/src/components/icon/YIcon.d.ts +67 -0
  475. package/types/src/components/icon/index.d.ts +1 -0
  476. package/types/src/components/icons/YIconCheckbox.d.ts +6 -0
  477. package/types/src/components/icons/YIconClear.d.ts +1 -0
  478. package/types/src/components/icons/YIconDropdown.d.ts +1 -0
  479. package/types/src/components/icons/YIconExpand.d.ts +1 -0
  480. package/types/src/components/icons/YIconPageControl.d.ts +14 -0
  481. package/types/src/components/icons/YIconSort.d.ts +10 -0
  482. package/types/src/components/icons/index.d.ts +51 -0
  483. package/types/src/components/img/YImg.d.ts +133 -0
  484. package/types/src/components/img/index.d.ts +0 -0
  485. package/types/src/components/index.d.ts +38 -0
  486. package/types/src/components/input/YInput.d.ts +249 -0
  487. package/types/src/components/input/index.d.ts +1 -0
  488. package/types/src/components/ip-field/YIpv4Field.d.ts +65 -0
  489. package/types/src/components/ip-field/index.d.ts +1 -0
  490. package/types/src/components/layer/YLayer.d.ts +436 -0
  491. package/types/src/components/layer/active-delay.d.ts +4 -0
  492. package/types/src/components/layer/active-stack.d.ts +16 -0
  493. package/types/src/components/layer/base.d.ts +28 -0
  494. package/types/src/components/layer/content.d.ts +21 -0
  495. package/types/src/components/layer/index.d.ts +1 -0
  496. package/types/src/components/layer/scroll-strategies.d.ts +41 -0
  497. package/types/src/components/list/YList.d.ts +19 -0
  498. package/types/src/components/list/YListItem.d.ts +42 -0
  499. package/types/src/components/list/index.d.ts +2 -0
  500. package/types/src/components/loading/YSpinnerRing.d.ts +3 -0
  501. package/types/src/components/loading/index.d.ts +1 -0
  502. package/types/src/components/menu/YMenu.d.ts +517 -0
  503. package/types/src/components/menu/index.d.ts +1 -0
  504. package/types/src/components/navigation/YNavigation.d.ts +1 -0
  505. package/types/src/components/navigation/index.d.ts +1 -0
  506. package/types/src/components/pagination/YPagination.d.ts +137 -0
  507. package/types/src/components/pagination/index.d.ts +1 -0
  508. package/types/src/components/panel/YDividePanel.d.ts +5 -0
  509. package/types/src/components/panel/index.d.ts +1 -0
  510. package/types/src/components/plate/YPlate.d.ts +9 -0
  511. package/types/src/components/plate/index.d.ts +1 -0
  512. package/types/src/components/progress-bar/YProgressBar.d.ts +38 -0
  513. package/types/src/components/progress-bar/index.d.ts +1 -0
  514. package/types/src/components/progress-ring/YProgressRing.d.ts +34 -0
  515. package/types/src/components/progress-ring/index.d.ts +1 -0
  516. package/types/src/components/radio/YRadio.d.ts +25 -0
  517. package/types/src/components/radio/YRadioIcon.d.ts +6 -0
  518. package/types/src/components/radio/index.d.ts +2 -0
  519. package/types/src/components/select/YSelect.d.ts +1221 -0
  520. package/types/src/components/select/index.d.ts +1 -0
  521. package/types/src/components/slider/YSlider.d.ts +16 -0
  522. package/types/src/components/slider/index.d.ts +1 -0
  523. package/types/src/components/slider/slider.d.ts +0 -0
  524. package/types/src/components/snackbar/YSnackbar.d.ts +452 -0
  525. package/types/src/components/snackbar/index.d.ts +1 -0
  526. package/types/src/components/switch/YSwitch.d.ts +137 -0
  527. package/types/src/components/switch/index.d.ts +1 -0
  528. package/types/src/components/tab/YTab.d.ts +218 -0
  529. package/types/src/components/tab/YTabs.d.ts +98 -0
  530. package/types/src/components/tab/index.d.ts +3 -0
  531. package/types/src/components/tab/shared.d.ts +4 -0
  532. package/types/src/components/tab/types.d.ts +5 -0
  533. package/types/src/components/table/YDataTable.d.ts +459 -0
  534. package/types/src/components/table/YDataTableBody.d.ts +99 -0
  535. package/types/src/components/table/YDataTableCell.d.ts +32 -0
  536. package/types/src/components/table/YDataTableControl.d.ts +68 -0
  537. package/types/src/components/table/YDataTableHead.d.ts +54 -0
  538. package/types/src/components/table/YDataTableLayer.d.ts +13 -0
  539. package/types/src/components/table/YDataTableLayerRow.d.ts +22 -0
  540. package/types/src/components/table/YDataTableLayerRows.d.ts +9 -0
  541. package/types/src/components/table/YDataTableRow.d.ts +53 -0
  542. package/types/src/components/table/YDataTableServer.d.ts +502 -0
  543. package/types/src/components/table/YTable.d.ts +65 -0
  544. package/types/src/components/table/composables/expand.d.ts +42 -0
  545. package/types/src/components/table/composables/header.d.ts +175 -0
  546. package/types/src/components/table/composables/items.d.ts +55 -0
  547. package/types/src/components/table/composables/measure.d.ts +8 -0
  548. package/types/src/components/table/composables/options.d.ts +11 -0
  549. package/types/src/components/table/composables/pagination.d.ts +81 -0
  550. package/types/src/components/table/composables/provides.d.ts +15 -0
  551. package/types/src/components/table/composables/selection.d.ts +82 -0
  552. package/types/src/components/table/composables/sorted-items.d.ts +7 -0
  553. package/types/src/components/table/composables/sorting.d.ts +56 -0
  554. package/types/src/components/table/index.d.ts +10 -0
  555. package/types/src/components/table/types/common.d.ts +2 -0
  556. package/types/src/components/table/types/header.d.ts +25 -0
  557. package/types/src/components/table/types/index.d.ts +59 -0
  558. package/types/src/components/table/types/item.d.ts +23 -0
  559. package/types/src/components/table/types/row.d.ts +4 -0
  560. package/types/src/components/text-ellipsis/YTextEllipsis.d.ts +11 -0
  561. package/types/src/components/text-ellipsis/index.d.ts +1 -0
  562. package/types/src/components/text-highlighter/YTextHighlighter.d.ts +26 -0
  563. package/types/src/components/text-highlighter/index.d.ts +1 -0
  564. package/types/src/components/text-interpolation/YTi.d.ts +11 -0
  565. package/types/src/components/text-interpolation/index.d.ts +1 -0
  566. package/types/src/components/textarea/YTextarea.d.ts +583 -0
  567. package/types/src/components/textarea/index.d.ts +1 -0
  568. package/types/src/components/toggle-button/YToggleButton.d.ts +4 -0
  569. package/types/src/components/toggle-button/index.d.ts +1 -0
  570. package/types/src/components/tooltip/YTooltip.d.ts +502 -0
  571. package/types/src/components/tooltip/index.d.ts +1 -0
  572. package/types/src/components/transitions/expand-transition.d.ts +20 -0
  573. package/types/src/components/transitions/index.d.ts +38 -0
  574. package/types/src/components/tree-view/YTreeView.d.ts +172 -0
  575. package/types/src/components/tree-view/YTreeViewNode.d.ts +176 -0
  576. package/types/src/components/tree-view/index.d.ts +2 -0
  577. package/types/src/components/tree-view/tree-view.d.ts +51 -0
  578. package/types/src/components/tree-view/types.d.ts +17 -0
  579. package/types/src/components/tree-view/util.d.ts +6 -0
  580. package/types/src/composables/choice-link.d.ts +3 -0
  581. package/types/src/composables/choice.d.ts +113 -0
  582. package/types/src/composables/communication.d.ts +8 -0
  583. package/types/src/composables/component.d.ts +3 -0
  584. package/types/src/composables/coordinate/arrangement.d.ts +7 -0
  585. package/types/src/composables/coordinate/index.d.ts +87 -0
  586. package/types/src/composables/coordinate/levitation.d.ts +7 -0
  587. package/types/src/composables/coordinate/types.d.ts +7 -0
  588. package/types/src/composables/coordinate/utils/point.d.ts +22 -0
  589. package/types/src/composables/date/factory.d.ts +3 -0
  590. package/types/src/composables/date/index.d.ts +12 -0
  591. package/types/src/composables/date/setting.d.ts +5 -0
  592. package/types/src/composables/date/types.d.ts +13 -0
  593. package/types/src/composables/defaults/index.d.ts +11 -0
  594. package/types/src/composables/defaults/share.d.ts +4 -0
  595. package/types/src/composables/defaults/types.d.ts +12 -0
  596. package/types/src/composables/dimension.d.ts +54 -0
  597. package/types/src/composables/focus.d.ts +30 -0
  598. package/types/src/composables/form.d.ts +132 -0
  599. package/types/src/composables/i18n/index.d.ts +9 -0
  600. package/types/src/composables/i18n/locale.d.ts +3 -0
  601. package/types/src/composables/i18n/rtl.d.ts +21 -0
  602. package/types/src/composables/i18n/share.d.ts +1 -0
  603. package/types/src/composables/icon.d.ts +79 -0
  604. package/types/src/composables/index.d.ts +10 -0
  605. package/types/src/composables/layer-group.d.ts +10 -0
  606. package/types/src/composables/layout.d.ts +10 -0
  607. package/types/src/composables/list-items.d.ts +113 -0
  608. package/types/src/composables/progress.d.ts +4 -0
  609. package/types/src/composables/ref.d.ts +6 -0
  610. package/types/src/composables/resize-observer.d.ts +24 -0
  611. package/types/src/composables/scope.d.ts +3 -0
  612. package/types/src/composables/style-color.d.ts +14 -0
  613. package/types/src/composables/theme/factory.d.ts +4 -0
  614. package/types/src/composables/theme/helper.d.ts +3 -0
  615. package/types/src/composables/theme/index.d.ts +57 -0
  616. package/types/src/composables/theme/setting.d.ts +11 -0
  617. package/types/src/composables/theme/types.d.ts +29 -0
  618. package/types/src/composables/timing.d.ts +20 -0
  619. package/types/src/composables/transition.d.ts +40 -0
  620. package/types/src/composables/validation.d.ts +82 -0
  621. package/types/src/composables/vue-router.d.ts +43 -0
  622. package/types/src/declares.d.ts +1 -0
  623. package/types/src/directives/complement-click/index.d.ts +26 -0
  624. package/types/src/directives/index.d.ts +2 -0
  625. package/types/src/directives/plate-wave/index.d.ts +20 -0
  626. package/types/src/directives/theme-class/index.d.ts +4 -0
  627. package/types/src/etc/index.d.ts +1 -0
  628. package/types/src/globals.d.ts +20 -0
  629. package/types/src/i18n/built-in.d.ts +3 -0
  630. package/types/src/i18n/config.d.ts +81 -0
  631. package/types/src/i18n/types.d.ts +20 -0
  632. package/types/src/index.d.ts +13 -0
  633. package/types/src/locales/en.d.ts +6 -0
  634. package/types/src/locales/index.d.ts +2 -0
  635. package/types/src/locales/ko.d.ts +6 -0
  636. package/types/src/mixins/di.d.ts +2 -0
  637. package/types/src/mixins/rebind-attrs.d.ts +5 -0
  638. package/types/src/shims.d.ts +64 -0
  639. package/types/src/types/index.d.ts +9 -0
  640. package/types/src/util/anchor.d.ts +23 -0
  641. package/types/src/util/array.d.ts +2 -0
  642. package/types/src/util/collection.d.ts +1 -0
  643. package/types/src/util/color/apca.d.ts +29 -0
  644. package/types/src/util/color/const.d.ts +5 -0
  645. package/types/src/util/color/contrast/contrast.d.ts +74 -0
  646. package/types/src/util/color/conversion.d.ts +131 -0
  647. package/types/src/util/color/hct/cam16.d.ts +116 -0
  648. package/types/src/util/color/hct/hct-solver.d.ts +131 -0
  649. package/types/src/util/color/hct/hct.d.ts +71 -0
  650. package/types/src/util/color/hct/viewing-conditions.d.ts +58 -0
  651. package/types/src/util/color/index.d.ts +5 -0
  652. package/types/src/util/color/palettes/core-palette.d.ts +44 -0
  653. package/types/src/util/color/palettes/tonal-palette.d.ts +40 -0
  654. package/types/src/util/color/types.d.ts +14 -0
  655. package/types/src/util/color/utils/math-utils.d.ts +82 -0
  656. package/types/src/util/common.d.ts +17 -0
  657. package/types/src/util/component/component.d.ts +5 -0
  658. package/types/src/util/component/index.d.ts +11 -0
  659. package/types/src/util/component/inject-self.d.ts +3 -0
  660. package/types/src/util/component/props.d.ts +32 -0
  661. package/types/src/util/component/types.d.ts +21 -0
  662. package/types/src/util/date/adapters/yuyeon-date-adapter.d.ts +43 -0
  663. package/types/src/util/date/built-in.d.ts +41 -0
  664. package/types/src/util/date/index.d.ts +3 -0
  665. package/types/src/util/date/types.d.ts +167 -0
  666. package/types/src/util/debounce.d.ts +11 -0
  667. package/types/src/util/dom.d.ts +5 -0
  668. package/types/src/util/environments.d.ts +6 -0
  669. package/types/src/util/frame-scheduler.d.ts +7 -0
  670. package/types/src/util/index.d.ts +16 -0
  671. package/types/src/util/reactivity.d.ts +7 -0
  672. package/types/src/util/rect.d.ts +36 -0
  673. package/types/src/util/scroll.d.ts +3 -0
  674. package/types/src/util/string.d.ts +9 -0
  675. package/types/src/util/ui.d.ts +4 -0
  676. package/types/src/util/validation.d.ts +3 -0
  677. package/types/types/index.d.ts +3 -0
  678. package/types/util/anchor.d.ts +1 -1
  679. package/types/util/common.d.ts +3 -0
  680. package/types/util/component/component.d.ts +1 -2
  681. package/types/util/component/props.d.ts +1 -1
  682. package/types/util/component/types.d.ts +1 -1
  683. package/types/util/date/index.d.ts +1 -1
  684. package/types/util/dom.d.ts +2 -0
  685. package/types/util/index.d.ts +11 -11
  686. package/types/util/string.d.ts +1 -0
  687. /package/types/directives/{theme-class.d.ts → theme-class/index.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"viewing-conditions.js","names":["whitePointD65","yFromLstar","math","ViewingConditions","make","whitePoint","arguments","length","undefined","adaptingLuminance","Math","PI","backgroundLstar","surround","discountingIlluminant","xyz","rW","gW","bW","f","c","lerp","d","exp","nc","rgbD","k","k4","k4F","fl","cbrt","n","z","sqrt","nbb","pow","ncb","rgbAFactors","rgbA","aw","constructor","fLRoot","_defineProperty"],"sources":["../../../../src/util/color/hct/viewing-conditions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { whitePointD65, yFromLstar } from '../conversion';\nimport * as math from '../utils/math-utils';\n\n/**\n * In traditional color spaces, a color can be identified solely by the\n * observer's measurement of the color. Color appearance models such as CAM16\n * also use information about the environment where the color was\n * observed, known as the viewing conditions.\n *\n * For example, white under the traditional assumption of a midday sun white\n * point is accurately measured as a slightly chromatic blue by CAM16. (roughly,\n * hue 203, chroma 3, lightness 100)\n *\n * This class caches intermediate values of the CAM16 conversion process that\n * depend only on viewing conditions, enabling speed ups.\n */\nexport class ViewingConditions {\n /** sRGB-like viewing conditions. */\n static DEFAULT = ViewingConditions.make();\n\n /**\n * Create ViewingConditions from a simple, physically relevant, set of\n * parameters.\n *\n * @param whitePoint White point, measured in the XYZ color space.\n * default = D65, or sunny day afternoon\n * @param adaptingLuminance The luminance of the adapting field. Informally,\n * how bright it is in the room where the color is viewed. Can be\n * calculated from lux by multiplying lux by 0.0586. default = 11.72,\n * or 200 lux.\n * @param backgroundLstar The lightness of the area surrounding the color.\n * measured by L* in L*a*b*. default = 50.0\n * @param surround A general description of the lighting surrounding the\n * color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a\n * dimly light room, like watching TV at home at night. 2.0 means there\n * is no difference between the lighting on the color and around it.\n * default = 2.0\n * @param discountingIlluminant Whether the eye accounts for the tint of the\n * ambient lighting, such as knowing an apple is still red in green light.\n * default = false, the eye does not perform this process on\n * self-luminous objects like displays.\n */\n static make(\n whitePoint = whitePointD65(),\n adaptingLuminance = ((200.0 / Math.PI) * yFromLstar(50.0)) / 100.0,\n backgroundLstar = 50.0,\n surround = 2.0,\n discountingIlluminant = false,\n ): ViewingConditions {\n const xyz = whitePoint;\n const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;\n const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;\n const bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;\n const f = 0.8 + surround / 10.0;\n const c =\n f >= 0.9\n ? math.lerp(0.59, 0.69, (f - 0.9) * 10.0)\n : math.lerp(0.525, 0.59, (f - 0.8) * 10.0);\n let d = discountingIlluminant\n ? 1.0\n : f * (1.0 - (1.0 / 3.6) * Math.exp((-adaptingLuminance - 42.0) / 92.0));\n d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;\n const nc = f;\n const rgbD = [\n d * (100.0 / rW) + 1.0 - d,\n d * (100.0 / gW) + 1.0 - d,\n d * (100.0 / bW) + 1.0 - d,\n ];\n const k = 1.0 / (5.0 * adaptingLuminance + 1.0);\n const k4 = k * k * k * k;\n const k4F = 1.0 - k4;\n const fl =\n k4 * adaptingLuminance +\n 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);\n const n = yFromLstar(backgroundLstar) / whitePoint[1];\n const z = 1.48 + Math.sqrt(n);\n const nbb = 0.725 / Math.pow(n, 0.2);\n const ncb = nbb;\n const rgbAFactors = [\n Math.pow((fl * rgbD[0] * rW) / 100.0, 0.42),\n Math.pow((fl * rgbD[1] * gW) / 100.0, 0.42),\n Math.pow((fl * rgbD[2] * bW) / 100.0, 0.42),\n ];\n const rgbA = [\n (400.0 * rgbAFactors[0]) / (rgbAFactors[0] + 27.13),\n (400.0 * rgbAFactors[1]) / (rgbAFactors[1] + 27.13),\n (400.0 * rgbAFactors[2]) / (rgbAFactors[2] + 27.13),\n ];\n const aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;\n return new ViewingConditions(\n n,\n aw,\n nbb,\n ncb,\n c,\n nc,\n rgbD,\n fl,\n Math.pow(fl, 0.25),\n z,\n );\n }\n\n /**\n * Parameters are intermediate values of the CAM16 conversion process. Their\n * names are shorthand for technical color science terminology, this class\n * would not benefit from documenting them individually. A brief overview\n * is available in the CAM16 specification, and a complete overview requires\n * a color science textbook, such as Fairchild's Color Appearance Models.\n */\n private constructor(\n public n: number,\n public aw: number,\n public nbb: number,\n public ncb: number,\n public c: number,\n public nc: number,\n public rgbD: number[],\n public fl: number,\n public fLRoot: number,\n public z: number,\n ) {}\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,aAAa,EAAEC,UAAU;AAAA,OAC3B,KAAKC,IAAI;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,CAAC;EAI7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAAA,EAMU;IAAA,IALnBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGN,aAAa,CAAC,CAAC;IAAA,IAC5BS,iBAAiB,G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AS,GAATA,CAAS;IAAA,KACTQ,EAAU,GAAVA,EAAU;IAAA,KACVL,GAAW,GAAXA,GAAW;IAAA,KACXE,GAAW,GAAXA,GAAW;IAAA,KACXhB,CAAS,GAATA,CAAS;IAAA,KACTI,EAAU,GAAVA,EAAU;IAAA,KACVC,IAAc,GAAdA,IAAc;IAAA,KACdI,EAAU,GAAVA,EAAU;IAAA,KACVY,MAAc,GAAdA,MAAc;IAAA,KACdT,CAAS,GAATA,CAAS;EACf;AACL;AAzGE;AAAAU,eAAA,CADWvC,iBAAiB,aAEXA,iBAAiB,CAACC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"viewing-conditions.js","names":["whitePointD65","yFromLstar","math","ViewingConditions","make","whitePoint","arguments","length","undefined","adaptingLuminance","Math","PI","backgroundLstar","surround","discountingIlluminant","xyz","rW","gW","bW","f","c","lerp","d","exp","nc","rgbD","k","k4","k4F","fl","cbrt","n","z","sqrt","nbb","pow","ncb","rgbAFactors","rgbA","aw","constructor","fLRoot","_ViewingConditions","_defineProperty"],"sources":["../../../../src/util/color/hct/viewing-conditions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { whitePointD65, yFromLstar } from '../conversion';\nimport * as math from '../utils/math-utils';\n\n/**\n * In traditional color spaces, a color can be identified solely by the\n * observer's measurement of the color. Color appearance models such as CAM16\n * also use information about the environment where the color was\n * observed, known as the viewing conditions.\n *\n * For example, white under the traditional assumption of a midday sun white\n * point is accurately measured as a slightly chromatic blue by CAM16. (roughly,\n * hue 203, chroma 3, lightness 100)\n *\n * This class caches intermediate values of the CAM16 conversion process that\n * depend only on viewing conditions, enabling speed ups.\n */\nexport class ViewingConditions {\n /** sRGB-like viewing conditions. */\n static DEFAULT = ViewingConditions.make();\n\n /**\n * Create ViewingConditions from a simple, physically relevant, set of\n * parameters.\n *\n * @param whitePoint White point, measured in the XYZ color space.\n * default = D65, or sunny day afternoon\n * @param adaptingLuminance The luminance of the adapting field. Informally,\n * how bright it is in the room where the color is viewed. Can be\n * calculated from lux by multiplying lux by 0.0586. default = 11.72,\n * or 200 lux.\n * @param backgroundLstar The lightness of the area surrounding the color.\n * measured by L* in L*a*b*. default = 50.0\n * @param surround A general description of the lighting surrounding the\n * color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a\n * dimly light room, like watching TV at home at night. 2.0 means there\n * is no difference between the lighting on the color and around it.\n * default = 2.0\n * @param discountingIlluminant Whether the eye accounts for the tint of the\n * ambient lighting, such as knowing an apple is still red in green light.\n * default = false, the eye does not perform this process on\n * self-luminous objects like displays.\n */\n static make(\n whitePoint = whitePointD65(),\n adaptingLuminance = ((200.0 / Math.PI) * yFromLstar(50.0)) / 100.0,\n backgroundLstar = 50.0,\n surround = 2.0,\n discountingIlluminant = false,\n ): ViewingConditions {\n const xyz = whitePoint;\n const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;\n const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;\n const bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;\n const f = 0.8 + surround / 10.0;\n const c =\n f >= 0.9\n ? math.lerp(0.59, 0.69, (f - 0.9) * 10.0)\n : math.lerp(0.525, 0.59, (f - 0.8) * 10.0);\n let d = discountingIlluminant\n ? 1.0\n : f * (1.0 - (1.0 / 3.6) * Math.exp((-adaptingLuminance - 42.0) / 92.0));\n d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;\n const nc = f;\n const rgbD = [\n d * (100.0 / rW) + 1.0 - d,\n d * (100.0 / gW) + 1.0 - d,\n d * (100.0 / bW) + 1.0 - d,\n ];\n const k = 1.0 / (5.0 * adaptingLuminance + 1.0);\n const k4 = k * k * k * k;\n const k4F = 1.0 - k4;\n const fl =\n k4 * adaptingLuminance +\n 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);\n const n = yFromLstar(backgroundLstar) / whitePoint[1];\n const z = 1.48 + Math.sqrt(n);\n const nbb = 0.725 / Math.pow(n, 0.2);\n const ncb = nbb;\n const rgbAFactors = [\n Math.pow((fl * rgbD[0] * rW) / 100.0, 0.42),\n Math.pow((fl * rgbD[1] * gW) / 100.0, 0.42),\n Math.pow((fl * rgbD[2] * bW) / 100.0, 0.42),\n ];\n const rgbA = [\n (400.0 * rgbAFactors[0]) / (rgbAFactors[0] + 27.13),\n (400.0 * rgbAFactors[1]) / (rgbAFactors[1] + 27.13),\n (400.0 * rgbAFactors[2]) / (rgbAFactors[2] + 27.13),\n ];\n const aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;\n return new ViewingConditions(\n n,\n aw,\n nbb,\n ncb,\n c,\n nc,\n rgbD,\n fl,\n Math.pow(fl, 0.25),\n z,\n );\n }\n\n /**\n * Parameters are intermediate values of the CAM16 conversion process. Their\n * names are shorthand for technical color science terminology, this class\n * would not benefit from documenting them individually. A brief overview\n * is available in the CAM16 specification, and a complete overview requires\n * a color science textbook, such as Fairchild's Color Appearance Models.\n */\n private constructor(\n public n: number,\n public aw: number,\n public nbb: number,\n public ncb: number,\n public c: number,\n public nc: number,\n public rgbD: number[],\n public fl: number,\n public fLRoot: number,\n public z: number,\n ) {}\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,aAAa,EAAEC,UAAU;AAAA,OAC3B,KAAKC,IAAI;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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CAAC,EACDI,EAAE,EACFC,IAAI,EACJI,EAAE,EACFnB,IAAI,CAACyB,GAAG,CAACN,EAAE,EAAE,IAAI,CAAC,EAClBG,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACUQ,WAAWA,CACVT,CAAS,EACTQ,EAAU,EACVL,GAAW,EACXE,GAAW,EACXhB,CAAS,EACTI,EAAU,EACVC,IAAc,EACdI,EAAU,EACVY,MAAc,EACdT,CAAS,EAChB;IAAA,KAVOD,CAAS,GAATA,CAAS;IAAA,KACTQ,EAAU,GAAVA,EAAU;IAAA,KACVL,GAAW,GAAXA,GAAW;IAAA,KACXE,GAAW,GAAXA,GAAW;IAAA,KACXhB,CAAS,GAATA,CAAS;IAAA,KACTI,EAAU,GAAVA,EAAU;IAAA,KACVC,IAAc,GAAdA,IAAc;IAAA,KACdI,EAAU,GAAVA,EAAU;IAAA,KACVY,MAAc,GAAdA,MAAc;IAAA,KACdT,CAAS,GAATA,CAAS;EACf;AACL;AAACU,kBAAA,GA1GYvC,iBAAiB;AAC5B;AAAAwC,eAAA,CADWxC,iBAAiB,aAEXA,kBAAiB,CAACC,IAAI,CAAC,CAAC","ignoreList":[]}
@@ -1,16 +1,16 @@
1
- /*
2
- * yuyeon
3
- * Apache-2.0 license (Copyright 2023 yeonyew)
4
- *
5
- * Used Libs
6
- * - material-color-utilities
7
- * Apache-2.0 license (Copyright 2021 Google LLC)
8
- * https://github.com/material-foundation/material-color-utilities
9
- *
10
- * - Vuetify
11
- * MIT license (Copyright (c) 2016-2023 John Jeremy Leider)
12
- * https://github.com/vuetifyjs/vuetify
13
- * */
1
+ /*
2
+ * yuyeon
3
+ * Apache-2.0 license (Copyright 2023 yeonyew)
4
+ *
5
+ * Used Libs
6
+ * - material-color-utilities
7
+ * Apache-2.0 license (Copyright 2021 Google LLC)
8
+ * https://github.com/material-foundation/material-color-utilities
9
+ *
10
+ * - Vuetify
11
+ * MIT license (Copyright (c) 2016-2023 John Jeremy Leider)
12
+ * https://github.com/vuetifyjs/vuetify
13
+ * */
14
14
  import { HEX_COLOR_REGEX, RGBA_REGEX } from "./const.js";
15
15
  import { rgbFromHex } from "./conversion.js";
16
16
  export function isColorValue(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["HEX_COLOR_REGEX","RGBA_REGEX","rgbFromHex","isColorValue","value","test","colorRgb","color","startsWith","join","exec","valueArray","trim","split","splice","isTextColorIsLight","r","g","b","luminance"],"sources":["../../../src/util/color/index.ts"],"sourcesContent":["/*\r\n* yuyeon\r\n* Apache-2.0 license (Copyright 2023 yeonyew)\r\n*\r\n* Used Libs\r\n* - material-color-utilities\r\n* Apache-2.0 license (Copyright 2021 Google LLC)\r\n* https://github.com/material-foundation/material-color-utilities\r\n*\r\n* - Vuetify\r\n* MIT license (Copyright (c) 2016-2023 John Jeremy Leider)\r\n* https://github.com/vuetifyjs/vuetify\r\n* */\r\n\r\nimport { HEX_COLOR_REGEX, RGBA_REGEX } from \"./const\";\r\nimport { rgbFromHex } from './conversion';\r\n\r\nexport function isColorValue(value: string): boolean {\r\n return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);\r\n}\r\n\r\nexport function colorRgb(color: string): string {\r\n if (color?.startsWith('#')) {\r\n return rgbFromHex(color)?.join(',') || '';\r\n }\r\n const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\r\n if (RGBA_REGEX.test(color)) {\r\n const value = RGBA_REGEX.exec(color)?.[2] || '';\r\n if (value) {\r\n const valueArray = value.trim().split(',');\r\n valueArray.splice(3, 1);\r\n return valueArray.join(',');\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nexport function isTextColorIsLight(r: number, g: number, b: number): boolean {\r\n const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;\r\n return luminance < 0.5;\r\n}\r\n\r\nexport * from './const';\r\nexport * from \"./conversion\";\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAcSA,eAAe,EAAEC,UAAU;AAAA,SAC3BC,UAAU;AAEnB,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOH,UAAU,CAACI,IAAI,CAACD,KAAK,CAAC,IAAIJ,eAAe,CAACK,IAAI,CAACD,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,QAAQA,CAACC,KAAa,EAAU;EAC9C,IAAIA,KAAK,EAAEC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC1B,OAAON,UAAU,CAACK,KAAK,CAAC,EAAEE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;EAC3C;EACA,MAAMR,UAAU,GAAG,qBAAqB;EACxC,IAAIA,UAAU,CAACI,IAAI,CAACE,KAAK,CAAC,EAAE;IAC1B,MAAMH,KAAK,GAAGH,UAAU,CAACS,IAAI,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAC/C,IAAIH,KAAK,EAAE;MACT,MAAMO,UAAU,GAAGP,KAAK,CAACQ,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;MAC1CF,UAAU,CAACG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;MACvB,OAAOH,UAAU,CAACF,IAAI,CAAC,GAAG,CAAC;IAC7B;EACF;EACA,OAAO,EAAE;AACX;AAEA,OAAO,SAASM,kBAAkBA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAW;EAC3E,MAAMC,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,GAAGH,CAAC,GAAG,KAAK,GAAGC,CAAC,GAAG,KAAK,GAAGC,CAAC,IAAI,GAAG;EAC/D,OAAOC,SAAS,GAAG,GAAG;AACxB;AAAC;AAAA"}
1
+ {"version":3,"file":"index.js","names":["HEX_COLOR_REGEX","RGBA_REGEX","rgbFromHex","isColorValue","value","test","colorRgb","color","startsWith","join","exec","valueArray","trim","split","splice","isTextColorIsLight","r","g","b","luminance"],"sources":["../../../src/util/color/index.ts"],"sourcesContent":["/*\n * yuyeon\n * Apache-2.0 license (Copyright 2023 yeonyew)\n *\n * Used Libs\n * - material-color-utilities\n * Apache-2.0 license (Copyright 2021 Google LLC)\n * https://github.com/material-foundation/material-color-utilities\n *\n * - Vuetify\n * MIT license (Copyright (c) 2016-2023 John Jeremy Leider)\n * https://github.com/vuetifyjs/vuetify\n * */\n\nimport { HEX_COLOR_REGEX, RGBA_REGEX } from './const';\nimport { rgbFromHex } from './conversion';\n\nexport function isColorValue(value: string): boolean {\n return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);\n}\n\nexport function colorRgb(color: string): string {\n if (color?.startsWith('#')) {\n return rgbFromHex(color)?.join(',') || '';\n }\n const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\n if (RGBA_REGEX.test(color)) {\n const value = RGBA_REGEX.exec(color)?.[2] || '';\n if (value) {\n const valueArray = value.trim().split(',');\n valueArray.splice(3, 1);\n return valueArray.join(',');\n }\n }\n return '';\n}\n\nexport function isTextColorIsLight(r: number, g: number, b: number): boolean {\n const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n return luminance < 0.5;\n}\n\nexport * from './const';\nexport * from './conversion';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAcSA,eAAe,EAAEC,UAAU;AAAA,SAC3BC,UAAU;AAEnB,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOH,UAAU,CAACI,IAAI,CAACD,KAAK,CAAC,IAAIJ,eAAe,CAACK,IAAI,CAACD,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,QAAQA,CAACC,KAAa,EAAU;EAC9C,IAAIA,KAAK,EAAEC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC1B,OAAON,UAAU,CAACK,KAAK,CAAC,EAAEE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;EAC3C;EACA,MAAMR,UAAU,GAAG,qBAAqB;EACxC,IAAIA,UAAU,CAACI,IAAI,CAACE,KAAK,CAAC,EAAE;IAC1B,MAAMH,KAAK,GAAGH,UAAU,CAACS,IAAI,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAC/C,IAAIH,KAAK,EAAE;MACT,MAAMO,UAAU,GAAGP,KAAK,CAACQ,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;MAC1CF,UAAU,CAACG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;MACvB,OAAOH,UAAU,CAACF,IAAI,CAAC,GAAG,CAAC;IAC7B;EACF;EACA,OAAO,EAAE;AACX;AAEA,OAAO,SAASM,kBAAkBA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAW;EAC3E,MAAMC,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,GAAGH,CAAC,GAAG,KAAK,GAAGC,CAAC,GAAG,KAAK,GAAGC,CAAC,IAAI,GAAG;EAC/D,OAAOC,SAAS,GAAG,GAAG;AACxB;AAAC;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"core-palette.js","names":["Hct","TonalPalette","CorePalette","of","argb","contentOf","fromColors","colors","createPaletteFromColors","contentFromColors","content","palette","primary","secondary","p","a2","a1","tertiary","a3","error","neutral","n1","neutralVariant","n2","constructor","isContent","hct","fromInt","hue","chroma","fromHueAndChroma","Math","min","max"],"sources":["../../../../src/util/color/palettes/core-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\nimport { TonalPalette } from './tonal-palette';\n\n/**\n * Set of colors to generate a [CorePalette] from\n */\nexport interface CorePaletteColors {\n primary: number;\n secondary?: number;\n tertiary?: number;\n neutral?: number;\n neutralVariant?: number;\n error?: number;\n}\n\n/**\n * An intermediate concept between the key color for a UI theme, and a full\n * color scheme. 5 sets of tones are generated, all except one use the same hue\n * as the key color, and all vary in chroma.\n */\nexport class CorePalette {\n a1: TonalPalette;\n a2: TonalPalette;\n a3: TonalPalette;\n n1: TonalPalette;\n n2: TonalPalette;\n error: TonalPalette;\n\n /**\n * @param argb ARGB representation of a color\n */\n static of(argb: number): CorePalette {\n return new CorePalette(argb, false);\n }\n\n /**\n * @param argb ARGB representation of a color\n */\n static contentOf(argb: number): CorePalette {\n return new CorePalette(argb, true);\n }\n\n /**\n * Create a [CorePalette] from a set of colors\n */\n static fromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(false, colors);\n }\n\n /**\n * Create a content [CorePalette] from a set of colors\n */\n static contentFromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(true, colors);\n }\n\n private static createPaletteFromColors(\n content: boolean,\n colors: CorePaletteColors,\n ) {\n const palette = new CorePalette(colors.primary, content);\n if (colors.secondary) {\n const p = new CorePalette(colors.secondary, content);\n palette.a2 = p.a1;\n }\n if (colors.tertiary) {\n const p = new CorePalette(colors.tertiary, content);\n palette.a3 = p.a1;\n }\n if (colors.error) {\n const p = new CorePalette(colors.error, content);\n palette.error = p.a1;\n }\n if (colors.neutral) {\n const p = new CorePalette(colors.neutral, content);\n palette.n1 = p.n1;\n }\n if (colors.neutralVariant) {\n const p = new CorePalette(colors.neutralVariant, content);\n palette.n2 = p.n2;\n }\n return palette;\n }\n\n private constructor(argb: number, isContent: boolean) {\n const hct = Hct.fromInt(argb);\n const hue = hct.hue;\n const chroma = hct.chroma;\n if (isContent) {\n this.a1 = TonalPalette.fromHueAndChroma(hue, chroma);\n this.a2 = TonalPalette.fromHueAndChroma(hue, chroma / 3);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, chroma / 2);\n this.n1 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 12, 4));\n this.n2 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 6, 8));\n } else {\n this.a1 = TonalPalette.fromHueAndChroma(hue, Math.max(48, chroma));\n this.a2 = TonalPalette.fromHueAndChroma(hue, 16);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, 24);\n this.n1 = TonalPalette.fromHueAndChroma(hue, 4);\n this.n2 = TonalPalette.fromHueAndChroma(hue, 8);\n }\n this.error = TonalPalette.fromHueAndChroma(25, 84);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAAA,SACHC,YAAY;AAErB;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EAQvB;AACF;AACA;EACE,OAAOC,EAAEA,CAACC,IAAY,EAAe;IACnC,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAE,KAAK,CAAC;EACrC;;EAEA;AACF;AACA;EACE,OAAOC,SAASA,CAACD,IAAY,EAAe;IAC1C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAE,IAAI,CAAC;EACpC;;EAEA;AACF;AACA;EACE,OAAOE,UAAUA,CAACC,MAAyB,EAAe;IACxD,OAAOL,WAAW,CAACM,uBAAuB,CAAC,KAAK,EAAED,MAAM,CAAC;EAC3D;;EAEA;AACF;AACA;EACE,OAAOE,iBAAiBA,CAACF,MAAyB,EAAe;IAC/D,OAAOL,WAAW,CAACM,uBAAuB,CAAC,IAAI,EAAED,MAAM,CAAC;EAC1D;EAEA,OAAeC,uBAAuBA,CACpCE,OAAgB,EAChBH,MAAyB,EACzB;IACA,MAAMI,OAAO,GAAG,IAAIT,WAAW,CAACK,MAAM,CAACK,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EAAEC,MAAM,CAAC;MACpD,IAAI,CAACd,EAAE,GAAGd,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAEC,MAAM,GAAG,CAAC,CAAC;MACxD,IAAI,CAACX,EAAE,GAAGjB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,GAAG,EAAE,EAAEC,MAAM,GAAG,CAAC,CAAC;MAC7D,IAAI,CAACR,EAAE,GAAGpB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAEG,IAAI,CAACC,GAAG,CAACH,MAAM,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;MACtE,IAAI,CAACN,EAAE,GAAGtB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAEG,IAAI,CAACC,GAAG,CAACH,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC,MAAM;MACL,IAAI,CAACb,EAAE,GAAGf,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAEG,IAAI,CAACE,GAAG,CAAC,EAAE,EAAEJ,MAAM,CAAC,CAAC;MAClE,IAAI,CAACd,EAAE,GAAGd,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,EAAE,CAAC;MAChD,IAAI,CAACV,EAAE,GAAGjB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC;MACrD,IAAI,CAACP,EAAE,GAAGpB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,CAAC,CAAC;MAC/C,IAAI,CAACL,EAAE,GAAGtB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,CAAC,CAAC;IACjD;IACA,IAAI,CAACT,KAAK,GAAGlB,YAAY,CAAC6B,gBAAgB,CAAC,EAAE,EAAE,EAAE,CAAC;EACpD;AACF"}
1
+ {"version":3,"file":"core-palette.js","names":["Hct","TonalPalette","CorePalette","of","argb","contentOf","fromColors","colors","createPaletteFromColors","contentFromColors","content","palette","primary","secondary","p","a2","a1","tertiary","a3","error","neutral","n1","neutralVariant","n2","constructor","isContent","hct","fromInt","hue","chroma","fromHueAndChroma","Math","min","max"],"sources":["../../../../src/util/color/palettes/core-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\nimport { TonalPalette } from './tonal-palette';\n\n/**\n * Set of colors to generate a [CorePalette] from\n */\nexport interface CorePaletteColors {\n primary: number;\n secondary?: number;\n tertiary?: number;\n neutral?: number;\n neutralVariant?: number;\n error?: number;\n}\n\n/**\n * An intermediate concept between the key color for a UI theme, and a full\n * color scheme. 5 sets of tones are generated, all except one use the same hue\n * as the key color, and all vary in chroma.\n */\nexport class CorePalette {\n a1: TonalPalette;\n a2: TonalPalette;\n a3: TonalPalette;\n n1: TonalPalette;\n n2: TonalPalette;\n error: TonalPalette;\n\n /**\n * @param argb ARGB representation of a color\n */\n static of(argb: number): CorePalette {\n return new CorePalette(argb, false);\n }\n\n /**\n * @param argb ARGB representation of a color\n */\n static contentOf(argb: number): CorePalette {\n return new CorePalette(argb, true);\n }\n\n /**\n * Create a [CorePalette] from a set of colors\n */\n static fromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(false, colors);\n }\n\n /**\n * Create a content [CorePalette] from a set of colors\n */\n static contentFromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(true, colors);\n }\n\n private static createPaletteFromColors(\n content: boolean,\n colors: CorePaletteColors,\n ) {\n const palette = new CorePalette(colors.primary, content);\n if (colors.secondary) {\n const p = new CorePalette(colors.secondary, content);\n palette.a2 = p.a1;\n }\n if (colors.tertiary) {\n const p = new CorePalette(colors.tertiary, content);\n palette.a3 = p.a1;\n }\n if (colors.error) {\n const p = new CorePalette(colors.error, content);\n palette.error = p.a1;\n }\n if (colors.neutral) {\n const p = new CorePalette(colors.neutral, content);\n palette.n1 = p.n1;\n }\n if (colors.neutralVariant) {\n const p = new CorePalette(colors.neutralVariant, content);\n palette.n2 = p.n2;\n }\n return palette;\n }\n\n private constructor(argb: number, isContent: boolean) {\n const hct = Hct.fromInt(argb);\n const hue = hct.hue;\n const chroma = hct.chroma;\n if (isContent) {\n this.a1 = TonalPalette.fromHueAndChroma(hue, chroma);\n this.a2 = TonalPalette.fromHueAndChroma(hue, chroma / 3);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, chroma / 2);\n this.n1 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 12, 4));\n this.n2 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 6, 8));\n } else {\n this.a1 = TonalPalette.fromHueAndChroma(hue, Math.max(48, chroma));\n this.a2 = TonalPalette.fromHueAndChroma(hue, 16);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, 24);\n this.n1 = TonalPalette.fromHueAndChroma(hue, 4);\n this.n2 = TonalPalette.fromHueAndChroma(hue, 8);\n }\n this.error = TonalPalette.fromHueAndChroma(25, 84);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAAA,SACHC,YAAY;AAErB;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EAQvB;AACF;AACA;EACE,OAAOC,EAAEA,CAACC,IAAY,EAAe;IACnC,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAE,KAAK,CAAC;EACrC;;EAEA;AACF;AACA;EACE,OAAOC,SAASA,CAACD,IAAY,EAAe;IAC1C,OAAO,IAAI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E,EAAE,EAAE,CAAC;MACrD,IAAI,CAACP,EAAE,GAAGpB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,CAAC,CAAC;MAC/C,IAAI,CAACL,EAAE,GAAGtB,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,CAAC,CAAC;IACjD;IACA,IAAI,CAACT,KAAK,GAAGlB,YAAY,CAAC6B,gBAAgB,CAAC,EAAE,EAAE,EAAE,CAAC;EACpD;AACF","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2021 Google LLC
@@ -1 +1 @@
1
- {"version":3,"file":"tonal-palette.js","names":["Hct","TonalPalette","fromInt","argb","hct","fromHct","hue","chroma","fromHueAndChroma","createKeyColor","constructor","keyColor","_defineProperty","Map","startTone","smallestDeltaHct","from","smallestDelta","Math","abs","delta","round","hctAdd","hctAddDelta","hctSubtract","hctSubtractDelta","tone","cache","get","undefined","toInt","set","getHct"],"sources":["../../../../src/util/color/palettes/tonal-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\n\n/**\n * A convenience class for retrieving colors that are constant in hue and\n * chroma, but vary in tone.\n */\nexport class TonalPalette {\n private readonly cache = new Map<number, number>();\n\n /**\n * @param argb ARGB representation of a color\n * @return Tones matching that color's hue and chroma.\n */\n static fromInt(argb: number): TonalPalette {\n const hct = Hct.fromInt(argb);\n return TonalPalette.fromHct(hct);\n }\n\n /**\n * @param hct Hct\n * @return Tones matching that color's hue and chroma.\n */\n static fromHct(hct: Hct) {\n return new TonalPalette(hct.hue, hct.chroma, hct);\n }\n\n /**\n * @param hue HCT hue\n * @param chroma HCT chroma\n * @return Tones matching hue and chroma.\n */\n static fromHueAndChroma(hue: number, chroma: number): TonalPalette {\n return new TonalPalette(\n hue,\n chroma,\n TonalPalette.createKeyColor(hue, chroma),\n );\n }\n\n private constructor(\n readonly hue: number,\n readonly chroma: number,\n readonly keyColor: Hct,\n ) {}\n\n private static createKeyColor(hue: number, chroma: number): Hct {\n const startTone = 50.0;\n let smallestDeltaHct = Hct.from(hue, chroma, startTone);\n let smallestDelta = Math.abs(smallestDeltaHct.chroma - chroma);\n // Starting from T50, check T+/-delta to see if they match the requested\n // chroma.\n //\n // Starts from T50 because T50 has the most chroma available, on\n // average. Thus it is most likely to have a direct answer and minimize\n // iteration.\n for (let delta = 1.0; delta < 50.0; delta += 1.0) {\n // Termination condition rounding instead of minimizing delta to avoid\n // case where requested chroma is 16.51, and the closest chroma is 16.49.\n // Error is minimized, but when rounded and displayed, requested chroma\n // is 17, key color's chroma is 16.\n if (Math.round(chroma) === Math.round(smallestDeltaHct.chroma)) {\n return smallestDeltaHct;\n }\n\n const hctAdd = Hct.from(hue, chroma, startTone + delta);\n const hctAddDelta = Math.abs(hctAdd.chroma - chroma);\n if (hctAddDelta < smallestDelta) {\n smallestDelta = hctAddDelta;\n smallestDeltaHct = hctAdd;\n }\n\n const hctSubtract = Hct.from(hue, chroma, startTone - delta);\n const hctSubtractDelta = Math.abs(hctSubtract.chroma - chroma);\n if (hctSubtractDelta < smallestDelta) {\n smallestDelta = hctSubtractDelta;\n smallestDeltaHct = hctSubtract;\n }\n }\n\n return smallestDeltaHct;\n }\n\n /**\n * @param tone HCT tone, measured from 0 to 100.\n * @return ARGB representation of a color with that tone.\n */\n tone(tone: number): number {\n let argb = this.cache.get(tone);\n if (argb === undefined) {\n argb = Hct.from(this.hue, this.chroma, tone).toInt();\n this.cache.set(tone, argb);\n }\n return argb;\n }\n\n /**\n * @param tone HCT tone.\n * @return HCT representation of a color with that tone.\n */\n getHct(tone: number): Hct {\n return Hct.fromInt(this.tone(tone));\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EAGxB;AACF;AACA;AACA;EACE,OAAOC,OAAOA,CAACC,IAAY,EAAgB;IACzC,MAAMC,GAAG,GAAGJ,GAAG,CAACE,OAAO,CAACC,IAAI,CAAC;IAC7B,OAAOF,YAAY,CAACI,OAAO,CAACD,GAAG,CAAC;EAClC;;EAEA;AACF;AACA;AACA;EACE,OAAOC,OAAOA,CAACD,GAAQ,EAAE;IACvB,OAAO,IAAIH,YAAY,CAACG,GAAG,CAACE,GAAG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N,aAAa,EAAE;QAC/BA,aAAa,GAAGM,WAAW;QAC3BR,gBAAgB,GAAGO,MAAM;MAC3B;MAEA,MAAME,WAAW,GAAGxB,GAAG,CAACgB,IAAI,CAACV,GAAG,EAAEC,MAAM,EAAEO,SAAS,GAAGM,KAAK,CAAC;MAC5D,MAAMK,gBAAgB,GAAGP,IAAI,CAACC,GAAG,CAACK,WAAW,CAACjB,MAAM,GAAGA,MAAM,CAAC;MAC9D,IAAIkB,gBAAgB,GAAGR,aAAa,EAAE;QACpCA,aAAa,GAAGQ,gBAAgB;QAChCV,gBAAgB,GAAGS,WAAW;MAChC;IACF;IAEA,OAAOT,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;EACEW,IAAIA,CAACA,IAAY,EAAU;IACzB,IAAIvB,IAAI,GAAG,IAAI,CAACwB,KAAK,CAACC,GAAG,CAACF,IAAI,CAAC;IAC/B,IAAIvB,IAAI,KAAK0B,SAAS,EAAE;MACtB1B,IAAI,GAAGH,GAAG,CAACgB,IAAI,CAAC,IAAI,CAACV,GAAG,EAAE,IAAI,CAACC,MAAM,EAAEmB,IAAI,CAAC,CAACI,KAAK,CAAC,CAAC;MACpD,IAAI,CAACH,KAAK,CAACI,GAAG,CAACL,IAAI,EAAEvB,IAAI,CAAC;IAC5B;IACA,OAAOA,IAAI;EACb;;EAEA;AACF;AACA;AACA;EACE6B,MAAMA,CAACN,IAAY,EAAO;IACxB,OAAO1B,GAAG,CAACE,OAAO,CAAC,IAAI,CAACwB,IAAI,CAACA,IAAI,CAAC,CAAC;EACrC;AACF"}
1
+ {"version":3,"file":"tonal-palette.js","names":["Hct","TonalPalette","fromInt","argb","hct","fromHct","hue","chroma","fromHueAndChroma","createKeyColor","constructor","keyColor","_defineProperty","Map","startTone","smallestDeltaHct","from","smallestDelta","Math","abs","delta","round","hctAdd","hctAddDelta","hctSubtract","hctSubtractDelta","tone","cache","get","undefined","toInt","set","getHct"],"sources":["../../../../src/util/color/palettes/tonal-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\n\n/**\n * A convenience class for retrieving colors that are constant in hue and\n * chroma, but vary in tone.\n */\nexport class TonalPalette {\n private readonly cache = new Map<number, number>();\n\n /**\n * @param argb ARGB representation of a color\n * @return Tones matching that color's hue and chroma.\n */\n static fromInt(argb: number): TonalPalette {\n const hct = Hct.fromInt(argb);\n return TonalPalette.fromHct(hct);\n }\n\n /**\n * @param hct Hct\n * @return Tones matching that color's hue and chroma.\n */\n static fromHct(hct: Hct) {\n return new TonalPalette(hct.hue, hct.chroma, hct);\n }\n\n /**\n * @param hue HCT hue\n * @param chroma HCT chroma\n * @return Tones matching hue and chroma.\n */\n static fromHueAndChroma(hue: number, chroma: number): TonalPalette {\n return new TonalPalette(\n hue,\n chroma,\n TonalPalette.createKeyColor(hue, chroma),\n );\n }\n\n private constructor(\n readonly hue: number,\n readonly chroma: number,\n readonly keyColor: Hct,\n ) {}\n\n private static createKeyColor(hue: number, chroma: number): Hct {\n const startTone = 50.0;\n let smallestDeltaHct = Hct.from(hue, chroma, startTone);\n let smallestDelta = Math.abs(smallestDeltaHct.chroma - chroma);\n // Starting from T50, check T+/-delta to see if they match the requested\n // chroma.\n //\n // Starts from T50 because T50 has the most chroma available, on\n // average. Thus it is most likely to have a direct answer and minimize\n // iteration.\n for (let delta = 1.0; delta < 50.0; delta += 1.0) {\n // Termination condition rounding instead of minimizing delta to avoid\n // case where requested chroma is 16.51, and the closest chroma is 16.49.\n // Error is minimized, but when rounded and displayed, requested chroma\n // is 17, key color's chroma is 16.\n if (Math.round(chroma) === Math.round(smallestDeltaHct.chroma)) {\n return smallestDeltaHct;\n }\n\n const hctAdd = Hct.from(hue, chroma, startTone + delta);\n const hctAddDelta = Math.abs(hctAdd.chroma - chroma);\n if (hctAddDelta < smallestDelta) {\n smallestDelta = hctAddDelta;\n smallestDeltaHct = hctAdd;\n }\n\n const hctSubtract = Hct.from(hue, chroma, startTone - delta);\n const hctSubtractDelta = Math.abs(hctSubtract.chroma - chroma);\n if (hctSubtractDelta < smallestDelta) {\n smallestDelta = hctSubtractDelta;\n smallestDeltaHct = hctSubtract;\n }\n }\n\n return smallestDeltaHct;\n }\n\n /**\n * @param tone HCT tone, measured from 0 to 100.\n * @return ARGB representation of a color with that tone.\n */\n tone(tone: number): number {\n let argb = this.cache.get(tone);\n if (argb === undefined) {\n argb = Hct.from(this.hue, this.chroma, tone).toInt();\n this.cache.set(tone, argb);\n }\n return argb;\n }\n\n /**\n * @param tone HCT tone.\n * @return HCT representation of a color with that tone.\n */\n getHct(tone: number): Hct {\n return Hct.fromInt(this.tone(tone));\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EAGxB;AACF;AACA;AACA;EACE,OAAOC,OAAOA,CAACC,IAAY,EAAgB;IACzC,MAAMC,GAAG,GAAGJ,GAAG,CAACE,OAAO,CAACC,IAAI,CAAC;IAC7B,OAAOF,YAAY,CAACI,OAAO,CAACD,GAAG,CAAC;EAClC;;EAEA;AACF;AACA;AACA;EACE,OAAOC,OAAOA,CAACD,GAAQ,EAAE;IACvB,OAAO,IAAIH,YAAY,CAACG,GAAG,CAACE,GAAG,EAAEF,GAAG,CAACG,MAAM,EAAEH,GAAG,CAAC;EACnD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOI,gBAAgBA,CAACF,GAAW,EA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ACgB,IAAI,CAACV,GAAG,EAAEC,MAAM,EAAEO,SAAS,GAAGM,KAAK,CAAC;MAC5D,MAAMK,gBAAgB,GAAGP,IAAI,CAACC,GAAG,CAACK,WAAW,CAACjB,MAAM,GAAGA,MAAM,CAAC;MAC9D,IAAIkB,gBAAgB,GAAGR,aAAa,EAAE;QACpCA,aAAa,GAAGQ,gBAAgB;QAChCV,gBAAgB,GAAGS,WAAW;MAChC;IACF;IAEA,OAAOT,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;EACEW,IAAIA,CAACA,IAAY,EAAU;IACzB,IAAIvB,IAAI,GAAG,IAAI,CAACwB,KAAK,CAACC,GAAG,CAACF,IAAI,CAAC;IAC/B,IAAIvB,IAAI,KAAK0B,SAAS,EAAE;MACtB1B,IAAI,GAAGH,GAAG,CAACgB,IAAI,CAAC,IAAI,CAACV,GAAG,EAAE,IAAI,CAACC,MAAM,EAAEmB,IAAI,CAAC,CAACI,KAAK,CAAC,CAAC;MACpD,IAAI,CAACH,KAAK,CAACI,GAAG,CAACL,IAAI,EAAEvB,IAAI,CAAC;IAC5B;IACA,OAAOA,IAAI;EACb;;EAEA;AACF;AACA;AACA;EACE6B,MAAMA,CAACN,IAAY,EAAO;IACxB,OAAO1B,GAAG,CAACE,OAAO,CAAC,IAAI,CAACwB,IAAI,CAACA,IAAI,CAAC,CAAC;EACrC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/util/color/types.ts"],"sourcesContent":["/**\r\n * RGBA component\r\n *\r\n * @param r Red value should be between 0-255\r\n * @param g Green value should be between 0-255\r\n * @param b Blue value should be between 0-255\r\n * @param a Alpha value should be between 0-255\r\n */\r\nexport interface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/util/color/types.ts"],"sourcesContent":["/**\n * RGBA component\n *\n * @param r Red value should be between 0-255\n * @param g Green value should be between 0-255\n * @param b Blue value should be between 0-255\n * @param a Alpha value should be between 0-255\n */\nexport interface Rgba {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,28 +1,28 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
16
  */
17
17
 
18
- /**
19
- * Utility methods for mathematical operations.
18
+ /**
19
+ * Utility methods for mathematical operations.
20
20
  */
21
21
 
22
- /**
23
- * The signum function.
24
- *
25
- * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
22
+ /**
23
+ * The signum function.
24
+ *
25
+ * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
26
26
  */
27
27
  export function signum(num) {
28
28
  if (num < 0) {
@@ -34,20 +34,20 @@ export function signum(num) {
34
34
  }
35
35
  }
36
36
 
37
- /**
38
- * The linear interpolation function.
39
- *
40
- * @return start if amount = 0 and stop if amount = 1
37
+ /**
38
+ * The linear interpolation function.
39
+ *
40
+ * @return start if amount = 0 and stop if amount = 1
41
41
  */
42
42
  export function lerp(start, stop, amount) {
43
43
  return (1.0 - amount) * start + amount * stop;
44
44
  }
45
45
 
46
- /**
47
- * Clamps an integer between two integers.
48
- *
49
- * @return input when min <= input <= max, and either min or max
50
- * otherwise.
46
+ /**
47
+ * Clamps an integer between two integers.
48
+ *
49
+ * @return input when min <= input <= max, and either min or max
50
+ * otherwise.
51
51
  */
52
52
  export function clampInt(min, max, input) {
53
53
  if (input < min) {
@@ -58,11 +58,11 @@ export function clampInt(min, max, input) {
58
58
  return input;
59
59
  }
60
60
 
61
- /**
62
- * Clamps an integer between two floating-point numbers.
63
- *
64
- * @return input when min <= input <= max, and either min or max
65
- * otherwise.
61
+ /**
62
+ * Clamps an integer between two floating-point numbers.
63
+ *
64
+ * @return input when min <= input <= max, and either min or max
65
+ * otherwise.
66
66
  */
67
67
  export function clampDouble(min, max, input) {
68
68
  if (input < min) {
@@ -73,11 +73,11 @@ export function clampDouble(min, max, input) {
73
73
  return input;
74
74
  }
75
75
 
76
- /**
77
- * Sanitizes a degree measure as an integer.
78
- *
79
- * @return a degree measure between 0 (inclusive) and 360
80
- * (exclusive).
76
+ /**
77
+ * Sanitizes a degree measure as an integer.
78
+ *
79
+ * @return a degree measure between 0 (inclusive) and 360
80
+ * (exclusive).
81
81
  */
82
82
  export function sanitizeDegreesInt(degrees) {
83
83
  degrees = degrees % 360;
@@ -87,11 +87,11 @@ export function sanitizeDegreesInt(degrees) {
87
87
  return degrees;
88
88
  }
89
89
 
90
- /**
91
- * Sanitizes a degree measure as a floating-point number.
92
- *
93
- * @return a degree measure between 0.0 (inclusive) and 360.0
94
- * (exclusive).
90
+ /**
91
+ * Sanitizes a degree measure as a floating-point number.
92
+ *
93
+ * @return a degree measure between 0.0 (inclusive) and 360.0
94
+ * (exclusive).
95
95
  */
96
96
  export function sanitizeDegreesDouble(degrees) {
97
97
  degrees = degrees % 360.0;
@@ -101,34 +101,34 @@ export function sanitizeDegreesDouble(degrees) {
101
101
  return degrees;
102
102
  }
103
103
 
104
- /**
105
- * Sign of direction change needed to travel from one angle to
106
- * another.
107
- *
108
- * For angles that are 180 degrees apart from each other, both
109
- * directions have the same travel distance, so either direction is
110
- * shortest. The value 1.0 is returned in this case.
111
- *
112
- * @param from The angle travel starts from, in degrees.
113
- * @param to The angle travel ends at, in degrees.
114
- * @return -1 if decreasing from leads to the shortest travel
115
- * distance, 1 if increasing from leads to the shortest travel
116
- * distance.
104
+ /**
105
+ * Sign of direction change needed to travel from one angle to
106
+ * another.
107
+ *
108
+ * For angles that are 180 degrees apart from each other, both
109
+ * directions have the same travel distance, so either direction is
110
+ * shortest. The value 1.0 is returned in this case.
111
+ *
112
+ * @param from The angle travel starts from, in degrees.
113
+ * @param to The angle travel ends at, in degrees.
114
+ * @return -1 if decreasing from leads to the shortest travel
115
+ * distance, 1 if increasing from leads to the shortest travel
116
+ * distance.
117
117
  */
118
118
  export function rotationDirection(from, to) {
119
119
  const increasingDifference = sanitizeDegreesDouble(to - from);
120
120
  return increasingDifference <= 180.0 ? 1.0 : -1.0;
121
121
  }
122
122
 
123
- /**
124
- * Distance of two points on a circle, represented using degrees.
123
+ /**
124
+ * Distance of two points on a circle, represented using degrees.
125
125
  */
126
126
  export function differenceDegrees(a, b) {
127
127
  return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
128
128
  }
129
129
 
130
- /**
131
- * Multiplies a 1x3 row vector with a 3x3 matrix.
130
+ /**
131
+ * Multiplies a 1x3 row vector with a 3x3 matrix.
132
132
  */
133
133
  export function matrixMultiply(row, matrix) {
134
134
  const a = row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
@@ -1 +1 @@
1
- {"version":3,"file":"math-utils.js","names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sources":["../../../../src/util/color/utils/math-utils.ts"],"sourcesContent":["/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Utility methods for mathematical operations.\r\n */\r\n\r\n/**\r\n * The signum function.\r\n *\r\n * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0\r\n */\r\nexport function signum(num: number): number {\r\n if (num < 0) {\r\n return -1;\r\n } else if (num === 0) {\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n}\r\n\r\n/**\r\n * The linear interpolation function.\r\n *\r\n * @return start if amount = 0 and stop if amount = 1\r\n */\r\nexport function lerp(start: number, stop: number, amount: number): number {\r\n return (1.0 - amount) * start + amount * stop;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two integers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampInt(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two floating-point numbers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampDouble(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as an integer.\r\n *\r\n * @return a degree measure between 0 (inclusive) and 360\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesInt(degrees: number): number {\r\n degrees = degrees % 360;\r\n if (degrees < 0) {\r\n degrees = degrees + 360;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as a floating-point number.\r\n *\r\n * @return a degree measure between 0.0 (inclusive) and 360.0\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesDouble(degrees: number): number {\r\n degrees = degrees % 360.0;\r\n if (degrees < 0) {\r\n degrees = degrees + 360.0;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sign of direction change needed to travel from one angle to\r\n * another.\r\n *\r\n * For angles that are 180 degrees apart from each other, both\r\n * directions have the same travel distance, so either direction is\r\n * shortest. The value 1.0 is returned in this case.\r\n *\r\n * @param from The angle travel starts from, in degrees.\r\n * @param to The angle travel ends at, in degrees.\r\n * @return -1 if decreasing from leads to the shortest travel\r\n * distance, 1 if increasing from leads to the shortest travel\r\n * distance.\r\n */\r\nexport function rotationDirection(from: number, to: number): number {\r\n const increasingDifference = sanitizeDegreesDouble(to - from);\r\n return increasingDifference <= 180.0 ? 1.0 : -1.0;\r\n}\r\n\r\n/**\r\n * Distance of two points on a circle, represented using degrees.\r\n */\r\nexport function differenceDegrees(a: number, b: number): number {\r\n return 180.0 - Math.abs(Math.abs(a - b) - 180.0);\r\n}\r\n\r\n/**\r\n * Multiplies a 1x3 row vector with a 3x3 matrix.\r\n */\r\nexport function matrixMultiply(row: number[], matrix: number[][]): number[] {\r\n const a =\r\n row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];\r\n const b =\r\n row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];\r\n const c =\r\n row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];\r\n return [a, b, c];\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,GAAW,EA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AC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,OAAO,CAACN,CAAC,EAAEC,CAAC,EAAEM,CAAC,CAAC;AAClB"}
1
+ {"version":3,"file":"math-utils.js","names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sources":["../../../../src/util/color/utils/math-utils.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Utility methods for mathematical operations.\n */\n\n/**\n * The signum function.\n *\n * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0\n */\nexport function signum(num: number): number {\n if (num < 0) {\n return -1;\n } else if (num === 0) {\n return 0;\n } else {\n return 1;\n }\n}\n\n/**\n * The linear interpolation function.\n *\n * @return start if amount = 0 and stop if amount = 1\n */\nexport function lerp(start: number, stop: number, amount: number): number {\n return (1.0 - amount) * start + amount * stop;\n}\n\n/**\n * Clamps an integer between two integers.\n *\n * @return input when min <= input <= max, and either min or max\n * otherwise.\n */\nexport function clampInt(min: number, max: number, input: number): number {\n if (input < min) {\n return min;\n } else if (input > max) {\n return max;\n }\n\n return input;\n}\n\n/**\n * Clamps an integer between two floating-point numbers.\n *\n * @return input when min <= input <= max, and either min or max\n * otherwise.\n */\nexport function clampDouble(min: number, max: number, input: number): number {\n if (input < min) {\n return min;\n } else if (input > max) {\n return max;\n }\n\n return input;\n}\n\n/**\n * Sanitizes a degree measure as an integer.\n *\n * @return a degree measure between 0 (inclusive) and 360\n * (exclusive).\n */\nexport function sanitizeDegreesInt(degrees: number): number {\n degrees = degrees % 360;\n if (degrees < 0) {\n degrees = degrees + 360;\n }\n return degrees;\n}\n\n/**\n * Sanitizes a degree measure as a floating-point number.\n *\n * @return a degree measure between 0.0 (inclusive) and 360.0\n * (exclusive).\n */\nexport function sanitizeDegreesDouble(degrees: number): number {\n degrees = degrees % 360.0;\n if (degrees < 0) {\n degrees = degrees + 360.0;\n }\n return degrees;\n}\n\n/**\n * Sign of direction change needed to travel from one angle to\n * another.\n *\n * For angles that are 180 degrees apart from each other, both\n * directions have the same travel distance, so either direction is\n * shortest. The value 1.0 is returned in this case.\n *\n * @param from The angle travel starts from, in degrees.\n * @param to The angle travel ends at, in degrees.\n * @return -1 if decreasing from leads to the shortest travel\n * distance, 1 if increasing from leads to the shortest travel\n * distance.\n */\nexport function rotationDirection(from: number, to: number): number {\n const increasingDifference = sanitizeDegreesDouble(to - from);\n return increasingDifference <= 180.0 ? 1.0 : -1.0;\n}\n\n/**\n * Distance of two points on a circle, represented using degrees.\n */\nexport function differenceDegrees(a: number, b: number): number {\n return 180.0 - Math.abs(Math.abs(a - b) - 180.0);\n}\n\n/**\n * Multiplies a 1x3 row vector with a 3x3 matrix.\n */\nexport function matrixMultiply(row: number[], matrix: number[][]): number[] {\n const a =\n row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];\n const b =\n row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];\n const c =\n row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];\n return [a, b, c];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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ACLF,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,OAAO,CAACN,CAAC,EAAEC,CAAC,EAAEM,CAAC,CAAC;AAClB","ignoreList":[]}
@@ -1,6 +1,9 @@
1
+ /** biome-ignore-all lint/suspicious/useIterableCallbackReturn: <explanation> */
2
+
3
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
1
4
  export function hasOwnProperty(object, property) {
2
5
  if (object) {
3
- return Object.prototype.hasOwnProperty.call(object, property);
6
+ return Object.hasOwn(object, property);
4
7
  }
5
8
  return false;
6
9
  }
@@ -33,7 +36,7 @@ export function mergeDeep() {
33
36
  continue;
34
37
  }
35
38
  }
36
- if (typeof sourceValue === 'object' && typeof overwriteValue === 'object') {
39
+ if (typeof sourceValue === "object" && typeof overwriteValue === "object") {
37
40
  ret[key] = mergeDeep(sourceValue, overwriteValue, arrayFn);
38
41
  continue;
39
42
  }
@@ -44,26 +47,26 @@ export function mergeDeep() {
44
47
  export function getObjectValueByPath(obj, path, fallback) {
45
48
  // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621
46
49
  let traversPath = path;
47
- if (obj == null || !traversPath || typeof traversPath !== 'string') {
50
+ if (obj == null || !traversPath || typeof traversPath !== "string") {
48
51
  return fallback;
49
52
  }
50
53
  if (obj[traversPath] !== undefined) return obj[traversPath];
51
- traversPath = traversPath.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
52
- traversPath = traversPath.replace(/^\./, ''); // strip a leading dot
53
- return getNestedValue(obj, traversPath.split('.'), fallback);
54
+ traversPath = traversPath.replace(/\[(\w+)\]/g, ".$1"); // convert indexes to properties
55
+ traversPath = traversPath.replace(/^\./, ""); // strip a leading dot
56
+ return getNestedValue(obj, traversPath.split("."), fallback);
54
57
  }
55
58
  export function getPropertyFromItem(item, property, fallback) {
56
59
  if (property == null) return item === undefined ? fallback : item;
57
60
  if (item !== Object(item)) {
58
- if (typeof property !== 'function') return fallback;
61
+ if (typeof property !== "function") return fallback;
59
62
  const value = property(item, fallback);
60
- return typeof value === 'undefined' ? fallback : value;
63
+ return typeof value === "undefined" ? fallback : value;
61
64
  }
62
- if (typeof property === 'string') return getObjectValueByPath(item, property, fallback);
65
+ if (typeof property === "string") return getObjectValueByPath(item, property, fallback);
63
66
  if (Array.isArray(property)) return getNestedValue(item, property, fallback);
64
- if (typeof property !== 'function') return fallback;
67
+ if (typeof property !== "function") return fallback;
65
68
  const value = property(item, fallback);
66
- return typeof value === 'undefined' ? fallback : value;
69
+ return typeof value === "undefined" ? fallback : value;
67
70
  }
68
71
  export function clamp(value) {
69
72
  let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -92,10 +95,10 @@ export function deepEqual(a, b) {
92
95
  }
93
96
  export function isObject(obj) {
94
97
  const type = typeof obj;
95
- return obj !== null && (type === 'object' || type === 'function');
98
+ return obj !== null && (type === "object" || type === "function");
96
99
  }
97
100
  export function isEmpty(target) {
98
- return target == null || target?.trim() === '';
101
+ return target == null || target?.trim() === "";
99
102
  }
100
103
  export function omit(obj, excludes) {
101
104
  const ret = {
@@ -104,4 +107,16 @@ export function omit(obj, excludes) {
104
107
  excludes.forEach(prop => delete ret[prop]);
105
108
  return ret;
106
109
  }
110
+ export const noop = () => void 0;
111
+ export function makeEventPromiseLike(event, promise) {
112
+ const promiseMethods = ["then", "catch", "finally"];
113
+ promiseMethods.forEach(method => {
114
+ Object.defineProperty(event, method, {
115
+ value: promise[method].bind(promise),
116
+ writable: false,
117
+ enumerable: false
118
+ });
119
+ });
120
+ return event;
121
+ }
107
122
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","names":["hasOwnProperty","object","property","Object","prototype","call","getNestedValue","obj","path","fallback","last","length","traversObj","undefined","i","mergeDeep","source","arguments","overwrite","arrayFn","ret","key","sourceValue","overwriteValue","Array","isArray","getObjectValueByPath","traversPath","replace","split","getPropertyFromItem","item","value","clamp","min","max","Math","getRangeArr","start","from","v","k","deepEqual","a","b","Date","getTime","props","keys","every","p","isObject","type","isEmpty","target","trim","omit","excludes","forEach","prop"],"sources":["../../src/util/common.ts"],"sourcesContent":["export function hasOwnProperty(object: any, property: string) {\n if (object) {\n return Object.prototype.hasOwnProperty.call(object, property);\n }\n return false;\n}\n\nexport function getNestedValue(\n obj: any,\n path: (string | number)[],\n fallback?: any,\n): any {\n const last = path.length - 1;\n let traversObj = obj;\n\n if (last < 0) return traversObj === undefined ? fallback : traversObj;\n\n for (let i = 0; i < last; i += 1) {\n if (traversObj == null) {\n return fallback;\n }\n traversObj = traversObj[path[i]];\n }\n\n if (traversObj == null) return fallback;\n\n return traversObj[path[last]] === undefined\n ? fallback\n : traversObj[path[last]];\n}\n\nexport function mergeDeep(\n source: Record<string, any> = {},\n overwrite: Record<string, any> = {},\n arrayFn?: (source: unknown[], overwrite: unknown[]) => unknown[],\n) {\n const ret = { ...source };\n for (const key in overwrite) {\n const sourceValue = ret[key];\n const overwriteValue = overwrite[key];\n\n if (Array.isArray(sourceValue) && Array.isArray(overwriteValue)) {\n if (arrayFn) {\n ret[key] = arrayFn(sourceValue, overwriteValue);\n continue;\n }\n }\n\n if (typeof sourceValue === 'object' && typeof overwriteValue === 'object') {\n ret[key] = mergeDeep(sourceValue, overwriteValue, arrayFn);\n continue;\n }\n\n ret[key] = overwriteValue;\n }\n return ret;\n}\n\nexport function getObjectValueByPath(\n obj: any,\n path: string,\n fallback?: any,\n): any {\n // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621\n let traversPath = path;\n if (obj == null || !traversPath || typeof traversPath !== 'string') {\n return fallback;\n }\n if (obj[traversPath] !== undefined) return obj[traversPath];\n traversPath = traversPath.replace(/\\[(\\w+)\\]/g, '.$1'); // convert indexes to properties\n traversPath = traversPath.replace(/^\\./, ''); // strip a leading dot\n return getNestedValue(obj, traversPath.split('.'), fallback);\n}\n\nexport type SelectItemKey =\n | boolean // Ignored\n | string // Lookup by key, can use dot notation for nested objects\n | (string | number)[] // Nested lookup by key, each array item is a key in the next level\n | ((item: Record<string, any>, fallback?: any) => any);\n\nexport function getPropertyFromItem(\n item: any,\n property: SelectItemKey,\n fallback?: any,\n): any {\n if (property == null) return item === undefined ? fallback : item;\n\n if (item !== Object(item)) {\n if (typeof property !== 'function') return fallback;\n\n const value = property(item, fallback);\n\n return typeof value === 'undefined' ? fallback : value;\n }\n\n if (typeof property === 'string')\n return getObjectValueByPath(item, property, fallback);\n\n if (Array.isArray(property)) return getNestedValue(item, property, fallback);\n\n if (typeof property !== 'function') return fallback;\n\n const value = property(item, fallback);\n\n return typeof value === 'undefined' ? fallback : value;\n}\n\nexport function clamp(value: number, min = 0, max = 1) {\n return Math.max(min, Math.min(max, value));\n}\n\nexport function getRangeArr(length: number, start = 0) {\n return Array.from({ length }, (v, k) => start + k);\n}\n\nexport function deepEqual(a: any, b: any): boolean {\n if (a === b) return true;\n\n if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {\n return false;\n }\n\n if (a !== Object(a) || b !== Object(b)) {\n return false;\n }\n const props = Object.keys(a);\n if (props.length !== Object.keys(b).length) {\n return false;\n }\n return props.every((p) => deepEqual(a[p], b[p]));\n}\n\nexport function isObject(obj: unknown) {\n const type = typeof obj;\n return obj !== null && (type === 'object' || type === 'function');\n}\n\nexport function isEmpty(target: any) {\n return target == null || target?.trim() === '';\n}\n\nexport function omit<T extends object, U extends Extract<keyof T, string>>(\n obj: T,\n excludes: U[],\n): Omit<T, U> {\n const ret = { ...obj };\n excludes.forEach((prop) => delete ret[prop]);\n return ret;\n}\n"],"mappings":"AAAA,OAAO,SAASA,cAAcA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AAI,IAAIA,MAAM,EAAEC,IAAI,CAAC,CAAC,KAAK,EAAE;AAChD;AAEA,OAAO,SAASC,IAAIA,CAClBjD,GAAM,EACNkD,QAAa,EACD;EACZ,MAAMrC,GAAG,GAAG;IAAE,GAAGb;EAAI,CAAC;EACtBkD,QAAQ,CAACC,OAAO,CAAEC,IAAI,IAAK,OAAOvC,GAAG,CAACuC,IAAI,CAAC,CAAC;EAC5C,OAAOvC,GAAG;AACZ"}
1
+ {"version":3,"file":"common.js","names":["hasOwnProperty","object","property","Object","hasOwn","getNestedValue","obj","path","fallback","last","length","traversObj","undefined","i","mergeDeep","source","arguments","overwrite","arrayFn","ret","key","sourceValue","overwriteValue","Array","isArray","getObjectValueByPath","traversPath","replace","split","getPropertyFromItem","item","value","clamp","min","max","Math","getRangeArr","start","from","v","k","deepEqual","a","b","Date","getTime","props","keys","every","p","isObject","type","isEmpty","target","trim","omit","excludes","forEach","prop","noop","makeEventPromiseLike","event","promise","promiseMethods","method","defineProperty","bind","writable","enumerable"],"sources":["../../src/util/common.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/useIterableCallbackReturn: <explanation> */\n\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nexport function hasOwnProperty(object: any, property: string) {\n if (object) {\n return Object.hasOwn(object, property);\n }\n return false;\n}\n\nexport function getNestedValue(\n obj: any,\n path: (string | number)[],\n fallback?: any\n): any {\n const last = path.length - 1;\n let traversObj = obj;\n\n if (last < 0) return traversObj === undefined ? fallback : traversObj;\n\n for (let i = 0; i < last; i += 1) {\n if (traversObj == null) {\n return fallback;\n }\n traversObj = traversObj[path[i]];\n }\n\n if (traversObj == null) return fallback;\n\n return traversObj[path[last]] === undefined\n ? fallback\n : traversObj[path[last]];\n}\n\nexport function mergeDeep(\n source: Record<string, any> = {},\n overwrite: Record<string, any> = {},\n arrayFn?: (source: unknown[], overwrite: unknown[]) => unknown[]\n) {\n const ret = { ...source };\n for (const key in overwrite) {\n const sourceValue = ret[key];\n const overwriteValue = overwrite[key];\n\n if (Array.isArray(sourceValue) && Array.isArray(overwriteValue)) {\n if (arrayFn) {\n ret[key] = arrayFn(sourceValue, overwriteValue);\n continue;\n }\n }\n\n if (typeof sourceValue === \"object\" && typeof overwriteValue === \"object\") {\n ret[key] = mergeDeep(sourceValue, overwriteValue, arrayFn);\n continue;\n }\n\n ret[key] = overwriteValue;\n }\n return ret;\n}\n\nexport function getObjectValueByPath(\n obj: any,\n path: string,\n fallback?: any\n): any {\n // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621\n let traversPath = path;\n if (obj == null || !traversPath || typeof traversPath !== \"string\") {\n return fallback;\n }\n if (obj[traversPath] !== undefined) return obj[traversPath];\n traversPath = traversPath.replace(/\\[(\\w+)\\]/g, \".$1\"); // convert indexes to properties\n traversPath = traversPath.replace(/^\\./, \"\"); // strip a leading dot\n return getNestedValue(obj, traversPath.split(\".\"), fallback);\n}\n\nexport type SelectItemKey =\n | boolean // Ignored\n | string // Lookup by key, can use dot notation for nested objects\n | (string | number)[] // Nested lookup by key, each array item is a key in the next level\n | ((item: Record<string, any>, fallback?: any) => any);\n\nexport function getPropertyFromItem(\n item: any,\n property: SelectItemKey,\n fallback?: any\n): any {\n if (property == null) return item === undefined ? fallback : item;\n\n if (item !== Object(item)) {\n if (typeof property !== \"function\") return fallback;\n\n const value = property(item, fallback);\n\n return typeof value === \"undefined\" ? fallback : value;\n }\n\n if (typeof property === \"string\")\n return getObjectValueByPath(item, property, fallback);\n\n if (Array.isArray(property)) return getNestedValue(item, property, fallback);\n\n if (typeof property !== \"function\") return fallback;\n\n const value = property(item, fallback);\n\n return typeof value === \"undefined\" ? fallback : value;\n}\n\nexport function clamp(value: number, min = 0, max = 1) {\n return Math.max(min, Math.min(max, value));\n}\n\nexport function getRangeArr(length: number, start = 0) {\n return Array.from({ length }, (v, k) => start + k);\n}\n\nexport function deepEqual(a: any, b: any): boolean {\n if (a === b) return true;\n\n if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {\n return false;\n }\n\n if (a !== Object(a) || b !== Object(b)) {\n return false;\n }\n const props = Object.keys(a);\n if (props.length !== Object.keys(b).length) {\n return false;\n }\n return props.every((p) => deepEqual(a[p], b[p]));\n}\n\nexport function isObject(obj: unknown) {\n const type = typeof obj;\n return obj !== null && (type === \"object\" || type === \"function\");\n}\n\nexport function isEmpty(target: any) {\n return target == null || target?.trim() === \"\";\n}\n\nexport function omit<T extends object, U extends Extract<keyof T, string>>(\n obj: T,\n excludes: U[]\n): Omit<T, U> {\n const ret = { ...obj };\n excludes.forEach((prop) => delete ret[prop]);\n return ret;\n}\n\nexport const noop = () => void 0;\n\nexport function makeEventPromiseLike<T extends Event, P = any>(\n event: T,\n promise: Promise<P>\n): T & Promise<P> {\n const promiseMethods = [\"then\", \"catch\", \"finally\"] as const;\n\n promiseMethods.forEach((method) => {\n Object.defineProperty(event, method, {\n value: promise[method].bind(promise),\n writable: false,\n enumerable: false,\n });\n });\n\n return event as T & Promise<P>;\n}\n"],"mappings":"AAAA;;AAEA;AACA,OAAO,SAASA,cAAcA,CAACC,MAAW,EAAEC,QAAgB,EAAE;EAC5D,IAAID,MAAM,EAAE;IACV,OAAOE,MAAM,CAACC,MAAM,CAACH,MAAM,EAAEC,QAAQ,CAAC;EACxC;EACA,OAAO,KAAK;AACd;AAEA,OAAO,SAASG,cAAcA,CAC5BC,GAAQ,EACRC,IAAyB,EACzBC,QAAc,EACT;EACL,MAAMC,IAAI,GAAGF,IAAI,CAACG,MAAM,GAAG,CAAC;EAC5B,IAAIC,UAAU,GAAGL,GAAG;EAEpB,IAAIG,IAAI,GAAG,CAAC,EAAE,OAAOE,UAAU,KAAKC,SAAS,GAAGJ,QAAQ,GAAGG,UAAU;EAErE,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,EAAEI,CAAC,IAAI,CAAC,EAAE;IAChC,IAAIF,UAAU,IAAI,IAAI,EAAE;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MAAM,EAAE;MACnCjC,KAAK,EAAE+B,OAAO,CAACE,MAAM,CAAC,CAACE,IAAI,CAACJ,OAAO,CAAC;MACpCK,QAAQ,EAAE,KAAK;MACfC,UAAU,EAAE;IACd,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOP,KAAK;AACd","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","names":["useDefaultsModule","useSuperDefaults","redefineComponent","options","_setup","setup","props","ctx","defaults","value","_props","provideSubDefaults","name","setupBindings","defineFunctionalComponent","context","defineComponent"],"sources":["../../../src/util/component/component.ts"],"sourcesContent":["import {\r\n ComponentObjectPropsOptions,\r\n ComponentOptionsWithoutProps,\r\n ExtractDefaultPropTypes,\r\n ExtractPropTypes,\r\n FunctionalComponent,\r\n defineComponent,\r\n} from 'vue';\r\nimport type {\r\n Component,\r\n ComponentInjectOptions,\r\n ComponentOptions,\r\n ComponentOptionsMixin,\r\n ComponentPropsOptions,\r\n ComponentProvideOptions,\r\n ComputedOptions,\r\n DefineComponent,\r\n Directive,\r\n EmitsOptions,\r\n MethodOptions,\r\n SlotsType,\r\n} from 'vue';\r\n\r\nimport {\r\n useDefaultsModule,\r\n useSuperDefaults,\r\n} from '../../composables/defaults';\r\nimport { EmitsToProps } from './types';\r\nimport { ComponentOptionsWithObjectProps } from '@vue/runtime-core';\r\n\r\ntype ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> &\r\n Readonly<EmitsToProps<Emits>>;\r\n\r\n// overload 1: no props from options\r\nfunction redefineComponent<\r\n // props\r\n PropsOptions = {},\r\n //\r\n RawBindings = {},\r\n // emits\r\n E extends EmitsOptions = {},\r\n EE extends string = string,\r\n // other options\r\n Data = {},\r\n SetupBindings = {},\r\n Computed extends ComputedOptions = {},\r\n Methods extends MethodOptions = {},\r\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n InjectOptions extends ComponentInjectOptions = {},\r\n InjectKeys extends string = string,\r\n Slots extends SlotsType = {},\r\n LocalComponents extends Record<string, Component> = {},\r\n Directives extends Record<string, Directive> = {},\r\n Exposed extends string = string,\r\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\r\n>(\r\n options: ComponentOptionsWithoutProps<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE,\r\n InjectOptions,\r\n InjectKeys,\r\n Slots\r\n >,\r\n): DefineComponent<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE\r\n>;\r\n\r\n// overload 2: defineComponent with options object, infer props from options\r\nfunction redefineComponent<\r\n // props\r\n PropsOptions = ComponentObjectPropsOptions,\r\n RawBindings = {},\r\n // emits\r\n E extends EmitsOptions = {},\r\n EE extends string = string,\r\n // other options\r\n Data = {},\r\n SetupBindings = {},\r\n Computed extends ComputedOptions = {},\r\n Methods extends MethodOptions = {},\r\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\r\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\r\n InjectOptions extends {} = {},\r\n InjectKeys extends string = string,\r\n Slots extends SlotsType = {},\r\n LocalComponents extends Record<string, Component> = {},\r\n Directives extends Record<string, Directive> = {},\r\n Exposed extends string = string,\r\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\r\n>(\r\n options: ComponentOptionsWithObjectProps<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE,\r\n InjectOptions,\r\n InjectKeys,\r\n Slots\r\n >,\r\n): DefineComponent<\r\n PropsOptions,\r\n RawBindings,\r\n Data,\r\n Computed,\r\n Methods,\r\n Mixin,\r\n Extends,\r\n E,\r\n EE\r\n>;\r\n\r\nfunction redefineComponent(options: ComponentOptions) {\r\n options._setup = options._setup ?? options.setup;\r\n\r\n if (options._setup) {\r\n options.setup = function (props, ctx) {\r\n const defaults = useDefaultsModule();\r\n // Skip props proxy if defaults are not provided\r\n if (!defaults.value) return options._setup(props, ctx);\r\n\r\n const { props: _props, provideSubDefaults } = useSuperDefaults(\r\n props,\r\n options.name,\r\n defaults,\r\n );\r\n\r\n const setupBindings = options._setup(_props, ctx);\r\n\r\n provideSubDefaults();\r\n\r\n return setupBindings;\r\n };\r\n }\r\n\r\n return options;\r\n}\r\n\r\nfunction defineFunctionalComponent<\r\n T extends FunctionalComponent<Props>,\r\n PropsOptions = ComponentObjectPropsOptions,\r\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\r\n Props = Readonly<ExtractPropTypes<PropsOptions>>,\r\n>(\r\n props: PropsOptions,\r\n context: T,\r\n): FunctionalComponent<Partial<Defaults> & Omit<Props, keyof Defaults>> {\r\n context.props = props as any;\r\n return context as any;\r\n}\r\n\r\nexport { redefineComponent as defineComponent };\r\n"],"mappings":"SAwBEA,iBAAiB,EACjBC,gBAAgB,+CAQlB;AAkDA;AAkDA,SAASC,iBAAiBA,CAACC,OAAyB,EAAE;EACpDA,OAAO,CAACC,MAAM,GAAGD,OAAO,CAACC,MAAM,IAAID,OAAO,CAACE,KAAK;EAEhD,IAAIF,OAAO,CAACC,MAAM,EAAE;IAClBD,OAAO,CAACE,KAAK,GAAG,UAAUC,KAAK,EAAEC,GAAG,EAAE;MACpC,MAAMC,QAAQ,GAAGR,iBAAiB,CAAC,CAAC;MACpC;MACA,IAAI,CAACQ,QAAQ,CAACC,KAAK,EAAE,OAAON,OAAO,CAACC,MAAM,CAACE,KAAK,EAAEC,GAAG,CAAC;MAEtD,MAAM;QAAED,KAAK,EAAEI,MAAM;QAAEC;MAAmB,CAAC,GAAGV,gBAAgB,CAC5DK,KAAK,EACLH,OAAO,CAACS,IAAI,EACZJ,QACF,CAAC;MAED,MAAMK,aAAa,GAAGV,OAAO,CAACC,MAAM,CAACM,MAAM,EAAEH,GAAG,CAAC;MAEjDI,kBAAkB,CAAC,CAAC;MAEpB,OAAOE,aAAa;IACtB,CAAC;EACH;EAEA,OAAOV,OAAO;AAChB;AAEA,SAASW,yBAAyBA,CAMhCR,KAAmB,EACnBS,OAAU,EAC4D;EACtEA,OAAO,CAACT,KAAK,GAAGA,KAAY;EAC5B,OAAOS,OAAO;AAChB;AAEA,SAASb,iBAAiB,IAAIc,eAAe"}
1
+ {"version":3,"file":"component.js","names":["useDefaultsModule","useSuperDefaults","redefineComponent","options","_setup","setup","props","ctx","defaults","value","_props","provideSubDefaults","name","setupBindings","defineFunctionalComponent","context","defineComponent"],"sources":["../../../src/util/component/component.ts"],"sourcesContent":["import type {\n Component,\n ComponentInjectOptions,\n ComponentOptions,\n ComponentOptionsMixin,\n ComponentProvideOptions,\n ComputedOptions,\n DefineComponent,\n Directive,\n EmitsOptions,\n MethodOptions,\n SlotsType,\n} from 'vue';\nimport {\n ComponentObjectPropsOptions,\n ComponentOptionsWithObjectProps,\n ComponentOptionsWithoutProps,\n ExtractDefaultPropTypes,\n ExtractPropTypes,\n FunctionalComponent,\n} from 'vue';\n\nimport {\n useDefaultsModule,\n useSuperDefaults,\n} from '../../composables/defaults';\nimport { EmitsToProps } from './types';\n\ntype ToResolvedProps<Props, Emits extends EmitsOptions> = Readonly<Props> &\n Readonly<EmitsToProps<Emits>>;\n\n// overload 1: no props from options\nfunction redefineComponent<\n // props\n PropsOptions = {},\n //\n RawBindings = {},\n // emits\n E extends EmitsOptions = {},\n EE extends string = string,\n // other options\n Data = {},\n SetupBindings = {},\n Computed extends ComputedOptions = {},\n Methods extends MethodOptions = {},\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\n InjectOptions extends ComponentInjectOptions = {},\n InjectKeys extends string = string,\n Slots extends SlotsType = {},\n LocalComponents extends Record<string, Component> = {},\n Directives extends Record<string, Directive> = {},\n Exposed extends string = string,\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\n>(\n options: ComponentOptionsWithoutProps<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE,\n InjectOptions,\n InjectKeys,\n Slots\n >,\n): DefineComponent<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE\n>;\n\n// overload 2: defineComponent with options object, infer props from options\nfunction redefineComponent<\n // props\n PropsOptions = ComponentObjectPropsOptions,\n RawBindings = {},\n // emits\n E extends EmitsOptions = {},\n EE extends string = string,\n // other options\n Data = {},\n SetupBindings = {},\n Computed extends ComputedOptions = {},\n Methods extends MethodOptions = {},\n Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,\n Extends extends ComponentOptionsMixin = ComponentOptionsMixin,\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\n InjectOptions extends {} = {},\n InjectKeys extends string = string,\n Slots extends SlotsType = {},\n LocalComponents extends Record<string, Component> = {},\n Directives extends Record<string, Directive> = {},\n Exposed extends string = string,\n Provide extends ComponentProvideOptions = ComponentProvideOptions,\n>(\n options: ComponentOptionsWithObjectProps<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE,\n InjectOptions,\n InjectKeys,\n Slots\n >,\n): DefineComponent<\n PropsOptions,\n RawBindings,\n Data,\n Computed,\n Methods,\n Mixin,\n Extends,\n E,\n EE\n>;\n\nfunction redefineComponent(options: ComponentOptions) {\n options._setup = options._setup ?? options.setup;\n\n if (options._setup) {\n options.setup = function (props, ctx) {\n const defaults = useDefaultsModule();\n // Skip props proxy if defaults are not provided\n if (!defaults.value) return options._setup(props, ctx);\n\n const { props: _props, provideSubDefaults } = useSuperDefaults(\n props,\n options.name,\n defaults,\n );\n\n const setupBindings = options._setup(_props, ctx);\n\n provideSubDefaults();\n\n return setupBindings;\n };\n }\n\n return options;\n}\n\nfunction defineFunctionalComponent<\n T extends FunctionalComponent<Props>,\n PropsOptions = ComponentObjectPropsOptions,\n Defaults = ExtractDefaultPropTypes<PropsOptions>,\n Props = Readonly<ExtractPropTypes<PropsOptions>>,\n>(\n props: PropsOptions,\n context: T,\n): FunctionalComponent<Partial<Defaults> & Omit<Props, keyof Defaults>> {\n context.props = props as any;\n return context as any;\n}\n\nexport { redefineComponent as defineComponent };\n"],"mappings":"SAuBEA,iBAAiB,EACjBC,gBAAgB,+CAOlB;AAkDA;AAkDA,SAASC,iBAAiBA,CAACC,OAAyB,EAAE;EACpDA,OAAO,CAACC,MAAM,GAAGD,OAAO,CAACC,MAAM,IAAID,OAAO,CAACE,KAAK;EAEhD,IAAIF,OAAO,CAACC,MAAM,EAAE;IAClBD,OAAO,CAACE,KAAK,GAAG,UAAUC,KAAK,EAAEC,GAAG,EAAE;MACpC,MAAMC,QAAQ,GAAGR,iBAAiB,CAAC,CAAC;MACpC;MACA,IAAI,CAACQ,QAAQ,CAACC,KAAK,EAAE,OAAON,OAAO,CAACC,MAAM,CAACE,KAAK,EAAEC,GAAG,CAAC;MAEtD,MAAM;QAAED,KAAK,EAAEI,MAAM;QAAEC;MAAmB,CAAC,GAAGV,gBAAgB,CAC5DK,KAAK,EACLH,OAAO,CAACS,IAAI,EACZJ,QACF,CAAC;MAED,MAAMK,aAAa,GAAGV,OAAO,CAACC,MAAM,CAACM,MAAM,EAAEH,GAAG,CAAC;MAEjDI,kBAAkB,CAAC,CAAC;MAEpB,OAAOE,aAAa;IACtB,CAAC;EACH;EAEA,OAAOV,OAAO;AAChB;AAEA,SAASW,yBAAyBA,CAMhCR,KAAmB,EACnBS,OAAU,EAC4D;EACtEA,OAAO,CAACT,KAAK,GAAGA,KAAY;EAC5B,OAAOS,OAAO;AAChB;AAEA,SAASb,iBAAiB,IAAIc,eAAe","ignoreList":[]}