@domandigital/craft 0.20.0 → 0.20.2
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 +13 -0
- package/CHARACTER.md +4 -2
- package/COPY.md +3 -1
- package/README.md +4 -1
- package/dist/{audit-43PC4LMS.js → audit-BN2GSFKT.js} +3 -3
- package/dist/audit.cjs +80 -5
- package/dist/audit.js +80 -5
- package/dist/{chunk-4LJFZH2I.js → chunk-2OBDCIVW.js} +2 -2
- package/dist/{chunk-CZ7KT452.js → chunk-7DQDF3VL.js} +76 -4
- package/dist/{chunk-RFU5CIST.js → chunk-IJXDBYHH.js} +5 -5
- package/dist/{chunk-WK2WMWTH.js → chunk-JGWOA4LI.js} +5 -2
- package/dist/{chunk-LZVTN2KI.js → chunk-JLLULDVW.js} +14 -14
- package/dist/{chunk-3CD3DTEI.js → chunk-TCMM3PTK.js} +4 -4
- package/dist/{chunk-VDUIIWG7.js → chunk-YOZLPNJS.js} +1 -1
- package/dist/{chunk-H4UF2I7V.js → chunk-YRXMPI3T.js} +5 -5
- package/dist/{cli-5DONIRMR.js → cli-A6SNEMRL.js} +9 -9
- package/dist/{cli-3IAIKGCP.js → cli-DZGQOIBX.js} +6 -6
- package/dist/{cli-YHS2VPWQ.js → cli-FF2YDHA4.js} +3 -3
- package/dist/{cli-EDQNTWDD.js → cli-KJRHO3YO.js} +4 -4
- package/dist/{cli-73JCUXAV.js → cli-LVYTLT2A.js} +5 -5
- package/dist/{cli-EOXIJOJN.js → cli-U7PJQKZT.js} +6 -6
- package/dist/{cli-YUVATZD5.js → cli-YQEVPRL5.js} +5 -5
- package/dist/{cli-VPARW6FY.js → cli-ZXDGVDYU.js} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.cjs +80 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +80 -5
- package/dist/phone.cjs +20 -1
- package/dist/phone.d.cts +30 -1
- package/dist/phone.d.ts +30 -1
- package/dist/phone.js +18 -1
- package/dist/{viewports-cli-RYV4LDQK.js → viewports-cli-WWWWEBKI.js} +5 -4
- package/package.json +1 -1
- package/word-lists.json +3 -1
package/dist/phone.d.cts
CHANGED
|
@@ -335,6 +335,35 @@ interface ViewportsResult extends MeasuredRoute {
|
|
|
335
335
|
* not judge or throw on a finding: the baseline decides.
|
|
336
336
|
*/
|
|
337
337
|
declare function measureViewports(page: ViewportPage, options: MeasureViewportsOptions): Promise<ViewportsResult>;
|
|
338
|
+
/** The desktop context the wide half is measured in, beside `PHONE` for the phone half. Spread into `browser.newContext`. */
|
|
339
|
+
declare const DESKTOP: {
|
|
340
|
+
readonly viewport: {
|
|
341
|
+
readonly width: 1024;
|
|
342
|
+
readonly height: 768;
|
|
343
|
+
};
|
|
344
|
+
readonly deviceScaleFactor: 1;
|
|
345
|
+
};
|
|
346
|
+
/** A page opened at the route, and how to close it when its half is measured. */
|
|
347
|
+
interface OpenedPage {
|
|
348
|
+
page: ViewportPage;
|
|
349
|
+
close?: () => Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Every viewport for a route only the caller can open, such as a portal screen
|
|
353
|
+
* behind a sign-in (DOM-835). As `measureSite` does for a public page, the
|
|
354
|
+
* phone half is measured in a phone context and the wide half in a desktop
|
|
355
|
+
* one; `open(scope)` returns a page already at the route, signed in with the
|
|
356
|
+
* suite's fixtures, in `PHONE` for "phone" and `DESKTOP` for "wide". The two
|
|
357
|
+
* halves are merged and written once, for `craft phone-first --measured`.
|
|
358
|
+
*
|
|
359
|
+
* await measureRoute(async (scope) => {
|
|
360
|
+
* const context = await browser.newContext({ ...(scope === "phone" ? PHONE : DESKTOP), extraHTTPHeaders: auth });
|
|
361
|
+
* const page = await context.newPage();
|
|
362
|
+
* await page.goto(base + route);
|
|
363
|
+
* return { page, close: () => context.close() };
|
|
364
|
+
* }, { route, mainAction: 'a[href="/portal/requests/new"]' });
|
|
365
|
+
*/
|
|
366
|
+
declare function measureRoute(open: (scope: "phone" | "wide") => Promise<OpenedPage>, options: Omit<MeasureViewportsOptions, "scope">): Promise<ViewportsResult>;
|
|
338
367
|
interface SitePage extends ViewportPage {
|
|
339
368
|
goto(url: string): Promise<{
|
|
340
369
|
ok(): boolean;
|
|
@@ -419,4 +448,4 @@ interface MeasurePhoneOptions {
|
|
|
419
448
|
*/
|
|
420
449
|
declare function measurePhone(page: MinimalPage, options: MeasurePhoneOptions): Promise<MeasuredRoute>;
|
|
421
450
|
|
|
422
|
-
export { BANDS, type Band, type Baseline, DEFAULT_MEASURED_DIR, DEFAULT_SWEEP, DEFAULT_THRESHOLDS, EMPTY_BASELINE, type FileException, type InPageGroup, type Judgement, LADDER, type MainAction, type MeasurePhoneOptions, type MeasureSiteOptions, type MeasureViewportsOptions, type MeasuredRoute, PHONE, PHONE_FLOORS, type PhoneCheck, type PhoneFloors, type RawPhoneFinding, SHORT_PHONE, type SiteBrowser, type SitePage, type SiteResult, type StaticFinding, type Sweep, type Thresholds, type Viewport, type ViewportArg, type ViewportPage, type ViewportsResult, WIDE_WIDTHS, bandOf, checkExceptions, formatWidths, judgeMeasured, judgeStatic, mainActionFor, measurePhone, measurePhoneInPage, measureSite, measureViewportInPage, measureViewports, mergeViewportFindings, normaliseElement, reasonOf, routeFile, scanPhoneFirst, sweepWidths, writeBaseline };
|
|
451
|
+
export { BANDS, type Band, type Baseline, DEFAULT_MEASURED_DIR, DEFAULT_SWEEP, DEFAULT_THRESHOLDS, DESKTOP, EMPTY_BASELINE, type FileException, type InPageGroup, type Judgement, LADDER, type MainAction, type MeasurePhoneOptions, type MeasureSiteOptions, type MeasureViewportsOptions, type MeasuredRoute, type OpenedPage, PHONE, PHONE_FLOORS, type PhoneCheck, type PhoneFloors, type RawPhoneFinding, SHORT_PHONE, type SiteBrowser, type SitePage, type SiteResult, type StaticFinding, type Sweep, type Thresholds, type Viewport, type ViewportArg, type ViewportPage, type ViewportsResult, WIDE_WIDTHS, bandOf, checkExceptions, formatWidths, judgeMeasured, judgeStatic, mainActionFor, measurePhone, measurePhoneInPage, measureRoute, measureSite, measureViewportInPage, measureViewports, mergeViewportFindings, normaliseElement, reasonOf, routeFile, scanPhoneFirst, sweepWidths, writeBaseline };
|
package/dist/phone.d.ts
CHANGED
|
@@ -335,6 +335,35 @@ interface ViewportsResult extends MeasuredRoute {
|
|
|
335
335
|
* not judge or throw on a finding: the baseline decides.
|
|
336
336
|
*/
|
|
337
337
|
declare function measureViewports(page: ViewportPage, options: MeasureViewportsOptions): Promise<ViewportsResult>;
|
|
338
|
+
/** The desktop context the wide half is measured in, beside `PHONE` for the phone half. Spread into `browser.newContext`. */
|
|
339
|
+
declare const DESKTOP: {
|
|
340
|
+
readonly viewport: {
|
|
341
|
+
readonly width: 1024;
|
|
342
|
+
readonly height: 768;
|
|
343
|
+
};
|
|
344
|
+
readonly deviceScaleFactor: 1;
|
|
345
|
+
};
|
|
346
|
+
/** A page opened at the route, and how to close it when its half is measured. */
|
|
347
|
+
interface OpenedPage {
|
|
348
|
+
page: ViewportPage;
|
|
349
|
+
close?: () => Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Every viewport for a route only the caller can open, such as a portal screen
|
|
353
|
+
* behind a sign-in (DOM-835). As `measureSite` does for a public page, the
|
|
354
|
+
* phone half is measured in a phone context and the wide half in a desktop
|
|
355
|
+
* one; `open(scope)` returns a page already at the route, signed in with the
|
|
356
|
+
* suite's fixtures, in `PHONE` for "phone" and `DESKTOP` for "wide". The two
|
|
357
|
+
* halves are merged and written once, for `craft phone-first --measured`.
|
|
358
|
+
*
|
|
359
|
+
* await measureRoute(async (scope) => {
|
|
360
|
+
* const context = await browser.newContext({ ...(scope === "phone" ? PHONE : DESKTOP), extraHTTPHeaders: auth });
|
|
361
|
+
* const page = await context.newPage();
|
|
362
|
+
* await page.goto(base + route);
|
|
363
|
+
* return { page, close: () => context.close() };
|
|
364
|
+
* }, { route, mainAction: 'a[href="/portal/requests/new"]' });
|
|
365
|
+
*/
|
|
366
|
+
declare function measureRoute(open: (scope: "phone" | "wide") => Promise<OpenedPage>, options: Omit<MeasureViewportsOptions, "scope">): Promise<ViewportsResult>;
|
|
338
367
|
interface SitePage extends ViewportPage {
|
|
339
368
|
goto(url: string): Promise<{
|
|
340
369
|
ok(): boolean;
|
|
@@ -419,4 +448,4 @@ interface MeasurePhoneOptions {
|
|
|
419
448
|
*/
|
|
420
449
|
declare function measurePhone(page: MinimalPage, options: MeasurePhoneOptions): Promise<MeasuredRoute>;
|
|
421
450
|
|
|
422
|
-
export { BANDS, type Band, type Baseline, DEFAULT_MEASURED_DIR, DEFAULT_SWEEP, DEFAULT_THRESHOLDS, EMPTY_BASELINE, type FileException, type InPageGroup, type Judgement, LADDER, type MainAction, type MeasurePhoneOptions, type MeasureSiteOptions, type MeasureViewportsOptions, type MeasuredRoute, PHONE, PHONE_FLOORS, type PhoneCheck, type PhoneFloors, type RawPhoneFinding, SHORT_PHONE, type SiteBrowser, type SitePage, type SiteResult, type StaticFinding, type Sweep, type Thresholds, type Viewport, type ViewportArg, type ViewportPage, type ViewportsResult, WIDE_WIDTHS, bandOf, checkExceptions, formatWidths, judgeMeasured, judgeStatic, mainActionFor, measurePhone, measurePhoneInPage, measureSite, measureViewportInPage, measureViewports, mergeViewportFindings, normaliseElement, reasonOf, routeFile, scanPhoneFirst, sweepWidths, writeBaseline };
|
|
451
|
+
export { BANDS, type Band, type Baseline, DEFAULT_MEASURED_DIR, DEFAULT_SWEEP, DEFAULT_THRESHOLDS, DESKTOP, EMPTY_BASELINE, type FileException, type InPageGroup, type Judgement, LADDER, type MainAction, type MeasurePhoneOptions, type MeasureSiteOptions, type MeasureViewportsOptions, type MeasuredRoute, type OpenedPage, PHONE, PHONE_FLOORS, type PhoneCheck, type PhoneFloors, type RawPhoneFinding, SHORT_PHONE, type SiteBrowser, type SitePage, type SiteResult, type StaticFinding, type Sweep, type Thresholds, type Viewport, type ViewportArg, type ViewportPage, type ViewportsResult, WIDE_WIDTHS, bandOf, checkExceptions, formatWidths, judgeMeasured, judgeStatic, mainActionFor, measurePhone, measurePhoneInPage, measureRoute, measureSite, measureViewportInPage, measureViewports, mergeViewportFindings, normaliseElement, reasonOf, routeFile, scanPhoneFirst, sweepWidths, writeBaseline };
|
package/dist/phone.js
CHANGED
|
@@ -673,6 +673,21 @@ async function measureViewports(page, options) {
|
|
|
673
673
|
await page.evaluate(() => document.fonts?.ready.then(() => void 0), void 0);
|
|
674
674
|
return finish(options.route, await collect(page, options), options.out);
|
|
675
675
|
}
|
|
676
|
+
var DESKTOP = { viewport: { width: 1024, height: 768 }, deviceScaleFactor: 1 };
|
|
677
|
+
async function measureRoute(open, options) {
|
|
678
|
+
if (!options.route.startsWith("/")) throw new Error(`measureRoute: route "${options.route}" should start with /`);
|
|
679
|
+
const collected = [];
|
|
680
|
+
for (const scope of ["phone", "wide"]) {
|
|
681
|
+
const { page, close } = await open(scope);
|
|
682
|
+
try {
|
|
683
|
+
await page.evaluate(() => document.fonts?.ready.then(() => void 0), void 0);
|
|
684
|
+
collected.push(await collect(page, { ...options, scope }));
|
|
685
|
+
} finally {
|
|
686
|
+
await close?.();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return finish(options.route, { perViewport: collected.flatMap((c) => c.perViewport), tested: collected.flatMap((c) => c.tested) }, options.out);
|
|
690
|
+
}
|
|
676
691
|
async function measureSite(browser, options) {
|
|
677
692
|
const result = { routes: [], errors: [] };
|
|
678
693
|
for (const route of options.routes) {
|
|
@@ -680,7 +695,7 @@ async function measureSite(browser, options) {
|
|
|
680
695
|
let failed = null;
|
|
681
696
|
for (const [scope, context] of [
|
|
682
697
|
["phone", PHONE],
|
|
683
|
-
["wide",
|
|
698
|
+
["wide", DESKTOP]
|
|
684
699
|
]) {
|
|
685
700
|
const ctx = await browser.newContext({ ...context });
|
|
686
701
|
try {
|
|
@@ -723,6 +738,7 @@ export {
|
|
|
723
738
|
DEFAULT_MEASURED_DIR,
|
|
724
739
|
DEFAULT_SWEEP,
|
|
725
740
|
DEFAULT_THRESHOLDS,
|
|
741
|
+
DESKTOP,
|
|
726
742
|
EMPTY_BASELINE,
|
|
727
743
|
LADDER,
|
|
728
744
|
PHONE,
|
|
@@ -737,6 +753,7 @@ export {
|
|
|
737
753
|
mainActionFor,
|
|
738
754
|
measurePhone,
|
|
739
755
|
measurePhoneInPage,
|
|
756
|
+
measureRoute,
|
|
740
757
|
measureSite,
|
|
741
758
|
measureViewportInPage,
|
|
742
759
|
measureViewports,
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
} from "./chunk-IJUZ7RV4.js";
|
|
6
6
|
import {
|
|
7
7
|
loadPlaywright
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YOZLPNJS.js";
|
|
9
9
|
import "./chunk-JYNXGCYZ.js";
|
|
10
10
|
import {
|
|
11
11
|
toJson
|
|
12
12
|
} from "./chunk-QIEDBL4J.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-JGWOA4LI.js";
|
|
14
|
+
import "./chunk-7DQDF3VL.js";
|
|
15
15
|
import "./chunk-QYBAVU3P.js";
|
|
16
16
|
|
|
17
17
|
// src/phone/viewports-cli.ts
|
|
@@ -534,6 +534,7 @@ function writeMeasured(result, dir) {
|
|
|
534
534
|
writeFileSync(join(dir, routeFile(route)), `${JSON.stringify({ route, ...viewport ? { viewport } : {}, ...viewports ? { viewports } : {}, findings }, null, 1)}
|
|
535
535
|
`);
|
|
536
536
|
}
|
|
537
|
+
var DESKTOP = { viewport: { width: 1024, height: 768 }, deviceScaleFactor: 1 };
|
|
537
538
|
async function measureSite(browser, options) {
|
|
538
539
|
const result = { routes: [], errors: [] };
|
|
539
540
|
for (const route of options.routes) {
|
|
@@ -541,7 +542,7 @@ async function measureSite(browser, options) {
|
|
|
541
542
|
let failed = null;
|
|
542
543
|
for (const [scope, context] of [
|
|
543
544
|
["phone", PHONE],
|
|
544
|
-
["wide",
|
|
545
|
+
["wide", DESKTOP]
|
|
545
546
|
]) {
|
|
546
547
|
const ctx = await browser.newContext({ ...context });
|
|
547
548
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domandigital/craft",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Doman Digital house craft standard as numbers: OKLCh colour ramps that snap to existing anchors, derived semantic tokens with measured WCAG and APCA contrast, one shared motion vocabulary for CSS and JS, and a base stylesheet. Zero dependencies.",
|
|
6
6
|
"license": "Apache-2.0",
|
package/word-lists.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"catalogueVersion": "2026.
|
|
2
|
+
"catalogueVersion": "2026.10.2",
|
|
3
3
|
"lists": {
|
|
4
4
|
"aiWords": [
|
|
5
5
|
"tapestry",
|
|
@@ -150,6 +150,8 @@
|
|
|
150
150
|
"truly",
|
|
151
151
|
"genuinely",
|
|
152
152
|
"deeply",
|
|
153
|
+
"clear",
|
|
154
|
+
"clearly",
|
|
153
155
|
"ultimately",
|
|
154
156
|
"one-size-fits-all",
|
|
155
157
|
"one size fits all",
|