@popcorn245/cornfield 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/core/color.js +38 -8
- package/core/contrast.js +3 -3
- package/core/layers.js +8 -0
- package/core/map-tokens.js +83 -0
- package/core/validate.js +4 -2
- package/explorer/css-color.js +99 -0
- package/explorer/explorer.css +89 -56
- package/explorer/layers.js +83 -35
- package/explorer/map-style.js +10 -71
- package/explorer/scene.js +10 -2
- package/explorer/tokens.css +12 -0
- package/package.json +1 -1
package/core/color.js
CHANGED
|
@@ -14,14 +14,36 @@
|
|
|
14
14
|
* toHex([r,g,b]) '#rrggbb'
|
|
15
15
|
*
|
|
16
16
|
* Read: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` / `rgba()` and `hsl()` / `hsla()` (comma or space syntax, an optional `/ alpha`,
|
|
17
|
-
* percentages), `transparent`, the
|
|
18
|
-
* (`oklch()`, `var()`, `calc()`, `currentcolor`, `auto`) is not read, nor a `color-mix()` nested more than MAX_MIX_DEPTH deep, nor text over MAX_COLOR_CHARS.
|
|
17
|
+
* percentages), `transparent`, the 148 CSS named colours, and `color-mix(in srgb, A p%, B [p%])` (of any of these, nested). Anything else
|
|
18
|
+
* (`oklch()`, `hwb()`, `lab()`, `color()`, the system colours, `var()`, `calc()`, `currentcolor`, `auto`) is not read, nor a `color-mix()` nested more than MAX_MIX_DEPTH deep, nor text over MAX_COLOR_CHARS.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/** The 148 CSS named colours (CSS Color 4), as a browser reads them: a name the map draws is a name validate reads */
|
|
21
22
|
const NAMED = Object.freeze({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4',
|
|
24
|
+
black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0',
|
|
25
|
+
chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff',
|
|
26
|
+
darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgreen: '#006400', darkgrey: '#a9a9a9',
|
|
27
|
+
darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000',
|
|
28
|
+
darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f',
|
|
29
|
+
darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969',
|
|
30
|
+
dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc',
|
|
31
|
+
ghostwhite: '#f8f8ff', gold: '#ffd700', goldenrod: '#daa520', gray: '#808080', green: '#008000', greenyellow: '#adff2f', grey: '#808080',
|
|
32
|
+
honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavender: '#e6e6fa',
|
|
33
|
+
lavenderblush: '#fff0f5', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff',
|
|
34
|
+
lightgoldenrodyellow: '#fafad2', lightgray: '#d3d3d3', lightgreen: '#90ee90', lightgrey: '#d3d3d3', lightpink: '#ffb6c1', lightsalmon: '#ffa07a',
|
|
35
|
+
lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de',
|
|
36
|
+
lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000',
|
|
37
|
+
mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370db', mediumseagreen: '#3cb371',
|
|
38
|
+
mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970',
|
|
39
|
+
mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000',
|
|
40
|
+
olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98',
|
|
41
|
+
paleturquoise: '#afeeee', palevioletred: '#db7093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd',
|
|
42
|
+
powderblue: '#b0e0e6', purple: '#800080', rebeccapurple: '#663399', red: '#ff0000', rosybrown: '#bc8f8f', royalblue: '#4169e1',
|
|
43
|
+
saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0',
|
|
44
|
+
skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f',
|
|
45
|
+
steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee',
|
|
46
|
+
wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32',
|
|
25
47
|
});
|
|
26
48
|
|
|
27
49
|
/** How deep `color-mix()` may nest: deeper is not read (a hostile stylesheet cannot make the parser crawl or overflow the stack) */
|
|
@@ -71,10 +93,18 @@ function hslToRgb(h, s, l) {
|
|
|
71
93
|
return [f(0) * 255, f(8) * 255, f(4) * 255];
|
|
72
94
|
}
|
|
73
95
|
|
|
74
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The arguments of rgb()/hsl() as [a, b, c, alpha?] strings, in one of the two shapes a browser reads: commas throughout (`1, 2, 3, 0.5`), or
|
|
98
|
+
* spaces with the alpha after a slash (`1 2 3 / 0.5`). Null for any other shape (`1 2 3 4`, `1, 2 3`), which the browser does not draw either.
|
|
99
|
+
*/
|
|
75
100
|
function fnParts(args) {
|
|
76
|
-
const
|
|
77
|
-
|
|
101
|
+
const t = args.trim();
|
|
102
|
+
if (t.includes(',')) {
|
|
103
|
+
const parts = t.split(/\s*,\s*/);
|
|
104
|
+
return (parts.length === 3 || parts.length === 4) && parts.every((p) => p && !/[\s/]/.test(p)) ? parts : null;
|
|
105
|
+
}
|
|
106
|
+
const m = /^(\S+)\s+(\S+)\s+([^\s/]+)(?:\s*\/\s*(\S+))?$/.exec(t);
|
|
107
|
+
return m && !m.slice(1, 4).some((p) => p.includes('/')) ? m.slice(1, m[4] === undefined ? 4 : 5) : null;
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
/** @returns {number[] | null} */
|
package/core/contrast.js
CHANGED
|
@@ -25,7 +25,7 @@ import { MAX_MIX_DEPTH, readColor, over, toHex, luminance, ratio, splitTop } fro
|
|
|
25
25
|
import { MAX_THEME_BYTES, cssProblems, withoutComments } from './theme.js';
|
|
26
26
|
import { MIN_SHAPE_DELTA_E, NODE_SHAPES, NODE_THEMES } from './schema.js';
|
|
27
27
|
import { deltaE2000 } from './delta-e.js';
|
|
28
|
-
import { LAYER_KEY_RE, MAX_KEY, parseKindToken } from './layers.js';
|
|
28
|
+
import { LAYER_KEY_RE, MAX_KEY, mapFillNames, parseKindToken } from './layers.js';
|
|
29
29
|
import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, markOpacity } from '../explorer/diff-marks.js';
|
|
30
30
|
import { lightColor } from '../explorer/theme-model.js';
|
|
31
31
|
|
|
@@ -311,7 +311,7 @@ function origin(props, name) {
|
|
|
311
311
|
return at;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
const READS = 'hex, rgb(), hsl(), color-mix(in srgb, …), transparent and the
|
|
314
|
+
const READS = 'hex, rgb(), hsl(), color-mix(in srgb, …), transparent and the CSS named colours';
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* A token (`--corn-text`) or a value (`color-mix(…)`) as `[r, g, b, a]`, or `{ problem }` naming the custom property that could not
|
|
@@ -529,7 +529,7 @@ function mapFindings(props, theme, mode, grounds, extra = []) {
|
|
|
529
529
|
const strokeOn = isColor(stroke.color) && !(Number.parseFloat(widthText) === 0);
|
|
530
530
|
for (const type of Object.keys(NODE_THEMES)) {
|
|
531
531
|
for (const group of MAP_GROUPS_OF(type)) {
|
|
532
|
-
const names =
|
|
532
|
+
const names = mapFillNames({ type, group }); // the map's own order (a kind and a project layer are checked on their own, below)
|
|
533
533
|
let name = null;
|
|
534
534
|
let fill = null;
|
|
535
535
|
let problem = null;
|
package/core/layers.js
CHANGED
|
@@ -88,6 +88,14 @@ const TYPE_SET = new Set(NODE_TYPES);
|
|
|
88
88
|
export const mapKindToken = (type, kind) => (TYPE_SET.has(type) && typeof kind === 'string' && kind.length <= MAX_KIND_NAME && KIND_NAME_RE.test(kind) ? `--corn-map-kind-${type}-${kind}` : null);
|
|
89
89
|
/** `--corn-map-group-<key>` for a layer key that passes LAYER_KEY_RE, else null */
|
|
90
90
|
export const mapGroupToken = (key) => (typeof key === 'string' && key.length <= MAX_KEY && LAYER_KEY_RE.test(key) ? `--corn-map-group-${key}` : null);
|
|
91
|
+
/**
|
|
92
|
+
* The tokens that can fill a node, most specific first (spec 0009 D6): its finer kind, its project layer, its type, its starting group. The one
|
|
93
|
+
* place the order is written: the map (explorer/map-style.js `fillOf`), the Layers menu's dots and `cornfield validate`'s contrast check
|
|
94
|
+
* (core/contrast.js) all read it.
|
|
95
|
+
* @param {{type: string, kind?: unknown, layer?: string | null, group?: string}} node
|
|
96
|
+
* @returns {string[]}
|
|
97
|
+
*/
|
|
98
|
+
export const mapFillNames = ({ type, kind, layer, group }) => [mapKindToken(type, kind), layer ? mapGroupToken(layer) : null, `--corn-map-node-${type}`, `--corn-map-group-${group || type}`].filter(Boolean);
|
|
91
99
|
/** Reads a kind token's name back: `{ type, kind }`, or null (the type is the part before the first "-") */
|
|
92
100
|
export function parseKindToken(name) {
|
|
93
101
|
const m = /^--corn-map-kind-([a-z]+)-([a-z0-9]+(?:-[a-z0-9]+)*)$/.exec(String(name));
|
package/core/map-tokens.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import { declaredProps, expand, projectGroupOf, resolveProps, themesToCheck } from './contrast.js';
|
|
10
10
|
import { iconKeyShape, parseKindToken } from './layers.js';
|
|
11
|
+
import { readColor } from './color.js';
|
|
12
|
+
import { MAX_NODE_COLOR_CHARS } from '../explorer/css-color.js';
|
|
11
13
|
import { EDGE_WIDTH_TOKEN, FONT_TOKEN, GLOW_TOKEN, LABEL_MIN_TOKEN, MAX_EDGE_WIDTH, MAX_GLOW, MAX_LABEL_MIN, readMapTokens } from '../explorer/map-style.js';
|
|
12
14
|
|
|
13
15
|
const WANTS = {
|
|
@@ -86,3 +88,84 @@ export function layerTokenWarnings(config, map) {
|
|
|
86
88
|
}
|
|
87
89
|
return out;
|
|
88
90
|
}
|
|
91
|
+
|
|
92
|
+
/** How many node colours are named one by one, per kind of line: past this, one line counts the rest */
|
|
93
|
+
export const MAX_NODE_COLOR_WARNINGS = 10;
|
|
94
|
+
const SHOWN_CHARS = 40;
|
|
95
|
+
|
|
96
|
+
/** What JSON leaves as it is but a terminal must not get raw: DEL and the C1 controls, and the invisible and bidirectional marks */
|
|
97
|
+
const UNSEEN = new RegExp('[\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2060-\\u206f\\ufeff\\ufff9-\\ufffb]', 'g');
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Project text as a terminal may print it: JSON-quoted (so a line break, an escape character and every other C0 control is `\n`, `\u001b`,
|
|
101
|
+
* ...), cut to `max` characters, and with the controls JSON leaves alone made visible too (DEL, the C1 controls such as U+009B, which some
|
|
102
|
+
* terminals read as an escape, and the invisible and bidirectional marks that could make a line read as something it is not).
|
|
103
|
+
* @param {unknown} v
|
|
104
|
+
* @param {number} [max]
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
export function quoted(v, max = SHOWN_CHARS) {
|
|
108
|
+
let t;
|
|
109
|
+
try { t = typeof v === 'string' ? v : JSON.stringify(v) ?? String(v); } catch { t = String(v); }
|
|
110
|
+
const chars = Array.from(t);
|
|
111
|
+
if (chars.length > max) t = `${chars.slice(0, max).join('')}...`;
|
|
112
|
+
return JSON.stringify(t).replace(UNSEEN, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Colour functions a current browser reads that core/color.js does not work out (it reads rgb() and hsl() only in their plainer forms) */
|
|
116
|
+
const UNCHECKED_FN = /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\(/i;
|
|
117
|
+
/** The CSS system colours (CSS Color 4, with the deprecated ones browsers still read): the map draws them, in the colour the device gives */
|
|
118
|
+
const SYSTEM_COLORS = new Set(('accentcolor accentcolortext activetext buttonborder buttonface buttontext canvas canvastext field fieldtext graytext highlight '
|
|
119
|
+
+ 'highlighttext linktext mark marktext selecteditem selecteditemtext visitedtext activeborder activecaption appworkspace background buttonhighlight '
|
|
120
|
+
+ 'buttonshadow captiontext inactiveborder inactivecaption inactivecaptiontext infobackground infotext menu menutext scrollbar threeddarkshadow '
|
|
121
|
+
+ 'threedface threedhighlight threedlightshadow threedshadow window windowframe windowtext').split(' '));
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* How `cornfield validate` can speak of a node's own `color`, which the map checks in the browser (explorer/css-color.js `nodeColor`):
|
|
125
|
+
* - `ok`: core/color.js reads it (hex, rgb(), hsl(), the 148 names, transparent, color-mix in srgb), so the browser does too;
|
|
126
|
+
* - `unchecked`: the shape of a colour a current browser reads that core/color.js cannot work out (`oklch()`, `lab()`, `hwb()`, `color()`,
|
|
127
|
+
* `color-mix()` in another space, rgb()/hsl() in a newer form, a system colour): the map draws it if it is valid, else the type's fill;
|
|
128
|
+
* - `bad`: no browser's map draws it (a typo, `#12345`, an empty string, a number, `currentcolor`, `var()`, `light-dark()`, which a canvas
|
|
129
|
+
* does not read, text over MAX_NODE_COLOR_CHARS): the map draws the type's fill.
|
|
130
|
+
* @param {unknown} value a node's `color`, not undefined
|
|
131
|
+
* @returns {'ok' | 'unchecked' | 'bad'}
|
|
132
|
+
*/
|
|
133
|
+
export function nodeColorClass(value) {
|
|
134
|
+
if (typeof value !== 'string' || value.length > MAX_NODE_COLOR_CHARS) return 'bad';
|
|
135
|
+
const s = value.trim();
|
|
136
|
+
if (!s || /currentcolor|light-dark\(|var\(|env\(|attr\(/i.test(s)) return 'bad'; // the map never draws these (explorer/css-color.js)
|
|
137
|
+
if (readColor(s)) return 'ok';
|
|
138
|
+
if (UNCHECKED_FN.test(s) && s.endsWith(')')) return 'unchecked';
|
|
139
|
+
return SYSTEM_COLORS.has(s.toLowerCase()) ? 'unchecked' : 'bad';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const nodesWithColor = (map, kind) => ((map && map.nodes) || []).filter((n) => n && n.color !== undefined && nodeColorClass(n.color) === kind);
|
|
143
|
+
const capped = (nodes, line, rest) => {
|
|
144
|
+
const out = nodes.slice(0, MAX_NODE_COLOR_WARNINGS).map(line);
|
|
145
|
+
if (nodes.length > MAX_NODE_COLOR_WARNINGS) out.push(rest(nodes.length - MAX_NODE_COLOR_WARNINGS, nodes.length));
|
|
146
|
+
return out;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A warning per node whose own `color` no browser's map draws (nodeColorClass `bad`): the map draws that node in its type's fill instead
|
|
151
|
+
* (explorer/scene.js `buildNodes`). The id and the value are printed as quoted text (`quoted`), at most MAX_NODE_COLOR_WARNINGS lines, then a count.
|
|
152
|
+
* @param {{ nodes?: { id?: unknown, color?: unknown }[] } | null} map the committed map
|
|
153
|
+
* @returns {string[]}
|
|
154
|
+
*/
|
|
155
|
+
export function nodeColorWarnings(map) {
|
|
156
|
+
return capped(nodesWithColor(map, 'bad'),
|
|
157
|
+
(n) => `node ${quoted(n.id)} has color ${quoted(n.color)}, which is not a colour the map reads: it draws in its type's fill. Write #rrggbb, rgb(), rgba() or hsl().`,
|
|
158
|
+
(more, all) => `${more} more nodes have a color the map does not read (${all} in all): they draw in their type's fill.`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A note per node whose own `color` validate cannot check (nodeColorClass `unchecked`: `oklch()`, `lab()`, a system colour, ...). Not a
|
|
163
|
+
* warning: a current browser draws a valid one, and only an invalid one falls back to the type's fill. Same form and cap as the warnings.
|
|
164
|
+
* @param {{ nodes?: { id?: unknown, color?: unknown }[] } | null} map the committed map
|
|
165
|
+
* @returns {string[]}
|
|
166
|
+
*/
|
|
167
|
+
export function nodeColorNotes(map) {
|
|
168
|
+
return capped(nodesWithColor(map, 'unchecked'),
|
|
169
|
+
(n) => `node ${quoted(n.id)} has color ${quoted(n.color)}, which validate cannot check: a current browser draws it if it is a valid colour, else the node draws in its type's fill.`,
|
|
170
|
+
(more, all) => `${more} more nodes have a color validate cannot check (${all} in all).`);
|
|
171
|
+
}
|
package/core/validate.js
CHANGED
|
@@ -24,7 +24,7 @@ import { deriveTopology } from './derive.js';
|
|
|
24
24
|
import { missingPaths, planSync } from './sync.js';
|
|
25
25
|
import { repoPaths, repoReader } from './repo.js';
|
|
26
26
|
import { checkThemeContrast } from './contrast.js';
|
|
27
|
-
import { layerTokenWarnings, mapTokenWarnings } from './map-tokens.js';
|
|
27
|
+
import { layerTokenWarnings, mapTokenWarnings, nodeColorNotes, nodeColorWarnings, quoted } from './map-tokens.js';
|
|
28
28
|
import { layersMapWarnings } from './layers.js';
|
|
29
29
|
import { BRAND_IMAGE_KEYS, brandAssetFile } from './brand.js';
|
|
30
30
|
import { MAX_THEME_BYTES, cssProblems, cssUrls, themeAssetFile, themeFileUrl, themeFiles, themeIconFileProblems, themeUrlTarget } from './theme.js';
|
|
@@ -113,7 +113,7 @@ export function validateTopology(topology, { requireExternalKind = true } = {})
|
|
|
113
113
|
errors.push(`Node "${node.id}" has unknown type: "${node.type}". Valid types: ${Object.keys(NODE_THEMES).join(', ')}`);
|
|
114
114
|
} else {
|
|
115
115
|
if (node.type === 'page') {
|
|
116
|
-
if (node.color !== NODE_THEMES.page.color) errors.push(`Page node "${node.id}" has color
|
|
116
|
+
if (node.color !== NODE_THEMES.page.color) errors.push(`Page node "${node.id}" has color ${quoted(node.color)}. All pages use "${NODE_THEMES.page.color}".`);
|
|
117
117
|
if (typeof node.label !== 'string' || !node.label.startsWith('/')) errors.push(`Page node "${node.id}" label "${node.label}" must start with a slash route (e.g. "/cart"). Put the file in 'file'.`);
|
|
118
118
|
else if (node.label.includes('.html')) errors.push(`Page node "${node.id}" label "${node.label}" contains ".html". Use a clean route label and put the file in 'file'.`);
|
|
119
119
|
if (node.render) {
|
|
@@ -288,6 +288,8 @@ export async function validateRepo({ config, derivers, topology = readTopology(c
|
|
|
288
288
|
if (contrast.summary) notes.push(contrast.summary);
|
|
289
289
|
warnings.push(...mapTokenWarnings(config)); // a map font, line width or glow the map cannot read draws as auto
|
|
290
290
|
warnings.push(...layerTokenWarnings(config, topology)); // a kind token, a group token or an icon for a kind or layer that is not there
|
|
291
|
+
warnings.push(...nodeColorWarnings(topology)); // a node whose own colour the map cannot read draws in its type's fill
|
|
292
|
+
notes.push(...nodeColorNotes(topology)); // a node colour only a browser can work out (oklch(), lab(), ...): said, not warned
|
|
291
293
|
warnings.push(...layersMapWarnings(config.layers, topology)); // a project layer that matches nothing, or whose every node an earlier layer took
|
|
292
294
|
errors.push(...validateCloudNodes(topology, config.root));
|
|
293
295
|
errors.push(...validateProposalFiles(topology, path.join(config.root, config.proposals), config.root));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/css-color
|
|
3
|
+
*
|
|
4
|
+
* A CSS colour as the renderers can use it, read once here so every reader (the map's tokens in map-style.js, a node's own
|
|
5
|
+
* colour in scene.js) agrees on what a colour is. The text is project or theme data: it only ever leaves here as `#rrggbb`,
|
|
6
|
+
* `rgb()` or `rgba()` that this file built or checked, never as the text it was given.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { parseColor } from './theme-model.js';
|
|
10
|
+
import { readColor } from '../core/color.js';
|
|
11
|
+
|
|
12
|
+
let probe;
|
|
13
|
+
const normalised = new Map();
|
|
14
|
+
|
|
15
|
+
/** A canvas context to normalise a colour the way the browser reads it (`hsl()`, a name, `color-mix()`), or null where there is none */
|
|
16
|
+
function probeContext() {
|
|
17
|
+
if (probe !== undefined) return probe;
|
|
18
|
+
probe = null;
|
|
19
|
+
try { if (typeof document !== 'undefined') probe = document.createElement('canvas').getContext('2d', { willReadFrequently: true }) || null; } catch { probe = null; }
|
|
20
|
+
return probe;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A token's value as a colour the renderers can use (`#rrggbb`, `rgb()`, `rgba()`), or null for `auto`, empty, or anything that is not a colour.
|
|
25
|
+
* @param {string} value
|
|
26
|
+
* @returns {string | null}
|
|
27
|
+
*/
|
|
28
|
+
export function cssColor(value) {
|
|
29
|
+
const s = typeof value === 'string' ? value.trim() : '';
|
|
30
|
+
if (!s || s.toLowerCase() === 'auto') return null;
|
|
31
|
+
if (inRange(s)) return s;
|
|
32
|
+
if (/^transparent$/i.test(s)) return 'rgba(0, 0, 0, 0)';
|
|
33
|
+
if (normalised.has(s)) return normalised.get(s);
|
|
34
|
+
let out = null;
|
|
35
|
+
const ctx = isColor(s) && !/currentcolor/i.test(s) ? probeContext() : null; // a canvas has no current colour: it would read as black
|
|
36
|
+
if (ctx) {
|
|
37
|
+
try {
|
|
38
|
+
// The browser's own reading: a value it refuses leaves fillStyle as it was, so two different starting colours tell a refusal
|
|
39
|
+
// from a colour that happens to equal the first one
|
|
40
|
+
const read = (from) => { ctx.fillStyle = from; ctx.fillStyle = s; return String(ctx.fillStyle); };
|
|
41
|
+
const a = read('#010203');
|
|
42
|
+
const got = a !== '#010203' ? a : read('#040506') !== '#040506' ? a : null;
|
|
43
|
+
// A colour the browser keeps in another space (`oklch()`, `color(display-p3 ...)`) is read back as the sRGB pixel it paints
|
|
44
|
+
out = got === null ? null : parseable(got) ? got : pixelOf(ctx, s);
|
|
45
|
+
} catch { out = null; }
|
|
46
|
+
}
|
|
47
|
+
normalised.set(s, out);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Whether CSS itself reads `s` as a colour (a canvas is more lenient: it takes `rgb(1.2.3, 0, 0)`); true where the page cannot say */
|
|
52
|
+
function isColor(s) {
|
|
53
|
+
try { return typeof CSS === 'undefined' || typeof CSS.supports !== 'function' || CSS.supports('color', s); } catch { return false; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** `#rgb`, `#rrggbb`, `rgb()` or `rgba()` with every channel in range: what both renderers read as written */
|
|
57
|
+
function inRange(s) {
|
|
58
|
+
if (!parseable(s)) return false;
|
|
59
|
+
// The numbers as written: parseColor clamps them, and an out-of-range channel must go to the browser to be read
|
|
60
|
+
const nums = /^rgba?\(/i.test(s.trim()) ? s.slice(s.indexOf('(') + 1, s.lastIndexOf(')')).split(',').map(Number) : null;
|
|
61
|
+
if (nums && (nums.slice(0, 3).some((c) => !(c >= 0 && c <= 255)) || (nums.length > 3 && !(nums[3] > 0 && nums[3] <= 1)))) return false;
|
|
62
|
+
const [r, g, b, a] = parseColor(s);
|
|
63
|
+
return [r, g, b].every((c) => Number.isFinite(c) && c >= 0 && c <= 255) && Number.isFinite(a) && a > 0 && a <= 1;
|
|
64
|
+
}
|
|
65
|
+
/** The forms parseColor (theme-model.js) reads; anything else is normalised by the browser first */
|
|
66
|
+
const COLOR_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$|^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(?:,\s*[\d.]+\s*)?\)$/i;
|
|
67
|
+
const parseable = (s) => COLOR_RE.test(s.trim());
|
|
68
|
+
|
|
69
|
+
/** The sRGB pixel `css` paints, as `rgba()` (or null when the context cannot be read) */
|
|
70
|
+
function pixelOf(ctx, css) {
|
|
71
|
+
if (!ctx.getImageData || !ctx.fillRect) return null;
|
|
72
|
+
ctx.clearRect(0, 0, 1, 1);
|
|
73
|
+
ctx.fillStyle = css;
|
|
74
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
75
|
+
const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data;
|
|
76
|
+
return rgbaText(r, g, b, a / 255);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const rgbaText = (r, g, b, a) => `rgba(${r}, ${g}, ${b}, ${+a.toFixed(3)})`;
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/** The longest colour a node may carry: every real colour is far shorter, and a longer text is never handed to the browser to read */
|
|
83
|
+
export const MAX_NODE_COLOR_CHARS = 200;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A node's own `color` (project data) as a colour both renderers draw the same, or null when it is not one: a typo, `#12345`, an empty
|
|
87
|
+
* string, a number, `null`, a value with a quote or `url(`, text over MAX_NODE_COLOR_CHARS. The caller then uses the node type's fill.
|
|
88
|
+
* Where the page has no canvas to read with (Node, the tests), the forms core/color.js reads are kept as written.
|
|
89
|
+
* @param {unknown} value
|
|
90
|
+
* @returns {string | null}
|
|
91
|
+
*/
|
|
92
|
+
export function nodeColor(value) {
|
|
93
|
+
if (typeof value !== 'string' || value.length > MAX_NODE_COLOR_CHARS) return null;
|
|
94
|
+
const s = value.trim();
|
|
95
|
+
if (!s || /^(?:auto|currentcolor)$/i.test(s)) return null;
|
|
96
|
+
const c = cssColor(s);
|
|
97
|
+
if (c) return c;
|
|
98
|
+
return probeContext() === null && readColor(s) ? s : null;
|
|
99
|
+
}
|
package/explorer/explorer.css
CHANGED
|
@@ -93,47 +93,47 @@ h1, h2, h3, p { margin: 0; }
|
|
|
93
93
|
.hx-only-mobile { display: inline-flex; }
|
|
94
94
|
|
|
95
95
|
/* The brand: logo and wordmark; a click resets the view */
|
|
96
|
-
.hx-brand { display: flex; align-items: center; gap: var(--corn-space-3); flex: none; min-width:
|
|
97
|
-
.hx-title { font-size: var(--corn-text-base); font-weight:
|
|
96
|
+
.hx-brand { display: flex; align-items: center; gap: var(--corn-space-3); flex: none; min-width: var(--hx-control-h); min-height: var(--hx-control-h); padding: 0; border: 0; background: none; }
|
|
97
|
+
.hx-title { font-size: var(--corn-text-base); font-weight: 600; letter-spacing: -0.01em; color: var(--corn-text); }
|
|
98
98
|
.hx-mark { flex: none; }
|
|
99
99
|
.hx-mark-bg { fill: var(--corn-accent); }
|
|
100
100
|
.hx-mark-fg { fill: var(--corn-text-on-accent); }
|
|
101
101
|
.hx-mark-line { fill: none; stroke: var(--corn-text-on-accent); stroke-width: 1.5; }
|
|
102
102
|
|
|
103
103
|
/* The View switch: Map, Flow and House (aria-pressed says which is on), and Fit at its end */
|
|
104
|
-
.hx-view { display: inline-flex; align-items: center; flex: none; padding: var(--corn-space-1); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); }
|
|
105
|
-
.hx-view-btn, .hx-view-fit { display: inline-flex; align-items: center; justify-content: center; height:
|
|
104
|
+
.hx-view { display: inline-flex; align-items: center; flex: none; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); }
|
|
105
|
+
.hx-view-btn, .hx-view-fit { display: inline-flex; align-items: center; justify-content: center; height: var(--hx-seg-inner); border: 0; border-radius: var(--corn-radius-sm); background: transparent; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; white-space: nowrap; }
|
|
106
106
|
.hx-view-btn { padding: 0 var(--corn-space-4); }
|
|
107
107
|
.hx-view-btn:hover, .hx-view-fit:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
108
108
|
.hx-view-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
|
|
109
|
-
.hx-view-fit { width:
|
|
109
|
+
.hx-view-fit { width: var(--hx-seg-inner); margin-left: var(--corn-space-1); border-left: var(--corn-border) solid var(--corn-line); border-radius: 0 var(--corn-radius-sm) var(--corn-radius-sm) 0; color: var(--corn-text-3); }
|
|
110
110
|
|
|
111
111
|
/* The Layers chip: "Layers · 13 of 20" */
|
|
112
|
-
.hx-layers-chip { display: inline-flex; align-items: center; gap: var(--corn-space-1); height:
|
|
112
|
+
.hx-layers-chip { display: inline-flex; align-items: center; gap: var(--corn-space-1); height: var(--hx-control-h); padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); white-space: nowrap; }
|
|
113
113
|
.hx-layers-chip:hover, .hx-layers-chip[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
114
114
|
.hx-layers-count { color: var(--corn-text-3); }
|
|
115
115
|
.hx-layers-chip--dim { border-color: var(--corn-line-soft); }
|
|
116
116
|
.hx-layers-chip--dim, .hx-layers-chip--dim .hx-layers-count { color: var(--corn-text-3); }
|
|
117
117
|
|
|
118
118
|
/* Search: the field with its key hint (a desktop's), an icon on a phone */
|
|
119
|
-
.hx-search { display: none; align-items: center; gap: var(--corn-space-3); width: 260px; min-width: 120px; height:
|
|
119
|
+
.hx-search { display: none; align-items: center; gap: var(--corn-space-3); width: 260px; min-width: 120px; height: var(--hx-control-h); padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-3); }
|
|
120
120
|
.hx-search:focus-within { border-color: var(--corn-focus); outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
121
121
|
.hx-search-icon { flex: none; }
|
|
122
122
|
.hx-search-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); outline: none; user-select: text; }
|
|
123
123
|
.hx-search-input::placeholder { color: var(--corn-text-3); }
|
|
124
124
|
.hx-kbd { flex: none; padding: 0 var(--corn-space-1); border-radius: var(--corn-radius-xs); border: var(--corn-border) solid var(--corn-line); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); color: var(--corn-text-3); }
|
|
125
125
|
.hx-search:focus-within .hx-kbd { display: none; }
|
|
126
|
-
.hx-hdr-icon { align-items: center; justify-content: center; width:
|
|
126
|
+
.hx-hdr-icon { align-items: center; justify-content: center; width: var(--hx-control-h); height: var(--hx-control-h); padding: 0; border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-2); }
|
|
127
127
|
.hx-hdr-icon:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
128
128
|
|
|
129
129
|
/* The Work toggle: opens the Work panel (forge-panel.js says in the tag which pull request is lit) */
|
|
130
|
-
.hx-work { display: inline-flex; align-items: center; gap: var(--corn-space-2); height:
|
|
130
|
+
.hx-work { display: inline-flex; align-items: center; gap: var(--corn-space-2); height: var(--hx-control-h); padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 600; white-space: nowrap; }
|
|
131
131
|
.hx-work:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
132
132
|
.hx-work[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); }
|
|
133
133
|
.hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: var(--corn-ground); color: var(--corn-warn); font-size: var(--corn-text-2xs); }
|
|
134
134
|
|
|
135
135
|
/* The account button: the initial of who is signed in (a menu glyph when nobody is) */
|
|
136
|
-
.hx-account-btn { display: inline-flex; align-items: center; gap: var(--corn-space-3); height:
|
|
136
|
+
.hx-account-btn { display: inline-flex; align-items: center; gap: var(--corn-space-3); height: var(--hx-control-h); padding: 0 var(--corn-space-2) 0 var(--corn-space-1); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); }
|
|
137
137
|
.hx-account-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
138
138
|
.hx-account-btn[aria-expanded="true"] { border-color: var(--corn-accent-text); }
|
|
139
139
|
.hx-avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--corn-radius-pill); background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-xs); font-weight: 700; }
|
|
@@ -145,11 +145,11 @@ h1, h2, h3, p { margin: 0; }
|
|
|
145
145
|
.hx-account-row { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); padding: var(--corn-space-1) var(--corn-space-4); }
|
|
146
146
|
.hx-account-label { color: var(--corn-text-2); }
|
|
147
147
|
.hx-account-seg { display: inline-flex; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); }
|
|
148
|
-
.hx-account-seg-btn { height:
|
|
148
|
+
.hx-account-seg-btn { height: var(--hx-seg-inner); padding: 0 var(--corn-space-3); border: 0; border-radius: var(--corn-radius-xs); background: transparent; color: var(--corn-text-2); font-size: var(--corn-text-xs); font-weight: 500; }
|
|
149
149
|
.hx-account-seg-btn:hover { color: var(--corn-text); }
|
|
150
150
|
.hx-account-seg-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
|
|
151
|
-
.hx-account-select { display: block; width: calc(100% - var(--corn-space-5)); height:
|
|
152
|
-
.hx-account-item { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); width: 100%; min-height:
|
|
151
|
+
.hx-account-select { display: block; width: calc(100% - var(--corn-space-5)); height: var(--hx-control-h); margin: 0 var(--corn-space-3); padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); }
|
|
152
|
+
.hx-account-item { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); width: 100%; min-height: var(--hx-control-h); padding: 0 var(--corn-space-4); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text); font-size: var(--corn-text-sm); text-align: left; text-decoration: none; }
|
|
153
153
|
.hx-account-item:hover { background: var(--corn-surface-3); }
|
|
154
154
|
.hx-account-item--sub { padding-left: var(--corn-space-6); color: var(--corn-text-2); }
|
|
155
155
|
.hx-account-item svg { flex: none; color: var(--corn-text-3); }
|
|
@@ -174,7 +174,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
174
174
|
.hx-header { height: 52px; padding: 0 var(--corn-space-5); gap: var(--corn-space-5); }
|
|
175
175
|
.hx-header-left { gap: var(--corn-space-5); }
|
|
176
176
|
.hx-header-right { gap: var(--corn-space-3); }
|
|
177
|
-
.hx-brand { min-width: 0; min-height:
|
|
177
|
+
.hx-brand { min-width: 0; min-height: var(--hx-control-h); }
|
|
178
178
|
.hx-only-wide { display: inline; }
|
|
179
179
|
.hx-only-mobile { display: none; }
|
|
180
180
|
.hx-search { display: flex; flex: 0 1 260px; width: auto; }
|
|
@@ -193,21 +193,21 @@ h1, h2, h3, p { margin: 0; }
|
|
|
193
193
|
.hx-header-left::-webkit-scrollbar { display: none; }
|
|
194
194
|
.hx-header-right { gap: var(--corn-space-1); }
|
|
195
195
|
.hx-view { padding: 0; }
|
|
196
|
-
.hx-view-btn { min-width:
|
|
197
|
-
.hx-view-fit { position: absolute; top: calc(100% + var(--corn-space-4)); right: var(--corn-space-4); width:
|
|
196
|
+
.hx-view-btn { min-width: var(--hx-control-h); height: var(--hx-seg-inner); padding: 0 var(--corn-space-2); }
|
|
197
|
+
.hx-view-fit { position: absolute; top: calc(100% + var(--corn-space-4)); right: var(--corn-space-4); width: var(--hx-control-h); height: var(--hx-control-h); margin: 0; border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); color: var(--corn-text-2); box-shadow: var(--corn-shadow); }
|
|
198
198
|
.hx-header .hx-layers { position: absolute; top: calc(100% + var(--corn-space-4)); left: var(--corn-space-4); }
|
|
199
|
-
.hx-layers-chip { height:
|
|
199
|
+
.hx-layers-chip { height: var(--hx-control-h); padding: 0 var(--corn-space-5); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); box-shadow: var(--corn-shadow); }
|
|
200
200
|
/* The live chip sits on the map too, left of Fit */
|
|
201
|
-
.hx-header .hx-live { position: absolute; top: calc(100% + var(--corn-space-4)); right: calc(var(--corn-space-4) + var(--corn-space-3) +
|
|
202
|
-
.hx-work { height:
|
|
201
|
+
.hx-header .hx-live { position: absolute; top: calc(100% + var(--corn-space-4)); right: calc(var(--corn-space-4) + var(--corn-space-3) + var(--hx-control-h)); }
|
|
202
|
+
.hx-work { height: var(--hx-control-h); min-width: var(--hx-control-h); justify-content: center; padding: 0 var(--corn-space-3); }
|
|
203
203
|
.hx-forge-lit { display: none; }
|
|
204
|
-
.hx-account-btn { width:
|
|
204
|
+
.hx-account-btn { width: var(--hx-control-h); height: var(--hx-control-h); justify-content: center; padding: 0; border: 0; background: none; }
|
|
205
205
|
.hx-account-caret { display: none; }
|
|
206
206
|
.hx-avatar { width: 28px; height: 28px; }
|
|
207
207
|
.hx-menu.hx-account-menu { width: min(300px, calc(100vw - 24px)); }
|
|
208
|
-
.hx-account-item, .hx-account-row { min-height:
|
|
209
|
-
.hx-account-seg-btn { height:
|
|
210
|
-
.hx-account-select { height:
|
|
208
|
+
.hx-account-item, .hx-account-row { min-height: var(--hx-control-h); }
|
|
209
|
+
.hx-account-seg-btn { height: var(--hx-seg-inner); padding: 0 var(--corn-space-4); }
|
|
210
|
+
.hx-account-select { height: var(--hx-control-h); }
|
|
211
211
|
.hx-stage .hx-hint { top: 68px; }
|
|
212
212
|
}
|
|
213
213
|
/* ==== end of the header ============================================================================================ */
|
|
@@ -342,11 +342,10 @@ h1, h2, h3, p { margin: 0; }
|
|
|
342
342
|
}
|
|
343
343
|
.hx-drawer-handle { display: flex; justify-content: center; padding: var(--corn-space-3) 0 var(--corn-space-1); }
|
|
344
344
|
.hx-drawer-handle span { width: 48px; height: 6px; border-radius: var(--corn-radius-pill); background: var(--corn-surface-3); }
|
|
345
|
-
.hx-drawer-body { flex: 1; display: flex; flex-direction: column; gap: var(--corn-space-5); padding:
|
|
346
|
-
@media (min-width: 640px) { .hx-drawer-body { padding: var(--corn-space-6); } }
|
|
345
|
+
.hx-drawer-body { flex: 1; display: flex; flex-direction: column; gap: var(--corn-space-5); padding: var(--corn-panel-pad); overflow-y: auto; user-select: text; }
|
|
347
346
|
.hx-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--corn-space-3); }
|
|
348
347
|
.hx-drawer-title { font-size: var(--corn-text-lg); font-weight: 700; color: var(--corn-text); overflow-wrap: anywhere; }
|
|
349
|
-
.hx-close { width:
|
|
348
|
+
.hx-close { width: var(--hx-control-h); height: var(--hx-control-h); flex: none; border: 0; border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); color: var(--corn-text-3); font-weight: 700; font-size: var(--corn-text-base); }
|
|
350
349
|
.hx-close:hover { color: var(--corn-text); }
|
|
351
350
|
.hx-lead { font-size: var(--corn-text-base); line-height: 1.5; color: var(--corn-text-2); }
|
|
352
351
|
|
|
@@ -367,7 +366,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
367
366
|
.hx-file { padding: calc(var(--corn-space-1) / 2) 0; }
|
|
368
367
|
|
|
369
368
|
.hx-sandbox { display: flex; flex-direction: column; gap: var(--corn-space-4); padding: var(--corn-space-5); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); }
|
|
370
|
-
.hx-sandbox-title { display: flex; align-items: center; justify-content: space-between; font-size: var(--corn-text-
|
|
369
|
+
.hx-sandbox-title { display: flex; align-items: center; justify-content: space-between; font-size: var(--corn-text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--corn-text-3); }
|
|
371
370
|
.hx-sandbox-name { display: flex; align-items: center; gap: var(--corn-space-2); }
|
|
372
371
|
.hx-sandbox-stage { min-height: 90px; display: flex; align-items: center; justify-content: center; padding: var(--corn-space-5); border-radius: var(--corn-radius-sm); border: var(--corn-border) dashed var(--corn-surface-2); background: var(--corn-ground); overflow-x: auto; }
|
|
373
372
|
.hx-sandbox-controls { display: flex; flex-direction: column; gap: var(--corn-space-2); padding-top: var(--corn-space-3); border-top: var(--corn-border) solid var(--corn-line); font-size: var(--corn-text-xs); }
|
|
@@ -383,7 +382,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
383
382
|
.hx-chip--danger, .hx-chip--success, .hx-chip--warning { color: var(--corn-ground); }
|
|
384
383
|
|
|
385
384
|
.hx-drawer-foot { display: flex; align-items: stretch; gap: var(--corn-space-3); flex: none; padding: var(--corn-space-4) var(--corn-space-5) calc(var(--corn-space-4) + env(safe-area-inset-bottom, 0px)); border-top: var(--corn-border) solid var(--corn-line-soft); }
|
|
386
|
-
.hx-open { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: var(--corn-space-2); min-height:
|
|
385
|
+
.hx-open { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: var(--corn-space-2); min-height: var(--hx-control-h); padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-sm); font-weight: 600; text-align: center; text-decoration: none; transition: background 0.15s; }
|
|
387
386
|
.hx-open:hover { background: var(--corn-accent-hover); }
|
|
388
387
|
|
|
389
388
|
/* ---- proposals (proposal.js): picker, bar, marks, panel rows ----------------------------------- */
|
|
@@ -406,13 +405,13 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
406
405
|
.hx-proposal-message { color: var(--corn-text-2); }
|
|
407
406
|
.hx-proposal-bar.is-error .hx-proposal-message { color: var(--corn-bad); }
|
|
408
407
|
.hx-proposal-count:focus-visible, .hx-proposal-mode:focus-visible, .hx-seg-btn:focus-visible, .hx-change-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
409
|
-
.hx-proposal-summary { margin-top: var(--corn-space-2); color: var(--corn-text-2); line-height: 1.
|
|
408
|
+
.hx-proposal-summary { margin-top: var(--corn-space-2); color: var(--corn-text-2); line-height: 1.5; }
|
|
410
409
|
|
|
411
410
|
/* Before / Diff / After */
|
|
412
411
|
.hx-seg { display: inline-flex; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); }
|
|
413
|
-
.hx-seg-btn { height:
|
|
412
|
+
.hx-seg-btn { height: var(--hx-seg-inner); padding: 0 var(--corn-space-4); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-3); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
414
413
|
.hx-seg-btn:hover { color: var(--corn-text); }
|
|
415
|
-
.hx-seg-btn.is-on, .hx-seg-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent);
|
|
414
|
+
.hx-seg-btn.is-on, .hx-seg-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); } /* the weight does not change: a heavier word is wider, and Edit and the rest of the bar would move */
|
|
416
415
|
|
|
417
416
|
.hx-proposal-errors { margin-top: var(--corn-space-2); padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); background: color-mix(in srgb, var(--corn-removed) 10%, transparent); border: var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 30%, transparent); color: var(--corn-text-2); }
|
|
418
417
|
.hx-proposal-errors summary { cursor: pointer; color: var(--corn-bad); font-weight: 600; }
|
|
@@ -458,9 +457,9 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
458
457
|
|
|
459
458
|
|
|
460
459
|
|
|
461
|
-
.hx-player .hx-close { width:
|
|
460
|
+
.hx-player .hx-close { width: var(--hx-control-h); height: var(--hx-control-h); font-size: var(--corn-text-sm); }
|
|
462
461
|
|
|
463
|
-
.hx-player-speed { flex: none; height:
|
|
462
|
+
.hx-player-speed { flex: none; height: var(--hx-control-h); padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); cursor: pointer; }
|
|
464
463
|
.hx-player-speed:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-offset) / 2); }
|
|
465
464
|
.hx-player-text { margin: 0; flex: 1 1 18em; min-width: 0; font-size: var(--corn-text-base); line-height: 1.4; color: var(--corn-text); user-select: text; overflow-wrap: anywhere; }
|
|
466
465
|
.hx-player-who { color: var(--corn-text-2); font-weight: 600; }
|
|
@@ -504,7 +503,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
504
503
|
.hx-whatif-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); }
|
|
505
504
|
.hx-whatif-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--corn-space-1); }
|
|
506
505
|
.hx-whatif-edit { display: flex; align-items: center; gap: var(--corn-space-3); }
|
|
507
|
-
.hx-whatif-edit-text { flex: 1; min-width: 0; line-height: 1.
|
|
506
|
+
.hx-whatif-edit-text { flex: 1; min-width: 0; line-height: 1.4; }
|
|
508
507
|
.hx-whatif-step { display: flex; align-items: flex-start; gap: var(--corn-space-2); padding: var(--corn-space-1); border-radius: var(--corn-radius-sm); }
|
|
509
508
|
.hx-whatif-step.is-current { background: color-mix(in srgb, var(--corn-edit) 18%, transparent); }
|
|
510
509
|
.hx-whatif-num { flex: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--corn-edit) 30%, transparent); color: var(--corn-text); font-size: var(--corn-text-xs); font-weight: 700; cursor: pointer; }
|
|
@@ -545,10 +544,10 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
545
544
|
the current mode (a button that opens the switcher), the note when it is open, and Send back and Approve full
|
|
546
545
|
width, each 44px tall. */
|
|
547
546
|
.hx-proposal-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-3) var(--corn-space-4); }
|
|
548
|
-
.hx-proposal-name { flex: 0 1 auto; min-width: 0; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
547
|
+
.hx-proposal-name { flex: 0 1 auto; min-width: 0; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--corn-text); } /* its size and weight are the shared panel title's ("panel head" at the end of this file) */
|
|
549
548
|
.hx-proposal-counts { display: contents; }
|
|
550
549
|
.hx-proposal-chip { display: inline-flex; align-items: center; flex-wrap: wrap; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
551
|
-
.hx-proposal-count { display: inline-flex; align-items: center; padding: var(--corn-space-1) var(--corn-space-2); border: 0; border-radius: var(--corn-radius-sm); background: none; color: inherit; font: inherit; white-space: inherit; cursor: pointer; }
|
|
550
|
+
.hx-proposal-count { display: inline-flex; align-items: center; min-height: var(--hx-control-h); padding: var(--corn-space-1) var(--corn-space-2); border: 0; border-radius: var(--corn-radius-sm); background: none; color: inherit; font: inherit; white-space: inherit; cursor: pointer; }
|
|
552
551
|
.hx-proposal-count:hover { color: var(--corn-text); text-decoration: underline; }
|
|
553
552
|
.hx-proposal-peek { display: none; margin: 0; }
|
|
554
553
|
.hx-proposal-chip .hx-mark-dot { margin: 0 var(--corn-space-2) 0 0; }
|
|
@@ -556,18 +555,18 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
556
555
|
.hx-proposal-sep { margin: 0 var(--corn-space-2); color: var(--corn-text-3); }
|
|
557
556
|
.hx-proposal-mode { display: none; }
|
|
558
557
|
.hx-proposal-tools, .hx-proposal-actions { display: flex; align-items: center; gap: var(--corn-space-3); }
|
|
559
|
-
.hx-proposal-tools .hx-btn { height:
|
|
558
|
+
.hx-proposal-tools .hx-btn { height: var(--hx-control-h); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
560
559
|
#proposal-edit.hx-btn--active { background: var(--corn-edit-text); border-color: var(--corn-edit); color: var(--corn-ground); }
|
|
561
560
|
.hx-proposal-actions { margin-left: auto; }
|
|
562
|
-
.hx-proposal-actions .hx-btn { height:
|
|
561
|
+
.hx-proposal-actions .hx-btn { height: var(--hx-control-h); justify-content: center; padding: 0 var(--corn-space-5); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
563
562
|
.hx-proposal-actions .hx-btn--approve, .hx-proposal-actions .hx-btn--approve:hover { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
|
|
564
563
|
.hx-proposal-actions .hx-btn:disabled { opacity: 0.4; cursor: default; }
|
|
565
564
|
.hx-proposal-more { position: relative; }
|
|
566
|
-
.hx-proposal-more .hx-btn--icon { width:
|
|
565
|
+
.hx-proposal-more .hx-btn--icon { width: var(--hx-control-h); height: var(--hx-control-h); border-color: transparent; background: none; color: var(--corn-text-3); }
|
|
567
566
|
.hx-proposal-more .hx-btn--icon:hover, .hx-proposal-more .hx-btn--icon[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
568
567
|
.hx-proposal-more-menu { position: absolute; top: 100%; right: 0; z-index: 20; display: flex; flex-direction: column; min-width: 160px; margin-top: var(--corn-space-2); padding: var(--corn-space-2); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); box-shadow: var(--corn-shadow); }
|
|
569
568
|
.hx-proposal-more-menu[hidden] { display: none; }
|
|
570
|
-
.hx-proposal-more-menu .hx-btn { width: 100%; height:
|
|
569
|
+
.hx-proposal-more-menu .hx-btn { width: 100%; height: var(--hx-control-h); border-color: transparent; background: none; color: var(--corn-text-2); font-size: var(--corn-text-sm); }
|
|
571
570
|
.hx-proposal-more-menu .hx-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
572
571
|
|
|
573
572
|
@media (max-width: 767px) {
|
|
@@ -581,13 +580,13 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
581
580
|
.hx-proposal-mode[aria-expanded="true"]::after { transform: rotate(180deg); }
|
|
582
581
|
.hx-seg, .hx-review { grid-column: 1 / -1; order: 3; }
|
|
583
582
|
.hx-proposal-bar:not([data-mode-open="true"]) .hx-seg { display: none; }
|
|
584
|
-
.hx-seg-btn { flex: 1; height:
|
|
583
|
+
.hx-seg-btn { flex: 1; height: var(--hx-seg-inner); font-size: var(--corn-text-md); }
|
|
585
584
|
.hx-proposal-actions { grid-column: 1 / -1; order: 4; display: grid; grid-template-columns: 1fr 1fr; margin-left: 0; gap: var(--corn-space-3); }
|
|
586
585
|
.hx-proposal-actions .hx-btn { height: auto; min-height: 44px; padding: var(--corn-space-2) var(--corn-space-3); white-space: normal; text-align: center; font-size: var(--corn-text-md); }
|
|
587
586
|
.hx-proposal-tools { order: 5; }
|
|
588
587
|
.hx-proposal-tools .hx-btn { height: auto; min-height: 44px; padding: 0 var(--corn-space-5); font-size: var(--corn-text-md); }
|
|
589
588
|
.hx-proposal-more { display: contents; }
|
|
590
|
-
.hx-proposal-more .hx-btn--icon { order: 6; width:
|
|
589
|
+
.hx-proposal-more .hx-btn--icon { order: 6; width: var(--hx-control-h); height: var(--hx-control-h); }
|
|
591
590
|
.hx-proposal-more-menu { position: static; grid-column: 1 / -1; order: 7; box-shadow: none; }
|
|
592
591
|
.hx-proposal-more-menu .hx-btn { height: auto; min-height: 44px; font-size: var(--corn-text-md); }
|
|
593
592
|
.hx-review .hx-btn, .hx-whatif .hx-btn { min-height: 44px; }
|
|
@@ -668,6 +667,9 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
668
667
|
/* ---- the live layer (live.js, spec 0029): the chip in the toolbar, its menu, and its part of the node panel ---- */
|
|
669
668
|
.hx-live-chip { max-width: 240px; min-width: 0; }
|
|
670
669
|
@media (min-width: 768px) { .hx-live-chip-text { display: inline-block; min-width: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; } }
|
|
670
|
+
/* A narrow desktop (768 to 1023px): the header has no room for the chip's words beside a signed-in search, Work and account (a scenario's step
|
|
671
|
+
turns the live layer on, and the header ran 100px past the page). The chip is its dot, as on a phone; its line is in its menu and its name in aria-label */
|
|
672
|
+
@media (min-width: 768px) and (max-width: 1023px) { .hx-live-chip-text { display: none; } }
|
|
671
673
|
.hx-live-chip-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--corn-text-3); }
|
|
672
674
|
.hx-live[data-tone="ok"] .hx-live-chip-dot { background: var(--corn-ok); box-shadow: 0 0 calc(var(--corn-glow) * 0.75) color-mix(in srgb, var(--corn-ok) 70%, transparent); }
|
|
673
675
|
.hx-live[data-tone="stale"] .hx-live-chip-dot { background: var(--corn-changed); }
|
|
@@ -677,7 +679,7 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
677
679
|
.hx-live-line { margin: 0 0 var(--corn-space-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); line-height: 1.4; user-select: text; }
|
|
678
680
|
.hx-live-line--main { color: var(--corn-text); font-weight: 600; }
|
|
679
681
|
.hx-live-row { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); margin-top: var(--corn-space-3); }
|
|
680
|
-
.hx-live-tag { margin-left: var(--corn-space-2); padding: 0 var(--corn-space-1); border-radius: var(--corn-radius-xs); background: var(--corn-ok-soft); color: var(--corn-ok); font-size: var(--corn-text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.
|
|
682
|
+
.hx-live-tag { margin-left: var(--corn-space-2); padding: 0 var(--corn-space-1); border-radius: var(--corn-radius-xs); background: var(--corn-ok-soft); color: var(--corn-ok); font-size: var(--corn-text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
|
|
681
683
|
.hx-live-photo { display: block; max-width: 100%; max-height: 180px; margin: var(--corn-space-2) 0; border-radius: var(--corn-radius-sm); object-fit: cover; }
|
|
682
684
|
.hx-live-list { margin: var(--corn-space-1) 0 0; padding: 0 0 0 var(--corn-space-1); list-style: none; font-size: var(--corn-text-sm); line-height: 1.6; }
|
|
683
685
|
/* The token field (live.js): shown while the live layer is off for want of a token */
|
|
@@ -753,8 +755,7 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
753
755
|
.hx-forge[data-sheet-state="peek"] .hx-forge-head { padding-bottom: 0; border-bottom: 0; }
|
|
754
756
|
.hx-forge[data-sheet-state="peek"] .hx-forge-head .hx-btn { display: none; }
|
|
755
757
|
}
|
|
756
|
-
.hx-forge-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--corn-space-4); padding:
|
|
757
|
-
@media (min-width: 640px) { .hx-forge-body { padding: var(--corn-space-6) calc(var(--corn-space-5) + var(--corn-space-1)); } }
|
|
758
|
+
.hx-forge-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--corn-space-4); padding: var(--corn-panel-pad); overflow-y: auto; user-select: text; font-size: var(--corn-text-sm); }
|
|
758
759
|
.hx-forge-head { display: flex; align-items: center; gap: var(--corn-space-3); padding-bottom: var(--corn-space-3); border-bottom: var(--corn-border) solid var(--corn-line-soft); }
|
|
759
760
|
.hx-forge-head .hx-drawer-title { flex: 1; min-width: 0; }
|
|
760
761
|
.hx-forge-status, .hx-forge-rate { font-size: var(--corn-text-xs); line-height: 1.5; }
|
|
@@ -762,7 +763,7 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
762
763
|
/* The tabs, in the order of the loop: underlined here, pills that scroll sideways on a phone (below) */
|
|
763
764
|
.hx-forge-tabs { display: flex; gap: calc(var(--corn-space-1) / 2); margin: 0 calc(var(--corn-space-4) * -1); padding: 0 var(--corn-space-4); border-bottom: var(--corn-border) solid var(--corn-line); overflow-x: auto; scrollbar-width: none; }
|
|
764
765
|
.hx-forge-tabs::-webkit-scrollbar { display: none; }
|
|
765
|
-
.hx-forge-tab { flex: none; display: inline-flex; align-items: baseline; gap: var(--corn-space-1); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-3); border: 0; border-bottom: var(--corn-border-strong) solid transparent; background: none; white-space: nowrap; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
766
|
+
.hx-forge-tab { flex: none; display: inline-flex; align-items: baseline; min-height: var(--hx-control-h); gap: var(--corn-space-1); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-3); border: 0; border-bottom: var(--corn-border-strong) solid transparent; background: none; white-space: nowrap; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
766
767
|
.hx-forge-tab:hover { color: var(--corn-text); }
|
|
767
768
|
.hx-forge-tab[aria-pressed="true"] { border-bottom-color: var(--corn-accent); color: var(--corn-text); font-weight: 600; }
|
|
768
769
|
.hx-forge-tab:focus-visible, .hx-forge-chip:focus-visible, .hx-forge-back:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); }
|
|
@@ -968,7 +969,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
968
969
|
.hx-kicker [data-corn="badge"] { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
|
|
969
970
|
#drawer-host { white-space: pre; } /* the kicker is a flex row, which drops a leading space: keep " · host" */
|
|
970
971
|
.hx-diffpill { margin-left: var(--corn-space-3); padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-pill); border: var(--corn-border) dashed var(--corn-added); color: var(--corn-added-text); font-size: var(--corn-text-xs); }
|
|
971
|
-
.hx-drawer-id .hx-drawer-title { font-size: var(--corn-text-xl); font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
|
|
972
972
|
.hx-drawer-id .hx-drawer-title.hx-mono { font-family: var(--corn-mono); }
|
|
973
973
|
.hx-facts { display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
974
974
|
.hx-fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--corn-space-4); }
|
|
@@ -1003,7 +1003,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
1003
1003
|
.hx-diff-v { min-width: 0; overflow-wrap: anywhere; }
|
|
1004
1004
|
.hx-drawer .hx-why { margin: 0; }
|
|
1005
1005
|
.hx-drawer-foot .hx-open[hidden], .hx-drawer-foot .hx-foot-btn[hidden] { display: none; }
|
|
1006
|
-
.hx-foot-btn { min-height:
|
|
1006
|
+
.hx-foot-btn { min-height: var(--hx-control-h); padding: 0 var(--corn-space-4); justify-content: center; }
|
|
1007
1007
|
@media (max-width: 767px) {
|
|
1008
1008
|
/* a phone: the sheet's actions are full width at the foot, each a 44px target */
|
|
1009
1009
|
.hx-drawer-foot { flex-direction: column; }
|
|
@@ -1156,8 +1156,7 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1156
1156
|
.hx-forge-empty { line-height: 1.5; }
|
|
1157
1157
|
|
|
1158
1158
|
/* The panel's title row and tabs stay in place while a list scrolls; the body's padding is taken up by the top so nothing shows above it */
|
|
1159
|
-
.hx-forge-body { --hx-forge-pad:
|
|
1160
|
-
@media (min-width: 640px) { .hx-forge-body { --hx-forge-pad: var(--corn-space-6); --hx-forge-padx: calc(var(--corn-space-5) + var(--corn-space-1)); } }
|
|
1159
|
+
.hx-forge-body { --hx-forge-pad: var(--corn-panel-pad); --hx-forge-padx: var(--corn-panel-pad); }
|
|
1161
1160
|
.hx-forge-top { position: sticky; top: calc(var(--hx-forge-pad) * -1); z-index: 3; display: flex; flex-direction: column; gap: var(--corn-space-4); margin: calc(var(--hx-forge-pad) * -1) calc(var(--hx-forge-padx) * -1) 0; padding: var(--hx-forge-pad) var(--hx-forge-padx) 0; background: linear-gradient(var(--corn-surface-1), var(--corn-surface-1)), var(--corn-ground); } /* opaque: the panel's surface over the ground, so a list scrolls under it without showing through */
|
|
1162
1161
|
.hx-forge-top .hx-forge-tabs { margin: 0 calc(var(--hx-forge-padx) * -1); padding: 0 var(--hx-forge-padx); }
|
|
1163
1162
|
/* Where the tabs run on past an edge (a phone), they fade out on that side: a mask (only its alpha counts, so any opaque token does), so it works on any surface and in any theme */
|
|
@@ -1193,7 +1192,7 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1193
1192
|
/* On a phone the list is in the search bar, under the sheets (the dock, 45): while it is open the bar is over them, so a proposal's or the
|
|
1194
1193
|
Work sheet never covers rows of it. Without :has() the list stays under the sheets, as the bar always was */
|
|
1195
1194
|
.hx-mobile-search:has(.hx-search-results:not([hidden])) { z-index: 46; }
|
|
1196
|
-
.hx-search-group-title { position: sticky; top: 0; display: flex; justify-content: space-between; gap: var(--corn-space-3); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-1); background: var(--corn-ground); color: var(--corn-text-3); font-size: var(--corn-text-2xs); font-weight:
|
|
1195
|
+
.hx-search-group-title { position: sticky; top: 0; display: flex; justify-content: space-between; gap: var(--corn-space-3); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-1); background: var(--corn-ground); color: var(--corn-text-3); font-size: var(--corn-text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
|
|
1197
1196
|
.hx-search-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--corn-space-3); width: 100%; min-height: 28px; padding: var(--corn-space-1) var(--corn-space-3); border: 0; border-left: var(--corn-border-strong) solid transparent; background: none; color: var(--corn-text); font: inherit; text-align: left; cursor: pointer; }
|
|
1198
1197
|
.hx-search-row:hover, .hx-search-row:focus-visible { background: var(--corn-surface-3); }
|
|
1199
1198
|
.hx-search-row[aria-current="true"] { border-left-color: var(--corn-accent); background: var(--corn-accent-soft); }
|
|
@@ -1237,19 +1236,19 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1237
1236
|
.hx-rc-h { flex: none; }
|
|
1238
1237
|
.hx-rc-tabs { display: flex; gap: var(--corn-space-2); }
|
|
1239
1238
|
.hx-rc-tabs[hidden] { display: none; }
|
|
1240
|
-
.hx-rc-tab { flex: 1; min-height:
|
|
1239
|
+
.hx-rc-tab { flex: 1; min-height: var(--hx-control-h); padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-3); font: inherit; font-weight: 600; cursor: pointer; }
|
|
1241
1240
|
.hx-rc-tab[aria-selected="true"] { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); }
|
|
1242
1241
|
.hx-rc-tab:focus-visible, .hx-sc-row:focus-visible, .hx-step:focus-visible, .hx-rc-h:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
1243
1242
|
.hx-rc-section[hidden] { display: none; }
|
|
1244
|
-
.hx-rc-h { margin: 0 0 var(--corn-space-2); font-size: var(--corn-text-sm); font-weight:
|
|
1243
|
+
.hx-rc-h { margin: 0 0 var(--corn-space-2); font-size: var(--corn-text-sm); font-weight: 700; color: var(--corn-text); }
|
|
1245
1244
|
.hx-rc-h [data-corn="count"] { color: var(--corn-text-3); font-variant-numeric: tabular-nums; }
|
|
1246
|
-
.hx-rc-empty, .hx-rc-note, .hx-rc-coverage { margin: var(--corn-space-2) 0 0; line-height: 1.
|
|
1245
|
+
.hx-rc-empty, .hx-rc-note, .hx-rc-coverage { margin: var(--corn-space-2) 0 0; line-height: 1.5; }
|
|
1247
1246
|
.hx-rc-coverage { color: var(--corn-text-2); }
|
|
1248
1247
|
.hx-change-list, .hx-sc-list, .hx-steps { margin: 0; padding: 0; list-style: none; }
|
|
1249
1248
|
.hx-change-list { display: flex; flex-direction: column; gap: calc(var(--corn-space-1) / 2); }
|
|
1250
1249
|
.hx-persona { margin-top: var(--corn-space-4); }
|
|
1251
1250
|
.hx-persona:first-of-type { margin-top: 0; }
|
|
1252
|
-
.hx-persona-name { margin: 0 0 var(--corn-space-1); font-size: var(--corn-text-xs); font-weight:
|
|
1251
|
+
.hx-persona-name { margin: 0 0 var(--corn-space-1); font-size: var(--corn-text-xs); font-weight: 600; letter-spacing: 0.02em; color: var(--corn-text-3); overflow-wrap: anywhere; } /* a persona's name in its own words (0.39.0), not a label: sentence case */
|
|
1253
1252
|
.hx-sc-list { display: flex; flex-direction: column; gap: var(--corn-space-1); }
|
|
1254
1253
|
.hx-sc-row { display: flex; align-items: flex-start; gap: var(--corn-space-3); width: 100%; padding: var(--corn-space-2) var(--corn-space-2); border: var(--corn-border) solid var(--corn-line-soft); border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text); font: inherit; text-align: left; cursor: pointer; }
|
|
1255
1254
|
.hx-sc-row:hover { background: color-mix(in srgb, var(--corn-accent-hover) 18%, transparent); }
|
|
@@ -1429,6 +1428,7 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1429
1428
|
.hx-lines-reach { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-3); font-size: var(--corn-text-sm); color: var(--corn-text-2); font-variant-numeric: tabular-nums; }
|
|
1430
1429
|
@media (max-width: 767px), (pointer: coarse) {
|
|
1431
1430
|
.hx-lines-kind, .hx-lines-switch, .hx-lines-list .hx-linkbtn, .hx-lines-reach .hx-btn { min-height: 44px; }
|
|
1431
|
+
.hx-lines-kind { align-items: center; } /* in a 44px chip the words sit in the middle, not at the top */
|
|
1432
1432
|
.hx-lines-switch input { width: 24px; height: 24px; }
|
|
1433
1433
|
}
|
|
1434
1434
|
|
|
@@ -1441,7 +1441,7 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1441
1441
|
.hx-key-note { margin: var(--corn-space-1) 0 0; font-size: var(--corn-text-xs); }
|
|
1442
1442
|
|
|
1443
1443
|
/* ===== Spec 0007: the decision. The line above Approve, the question asked in place, the hold with Undo, a landing that waits, what a send back carried ===== */
|
|
1444
|
-
.hx-decision-line { margin: 0; color: var(--corn-text-2); font-size: var(--corn-text-sm); line-height: 1.
|
|
1444
|
+
.hx-decision-line { margin: 0; color: var(--corn-text-2); font-size: var(--corn-text-sm); line-height: 1.5; }
|
|
1445
1445
|
.hx-decision-line[hidden], .hx-review-ask[hidden], .hx-hold[hidden], .hx-review-landing[hidden], .hx-sent-edits[hidden] { display: none; }
|
|
1446
1446
|
.hx-review-ask { margin: 0; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid color-mix(in srgb, var(--corn-warn) 55%, transparent); background: color-mix(in srgb, var(--corn-warn) 14%, transparent); color: var(--corn-text); line-height: 1.4; }
|
|
1447
1447
|
.hx-review-landing { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); color: var(--corn-text-2); }
|
|
@@ -1466,3 +1466,36 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1466
1466
|
.hx-whatif-row [aria-disabled="true"] { opacity: 0.55; cursor: default; }
|
|
1467
1467
|
.hx-runner-dot { display: inline-block; width: 8px; height: 8px; margin-left: var(--corn-space-1); border-radius: 50%; background: var(--corn-warn); vertical-align: middle; }
|
|
1468
1468
|
.hx-runner-dot[hidden] { display: none; }
|
|
1469
|
+
/* ---- Layers menu: a dot's outline and a kind's swatch (issue #229) ---- */
|
|
1470
|
+
/* A fill under 3:1 on the menu keeps its colour and gets an outline: the map's own (--corn-map-stroke, set inline as --hx-dot-ring) when the theme sets one */
|
|
1471
|
+
.hx-dot.is-ringed { outline: var(--corn-border) solid var(--hx-dot-ring, var(--corn-text-3)); outline-offset: 0; }
|
|
1472
|
+
/* The swatch before a kind's letters: the theme's --corn-map-kind-<type>-<kind>; decoration, the letters and the name stay */
|
|
1473
|
+
.hx-kind-swatch { margin-inline-end: calc(var(--corn-space-1) * -1); }
|
|
1474
|
+
.hx-kind-swatch.is-blank { visibility: hidden; }
|
|
1475
|
+
/* ---- end: Layers menu dots ---- */
|
|
1476
|
+
|
|
1477
|
+
/* ==== one panel head, one control height, one title (issue #200, F53 of the 0.34 design review) ==========================================
|
|
1478
|
+
The measured scatter was values that sit between two steps, or that three places chose differently: a panel title of 14, 15 and 20px, controls of
|
|
1479
|
+
24 to 36px in one bar, paddings of 20 and 24px on two panels that sit side by side. They now share the tokens --corn-control-height,
|
|
1480
|
+
--corn-panel-pad and --corn-panel-head-height (docs/theming.md, "Density"). No rule here is more specific than one class (an ancestor is in :where()),
|
|
1481
|
+
so a theme's [data-corn] rule, loaded later, still wins.
|
|
1482
|
+
The rules read --hx-control-h, the token on a desk and never under 44px on a phone: a brand that sets --corn-control-height on :root (which also
|
|
1483
|
+
overrides tokens.css's phone value) cannot take a phone's targets under 44px; one that sets it higher than 44px gets its height on a phone too.
|
|
1484
|
+
A segmented control (View, Before / Diff / After, the theme choice) is the control height outside; its buttons are that less the frame
|
|
1485
|
+
(the padding and the two borders), or the full height on a phone, where each button is the 44px target and the frame is outside it. */
|
|
1486
|
+
:root { --hx-control-h: var(--corn-control-height); }
|
|
1487
|
+
@media (max-width: 767px) { :root { --hx-control-h: max(44px, var(--corn-control-height)); } }
|
|
1488
|
+
:root { --hx-seg-inner: calc(var(--hx-control-h) - var(--corn-space-1) - 2 * var(--corn-border)); }
|
|
1489
|
+
@media (max-width: 767px) { :root { --hx-seg-inner: var(--hx-control-h); } }
|
|
1490
|
+
|
|
1491
|
+
/* The title of a panel: the Work panel, the node panel, the proposal bar, a detail in the Work panel and a dialog are one style. A node's name is long and
|
|
1492
|
+
often a path, so it wraps (overflow-wrap) in this size rather than being set larger than the panel's own words. */
|
|
1493
|
+
.hx-drawer-title, .hx-forge-detail-title, .hx-forge-notes-title, .hx-confirm-title, .hx-proposal-name { font-size: var(--corn-text-lg); font-weight: 700; line-height: 1.25; letter-spacing: normal; }
|
|
1494
|
+
|
|
1495
|
+
/* The head of a panel: its title row. The Work panel and the node panel start at one edge (the padding is --corn-panel-pad) and the head is at least this tall */
|
|
1496
|
+
.hx-forge-head, .hx-drawer-head { min-height: var(--corn-panel-head-height); }
|
|
1497
|
+
|
|
1498
|
+
/* The controls of a bar that had no height of their own */
|
|
1499
|
+
/* (the waiting line's Answer is in the proposal bar too, so it is the bar's height; it is a strip's action elsewhere, at its own size) */
|
|
1500
|
+
:where(.hx-forge-head, .hx-player-controls, .hx-player-as, .hx-proposal-bar .hx-waiting-line) .hx-btn, :where(.hx-header) .hx-live-chip { height: var(--hx-control-h); }
|
|
1501
|
+
/* ==== end of the panel head and control height ============================================================================================ */
|
package/explorer/layers.js
CHANGED
|
@@ -16,23 +16,23 @@ import { onThemeChange } from './theme.js';
|
|
|
16
16
|
import { NODE_THEMES } from '../core/schema.js';
|
|
17
17
|
import { STARTING_LAYERS, clientLayers, kindLetters, orderRows, startingLayerOf } from '../core/layers.js';
|
|
18
18
|
import { rowKeyOf, shownByProposal } from './layer-model.js';
|
|
19
|
-
import { layerShows } from './scene.js';
|
|
20
|
-
import { getMapStyle,
|
|
19
|
+
import { fillOfNode, groupOf, layerShows } from './scene.js';
|
|
20
|
+
import { STROKE_TOKEN, cssColor, fillOf, getMapStyle, kindToken, onMapStyleChange, pageReader, setMapSubjects } from './map-style.js';
|
|
21
|
+
import { over, parseColor, contrast } from '../core/color.js';
|
|
22
|
+
import { DARK_GROUND, LIGHT_GROUND } from './theme-model.js';
|
|
21
23
|
import { t } from './strings.js';
|
|
22
24
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
flow: NODE_THEMES.store.color, cloud: NODE_THEMES.external.color, web: NODE_THEMES.external.color, house: NODE_THEMES.floor.color, runs: '#5eead4',
|
|
30
|
-
};
|
|
25
|
+
/** The types a starting row's nodes have (House: floors and rooms; Cloud and the Public web: `external`), or none for a row that is not a node type */
|
|
26
|
+
const typesOf = (l) => (l.match && l.match.type ? [].concat(l.match.type) : []);
|
|
27
|
+
/** The dot of the two rows that are not a node type: Data Flow's lines and the ring of a run in flight. Every other row's built-in dot is its
|
|
28
|
+
* first type's colour in core/schema.js NODE_THEMES, the colour the map draws its nodes in when the theme sets none (one table, not two) */
|
|
29
|
+
const NOT_A_TYPE = { flow: '#fb923c', runs: '#5eead4' };
|
|
30
|
+
const builtIn = (l) => { const type = typesOf(l)[0]; return type && NODE_THEMES[type] ? NODE_THEMES[type].color : NOT_A_TYPE[l.key]; };
|
|
31
31
|
/** The starting layers that start off: the infra layer is its own view, and the physical world's are loaded when first turned on (spec 0029) */
|
|
32
32
|
const STARTS_OFF = new Set(['stack', 'machine', 'container', 'device', 'house', 'persona']);
|
|
33
33
|
|
|
34
34
|
/** The starting rows (core/layers.js STARTING_LAYERS) with the colour of their dot */
|
|
35
|
-
export const LAYER_DEFS = STARTING_LAYERS.map((l) => ({ ...l, color:
|
|
35
|
+
export const LAYER_DEFS = STARTING_LAYERS.map((l) => ({ ...l, color: builtIn(l) }));
|
|
36
36
|
|
|
37
37
|
const layerListeners = new Set();
|
|
38
38
|
/** Calls `fn` after a layer goes on or off (live.js starts or stops the live layer). Returns how to stop. */
|
|
@@ -81,22 +81,53 @@ export function clickWithLegendMenu(target, act) {
|
|
|
81
81
|
const defaultOf = (key) => (Object.hasOwn(state.layerDefaults, key) ? state.layerDefaults[key] : !STARTS_OFF.has(key));
|
|
82
82
|
const isOn = (key) => state.activeLayers[key] !== false;
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* A project layer's dot: the theme's `--corn-map-group-<key>`, else the colour of the first node the layer holds (a project layer has no
|
|
86
|
-
* colour of its own in the config: it is the theme's to give, so the contrast check sees it).
|
|
87
|
-
*/
|
|
88
|
-
function projectColor(layer) {
|
|
89
|
-
const set = getMapStyle().values[groupToken(layer.key)];
|
|
90
|
-
if (set) return set;
|
|
91
|
-
const first = state.nodes.find((n) => rowKeyOf(state, n) === layer.key);
|
|
92
|
-
return first ? first.color : NO_COLOR;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
84
|
const NO_COLOR = '#94a3b8';
|
|
96
85
|
/** A colour as the dot's style may hold it: a hex or an rgb()/rgba() of numbers, else the plain grey. A node's colour is the map's data
|
|
97
86
|
* (a proposal can set it), so it is checked before it reaches a style attribute, and escaped there all the same */
|
|
98
|
-
const
|
|
99
|
-
const
|
|
87
|
+
const NUM = '\\d{1,3}(?:\\.\\d+)?%?';
|
|
88
|
+
const SWATCH_RE = new RegExp(`^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\\(\\s*${NUM}(?:\\s*,\\s*|\\s+)${NUM}(?:\\s*,\\s*|\\s+)${NUM}(?:\\s*[,/]\\s*(?:\\d*\\.)?\\d+%?)?\\s*\\))$`, 'i');
|
|
89
|
+
const swatch = (c) => (typeof c === 'string' && c.length <= 64 && SWATCH_RE.test(c.trim()) ? c.trim() : NO_COLOR);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The colour of a row's dot: the fill the map draws for the row's nodes, by the map's own order (map-style.js `fillOf`: the type's or layer's
|
|
93
|
+
* token, then the starting group's), else the row's built-in colour on this ground (`themed`). `node` is what the row's nodes are: for a
|
|
94
|
+
* starting row its type (`typeOfRow`: a row of two types, House, speaks for its first, floors, so `--corn-map-group-house` is its dot unless
|
|
95
|
+
* the theme gives floors a colour of their own) and its key as the group; for a project row its first node's type with the layer. A finer kind's token is left out: a dot is a row's, not a kind's.
|
|
96
|
+
* A token's value is the theme's text and a node's colour is the project's: both go through `swatch` before they reach a style.
|
|
97
|
+
*/
|
|
98
|
+
function rowColor(node, built) {
|
|
99
|
+
const fill = fillOf(getMapStyle().values, node);
|
|
100
|
+
// The built-in is a node's colour (project data): normalised as the map's renderers read it (`cssColor`, the reader of the tokens), so a
|
|
101
|
+
// name or an `hsl()` the map draws is the dot too; anything that is not a colour is the grey
|
|
102
|
+
return fill ? swatch(fill) : swatch(cssColor(themed(built, state.theme)));
|
|
103
|
+
}
|
|
104
|
+
/** The type a row's dot speaks for: of a row of several types (House), the first one the map holds, else the first; a row with no type, its key */
|
|
105
|
+
const typeOfRow = (l) => { const types = typesOf(l); return (types.length > 1 && types.find((ty) => state.nodes.some((n) => n.type === ty))) || types[0] || l.key; };
|
|
106
|
+
|
|
107
|
+
/** The ground of the menu: its surface laid over the page, as `--corn-surface-1` and `--corn-ground` say, else the theme's own ground */
|
|
108
|
+
function menuSurface() {
|
|
109
|
+
const fallback = state.theme === 'light' ? LIGHT_GROUND : DARK_GROUND;
|
|
110
|
+
const read = pageReader();
|
|
111
|
+
if (!read) return fallback;
|
|
112
|
+
const ground = parseColor(read('--corn-ground'));
|
|
113
|
+
const surface = parseColor(read('--corn-surface-1'));
|
|
114
|
+
if (!ground[3] || !surface[3]) return fallback;
|
|
115
|
+
const [r, g, b] = over(surface, over(ground, [0, 0, 0, 1]));
|
|
116
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
117
|
+
}
|
|
118
|
+
/** The outline a dot or swatch gets when its fill is under 3:1 on the menu: the map's own outline colour when the theme sets one, else the CSS default (`.is-ringed`). The fill is never changed */
|
|
119
|
+
function ringOf(color, surface) {
|
|
120
|
+
if (contrast(color, surface) >= 3) return null;
|
|
121
|
+
const stroke = getMapStyle().values[STROKE_TOKEN];
|
|
122
|
+
return { stroke: stroke ? swatch(stroke) : '' };
|
|
123
|
+
}
|
|
124
|
+
/** A swatch of `color` on this menu: the fill, a soft glow on a dark ground, and the outline when it is needed. `extra` is more attributes (a kind's is `aria-hidden`) */
|
|
125
|
+
function dot(color, on, surface, extra = '') {
|
|
126
|
+
const ring = ringOf(color, surface);
|
|
127
|
+
const glow = on && state.theme !== 'light' ? (/^#[0-9a-f]{6}$/i.test(color) ? `0 0 8px ${color}90` : `0 0 8px color-mix(in srgb, ${color} 56%, transparent)`) : 'none';
|
|
128
|
+
const style = `background-color: ${color}; box-shadow: ${glow}${ring && ring.stroke ? `; --hx-dot-ring: ${ring.stroke}` : ''}`;
|
|
129
|
+
return `<span class="hx-dot${extra ? ' hx-kind-swatch' : ''}${ring ? ' is-ringed' : ''}" data-corn="swatch"${extra} style="${escHtml(style)}"></span>`;
|
|
130
|
+
}
|
|
100
131
|
|
|
101
132
|
/**
|
|
102
133
|
* The rows: the project layers that hold a node, then the starting ones in their usual order (`layers.order` first of all), and one more
|
|
@@ -104,6 +135,7 @@ const swatch = (c) => (typeof c === 'string' && SWATCH_RE.test(c.trim()) ? c.tri
|
|
|
104
135
|
* `root` is always shown and has no row. The overlays are the rows with `overlay`: the menu draws them under their own heading.
|
|
105
136
|
*/
|
|
106
137
|
function layerRows() {
|
|
138
|
+
const dotted = (l) => { const type = typeOfRow(l); return { ...l, color: rowColor({ type, group: l.key }, NODE_THEMES[type] ? NODE_THEMES[type].color : l.color) }; };
|
|
107
139
|
const held = new Set();
|
|
108
140
|
const left = new Set(); // starting layers a project layer took nodes from
|
|
109
141
|
state.nodes.forEach((n) => {
|
|
@@ -113,17 +145,21 @@ function layerRows() {
|
|
|
113
145
|
const own = startingLayerOf(n);
|
|
114
146
|
if (own !== key) left.add(own);
|
|
115
147
|
});
|
|
116
|
-
const
|
|
148
|
+
const projectDot = (l) => {
|
|
149
|
+
const first = state.nodes.find((n) => rowKeyOf(state, n) === l.key);
|
|
150
|
+
return { color: rowColor(first ? { type: first.type, layer: l.key, group: groupOf(first) } : { type: l.key, layer: l.key }, first ? fillOfNode(first) : NO_COLOR) };
|
|
151
|
+
};
|
|
152
|
+
const project = state.projectLayers.filter((l) => held.has(l.key)).map((l) => ({ key: l.key, label: l.label, desc: l.desc || '', project: true, ...projectDot(l) }));
|
|
117
153
|
// A starting row a project layer has taken every node from goes (spec 0009 D7, example 3); with no project layer, every starting row stays, as it always was
|
|
118
|
-
const starting = LAYER_DEFS.filter((l) => !l.overlay && (held.has(l.key) || !left.has(l.key)));
|
|
154
|
+
const starting = LAYER_DEFS.filter((l) => !l.overlay && (held.has(l.key) || !left.has(l.key))).map(dotted);
|
|
119
155
|
const known = new Set([...LAYER_DEFS.map((l) => l.key), ...state.projectLayers.map((l) => l.key)]);
|
|
120
156
|
const extra = [];
|
|
121
157
|
held.forEach((key) => {
|
|
122
158
|
if (known.has(key)) return;
|
|
123
159
|
known.add(key);
|
|
124
|
-
extra.push({ key, label: key.charAt(0).toUpperCase() + key.slice(1), color:
|
|
160
|
+
extra.push({ key, label: key.charAt(0).toUpperCase() + key.slice(1), color: rowColor({ type: key, group: key }, NO_COLOR), desc: `Nodes of the type ${key}` });
|
|
125
161
|
});
|
|
126
|
-
return { layers: [...orderRows(project, starting, state.layerOrder), ...extra], overlays: LAYER_DEFS.filter((l) => l.overlay) };
|
|
162
|
+
return { layers: [...orderRows(project, starting, state.layerOrder), ...extra], overlays: LAYER_DEFS.filter((l) => l.overlay).map(dotted) };
|
|
127
163
|
}
|
|
128
164
|
|
|
129
165
|
/** The chip says how many layers are on: " · 13 of 20". An overlay (Runs in flight) is not a layer: it is not counted */
|
|
@@ -198,20 +234,28 @@ function kindsByRow(rowOf) {
|
|
|
198
234
|
if (!key) return;
|
|
199
235
|
if (!rows.has(key)) rows.set(key, new Map());
|
|
200
236
|
const id = `${n.type}\u0000${n.kind}`;
|
|
201
|
-
const entry = rows.get(key).get(id) || { kind: n.kind, letters: letters.get(n.type).get(n.kind), n: 0 };
|
|
237
|
+
const entry = rows.get(key).get(id) || { type: n.type, kind: n.kind, letters: letters.get(n.type).get(n.kind), n: 0 };
|
|
202
238
|
entry.n++;
|
|
203
239
|
rows.get(key).set(id, entry);
|
|
204
240
|
});
|
|
205
241
|
return new Map([...rows].map(([k, m]) => [k, [...m.values()].sort((a, b) => a.kind.localeCompare(b.kind))]));
|
|
206
242
|
}
|
|
207
243
|
|
|
244
|
+
/** The swatch of a kind: the theme's `--corn-map-kind-<type>-<kind>`, as the map draws that kind, or nothing when the token is unset (the node then has its type's colour, which is the row's dot). Decoration: the letters and the name say which kind it is */
|
|
245
|
+
function kindSwatch(k, surface, pad) {
|
|
246
|
+
const fill = getMapStyle().values[kindToken(k.type, k.kind)];
|
|
247
|
+
if (!fill) return pad ? '<span class="hx-dot hx-kind-swatch is-blank" aria-hidden="true"></span>' : ''; // nothing to see, but the letters of the rows stay in line
|
|
248
|
+
return dot(swatch(fill), true, surface, ' aria-hidden="true"');
|
|
249
|
+
}
|
|
250
|
+
|
|
208
251
|
/** What a viewer sees as "kinds" for a row: the disclosure button and, when open, the key rows. A key is a key, not a toggle (spec 0009 D5) */
|
|
209
|
-
function kindsHtml(layer, kinds) {
|
|
252
|
+
function kindsHtml(layer, kinds, surface) {
|
|
210
253
|
if (!kinds || !kinds.length) return '';
|
|
211
254
|
const open = openKinds.has(layer.key);
|
|
212
255
|
const id = `layer-kinds-${layer.key}`;
|
|
213
256
|
const words = `${kinds.length} ${kinds.length === 1 ? 'kind' : 'kinds'}`;
|
|
214
|
-
const
|
|
257
|
+
const padded = kinds.some((k) => getMapStyle().values[kindToken(k.type, k.kind)]);
|
|
258
|
+
const list = open ? `<ul class="hx-kind-keys" id="${escHtml(id)}">${kinds.map((k) => `<li class="hx-kind-key" data-corn="kind-key">${kindSwatch(k, surface, padded)}<span class="hx-kind-letter" aria-hidden="true">${escHtml(k.letters)}</span><span class="hx-kind-name">${escHtml(k.kind)}</span><span class="hx-count" data-corn="count">${k.n}</span></li>`).join('')}</ul>` : '';
|
|
215
259
|
return `<div class="hx-kinds"><button type="button" class="hx-textbtn hx-kinds-btn" data-action="toggle-layer-kinds" data-layer="${escHtml(layer.key)}" aria-expanded="${open}" aria-controls="${escHtml(id)}" data-corn="layer-kinds" data-corn-kind="quiet">${open ? '▾' : '▸'} ${escHtml(words)}</button>${list}</div>`;
|
|
216
260
|
}
|
|
217
261
|
|
|
@@ -227,8 +271,10 @@ function syncMapSubjects() {
|
|
|
227
271
|
setMapSubjects({ kinds, layers: state.projectLayers.map((l) => l.key) });
|
|
228
272
|
}
|
|
229
273
|
|
|
274
|
+
let drawing = false;
|
|
230
275
|
export function renderLayerToggles() {
|
|
231
|
-
|
|
276
|
+
drawing = true;
|
|
277
|
+
try { syncMapSubjects(); } finally { drawing = false; } // reading the tokens of a new kind may tell the style listener below: this draw already has them
|
|
232
278
|
paintCount();
|
|
233
279
|
const container = document.getElementById('layer-toggles-container');
|
|
234
280
|
if (!container) return;
|
|
@@ -248,22 +294,22 @@ export function renderLayerToggles() {
|
|
|
248
294
|
counts.runs = state.runsMap ? state.runsMap.flight.size : 0;
|
|
249
295
|
const kinds = kindsByRow(rowOf);
|
|
250
296
|
const { layers, overlays } = layerRows();
|
|
297
|
+
const surface = menuSurface();
|
|
251
298
|
|
|
252
299
|
const row = (layer) => {
|
|
253
300
|
const on = isOn(layer.key);
|
|
254
|
-
const color = escHtml(swatch(themed(swatch(layer.color), state.theme))); // the dot is the colour the map draws on this ground
|
|
255
301
|
const shown = byProposal[layer.key] ? `<span class="hx-faint hx-layer-note" data-corn="layer-note">+${byProposal[layer.key]} shown by the proposal</span>` : '';
|
|
256
302
|
return `
|
|
257
303
|
<button type="button" class="hx-toggle-row${on ? '' : ' is-off'}" data-action="toggle-layer" data-layer="${escHtml(layer.key)}" aria-pressed="${on}" title="${escHtml(layer.desc)}" data-corn="row">
|
|
258
304
|
<span class="hx-toggle-label">
|
|
259
|
-
|
|
305
|
+
${dot(swatch(layer.color), on, surface)}
|
|
260
306
|
<span class="hx-toggle-name">${escHtml(layer.label)}</span>${layer.live ? '<span class="hx-live-tag" data-corn="live-tag">live</span>' : ''}
|
|
261
307
|
</span>
|
|
262
308
|
<span class="hx-toggle-meta">${shown}
|
|
263
309
|
<span class="hx-count" data-corn="count">${(UNIT[layer.key] || String)(counts[layer.key] || 0)}</span>
|
|
264
310
|
<span class="hx-tick">${on ? '✓' : '—'}</span>
|
|
265
311
|
</span>
|
|
266
|
-
</button>${kindsHtml(layer, kinds.get(layer.key))}`;
|
|
312
|
+
</button>${kindsHtml(layer, kinds.get(layer.key), surface)}`;
|
|
267
313
|
};
|
|
268
314
|
|
|
269
315
|
// The focus stays where it was across the redraw: the same row or disclosure, found again by what it names
|
|
@@ -352,3 +398,5 @@ export function toggleLayerKinds(key) {
|
|
|
352
398
|
|
|
353
399
|
// The dots and the legends are drawn in the theme's colours: drawn again when it changes (theme.js)
|
|
354
400
|
onThemeChange(() => renderLayerToggles());
|
|
401
|
+
// ... and when the map's own tokens change (a named theme, its stylesheet arriving, light and dark): the same signal the map is drawn again on
|
|
402
|
+
onMapStyleChange(() => { if (!drawing) renderLayerToggles(); });
|
package/explorer/map-style.js
CHANGED
|
@@ -35,8 +35,10 @@
|
|
|
35
35
|
|
|
36
36
|
import { NODE_THEMES } from '../core/schema.js';
|
|
37
37
|
import { parseColor } from './theme-model.js';
|
|
38
|
+
import { cssColor, rgbaText } from './css-color.js';
|
|
39
|
+
export { cssColor };
|
|
38
40
|
import { LABEL_MIN_FLOOR, looksFor } from './scene.js';
|
|
39
|
-
import { iconKeyShape, iconKeysFor, mapGroupToken, mapKindToken } from '../core/layers.js';
|
|
41
|
+
import { iconKeyShape, iconKeysFor, mapFillNames, mapGroupToken, mapKindToken } from '../core/layers.js';
|
|
40
42
|
|
|
41
43
|
/** The node kinds (topology types) and the groups (layers a node can belong to) the tokens exist for */
|
|
42
44
|
export const MAP_KINDS = Object.freeze(Object.keys(NODE_THEMES));
|
|
@@ -100,75 +102,6 @@ export const mapTokenNames = () => [...MAP_COLOR_TOKENS, STROKE_WIDTH_TOKEN, COL
|
|
|
100
102
|
// Reading a token
|
|
101
103
|
// ---------------------------------------------------------------------------
|
|
102
104
|
|
|
103
|
-
let probe;
|
|
104
|
-
const normalised = new Map();
|
|
105
|
-
|
|
106
|
-
/** A canvas context to normalise a colour the way the browser reads it (`hsl()`, a name, `color-mix()`), or null where there is none */
|
|
107
|
-
function probeContext() {
|
|
108
|
-
if (probe !== undefined) return probe;
|
|
109
|
-
probe = null;
|
|
110
|
-
try { if (typeof document !== 'undefined') probe = document.createElement('canvas').getContext('2d', { willReadFrequently: true }) || null; } catch { probe = null; }
|
|
111
|
-
return probe;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* A token's value as a colour the renderers can use (`#rrggbb`, `rgb()`, `rgba()`), or null for `auto`, empty, or anything that is not a colour.
|
|
116
|
-
* @param {string} value
|
|
117
|
-
* @returns {string | null}
|
|
118
|
-
*/
|
|
119
|
-
export function cssColor(value) {
|
|
120
|
-
const s = typeof value === 'string' ? value.trim() : '';
|
|
121
|
-
if (!s || s.toLowerCase() === 'auto') return null;
|
|
122
|
-
if (inRange(s)) return s;
|
|
123
|
-
if (/^transparent$/i.test(s)) return 'rgba(0, 0, 0, 0)';
|
|
124
|
-
if (normalised.has(s)) return normalised.get(s);
|
|
125
|
-
let out = null;
|
|
126
|
-
const ctx = isColor(s) && !/currentcolor/i.test(s) ? probeContext() : null; // a canvas has no current colour: it would read as black
|
|
127
|
-
if (ctx) {
|
|
128
|
-
try {
|
|
129
|
-
// The browser's own reading: a value it refuses leaves fillStyle as it was, so two different starting colours tell a refusal
|
|
130
|
-
// from a colour that happens to equal the first one
|
|
131
|
-
const read = (from) => { ctx.fillStyle = from; ctx.fillStyle = s; return String(ctx.fillStyle); };
|
|
132
|
-
const a = read('#010203');
|
|
133
|
-
const got = a !== '#010203' ? a : read('#040506') !== '#040506' ? a : null;
|
|
134
|
-
// A colour the browser keeps in another space (`oklch()`, `color(display-p3 ...)`) is read back as the sRGB pixel it paints
|
|
135
|
-
out = got === null ? null : parseable(got) ? got : pixelOf(ctx, s);
|
|
136
|
-
} catch { out = null; }
|
|
137
|
-
}
|
|
138
|
-
normalised.set(s, out);
|
|
139
|
-
return out;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** Whether CSS itself reads `s` as a colour (a canvas is more lenient: it takes `rgb(1.2.3, 0, 0)`); true where the page cannot say */
|
|
143
|
-
function isColor(s) {
|
|
144
|
-
try { return typeof CSS === 'undefined' || typeof CSS.supports !== 'function' || CSS.supports('color', s); } catch { return false; }
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/** `#rgb`, `#rrggbb`, `rgb()` or `rgba()` with every channel in range: what both renderers read as written */
|
|
148
|
-
function inRange(s) {
|
|
149
|
-
if (!parseable(s)) return false;
|
|
150
|
-
// The numbers as written: parseColor clamps them, and an out-of-range channel must go to the browser to be read
|
|
151
|
-
const nums = /^rgba?\(/i.test(s.trim()) ? s.slice(s.indexOf('(') + 1, s.lastIndexOf(')')).split(',').map(Number) : null;
|
|
152
|
-
if (nums && (nums.slice(0, 3).some((c) => !(c >= 0 && c <= 255)) || (nums.length > 3 && !(nums[3] > 0 && nums[3] <= 1)))) return false;
|
|
153
|
-
const [r, g, b, a] = parseColor(s);
|
|
154
|
-
return [r, g, b].every((c) => Number.isFinite(c) && c >= 0 && c <= 255) && Number.isFinite(a) && a > 0 && a <= 1;
|
|
155
|
-
}
|
|
156
|
-
/** The forms parseColor (theme-model.js) reads; anything else is normalised by the browser first */
|
|
157
|
-
const COLOR_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$|^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(?:,\s*[\d.]+\s*)?\)$/i;
|
|
158
|
-
const parseable = (s) => COLOR_RE.test(s.trim());
|
|
159
|
-
|
|
160
|
-
/** The sRGB pixel `css` paints, as `rgba()` (or null when the context cannot be read) */
|
|
161
|
-
function pixelOf(ctx, css) {
|
|
162
|
-
if (!ctx.getImageData || !ctx.fillRect) return null;
|
|
163
|
-
ctx.clearRect(0, 0, 1, 1);
|
|
164
|
-
ctx.fillStyle = css;
|
|
165
|
-
ctx.fillRect(0, 0, 1, 1);
|
|
166
|
-
const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data;
|
|
167
|
-
return rgbaText(r, g, b, a / 255);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const rgbaText = (r, g, b, a) => `rgba(${r}, ${g}, ${b}, ${+a.toFixed(3)})`;
|
|
171
|
-
|
|
172
105
|
/** `token` as the colour of something that was `original`: the token's colour, with the original's own alpha kept (a faint line stays faint) */
|
|
173
106
|
export function withAlphaOf(token, original) {
|
|
174
107
|
const [r, g, b, a] = parseColor(token);
|
|
@@ -456,6 +389,12 @@ export function watchMapStyle(doc) {
|
|
|
456
389
|
|
|
457
390
|
const firstOf = (values, names) => { for (const n of names) if (values[n]) return values[n]; return null; };
|
|
458
391
|
|
|
392
|
+
/** The tokens that can fill a node, most specific first (core/layers.js `mapFillNames`, the one place the order is written) */
|
|
393
|
+
export const fillNames = mapFillNames;
|
|
394
|
+
|
|
395
|
+
/** The theme's fill for a node of that kind, layer, type and group (`values` of a style), or null: the node then draws its own colour (`auto`) */
|
|
396
|
+
export const fillOf = (values, node) => firstOf(values, fillNames(node));
|
|
397
|
+
|
|
459
398
|
/** A line's shape in the theme: its width scaled to `--corn-map-edge-width`, its glow and its packet's by `--corn-map-glow` (nothing at `auto`) */
|
|
460
399
|
function shapeEdge(e, style) {
|
|
461
400
|
const scale = style.edgeWidth == null ? 1 : style.edgeWidth / BASE_EDGE_WIDTH;
|
|
@@ -489,7 +428,7 @@ function compute(scene, style) {
|
|
|
489
428
|
const painted = scene.painted || { nodes: new Set(), edges: new Set() };
|
|
490
429
|
const nodes = scene.nodes.map((n) => {
|
|
491
430
|
// Which fill wins, most specific first (spec 0009 D6): the finer kind, the project layer, the type, the starting layer
|
|
492
|
-
const fill = !painted.nodes.has(n.id) &&
|
|
431
|
+
const fill = !painted.nodes.has(n.id) && fillOf(values, n);
|
|
493
432
|
const icon = style.icons ? iconKeysFor(n.type, n.kind, n.layer).find((k) => style.icons.get(k)) || null : null; // the same order: kind, layer, type
|
|
494
433
|
const glows = style.glow != null && style.glow !== 1 && n.glow > 0;
|
|
495
434
|
if (!fill && !label && !stroke && !icon && !glows) return n;
|
package/explorer/scene.js
CHANGED
|
@@ -172,12 +172,13 @@ import { decorateHouseScene, houseEdgeStyle, houseShowsNode, houseViewEdges } fr
|
|
|
172
172
|
import { paintVerdict } from './check-model.js';
|
|
173
173
|
import { externalLayer, whenTicks } from './cloud-model.js';
|
|
174
174
|
import { lettersOf, projectLayerKey, shownByProposal } from './layer-model.js';
|
|
175
|
-
import { shapeOf } from '../core/schema.js';
|
|
175
|
+
import { NODE_THEMES, shapeOf } from '../core/schema.js';
|
|
176
176
|
import { hasGlyph } from './glyphs.js';
|
|
177
177
|
import { outageFor, paintOutage } from './outage-model.js';
|
|
178
178
|
import { paintForge } from './forge-panel-model.js';
|
|
179
179
|
import { lightColor, lightenScene, parseColor } from './theme-model.js';
|
|
180
180
|
import { matchIds } from './search-model.js';
|
|
181
|
+
import { nodeColor } from './css-color.js';
|
|
181
182
|
import { activeSubgraph, kindEdgeWord } from './selection-model.js';
|
|
182
183
|
import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, EDGE_MIN_ALPHA, MARK_SHAPES, REMOVED_ALPHA } from './diff-marks.js';
|
|
183
184
|
|
|
@@ -547,6 +548,13 @@ function buildEdges(state, subgraph, reduceMotion) {
|
|
|
547
548
|
/** A node's group: its layer in the Layers menu (layers.js), one per kind but for the rooms and floors (House) and the outside nodes (Cloud, or the Public web) */
|
|
548
549
|
export const groupOf = (node) => (node.type === 'floor' || node.type === 'room' ? 'house' : node.type === 'external' ? externalLayer(node) : node.type);
|
|
549
550
|
|
|
551
|
+
/**
|
|
552
|
+
* A node's fill before any theme token: its own `color` when that is a colour the browser reads, else its type's fill in NODE_THEMES (the
|
|
553
|
+
* built-in the map's fill order ends on, core/layers.js `mapFillNames`). Checked here, once, so WebGL and Canvas 2D are given the same valid
|
|
554
|
+
* fill and project data never reaches a shader or a `fillStyle` unchecked. The Layers menu's dot of a project layer reads it too (layers.js).
|
|
555
|
+
*/
|
|
556
|
+
export const fillOfNode = (node) => nodeColor(node.color) ?? (NODE_THEMES[node.type] || NODE_THEMES.external).color;
|
|
557
|
+
|
|
550
558
|
function buildNodes(state, subgraph) {
|
|
551
559
|
const { nodes, selectedNode, searchQuery } = state;
|
|
552
560
|
const found = searchQuery ? matchIds(nodes, searchQuery) : null; // what the search finds: label, id, file, type, kind (search-model.js)
|
|
@@ -586,7 +594,7 @@ function buildNodes(state, subgraph) {
|
|
|
586
594
|
hitR: shown.r * SHAPE_REACH[shapeOf(shown.type)], // the disc a click or tap hits: as far as the silhouette reaches (spatial.js)
|
|
587
595
|
...(hasGlyph(shown.type) ? { glyph: shown.type } : {}), // its built-in glyph, drawn where the core dot is once the node is wide enough (glyphs.js)
|
|
588
596
|
...(layer ? { layer } : {}),
|
|
589
|
-
x: node.x, y: node.y, r: shown.r, color: shown
|
|
597
|
+
x: node.x, y: node.y, r: shown.r, color: fillOfNode(shown),
|
|
590
598
|
alpha,
|
|
591
599
|
glow: connected && alpha >= 0.5 ? (big ? 15 : 9) : 0,
|
|
592
600
|
halo: match ? 'match' : selected ? 'selected' : child ? 'child' : 'none',
|
package/explorer/tokens.css
CHANGED
|
@@ -115,6 +115,13 @@
|
|
|
115
115
|
--corn-space-5: 16px;
|
|
116
116
|
--corn-space-6: 24px;
|
|
117
117
|
|
|
118
|
+
/* Density (issue #200). The one height of a control in a bar (the header, the proposal bar, the decision foot, the player, the Work panel's top row):
|
|
119
|
+
32px at a desk, 44px on a phone (the media query after the light blocks). The padding of a panel's body, which the Work panel and the node panel share,
|
|
120
|
+
and the least height of a panel's head: a control and a step of padding */
|
|
121
|
+
--corn-control-height: 32px;
|
|
122
|
+
--corn-panel-pad: calc(var(--corn-space-5) + var(--corn-space-1));
|
|
123
|
+
--corn-panel-head-height: calc(var(--corn-control-height) + var(--corn-space-3));
|
|
124
|
+
|
|
118
125
|
/* The House view's plan: the house's outline and each room's */
|
|
119
126
|
--corn-house-line: color-mix(in srgb, var(--corn-hue-lime) 18%, transparent);
|
|
120
127
|
--corn-house-room: color-mix(in srgb, var(--corn-hue-lime) 45%, transparent);
|
|
@@ -302,6 +309,11 @@
|
|
|
302
309
|
color-scheme: light;
|
|
303
310
|
}
|
|
304
311
|
|
|
312
|
+
/* A phone's density: controls are 44px tall (the target), and a panel pads by 16px under 640px. explorer.css floors a phone's control at 44px whatever
|
|
313
|
+
a brand sets (max(44px, …)); a brand that sets --corn-panel-pad on :root sets a phone's too, unless it sets it again under the same query */
|
|
314
|
+
@media (max-width: 767px) { :root { --corn-control-height: 44px; } }
|
|
315
|
+
@media (max-width: 639px) { :root { --corn-panel-pad: var(--corn-space-5); } }
|
|
316
|
+
|
|
305
317
|
/* ==========================================================================
|
|
306
318
|
The old --hx-* names, as aliases of the tokens above, for one release (scene.js, proposal.js and plugin
|
|
307
319
|
CSS still read them). They go in the next minor: write --corn-* in new CSS. proposal.js writes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcorn245/cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "popcorn245 (https://github.com/popcorn245)",
|