platform-types 1.10.697 → 1.10.698
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/dist/cjs/storefrontTheme.js +12 -9
- package/dist/storefrontDesign.d.ts +21 -9
- package/dist/storefrontTheme.js +12 -9
- package/package.json +1 -1
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveStorefrontTheme = exports.resolveStorefrontEffectiveSettings = exports.storefrontGlobalSettingsLayer = exports.storefrontContrastRatio = void 0;
|
|
4
4
|
const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
|
|
5
|
+
/*
|
|
6
|
+
* The one binding of a warning role and of a surface to the setting it reads: `surfaceTokens`
|
|
7
|
+
* and `makeMode` read the colours THROUGH these maps, and the `warnings` filter judges by them,
|
|
8
|
+
* so the tokens and the "design caused it" filter cannot name different settings.
|
|
9
|
+
*/
|
|
5
10
|
const WARNING_SETTING = {
|
|
6
11
|
link: 'primaryColor',
|
|
7
12
|
button: 'primaryColor',
|
|
@@ -54,22 +59,23 @@ const ensureContrast = (color, background, minimum) => {
|
|
|
54
59
|
return target;
|
|
55
60
|
};
|
|
56
61
|
const surfaceTokens = (background, settings, mode, surface, warnings) => {
|
|
57
|
-
const adjusted = (role,
|
|
62
|
+
const adjusted = (role, minimum) => {
|
|
63
|
+
const requested = settings[WARNING_SETTING[role]];
|
|
58
64
|
const effective = ensureContrast(requested, background, minimum);
|
|
59
65
|
if (effective !== requested.toUpperCase())
|
|
60
66
|
warnings.push({ mode, surface, role, requested, effective });
|
|
61
67
|
return effective;
|
|
62
68
|
};
|
|
63
69
|
const text = readableText(background);
|
|
64
|
-
const button = adjusted('button',
|
|
70
|
+
const button = adjusted('button', 3);
|
|
65
71
|
const hover = ensureContrast(mix(button, readableText(background), 0.2), background, 3);
|
|
66
72
|
const disabledBackground = mix(background, text, 0.12);
|
|
67
73
|
return {
|
|
68
74
|
background,
|
|
69
75
|
text,
|
|
70
76
|
secondaryText: ensureContrast(mix(background, text, 0.6), background, 4.5),
|
|
71
|
-
link: adjusted('link',
|
|
72
|
-
focus: adjusted('focus',
|
|
77
|
+
link: adjusted('link', 4.5),
|
|
78
|
+
focus: adjusted('focus', 3),
|
|
73
79
|
border: ensureContrast(mix(background, text, 0.3), background, 3),
|
|
74
80
|
button: { background: button, text: readableText(button), hover, hoverText: readableText(hover) },
|
|
75
81
|
disabled: { background: disabledBackground, text: readableText(disabledBackground) },
|
|
@@ -117,11 +123,8 @@ const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
117
123
|
const warnings = [];
|
|
118
124
|
const makeMode = (mode) => {
|
|
119
125
|
const background = (requested) => mode === 'light' ? requested.toUpperCase() : mix(requested, '#000000', 0.9);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
header: surfaceTokens(background(settings.headerColor), settings, mode, 'header', warnings),
|
|
123
|
-
footer: surfaceTokens(background(settings.footerColor), settings, mode, 'footer', warnings),
|
|
124
|
-
};
|
|
126
|
+
const surface = (id) => surfaceTokens(background(settings[SURFACE_SETTING[id]]), settings, mode, id, warnings);
|
|
127
|
+
return { page: surface('page'), header: surface('header'), footer: surface('footer') };
|
|
125
128
|
};
|
|
126
129
|
const scale = { compact: 0.875, standard: 1, large: 1.125 }[settings.textSize];
|
|
127
130
|
return {
|
|
@@ -358,7 +358,11 @@ declare global {
|
|
|
358
358
|
/** Always `[]`: an invalid colour, an unmapped Home switch, the banner and every refused or oversized literal fall back to defaults. */
|
|
359
359
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
360
360
|
legacySourceRevision: string;
|
|
361
|
-
/**
|
|
361
|
+
/**
|
|
362
|
+
* The store's own logo, offered as a suggestion; init copies it into `branding.logo`. A logo
|
|
363
|
+
* that is not adoptable or would exceed the asset capacity leaves no logo and no conflict;
|
|
364
|
+
* any other copy failure answers 503 `STOREFRONT_DRAFT_UNAVAILABLE`.
|
|
365
|
+
*/
|
|
362
366
|
legacyLogo?: {
|
|
363
367
|
source: 'store.photoURL';
|
|
364
368
|
key: string;
|
|
@@ -476,7 +480,11 @@ declare global {
|
|
|
476
480
|
type StorefrontDesignPublishOperationResult = StorefrontDesignPublishResult;
|
|
477
481
|
type StorefrontDesignPublishOperationResponse = StorefrontDesignPublishResponse;
|
|
478
482
|
interface StorefrontDesignPublishResult {
|
|
479
|
-
/**
|
|
483
|
+
/**
|
|
484
|
+
* Only adjustments the design itself caused: the adjusted colour, or the background of the
|
|
485
|
+
* surface it sits on, is set by the design. So a default primary or accent colour IS listed
|
|
486
|
+
* when the design sets that surface's background.
|
|
487
|
+
*/
|
|
480
488
|
changeSummary: {
|
|
481
489
|
contrastAdjustments: StorefrontThemeWarning[];
|
|
482
490
|
};
|
|
@@ -546,10 +554,12 @@ declare global {
|
|
|
546
554
|
/**
|
|
547
555
|
* Web `GET /products?updatedAt=`'s recency listing (the shop's «Ingresos» page), with the
|
|
548
556
|
* same rows and cursor shape, in the grant's store: enabled products updated after
|
|
549
|
-
* `updatedAt` (epoch ms
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
557
|
+
* `updatedAt` (epoch ms), newest first; `LastEvaluatedKey` resumes as `startKey`. The web
|
|
558
|
+
* route's one rule: an absent or empty `updatedAt` reads from 0; anything but digits within
|
|
559
|
+
* `Number.MAX_SAFE_INTEGER` (`1e5`, `-5`, `0x10`, a blank) answers 400 `INVALID_UPDATED_AT`,
|
|
560
|
+
* on both routes alike. An `updatedAt` over 32 characters or a `startKey` over 2048 answers
|
|
561
|
+
* 400 `STOREFRONT_PREVIEW_INVALID`; a malformed or foreign `startKey` answers 400
|
|
562
|
+
* `INVALID_CURSOR`.
|
|
553
563
|
*/
|
|
554
564
|
| {
|
|
555
565
|
operation: 'incomes';
|
|
@@ -600,10 +610,12 @@ declare global {
|
|
|
600
610
|
/**
|
|
601
611
|
* The codes a catalogue operation answers through its public web route's own core, as that
|
|
602
612
|
* route does: 404 `PRODUCT_NOT_FOUND` / `PRODUCT_GROUP_NOT_FOUND` / `COLLECTION_NOT_FOUND`,
|
|
603
|
-
* 400 `INVALID_CURSOR` / `INVALID_DISCOVERY_QUERY
|
|
604
|
-
*
|
|
613
|
+
* 400 `INVALID_CURSOR` / `INVALID_DISCOVERY_QUERY` / `INVALID_UPDATED_AT` (an `incomes`
|
|
614
|
+
* `updatedAt` that is not digits within the safe-integer range), 409 `CURSOR_STALE` (a
|
|
615
|
+
* collection that changed between the reads bracketing a page) and 503
|
|
616
|
+
* `PRODUCT_LOOKUP_INCOMPLETE`.
|
|
605
617
|
*/
|
|
606
|
-
type StorefrontPreviewCatalogueErrorCode = 'PRODUCT_NOT_FOUND' | 'PRODUCT_GROUP_NOT_FOUND' | 'COLLECTION_NOT_FOUND' | 'INVALID_CURSOR' | 'INVALID_DISCOVERY_QUERY' | 'CURSOR_STALE' | 'PRODUCT_LOOKUP_INCOMPLETE';
|
|
618
|
+
type StorefrontPreviewCatalogueErrorCode = 'PRODUCT_NOT_FOUND' | 'PRODUCT_GROUP_NOT_FOUND' | 'COLLECTION_NOT_FOUND' | 'INVALID_CURSOR' | 'INVALID_DISCOVERY_QUERY' | 'INVALID_UPDATED_AT' | 'CURSOR_STALE' | 'PRODUCT_LOOKUP_INCOMPLETE';
|
|
607
619
|
interface StorefrontPreviewReadFailure {
|
|
608
620
|
message: string;
|
|
609
621
|
error: StorefrontPreviewReadErrorCode | StorefrontPreviewCatalogueErrorCode;
|
package/dist/storefrontTheme.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { resolveStorefrontDesignSettings, validateStorefrontDesignSetting, } from "./storefrontDesignRegistry.js";
|
|
2
|
+
/*
|
|
3
|
+
* The one binding of a warning role and of a surface to the setting it reads: `surfaceTokens`
|
|
4
|
+
* and `makeMode` read the colours THROUGH these maps, and the `warnings` filter judges by them,
|
|
5
|
+
* so the tokens and the "design caused it" filter cannot name different settings.
|
|
6
|
+
*/
|
|
2
7
|
const WARNING_SETTING = {
|
|
3
8
|
link: 'primaryColor',
|
|
4
9
|
button: 'primaryColor',
|
|
@@ -50,22 +55,23 @@ const ensureContrast = (color, background, minimum) => {
|
|
|
50
55
|
return target;
|
|
51
56
|
};
|
|
52
57
|
const surfaceTokens = (background, settings, mode, surface, warnings) => {
|
|
53
|
-
const adjusted = (role,
|
|
58
|
+
const adjusted = (role, minimum) => {
|
|
59
|
+
const requested = settings[WARNING_SETTING[role]];
|
|
54
60
|
const effective = ensureContrast(requested, background, minimum);
|
|
55
61
|
if (effective !== requested.toUpperCase())
|
|
56
62
|
warnings.push({ mode, surface, role, requested, effective });
|
|
57
63
|
return effective;
|
|
58
64
|
};
|
|
59
65
|
const text = readableText(background);
|
|
60
|
-
const button = adjusted('button',
|
|
66
|
+
const button = adjusted('button', 3);
|
|
61
67
|
const hover = ensureContrast(mix(button, readableText(background), 0.2), background, 3);
|
|
62
68
|
const disabledBackground = mix(background, text, 0.12);
|
|
63
69
|
return {
|
|
64
70
|
background,
|
|
65
71
|
text,
|
|
66
72
|
secondaryText: ensureContrast(mix(background, text, 0.6), background, 4.5),
|
|
67
|
-
link: adjusted('link',
|
|
68
|
-
focus: adjusted('focus',
|
|
73
|
+
link: adjusted('link', 4.5),
|
|
74
|
+
focus: adjusted('focus', 3),
|
|
69
75
|
border: ensureContrast(mix(background, text, 0.3), background, 3),
|
|
70
76
|
button: { background: button, text: readableText(button), hover, hoverText: readableText(hover) },
|
|
71
77
|
disabled: { background: disabledBackground, text: readableText(disabledBackground) },
|
|
@@ -111,11 +117,8 @@ export const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
111
117
|
const warnings = [];
|
|
112
118
|
const makeMode = (mode) => {
|
|
113
119
|
const background = (requested) => mode === 'light' ? requested.toUpperCase() : mix(requested, '#000000', 0.9);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
header: surfaceTokens(background(settings.headerColor), settings, mode, 'header', warnings),
|
|
117
|
-
footer: surfaceTokens(background(settings.footerColor), settings, mode, 'footer', warnings),
|
|
118
|
-
};
|
|
120
|
+
const surface = (id) => surfaceTokens(background(settings[SURFACE_SETTING[id]]), settings, mode, id, warnings);
|
|
121
|
+
return { page: surface('page'), header: surface('header'), footer: surface('footer') };
|
|
119
122
|
};
|
|
120
123
|
const scale = { compact: 0.875, standard: 1, large: 1.125 }[settings.textSize];
|
|
121
124
|
return {
|