@cameronsjo/artificer 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -16
- package/bin/artificer.mjs +341 -5
- package/bin/lint-core.mjs +3 -2
- package/dist/react/chrome.d.ts +6 -2
- package/dist/react/chrome.d.ts.map +1 -1
- package/dist/react/chrome.js +4 -4
- package/dist/react/index.d.ts +4 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -1
- package/dist/react/interactive.d.ts +52 -0
- package/dist/react/interactive.d.ts.map +1 -0
- package/dist/react/interactive.js +210 -0
- package/dist/react/primitives.d.ts +20 -5
- package/dist/react/primitives.d.ts.map +1 -1
- package/dist/react/primitives.js +37 -9
- package/package.json +6 -1
- package/reference/SKILL.md +13 -9
- package/src/artificer-options.js +1 -1
- package/src/artificer-sploot.js +303 -0
- package/src/artificer-tailwind.css +86 -0
- package/src/artificer-texture.css +129 -23
- package/src/artificer-theme.js +31 -4
- package/src/artificer-whimsy.css +43 -34
- package/src/artificer-whimsy.js +1 -1
- package/src/artificer.css +392 -120
- package/src/assets/app-icon-1024.png +0 -0
- package/src/assets/app-icon.svg +1 -0
- package/src/assets/favicon-16.png +0 -0
- package/src/assets/favicon-180.png +0 -0
- package/src/assets/favicon-32.png +0 -0
- package/src/assets/favicon-48.png +0 -0
- package/src/assets/favicon-512.png +0 -0
- package/src/assets/favicon-legacy.svg +5 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/favicon.svg +1 -5
- package/src/assets/fonts/bricolage-grotesque-variable.woff2 +0 -0
- package/src/assets/fonts/jetbrains-mono-blocks.woff2 +0 -0
- package/src/assets/fonts/recursive-variable.woff2 +0 -0
- package/src/assets/og-image.png +0 -0
- package/src/assets/og-image.svg +14 -20
- package/src/primitives.json +74 -2
- package/src/print.css +4 -3
- package/src/theme-bootstrap.html +4 -2
- package/src/tokens.json +4 -4
- package/types/sploot.d.ts +48 -0
- package/src/assets/fonts/ia-writer-quattro-s-400-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-400.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-700-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-700.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-v-400-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-v-400.woff2 +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
ARTIFICER · Sploot
|
|
3
|
+
The system's critter: a Pembroke corgi, named for the flat-out,
|
|
4
|
+
back-legs-behind lounge corgis are known for. Drawn as real text — quadrant
|
|
5
|
+
block glyphs, 2×2 pixels per character — so it renders in JetBrains Mono
|
|
6
|
+
and copy-pastes into a terminal intact. Gold (--accent), single-tone,
|
|
7
|
+
static. Styles live in artificer.css (.sploot); doctrine in CLAUDE.md
|
|
8
|
+
§ Brand; reference page live-spec/sploot.html.
|
|
9
|
+
|
|
10
|
+
The pixel grids below are the ONE source for every pose. Everything else
|
|
11
|
+
(text layers here, SVG rects on a stats card, a favicon) derives from them.
|
|
12
|
+
Quadrant pixels render tall (about 0.3 × 0.65 em), so a grid reads about
|
|
13
|
+
twice as wide as it looks in source: keep the body ~3× longer than tall,
|
|
14
|
+
the ears wide-based triangles, the legs one row.
|
|
15
|
+
|
|
16
|
+
Hook: <span data-sploot="stand"></span>
|
|
17
|
+
data-sploot stand | droopy | sleep | sniff | mini
|
|
18
|
+
data-sploot-helmet fishbowl space helmet over the head
|
|
19
|
+
data-sploot-decorative aria-hidden (another element carries the meaning)
|
|
20
|
+
class="sploot--sm" size (--mini / --sm / default / --lg)
|
|
21
|
+
API: window.ArtificerSploot = { POSES, SCARF, toGlyphs, markup, build,
|
|
22
|
+
hydrate, observe, season }
|
|
23
|
+
═══════════════════════════════════════════════════════════════════════════ */
|
|
24
|
+
|
|
25
|
+
(function () {
|
|
26
|
+
'use strict';
|
|
27
|
+
|
|
28
|
+
// `#` is a pixel; anything else is empty. Every pose but `mini` is 30×8, so
|
|
29
|
+
// poses swap in place without the layout moving.
|
|
30
|
+
var POSES = {
|
|
31
|
+
// Ears up, fox snout, eye, long loaf, fluffy rump, four stubby legs.
|
|
32
|
+
stand: [
|
|
33
|
+
'....................#...#.....',
|
|
34
|
+
'...................###.###....',
|
|
35
|
+
'...................#######....',
|
|
36
|
+
'.####################.######..',
|
|
37
|
+
'##############################',
|
|
38
|
+
'##########################....',
|
|
39
|
+
'.#######################......',
|
|
40
|
+
'...##..##..........##..##.....',
|
|
41
|
+
],
|
|
42
|
+
// Ears flopped forward, a little lower in the shoulders.
|
|
43
|
+
droopy: [
|
|
44
|
+
'..............................',
|
|
45
|
+
'..............................',
|
|
46
|
+
'....................##..##....',
|
|
47
|
+
'...................#######....',
|
|
48
|
+
'.####################.######..',
|
|
49
|
+
'##############################',
|
|
50
|
+
'#########################.....',
|
|
51
|
+
'...##..##..........##..##.....',
|
|
52
|
+
],
|
|
53
|
+
// The namesake: belly down, eyes shut, back legs stretched out behind.
|
|
54
|
+
sleep: [
|
|
55
|
+
'..............................',
|
|
56
|
+
'..............................',
|
|
57
|
+
'....................#...#.....',
|
|
58
|
+
'...................###.###....',
|
|
59
|
+
'...########################...',
|
|
60
|
+
'..##########################..',
|
|
61
|
+
'..#########################...',
|
|
62
|
+
'############################..',
|
|
63
|
+
],
|
|
64
|
+
// Nose down: the standing body with the head lowered two rows, tail up.
|
|
65
|
+
sniff: [
|
|
66
|
+
'..............................',
|
|
67
|
+
'..............................',
|
|
68
|
+
'.##.................#...#.....',
|
|
69
|
+
'.#####################.###....',
|
|
70
|
+
'##########################....',
|
|
71
|
+
'#####################.######..',
|
|
72
|
+
'.#############################',
|
|
73
|
+
'...##..##...........##..##....',
|
|
74
|
+
],
|
|
75
|
+
// Two text rows — a marker (e.g. beside the current table-of-contents
|
|
76
|
+
// entry). Pair with .sploot--mini.
|
|
77
|
+
mini: [
|
|
78
|
+
'...........#.#..',
|
|
79
|
+
'..........#####.',
|
|
80
|
+
'.###########.###',
|
|
81
|
+
'..#..#.....#..#.',
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Winter scarf for `stand`: a band around the neck, the end flying back
|
|
86
|
+
// over the shoulders. Its own layer so it can take --brand-purple.
|
|
87
|
+
var SCARF = [
|
|
88
|
+
'..............................',
|
|
89
|
+
'..............................',
|
|
90
|
+
'............#######...........',
|
|
91
|
+
'..................###.........',
|
|
92
|
+
'..................###.........',
|
|
93
|
+
'..................###.........',
|
|
94
|
+
'..............................',
|
|
95
|
+
'..............................',
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
// Text overlays, already in glyph rows (they're characters, not pixels).
|
|
99
|
+
var TEXT_OVERLAYS = {
|
|
100
|
+
sleep: { cls: 'sploot__zzz', rows: [' z', ' z'] },
|
|
101
|
+
sniff: { cls: 'sploot__scent', rows: [' ', ' ', ' ', ' · ·'] },
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var HELMET = [
|
|
105
|
+
' ╭──────╮',
|
|
106
|
+
' │ │',
|
|
107
|
+
' │ │',
|
|
108
|
+
' ╰──────╯',
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
var DESCRIBE = {
|
|
112
|
+
stand: 'Sploot the corgi',
|
|
113
|
+
droopy: 'Sploot the corgi, ears drooping',
|
|
114
|
+
sleep: 'Sploot the corgi, asleep',
|
|
115
|
+
sniff: 'Sploot the corgi, sniffing the ground',
|
|
116
|
+
mini: 'Sploot the corgi',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Index = TL | TR<<1 | BL<<2 | BR<<3 over each 2×2 pixel block.
|
|
120
|
+
var GLYPH = [' ', '▘', '▝', '▀', '▖', '▌', '▞', '▛',
|
|
121
|
+
'▗', '▚', '▐', '▜', '▄', '▙', '▟', '█'];
|
|
122
|
+
|
|
123
|
+
// Pixel grid → rows of quadrant glyphs. Trailing blanks are trimmed; an
|
|
124
|
+
// all-blank row becomes one space so the row keeps its line box.
|
|
125
|
+
function toGlyphs(grid) {
|
|
126
|
+
var width = 0;
|
|
127
|
+
grid.forEach(function (row) { if (row.length > width) width = row.length; });
|
|
128
|
+
var at = function (x, y) { return grid[y] && grid[y].charAt(x) === '#' ? 1 : 0; };
|
|
129
|
+
var rows = [];
|
|
130
|
+
for (var y = 0; y < grid.length; y += 2) {
|
|
131
|
+
var line = '';
|
|
132
|
+
for (var x = 0; x < width; x += 2) {
|
|
133
|
+
line += GLYPH[at(x, y) | (at(x + 1, y) << 1) | (at(x, y + 1) << 2) | (at(x + 1, y + 1) << 3)];
|
|
134
|
+
}
|
|
135
|
+
rows.push(line.replace(/\s+$/, '') || ' ');
|
|
136
|
+
}
|
|
137
|
+
return rows;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Northern-hemisphere meteorological seasons, from a Date (default: now).
|
|
141
|
+
function season(date) {
|
|
142
|
+
var m = (date || new Date()).getMonth();
|
|
143
|
+
if (m === 11 || m <= 1) return 'winter';
|
|
144
|
+
if (m <= 4) return 'spring';
|
|
145
|
+
if (m <= 7) return 'summer';
|
|
146
|
+
return 'autumn';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var warned = {};
|
|
150
|
+
function resolvePose(pose) {
|
|
151
|
+
if (pose && Object.prototype.hasOwnProperty.call(POSES, pose)) return pose;
|
|
152
|
+
if (pose && !warned[pose] && typeof console !== 'undefined') {
|
|
153
|
+
warned[pose] = true;
|
|
154
|
+
console.warn('[ArtificerSploot] unknown pose "' + pose + '"; drawing "stand"');
|
|
155
|
+
}
|
|
156
|
+
return 'stand';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// The layers for a pose, in paint order: body, then pose overlay, then
|
|
160
|
+
// helmet. With a helmet every layer drops one row to make room for the dome.
|
|
161
|
+
function layers(pose, opts) {
|
|
162
|
+
var helmet = !!(opts && opts.helmet);
|
|
163
|
+
var lift = function (rows) { return helmet ? [' '].concat(rows) : rows; };
|
|
164
|
+
var out = [{ cls: 'sploot__body', rows: lift(toGlyphs(POSES[pose])) }];
|
|
165
|
+
if (pose === 'stand') out.push({ cls: 'sploot__scarf', rows: lift(toGlyphs(SCARF)) });
|
|
166
|
+
if (TEXT_OVERLAYS[pose]) out.push({ cls: TEXT_OVERLAYS[pose].cls, rows: lift(TEXT_OVERLAYS[pose].rows) });
|
|
167
|
+
if (helmet) out.push({ cls: 'sploot__helmet', rows: HELMET });
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function describe(pose, opts) {
|
|
172
|
+
return DESCRIBE[pose] + (opts && opts.helmet ? ', in a fishbowl space helmet' : '') + ', drawn in block characters';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function escapeHtml(s) {
|
|
176
|
+
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Server-side / build-time rendering: the same element build() makes, as an
|
|
180
|
+
// HTML string. Needs no DOM, so a static-site build can import this module
|
|
181
|
+
// for effect and render Sploot with JavaScript off in the browser.
|
|
182
|
+
function markup(pose, opts) {
|
|
183
|
+
opts = opts || {};
|
|
184
|
+
var p = resolvePose(pose);
|
|
185
|
+
var cls = ['sploot'];
|
|
186
|
+
if (opts.size) cls.push('sploot--' + escapeHtml(opts.size));
|
|
187
|
+
else if (p === 'mini') cls.push('sploot--mini');
|
|
188
|
+
if (opts.className) cls.push(escapeHtml(opts.className));
|
|
189
|
+
var a11y = opts.decorative
|
|
190
|
+
? ' aria-hidden="true"'
|
|
191
|
+
: ' role="img" aria-label="' + escapeHtml(opts.label || describe(p, opts)) + '"';
|
|
192
|
+
var inner = layers(p, opts).map(function (l) {
|
|
193
|
+
return '<span class="sploot__layer ' + l.cls + '">' + escapeHtml(l.rows.join('\n')) + '</span>';
|
|
194
|
+
}).join('');
|
|
195
|
+
return '<span class="' + cls.join(' ') + '"' + a11y + '>' + inner + '</span>';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Fill an existing host element (the data-sploot hook) or a fresh span.
|
|
199
|
+
function build(pose, opts, host) {
|
|
200
|
+
opts = opts || {};
|
|
201
|
+
var p = resolvePose(pose);
|
|
202
|
+
var el = host || document.createElement('span');
|
|
203
|
+
el.classList.add('sploot');
|
|
204
|
+
if (opts.size) el.classList.add('sploot--' + opts.size);
|
|
205
|
+
else if (p === 'mini' && !/\bsploot--/.test(el.className)) el.classList.add('sploot--mini');
|
|
206
|
+
if (opts.decorative) {
|
|
207
|
+
el.setAttribute('aria-hidden', 'true');
|
|
208
|
+
el.removeAttribute('role');
|
|
209
|
+
} else {
|
|
210
|
+
el.removeAttribute('aria-hidden');
|
|
211
|
+
el.setAttribute('role', 'img');
|
|
212
|
+
// Keep an author's label; refresh one we generated, so a re-posed
|
|
213
|
+
// Sploot never announces its previous pose.
|
|
214
|
+
if (opts.label) {
|
|
215
|
+
el.setAttribute('aria-label', opts.label);
|
|
216
|
+
el.removeAttribute('data-sploot-auto-label');
|
|
217
|
+
} else if (!el.hasAttribute('aria-label') || el.hasAttribute('data-sploot-auto-label')) {
|
|
218
|
+
el.setAttribute('aria-label', describe(p, opts));
|
|
219
|
+
el.setAttribute('data-sploot-auto-label', '');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
el.replaceChildren();
|
|
223
|
+
layers(p, opts).forEach(function (l) {
|
|
224
|
+
var span = document.createElement('span');
|
|
225
|
+
span.className = 'sploot__layer ' + l.cls;
|
|
226
|
+
span.textContent = l.rows.join('\n');
|
|
227
|
+
el.appendChild(span);
|
|
228
|
+
});
|
|
229
|
+
return el;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function hydrate(root) {
|
|
233
|
+
var scope = root || document;
|
|
234
|
+
if (!scope.querySelectorAll) return;
|
|
235
|
+
var hosts = scope.querySelectorAll('[data-sploot]:not([data-sploot-hydrated])');
|
|
236
|
+
Array.prototype.forEach.call(hosts, function (el) {
|
|
237
|
+
build(el.getAttribute('data-sploot'), {
|
|
238
|
+
helmet: el.hasAttribute('data-sploot-helmet'),
|
|
239
|
+
decorative: el.hasAttribute('data-sploot-decorative'),
|
|
240
|
+
}, el);
|
|
241
|
+
el.setAttribute('data-sploot-hydrated', '');
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Hydrate now, then watch for inserted or re-posed hosts (SPA). Returns a
|
|
246
|
+
// disconnect fn.
|
|
247
|
+
function observe(root) {
|
|
248
|
+
var target = root || document.body;
|
|
249
|
+
hydrate(target);
|
|
250
|
+
if (typeof MutationObserver === 'undefined') return function () {};
|
|
251
|
+
var scheduled = false;
|
|
252
|
+
// rAF must be called as a method — a detached reference throws "Illegal
|
|
253
|
+
// invocation" — so wrap it rather than pick the function by ||.
|
|
254
|
+
var schedule = typeof window.requestAnimationFrame === 'function'
|
|
255
|
+
? function (fn) { window.requestAnimationFrame(fn); }
|
|
256
|
+
: function (fn) { setTimeout(fn, 16); };
|
|
257
|
+
var mo = new MutationObserver(function (mutations) {
|
|
258
|
+
mutations.forEach(function (m) {
|
|
259
|
+
if (m.type === 'attributes') m.target.removeAttribute('data-sploot-hydrated');
|
|
260
|
+
});
|
|
261
|
+
if (scheduled) return;
|
|
262
|
+
scheduled = true;
|
|
263
|
+
schedule(function () { scheduled = false; hydrate(target); });
|
|
264
|
+
});
|
|
265
|
+
mo.observe(target, {
|
|
266
|
+
childList: true,
|
|
267
|
+
subtree: true,
|
|
268
|
+
attributes: true,
|
|
269
|
+
attributeFilter: ['data-sploot', 'data-sploot-helmet', 'data-sploot-decorative'],
|
|
270
|
+
});
|
|
271
|
+
return function () { mo.disconnect(); };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
var api = {
|
|
275
|
+
POSES: POSES,
|
|
276
|
+
SCARF: SCARF,
|
|
277
|
+
toGlyphs: toGlyphs,
|
|
278
|
+
markup: markup,
|
|
279
|
+
build: build,
|
|
280
|
+
hydrate: hydrate,
|
|
281
|
+
observe: observe,
|
|
282
|
+
season: season,
|
|
283
|
+
};
|
|
284
|
+
// globalThis === window in a browser; in Node it lets a unit test or a
|
|
285
|
+
// static-site build import this file and call toGlyphs()/markup().
|
|
286
|
+
if (typeof window !== 'undefined') window.ArtificerSploot = api;
|
|
287
|
+
else if (typeof globalThis !== 'undefined') globalThis.ArtificerSploot = api;
|
|
288
|
+
|
|
289
|
+
if (typeof document === 'undefined') return;
|
|
290
|
+
|
|
291
|
+
// Stamp the season once, unless the page already did (a pre-paint script
|
|
292
|
+
// can set it to avoid any flash; Sploot itself hydrates after load anyway).
|
|
293
|
+
function autoInit() {
|
|
294
|
+
var html = document.documentElement;
|
|
295
|
+
if (!html.hasAttribute('data-season')) html.setAttribute('data-season', season());
|
|
296
|
+
observe(document.body);
|
|
297
|
+
}
|
|
298
|
+
if (document.readyState === 'loading') {
|
|
299
|
+
document.addEventListener('DOMContentLoaded', autoInit);
|
|
300
|
+
} else {
|
|
301
|
+
autoInit();
|
|
302
|
+
}
|
|
303
|
+
})();
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
ARTIFICER · Tailwind v4 @theme adapter
|
|
3
|
+
Import AFTER @import "tailwindcss"; and @import "@cameronsjo/artificer/artificer.css";
|
|
4
|
+
|
|
5
|
+
@import "tailwindcss";
|
|
6
|
+
@import "@cameronsjo/artificer/artificer.css";
|
|
7
|
+
@import "@cameronsjo/artificer/tailwind.css";
|
|
8
|
+
|
|
9
|
+
Maps Artificer CSS custom properties into Tailwind v4's @theme namespace so
|
|
10
|
+
utilities (bg-bg, text-fg, text-accent, font-body, font-interface, font-mono,
|
|
11
|
+
p-md, rounded-md) stay theme-reactive and version-locked to artificer.css.
|
|
12
|
+
═══════════════════════════════════════════════════════════════════════════ */
|
|
13
|
+
|
|
14
|
+
@theme {
|
|
15
|
+
/* Surfaces */
|
|
16
|
+
--color-bg: var(--bg);
|
|
17
|
+
--color-bg-raised: var(--bg-raised);
|
|
18
|
+
--color-bg-overlay: var(--bg-overlay);
|
|
19
|
+
--color-bg-inactive: var(--bg-inactive);
|
|
20
|
+
|
|
21
|
+
/* Foreground & borders */
|
|
22
|
+
--color-fg: var(--fg);
|
|
23
|
+
--color-fg-secondary: var(--fg-secondary);
|
|
24
|
+
--color-fg-muted: var(--fg-muted);
|
|
25
|
+
--color-fg-disabled: var(--fg-disabled);
|
|
26
|
+
--color-border: var(--border);
|
|
27
|
+
--color-border-lifted: var(--border-lifted);
|
|
28
|
+
|
|
29
|
+
/* Semantic */
|
|
30
|
+
--color-accent: var(--accent);
|
|
31
|
+
--color-accent-bright: var(--accent-bright);
|
|
32
|
+
--color-accent-fill: var(--accent-fill);
|
|
33
|
+
--color-on-accent: var(--on-accent);
|
|
34
|
+
--color-attention: var(--attention);
|
|
35
|
+
--color-attention-fill: var(--attention-fill);
|
|
36
|
+
--color-on-attention: var(--on-attention);
|
|
37
|
+
--color-urgent: var(--urgent);
|
|
38
|
+
--color-urgent-fill: var(--urgent-fill);
|
|
39
|
+
--color-urgent-text: var(--urgent-text);
|
|
40
|
+
--color-on-urgent: var(--on-urgent);
|
|
41
|
+
--color-success: var(--success);
|
|
42
|
+
--color-success-fill: var(--success-fill);
|
|
43
|
+
--color-on-success: var(--on-success);
|
|
44
|
+
--color-steel: var(--steel);
|
|
45
|
+
--color-steel-fill: var(--steel-fill);
|
|
46
|
+
--color-diff-add-bg: var(--diff-add-bg);
|
|
47
|
+
--color-diff-del-bg: var(--diff-del-bg);
|
|
48
|
+
|
|
49
|
+
/* Brand */
|
|
50
|
+
--color-brand-purple: var(--brand-purple);
|
|
51
|
+
--color-brand-purple-bright: var(--brand-purple-bright);
|
|
52
|
+
--color-brand-purple-fill: var(--brand-purple-fill);
|
|
53
|
+
|
|
54
|
+
/* Typography — bound to Artificer's bundled variable faces (ADR 0046) */
|
|
55
|
+
--font-mono: 'JetBrains Mono', 'Berkeley Mono', ui-monospace, 'SF Mono', Menlo, monospace;
|
|
56
|
+
--font-body: 'Bricolage Grotesque', 'Source Sans 3', system-ui, -apple-system, sans-serif;
|
|
57
|
+
--font-interface: 'Recursive', 'Source Sans 3', system-ui, -apple-system, sans-serif;
|
|
58
|
+
--font-sans: 'Bricolage Grotesque', 'Source Sans 3', system-ui, -apple-system, sans-serif;
|
|
59
|
+
|
|
60
|
+
/* Spacing (8px grid) */
|
|
61
|
+
--spacing-xs: var(--s-xs);
|
|
62
|
+
--spacing-sm: var(--s-sm);
|
|
63
|
+
--spacing-md: var(--s-md);
|
|
64
|
+
--spacing-lg: var(--s-lg);
|
|
65
|
+
--spacing-xl: var(--s-xl);
|
|
66
|
+
--spacing-2xl: var(--s-2xl);
|
|
67
|
+
--spacing-3xl: var(--s-3xl);
|
|
68
|
+
|
|
69
|
+
/* Radius */
|
|
70
|
+
--radius-sm: 4px;
|
|
71
|
+
--radius-md: 8px;
|
|
72
|
+
--radius-lg: 12px;
|
|
73
|
+
--radius-pill: 999px;
|
|
74
|
+
|
|
75
|
+
/* Shadows */
|
|
76
|
+
--shadow-overlay: var(--shadow-overlay);
|
|
77
|
+
--shadow-popover: var(--shadow-popover);
|
|
78
|
+
|
|
79
|
+
/* Motion */
|
|
80
|
+
--ease-artificer: cubic-bezier(0.2, 0.7, 0.3, 1);
|
|
81
|
+
|
|
82
|
+
/* Breakpoints */
|
|
83
|
+
--breakpoint-mobile: 640px;
|
|
84
|
+
--breakpoint-tablet: 800px;
|
|
85
|
+
--breakpoint-wide: 1200px;
|
|
86
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
-
ARTIFICER · Texture · v0.12.0 (the third — and ceiling — sanctioned carve)
|
|
2
|
+
ARTIFICER · Texture · v0.12.0 → drafting v0.28 (the third — and ceiling — sanctioned carve)
|
|
3
3
|
─────────────────────────────────────────────────────────────────────────
|
|
4
4
|
Artificer's surfaces are flat solid fills by doctrine. This file is the
|
|
5
5
|
bounded place that relaxes that — material honesty, not decoration. Read
|
|
@@ -28,26 +28,30 @@
|
|
|
28
28
|
|
|
29
29
|
:root {
|
|
30
30
|
/* ── knobs ─────────────────────────────────────────────────────────────── */
|
|
31
|
-
--tex-dot-gap: 14px; /* dot-matrix lattice pitch. Sweet spot 14; 12–16. */
|
|
32
|
-
--tex-fiber-strength: 0.5; /* document-fiber intensity (0–1). */
|
|
33
|
-
--tex-paper-grain: 0.22; /* page-grain level. 0.22 = Faint · 0.45 = Whisper. */
|
|
34
|
-
--tex-line-ink: var(--border); /* deco lines are token ink, never raw color. */
|
|
35
|
-
--tex-line-a: 70%; /* line ink alpha (dark). */
|
|
31
|
+
--tex-dot-gap: 14px; /* @kind spacing */ /* dot-matrix lattice pitch. Sweet spot 14; 12–16. */
|
|
32
|
+
--tex-fiber-strength: 0.5; /* @kind other */ /* document-fiber intensity (0–1). */
|
|
33
|
+
--tex-paper-grain: 0.22; /* @kind other */ /* page-grain level. 0.22 = Faint · 0.45 = Whisper (drawn ×0.71 on ink). */
|
|
34
|
+
--tex-line-ink: var(--border); /* @kind color */ /* deco lines are token ink, never raw color. */
|
|
35
|
+
--tex-line-a: 70%; /* @kind other */ /* line ink alpha (dark). */
|
|
36
|
+
--tex-grid-minor: 8px; /* @kind spacing */ /* drafting grid minor pitch = --s-sm. */
|
|
37
|
+
--tex-grid-major: 40px; /* @kind spacing */ /* drafting grid major pitch (5 minors). */
|
|
38
|
+
--tex-ruled-lh: 1.7em; /* @kind other */ /* ledger line pitch; text + rules share it. */
|
|
39
|
+
--tex-perf-ground: var(--bg); /* @kind color */ /* what the perforation notches punch through to. */
|
|
36
40
|
|
|
37
41
|
/* Desaturated fiber noise — the paper/ink tooth. No hue, blended into surface. */
|
|
38
|
-
--tex-noise-fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
|
|
42
|
+
--tex-noise-fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"); /* @kind other */
|
|
39
43
|
/* Page-grain speckle — noise baked as ALPHA so it shows with normal
|
|
40
44
|
compositing (blend-mode independent, renders reliably). Light grains on
|
|
41
45
|
ink; the light-theme block below swaps to ink grains on paper. */
|
|
42
|
-
--tex-speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='1.1' intercept='-0.45'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
|
|
46
|
+
--tex-speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='1.1' intercept='-0.45'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"); /* @kind other */
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
/* Light (paper) retunes — the lines read too strong on cream with the dark
|
|
46
50
|
--border at full alpha and pick up a bluish cast; ride the border ink softer.
|
|
47
51
|
The page-grain speckle inverts to ink grains so it shows on paper. */
|
|
48
52
|
:root[data-theme="light"] {
|
|
49
|
-
--tex-line-a: 68%;
|
|
50
|
-
--tex-speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.12 0 0 0 0 0.11 0 0 0 0 0.20 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='1.1' intercept='-0.45'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
|
|
53
|
+
--tex-line-a: 68%; /* @kind other */
|
|
54
|
+
--tex-speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.12 0 0 0 0 0.11 0 0 0 0 0.20 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='1.1' intercept='-0.45'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"); /* @kind other */
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/* ═══ 1 · GRAIN ═══════════════════════════════════════════════════════════
|
|
@@ -91,6 +95,13 @@
|
|
|
91
95
|
opacity: var(--tex-paper-grain);
|
|
92
96
|
}
|
|
93
97
|
.tex-paper--whisper { --tex-paper-grain: 0.45; }
|
|
98
|
+
/* Whisper is capped lower on ink: at 0.45 the light speckle on a dark floor
|
|
99
|
+
read as dust/static, so the ink floor draws it at ~0.32 (0.45 × 0.71).
|
|
100
|
+
Paper keeps the full level — ink grains on cream read as tooth. Scaled on
|
|
101
|
+
the pseudo-element so no new custom property is declared per theme. */
|
|
102
|
+
.tex-paper--whisper::before { opacity: calc(var(--tex-paper-grain) * 0.71); }
|
|
103
|
+
:root[data-theme="light"] .tex-paper--whisper::before { opacity: var(--tex-paper-grain); }
|
|
104
|
+
@media (prefers-color-scheme: light) { :root:not([data-theme]) .tex-paper--whisper::before { opacity: var(--tex-paper-grain); } }
|
|
94
105
|
|
|
95
106
|
/* ═══ 3 · DECO LINE-TEXTURE (ink, not material) ═══════════════════════════
|
|
96
107
|
Hatch / cross / flute / pinstripe — drawn ONLY from token ink, so they add
|
|
@@ -114,20 +125,24 @@
|
|
|
114
125
|
repeating-linear-gradient(45deg, transparent 0 7px, color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 7px 8px),
|
|
115
126
|
repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 7px 8px);
|
|
116
127
|
}
|
|
117
|
-
/* flute — paired vertical hairlines, the speakeasy column
|
|
128
|
+
/* flute — paired vertical hairlines, the speakeasy column. 28px period, a
|
|
129
|
+
4px pair gap: wide enough that the doubling reads at a glance (the old
|
|
130
|
+
17px/2px pitch was indistinguishable from pinstripe). */
|
|
118
131
|
.tex-line--flute::after {
|
|
119
132
|
background-image: repeating-linear-gradient(90deg,
|
|
120
|
-
transparent 0
|
|
121
|
-
color-mix(in oklab, var(--fg) 9%, transparent)
|
|
122
|
-
transparent
|
|
123
|
-
color-mix(in oklab, var(--fg) 9%, transparent)
|
|
133
|
+
transparent 0 20px,
|
|
134
|
+
color-mix(in oklab, var(--fg) 9%, transparent) 20px 21px,
|
|
135
|
+
transparent 21px 25px,
|
|
136
|
+
color-mix(in oklab, var(--fg) 9%, transparent) 25px 26px,
|
|
137
|
+
transparent 26px 28px);
|
|
124
138
|
}
|
|
125
139
|
:root[data-theme="light"] .tex-line--flute::after {
|
|
126
140
|
background-image: repeating-linear-gradient(90deg,
|
|
127
|
-
transparent 0
|
|
128
|
-
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent)
|
|
129
|
-
transparent
|
|
130
|
-
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent)
|
|
141
|
+
transparent 0 20px,
|
|
142
|
+
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 20px 21px,
|
|
143
|
+
transparent 21px 25px,
|
|
144
|
+
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 25px 26px,
|
|
145
|
+
transparent 26px 28px);
|
|
131
146
|
}
|
|
132
147
|
/* pinstripe — even single hairlines, tailoring not architecture */
|
|
133
148
|
.tex-line--pinstripe::after {
|
|
@@ -139,15 +154,106 @@
|
|
|
139
154
|
/* ═══ 4 · RAISED (outer-glow depth) ═══════════════════════════════════════
|
|
140
155
|
The one sanctioned elevation beyond the functional --shadow-overlay. The
|
|
141
156
|
card FACE stays flat (no interior gradient — that "uniform glow" look is a
|
|
142
|
-
canonical no); depth is a soft halo
|
|
143
|
-
|
|
157
|
+
canonical no); depth is a soft halo falling straight down, entirely outside
|
|
158
|
+
the border — lit from above, the same light as the app icon (v0.28; was
|
|
159
|
+
bottom-right). */
|
|
144
160
|
.tex-raised {
|
|
145
|
-
box-shadow:
|
|
161
|
+
box-shadow: 0 6px 14px 1px rgba(0,0,0,.20), 0 14px 30px 2px rgba(0,0,0,.14);
|
|
146
162
|
}
|
|
147
163
|
:root[data-theme="light"] .tex-raised {
|
|
148
|
-
box-shadow:
|
|
164
|
+
box-shadow: 0 6px 14px 1px rgba(32,32,62,.13), 0 14px 30px 2px rgba(32,32,62,.09);
|
|
149
165
|
}
|
|
150
166
|
|
|
167
|
+
/* ═══ 5 · DRAFTING (v0.28) — the maker's bench ════════════════════════════
|
|
168
|
+
Six textures from the drafting table the compass icon comes off. Same
|
|
169
|
+
bounds as everything above: token ink only, no hue, no motion, never on
|
|
170
|
+
data/status/errors, one per surface.
|
|
171
|
+
.tex-grid engineering paper — tool canvases, layout previews
|
|
172
|
+
.tex-line--arc scribed compass arcs from a corner — empty states
|
|
173
|
+
.tex-line--ray deco sunburst from bottom-centre — ONE launch moment
|
|
174
|
+
.tex-ruled ledger rules locked to the text — notes, journals
|
|
175
|
+
.tex-perf a perforated tear line — receipt / ticket cards
|
|
176
|
+
.tex-deboss pressed-in display type — decorative ONLY */
|
|
177
|
+
|
|
178
|
+
/* drafting grid — minor on the 8px spacing unit, major every 5 minors. */
|
|
179
|
+
.tex-grid { position: relative; isolation: isolate; }
|
|
180
|
+
.tex-grid::after {
|
|
181
|
+
content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
|
|
182
|
+
background-image:
|
|
183
|
+
linear-gradient(to right, color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 1px, transparent 1px),
|
|
184
|
+
linear-gradient(to bottom, color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 1px, transparent 1px),
|
|
185
|
+
linear-gradient(to right, color-mix(in oklab, var(--tex-line-ink) calc(var(--tex-line-a) * .45), transparent) 1px, transparent 1px),
|
|
186
|
+
linear-gradient(to bottom, color-mix(in oklab, var(--tex-line-ink) calc(var(--tex-line-a) * .45), transparent) 1px, transparent 1px);
|
|
187
|
+
background-size:
|
|
188
|
+
var(--tex-grid-major) var(--tex-grid-major), var(--tex-grid-major) var(--tex-grid-major),
|
|
189
|
+
var(--tex-grid-minor) var(--tex-grid-minor), var(--tex-grid-minor) var(--tex-grid-minor);
|
|
190
|
+
background-position: -1px -1px;
|
|
191
|
+
}
|
|
192
|
+
:root[data-theme="light"] .tex-grid::after { opacity: 0.8; }
|
|
193
|
+
|
|
194
|
+
/* scribed arcs — concentric compass arcs swung from the bottom-right corner,
|
|
195
|
+
masked so they fade before reaching the content. Composes with .tex-line. */
|
|
196
|
+
.tex-line--arc::after {
|
|
197
|
+
background-image: repeating-radial-gradient(circle at 100% 100%,
|
|
198
|
+
transparent 0 17px,
|
|
199
|
+
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 17px 18px);
|
|
200
|
+
-webkit-mask-image: radial-gradient(circle at 100% 100%, #000 30%, transparent 85%);
|
|
201
|
+
mask-image: radial-gradient(circle at 100% 100%, #000 30%, transparent 85%);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* deco sunburst — hairline rays fanned from bottom-centre. A single-moment
|
|
205
|
+
texture (release banner, launch hero): never a repeated surface. */
|
|
206
|
+
.tex-line--ray::after {
|
|
207
|
+
background-image: repeating-conic-gradient(from -90deg at 50% 100%,
|
|
208
|
+
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 0 .5deg,
|
|
209
|
+
transparent .5deg 7.5deg);
|
|
210
|
+
-webkit-mask-image: radial-gradient(ellipse 70% 95% at 50% 100%, #000 25%, transparent 80%);
|
|
211
|
+
mask-image: radial-gradient(ellipse 70% 95% at 50% 100%, #000 25%, transparent 80%);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* ledger rule — the element owns its line-height, and each rule sits at the
|
|
215
|
+
bottom of the em box: (line-height + 1em) / 2 from the top of every line
|
|
216
|
+
box, just under the baseline (the baseline sits 0.33–0.36em below the
|
|
217
|
+
line box's middle for Bricolage Grotesque, Recursive and JetBrains Mono,
|
|
218
|
+
so the rule at +0.5em clears it). Rules start at the content box, so
|
|
219
|
+
padding never shifts them; local attachment keeps them under the text when
|
|
220
|
+
a <textarea> scrolls. Set the font-size on the element itself. */
|
|
221
|
+
.tex-ruled {
|
|
222
|
+
line-height: var(--tex-ruled-lh);
|
|
223
|
+
background-image: linear-gradient(to bottom,
|
|
224
|
+
transparent 0 calc((var(--tex-ruled-lh) + 1em) / 2 - 1px),
|
|
225
|
+
color-mix(in oklab, var(--tex-line-ink) var(--tex-line-a), transparent) 0 calc((var(--tex-ruled-lh) + 1em) / 2),
|
|
226
|
+
transparent 0);
|
|
227
|
+
background-size: 100% var(--tex-ruled-lh);
|
|
228
|
+
background-origin: content-box;
|
|
229
|
+
background-attachment: local;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* perforation — a tear line between two padded sections of a card. The card
|
|
233
|
+
needs overflow: hidden and no side padding on the line itself; the notches
|
|
234
|
+
punch through to --tex-perf-ground (set it to the card's backdrop). */
|
|
235
|
+
.tex-perf {
|
|
236
|
+
height: 16px; margin: 0 -1px; border: 0;
|
|
237
|
+
background:
|
|
238
|
+
radial-gradient(circle at 0 50%, var(--tex-perf-ground) 7px, var(--border) 7.5px 8.5px, transparent 9px) left / 50% 100% no-repeat,
|
|
239
|
+
radial-gradient(circle at 100% 50%, var(--tex-perf-ground) 7px, var(--border) 7.5px 8.5px, transparent 9px) right / 50% 100% no-repeat,
|
|
240
|
+
repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 12px) center / calc(100% - 32px) 1px no-repeat;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* letterpress — display type pressed into its surface: the text IS the
|
|
244
|
+
surface color, drawn by a 1px light edge below and a 1px shadow edge above.
|
|
245
|
+
Below text contrast BY DESIGN — decorative only (colophons, empty-page
|
|
246
|
+
watermarks). Always aria-hidden or duplicated in readable text. */
|
|
247
|
+
.tex-deboss {
|
|
248
|
+
color: var(--bg);
|
|
249
|
+
text-shadow: 0 1px 0 rgba(255,255,255,.07), 0 -1px 0 rgba(0,0,0,.55);
|
|
250
|
+
}
|
|
251
|
+
:root[data-theme="light"] .tex-deboss {
|
|
252
|
+
color: var(--bg-overlay);
|
|
253
|
+
text-shadow: 0 1px 0 rgba(255,255,255,.7), 0 -1px 0 rgba(32,32,62,.18);
|
|
254
|
+
}
|
|
255
|
+
@media (forced-colors: active) { .tex-deboss { color: GrayText; text-shadow: none; } }
|
|
256
|
+
|
|
151
257
|
/* ═══ Reduced-motion ══════════════════════════════════════════════════════
|
|
152
258
|
Texture is static by design, so there is nothing to stop. Page-grain travels
|
|
153
259
|
with native scroll only — it has no animation. Documented for completeness. */
|
package/src/artificer-theme.js
CHANGED
|
@@ -29,12 +29,18 @@
|
|
|
29
29
|
return mode === 'auto' ? systemTheme() : mode;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
function syncColorSchemeMeta(mode, theme) {
|
|
33
|
+
var meta = document.querySelector && document.querySelector('meta[name="color-scheme"]');
|
|
34
|
+
if (meta) meta.setAttribute('content', mode === 'auto' ? 'light dark' : theme);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Paint the mode everywhere: the html attribute, <meta name="color-scheme">,
|
|
38
|
+
// plus state narration on every toggle (data-theme-mode for styling hooks,
|
|
39
|
+
// aria-label/title for people, the legacy label span if present).
|
|
35
40
|
function reflect(mode) {
|
|
36
41
|
var theme = resolvedTheme(mode);
|
|
37
42
|
document.documentElement.setAttribute('data-theme', theme);
|
|
43
|
+
syncColorSchemeMeta(mode, theme);
|
|
38
44
|
var next = MODES[(MODES.indexOf(mode) + 1) % MODES.length];
|
|
39
45
|
var state = mode === 'auto' ? 'auto (' + theme + ')' : mode;
|
|
40
46
|
document.querySelectorAll('[data-theme-toggle]').forEach(function (b) {
|
|
@@ -141,9 +147,14 @@
|
|
|
141
147
|
// the same autoInit shape as artificer-icons.js. observe() calls bind()
|
|
142
148
|
// internally, so static pages see no double-scan; SPA-mounted
|
|
143
149
|
// [data-theme-toggle] buttons now bind without manual observe() arming.
|
|
150
|
+
var disconnectBodyObserver = null;
|
|
144
151
|
function autoInit() {
|
|
152
|
+
if (disconnectBodyObserver) {
|
|
153
|
+
disconnectBodyObserver();
|
|
154
|
+
disconnectBodyObserver = null;
|
|
155
|
+
}
|
|
145
156
|
if (typeof MutationObserver !== 'undefined') {
|
|
146
|
-
observe(document.body);
|
|
157
|
+
disconnectBodyObserver = observe(document.body);
|
|
147
158
|
} else {
|
|
148
159
|
bind();
|
|
149
160
|
}
|
|
@@ -153,4 +164,20 @@
|
|
|
153
164
|
} else {
|
|
154
165
|
autoInit();
|
|
155
166
|
}
|
|
167
|
+
|
|
168
|
+
// Astro View Transitions (#530): swaps replace <html> attributes and <body>.
|
|
169
|
+
// Carry data-theme + <meta name="color-scheme"> onto the incoming document
|
|
170
|
+
// before swap so there is no flash, then re-bind/re-observe after swap.
|
|
171
|
+
if (document.addEventListener) {
|
|
172
|
+
document.addEventListener('astro:before-swap', function (ev) {
|
|
173
|
+
var doc = ev && ev.newDocument;
|
|
174
|
+
if (!doc || !doc.documentElement) return;
|
|
175
|
+
var mode = storedMode();
|
|
176
|
+
var theme = resolvedTheme(mode);
|
|
177
|
+
doc.documentElement.setAttribute('data-theme', theme);
|
|
178
|
+
var meta = doc.querySelector && doc.querySelector('meta[name="color-scheme"]');
|
|
179
|
+
if (meta) meta.setAttribute('content', mode === 'auto' ? 'light dark' : theme);
|
|
180
|
+
});
|
|
181
|
+
document.addEventListener('astro:page-load', autoInit);
|
|
182
|
+
}
|
|
156
183
|
})();
|