@newtone-dev/ui-react-web 0.43.0 → 0.44.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/dist/app-frame/app-frame.css +16 -67
- package/dist/app-frame/control/control.d.ts +1 -0
- package/dist/app-frame/control/control.d.ts.map +1 -1
- package/dist/app-frame/control/control.js +3 -2
- package/dist/app-frame/control/control.js.map +1 -1
- package/dist/app-frame/launcher/launcher.d.ts +6 -2
- package/dist/app-frame/launcher/launcher.d.ts.map +1 -1
- package/dist/app-frame/launcher/launcher.js +12 -11
- package/dist/app-frame/launcher/launcher.js.map +1 -1
- package/dist/app-frame/main-menu/main-menu.js +2 -2
- package/dist/app-frame/main-menu/main-menu.js.map +1 -1
- package/dist/app-frame/menu/menu.d.ts +1 -0
- package/dist/app-frame/menu/menu.d.ts.map +1 -1
- package/dist/app-frame/menu/menu.js +3 -1
- package/dist/app-frame/menu/menu.js.map +1 -1
- package/dist/app-frame/parts.d.ts +3 -1
- package/dist/app-frame/parts.d.ts.map +1 -1
- package/dist/app-frame/parts.js +12 -4
- package/dist/app-frame/parts.js.map +1 -1
- package/dist/ask-button/ask-button.css +37 -0
- package/dist/ask-button/ask-button.d.ts +24 -0
- package/dist/ask-button/ask-button.d.ts.map +1 -0
- package/dist/ask-button/ask-button.js +19 -0
- package/dist/ask-button/ask-button.js.map +1 -0
- package/dist/ask-button/index.d.ts +3 -0
- package/dist/ask-button/index.d.ts.map +1 -0
- package/dist/ask-button/index.js +2 -0
- package/dist/ask-button/index.js.map +1 -0
- package/dist/badge/badge.css +44 -0
- package/dist/badge/badge.d.ts +16 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +15 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/below/below.css +8 -10
- package/dist/below/below.d.ts +3 -4
- package/dist/below/below.d.ts.map +1 -1
- package/dist/below/below.js +10 -52
- package/dist/below/below.js.map +1 -1
- package/dist/below/grip.d.ts +20 -0
- package/dist/below/grip.d.ts.map +1 -0
- package/dist/below/grip.js +78 -0
- package/dist/below/grip.js.map +1 -0
- package/dist/canvas/box/box.d.ts +9 -2
- package/dist/canvas/box/box.d.ts.map +1 -1
- package/dist/canvas/box/box.js +2 -2
- package/dist/canvas/box/box.js.map +1 -1
- package/dist/canvas/canvas.css +105 -34
- package/dist/canvas/canvas.d.ts +9 -2
- package/dist/canvas/canvas.d.ts.map +1 -1
- package/dist/canvas/canvas.js +19 -6
- package/dist/canvas/canvas.js.map +1 -1
- package/dist/canvas/cells/cells.d.ts +3 -3
- package/dist/canvas/cells/cells.js +10 -9
- package/dist/canvas/cells/cells.js.map +1 -1
- package/dist/canvas/cells/grid.d.ts +32 -0
- package/dist/canvas/cells/grid.d.ts.map +1 -1
- package/dist/canvas/cells/grid.js +93 -1
- package/dist/canvas/cells/grid.js.map +1 -1
- package/dist/canvas/dock/dock.d.ts +6 -1
- package/dist/canvas/dock/dock.d.ts.map +1 -1
- package/dist/canvas/dock/dock.js +19 -3
- package/dist/canvas/dock/dock.js.map +1 -1
- package/dist/canvas/frame/frame.d.ts.map +1 -1
- package/dist/canvas/frame/frame.js +1 -7
- package/dist/canvas/frame/frame.js.map +1 -1
- package/dist/canvas/index.d.ts +2 -1
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/insert/insert.d.ts +18 -0
- package/dist/canvas/insert/insert.d.ts.map +1 -0
- package/dist/canvas/insert/insert.js +40 -0
- package/dist/canvas/insert/insert.js.map +1 -0
- package/dist/canvas/pin/pin.d.ts.map +1 -1
- package/dist/canvas/pin/pin.js +2 -1
- package/dist/canvas/pin/pin.js.map +1 -1
- package/dist/chat/chat.css +2 -7
- package/dist/chat/chat.d.ts +5 -3
- package/dist/chat/chat.d.ts.map +1 -1
- package/dist/chat/chat.js +17 -24
- package/dist/chat/chat.js.map +1 -1
- package/dist/data-grid/data-grid.css +128 -0
- package/dist/data-grid/data-grid.d.ts +45 -0
- package/dist/data-grid/data-grid.d.ts.map +1 -0
- package/dist/data-grid/data-grid.js +50 -0
- package/dist/data-grid/data-grid.js.map +1 -0
- package/dist/data-grid/index.d.ts +3 -0
- package/dist/data-grid/index.d.ts.map +1 -0
- package/dist/data-grid/index.js +2 -0
- package/dist/data-grid/index.js.map +1 -0
- package/dist/discover/discover.css +60 -0
- package/dist/discover/discover.d.ts +33 -0
- package/dist/discover/discover.d.ts.map +1 -0
- package/dist/discover/discover.js +13 -0
- package/dist/discover/discover.js.map +1 -0
- package/dist/discover/index.d.ts +4 -0
- package/dist/discover/index.d.ts.map +1 -0
- package/dist/discover/index.js +3 -0
- package/dist/discover/index.js.map +1 -0
- package/dist/file-grid/file-grid.css +5 -0
- package/dist/file-grid/file-grid.d.ts +9 -2
- package/dist/file-grid/file-grid.d.ts.map +1 -1
- package/dist/file-grid/file-grid.js +5 -4
- package/dist/file-grid/file-grid.js.map +1 -1
- package/dist/floating-bar/floating-bar.css +20 -1
- package/dist/floating-bar/floating-bar.d.ts +16 -1
- package/dist/floating-bar/floating-bar.d.ts.map +1 -1
- package/dist/floating-bar/floating-bar.js +51 -46
- package/dist/floating-bar/floating-bar.js.map +1 -1
- package/dist/floating-bar/menu.d.ts +1 -0
- package/dist/floating-bar/menu.d.ts.map +1 -1
- package/dist/floating-bar/menu.js +12 -1
- package/dist/floating-bar/menu.js.map +1 -1
- package/dist/font-picker/font-picker.css +39 -0
- package/dist/font-picker/font-picker.d.ts +29 -0
- package/dist/font-picker/font-picker.d.ts.map +1 -0
- package/dist/font-picker/font-picker.js +119 -0
- package/dist/font-picker/font-picker.js.map +1 -0
- package/dist/font-picker/index.d.ts +3 -0
- package/dist/font-picker/index.d.ts.map +1 -0
- package/dist/font-picker/index.js +2 -0
- package/dist/font-picker/index.js.map +1 -0
- package/dist/hint/hint.css +55 -0
- package/dist/hint/hint.d.ts +33 -0
- package/dist/hint/hint.d.ts.map +1 -0
- package/dist/hint/hint.js +80 -0
- package/dist/hint/hint.js.map +1 -0
- package/dist/hint/index.d.ts +4 -0
- package/dist/hint/index.d.ts.map +1 -0
- package/dist/hint/index.js +3 -0
- package/dist/hint/index.js.map +1 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector/inspector.css +27 -0
- package/dist/inspector/inspector.d.ts +12 -1
- package/dist/inspector/inspector.d.ts.map +1 -1
- package/dist/inspector/inspector.js +6 -3
- package/dist/inspector/inspector.js.map +1 -1
- package/dist/look-picker/index.d.ts +3 -0
- package/dist/look-picker/index.d.ts.map +1 -0
- package/dist/look-picker/index.js +2 -0
- package/dist/look-picker/index.js.map +1 -0
- package/dist/look-picker/look-picker.css +90 -0
- package/dist/look-picker/look-picker.d.ts +40 -0
- package/dist/look-picker/look-picker.d.ts.map +1 -0
- package/dist/look-picker/look-picker.js +82 -0
- package/dist/look-picker/look-picker.js.map +1 -0
- package/dist/look-thumb/index.d.ts +3 -0
- package/dist/look-thumb/index.d.ts.map +1 -0
- package/dist/look-thumb/index.js +2 -0
- package/dist/look-thumb/index.js.map +1 -0
- package/dist/look-thumb/look-thumb.css +7 -0
- package/dist/look-thumb/look-thumb.d.ts +27 -0
- package/dist/look-thumb/look-thumb.d.ts.map +1 -0
- package/dist/look-thumb/look-thumb.js +15 -0
- package/dist/look-thumb/look-thumb.js.map +1 -0
- package/dist/material/index.d.ts +3 -0
- package/dist/material/index.d.ts.map +1 -0
- package/dist/material/index.js +2 -0
- package/dist/material/index.js.map +1 -0
- package/dist/material/material.css +306 -0
- package/dist/material/material.d.ts +43 -0
- package/dist/material/material.d.ts.map +1 -0
- package/dist/material/material.js +27 -0
- package/dist/material/material.js.map +1 -0
- package/dist/on-media/on-media.css +6 -6
- package/dist/prompt-field/index.d.ts +3 -0
- package/dist/prompt-field/index.d.ts.map +1 -0
- package/dist/prompt-field/index.js +2 -0
- package/dist/prompt-field/index.js.map +1 -0
- package/dist/prompt-field/prompt-field.css +203 -0
- package/dist/prompt-field/prompt-field.d.ts +72 -0
- package/dist/prompt-field/prompt-field.d.ts.map +1 -0
- package/dist/prompt-field/prompt-field.js +91 -0
- package/dist/prompt-field/prompt-field.js.map +1 -0
- package/dist/quick-action/index.d.ts +1 -1
- package/dist/quick-action/index.d.ts.map +1 -1
- package/dist/quick-action/quick-action.css +60 -17
- package/dist/quick-action/quick-action.d.ts +34 -28
- package/dist/quick-action/quick-action.d.ts.map +1 -1
- package/dist/quick-action/quick-action.js +25 -21
- package/dist/quick-action/quick-action.js.map +1 -1
- package/dist/row-list/row-list.css +3 -0
- package/dist/seed-color-field/index.d.ts +3 -0
- package/dist/seed-color-field/index.d.ts.map +1 -0
- package/dist/seed-color-field/index.js +2 -0
- package/dist/seed-color-field/index.js.map +1 -0
- package/dist/seed-color-field/seed-color-field.css +105 -0
- package/dist/seed-color-field/seed-color-field.d.ts +36 -0
- package/dist/seed-color-field/seed-color-field.d.ts.map +1 -0
- package/dist/seed-color-field/seed-color-field.js +103 -0
- package/dist/seed-color-field/seed-color-field.js.map +1 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/skeleton.css +84 -0
- package/dist/skeleton/skeleton.d.ts +50 -0
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/skeleton/skeleton.js +25 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/slide-list/index.d.ts +1 -1
- package/dist/slide-list/index.d.ts.map +1 -1
- package/dist/slide-list/slide-list.css +259 -22
- package/dist/slide-list/slide-list.d.ts +78 -1
- package/dist/slide-list/slide-list.d.ts.map +1 -1
- package/dist/slide-list/slide-list.js +264 -18
- package/dist/slide-list/slide-list.js.map +1 -1
- package/dist/split/split.css +8 -10
- package/dist/thread/thread.css +7 -39
- package/dist/thread/thread.d.ts.map +1 -1
- package/dist/thread/thread.js +44 -45
- package/dist/thread/thread.js.map +1 -1
- package/dist/tile-picker/tile-picker.css +18 -0
- package/dist/tile-picker/tile-picker.d.ts +12 -2
- package/dist/tile-picker/tile-picker.d.ts.map +1 -1
- package/dist/tile-picker/tile-picker.js +19 -4
- package/dist/tile-picker/tile-picker.js.map +1 -1
- package/dist/workbench/workbench.css +55 -16
- package/dist/workbench/workbench.d.ts +7 -2
- package/dist/workbench/workbench.d.ts.map +1 -1
- package/dist/workbench/workbench.js +8 -2
- package/dist/workbench/workbench.js.map +1 -1
- package/package.json +61 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* LookPicker -- blueprint components/look-picker.md. Looks to pick one from, in titled groups. A tile is
|
|
2
|
+
* TilePicker's: at least --newtone-look-picker-min wide, its picture in a box of --newtone-look-picker-ratio, the
|
|
3
|
+
* chosen one ringed.
|
|
4
|
+
*
|
|
5
|
+
* LENGTHS IT DECIDES:
|
|
6
|
+
* 2px the chosen ring, text.accent, as TilePicker's and SlideList's
|
|
7
|
+
* 1px the picture's hairline */
|
|
8
|
+
.newtone-look-picker {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: var(--newtone-space-4);
|
|
12
|
+
min-inline-size: 0;
|
|
13
|
+
}
|
|
14
|
+
.newtone-look-picker-group {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: var(--newtone-space-1);
|
|
18
|
+
min-inline-size: 0;
|
|
19
|
+
}
|
|
20
|
+
.newtone-look-picker-title {
|
|
21
|
+
padding-inline: var(--newtone-space-1);
|
|
22
|
+
}
|
|
23
|
+
.newtone-look-picker-tiles {
|
|
24
|
+
display: grid;
|
|
25
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--newtone-look-picker-min, 120px), 1fr));
|
|
26
|
+
gap: var(--newtone-space-2);
|
|
27
|
+
}
|
|
28
|
+
.newtone-look-picker[data-layout='row'] .newtone-look-picker-tiles {
|
|
29
|
+
grid-auto-flow: column;
|
|
30
|
+
grid-auto-columns: var(--newtone-look-picker-min, 120px);
|
|
31
|
+
grid-template-columns: none;
|
|
32
|
+
overflow-x: auto;
|
|
33
|
+
overscroll-behavior-x: contain;
|
|
34
|
+
scroll-snap-type: x proximity;
|
|
35
|
+
scroll-padding-inline: var(--newtone-space-1);
|
|
36
|
+
scrollbar-width: thin;
|
|
37
|
+
padding-block-end: var(--newtone-space-1);
|
|
38
|
+
}
|
|
39
|
+
.newtone-look-picker[data-layout='row'] .newtone-look-picker-tile {
|
|
40
|
+
scroll-snap-align: start;
|
|
41
|
+
}
|
|
42
|
+
.newtone-look-picker-tile {
|
|
43
|
+
all: unset;
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--newtone-space-1);
|
|
48
|
+
inline-size: 100%;
|
|
49
|
+
min-inline-size: 0;
|
|
50
|
+
padding: var(--newtone-space-1);
|
|
51
|
+
border-radius: var(--newtone-radius-md);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
color: var(--newtone-role-text-primary);
|
|
54
|
+
}
|
|
55
|
+
.newtone-look-picker-tile:where(:hover, :focus-visible):not(:disabled) {
|
|
56
|
+
background: var(--newtone-role-surface-secondary);
|
|
57
|
+
outline: none;
|
|
58
|
+
}
|
|
59
|
+
.newtone-look-picker-tile:focus-visible {
|
|
60
|
+
box-shadow: 0 0 0 2px var(--newtone-role-text-accent);
|
|
61
|
+
}
|
|
62
|
+
.newtone-look-picker-tile:disabled {
|
|
63
|
+
cursor: default;
|
|
64
|
+
color: var(--newtone-role-text-disabled);
|
|
65
|
+
}
|
|
66
|
+
.newtone-look-picker-thumb {
|
|
67
|
+
display: block;
|
|
68
|
+
aspect-ratio: var(--newtone-look-picker-ratio, 1.7778);
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
background: var(--newtone-role-surface-primary);
|
|
71
|
+
border: 1px solid var(--newtone-role-divider-secondary);
|
|
72
|
+
border-radius: var(--newtone-radius-sm);
|
|
73
|
+
}
|
|
74
|
+
.newtone-look-picker-thumb > :where(*) {
|
|
75
|
+
display: block;
|
|
76
|
+
inline-size: 100%;
|
|
77
|
+
block-size: 100%;
|
|
78
|
+
}
|
|
79
|
+
.newtone-look-picker-tile:disabled .newtone-look-picker-thumb {
|
|
80
|
+
opacity: 0.4;
|
|
81
|
+
}
|
|
82
|
+
.newtone-look-picker-tile[data-chosen] .newtone-look-picker-thumb {
|
|
83
|
+
box-shadow: 0 0 0 2px var(--newtone-role-text-accent);
|
|
84
|
+
}
|
|
85
|
+
.newtone-look-picker-tags {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-wrap: wrap;
|
|
88
|
+
gap: var(--newtone-space-1);
|
|
89
|
+
min-inline-size: 0;
|
|
90
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
/** A look to pick: what it is, its name, the consumer's picture of it and a few words about it. */
|
|
3
|
+
export interface LookPickerTile {
|
|
4
|
+
/** Unique across every group. */
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
/** The consumer's picture of the look, drawn in a box of `ratio`. */
|
|
8
|
+
thumb?: ReactNode;
|
|
9
|
+
/** A few words about it under its name: `Tag`s (v3, Update available, Edit). */
|
|
10
|
+
tags?: ReactNode;
|
|
11
|
+
/** Shown, and cannot be picked or focused (a look the person may not start from). */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** A titled group of tiles: HuevOS, My variants, My brands, From an org, the pool. One with no tiles is not shown. */
|
|
15
|
+
export interface LookPickerGroup {
|
|
16
|
+
id: string;
|
|
17
|
+
/** Its title over its tiles; also its name for assistive tech. Omitted, the group has no title. */
|
|
18
|
+
title?: string;
|
|
19
|
+
tiles: LookPickerTile[];
|
|
20
|
+
}
|
|
21
|
+
export interface LookPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
|
|
22
|
+
/** The picker's name, for assistive tech. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** The id of the tile chosen now, ringed; null for none. */
|
|
25
|
+
value: string | null;
|
|
26
|
+
groups: LookPickerGroup[];
|
|
27
|
+
/** A tile picked. */
|
|
28
|
+
onPick: (id: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* `grid` (the default): each group's tiles in rows that wrap. `row`: each group one row that scrolls sideways,
|
|
31
|
+
* snapping to tiles; the chosen tile is scrolled into view in its row.
|
|
32
|
+
*/
|
|
33
|
+
layout?: 'grid' | 'row';
|
|
34
|
+
/** Width over height of each picture; 16 / 9 unless said. */
|
|
35
|
+
ratio?: number;
|
|
36
|
+
/** The least width of a tile, in CSS pixels; 120 unless said. In a row, each tile's width. */
|
|
37
|
+
minTile?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function LookPicker({ label, value, groups, onPick, layout, ratio, minTile, className, style, ...rest }: LookPickerProps): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=look-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-picker.d.ts","sourceRoot":"","sources":["../../src/look-picker/look-picker.tsx"],"names":[],"mappings":"AAQA,OAAO,EAIH,KAAK,cAAc,EAEnB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAA;AAGd,mGAAmG;AACnG,MAAM,WAAW,cAAc;IAC3B,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,gFAAgF;IAChF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,sHAAsH;AACtH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,cAAc,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CACzC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,UAAU,CAC1B;IACG,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,qBAAqB;IACrB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACvB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAID,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAe,EACf,KAAc,EACd,OAAa,EACb,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACV,EAAE,eAAe,+BAoIjB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// Looks to pick one from, in titled groups: each tile the consumer's own picture of a look (`thumb`), its name and a
|
|
4
|
+
// few tags under it. HuevOS's "Start from" (a new brand from HuevOS, a variant, a brand, one of an org's or of the
|
|
5
|
+
// pool) is its first consumer, then Slides' and Appearance's brand pickers (blueprint components/look-picker.md).
|
|
6
|
+
// One Tab stop for every group: the tile last focused, first the chosen one. The arrow keys go through the tiles across
|
|
7
|
+
// the groups (Left and Right in reading order, Up and Down to the nearest tile above or below as laid out now), Home
|
|
8
|
+
// and End to the ends; Enter or Space picks.
|
|
9
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
10
|
+
import { Text } from '../text/text.js';
|
|
11
|
+
const TILE = '.newtone-look-picker-tile:not(:disabled)';
|
|
12
|
+
export function LookPicker({ label, value, groups, onPick, layout = 'grid', ratio = 16 / 9, minTile = 120, className, style, ...rest }) {
|
|
13
|
+
const shown = groups.filter((g) => g.tiles.length);
|
|
14
|
+
const open = shown.flatMap((g) => g.tiles).filter((t) => !t.disabled);
|
|
15
|
+
const box = useRef(null);
|
|
16
|
+
const [focused, setFocused] = useState(null);
|
|
17
|
+
// The one Tab stop: the tile last focused while it is still there, else the chosen one, else the first.
|
|
18
|
+
const stop = (focused && open.some((t) => t.id === focused) && focused) ||
|
|
19
|
+
(value && open.some((t) => t.id === value) && value) ||
|
|
20
|
+
open[0]?.id;
|
|
21
|
+
// In rows, the chosen tile is shown: scrolled into view in its row when it changes, without moving the page.
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (layout !== 'row' || !value)
|
|
24
|
+
return;
|
|
25
|
+
const tile = box.current?.querySelector(`[data-newtone-tile="${CSS.escape(value)}"]`);
|
|
26
|
+
const row = tile?.closest('.newtone-look-picker-tiles');
|
|
27
|
+
if (!tile || !row)
|
|
28
|
+
return;
|
|
29
|
+
const left = tile.offsetLeft - row.offsetLeft;
|
|
30
|
+
if (left < row.scrollLeft || left + tile.offsetWidth > row.scrollLeft + row.clientWidth)
|
|
31
|
+
row.scrollTo({ left: Math.max(0, left - 8) });
|
|
32
|
+
}, [layout, value, open.length]);
|
|
33
|
+
const keys = (e) => {
|
|
34
|
+
const from = e.target;
|
|
35
|
+
if (!from.matches(TILE))
|
|
36
|
+
return;
|
|
37
|
+
const all = [...(box.current?.querySelectorAll(TILE) ?? [])];
|
|
38
|
+
const at = all.indexOf(from);
|
|
39
|
+
if (at < 0)
|
|
40
|
+
return;
|
|
41
|
+
// Up and Down: the nearest line of tiles above or below, then the tile in it nearest across.
|
|
42
|
+
const vertical = (down) => {
|
|
43
|
+
const r = from.getBoundingClientRect();
|
|
44
|
+
const mid = r.left + r.width / 2;
|
|
45
|
+
const beyond = all
|
|
46
|
+
.map((el) => ({ el, r: el.getBoundingClientRect() }))
|
|
47
|
+
.filter((c) => (down ? c.r.top >= r.bottom - 2 : c.r.bottom <= r.top + 2));
|
|
48
|
+
if (!beyond.length)
|
|
49
|
+
return at;
|
|
50
|
+
const line = down
|
|
51
|
+
? Math.min(...beyond.map((c) => c.r.top))
|
|
52
|
+
: Math.max(...beyond.map((c) => c.r.bottom));
|
|
53
|
+
const near = beyond
|
|
54
|
+
.filter((c) => Math.abs((down ? c.r.top : c.r.bottom) - line) < 4)
|
|
55
|
+
.sort((a, b) => Math.abs(a.r.left + a.r.width / 2 - mid) -
|
|
56
|
+
Math.abs(b.r.left + b.r.width / 2 - mid))[0];
|
|
57
|
+
return all.indexOf(near.el);
|
|
58
|
+
};
|
|
59
|
+
const move = {
|
|
60
|
+
ArrowRight: () => at + 1,
|
|
61
|
+
ArrowLeft: () => at - 1,
|
|
62
|
+
ArrowDown: () => vertical(true),
|
|
63
|
+
ArrowUp: () => vertical(false),
|
|
64
|
+
Home: () => 0,
|
|
65
|
+
End: () => all.length - 1,
|
|
66
|
+
};
|
|
67
|
+
const to = move[e.key];
|
|
68
|
+
if (!to)
|
|
69
|
+
return;
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
all[Math.max(0, Math.min(all.length - 1, to()))]?.focus();
|
|
72
|
+
};
|
|
73
|
+
return (_jsx("div", { ...rest, ref: box, role: "group", "aria-label": label, className: ['newtone-look-picker', className].filter(Boolean).join(' '), "data-layout": layout === 'row' ? 'row' : undefined, style: {
|
|
74
|
+
...style,
|
|
75
|
+
['--newtone-look-picker-min']: `${minTile}px`,
|
|
76
|
+
['--newtone-look-picker-ratio']: String(ratio),
|
|
77
|
+
}, onKeyDown: keys, children: shown.map((g) => (_jsxs("div", { role: "group", "aria-label": g.title, className: "newtone-look-picker-group", children: [g.title ? (_jsx(Text, { as: "p", scale: "caption", weight: "medium", tone: "secondary", lines: 1, className: "newtone-look-picker-title", "aria-hidden": "true", children: g.title })) : null, _jsx("div", { className: "newtone-look-picker-tiles", children: g.tiles.map((t) => {
|
|
78
|
+
const chosen = t.id === value;
|
|
79
|
+
return (_jsxs("button", { type: "button", className: "newtone-look-picker-tile", "data-newtone-tile": t.id, "data-chosen": chosen ? '' : undefined, "aria-pressed": chosen, disabled: t.disabled, tabIndex: t.id === stop ? 0 : -1, onFocus: () => setFocused(t.id), onClick: () => onPick(t.id), children: [_jsx("span", { className: "newtone-look-picker-thumb", "aria-hidden": "true", children: t.thumb }), _jsx(Text, { as: "span", scale: "body-sm", lines: 1, children: t.name }), t.tags ? (_jsx("span", { className: "newtone-look-picker-tags", children: t.tags })) : null] }, t.id));
|
|
80
|
+
}) })] }, g.id))) }));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=look-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-picker.js","sourceRoot":"","sources":["../../src/look-picker/look-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,qHAAqH;AACrH,mHAAmH;AACnH,kHAAkH;AAClH,wHAAwH;AACxH,qHAAqH;AACrH,6CAA6C;AAE7C,OAAO,EACH,SAAS,EACT,MAAM,EACN,QAAQ,GAIX,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AA6CtC,MAAM,IAAI,GAAG,0CAA0C,CAAA;AAEvD,MAAM,UAAU,UAAU,CAAC,EACvB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,GAAG,MAAM,EACf,KAAK,GAAG,EAAE,GAAG,CAAC,EACd,OAAO,GAAG,GAAG,EACb,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACO;IACd,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAA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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/look-thumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/look-thumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* LookThumb -- blueprint components/look-thumb.md. A look's picture, filling the box it is given (a tile's preview,
|
|
2
|
+
* a picker's thumb), cropped to cover. Its colours and families are the look's data, set on the picture itself. */
|
|
3
|
+
.newtone-look-thumb {
|
|
4
|
+
display: block;
|
|
5
|
+
inline-size: 100%;
|
|
6
|
+
block-size: 100%;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SVGAttributes } from 'react';
|
|
2
|
+
/** A look's data, as the consumer resolved it. Colours are CSS colours; families are CSS family names. */
|
|
3
|
+
export interface LookThumbLook {
|
|
4
|
+
/** The ground the look is shown on (its white or default surface). */
|
|
5
|
+
paper: string;
|
|
6
|
+
/** Its primary text colour on `paper`. */
|
|
7
|
+
ink: string;
|
|
8
|
+
/** Its secondary text colour on `paper`; `ink` unless given. */
|
|
9
|
+
quiet?: string;
|
|
10
|
+
/** Its other grounds (accent, dark, tinted, off-white), in order, drawn as strips down the right edge. */
|
|
11
|
+
grounds?: readonly string[];
|
|
12
|
+
/** The families for headings and for words; the page's serif and sans-serif while unset. */
|
|
13
|
+
display?: string | null;
|
|
14
|
+
body?: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface LookThumbProps extends Omit<SVGAttributes<SVGSVGElement>, 'children'> {
|
|
17
|
+
look: LookThumbLook;
|
|
18
|
+
/** The name said under "Aa", in the body family; a long one ends in an ellipsis. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The address of its logo, drawn top left when it has one. */
|
|
21
|
+
logo?: string;
|
|
22
|
+
/** What the display family is shown by: "Aa" unless given. */
|
|
23
|
+
sample?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A look's picture. Blueprint components/look-thumb.md. */
|
|
26
|
+
export declare function LookThumb({ look, name, logo, sample, className, ...rest }: LookThumbProps): import("react").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=look-thumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-thumb.d.ts","sourceRoot":"","sources":["../../src/look-thumb/look-thumb.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,0GAA0G;AAC1G,MAAM,WAAW,aAAa;IAC1B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAA;IACX,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0GAA0G;IAC1G,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC;IAClF,IAAI,EAAE,aAAa,CAAA;IACnB,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AAYD,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAa,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,+BAoDhG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The picture's own lengths, in its 320 × 180 box.
|
|
3
|
+
const W = 320;
|
|
4
|
+
const H = 180;
|
|
5
|
+
const STRIP = 30;
|
|
6
|
+
const NAME_MAX = 24;
|
|
7
|
+
// A family as SVG draws it: itself, then the generic one while its faces arrive.
|
|
8
|
+
const family = (name, fallback) => name ? `"${name.replace(/"/g, '')}", ${fallback}` : fallback;
|
|
9
|
+
/** A look's picture. Blueprint components/look-thumb.md. */
|
|
10
|
+
export function LookThumb({ look, name, logo, sample = 'Aa', className, ...rest }) {
|
|
11
|
+
const grounds = look.grounds ?? [];
|
|
12
|
+
const said = name.length > NAME_MAX ? `${name.slice(0, NAME_MAX - 1).trimEnd()}…` : name;
|
|
13
|
+
return (_jsxs("svg", { ...rest, className: ['newtone-look-thumb', className].filter(Boolean).join(' '), viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "xMidYMid slice", "aria-hidden": "true", children: [_jsx("rect", { width: W, height: H, fill: look.paper }), logo ? (_jsx("image", { href: logo, x: "20", y: "18", width: "150", height: "34", preserveAspectRatio: "xMinYMid meet" })) : null, _jsx("text", { x: "20", y: "130", fill: look.ink, fontFamily: family(look.display, 'serif'), fontSize: 60, children: sample }), _jsx("text", { x: "20", y: "156", fill: look.quiet ?? look.ink, fontFamily: family(look.body, 'system-ui, sans-serif'), fontSize: 13, children: said }), grounds.map((c, i) => (_jsx("rect", { x: W - STRIP * (grounds.length - i), y: "0", width: STRIP, height: H, fill: c }, i)))] }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=look-thumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look-thumb.js","sourceRoot":"","sources":["../../src/look-thumb/look-thumb.tsx"],"names":[],"mappings":";AAiC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M,EAAC,IAAI,EACX,mBAAmB,EAAC,eAAe,GACrC,CACL,CAAC,CAAC,CAAC,IAAI,EACR,eACI,CAAC,EAAC,IAAI,EACN,CAAC,EAAC,KAAK,EACP,IAAI,EAAE,IAAI,CAAC,GAAG,EACd,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,EACzC,QAAQ,EAAE,EAAE,YAEX,MAAM,GACJ,EACP,eACI,CAAC,EAAC,IAAI,EACN,CAAC,EAAC,KAAK,EACP,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAC5B,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,EACtD,QAAQ,EAAE,EAAE,YAEX,IAAI,GACF,EACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,eAEI,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EACnC,CAAC,EAAC,GAAG,EACL,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,CAAC,IALF,CAAC,CAMR,CACL,CAAC,IACA,CACT,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/material/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/material/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* Material -- blueprint components/material.md, contract contracts/material.md. What a part is made of (Joshua
|
|
2
|
+
* 2026-11-11): glass, the translucent control layer; crystal, the inset screen content sits on; solid, the default.
|
|
3
|
+
*
|
|
4
|
+
* THIS IS THE ONLY SHEET THAT NAMES `material.*`, `blur.*`, `shadow.close`, `shadow.far` OR `backdrop-filter`
|
|
5
|
+
* (on-media keeps its own vocabulary for photographs). A part never draws glass itself: it wears a recipe class, and
|
|
6
|
+
* the class does nothing outside a glass boundary.
|
|
7
|
+
*
|
|
8
|
+
* WHERE IT APPLIES IS SET BY THE BOUNDARY, NOT BY WHERE A PART SITS. A boundary is `data-newtone-material` on an
|
|
9
|
+
* element (`<Material>`, or a part that is one by what it is: Canvas.Dock, a Workbench foot). Every glass rule sits in
|
|
10
|
+
* one `@scope` from a glass boundary down to the next boundary of another material, so the nearest one wins and a
|
|
11
|
+
* `solid` one (an Inspector, a FloatingBar.Panel) ends the glass above it. `:where(:scope, *)` lets a rule match the
|
|
12
|
+
* boundary itself as well as what is under it, at no specificity of its own.
|
|
13
|
+
*
|
|
14
|
+
* THE FOUR RECIPES (Joshua 2026-11-11):
|
|
15
|
+
* --bar a FloatingBar pill: glass.regular (surface.secondary at 72%), blur.regular (16px), the lit edge, close
|
|
16
|
+
* --menu a menu over the glass: glass.thick (surface.primary at 84%), blur.thick (24px), the lit edge, close + far
|
|
17
|
+
* --field the prompt field: glass.regular, no edge, no shadow; solid while focused
|
|
18
|
+
* --action the raised primary: glass.accent (the primary fill at 88%), blur.regular, the lit edge, close
|
|
19
|
+
* A QuickAction on the glass is raised: `primary` wears --action; `neutral` the bar's wash, edge and shadow, with the
|
|
20
|
+
* glass's veils for hover and press (Joshua 2026-11-11).
|
|
21
|
+
*
|
|
22
|
+
* Private properties are spelled --_material-*. */
|
|
23
|
+
|
|
24
|
+
.newtone-material {
|
|
25
|
+
display: contents;
|
|
26
|
+
}
|
|
27
|
+
/* A crystal boundary is a screen, so it has a box to draw on (Joshua 2026-11-11): the bezel, the ground and the inset
|
|
28
|
+
* shadow need one. Glass and solid stay boxless, safe in a flex row. The consumer sizes it. */
|
|
29
|
+
.newtone-material[data-newtone-material='crystal'] {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* The shadows, cast in black (material.cast, Joshua 2026-11-11), so they read as shadows in dark mode too, where the
|
|
34
|
+
* ink-tinted `raised` read as a glow. Written where a boundary is, and inherited.
|
|
35
|
+
* close the contact (y1 b2 s1 at 10%) under the ambient (y2 b4 s2 at 5%): the bars' and the slide's
|
|
36
|
+
* far y12 b32 at 12%: what a menu adds, standing further off */
|
|
37
|
+
[data-newtone-material],
|
|
38
|
+
.newtone-material-cast-close {
|
|
39
|
+
--_material-contact: 0 var(--newtone-shadow-close-contact-y) var(--newtone-shadow-close-contact-blur) var(--newtone-shadow-close-contact-spread)
|
|
40
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-contact), transparent);
|
|
41
|
+
--_material-close:
|
|
42
|
+
0 var(--newtone-shadow-close-ambient-y) var(--newtone-shadow-close-ambient-blur) var(--newtone-shadow-close-ambient-spread)
|
|
43
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-ambient), transparent),
|
|
44
|
+
var(--_material-contact);
|
|
45
|
+
--_material-far: 0 var(--newtone-shadow-far-ambient-y) var(--newtone-shadow-far-ambient-blur) var(--newtone-shadow-far-ambient-spread)
|
|
46
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-far-strength-ambient), transparent);
|
|
47
|
+
--_material-lit: linear-gradient(180deg, var(--newtone-material-edge-top-border), var(--newtone-material-edge-foot-border));
|
|
48
|
+
}
|
|
49
|
+
/* The close shadow for a solid part that stands off what it is on (Canvas.Frame `card`, the slide; Joshua 2026-11-09). */
|
|
50
|
+
.newtone-material-cast-close {
|
|
51
|
+
box-shadow: var(--_material-close);
|
|
52
|
+
}
|
|
53
|
+
/* Solid parts that stand off what they are on, cast here because this is the only sheet that names the close and far
|
|
54
|
+
* shadows (Joshua 2026-11-11: every shadow from one place). Their own sheets keep everything else and point here. */
|
|
55
|
+
.newtone-split-rail-list[data-expand='hover']:is(:hover, :has(:focus-visible)),
|
|
56
|
+
.newtone-slide-list-ghost {
|
|
57
|
+
--_material-contact: 0 var(--newtone-shadow-close-contact-y) var(--newtone-shadow-close-contact-blur) var(--newtone-shadow-close-contact-spread)
|
|
58
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-contact), transparent);
|
|
59
|
+
--_material-close:
|
|
60
|
+
0 var(--newtone-shadow-close-ambient-y) var(--newtone-shadow-close-ambient-blur) var(--newtone-shadow-close-ambient-spread)
|
|
61
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-ambient), transparent),
|
|
62
|
+
var(--_material-contact);
|
|
63
|
+
--_material-far: 0 var(--newtone-shadow-far-ambient-y) var(--newtone-shadow-far-ambient-blur) var(--newtone-shadow-far-ambient-spread)
|
|
64
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-far-strength-ambient), transparent);
|
|
65
|
+
}
|
|
66
|
+
/* The widened rail: its divider's hairline just outside it, then the close shadow (was twice close, hand-drawn). */
|
|
67
|
+
.newtone-split-rail-list[data-expand='hover']:is(:hover, :has(:focus-visible)) {
|
|
68
|
+
box-shadow:
|
|
69
|
+
1px 0 0 0 var(--newtone-role-divider-secondary),
|
|
70
|
+
var(--_material-close);
|
|
71
|
+
}
|
|
72
|
+
/* A slide or section being dragged: the accent ring, then close + far, as a menu stands (was 0 4px 12px 15%). */
|
|
73
|
+
.newtone-slide-list-ghost:is([data-what='slide'], [data-what='section']) {
|
|
74
|
+
box-shadow:
|
|
75
|
+
0 0 0 2px var(--newtone-role-text-accent),
|
|
76
|
+
var(--_material-close),
|
|
77
|
+
var(--_material-far);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ---- Glass ---------------------------------------------------------------------------------------------------- */
|
|
81
|
+
@scope ([data-newtone-material='glass']) to ([data-newtone-material]:not([data-newtone-material='glass'])) {
|
|
82
|
+
/* What an item on the glass wears (a bar's tool, a menu's row, a quiet button): the regular glass's ink and veils
|
|
83
|
+
* unless a menu under it says the thick one's. */
|
|
84
|
+
:scope {
|
|
85
|
+
--_material-item-ink: var(--newtone-material-glass-regular-text);
|
|
86
|
+
--_material-item-hover: var(--newtone-material-glass-regular-item-hover-fill);
|
|
87
|
+
--_material-item-pressed: var(--newtone-material-glass-regular-item-pressed-fill);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* The recipe, once. A Button or Action `primary` wears the raised form without a class: both stay server
|
|
91
|
+
* components, and the boundary reaches them. */
|
|
92
|
+
:where(:scope, *):is(.newtone-glass--bar, .newtone-glass--menu, .newtone-glass--field, .newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action) {
|
|
93
|
+
--_material-paint: var(--_material-wash);
|
|
94
|
+
border-color: transparent;
|
|
95
|
+
background:
|
|
96
|
+
linear-gradient(var(--_material-paint), var(--_material-paint)) padding-box,
|
|
97
|
+
var(--_material-edge) border-box;
|
|
98
|
+
-webkit-backdrop-filter: blur(var(--_material-blur));
|
|
99
|
+
backdrop-filter: blur(var(--_material-blur));
|
|
100
|
+
box-shadow: var(--_material-shadow);
|
|
101
|
+
color: var(--_material-ink);
|
|
102
|
+
}
|
|
103
|
+
:where(:scope, *).newtone-glass--bar {
|
|
104
|
+
--_material-wash: var(--newtone-material-glass-regular-fill);
|
|
105
|
+
--_material-blur: var(--newtone-blur-regular);
|
|
106
|
+
--_material-edge: var(--_material-lit);
|
|
107
|
+
--_material-shadow: var(--_material-close);
|
|
108
|
+
--_material-ink: var(--newtone-material-glass-regular-text);
|
|
109
|
+
}
|
|
110
|
+
/* Rows of words sit on a menu, so its frost is denser than a bar's (Joshua 2026-11-10). */
|
|
111
|
+
:where(:scope, *).newtone-glass--menu {
|
|
112
|
+
--_material-wash: var(--newtone-material-glass-thick-fill);
|
|
113
|
+
--_material-blur: var(--newtone-blur-thick);
|
|
114
|
+
--_material-edge: var(--_material-lit);
|
|
115
|
+
--_material-shadow: var(--_material-close), var(--_material-far);
|
|
116
|
+
--_material-ink: var(--newtone-material-glass-thick-text);
|
|
117
|
+
--_material-item-ink: var(--newtone-material-glass-thick-text);
|
|
118
|
+
--_material-item-hover: var(--newtone-material-glass-thick-item-hover-fill);
|
|
119
|
+
--_material-item-pressed: var(--newtone-material-glass-thick-item-pressed-fill);
|
|
120
|
+
}
|
|
121
|
+
/* The words at rest are quieter than pure ink (75%); solid while focused, so what is typed is plain. */
|
|
122
|
+
:where(:scope, *).newtone-glass--field {
|
|
123
|
+
--_material-wash: var(--newtone-material-glass-regular-fill);
|
|
124
|
+
--_material-blur: var(--newtone-blur-regular);
|
|
125
|
+
--_material-edge: linear-gradient(var(--_material-paint), var(--_material-paint));
|
|
126
|
+
--_material-shadow: none;
|
|
127
|
+
--_material-ink: var(--newtone-material-glass-regular-rest-text);
|
|
128
|
+
}
|
|
129
|
+
:where(:scope, *).newtone-glass--field:focus-within {
|
|
130
|
+
--_material-paint: var(--newtone-role-surface-secondary);
|
|
131
|
+
--_material-blur: 0px;
|
|
132
|
+
--_material-ink: var(--newtone-role-text-primary);
|
|
133
|
+
}
|
|
134
|
+
:where(:scope, *):is(.newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action--primary) {
|
|
135
|
+
--_material-wash: var(--newtone-material-glass-accent-rest-fill);
|
|
136
|
+
--_material-blur: var(--newtone-blur-regular);
|
|
137
|
+
--_material-edge: var(--_material-lit);
|
|
138
|
+
--_material-shadow: var(--_material-close);
|
|
139
|
+
--_material-ink: var(--newtone-button-primary-rest-text);
|
|
140
|
+
}
|
|
141
|
+
:where(:scope, *):is(.newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action--primary):hover {
|
|
142
|
+
--_material-wash: var(--newtone-material-glass-accent-hover-fill);
|
|
143
|
+
--_material-ink: var(--newtone-button-primary-hover-text);
|
|
144
|
+
}
|
|
145
|
+
/* Pressed, it sits down: the contact shadow only. */
|
|
146
|
+
:where(:scope, *):is(.newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action--primary):is(:active, [aria-pressed='true']) {
|
|
147
|
+
--_material-wash: var(--newtone-material-glass-accent-pressed-fill);
|
|
148
|
+
--_material-shadow: var(--_material-contact);
|
|
149
|
+
--_material-ink: var(--newtone-button-primary-pressed-text);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* A neutral QuickAction on the glass: raised as a bar is (its wash, the lit edge, close), the glass's ink, and the
|
|
153
|
+
* glass's veils laid over the wash for hover and press. Pressed, it sits down to the contact shadow. */
|
|
154
|
+
:where(:scope, *).newtone-quick-action:not(.newtone-quick-action--primary) {
|
|
155
|
+
--_material-wash: var(--newtone-material-glass-regular-fill);
|
|
156
|
+
--_material-blur: var(--newtone-blur-regular);
|
|
157
|
+
--_material-edge: var(--_material-lit);
|
|
158
|
+
--_material-shadow: var(--_material-close);
|
|
159
|
+
--_material-ink: var(--newtone-material-glass-regular-text);
|
|
160
|
+
--_material-veil: transparent;
|
|
161
|
+
background:
|
|
162
|
+
linear-gradient(var(--_material-veil), var(--_material-veil)) padding-box,
|
|
163
|
+
linear-gradient(var(--_material-paint), var(--_material-paint)) padding-box,
|
|
164
|
+
var(--_material-edge) border-box;
|
|
165
|
+
}
|
|
166
|
+
:where(:scope, *).newtone-quick-action:not(.newtone-quick-action--primary):hover {
|
|
167
|
+
--_material-veil: var(--newtone-material-glass-regular-item-hover-fill);
|
|
168
|
+
}
|
|
169
|
+
:where(:scope, *).newtone-quick-action:not(.newtone-quick-action--primary):is(:active, [aria-pressed='true']) {
|
|
170
|
+
--_material-veil: var(--newtone-material-glass-regular-item-pressed-fill);
|
|
171
|
+
--_material-shadow: var(--_material-contact);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* A prompt field's hint and its glyphs on the glass: quieter than its words (hint.text, 50%). Focused, it is solid,
|
|
175
|
+
* and they take the secondary text role. */
|
|
176
|
+
:where(:scope, *).newtone-glass--field:not(:focus-within) :is(.newtone-prompt-field-hint, .newtone-prompt-field-slot),
|
|
177
|
+
:where(:scope, *).newtone-glass--field:not(:focus-within) .newtone-prompt-field-input::placeholder {
|
|
178
|
+
color: var(--newtone-material-glass-regular-hint-text);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* A quiet button on the glass (Button `secondary` and `tertiary`, Action `secondary`): the glass's ink and veils. */
|
|
182
|
+
:where(:scope, *):is(.newtone-button--secondary, .newtone-button--tertiary, .newtone-action--secondary):not(:disabled) {
|
|
183
|
+
color: var(--_material-item-ink);
|
|
184
|
+
}
|
|
185
|
+
:where(:scope, *):is(.newtone-button--secondary, .newtone-button--tertiary, .newtone-action--secondary):not(:disabled):hover {
|
|
186
|
+
background: var(--_material-item-hover);
|
|
187
|
+
color: var(--_material-item-ink);
|
|
188
|
+
}
|
|
189
|
+
:where(:scope, *):is(.newtone-button--secondary, .newtone-button--tertiary, .newtone-action--secondary):not(:disabled):active {
|
|
190
|
+
background: var(--_material-item-pressed);
|
|
191
|
+
color: var(--_material-item-ink);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* FloatingBar's tools on the glass: the glass's ink, its veils for hover and press. A tool drawn as a Button
|
|
195
|
+
* (`variant`) keeps the Button's own colours. */
|
|
196
|
+
.newtone-floating-bar-tool:not([data-variant]) {
|
|
197
|
+
color: var(--_material-item-ink);
|
|
198
|
+
}
|
|
199
|
+
.newtone-floating-bar-tool:not([data-variant], :disabled):where(:hover, [data-open]) {
|
|
200
|
+
background: var(--_material-item-hover);
|
|
201
|
+
}
|
|
202
|
+
.newtone-floating-bar-tool:not([data-variant], :disabled):where(:active) {
|
|
203
|
+
background: var(--_material-item-pressed);
|
|
204
|
+
}
|
|
205
|
+
/* The current or chosen tool: a dome (Joshua 2026-11-10), its own fill shaded from dark at the top to light at the
|
|
206
|
+
* foot: the selection's fill with 12% black at the top and 24% white at the foot, as Joshua drew it (2026-11-10;
|
|
207
|
+
* kept over palette steps on the tuning page, 2026-11-11). The component draws the mix, so no token holds it. Ringed in the divider's colour, as the gap between
|
|
208
|
+
* the window's panels, so it reads as set into the bar. Inset, so the tool keeps its size. A `neutral` current one
|
|
209
|
+
* (a view) is the secondary surface's dome. */
|
|
210
|
+
.newtone-floating-bar-tool[aria-pressed='true'] {
|
|
211
|
+
--_dome: var(--newtone-selection-fill);
|
|
212
|
+
background: linear-gradient(180deg, color-mix(in oklab, var(--_dome), black 12%), color-mix(in oklab, var(--_dome), white 24%));
|
|
213
|
+
box-shadow: inset 0 0 0 1px var(--newtone-role-divider-secondary);
|
|
214
|
+
}
|
|
215
|
+
.newtone-floating-bar-tool[aria-pressed='true'][data-neutral] {
|
|
216
|
+
--_dome: var(--newtone-role-surface-secondary);
|
|
217
|
+
}
|
|
218
|
+
/* The chosen tool's glyph (Joshua 2026-11-10): filled, in the accent's words colour, so the tool in use reads at a
|
|
219
|
+
* glance. A `neutral` current one keeps its outline and its ink. Icon writes FILL on the element itself, so the axes
|
|
220
|
+
* are restated with FILL at 1, the others as icon.css sets them. */
|
|
221
|
+
.newtone-floating-bar-tool[aria-pressed='true']:not([data-neutral]) .newtone-icon {
|
|
222
|
+
color: var(--newtone-role-text-accent);
|
|
223
|
+
font-variation-settings:
|
|
224
|
+
'FILL' 1,
|
|
225
|
+
'wght' var(--newtone-icon-weight),
|
|
226
|
+
'GRAD' 0,
|
|
227
|
+
'opsz' clamp(var(--newtone-icon-opsz-min), var(--newtone-icon-px), var(--newtone-icon-opsz-max));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* A menu's rows on the glass: the menu's veil under the one pointed at, kept or opened. `danger` keeps its colour. */
|
|
231
|
+
.newtone-pop-menu-row:not(:disabled):where(:hover, :focus-visible) {
|
|
232
|
+
background: var(--_material-item-hover);
|
|
233
|
+
}
|
|
234
|
+
.newtone-pop-menu-row:not(:disabled):where(:active) {
|
|
235
|
+
background: var(--_material-item-pressed);
|
|
236
|
+
}
|
|
237
|
+
.newtone-app-frame-menu-item:is(:hover, :focus-visible),
|
|
238
|
+
.newtone-app-frame-menu-item.newtone-app-frame-main-menu-row[data-open] {
|
|
239
|
+
background: var(--_material-item-hover);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* Where the glass cannot be seen through (no backdrop-filter) or should not be (reduced transparency), each recipe
|
|
244
|
+
* is its own wash at full strength and nothing is blurred: the same colour, opaque. With more contrast asked for, also
|
|
245
|
+
* the quieter ink goes to pure ink. */
|
|
246
|
+
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
|
247
|
+
@scope ([data-newtone-material='glass']) to ([data-newtone-material]:not([data-newtone-material='glass'])) {
|
|
248
|
+
:where(:scope, *):is(.newtone-glass--bar, .newtone-glass--menu, .newtone-glass--field, .newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action) {
|
|
249
|
+
--_material-paint: oklch(from var(--_material-wash) l c h / 1);
|
|
250
|
+
--_material-blur: 0px;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
|
|
255
|
+
@scope ([data-newtone-material='glass']) to ([data-newtone-material]:not([data-newtone-material='glass'])) {
|
|
256
|
+
:where(:scope, *):is(.newtone-glass--bar, .newtone-glass--menu, .newtone-glass--field, .newtone-glass--action, .newtone-button--primary:not(:disabled), .newtone-action:not(.newtone-action--secondary), .newtone-quick-action) {
|
|
257
|
+
--_material-paint: oklch(from var(--_material-wash) l c h / 1);
|
|
258
|
+
--_material-blur: 0px;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
@media (prefers-contrast: more) {
|
|
263
|
+
@scope ([data-newtone-material='glass']) to ([data-newtone-material]:not([data-newtone-material='glass'])) {
|
|
264
|
+
:where(:scope, *).newtone-glass--field {
|
|
265
|
+
--_material-ink: var(--newtone-material-glass-regular-text);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* ---- Crystal -------------------------------------------------------------------------------------------------- */
|
|
271
|
+
/* An inset screen with bezels (Joshua 2026-11-11), what content sits on: Show's slide area. Its ground is the deep
|
|
272
|
+
* rung's primary surface, what C2 stood on before (a role, so no token of its own; not the secondary: glass mixes
|
|
273
|
+
* the secondary, so a PromptField on it vanished, Joshua 2026-11-11); its bezel the lit edge reversed, dark at the
|
|
274
|
+
* top and light at the foot, so it reads as set in; and the close shadow cast inward, over what is on it.
|
|
275
|
+
* 1px the bezel
|
|
276
|
+
* radius.md its corners */
|
|
277
|
+
[data-newtone-material='crystal'] {
|
|
278
|
+
position: relative;
|
|
279
|
+
box-sizing: border-box;
|
|
280
|
+
border: 1px solid transparent;
|
|
281
|
+
border-radius: var(--newtone-radius-md);
|
|
282
|
+
background:
|
|
283
|
+
linear-gradient(var(--newtone-role-surface-primary), var(--newtone-role-surface-primary)) padding-box,
|
|
284
|
+
linear-gradient(180deg, var(--newtone-material-crystal-bezel-top-border), var(--newtone-material-crystal-bezel-foot-border)) border-box;
|
|
285
|
+
}
|
|
286
|
+
/* The inset shadow over what is on the screen (a canvas paints its own ground over the screen's background), under the
|
|
287
|
+
* bars that float on it, and never in the way of a press. */
|
|
288
|
+
[data-newtone-material='crystal']::after {
|
|
289
|
+
content: '';
|
|
290
|
+
position: absolute;
|
|
291
|
+
inset: 0;
|
|
292
|
+
z-index: 4;
|
|
293
|
+
border-radius: calc(var(--newtone-radius-md) - 1px);
|
|
294
|
+
box-shadow:
|
|
295
|
+
inset 0 var(--newtone-shadow-close-ambient-y) var(--newtone-shadow-close-ambient-blur) var(--newtone-shadow-close-ambient-spread)
|
|
296
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-ambient), transparent),
|
|
297
|
+
inset 0 var(--newtone-shadow-close-contact-y) var(--newtone-shadow-close-contact-blur) var(--newtone-shadow-close-contact-spread)
|
|
298
|
+
color-mix(in oklab, var(--newtone-material-cast-fill) var(--newtone-shadow-close-strength-contact), transparent);
|
|
299
|
+
pointer-events: none;
|
|
300
|
+
}
|
|
301
|
+
@scope ([data-newtone-material='crystal']) to ([data-newtone-material]:not([data-newtone-material='crystal'])) {
|
|
302
|
+
/* A canvas with no ground of its own shows the screen's, and dims outside its frame with it. */
|
|
303
|
+
.newtone-canvas:where([data-ground='none']) {
|
|
304
|
+
--_canvas-ground: var(--newtone-role-surface-primary);
|
|
305
|
+
}
|
|
306
|
+
}
|