rift-ds 1.28.0 → 1.30.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 (140) hide show
  1. package/README.md +5 -4
  2. package/bin/rift-ds.mjs +5 -4
  3. package/bin/templates/app/components/rift/ColorModeScript.tsx +7 -3
  4. package/bin/templates/blocks/app/settings/ProfileForm.tsx +98 -0
  5. package/bin/templates/blocks/app/settings/page.module.css +11 -0
  6. package/bin/templates/blocks/app/settings/page.tsx +84 -0
  7. package/bin/templates/blocks/app/shader/page.module.css +75 -0
  8. package/bin/templates/blocks/app/shader/page.tsx +81 -0
  9. package/bin/templates/blocks/components/blocks/AppShell.module.css +8 -41
  10. package/bin/templates/blocks/components/blocks/AppShell.tsx +9 -11
  11. package/bin/templates/blocks/components/blocks/emberScene.ts +53 -0
  12. package/bin/templates/blocks/registry.json +24 -0
  13. package/bin/templates/chat/app/api/chat/feedback/route.ts +0 -3
  14. package/bin/templates/chat/app/api/chat/followups/route.ts +0 -3
  15. package/bin/templates/chat/app/api/chat/route.ts +0 -2
  16. package/chat/ChatLauncher.d.ts +9 -1
  17. package/chat/ChatLauncher.js +3 -1
  18. package/chat/threads.js +7 -4
  19. package/components/Alert/Alert.css +12 -0
  20. package/components/Alert/Alert.d.ts +2 -0
  21. package/components/Alert/Alert.js +3 -1
  22. package/components/Attachment/Attachment.css +92 -0
  23. package/components/Attachment/FileRow.d.ts +47 -0
  24. package/components/Attachment/FileRow.js +38 -0
  25. package/components/Avatar/Avatar.css +14 -0
  26. package/components/Avatar/Avatar.d.ts +3 -1
  27. package/components/Avatar/Avatar.js +3 -2
  28. package/components/Button/Button.css +38 -0
  29. package/components/Button/Button.d.ts +8 -0
  30. package/components/Button/Button.js +2 -0
  31. package/components/Chart/AreaChart.d.ts +2 -0
  32. package/components/Chart/AreaChart.js +2 -1
  33. package/components/Chart/BarChart.d.ts +2 -0
  34. package/components/Chart/BarChart.js +2 -1
  35. package/components/Chart/ComboChart.d.ts +4 -0
  36. package/components/Chart/ComboChart.js +4 -2
  37. package/components/Chart/LineChart.d.ts +2 -0
  38. package/components/Chart/LineChart.js +2 -1
  39. package/components/Chart/PieChart.d.ts +4 -4
  40. package/components/Chart/PieChart.js +1 -1
  41. package/components/Chart/ScatterChart.d.ts +2 -0
  42. package/components/Chart/ScatterChart.js +2 -1
  43. package/components/Checklist/Checklist.css +123 -0
  44. package/components/Checklist/Checklist.d.ts +66 -0
  45. package/components/Checklist/Checklist.js +115 -0
  46. package/components/CircularButton/CircularButton.css +39 -0
  47. package/components/CircularButton/CircularButton.d.ts +13 -0
  48. package/components/CircularButton/CircularButton.js +18 -4
  49. package/components/ColourSwatch/ColourSwatch.css +3 -1
  50. package/components/ColourSwatch/ColourSwatch.d.ts +5 -3
  51. package/components/ColourSwatch/ColourSwatch.js +5 -0
  52. package/components/Combobox/Combobox.d.ts +4 -2
  53. package/components/Combobox/Combobox.js +7 -3
  54. package/components/DataTable/DataTable.css +35 -0
  55. package/components/DataTable/DataTable.d.ts +34 -2
  56. package/components/DataTable/DataTable.js +58 -5
  57. package/components/DataTable/columnTypes.d.ts +1 -1
  58. package/components/DataTable/columnTypes.js +1 -1
  59. package/components/DateInput/DateInput.d.ts +4 -2
  60. package/components/DateInput/DateInput.js +7 -3
  61. package/components/DescriptionList/DescriptionList.css +28 -0
  62. package/components/DescriptionList/DescriptionList.d.ts +3 -1
  63. package/components/DescriptionList/DescriptionList.js +4 -3
  64. package/components/DescriptionList/DescriptionListCopy.js +2 -0
  65. package/components/Dropdown/Dropdown.d.ts +4 -2
  66. package/components/Dropdown/Dropdown.js +7 -3
  67. package/components/EmptyState/EmptyState.css +12 -0
  68. package/components/EmptyState/EmptyState.d.ts +7 -0
  69. package/components/EmptyState/EmptyState.js +2 -0
  70. package/components/EventCalendar/EventCalendar.css +59 -0
  71. package/components/EventCalendar/EventCalendar.d.ts +24 -2
  72. package/components/EventCalendar/EventCalendar.js +104 -19
  73. package/components/FormSection/FormSection.css +70 -0
  74. package/components/FormSection/FormSection.d.ts +35 -0
  75. package/components/FormSection/FormSection.js +35 -0
  76. package/components/Grid/Grid.css +52 -0
  77. package/components/Grid/Grid.d.ts +30 -0
  78. package/components/Grid/Grid.js +36 -0
  79. package/components/Icon/Icon.css +55 -0
  80. package/components/Icon/Icon.d.ts +27 -0
  81. package/components/Icon/Icon.js +42 -0
  82. package/components/NumberInput/NumberInput.d.ts +4 -2
  83. package/components/NumberInput/NumberInput.js +7 -3
  84. package/components/OrgChart/OrgChart.css +143 -0
  85. package/components/OrgChart/OrgChart.d.ts +44 -0
  86. package/components/OrgChart/OrgChart.js +26 -0
  87. package/components/PageHeader/PageHeader.css +74 -0
  88. package/components/PageHeader/PageHeader.d.ts +39 -0
  89. package/components/PageHeader/PageHeader.js +33 -0
  90. package/components/Panel/Panel.css +7 -0
  91. package/components/Panel/Panel.d.ts +5 -2
  92. package/components/Panel/Panel.js +2 -1
  93. package/components/ResourceTimeline/ResourceTimeline.css +194 -0
  94. package/components/ResourceTimeline/ResourceTimeline.d.ts +57 -0
  95. package/components/ResourceTimeline/ResourceTimeline.js +129 -0
  96. package/components/ShaderField/useShaderField.js +13 -1
  97. package/components/ShaderScene/ShaderScene.d.ts +39 -15
  98. package/components/ShaderScene/ShaderScene.js +87 -6
  99. package/components/ShaderScene/assemble.d.ts +10 -3
  100. package/components/ShaderScene/assemble.js +29 -0
  101. package/components/ShaderScene/renderer.d.ts +12 -4
  102. package/components/ShaderScene/renderer.js +32 -20
  103. package/components/ShaderScene/scenes.d.ts +78 -0
  104. package/components/ShaderScene/scenes.js +933 -1
  105. package/components/ShaderScene/types.d.ts +52 -23
  106. package/components/Stack/Stack.css +68 -0
  107. package/components/Stack/Stack.d.ts +37 -0
  108. package/components/Stack/Stack.js +39 -0
  109. package/components/Stat/Stat.css +65 -0
  110. package/components/Stat/Stat.d.ts +7 -1
  111. package/components/Stat/Stat.js +16 -1
  112. package/components/Table/Table.css +11 -0
  113. package/components/Table/Table.d.ts +2 -0
  114. package/components/Table/Table.js +5 -1
  115. package/components/Tabs/Tabs.css +23 -0
  116. package/components/Tabs/Tabs.d.ts +9 -8
  117. package/components/Tabs/Tabs.js +38 -5
  118. package/components/Textarea/Textarea.d.ts +4 -2
  119. package/components/Textarea/Textarea.js +7 -3
  120. package/components/ThemeToggle/colorMode.d.ts +17 -1
  121. package/components/ThemeToggle/colorMode.js +11 -2
  122. package/components/Widget/Widget.css +21 -0
  123. package/components/Widget/Widget.d.ts +4 -0
  124. package/components/Widget/Widget.js +13 -5
  125. package/components/Wizard/Wizard.css +67 -0
  126. package/components/Wizard/Wizard.d.ts +54 -0
  127. package/components/Wizard/Wizard.js +71 -0
  128. package/components/registry.d.ts +25 -0
  129. package/components/registry.js +8 -0
  130. package/components/registry.json +234 -33
  131. package/components/registry.json.d.ts +234 -33
  132. package/components/registry.json.js +1 -1
  133. package/index.d.ts +10 -0
  134. package/index.js +20 -0
  135. package/package.json +1 -1
  136. package/tokens/motion.d.ts +2 -0
  137. package/tokens/motion.js +2 -0
  138. package/tokens/values.d.ts +31 -0
  139. package/tokens/values.js +16 -0
  140. package/tokens/values.json.js +1 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@ An open source React design system built for AI products and coding agents: comp
13
13
 
14
14
  ## Why Rift DS
15
15
 
16
- - **<!-- component-count -->178<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
16
+ - **<!-- component-count -->188<!-- /component-count --> components.** Buttons, forms and tables through to charts, navigation and overlays, each typed and documented with live examples. Every one forwards a ref and your own attributes to its element, state you can own works controlled or uncontrolled (a modal opens when your app says so, by design), and every word a component writes has a prop you can localise. The build checks the first two on every component, and the words wherever they sit in markup. React and React DOM are the only required peer dependencies.
17
17
  - **A matching <!-- figma-kit-link -->[Figma kit](https://www.figma.com/community/file/1701820123445795117)<!-- /figma-kit-link -->.** Every component has a page in it, with a sticker sheet of its states, built on variables named after the same tokens. Duplicate it from the Figma Community to design with the same system.
18
18
  - **AI patterns, the whole chat and templates, ready to use.** Composer, streaming chat thread, tool calls, reasoning and thread panel are in the box, the complete AI chat ships assembled as one widget that one command scaffolds, and the docs site has complete template screens built from them.
19
19
  - **Fully themeable.** The shipped themes are complete looks to start from, each in light and dark. One `data-brand` attribute applies a theme, and a few CSS overrides make your own.
@@ -76,7 +76,7 @@ The quickest start is one file: save [AGENTS.md](https://rift-ds.com/AGENTS.md)
76
76
  curl -o AGENTS.md https://rift-ds.com/AGENTS.md
77
77
  ```
78
78
 
79
- For the full setup, one command teaches a coding agent the system: it installs the generated agent skills into your project and prints the MCP connect line. The skills cover the library's rules, moving existing screens onto the tokens and components, and auditing styles against them.
79
+ For the full setup, one command teaches a coding agent the system: it installs the generated agent skills into your project and prints the MCP connect line. The skills cover the library's rules, moving existing screens onto the tokens and components, auditing styles against them, and writing a shader scene of your own.
80
80
 
81
81
  ```bash
82
82
  npx rift-ds init
@@ -101,6 +101,7 @@ import 'rift-ds/tokens/presets/presets.css';
101
101
  ```
102
102
 
103
103
  - **Dark mode**: `data-theme="dark"` on the root element; light is the default.
104
+ - **Theme names**: a preset's id is its `data-brand` value and stylesheet name, which can differ from the name a theme menu shows (Signal ships as `plum`). `SHIPPED_THEMES` from `rift-ds/tokens/values` lists every theme with its name and attribute, and `shippedThemeOptions()` hands ThemePicker the same list with each theme's swatch. To apply a stored theme before first paint, pass `colorModeScript({ brandStorageKey })` the key you keep it under.
104
105
  - **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
106
  - **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
107
  - **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 { … }`.
@@ -109,13 +110,13 @@ import 'rift-ds/tokens/presets/presets.css';
109
110
 
110
111
  ## Components
111
112
 
112
- <!-- component-count -->178<!-- /component-count --> components, including a chat set for AI products (Chat thread, Composer, Tool call, Reasoning, Thread panel) and Shader field, a WebGL2 ambient background whose light sources read your colour tokens at runtime, so it re-themes with everything else. Details and live examples are on the [docs site](https://rift-ds.com/components).
113
+ <!-- component-count -->188<!-- /component-count --> components, including a chat set for AI products (Chat thread, Composer, Tool call, Reasoning, Thread panel) and Shader field, a WebGL2 ambient background whose light sources read your colour tokens at runtime, so it re-themes with everything else. Details and live examples are on the [docs site](https://rift-ds.com/components).
113
114
 
114
115
  <details>
115
116
  <summary>The full list</summary>
116
117
 
117
118
  <!-- component-list:start -->
118
- Accordion · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Chip · Circular button · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · Filter bar · Funnel chart · Gantt chart · Gauge · Globe · Heading · Hover card · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Message actions · Message card · Meter · Model picker · Nav · Nav list · Notification centre · Number input · Pagination · Panel · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Sidebar panel · Signature pad · Site header · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · World map
119
+ Accordion · Action card · Action readout · Agent plan · Agent rail · Agent status · AI button · Alert · Alert dialog · Anchor nav · Animated number · App layout · App sidebar · Area chart · Artifact card · Artifact panel · Attachment drop zone · Attachment group · Attachment tile · Attachment viewer · Avatar · Avatar group · Badge · Banner · Bar chart · Bento tile · Bento tile art · Bottom nav · Breadcrumb · Button · Button group · Card · Card stack · Carousel · Chat header · Chat marker · Chat message · Chat thread · Checkbox · Checklist · Chip · Circular button · Code block · Code diff · Colour picker · Combo chart · Combobox · Command palette · Command palette trigger · Composer · Contact card · Context menu · Contribution graph · Currency input · Data table · Date input · Date picker · Date range picker · Deadline · Description list · Dialog · Divider · Document chip · Document viewer · Drawer · Dropdown · Dropdown menu · Empty state · Entity card · Entity switcher · Error summary · Event calendar · Field · Figure · File input · File row · Filter bar · Form section · Funnel chart · Gantt chart · Gauge · Globe · Grid · Heading · Hover card · Icon · Image compare · Input · Inspector colour picker · Inspector dropdown · Inspector input · Inspector section · Inspector segments · Inspector slider · Inspector toggle switch · Instructions · Interrupt card · Kbd · Legend tile · Lightbox · Line chart · Link · Link list · List · Map callout · Map legend · Masked input · Mega menu · Mention · Message actions · Message card · Meter · Model picker · Nav · Nav list · Notification centre · Number input · Org chart · Page header · Pagination · Panel · Pie chart · Pin input · Pixel avatar · Popover · Progress bar · Progressive blur · Prompt suggestions · Prose · Question card · Quote · Radar chart · Radial chart · Radio button · Rating · Reasoning · Resource timeline · Rich dropdown · Scatter chart · Section title · Segmented control · Selection card · Shader field · Shader scene · Sidebar panel · Signature pad · Site header · Skeleton · Slider · Source chip · Source trail · Sparkline · Spinner · Split button · Split pane · Stack · Stacked bar chart · Stat · Status dot · Stepper · Streaming text · Swatch · Table · Table toolbar · Tabs · Tag input · Text · Textarea · Theme picker · Theme toggle · Thread panel · Thread tabs · Time picker · Timeline · Toast · Toggle group · Toggle switch · Tool call · Toolbar · Tooltip · Top app bar · Tree view · Treemap · Usage card · Waveform · Widget · Wizard · World map
119
120
  <!-- component-list:end -->
120
121
 
121
122
  </details>
package/bin/rift-ds.mjs CHANGED
@@ -121,10 +121,11 @@ init chat
121
121
 
122
122
  init block [<name>]
123
123
  Copies a block into a Next.js app router project: a whole starting page
124
- (an app shell, a dashboard, a sign-in) built from the library, its page
125
- under app/ and any shared parts under components/blocks/. The files are
126
- yours from then on. With no name, lists the blocks. Run init app first.
127
- Existing files are never overwritten.
124
+ (an app shell, a dashboard, a settings page and more) built from the
125
+ library, its page under app/ and any shared parts under
126
+ components/blocks/. The files are yours from then on. With no name,
127
+ lists the blocks. Run init app first. Existing files are never
128
+ overwritten.
128
129
 
129
130
  --app <dir> The app router folder (default: app/ or src/app/, whichever exists)
130
131
  --dry-run Print what would be written and write nothing
@@ -1,10 +1,14 @@
1
- import { colorModeScript } from 'rift-ds/components/ThemeToggle/colorMode';
1
+ import { colorModeScript, type ColorModeScriptOptions } from 'rift-ds/components/ThemeToggle/colorMode';
2
2
 
3
3
  /**
4
4
  * Applies the visitor's stored colour mode before first paint, so a
5
5
  * returning visitor never sees the wrong mode flash. Render it in your root
6
6
  * layout's <head>. ThemeToggle reads and changes the same setting.
7
+ *
8
+ * If your app lets the visitor pick a theme, store the preset id under a key
9
+ * of your own and pass it as `brandStorageKey`: the script then applies that
10
+ * theme before first paint too.
7
11
  */
8
- export function ColorModeScript() {
9
- return <script dangerouslySetInnerHTML={{ __html: colorModeScript() }} />;
12
+ export function ColorModeScript(options: ColorModeScriptOptions) {
13
+ return <script dangerouslySetInnerHTML={{ __html: colorModeScript(options) }} />;
10
14
  }
@@ -0,0 +1,98 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * The settings block's profile section: a form that checks every field in
5
+ * one pass when it is saved. The checks write one record of messages by
6
+ * field name; fieldErrorsFrom turns it into ErrorSummary's list and each
7
+ * field's errorText, so the summary and the fields can never disagree.
8
+ * Replace `check` with your own rules, or with the errors your server
9
+ * returns.
10
+ */
11
+
12
+ import { useState } from 'react';
13
+ import { Button } from 'rift-ds/components/Button/Button';
14
+ import { ErrorSummary, fieldErrorsFrom } from 'rift-ds/components/ErrorSummary/ErrorSummary';
15
+ import { FormSection } from 'rift-ds/components/FormSection/FormSection';
16
+ import { Input } from 'rift-ds/components/Input/Input';
17
+
18
+ const FIELDS = ['firstName', 'lastName', 'email'] as const;
19
+ type Field = (typeof FIELDS)[number];
20
+
21
+ function check(values: Record<Field, string>): Partial<Record<Field, string>> {
22
+ const errors: Partial<Record<Field, string>> = {};
23
+ if (!values.firstName.trim()) errors.firstName = 'Enter your first name.';
24
+ if (!values.lastName.trim()) errors.lastName = 'Enter your last name.';
25
+ if (!/^\S+@\S+\.\S+$/.test(values.email)) errors.email = 'Enter an email address like name@example.com.';
26
+ return errors;
27
+ }
28
+
29
+ export function ProfileForm() {
30
+ const [values, setValues] = useState<Record<Field, string>>({
31
+ firstName: 'Ada',
32
+ lastName: 'Lovelace',
33
+ email: 'ada@example.com',
34
+ });
35
+ const [submitted, setSubmitted] = useState(false);
36
+ const [saved, setSaved] = useState(false);
37
+
38
+ const { errors, errorText } = fieldErrorsFrom(submitted ? check(values) : {}, {
39
+ order: [...FIELDS],
40
+ idFor: (name) => `profile-${name}`,
41
+ });
42
+
43
+ const set = (field: Field) => (value: string) => {
44
+ setSaved(false);
45
+ setValues((current) => ({ ...current, [field]: value }));
46
+ };
47
+
48
+ const save = () => {
49
+ setSubmitted(true);
50
+ // Save here when the check passes, and show what your server returns.
51
+ setSaved(Object.keys(check(values)).length === 0);
52
+ };
53
+
54
+ return (
55
+ <form
56
+ noValidate
57
+ onSubmit={(event) => {
58
+ event.preventDefault();
59
+ save();
60
+ }}
61
+ >
62
+ <ErrorSummary errors={errors} />
63
+ <FormSection
64
+ layout="aside"
65
+ columns={2}
66
+ title="Profile"
67
+ description="How you appear to the people you work with."
68
+ actions={<Button label={saved ? 'Saved' : 'Save profile'} onClick={save} />}
69
+ >
70
+ <Input
71
+ id="profile-firstName"
72
+ label="First name"
73
+ value={values.firstName}
74
+ onValueChange={set('firstName')}
75
+ errorText={errorText.firstName}
76
+ required
77
+ />
78
+ <Input
79
+ id="profile-lastName"
80
+ label="Last name"
81
+ value={values.lastName}
82
+ onValueChange={set('lastName')}
83
+ errorText={errorText.lastName}
84
+ required
85
+ />
86
+ <Input
87
+ id="profile-email"
88
+ label="Email"
89
+ type="email"
90
+ value={values.email}
91
+ onValueChange={set('email')}
92
+ errorText={errorText.email}
93
+ required
94
+ />
95
+ </FormSection>
96
+ </form>
97
+ );
98
+ }
@@ -0,0 +1,11 @@
1
+ /* The settings column: one section under another, held to a reading width
2
+ so a row of fields never stretches across a wide screen. Each section
3
+ lays its heading beside its fields once it has the room, and stacks them
4
+ on a phone. */
5
+
6
+ .column {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: var(--gap-1000);
10
+ max-width: 880px;
11
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * The settings block: the app shell with a column of FormSections, each a
3
+ * heading and a sentence beside its fields, and each saving on its own. The
4
+ * values are placeholders; read and write your own.
5
+ *
6
+ * The profile section is a client form (ProfileForm.tsx beside this page)
7
+ * that checks every field in one pass on save: the errors go to an
8
+ * ErrorSummary at the top of the form and to each field's errorText, both
9
+ * from one record through fieldErrorsFrom. The other sections render from
10
+ * this server page.
11
+ */
12
+
13
+ import { Button } from 'rift-ds/components/Button/Button';
14
+ import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
15
+ import { FormSection } from 'rift-ds/components/FormSection/FormSection';
16
+ import { ToggleSwitch } from 'rift-ds/components/ToggleSwitch/ToggleSwitch';
17
+ import { AppShell } from '../../components/blocks/AppShell';
18
+ import { ProfileForm } from './ProfileForm';
19
+ import styles from './page.module.css';
20
+
21
+ export default function SettingsPage() {
22
+ return (
23
+ <AppShell
24
+ activeKey="settings"
25
+ breadcrumb={[{ label: 'Workspace', href: '#' }, { label: 'Settings' }]}
26
+ title="Settings"
27
+ >
28
+ <div className={styles.column}>
29
+ <ProfileForm />
30
+
31
+ <FormSection
32
+ layout="aside"
33
+ divider
34
+ title="Notifications"
35
+ description="What we email you about. Changes apply from the next message."
36
+ actions={<Button label="Save notifications" />}
37
+ >
38
+ <ToggleSwitch label="A weekly summary" defaultChecked />
39
+ <ToggleSwitch label="When someone mentions you" defaultChecked />
40
+ <ToggleSwitch label="Product news" />
41
+ </FormSection>
42
+
43
+ <FormSection
44
+ layout="aside"
45
+ divider
46
+ columns={2}
47
+ title="Region"
48
+ description="How dates, times and numbers are written for you."
49
+ actions={<Button label="Save region" />}
50
+ >
51
+ <Dropdown
52
+ label="Language"
53
+ defaultValue="en"
54
+ options={[
55
+ { value: 'en', label: 'English' },
56
+ { value: 'de', label: 'Deutsch' },
57
+ { value: 'fr', label: 'Français' },
58
+ ]}
59
+ />
60
+ <Dropdown
61
+ label="Time zone"
62
+ defaultValue="utc"
63
+ options={[
64
+ { value: 'utc', label: 'UTC' },
65
+ { value: 'cet', label: 'Central European' },
66
+ { value: 'pt', label: 'Pacific' },
67
+ ]}
68
+ />
69
+ </FormSection>
70
+
71
+ <FormSection
72
+ layout="aside"
73
+ divider
74
+ title="Delete workspace"
75
+ description="Removes the workspace and everything in it. This cannot be undone."
76
+ >
77
+ <div>
78
+ <Button label="Delete workspace" variant="secondary" tone="destructive" />
79
+ </div>
80
+ </FormSection>
81
+ </div>
82
+ </AppShell>
83
+ );
84
+ }
@@ -0,0 +1,75 @@
1
+ /* The scene on a stage beside its controls: two columns on a desktop, the
2
+ stage above the panel on a phone. The stage is the scene's positioned
3
+ ancestor, and it clips the scene to its own rounded box. */
4
+
5
+ .page {
6
+ min-height: 100dvh;
7
+ display: grid;
8
+ grid-template-columns: minmax(0, 1fr) 320px;
9
+ gap: var(--gap-500);
10
+ padding: var(--padding-500);
11
+ background-color: var(--color-bg-page-primary);
12
+ }
13
+
14
+ .stage {
15
+ position: relative;
16
+ min-height: 320px;
17
+ overflow: hidden;
18
+ border-radius: var(--radius-600);
19
+ background-color: var(--color-bg-container-secondary);
20
+ }
21
+
22
+ .panel {
23
+ align-self: start;
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--gap-500);
27
+ padding: var(--padding-500);
28
+ border-radius: var(--radius-600);
29
+ background-color: var(--color-bg-container-primary);
30
+ }
31
+
32
+ .intro {
33
+ display: flex;
34
+ flex-direction: column;
35
+ gap: var(--gap-200);
36
+ }
37
+
38
+ .title {
39
+ margin: 0;
40
+ font-family: var(--font-heading-2-family);
41
+ font-size: var(--font-heading-2-size);
42
+ font-weight: var(--font-heading-2-weight);
43
+ line-height: var(--font-heading-2-line-height);
44
+ letter-spacing: var(--font-heading-2-letter-spacing);
45
+ color: var(--color-text-primary);
46
+ }
47
+
48
+ .subhead,
49
+ .note {
50
+ margin: 0;
51
+ font-size: var(--font-paragraph-sm-size);
52
+ line-height: var(--font-paragraph-sm-line-height);
53
+ color: var(--color-text-secondary);
54
+ }
55
+
56
+ .log {
57
+ margin: 0;
58
+ padding: var(--padding-300);
59
+ overflow-x: auto;
60
+ border-radius: var(--radius-300);
61
+ background-color: var(--color-bg-container-secondary);
62
+ font-family: var(--font-family-code);
63
+ font-size: var(--font-paragraph-sm-size);
64
+ line-height: var(--font-paragraph-sm-line-height);
65
+ color: var(--color-text-primary);
66
+ white-space: pre-wrap;
67
+ }
68
+
69
+ @media (max-width: 959px) {
70
+ .page {
71
+ grid-template-columns: minmax(0, 1fr);
72
+ grid-template-rows: minmax(320px, 50dvh) auto;
73
+ padding: var(--padding-400);
74
+ }
75
+ }
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * The shader scene block: a scene of your own on a stage, with a slider for
5
+ * each setting it declares. The scene is `emberScene` in
6
+ * components/blocks/emberScene.ts; edit its GLSL and this page follows.
7
+ */
8
+
9
+ import { useState } from 'react';
10
+ import {
11
+ SHADER_PASSES,
12
+ ShaderScene,
13
+ shaderSceneDefaults,
14
+ type ShaderSceneStatus,
15
+ type ShaderSceneValues,
16
+ } from 'rift-ds/components/ShaderScene/ShaderScene';
17
+ import { Slider } from 'rift-ds/components/Slider/Slider';
18
+ import { emberScene } from '../../components/blocks/emberScene';
19
+ import styles from './page.module.css';
20
+
21
+ const SPEED = 1.6;
22
+
23
+ /* What the scene reads each frame: its own settings and every finishing
24
+ pass, at their defaults, with the two fades off so the light fills the
25
+ stage. */
26
+ const initialValues = (): ShaderSceneValues => ({
27
+ speed: SPEED,
28
+ scene: shaderSceneDefaults(emberScene.params),
29
+ passes: Object.fromEntries(
30
+ SHADER_PASSES.map((pass) => [
31
+ pass.id,
32
+ { on: pass.id.startsWith('fade') ? false : pass.on, params: shaderSceneDefaults(pass.params) },
33
+ ])
34
+ ),
35
+ });
36
+
37
+ export default function ShaderScenePage() {
38
+ /* The sliders write this ref and the scene reads it every frame, so a
39
+ drag moves the picture without rendering the page. */
40
+ const [values] = useState(() => ({ current: initialValues() }));
41
+
42
+ const [status, setStatus] = useState<ShaderSceneStatus>('pending');
43
+ const [error, setError] = useState<string>();
44
+
45
+ return (
46
+ <div className={styles.page}>
47
+ <div className={styles.stage}>
48
+ <ShaderScene scene={emberScene} liveRef={values} onStatusChange={setStatus} onError={setError} />
49
+ </div>
50
+
51
+ <main className={styles.panel}>
52
+ <div className={styles.intro}>
53
+ <h1 className={styles.title}>Ember</h1>
54
+ <p className={styles.subhead}>A scene of your own, in the theme’s colours.</p>
55
+ </div>
56
+
57
+ {emberScene.params.map((param) => (
58
+ <Slider
59
+ key={param.key}
60
+ label={param.label}
61
+ min={param.min}
62
+ max={param.max}
63
+ step={param.step}
64
+ defaultValue={param.default}
65
+ showValue
66
+ onValueChange={(value) => {
67
+ values.current.scene[param.key] = value;
68
+ }}
69
+ />
70
+ ))}
71
+
72
+ {status === 'unavailable' && (
73
+ <p className={styles.note} role="status">
74
+ {error ? 'The scene did not compile:' : 'This browser cannot run the scene.'}
75
+ </p>
76
+ )}
77
+ {error && <pre className={styles.log}>{error}</pre>}
78
+ </main>
79
+ </div>
80
+ );
81
+ }
@@ -145,7 +145,8 @@
145
145
  }
146
146
 
147
147
  /* The folded search: shown only where the field does not fit. */
148
- .searchIcon {
148
+ .searchIcon,
149
+ .aiIcon {
149
150
  display: none;
150
151
  }
151
152
 
@@ -164,39 +165,12 @@
164
165
  min-width: 0;
165
166
  }
166
167
 
168
+ /* PageHeader draws the breadcrumb, the title and the actions, and folds the
169
+ actions under the title when it is narrow; the shell only spaces it. */
167
170
  .pageHead {
168
- display: flex;
169
- align-items: flex-end;
170
- justify-content: space-between;
171
- flex-wrap: wrap;
172
- gap: var(--gap-400);
173
171
  padding-top: var(--padding-400);
174
172
  }
175
173
 
176
- .pageHeadText {
177
- display: flex;
178
- flex-direction: column;
179
- gap: var(--gap-100);
180
- min-width: 0;
181
- }
182
-
183
- .title {
184
- margin: 0;
185
- font-family: var(--font-heading-1-family);
186
- font-size: var(--font-heading-1-size);
187
- font-weight: var(--font-heading-1-weight);
188
- line-height: var(--font-heading-1-line-height);
189
- letter-spacing: var(--font-heading-1-letter-spacing);
190
- color: var(--color-text-primary);
191
- }
192
-
193
- .pageActions {
194
- display: flex;
195
- flex-wrap: wrap;
196
- align-items: center;
197
- gap: var(--gap-200);
198
- }
199
-
200
174
  /* -------------------------------------------------------- responsive */
201
175
 
202
176
  /* Laptop: a tighter side gutter. */
@@ -241,24 +215,17 @@
241
215
  justify-content: flex-end;
242
216
  }
243
217
 
244
- .search {
218
+ .search,
219
+ .ai {
245
220
  display: none;
246
221
  }
247
222
 
248
- .searchIcon {
223
+ .searchIcon,
224
+ .aiIcon {
249
225
  display: inline-flex;
250
226
  }
251
227
 
252
228
  .pageHead {
253
229
  padding-top: 0;
254
230
  }
255
-
256
- /* The actions take the full row under the title, sharing it evenly. */
257
- .pageActions {
258
- width: 100%;
259
- }
260
-
261
- .pageActions > * {
262
- flex: 1;
263
- }
264
231
  }
@@ -25,7 +25,8 @@ import {
25
25
  type AppSidebarProfile,
26
26
  type AppSidebarSection,
27
27
  } from 'rift-ds/components/AppSidebar/AppSidebar';
28
- import { Breadcrumb, type BreadcrumbItem } from 'rift-ds/components/Breadcrumb/Breadcrumb';
28
+ import type { BreadcrumbItem } from 'rift-ds/components/Breadcrumb/Breadcrumb';
29
+ import { PageHeader } from 'rift-ds/components/PageHeader/PageHeader';
29
30
  import { CommandPaletteTrigger } from 'rift-ds/components/CommandPaletteTrigger/CommandPaletteTrigger';
30
31
  import { ProgressiveBlur } from 'rift-ds/components/ProgressiveBlur/ProgressiveBlur';
31
32
  import { ThemeToggle } from 'rift-ds/components/ThemeToggle/ThemeToggle';
@@ -122,21 +123,18 @@ export function AppShell({ activeKey, breadcrumb, title, actions, children }: Ap
122
123
  <CommandPaletteTrigger className={styles.search} />
123
124
  <div className={styles.topBarActions}>
124
125
  <CommandPaletteTrigger iconOnly className={styles.searchIcon} />
125
- {/* The AI entry. Point it at your chat: `npx rift-ds init chat`
126
- scaffolds one, and ChatLauncher opens it. */}
127
- <AiButton />
126
+ {/* The AI entry. Point both at your chat: `npx rift-ds init chat`
127
+ scaffolds one, and ChatLauncher opens it. On a phone the
128
+ labelled button gives way to the icon, as search does, so
129
+ the bar keeps room for the actions you add. */}
130
+ <AiButton className={styles.ai} />
131
+ <AiButton iconOnly className={styles.aiIcon} />
128
132
  <ThemeToggle showLabels={false} />
129
133
  </div>
130
134
  </header>
131
135
 
132
136
  <main className={styles.page}>
133
- <div className={styles.pageHead}>
134
- <div className={styles.pageHeadText}>
135
- {breadcrumb && <Breadcrumb items={breadcrumb} />}
136
- <h1 className={styles.title}>{title}</h1>
137
- </div>
138
- {actions && <div className={styles.pageActions}>{actions}</div>}
139
- </div>
137
+ <PageHeader className={styles.pageHead} breadcrumb={breadcrumb} title={title} actions={actions} />
140
138
  {children}
141
139
  </main>
142
140
  </div>
@@ -0,0 +1,53 @@
1
+ /**
2
+ * A shader scene of your own, for ShaderScene's `scene` prop: a bed of
3
+ * light that rises in slow tongues. Rename it, then change it. The three
4
+ * parts are everything a scene is:
5
+ *
6
+ * - `colours`: the custom properties it reads, handed to the GLSL as
7
+ * `u_col[0]`, `u_col[1]` and so on. Naming the theme's ambient roles
8
+ * means it follows the theme and the colour mode.
9
+ * - `params`: its settings. Each arrives as `uniform float u_<key>`,
10
+ * declared for you, and is set through the component's `params` prop.
11
+ * - `glsl`: `vec3 scene(vec2 uv, float t)`, returning the pixel's linear
12
+ * colour over the ground (`u_ground`). `uv` runs 0 to 1 from the bottom
13
+ * left, `t` is seconds, and `fbm`, `vnoise`, `rnd` and `lobe` are there
14
+ * to call.
15
+ *
16
+ * `mode: 'dark'` says it only adds light: on a light page the component
17
+ * lays that light on as a pale tint. Leave it out for a scene that paints
18
+ * both modes itself.
19
+ */
20
+
21
+ import type { ShaderSceneSource } from 'rift-ds/components/ShaderScene/ShaderScene';
22
+
23
+ export const emberScene: ShaderSceneSource = {
24
+ mode: 'dark',
25
+ colours: ['--color-ambient-4', '--color-ambient-5'],
26
+ params: [
27
+ { key: 'glow', label: 'Glow', min: 0, max: 2, step: 0.01, default: 1 },
28
+ { key: 'height', label: 'Height', min: 0.1, max: 1.5, step: 0.01, default: 0.8 },
29
+ { key: 'scale', label: 'Scale', min: 0.5, max: 6, step: 0.05, default: 2.4 },
30
+ ],
31
+ glsl: /* glsl */ `
32
+ vec3 scene(vec2 uv, float t) {
33
+ // Square the space up, so the noise is not stretched on a wide stage.
34
+ float aspect = u_size.x / u_size.y;
35
+ vec2 p = vec2((uv.x - 0.5) * aspect, uv.y);
36
+
37
+ // How high the light reaches in this column: slow noise, drifting.
38
+ float reach = u_height * (0.35 + 1.1 * fbm(vec2(p.x * u_scale + t * 0.05, t * 0.08)));
39
+
40
+ // Brightest at the floor and gone at its reach, with a soft top edge.
41
+ float body = smoothstep(reach, 0.0, uv.y);
42
+ body *= body;
43
+
44
+ // Finer noise rising through it lifts the second colour out as embers.
45
+ float fine = fbm(vec2(p.x, uv.y) * u_scale * 5.0 - vec2(0.0, t * 0.35));
46
+ float embers = smoothstep(0.5, 0.85, fine) * body;
47
+
48
+ // Add the light to the ground: the fades and light mode depend on it.
49
+ vec3 light = (u_col[0] * body * 1.2 + u_col[1] * embers * 0.5) * u_glow;
50
+ return u_ground + light;
51
+ }
52
+ `,
53
+ };
@@ -25,6 +25,19 @@
25
25
  "app/dashboard/page.module.css"
26
26
  ]
27
27
  },
28
+ {
29
+ "name": "settings",
30
+ "label": "Settings",
31
+ "description": "The app shell with a column of settings sections, each saving on its own, and a profile form checked in one pass.",
32
+ "route": "/settings",
33
+ "files": [
34
+ "components/blocks/AppShell.tsx",
35
+ "components/blocks/AppShell.module.css",
36
+ "app/settings/page.tsx",
37
+ "app/settings/page.module.css",
38
+ "app/settings/ProfileForm.tsx"
39
+ ]
40
+ },
28
41
  {
29
42
  "name": "sign-in",
30
43
  "label": "Sign in",
@@ -34,6 +47,17 @@
34
47
  "app/sign-in/page.tsx",
35
48
  "app/sign-in/page.module.css"
36
49
  ]
50
+ },
51
+ {
52
+ "name": "shader-scene",
53
+ "label": "Shader scene",
54
+ "description": "A shader scene of your own on a stage, written in GLSL from the theme's colour roles, with a slider for each setting it declares.",
55
+ "route": "/shader",
56
+ "files": [
57
+ "components/blocks/emberScene.ts",
58
+ "app/shader/page.tsx",
59
+ "app/shader/page.module.css"
60
+ ]
37
61
  }
38
62
  ]
39
63
  }
@@ -1,9 +1,6 @@
1
1
  import { createFeedbackHandler } from 'rift-ds/chat/server';
2
2
  import { guardrails } from '../guardrails';
3
3
 
4
- export const runtime = 'nodejs';
5
- export const dynamic = 'force-dynamic';
6
-
7
4
  /** Thumbs verdicts on answers, stored against the exchange the chat route logged. */
8
5
  const handler = createFeedbackHandler({ guardrails });
9
6