rift-ds 1.26.0 → 1.27.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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ An open source React design system built for AI products and coding agents: comp
22
22
 
23
23
  ## Documentation
24
24
 
25
- Everything deep lives on the docs site: **[rift-ds.com](https://rift-ds.com/)**, with live examples, foundations, templates, the playground, and the **[get-started guide](https://rift-ds.com/docs/get-started)**. **[Storybook](https://storybook.rift-ds.com/?path=/docs/rift-ds--docs)** is the interactive component explorer.
25
+ Everything deep lives on the docs site: **[rift-ds.com](https://rift-ds.com/)**, with live examples, foundations, templates, the playground, and the **[get-started guide](https://rift-ds.com/docs/get-started)**. **[Storybook](https://storybook.rift-ds.com/?path=/docs/rift-ds--docs)** is the interactive component explorer. What changed in each version, and anything you need to do when you upgrade, is in the **[release notes](https://rift-ds.com/releases)**, also published as [GitHub releases](https://github.com/robritacca-dotcom/rift-ds/releases).
26
26
 
27
27
  ## Install
28
28
 
@@ -103,6 +103,7 @@ import 'rift-ds/tokens/presets/presets.css';
103
103
  - **Dark mode**: `data-theme="dark"` on the root element; light is the default.
104
104
  - **Page colours**: the token stylesheet defines custom properties and styles no element, so paint the page once: set `background: var(--color-bg-page-primary)`, `color: var(--color-text-primary)` and `font-family: var(--font-family-primary)` on `body`. Without it a dark theme lands as dark components on a white page.
105
105
  - **Your own brand**: every semantic token chains to a primitive, so overriding one primitive re-themes everything built on it. The [playground](https://rift-ds.com/playground) restyles the system live and copies out a complete, paste-ready override.
106
+ - **One part of a shipped theme**: the token and theme stylesheets sit in cascade layers (`rift.tokens`, then `rift.preset`), so any rule of your own outranks them whatever its selector. A plain `:root { --font-family-primary: … }` keeps a preset's colours with your face, in light and dark alike. To set a default that a preset still replaces, declare it inside `@layer rift.tokens { … }`.
106
107
  - **Fonts**: the base theme bundles no text face, and the whole scale chains to `--font-family-primary` (split heading and body faces via `--font-family-heading` and `--font-family-body`); point them at any font you load. Only the preset stylesheets carry faces, each self-hosting its own, and only the presets you import pull them in.
107
108
  - **Icons**: a Material Symbols Rounded variable font is bundled and components import it themselves, with every Google axis exposed as a custom property. Every icon prop also takes your own element, so any icon set drops in.
108
109
 
@@ -1,7 +1,10 @@
1
1
  /* Points the library's primary face at the one font.ts loads. The class
2
2
  that defines --font-rift-primary sits on <html>, which is :root, so the
3
- variable resolves here. A shipped theme (data-brand on <html>) sets its
4
- own face and wins over this rule. */
5
- :root {
6
- --font-family-primary: var(--font-rift-primary), 'Nunito Sans', sans-serif;
3
+ variable resolves here. The rule sits in the library's base token layer,
4
+ so a shipped theme (data-brand on <html>) still sets its own face over
5
+ it. Move it out of the layer to keep this face under every theme. */
6
+ @layer rift.tokens {
7
+ :root {
8
+ --font-family-primary: var(--font-rift-primary), 'Nunito Sans', sans-serif;
9
+ }
7
10
  }
@@ -120,9 +120,13 @@
120
120
  ============================================ */
121
121
 
122
122
  /* The frame holds the guide and drop lines, and is the scroll container
123
- a sticky header and pinned columns stick to. */
123
+ a sticky header and pinned columns stick to. It is also the
124
+ inline-size container a details panel takes its width from (see
125
+ DETAILS below), so the visible width reaches the panel through the
126
+ stylesheet, never through a render. */
124
127
  .ds-data-table__frame {
125
128
  position: relative;
129
+ container-type: inline-size;
126
130
  }
127
131
 
128
132
  /* Fixed widths: every column holds its own width exactly, and a filler
@@ -138,8 +142,13 @@
138
142
  /* Under fixed widths a cell clips what does not fit, so a narrow column
139
143
  never draws over its neighbour. Menus and tooltips inside are fixed
140
144
  panels and escape the clip. A pinned edge cell clips its content box
141
- instead, since its scrolling-edge shadow is drawn outside the cell. */
142
- .ds-data-table__grid--fixed .ds-table__body .ds-table__cell:not(.ds-data-table__cell--pinned-edge),
145
+ instead, since its scrolling-edge shadow is drawn outside the cell. The
146
+ details cell is left out: a clipping cell would be the scroll container
147
+ its sticky panel holds to, and the panel would scroll away with the
148
+ columns; the panel clips its own body instead. */
149
+ .ds-data-table__grid--fixed
150
+ .ds-table__body
151
+ .ds-table__cell:not(.ds-data-table__cell--pinned-edge, .ds-data-table__detail-cell),
143
152
  .ds-data-table__grid--fixed .ds-data-table__cell--pinned-edge > .ds-table__cell-content {
144
153
  overflow: hidden;
145
154
  }
@@ -917,7 +926,8 @@
917
926
  }
918
927
 
919
928
  /* Every other column: its label, then its value, on a line of its own. */
920
- .ds-data-table__grid--stacked .ds-table__cell:not(.ds-table__cell--row-header, .ds-data-table__utility, .ds-data-table__actions) {
929
+ .ds-data-table__grid--stacked
930
+ .ds-table__cell:not(.ds-table__cell--row-header, .ds-data-table__utility, .ds-data-table__actions, .ds-data-table__detail-cell) {
921
931
  order: 2;
922
932
  display: grid;
923
933
  flex-basis: 100%;
@@ -1161,10 +1171,15 @@
1161
1171
  background-color: var(--color-table-body-bg);
1162
1172
  }
1163
1173
 
1174
+ /* The panel is as wide as the visible table, not the whole scrolling
1175
+ grid: the frame's content box, read as its container's inline size
1176
+ (inside the frame's border and any scrollbar), so a pinned, scrolling or
1177
+ virtualised grid keeps its details in view at every width. */
1164
1178
  .ds-data-table__detail {
1165
1179
  position: sticky;
1166
1180
  inset-inline-start: 0;
1167
1181
  display: grid;
1182
+ width: 100cqi;
1168
1183
  grid-template-rows: 1fr;
1169
1184
  max-width: 100%;
1170
1185
  animation: ds-data-table-detail-open var(--motion-duration-base) var(--motion-ease-standard);
@@ -1197,6 +1212,11 @@
1197
1212
  flex-basis: 100%;
1198
1213
  }
1199
1214
 
1215
+ /* A card is narrower than the frame, so its details take the card's width. */
1216
+ .ds-data-table__grid--stacked .ds-data-table__detail {
1217
+ width: auto;
1218
+ }
1219
+
1200
1220
  /* ============================================
1201
1221
  SCALE
1202
1222
  A virtualised body's spacer rows hold the
@@ -104,7 +104,6 @@ const VIRTUAL_THRESHOLD = 200;
104
104
  const VIRTUAL_HEIGHT = 640;
105
105
  const ESTIMATED_ROW_HEIGHT = { default: 52, compact: 40 };
106
106
  const VIRTUAL_OVERSCAN = 8;
107
- const UTILITY_BORDER = 1;
108
107
  const SORT_RANK_WIDTH = 12;
109
108
  const MENU_BUTTON_WIDTH = 36;
110
109
  const FILTER_MARK_WIDTH = 24;
@@ -434,23 +433,17 @@ function DataTable({
434
433
  ].filter((key, index, all) => all.indexOf(key) === index);
435
434
  const rootRef = useRef(null);
436
435
  const tableId = useId();
437
- const [narrowWidth, setNarrowWidth] = useState(0);
438
- const [tableWidth, setTableWidth] = useState(0);
439
- const hasDetails = Boolean(renderDetail);
440
- useLayoutEffect(() => {
441
- const el = rootRef.current;
442
- if (!el || !hasDetails) return;
443
- const observer = new ResizeObserver(([entry]) => setTableWidth(Math.round(entry.contentRect.width / 8) * 8));
444
- observer.observe(el);
445
- return () => observer.disconnect();
446
- }, [hasDetails]);
447
- const narrow = narrowWidth > 0;
436
+ const [narrow, setNarrow] = useState(false);
448
437
  useLayoutEffect(() => {
449
438
  const el = rootRef.current;
450
439
  if (!el) return;
440
+ let last = false;
451
441
  const observer = new ResizeObserver(([entry]) => {
452
442
  const width = entry.contentRect.width;
453
- setNarrowWidth(width > 0 && width < BREAKPOINT_PHONE_PX ? Math.round(width / 8) * 8 : 0);
443
+ const next = width > 0 && width < BREAKPOINT_PHONE_PX;
444
+ if (next === last) return;
445
+ last = next;
446
+ setNarrow(next);
454
447
  });
455
448
  observer.observe(el);
456
449
  return () => observer.disconnect();
@@ -717,33 +710,48 @@ function DataTable({
717
710
  };
718
711
  const clampWidth = (col, width) => Math.round(Math.min(col.maxWidth ?? Number.MAX_SAFE_INTEGER, Math.max(minWidthOf(col), width)));
719
712
  const PHONE_PINNED_SHARE = 0.4;
720
- const widthOf = (key, widths = widthsState) => {
713
+ const cappedKey = narrow && !stacked && rowHeaderKey && regionOf(rowHeaderKey) === "start" ? rowHeaderKey : void 0;
714
+ const plainWidthOf = (key, widths) => {
721
715
  const col = byKey.get(key);
722
- const width = clampWidth(col, widths[key] ?? declaredOf(key) ?? measured[key] ?? minWidthOf(col));
723
- if (narrow && !stacked && key === rowHeaderKey && regionOf(key) === "start")
724
- return Math.min(width, Math.max(minWidthOf(col), Math.round(narrowWidth * PHONE_PINNED_SHARE)));
725
- return width;
716
+ return clampWidth(col, widths[key] ?? declaredOf(key) ?? measured[key] ?? minWidthOf(col));
717
+ };
718
+ const widthCss = (key, widths) => {
719
+ const width = plainWidthOf(key, widths);
720
+ if (key !== cappedKey) return `${width}px`;
721
+ const floor = Math.min(width, minWidthOf(byKey.get(key)));
722
+ return `min(${width}px, max(${floor}px, ${PHONE_PINNED_SHARE * 100}cqi))`;
723
+ };
724
+ const widthOf = (key, widths = widthsState) => {
725
+ const width = plainWidthOf(key, widths);
726
+ if (key !== cappedKey) return width;
727
+ const frame = tableEl?.parentElement?.clientWidth ?? 0;
728
+ return Math.min(width, Math.max(minWidthOf(byKey.get(key)), Math.round(frame * PHONE_PINNED_SHARE)));
726
729
  };
727
730
  const layoutVars = (widths) => {
728
731
  const vars = {};
729
- let total = utilityKeys.length * UTILITY_COLUMN_WIDTH;
732
+ const sumOf = (keys, start, extra) => {
733
+ let px = start;
734
+ const terms = [];
735
+ keys.forEach((key) => {
736
+ if (key === cappedKey) terms.push(widthCss(key, widths));
737
+ else px += plainWidthOf(key, widths);
738
+ });
739
+ if (extra) terms.push(extra);
740
+ return terms.length ? `calc(${[`${px}px`, ...terms].join(" + ")})` : `${px}px`;
741
+ };
742
+ const actions = showActions ? "var(--ds-dt-w-actions)" : void 0;
743
+ const utility = utilityKeys.length * UTILITY_COLUMN_WIDTH;
730
744
  visibleKeys.forEach((key) => {
731
- const w = widthOf(key, widths);
732
- vars[`--ds-dt-w-${indexOfKey.get(key)}`] = `${w}px`;
733
- total += w;
745
+ vars[`--ds-dt-w-${indexOfKey.get(key)}`] = widthCss(key, widths);
734
746
  });
735
- let offset = utilityKeys.length * UTILITY_COLUMN_WIDTH;
736
- startKeys.forEach((key) => {
737
- vars[`--ds-dt-off-${indexOfKey.get(key)}`] = `${offset}px`;
738
- offset += widthOf(key, widths);
747
+ startKeys.forEach((key, index) => {
748
+ vars[`--ds-dt-off-${indexOfKey.get(key)}`] = sumOf(startKeys.slice(0, index), utility);
739
749
  });
740
- const plusActions = (px) => showActions ? `calc(${px}px + var(--ds-dt-w-actions))` : `${px}px`;
741
- let fromEnd = 0;
742
- [...endKeys].reverse().forEach((key) => {
743
- vars[`--ds-dt-off-${indexOfKey.get(key)}`] = plusActions(fromEnd);
744
- fromEnd += widthOf(key, widths);
750
+ const fromEnd = [...endKeys].reverse();
751
+ fromEnd.forEach((key, index) => {
752
+ vars[`--ds-dt-off-${indexOfKey.get(key)}`] = sumOf(fromEnd.slice(0, index), 0, actions);
745
753
  });
746
- vars["--ds-dt-total"] = plusActions(total);
754
+ vars["--ds-dt-total"] = sumOf(visibleKeys, utility, actions);
747
755
  return vars;
748
756
  };
749
757
  const writeVars = (vars) => {
@@ -2250,14 +2258,7 @@ function DataTable({
2250
2258
  ref: slot ? slot.measure : void 0,
2251
2259
  "data-index": slot?.index,
2252
2260
  "aria-rowindex": slot ? slot.index + 2 : void 0,
2253
- children: /* @__PURE__ */ jsx("td", { id: detailId, colSpan: columnCount, className: `ds-table__cell ${baseClass}__detail-cell`, children: /* @__PURE__ */ jsx(
2254
- "div",
2255
- {
2256
- className: `${baseClass}__detail`,
2257
- style: tableWidth && !stacked ? { width: tableWidth - 2 * UTILITY_BORDER } : void 0,
2258
- children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail-body`, children: renderDetail(row) })
2259
- }
2260
- ) })
2261
+ children: /* @__PURE__ */ jsx("td", { id: detailId, colSpan: columnCount, className: `ds-table__cell ${baseClass}__detail-cell`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__detail-body`, children: renderDetail(row) }) }) })
2261
2262
  },
2262
2263
  `${row.id}:detail`
2263
2264
  );
@@ -47,11 +47,13 @@
47
47
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
48
48
  }
49
49
 
50
- /* The link grid: four rows to a column, wrapping into further columns, so
51
- a long menu grows sideways and never into a scroll. */
50
+ /* The link grid: columns of at least four rows. MegaMenu.tsx sets the row
51
+ count, deepening every column before it adds one (three columns at most
52
+ beside a showcase, four without), so a long menu grows downward first
53
+ and never leaves a column holding one stray row. */
52
54
  .ds-mega-menu__grid {
53
55
  display: grid;
54
- grid-template-rows: repeat(4, auto);
56
+ grid-template-rows: repeat(var(--ds-mega-menu-rows, 4), auto);
55
57
  grid-auto-flow: column;
56
58
  grid-auto-columns: minmax(0, 1fr);
57
59
  gap: var(--gap-200) var(--gap-1000);
@@ -37,7 +37,10 @@ type MegaMenuOwnProps = {
37
37
  * out and is `inert`, so its links leave the tab order.
38
38
  */
39
39
  open: boolean;
40
- /** The link rows, laid out four to a column and wrapping into further columns. */
40
+ /**
41
+ * The link rows, in columns of at least four. A column grows taller before
42
+ * the grid adds one, up to three columns beside a showcase and four without.
43
+ */
41
44
  items: MegaMenuItem[];
42
45
  /** A featured card in its own column beside the link grid. */
43
46
  showcase?: MegaMenuShowcase;
@@ -4,6 +4,9 @@ import { mirrorClass } from "../../behaviors/direction.js";
4
4
  import "./MegaMenu.css";
5
5
  import "../../fonts/material-symbols.css";
6
6
  import "../../behaviors/direction.css";
7
+ const MIN_ROWS = 4;
8
+ const MAX_COLUMNS_WITH_SHOWCASE = 3;
9
+ const MAX_COLUMNS = 4;
7
10
  const isCurrent = (href, currentHref) => currentHref != null && (currentHref === href || currentHref.startsWith(`${href}/`));
8
11
  function MegaMenu({
9
12
  open,
@@ -19,31 +22,42 @@ function MegaMenu({
19
22
  const Link = linkComponent ?? "a";
20
23
  const baseClass = "ds-mega-menu";
21
24
  const classes = [baseClass, open && `${baseClass}--open`, className].filter(Boolean).join(" ");
25
+ const rows = Math.max(
26
+ MIN_ROWS,
27
+ Math.ceil(items.length / (showcase ? MAX_COLUMNS_WITH_SHOWCASE : MAX_COLUMNS))
28
+ );
22
29
  return /* @__PURE__ */ jsx("div", { ...rest, ref, className: classes, inert: !open, children: /* @__PURE__ */ jsxs(
23
30
  "div",
24
31
  {
25
32
  className: [`${baseClass}__layout`, showcase && `${baseClass}__layout--showcase`].filter(Boolean).join(" "),
26
33
  children: [
27
- /* @__PURE__ */ jsx("div", { className: `${baseClass}__grid`, children: items.map((item) => {
28
- const current = isCurrent(item.href, currentHref);
29
- return /* @__PURE__ */ jsxs(
30
- Link,
31
- {
32
- href: item.href,
33
- className: [`${baseClass}__item`, current && `${baseClass}__item--current`].filter(Boolean).join(" "),
34
- "aria-current": current ? "page" : void 0,
35
- onClick: onNavigate,
36
- children: [
37
- (item.logo || item.icon) && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: item.logo ? /* @__PURE__ */ jsx("img", { className: `${baseClass}__logo`, src: item.logo, alt: "" }) : /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(item.icon)}`, children: item.icon }) }),
38
- /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
39
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: item.label }),
40
- item.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__description`, children: item.description })
41
- ] })
42
- ]
43
- },
44
- item.href
45
- );
46
- }) }),
34
+ /* @__PURE__ */ jsx(
35
+ "div",
36
+ {
37
+ className: `${baseClass}__grid`,
38
+ style: { "--ds-mega-menu-rows": rows },
39
+ children: items.map((item) => {
40
+ const current = isCurrent(item.href, currentHref);
41
+ return /* @__PURE__ */ jsxs(
42
+ Link,
43
+ {
44
+ href: item.href,
45
+ className: [`${baseClass}__item`, current && `${baseClass}__item--current`].filter(Boolean).join(" "),
46
+ "aria-current": current ? "page" : void 0,
47
+ onClick: onNavigate,
48
+ children: [
49
+ (item.logo || item.icon) && /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: item.logo ? /* @__PURE__ */ jsx("img", { className: `${baseClass}__logo`, src: item.logo, alt: "" }) : /* @__PURE__ */ jsx("span", { className: `material-symbols-rounded ${mirrorClass(item.icon)}`, children: item.icon }) }),
50
+ /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
51
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: item.label }),
52
+ item.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__description`, children: item.description })
53
+ ] })
54
+ ]
55
+ },
56
+ item.href
57
+ );
58
+ })
59
+ }
60
+ ),
47
61
  showcase && /* @__PURE__ */ jsx("div", { className: `${baseClass}__showcase-column`, children: /* @__PURE__ */ jsxs(Link, { href: showcase.href, className: `${baseClass}__showcase`, onClick: onNavigate, children: [
48
62
  showcase.cover && /* @__PURE__ */ jsx("span", { className: `${baseClass}__cover`, children: showcase.cover }),
49
63
  /* @__PURE__ */ jsxs("span", { className: `${baseClass}__showcase-text`, children: [
@@ -1,7 +1,6 @@
1
1
  /* ShaderScene: the canvas, filling its positioned ancestor.
2
2
  Placement and clipping belong to that ancestor, as with ShaderField: where
3
- a scene sits is a layout decision. The ground under the canvas is the
4
- page's, so a machine that cannot run WebGL2 shows the plain page. */
3
+ a scene sits is a layout decision. */
5
4
 
6
5
  .ds-shader-scene {
7
6
  position: absolute;
@@ -9,7 +8,16 @@
9
8
  overflow: hidden;
10
9
  /* Scenery, never a target. */
11
10
  pointer-events: none;
12
- background-color: var(--color-bg-page-primary);
11
+ /* Paints nothing until a context is live and the first frame is drawn,
12
+ as ShaderField does, so whatever the caller lays under it (the page,
13
+ or a fallback of its own) shows while it is pending, disabled or where
14
+ WebGL2 cannot run. Once active the canvas is opaque. */
15
+ opacity: 0;
16
+ transition: opacity var(--motion-duration-slower) var(--motion-ease-entrance);
17
+ }
18
+
19
+ .ds-shader-scene[data-status='active'] {
20
+ opacity: 1;
13
21
  }
14
22
 
15
23
  .ds-shader-scene__canvas {
@@ -40,14 +40,15 @@ type ShaderSceneOwnProps = {
40
40
  */
41
41
  liveRef?: React.RefObject<Values | null>;
42
42
  /**
43
- * False never starts WebGL and reports `unavailable`, leaving the page
44
- * ground: the kill switch, as on ShaderField.
43
+ * False never starts WebGL and reports `unavailable`, painting nothing:
44
+ * the kill switch, as on ShaderField.
45
45
  */
46
46
  enabled?: boolean;
47
47
  /**
48
- * Called whenever the status changes. Drive a fallback from this: the scene
49
- * paints only the page ground when it cannot run, and what to show instead
50
- * is the caller's design decision.
48
+ * Called whenever the status changes. Drive a fallback from this, or lay
49
+ * one under the scene: it paints nothing until it is `active`, so what
50
+ * shows while it is pending or cannot run is the caller's design
51
+ * decision.
51
52
  */
52
53
  onStatusChange?: (status: ShaderSceneStatus) => void;
53
54
  /** Additional CSS classes */
@@ -71,8 +72,9 @@ export interface ShaderSceneProps extends ShaderSceneOwnProps, Omit<React.Compon
71
72
  * It is scenery, not interface. It fills its positioned ancestor and is inert
72
73
  * to pointer events and to assistive tech; give the ancestor the placement and
73
74
  * the clipping. It honours reduced motion in JavaScript, holding a still frame
74
- * that still answers its settings, and paints the page ground alone where
75
- * WebGL2 is unavailable.
75
+ * that still answers its settings. Like ShaderField it paints nothing until
76
+ * its first frame is drawn, then fades in, so where WebGL2 is unavailable
77
+ * whatever lies under it (the page, or a fallback of the caller's) shows.
76
78
  */
77
79
  export declare function ShaderScene({ scene, params, passes, speed, liveRef, enabled, onStatusChange, className, ref, ...rest }: ShaderSceneProps): React.JSX.Element;
78
80
  export type { ParamSpec as ShaderSceneParamSpec, Scene as ShaderSceneDefinition, Pass as ShaderScenePass, Values as ShaderSceneValues, Recipe as ShaderSceneRecipe, } from './types';
@@ -1,7 +1,7 @@
1
1
  import { Scene } from './types';
2
2
  /**
3
3
  * The horizon, ported from /labs/horizon as a scene: a planet's limb at
4
- * night with a fixed sun at the apex, soft layers of light along the arc,
4
+ * night with a sun on the arc (at the apex by default), soft layers of light along the arc,
5
5
  * a hazy world of land and cloud below, and deep ocean blue further down.
6
6
  * The horizon lab's own fades and grain are passes here, so they can be switched
7
7
  * and tuned like any other scene's.
@@ -1,7 +1,7 @@
1
1
  const horizon = {
2
2
  id: "horizon",
3
3
  label: "Horizon",
4
- description: "A planet's limb at night, a fixed sun at the apex, a hazy world and ocean below.",
4
+ description: "A planet's limb at night, a sun on the arc, a hazy world and ocean below.",
5
5
  mode: "dark",
6
6
  /* The background field's roles, the ones a preset tunes for ambient
7
7
  shaders and a DESIGN.md import rewrites from the action colour: in the
@@ -20,7 +20,8 @@ const horizon = {
20
20
  { key: "glow", label: "Glow", min: 0, max: 2, step: 0.01, default: 1 },
21
21
  { key: "clouds", label: "Clouds", min: 0, max: 2, step: 0.01, default: 1 },
22
22
  { key: "ocean", label: "Ocean", min: 0, max: 2.5, step: 0.01, default: 1 },
23
- { key: "beam", label: "Beam", min: 0, max: 2.5, step: 0.01, default: 1 }
23
+ { key: "beam", label: "Beam", min: 0, max: 2.5, step: 0.01, default: 1 },
24
+ { key: "dawn", label: "Sun position", min: -0.5, max: 0.5, step: 0.01, default: 0 }
24
25
  ],
25
26
  glsl: (
26
27
  /* glsl */
@@ -47,10 +48,16 @@ vec3 scene(vec2 uv, float t) {
47
48
  float d = length(wl - centre) - radius;
48
49
 
49
50
  float halfW = 0.5 * aspect;
50
- float sunX = exp(-pow(w.x, 2.0) / (2.0 * 0.28 * 0.28));
51
- float wide = exp(-pow(w.x, 2.0) / (2.0 * 0.75 * 0.75));
51
+ /* The sun sits on the arc over its own place across the stage (the apex
52
+ at 0), and the light along the limb gathers round it. */
53
+ float sx = u_dawn * aspect;
54
+ float reachX = clamp(sx, -radius * 0.98, radius * 0.98);
55
+ float sy = centre.y + sqrt(radius * radius - reachX * reachX);
56
+ float fx = w.x - sx;
57
+ float sunX = exp(-pow(fx, 2.0) / (2.0 * 0.28 * 0.28));
58
+ float wide = exp(-pow(fx, 2.0) / (2.0 * 0.75 * 0.75));
52
59
  float energy = (0.4 + 0.45 * wide + 0.9 * sunX) * u_glow;
53
- float side = clamp(abs(w.x) / halfW, 0.0, 1.0);
60
+ float side = clamp(abs(fx) / halfW, 0.0, 1.0);
54
61
 
55
62
  float curtain = fbm(vec2(w.x * 5.0 + t * 0.05, d * 1.2 - t * 0.02));
56
63
  float band = fbm(vec2(w.x * 1.2 - t * 0.035, d * 11.0 + t * 0.015));
@@ -92,7 +99,7 @@ vec3 scene(vec2 uv, float t) {
92
99
  world += mix(u_rim, amber, 0.4) * cloud * near * 0.6 * energy;
93
100
  world += u_scatter * streaks * 0.08 * reach;
94
101
 
95
- vec2 src = vec2(0.0, crown - 0.005);
102
+ vec2 src = vec2(sx, sy - 0.005);
96
103
  vec2 r = p - src;
97
104
  float ang = atan(r.x, -r.y);
98
105
  float shafts = smoothstep(0.2, 0.95, fbm(vec2(ang * 1.6, 3.7)));
@@ -694,10 +701,17 @@ const aurora = {
694
701
  glsl: (
695
702
  /* glsl */
696
703
  `
704
+ /* Each tone saturated and lifted to full value, so the ribbons glow in a
705
+ theme's colour however dark its role sits. A tone with next to no hue
706
+ (a monochrome theme's greys) keeps its own value instead: lifted, every
707
+ grey would come out the same white. */
697
708
  vec3 auroraHue(vec3 c) {
709
+ float hi = max(c.r, max(c.g, c.b));
710
+ float chroma = (hi - min(c.r, min(c.g, c.b))) / max(hi, 1e-3);
698
711
  float grey = (c.r + c.g + c.b) / 3.0;
699
- c = max(grey + (c - grey) * 1.6, vec3(0.0));
700
- return c / max(max(c.r, max(c.g, c.b)), 1e-3);
712
+ vec3 s = max(grey + (c - grey) * 1.6, vec3(0.0));
713
+ vec3 lifted = s / max(max(s.r, max(s.g, s.b)), 1e-3);
714
+ return mix(c, lifted, smoothstep(0.04, 0.2, chroma));
701
715
  }
702
716
 
703
717
  vec3 scene(vec2 uv, float t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rift-ds",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "An AI-ready React design system: accessible components on composable tokens, light/dark theming, and CSS-variable overrides.",
5
5
  "author": {
6
6
  "name": "Robert Ritacca",