@domandigital/craft 0.11.0 → 0.13.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/CHANGELOG.md +36 -0
- package/CHARACTER.md +100 -1
- package/COPY.md +6 -2
- package/README.md +5 -0
- package/dist/{audit-QIPXL7E4.js → audit-5TYDYRXV.js} +9 -3
- package/dist/audit.cjs +881 -95
- package/dist/audit.d.cts +161 -4
- package/dist/audit.d.ts +161 -4
- package/dist/audit.js +878 -95
- package/dist/{chunk-2AJB27BJ.js → chunk-3VTPI7BU.js} +26 -11
- package/dist/chunk-CZDOMIVS.js +19 -0
- package/dist/chunk-ESCVTKPN.js +217 -0
- package/dist/{chunk-3NGWXZZE.js → chunk-GMVXADJ6.js} +2929 -2082
- package/dist/{chunk-MSQ57PJU.js → chunk-IMB4V34S.js} +31 -18
- package/dist/chunk-JYNXGCYZ.js +75 -0
- package/dist/{chunk-HOHHQB4N.js → chunk-K2BZN4GA.js} +52 -16
- package/dist/{chunk-JP75P2DU.js → chunk-ZLDA2SYB.js} +342 -16
- package/dist/{chunk-JWHC67ZS.js → chunk-ZZ5CKOJP.js} +121 -1
- package/dist/cli-BKJMLD3H.js +18 -0
- package/dist/{cli-U3SZVHSK.js → cli-DRKAMFAH.js} +12 -80
- package/dist/{cli-4ESXOLKV.js → cli-ILH7OO5G.js} +4 -4
- package/dist/{cli-DBZMVYYV.js → cli-J5ECRCD4.js} +17 -17
- package/dist/cli-N2IDXH7W.js +20 -0
- package/dist/cli.js +2 -2
- package/dist/index.cjs +1291 -502
- package/dist/index.d.cts +586 -200
- package/dist/index.d.ts +586 -200
- package/dist/index.js +1263 -502
- package/licences.json +104 -0
- package/package.json +3 -2
- package/word-lists.json +1 -1
- package/dist/chunk-3OZQ4C5R.js +0 -459
- package/dist/chunk-QMYERCBB.js +0 -105
- package/dist/cli-T5RD2BTK.js +0 -17
- package/dist/cli-VREYWCT4.js +0 -16
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DIRECTION_VERSION,
|
|
3
3
|
validateDirection
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZZ5CKOJP.js";
|
|
5
|
+
import {
|
|
6
|
+
decodePng
|
|
7
|
+
} from "./chunk-JYNXGCYZ.js";
|
|
8
|
+
import {
|
|
9
|
+
readSnapshot
|
|
10
|
+
} from "./chunk-CZDOMIVS.js";
|
|
5
11
|
import {
|
|
6
12
|
parseFlags,
|
|
7
13
|
toJson
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
fingerprint
|
|
11
|
-
} from "./chunk-QMYERCBB.js";
|
|
14
|
+
} from "./chunk-3VTPI7BU.js";
|
|
12
15
|
import {
|
|
13
16
|
deltaEOk,
|
|
17
|
+
fingerprint,
|
|
14
18
|
formatHex,
|
|
15
19
|
hexToOklch,
|
|
16
20
|
isAiViolet,
|
|
17
21
|
isCream,
|
|
18
22
|
oklchToRgb,
|
|
19
23
|
parseColour
|
|
20
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-GMVXADJ6.js";
|
|
21
25
|
|
|
22
26
|
// src/direction/cli.ts
|
|
23
27
|
import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -50,78 +54,6 @@ function initDirection(input) {
|
|
|
50
54
|
};
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
// src/direction/png.ts
|
|
54
|
-
import { inflateSync } from "zlib";
|
|
55
|
-
function decodePng(buf) {
|
|
56
|
-
const sig = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
57
|
-
if (!sig.every((b, i) => buf[i] === b)) throw new Error("not a PNG");
|
|
58
|
-
const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
59
|
-
let pos = 8;
|
|
60
|
-
let width = 0;
|
|
61
|
-
let height = 0;
|
|
62
|
-
let depth = 0;
|
|
63
|
-
let colour = 0;
|
|
64
|
-
let interlace = 0;
|
|
65
|
-
const idat = [];
|
|
66
|
-
while (pos < buf.length) {
|
|
67
|
-
const len = view.getUint32(pos);
|
|
68
|
-
const type = String.fromCharCode(...buf.subarray(pos + 4, pos + 8));
|
|
69
|
-
const data = buf.subarray(pos + 8, pos + 8 + len);
|
|
70
|
-
if (type === "IHDR") {
|
|
71
|
-
width = view.getUint32(pos + 8);
|
|
72
|
-
height = view.getUint32(pos + 12);
|
|
73
|
-
depth = data[8];
|
|
74
|
-
colour = data[9];
|
|
75
|
-
interlace = data[12];
|
|
76
|
-
} else if (type === "IDAT") idat.push(data);
|
|
77
|
-
else if (type === "IEND") break;
|
|
78
|
-
pos += 12 + len;
|
|
79
|
-
}
|
|
80
|
-
const channels = { 0: 1, 2: 3, 4: 2, 6: 4 }[colour];
|
|
81
|
-
if (depth !== 8 || !channels || interlace !== 0) throw new Error(`unsupported PNG (depth ${depth}, colour type ${colour}${interlace ? ", interlaced" : ""}); export it as 8-bit RGB`);
|
|
82
|
-
const raw = inflateSync(Buffer.concat(idat.map((d) => Buffer.from(d))));
|
|
83
|
-
const stride = width * channels;
|
|
84
|
-
const out = new Uint8Array(width * height * 4);
|
|
85
|
-
const prev = new Uint8Array(stride);
|
|
86
|
-
const line = new Uint8Array(stride);
|
|
87
|
-
for (let y = 0; y < height; y += 1) {
|
|
88
|
-
const filter = raw[y * (stride + 1)];
|
|
89
|
-
const src = raw.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1));
|
|
90
|
-
for (let x = 0; x < stride; x += 1) {
|
|
91
|
-
const a = x >= channels ? line[x - channels] : 0;
|
|
92
|
-
const b = prev[x];
|
|
93
|
-
const c = x >= channels ? prev[x - channels] : 0;
|
|
94
|
-
let v = src[x];
|
|
95
|
-
if (filter === 1) v += a;
|
|
96
|
-
else if (filter === 2) v += b;
|
|
97
|
-
else if (filter === 3) v += a + b >> 1;
|
|
98
|
-
else if (filter === 4) {
|
|
99
|
-
const p = a + b - c;
|
|
100
|
-
const pa = Math.abs(p - a);
|
|
101
|
-
const pb = Math.abs(p - b);
|
|
102
|
-
const pc = Math.abs(p - c);
|
|
103
|
-
v += pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
|
|
104
|
-
}
|
|
105
|
-
line[x] = v & 255;
|
|
106
|
-
}
|
|
107
|
-
for (let x = 0; x < width; x += 1) {
|
|
108
|
-
const i = x * channels;
|
|
109
|
-
const o = (y * width + x) * 4;
|
|
110
|
-
if (channels >= 3) {
|
|
111
|
-
out[o] = line[i];
|
|
112
|
-
out[o + 1] = line[i + 1];
|
|
113
|
-
out[o + 2] = line[i + 2];
|
|
114
|
-
out[o + 3] = channels === 4 ? line[i + 3] : 255;
|
|
115
|
-
} else {
|
|
116
|
-
out[o] = out[o + 1] = out[o + 2] = line[i];
|
|
117
|
-
out[o + 3] = channels === 2 ? line[i + 1] : 255;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
prev.set(line);
|
|
121
|
-
}
|
|
122
|
-
return { width, height, rgba: out };
|
|
123
|
-
}
|
|
124
|
-
|
|
125
57
|
// src/direction/propose.ts
|
|
126
58
|
var PROPOSED = "PROPOSED:";
|
|
127
59
|
function srgbToLinear(c) {
|
|
@@ -253,8 +185,8 @@ function estateFrom(dir, cwd) {
|
|
|
253
185
|
}
|
|
254
186
|
return readdirSync(root).filter((f) => f.endsWith(".json")).flatMap((f) => {
|
|
255
187
|
try {
|
|
256
|
-
const snap = readJson(join(root, f));
|
|
257
|
-
return snap.
|
|
188
|
+
const snap = readSnapshot(readJson(join(root, f)), f);
|
|
189
|
+
return snap.fonts ? [{ id: f.replace(/(\.snapshot)?\.json$/, ""), fingerprint: fingerprint(snap) }] : [];
|
|
258
190
|
} catch {
|
|
259
191
|
return [];
|
|
260
192
|
}
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
nullPath,
|
|
7
7
|
runHarvest,
|
|
8
8
|
runNull
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-ESCVTKPN.js";
|
|
10
|
+
import "./chunk-CZDOMIVS.js";
|
|
11
|
+
import "./chunk-3VTPI7BU.js";
|
|
12
|
+
import "./chunk-GMVXADJ6.js";
|
|
13
13
|
export {
|
|
14
14
|
describeTypicality,
|
|
15
15
|
formatHarvest,
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateDirection
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZZ5CKOJP.js";
|
|
4
4
|
import {
|
|
5
5
|
merge
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-IMB4V34S.js";
|
|
7
|
+
import "./chunk-ZLDA2SYB.js";
|
|
8
|
+
import "./chunk-JYNXGCYZ.js";
|
|
8
9
|
import {
|
|
9
10
|
SIBLING_AT,
|
|
10
11
|
compareToEstate,
|
|
11
12
|
loadEstate
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K2BZN4GA.js";
|
|
13
14
|
import {
|
|
14
|
-
loadNull
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
loadNull
|
|
16
|
+
} from "./chunk-ESCVTKPN.js";
|
|
17
|
+
import {
|
|
18
|
+
readSnapshot
|
|
19
|
+
} from "./chunk-CZDOMIVS.js";
|
|
17
20
|
import {
|
|
18
21
|
COPY_FILE,
|
|
19
22
|
NOT_COPY_DIR,
|
|
@@ -24,17 +27,15 @@ import {
|
|
|
24
27
|
parseFlags,
|
|
25
28
|
readPaths,
|
|
26
29
|
toJson
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import {
|
|
29
|
-
fingerprint
|
|
30
|
-
} from "./chunk-QMYERCBB.js";
|
|
30
|
+
} from "./chunk-3VTPI7BU.js";
|
|
31
31
|
import {
|
|
32
32
|
CATALOGUE,
|
|
33
|
-
SNAPSHOT_VERSION,
|
|
34
33
|
auditSnapshot,
|
|
35
34
|
checkCopy,
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
fingerprint,
|
|
36
|
+
scanSource,
|
|
37
|
+
typicality
|
|
38
|
+
} from "./chunk-GMVXADJ6.js";
|
|
38
39
|
|
|
39
40
|
// src/report/cli.ts
|
|
40
41
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -259,10 +260,9 @@ async function runReport(command, args, io) {
|
|
|
259
260
|
const local = resolve(io.cwd, target2);
|
|
260
261
|
let snap;
|
|
261
262
|
if (/\.json$/i.test(target2) && existsSync(local)) {
|
|
262
|
-
snap = JSON.parse(readFileSync(local, "utf8"));
|
|
263
|
-
if (snap.version !== SNAPSHOT_VERSION) throw new Error(`${target2} is not a snapshot`);
|
|
263
|
+
snap = readSnapshot(JSON.parse(readFileSync(local, "utf8")), target2);
|
|
264
264
|
} else {
|
|
265
|
-
const { snapshotUrl } = await import("./audit-
|
|
265
|
+
const { snapshotUrl } = await import("./audit-5TYDYRXV.js");
|
|
266
266
|
snap = await snapshotUrl(target2);
|
|
267
267
|
}
|
|
268
268
|
const fp = fingerprint(snap);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeComponents,
|
|
3
|
+
describeFingerprint,
|
|
4
|
+
merge,
|
|
5
|
+
resolvePages,
|
|
6
|
+
runAudit
|
|
7
|
+
} from "./chunk-IMB4V34S.js";
|
|
8
|
+
import "./chunk-ZLDA2SYB.js";
|
|
9
|
+
import "./chunk-JYNXGCYZ.js";
|
|
10
|
+
import "./chunk-ESCVTKPN.js";
|
|
11
|
+
import "./chunk-CZDOMIVS.js";
|
|
12
|
+
import "./chunk-3VTPI7BU.js";
|
|
13
|
+
import "./chunk-GMVXADJ6.js";
|
|
14
|
+
export {
|
|
15
|
+
describeComponents,
|
|
16
|
+
describeFingerprint,
|
|
17
|
+
merge,
|
|
18
|
+
resolvePages,
|
|
19
|
+
runAudit
|
|
20
|
+
};
|