@nsaa/core 0.1.0-alpha.1 → 0.1.0-alpha.3

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 (286) hide show
  1. package/README.md +30 -8
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/accordion/accordion.d.ts +7 -0
  4. package/dist/accordion/accordion.js +54 -0
  5. package/dist/accordion/index.d.ts +3 -0
  6. package/dist/alert/alert.d.ts +19 -0
  7. package/dist/alert/alert.js +58 -0
  8. package/dist/alert/index.d.ts +3 -0
  9. package/dist/alert-dialog/alert-dialog.d.ts +19 -0
  10. package/dist/alert-dialog/alert-dialog.js +106 -0
  11. package/dist/alert-dialog/index.d.ts +3 -0
  12. package/dist/avatar/avatar.d.ts +12 -0
  13. package/dist/avatar/avatar.js +50 -0
  14. package/dist/avatar/index.d.ts +3 -0
  15. package/dist/badge/badge.d.ts +8 -0
  16. package/dist/badge/badge.js +29 -0
  17. package/dist/badge/index.d.ts +3 -0
  18. package/dist/button/button.d.ts +25 -0
  19. package/dist/button/button.js +136 -0
  20. package/dist/button/index.d.ts +3 -0
  21. package/dist/calendar/calendar.d.ts +11 -0
  22. package/dist/calendar/calendar.js +131 -0
  23. package/dist/calendar/index.d.ts +3 -0
  24. package/dist/card/card.d.ts +12 -0
  25. package/dist/card/card.js +55 -0
  26. package/dist/card/index.d.ts +3 -0
  27. package/dist/checkbox/checkbox.d.ts +4 -0
  28. package/dist/checkbox/checkbox.js +35 -0
  29. package/dist/checkbox/index.d.ts +3 -0
  30. package/dist/collapsible/collapsible.d.ts +6 -0
  31. package/dist/collapsible/collapsible.js +24 -0
  32. package/dist/collapsible/index.d.ts +3 -0
  33. package/dist/combobox/combobox.d.ts +27 -0
  34. package/dist/combobox/combobox.js +226 -0
  35. package/dist/combobox/index.d.ts +3 -0
  36. package/dist/command/command.d.ts +20 -0
  37. package/dist/command/command.js +116 -0
  38. package/dist/command/index.d.ts +3 -0
  39. package/dist/context-menu/context-menu.d.ts +30 -0
  40. package/dist/context-menu/context-menu.js +173 -0
  41. package/dist/context-menu/index.d.ts +3 -0
  42. package/dist/dialog/dialog.d.ts +18 -0
  43. package/dist/dialog/dialog.js +112 -0
  44. package/dist/dialog/index.d.ts +3 -0
  45. package/dist/direction.d.ts +3 -0
  46. package/dist/direction.js +2 -0
  47. package/dist/drawer/drawer.d.ts +17 -0
  48. package/dist/drawer/drawer.js +136 -0
  49. package/dist/drawer/index.d.ts +3 -0
  50. package/dist/dropdown-menu/dropdown-menu.d.ts +30 -0
  51. package/dist/dropdown-menu/dropdown-menu.js +177 -0
  52. package/dist/dropdown-menu/index.d.ts +3 -0
  53. package/dist/empty/empty.d.ts +35 -0
  54. package/dist/empty/empty.js +93 -0
  55. package/dist/empty/index.d.ts +3 -0
  56. package/dist/field/field.d.ts +26 -0
  57. package/dist/field/field.js +109 -0
  58. package/dist/field/index.d.ts +3 -0
  59. package/dist/index.d.ts +90 -674
  60. package/dist/index.js +50 -3877
  61. package/dist/input/index.d.ts +3 -0
  62. package/dist/input/input.d.ts +4 -0
  63. package/dist/input/input.js +14 -0
  64. package/dist/input-group/index.d.ts +3 -0
  65. package/dist/input-group/input-group.d.ts +19 -0
  66. package/dist/input-group/input-group.js +78 -0
  67. package/dist/input-otp/index.d.ts +3 -0
  68. package/dist/input-otp/input-otp.d.ts +12 -0
  69. package/dist/input-otp/input-otp.js +73 -0
  70. package/dist/kbd/index.d.ts +3 -0
  71. package/dist/kbd/kbd.d.ts +5 -0
  72. package/dist/kbd/kbd.js +19 -0
  73. package/dist/label/index.d.ts +3 -0
  74. package/dist/label/label.d.ts +4 -0
  75. package/dist/label/label.js +13 -0
  76. package/dist/legacy/icon-button/icon-swap.js +58 -0
  77. package/dist/lib/cn.d.ts +3 -0
  78. package/dist/{cn-DxFBFdwT.js → lib/cn.js} +1 -1
  79. package/dist/lib/control-defaults.js +8 -0
  80. package/dist/lib/icon-swap.d.ts +15 -0
  81. package/dist/lib/icon-swap.js +26 -0
  82. package/dist/lib/input-modality.js +39 -0
  83. package/dist/lib/merge-refs.js +21 -0
  84. package/dist/lib/opener.js +29 -0
  85. package/dist/lib/shortcut.js +50 -0
  86. package/dist/lib/track-input-modality.d.ts +2 -0
  87. package/dist/lib/track-input-modality.js +4 -0
  88. package/dist/lib/tv.js +7 -0
  89. package/dist/lib/use-press.js +48 -0
  90. package/dist/lib/user-action.js +13 -0
  91. package/dist/loaders/arc.d.ts +6 -0
  92. package/dist/loaders/arc.js +31 -0
  93. package/dist/loaders/atom.d.ts +5 -0
  94. package/dist/loaders/atom.js +70 -0
  95. package/dist/loaders/blocks.d.ts +8 -0
  96. package/dist/loaders/blocks.js +74 -0
  97. package/dist/loaders/bouncing-dots.d.ts +3 -0
  98. package/dist/loaders/bouncing-dots.js +45 -0
  99. package/dist/loaders/cap.d.ts +6 -0
  100. package/dist/loaders/cap.js +7 -0
  101. package/dist/loaders/cascade.d.ts +5 -0
  102. package/dist/loaders/cascade.js +50 -0
  103. package/dist/loaders/circular-dots.d.ts +3 -0
  104. package/dist/loaders/circular-dots.js +40 -0
  105. package/dist/loaders/classic-v2.d.ts +3 -0
  106. package/dist/loaders/classic-v2.js +41 -0
  107. package/dist/loaders/classic.d.ts +3 -0
  108. package/dist/loaders/classic.js +48 -0
  109. package/dist/loaders/clock.d.ts +5 -0
  110. package/dist/loaders/clock.js +31 -0
  111. package/dist/loaders/comet.d.ts +5 -0
  112. package/dist/loaders/comet.js +52 -0
  113. package/dist/loaders/compass.d.ts +3 -0
  114. package/dist/loaders/compass.js +39 -0
  115. package/dist/loaders/dual.d.ts +6 -0
  116. package/dist/loaders/dual.js +47 -0
  117. package/dist/loaders/easing.d.ts +6 -0
  118. package/dist/loaders/easing.js +34 -0
  119. package/dist/loaders/eclipse.d.ts +3 -0
  120. package/dist/loaders/eclipse.js +69 -0
  121. package/dist/loaders/fade.js +28 -0
  122. package/dist/loaders/flip.d.ts +3 -0
  123. package/dist/loaders/flip.js +41 -0
  124. package/dist/{frame-CK9IBOZB.js → loaders/frame.js} +2 -50
  125. package/dist/loaders/gather.d.ts +3 -0
  126. package/dist/loaders/gather.js +85 -0
  127. package/dist/loaders/leap.d.ts +3 -0
  128. package/dist/loaders/leap.js +67 -0
  129. package/dist/loaders/linear-dots.d.ts +3 -0
  130. package/dist/loaders/linear-dots.js +54 -0
  131. package/dist/loaders/loading.d.ts +3 -0
  132. package/dist/loaders/loading.js +64 -0
  133. package/dist/loaders/morph.d.ts +3 -0
  134. package/dist/loaders/morph.js +40 -0
  135. package/dist/loaders/motion.d.ts +35 -0
  136. package/dist/loaders/motion.js +51 -0
  137. package/dist/loaders/orbit.d.ts +5 -0
  138. package/dist/loaders/orbit.js +44 -0
  139. package/dist/loaders/pulse.d.ts +3 -0
  140. package/dist/loaders/pulse.js +52 -0
  141. package/dist/loaders/radar.d.ts +5 -0
  142. package/dist/loaders/radar.js +64 -0
  143. package/dist/loaders/ring.d.ts +6 -0
  144. package/dist/loaders/ring.js +38 -0
  145. package/dist/loaders/ripple.d.ts +8 -0
  146. package/dist/loaders/ripple.js +57 -0
  147. package/dist/loaders/slide.d.ts +3 -0
  148. package/dist/loaders/slide.js +74 -0
  149. package/dist/loaders/snake.d.ts +6 -0
  150. package/dist/loaders/snake.js +59 -0
  151. package/dist/loaders/spinners.d.ts +61 -0
  152. package/dist/loaders/spinners.js +63 -0
  153. package/dist/loaders/swirl.d.ts +3 -0
  154. package/dist/loaders/swirl.js +50 -0
  155. package/dist/loaders/text/shared.js +25 -0
  156. package/dist/loaders/text/text-loaders.d.ts +48 -0
  157. package/dist/loaders/text/text-loaders.js +723 -0
  158. package/dist/loaders/trace.d.ts +6 -0
  159. package/dist/loaders/trace.js +46 -0
  160. package/dist/loaders/types.d.ts +10 -0
  161. package/dist/loaders/wave.d.ts +8 -0
  162. package/dist/loaders/wave.js +59 -0
  163. package/dist/loaders-text.d.ts +2 -47
  164. package/dist/loaders-text.js +1 -743
  165. package/dist/loaders.d.ts +36 -132
  166. package/dist/loaders.js +35 -1096
  167. package/dist/native-select/index.d.ts +3 -0
  168. package/dist/native-select/native-select.d.ts +9 -0
  169. package/dist/native-select/native-select.js +44 -0
  170. package/dist/pagination/index.d.ts +3 -0
  171. package/dist/pagination/pagination.d.ts +18 -0
  172. package/dist/pagination/pagination.js +134 -0
  173. package/dist/popover/index.d.ts +3 -0
  174. package/dist/popover/popover.d.ts +10 -0
  175. package/dist/popover/popover.js +54 -0
  176. package/dist/radio-group/index.d.ts +3 -0
  177. package/dist/radio-group/radio-group.d.ts +6 -0
  178. package/dist/radio-group/radio-group.js +33 -0
  179. package/dist/select/index.d.ts +3 -0
  180. package/dist/select/select.d.ts +16 -0
  181. package/dist/select/select.js +148 -0
  182. package/dist/separator/index.d.ts +3 -0
  183. package/dist/separator/separator.d.ts +4 -0
  184. package/dist/separator/separator.js +15 -0
  185. package/dist/skeleton/index.d.ts +3 -0
  186. package/dist/skeleton/skeleton.d.ts +10 -0
  187. package/dist/skeleton/skeleton.js +24 -0
  188. package/dist/slider/index.d.ts +3 -0
  189. package/dist/slider/slider.d.ts +4 -0
  190. package/dist/slider/slider.js +39 -0
  191. package/dist/sound/lazy-uisfx.d.ts +20 -0
  192. package/dist/sound/lazy-uisfx.js +68 -0
  193. package/dist/sound/sound-map.d.ts +72 -0
  194. package/dist/sound/sound-map.js +76 -0
  195. package/dist/sound/sound.d.ts +38 -0
  196. package/dist/sound/sound.js +136 -0
  197. package/dist/sound/uisfx.d.ts +41 -0
  198. package/dist/sound/uisfx.js +59 -0
  199. package/dist/sound-uisfx.d.ts +2 -37
  200. package/dist/sound-uisfx.js +1 -58
  201. package/dist/sources/accordion.css +3 -0
  202. package/dist/sources/alert-dialog.css +26 -0
  203. package/dist/sources/alert.css +8 -0
  204. package/dist/sources/avatar.css +3 -0
  205. package/dist/sources/badge.css +3 -0
  206. package/dist/sources/button.css +24 -0
  207. package/dist/sources/calendar.css +25 -0
  208. package/dist/sources/card.css +3 -0
  209. package/dist/sources/checkbox.css +6 -0
  210. package/dist/sources/collapsible.css +2 -0
  211. package/dist/sources/combobox.css +28 -0
  212. package/dist/sources/command.css +30 -0
  213. package/dist/sources/context-menu.css +6 -0
  214. package/dist/sources/dialog.css +26 -0
  215. package/dist/sources/drawer.css +6 -0
  216. package/dist/sources/dropdown-menu.css +6 -0
  217. package/dist/sources/empty.css +3 -0
  218. package/dist/sources/field.css +5 -0
  219. package/dist/sources/input-group.css +27 -0
  220. package/dist/sources/input-otp.css +8 -0
  221. package/dist/sources/input.css +3 -0
  222. package/dist/sources/kbd.css +3 -0
  223. package/dist/sources/label.css +3 -0
  224. package/dist/sources/loaders-text.css +8 -0
  225. package/dist/sources/loaders.css +40 -0
  226. package/dist/sources/native-select.css +3 -0
  227. package/dist/sources/pagination.css +25 -0
  228. package/dist/sources/popover.css +3 -0
  229. package/dist/sources/radio-group.css +6 -0
  230. package/dist/sources/select.css +6 -0
  231. package/dist/sources/separator.css +3 -0
  232. package/dist/sources/skeleton.css +3 -0
  233. package/dist/sources/slider.css +6 -0
  234. package/dist/sources/spinner.css +20 -0
  235. package/dist/sources/switch.css +6 -0
  236. package/dist/sources/table.css +3 -0
  237. package/dist/sources/tabs.css +3 -0
  238. package/dist/sources/textarea.css +3 -0
  239. package/dist/sources/toast.css +25 -0
  240. package/dist/sources/toggle-group.css +32 -0
  241. package/dist/sources/toolbar.css +34 -0
  242. package/dist/sources/tooltip.css +3 -0
  243. package/dist/spinner/index.d.ts +5 -0
  244. package/dist/spinner/loader-provider.d.ts +16 -0
  245. package/dist/spinner/loader-provider.js +28 -0
  246. package/dist/spinner/registry.d.ts +9 -0
  247. package/dist/spinner/registry.js +15 -0
  248. package/dist/spinner/spinner.d.ts +26 -0
  249. package/dist/spinner/spinner.js +143 -0
  250. package/dist/switch/index.d.ts +3 -0
  251. package/dist/switch/switch.d.ts +6 -0
  252. package/dist/switch/switch.js +25 -0
  253. package/dist/table/index.d.ts +3 -0
  254. package/dist/table/table.d.ts +17 -0
  255. package/dist/table/table.js +66 -0
  256. package/dist/tabs/index.d.ts +3 -0
  257. package/dist/tabs/tabs.d.ts +11 -0
  258. package/dist/tabs/tabs.js +46 -0
  259. package/dist/textarea/index.d.ts +3 -0
  260. package/dist/textarea/textarea.d.ts +4 -0
  261. package/dist/textarea/textarea.js +12 -0
  262. package/dist/toast/index.d.ts +3 -0
  263. package/dist/toast/toast.d.ts +17 -0
  264. package/dist/toast/toast.js +211 -0
  265. package/dist/toggle-group/index.d.ts +3 -0
  266. package/dist/toggle-group/toggle-group.d.ts +64 -0
  267. package/dist/toggle-group/toggle-group.js +95 -0
  268. package/dist/tokens/dist/motion.d.ts +24 -0
  269. package/dist/{motion-NQq2BA78.js → tokens/dist/motion.js} +1 -1
  270. package/dist/toolbar/index.d.ts +3 -0
  271. package/dist/toolbar/overflow.d.ts +4 -0
  272. package/dist/toolbar/overflow.js +242 -0
  273. package/dist/toolbar/toolbar-item.d.ts +29 -0
  274. package/dist/toolbar/toolbar-item.js +71 -0
  275. package/dist/toolbar/toolbar.d.ts +73 -0
  276. package/dist/toolbar/toolbar.js +250 -0
  277. package/dist/tooltip/index.d.ts +3 -0
  278. package/dist/tooltip/tooltip.d.ts +7 -0
  279. package/dist/tooltip/tooltip.js +41 -0
  280. package/package.json +9 -5
  281. package/src/feel.css +52 -0
  282. package/src/styles-base.css +142 -0
  283. package/src/styles.css +3 -133
  284. package/dist/registry-2PyPW9Xw.js +0 -390
  285. package/dist/registry-DjfWNw3R.d.ts +0 -18
  286. package/dist/sound-DiYNAnR_.d.ts +0 -61
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { animation } from "./motion.js";
3
+ // src/loaders/easing.ts
4
+ const DEFAULT_EASING = "linear";
5
+ function spinClass(name, easing = DEFAULT_EASING) {
6
+ const base = `nsaa-loader-${name}-spin`;
7
+ return easing === "linear" ? base : `${base} ${base}-${easing}`;
8
+ }
9
+ const ROTATE = `to {
10
+ transform: rotate(360deg);
11
+ }`;
12
+ function rotationCss(name, turn = ROTATE) {
13
+ return `
14
+ .nsaa-loader-${name}-spin {
15
+ transform-origin: center;
16
+ ${animation(name, `nsaa-loader-${name}-rotate`, "linear")}
17
+ }
18
+
19
+ .nsaa-loader-${name}-spin-ease-in-out {
20
+ animation-timing-function: ease-in-out;
21
+ }
22
+
23
+ .nsaa-loader-${name}-spin-stacked {
24
+ animation-name: nsaa-loader-${name}-rotate, nsaa-loader-${name}-rotate;
25
+ animation-timing-function: linear, ease-in-out;
26
+ animation-composition: add;
27
+ }
28
+
29
+ @keyframes nsaa-loader-${name}-rotate {
30
+ ${turn}
31
+ }
32
+ `;
33
+ }
34
+ export { DEFAULT_EASING, rotationCss, spinClass };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Eclipse(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { STEP_VAR, animation, stagger } from "./motion.js";
3
+ import { SpinnerStyle, reducedMotion, spinnerRoot, step } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/eclipse.tsx
6
+ const DOTS = [0, 1];
7
+ const css = `
8
+ .nsaa-loader-eclipse {
9
+ position: relative;
10
+ }
11
+
12
+ .nsaa-loader-eclipse-dot {
13
+ position: absolute;
14
+ top: 30%;
15
+ left: 30%;
16
+ width: 40%;
17
+ height: 40%;
18
+ background: currentColor;
19
+ border-radius: 50%;
20
+ ${animation("eclipse", ["nsaa-loader-eclipse-slide", "nsaa-loader-eclipse-depth"], "ease-in-out")}
21
+ animation-delay: ${stagger("eclipse", DOTS.length)};
22
+ }
23
+
24
+ @keyframes nsaa-loader-eclipse-slide {
25
+ 0%,
26
+ 100% {
27
+ translate: 75% 0;
28
+ }
29
+ 50% {
30
+ translate: -75% 0;
31
+ }
32
+ }
33
+
34
+ @keyframes nsaa-loader-eclipse-depth {
35
+ 0%,
36
+ 50%,
37
+ 100% {
38
+ opacity: 0.75;
39
+ scale: 1;
40
+ }
41
+ 25% {
42
+ opacity: 1;
43
+ scale: 1.3;
44
+ }
45
+ 75% {
46
+ opacity: 0.5;
47
+ scale: 0.7;
48
+ }
49
+ }
50
+
51
+ ${reducedMotion(`
52
+ .nsaa-loader-eclipse-dot {
53
+ translate: calc(var(${STEP_VAR}) * 150% - 75%) 0;
54
+ }
55
+ `)}
56
+ `;
57
+ function Eclipse(props) {
58
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
59
+ name: "eclipse",
60
+ children: css
61
+ }), /* @__PURE__ */ jsx("div", {
62
+ ...spinnerRoot("eclipse", props),
63
+ children: DOTS.map((index) => /* @__PURE__ */ jsx("div", {
64
+ className: "nsaa-loader-eclipse-dot",
65
+ style: step(index)
66
+ }, index))
67
+ })] });
68
+ }
69
+ export { Eclipse };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { animation, stagger } from "./motion.js";
3
+ import { reducedMotion } from "./frame.js";
4
+ // src/loaders/fade.ts
5
+ function fadeCss(name, element, count, { dim, rest }) {
6
+ return `
7
+ .nsaa-loader-${name}-${element} {
8
+ ${animation(name, `nsaa-loader-${name}-fade`, "linear")}
9
+ animation-delay: ${stagger(name, count)};
10
+ }
11
+
12
+ @keyframes nsaa-loader-${name}-fade {
13
+ from {
14
+ opacity: 1;
15
+ }
16
+ to {
17
+ opacity: ${dim};
18
+ }
19
+ }
20
+
21
+ ${reducedMotion(`
22
+ .nsaa-loader-${name}-${element} {
23
+ opacity: ${rest};
24
+ }
25
+ `)}
26
+ `;
27
+ }
28
+ export { fadeCss };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Flip(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { SIZE, animation } from "./motion.js";
3
+ import { SpinnerStyle, spinnerRoot } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/flip.tsx
6
+ const css = `
7
+ .nsaa-loader-flip {
8
+ perspective: calc(${SIZE} * 3);
9
+ }
10
+
11
+ .nsaa-loader-flip-face {
12
+ width: 64%;
13
+ height: 64%;
14
+ margin: 18%;
15
+ background: currentColor;
16
+ border-radius: calc(${SIZE} * 0.06);
17
+ ${animation("flip", "nsaa-loader-flip-turn", "ease-in-out")}
18
+ }
19
+
20
+ @keyframes nsaa-loader-flip-turn {
21
+ 0% {
22
+ transform: rotateX(0) rotateY(0);
23
+ }
24
+ 50% {
25
+ transform: rotateX(-180deg) rotateY(0);
26
+ }
27
+ 100% {
28
+ transform: rotateX(-180deg) rotateY(-180deg);
29
+ }
30
+ }
31
+ `;
32
+ function Flip(props) {
33
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
34
+ name: "flip",
35
+ children: css
36
+ }), /* @__PURE__ */ jsx("div", {
37
+ ...spinnerRoot("flip", props),
38
+ children: /* @__PURE__ */ jsx("div", { className: "nsaa-loader-flip-face" })
39
+ })] });
40
+ }
41
+ export { Flip };
@@ -1,54 +1,6 @@
1
1
  "use client";
2
- import { n as loader } from "./motion-NQq2BA78.js";
2
+ import { DURATION_VAR, PLAY_STATE_VAR, SIZE, SIZE_VAR, STEP_VAR } from "./motion.js";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- // src/loaders/motion.ts
5
- const DURATION_VAR = "--nsaa-loader-duration";
6
- const PLAY_STATE_VAR = "--nsaa-loader-play-state";
7
- const SIZE_VAR = "--nsaa-loader-size";
8
- const STEP_VAR = "--nsaa-loader-step";
9
- const SIZE = `var(${SIZE_VAR}, var(--nsaa-loader-size-md))`;
10
- const SPINNER_MOTION = {
11
- arc: loader.duration.arc,
12
- atom: loader.duration.atom,
13
- blocks: loader.duration.blocks,
14
- "bouncing-dots": loader.duration["bouncing-dots"],
15
- cascade: loader.duration.cascade,
16
- "circular-dots": loader.duration["circular-dots"],
17
- classic: loader.duration.classic,
18
- "classic-v2": loader.duration["classic-v2"],
19
- clock: loader.duration.clock,
20
- comet: loader.duration.comet,
21
- compass: loader.duration.compass,
22
- dual: loader.duration.dual,
23
- eclipse: loader.duration.eclipse,
24
- flip: loader.duration.flip,
25
- gather: loader.duration.gather,
26
- leap: loader.duration.leap,
27
- "linear-dots": loader.duration["linear-dots"],
28
- loading: loader.duration.loading,
29
- morph: loader.duration.morph,
30
- orbit: loader.duration.orbit,
31
- pulse: loader.duration.pulse,
32
- radar: loader.duration.radar,
33
- ring: loader.duration.ring,
34
- ripple: loader.duration.ripple,
35
- slide: loader.duration.slide,
36
- snake: loader.duration.snake,
37
- swirl: loader.duration.swirl,
38
- trace: loader.duration.trace,
39
- wave: loader.duration.wave
40
- };
41
- function duration(name) {
42
- return `var(${DURATION_VAR}, var(--nsaa-loader-duration-${name}))`;
43
- }
44
- function stagger(name, count) {
45
- return `calc(${duration(name)} * (var(${STEP_VAR}) - ${count}) / ${count})`;
46
- }
47
- const PLAY_STATE = `var(${PLAY_STATE_VAR}, running)`;
48
- function animation(name, keyframes, timing) {
49
- return `animation: ${[keyframes].flat().map((frames) => `${frames} ${duration(name)} ${timing} infinite`).join(", ")};
50
- animation-play-state: ${PLAY_STATE};`;
51
- }
52
4
  // src/loaders/frame.tsx
53
5
  /**
54
6
  * Nsaa: a loader's reduced-motion rules apply under the OS setting (unless the app forces full
@@ -112,4 +64,4 @@ function spinnerRoot(name, { className, color, duration, playState, size }) {
112
64
  })
113
65
  };
114
66
  }
115
- export { spinnerRoot as a, PLAY_STATE_VAR as c, STEP_VAR as d, animation as f, reducedMotion as i, SIZE as l, SpinnerStyle as n, step as o, stagger as p, cssVars as r, DURATION_VAR as s, PauseStyle as t, SPINNER_MOTION as u };
67
+ export { PauseStyle, SpinnerStyle, cssVars, reducedMotion, spinnerRoot, step };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Gather(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import { SIZE, animation } from "./motion.js";
3
+ import { SpinnerStyle, cssVars, spinnerRoot } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/gather.tsx
6
+ const BLOCKS = [
7
+ {
8
+ x: 1,
9
+ y: 1
10
+ },
11
+ {
12
+ x: -1,
13
+ y: 1
14
+ },
15
+ {
16
+ x: 1,
17
+ y: -1
18
+ },
19
+ {
20
+ x: -1,
21
+ y: -1
22
+ }
23
+ ];
24
+ const GAP = 24;
25
+ const PULL = `${(8 / 38 * 100).toFixed(1)}%`;
26
+ const css = `
27
+ .nsaa-loader-gather-group {
28
+ display: grid;
29
+ grid-template-columns: 1fr 1fr;
30
+ gap: ${GAP}%;
31
+ width: 100%;
32
+ height: 100%;
33
+ ${animation("gather", "nsaa-loader-gather-turn", "ease-in-out")}
34
+ }
35
+
36
+ .nsaa-loader-gather-block {
37
+ background: currentColor;
38
+ border-radius: calc(${SIZE} * 0.14);
39
+ ${animation("gather", "nsaa-loader-gather-pull", "ease-in-out")}
40
+ }
41
+
42
+ @keyframes nsaa-loader-gather-pull {
43
+ 0%,
44
+ 100% {
45
+ transform: translate(0, 0);
46
+ }
47
+ 30%,
48
+ 60% {
49
+ transform: translate(
50
+ calc(var(--nsaa-loader-gather-x) * ${PULL}),
51
+ calc(var(--nsaa-loader-gather-y) * ${PULL})
52
+ );
53
+ }
54
+ }
55
+
56
+ @keyframes nsaa-loader-gather-turn {
57
+ 0%,
58
+ 30% {
59
+ transform: rotate(0);
60
+ }
61
+ 60%,
62
+ 100% {
63
+ transform: rotate(90deg);
64
+ }
65
+ }
66
+ `;
67
+ function Gather(props) {
68
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
69
+ name: "gather",
70
+ children: css
71
+ }), /* @__PURE__ */ jsx("div", {
72
+ ...spinnerRoot("gather", props),
73
+ children: /* @__PURE__ */ jsx("div", {
74
+ className: "nsaa-loader-gather-group",
75
+ children: BLOCKS.map(({ x, y }) => /* @__PURE__ */ jsx("div", {
76
+ className: "nsaa-loader-gather-block",
77
+ style: cssVars({
78
+ "--nsaa-loader-gather-x": x,
79
+ "--nsaa-loader-gather-y": y
80
+ })
81
+ }, `${x}${y}`))
82
+ })
83
+ })] });
84
+ }
85
+ export { Gather };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Leap(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { SIZE, STEP_VAR, animation, stagger } from "./motion.js";
3
+ import { SpinnerStyle, reducedMotion, spinnerRoot, step } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { createElement } from "react";
6
+ // src/loaders/leap.tsx
7
+ const DOTS = Array.from({ length: 3 }, (_, index) => index);
8
+ const css = `
9
+ .nsaa-loader-leap {
10
+ --nsaa-loader-leap-dot: round(calc(${SIZE} * 0.22), 1px);
11
+ --nsaa-loader-leap-gap: round(down, calc((${SIZE} - var(--nsaa-loader-leap-dot)) / 2), 1px);
12
+ position: relative;
13
+ }
14
+
15
+ .nsaa-loader-leap-wrapper {
16
+ position: absolute;
17
+ top: round(calc((${SIZE} - var(--nsaa-loader-leap-dot)) / 2), 1px);
18
+ left: calc(${SIZE} - var(--nsaa-loader-leap-dot) - var(--nsaa-loader-leap-gap) * 2);
19
+ width: calc(var(--nsaa-loader-leap-gap) * 2 + var(--nsaa-loader-leap-dot));
20
+ height: var(--nsaa-loader-leap-dot);
21
+ ${animation("leap", "nsaa-loader-leap-hop", "ease-in-out")}
22
+ animation-delay: ${stagger("leap", DOTS.length)};
23
+ }
24
+
25
+ .nsaa-loader-leap-dot {
26
+ position: absolute;
27
+ inset: 0 auto 0 0;
28
+ width: var(--nsaa-loader-leap-dot);
29
+ background: currentColor;
30
+ border-radius: 50%;
31
+ }
32
+
33
+ @keyframes nsaa-loader-leap-hop {
34
+ 0% {
35
+ transform: translateX(0) rotate(0);
36
+ }
37
+ 33.33% {
38
+ transform: translateX(0) rotate(180deg);
39
+ }
40
+ 66.66% {
41
+ transform: translateX(calc(var(--nsaa-loader-leap-gap) * -1)) rotate(180deg);
42
+ }
43
+ 100% {
44
+ transform: translateX(calc(var(--nsaa-loader-leap-gap) * -2)) rotate(180deg);
45
+ }
46
+ }
47
+
48
+ ${reducedMotion(`
49
+ .nsaa-loader-leap-wrapper {
50
+ transform: translateX(calc(var(${STEP_VAR}) * var(--nsaa-loader-leap-gap)));
51
+ }
52
+ `)}
53
+ `;
54
+ function Leap(props) {
55
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
56
+ name: "leap",
57
+ children: css
58
+ }), /* @__PURE__ */ createElement("div", {
59
+ ...spinnerRoot("leap", props),
60
+ key: props.size
61
+ }, DOTS.map((index) => /* @__PURE__ */ jsx("div", {
62
+ className: "nsaa-loader-leap-wrapper",
63
+ style: step(index),
64
+ children: /* @__PURE__ */ jsx("div", { className: "nsaa-loader-leap-dot" })
65
+ }, index)))] });
66
+ }
67
+ export { Leap };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function LinearDots(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { SIZE, animation, stagger } from "./motion.js";
3
+ import { SpinnerStyle, reducedMotion, spinnerRoot, step } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/linear-dots.tsx
6
+ const DOTS = Array.from({ length: 3 }, (_, index) => index);
7
+ const css = `
8
+ .nsaa-loader-linear-dots {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: calc(${SIZE} * 0.1875);
12
+ width: auto;
13
+ }
14
+
15
+ .nsaa-loader-linear-dots-dot {
16
+ width: calc(${SIZE} * 0.1875);
17
+ height: calc(${SIZE} * 0.1875);
18
+ background: currentColor;
19
+ border-radius: 9999px;
20
+ ${animation("linear-dots", "nsaa-loader-linear-dots-fade", "linear")}
21
+ animation-delay: ${stagger("linear-dots", DOTS.length)};
22
+ }
23
+
24
+ @keyframes nsaa-loader-linear-dots-fade {
25
+ 0% {
26
+ opacity: 1;
27
+ }
28
+ 66.67% {
29
+ opacity: 0.5;
30
+ }
31
+ 100% {
32
+ opacity: 1;
33
+ }
34
+ }
35
+
36
+ ${reducedMotion(`
37
+ .nsaa-loader-linear-dots-dot {
38
+ opacity: 0.75;
39
+ }
40
+ `)}
41
+ `;
42
+ function LinearDots(props) {
43
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
44
+ name: "linear-dots",
45
+ children: css
46
+ }), /* @__PURE__ */ jsx("div", {
47
+ ...spinnerRoot("linear-dots", props),
48
+ children: DOTS.map((dot) => /* @__PURE__ */ jsx("div", {
49
+ className: "nsaa-loader-linear-dots-dot",
50
+ style: step(dot)
51
+ }, dot))
52
+ })] });
53
+ }
54
+ export { LinearDots };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Loading(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { SpinnerStyle, spinnerRoot, step } from "./frame.js";
3
+ import { fadeCss } from "./fade.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/loading.tsx
6
+ const BLOCK = "M0 0h1v1H0zM2 0h1v1H2zM0 2h1v1H0zM2 2h1v1H2z";
7
+ const SEGMENTS = [
8
+ {
9
+ x: 12,
10
+ y: 6
11
+ },
12
+ {
13
+ x: 10,
14
+ y: 10
15
+ },
16
+ {
17
+ x: 6,
18
+ y: 12
19
+ },
20
+ {
21
+ x: 2,
22
+ y: 10
23
+ },
24
+ {
25
+ x: 0,
26
+ y: 6
27
+ },
28
+ {
29
+ x: 2,
30
+ y: 2
31
+ },
32
+ {
33
+ x: 6,
34
+ y: 0
35
+ },
36
+ {
37
+ x: 10,
38
+ y: 2
39
+ }
40
+ ];
41
+ const css = `
42
+ ${fadeCss("loading", "segment", SEGMENTS.length, {
43
+ dim: .2,
44
+ rest: .6
45
+ })}
46
+ `;
47
+ function Loading(props) {
48
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
49
+ name: "loading",
50
+ children: css
51
+ }), /* @__PURE__ */ jsx("svg", {
52
+ ...spinnerRoot("loading", props),
53
+ fill: "currentColor",
54
+ role: "presentation",
55
+ viewBox: "0 0 15 15",
56
+ children: SEGMENTS.map(({ x, y }, segment) => /* @__PURE__ */ jsx("path", {
57
+ className: "nsaa-loader-loading-segment",
58
+ d: BLOCK,
59
+ style: step(segment),
60
+ transform: `translate(${x} ${y})`
61
+ }, `${x}-${y}`))
62
+ })] });
63
+ }
64
+ export { Loading };
@@ -0,0 +1,3 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ export declare function Morph(props: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { SIZE, animation } from "./motion.js";
3
+ import { SpinnerStyle, spinnerRoot } from "./frame.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/loaders/morph.tsx
6
+ const css = `
7
+ .nsaa-loader-morph-shape {
8
+ width: 64%;
9
+ height: 64%;
10
+ margin: 18%;
11
+ background: currentColor;
12
+ border-radius: calc(${SIZE} * 0.08);
13
+ ${animation("morph", "nsaa-loader-morph-round", "ease-in-out")}
14
+ }
15
+
16
+ @keyframes nsaa-loader-morph-round {
17
+ 0% {
18
+ border-radius: calc(${SIZE} * 0.08);
19
+ transform: rotate(0);
20
+ }
21
+ 50% {
22
+ border-radius: 50%;
23
+ transform: rotate(45deg);
24
+ }
25
+ 100% {
26
+ border-radius: calc(${SIZE} * 0.08);
27
+ transform: rotate(90deg);
28
+ }
29
+ }
30
+ `;
31
+ function Morph(props) {
32
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SpinnerStyle, {
33
+ name: "morph",
34
+ children: css
35
+ }), /* @__PURE__ */ jsx("div", {
36
+ ...spinnerRoot("morph", props),
37
+ children: /* @__PURE__ */ jsx("div", { className: "nsaa-loader-morph-shape" })
38
+ })] });
39
+ }
40
+ export { Morph };
@@ -0,0 +1,35 @@
1
+
2
+ export declare const DURATION_VAR = "--nsaa-loader-duration";
3
+ export declare const PLAY_STATE_VAR = "--nsaa-loader-play-state";
4
+ export declare const SPINNER_MOTION: {
5
+ readonly arc: 800;
6
+ readonly atom: 1000;
7
+ readonly blocks: 1300;
8
+ readonly "bouncing-dots": 500;
9
+ readonly cascade: 1500;
10
+ readonly "circular-dots": 800;
11
+ readonly classic: 1200;
12
+ readonly "classic-v2": 800;
13
+ readonly clock: 1200;
14
+ readonly comet: 700;
15
+ readonly compass: 500;
16
+ readonly dual: 1000;
17
+ readonly eclipse: 1200;
18
+ readonly flip: 1200;
19
+ readonly gather: 1600;
20
+ readonly leap: 1800;
21
+ readonly "linear-dots": 900;
22
+ readonly loading: 1000;
23
+ readonly morph: 1200;
24
+ readonly orbit: 750;
25
+ readonly pulse: 1200;
26
+ readonly radar: 1500;
27
+ readonly ring: 800;
28
+ readonly ripple: 1200;
29
+ readonly slide: 2400;
30
+ readonly snake: 1400;
31
+ readonly swirl: 1200;
32
+ readonly trace: 1200;
33
+ readonly wave: 900;
34
+ };
35
+ export type SpinnerName = keyof typeof SPINNER_MOTION;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { loader } from "../tokens/dist/motion.js";
3
+ // src/loaders/motion.ts
4
+ const DURATION_VAR = "--nsaa-loader-duration";
5
+ const PLAY_STATE_VAR = "--nsaa-loader-play-state";
6
+ const SIZE_VAR = "--nsaa-loader-size";
7
+ const STEP_VAR = "--nsaa-loader-step";
8
+ const SIZE = `var(${SIZE_VAR}, var(--nsaa-loader-size-md))`;
9
+ const SPINNER_MOTION = {
10
+ arc: loader.duration.arc,
11
+ atom: loader.duration.atom,
12
+ blocks: loader.duration.blocks,
13
+ "bouncing-dots": loader.duration["bouncing-dots"],
14
+ cascade: loader.duration.cascade,
15
+ "circular-dots": loader.duration["circular-dots"],
16
+ classic: loader.duration.classic,
17
+ "classic-v2": loader.duration["classic-v2"],
18
+ clock: loader.duration.clock,
19
+ comet: loader.duration.comet,
20
+ compass: loader.duration.compass,
21
+ dual: loader.duration.dual,
22
+ eclipse: loader.duration.eclipse,
23
+ flip: loader.duration.flip,
24
+ gather: loader.duration.gather,
25
+ leap: loader.duration.leap,
26
+ "linear-dots": loader.duration["linear-dots"],
27
+ loading: loader.duration.loading,
28
+ morph: loader.duration.morph,
29
+ orbit: loader.duration.orbit,
30
+ pulse: loader.duration.pulse,
31
+ radar: loader.duration.radar,
32
+ ring: loader.duration.ring,
33
+ ripple: loader.duration.ripple,
34
+ slide: loader.duration.slide,
35
+ snake: loader.duration.snake,
36
+ swirl: loader.duration.swirl,
37
+ trace: loader.duration.trace,
38
+ wave: loader.duration.wave
39
+ };
40
+ function duration(name) {
41
+ return `var(${DURATION_VAR}, var(--nsaa-loader-duration-${name}))`;
42
+ }
43
+ function stagger(name, count) {
44
+ return `calc(${duration(name)} * (var(${STEP_VAR}) - ${count}) / ${count})`;
45
+ }
46
+ const PLAY_STATE = `var(${PLAY_STATE_VAR}, running)`;
47
+ function animation(name, keyframes, timing) {
48
+ return `animation: ${[keyframes].flat().map((frames) => `${frames} ${duration(name)} ${timing} infinite`).join(", ")};
49
+ animation-play-state: ${PLAY_STATE};`;
50
+ }
51
+ export { DURATION_VAR, PLAY_STATE, PLAY_STATE_VAR, SIZE, SIZE_VAR, SPINNER_MOTION, STEP_VAR, animation, duration, stagger };
@@ -0,0 +1,5 @@
1
+
2
+ import { SpinnerProps } from "./types.js";
3
+ import { EasingProps } from "./easing.js";
4
+ export interface OrbitProps extends SpinnerProps, EasingProps {}
5
+ export declare function Orbit({ easing, ...rest }: OrbitProps): import("react").JSX.Element;