@northstar-js/react 0.1.0 → 0.2.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 (127) hide show
  1. package/dist/actions.d.ts +71 -4
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js +50 -4
  4. package/dist/actions.js.map +1 -1
  5. package/dist/backdrops/StarBackdrop.d.ts +31 -0
  6. package/dist/backdrops/StarBackdrop.d.ts.map +1 -0
  7. package/dist/backdrops/StarBackdrop.js +84 -0
  8. package/dist/backdrops/StarBackdrop.js.map +1 -0
  9. package/dist/backdrops/index.d.ts +7 -0
  10. package/dist/backdrops/index.d.ts.map +1 -0
  11. package/dist/backdrops/index.js +8 -0
  12. package/dist/backdrops/index.js.map +1 -0
  13. package/dist/backdrops/math.d.ts +39 -0
  14. package/dist/backdrops/math.d.ts.map +1 -0
  15. package/dist/backdrops/math.js +44 -0
  16. package/dist/backdrops/math.js.map +1 -0
  17. package/dist/backdrops/scenes.d.ts +20 -0
  18. package/dist/backdrops/scenes.d.ts.map +1 -0
  19. package/dist/backdrops/scenes.js +417 -0
  20. package/dist/backdrops/scenes.js.map +1 -0
  21. package/dist/backdrops.css +141 -0
  22. package/dist/data.d.ts +14 -3
  23. package/dist/data.d.ts.map +1 -1
  24. package/dist/data.js +16 -7
  25. package/dist/data.js.map +1 -1
  26. package/dist/effects/actions.d.ts +48 -0
  27. package/dist/effects/actions.d.ts.map +1 -0
  28. package/dist/effects/actions.js +80 -0
  29. package/dist/effects/actions.js.map +1 -0
  30. package/dist/effects/controls.d.ts +84 -0
  31. package/dist/effects/controls.d.ts.map +1 -0
  32. package/dist/effects/controls.js +121 -0
  33. package/dist/effects/controls.js.map +1 -0
  34. package/dist/effects/display.d.ts +92 -0
  35. package/dist/effects/display.d.ts.map +1 -0
  36. package/dist/effects/display.js +138 -0
  37. package/dist/effects/display.js.map +1 -0
  38. package/dist/effects/hooks.d.ts +13 -0
  39. package/dist/effects/hooks.d.ts.map +1 -0
  40. package/dist/effects/hooks.js +68 -0
  41. package/dist/effects/hooks.js.map +1 -0
  42. package/dist/effects/index.d.ts +14 -0
  43. package/dist/effects/index.d.ts.map +1 -0
  44. package/dist/effects/index.js +12 -0
  45. package/dist/effects/index.js.map +1 -0
  46. package/dist/effects/loaders.d.ts +67 -0
  47. package/dist/effects/loaders.d.ts.map +1 -0
  48. package/dist/effects/loaders.js +73 -0
  49. package/dist/effects/loaders.js.map +1 -0
  50. package/dist/effects/math.d.ts +23 -0
  51. package/dist/effects/math.d.ts.map +1 -0
  52. package/dist/effects/math.js +56 -0
  53. package/dist/effects/math.js.map +1 -0
  54. package/dist/effects/navigation.d.ts +55 -0
  55. package/dist/effects/navigation.d.ts.map +1 -0
  56. package/dist/effects/navigation.js +103 -0
  57. package/dist/effects/navigation.js.map +1 -0
  58. package/dist/effects/overlays.d.ts +34 -0
  59. package/dist/effects/overlays.d.ts.map +1 -0
  60. package/dist/effects/overlays.js +56 -0
  61. package/dist/effects/overlays.js.map +1 -0
  62. package/dist/effects.css +1659 -0
  63. package/dist/feedback.d.ts +6 -1
  64. package/dist/feedback.d.ts.map +1 -1
  65. package/dist/feedback.js +3 -3
  66. package/dist/feedback.js.map +1 -1
  67. package/dist/flow.d.ts +70 -0
  68. package/dist/flow.d.ts.map +1 -0
  69. package/dist/flow.js +118 -0
  70. package/dist/flow.js.map +1 -0
  71. package/dist/glass.d.ts +74 -0
  72. package/dist/glass.d.ts.map +1 -0
  73. package/dist/glass.js +139 -0
  74. package/dist/glass.js.map +1 -0
  75. package/dist/index.d.ts +14 -5
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +5 -1
  78. package/dist/index.js.map +1 -1
  79. package/dist/internal/expand.d.ts +17 -0
  80. package/dist/internal/expand.d.ts.map +1 -0
  81. package/dist/internal/expand.js +23 -0
  82. package/dist/internal/expand.js.map +1 -0
  83. package/dist/internal/interaction.d.ts +21 -0
  84. package/dist/internal/interaction.d.ts.map +1 -0
  85. package/dist/internal/interaction.js +129 -0
  86. package/dist/internal/interaction.js.map +1 -0
  87. package/dist/motion.d.ts +36 -0
  88. package/dist/motion.d.ts.map +1 -0
  89. package/dist/motion.js +80 -0
  90. package/dist/motion.js.map +1 -0
  91. package/dist/navigation.d.ts +43 -6
  92. package/dist/navigation.d.ts.map +1 -1
  93. package/dist/navigation.js +86 -19
  94. package/dist/navigation.js.map +1 -1
  95. package/dist/northstar/ExportMenu.d.ts +3 -1
  96. package/dist/northstar/ExportMenu.d.ts.map +1 -1
  97. package/dist/northstar/ExportMenu.js +2 -2
  98. package/dist/northstar/ExportMenu.js.map +1 -1
  99. package/dist/northstar/ResearchBuilder.d.ts.map +1 -1
  100. package/dist/northstar/ResearchBuilder.js +3 -3
  101. package/dist/northstar/ResearchBuilder.js.map +1 -1
  102. package/dist/northstar/Run.d.ts +3 -1
  103. package/dist/northstar/Run.d.ts.map +1 -1
  104. package/dist/northstar/Run.js +4 -3
  105. package/dist/northstar/Run.js.map +1 -1
  106. package/dist/northstar/StudyShell.d.ts +23 -1
  107. package/dist/northstar/StudyShell.d.ts.map +1 -1
  108. package/dist/northstar/StudyShell.js +6 -2
  109. package/dist/northstar/StudyShell.js.map +1 -1
  110. package/dist/northstar/StudyStatus.d.ts +3 -1
  111. package/dist/northstar/StudyStatus.d.ts.map +1 -1
  112. package/dist/northstar/StudyStatus.js +4 -2
  113. package/dist/northstar/StudyStatus.js.map +1 -1
  114. package/dist/overlays.d.ts +29 -4
  115. package/dist/overlays.d.ts.map +1 -1
  116. package/dist/overlays.js +38 -12
  117. package/dist/overlays.js.map +1 -1
  118. package/dist/provider.d.ts +31 -2
  119. package/dist/provider.d.ts.map +1 -1
  120. package/dist/provider.js +20 -6
  121. package/dist/provider.js.map +1 -1
  122. package/dist/styles.css +1069 -7
  123. package/dist/surface.d.ts +58 -0
  124. package/dist/surface.d.ts.map +1 -0
  125. package/dist/surface.js +39 -0
  126. package/dist/surface.js.map +1 -0
  127. package/package.json +18 -8
package/dist/actions.d.ts CHANGED
@@ -1,21 +1,88 @@
1
+ import { type ButtonFinish, type Material } from './provider.js';
1
2
  import { type Size, type Tone } from './internal/util.js';
3
+ import { type Expand } from './internal/expand.js';
2
4
  export type ButtonVariant = 'primary' | 'secondary' | 'ghost';
5
+ /**
6
+ * `silver` is an alias for the machined spin finish (`finish="spin"`), kept
7
+ * for the brushed-silver API it replaced. Spin is the default everywhere now.
8
+ */
9
+ export type ButtonTone = Tone | 'silver';
10
+ /**
11
+ * `pill` (default): a capsule (`radius.control.pill`), and a perfect circle
12
+ * when the button is square (icon-only). `rounded` opts out to tight corners
13
+ * (`radius.control.rounded`, or `radius.glass.control` on glass).
14
+ */
15
+ export type ButtonShape = 'pill' | 'rounded';
3
16
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
17
  variant?: ButtonVariant;
5
18
  size?: Size;
6
- tone?: Tone;
19
+ tone?: ButtonTone;
20
+ /** Default `pill`; `rounded` opts out of the pill shape. */
21
+ shape?: ButtonShape;
22
+ /**
23
+ * `spin`: machined metal, a conic sweep under a fine concentric grain that
24
+ * turns with the pointer, Glacier-anodized on primary; ghost takes a faint
25
+ * wash of it on hover and focus; icon-only circles are turned knobs.
26
+ * `soft`: the tonal fill with the tactile texture. Default: the provider's
27
+ * `buttonFinish` (`spin`). Glass buttons (`material="glass"`) keep glass.
28
+ */
29
+ finish?: ButtonFinish;
30
+ /** Leading icon (decorative; the label names the button). */
31
+ icon?: React.ReactNode;
32
+ /**
33
+ * Icon-first: with `icon`, `true` shows only the icon and eases the full
34
+ * label open on hover and keyboard focus (never truncated; always open on
35
+ * touch). `always` keeps it open. Default false.
36
+ */
37
+ expand?: Expand;
7
38
  loading?: boolean;
8
39
  /** Accessible text announced while loading. */
9
40
  loadingLabel?: string;
41
+ /** Shows the success check (it draws in, then rests). Purely presentational; announce the outcome elsewhere too. */
42
+ success?: boolean;
43
+ /** Accessible text added while `success` is set. Default "Done". */
44
+ successLabel?: string;
45
+ /** `glass` gives secondary and ghost buttons the liquid-glass material. Default `solid`. */
46
+ material?: Material;
47
+ /** Leans toward the pointer by a few pixels and springs back. Pointer only; off under reduced motion. */
48
+ magnetic?: boolean;
10
49
  ref?: React.Ref<HTMLButtonElement>;
11
50
  }
12
- export declare function Button({ variant, size, tone, loading, loadingLabel, disabled, className, children, type, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
13
- export interface IconButtonProps extends Omit<ButtonProps, 'children'> {
51
+ export declare function Button({ variant, size, tone, shape, finish: finishProp, icon, expand, loading, loadingLabel, success, successLabel, material, magnetic, disabled, className, children, type, ref, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
52
+ export interface IconButtonProps extends Omit<ButtonProps, 'children' | 'icon'> {
14
53
  /** Required accessible name. */
15
54
  label: string;
16
55
  icon: React.ReactNode;
56
+ /**
57
+ * Icon-led: `true` shows the icon and, on hover and keyboard focus, eases
58
+ * open to reveal the full label (never truncated). `always` keeps the label
59
+ * shown. Default false: icon only, with the label as a native tooltip.
60
+ */
61
+ expand?: Expand;
62
+ }
63
+ export declare function IconButton({ label, icon, expand, className, title, ...rest }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
64
+ /**
65
+ * A label that is collapsed to zero width and eases open (grid 0fr → 1fr) when
66
+ * an ancestor control is hovered or focused, so the whole text shows and
67
+ * nothing is cut with an ellipsis. It stays in the accessibility tree. The
68
+ * public face of the shared ExpandLabel primitive; give the control the
69
+ * `ns-expand-host` class (or use a component's `expand` prop).
70
+ */
71
+ export declare function RevealLabel({ className, children, ...rest }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
72
+ export interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
73
+ /** Required accessible name. */
74
+ label: string;
75
+ orientation?: 'horizontal' | 'vertical';
76
+ /** Sits on liquid glass, floating. Default false. */
77
+ glass?: boolean;
78
+ }
79
+ /** A toolbar of icon-led items: arrow keys move between them, Home and End jump. */
80
+ export declare function Toolbar({ label, orientation, glass, className, onKeyDown, ...rest }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
81
+ export interface ToolbarItemProps extends Omit<IconButtonProps, 'expand'> {
82
+ /** Default true: the label reveals on hover and focus. */
83
+ expand?: Expand;
17
84
  }
18
- export declare function IconButton({ label, icon, className, title, ...rest }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
85
+ export declare function ToolbarItem({ expand, variant, className, ...rest }: ToolbarItemProps): import("react/jsx-runtime").JSX.Element;
19
86
  export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
20
87
  tone?: Tone;
21
88
  /** Adds rel="noreferrer" and target="_blank". */
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;CACpC;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAqB,EACrB,IAAW,EACX,IAAgB,EAChB,OAAe,EACf,YAAwB,EACxB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,IAAe,EACf,GAAG,IAAI,EACR,EAAE,WAAW,2CAeb;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IACpE,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AAED,wBAAgB,IAAI,CAAC,EAAE,IAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,2CAShF;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,2CAS5F"}
package/dist/actions.js CHANGED
@@ -1,12 +1,58 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cx } from './internal/util.js';
3
- export function Button({ variant = 'secondary', size = 'md', tone = 'neutral', loading = false, loadingLabel = 'Loading', disabled, className, children, type = 'button', ...rest }) {
4
- return (_jsxs("button", { ...rest, type: type, className: cx('ns-button', `ns-button--${variant}`, `ns-size-${size}`, tone === 'signal' && 'ns-tone-signal', className), disabled: disabled || loading, "aria-busy": loading || undefined, "data-loading": loading || undefined, children: [loading && _jsx("span", { className: "ns-spinner", "aria-hidden": "true" }), _jsx("span", { className: "ns-button__label", children: children }), loading && _jsx("span", { className: "ns-visually-hidden", children: loadingLabel })] }));
3
+ import { useNorthstar } from './provider.js';
4
+ import { usePointerTracking } from './internal/interaction.js';
5
+ import { cx, mergeRefs } from './internal/util.js';
6
+ import { rovingKeyDown } from './internal/layers.js';
7
+ import { ExpandIcon, ExpandLabel, expandHost } from './internal/expand.js';
8
+ /** The north star: a fixed four-point mark with an orbit turning round it while work runs. */
9
+ function NorthStarSpinner() {
10
+ return (_jsxs("svg", { className: "ns-spinner ns-spinner--star", viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { className: "ns-spinner__star", d: "M8 3 8.8 7.2 13 8 8.8 8.8 8 13 7.2 8.8 3 8 7.2 7.2Z", fill: "currentColor" }), _jsx("circle", { className: "ns-spinner__orbit", cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeWidth: "1" })] }));
5
11
  }
6
- export function IconButton({ label, icon, className, title, ...rest }) {
12
+ function SuccessCheck() {
13
+ return (_jsx("svg", { className: "ns-button__check", viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M3.5 8.5 6.5 11.5 12.5 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", pathLength: 1 }) }));
14
+ }
15
+ export function Button({ variant = 'secondary', size = 'md', tone = 'neutral', shape = 'pill', finish: finishProp, icon, expand = false, loading = false, loadingLabel = 'Loading', success = false, successLabel = 'Done', material, magnetic = false, disabled, className, children, type = 'button', ref, ...rest }) {
16
+ const ns = useNorthstar();
17
+ const glass = material === 'glass';
18
+ const silver = tone === 'silver';
19
+ const finish = finishProp ?? (silver ? 'spin' : ns.buttonFinish);
20
+ const spin = finish === 'spin' && !glass;
21
+ // The spin sweep turns with the pointer and glass's spotlight follows it, so both track it.
22
+ const track = usePointerTracking(magnetic || glass || spin, { magnetic: magnetic ? 4 : 0 });
23
+ const done = success && !loading;
24
+ const host = icon !== undefined && icon !== null && icon !== false ? expandHost(expand) : {};
25
+ const expanding = !!host.className;
26
+ return (_jsxs("button", { ...rest, ref: mergeRefs(ref, track), type: type, className: cx('ns-button', `ns-button--${variant}`, `ns-size-${size}`, tone === 'signal' && 'ns-tone-signal', silver && 'ns-button--silver', shape === 'rounded' && 'ns-button--rounded', glass && 'ns-button--glass', expanding && 'ns-button--expand', host.className, className), "data-expand": host['data-expand'], "data-shape": shape, "data-finish": finish, "data-material": material, disabled: disabled || loading, "aria-busy": loading || undefined, "data-loading": loading || undefined, "data-success": done || undefined, "data-magnetic": magnetic || undefined, children: [loading && _jsx(NorthStarSpinner, {}), done && _jsx(SuccessCheck, {}), icon !== undefined && icon !== null && icon !== false && !loading && !done && _jsx(ExpandIcon, { className: "ns-button__icon", children: icon }), expanding ? (_jsx(ExpandLabel, { className: "ns-button__label", children: children })) : (_jsx("span", { className: "ns-button__label", children: children })), loading && _jsx("span", { className: "ns-visually-hidden", children: loadingLabel === 'Loading' ? ns.messages.loading : loadingLabel }), done && _jsx("span", { className: "ns-visually-hidden", children: successLabel })] }));
27
+ }
28
+ export function IconButton({ label, icon, expand = false, className, title, ...rest }) {
29
+ if (expand) {
30
+ return (_jsx(Button, { ...rest, title: title, icon: icon, expand: expand, className: cx('ns-icon-button', 'ns-icon-button--expand', expand === 'always' && 'ns-icon-button--open', className), children: label }));
31
+ }
7
32
  return (_jsx(Button, { ...rest, "aria-label": label, title: title ?? label, className: cx('ns-icon-button', className), children: icon }));
8
33
  }
34
+ /**
35
+ * A label that is collapsed to zero width and eases open (grid 0fr → 1fr) when
36
+ * an ancestor control is hovered or focused, so the whole text shows and
37
+ * nothing is cut with an ellipsis. It stays in the accessibility tree. The
38
+ * public face of the shared ExpandLabel primitive; give the control the
39
+ * `ns-expand-host` class (or use a component's `expand` prop).
40
+ */
41
+ export function RevealLabel({ className, children, ...rest }) {
42
+ return (_jsx(ExpandLabel, { ...rest, className: className, children: children }));
43
+ }
44
+ /** A toolbar of icon-led items: arrow keys move between them, Home and End jump. */
45
+ export function Toolbar({ label, orientation = 'horizontal', glass = false, className, onKeyDown, ...rest }) {
46
+ return (_jsx("div", { role: "toolbar", "aria-label": label, "aria-orientation": orientation, ...rest, className: cx('ns-toolbar', `ns-toolbar--${orientation}`, glass && 'ns-liquid ns-liquid--sm ns-liquid--floating ns-liquid--tint-subtle', className), onKeyDown: (e) => {
47
+ onKeyDown?.(e);
48
+ rovingKeyDown(e, '.ns-toolbar__item', orientation);
49
+ } }));
50
+ }
51
+ export function ToolbarItem({ expand = true, variant = 'ghost', className, ...rest }) {
52
+ return _jsx(IconButton, { ...rest, expand: expand, variant: variant, className: cx('ns-toolbar__item', className) });
53
+ }
9
54
  export function Link({ tone = 'signal', external, className, ...rest }) {
55
+ // The underline draws in from the left on hover and keyboard focus (CSS).
10
56
  return (_jsx("a", { ...(external ? { target: '_blank', rel: 'noreferrer' } : {}), ...rest, className: cx('ns-link', tone === 'neutral' && 'ns-link--neutral', className) }));
11
57
  }
12
58
  export function ButtonGroup({ attached = false, label, className, ...rest }) {
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAwB,MAAM,oBAAoB,CAAC;AAc9D,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,IAAI,EACX,IAAI,GAAG,SAAS,EAChB,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,SAAS,EACxB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACK;IACZ,OAAO,CACL,qBACM,IAAI,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,cAAc,OAAO,EAAE,EAAE,WAAW,IAAI,EAAE,EAAE,IAAI,KAAK,QAAQ,IAAI,gBAAgB,EAAE,SAAS,CAAC,EACxH,QAAQ,EAAE,QAAQ,IAAI,OAAO,eAClB,OAAO,IAAI,SAAS,kBACjB,OAAO,IAAI,SAAS,aAEjC,OAAO,IAAI,eAAM,SAAS,EAAC,YAAY,iBAAa,MAAM,GAAG,EAC9D,eAAM,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAQ,EACnD,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,YAAE,YAAY,GAAQ,IAC/D,CACV,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAmB;IACpF,OAAO,CACL,KAAC,MAAM,OAAK,IAAI,gBA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AAI,GAAG,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAa;IAC/E,0EAA0E;IAC1E,OAAO,CACL,eACM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACzD,IAAI,EACR,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,IAAI,KAAK,SAAS,IAAI,kBAAkB,EAAE,SAAS,CAAC,GAC7E,CACH,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAoB;IAC3F,OAAO,CACL,cACE,IAAI,EAAC,OAAO,gBACA,KAAK,KACb,IAAI,EACR,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,QAAQ,IAAI,2BAA2B,EAAE,SAAS,CAAC,GACpF,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type BackdropDensity } from './math.js';
2
+ import { type BackdropVariant } from './scenes.js';
3
+ export interface StarBackdropProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ /** Which backdrop. Every variant takes the same props, so they swap freely. Default `constellation-atlas`. */
5
+ variant?: BackdropVariant;
6
+ /** Force Night or Day colours for this backdrop; by default it follows the surrounding theme. */
7
+ theme?: 'night' | 'day';
8
+ /**
9
+ * How many stars: `high` is the approved design, `medium` about 65 % of it
10
+ * and `low` about 35 %, capped at 480 and 240 marks. The signal stars always
11
+ * stay. Default `medium`.
12
+ */
13
+ density?: BackdropDensity;
14
+ /** Animation speed multiplier (2 is twice as fast). 0 holds still. Default 1. */
15
+ speed?: number;
16
+ /** Holds every animation where it is. Backdrops also pause by themselves offscreen and while the page is hidden. */
17
+ paused?: boolean;
18
+ /** Paint the backdrop ground (`--ns-backdrop-ground`). `false` draws the stars only, over whatever is behind. Default true. */
19
+ ground?: boolean;
20
+ ref?: React.Ref<HTMLDivElement>;
21
+ }
22
+ /**
23
+ * An animated star field that fills its container: absolutely positioned,
24
+ * `aria-hidden`, never takes the pointer, and covers any aspect ratio (the
25
+ * 720 × 450 design frame is sliced to fit). Geometry is seeded and memoised,
26
+ * so the server and the client draw the same stars. Animations are CSS only;
27
+ * they pause offscreen and while the document is hidden, and under reduced
28
+ * motion the backdrop is a still frame. Load `@northstar-js/react/backdrops.css`.
29
+ */
30
+ export declare function StarBackdrop({ variant, theme, density, speed, paused, ground, className, style, ref, ...rest }: StarBackdropProps): import("react/jsx-runtime").JSX.Element;
31
+ //# sourceMappingURL=StarBackdrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StarBackdrop.d.ts","sourceRoot":"","sources":["../../src/backdrops/StarBackdrop.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC/F,8GAA8G;IAC9G,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iGAAiG;IACjG,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+HAA+H;IAC/H,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAiBD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAA+B,EAC/B,KAAK,EACL,OAAkB,EAClB,KAAS,EACT,MAAc,EACd,MAAa,EACb,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,iBAAiB,2CAmEnB"}
@@ -0,0 +1,84 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useId, useMemo, useRef, useState } from 'react';
4
+ import { DENSITY, FRAME } from './math.js';
5
+ import { SCENES, sceneData } from './scenes.js';
6
+ const QUERY = '(prefers-reduced-motion: reduce)';
7
+ function useReducedMotion() {
8
+ const [reduced, setReduced] = useState(false);
9
+ useEffect(() => {
10
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
11
+ return;
12
+ const mq = window.matchMedia(QUERY);
13
+ setReduced(mq.matches);
14
+ const on = () => setReduced(mq.matches);
15
+ mq.addEventListener?.('change', on);
16
+ return () => mq.removeEventListener?.('change', on);
17
+ }, []);
18
+ return reduced;
19
+ }
20
+ /**
21
+ * An animated star field that fills its container: absolutely positioned,
22
+ * `aria-hidden`, never takes the pointer, and covers any aspect ratio (the
23
+ * 720 × 450 design frame is sliced to fit). Geometry is seeded and memoised,
24
+ * so the server and the client draw the same stars. Animations are CSS only;
25
+ * they pause offscreen and while the document is hidden, and under reduced
26
+ * motion the backdrop is a still frame. Load `@northstar-js/react/backdrops.css`.
27
+ */
28
+ export function StarBackdrop({ variant = 'constellation-atlas', theme, density = 'medium', speed = 1, paused = false, ground = true, className, style, ref, ...rest }) {
29
+ const scene = SCENES[variant] ?? SCENES['constellation-atlas'];
30
+ const id = `ns-bd-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;
31
+ const level = density in DENSITY ? density : 'medium';
32
+ const key = scene === SCENES[variant] ? variant : 'constellation-atlas';
33
+ const content = useMemo(() => scene.render(sceneData(key, level), id), [scene, key, level, id]);
34
+ const reduced = useReducedMotion();
35
+ const node = useRef(null);
36
+ const still = !(speed > 0);
37
+ // Pause offscreen and while the page is hidden: written straight to the
38
+ // element, so it never re-renders the scene. 3D scenes are scaled to cover.
39
+ const kind = scene.kind;
40
+ useEffect(() => {
41
+ const el = node.current;
42
+ if (!el || typeof window === 'undefined')
43
+ return;
44
+ let offscreen = false;
45
+ const sync = () => {
46
+ const idle = offscreen || (typeof document !== 'undefined' && document.visibilityState === 'hidden');
47
+ if (idle)
48
+ el.setAttribute('data-idle', '');
49
+ else
50
+ el.removeAttribute('data-idle');
51
+ };
52
+ const io = typeof IntersectionObserver === 'function'
53
+ ? new IntersectionObserver((entries) => {
54
+ for (const e of entries)
55
+ offscreen = !e.isIntersecting;
56
+ sync();
57
+ })
58
+ : null;
59
+ io?.observe(el);
60
+ const ro = kind === '3d' && typeof ResizeObserver === 'function'
61
+ ? new ResizeObserver(() => {
62
+ const k = Math.max(el.clientWidth / FRAME.w, el.clientHeight / FRAME.h);
63
+ if (k > 0)
64
+ el.style.setProperty('--ns-bd-k', k.toFixed(4));
65
+ })
66
+ : null;
67
+ ro?.observe(el);
68
+ document.addEventListener('visibilitychange', sync);
69
+ sync();
70
+ return () => {
71
+ io?.disconnect();
72
+ ro?.disconnect();
73
+ document.removeEventListener('visibilitychange', sync);
74
+ };
75
+ }, [kind]);
76
+ return (_jsx("div", { ...rest, ref: (el) => {
77
+ node.current = el;
78
+ if (typeof ref === 'function')
79
+ ref(el);
80
+ else if (ref)
81
+ ref.current = el;
82
+ }, "aria-hidden": "true", "data-variant": variant, "data-density": density, "data-theme": theme, "data-paused": paused || still || undefined, "data-motion": reduced ? 'reduced' : undefined, className: ['ns-backdrop', `ns-backdrop--${variant}`, `ns-backdrop--${kind}`, ground ? '' : 'ns-backdrop--bare', className ?? ''].filter(Boolean).join(' '), style: { '--ns-bd-speed': still ? 1 : Math.min(20, Math.max(0.05, speed)), ...style }, children: content }));
83
+ }
84
+ //# sourceMappingURL=StarBackdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StarBackdrop.js","sourceRoot":"","sources":["../../src/backdrops/StarBackdrop.tsx"],"names":[],"mappings":"AAAA,YAA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E;YACV,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAClB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,EAAE,CAAC,CAAC;iBAClC,IAAI,GAAG;gBAAG,GAA8C,CAAC,OAAO,GAAG,EAAE,CAAC;QAC7E,CAAC,iBACW,MAAM,kBACJ,OAAO,kBACP,OAAO,gBACT,KAAK,iBACJ,MAAM,IAAI,KAAK,IAAI,SAAS,iBAC5B,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAC5C,SAAS,EAAE,CAAC,aAAa,EAAE,gBAAgB,OAAO,EAAE,EAAE,gBAAgB,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC3J,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,KAAK,EAAyB,YAE3G,OAAO,GACJ,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { StarBackdrop } from './StarBackdrop.js';
2
+ export type { StarBackdropProps } from './StarBackdrop.js';
3
+ export { BACKDROP_VARIANTS, countMarks, sceneData } from './scenes.js';
4
+ export type { BackdropVariant } from './scenes.js';
5
+ export { CAP, DENSITY, lcg, thin } from './math.js';
6
+ export type { BackdropDensity } from './math.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/backdrops/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ // @northstar-js/react/backdrops — animated star backdrops. One component,
2
+ // fifteen interchangeable variants, all drawn from seeded maths (no
3
+ // Math.random) in the 720 × 450 design frame and sliced to cover their
4
+ // container. Styles ship in `backdrops.css`; load it after `tokens.css`.
5
+ export { StarBackdrop } from './StarBackdrop.js';
6
+ export { BACKDROP_VARIANTS, countMarks, sceneData } from './scenes.js';
7
+ export { CAP, DENSITY, lcg, thin } from './math.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/backdrops/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oEAAoE;AACpE,uEAAuE;AACvE,yEAAyE;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,39 @@
1
+ /** The four-point north star on a unit box, scaled per star with `transform`. */
2
+ export declare const STAR = "M0 -1L.2 -.2L1 0L.2 .2L0 1L-.2 .2L-1 0L-.2 -.2Z";
3
+ /** CSS polygon of the same star, for the 3D (HTML) scenes. */
4
+ export declare const STAR_CLIP = "polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%)";
5
+ /** The design frame every scene is drawn in; the root covers its container with it (slice). */
6
+ export declare const FRAME: {
7
+ readonly w: 720;
8
+ readonly h: 450;
9
+ };
10
+ /**
11
+ * Numerical Recipes LCG, exactly as in the approved designs:
12
+ * seed = (seed × 1664525 + 1013904223) mod 2³², returned as [0, 1).
13
+ * The products stay below 2⁵³, so the doubles are exact.
14
+ */
15
+ export declare function lcg(seed: number): () => number;
16
+ export type BackdropDensity = 'low' | 'medium' | 'high';
17
+ /** Share of the approved element count kept at each density. `high` is the approved design. */
18
+ export declare const DENSITY: Record<BackdropDensity, number>;
19
+ /**
20
+ * Hard ceiling on drawn marks per backdrop at each density, whatever the
21
+ * design's own count: the share is lowered until the scene fits. `high` is
22
+ * set above every approved design, so it always draws the full design.
23
+ */
24
+ export declare const CAP: Record<BackdropDensity, number>;
25
+ /**
26
+ * Low-discrepancy thinning: keeps item i when frac(i·φ) < share, so whatever
27
+ * is left stays evenly spread over the field, and the same items survive on
28
+ * every render. Items marked `keep` (the Glacier stars, the north star) always stay.
29
+ */
30
+ export declare function thin<T extends {
31
+ keep?: boolean;
32
+ }>(items: T[], share: number): T[];
33
+ /** One decimal place, as the designs print coordinates. */
34
+ export declare const f1: (n: number) => string;
35
+ /** Two decimal places. */
36
+ export declare const f2: (n: number) => string;
37
+ /** The golden angle in radians, π(3 − √5). */
38
+ export declare const GOLDEN: number;
39
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/backdrops/math.ts"],"names":[],"mappings":"AAIA,iFAAiF;AACjF,eAAO,MAAM,IAAI,oDAAoD,CAAC;AAEtE,8DAA8D;AAC9D,eAAO,MAAM,SAAS,2EAA2E,CAAC;AAElG,+FAA+F;AAC/F,eAAO,MAAM,KAAK;;;CAA8B,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAG9C;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,+FAA+F;AAC/F,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAwC,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,GAAG,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAyC,CAAC;AAI1F;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAGjF;AAED,2DAA2D;AAC3D,eAAO,MAAM,EAAE,GAAI,GAAG,MAAM,KAAG,MAAsB,CAAC;AACtD,0BAA0B;AAC1B,eAAO,MAAM,EAAE,GAAI,GAAG,MAAM,KAAG,MAAsB,CAAC;AAEtD,8CAA8C;AAC9C,eAAO,MAAM,MAAM,QAA+B,CAAC"}
@@ -0,0 +1,44 @@
1
+ // Deterministic maths for the star backdrops. Nothing here calls Math.random:
2
+ // every scatter comes from the same linear congruential generator the approved
3
+ // designs used, so the server, the client and every screenshot agree.
4
+ /** The four-point north star on a unit box, scaled per star with `transform`. */
5
+ export const STAR = 'M0 -1L.2 -.2L1 0L.2 .2L0 1L-.2 .2L-1 0L-.2 -.2Z';
6
+ /** CSS polygon of the same star, for the 3D (HTML) scenes. */
7
+ export const STAR_CLIP = 'polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%)';
8
+ /** The design frame every scene is drawn in; the root covers its container with it (slice). */
9
+ export const FRAME = { w: 720, h: 450 };
10
+ /**
11
+ * Numerical Recipes LCG, exactly as in the approved designs:
12
+ * seed = (seed × 1664525 + 1013904223) mod 2³², returned as [0, 1).
13
+ * The products stay below 2⁵³, so the doubles are exact.
14
+ */
15
+ export function lcg(seed) {
16
+ let s = seed;
17
+ return () => (s = (s * 1664525 + 1013904223) % 4294967296) / 4294967296;
18
+ }
19
+ /** Share of the approved element count kept at each density. `high` is the approved design. */
20
+ export const DENSITY = { low: 0.35, medium: 0.65, high: 1 };
21
+ /**
22
+ * Hard ceiling on drawn marks per backdrop at each density, whatever the
23
+ * design's own count: the share is lowered until the scene fits. `high` is
24
+ * set above every approved design, so it always draws the full design.
25
+ */
26
+ export const CAP = { low: 240, medium: 480, high: 1800 };
27
+ const PHI_FRAC = 0.6180339887498949;
28
+ /**
29
+ * Low-discrepancy thinning: keeps item i when frac(i·φ) < share, so whatever
30
+ * is left stays evenly spread over the field, and the same items survive on
31
+ * every render. Items marked `keep` (the Glacier stars, the north star) always stay.
32
+ */
33
+ export function thin(items, share) {
34
+ if (share >= 1)
35
+ return items;
36
+ return items.filter((it, i) => it.keep || (i * PHI_FRAC) % 1 < share);
37
+ }
38
+ /** One decimal place, as the designs print coordinates. */
39
+ export const f1 = (n) => n.toFixed(1);
40
+ /** Two decimal places. */
41
+ export const f2 = (n) => n.toFixed(2);
42
+ /** The golden angle in radians, π(3 − √5). */
43
+ export const GOLDEN = Math.PI * (3 - Math.sqrt(5));
44
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/backdrops/math.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,sEAAsE;AAEtE,iFAAiF;AACjF,MAAM,CAAC,MAAM,IAAI,GAAG,iDAAiD,CAAC;AAEtE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,wEAAwE,CAAC;AAElG,+FAA+F;AAC/F,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAW,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,IAAI,CAAC,GAAG,IAAI,CAAC;IACb,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AAC1E,CAAC;AAID,+FAA+F;AAC/F,MAAM,CAAC,MAAM,OAAO,GAAoC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAE7F;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAoC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAE1F,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAA+B,KAAU,EAAE,KAAa;IAC1E,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACtD,0BAA0B;AAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type BackdropDensity } from './math.js';
3
+ export declare const BACKDROP_VARIANTS: readonly ["constellation-atlas", "orrery", "golden-angle", "prime-lattice", "meridian-sweep", "interference", "celestial-sphere", "fibonacci-sphere", "star-torus", "double-helix", "wave-surface", "twin-vortex", "drifting-blooms", "mobius", "galaxy-3d"];
4
+ export type BackdropVariant = (typeof BACKDROP_VARIANTS)[number];
5
+ /** Any scene: each entry pairs a builder with the renderer for its own data shape. */
6
+ interface AnyScene {
7
+ kind: '2d' | '3d';
8
+ build: (share: number) => unknown;
9
+ render: (data: never, id: string) => ReactNode;
10
+ }
11
+ export declare const SCENES: Record<BackdropVariant, AnyScene>;
12
+ /** Drawn marks in a scene's data: every placed item (it has an `x` or `x1`). */
13
+ export declare function countMarks(data: unknown): number;
14
+ /**
15
+ * The geometry of one variant at one density, thinned to the density's share
16
+ * and capped at CAP[density] marks. Built once per process, then reused.
17
+ */
18
+ export declare function sceneData(variant: BackdropVariant, density: BackdropDensity): unknown;
19
+ export {};
20
+ //# sourceMappingURL=scenes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../src/backdrops/scenes.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAwD,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAEvG,eAAO,MAAM,iBAAiB,8PAgBpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AA6iBjE,sFAAsF;AACtF,UAAU,QAAQ;IAChB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,KAAK,SAAS,CAAC;CAChD;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,QAAQ,CAgBpD,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAIhD;AAID;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAUrF"}