@domandigital/craft 0.14.0 → 0.16.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.
@@ -2,40 +2,257 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://unpkg.com/@domandigital/craft/art-direction.schema.json",
4
4
  "title": "art-direction.json",
5
- "description": "What a site decided about how it looks, and why. Every choice carries a reason from the client's real world and cites a source that shows it. The reason rule itself is enforced by `craft direction validate`; this schema only checks the shape.",
5
+ "description": "What a site decided, and why: the visitor's job, the structure decided from it, and how it looks. Every decision carries a reason: tokens from the client's real world, the job from the customer's own words, structure from the job. The reason rules are enforced by `craft direction validate`; this schema only checks the shape. Version 1 files (tokens only) still validate.",
6
6
  "type": "object",
7
- "required": ["version", "client", "brief", "sources", "choices"],
7
+ "required": [
8
+ "version",
9
+ "client",
10
+ "brief",
11
+ "sources",
12
+ "choices"
13
+ ],
8
14
  "properties": {
9
- "$schema": { "type": "string" },
10
- "version": { "const": 1 },
11
- "client": { "type": "string", "minLength": 1 },
12
- "brief": { "type": "string", "description": "Who, where, and what they do, in a sentence or two." },
15
+ "$schema": {
16
+ "type": "string"
17
+ },
18
+ "version": {
19
+ "enum": [
20
+ 1,
21
+ 2
22
+ ]
23
+ },
24
+ "client": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ },
28
+ "brief": {
29
+ "type": "string",
30
+ "description": "Who, where, and what they do, in a sentence or two."
31
+ },
32
+ "job": {
33
+ "type": "object",
34
+ "description": "Version 2. What the visitor is trying to get done, in their words.",
35
+ "properties": {
36
+ "statement": {
37
+ "type": "object",
38
+ "required": [
39
+ "verb",
40
+ "object",
41
+ "context"
42
+ ],
43
+ "properties": {
44
+ "verb": {
45
+ "type": "string"
46
+ },
47
+ "object": {
48
+ "type": "string"
49
+ },
50
+ "context": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "additionalProperties": false
55
+ },
56
+ "functional": {
57
+ "$ref": "#/$defs/jobPart"
58
+ },
59
+ "emotional": {
60
+ "$ref": "#/$defs/jobPart"
61
+ },
62
+ "social": {
63
+ "$ref": "#/$defs/jobPart"
64
+ },
65
+ "consideration": {
66
+ "type": "object",
67
+ "required": [
68
+ "value",
69
+ "because",
70
+ "evidence"
71
+ ],
72
+ "properties": {
73
+ "value": {
74
+ "enum": [
75
+ "low",
76
+ "considered",
77
+ "high"
78
+ ]
79
+ },
80
+ "because": {
81
+ "type": "string"
82
+ },
83
+ "evidence": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ },
92
+ "objections": {
93
+ "type": "array",
94
+ "items": {
95
+ "type": "string"
96
+ }
97
+ },
98
+ "language": {
99
+ "type": "array",
100
+ "items": {
101
+ "type": "string"
102
+ }
103
+ },
104
+ "evidence": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "string"
108
+ }
109
+ }
110
+ },
111
+ "additionalProperties": false,
112
+ "required": [
113
+ "statement",
114
+ "functional",
115
+ "emotional",
116
+ "social",
117
+ "consideration",
118
+ "objections",
119
+ "language",
120
+ "evidence"
121
+ ]
122
+ },
123
+ "hierarchy": {
124
+ "type": "object",
125
+ "description": "Version 2. Keyed by page type.",
126
+ "propertyNames": {
127
+ "enum": [
128
+ "home",
129
+ "service",
130
+ "about",
131
+ "pricing",
132
+ "booking",
133
+ "contact",
134
+ "article",
135
+ "landing"
136
+ ]
137
+ },
138
+ "additionalProperties": {
139
+ "$ref": "#/$defs/page"
140
+ },
141
+ "required": [
142
+ "home"
143
+ ]
144
+ },
13
145
  "sources": {
14
146
  "type": "array",
15
147
  "items": {
16
148
  "type": "object",
17
- "required": ["id", "kind", "note"],
149
+ "required": [
150
+ "id",
151
+ "kind",
152
+ "note"
153
+ ],
18
154
  "properties": {
19
- "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
20
- "kind": { "enum": ["livery", "shopfront", "signage", "packaging", "product", "uniform", "interior", "place", "material", "trade", "print", "photo", "founder"] },
21
- "note": { "type": "string" },
22
- "path": { "type": "string" },
23
- "colours": { "type": "array", "items": { "type": "string" } },
24
- "lettering": { "type": "string" }
155
+ "id": {
156
+ "type": "string",
157
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
158
+ },
159
+ "kind": {
160
+ "enum": [
161
+ "livery",
162
+ "shopfront",
163
+ "signage",
164
+ "packaging",
165
+ "product",
166
+ "uniform",
167
+ "interior",
168
+ "place",
169
+ "material",
170
+ "trade",
171
+ "print",
172
+ "photo",
173
+ "founder",
174
+ "review",
175
+ "enquiry",
176
+ "conversation",
177
+ "search",
178
+ "reference"
179
+ ]
180
+ },
181
+ "note": {
182
+ "type": "string"
183
+ },
184
+ "path": {
185
+ "type": "string"
186
+ },
187
+ "colours": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ }
192
+ },
193
+ "lettering": {
194
+ "type": "string"
195
+ },
196
+ "category": {
197
+ "type": "string",
198
+ "description": "For a reference: where it comes from. Never the client's own category."
199
+ }
25
200
  },
26
- "additionalProperties": false
201
+ "additionalProperties": false,
202
+ "allOf": [
203
+ {
204
+ "if": {
205
+ "properties": {
206
+ "kind": {
207
+ "const": "reference"
208
+ }
209
+ },
210
+ "required": [
211
+ "kind"
212
+ ]
213
+ },
214
+ "then": {
215
+ "required": [
216
+ "category"
217
+ ]
218
+ }
219
+ }
220
+ ]
27
221
  }
28
222
  },
29
223
  "choices": {
30
224
  "type": "object",
31
- "propertyNames": { "enum": ["accent", "ground", "display", "body", "shape", "motif", "signature"] },
225
+ "propertyNames": {
226
+ "enum": [
227
+ "accent",
228
+ "ground",
229
+ "display",
230
+ "body",
231
+ "shape",
232
+ "motif",
233
+ "signature"
234
+ ]
235
+ },
32
236
  "additionalProperties": {
33
237
  "type": "object",
34
- "required": ["value", "because", "evidence"],
238
+ "required": [
239
+ "value",
240
+ "because",
241
+ "evidence"
242
+ ],
35
243
  "properties": {
36
- "value": { "type": "string" },
37
- "because": { "type": "string" },
38
- "evidence": { "type": "array", "items": { "type": "string" } }
244
+ "value": {
245
+ "type": "string"
246
+ },
247
+ "because": {
248
+ "type": "string"
249
+ },
250
+ "evidence": {
251
+ "type": "array",
252
+ "items": {
253
+ "type": "string"
254
+ }
255
+ }
39
256
  },
40
257
  "additionalProperties": false
41
258
  }
@@ -44,16 +261,202 @@
44
261
  "type": "array",
45
262
  "items": {
46
263
  "type": "object",
47
- "required": ["tell", "because"],
264
+ "required": [
265
+ "tell",
266
+ "because"
267
+ ],
48
268
  "properties": {
49
- "tell": { "type": "string" },
50
- "because": { "type": "string" },
51
- "evidence": { "type": "string" },
52
- "path": { "type": "string" }
269
+ "tell": {
270
+ "type": "string"
271
+ },
272
+ "because": {
273
+ "type": "string"
274
+ },
275
+ "evidence": {
276
+ "type": "string"
277
+ },
278
+ "path": {
279
+ "type": "string"
280
+ }
53
281
  },
54
282
  "additionalProperties": false
55
283
  }
56
284
  }
57
285
  },
58
- "additionalProperties": false
286
+ "additionalProperties": false,
287
+ "$defs": {
288
+ "jobPart": {
289
+ "type": "object",
290
+ "required": [
291
+ "value",
292
+ "evidence"
293
+ ],
294
+ "properties": {
295
+ "value": {
296
+ "type": "string"
297
+ },
298
+ "evidence": {
299
+ "type": "array",
300
+ "items": {
301
+ "type": "string"
302
+ }
303
+ }
304
+ },
305
+ "additionalProperties": false
306
+ },
307
+ "role": {
308
+ "enum": [
309
+ "hero",
310
+ "logos",
311
+ "stats",
312
+ "cards",
313
+ "marquee",
314
+ "text",
315
+ "other",
316
+ "cta-band",
317
+ "footer-cta",
318
+ "pricing",
319
+ "testimonials",
320
+ "faq",
321
+ "process",
322
+ "features",
323
+ "team",
324
+ "contact"
325
+ ]
326
+ },
327
+ "page": {
328
+ "type": "object",
329
+ "required": [
330
+ "primaryAction",
331
+ "order",
332
+ "lead",
333
+ "journey"
334
+ ],
335
+ "properties": {
336
+ "primaryAction": {
337
+ "type": "object",
338
+ "required": [
339
+ "value",
340
+ "positions",
341
+ "because"
342
+ ],
343
+ "properties": {
344
+ "value": {
345
+ "type": "string"
346
+ },
347
+ "positions": {
348
+ "type": "array",
349
+ "minItems": 1,
350
+ "items": {
351
+ "anyOf": [
352
+ {
353
+ "$ref": "#/$defs/role"
354
+ },
355
+ {
356
+ "enum": [
357
+ "header",
358
+ "sticky"
359
+ ]
360
+ }
361
+ ]
362
+ }
363
+ },
364
+ "because": {
365
+ "type": "string"
366
+ },
367
+ "evidence": {
368
+ "type": "array",
369
+ "items": {
370
+ "type": "string"
371
+ }
372
+ }
373
+ },
374
+ "additionalProperties": false
375
+ },
376
+ "order": {
377
+ "type": "array",
378
+ "items": {
379
+ "type": "object",
380
+ "required": [
381
+ "role",
382
+ "because"
383
+ ],
384
+ "properties": {
385
+ "role": {
386
+ "$ref": "#/$defs/role"
387
+ },
388
+ "because": {
389
+ "type": "string"
390
+ }
391
+ },
392
+ "additionalProperties": false
393
+ },
394
+ "minItems": 2
395
+ },
396
+ "lead": {
397
+ "type": "object",
398
+ "required": [
399
+ "value",
400
+ "because"
401
+ ],
402
+ "properties": {
403
+ "value": {
404
+ "type": "string"
405
+ },
406
+ "subordinate": {
407
+ "type": "array",
408
+ "items": {
409
+ "type": "string"
410
+ }
411
+ },
412
+ "because": {
413
+ "type": "string"
414
+ }
415
+ },
416
+ "additionalProperties": false
417
+ },
418
+ "journey": {
419
+ "type": "array",
420
+ "items": {
421
+ "type": "object",
422
+ "required": [
423
+ "stage",
424
+ "because"
425
+ ],
426
+ "properties": {
427
+ "stage": {
428
+ "type": "string"
429
+ },
430
+ "because": {
431
+ "type": "string"
432
+ }
433
+ },
434
+ "additionalProperties": false
435
+ },
436
+ "minItems": 2
437
+ }
438
+ },
439
+ "additionalProperties": false
440
+ }
441
+ },
442
+ "oneOf": [
443
+ {
444
+ "properties": {
445
+ "version": {
446
+ "const": 1
447
+ }
448
+ }
449
+ },
450
+ {
451
+ "properties": {
452
+ "version": {
453
+ "const": 2
454
+ }
455
+ },
456
+ "required": [
457
+ "job",
458
+ "hierarchy"
459
+ ]
460
+ }
461
+ ]
59
462
  }
@@ -9,9 +9,9 @@ import {
9
9
  snapshotPage,
10
10
  snapshotUrl,
11
11
  snapshotUrls
12
- } from "./chunk-Q7ILL2HV.js";
12
+ } from "./chunk-YK2FFL6Z.js";
13
13
  import "./chunk-JYNXGCYZ.js";
14
- import "./chunk-GQVEYTBY.js";
14
+ import "./chunk-B2MJLGF6.js";
15
15
  import "./chunk-QYBAVU3P.js";
16
16
  export {
17
17
  PROVENANCE_BUDGET_MS,
package/dist/audit.cjs CHANGED
@@ -3365,6 +3365,11 @@ function fingerprint(s) {
3365
3365
  } : {}
3366
3366
  };
3367
3367
  }
3368
+ var ACCENT_SCALE = 0.3;
3369
+ var GROUND_SCALE = 0.15;
3370
+ var SHARED_PART = 0.2;
3371
+ var ACCENT_SHARED = ACCENT_SCALE * SHARED_PART;
3372
+ var GROUND_SHARED = GROUND_SCALE * SHARED_PART;
3368
3373
 
3369
3374
  // src/fingerprint/component.ts
3370
3375
  var PROMO_BADGE = /\b(?:most popular|popular|recommended|best value|best seller|bestseller|most chosen)\b/i;
package/dist/audit.js CHANGED
@@ -3330,6 +3330,11 @@ function fingerprint(s) {
3330
3330
  } : {}
3331
3331
  };
3332
3332
  }
3333
+ var ACCENT_SCALE = 0.3;
3334
+ var GROUND_SCALE = 0.15;
3335
+ var SHARED_PART = 0.2;
3336
+ var ACCENT_SHARED = ACCENT_SCALE * SHARED_PART;
3337
+ var GROUND_SHARED = GROUND_SCALE * SHARED_PART;
3333
3338
 
3334
3339
  // src/fingerprint/component.ts
3335
3340
  var PROMO_BADGE = /\b(?:most popular|popular|recommended|best value|best seller|bestseller|most chosen)\b/i;
@@ -660,9 +660,14 @@ function faceDistance(a, b) {
660
660
  if (a.family.toLowerCase() === b.family.toLowerCase()) return 0;
661
661
  return a.class === b.class ? 0.5 : 1;
662
662
  }
663
+ var ACCENT_SCALE = 0.3;
664
+ var GROUND_SCALE = 0.15;
665
+ var SHARED_PART = 0.2;
666
+ var ACCENT_SHARED = ACCENT_SCALE * SHARED_PART;
667
+ var GROUND_SHARED = GROUND_SCALE * SHARED_PART;
663
668
  function fingerprintDistance(a, b) {
664
- const accent = a.accent && b.accent ? clamp(deltaEOk(a.accent, b.accent) / 0.3) : a.accent || b.accent ? 1 : 0;
665
- const ground = clamp(deltaEOk(a.ground, b.ground) / 0.15);
669
+ const accent = a.accent && b.accent ? clamp(deltaEOk(a.accent, b.accent) / ACCENT_SCALE) : a.accent || b.accent ? 1 : 0;
670
+ const ground = clamp(deltaEOk(a.ground, b.ground) / GROUND_SCALE);
666
671
  const type = 0.6 * faceDistance(a.display, b.display) + 0.4 * faceDistance(a.body, b.body);
667
672
  const shape = a.roundness === null || b.roundness === null ? a.roundness === b.roundness ? 0 : 0.5 : clamp(Math.abs(a.roundness - b.roundness) / 0.5);
668
673
  const motion = clamp(Math.abs(a.motion - b.motion));
@@ -1854,7 +1859,7 @@ function closestComponents(a, b, role) {
1854
1859
  }
1855
1860
  function estateComponentPairs(register, role) {
1856
1861
  const out = [];
1857
- const s = register.sites;
1862
+ const s = register.sites.filter((site) => site.fingerprint);
1858
1863
  for (let i = 0; i < s.length; i += 1) {
1859
1864
  for (let j = i + 1; j < s.length; j += 1) {
1860
1865
  const c = closestComponents(s[i].fingerprint, s[j].fingerprint, role);
@@ -4611,6 +4616,7 @@ export {
4611
4616
  protectedFacts,
4612
4617
  compareFacts,
4613
4618
  formatComparison,
4619
+ TRADE_NOUNS,
4614
4620
  pageCopy,
4615
4621
  compareCompetitor,
4616
4622
  formatCompetitor,
@@ -4619,10 +4625,15 @@ export {
4619
4625
  holdHouseBlocks,
4620
4626
  normaliseFamily,
4621
4627
  fingerprint,
4628
+ levenshtein,
4629
+ SHARED_PART,
4630
+ ACCENT_SHARED,
4631
+ GROUND_SHARED,
4622
4632
  fingerprintDistance,
4623
4633
  NULL_VERSION,
4624
4634
  nullPrompt,
4625
4635
  extractHtml,
4636
+ MIN_RUNS,
4626
4637
  typicality,
4627
4638
  hueName,
4628
4639
  groundName,