@pg-labs-incubator/cobweb 0.0.0-stage → 0.0.1

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 (320) hide show
  1. package/LICENSE +163 -0
  2. package/README.md +82 -2
  3. package/package.json +111 -3
  4. package/src/action/action.yaml +291 -0
  5. package/src/action/button-group.yaml +56 -0
  6. package/src/action/button.yaml +239 -0
  7. package/src/action/split-button.yaml +87 -0
  8. package/src/color/color.yaml +181 -0
  9. package/src/color/palette.yaml +147 -0
  10. package/src/container/card.yaml +170 -0
  11. package/src/container/corner-radius.yaml +50 -0
  12. package/src/container/elevation.yaml +19 -0
  13. package/src/design.yaml +41 -0
  14. package/src/feedback/feedback.yaml +225 -0
  15. package/src/icon/icon-font.yaml +28 -0
  16. package/src/icon/icon.yaml +31 -0
  17. package/src/input/date-picker.yaml +144 -0
  18. package/src/input/date-range-input.yaml +162 -0
  19. package/src/input/range-slider.yaml +161 -0
  20. package/src/input/select.yaml +230 -0
  21. package/src/input/slider.yaml +172 -0
  22. package/src/input/text-field.yaml +240 -0
  23. package/src/input/time-picker.yaml +220 -0
  24. package/src/motion/motion.yaml +371 -0
  25. package/src/navigation/app-bar.yaml +147 -0
  26. package/src/navigation/navigation.yaml +339 -0
  27. package/src/navigation/scroll.yaml +23 -0
  28. package/src/navigation/search.yaml +112 -0
  29. package/src/navigation/tabs.yaml +144 -0
  30. package/src/navigation/toolbar.yaml +130 -0
  31. package/src/selection/checkbox.yaml +162 -0
  32. package/src/selection/chip.yaml +219 -0
  33. package/src/selection/radio.yaml +125 -0
  34. package/src/selection/segmented-group.yaml +11 -0
  35. package/src/selection/segmented.yaml +69 -0
  36. package/src/selection/switch.yaml +209 -0
  37. package/src/spacing/measurement.yaml +80 -0
  38. package/src/state/state.yaml +38 -0
  39. package/src/surface/surface.yaml +483 -0
  40. package/src/text/line-height.yaml +144 -0
  41. package/src/text/typeface.yaml +31 -0
  42. package/src/text/typescale.yaml +726 -0
  43. package/target/esbuild/action/action.css +1 -0
  44. package/target/esbuild/action/base.jsx +1 -0
  45. package/target/esbuild/action/button.jsx +17 -0
  46. package/target/esbuild/action/fab-menu-context.jsx +1 -0
  47. package/target/esbuild/action/fab-menu.jsx +15 -0
  48. package/target/esbuild/action/fab.jsx +7 -0
  49. package/target/esbuild/action/group.jsx +22 -0
  50. package/target/esbuild/action/icon-button.jsx +5 -0
  51. package/target/esbuild/action/index.jsx +1 -0
  52. package/target/esbuild/action/split-button.jsx +12 -0
  53. package/target/esbuild/color/contrast.jsx +1 -0
  54. package/target/esbuild/color/dynamic.jsx +1 -0
  55. package/target/esbuild/color/hct.jsx +1 -0
  56. package/target/esbuild/color/index.css +1 -0
  57. package/target/esbuild/color/index.jsx +1 -0
  58. package/target/esbuild/color/palette.jsx +1 -0
  59. package/target/esbuild/color/scheme.jsx +1 -0
  60. package/target/esbuild/color/temperature.jsx +1 -0
  61. package/target/esbuild/container/card.css +1 -0
  62. package/target/esbuild/container/card.jsx +1 -0
  63. package/target/esbuild/container/elevation-shadow.css +1 -0
  64. package/target/esbuild/container/elevation-shadow.jsx +1 -0
  65. package/target/esbuild/container/index.jsx +1 -0
  66. package/target/esbuild/dom/client.jsx +1 -0
  67. package/target/esbuild/dom/index.jsx +1 -0
  68. package/target/esbuild/dom/server.jsx +1 -0
  69. package/target/esbuild/dom/types.jsx +1 -0
  70. package/target/esbuild/feedback/badge.jsx +15 -0
  71. package/target/esbuild/feedback/feedback.css +1 -0
  72. package/target/esbuild/feedback/focus.jsx +1 -0
  73. package/target/esbuild/feedback/index.jsx +1 -0
  74. package/target/esbuild/feedback/loading.jsx +7 -0
  75. package/target/esbuild/feedback/observe.jsx +1 -0
  76. package/target/esbuild/feedback/progress.jsx +35 -0
  77. package/target/esbuild/feedback/snackbar.jsx +23 -0
  78. package/target/esbuild/feedback/tooltip.jsx +24 -0
  79. package/target/esbuild/icon/icon.css +1 -0
  80. package/target/esbuild/icon/icon.jsx +1 -0
  81. package/target/esbuild/icon/index.jsx +1 -0
  82. package/target/esbuild/index.css +1 -0
  83. package/target/esbuild/index.jsx +1 -0
  84. package/target/esbuild/input/autocomplete.jsx +5 -0
  85. package/target/esbuild/input/base.jsx +4 -0
  86. package/target/esbuild/input/date-picker.css +1 -0
  87. package/target/esbuild/input/date-picker.jsx +104 -0
  88. package/target/esbuild/input/date-range-input.css +1 -0
  89. package/target/esbuild/input/date-time.jsx +21 -0
  90. package/target/esbuild/input/index.css +1 -0
  91. package/target/esbuild/input/index.jsx +1 -0
  92. package/target/esbuild/input/paired-input.jsx +1 -0
  93. package/target/esbuild/input/picker-dialog.css +1 -0
  94. package/target/esbuild/input/picker-dialog.jsx +14 -0
  95. package/target/esbuild/input/select.css +1 -0
  96. package/target/esbuild/input/select.jsx +63 -0
  97. package/target/esbuild/input/slider.css +1 -0
  98. package/target/esbuild/input/slider.jsx +51 -0
  99. package/target/esbuild/input/text-field.css +1 -0
  100. package/target/esbuild/input/text-field.jsx +67 -0
  101. package/target/esbuild/input/time-picker.css +1 -0
  102. package/target/esbuild/input/time-picker.jsx +29 -0
  103. package/target/esbuild/motion/frame.jsx +1 -0
  104. package/target/esbuild/motion/index.css +1 -0
  105. package/target/esbuild/motion/index.jsx +1 -0
  106. package/target/esbuild/motion/material.jsx +1 -0
  107. package/target/esbuild/motion/motion.jsx +1 -0
  108. package/target/esbuild/motion/spring.jsx +1 -0
  109. package/target/esbuild/motion/transition.css +1 -0
  110. package/target/esbuild/motion/transition.jsx +1 -0
  111. package/target/esbuild/motion/velocity.jsx +1 -0
  112. package/target/esbuild/navigation/app-bar.jsx +51 -0
  113. package/target/esbuild/navigation/base.jsx +1 -0
  114. package/target/esbuild/navigation/drawer.jsx +25 -0
  115. package/target/esbuild/navigation/index.jsx +1 -0
  116. package/target/esbuild/navigation/navigation.css +1 -0
  117. package/target/esbuild/navigation/navigation.jsx +29 -0
  118. package/target/esbuild/navigation/scroll.jsx +1 -0
  119. package/target/esbuild/navigation/search.jsx +29 -0
  120. package/target/esbuild/navigation/tabs.jsx +7 -0
  121. package/target/esbuild/navigation/toolbar.jsx +23 -0
  122. package/target/esbuild/selection/base.jsx +1 -0
  123. package/target/esbuild/selection/checkbox.jsx +14 -0
  124. package/target/esbuild/selection/chip.jsx +23 -0
  125. package/target/esbuild/selection/index.jsx +1 -0
  126. package/target/esbuild/selection/radio.jsx +9 -0
  127. package/target/esbuild/selection/segmented.jsx +15 -0
  128. package/target/esbuild/selection/selection.css +1 -0
  129. package/target/esbuild/selection/switch.jsx +14 -0
  130. package/target/esbuild/shape/corner-rounding.jsx +1 -0
  131. package/target/esbuild/shape/cubic.jsx +1 -0
  132. package/target/esbuild/shape/index.jsx +1 -0
  133. package/target/esbuild/shape/material-shapes.jsx +1 -0
  134. package/target/esbuild/shape/morph.jsx +1 -0
  135. package/target/esbuild/shape/path.jsx +1 -0
  136. package/target/esbuild/shape/point.jsx +1 -0
  137. package/target/esbuild/shape/rounded-polygon.jsx +1 -0
  138. package/target/esbuild/shape/shapes.jsx +1 -0
  139. package/target/esbuild/spacing/index.jsx +1 -0
  140. package/target/esbuild/state/component.css +1 -0
  141. package/target/esbuild/state/component.jsx +1 -0
  142. package/target/esbuild/state/controller.jsx +1 -0
  143. package/target/esbuild/state/index.jsx +1 -0
  144. package/target/esbuild/state/ripple.jsx +1 -0
  145. package/target/esbuild/state/state.jsx +1 -0
  146. package/target/esbuild/state/style.jsx +1 -0
  147. package/target/esbuild/surface/carousel-layout.jsx +1 -0
  148. package/target/esbuild/surface/carousel.css +1 -0
  149. package/target/esbuild/surface/carousel.jsx +10 -0
  150. package/target/esbuild/surface/dialog.jsx +35 -0
  151. package/target/esbuild/surface/divider.jsx +1 -0
  152. package/target/esbuild/surface/drag.jsx +1 -0
  153. package/target/esbuild/surface/gestures.css +1 -0
  154. package/target/esbuild/surface/gestures.jsx +7 -0
  155. package/target/esbuild/surface/index.css +1 -0
  156. package/target/esbuild/surface/index.jsx +1 -0
  157. package/target/esbuild/surface/interactive.jsx +1 -0
  158. package/target/esbuild/surface/list-patterns.jsx +26 -0
  159. package/target/esbuild/surface/list.css +1 -0
  160. package/target/esbuild/surface/list.jsx +9 -0
  161. package/target/esbuild/surface/menu.css +1 -0
  162. package/target/esbuild/surface/menu.jsx +12 -0
  163. package/target/esbuild/surface/scaffold.jsx +47 -0
  164. package/target/esbuild/surface/sheet.jsx +21 -0
  165. package/target/esbuild/surface/side-sheet.jsx +17 -0
  166. package/target/esbuild/surface/slots.jsx +1 -0
  167. package/target/esbuild/surface/surface.css +1 -0
  168. package/target/esbuild/surface/surface.jsx +1 -0
  169. package/target/esbuild/text/index.css +1 -0
  170. package/target/esbuild/text/index.jsx +1 -0
  171. package/target/esbuild/text/text.css +1 -0
  172. package/target/esbuild/text/text.jsx +3 -0
  173. package/target/esbuild/text/typography.css +1 -0
  174. package/target/esbuild/text/typography.jsx +1 -0
  175. package/target/esbuild/util/box-side.jsx +1 -0
  176. package/target/esbuild/util/debug.jsx +1 -0
  177. package/target/esbuild/util/dom.jsx +1 -0
  178. package/target/esbuild/util/event.jsx +1 -0
  179. package/target/esbuild/util/index.jsx +1 -0
  180. package/target/esbuild/util/preconditions.jsx +1 -0
  181. package/target/esbuild/util/reactive.jsx +1 -0
  182. package/target/tsc/action/action.css.d.ts +3 -0
  183. package/target/tsc/action/base.d.ts +211 -0
  184. package/target/tsc/action/button.d.ts +126 -0
  185. package/target/tsc/action/fab-menu-context.d.ts +16 -0
  186. package/target/tsc/action/fab-menu.d.ts +112 -0
  187. package/target/tsc/action/fab.d.ts +98 -0
  188. package/target/tsc/action/group.d.ts +166 -0
  189. package/target/tsc/action/icon-button.d.ts +79 -0
  190. package/target/tsc/action/index.d.ts +24 -0
  191. package/target/tsc/action/split-button.d.ts +78 -0
  192. package/target/tsc/color/contrast.d.ts +48 -0
  193. package/target/tsc/color/dynamic.d.ts +203 -0
  194. package/target/tsc/color/hct.d.ts +114 -0
  195. package/target/tsc/color/index.css.d.ts +3 -0
  196. package/target/tsc/color/index.d.ts +23 -0
  197. package/target/tsc/color/palette.d.ts +30 -0
  198. package/target/tsc/color/scheme.d.ts +446 -0
  199. package/target/tsc/color/temperature.d.ts +24 -0
  200. package/target/tsc/container/card.css.d.ts +3 -0
  201. package/target/tsc/container/card.d.ts +110 -0
  202. package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
  203. package/target/tsc/container/elevation-shadow.d.ts +23 -0
  204. package/target/tsc/container/index.d.ts +44 -0
  205. package/target/tsc/dom/client.d.ts +387 -0
  206. package/target/tsc/dom/index.d.ts +93 -0
  207. package/target/tsc/dom/server.d.ts +65 -0
  208. package/target/tsc/dom/types.d.ts +134 -0
  209. package/target/tsc/feedback/badge.d.ts +116 -0
  210. package/target/tsc/feedback/feedback.css.d.ts +3 -0
  211. package/target/tsc/feedback/focus.d.ts +20 -0
  212. package/target/tsc/feedback/index.d.ts +17 -0
  213. package/target/tsc/feedback/loading.d.ts +194 -0
  214. package/target/tsc/feedback/observe.d.ts +75 -0
  215. package/target/tsc/feedback/progress.d.ts +281 -0
  216. package/target/tsc/feedback/snackbar.d.ts +398 -0
  217. package/target/tsc/feedback/tooltip.d.ts +326 -0
  218. package/target/tsc/icon/icon.css.d.ts +3 -0
  219. package/target/tsc/icon/icon.d.ts +69 -0
  220. package/target/tsc/icon/index.d.ts +13 -0
  221. package/target/tsc/index.css.d.ts +3 -0
  222. package/target/tsc/index.d.ts +7 -0
  223. package/target/tsc/input/autocomplete.d.ts +119 -0
  224. package/target/tsc/input/base.d.ts +282 -0
  225. package/target/tsc/input/date-picker.css.d.ts +3 -0
  226. package/target/tsc/input/date-picker.d.ts +351 -0
  227. package/target/tsc/input/date-range-input.css.d.ts +3 -0
  228. package/target/tsc/input/date-time.d.ts +171 -0
  229. package/target/tsc/input/index.css.d.ts +3 -0
  230. package/target/tsc/input/index.d.ts +27 -0
  231. package/target/tsc/input/paired-input.d.ts +435 -0
  232. package/target/tsc/input/picker-dialog.css.d.ts +3 -0
  233. package/target/tsc/input/picker-dialog.d.ts +84 -0
  234. package/target/tsc/input/select.css.d.ts +3 -0
  235. package/target/tsc/input/select.d.ts +267 -0
  236. package/target/tsc/input/slider.css.d.ts +3 -0
  237. package/target/tsc/input/slider.d.ts +372 -0
  238. package/target/tsc/input/text-field.css.d.ts +3 -0
  239. package/target/tsc/input/text-field.d.ts +415 -0
  240. package/target/tsc/input/time-picker.css.d.ts +3 -0
  241. package/target/tsc/input/time-picker.d.ts +212 -0
  242. package/target/tsc/motion/frame.d.ts +36 -0
  243. package/target/tsc/motion/index.css.d.ts +3 -0
  244. package/target/tsc/motion/index.d.ts +34 -0
  245. package/target/tsc/motion/material.d.ts +110 -0
  246. package/target/tsc/motion/motion.d.ts +235 -0
  247. package/target/tsc/motion/spring.d.ts +223 -0
  248. package/target/tsc/motion/transition.css.d.ts +3 -0
  249. package/target/tsc/motion/transition.d.ts +597 -0
  250. package/target/tsc/motion/velocity.d.ts +54 -0
  251. package/target/tsc/navigation/app-bar.d.ts +473 -0
  252. package/target/tsc/navigation/base.d.ts +320 -0
  253. package/target/tsc/navigation/drawer.d.ts +301 -0
  254. package/target/tsc/navigation/index.d.ts +25 -0
  255. package/target/tsc/navigation/navigation.css.d.ts +3 -0
  256. package/target/tsc/navigation/navigation.d.ts +537 -0
  257. package/target/tsc/navigation/scroll.d.ts +218 -0
  258. package/target/tsc/navigation/search.d.ts +332 -0
  259. package/target/tsc/navigation/tabs.d.ts +497 -0
  260. package/target/tsc/navigation/toolbar.d.ts +248 -0
  261. package/target/tsc/selection/base.d.ts +100 -0
  262. package/target/tsc/selection/checkbox.d.ts +194 -0
  263. package/target/tsc/selection/chip.d.ts +358 -0
  264. package/target/tsc/selection/index.d.ts +21 -0
  265. package/target/tsc/selection/radio.d.ts +198 -0
  266. package/target/tsc/selection/segmented.d.ts +333 -0
  267. package/target/tsc/selection/selection.css.d.ts +3 -0
  268. package/target/tsc/selection/switch.d.ts +165 -0
  269. package/target/tsc/shape/corner-rounding.d.ts +36 -0
  270. package/target/tsc/shape/cubic.d.ts +215 -0
  271. package/target/tsc/shape/index.d.ts +35 -0
  272. package/target/tsc/shape/material-shapes.d.ts +176 -0
  273. package/target/tsc/shape/morph.d.ts +91 -0
  274. package/target/tsc/shape/path.d.ts +177 -0
  275. package/target/tsc/shape/point.d.ts +165 -0
  276. package/target/tsc/shape/rounded-polygon.d.ts +289 -0
  277. package/target/tsc/shape/shapes.d.ts +76 -0
  278. package/target/tsc/spacing/index.d.ts +19 -0
  279. package/target/tsc/state/component.css.d.ts +3 -0
  280. package/target/tsc/state/component.d.ts +276 -0
  281. package/target/tsc/state/controller.d.ts +257 -0
  282. package/target/tsc/state/index.d.ts +19 -0
  283. package/target/tsc/state/ripple.d.ts +50 -0
  284. package/target/tsc/state/state.d.ts +129 -0
  285. package/target/tsc/state/style.d.ts +22 -0
  286. package/target/tsc/surface/carousel-layout.d.ts +212 -0
  287. package/target/tsc/surface/carousel.css.d.ts +3 -0
  288. package/target/tsc/surface/carousel.d.ts +231 -0
  289. package/target/tsc/surface/dialog.d.ts +580 -0
  290. package/target/tsc/surface/divider.d.ts +92 -0
  291. package/target/tsc/surface/drag.d.ts +92 -0
  292. package/target/tsc/surface/gestures.css.d.ts +3 -0
  293. package/target/tsc/surface/gestures.d.ts +292 -0
  294. package/target/tsc/surface/index.css.d.ts +3 -0
  295. package/target/tsc/surface/index.d.ts +29 -0
  296. package/target/tsc/surface/interactive.d.ts +22 -0
  297. package/target/tsc/surface/list-patterns.d.ts +384 -0
  298. package/target/tsc/surface/list.css.d.ts +3 -0
  299. package/target/tsc/surface/list.d.ts +340 -0
  300. package/target/tsc/surface/menu.css.d.ts +3 -0
  301. package/target/tsc/surface/menu.d.ts +590 -0
  302. package/target/tsc/surface/scaffold.d.ts +337 -0
  303. package/target/tsc/surface/sheet.d.ts +384 -0
  304. package/target/tsc/surface/side-sheet.d.ts +183 -0
  305. package/target/tsc/surface/slots.d.ts +21 -0
  306. package/target/tsc/surface/surface.css.d.ts +3 -0
  307. package/target/tsc/surface/surface.d.ts +192 -0
  308. package/target/tsc/text/index.css.d.ts +3 -0
  309. package/target/tsc/text/index.d.ts +18 -0
  310. package/target/tsc/text/text.css.d.ts +3 -0
  311. package/target/tsc/text/text.d.ts +94 -0
  312. package/target/tsc/text/typography.css.d.ts +3 -0
  313. package/target/tsc/text/typography.d.ts +82 -0
  314. package/target/tsc/util/box-side.d.ts +76 -0
  315. package/target/tsc/util/debug.d.ts +20 -0
  316. package/target/tsc/util/dom.d.ts +35 -0
  317. package/target/tsc/util/event.d.ts +93 -0
  318. package/target/tsc/util/index.d.ts +12 -0
  319. package/target/tsc/util/preconditions.d.ts +79 -0
  320. package/target/tsc/util/reactive.d.ts +36 -0
@@ -0,0 +1,597 @@
1
+ import type { Accessor, FlowComponent, JSX } from "solid-js";
2
+ import type { MotionKeyframe, MotionOptions } from "./motion";
3
+ import "./transition.css";
4
+ /**
5
+ * Element which can be {@link Transition | transitioned} from or to.
6
+ *
7
+ * Transition elements may be either `undefined` or an DOM element. When transitioning from or to
8
+ * an `undefined` element, the transition applies only an enter or exit sequence, respectively.
9
+ */
10
+ export type TransitionElement = Element | undefined;
11
+ /**
12
+ * {@link Transition} target element tuple.
13
+ *
14
+ * A transition target is composed of two {@link TransitionElement | elements}, an exiting and
15
+ * entering element, respectively.
16
+ */
17
+ export type TransitionTarget = [exiting: TransitionElement, entering: TransitionElement];
18
+ /**
19
+ * Inline motion applied during a {@link Transition | transition}.
20
+ *
21
+ * Inline motions are defined by motion {@link MotionOptions | options} and {@link
22
+ * TransitionMotion.keyframes | keyframes}.
23
+ *
24
+ * @see {@link TransitionProps.enterMotion}
25
+ * @see {@link TransitionProps.exitMotion}
26
+ */
27
+ export interface TransitionMotion extends MotionOptions {
28
+ /**
29
+ * Motion {@link MotionKeyframe | keyframe} array or keyframe array provider.
30
+ *
31
+ * This may be assigned to either a keyframe array or a keyframe array provider function.
32
+ * When assigned to a provider function, the function is invoked, with the transition
33
+ * {@link TransitionTarget | target}, when the respective sequence begins, and is expected
34
+ * to return a keyframe array to apply. If the keyframe array assigned, or provided, has a
35
+ * length of `0`, inline motion is not applied.
36
+ */
37
+ keyframes: ((target: TransitionTarget) => readonly MotionKeyframe[]) | readonly MotionKeyframe[];
38
+ }
39
+ /**
40
+ * {@link TransitionProps.children | Element} has changed and a new transition is beginning.
41
+ *
42
+ * This is entered into immediately before the enter or exit sequence of the transition
43
+ * begins.
44
+ *
45
+ * @see {@link TransitionState}
46
+ */
47
+ export declare const TransitionBegin = 0;
48
+ /**
49
+ * Enter sequence of transition has begun.
50
+ *
51
+ * This is entered into once the enter sequence of the transition begins, *after* {@link
52
+ * TransitionProps.enterClass | `props.enterClass`} and {@link TransitionProps.enterStartClass |
53
+ * `props.enterStartClass`} are applied to the entering element, but *before* {@link
54
+ * TransitionProps.enterMotionClass | `props.enterMotionClass`} or {@link
55
+ * TransitionProps.enterMotion | `props.enterMotion`} are applied to the entering element.
56
+ *
57
+ * @remarks
58
+ * This state is never entered into if the entering element is `undefined`.
59
+ * @see {@link TransitionState}
60
+ */
61
+ export declare const EnterSequenceBegin = 1;
62
+ /**
63
+ * Enter sequence of transition is ending.
64
+ *
65
+ * This is entered into immediately before the enter motion of the transition ends, *before*
66
+ * {@link TransitionProps.enterClass | `props.enterClass`} is removed from the entering element,
67
+ * but *after* {@link TransitionProps.enterMotionClass | `props.enterMotionClass`} is removed
68
+ * from the entering element.
69
+ *
70
+ * @remarks
71
+ * This state is never entered into if the entering element is `undefined`.
72
+ * @see {@link TransitionState}
73
+ */
74
+ export declare const EnterSequenceEnd = 2;
75
+ /**
76
+ * Exit sequence of transition has begun.
77
+ *
78
+ * This is entered into once the exit sequence of the transition begins, *after* {@link
79
+ * TransitionProps.exitClass | `props.exitClass`} and {@link TransitionProps.exitStartClass |
80
+ * `props.exitStartClass`} are applied to the exiting element, but *before* {@link
81
+ * TransitionProps.exitMotionClass | `props.exitMotionClass`} or {@link
82
+ * TransitionProps.exitMotion | `props.exitMotion`} are applied to the exiting element.
83
+ *
84
+ * @remarks
85
+ * This state is never entered into if the exiting element is `undefined`.
86
+ * @see {@link TransitionState}
87
+ */
88
+ export declare const ExitSequenceBegin = 3;
89
+ /**
90
+ * Exit sequence of transition is ending.
91
+ *
92
+ * This is entered into immediately before the exit motion of the transition ends, *before* {@link
93
+ * TransitionProps.exitClass | `props.exitClass`} is removed from the exiting element, but *after*
94
+ * {@link TransitionProps.exitMotionClass | `props.exitMotionClass`} is removed from the exiting
95
+ * element.
96
+ *
97
+ * @remarks
98
+ * This state is never entered into if the exiting element is `undefined`.
99
+ * @see {@link TransitionState}
100
+ */
101
+ export declare const ExitSequenceEnd = 4;
102
+ /**
103
+ * Transition has completed.
104
+ *
105
+ * This is entered into immediately after both the enter and exit sequences of the
106
+ * transition have ended.
107
+ *
108
+ * @see {@link TransitionState}
109
+ */
110
+ export declare const TransitionEnd = 5;
111
+ /**
112
+ * Union of {@link Transition | transition} states.
113
+ *
114
+ * @see {@link TransitionProps.onStateChange}
115
+ */
116
+ export type TransitionState = typeof EnterSequenceBegin | typeof EnterSequenceEnd | typeof ExitSequenceBegin | typeof ExitSequenceEnd | typeof TransitionBegin | typeof TransitionEnd;
117
+ /**
118
+ * Element {@link Transition | transition} component properties.
119
+ */
120
+ export interface TransitionProps {
121
+ /**
122
+ * Transition name.
123
+ *
124
+ * This serves as the base name for the default values of CSS class properties, such as
125
+ * {@link TransitionProps.enterClass | `enterClass`}.
126
+ *
127
+ * @defaultValue `"cw-transition"`
128
+ */
129
+ name?: string;
130
+ /**
131
+ * CSS class applied to entering element during enter sequence.
132
+ *
133
+ * The class specified is applied to the entering element when the enter sequence begins,
134
+ * *before* the element is rendered into the DOM. The class is removed when the enter
135
+ * sequence ends. This may be used to apply styles which are present on the entering
136
+ * element for the entire duration of the enter sequence.
137
+ *
138
+ * @defaultValue `${props.name}-enter`
139
+ * @see {@link TransitionProps.enterMotionClass}
140
+ * @see {@link TransitionProps.enterStartClass}
141
+ */
142
+ enterClass?: string | readonly string[];
143
+ /**
144
+ * CSS class applied to entering element during enter sequence initialization.
145
+ *
146
+ * The class specified is applied to the entering element when the enter sequence begins,
147
+ * *before* the element is rendered into the DOM. The class is removed when the enter
148
+ * motion begins. This may be used to apply styles which the entering element is
149
+ * initialized with, but should not exist when enter motion begins.
150
+ *
151
+ * @defaultValue `${props.name}-enterStart`
152
+ * @see {@link TransitionProps.enterClass}
153
+ * @see {@link TransitionProps.enterMotionClass}
154
+ */
155
+ enterStartClass?: string | readonly string[];
156
+ /**
157
+ * CSS class applied to entering element after enter sequence initialization.
158
+ *
159
+ * The class specified is applied to the entering element after it has been rendered into
160
+ * the DOM, *after* {@link TransitionProps.enterStartClass | `enterStartClass`} is removed
161
+ * from the element. This class should be used to apply the enter motion.
162
+ *
163
+ * @defaultValue `${props.name}-enterMotion`
164
+ * @see {@link TransitionProps.enterClass}
165
+ * @see {@link TransitionProps.enterStartClass}
166
+ */
167
+ enterMotionClass?: string | readonly string[];
168
+ /**
169
+ * Inline motion {@link applyMotion | applied} to entering element after enter sequence
170
+ * initialization.
171
+ *
172
+ * The motion specified, if any, is applied to the entering element after it has been
173
+ * rendered into the DOM, *before* {@link TransitionProps.enterStartClass |
174
+ * `enterStartClass`} and {@link TransitionProps.enterMotionClass |
175
+ * `enterMotionClass`} is removed and applied to the element, respectively.
176
+ */
177
+ enterMotion?: Readonly<TransitionMotion>;
178
+ /**
179
+ * CSS class applied to exiting element during exit sequence.
180
+ *
181
+ * The class specified is applied to the exiting element when the exit sequence begins.
182
+ * The class is removed when the exit sequence ends. This may be used to apply styles
183
+ * which are present on the exiting element for the entire duration of the exit sequence.
184
+ *
185
+ * The default `cw-transition-exit` class, applied when {@link TransitionProps.name |
186
+ * `name`} and this property are omitted or `undefined`, disables interaction with the
187
+ * exiting element by setting `touch-action`, `user-select`, and `pointer-events` to
188
+ * `none`.
189
+ *
190
+ * @defaultValue `${props.name}-exit`
191
+ * @see {@link TransitionProps.exitMotionClass}
192
+ * @see {@link TransitionProps.exitStartClass}
193
+ */
194
+ exitClass?: string | readonly string[];
195
+ /**
196
+ * CSS class applied to exiting element during exit sequence initialization.
197
+ *
198
+ * The class specified is applied to the exiting element when the exit sequence begins.
199
+ * The class is removed when the exit motion begins. This may be used to apply styles
200
+ * which the exiting element is initialized with, but should not exist when the exit motion
201
+ * begins.
202
+ *
203
+ * @defaultValue `${props.name}-exitStart`
204
+ * @see {@link TransitionProps.exitClass}
205
+ * @see {@link TransitionProps.exitMotionClass}
206
+ */
207
+ exitStartClass?: string | readonly string[];
208
+ /**
209
+ * CSS class applied to exiting element after exit sequence initialization.
210
+ *
211
+ * The class specified is applied to the exiting element after {@link
212
+ * TransitionProps.exitStartClass | `exitStartClass`} is removed from the element, after
213
+ * the render frame in which `exitStartClass` is applied to the element. This class should
214
+ * be used to apply the exit motion.
215
+ *
216
+ * @defaultValue `${props.name}-exitMotion`
217
+ * @see {@link TransitionProps.exitClass}
218
+ * @see {@link TransitionProps.exitStartClass}
219
+ */
220
+ exitMotionClass?: string | readonly string[];
221
+ /**
222
+ * Inline motion {@link applyMotion | applied} to exiting element after exit sequence
223
+ * initialization.
224
+ *
225
+ * The motion specified, if any, is applied to the exiting element in the *same* frame in
226
+ * which {@link TransitionProps.exitStartClass | `exitStartClass`} is applied to the
227
+ * element, but *before* {@link TransitionProps.exitMotionClass | `exitMotionClass`} is
228
+ * applied to the element.
229
+ *
230
+ * Unless the motion specifies a {@link MotionOptions.fill | fill} of its own, it fills
231
+ * `"forwards"`, holding its end state until the exiting element is removed from the DOM; the
232
+ * motion is cancelled once the element is removed. An exiting element has no resting state to
233
+ * return to, but it stays in the DOM after its motion ends, while the exit sequence waits for
234
+ * a paint, for the other motions of the element, and for {@link
235
+ * TransitionProps.onStateChange | `onStateChange`}: without the hold, it would be drawn at
236
+ * rest meanwhile, such as for the frames after a motion which reduced motion ends at once.
237
+ */
238
+ exitMotion?: Readonly<TransitionMotion>;
239
+ /**
240
+ * Order of enter and exit sequences.
241
+ *
242
+ * This may be set to `"enter-exit"`, `"exit-enter"`, or `"parallel"` for exit sequence
243
+ * beginning *after* enter sequence is complete, enter sequence beginning *after* exit
244
+ * sequence is complete or, both enter and exit sequences beginning in parallel,
245
+ * respectively.
246
+ *
247
+ * @defaultValue `"parallel"`
248
+ */
249
+ order?: "enter-exit" | "exit-enter" | "parallel";
250
+ /**
251
+ * Apply enter sequence to initial entering element.
252
+ *
253
+ * When `true`, the enter sequence will be applied to the initial entering element if,
254
+ * and only if, it is not `undefined`.
255
+ *
256
+ * @defaultValue `false`
257
+ * @remarks
258
+ * This is **not** reactive.
259
+ */
260
+ readonly appear?: boolean;
261
+ /**
262
+ * Entering element.
263
+ *
264
+ * This may be assigned to either an element {@link Accessor | accessor} or an element.
265
+ * When assigned to an accessor, the accessor is invoked, in a reactive context, to
266
+ * determine when a transition should begin. When assigned to an element, however, the
267
+ * element is returned as-is without any transitions. If {@link TransitionProps.appear |
268
+ * `appear`} is `true`, however, and this is assigned to an element, the enter sequence is
269
+ * started for the element on initialization.
270
+ *
271
+ * As the return value of the accessor is updated, the previously rendered element, if any,
272
+ * is exited from, and the newly returned element, if any, is entered into. If the accessor
273
+ * returns the same element across two serial invocations, no transition is applied.
274
+ *
275
+ * @remarks
276
+ * This is **not** reactive; however, if an accessor is specified, the accessor may be
277
+ * reactive.
278
+ */
279
+ readonly children: Accessor<JSX.Element> | JSX.Element;
280
+ /**
281
+ * Callback invoked when transition {@link TransitionState | state} changes.
282
+ *
283
+ * This is invoked with the transition {@link TransitionTarget | target} and new state,
284
+ * respectively. This may return nothing or a promise which resolves to nothing. If a
285
+ * promise is returned, the transition will not progress forward until the promise is
286
+ * complete. If this function fails with an error, transition is aborted, and the entering
287
+ * element, if any, is entered into the DOM immediately.
288
+ *
289
+ * @param target - elements participating in this transition
290
+ * @param state - newly entered transition state
291
+ * @returns optional promise to await before advancing the transition; resolved values are
292
+ * ignored
293
+ *
294
+ * @remarks
295
+ * This is **not** reactive.
296
+ */
297
+ readonly onStateChange?: (target: TransitionTarget, state: TransitionState) => Promise<unknown> | unknown;
298
+ }
299
+ /**
300
+ * Component which transitions between two elements.
301
+ *
302
+ * This renders an element which transitions between the element {@link TransitionProps.children |
303
+ * `props.children`} evaluates to, and the previous element `props.children` evaluated to. Note
304
+ * that `props.children` may not be reactive, instead, it may be assigned to either an {@link
305
+ * TransitionElement | transition} element or an {@link Accessor | accessor} which returns a
306
+ * transition element.
307
+ *
308
+ * While most transition properties are reactive, it is important to note that when a transition
309
+ * begins, a snapshot of the transition properties is created. This snapshot of property values
310
+ * is used for the duration of the respective transition. Any updates to property values, while
311
+ * a transition is pending, the property will not be applied to that transition, instead it will
312
+ * be applied to the *next* transition.
313
+ *
314
+ * # `props.children`
315
+ *
316
+ * When `props.children` is a transition element, an enter sequence is applied to the transition
317
+ * element if, and only if, {@link TransitionProps.appear | `props.appear`} is `true` and the
318
+ * transition element is not `undefined`. In either case, the transition element is returned
319
+ * immediately.
320
+ *
321
+ * An accessor function `props.children`, however, is invoked in a tracking context. The initial
322
+ * rendered element is the initial return value of `props.children`. Any subsequent update of the
323
+ * accessor function results in a transition if, and only if, the updated element is not equal to
324
+ * the previously returned element. The enter sequence is entered into for the initial return
325
+ * value of `props.children` if `props.appear` is `true`; otherwise, only during an element update
326
+ * is a transition applied.
327
+ *
328
+ * ```tsx
329
+ * // An element which appears only once when created.
330
+ * <Transition appear={true} name="my-transition-name">
331
+ * <div>Appears Once</div>
332
+ * </Transition>
333
+ *
334
+ * // An element which transitions between different elements reactively, and the initial element
335
+ * // has no enter sequence.
336
+ * <Transition name="my-transition-name">
337
+ * <Switch>
338
+ * <Match when={value() === "a"}>
339
+ * <div>A</div>
340
+ * </Match>
341
+ * <Match when={value() === "b"}>
342
+ * <div>B</div>
343
+ * </Match>
344
+ * </Switch>
345
+ * </Transition>
346
+ *
347
+ * // An element which transitions between different elements reactively, and the initial element
348
+ * // has an enter sequence.
349
+ * <Transition appear={true} name="my-transition-name">
350
+ * <Switch>
351
+ * <Match when={value() === "a"}>
352
+ * <div>A</div>
353
+ * </Match>
354
+ * <Match when={value() === "b"}>
355
+ * <div>B</div>
356
+ * </Match>
357
+ * </Switch>
358
+ * </Transition>
359
+ * ```
360
+ *
361
+ * # Transition
362
+ *
363
+ * Transition components maintain an internal state tracking the last entered element. As the
364
+ * `props.children` function updates its return value, the new return value is considered the
365
+ * entering element, while the last entered element is considered the exiting element. If
366
+ * `props.children` returns the last entered element, a transition is *not* initiated. In other
367
+ * words, the return value of `props.children` must be materially different from the last entered
368
+ * element, for a transition to begin.
369
+ *
370
+ * The last entered element, upon construction, is equal to the return value of `props.children`
371
+ * during component initialization. When {@link TransitionProps.appear | `props.appear`} is
372
+ * `true`, the last entered element is `undefined`, and the initial value of `props.children` is
373
+ * the entering element.
374
+ *
375
+ * Transitions stack, as such, if a transition is pending, and `props.children` is updated, then
376
+ * the new transition, if any, will be queued to begin *after* the pending transition completes.
377
+ * One exception to this is if `props.children` is updated to an element which already has a
378
+ * transition queued. In this case, all transitions succeeding the respective queued transition
379
+ * will be removed.
380
+ *
381
+ * A transition has at most two sequences, an enter sequence and an exit sequence. The enter and
382
+ * exit sequences are responsible for adding the entering element into the DOM and removing the
383
+ * exiting element from the DOM, respectively. If the entering or exiting element is not
384
+ * `undefined`, then the transition has an enter or exit sequence, respectively.
385
+ *
386
+ * The order of enter and exit sequence can be controlled using {@link TransitionProps.order |
387
+ * `props.order`}. When `props.order` is `"enter-exit"`, `"exit-enter"`, or, `"parallel"` or
388
+ * `undefined`, the exit sequence begins after the enter sequence ends, the enter sequence begins
389
+ * after the exit sequence ends, or both sequences start in parallel, respectively. Transition and
390
+ * sequence events can be consumed by specifying a {@link TransitionProps.onStateChange |
391
+ * `props.onStateChange`}.
392
+ *
393
+ * # Enter Sequence
394
+ *
395
+ * A transition will have an enter sequence if, and only if, the entering element is not
396
+ * `undefined`. The enter sequence is responsible for initializing the entering element for the
397
+ * enter motion, rendering the entering element into the DOM, awaiting enter motion completion,
398
+ * and removing enter motion styling from the element.
399
+ *
400
+ * When an enter sequence begins, it first applies {@link TransitionProps.enterClass |
401
+ * `props.enterClass`} and {@link TransitionProps.enterStartClass | `props.enterStartClass`} to
402
+ * the entering element. The `props.enterClass` is guaranteed to exist on the entering element
403
+ * for the duration of the enter sequence. The `props.enterStartClass`, however, exists on the
404
+ * entering element *only* until {@link TransitionProps.enterMotionClass |
405
+ * `props.enterMotionClass`} is applied to the element.
406
+ *
407
+ * After applying initial CSS classes to the entering element, the entering element is rendered
408
+ * into the DOM. After, the element is entered into the DOM, any {@link
409
+ * TransitionProps.enterMotion | inline} enter motion specified is {@link applyMotion | applied}
410
+ * to the entering element.
411
+ *
412
+ * Before `props.enterStartClass` is replaced with `props.enterMotionClass`, the enter sequence
413
+ * waits until the next paint frame. This barrier ensures the browser renders the styling from
414
+ * `props.enterStartClass` or `props.enterClass` *before* `props.enterMotionClass` is applied.
415
+ * Through this, `props.enterMotionClass` may initiate motions to a resting state with a
416
+ * guaranteed initial state, provided by `props.enterClass` or `props.enterStartClass`.
417
+ *
418
+ * This barrier is not required for the inline motion, as the inline motion utilizes the Web
419
+ * Animation API, which synchronizes the inline motion with the rendering pipeline of the
420
+ * browser.
421
+ *
422
+ * After `props.enterMotionClass` is applied, all motions pending on the entering element,
423
+ * including its recursively nested children and pseudo elements, are awaited on *before* ending
424
+ * the enter sequence. Note that motions whose timeline is not `document.timeline`, or whose
425
+ * iterations are infinite are ignored. Once pending motions are complete,
426
+ * `props.enterMotionClass` and `props.enterClass` are removed from the entering element.
427
+ *
428
+ * ```
429
+ * +----------------+
430
+ * | Begin Sequence |
431
+ * +----------------+
432
+ * |
433
+ * v
434
+ * +-------------------------------------------------+
435
+ * | Add `props.enterStartClass`, `props.enterClass` |
436
+ * +-------------------------------------------------+
437
+ * |
438
+ * v
439
+ * +-----------------------------+
440
+ * | Add entering element to DOM |
441
+ * +-----------------------------+
442
+ * |
443
+ * v
444
+ * +-------------------------------------------------------------------+
445
+ * | 1. Invoke `props.onStateChange` with `EnterSequenceBegin` |
446
+ * | 2. Start `props.enterMotion` |
447
+ * +-------------------------------------------------------------------+
448
+ * |
449
+ * v
450
+ * +----------------------------------------+
451
+ * | Wait until entering element is painted |
452
+ * +----------------------------------------+
453
+ * |
454
+ * v
455
+ * +---------------------------------------------------------------+
456
+ * | Replace `props.enterStartClass` with `props.enterMotionClass` |
457
+ * +---------------------------------------------------------------+
458
+ * |
459
+ * v
460
+ * +----------------------------------------------------------------------------------+
461
+ * | Wait until all motions for entering element, including nested elements, complete |
462
+ * +----------------------------------------------------------------------------------+
463
+ * |
464
+ * v
465
+ * +-----------------------------------------------------------------+
466
+ * | 1. Remove `props.enterMotionClass` |
467
+ * | 2. Invoke `props.onStateChange` with `EnterSequenceEnd` |
468
+ * +-----------------------------------------------------------------+
469
+ * |
470
+ * v
471
+ * +---------------------------+
472
+ * | Remove `props.enterClass` |
473
+ * +---------------------------+
474
+ * |
475
+ * v
476
+ * +--------------+
477
+ * | End Sequence |
478
+ * +--------------+
479
+ * ```
480
+ *
481
+ * # Exit Sequence
482
+ *
483
+ * A transition will have an exit sequence if, and only if, the exiting element is not `undefined`.
484
+ * The exit sequence is responsible for initializing the exiting element for the exit motion,
485
+ * awaiting exit motion completion, removing exit motion styling from the element, and removing the
486
+ * element from the DOM.
487
+ *
488
+ * When an exit sequence begins, it first applies {@link TransitionProps.exitClass |
489
+ * `props.exitClass`} and {@link TransitionProps.exitStartClass | `props.exitStartClass`} to the
490
+ * exiting element. The `props.exitClass` is guaranteed to exist on the exiting element for the
491
+ * duration of the exit sequence. The `props.exitStartClass`, however, exists on the exiting
492
+ * element *only* until {@link TransitionProps.exitMotionClass | `props.exitMotionClass`} is
493
+ * applied to the element. After applying initial CSS classes to the exiting element, the {@link
494
+ * TransitionProps.exitMotion | inline} exit motion specified is {@link applyMotion | applied}
495
+ * to the exiting element. Unless it specifies a fill of its own, the inline exit motion holds its
496
+ * end state until the exiting element is removed from the DOM.
497
+ *
498
+ * Before `props.exitStartClass` is replaced with `props.exitMotionClass`, the exit sequence
499
+ * waits until the next paint frame. This barrier ensures the browser renders the styling from
500
+ * `props.exitStartClass` or `props.exitClass` *before* `props.exitMotionClass` is applied.
501
+ * Through this, `props.exitMotionClass` may initiate motions to a resting state with a guaranteed
502
+ * initial state, provided by `props.exitClass` or `props.exitStartClass`.
503
+ *
504
+ * This barrier is not required for the inline motion, as the inline motion utilizes the Web
505
+ * Animation API, which synchronizes the inline motion with the rendering pipeline of the
506
+ * browser.
507
+ *
508
+ * After `props.exitMotionClass` is applied, all motions pending on the exiting element, including
509
+ * its recursively nested children and pseudo elements, are awaited on *before* continuing the
510
+ * exit sequence. Note that motions whose timeline is not `document.timeline`, or whose iterations
511
+ * are infinite are ignored. Once pending motions are complete, `props.exitMotionClass` and
512
+ * `props.exitClass` are removed from the exiting element, the exiting element is removed from the
513
+ * DOM, and the inline exit motion is cancelled, so the element is at rest if it enters again.
514
+ *
515
+ * ```
516
+ * +----------------+
517
+ * | Begin Sequence |
518
+ * +----------------+
519
+ * |
520
+ * v
521
+ * +-----------------------------------------------+
522
+ * | Add `props.exitStartClass`, `props.exitClass` |
523
+ * +-----------------------------------------------+
524
+ * |
525
+ * v
526
+ * +------------------------------------------------------------------+
527
+ * | 1. Invoke `props.onStateChange` with `ExitSequenceBegin` |
528
+ * | 2. Start `props.exitMotion`, holding its end state |
529
+ * +------------------------------------------------------------------+
530
+ * |
531
+ * v
532
+ * +----------------------------------------+
533
+ * | Wait until exiting element is painted |
534
+ * +----------------------------------------+
535
+ * |
536
+ * v
537
+ * +-------------------------------------------------------------+
538
+ * | Replace `props.exitStartClass` with `props.exitMotionClass` |
539
+ * +-------------------------------------------------------------+
540
+ * |
541
+ * v
542
+ * +----------------------------------------------------------------------------------+
543
+ * | Wait until all motions for exiting element, including nested elements, complete |
544
+ * +----------------------------------------------------------------------------------+
545
+ * |
546
+ * v
547
+ * +----------------------------------------------------------------+
548
+ * | 1. Remove `props.exitMotionClass` |
549
+ * | 2. Invoke `props.onStateChange` with `ExitSequenceEnd` |
550
+ * +----------------------------------------------------------------+
551
+ * |
552
+ * v
553
+ * +--------------------------+
554
+ * | Remove `props.exitClass` |
555
+ * +--------------------------+
556
+ * |
557
+ * v
558
+ * +----------------------------------------+
559
+ * | 1. Remove exiting element from the DOM |
560
+ * | 2. Cancel `props.exitMotion` |
561
+ * +----------------------------------------+
562
+ * |
563
+ * v
564
+ * +--------------+
565
+ * | End Sequence |
566
+ * +--------------+
567
+ * ```
568
+ *
569
+ * # Inline Motion
570
+ *
571
+ * In addition to CSS initiated motions, inline motions can be defined for both the enter and exit
572
+ * sequences through {@link TransitionProps.enterMotion | `props.enterMotion`} and {@link
573
+ * TransitionProps.exitMotion | `props.exitMotion`}, respectively. These motions begin *after*
574
+ * the respective sequence and sequence start CSS classes are applied to the respective element.
575
+ *
576
+ * Inline motions must be defined in terms of a {@link TransitionMotion}, which contains the
577
+ * motion {@link MotionOptions | options} and {@link TransitionMotion.keyframes | keyframes}. The
578
+ * keyframes may be either an array of {@link MotionKeyframe | motion keyframes} or a function
579
+ * which returns an array of motion keyframes.
580
+ *
581
+ * When a function is specified, the function will be invoked for the enter and exit sequences of
582
+ * the respective transition. Each invocation will be with the transition {@link TransitionTarget |
583
+ * target}. This can be used to construct keyframes dynamically for each transition and
584
+ * sequence.
585
+ *
586
+ * An inline enter motion, which ends at the resting state of the entering element, stops affecting
587
+ * the element once it finishes, unless it specifies a fill. An inline exit motion, however, holds
588
+ * its end state until the exiting element is removed from the DOM, unless it specifies a fill of
589
+ * its own, since the exiting element has no resting state to return to; see {@link
590
+ * TransitionProps.exitMotion | `props.exitMotion`}.
591
+ *
592
+ * @param props - component properties
593
+ * @returns rendered element
594
+ * @throws {@link TypeError} `props.children` evaluated to a value which could not be mapped to
595
+ * {@link TransitionElement}
596
+ */
597
+ export declare const Transition: FlowComponent<TransitionProps, TransitionProps["children"]>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Velocity estimator of a one-dimensional position.
3
+ *
4
+ * This estimates the velocity of a position, such as a pointer coordinate, from its newest
5
+ * {@link SAMPLE_CAPACITY | 20} samples. An estimate considers the newest sample, then each older
6
+ * sample in turn, as long as it is at most {@link SAMPLE_HORIZON_MSEC | 100ms} older than the
7
+ * newest sample *and* at most {@link MAX_SAMPLE_GAP_MSEC | 40ms} apart from the previous one. The
8
+ * velocity is the slope, at the newest sample, of lines and parabolas fitted by least squares to
9
+ * the newest of these samples.
10
+ *
11
+ * Consecutive samples which share a time stamp are reduced to one: the newest of them, as for
12
+ * coalesced pointer events, or the oldest, as for a clock which did not advance, whichever fits a
13
+ * parabola with the smaller residual variance.
14
+ *
15
+ * Of three kept samples or fewer, the velocity is the slope between the newest two; of four, it is
16
+ * the mean of that slope and the slope of the fitted parabola. Of more, it is the mean of the
17
+ * slopes of the lines and parabolas fitted to each window of the newest samples, weighted by their
18
+ * risk. The risk of a fit is the variance of its slope, given the noise of the positions, plus its
19
+ * squared bias, given its difference from the fits of higher degree. The noise is estimated from
20
+ * the residual of each sample from the parabola through its neighbors.
21
+ *
22
+ * Estimation does not allocate.
23
+ */
24
+ export declare class VelocityTracker {
25
+ #private;
26
+ /**
27
+ * Construct a new tracker without samples.
28
+ */
29
+ constructor();
30
+ /**
31
+ * Add a sample.
32
+ *
33
+ * Once the tracker is full, this replaces the oldest retained sample. Samples are expected in
34
+ * chronological order, such as successive pointer events; this is **not** enforced.
35
+ *
36
+ * @param time - finite time, in milliseconds, such as `PointerEvent.timeStamp`
37
+ * @param position - finite position
38
+ * @throws {@link Error} `time` or `position` is not finite
39
+ */
40
+ addDataPoint(time: number, position: number): void;
41
+ /**
42
+ * Estimate velocity at newest sample.
43
+ *
44
+ * @param maximumVelocity - positive bound of the magnitude of the result, if any
45
+ * @returns velocity, in position units per second, or `0` without samples at two distinct
46
+ * contributing times or if the estimate is not finite
47
+ * @throws {@link Error} `maximumVelocity` is not positive
48
+ */
49
+ calculateVelocity(maximumVelocity?: number): number;
50
+ /**
51
+ * Remove all samples.
52
+ */
53
+ resetTracking(): void;
54
+ }