@certrev/cert-block 0.5.3 → 0.5.4
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/components/render-def.d.ts +11 -7
- package/dist/components/render-def.d.ts.map +1 -1
- package/dist/components/render-def.js +17 -9
- package/dist/components/render-def.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/render-def.test.tsx +14 -5
- package/src/components/render-def.ts +17 -9
|
@@ -41,15 +41,19 @@
|
|
|
41
41
|
* entry targets (edge / Workers / server / client).
|
|
42
42
|
*/
|
|
43
43
|
/** The font ENUM. Resolves to a FIXED slot stack — never a free-form family. */
|
|
44
|
-
export declare const FONT_SLOTS: readonly ["sans", "serif", "system"];
|
|
44
|
+
export declare const FONT_SLOTS: readonly ["sans", "serif", "system", "grotesk", "mono"];
|
|
45
45
|
export type FontSlot = (typeof FONT_SLOTS)[number];
|
|
46
46
|
/**
|
|
47
|
-
* The `fontSlot` → fixed font-stack literal
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
47
|
+
* The `fontSlot` → fixed font-stack literal — the render-def theme map the webcomponent MODAL
|
|
48
|
+
* (`resolveRenderTheme` → `renderBadgeHtml`) and the legacy `<CertBadge>` resolve. The three original
|
|
49
|
+
* slots (sans/serif/system) stay BYTE-IDENTICAL to the Shopify Liquid engine's stacks
|
|
50
|
+
* (`shopify/extensions/certrev-schema/snippets/certrev-badge.liquid`), so a themed brand's popup modal
|
|
51
|
+
* and its inline Liquid card paint the same typography — the load-bearing card==modal invariant.
|
|
52
|
+
* grotesk (Plus Jakarta Sans) + mono (JetBrains Mono) are ADDED at the shared guide values —
|
|
53
|
+
* byte-identical to portal `FONT_SLOT_STACKS`, this package's `RENDER_BLOCK_FONT_STACKS`, and the
|
|
54
|
+
* Liquid twin's added branches — so card == modal holds for them too. A raw family string in a
|
|
55
|
+
* `font-family` CSS var is a CSS-injection surface AND breaks the "CertREV hosts no fonts" invariant,
|
|
56
|
+
* so the enum → stack indirection is the security boundary.
|
|
53
57
|
*/
|
|
54
58
|
export declare const FONT_STACKS: Readonly<Record<FontSlot, string>>;
|
|
55
59
|
/** A fully-resolved themeable token set (a brand overrides a subset of these). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-def.d.ts","sourceRoot":"","sources":["../../src/components/render-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAMH,gFAAgF;AAChF,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"render-def.d.ts","sourceRoot":"","sources":["../../src/components/render-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAMH,gFAAgF;AAChF,eAAO,MAAM,UAAU,yDAA0D,CAAA;AACjF,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAM1D,CAAA;AAED,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAC3B;AAED,qFAAqF;AACrF,eAAO,MAAM,eAAe,oCAAqC,CAAA;AACjE,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,C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|
// ─────────────────────────────────────────────────────────────────────────────
|
|
46
46
|
/** The font ENUM. Resolves to a FIXED slot stack — never a free-form family. */
|
|
47
|
-
export const FONT_SLOTS = ['sans', 'serif', 'system'];
|
|
47
|
+
export const FONT_SLOTS = ['sans', 'serif', 'system', 'grotesk', 'mono'];
|
|
48
48
|
/**
|
|
49
|
-
* The `fontSlot` → fixed font-stack literal
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
49
|
+
* The `fontSlot` → fixed font-stack literal — the render-def theme map the webcomponent MODAL
|
|
50
|
+
* (`resolveRenderTheme` → `renderBadgeHtml`) and the legacy `<CertBadge>` resolve. The three original
|
|
51
|
+
* slots (sans/serif/system) stay BYTE-IDENTICAL to the Shopify Liquid engine's stacks
|
|
52
|
+
* (`shopify/extensions/certrev-schema/snippets/certrev-badge.liquid`), so a themed brand's popup modal
|
|
53
|
+
* and its inline Liquid card paint the same typography — the load-bearing card==modal invariant.
|
|
54
|
+
* grotesk (Plus Jakarta Sans) + mono (JetBrains Mono) are ADDED at the shared guide values —
|
|
55
|
+
* byte-identical to portal `FONT_SLOT_STACKS`, this package's `RENDER_BLOCK_FONT_STACKS`, and the
|
|
56
|
+
* Liquid twin's added branches — so card == modal holds for them too. A raw family string in a
|
|
57
|
+
* `font-family` CSS var is a CSS-injection surface AND breaks the "CertREV hosts no fonts" invariant,
|
|
58
|
+
* so the enum → stack indirection is the security boundary.
|
|
55
59
|
*/
|
|
56
60
|
export const FONT_STACKS = {
|
|
57
61
|
sans: "'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif",
|
|
58
62
|
serif: "'Playfair Display', Georgia, 'Times New Roman', serif",
|
|
59
63
|
system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
64
|
+
grotesk: "'Plus Jakarta Sans', system-ui, Helvetica, Arial, sans-serif",
|
|
65
|
+
mono: "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
60
66
|
};
|
|
61
67
|
/** The badge fields a render-def may SUBTRACTIVELY hide (brand-toggleable, free). */
|
|
62
68
|
export const HIDEABLE_FIELDS = ['reviewerPhoto', 'memo'];
|
|
@@ -128,8 +134,10 @@ export function isFieldHidden(def, id) {
|
|
|
128
134
|
// above (which the legacy `<CertBadge>` uses): it mirrors the portal's FULL
|
|
129
135
|
// five-member `FontSlot` enum + the pre-computed `accentFg` ink, so the block can
|
|
130
136
|
// reproduce the guide's four-font design (DM Sans body, Playfair memo, JetBrains
|
|
131
|
-
// mono labels, Plus Jakarta wordmark).
|
|
132
|
-
//
|
|
137
|
+
// mono labels, Plus Jakarta wordmark). Its STACKS stay DISTINCT from `FONT_STACKS`
|
|
138
|
+
// above: both maps now span the same five `FontSlot`s, but `FONT_STACKS` pins
|
|
139
|
+
// sans/serif/system to the legacy Liquid table (the card==modal invariant) while this
|
|
140
|
+
// map pins them to the guide table; grotesk/mono are byte-identical across both.
|
|
133
141
|
/**
|
|
134
142
|
* The full portal font-slot enum (mirrors portal `src/lib/design-guide/tokens.ts`
|
|
135
143
|
* `FONT_SLOTS`). `grotesk` ⇐ the guide's wordmark slot; `mono` ⇐ the label slot.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-def.js","sourceRoot":"","sources":["../../src/components/render-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAEhF,gFAAgF;AAChF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"render-def.js","sourceRoot":"","sources":["../../src/components/render-def.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,gFAAgF;AAChF,6EAA6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O;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IACjE,IAAI,KAAK,CAAC,YAAY;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;IAC1E,IAAI,KAAK,CAAC,SAAS;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAClE,OAAO,GAAG,CAAA;AACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certrev/cert-block",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Headless / crypto_verify render edge for the CertREV CertDeliveryEnvelope. SSR-safe React components (<CertBadge>/<ExpertBio>/<CertRevBacklink>), a deterministic schema.org JSON-LD projector, a fail-closed verify layer over the shared VerdictKernel, and a framework-agnostic <certrev-badge> Web Component. Sign once (portal), render everywhere (Hydrogen / Next / Builder / universal embed).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,9 +67,9 @@ describe('token validators (mirror portal src/lib/design-guide/tokens.ts)', () =
|
|
|
67
67
|
for (const bad of ['12', '12 px', 'calc(1px)', '1px 2px', '', 'px', '-4px']) expect(isCornerRadius(bad)).toBe(false)
|
|
68
68
|
})
|
|
69
69
|
|
|
70
|
-
it('isFontSlot admits
|
|
71
|
-
for (const ok of ['sans', 'serif', 'system']) expect(isFontSlot(ok)).toBe(true)
|
|
72
|
-
for (const bad of ['
|
|
70
|
+
it('isFontSlot admits the five enum members', () => {
|
|
71
|
+
for (const ok of ['sans', 'serif', 'system', 'grotesk', 'mono']) expect(isFontSlot(ok)).toBe(true)
|
|
72
|
+
for (const bad of ['Arial', '', 'SANS', 'wingdings']) expect(isFontSlot(bad)).toBe(false)
|
|
73
73
|
})
|
|
74
74
|
})
|
|
75
75
|
|
|
@@ -78,6 +78,10 @@ describe('FONT_STACKS — byte-identical to the Shopify Liquid engine literals',
|
|
|
78
78
|
expect(FONT_STACKS.sans).toBe("'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif")
|
|
79
79
|
expect(FONT_STACKS.serif).toBe("'Playfair Display', Georgia, 'Times New Roman', serif")
|
|
80
80
|
expect(FONT_STACKS.system).toBe("system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif")
|
|
81
|
+
// grotesk/mono added at the shared guide values — byte-identical to RENDER_BLOCK_FONT_STACKS
|
|
82
|
+
// and the portal FONT_SLOT_STACKS, so the modal + Liquid card paint the same typography.
|
|
83
|
+
expect(FONT_STACKS.grotesk).toBe("'Plus Jakarta Sans', system-ui, Helvetica, Arial, sans-serif")
|
|
84
|
+
expect(FONT_STACKS.mono).toBe("'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace")
|
|
81
85
|
})
|
|
82
86
|
})
|
|
83
87
|
|
|
@@ -96,13 +100,18 @@ describe('resolveRenderTheme — validates + drops (fail-safe)', () => {
|
|
|
96
100
|
})
|
|
97
101
|
})
|
|
98
102
|
|
|
103
|
+
it('resolves the ADDED grotesk/mono slots to their FONT_STACKS families (the modal themes all five)', () => {
|
|
104
|
+
expect(resolveRenderTheme({ tokens: { fontSlot: 'grotesk' } }).fontStack).toBe(FONT_STACKS.grotesk)
|
|
105
|
+
expect(resolveRenderTheme({ tokens: { fontSlot: 'mono' } }).fontStack).toBe(FONT_STACKS.mono)
|
|
106
|
+
})
|
|
107
|
+
|
|
99
108
|
it('DROPS every invalid token (alpha surface, function accent, calc radius, unknown slot)', () => {
|
|
100
109
|
const resolved = resolveRenderTheme({
|
|
101
110
|
tokens: {
|
|
102
111
|
accentColor: 'rgb(0,0,0)',
|
|
103
112
|
surface: '#ffffffaa',
|
|
104
113
|
cornerRadius: 'calc(1px)',
|
|
105
|
-
fontSlot: '
|
|
114
|
+
fontSlot: 'wingdings' as FontSlot,
|
|
106
115
|
},
|
|
107
116
|
version: 2,
|
|
108
117
|
})
|
|
@@ -251,7 +260,7 @@ describe('renderBadgeHtml themed (the crawlable string path)', () => {
|
|
|
251
260
|
accentColor: 'rgb(0,0,0)',
|
|
252
261
|
surface: '#ffffffaa',
|
|
253
262
|
cornerRadius: 'calc(1px)',
|
|
254
|
-
fontSlot: '
|
|
263
|
+
fontSlot: 'wingdings' as FontSlot,
|
|
255
264
|
},
|
|
256
265
|
},
|
|
257
266
|
})
|
|
@@ -46,21 +46,27 @@
|
|
|
46
46
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
47
47
|
|
|
48
48
|
/** The font ENUM. Resolves to a FIXED slot stack — never a free-form family. */
|
|
49
|
-
export const FONT_SLOTS = ['sans', 'serif', 'system'] as const
|
|
49
|
+
export const FONT_SLOTS = ['sans', 'serif', 'system', 'grotesk', 'mono'] as const
|
|
50
50
|
export type FontSlot = (typeof FONT_SLOTS)[number]
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* The `fontSlot` → fixed font-stack literal
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
53
|
+
* The `fontSlot` → fixed font-stack literal — the render-def theme map the webcomponent MODAL
|
|
54
|
+
* (`resolveRenderTheme` → `renderBadgeHtml`) and the legacy `<CertBadge>` resolve. The three original
|
|
55
|
+
* slots (sans/serif/system) stay BYTE-IDENTICAL to the Shopify Liquid engine's stacks
|
|
56
|
+
* (`shopify/extensions/certrev-schema/snippets/certrev-badge.liquid`), so a themed brand's popup modal
|
|
57
|
+
* and its inline Liquid card paint the same typography — the load-bearing card==modal invariant.
|
|
58
|
+
* grotesk (Plus Jakarta Sans) + mono (JetBrains Mono) are ADDED at the shared guide values —
|
|
59
|
+
* byte-identical to portal `FONT_SLOT_STACKS`, this package's `RENDER_BLOCK_FONT_STACKS`, and the
|
|
60
|
+
* Liquid twin's added branches — so card == modal holds for them too. A raw family string in a
|
|
61
|
+
* `font-family` CSS var is a CSS-injection surface AND breaks the "CertREV hosts no fonts" invariant,
|
|
62
|
+
* so the enum → stack indirection is the security boundary.
|
|
59
63
|
*/
|
|
60
64
|
export const FONT_STACKS: Readonly<Record<FontSlot, string>> = {
|
|
61
65
|
sans: "'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif",
|
|
62
66
|
serif: "'Playfair Display', Georgia, 'Times New Roman', serif",
|
|
63
67
|
system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
68
|
+
grotesk: "'Plus Jakarta Sans', system-ui, Helvetica, Arial, sans-serif",
|
|
69
|
+
mono: "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
/** A fully-resolved themeable token set (a brand overrides a subset of these). */
|
|
@@ -191,8 +197,10 @@ export function isFieldHidden(def: CertRenderDef | undefined, id: BadgeVisibilit
|
|
|
191
197
|
// above (which the legacy `<CertBadge>` uses): it mirrors the portal's FULL
|
|
192
198
|
// five-member `FontSlot` enum + the pre-computed `accentFg` ink, so the block can
|
|
193
199
|
// reproduce the guide's four-font design (DM Sans body, Playfair memo, JetBrains
|
|
194
|
-
// mono labels, Plus Jakarta wordmark).
|
|
195
|
-
//
|
|
200
|
+
// mono labels, Plus Jakarta wordmark). Its STACKS stay DISTINCT from `FONT_STACKS`
|
|
201
|
+
// above: both maps now span the same five `FontSlot`s, but `FONT_STACKS` pins
|
|
202
|
+
// sans/serif/system to the legacy Liquid table (the card==modal invariant) while this
|
|
203
|
+
// map pins them to the guide table; grotesk/mono are byte-identical across both.
|
|
196
204
|
|
|
197
205
|
/**
|
|
198
206
|
* The full portal font-slot enum (mirrors portal `src/lib/design-guide/tokens.ts`
|