rift-ds 1.27.0 → 1.29.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 +1 -1
- package/behaviors/typeahead.d.ts +27 -0
- package/behaviors/typeahead.js +30 -0
- package/bin/rift-ds.mjs +5 -4
- package/bin/templates/blocks/app/shader/page.module.css +75 -0
- package/bin/templates/blocks/app/shader/page.tsx +81 -0
- package/bin/templates/blocks/components/blocks/emberScene.ts +53 -0
- package/bin/templates/blocks/registry.json +11 -0
- package/chat/ChatWidget.d.ts +1 -1
- package/chat/threads.js +7 -4
- package/components/Button/Button.css +38 -0
- package/components/Button/Button.d.ts +12 -1
- package/components/Button/Button.js +2 -0
- package/components/Carousel/Carousel.js +4 -0
- package/components/ColorPicker/ColorPicker.js +5 -0
- package/components/CommandPalette/CommandPalette.js +1 -0
- package/components/ContextMenu/ContextMenu.js +8 -0
- package/components/DataTable/DataTable.css +1 -1
- package/components/Dropdown/Dropdown.js +13 -0
- package/components/DropdownMenu/DropdownMenu.js +12 -0
- package/components/EntitySwitcher/EntitySwitcher.js +23 -1
- package/components/FilterBar/FilterBar.js +8 -0
- package/components/ModelPicker/ModelPicker.js +8 -0
- package/components/RadioButton/RadioButton.js +19 -2
- package/components/RichDropdown/RichDropdown.js +8 -0
- package/components/SegmentedControl/SegmentedControl.js +6 -0
- package/components/ShaderScene/ShaderScene.d.ts +36 -13
- package/components/ShaderScene/ShaderScene.js +41 -3
- package/components/ShaderScene/assemble.d.ts +10 -3
- package/components/ShaderScene/assemble.js +29 -0
- package/components/ShaderScene/renderer.d.ts +12 -4
- package/components/ShaderScene/renderer.js +32 -20
- package/components/ShaderScene/scenes.d.ts +78 -0
- package/components/ShaderScene/scenes.js +933 -1
- package/components/ShaderScene/types.d.ts +52 -23
- package/components/ThemePicker/ThemePicker.js +14 -2
- package/components/TimePicker/TimePicker.js +8 -0
- package/components/Toolbar/Toolbar.d.ts +3 -1
- package/components/TreeView/TreeView.js +10 -0
- package/components/WorldMap/WorldMap.d.ts +1 -1
- package/components/WorldMap/WorldMap.js +1 -1
- package/components/keyboard-patterns.json.d.ts +625 -0
- package/components/keyboard-patterns.json.js +8 -0
- package/components/registry.d.ts +52 -0
- package/components/registry.js +13 -1
- package/components/registry.json +358 -179
- package/components/registry.json.d.ts +358 -179
- package/components/registry.json.js +1 -1
- package/package.json +1 -1
- package/tokens/presets/contrast.css +2 -2
- package/tokens/presets/coral.css +2 -2
- package/tokens/presets/forest.css +2 -2
- package/tokens/presets/gold.css +2 -2
- package/tokens/presets/mono.css +92 -98
- package/tokens/presets/pink.css +2 -2
- package/tokens/presets/plum.css +2 -2
- package/tokens/presets/terminal.css +2 -2
- package/tokens/presets/warm.css +2 -2
- package/tokens/presets/zest.css +2 -2
- package/tokens/registry.json +19 -18
- package/tokens/registry.json.d.ts +19 -18
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +4 -1
- package/tokens/tokens-light.css +3 -0
- package/tokens/values.json.js +1 -1
|
@@ -5,51 +5,80 @@
|
|
|
5
5
|
* with theirs. Every setting is declared as data, so the panel draws its
|
|
6
6
|
* sliders from the declaration and never needs a hand-built control.
|
|
7
7
|
*/
|
|
8
|
-
/** One numeric setting, drawn as a slider. */
|
|
9
|
-
export type
|
|
8
|
+
/** One numeric setting of a scene, drawn as a slider by a host that offers controls. */
|
|
9
|
+
export type ShaderSceneParamSpec = {
|
|
10
|
+
/** The setting's name: a GLSL identifier, which the scene reads as `uniform float u_<key>`. */
|
|
10
11
|
key: string;
|
|
12
|
+
/** The name a host prints beside the slider. */
|
|
11
13
|
label: string;
|
|
14
|
+
/** The lowest value the slider offers. */
|
|
12
15
|
min: number;
|
|
16
|
+
/** The highest value the slider offers. */
|
|
13
17
|
max: number;
|
|
18
|
+
/** The slider's step. */
|
|
14
19
|
step: number;
|
|
20
|
+
/** The value the scene takes when `params` does not set this key. */
|
|
15
21
|
default: number;
|
|
16
22
|
};
|
|
23
|
+
/** The engine's own name for a setting; `ShaderSceneParamSpec` is the published one. */
|
|
24
|
+
export type ParamSpec = ShaderSceneParamSpec;
|
|
17
25
|
/**
|
|
18
|
-
* A
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
26
|
+
* A scene of your own, as ShaderScene's `scene` prop takes it: the colour
|
|
27
|
+
* roles it reads, its settings, and the GLSL that paints it. Hold it at
|
|
28
|
+
* module scope or pass it inline; the program is rebuilt only when its
|
|
29
|
+
* content changes.
|
|
22
30
|
*/
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
export type ShaderSceneSource = {
|
|
32
|
+
/**
|
|
33
|
+
* The colour custom properties the scene reads, resolved from the live
|
|
34
|
+
* cascade at the scene into `u_col[0..]` in this order, eight at most.
|
|
35
|
+
* Name the `--color-ambient-*` roles and the scene re-themes with the page.
|
|
36
|
+
*/
|
|
28
37
|
colours: string[];
|
|
29
38
|
/**
|
|
30
|
-
* `dark` for a scene that only reads on a dark
|
|
31
|
-
* On a light page its
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
39
|
+
* `dark` for a scene that only adds light and so only reads on a dark
|
|
40
|
+
* ground. On a light page its light is computed against a near-black
|
|
41
|
+
* ground of its own and laid onto the page as a pale tint. A scene
|
|
42
|
+
* without it paints for both modes itself, from the page ground
|
|
43
|
+
* (`u_ground`).
|
|
35
44
|
*/
|
|
36
45
|
mode?: "dark";
|
|
37
46
|
/**
|
|
38
|
-
* A ramp of characters, thin to heavy, for a scene that prints type.
|
|
39
|
-
*
|
|
40
|
-
* (`--font-family-code`) and
|
|
41
|
-
*
|
|
47
|
+
* A ramp of characters, thin to heavy, for a scene that prints type. It
|
|
48
|
+
* is drawn once into a strip texture in the theme's code face
|
|
49
|
+
* (`--font-family-code`) and reaches the GLSL as `u_glyphs`, with the
|
|
50
|
+
* number of characters in `u_glyphCount`.
|
|
42
51
|
*/
|
|
43
52
|
glyphs?: string;
|
|
44
53
|
/**
|
|
45
54
|
* The most drawing-buffer pixels per CSS pixel the scene may use, for a
|
|
46
|
-
* scene with detail finer than soft light (type). Defaults to 1;
|
|
47
|
-
* ratio in use reaches the GLSL as `u_ratio`.
|
|
55
|
+
* scene with detail finer than soft light (type, points). Defaults to 1;
|
|
56
|
+
* the ratio in use reaches the GLSL as `u_ratio`.
|
|
48
57
|
*/
|
|
49
58
|
pixelRatio?: number;
|
|
50
|
-
|
|
59
|
+
/** The scene's settings. Each arrives in the GLSL as `uniform float u_<key>`, declared for you. */
|
|
60
|
+
params: ShaderSceneParamSpec[];
|
|
61
|
+
/**
|
|
62
|
+
* GLSL ES 3.00 defining `vec3 scene(vec2 uv, float t)`, which returns the
|
|
63
|
+
* pixel's linear colour over the ground (`u_ground`). `uv` runs 0 to 1
|
|
64
|
+
* from the bottom left and `t` is the scene's clock in seconds. The
|
|
65
|
+
* uniforms and the noise helpers are declared before it.
|
|
66
|
+
*/
|
|
51
67
|
glsl: string;
|
|
52
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* A scene the library ships: a source with the id it is picked by, and the
|
|
71
|
+
* label and description a picker prints. `glsl` defines
|
|
72
|
+
* `vec3 scene(vec2 uv, float t)`, returning the final linear colour of the
|
|
73
|
+
* pixel over the page ground (`u_ground`). Its settings arrive as
|
|
74
|
+
* `uniform float u_<key>`, and its colours as `u_col[i]` in the order
|
|
75
|
+
* `colours` lists their tokens.
|
|
76
|
+
*/
|
|
77
|
+
export type Scene = ShaderSceneSource & {
|
|
78
|
+
id: string;
|
|
79
|
+
label: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
53
82
|
/**
|
|
54
83
|
* A finishing step. `glsl` defines one function named `pass_<id>`: a
|
|
55
84
|
* `light` pass takes and returns the linear colour, before encoding; an
|
|
@@ -5,6 +5,7 @@ import { ChosenMark } from "../Dropdown/Dropdown.js";
|
|
|
5
5
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
6
6
|
import { useAnchoredPosition } from "../../behaviors/useAnchoredPosition.js";
|
|
7
7
|
import { useLayer } from "../../behaviors/useLayer.js";
|
|
8
|
+
import { useTypeahead } from "../../behaviors/typeahead.js";
|
|
8
9
|
import "./ThemePicker.css";
|
|
9
10
|
const ThemePicker = React.forwardRef(
|
|
10
11
|
({
|
|
@@ -74,14 +75,25 @@ const ThemePicker = React.forwardRef(
|
|
|
74
75
|
setOpen(false);
|
|
75
76
|
triggerRef.current?.focus();
|
|
76
77
|
};
|
|
78
|
+
const typeahead = useTypeahead();
|
|
77
79
|
const handleMenuKeyDown = (event) => {
|
|
78
|
-
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
|
|
79
80
|
const items = [
|
|
80
81
|
...menuRef.current?.querySelectorAll('[role="menuitemradio"], [role="menuitem"]') ?? []
|
|
81
82
|
];
|
|
82
83
|
if (!items.length) return;
|
|
83
|
-
event.preventDefault();
|
|
84
84
|
const at = items.indexOf(document.activeElement);
|
|
85
|
+
const hit = typeahead(
|
|
86
|
+
event,
|
|
87
|
+
items.map((item) => (item.querySelector(`.${baseClass}__row-name`) ?? item).textContent),
|
|
88
|
+
at
|
|
89
|
+
);
|
|
90
|
+
if (hit !== null) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
items[hit]?.focus();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
|
|
96
|
+
event.preventDefault();
|
|
85
97
|
const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : (at + (event.key === "ArrowDown" ? 1 : -1) + items.length) % items.length;
|
|
86
98
|
items[next]?.focus();
|
|
87
99
|
};
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useState, useRef, useId, useMemo, useEffect } from "react";
|
|
4
4
|
import { ChosenMark } from "../Dropdown/Dropdown.js";
|
|
5
5
|
import { useLayer } from "../../behaviors/useLayer.js";
|
|
6
|
+
import { useTypeahead } from "../../behaviors/typeahead.js";
|
|
6
7
|
import { useAnchoredPosition } from "../../behaviors/useAnchoredPosition.js";
|
|
7
8
|
import { Field } from "../Field/Field.js";
|
|
8
9
|
import { useLocale } from "../../behaviors/LocaleProvider.js";
|
|
@@ -138,8 +139,15 @@ const TimePicker = React.forwardRef(
|
|
|
138
139
|
dismissOnOutsidePress: true,
|
|
139
140
|
getElements: () => [rootRef.current]
|
|
140
141
|
});
|
|
142
|
+
const typeahead = useTypeahead();
|
|
141
143
|
const handleKeyDown = (e) => {
|
|
142
144
|
if (disabled) return;
|
|
145
|
+
const hit = typeahead(e, timeOptions.map((option) => option.label), focusedIndex);
|
|
146
|
+
if (hit !== null && isOpen) {
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
setFocusedIndex(hit);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
143
151
|
switch (e.key) {
|
|
144
152
|
case "Enter":
|
|
145
153
|
case " ":
|
|
@@ -23,7 +23,9 @@ export interface ToolbarProps extends ToolbarOwnProps, Omit<React.ComponentProps
|
|
|
23
23
|
* segmented controls, separated into clusters. Announces as `role="toolbar"`
|
|
24
24
|
* and moves focus with the arrow keys (Home/End jump to the ends), following
|
|
25
25
|
* the toolbar keyboard pattern, while every control keeps its natural tab
|
|
26
|
-
* stop.
|
|
26
|
+
* stop. That departure from the pattern's single tab stop is deliberate: a
|
|
27
|
+
* control inside that owns the arrow keys (a segmented control's tabs)
|
|
28
|
+
* would otherwise cut the controls after it off from the keyboard.
|
|
27
29
|
*
|
|
28
30
|
* The `floating` variant is the glass pill for controls that hover over
|
|
29
31
|
* content — a canvas's zoom cluster, a stage's own instruments. The shell is
|
|
@@ -4,6 +4,7 @@ import React, { useState, useMemo, useRef, useCallback } from "react";
|
|
|
4
4
|
import "./TreeView.css";
|
|
5
5
|
import "../../fonts/material-symbols.css";
|
|
6
6
|
import { mirrorClass, logicalArrowKey } from "../../behaviors/direction.js";
|
|
7
|
+
import { useTypeahead } from "../../behaviors/typeahead.js";
|
|
7
8
|
const isBranchNode = (node) => Array.isArray(node.children) && node.children.length > 0;
|
|
8
9
|
const TreeView = React.forwardRef(
|
|
9
10
|
({
|
|
@@ -103,10 +104,19 @@ const TreeView = React.forwardRef(
|
|
|
103
104
|
setFocusedId(id);
|
|
104
105
|
itemRefs.current.get(id)?.focus();
|
|
105
106
|
}, []);
|
|
107
|
+
const typeahead = useTypeahead();
|
|
106
108
|
const handleKeyDown = (event, node) => {
|
|
107
109
|
const branch = isBranchNode(node);
|
|
108
110
|
const expanded = expandedSet.has(node.id);
|
|
109
111
|
const index = visibleNodes.findIndex((n) => n.id === node.id);
|
|
112
|
+
const own = event.target.closest('[role="treeitem"]') === event.currentTarget;
|
|
113
|
+
const hit = own ? typeahead(event, visibleNodes.map((n) => n.label), index) : null;
|
|
114
|
+
if (hit !== null) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
focusNode(visibleNodes[hit].id);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
110
120
|
let handled = true;
|
|
111
121
|
switch (logicalArrowKey(event.key, event.currentTarget)) {
|
|
112
122
|
case "ArrowDown":
|
|
@@ -90,7 +90,7 @@ type WorldMapOwnProps = {
|
|
|
90
90
|
pointsLabel?: (count: number) => string;
|
|
91
91
|
/** The keyboard and pointer instructions appended to the map's accessible name while zooming is on. */
|
|
92
92
|
zoomHintLabel?: string;
|
|
93
|
-
/** Accessible name of the zoom
|
|
93
|
+
/** Accessible name of the group of zoom controls. Defaults to "Map zoom controls". */
|
|
94
94
|
zoomControlsLabel?: string;
|
|
95
95
|
/** Accessible name of the zoom-out button. Defaults to "Zoom out". */
|
|
96
96
|
zoomOutLabel?: string;
|
|
@@ -385,7 +385,7 @@ const WorldMap = React.forwardRef(
|
|
|
385
385
|
]
|
|
386
386
|
}
|
|
387
387
|
),
|
|
388
|
-
zoomEnabled && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__zoom`, role: "
|
|
388
|
+
zoomEnabled && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__zoom`, role: "group", "aria-label": zoomControlsLabel, children: [
|
|
389
389
|
/* @__PURE__ */ jsx(
|
|
390
390
|
CircularButton,
|
|
391
391
|
{
|