cornfield 0.21.0 → 0.23.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/config.js +5 -0
- package/core/theme.js +337 -0
- package/core/validate.js +37 -0
- package/explorer/explorer.css +499 -637
- package/explorer/house.css +20 -26
- package/explorer/index.html +10 -2
- package/explorer/plugins.js +2 -0
- package/explorer/theme-boot.js +22 -2
- package/explorer/theme-model.js +19 -0
- package/explorer/theme-names.js +61 -0
- package/explorer/tokens.css +271 -0
- package/package.json +1 -1
- package/server/server.js +98 -4
package/explorer/house.css
CHANGED
|
@@ -15,57 +15,51 @@
|
|
|
15
15
|
.hx-house-plan .floor-map__floor[hidden] { display: none; }
|
|
16
16
|
.hx-house-plan svg { display: block; width: 100%; height: 100%; overflow: visible; }
|
|
17
17
|
|
|
18
|
-
/* The plan
|
|
18
|
+
/* The plan: the house's outline faint (--corn-house-line; a little stronger on the light ground), each room a box with its name (pop-floor-map's markup, or the tool's plain boxes) */
|
|
19
19
|
.hx-house-plan .floor-map__svg,
|
|
20
|
-
.hx-house-plan .hx-plain-floor { background: var(--
|
|
20
|
+
.hx-house-plan .hx-plain-floor { background: color-mix(in srgb, var(--corn-ground) 55%, transparent); border: var(--corn-border) solid var(--corn-house-line); border-radius: var(--corn-radius-sm); font-family: var(--corn-font); }
|
|
21
21
|
.hx-house-plan .floor-map__box,
|
|
22
|
-
.hx-house-plan .hx-plain-room rect { fill:
|
|
22
|
+
.hx-house-plan .hx-plain-room rect { fill: color-mix(in srgb, var(--corn-hue-lime) 6%, transparent); stroke: var(--corn-house-room); stroke-width: 1.2; }
|
|
23
23
|
.hx-house-plan .floor-map__label,
|
|
24
|
-
.hx-house-plan .hx-plain-room text { fill: var(--
|
|
24
|
+
.hx-house-plan .hx-plain-room text { fill: var(--corn-hue-lime); font-size: var(--corn-text-md); font-weight: 600; }
|
|
25
25
|
.hx-house-plan .floor-map__badge { display: none; }
|
|
26
26
|
.hx-house-plan [aria-current="true"] .floor-map__box,
|
|
27
|
-
.hx-house-plan .hx-plain-room[aria-current="true"] rect { fill:
|
|
27
|
+
.hx-house-plan .hx-plain-room[aria-current="true"] rect { fill: color-mix(in srgb, var(--corn-accent-text) 18%, transparent); stroke: var(--corn-accent-text); stroke-width: 2.5; }
|
|
28
28
|
|
|
29
29
|
/* The floor chips at the stage's top left; on a phone the people and the Software and Cloud toggles in a row under them */
|
|
30
|
-
.hx-house-bar { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-start; gap:
|
|
30
|
+
.hx-house-bar { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: var(--corn-space-2); z-index: 12; pointer-events: none; }
|
|
31
31
|
.hx-house-bar[hidden] { display: none; }
|
|
32
|
-
.hx-house-floors, .hx-house-people { display: flex; flex-wrap: wrap; align-items: center; gap:
|
|
33
|
-
.hx-house-floors { max-width: 100%; padding:
|
|
32
|
+
.hx-house-floors, .hx-house-people { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-1); pointer-events: auto; }
|
|
33
|
+
.hx-house-floors { max-width: 100%; padding: var(--corn-space-1); border-radius: var(--corn-radius-pill); }
|
|
34
34
|
.hx-house-people[hidden] { display: none; }
|
|
35
|
-
.hx-house-chip { min-height: 28px; padding:
|
|
36
|
-
.hx-house-chip:hover { border-color:
|
|
37
|
-
.hx-house-chip:focus-visible { outline:
|
|
38
|
-
.hx-house-chip[aria-pressed="true"] { background:
|
|
39
|
-
.hx-house-chip--person { border-color:
|
|
35
|
+
.hx-house-chip { min-height: 28px; padding: var(--corn-space-1) var(--corn-space-4); border: var(--corn-border) solid color-mix(in srgb, var(--corn-text-3) 25%, transparent); border-radius: var(--corn-radius-pill); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text-2); font-weight: 600; font-size: var(--corn-text-sm); line-height: 1.2; font-family: inherit; cursor: pointer; white-space: nowrap; }
|
|
36
|
+
.hx-house-chip:hover { border-color: color-mix(in srgb, var(--corn-hue-lime) 50%, transparent); color: var(--corn-text); }
|
|
37
|
+
.hx-house-chip:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
|
|
38
|
+
.hx-house-chip[aria-pressed="true"] { background: var(--corn-hue-lime); border-color: var(--corn-hue-lime); color: var(--corn-ground); }
|
|
39
|
+
.hx-house-chip--person { border-color: color-mix(in srgb, var(--corn-hue-pink) 45%, transparent); }
|
|
40
40
|
.hx-house-chip--software, .hx-house-chip--cloud { border-style: dashed; }
|
|
41
|
-
.hx-house-tag { padding:
|
|
41
|
+
.hx-house-tag { padding: calc(var(--corn-space-1) / 2) var(--corn-space-3); font-size: var(--corn-text-xs); color: var(--corn-warn); }
|
|
42
42
|
/* "Edit layout": a link to where the plan is edited, looking like a chip; the arrow says it leaves the map */
|
|
43
43
|
.hx-house-edit { display: inline-flex; align-items: center; text-decoration: none; border-style: dashed; }
|
|
44
|
-
.hx-house-edit::after { content: "\2197"; margin-left:
|
|
44
|
+
.hx-house-edit::after { content: "\2197"; margin-left: var(--corn-space-1); opacity: 0.7; }
|
|
45
45
|
|
|
46
46
|
/* "+3": a room that holds more than its grid, where its last slot is */
|
|
47
47
|
.hx-house-over { position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; }
|
|
48
48
|
.hx-house-over[hidden] { display: none; }
|
|
49
|
-
.hx-house-more { position: absolute; left: 0; top: 0; min-width: 34px; height: 24px; padding: 0
|
|
50
|
-
.hx-house-more:hover, .hx-house-more:focus-visible { background:
|
|
49
|
+
.hx-house-more { position: absolute; left: 0; top: 0; min-width: 34px; height: 24px; padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-added); border-radius: var(--corn-radius-pill); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-added-text); font-weight: 700; font-size: var(--corn-text-sm); line-height: 1; font-family: inherit; cursor: pointer; pointer-events: auto; }
|
|
50
|
+
.hx-house-more:hover, .hx-house-more:focus-visible { background: var(--corn-added-text); color: var(--corn-ground); outline: none; }
|
|
51
51
|
|
|
52
52
|
/* The House button joins the toolbar: up to a wide screen the live chip's line is cut shorter (the whole line is in its
|
|
53
53
|
menu and its title), and on a narrow phone the toolbar tightens, so the toolbar still fits on one line */
|
|
54
54
|
@media (min-width: 768px) and (max-width: 1439px) { .hx-live-chip-text { max-width: 140px; } }
|
|
55
55
|
@media (max-width: 420px) {
|
|
56
|
-
.hx-header .hx-header-left, .hx-header .hx-header-right { gap:
|
|
57
|
-
.hx-header .hx-btn { padding-left:
|
|
56
|
+
.hx-header .hx-header-left, .hx-header .hx-header-right { gap: var(--corn-space-1); }
|
|
57
|
+
.hx-header .hx-btn { padding-left: var(--corn-space-2); padding-right: var(--corn-space-2); }
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
@media (max-width: 767px) {
|
|
61
61
|
.hx-house-bar { top: 8px; left: 8px; right: 8px; }
|
|
62
|
-
.hx-house-chip { min-height: 32px; padding:
|
|
62
|
+
.hx-house-chip { min-height: 32px; padding: var(--corn-space-1) var(--corn-space-4); }
|
|
63
63
|
.hx-house-people { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/* The plan on the light ground (MAP-01): the rooms' lime deepened the way theme-model.js `lightColor` deepens the map's */
|
|
67
|
-
:root[data-theme="light"] .hx-house-plan .floor-map__svg,
|
|
68
|
-
:root[data-theme="light"] .hx-house-plan .hx-plain-floor { border-color: rgba(101, 152, 19, 0.3); }
|
|
69
|
-
:root[data-theme="light"] .hx-house-plan .floor-map__box,
|
|
70
|
-
:root[data-theme="light"] .hx-house-plan .hx-plain-room rect { fill: rgba(101, 152, 13, 0.06); stroke: rgba(101, 152, 13, 0.55); }
|
|
71
|
-
:root[data-theme="light"] .hx-house-more { border-color: #209a8b; }
|
package/explorer/index.html
CHANGED
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
<!--@importmap-->
|
|
9
9
|
|
|
10
10
|
<!-- The explorer's own stylesheet and modules (explorer/): no build step, no CDN -->
|
|
11
|
-
|
|
12
|
-
<script src="/explorer/theme-boot.js"></script>
|
|
11
|
+
<link rel="stylesheet" href="/explorer/tokens.css" />
|
|
13
12
|
<link rel="stylesheet" href="/explorer/explorer.css" />
|
|
14
13
|
<link rel="stylesheet" href="/explorer/house.css" />
|
|
14
|
+
<!-- The config's theme (server/server.js puts it here, so it comes after cornfield's own CSS): font stylesheets, the repo's theme.css, a named theme -->
|
|
15
|
+
<!--@theme-->
|
|
16
|
+
<!-- Light or dark on <html data-theme>, and the named theme on <html data-theme-name>, before the first paint (theme-boot.js; theme.js
|
|
17
|
+
keeps it after). A classic script in the head, after every stylesheet link: it runs before the body is parsed, so before anything is
|
|
18
|
+
drawn, and the named theme's <link> above already exists when it runs. Keep it the last thing in the head. -->
|
|
19
|
+
<script src="/explorer/theme-boot.js"></script>
|
|
15
20
|
</head>
|
|
16
21
|
<body>
|
|
17
22
|
<!-- Top bar: layers, data-flow preset, search, layout mode, zoom, links -->
|
|
@@ -157,6 +162,9 @@
|
|
|
157
162
|
</svg>
|
|
158
163
|
</button>
|
|
159
164
|
|
|
165
|
+
<!-- The named themes of the config (`theme.names`): filled and shown by explorer/theme-names.js; hidden when there are none -->
|
|
166
|
+
<select id="theme-name-select" class="hx-forge-select" style="width:auto;max-width:9rem" aria-label="Theme" title="Theme" hidden></select>
|
|
167
|
+
|
|
160
168
|
<!-- The config's links (cornfield.config.js `links`), filled by explorer/plugins.js -->
|
|
161
169
|
<span id="cf-links" class="hx-links"></span>
|
|
162
170
|
</div>
|
package/explorer/plugins.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { escHtml } from './state.js';
|
|
18
|
+
import { initThemePicker } from './theme-names.js';
|
|
18
19
|
|
|
19
20
|
/** What the live layer shows when the repo names no live source */
|
|
20
21
|
export const NO_SOURCE = Object.freeze({
|
|
@@ -43,6 +44,7 @@ export function applyBranding(doc, config) {
|
|
|
43
44
|
if (title && config.title) title.textContent = config.title;
|
|
44
45
|
const heading = doc.getElementById('cf-heading');
|
|
45
46
|
if (heading && config.title) heading.textContent = `${config.title}: the map`;
|
|
47
|
+
initThemePicker(doc, config.theme);
|
|
46
48
|
const links = doc.getElementById('cf-links');
|
|
47
49
|
if (!links) return;
|
|
48
50
|
const html = Array.isArray(config.links) ? config.links
|
package/explorer/theme-boot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Before the first paint (a classic script in the head of explorer/index.html, not a module, so it
|
|
3
|
-
* before the page is drawn): puts the theme on <html data-theme>, so a light page never flashes dark. The
|
|
2
|
+
* Before the first paint (a classic script, the last thing in the head of explorer/index.html, not a module, so it
|
|
3
|
+
* runs before the body is parsed and the page is drawn): puts the theme on <html data-theme>, so a light page never flashes dark. The
|
|
4
4
|
* same rule as theme-model.js `themeChoiceFrom` and `resolveTheme` (a test holds them together); theme.js
|
|
5
5
|
* takes over once the modules load.
|
|
6
6
|
*/
|
|
@@ -14,3 +14,23 @@
|
|
|
14
14
|
|| (choice !== 'dark' && !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches));
|
|
15
15
|
document.documentElement.setAttribute('data-theme', light ? 'light' : 'dark');
|
|
16
16
|
})();
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* The named themes of the config (`theme.names`, docs/config.md#theme): the server puts them on <html data-theme-names="a b"
|
|
20
|
+
* data-theme-default="a">. This puts the viewer's pick (localStorage, when it is one of them) or the default on
|
|
21
|
+
* <html data-theme-name> before the first paint, and points the named theme's <link id="cf-theme-name-css"> at it (that link comes
|
|
22
|
+
* before this script in the head, so it exists now). Only a plain name (theme-model.js `themeNameHref`) ever reaches the attribute or
|
|
23
|
+
* the URL. The same rule as theme-model.js `themeNameFrom` (a test holds them together).
|
|
24
|
+
*/
|
|
25
|
+
(function () {
|
|
26
|
+
var root = document.documentElement;
|
|
27
|
+
var names = (root.getAttribute('data-theme-names') || '').split(' ').filter(function (n) { return /^[a-z0-9][a-z0-9-]{0,31}$/.test(n); });
|
|
28
|
+
if (!names.length) return;
|
|
29
|
+
var stored = null;
|
|
30
|
+
try { stored = window.localStorage.getItem('cornfield:theme-name'); } catch (e) { stored = null; }
|
|
31
|
+
var fallback = root.getAttribute('data-theme-default');
|
|
32
|
+
var name = stored && names.indexOf(stored) >= 0 ? stored : (fallback && names.indexOf(fallback) >= 0 ? fallback : '');
|
|
33
|
+
if (name) root.setAttribute('data-theme-name', name); else root.removeAttribute('data-theme-name');
|
|
34
|
+
var link = document.getElementById('cf-theme-name-css');
|
|
35
|
+
if (link) { if (name) link.setAttribute('href', '/cornfield/theme/' + name + '.css'); else link.removeAttribute('href'); }
|
|
36
|
+
})();
|
package/explorer/theme-model.js
CHANGED
|
@@ -30,6 +30,25 @@
|
|
|
30
30
|
export const THEME_CHOICES = ['system', 'light', 'dark'];
|
|
31
31
|
/** Where the choice is kept in the browser (theme.js); `?theme=` in the address wins over it, without being kept */
|
|
32
32
|
export const THEME_STORAGE_KEY = 'topology-explorer:theme';
|
|
33
|
+
/** Where a viewer's pick among the config's named themes is kept (theme-names.js); theme-boot.js reads the same key */
|
|
34
|
+
export const THEME_NAME_STORAGE_KEY = 'cornfield:theme-name';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The named theme in force: the stored pick when it is one of `names`, else the config's default when that is one, else none ('').
|
|
38
|
+
* The same rule as theme-boot.js (a test holds them together).
|
|
39
|
+
* @param {string|null} stored what THEME_NAME_STORAGE_KEY holds
|
|
40
|
+
* @param {string[]} names the config's theme names
|
|
41
|
+
* @param {string|null} fallback the config's default
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
export function themeNameFrom(stored, names, fallback) {
|
|
45
|
+
if (stored && names.includes(stored)) return stored;
|
|
46
|
+
return fallback && names.includes(fallback) ? fallback : '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Where a named theme's stylesheet is served (server/server.js); '' for no named theme */
|
|
50
|
+
export const themeNameHref = (name) => (/^[a-z0-9][a-z0-9-]{0,31}$/.test(name) ? `/cornfield/theme/${name}.css` : '');
|
|
51
|
+
|
|
33
52
|
/** The light page's ground (--hx-bg in explorer.css): what the light colours are measured against */
|
|
34
53
|
export const LIGHT_GROUND = '#f4f6fa';
|
|
35
54
|
/** The dark page's ground, for checking what the dark theme already does */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/theme-names
|
|
3
|
+
*
|
|
4
|
+
* The named themes of the config (`theme.names`, docs/config.md#theme), the half that touches the page after load. theme-boot.js has
|
|
5
|
+
* already put the pick on <html data-theme-name> before the first paint; this fills the small <select> in the header with the names,
|
|
6
|
+
* and on a change sets the attribute, points the named theme's stylesheet link at it, and keeps the pick in localStorage
|
|
7
|
+
* (THEME_NAME_STORAGE_KEY). A theme is CSS only: nothing here loads anything but a stylesheet from this origin.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { THEME_NAME_STORAGE_KEY, themeNameFrom, themeNameHref } from './theme-model.js';
|
|
11
|
+
|
|
12
|
+
function readStored() {
|
|
13
|
+
try { return window.localStorage.getItem(THEME_NAME_STORAGE_KEY); } catch { return null; }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function store(name, fallback) {
|
|
17
|
+
try {
|
|
18
|
+
if (name === fallback) window.localStorage.removeItem(THEME_NAME_STORAGE_KEY);
|
|
19
|
+
else window.localStorage.setItem(THEME_NAME_STORAGE_KEY, name);
|
|
20
|
+
} catch { /* storage blocked: the pick still holds for this visit */ }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Puts a named theme in force on the page ('' for none) */
|
|
24
|
+
export function setThemeName(doc, name) {
|
|
25
|
+
const root = doc.documentElement;
|
|
26
|
+
if (name) root.setAttribute('data-theme-name', name); else root.removeAttribute('data-theme-name');
|
|
27
|
+
const link = doc.getElementById('cf-theme-name-css');
|
|
28
|
+
const href = themeNameHref(name);
|
|
29
|
+
if (link) { if (href) link.setAttribute('href', href); else link.removeAttribute('href'); }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Fills the header's picker from the config (`{ names, default }`, from /cornfield/config.json) and wires it. Hidden when there are no names.
|
|
34
|
+
* @param {Document} doc
|
|
35
|
+
* @param {{ names?: string[], default?: string | null } | null | undefined} theme
|
|
36
|
+
*/
|
|
37
|
+
export function initThemePicker(doc, theme) {
|
|
38
|
+
const select = doc.getElementById('theme-name-select');
|
|
39
|
+
if (!select) return;
|
|
40
|
+
const names = theme && Array.isArray(theme.names) ? theme.names.filter((n) => themeNameHref(n)) : [];
|
|
41
|
+
if (!names.length) { select.hidden = true; return; }
|
|
42
|
+
const fallback = theme.default && names.includes(theme.default) ? theme.default : '';
|
|
43
|
+
select.textContent = '';
|
|
44
|
+
const add = (value, label) => {
|
|
45
|
+
const o = doc.createElement('option');
|
|
46
|
+
o.value = value;
|
|
47
|
+
o.textContent = label;
|
|
48
|
+
select.appendChild(o);
|
|
49
|
+
};
|
|
50
|
+
if (!fallback) add('', 'Standard');
|
|
51
|
+
for (const n of names) add(n, n);
|
|
52
|
+
const current = themeNameFrom(readStored(), names, fallback);
|
|
53
|
+
setThemeName(doc, current);
|
|
54
|
+
select.value = current;
|
|
55
|
+
select.hidden = false;
|
|
56
|
+
select.onchange = () => {
|
|
57
|
+
const next = names.includes(select.value) ? select.value : '';
|
|
58
|
+
setThemeName(doc, next);
|
|
59
|
+
store(next, fallback);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
The explorer's design tokens (docs/theming.md)
|
|
3
|
+
==========================================================================
|
|
4
|
+
The ONLY file in explorer/ that holds a literal colour, font, size, radius, border width, shadow or spacing:
|
|
5
|
+
explorer.css and house.css read these `--corn-*` custom properties and nothing else (a test holds it,
|
|
6
|
+
test/explorer/tokens.test.js). A brand re-skins the explorer by loading a stylesheet after this one that
|
|
7
|
+
redefines some of them.
|
|
8
|
+
|
|
9
|
+
Dark is on :root. Light is under BOTH the system setting (when the page has not been told dark) and the
|
|
10
|
+
page's own choice (<html data-theme="light">, set by theme-boot.js and theme.js), so the page is right
|
|
11
|
+
before and without the script. The two light blocks below are the same; keep them in step. */
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
/* Ground and surfaces */
|
|
15
|
+
--corn-ground: #090d16;
|
|
16
|
+
--corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.28) 0%, transparent 45%),
|
|
17
|
+
radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.22) 0%, transparent 45%),
|
|
18
|
+
radial-gradient(circle at 50% 50%, rgba(66, 153, 225, 0.10) 0%, transparent 60%);
|
|
19
|
+
--corn-surface-1: rgba(26, 34, 52, 0.72);
|
|
20
|
+
--corn-surface-2: rgba(30, 41, 59, 0.8);
|
|
21
|
+
--corn-surface-3: rgba(51, 65, 85, 0.8);
|
|
22
|
+
--corn-line: rgba(255, 255, 255, 0.12);
|
|
23
|
+
--corn-line-soft: rgba(255, 255, 255, 0.07);
|
|
24
|
+
--corn-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
|
|
25
|
+
--corn-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
|
|
26
|
+
--corn-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
|
27
|
+
--corn-shadow-color: rgba(0, 0, 0, 0.5);
|
|
28
|
+
--corn-glow: 8px;
|
|
29
|
+
--corn-scrim: rgba(0, 0, 0, 0.6);
|
|
30
|
+
--corn-blur: 16px;
|
|
31
|
+
|
|
32
|
+
/* Text */
|
|
33
|
+
--corn-text: #f8fafc;
|
|
34
|
+
--corn-text-2: #cbd5e1;
|
|
35
|
+
--corn-text-3: #94a3b8;
|
|
36
|
+
--corn-text-on-accent: #fff;
|
|
37
|
+
--corn-mockup-ground: #fff;
|
|
38
|
+
|
|
39
|
+
/* Accent */
|
|
40
|
+
--corn-accent: #4f46e5;
|
|
41
|
+
--corn-accent-hover: #6366f1;
|
|
42
|
+
--corn-accent-text: #818cf8;
|
|
43
|
+
--corn-accent-soft: color-mix(in srgb, var(--corn-accent-hover) 20%, transparent);
|
|
44
|
+
--corn-focus: #818cf8;
|
|
45
|
+
--corn-brand-gradient: linear-gradient(135deg, #4299e1 0%, #818cf8 50%, #e53e3e 100%);
|
|
46
|
+
|
|
47
|
+
/* Status: only ever means status */
|
|
48
|
+
--corn-ok: #34d399;
|
|
49
|
+
--corn-warn: #fcd34d;
|
|
50
|
+
--corn-bad: #fca5a5;
|
|
51
|
+
--corn-info: #7dd3fc;
|
|
52
|
+
--corn-ok-soft: color-mix(in srgb, var(--corn-ok) 15%, transparent);
|
|
53
|
+
--corn-warn-soft: color-mix(in srgb, var(--corn-warn) 14%, transparent);
|
|
54
|
+
--corn-bad-soft: color-mix(in srgb, var(--corn-bad) 12%, transparent);
|
|
55
|
+
--corn-info-soft: color-mix(in srgb, var(--corn-info) 15%, transparent);
|
|
56
|
+
|
|
57
|
+
/* Diff: what a proposal adds, changes, removes and edits (the map draws the same four) */
|
|
58
|
+
--corn-added: #2dd4bf;
|
|
59
|
+
--corn-changed: #fbbf24;
|
|
60
|
+
--corn-removed: #f87171;
|
|
61
|
+
--corn-edit: #a78bfa;
|
|
62
|
+
/* The same as text: mixed toward the text colour, so it reads on either ground */
|
|
63
|
+
--corn-added-text: color-mix(in srgb, var(--corn-added) 60%, var(--corn-text));
|
|
64
|
+
--corn-edit-text: color-mix(in srgb, var(--corn-edit) 60%, var(--corn-text));
|
|
65
|
+
|
|
66
|
+
/* Category hues (never status): the preset, ROM, variable and House accents */
|
|
67
|
+
--corn-hue-orange: #fb923c;
|
|
68
|
+
--corn-hue-fuchsia: #e879f9;
|
|
69
|
+
--corn-hue-pink: #f472b6;
|
|
70
|
+
--corn-hue-lime: #a3e635;
|
|
71
|
+
|
|
72
|
+
/* Type */
|
|
73
|
+
--corn-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
74
|
+
--corn-font-display: var(--corn-font);
|
|
75
|
+
--corn-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
|
|
76
|
+
--corn-text-2xs: 10px;
|
|
77
|
+
--corn-text-xs: 11px;
|
|
78
|
+
--corn-text-sm: 12px;
|
|
79
|
+
--corn-text-md: 13px;
|
|
80
|
+
--corn-text-base: 14px;
|
|
81
|
+
--corn-text-lg: 15px;
|
|
82
|
+
|
|
83
|
+
/* Shape */
|
|
84
|
+
--corn-radius-xs: 3px;
|
|
85
|
+
--corn-radius-sm: 6px;
|
|
86
|
+
--corn-radius: 10px;
|
|
87
|
+
--corn-radius-lg: 14px;
|
|
88
|
+
--corn-radius-pill: 999px;
|
|
89
|
+
--corn-border: 1px;
|
|
90
|
+
--corn-border-strong: 2px;
|
|
91
|
+
--corn-focus-width: 2px;
|
|
92
|
+
|
|
93
|
+
/* Spacing: padding, gaps and margins are steps of this scale (or calc() over it) */
|
|
94
|
+
--corn-space: 4px;
|
|
95
|
+
--corn-space-1: var(--corn-space);
|
|
96
|
+
--corn-space-2: 6px;
|
|
97
|
+
--corn-space-3: 8px;
|
|
98
|
+
--corn-space-4: 12px;
|
|
99
|
+
--corn-space-5: 16px;
|
|
100
|
+
--corn-space-6: 24px;
|
|
101
|
+
|
|
102
|
+
/* The House view's plan: the house's outline and each room's */
|
|
103
|
+
--corn-house-line: color-mix(in srgb, var(--corn-hue-lime) 18%, transparent);
|
|
104
|
+
--corn-house-room: color-mix(in srgb, var(--corn-hue-lime) 45%, transparent);
|
|
105
|
+
|
|
106
|
+
/* How much of a panel glyph's own colour is kept (.hx-glyph) */
|
|
107
|
+
--corn-glyph-mix: 100%;
|
|
108
|
+
|
|
109
|
+
color-scheme: dark;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Light: the same names, for the light ground */
|
|
113
|
+
@media (prefers-color-scheme: light) {
|
|
114
|
+
:root:not([data-theme="dark"]) {
|
|
115
|
+
--corn-ground: #f4f6fa;
|
|
116
|
+
--corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.12) 0%, transparent 45%),
|
|
117
|
+
radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.07) 0%, transparent 45%);
|
|
118
|
+
--corn-surface-1: rgba(255, 255, 255, 0.8);
|
|
119
|
+
--corn-surface-2: rgba(241, 245, 249, 0.92);
|
|
120
|
+
--corn-surface-3: rgba(226, 232, 240, 0.95);
|
|
121
|
+
--corn-line: rgba(15, 23, 42, 0.12);
|
|
122
|
+
--corn-line-soft: rgba(15, 23, 42, 0.07);
|
|
123
|
+
--corn-shadow: 0 8px 28px 0 rgba(15, 23, 42, 0.12);
|
|
124
|
+
--corn-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.25);
|
|
125
|
+
--corn-shadow-lg: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
|
|
126
|
+
--corn-shadow-color: rgba(15, 23, 42, 0.25);
|
|
127
|
+
--corn-glow: 0px;
|
|
128
|
+
--corn-scrim: rgba(15, 23, 42, 0.35);
|
|
129
|
+
|
|
130
|
+
--corn-text: #0f172a;
|
|
131
|
+
--corn-text-2: #334155;
|
|
132
|
+
--corn-text-3: #475569;
|
|
133
|
+
|
|
134
|
+
--corn-accent-text: #4f46e5;
|
|
135
|
+
--corn-focus: #4f46e5;
|
|
136
|
+
--corn-brand-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #dc2626 100%);
|
|
137
|
+
|
|
138
|
+
--corn-ok: #047857;
|
|
139
|
+
--corn-warn: #854d0e;
|
|
140
|
+
--corn-bad: #b91c1c;
|
|
141
|
+
--corn-info: #0369a1;
|
|
142
|
+
|
|
143
|
+
--corn-added: #209a8b;
|
|
144
|
+
--corn-changed: #b28103;
|
|
145
|
+
--corn-removed: #f64c4c;
|
|
146
|
+
--corn-edit: #9472f9;
|
|
147
|
+
|
|
148
|
+
--corn-hue-orange: #c2410c;
|
|
149
|
+
--corn-hue-fuchsia: #a21caf;
|
|
150
|
+
--corn-hue-pink: #be185d;
|
|
151
|
+
--corn-hue-lime: #4d7c0f;
|
|
152
|
+
|
|
153
|
+
--corn-house-line: color-mix(in srgb, var(--corn-hue-lime) 30%, transparent);
|
|
154
|
+
--corn-house-room: color-mix(in srgb, var(--corn-hue-lime) 55%, transparent);
|
|
155
|
+
|
|
156
|
+
--corn-glyph-mix: 45%;
|
|
157
|
+
|
|
158
|
+
color-scheme: light;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:root[data-theme="light"] {
|
|
163
|
+
--corn-ground: #f4f6fa;
|
|
164
|
+
--corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.12) 0%, transparent 45%),
|
|
165
|
+
radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.07) 0%, transparent 45%);
|
|
166
|
+
--corn-surface-1: rgba(255, 255, 255, 0.8);
|
|
167
|
+
--corn-surface-2: rgba(241, 245, 249, 0.92);
|
|
168
|
+
--corn-surface-3: rgba(226, 232, 240, 0.95);
|
|
169
|
+
--corn-line: rgba(15, 23, 42, 0.12);
|
|
170
|
+
--corn-line-soft: rgba(15, 23, 42, 0.07);
|
|
171
|
+
--corn-shadow: 0 8px 28px 0 rgba(15, 23, 42, 0.12);
|
|
172
|
+
--corn-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.25);
|
|
173
|
+
--corn-shadow-lg: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
|
|
174
|
+
--corn-shadow-color: rgba(15, 23, 42, 0.25);
|
|
175
|
+
--corn-glow: 0px;
|
|
176
|
+
--corn-scrim: rgba(15, 23, 42, 0.35);
|
|
177
|
+
|
|
178
|
+
--corn-text: #0f172a;
|
|
179
|
+
--corn-text-2: #334155;
|
|
180
|
+
--corn-text-3: #475569;
|
|
181
|
+
|
|
182
|
+
--corn-accent-text: #4f46e5;
|
|
183
|
+
--corn-focus: #4f46e5;
|
|
184
|
+
--corn-brand-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #dc2626 100%);
|
|
185
|
+
|
|
186
|
+
--corn-ok: #047857;
|
|
187
|
+
--corn-warn: #854d0e;
|
|
188
|
+
--corn-bad: #b91c1c;
|
|
189
|
+
--corn-info: #0369a1;
|
|
190
|
+
|
|
191
|
+
--corn-added: #209a8b;
|
|
192
|
+
--corn-changed: #b28103;
|
|
193
|
+
--corn-removed: #f64c4c;
|
|
194
|
+
--corn-edit: #9472f9;
|
|
195
|
+
|
|
196
|
+
--corn-hue-orange: #c2410c;
|
|
197
|
+
--corn-hue-fuchsia: #a21caf;
|
|
198
|
+
--corn-hue-pink: #be185d;
|
|
199
|
+
--corn-hue-lime: #4d7c0f;
|
|
200
|
+
|
|
201
|
+
--corn-house-line: color-mix(in srgb, var(--corn-hue-lime) 30%, transparent);
|
|
202
|
+
--corn-house-room: color-mix(in srgb, var(--corn-hue-lime) 55%, transparent);
|
|
203
|
+
|
|
204
|
+
--corn-glyph-mix: 45%;
|
|
205
|
+
|
|
206
|
+
color-scheme: light;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* ==========================================================================
|
|
210
|
+
The old --hx-* names, as aliases of the tokens above, for one release (scene.js, proposal.js and plugin
|
|
211
|
+
CSS still read them). They go in the next minor: write --corn-* in new CSS. proposal.js writes
|
|
212
|
+
--hx-mark-* on :root for the map's own ground; nothing in explorer/*.css reads them any more.
|
|
213
|
+
========================================================================== */
|
|
214
|
+
:root {
|
|
215
|
+
--hx-bg: var(--corn-ground);
|
|
216
|
+
--hx-text: var(--corn-text);
|
|
217
|
+
--hx-ink: var(--corn-text);
|
|
218
|
+
--hx-text-1: var(--corn-text);
|
|
219
|
+
--hx-text-2: var(--corn-text-2);
|
|
220
|
+
--hx-slate-300: var(--corn-text-2);
|
|
221
|
+
--hx-slate-400: var(--corn-text-3);
|
|
222
|
+
--hx-slate-500: var(--corn-text-3);
|
|
223
|
+
--hx-slate-600: var(--corn-text-3);
|
|
224
|
+
--hx-slate-700: var(--corn-surface-3);
|
|
225
|
+
--hx-slate-800: var(--corn-surface-2);
|
|
226
|
+
--hx-slate-900: var(--corn-ground);
|
|
227
|
+
--hx-slate-950: var(--corn-ground);
|
|
228
|
+
--hx-indigo: var(--corn-accent-text);
|
|
229
|
+
--hx-indigo-strong: var(--corn-accent);
|
|
230
|
+
--hx-emerald: var(--corn-ok);
|
|
231
|
+
--hx-amber: var(--corn-warn);
|
|
232
|
+
--hx-sky: var(--corn-info);
|
|
233
|
+
--hx-pink: var(--corn-hue-pink);
|
|
234
|
+
--hx-fuchsia: var(--corn-hue-fuchsia);
|
|
235
|
+
--hx-fuchsia-strong: var(--corn-hue-fuchsia);
|
|
236
|
+
--hx-red: var(--corn-bad);
|
|
237
|
+
--hx-code: var(--corn-warn);
|
|
238
|
+
--hx-orange-text: var(--corn-hue-orange);
|
|
239
|
+
--hx-orange-strong: var(--corn-hue-orange);
|
|
240
|
+
--hx-teal-text: var(--corn-added-text);
|
|
241
|
+
--hx-teal-strong: var(--corn-added-text);
|
|
242
|
+
--hx-violet-text: var(--corn-edit-text);
|
|
243
|
+
--hx-green-text: var(--corn-ok);
|
|
244
|
+
--hx-lime-text: var(--corn-hue-lime);
|
|
245
|
+
--hx-mark-added: var(--corn-added);
|
|
246
|
+
--hx-mark-changed: var(--corn-changed);
|
|
247
|
+
--hx-mark-removed: var(--corn-removed);
|
|
248
|
+
--hx-mark-edit: var(--corn-edit);
|
|
249
|
+
--hx-control: var(--corn-surface-2);
|
|
250
|
+
--hx-control-hover: var(--corn-surface-3);
|
|
251
|
+
--hx-control-off: color-mix(in srgb, var(--corn-ground) 40%, transparent);
|
|
252
|
+
--hx-well: color-mix(in srgb, var(--corn-ground) 80%, transparent);
|
|
253
|
+
--hx-well-soft: color-mix(in srgb, var(--corn-ground) 55%, transparent);
|
|
254
|
+
--hx-line: var(--corn-line);
|
|
255
|
+
--hx-line-soft: var(--corn-line-soft);
|
|
256
|
+
--hx-scroll: color-mix(in srgb, var(--corn-text) 18%, transparent);
|
|
257
|
+
--hx-scroll-hover: color-mix(in srgb, var(--corn-text) 28%, transparent);
|
|
258
|
+
--hx-swatch-solid: color-mix(in srgb, var(--corn-text) 55%, transparent);
|
|
259
|
+
--hx-backdrop: var(--corn-scrim);
|
|
260
|
+
--hx-glyph-mix: var(--corn-glyph-mix);
|
|
261
|
+
--surface-glass: var(--corn-surface-1);
|
|
262
|
+
--surface-glass-header: color-mix(in srgb, var(--corn-ground) 88%, transparent);
|
|
263
|
+
--border-glass: var(--corn-line);
|
|
264
|
+
--border-subtle: var(--corn-line-soft);
|
|
265
|
+
--glass-blur: blur(var(--corn-blur));
|
|
266
|
+
--glass-shadow: var(--corn-shadow);
|
|
267
|
+
--gradient-primary: var(--corn-brand-gradient);
|
|
268
|
+
--bg-gradient: var(--corn-ground-image), var(--corn-ground);
|
|
269
|
+
--pop-font-body: var(--corn-font);
|
|
270
|
+
--pop-font-mono: var(--corn-mono);
|
|
271
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.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)",
|