origam 2.2.1 → 2.3.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 (345) hide show
  1. package/CHANGELOG.md +224 -0
  2. package/README.md +22 -0
  3. package/dist/src/assets/css/tokens/dark.css +318 -0
  4. package/dist/src/assets/css/tokens/light.css +159 -0
  5. package/dist/src/assets/locales/index.js +2 -2
  6. package/dist/src/assets/scss/tokens/_dark.scss +159 -0
  7. package/dist/src/assets/scss/tokens/_light.scss +159 -0
  8. package/dist/src/components/Bracket/OrigamBracket.vue +530 -0
  9. package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +210 -0
  10. package/dist/src/components/Bracket/OrigamBracketMatch.vue +288 -0
  11. package/dist/src/components/Bracket/OrigamBracketRound.vue +150 -0
  12. package/dist/src/components/Bracket/index.cjs +34 -0
  13. package/dist/src/components/Bracket/index.d.ts +4 -0
  14. package/dist/src/components/Bracket/index.js +4 -0
  15. package/dist/src/components/ClientOnly/OrigamClientOnly.vue +28 -0
  16. package/dist/src/components/ClientOnly/index.cjs +13 -0
  17. package/dist/src/components/ClientOnly/index.d.ts +1 -0
  18. package/dist/src/components/ClientOnly/index.js +1 -0
  19. package/dist/src/components/Code/OrigamCode.vue +449 -0
  20. package/dist/src/components/Code/index.cjs +13 -0
  21. package/dist/src/components/Code/index.d.ts +1 -0
  22. package/dist/src/components/Code/index.js +1 -0
  23. package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1 -0
  24. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +614 -0
  25. package/dist/src/components/CommandPalette/index.cjs +13 -0
  26. package/dist/src/components/CommandPalette/index.d.ts +1 -0
  27. package/dist/src/components/CommandPalette/index.js +1 -0
  28. package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1 -0
  29. package/dist/src/components/Parallax/OrigamParallax.vue +65 -34
  30. package/dist/src/components/Parallax/OrigamParallaxLayer.vue +119 -0
  31. package/dist/src/components/Parallax/index.cjs +7 -0
  32. package/dist/src/components/Parallax/index.d.ts +1 -0
  33. package/dist/src/components/Parallax/index.js +1 -0
  34. package/dist/src/components/PasswordField/OrigamPasswordField.vue +1 -0
  35. package/dist/src/components/Select/OrigamSelect.vue +1 -0
  36. package/dist/src/components/SnackbarStack/OrigamSnackbarStack.vue +457 -0
  37. package/dist/src/components/SnackbarStack/index.cjs +13 -0
  38. package/dist/src/components/SnackbarStack/index.d.ts +1 -0
  39. package/dist/src/components/SnackbarStack/index.js +1 -0
  40. package/dist/src/components/Tabs/OrigamTab.vue +263 -0
  41. package/dist/src/components/Tabs/OrigamTabPanel.vue +112 -0
  42. package/dist/src/components/Tabs/OrigamTabPanels.vue +139 -0
  43. package/dist/src/components/Tabs/OrigamTabs.vue +242 -0
  44. package/dist/src/components/Tabs/index.cjs +34 -0
  45. package/dist/src/components/Tabs/index.d.ts +4 -0
  46. package/dist/src/components/Tabs/index.js +4 -0
  47. package/dist/src/components/TextField/OrigamTextField.vue +75 -5
  48. package/dist/src/components/TextareaField/OrigamRichToolbar.vue +284 -0
  49. package/dist/src/components/TextareaField/OrigamTextareaField.vue +192 -5
  50. package/dist/src/components/TextareaField/index.cjs +7 -0
  51. package/dist/src/components/TextareaField/index.d.ts +1 -0
  52. package/dist/src/components/TextareaField/index.js +1 -0
  53. package/dist/src/components/index.cjs +66 -0
  54. package/dist/src/components/index.d.ts +6 -0
  55. package/dist/src/components/index.js +6 -0
  56. package/dist/src/composables/Code/code.composable.cjs +98 -0
  57. package/dist/src/composables/Code/code.composable.d.ts +10 -0
  58. package/dist/src/composables/Code/code.composable.js +82 -0
  59. package/dist/src/composables/CommandPalette/command.composable.cjs +53 -0
  60. package/dist/src/composables/CommandPalette/command.composable.d.ts +37 -0
  61. package/dist/src/composables/CommandPalette/command.composable.js +46 -0
  62. package/dist/src/composables/Commons/virtual.composable.cjs +1 -0
  63. package/dist/src/composables/Commons/virtual.composable.js +1 -0
  64. package/dist/src/composables/CssSupport/cssSupport.composable.cjs +12 -0
  65. package/dist/src/composables/CssSupport/cssSupport.composable.d.ts +25 -0
  66. package/dist/src/composables/CssSupport/cssSupport.composable.js +10 -1
  67. package/dist/src/composables/DataTable/headers.composable.d.ts +36 -36
  68. package/dist/src/composables/Mask/index.cjs +16 -0
  69. package/dist/src/composables/Mask/index.d.ts +1 -0
  70. package/dist/src/composables/Mask/index.js +1 -0
  71. package/dist/src/composables/Mask/mask.composable.cjs +57 -0
  72. package/dist/src/composables/Mask/mask.composable.d.ts +39 -0
  73. package/dist/src/composables/Mask/mask.composable.js +51 -0
  74. package/dist/src/composables/Parallax/parallax.composable.cjs +232 -0
  75. package/dist/src/composables/Parallax/parallax.composable.d.ts +60 -0
  76. package/dist/src/composables/Parallax/parallax.composable.js +219 -0
  77. package/dist/src/composables/Responsive/aspect.composable.cjs +6 -1
  78. package/dist/src/composables/Responsive/aspect.composable.d.ts +10 -0
  79. package/dist/src/composables/Responsive/aspect.composable.js +6 -1
  80. package/dist/src/composables/SnackbarStack/snackbar-stack.composable.cjs +102 -0
  81. package/dist/src/composables/SnackbarStack/snackbar-stack.composable.d.ts +58 -0
  82. package/dist/src/composables/SnackbarStack/snackbar-stack.composable.js +92 -0
  83. package/dist/src/composables/Textarea/textarea-rich.composable.cjs +263 -0
  84. package/dist/src/composables/Textarea/textarea-rich.composable.d.ts +41 -0
  85. package/dist/src/composables/Textarea/textarea-rich.composable.js +257 -0
  86. package/dist/src/composables/index.cjs +66 -0
  87. package/dist/src/composables/index.d.ts +6 -0
  88. package/dist/src/composables/index.js +6 -0
  89. package/dist/src/consts/Bracket/bracket.const.cjs +12 -0
  90. package/dist/src/consts/Bracket/bracket.const.d.ts +34 -0
  91. package/dist/src/consts/Bracket/bracket.const.js +15 -0
  92. package/dist/src/consts/Code/code.const.cjs +26 -0
  93. package/dist/src/consts/Code/code.const.d.ts +40 -0
  94. package/dist/src/consts/Code/code.const.js +35 -0
  95. package/dist/src/consts/CommandPalette/command-palette.const.cjs +10 -0
  96. package/dist/src/consts/CommandPalette/command-palette.const.d.ts +16 -0
  97. package/dist/src/consts/CommandPalette/command-palette.const.js +7 -0
  98. package/dist/src/consts/Mask/built-in-patterns.const.cjs +66 -0
  99. package/dist/src/consts/Mask/built-in-patterns.const.d.ts +20 -0
  100. package/dist/src/consts/Mask/built-in-patterns.const.js +60 -0
  101. package/dist/src/consts/Parallax/parallax-layer.const.cjs +7 -0
  102. package/dist/src/consts/Parallax/parallax-layer.const.d.ts +3 -0
  103. package/dist/src/consts/Parallax/parallax-layer.const.js +1 -0
  104. package/dist/src/consts/SnackbarStack/snackbar-stack.const.cjs +12 -0
  105. package/dist/src/consts/SnackbarStack/snackbar-stack.const.d.ts +33 -0
  106. package/dist/src/consts/SnackbarStack/snackbar-stack.const.js +18 -0
  107. package/dist/src/consts/Tabs/tabs.const.cjs +9 -0
  108. package/dist/src/consts/Tabs/tabs.const.d.ts +23 -0
  109. package/dist/src/consts/Tabs/tabs.const.js +3 -0
  110. package/dist/src/consts/Textarea/textarea.const.cjs +28 -0
  111. package/dist/src/consts/Textarea/textarea.const.d.ts +38 -0
  112. package/dist/src/consts/Textarea/textarea.const.js +65 -0
  113. package/dist/src/consts/Theme/theme.const.cjs +15 -0
  114. package/dist/src/consts/Theme/theme.const.d.ts +9 -0
  115. package/dist/src/consts/Theme/theme.const.js +9 -0
  116. package/dist/src/consts/index.cjs +99 -0
  117. package/dist/src/consts/index.d.ts +9 -0
  118. package/dist/src/consts/index.js +9 -0
  119. package/dist/src/enums/Bracket/bracket-match-status.enum.cjs +13 -0
  120. package/dist/src/enums/Bracket/bracket-match-status.enum.d.ts +6 -0
  121. package/dist/src/enums/Bracket/bracket-match-status.enum.js +7 -0
  122. package/dist/src/enums/Bracket/bracket-variant.enum.cjs +12 -0
  123. package/dist/src/enums/Bracket/bracket-variant.enum.d.ts +5 -0
  124. package/dist/src/enums/Bracket/bracket-variant.enum.js +6 -0
  125. package/dist/src/enums/Code/code-lang.enum.cjs +23 -0
  126. package/dist/src/enums/Code/code-lang.enum.d.ts +25 -0
  127. package/dist/src/enums/Code/code-lang.enum.js +17 -0
  128. package/dist/src/enums/Code/code-theme.enum.cjs +12 -0
  129. package/dist/src/enums/Code/code-theme.enum.d.ts +12 -0
  130. package/dist/src/enums/Code/code-theme.enum.js +6 -0
  131. package/dist/src/enums/Mask/mask.enum.cjs +28 -0
  132. package/dist/src/enums/Mask/mask.enum.d.ts +36 -0
  133. package/dist/src/enums/Mask/mask.enum.js +22 -0
  134. package/dist/src/enums/Parallax/parallax-direction.enum.cjs +12 -0
  135. package/dist/src/enums/Parallax/parallax-direction.enum.d.ts +5 -0
  136. package/dist/src/enums/Parallax/parallax-direction.enum.js +6 -0
  137. package/dist/src/enums/Parallax/parallax-easing.enum.cjs +12 -0
  138. package/dist/src/enums/Parallax/parallax-easing.enum.d.ts +5 -0
  139. package/dist/src/enums/Parallax/parallax-easing.enum.js +6 -0
  140. package/dist/src/enums/Tabs/tab-variant.enum.cjs +12 -0
  141. package/dist/src/enums/Tabs/tab-variant.enum.d.ts +5 -0
  142. package/dist/src/enums/Tabs/tab-variant.enum.js +6 -0
  143. package/dist/src/enums/Textarea/textarea-mode.enum.cjs +11 -0
  144. package/dist/src/enums/Textarea/textarea-mode.enum.d.ts +13 -0
  145. package/dist/src/enums/Textarea/textarea-mode.enum.js +5 -0
  146. package/dist/src/enums/Textarea/textarea-output.enum.cjs +11 -0
  147. package/dist/src/enums/Textarea/textarea-output.enum.d.ts +14 -0
  148. package/dist/src/enums/Textarea/textarea-output.enum.js +5 -0
  149. package/dist/src/enums/Textarea/textarea-toolbar-command.enum.cjs +21 -0
  150. package/dist/src/enums/Textarea/textarea-toolbar-command.enum.d.ts +20 -0
  151. package/dist/src/enums/Textarea/textarea-toolbar-command.enum.js +15 -0
  152. package/dist/src/enums/Textarea/textarea-toolbar-position.enum.cjs +12 -0
  153. package/dist/src/enums/Textarea/textarea-toolbar-position.enum.d.ts +10 -0
  154. package/dist/src/enums/Textarea/textarea-toolbar-position.enum.js +6 -0
  155. package/dist/src/enums/index.cjs +132 -0
  156. package/dist/src/enums/index.d.ts +12 -0
  157. package/dist/src/enums/index.js +12 -0
  158. package/dist/src/interfaces/Bracket/bracket-competitor-component.interface.cjs +1 -0
  159. package/dist/src/interfaces/Bracket/bracket-competitor-component.interface.d.ts +53 -0
  160. package/dist/src/interfaces/Bracket/bracket-competitor-component.interface.js +0 -0
  161. package/dist/src/interfaces/Bracket/bracket-competitor.interface.cjs +1 -0
  162. package/dist/src/interfaces/Bracket/bracket-competitor.interface.d.ts +25 -0
  163. package/dist/src/interfaces/Bracket/bracket-competitor.interface.js +0 -0
  164. package/dist/src/interfaces/Bracket/bracket-match-component.interface.cjs +1 -0
  165. package/dist/src/interfaces/Bracket/bracket-match-component.interface.d.ts +45 -0
  166. package/dist/src/interfaces/Bracket/bracket-match-component.interface.js +0 -0
  167. package/dist/src/interfaces/Bracket/bracket-match.interface.cjs +1 -0
  168. package/dist/src/interfaces/Bracket/bracket-match.interface.d.ts +51 -0
  169. package/dist/src/interfaces/Bracket/bracket-match.interface.js +0 -0
  170. package/dist/src/interfaces/Bracket/bracket-round-component.interface.cjs +1 -0
  171. package/dist/src/interfaces/Bracket/bracket-round-component.interface.d.ts +26 -0
  172. package/dist/src/interfaces/Bracket/bracket-round-component.interface.js +0 -0
  173. package/dist/src/interfaces/Bracket/bracket-round.interface.cjs +1 -0
  174. package/dist/src/interfaces/Bracket/bracket-round.interface.d.ts +27 -0
  175. package/dist/src/interfaces/Bracket/bracket-round.interface.js +0 -0
  176. package/dist/src/interfaces/Bracket/bracket.interface.cjs +1 -0
  177. package/dist/src/interfaces/Bracket/bracket.interface.d.ts +71 -0
  178. package/dist/src/interfaces/Bracket/bracket.interface.js +0 -0
  179. package/dist/src/interfaces/Code/code.interface.cjs +1 -0
  180. package/dist/src/interfaces/Code/code.interface.d.ts +99 -0
  181. package/dist/src/interfaces/Code/code.interface.js +0 -0
  182. package/dist/src/interfaces/CommandPalette/command-palette.interface.cjs +1 -0
  183. package/dist/src/interfaces/CommandPalette/command-palette.interface.d.ts +57 -0
  184. package/dist/src/interfaces/CommandPalette/command-palette.interface.js +0 -0
  185. package/dist/src/interfaces/CommandPalette/command.interface.cjs +1 -0
  186. package/dist/src/interfaces/CommandPalette/command.interface.d.ts +51 -0
  187. package/dist/src/interfaces/CommandPalette/command.interface.js +0 -0
  188. package/dist/src/interfaces/Mask/mask-options.interface.cjs +1 -0
  189. package/dist/src/interfaces/Mask/mask-options.interface.d.ts +48 -0
  190. package/dist/src/interfaces/Mask/mask-options.interface.js +0 -0
  191. package/dist/src/interfaces/Nuxt/nuxt-module.interface.cjs +1 -0
  192. package/dist/src/interfaces/Nuxt/nuxt-module.interface.d.ts +73 -0
  193. package/dist/src/interfaces/Nuxt/nuxt-module.interface.js +0 -0
  194. package/dist/src/interfaces/Parallax/parallax-layer.interface.cjs +1 -0
  195. package/dist/src/interfaces/Parallax/parallax-layer.interface.d.ts +39 -0
  196. package/dist/src/interfaces/Parallax/parallax-layer.interface.js +0 -0
  197. package/dist/src/interfaces/Parallax/parallax.interface.d.ts +83 -3
  198. package/dist/src/interfaces/SnackbarStack/snackbar-stack-item.interface.cjs +1 -0
  199. package/dist/src/interfaces/SnackbarStack/snackbar-stack-item.interface.d.ts +60 -0
  200. package/dist/src/interfaces/SnackbarStack/snackbar-stack-item.interface.js +0 -0
  201. package/dist/src/interfaces/SnackbarStack/snackbar-stack.interface.cjs +1 -0
  202. package/dist/src/interfaces/SnackbarStack/snackbar-stack.interface.d.ts +60 -0
  203. package/dist/src/interfaces/SnackbarStack/snackbar-stack.interface.js +0 -0
  204. package/dist/src/interfaces/Tabs/tab-panel.interface.cjs +1 -0
  205. package/dist/src/interfaces/Tabs/tab-panel.interface.d.ts +12 -0
  206. package/dist/src/interfaces/Tabs/tab-panel.interface.js +0 -0
  207. package/dist/src/interfaces/Tabs/tab-panels.interface.cjs +1 -0
  208. package/dist/src/interfaces/Tabs/tab-panels.interface.d.ts +28 -0
  209. package/dist/src/interfaces/Tabs/tab-panels.interface.js +0 -0
  210. package/dist/src/interfaces/Tabs/tab.interface.cjs +1 -0
  211. package/dist/src/interfaces/Tabs/tab.interface.d.ts +18 -0
  212. package/dist/src/interfaces/Tabs/tab.interface.js +0 -0
  213. package/dist/src/interfaces/Tabs/tabs.interface.cjs +1 -0
  214. package/dist/src/interfaces/Tabs/tabs.interface.d.ts +26 -0
  215. package/dist/src/interfaces/Tabs/tabs.interface.js +0 -0
  216. package/dist/src/interfaces/TextField/text-field.interface.d.ts +21 -1
  217. package/dist/src/interfaces/Textarea/textarea-rich.interface.cjs +1 -0
  218. package/dist/src/interfaces/Textarea/textarea-rich.interface.d.ts +41 -0
  219. package/dist/src/interfaces/Textarea/textarea-rich.interface.js +0 -0
  220. package/dist/src/interfaces/Textarea/textarea-toolbar.interface.cjs +1 -0
  221. package/dist/src/interfaces/Textarea/textarea-toolbar.interface.d.ts +31 -0
  222. package/dist/src/interfaces/Textarea/textarea-toolbar.interface.js +0 -0
  223. package/dist/src/interfaces/TextareaField/textarea-field.interface.d.ts +38 -1
  224. package/dist/src/interfaces/index.cjs +231 -0
  225. package/dist/src/interfaces/index.d.ts +21 -0
  226. package/dist/src/interfaces/index.js +21 -0
  227. package/dist/src/nuxt/index.cjs +13 -0
  228. package/dist/src/nuxt/index.d.ts +2 -0
  229. package/dist/src/nuxt/index.js +1 -0
  230. package/dist/src/nuxt/module.cjs +74 -0
  231. package/dist/src/nuxt/module.d.ts +31 -0
  232. package/dist/src/nuxt/module.js +68 -0
  233. package/dist/src/nuxt/plugin.client.cjs +44 -0
  234. package/dist/src/nuxt/plugin.client.d.ts +2 -0
  235. package/dist/src/nuxt/plugin.client.js +36 -0
  236. package/dist/src/nuxt/plugin.server.cjs +51 -0
  237. package/dist/src/nuxt/plugin.server.d.ts +2 -0
  238. package/dist/src/nuxt/plugin.server.js +45 -0
  239. package/dist/src/types/Bracket/bracket-direction.type.cjs +1 -0
  240. package/dist/src/types/Bracket/bracket-direction.type.d.ts +13 -0
  241. package/dist/src/types/Bracket/bracket-direction.type.js +0 -0
  242. package/dist/src/types/Bracket/bracket-match-status.type.cjs +1 -0
  243. package/dist/src/types/Bracket/bracket-match-status.type.d.ts +2 -0
  244. package/dist/src/types/Bracket/bracket-match-status.type.js +0 -0
  245. package/dist/src/types/Bracket/bracket-round-side.type.cjs +1 -0
  246. package/dist/src/types/Bracket/bracket-round-side.type.d.ts +12 -0
  247. package/dist/src/types/Bracket/bracket-round-side.type.js +0 -0
  248. package/dist/src/types/Bracket/bracket-variant.type.cjs +1 -0
  249. package/dist/src/types/Bracket/bracket-variant.type.d.ts +2 -0
  250. package/dist/src/types/Bracket/bracket-variant.type.js +0 -0
  251. package/dist/src/types/Code/code-lang.type.cjs +1 -0
  252. package/dist/src/types/Code/code-lang.type.d.ts +2 -0
  253. package/dist/src/types/Code/code-lang.type.js +0 -0
  254. package/dist/src/types/Code/code-theme.type.cjs +1 -0
  255. package/dist/src/types/Code/code-theme.type.d.ts +2 -0
  256. package/dist/src/types/Code/code-theme.type.js +0 -0
  257. package/dist/src/types/CommandPalette/command-palette-hotkey.type.cjs +1 -0
  258. package/dist/src/types/CommandPalette/command-palette-hotkey.type.d.ts +5 -0
  259. package/dist/src/types/CommandPalette/command-palette-hotkey.type.js +0 -0
  260. package/dist/src/types/Mask/built-in-pattern.type.cjs +1 -0
  261. package/dist/src/types/Mask/built-in-pattern.type.d.ts +7 -0
  262. package/dist/src/types/Mask/built-in-pattern.type.js +0 -0
  263. package/dist/src/types/Mask/mask.type.cjs +1 -0
  264. package/dist/src/types/Mask/mask.type.d.ts +19 -0
  265. package/dist/src/types/Mask/mask.type.js +0 -0
  266. package/dist/src/types/Mask/pattern-validator.type.cjs +1 -0
  267. package/dist/src/types/Mask/pattern-validator.type.d.ts +16 -0
  268. package/dist/src/types/Mask/pattern-validator.type.js +0 -0
  269. package/dist/src/types/Parallax/parallax-direction.type.cjs +1 -0
  270. package/dist/src/types/Parallax/parallax-direction.type.d.ts +2 -0
  271. package/dist/src/types/Parallax/parallax-direction.type.js +0 -0
  272. package/dist/src/types/Parallax/parallax-easing.type.cjs +1 -0
  273. package/dist/src/types/Parallax/parallax-easing.type.d.ts +2 -0
  274. package/dist/src/types/Parallax/parallax-easing.type.js +0 -0
  275. package/dist/src/types/SnackbarStack/snackbar-stack-direction.type.cjs +1 -0
  276. package/dist/src/types/SnackbarStack/snackbar-stack-direction.type.d.ts +11 -0
  277. package/dist/src/types/SnackbarStack/snackbar-stack-direction.type.js +0 -0
  278. package/dist/src/types/SnackbarStack/snackbar-stack-location.type.cjs +1 -0
  279. package/dist/src/types/SnackbarStack/snackbar-stack-location.type.d.ts +9 -0
  280. package/dist/src/types/SnackbarStack/snackbar-stack-location.type.js +0 -0
  281. package/dist/src/types/SnackbarStack/snackbar-stack.type.cjs +1 -0
  282. package/dist/src/types/SnackbarStack/snackbar-stack.type.d.ts +2 -0
  283. package/dist/src/types/SnackbarStack/snackbar-stack.type.js +0 -0
  284. package/dist/src/types/Tabs/tab-panel.type.cjs +1 -0
  285. package/dist/src/types/Tabs/tab-panel.type.d.ts +2 -0
  286. package/dist/src/types/Tabs/tab-panel.type.js +0 -0
  287. package/dist/src/types/Tabs/tab-panels.type.cjs +1 -0
  288. package/dist/src/types/Tabs/tab-panels.type.d.ts +2 -0
  289. package/dist/src/types/Tabs/tab-panels.type.js +0 -0
  290. package/dist/src/types/Tabs/tab-variant.type.cjs +1 -0
  291. package/dist/src/types/Tabs/tab-variant.type.d.ts +2 -0
  292. package/dist/src/types/Tabs/tab-variant.type.js +0 -0
  293. package/dist/src/types/Tabs/tab.type.cjs +1 -0
  294. package/dist/src/types/Tabs/tab.type.d.ts +2 -0
  295. package/dist/src/types/Tabs/tab.type.js +0 -0
  296. package/dist/src/types/Tabs/tabs.type.cjs +1 -0
  297. package/dist/src/types/Tabs/tabs.type.d.ts +2 -0
  298. package/dist/src/types/Tabs/tabs.type.js +0 -0
  299. package/dist/src/types/Textarea/textarea-mode.type.cjs +1 -0
  300. package/dist/src/types/Textarea/textarea-mode.type.d.ts +2 -0
  301. package/dist/src/types/Textarea/textarea-mode.type.js +0 -0
  302. package/dist/src/types/Textarea/textarea-output.type.cjs +1 -0
  303. package/dist/src/types/Textarea/textarea-output.type.d.ts +2 -0
  304. package/dist/src/types/Textarea/textarea-output.type.js +0 -0
  305. package/dist/src/types/Textarea/textarea-toolbar-command.type.cjs +1 -0
  306. package/dist/src/types/Textarea/textarea-toolbar-command.type.d.ts +2 -0
  307. package/dist/src/types/Textarea/textarea-toolbar-command.type.js +0 -0
  308. package/dist/src/types/Textarea/textarea-toolbar-position.type.cjs +1 -0
  309. package/dist/src/types/Textarea/textarea-toolbar-position.type.d.ts +2 -0
  310. package/dist/src/types/Textarea/textarea-toolbar-position.type.js +0 -0
  311. package/dist/src/types/index.cjs +264 -0
  312. package/dist/src/types/index.d.ts +24 -0
  313. package/dist/src/types/index.js +24 -0
  314. package/dist/src/types/tokens.type.d.ts +1 -1
  315. package/dist/src/utils/Code/parse-highlight-lines.util.cjs +34 -0
  316. package/dist/src/utils/Code/parse-highlight-lines.util.d.ts +24 -0
  317. package/dist/src/utils/Code/parse-highlight-lines.util.js +28 -0
  318. package/dist/src/utils/CommandPalette/fuzzy-match.util.cjs +84 -0
  319. package/dist/src/utils/CommandPalette/fuzzy-match.util.d.ts +51 -0
  320. package/dist/src/utils/CommandPalette/fuzzy-match.util.js +62 -0
  321. package/dist/src/utils/Mask/apply-mask.util.cjs +120 -0
  322. package/dist/src/utils/Mask/apply-mask.util.d.ts +13 -0
  323. package/dist/src/utils/Mask/apply-mask.util.js +91 -0
  324. package/dist/src/utils/Mask/index.cjs +38 -0
  325. package/dist/src/utils/Mask/index.d.ts +3 -0
  326. package/dist/src/utils/Mask/index.js +3 -0
  327. package/dist/src/utils/Mask/resolve-mask-config.util.cjs +31 -0
  328. package/dist/src/utils/Mask/resolve-mask-config.util.d.ts +15 -0
  329. package/dist/src/utils/Mask/resolve-mask-config.util.js +21 -0
  330. package/dist/src/utils/Mask/validate-pattern.util.cjs +92 -0
  331. package/dist/src/utils/Mask/validate-pattern.util.d.ts +41 -0
  332. package/dist/src/utils/Mask/validate-pattern.util.js +81 -0
  333. package/dist/src/utils/Textarea/html-to-markdown.util.cjs +85 -0
  334. package/dist/src/utils/Textarea/html-to-markdown.util.d.ts +21 -0
  335. package/dist/src/utils/Textarea/html-to-markdown.util.js +78 -0
  336. package/dist/src/utils/Textarea/sanitize-html.util.cjs +82 -0
  337. package/dist/src/utils/Textarea/sanitize-html.util.d.ts +17 -0
  338. package/dist/src/utils/Textarea/sanitize-html.util.js +83 -0
  339. package/dist/src/utils/index.cjs +77 -0
  340. package/dist/src/utils/index.d.ts +7 -0
  341. package/dist/src/utils/index.js +7 -0
  342. package/package.json +13 -3
  343. package/dist/src/globals.d.ts +0 -172
  344. package/dist/src/shims.d.ts +0 -36
  345. package/dist/src/vite-env.d.ts +0 -1
@@ -0,0 +1,60 @@
1
+ import { type Ref } from 'vue';
2
+ import type { IParallaxLayerRegistry } from '../../interfaces';
3
+ import type { TParallaxDirection, TParallaxEasing } from '../../types';
4
+ /*********************************************************
5
+ * Internal options consumed by `useParallaxRuntime`.
6
+ ********************************************************/
7
+ export interface IUseParallaxRuntimeOptions {
8
+ target: Ref<HTMLElement | undefined>;
9
+ direction: Ref<TParallaxDirection>;
10
+ easing: Ref<TParallaxEasing | string>;
11
+ threshold: Ref<number>;
12
+ disabled: Ref<boolean>;
13
+ /**
14
+ * Fallback speed used when `slot=default` carries raw content (no
15
+ * `<OrigamParallaxLayer>`). Mirrors `IParallaxProps.speed`.
16
+ */
17
+ speed: Ref<number>;
18
+ onEnter?: () => void;
19
+ onLeave?: () => void;
20
+ onProgress?: (progress: number) => void;
21
+ }
22
+ /*********************************************************
23
+ * useParallaxRuntime
24
+ *
25
+ * Headless runtime for the enriched OrigamParallax. Maintains a registry
26
+ * of layers, tracks scroll progress / mouse-ratio, decides between the
27
+ * CSS-first scroll-driven path and a JS rAF fallback, honours
28
+ * `prefers-reduced-motion`, and emits enter / leave / progress hooks via
29
+ * the options bag.
30
+ ********************************************************/
31
+ export declare function useParallaxRuntime(options: IUseParallaxRuntimeOptions): {
32
+ layers: Ref<{
33
+ id: symbol;
34
+ speed: number;
35
+ offsetX: number;
36
+ offsetY: number;
37
+ target: HTMLElement;
38
+ }[], IParallaxLayerRegistry[] | {
39
+ id: symbol;
40
+ speed: number;
41
+ offsetX: number;
42
+ offsetY: number;
43
+ target: HTMLElement;
44
+ }[]>;
45
+ progress: Ref<number, number>;
46
+ mouseRatio: Ref<{
47
+ x: number;
48
+ y: number;
49
+ }, {
50
+ x: number;
51
+ y: number;
52
+ } | {
53
+ x: number;
54
+ y: number;
55
+ }>;
56
+ cssScrollDriven: import("vue").ComputedRef<boolean>;
57
+ reducedMotion: Ref<boolean, boolean>;
58
+ register: (layer: IParallaxLayerRegistry) => void;
59
+ unregister: (id: symbol) => void;
60
+ };
@@ -0,0 +1,219 @@
1
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
2
+ import { useCssSupport } from "../CssSupport/cssSupport.composable.js";
3
+ import { PARALLAX_DIRECTION, PARALLAX_EASING } from "../../enums/index.js";
4
+ function usePrefersReducedMotion() {
5
+ const flag = ref(false);
6
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
7
+ return flag;
8
+ }
9
+ const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
10
+ flag.value = mql.matches;
11
+ const onChange = (ev) => {
12
+ flag.value = ev.matches;
13
+ };
14
+ if (typeof mql.addEventListener === "function") {
15
+ mql.addEventListener("change", onChange);
16
+ } else if (typeof mql.addListener === "function") {
17
+ mql.addListener(onChange);
18
+ }
19
+ onBeforeUnmount(() => {
20
+ if (typeof mql.removeEventListener === "function") {
21
+ mql.removeEventListener("change", onChange);
22
+ } else if (typeof mql.removeListener === "function") {
23
+ mql.removeListener(onChange);
24
+ }
25
+ });
26
+ return flag;
27
+ }
28
+ function composeLayerTransform(progress, mouseRatio, direction, layer, hostHeight, hostWidth) {
29
+ const centred = progress * 2 - 1;
30
+ let tx = layer.offsetX;
31
+ let ty = layer.offsetY;
32
+ switch (direction) {
33
+ case PARALLAX_DIRECTION.HORIZONTAL:
34
+ tx += centred * hostWidth * layer.speed;
35
+ break;
36
+ case PARALLAX_DIRECTION.BOTH:
37
+ tx += mouseRatio.x * hostWidth * 0.5 * layer.speed;
38
+ ty += centred * hostHeight * layer.speed;
39
+ break;
40
+ case PARALLAX_DIRECTION.VERTICAL:
41
+ default:
42
+ ty += centred * hostHeight * layer.speed;
43
+ break;
44
+ }
45
+ return `translate3d(${tx.toFixed(2)}px, ${ty.toFixed(2)}px, 0)`;
46
+ }
47
+ export function useParallaxRuntime(options) {
48
+ const { supports } = useCssSupport();
49
+ const cssScrollDriven = computed(
50
+ () => supports("animation-timeline: scroll()") && options.easing.value === PARALLAX_EASING.LINEAR
51
+ );
52
+ const reducedMotion = usePrefersReducedMotion();
53
+ const layers = ref([]);
54
+ const progress = ref(0);
55
+ const mouseRatio = ref({ x: 0, y: 0 });
56
+ let isInViewport = false;
57
+ let rafId = null;
58
+ let observer = null;
59
+ const layerLerp = /* @__PURE__ */ new WeakMap();
60
+ const register = (layer) => {
61
+ layers.value.push(layer);
62
+ };
63
+ const unregister = (id) => {
64
+ layers.value = layers.value.filter((l) => l.id !== id);
65
+ };
66
+ const updateProgress = () => {
67
+ const host = options.target.value;
68
+ if (!host) return;
69
+ const rect = host.getBoundingClientRect();
70
+ const vh = window.innerHeight || document.documentElement.clientHeight;
71
+ const total = rect.height + vh;
72
+ const distanceFromTop = vh - rect.top;
73
+ let p = distanceFromTop / total;
74
+ if (p < 0) p = 0;
75
+ if (p > 1) p = 1;
76
+ const t = options.threshold.value;
77
+ if (t > 0 && p < t) {
78
+ p = 0;
79
+ } else if (t > 0) {
80
+ p = (p - t) / (1 - t);
81
+ }
82
+ progress.value = p;
83
+ options.onProgress?.(p);
84
+ };
85
+ const applyLayerTransforms = () => {
86
+ const host = options.target.value;
87
+ if (!host) return;
88
+ const rect = host.getBoundingClientRect();
89
+ const dir = options.direction.value;
90
+ const easing = options.easing.value;
91
+ const isSpring = easing === PARALLAX_EASING.SPRING;
92
+ for (const layer of layers.value) {
93
+ if (options.disabled.value || reducedMotion.value) {
94
+ layer.target.style.transform = `translate3d(${layer.offsetX}px, ${layer.offsetY}px, 0)`;
95
+ continue;
96
+ }
97
+ const target = composeLayerTransform(
98
+ progress.value,
99
+ mouseRatio.value,
100
+ dir,
101
+ layer,
102
+ rect.height,
103
+ rect.width
104
+ );
105
+ if (!isSpring) {
106
+ layer.target.style.transform = target;
107
+ continue;
108
+ }
109
+ const match = /translate3d\(([-\d.]+)px,\s*([-\d.]+)px/.exec(target);
110
+ if (!match) {
111
+ layer.target.style.transform = target;
112
+ continue;
113
+ }
114
+ const targetTx = parseFloat(match[1]);
115
+ const targetTy = parseFloat(match[2]);
116
+ const current = layerLerp.get(layer.target) ?? { tx: targetTx, ty: targetTy };
117
+ const damping = 0.12;
118
+ current.tx += (targetTx - current.tx) * damping;
119
+ current.ty += (targetTy - current.ty) * damping;
120
+ layerLerp.set(layer.target, current);
121
+ layer.target.style.transform = `translate3d(${current.tx.toFixed(2)}px, ${current.ty.toFixed(2)}px, 0)`;
122
+ }
123
+ };
124
+ const tick = () => {
125
+ rafId = null;
126
+ updateProgress();
127
+ applyLayerTransforms();
128
+ if (isInViewport && !options.disabled.value && !reducedMotion.value) {
129
+ rafId = requestAnimationFrame(tick);
130
+ }
131
+ };
132
+ const onScroll = () => {
133
+ if (rafId == null && isInViewport) {
134
+ rafId = requestAnimationFrame(tick);
135
+ }
136
+ };
137
+ const onMouseMove = (event) => {
138
+ if (options.direction.value !== PARALLAX_DIRECTION.BOTH) return;
139
+ const host = options.target.value;
140
+ if (!host) return;
141
+ const rect = host.getBoundingClientRect();
142
+ const cx = rect.left + rect.width / 2;
143
+ const cy = rect.top + rect.height / 2;
144
+ mouseRatio.value = {
145
+ x: (event.clientX - cx) / (rect.width / 2),
146
+ y: (event.clientY - cy) / (rect.height / 2)
147
+ };
148
+ if (rafId == null && isInViewport) {
149
+ rafId = requestAnimationFrame(tick);
150
+ }
151
+ };
152
+ const startCss = () => {
153
+ const host = options.target.value;
154
+ if (!host) return;
155
+ for (const layer of layers.value) {
156
+ layer.target.style.setProperty("--origam-parallax__layer---speed", String(layer.speed));
157
+ layer.target.style.setProperty("--origam-parallax__layer---offset-x", `${layer.offsetX}px`);
158
+ layer.target.style.setProperty("--origam-parallax__layer---offset-y", `${layer.offsetY}px`);
159
+ }
160
+ };
161
+ onMounted(() => {
162
+ const host = options.target.value;
163
+ if (!host) return;
164
+ observer = new IntersectionObserver((entries) => {
165
+ for (const entry of entries) {
166
+ if (entry.isIntersecting && !isInViewport) {
167
+ isInViewport = true;
168
+ options.onEnter?.();
169
+ if (!cssScrollDriven.value) {
170
+ if (rafId == null) rafId = requestAnimationFrame(tick);
171
+ } else {
172
+ startCss();
173
+ }
174
+ } else if (!entry.isIntersecting && isInViewport) {
175
+ isInViewport = false;
176
+ options.onLeave?.();
177
+ }
178
+ }
179
+ }, { threshold: 0 });
180
+ observer.observe(host);
181
+ if (!cssScrollDriven.value) {
182
+ window.addEventListener("scroll", onScroll, { passive: true });
183
+ window.addEventListener("resize", onScroll, { passive: true });
184
+ host.addEventListener("mousemove", onMouseMove, { passive: true });
185
+ requestAnimationFrame(tick);
186
+ }
187
+ });
188
+ onBeforeUnmount(() => {
189
+ if (rafId != null) cancelAnimationFrame(rafId);
190
+ observer?.disconnect();
191
+ observer = null;
192
+ if (typeof window !== "undefined") {
193
+ window.removeEventListener("scroll", onScroll);
194
+ window.removeEventListener("resize", onScroll);
195
+ }
196
+ const host = options.target.value;
197
+ host?.removeEventListener("mousemove", onMouseMove);
198
+ });
199
+ watch(cssScrollDriven, (v) => {
200
+ if (v) {
201
+ if (rafId != null) {
202
+ cancelAnimationFrame(rafId);
203
+ rafId = null;
204
+ }
205
+ startCss();
206
+ } else if (isInViewport && rafId == null) {
207
+ rafId = requestAnimationFrame(tick);
208
+ }
209
+ });
210
+ return {
211
+ layers,
212
+ progress,
213
+ mouseRatio,
214
+ cssScrollDriven,
215
+ reducedMotion,
216
+ register,
217
+ unregister
218
+ };
219
+ }
@@ -5,12 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useAspectRatio = useAspectRatio;
7
7
  var _vue = require("vue");
8
+ var _consts = require("../../consts/index.cjs");
8
9
  function useAspectRatio(props) {
9
10
  const aspectStyles = (0, _vue.computed)(() => {
10
11
  const aspectRatio = [];
11
- let ratio = window.innerWidth / window.innerHeight;
12
+ let ratio;
12
13
  if (props.aspectRatio) {
13
14
  ratio = eval(props.aspectRatio);
15
+ } else if (_consts.IN_BROWSER) {
16
+ ratio = window.innerWidth / window.innerHeight;
17
+ } else {
18
+ return aspectRatio;
14
19
  }
15
20
  if (ratio) {
16
21
  aspectRatio.push(`padding-block-end: ${String(1 / ratio * 100)}%`);
@@ -1,5 +1,15 @@
1
1
  /*********************************************************
2
2
  * useAspectRatio
3
+ *
4
+ * SSR safety
5
+ * ──────────
6
+ * During SSR (`!IN_BROWSER`) we cannot read `window.innerWidth/Height`.
7
+ * When the consumer passes an explicit `aspectRatio` prop the ratio is
8
+ * derived from it (no DOM needed). Otherwise we return an empty styles
9
+ * array — the layout collapses to its natural box on the server, then
10
+ * the first browser-side computed access fills in the padding-bottom
11
+ * value. The component's intrinsic height takes over after hydration,
12
+ * so the difference is invisible to the user.
3
13
  ********************************************************/
4
14
  export declare function useAspectRatio(props: {
5
15
  aspectRatio?: string | number;
@@ -1,10 +1,15 @@
1
1
  import { computed } from "vue";
2
+ import { IN_BROWSER } from "../../consts/index.js";
2
3
  export function useAspectRatio(props) {
3
4
  const aspectStyles = computed(() => {
4
5
  const aspectRatio = [];
5
- let ratio = window.innerWidth / window.innerHeight;
6
+ let ratio;
6
7
  if (props.aspectRatio) {
7
8
  ratio = eval(props.aspectRatio);
9
+ } else if (IN_BROWSER) {
10
+ ratio = window.innerWidth / window.innerHeight;
11
+ } else {
12
+ return aspectRatio;
8
13
  }
9
14
  if (ratio) {
10
15
  aspectRatio.push(`padding-block-end: ${String(1 / ratio * 100)}%`);
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resetSnackbarStackForTesting = resetSnackbarStackForTesting;
7
+ exports.useSnackbarStack = useSnackbarStack;
8
+ exports.useSnackbarStackInternal = useSnackbarStackInternal;
9
+ var _vue = require("vue");
10
+ var _consts = require("../../consts/index.cjs");
11
+ const STORES = /* @__PURE__ */new Map();
12
+ const getStore = id => {
13
+ let store = STORES.get(id);
14
+ if (!store) {
15
+ store = {
16
+ items: (0, _vue.ref)([]),
17
+ timers: /* @__PURE__ */new Map(),
18
+ counter: {
19
+ current: 0
20
+ }
21
+ };
22
+ STORES.set(id, store);
23
+ }
24
+ return store;
25
+ };
26
+ const generateId = state => {
27
+ state.counter.current += 1;
28
+ return `origam-snackbar-stack-item-${state.counter.current}`;
29
+ };
30
+ const clearTimer = (state, itemId) => {
31
+ const handle = state.timers.get(itemId);
32
+ if (handle !== void 0) {
33
+ if (typeof window !== "undefined") window.clearTimeout(handle);
34
+ state.timers.delete(itemId);
35
+ }
36
+ };
37
+ function useSnackbarStack(options = {}) {
38
+ const id = options.id ?? _consts.SNACKBAR_STACK_DEFAULT_ID;
39
+ const state = getStore(id);
40
+ const dismiss = itemId => {
41
+ const index = state.items.value.findIndex(item => item.id === itemId);
42
+ if (index === -1) return;
43
+ const [removed] = state.items.value.splice(index, 1);
44
+ clearTimer(state, itemId);
45
+ removed?.onDismiss?.();
46
+ };
47
+ const scheduleAutoDismiss = (itemId, duration) => {
48
+ if (duration <= 0) return;
49
+ if (typeof window === "undefined") return;
50
+ const handle = window.setTimeout(() => {
51
+ dismiss(itemId);
52
+ }, duration);
53
+ state.timers.set(itemId, handle);
54
+ };
55
+ const notify = opts => {
56
+ const itemId = generateId(state);
57
+ const duration = opts.duration ?? options.defaultDuration ?? _consts.SNACKBAR_STACK_DEFAULT_DURATION;
58
+ const item = {
59
+ ...opts,
60
+ id: itemId,
61
+ createdAt: Date.now()
62
+ };
63
+ state.items.value.push(item);
64
+ if (options.max != null && state.items.value.length > options.max) {
65
+ const evicted = state.items.value.shift();
66
+ if (evicted) {
67
+ clearTimer(state, evicted.id);
68
+ evicted.onDismiss?.();
69
+ }
70
+ }
71
+ scheduleAutoDismiss(itemId, duration);
72
+ return itemId;
73
+ };
74
+ const dismissAll = () => {
75
+ const ids = state.items.value.map(item => item.id);
76
+ ids.forEach(dismiss);
77
+ };
78
+ return {
79
+ items: (0, _vue.readonly)(state.items),
80
+ notify,
81
+ dismiss,
82
+ dismissAll
83
+ };
84
+ }
85
+ function useSnackbarStackInternal(id = _consts.SNACKBAR_STACK_DEFAULT_ID) {
86
+ const state = getStore(id);
87
+ return {
88
+ rawItems: state.items,
89
+ itemCount: (0, _vue.computed)(() => state.items.value.length)
90
+ };
91
+ }
92
+ function resetSnackbarStackForTesting() {
93
+ STORES.forEach(state => {
94
+ state.timers.forEach(handle => {
95
+ if (typeof window !== "undefined") window.clearTimeout(handle);
96
+ });
97
+ state.timers.clear();
98
+ state.items.value = [];
99
+ state.counter.current = 0;
100
+ });
101
+ STORES.clear();
102
+ }
@@ -0,0 +1,58 @@
1
+ import { type Ref } from 'vue';
2
+ import type { ISnackbarStackItem, ISnackbarStackItemOptions } from '../../interfaces';
3
+ /*********************************************************
4
+ * useSnackbarStack
5
+ *
6
+ * @description
7
+ * Public API. Returns an interface to push / pop items
8
+ * from a named stack. The returned `items` ref is the
9
+ * same reactive reference shared with the matching
10
+ * `<OrigamSnackbarStack id="…">` instance, so direct
11
+ * mutation outside of `notify` / `dismiss` is discouraged.
12
+ ********************************************************/
13
+ export interface IUseSnackbarStackOptions {
14
+ id?: string;
15
+ /**
16
+ * Maximum number of items kept in the stack. When `notify` would
17
+ * push past this number, the oldest item is evicted FIFO. When
18
+ * undefined, the stack is unbounded (the rendering component
19
+ * still caps the visible count via its `max` prop).
20
+ */
21
+ max?: number;
22
+ /**
23
+ * Fallback `duration` applied to items that omit their own.
24
+ * Defaults to `SNACKBAR_STACK_DEFAULT_DURATION` (5 000 ms).
25
+ */
26
+ defaultDuration?: number;
27
+ }
28
+ export interface IUseSnackbarStackReturn {
29
+ items: Readonly<Ref<ReadonlyArray<ISnackbarStackItem>>>;
30
+ notify: (opts: ISnackbarStackItemOptions) => string;
31
+ dismiss: (itemId: string) => void;
32
+ dismissAll: () => void;
33
+ }
34
+ export declare function useSnackbarStack(options?: IUseSnackbarStackOptions): IUseSnackbarStackReturn;
35
+ /*********************************************************
36
+ * Internal helper for the host component
37
+ *
38
+ * @description
39
+ * `<OrigamSnackbarStack>` needs a *writable* ref to the
40
+ * items list (it reads them to render and the composable
41
+ * mutates them). Exposed under a separate name so the
42
+ * public `useSnackbarStack` API stays read-only on
43
+ * `items`. Components outside the library should never
44
+ * import this.
45
+ ********************************************************/
46
+ export declare function useSnackbarStackInternal(id?: string): {
47
+ rawItems: Ref<ISnackbarStackItem[], ISnackbarStackItem[]>;
48
+ itemCount: import("vue").ComputedRef<number>;
49
+ };
50
+ /*********************************************************
51
+ * Test helper
52
+ *
53
+ * @description
54
+ * Vitest needs to wipe the singleton between specs so that
55
+ * counters / timers do not leak across tests. Not part of
56
+ * the public surface — do not import in product code.
57
+ ********************************************************/
58
+ export declare function resetSnackbarStackForTesting(): void;
@@ -0,0 +1,92 @@
1
+ import { computed, readonly, ref } from "vue";
2
+ import { SNACKBAR_STACK_DEFAULT_DURATION, SNACKBAR_STACK_DEFAULT_ID } from "../../consts/index.js";
3
+ const STORES = /* @__PURE__ */ new Map();
4
+ const getStore = (id) => {
5
+ let store = STORES.get(id);
6
+ if (!store) {
7
+ store = {
8
+ items: ref([]),
9
+ timers: /* @__PURE__ */ new Map(),
10
+ counter: { current: 0 }
11
+ };
12
+ STORES.set(id, store);
13
+ }
14
+ return store;
15
+ };
16
+ const generateId = (state) => {
17
+ state.counter.current += 1;
18
+ return `origam-snackbar-stack-item-${state.counter.current}`;
19
+ };
20
+ const clearTimer = (state, itemId) => {
21
+ const handle = state.timers.get(itemId);
22
+ if (handle !== void 0) {
23
+ if (typeof window !== "undefined") window.clearTimeout(handle);
24
+ state.timers.delete(itemId);
25
+ }
26
+ };
27
+ export function useSnackbarStack(options = {}) {
28
+ const id = options.id ?? SNACKBAR_STACK_DEFAULT_ID;
29
+ const state = getStore(id);
30
+ const dismiss = (itemId) => {
31
+ const index = state.items.value.findIndex((item) => item.id === itemId);
32
+ if (index === -1) return;
33
+ const [removed] = state.items.value.splice(index, 1);
34
+ clearTimer(state, itemId);
35
+ removed?.onDismiss?.();
36
+ };
37
+ const scheduleAutoDismiss = (itemId, duration) => {
38
+ if (duration <= 0) return;
39
+ if (typeof window === "undefined") return;
40
+ const handle = window.setTimeout(() => {
41
+ dismiss(itemId);
42
+ }, duration);
43
+ state.timers.set(itemId, handle);
44
+ };
45
+ const notify = (opts) => {
46
+ const itemId = generateId(state);
47
+ const duration = opts.duration ?? options.defaultDuration ?? SNACKBAR_STACK_DEFAULT_DURATION;
48
+ const item = {
49
+ ...opts,
50
+ id: itemId,
51
+ createdAt: Date.now()
52
+ };
53
+ state.items.value.push(item);
54
+ if (options.max != null && state.items.value.length > options.max) {
55
+ const evicted = state.items.value.shift();
56
+ if (evicted) {
57
+ clearTimer(state, evicted.id);
58
+ evicted.onDismiss?.();
59
+ }
60
+ }
61
+ scheduleAutoDismiss(itemId, duration);
62
+ return itemId;
63
+ };
64
+ const dismissAll = () => {
65
+ const ids = state.items.value.map((item) => item.id);
66
+ ids.forEach(dismiss);
67
+ };
68
+ return {
69
+ items: readonly(state.items),
70
+ notify,
71
+ dismiss,
72
+ dismissAll
73
+ };
74
+ }
75
+ export function useSnackbarStackInternal(id = SNACKBAR_STACK_DEFAULT_ID) {
76
+ const state = getStore(id);
77
+ return {
78
+ rawItems: state.items,
79
+ itemCount: computed(() => state.items.value.length)
80
+ };
81
+ }
82
+ export function resetSnackbarStackForTesting() {
83
+ STORES.forEach((state) => {
84
+ state.timers.forEach((handle) => {
85
+ if (typeof window !== "undefined") window.clearTimeout(handle);
86
+ });
87
+ state.timers.clear();
88
+ state.items.value = [];
89
+ state.counter.current = 0;
90
+ });
91
+ STORES.clear();
92
+ }