frameboard 0.6.0 → 0.8.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 +5 -4
- package/dist/cli.js +432 -118
- package/dist/client/assets/index-C6Purk3o.js +111 -0
- package/dist/client/index.html +1 -1
- package/dist/hook.js +48 -1
- package/package.json +2 -2
- package/dist/client/assets/index-Bu_iEvp_.js +0 -111
package/dist/client/index.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
matchMedia('(prefers-color-scheme: dark)').matches),
|
|
24
24
|
)
|
|
25
25
|
</script>
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-C6Purk3o.js"></script>
|
|
27
27
|
<link rel="stylesheet" crossorigin href="/assets/index-C2o-JeD6.css">
|
|
28
28
|
</head>
|
|
29
29
|
<body>
|
package/dist/hook.js
CHANGED
|
@@ -19197,7 +19197,54 @@ function definesTheme(node) {
|
|
|
19197
19197
|
* count, and neither does a `url()` whose file name reads as a color.
|
|
19198
19198
|
*/
|
|
19199
19199
|
function setsLiteralColor(property, value) {
|
|
19200
|
-
|
|
19200
|
+
if (!COLOR_PROPERTIES.test(property)) return false;
|
|
19201
|
+
if (SHADOW_PROPERTIES.test(property) && isFaintShadow(value)) return false;
|
|
19202
|
+
return isLiteralColor(value);
|
|
19203
|
+
}
|
|
19204
|
+
const SHADOW_PROPERTIES = /^(box|text)-shadow$/i;
|
|
19205
|
+
const RGB_COLOR = /\brgba?\(([^)]*)\)/gi;
|
|
19206
|
+
const HEX_TOKEN = /#([0-9a-f]{4}|[0-9a-f]{8})\b/gi;
|
|
19207
|
+
/**
|
|
19208
|
+
* Whether every color a shadow names is black or white at or under 0.2
|
|
19209
|
+
* alpha, which reads the same on either theme, so a frame writing one for a
|
|
19210
|
+
* single theme is no finding.
|
|
19211
|
+
*/
|
|
19212
|
+
function isFaintShadow(value) {
|
|
19213
|
+
const own = stripFunctions(value, ["var", "url"]);
|
|
19214
|
+
const colors = [];
|
|
19215
|
+
const rest = own.replace(RGB_COLOR, (_match, args) => {
|
|
19216
|
+
colors.push(isFaintRgb(args));
|
|
19217
|
+
return " ";
|
|
19218
|
+
}).replace(HEX_TOKEN, (_match, digits) => {
|
|
19219
|
+
colors.push(isFaintHex(digits));
|
|
19220
|
+
return " ";
|
|
19221
|
+
});
|
|
19222
|
+
return colors.length > 0 && colors.every(Boolean) && !isLiteralColor(rest);
|
|
19223
|
+
}
|
|
19224
|
+
function isFaintRgb(args) {
|
|
19225
|
+
const parts = args.split(/[\s,/]+/).map((part) => part.trim()).filter(Boolean);
|
|
19226
|
+
const [r, g, b, a] = parts;
|
|
19227
|
+
if (parts.length !== 4 || a === void 0) return false;
|
|
19228
|
+
const alpha = a.endsWith("%") ? Number.parseFloat(a) / 100 : Number.parseFloat(a);
|
|
19229
|
+
return isBlackOrWhite(readChannel(r), readChannel(g), readChannel(b)) && alpha <= .200000001;
|
|
19230
|
+
}
|
|
19231
|
+
function readChannel(part) {
|
|
19232
|
+
if (part === void 0) return void 0;
|
|
19233
|
+
if (part.endsWith("%")) return Number.parseFloat(part) / 100 * 255;
|
|
19234
|
+
return Number.parseFloat(part);
|
|
19235
|
+
}
|
|
19236
|
+
function isFaintHex(digits) {
|
|
19237
|
+
const full = digits.length === 4 ? [...digits].map((digit) => digit + digit).join("") : digits;
|
|
19238
|
+
const [r, g, b, a] = [
|
|
19239
|
+
0,
|
|
19240
|
+
2,
|
|
19241
|
+
4,
|
|
19242
|
+
6
|
|
19243
|
+
].map((at) => Number.parseInt(full.slice(at, at + 2), 16));
|
|
19244
|
+
return isBlackOrWhite(r, g, b) && (a ?? 255) / 255 <= .200000001;
|
|
19245
|
+
}
|
|
19246
|
+
function isBlackOrWhite(r, g, b) {
|
|
19247
|
+
return r === 0 && g === 0 && b === 0 || r === 255 && g === 255 && b === 255;
|
|
19201
19248
|
}
|
|
19202
19249
|
/** Whether a value holds a color of its own, outside any `var()` or `url()`. */
|
|
19203
19250
|
function isLiteralColor(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frameboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A local design board that coding agents draw on as plain HTML files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typecheck": "tsc --noEmit",
|
|
35
35
|
"build": "vite build && rolldown -c rolldown.config.ts && bun scripts/copy-faces.ts",
|
|
36
36
|
"dev": "WORKTREE_PORT_OFFSET=$(bash scripts/worktree-port.sh) && export WORKTREE_PORT_OFFSET && vite",
|
|
37
|
-
"preview": "node dist/cli.js serve --root test/fixtures/boards/basic --no-open --port ${PREVIEW_PORT:-4173}",
|
|
37
|
+
"preview": "node dist/cli.js serve --root \"${CANON_PREVIEW_ROOT:-.}/test/fixtures/boards/basic\" --no-open --port ${PREVIEW_PORT:-4173}",
|
|
38
38
|
"test": "vitest",
|
|
39
39
|
"test:run": "vitest run --reporter=verbose",
|
|
40
40
|
"test:ui": "vitest --ui",
|