@mkbabb/glass-ui 8.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/MIGRATION.md +4768 -0
  2. package/README.md +57 -13
  3. package/dist/DialogContent-CwIBvou_.js +157 -0
  4. package/dist/{DropdownMenuTrigger-8UZsBtZ8.js → DropdownMenuTrigger-CKRnhDSQ.js} +1 -1
  5. package/dist/{Surface-i1tWC-Ga.js → Surface-1nPoabc3.js} +1 -1
  6. package/dist/{accent-tone-solve-Cw7WkRD9.js → accent-tone-solve-5H6FY2QO.js} +1 -1
  7. package/dist/aurora.js +386 -355
  8. package/dist/{badge-owUOaaba.js → badge-BO6BC4G5.js} +1 -1
  9. package/dist/badge.js +1 -1
  10. package/dist/blob.js +44 -44
  11. package/dist/{button-yvGPb0Bx.js → button-BOFTUPyU.js} +1 -1
  12. package/dist/button.js +1 -1
  13. package/dist/{card-3HFFpC7_.js → card-ByyqRBvK.js} +2 -2
  14. package/dist/card.js +1 -1
  15. package/dist/carousel.js +3 -3
  16. package/dist/{checkbox-BnXuGgJ3.js → checkbox-B1qn65se.js} +1 -1
  17. package/dist/checkbox.js +1 -1
  18. package/dist/chip.js +8 -3
  19. package/dist/{class-names-q-UGOkHH.js → class-names-FlXcvRRT.js} +65 -18
  20. package/dist/{collapsible-B7O6m-Ch.js → collapsible-DFzK29Oh.js} +5 -2
  21. package/dist/collapsible.js +1 -1
  22. package/dist/color.glsl-DTJhdekG.js +34 -0
  23. package/dist/color.js +11 -11
  24. package/dist/color.wgsl-BTszLY39.js +398 -0
  25. package/dist/{command-BuBnYpxF.js → command-C-5xSEJ2.js} +8 -8
  26. package/dist/command.js +1 -1
  27. package/dist/component-styles.css +1 -0
  28. package/dist/components/_shared/class-names.d.ts +10 -1
  29. package/dist/components/_shared/control.d.ts +0 -1
  30. package/dist/components/_shared/index.d.ts +0 -1
  31. package/dist/components/_shared/menu/menu.css +1 -1
  32. package/dist/components/_shared/overlay/index.d.ts +1 -0
  33. package/dist/components/_shared/overlay/shortcuts.d.ts +12 -0
  34. package/dist/components/aurora/Aurora.vue.d.ts +1 -0
  35. package/dist/components/aurora/composables/atoms.d.ts +22 -6
  36. package/dist/components/aurora/composables/frameLoop.d.ts +6 -5
  37. package/dist/components/aurora/composables/runtime.d.ts +28 -1
  38. package/dist/components/aurora/composables/useAurora.d.ts +28 -0
  39. package/dist/components/aurora/composables/wgpuSetup.d.ts +1 -1
  40. package/dist/components/aurora/constants/presets.d.ts +62 -5
  41. package/dist/components/aurora/index.d.ts +1 -1
  42. package/dist/components/blob/Blob.vue.d.ts +3 -3
  43. package/dist/components/card/Card.vue.d.ts +8 -2
  44. package/dist/components/chip/Chip.vue.d.ts +1 -7
  45. package/dist/components/chip/chipVariants.d.ts +1 -0
  46. package/dist/components/collapsible/Collapsible.vue.d.ts +1 -0
  47. package/dist/components/command/CommandDialog.vue.d.ts +1 -1
  48. package/dist/components/configurator/Configurator.vue.d.ts +25 -2
  49. package/dist/components/configurator/ConfiguratorRow.vue.d.ts +4 -2
  50. package/dist/components/configurator/styles.css +1 -1
  51. package/dist/components/dark-mode-toggle/dark-mode-toggle.css +1 -1
  52. package/dist/components/deck/styles/capture.css +1 -1
  53. package/dist/components/dialog/styles.css +1 -1
  54. package/dist/components/dock/DockSeparator.vue.d.ts +2 -3
  55. package/dist/components/dock/GlassDock.vue.d.ts +1 -0
  56. package/dist/components/dock/composables/dockContext.d.ts +1 -8
  57. package/dist/components/dock/composables/dockCrossfadeContext.d.ts +0 -2
  58. package/dist/components/dock/composables/index.d.ts +1 -1
  59. package/dist/components/dock/composables/useDockHold.d.ts +16 -12
  60. package/dist/components/dock/composables/useDockRun.d.ts +20 -0
  61. package/dist/components/dock/composables/useDockSearch.d.ts +1 -1
  62. package/dist/components/dock/composables/useDockShellProps.d.ts +18 -101
  63. package/dist/components/dock/composables/useDockState.d.ts +2 -9
  64. package/dist/components/dock/constants.d.ts +15 -0
  65. package/dist/components/dock/index.d.ts +2 -2
  66. package/dist/components/dock/styles/controls/icon-button.css +1 -1
  67. package/dist/components/dock/styles/controls/tab-button.css +1 -1
  68. package/dist/components/dock/styles/controls/triggers.css +1 -1
  69. package/dist/components/dock/styles/controls.css +1 -1
  70. package/dist/components/dock/styles/density.css +1 -1
  71. package/dist/components/dock/styles/index.css +1 -1
  72. package/dist/components/dock/styles/layer-group.css +1 -1
  73. package/dist/components/dock/styles/layers.css +1 -1
  74. package/dist/components/dock/styles/morph.css +1 -1
  75. package/dist/components/dock/styles/run.css +1 -0
  76. package/dist/components/dock/styles/search.css +1 -1
  77. package/dist/components/dock/styles/shape.css +1 -1
  78. package/dist/components/dock/styles/shell-regions.css +1 -1
  79. package/dist/components/dock/styles/shell.css +1 -1
  80. package/dist/components/fourier-field/FourierField.vue.d.ts +29 -26
  81. package/dist/components/fourier-field/clock.d.ts +35 -0
  82. package/dist/components/fourier-field/constants.d.ts +80 -104
  83. package/dist/components/fourier-field/index.d.ts +3 -28
  84. package/dist/components/fourier-field/math.d.ts +69 -77
  85. package/dist/components/fourier-field/renderer/mint.d.ts +50 -0
  86. package/dist/components/fourier-field/renderer/uniforms.d.ts +84 -0
  87. package/dist/components/fourier-field/renderer/wgpu.d.ts +28 -0
  88. package/dist/components/fourier-field/shaders/compute.wgsl.d.ts +1 -0
  89. package/dist/components/fourier-field/shaders/render.wgsl.d.ts +1 -0
  90. package/dist/components/fourier-field/useFourierField.d.ts +49 -0
  91. package/dist/components/handmark/HandMark.vue.d.ts +18 -14
  92. package/dist/components/handmark/index.d.ts +4 -23
  93. package/dist/components/handmark/stroke.d.ts +92 -0
  94. package/dist/components/labeled-field/LabeledSwitch.vue.d.ts +3 -1
  95. package/dist/components/labeled-field/types.d.ts +1 -1
  96. package/dist/components/menu/DropdownMenu.vue.d.ts +1 -1
  97. package/dist/components/metric/coalesce-metric.d.ts +6 -1
  98. package/dist/components/metric/styles.css +1 -1
  99. package/dist/components/popover/Popover.vue.d.ts +1 -1
  100. package/dist/components/scroll-progress-rim/styles.css +1 -1
  101. package/dist/components/sheet/styles.css +1 -1
  102. package/dist/components/slider/styles.css +1 -1
  103. package/dist/components/tabs/SegmentedTabs.vue.d.ts +25 -112
  104. package/dist/components/tabs/composables/useTabDragMorph.d.ts +1 -1
  105. package/dist/components/tabs/composables/useTabResponsive.d.ts +11 -11
  106. package/dist/components/tabs/index.d.ts +1 -1
  107. package/dist/components/tabs/styles/drag.css +1 -1
  108. package/dist/components/tabs/styles/segmented.css +1 -1
  109. package/dist/components/tabs/types.d.ts +85 -0
  110. package/dist/components/timeline/index.d.ts +2 -0
  111. package/dist/components/toast/Toast.vue.d.ts +2 -2
  112. package/dist/composables/color/index.d.ts +0 -15
  113. package/dist/composables/dark/darkModeSyncScript.d.ts +42 -0
  114. package/dist/composables/dom/useResolveTokenColor.d.ts +1 -1
  115. package/dist/composables/glass/index.d.ts +2 -0
  116. package/dist/composables/keyboard/useKeyboardShortcuts.d.ts +47 -1
  117. package/dist/composables/motion/pointer/pointerFieldMappings.d.ts +0 -41
  118. package/dist/{components/search/composables → composables/search}/index.d.ts +2 -2
  119. package/dist/{components/search/composables/fuzzySearchIndex.d.ts → composables/search/match.d.ts} +8 -3
  120. package/dist/composables/sidebar/types.d.ts +5 -1
  121. package/dist/configurator-DiwVN573.js +339 -0
  122. package/dist/configurator.js +1 -1
  123. package/dist/constellation.js +5 -5
  124. package/dist/{content-CWO-XL7o.js → content-So3j6SOe.js} +1 -1
  125. package/dist/control-DJp15L4U.js +7 -0
  126. package/dist/dark-mode-toggle.js +2 -2
  127. package/dist/{dark-z_P5QwqI.js → dark-pONY3x93.js} +2 -2
  128. package/dist/dark.js +1 -1
  129. package/dist/{data-table-_RrOEdiw.js → data-table-Ba_uTfPc.js} +3 -3
  130. package/dist/data-table.js +1 -1
  131. package/dist/{deck-Ci6YjB5e.js → deck-Cm_VmyNL.js} +1 -1
  132. package/dist/deck.js +1 -1
  133. package/dist/{dialog-CbRnTRtg.js → dialog-BZoFG0j8.js} +1 -1
  134. package/dist/dialog.js +2 -2
  135. package/dist/dock.js +718 -496
  136. package/dist/dom.js +90 -8
  137. package/dist/easing.js +5 -5
  138. package/dist/expandable-container-CZUj9BzY.js +142 -0
  139. package/dist/expandable-container.js +2 -142
  140. package/dist/fourier-field.js +638 -855
  141. package/dist/fourier-math.js +6 -6
  142. package/dist/glass-ui.css +1 -1
  143. package/dist/glass-ui.js +88 -75
  144. package/dist/handmark.js +330 -718
  145. package/dist/index.d.ts +2 -2
  146. package/dist/infinite-scroll.js +16 -17
  147. package/dist/{input-Bls2A4Tt.js → input-eLZ_AU7l.js} +1 -1
  148. package/dist/input.js +1 -1
  149. package/dist/keyboard.js +64 -21
  150. package/dist/{label-BQEZhnK_.js → label-CE03H1KL.js} +2 -2
  151. package/dist/label.js +1 -1
  152. package/dist/labeled-field.js +9 -6
  153. package/dist/{menu-wLu1XGKn.js → menu-BnmCOa3y.js} +93 -90
  154. package/dist/menu.js +2 -2
  155. package/dist/metric.js +12 -7
  156. package/dist/{motion-D4uYE0UM.js → motion-BvV1_24p.js} +1 -1
  157. package/dist/motion-core.js +35 -35
  158. package/dist/{number-field-NFAwQ0HK.js → number-field-RP89046a.js} +2 -2
  159. package/dist/number-field.js +1 -1
  160. package/dist/pager-dots.js +3 -3
  161. package/dist/{participation-B0hdsIRo.js → participation-Di4UHbzk.js} +8 -8
  162. package/dist/{pointerFieldMappings-DP5tla5z.js → pointerFieldMappings-DXwlU5uj.js} +7 -23
  163. package/dist/popover-DA87hFBx.js +184 -0
  164. package/dist/popover.js +1 -1
  165. package/dist/{progress-DF8dWZIX.js → progress-eVa-mc7J.js} +1 -1
  166. package/dist/progress.js +1 -1
  167. package/dist/{radio-group-Ci8o-pDx.js → radio-group-B58Bz16F.js} +2 -2
  168. package/dist/radio-group.js +1 -1
  169. package/dist/{select-CDgwGH_P.js → select-fy3vtArm.js} +13 -13
  170. package/dist/select.js +1 -1
  171. package/dist/{separator-CN11t406.js → separator-D4EZM10u.js} +2 -2
  172. package/dist/separator.js +1 -1
  173. package/dist/{sheet-BEFvnO_u.js → sheet-BQJyER59.js} +120 -115
  174. package/dist/sheet.js +2 -2
  175. package/dist/shortcuts-DGGWNRNe.js +13 -0
  176. package/dist/sidebar.js +4 -4
  177. package/dist/{slider-gsc8jDIo.js → slider-5ChjjWSR.js} +1 -1
  178. package/dist/slider.js +1 -1
  179. package/dist/{status-dot-BpnqOP5N.js → status-dot-W4LFiJps.js} +2 -2
  180. package/dist/status-dot.js +1 -1
  181. package/dist/styles/accessibility.css +1 -1
  182. package/dist/styles/animations.css +1 -1
  183. package/dist/styles/components.css +1 -1
  184. package/dist/styles/glass/a11y-fallback.css +1 -1
  185. package/dist/styles/glass/dissolve.css +1 -1
  186. package/dist/styles/glass/focus-veil.css +1 -1
  187. package/dist/styles/glass/ladder.css +1 -1
  188. package/dist/styles/glass/material.css +1 -1
  189. package/dist/styles/glass/overlay-plate.css +1 -1
  190. package/dist/styles/glass/reveal.css +1 -1
  191. package/dist/styles/glass-specular-track.css +1 -1
  192. package/dist/styles/paper.css +1 -1
  193. package/dist/styles/scroll-choreography.css +1 -1
  194. package/dist/styles/scroll-chrome.css +1 -1
  195. package/dist/styles/scroll-driven.css +1 -1
  196. package/dist/styles/theme/literals.css +1 -1
  197. package/dist/styles/tokens/color-radius.css +1 -1
  198. package/dist/styles/tokens/dark-arm-glass.css +1 -1
  199. package/dist/styles/tokens/light-dark.css +1 -1
  200. package/dist/styles/tokens/offsets.css +1 -1
  201. package/dist/styles/tokens/scheme-motion.css +1 -1
  202. package/dist/styles/tokens/sizing.css +1 -1
  203. package/dist/styles/typography/semantic.css +1 -1
  204. package/dist/styles/typography/utilities.css +1 -1
  205. package/dist/styles/utilities/a11y-overrides.css +1 -1
  206. package/dist/styles/utilities/responsive.css +1 -1
  207. package/dist/styles/view-transition.css +1 -1
  208. package/dist/styles/viz-reveal.css +1 -1
  209. package/dist/surface.js +1 -1
  210. package/dist/{switch-DxZzDrmV.js → switch-BYUZ6g9G.js} +2 -2
  211. package/dist/switch.js +1 -1
  212. package/dist/{tabs-CYscnq5H.js → tabs-rdRXKXxd.js} +4 -3
  213. package/dist/tabs.js +1 -1
  214. package/dist/textarea.js +1 -1
  215. package/dist/timeline.js +44 -42
  216. package/dist/{toast-9c6Kp58L.js → toast-DVOwo6GB.js} +1 -1
  217. package/dist/toast.js +1 -1
  218. package/dist/{toggle-group-11aPGMfE.js → toggle-group-CC5b3o1R.js} +2 -2
  219. package/dist/toggle-group.js +1 -1
  220. package/dist/{tooltip-DqKMZ4dn.js → tooltip-DhTHhtJN.js} +2 -2
  221. package/dist/tooltip.js +1 -1
  222. package/dist/typewriter.js +1 -1
  223. package/dist/{useAccentTone-DFAh1osB.js → useAccentTone-DitmKfGL.js} +1 -1
  224. package/dist/{resolveCanvasColor-6MCrswTB.js → useCanvas2D-CQRElMyE.js} +1 -11
  225. package/dist/{usePointerVelocityField-DsIf7yyq.js → usePointerVelocityField-Lx26_Yap.js} +1 -1
  226. package/dist/useResolveTokenColor-B2FfJnd9.js +24 -0
  227. package/package.json +5 -21
  228. package/dist/DialogContent-4hzLiaCQ.js +0 -152
  229. package/dist/canvas.d.ts +0 -1
  230. package/dist/canvas.js +0 -2
  231. package/dist/color.wgsl-B0N3mKMb.js +0 -412
  232. package/dist/compile-D7VYG3gi.js +0 -19
  233. package/dist/components/dock/composables/useDockOverflowFit.d.ts +0 -20
  234. package/dist/components/dock/composables/useDockTouchGate.d.ts +0 -42
  235. package/dist/components/dock/styles/overflow.css +0 -1
  236. package/dist/components/fourier-field/composables/fourierFieldGLSetup.d.ts +0 -24
  237. package/dist/components/fourier-field/composables/fourierFieldWGPUSetup.d.ts +0 -31
  238. package/dist/components/fourier-field/composables/uniformBridgeWGPU.d.ts +0 -39
  239. package/dist/components/fourier-field/composables/useFourierField.d.ts +0 -56
  240. package/dist/components/fourier-field/shaders/fourier-field.compute.wgsl.d.ts +0 -1
  241. package/dist/components/fourier-field/shaders/fourier-field.glsl.d.ts +0 -4
  242. package/dist/components/fourier-field/shaders/fourier-field.render.wgsl.d.ts +0 -1
  243. package/dist/components/fourier-field/shaders/fourier-field.ribbon.d.ts +0 -51
  244. package/dist/components/handmark/brush.d.ts +0 -269
  245. package/dist/components/handmark/composables/useHandMark.d.ts +0 -99
  246. package/dist/components/handmark/constants.d.ts +0 -69
  247. package/dist/components/handmark/freehand.d.ts +0 -69
  248. package/dist/components/handmark/geometry.d.ts +0 -62
  249. package/dist/components/handmark/ink.d.ts +0 -11
  250. package/dist/components/handmark/noise.d.ts +0 -30
  251. package/dist/components/handmark/texture.d.ts +0 -39
  252. package/dist/components/handmark/types.d.ts +0 -70
  253. package/dist/components/search/SearchBar.vue.d.ts +0 -38
  254. package/dist/components/search/index.d.ts +0 -8
  255. package/dist/components/search/searchVariants.d.ts +0 -16
  256. package/dist/configurator-BoeScnDL.js +0 -311
  257. package/dist/control-Da4XeT43.js +0 -11
  258. package/dist/popover-DBMKTPkL.js +0 -181
  259. package/dist/search.d.ts +0 -1
  260. package/dist/search.js +0 -61
  261. package/dist/useFuzzySearch-CUnZknpm.js +0 -177
  262. package/dist/useResolveTokenColor-CspQv_ik.js +0 -107
  263. /package/dist/{components/search/composables → composables/search}/types.d.ts +0 -0
  264. /package/dist/{components/search/composables → composables/search}/useFuzzySearch.d.ts +0 -0
package/dist/handmark.js CHANGED
@@ -1,768 +1,380 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { n as t } from "./prng-2uS6J_A1.js";
3
- import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as u, openBlock as d, ref as f, renderList as p, renderSlot as m, unref as h, useId as g, watch as _ } from "vue";
4
- import { catmullRomToBezier as v, ellipsePoints as y, perturbPoints as b, perturbPointsClosed as x, pointsToLinear as S, useLineBoil as C, wobbleLinePoints as w } from "@mkbabb/pencil-boil";
5
- //#region src/components/handmark/brush.ts
6
- var T = {
7
- pen: {
8
- weight: 6,
9
- weightJitter: .1,
10
- thinning: .15,
11
- taper: {
12
- start: 14,
13
- end: 14,
14
- ease: "out-cubic"
15
- },
16
- ribbon: "stroke",
17
- opacity: 1,
18
- blend: "source-over",
19
- passes: 1,
20
- passOpacity: 0,
21
- grain: 0,
22
- grainFreq: .1,
23
- grainScale: 0,
24
- octaves: 2,
25
- roughness: .7,
26
- wobble: 1.2,
27
- segments: 9,
28
- cap: "round"
29
- },
30
- boil: {
31
- weight: 7,
32
- weightJitter: .12,
33
- thinning: .55,
34
- taper: {
35
- start: 14,
36
- end: 18,
37
- ease: "out-cubic"
38
- },
39
- ribbon: "hull",
40
- opacity: 1,
41
- blend: "source-over",
42
- passes: 1,
43
- passOpacity: 0,
44
- grain: 0,
45
- grainFreq: .1,
46
- grainScale: 0,
47
- octaves: 2,
48
- roughness: .9,
49
- wobble: 1.4,
50
- segments: 14,
51
- cap: "round"
52
- },
53
- pencil: {
54
- weight: 3,
55
- weightJitter: .3,
56
- thinning: .4,
57
- taper: {
58
- start: 8,
59
- end: 18,
60
- ease: "out-cubic"
61
- },
62
- ribbon: "stroke",
63
- opacity: .6,
64
- blend: "source-over",
65
- passes: 1,
66
- passOpacity: 0,
67
- grain: .5,
68
- grainFreq: .42,
69
- grainScale: 1.5,
70
- octaves: 3,
71
- roughness: 1,
72
- wobble: 1.6,
73
- segments: 11,
74
- cap: "round"
75
- },
76
- crayon: {
77
- weight: 16,
78
- weightJitter: 1,
79
- thinning: .25,
80
- taper: {
81
- start: 6,
82
- end: 6,
83
- ease: "linear"
84
- },
85
- ribbon: "hull",
86
- opacity: .8,
87
- blend: "source-over",
88
- passes: 2,
89
- passOpacity: .18,
90
- grain: .85,
91
- grainFreq: .16,
92
- grainScale: 2.6,
93
- octaves: 4,
94
- roughness: 1.5,
95
- wobble: 3,
96
- segments: 13,
97
- cap: "round"
98
- },
99
- ring: {
100
- weight: 5,
101
- weightJitter: .6,
102
- thinning: .3,
103
- taper: {
104
- start: 8,
105
- end: 12,
106
- ease: "out-cubic"
107
- },
108
- ribbon: "stroke",
109
- opacity: .55,
110
- blend: "source-over",
111
- passes: 1,
112
- passOpacity: 0,
113
- grain: .7,
114
- grainFreq: .18,
115
- grainScale: 1.8,
116
- octaves: 4,
117
- roughness: 1.4,
118
- wobble: 2.6,
119
- segments: 13,
120
- cap: "round"
121
- },
122
- marker: {
123
- weight: 12,
124
- weightJitter: .2,
125
- thinning: .1,
126
- taper: {
127
- start: 4,
128
- end: 10,
129
- ease: "out-cubic"
130
- },
131
- ribbon: "hull",
132
- opacity: .92,
133
- blend: "source-over",
134
- passes: 1,
135
- passOpacity: 0,
136
- grain: .22,
137
- grainFreq: .09,
138
- grainScale: 1,
139
- octaves: 3,
140
- roughness: 1,
141
- wobble: 2.2,
142
- segments: 9,
143
- cap: "square"
144
- },
145
- highlighter: {
146
- weight: 26,
147
- weightJitter: .05,
148
- thinning: 0,
149
- taper: {
150
- start: 6,
151
- end: 10,
152
- ease: "out-cubic"
153
- },
154
- ribbon: "hull",
155
- opacity: .38,
156
- blend: "multiply",
157
- passes: 1,
158
- passOpacity: 0,
159
- grain: .12,
160
- grainFreq: .2,
161
- grainScale: 1.5,
162
- octaves: 2,
163
- roughness: .5,
164
- wobble: 1.4,
165
- segments: 9,
166
- cap: "square"
167
- }
168
- }, E = (e, t) => ({
169
- ...T[typeof e == "string" ? e : "pen"],
170
- ...typeof e == "object" ? e : {},
171
- ...t
172
- }), D = (e, t, n) => {
173
- let r = (e, t) => e + (t - e) * n, i = (e, t) => n < .5 ? e : t;
2
+ import { n as t } from "./constants-Dk96HZHu.js";
3
+ import { n, t as r } from "./prng-2uS6J_A1.js";
4
+ import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, defineComponent as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderList as g, renderSlot as _, unref as v, useId as ee, watch as y } from "vue";
5
+ //#region src/components/handmark/stroke.ts
6
+ var b = [
7
+ "underline",
8
+ "strike",
9
+ "circle",
10
+ "highlight"
11
+ ], x = .5444, S = .7515, C = 1, w = .6244, T = .06, E = .1, D = Math.SQRT1_2 * x, O = Math.cbrt(2), k = .055;
12
+ O * .9115 * 1.055 * 1.036;
13
+ var A = (e) => Math.round(e * 1e3) / 1e3, j = (e) => e * Math.PI / 180;
14
+ function M(e) {
15
+ let t = n(e >>> 0);
174
16
  return {
175
- weight: r(e.weight, t.weight),
176
- weightJitter: r(e.weightJitter, t.weightJitter),
177
- thinning: r(e.thinning, t.thinning),
178
- taper: {
179
- start: r(e.taper.start, t.taper.start),
180
- end: r(e.taper.end, t.taper.end),
181
- ease: i(e.taper.ease, t.taper.ease)
182
- },
183
- ribbon: i(e.ribbon, t.ribbon),
184
- opacity: r(e.opacity, t.opacity),
185
- blend: i(e.blend, t.blend),
186
- passes: Math.max(1, Math.round(r(e.passes, t.passes))),
187
- passOpacity: r(e.passOpacity, t.passOpacity),
188
- grain: r(e.grain, t.grain),
189
- grainFreq: r(e.grainFreq, t.grainFreq),
190
- grainScale: r(e.grainScale, t.grainScale),
191
- octaves: Math.max(1, Math.round(r(e.octaves, t.octaves))),
192
- roughness: r(e.roughness, t.roughness),
193
- wobble: r(e.wobble, t.wobble),
194
- segments: Math.max(2, Math.round(r(e.segments, t.segments))),
195
- cap: i(e.cap, t.cap)
17
+ next: t,
18
+ span: (e, n) => e + t() * (n - e),
19
+ sign: (e = .5) => t() < e ? 1 : -1
196
20
  };
197
- }, O = 100, k = 40, A = .06, j = .22, M = .66, N = 1.618033988749895, P = 2.5, F = .05, I = .12;
198
- //#endregion
199
- //#region src/components/handmark/noise.ts
200
- function L(e) {
201
- return e * e * e * (e * (e * 6 - 15) + 10);
202
- }
203
- function R(e, n, r, i, a, o = 1) {
204
- let s = r - e;
205
- if (s <= 0) return [[e, n], [r, n]];
206
- let c = i >>> 0, l = s * F * o, u = t(c), d = 0, f = Array.from({ length: 4 }, (e, n) => {
207
- let r = u() * 10, i = P * N ** +n, a = (1 / N) ** n;
208
- d += a;
209
- let o = t((c ^ Math.imul(2654435769, n + 1)) >>> 0), s = /* @__PURE__ */ new Map(), l = (e) => {
210
- let t = s.get(e);
211
- return t === void 0 && (t = o(), s.set(e, t)), t;
212
- };
213
- return {
214
- phase: r,
215
- freq: i,
216
- weight: a,
217
- vnoise: (e) => {
218
- let t = Math.floor(e), n = e - t, r = l(t);
219
- return r + (l(t + 1) - r) * L(n);
220
- }
221
- };
222
- }), p = Math.max(6, a), m = [];
223
- for (let t = 0; t <= p; t++) {
224
- let r = t / p, i = e + s * r, a = 0;
225
- for (let e of f) a += e.weight * (e.vnoise(r * e.freq + e.phase) * 2 - 1);
226
- a /= d;
227
- let o = 1;
228
- r < .12 ? o = .5 - .5 * Math.cos(r / I * Math.PI) : r > .88 && (o = .5 - .5 * Math.cos((1 - r) / I * Math.PI)), m.push([i, n + l * a * o]);
229
- }
230
- return m;
231
- }
232
- //#endregion
233
- //#region src/components/handmark/geometry.ts
234
- function z(e, t, n = null, r = null, i = !1, a = 40, o = 1) {
235
- let s = n == null && (e === "underline" || e === "strikethrough" || e === "highlight") ? a : 40, c = n ? n.x : 4, l = n ? n.x + n.w : 96, u = n ? n.y + n.h / 2 : s / 2, d = n ? n.y + n.h * .92 : r == null ? s - 8 : s * (r + A), f = t.seed ?? 1, p = t.segments ?? 9, m = (e, n, r, i, a = 0) => w(e, n, r, i, {
236
- ...t,
237
- seed: f + a
238
- });
239
- switch (e) {
240
- case "underline": return {
241
- lines: [i ? R(c, d, l, f, p, o) : m(c, d, l, d)],
242
- closed: !1
243
- };
244
- case "strikethrough": return {
245
- lines: [m(c, u, l, u)],
246
- closed: !1
247
- };
248
- case "highlight": {
249
- let e = n ? u : s * ((r ?? M) - j);
250
- return {
251
- lines: [m(c, e, l, e)],
252
- closed: !1
253
- };
254
- }
255
- case "box": {
256
- let e = n ? n.y : 4, t = n ? n.y + n.h : 36;
257
- return {
258
- lines: [
259
- m(c, e, l, e, 0),
260
- m(l, e, l, t, 1),
261
- m(l, t, c, t, 2),
262
- m(c, t, c, e, 3)
263
- ],
264
- closed: !1
265
- };
266
- }
267
- case "bracket": {
268
- let e = n ? n.y : 4, t = n ? n.y + n.h : 36, r = (l - c) * .22;
269
- return {
270
- lines: [
271
- m(c + r, e, c, e, 0),
272
- m(c, e, c, t, 1),
273
- m(c, t, c + r, t, 2)
274
- ],
275
- closed: !1
276
- };
277
- }
278
- case "circle": return {
279
- lines: [y(n ? n.x + n.w / 2 : 100 / 2, n ? n.y + n.h / 2 : 40 / 2, (n ? n.w / 2 : 100 / 2) - 3, (n ? n.h / 2 : 40 / 2) - 3, t)],
280
- closed: !0
281
- };
282
- case "path": return {
283
- lines: [],
284
- closed: !1
285
- };
286
- default: return {
287
- lines: [m(c, d, l, d)],
288
- closed: !1
289
- };
290
- }
291
21
  }
292
- function B({ lines: e, closed: t }, n, r) {
293
- return e.map((e, i) => {
294
- if (t) return x(e, n, r + i);
295
- let a = e[0], o = e[e.length - 1];
296
- return b(e, a[0], a[1], o[0], o[1], n, r + i);
297
- });
22
+ function N(e, t) {
23
+ return e * .2 * t ** .75;
298
24
  }
299
- function V(e, t = !1) {
300
- return e.map((e) => t ? S(e) : v(e)).join(" ");
25
+ function P(e) {
26
+ return 140 + .55 * e;
301
27
  }
302
- //#endregion
303
- //#region src/components/handmark/freehand.ts
304
- var H = (e, t) => [e[0] + t[0], e[1] + t[1]], U = (e, t) => [e[0] - t[0], e[1] - t[1]], W = (e, t) => [e[0] * t, e[1] * t], ee = (e) => [-e[0], -e[1]], G = (e) => [e[1], -e[0]], te = (e, t) => e[0] * t[0] + e[1] * t[1], ne = (e) => e[0] * e[0] + e[1] * e[1], K = (e, t) => ne(U(e, t)), re = (e, t) => Math.hypot(e[1] - t[1], e[0] - t[0]), ie = (e) => W(e, 1 / (Math.hypot(e[0], e[1]) || 1)), q = (e, t, n) => H(e, W(U(t, e), n)), J = (e, t) => W(H(e, t), .5), Y = (e, t, n) => {
305
- let r = Math.sin(n), i = Math.cos(n), a = e[0] - t[0], o = e[1] - t[1];
306
- return [a * i - o * r + t[0], a * r + o * i + t[1]];
307
- }, { min: X, PI: ae } = Math, Z = ae + 1e-4, oe = (e) => e;
308
- function se(e, t = {}) {
309
- let { streamline: n = .5, size: r = 16, last: i = !1 } = t;
310
- if (e.length === 0) return [];
311
- let a = .15 + (1 - n) * .85, o = e.map((e) => [
312
- e[0],
313
- e[1],
314
- e[2] ?? .5
315
- ]);
316
- if (o.length === 2) {
317
- let e = o[1];
318
- o[1] = q(o[0], e, .5), o.push(e);
319
- }
320
- o.length === 1 && o.push([...H(o[0], [1, 1]), ...o[0].slice(2)]);
321
- let s = [{
322
- point: [o[0][0], o[0][1]],
323
- pressure: o[0][2] >= 0 ? o[0][2] : .25,
324
- vector: [1, 1],
325
- distance: 0,
326
- runningLength: 0
327
- }], c = !1, l = 0, u = s[0], d = o.length - 1;
328
- for (let e = 1; e < o.length; e++) {
329
- let t = i && e === d ? [o[e][0], o[e][1]] : q(u.point, [o[e][0], o[e][1]], a);
330
- if (K(u.point, t) < 1e-4) continue;
331
- let n = re(t, u.point);
332
- if (l += n, e < d && !c) {
333
- if (l < r) continue;
334
- c = !0;
335
- }
336
- u = {
337
- point: t,
338
- pressure: o[e][2] >= 0 ? o[e][2] : .5,
339
- vector: ie(U(u.point, t)),
340
- distance: n,
341
- runningLength: l
342
- }, s.push(u);
28
+ function F(e = 24) {
29
+ let t = [];
30
+ for (let n = 0; n <= e; n++) {
31
+ let r = n / e, i = r * r * r * (10 + r * (-15 + 6 * r));
32
+ t.push(`${A(i)} ${A(r * 100)}%`);
343
33
  }
344
- return s.length > 0 && (s[0].vector = s[1]?.vector ?? [0, 0]), s;
34
+ return `linear(${t.join(", ")})`;
345
35
  }
346
- function ce(e, t = {}) {
347
- let { size: n = 16, smoothing: r = .5, thinning: i = .5, simulatePressure: a = !0, easing: o = oe, start: s = {}, end: c = {}, last: l = !1 } = t, { cap: u = !0, easing: d = (e) => e * (2 - e) } = s, { cap: f = !0, easing: p = (e) => --e * e * e + 1 } = c;
348
- if (e.length === 0 || n <= 0) return [];
349
- let m = e[e.length - 1].runningLength, h = s.taper === !1 ? 0 : s.taper === !0 ? Math.max(n, m) : s.taper ?? 0, g = c.taper === !1 ? 0 : c.taper === !0 ? Math.max(n, m) : c.taper ?? 0, _ = (n * r) ** 2, v = [], y = [], b = [], x = e.slice(0, 10).reduce((e, t) => {
350
- let r = t.pressure;
351
- if (a) {
352
- let i = X(1, t.distance / n);
353
- r = X(1, e + (X(1, 1 - i) - e) * (i * .275));
354
- }
355
- return (e + r) / 2;
356
- }, e[0].pressure), S = Q(n, i, e[e.length - 1].pressure, o), C, w = e[0].vector, T = e[0].point, E = T, D = T, O = E, k = !1;
357
- for (let t = 0; t < e.length; t++) {
358
- let { pressure: r } = e[t], { point: s, vector: c, distance: l, runningLength: u } = e[t];
359
- if (t < e.length - 1 && m - u < 3) continue;
360
- if (i) {
361
- if (a) {
362
- let e = X(1, l / n), t = X(1, 1 - e);
363
- r = X(1, x + (t - x) * (e * .275));
364
- }
365
- S = Q(n, i, r, o);
366
- } else S = n / 2;
367
- C === void 0 && (C = S);
368
- let f = u < h ? d(u / h) : 1, A = m - u < g ? p((m - u) / g) : 1;
369
- S = Math.max(.01, S * Math.min(f, A));
370
- let j = (t < e.length - 1 ? e[t + 1] : e[t]).vector, M = t < e.length - 1 ? te(c, j) : 1, N = te(c, w) < 0 && !k, P = M !== null && M < .2;
371
- if (N || P) {
372
- let e = W(G(w), S);
373
- for (let t = 0; t <= 1; t += .07692307692307693) D = Y(U(s, e), s, Z * t), v.push(D), O = Y(H(s, e), s, Z * -t), y.push(O);
374
- T = D, E = O, P && (k = !0);
375
- continue;
376
- }
377
- if (k = !1, t === e.length - 1) {
378
- let e = W(G(c), S);
379
- v.push(U(s, e)), y.push(H(s, e));
380
- continue;
381
- }
382
- let F = W(G(q(j, c, M)), S);
383
- D = U(s, F), (t <= 1 || K(T, D) > _) && (v.push(D), T = D), O = H(s, F), (t <= 1 || K(E, O) > _) && (y.push(O), E = O), x = r, w = c, b.push(S);
384
- }
385
- let A = e[0].point.slice(0, 2), j = e.length > 1 ? e[e.length - 1].point.slice(0, 2) : H(e[0].point, [1, 1]), M = [], N = [];
386
- if (e.length === 1) {
387
- if (!(h || g) || l) {
388
- let e = H(A, W(ie(G(U(A, j))), -(C ?? S))), t = [];
389
- for (let n = 1 / 13, r = n; r <= 1; r += n) t.push(Y(e, A, Z * 2 * r));
390
- return t;
391
- }
392
- } else {
393
- if (!(h || g && e.length === 1)) if (u) for (let e = 1 / 13, t = e; t <= 1; t += e) {
394
- let e = Y(y[0], A, Z * t);
395
- M.push(e);
396
- }
397
- else {
398
- let e = U(v[0], y[0]), t = W(e, .5), n = W(e, .51);
399
- M.push(U(A, t), U(A, n), H(A, n), H(A, t));
36
+ function I(e, t) {
37
+ let n = 1.2086000000000001 * t, r = Math.max(0, (e.height - n) / 2);
38
+ return e.y + r + C * t;
39
+ }
40
+ function L(e, t) {
41
+ let n = M(t.seed * 9541 + 17), r = e.width, i = I(e, t.fs), a = t.kind === "strike" ? i - D * t.fs : i + E * t.fs, o = n.span(.005, .02), s = Math.max(n.span(.012, .035), o + .004), c = n.sign(.7) * r * n.span(.006, .014), l = n.span(-.4, .4), u = Math.tan(j(n.span(-1.2, 1.2))), d = n.sign() * .55 * N(1, t.fs), f = r * (1 + o + s), p = e.x - o * r, m = Math.max(28, Math.round(f / 5)), h = [];
42
+ for (let e = 0; e <= m; e++) {
43
+ let t = e / m, n = p + t * f, r = 4 * t * (1 - t), i = a + c * (r + l * r * (1 - 2 * t)) + u * (n - p - f / 2);
44
+ if (t > .94) {
45
+ let e = (t - .94) / .06;
46
+ i += d * e * e;
400
47
  }
401
- let t = G(ee(e[e.length - 1].vector));
402
- if (g || h && e.length === 1) N.push(j);
403
- else if (f) {
404
- let e = H(j, W(t, S));
405
- for (let t = 1 / 29, n = t; n < 1; n += t) N.push(Y(e, j, Z * 3 * n));
406
- } else N.push(H(j, W(t, S)), H(j, W(t, S * .99)), U(j, W(t, S * .99)), U(j, W(t, S)));
48
+ h.push({
49
+ x: n,
50
+ y: i
51
+ });
407
52
  }
408
- return v.concat(N, y.reverse(), M);
409
- }
410
- function Q(e, t, n, r = oe) {
411
- if (!t) return e / 2;
412
- let i = n;
413
- return i < 0 && (i = 0), i > 1 && (i = 1), e * r(.5 - t * (.5 - i)) * .5 + e / 2 * (1 - Math.abs(t));
53
+ return h;
414
54
  }
415
- function le(e, t = {}) {
416
- return ce(se(e, t), t);
417
- }
418
- function ue(e, t = !0) {
419
- if (e.length < 4) return "";
420
- let n = e[0], r = e[1], i = e[2], a = `M${n[0].toFixed(2)},${n[1].toFixed(2)} Q${r[0].toFixed(2)},${r[1].toFixed(2)} ${J(r, i)[0].toFixed(2)},${J(r, i)[1].toFixed(2)} T`;
421
- for (let t = 2, i = e.length - 1; t < i; t++) n = e[t], r = e[t + 1], a += `${J(n, r)[0].toFixed(2)},${J(n, r)[1].toFixed(2)} `;
422
- return t && (a += "Z"), a;
423
- }
424
- //#endregion
425
- //#region src/components/handmark/texture.ts
426
- function de(e, t, n) {
427
- if (t.grain <= 0 && t.grainScale <= 0) return "";
428
- let r = (n ^ 34283) & 65535, i = (.55 - t.grain * .42).toFixed(3), a = t.grain > 0 ? "in" : "over";
429
- return `
430
- <filter id="${e}" x="-40%" y="-60%" width="180%" height="220%" color-interpolation-filters="sRGB">
431
- <feTurbulence type="fractalNoise" baseFrequency="${(.012 * t.roughness).toFixed(4)}" numOctaves="2" seed="${r}" result="warp"/>
432
- <feDisplacementMap in="SourceGraphic" in2="warp" scale="${(t.grainScale * 1.4).toFixed(2)}" xChannelSelector="R" yChannelSelector="G" result="wob"/>
433
- <feTurbulence type="fractalNoise" baseFrequency="${t.grainFreq}" numOctaves="${t.octaves}" seed="${r + 17}" result="grain"/>
434
- <feColorMatrix in="grain" type="matrix" result="grainA"
435
- values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${(6 + t.grain * 10).toFixed(2)} ${i}"/>
436
- <feComposite in="wob" in2="grainA" operator="${a}" result="grained"/>
437
- <feDisplacementMap in="grained" in2="grain" scale="${(t.grainScale * 2).toFixed(2)}" xChannelSelector="R" yChannelSelector="G"/>
438
- </filter>`;
55
+ function R(e, t) {
56
+ return {
57
+ a: O * (e.width / 2 + .06 * t),
58
+ b: O * (S * t / 2 + .08 * t)
59
+ };
439
60
  }
440
- function $(e) {
441
- return e.grain > 0 || e.grainScale > 0;
61
+ function te(e, t) {
62
+ return R(e, t).a - e.width / 2;
442
63
  }
443
- //#endregion
444
- //#region src/components/handmark/ink.ts
445
- function fe(e) {
446
- let t = 0;
447
- for (let n = 1; n < e.length; n++) t += Math.hypot(e[n][0] - e[n - 1][0], e[n][1] - e[n - 1][1]);
448
- return t;
449
- }
450
- function pe(e) {
451
- let t = e.length;
452
- if (t < 3) return e;
453
- let n = [e[0]];
454
- for (let r = 1; r < t - 1; r++) {
455
- let t = e[r - 1], i = e[r + 1], a = e[r];
456
- n.push([.25 * t[0] + .5 * a[0] + .25 * i[0], .25 * t[1] + .5 * a[1] + .25 * i[1]]);
64
+ function z(e, t) {
65
+ let n = M(t.seed * 40503 + 101), { a: r, b: i } = R(e, t.fs), a = e.x + e.width / 2, o = I(e, t.fs) - S * t.fs / 2, s = j(n.span(118, 142)), c = j(n.span(384, 402)), l = n.span(.025, k), u = n.span(0, Math.PI * 2), d = n.span(0, Math.PI * 2), f = [];
66
+ for (let e = 0; e <= 96; e++) {
67
+ let t = e / 96, n = s + t * c, p = (1 + l * t) * (1 + .022 * Math.sin(n + u) + .014 * Math.sin(2 * n + d)), m = Math.cos(n), h = Math.sin(n);
68
+ f.push({
69
+ x: a + p * r * Math.sign(m) * Math.abs(m) ** (2 / 3),
70
+ y: o + p * i * Math.sign(h) * Math.abs(h) ** (2 / 3)
71
+ });
457
72
  }
458
- return n.push(e[t - 1]), n;
73
+ return f;
459
74
  }
460
- function me(e, t) {
461
- let n = e.length;
462
- if (t <= 0 || t >= n - 1) return 0;
463
- let r = e[t - 1], i = e[t], a = e[t + 1], o = i[0] - r[0], s = i[1] - r[1], c = a[0] - i[0], l = a[1] - i[1], u = Math.hypot(o, s), d = Math.hypot(c, l);
464
- if (u === 0 || d === 0) return 0;
465
- let f = Math.abs(o * l - s * c) / (u * d);
466
- return Math.min(1, f);
467
- }
468
- var he = 2.5, ge = .9;
469
- function _e(e, n, r) {
470
- let i = t(r >>> 0), a = pe(e);
471
- return e.map((e, t) => {
472
- let r = ge * (1 - he * me(a, t)) + (i() - .5) * n.weightJitter * .4;
473
- return [
474
- e[0],
475
- e[1],
476
- Math.max(.05, Math.min(1, r))
477
- ];
478
- });
479
- }
480
- function ve(e) {
481
- return e === "out-cubic" ? (e) => 1 - (1 - e) ** 3 : (e) => e;
482
- }
483
- function ye(e, n, r, i, a, o = !1) {
484
- if (n.stamp) {
485
- let a = t(r >>> 0), o = n.stamp({
486
- centerline: e,
487
- brush: n,
488
- rng: a,
489
- seed: r,
490
- length: fe(e),
491
- color: i
75
+ function B(e, t) {
76
+ let n = M(t.seed * 34283 + 7), r = I(e, t.fs), i = w * t.fs, a = r + T * t.fs, o = a - i, s = n.span(.01, .02) * e.width, c = e.x - s, l = e.x + e.width + s, u = i * Math.tan(j(n.span(-2, 2))), d = i * Math.tan(j(n.span(-2, 2))), f = n.span(-.025, .025) * i, p = n.span(-.025, .025) * i, m = [];
77
+ for (let e = 0; e <= 24; e++) {
78
+ let t = e / 24;
79
+ m.push({
80
+ x: c + t * (l - c),
81
+ y: a + f * Math.sin(Math.PI * t)
492
82
  });
493
- return {
494
- paths: o.paths,
495
- filterId: o.filterId ?? null,
496
- defs: o.defs ?? []
497
- };
498
83
  }
499
- let s = [], c = (e) => o ? S(e) : v(e);
500
- for (let t = 0; t < n.passes; t++) {
501
- let a = e[0], o = e[e.length - 1], l = b(e, a[0], a[1], o[0], o[1], n.weight * .06, r + 991 * t), u = n.opacity * (1 - n.passOpacity * t);
502
- if (n.ribbon === "hull") {
503
- let e = _e(l, n, r + 7 * t), a = Math.max(.12, Math.min(.6, .875 - .75 * n.roughness)), o = le(e, {
504
- size: n.weight,
505
- thinning: n.thinning,
506
- streamline: a,
507
- last: !0,
508
- start: {
509
- taper: n.taper.start,
510
- easing: ve(n.taper.ease)
511
- },
512
- end: {
513
- taper: n.taper.end,
514
- easing: ve(n.taper.ease)
515
- }
516
- }), d = ue(o);
517
- o.length < 4 || d === "" ? s.push({
518
- d: c(l),
519
- stroke: i,
520
- opacity: u,
521
- blend: n.blend,
522
- cap: n.cap
523
- }) : s.push({
524
- d,
525
- fill: i,
526
- opacity: u,
527
- blend: n.blend,
528
- cap: n.cap
529
- });
530
- } else s.push({
531
- d: c(l),
532
- stroke: i,
533
- opacity: u,
534
- blend: n.blend,
535
- cap: n.cap
84
+ for (let e = 24; e >= 0; e--) {
85
+ let t = e / 24, n = c + u + t * (l + d - (c + u));
86
+ m.push({
87
+ x: n,
88
+ y: o + p * Math.sin(Math.PI * t)
536
89
  });
537
90
  }
538
- let l = $(n) ? de(a, n, r) : "";
539
- return {
540
- paths: s,
541
- filterId: l ? a : null,
542
- defs: l ? [l] : []
543
- };
91
+ return m;
544
92
  }
545
- //#endregion
546
- //#region src/components/handmark/composables/useHandMark.ts
547
- var be = {
548
- currentFrame: f(0),
549
- start: () => {},
550
- stop: () => {}
551
- };
552
- function xe(e, t, n = null, r = 40) {
553
- return {
554
- brush: e.brush ?? "pen",
555
- shape: e.shape ?? "underline",
556
- color: e.color ?? "currentColor",
557
- seed: e.seed ?? 1,
558
- overrides: e.overrides,
559
- animation: e.animation ?? "none",
560
- boilFps: e.boilFps ?? 8,
561
- boilFrames: e.boilFrames ?? 3,
562
- roughness: e.roughness ?? null,
563
- segments: e.segments ?? null,
564
- jagged: e.jagged ?? !1,
565
- natural: e.natural ?? e.brush === "boil",
566
- amplitude: e.amplitude ?? null,
567
- box: e.box ?? null,
568
- path: e.path ?? null,
569
- filterId: t,
570
- baselineFrac: n,
571
- vbH: r
572
- };
93
+ function V(e) {
94
+ let t = (e) => e * e * (3 - 2 * e);
95
+ return e < .05 ? .3 + .7 * t(e / .05) : e > .92 ? .25 + .75 * t((1 - e) / .08) : 1;
573
96
  }
574
- function Se(e) {
575
- let t = r(() => {
576
- let t = { ...e.value.overrides ?? {} };
577
- return e.value.roughness != null && (t.roughness = e.value.roughness), e.value.segments != null && (t.segments = e.value.segments), E(e.value.brush, t);
578
- }), n = r(() => $(t.value)), i = r(() => {
579
- let n = e.value.amplitude ?? t.value.wobble / 1.4;
580
- return z(e.value.shape, {
581
- roughness: t.value.roughness,
582
- segments: t.value.segments,
583
- seed: e.value.seed,
584
- jagged: e.value.jagged
585
- }, e.value.box, e.value.baselineFrac, e.value.natural, e.value.vbH, n);
586
- }), a = r(() => e.value.animation === "boil" || e.value.animation === "draw-then-boil"), o = r(() => e.value.animation === "draw-on" || e.value.animation === "draw-then-boil"), s = r(() => n.value ? "clip" : "dashoffset"), c = f(!1), l = e.value.animation === "boil" || e.value.animation === "draw-then-boil" ? C(() => a.value && c.value ? e.value.boilFrames : 1, () => Math.max(16, 1e3 / e.value.boilFps)) : be, u = r(() => {
587
- if (e.value.path) return e.value.path;
588
- let n = i.value.lines;
589
- if (a.value && c.value) {
590
- let r = t.value.wobble * .4 + .4, a = l.currentFrame.value;
591
- n = B(i.value, r, e.value.seed + a * 31);
592
- }
593
- return V(n, e.value.jagged);
594
- }), d = r(() => e.value.path ? [] : a.value && c.value ? B(i.value, t.value.wobble * .4 + .4, e.value.seed + l.currentFrame.value * 31) : i.value.lines);
97
+ function H(e, t) {
98
+ let n = e[Math.max(0, t - 1)], r = e[Math.min(e.length - 1, t + 1)], i = r.x - n.x, a = r.y - n.y, o = Math.hypot(i, a) || 1;
595
99
  return {
596
- brush: t,
597
- baseGeom: i,
598
- fragment: r(() => {
599
- let n = {
600
- paths: [],
601
- filterId: null,
602
- defs: []
603
- }, r = d.value.length ? d.value : [[]];
604
- for (let i of r) {
605
- let r = ye(i, t.value, e.value.seed, e.value.color, e.value.filterId, e.value.jagged);
606
- n.paths.push(...r.paths), r.filterId && !n.filterId && (n.filterId = r.filterId, n.defs = r.defs);
607
- }
608
- return n;
609
- }),
610
- pathD: u,
611
- grained: n,
612
- drawKind: s,
613
- draws: o,
614
- boils: a,
615
- boil: l,
616
- boilArmed: c
100
+ x: i / o,
101
+ y: a / o
617
102
  };
618
103
  }
104
+ function U(e) {
105
+ return e.length === 0 ? "" : e.map((e, t) => `${t === 0 ? "M" : "L"}${A(e.x)} ${A(e.y)}`).join(" ");
106
+ }
107
+ function W(e, t) {
108
+ if (e.length < 2) return "";
109
+ let n = [0];
110
+ for (let t = 1; t < e.length; t++) n.push(n[t - 1] + Math.hypot(e[t].x - e[t - 1].x, e[t].y - e[t - 1].y));
111
+ let r = n[n.length - 1] || 1, i = [], a = [];
112
+ for (let o = 0; o < e.length; o++) {
113
+ let s = t * V(n[o] / r) / 2, c = H(e, o), l = -c.y * s, u = c.x * s;
114
+ i.push({
115
+ x: e[o].x + l,
116
+ y: e[o].y + u
117
+ }), a.push({
118
+ x: e[o].x - l,
119
+ y: e[o].y - u
120
+ });
121
+ }
122
+ return `${U(i.concat(a.reverse()))} Z`;
123
+ }
124
+ function ne(e) {
125
+ return e.length ? `${U(e)} Z` : "";
126
+ }
127
+ function re(e, t) {
128
+ return (r(e) ^ t * 2654435761) >>> 0;
129
+ }
619
130
  //#endregion
620
131
  //#region src/components/handmark/HandMark.vue?vue&type=script&setup=true&lang.ts
621
- var Ce = [
622
- "data-shape",
623
- "data-behind",
624
- "data-grained"
625
- ], we = ["viewBox"], Te = ["innerHTML"], Ee = [
132
+ var ie = ["data-shape"], ae = { key: 0 }, oe = { key: 1 }, se = ["width", "height"], G = [
133
+ "id",
134
+ "x",
135
+ "y",
136
+ "width",
137
+ "height"
138
+ ], ce = [
139
+ "data-i",
140
+ "d",
141
+ "stroke-width"
142
+ ], le = [
626
143
  "d",
627
- "stroke",
628
144
  "fill",
629
- "stroke-width",
630
- "stroke-opacity",
631
- "fill-opacity",
632
- "stroke-linecap",
633
- "filter"
634
- ], De = /*#__PURE__*/ e(/* @__PURE__ */ o({
145
+ "mask"
146
+ ], K = /*#__PURE__*/ e(/* @__PURE__ */ c({
635
147
  __name: "HandMark",
636
148
  props: {
637
- brush: { default: "pen" },
638
149
  shape: { default: "underline" },
639
150
  color: { default: "currentColor" },
640
- seed: { default: 1 },
641
- overrides: {},
642
- animation: { default: "none" },
643
- drawMs: { default: 800 },
644
- drawDelayMs: { default: 0 },
645
- appear: { default: "visible" },
646
- boilFps: { default: 8 },
647
- boilFrames: { default: 3 },
648
- roughness: {},
649
- segments: {},
650
- jagged: {
151
+ weight: { default: 1 },
152
+ seed: {},
153
+ draw: {
651
154
  type: Boolean,
652
- default: !1
653
- },
654
- amplitude: {},
655
- natural: { type: Boolean },
656
- box: {},
657
- path: {},
658
- points: {}
155
+ default: !0
156
+ }
659
157
  },
660
- setup(e, { expose: t }) {
661
- let o = e, v = `hm-${g().replace(/[^a-zA-Z0-9_-]/g, "")}`, y = f(null), b = f(null), x = r(() => {
662
- let e = o.box == null && (o.shape === "underline" || o.shape === "strikethrough" || o.shape === "highlight"), t = b.value;
663
- return !e || t == null || t <= 0 ? 40 : 100 / t;
664
- }), { brush: S, fragment: C, grained: w, drawKind: T, draws: E, boils: D, boil: O, boilArmed: k } = Se(r(() => xe(o, v, y.value, x.value))), A = r(() => o.shape === "highlight"), j = r(() => o.path ?? null), M = f(!1), N = f(null), P = null, F = r(() => E.value ? `${T.value === "clip" ? "clip-path" : "stroke-dashoffset"} ${o.drawMs}ms var(--ease-out-expo) ${o.drawDelayMs}ms` : "none");
665
- function I() {
666
- D.value && (k.value = !0, O.start());
158
+ setup(e, { expose: n }) {
159
+ let r = e, c = (e) => Math.ceil(e * 1e3) / 1e3, b = (e) => Math.floor(e * 1e3) / 1e3, x = ee().replace(/[^a-zA-Z0-9_-]/g, ""), S = h(null), C = h([]), T = h([]), E = h(0), D = h(1), O = h(0), k = h(!1), A = a(() => {
160
+ let e = Number(r.color);
161
+ return Number.isFinite(e) ? e : 78;
162
+ }), j = a(() => r.shape === "highlight" ? "var(--hm-band)" : r.color), M = a(() => ({
163
+ "--hm-h": `${A.value}`,
164
+ "--hm-reserve": E.value ? `${E.value}px` : "0px"
165
+ }));
166
+ function I(e) {
167
+ let t = 0;
168
+ for (let n = 1; n < e.length; n++) t += Math.hypot(e[n].x - e[n - 1].x, e[n].y - e[n - 1].y);
169
+ return t;
170
+ }
171
+ function R(e) {
172
+ let t = e.parentElement;
173
+ for (; t && getComputedStyle(t).display.startsWith("inline");) t = t.parentElement;
174
+ return t ?? document.body;
667
175
  }
668
- function L() {
669
- if (!E.value) {
670
- I();
671
- return;
176
+ function V(e, t) {
177
+ let n = R(e), i = Array.from(n.querySelectorAll(`.hm[data-shape="${r.shape}"]`)), a = /* @__PURE__ */ new Set();
178
+ for (let e of Array.from(n.querySelectorAll(".hm"))) {
179
+ let n = e.getBoundingClientRect();
180
+ n.height > 0 && n.top < t - 1 && a.add(Math.round(n.top));
672
181
  }
673
- P !== null && cancelAnimationFrame(P), M.value = !1, N.value && N.value.offsetWidth, P = requestAnimationFrame(() => {
674
- P = null, M.value = !0;
675
- });
182
+ return {
183
+ index: Math.max(0, i.indexOf(e)),
184
+ line: a.size
185
+ };
186
+ }
187
+ function H(e) {
188
+ let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = document.createRange(), r = [];
189
+ for (let e = t.nextNode(); e; e = t.nextNode()) if ((e.textContent ?? "").trim().length !== 0 && !e.parentElement?.closest("svg")) {
190
+ n.selectNodeContents(e);
191
+ for (let e of Array.from(n.getClientRects())) {
192
+ if (e.width <= 0 || e.height <= 0) continue;
193
+ let t = r.find((t) => Math.min(t.y + t.height, e.bottom) - Math.max(t.y, e.top) > Math.min(t.height, e.height) / 2);
194
+ if (!t) {
195
+ r.push({
196
+ x: e.left,
197
+ y: e.top,
198
+ width: e.width,
199
+ height: e.height
200
+ });
201
+ continue;
202
+ }
203
+ let n = Math.max(t.x + t.width, e.right), i = Math.max(t.y + t.height, e.bottom);
204
+ t.x = Math.min(t.x, e.left), t.y = Math.min(t.y, e.top), t.width = n - t.x, t.height = i - t.y;
205
+ }
206
+ }
207
+ return n.detach?.(), r.sort((e, t) => e.y - t.y || e.x - t.x);
676
208
  }
677
- function R() {
678
- o.animation === "draw-then-boil" && I();
209
+ function K(e, t) {
210
+ let n = t / 2 + 1, r = (e) => b(Math.min(...e) - n), i = (e) => c(Math.max(...e) + n), a = e.map((e) => e.x), o = e.map((e) => e.y), s = r(a), l = r(o);
211
+ return {
212
+ x: s,
213
+ y: l,
214
+ width: c(i(a) - s),
215
+ height: c(i(o) - l)
216
+ };
679
217
  }
680
- t({ play: L });
681
- let z = r(() => o.box == null && (o.shape === "underline" || o.shape === "strikethrough" || o.shape === "highlight"));
682
- function B(e) {
683
- if (typeof document > "u" || typeof Range > "u") return null;
684
- let t = Array.from(e.childNodes).filter((e) => e.nodeType === Node.ELEMENT_NODE ? e.tagName !== "svg" : e.nodeType === Node.TEXT_NODE && (e.textContent ?? "").trim().length > 0);
685
- if (t.length === 0) return null;
686
- let n = document.createRange();
687
- n.selectNode(t[0]), t.length > 1 && n.setEndAfter(t[t.length - 1]);
688
- let r = n.getBoundingClientRect();
689
- return n.detach?.(), r.height > 0 ? r : null;
218
+ function ue(e, t, n) {
219
+ if (r.shape === "highlight") {
220
+ let r = B(e, {
221
+ fs: t,
222
+ seed: n
223
+ }), i = r.length / 2, a = [{
224
+ x: r[0].x,
225
+ y: (r[0].y + r[r.length - 1].y) / 2
226
+ }, {
227
+ x: r[i - 1].x,
228
+ y: (r[i - 1].y + r[i].y) / 2
229
+ }], o = w * t * 1.6;
230
+ return {
231
+ ink: ne(r),
232
+ guide: U(a),
233
+ length: I(a),
234
+ stroke: o,
235
+ window: K(r.concat(a), o)
236
+ };
237
+ }
238
+ let i = N(r.weight * D.value, t), a = r.shape === "circle" ? z(e, {
239
+ fs: t,
240
+ seed: n
241
+ }) : L(e, {
242
+ fs: t,
243
+ seed: n,
244
+ kind: r.shape === "strike" ? "strike" : "underline"
245
+ });
246
+ return {
247
+ ink: W(a, i),
248
+ guide: U(a),
249
+ length: I(a),
250
+ stroke: i * 1.6,
251
+ window: K(a, i * 1.6)
252
+ };
690
253
  }
691
- function V() {
692
- if (!z.value) return;
693
- let e = N.value;
254
+ function q() {
255
+ let e = S.value;
694
256
  if (!e) return;
695
- let t = B(e);
696
- if (!t) return;
697
- let n = e.getBoundingClientRect();
698
- if (n.height <= 0) return;
699
- n.width > 0 && (b.value = n.width / n.height);
700
- let r = (t.bottom - n.top) / n.height;
701
- y.value = Math.min(1, Math.max(0, r));
257
+ let n = H(e);
258
+ if (n.length === 0) return;
259
+ let i = parseFloat(getComputedStyle(e).fontSize) || 16, a = (C.value[0] ?? e).getBoundingClientRect(), { index: o, line: s } = V(e, n[0].y), l = r.seed ?? re((e.textContent ?? "").trim(), o), u = s * 4 * t, d = [];
260
+ for (let e of n) {
261
+ let t = {
262
+ x: e.x - a.left,
263
+ y: e.y - a.top,
264
+ width: e.width,
265
+ height: e.height
266
+ }, n = ue(t, i, l + d.length), r = P(n.length);
267
+ d.push({
268
+ ink: n.ink,
269
+ guide: n.guide,
270
+ stroke: n.stroke,
271
+ window: n.window,
272
+ box: {
273
+ width: c(t.width),
274
+ height: c(t.height)
275
+ },
276
+ delay: u,
277
+ duration: r
278
+ }), u += r;
279
+ }
280
+ T.value = d, E.value = r.shape === "circle" ? Math.max(0, te({
281
+ x: 0,
282
+ y: 0,
283
+ width: n[0].width,
284
+ height: n[0].height
285
+ }, i)) : 0;
702
286
  }
703
- let H = null;
704
- function U() {
705
- !z.value || !N.value || (V(), typeof document < "u" && document.fonts?.ready && document.fonts.ready.then(() => V()), typeof ResizeObserver < "u" && (H = new ResizeObserver(() => V()), H.observe(N.value)));
287
+ function J(e = 0) {
288
+ if (typeof document > "u" || !S.value) return;
289
+ let t = window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches ?? !1, n = getComputedStyle(S.value).getPropertyValue("--spring-press").trim(), i = e > 0 && n ? n : F();
290
+ for (let n of Array.from(S.value.querySelectorAll(".hm-guide"))) {
291
+ let a = n.getTotalLength?.() ?? 0;
292
+ if (!a) continue;
293
+ let o = T.value[Number(n.dataset.i ?? 0)];
294
+ n.style.strokeDasharray = `${a}`, n.style.strokeDashoffset = "0", !(!r.draw || t || typeof n.animate != "function") && n.animate([{ strokeDashoffset: a * (1 - e) }, { strokeDashoffset: 0 }], {
295
+ duration: e > 0 ? 220 : o?.duration ?? 400,
296
+ delay: e > 0 ? 0 : o?.delay ?? 0,
297
+ easing: i,
298
+ fill: "both"
299
+ });
300
+ }
706
301
  }
707
- let W = null;
708
- u(() => {
709
- U(), o.animation === "boil" && I(), o.appear === "mount" ? L() : o.appear === "visible" && typeof IntersectionObserver < "u" ? (W = new IntersectionObserver((e) => {
710
- e.some((e) => e.isIntersecting) && (L(), W?.disconnect());
711
- }, { threshold: .01 }), N.value && W.observe(N.value)) : o.appear === "visible" && L();
712
- }), l(() => {
713
- P !== null && cancelAnimationFrame(P), W?.disconnect(), H?.disconnect(), O.stop();
714
- }), _(() => o.animation, () => {
715
- M.value = !1, k.value = !1;
716
- });
717
- let ee = {
718
- "source-over": "normal",
719
- multiply: "multiply",
720
- darken: "darken",
721
- screen: "screen"
722
- };
723
- function G(e) {
724
- return {
725
- mixBlendMode: ee[e],
726
- transition: F.value
727
- };
302
+ function de() {
303
+ J(0);
304
+ }
305
+ function Y() {
306
+ D.value === 1 && (D.value = 1.04, q(), J(.35), window.setTimeout(() => {
307
+ D.value = 1, q();
308
+ }, 220));
728
309
  }
729
- return (t, r) => (d(), a("span", {
310
+ let X = null, Z = 0;
311
+ function Q() {
312
+ let e = S.value;
313
+ if (!e) return;
314
+ let t = e.getBoundingClientRect().top, n = t - Z;
315
+ Z = t, k.value = !1, O.value = Math.sign(n) * Math.min(1.5, Math.abs(.06 * n)), X !== null && window.clearTimeout(X), X = window.setTimeout(() => {
316
+ k.value = !0, O.value = 0;
317
+ }, 90);
318
+ }
319
+ let $ = null;
320
+ return p(() => {
321
+ q(), l(() => {
322
+ q(), J(0);
323
+ }), document.fonts?.ready?.then(() => {
324
+ q(), J(0);
325
+ }), typeof ResizeObserver < "u" && S.value && ($ = new ResizeObserver(() => q()), $.observe(S.value)), Z = S.value?.getBoundingClientRect().top ?? 0, document.addEventListener("scroll", Q, {
326
+ capture: !0,
327
+ passive: !0
328
+ });
329
+ }), f(() => {
330
+ $?.disconnect(), X !== null && window.clearTimeout(X), document.removeEventListener("scroll", Q, { capture: !0 });
331
+ }), y(() => [
332
+ r.shape,
333
+ r.weight,
334
+ r.seed
335
+ ], () => q()), n({ play: de }), (t, n) => (m(), o("span", {
730
336
  class: "hm",
731
337
  ref_key: "root",
732
- ref: N,
338
+ ref: S,
733
339
  "data-shape": e.shape,
734
- "data-behind": A.value,
735
- "data-grained": h(w)
736
- }, [m(t.$slots, "default", {}, void 0, !0), (d(), a("svg", {
737
- class: "hm__svg",
738
- viewBox: `0 0 ${h(100)} ${x.value}`,
739
- preserveAspectRatio: "none",
340
+ style: d(M.value),
341
+ onPointerenter: Y,
342
+ onPointerdown: Y,
343
+ onFocusin: Y
344
+ }, [e.shape === "strike" ? (m(), o("del", ae, [_(t.$slots, "default", {}, void 0, !0)])) : e.shape === "highlight" ? (m(), o("mark", oe, [_(t.$slots, "default", {}, void 0, !0)])) : _(t.$slots, "default", {}, void 0, !0, 2), (m(!0), o(i, null, g(T.value, (e, t) => (m(), o("svg", {
345
+ key: t,
346
+ ref_for: !0,
347
+ ref_key: "frames",
348
+ ref: C,
349
+ class: u(["hm-mark", { "hm-mark--settling": k.value }]),
350
+ width: e.box.width,
351
+ height: e.box.height,
352
+ style: d({ transform: `translateY(${-O.value}px)` }),
740
353
  "aria-hidden": "true",
741
354
  focusable: "false"
742
- }, [h(C).filterId ? (d(), a("defs", {
743
- key: 0,
744
- innerHTML: h(C).defs[0]
745
- }, null, 8, Te)) : i("", !0), (d(!0), a(n, null, p(h(C).paths, (e, t) => (d(), a("path", {
746
- key: t,
747
- class: s(["hm__path", {
748
- drawn: M.value,
749
- [`hm__path--${h(T)}`]: h(E)
750
- }]),
751
- d: j.value ?? e.d,
752
- pathLength: "1",
753
- "vector-effect": "non-scaling-stroke",
754
- stroke: e.stroke ?? "none",
755
- fill: e.fill ?? "none",
756
- "stroke-width": e.stroke ? h(S).weight : 0,
757
- "stroke-opacity": e.stroke ? e.opacity : void 0,
758
- "fill-opacity": e.fill ? e.opacity : void 0,
759
- "stroke-linecap": e.cap ?? "round",
760
- "stroke-linejoin": "round",
761
- filter: h(C).filterId ? `url(#${h(C).filterId})` : void 0,
762
- style: c(G(e.blend)),
763
- onTransitionend: R
764
- }, null, 46, Ee))), 128))], 8, we))], 8, Ce));
355
+ }, [s("defs", null, [s("mask", {
356
+ id: `${v(x)}-${t}`,
357
+ maskUnits: "userSpaceOnUse",
358
+ x: e.window.x,
359
+ y: e.window.y,
360
+ width: e.window.width,
361
+ height: e.window.height
362
+ }, [s("path", {
363
+ class: "hm-guide",
364
+ "data-i": t,
365
+ d: e.guide,
366
+ fill: "none",
367
+ stroke: "#fff",
368
+ "stroke-width": e.stroke,
369
+ "stroke-linecap": "round",
370
+ "stroke-linejoin": "round"
371
+ }, null, 8, ce)], 8, G)]), s("path", {
372
+ class: "hm-ink",
373
+ d: e.ink,
374
+ fill: j.value,
375
+ mask: `url(#${v(x)}-${t})`
376
+ }, null, 8, le)], 14, se))), 128))], 44, ie));
765
377
  }
766
- }), [["__scopeId", "data-v-fad07a4a"]]);
378
+ }), [["__scopeId", "data-v-0e9beb0b"]]);
767
379
  //#endregion
768
- export { T as BRUSHES, De as HandMark, A as UNDERLINE_GAP, k as VB_H, O as VB_W, B as boilLines, le as getStroke, se as getStrokePoints, ue as getSvgPathFromStroke, de as grainFilter, $ as hasGrain, ye as ink, D as lerpBrush, R as naturalUnderlinePoints, xe as normalizeProps, E as resolveBrush, V as serialize, z as shapeGeom, Se as useHandMark };
380
+ export { K as HandMark, b as SHAPES, B as handBand, L as handLine, z as handRing, P as markDuration, F as minJerk, U as serialize, W as strokeRibbon };