@shoplix-ai/block-kit 5.0.0 → 5.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.
- package/README.md +92 -13
- package/dist/account-links.d.ts +50 -1
- package/dist/account-links.d.ts.map +1 -1
- package/dist/account-links.js +61 -1
- package/dist/account-links.js.map +1 -1
- package/dist/address-list.d.ts +9 -8
- package/dist/address-list.d.ts.map +1 -1
- package/dist/address-list.js +5 -5
- package/dist/address-list.js.map +1 -1
- package/dist/buy-box.d.ts +8 -0
- package/dist/buy-box.d.ts.map +1 -1
- package/dist/buy-box.js +8 -0
- package/dist/buy-box.js.map +1 -1
- package/dist/capabilities.d.ts +4 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/category-grid.d.ts +92 -0
- package/dist/category-grid.d.ts.map +1 -0
- package/dist/category-grid.js +123 -0
- package/dist/category-grid.js.map +1 -0
- package/dist/color-choice.d.ts +4 -0
- package/dist/color-choice.d.ts.map +1 -0
- package/dist/color-choice.js +11 -0
- package/dist/color-choice.js.map +1 -0
- package/dist/content-direction.d.ts +10 -0
- package/dist/content-direction.d.ts.map +1 -0
- package/dist/content-direction.js +20 -0
- package/dist/content-direction.js.map +1 -0
- package/dist/description.d.ts +60 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +332 -0
- package/dist/description.js.map +1 -0
- package/dist/index.d.ts +23 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/listing-filters.d.ts +114 -0
- package/dist/listing-filters.d.ts.map +1 -0
- package/dist/listing-filters.js +195 -0
- package/dist/listing-filters.js.map +1 -0
- package/dist/listing-toolbar.d.ts +117 -0
- package/dist/listing-toolbar.d.ts.map +1 -0
- package/dist/listing-toolbar.js +130 -0
- package/dist/listing-toolbar.js.map +1 -0
- package/dist/money.d.ts +7 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +15 -0
- package/dist/money.js.map +1 -1
- package/dist/navigation.d.ts +7 -5
- package/dist/navigation.d.ts.map +1 -1
- package/dist/orders.d.ts +87 -9
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +127 -13
- package/dist/orders.js.map +1 -1
- package/dist/product-card.d.ts +4 -0
- package/dist/product-card.d.ts.map +1 -1
- package/dist/product-card.js +4 -0
- package/dist/product-card.js.map +1 -1
- package/dist/product-gallery.d.ts +3 -0
- package/dist/product-gallery.d.ts.map +1 -1
- package/dist/product-gallery.js +3 -0
- package/dist/product-gallery.js.map +1 -1
- package/dist/product-specs.d.ts +33 -2
- package/dist/product-specs.d.ts.map +1 -1
- package/dist/product-specs.js +51 -2
- package/dist/product-specs.js.map +1 -1
- package/dist/product-summary.d.ts +12 -1
- package/dist/product-summary.d.ts.map +1 -1
- package/dist/product-summary.js +29 -0
- package/dist/product-summary.js.map +1 -1
- package/dist/profile-header.d.ts +8 -1
- package/dist/profile-header.d.ts.map +1 -1
- package/dist/profile-header.js +8 -1
- package/dist/profile-header.js.map +1 -1
- package/dist/sign-in.d.ts +3 -0
- package/dist/sign-in.d.ts.map +1 -1
- package/dist/sign-in.js +3 -0
- package/dist/sign-in.js.map +1 -1
- package/dist/store-header.d.ts +49 -6
- package/dist/store-header.d.ts.map +1 -1
- package/dist/store-header.js +59 -5
- package/dist/store-header.js.map +1 -1
- package/dist/variant-choice.d.ts +14 -0
- package/dist/variant-choice.d.ts.map +1 -1
- package/dist/variant-choice.js +36 -0
- package/dist/variant-choice.js.map +1 -1
- package/dist/variant-rows.d.ts +33 -0
- package/dist/variant-rows.d.ts.map +1 -0
- package/dist/variant-rows.js +52 -0
- package/dist/variant-rows.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/words.d.ts +67 -2
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +180 -1
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { CATEGORY_GRID_DEFAULTS, componentTokenValue, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { readable } from './locale.js';
|
|
3
|
+
import { partColors } from './part-colors.js';
|
|
4
|
+
import { readableInk } from './readable.js';
|
|
5
|
+
/** The parts of the category grid, each with the theme role it draws unless a component token names another. */
|
|
6
|
+
const CATEGORY_GRID_ROLES = {
|
|
7
|
+
title: 'text',
|
|
8
|
+
label: 'text',
|
|
9
|
+
scrim: 'overlay',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Every colour a category grid draws: the title over it, the words of a tile,
|
|
13
|
+
* the scrim under words that stand over a picture, the tile a picture or an
|
|
14
|
+
* icon stands on, and the icon. The tile is the role the merchant chose for
|
|
15
|
+
* the block, and where they chose none `category_grid.tile` over the sunken
|
|
16
|
+
* role; the icon is whichever of ink and paper stands out on that tile. The
|
|
17
|
+
* phone's grid and its web twin read this one table.
|
|
18
|
+
*/
|
|
19
|
+
export function categoryGridColors(theme, background) {
|
|
20
|
+
const tile = background === undefined
|
|
21
|
+
? componentTokenValue(theme, 'category_grid.tile', theme.colors[CATEGORY_GRID_DEFAULTS.background])
|
|
22
|
+
: theme.colors[background];
|
|
23
|
+
return {
|
|
24
|
+
...partColors(theme, 'category_grid', CATEGORY_GRID_ROLES),
|
|
25
|
+
tile,
|
|
26
|
+
icon: readableInk(tile),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function artOf(collection, tile) {
|
|
30
|
+
if (tile?.image !== undefined) {
|
|
31
|
+
return { kind: 'picture', assetId: tile.image.assetId, alt: tile.image.alt };
|
|
32
|
+
}
|
|
33
|
+
if (tile?.icon !== undefined)
|
|
34
|
+
return { kind: 'icon', icon: tile.icon };
|
|
35
|
+
return collection.image === undefined
|
|
36
|
+
? { kind: 'none' }
|
|
37
|
+
: { kind: 'collection', image: collection.image };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The tile of one collection the Binding answered, with what the merchant
|
|
41
|
+
* changed on it over the collection's own: their words where they wrote them
|
|
42
|
+
* in a language the buyer reads, and the collection's title otherwise; their
|
|
43
|
+
* picture or icon, and the collection's picture otherwise; the place they
|
|
44
|
+
* pointed it at, and the collection otherwise. An action that opens nothing,
|
|
45
|
+
* which is what a build reads an action it does not know as, opens the
|
|
46
|
+
* collection too, so no tile is ever dead.
|
|
47
|
+
*/
|
|
48
|
+
export function categoryTileOf(collection, tiles, language, defaultLanguage) {
|
|
49
|
+
const tile = tiles?.find((entry) => entry.collectionId === collection.id);
|
|
50
|
+
const label = tile?.label === undefined ? undefined : readable(tile.label, language, defaultLanguage);
|
|
51
|
+
return {
|
|
52
|
+
collectionId: collection.id,
|
|
53
|
+
label: label ?? collection.title,
|
|
54
|
+
art: artOf(collection, tile),
|
|
55
|
+
action: tile?.action === undefined || tile.action.type === 'none'
|
|
56
|
+
? { type: 'open_collection', collectionId: collection.id }
|
|
57
|
+
: tile.action,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The tile's fixed proportions: the space over the words under a picture, the
|
|
62
|
+
* share of the tile an icon takes and its stroke, a line of words as a share
|
|
63
|
+
* of their size, how far up a circle words over it stand, and how much of the
|
|
64
|
+
* picture the scrim under them covers.
|
|
65
|
+
*/
|
|
66
|
+
const CATEGORY_TILE = {
|
|
67
|
+
labelGap: 8,
|
|
68
|
+
iconShare: 0.44,
|
|
69
|
+
iconStroke: 1.75,
|
|
70
|
+
lineHeight: 1.3,
|
|
71
|
+
circleInset: 0.18,
|
|
72
|
+
scrimHeight: '60%',
|
|
73
|
+
};
|
|
74
|
+
/** The row the merchant set, each measure falling back to the default. */
|
|
75
|
+
export function categoryGridRow(settings) {
|
|
76
|
+
return {
|
|
77
|
+
columns: settings.columns ?? CATEGORY_GRID_DEFAULTS.columns,
|
|
78
|
+
gap: settings.gap ?? CATEGORY_GRID_DEFAULTS.gap,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The width one tile keeps in a row: the content width less the gaps, shared
|
|
83
|
+
* by the columns, in whole points, the way the phone's row hands its cells.
|
|
84
|
+
*/
|
|
85
|
+
export function categoryTileWidth(contentWidth, row) {
|
|
86
|
+
return Math.floor(Math.max((contentWidth - row.gap * (row.columns - 1)) / row.columns, 1));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Every measure of a tile the merchant set, each falling back to the default,
|
|
90
|
+
* at the tile's width: a circle is cut at half the tile, a rounded square at
|
|
91
|
+
* `category_grid.radius` over the theme's corner, a square at none, and an
|
|
92
|
+
* icon takes a share of the tile. Words over a circle stand higher up its
|
|
93
|
+
* lower edge than over a square, where the curve leaves them room. Words
|
|
94
|
+
* under a tile hold every line they may take, so one title that wraps never
|
|
95
|
+
* stands its row lower than the next.
|
|
96
|
+
*/
|
|
97
|
+
export function categoryGridLook(settings, theme, tileWidth) {
|
|
98
|
+
const shape = settings.shape ?? CATEGORY_GRID_DEFAULTS.shape;
|
|
99
|
+
const labelSize = settings.labelSize ?? CATEGORY_GRID_DEFAULTS.labelSize;
|
|
100
|
+
const circle = shape === 'circle';
|
|
101
|
+
const labelLineHeight = Math.round(labelSize * CATEGORY_TILE.lineHeight);
|
|
102
|
+
const labelLines = settings.labelLines ?? CATEGORY_GRID_DEFAULTS.labelLines;
|
|
103
|
+
return {
|
|
104
|
+
shape,
|
|
105
|
+
radius: circle
|
|
106
|
+
? tileWidth / 2
|
|
107
|
+
: shape === 'rounded'
|
|
108
|
+
? componentTokenValue(theme, 'category_grid.radius', theme.radius)
|
|
109
|
+
: 0,
|
|
110
|
+
fit: settings.fit ?? CATEGORY_GRID_DEFAULTS.fit,
|
|
111
|
+
iconSize: Math.round(tileWidth * CATEGORY_TILE.iconShare),
|
|
112
|
+
iconStroke: CATEGORY_TILE.iconStroke,
|
|
113
|
+
labelPosition: settings.labelPosition ?? CATEGORY_GRID_DEFAULTS.labelPosition,
|
|
114
|
+
labelGap: CATEGORY_TILE.labelGap,
|
|
115
|
+
overInset: circle ? Math.round(tileWidth * CATEGORY_TILE.circleInset) : CATEGORY_TILE.labelGap,
|
|
116
|
+
scrimHeight: CATEGORY_TILE.scrimHeight,
|
|
117
|
+
labelSize,
|
|
118
|
+
labelLineHeight,
|
|
119
|
+
labelLines,
|
|
120
|
+
labelHeight: labelLineHeight * labelLines,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=category-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category-grid.js","sourceRoot":"","sources":["../src/category-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GAUpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,gHAAgH;AAChH,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,SAAS;CACiC,CAAC;AAMpD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAiB,EACjB,UAAsC;IAEtC,MAAM,IAAI,GACR,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,mBAAmB,CACjB,KAAK,EACL,oBAAoB,EACpB,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAChD;QACH,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO;QACL,GAAG,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,mBAAmB,CAAC;QAC1D,IAAI;QACJ,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;KACxB,CAAC;AACJ,CAAC;AAiBD,SAAS,KAAK,CAAC,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,IAAI,sBAAsB,CAAC,UAAU,CAAC;IAC5E,OAAO;QACL,KAAK;QACL,MAAM,EAAE,MAAM;YACZ,CAAC,CAAC,SAAS,GAAG,CAAC;YACf,CAAC,CAAC,KAAK,KAAK,SAAS;gBACnB,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAAC;gBAClE,CAAC,CAAC,CAAC;QACP,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,sBAAsB,CAAC,GAAG;QAC/C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzD,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,aAAa,EAAE,QAAQ,CAAC,aAAa,IAAI,sBAAsB,CAAC,aAAa;QAC7E,QAAQ,EAAE,aAAa,CAAC,QAAQ;QAChC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ;QAC9F,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,SAAS;QACT,eAAe;QACf,UAAU;QACV,WAAW,EAAE,eAAe,GAAG,UAAU;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ColorChoice, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/** The colour a merchant chose, as a value: their hex, or the theme role they named. */
|
|
3
|
+
export declare function colorChoiceOf(theme: ThemeStyle, choice: ColorChoice | undefined): string | undefined;
|
|
4
|
+
//# sourceMappingURL=color-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-choice.d.ts","sourceRoot":"","sources":["../src/color-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE5F,wFAAwF;AACxF,wBAAgB,aAAa,CAC3B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { tokenRoleValue } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/** The colour a merchant chose, as a value: their hex, or the theme role they named. */
|
|
3
|
+
export function colorChoiceOf(theme, choice) {
|
|
4
|
+
if (choice === undefined)
|
|
5
|
+
return undefined;
|
|
6
|
+
if (typeof choice === 'string')
|
|
7
|
+
return choice;
|
|
8
|
+
const role = tokenRoleValue(theme, choice.token);
|
|
9
|
+
return typeof role === 'string' ? role : undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=color-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-choice.js","sourceRoot":"","sources":["../src/color-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,yBAAyB,CAAC;AAE5F,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAC3B,KAAiB,EACjB,MAA+B;IAE/B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextDirection } from './contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* The direction a text is written in: the one its first strong letter reads
|
|
4
|
+
* in, as a browser's `dir="auto"` decides it. A merchant's catalog may be
|
|
5
|
+
* written in one language while the shopper reads the app in another, so a
|
|
6
|
+
* product's own words are laid out the way they were written. A text with no
|
|
7
|
+
* letter at all, a price or a number, says nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function contentDirection(text: string | undefined): TextDirection | null;
|
|
10
|
+
//# sourceMappingURL=content-direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-direction.d.ts","sourceRoot":"","sources":["../src/content-direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAYnD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAK/E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const LEFT_TO_RIGHT_LETTERS = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02AF\u0370-\u0373\u0376-\u03FF\u0400-\u0482\u048A-\u052F';
|
|
2
|
+
const RIGHT_TO_LEFT_LETTERS = '\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08C9\uFB1D\uFB1F-\uFB28\uFB2A-\uFDFB\uFE70-\uFEFC';
|
|
3
|
+
const STRONG_LETTER = new RegExp(`[${LEFT_TO_RIGHT_LETTERS}${RIGHT_TO_LEFT_LETTERS}]`);
|
|
4
|
+
const RIGHT_TO_LEFT_LETTER = new RegExp(`[${RIGHT_TO_LEFT_LETTERS}]`);
|
|
5
|
+
/**
|
|
6
|
+
* The direction a text is written in: the one its first strong letter reads
|
|
7
|
+
* in, as a browser's `dir="auto"` decides it. A merchant's catalog may be
|
|
8
|
+
* written in one language while the shopper reads the app in another, so a
|
|
9
|
+
* product's own words are laid out the way they were written. A text with no
|
|
10
|
+
* letter at all, a price or a number, says nothing.
|
|
11
|
+
*/
|
|
12
|
+
export function contentDirection(text) {
|
|
13
|
+
if (text === undefined)
|
|
14
|
+
return null;
|
|
15
|
+
const letter = STRONG_LETTER.exec(text)?.[0];
|
|
16
|
+
if (letter === undefined)
|
|
17
|
+
return null;
|
|
18
|
+
return RIGHT_TO_LEFT_LETTER.test(letter) ? 'rtl' : 'ltr';
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=content-direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-direction.js","sourceRoot":"","sources":["../src/content-direction.ts"],"names":[],"mappings":"AAEA,MAAM,qBAAqB,GACzB,mGAAmG,CAAC;AAEtG,MAAM,qBAAqB,GACzB,oLAAoL,CAAC;AAEvL,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,IAAI,qBAAqB,GAAG,qBAAqB,GAAG,CAAC,CAAC;AAEvF,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,IAAI,qBAAqB,GAAG,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,OAAO,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ProductDisplay } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import type { ProductSpecRow } from './product-specs.js';
|
|
3
|
+
export interface DescriptionRun {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly bold: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DescriptionFact {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly value: string;
|
|
10
|
+
}
|
|
11
|
+
export type DescriptionPart = {
|
|
12
|
+
readonly kind: 'paragraph';
|
|
13
|
+
readonly runs: readonly DescriptionRun[];
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'heading';
|
|
16
|
+
readonly runs: readonly DescriptionRun[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'list';
|
|
19
|
+
readonly ordered: boolean;
|
|
20
|
+
readonly items: readonly (readonly DescriptionRun[])[];
|
|
21
|
+
readonly webLinks: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: 'table';
|
|
24
|
+
readonly rows: readonly DescriptionFact[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The merchant's description as Shopify holds it, taken apart into what a
|
|
28
|
+
* native screen can draw: paragraphs and headings of plain and bold runs,
|
|
29
|
+
* lists, and tables of facts, a label and a value per row. Nothing of the
|
|
30
|
+
* markup survives, so a script, a style or a link can never run on a phone:
|
|
31
|
+
* a link keeps its words and loses its address, and a list whose every item is
|
|
32
|
+
* a link is marked, for the merchant's lists of web pages ("you may also
|
|
33
|
+
* like") that lead out of the app. White space folds the way a browser folds
|
|
34
|
+
* it, and the common entities read as their characters.
|
|
35
|
+
*/
|
|
36
|
+
export declare function descriptionParts(html: string | undefined): DescriptionPart[];
|
|
37
|
+
/**
|
|
38
|
+
* The parts a description draws: every one, less its tables where the
|
|
39
|
+
* specifications read them or the merchant hid them, and less its lists of
|
|
40
|
+
* web links, with the heading that stands over such a list.
|
|
41
|
+
*/
|
|
42
|
+
export declare function shownDescriptionParts(parts: readonly DescriptionPart[], options: {
|
|
43
|
+
readonly tables?: boolean;
|
|
44
|
+
readonly webLinks?: boolean;
|
|
45
|
+
}): DescriptionPart[];
|
|
46
|
+
/** The words of a description in reading order, what its direction is read from. */
|
|
47
|
+
export declare function descriptionText(parts: readonly DescriptionPart[]): string;
|
|
48
|
+
/** The facts of every table in the product's description, in its order. */
|
|
49
|
+
export declare function descriptionFacts(product: ProductDisplay): ProductSpecRow[];
|
|
50
|
+
/**
|
|
51
|
+
* What a description block draws from the merchant's markup: its shown parts
|
|
52
|
+
* where the block is rich and the product carries markup, and null where the
|
|
53
|
+
* block draws the plain text instead.
|
|
54
|
+
*/
|
|
55
|
+
export declare function descriptionPartsOf(product: ProductDisplay, settings: {
|
|
56
|
+
readonly rich?: boolean;
|
|
57
|
+
readonly tables?: boolean;
|
|
58
|
+
readonly webLinks?: boolean;
|
|
59
|
+
}): DescriptionPart[] | null;
|
|
60
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../src/description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACxE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACtE;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC;IACvD,QAAQ,CAAC,QAAQ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o: '»',
|
|
14
|
+
hellip: '…',
|
|
15
|
+
ndash: '–',
|
|
16
|
+
mdash: '—',
|
|
17
|
+
times: '×',
|
|
18
|
+
copy: '©',
|
|
19
|
+
reg: '®',
|
|
20
|
+
trade: '™',
|
|
21
|
+
};
|
|
22
|
+
function decodeEntities(text) {
|
|
23
|
+
return text.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi, (whole, name) => {
|
|
24
|
+
if (name[0] === '#') {
|
|
25
|
+
const code = name[1] === 'x' || name[1] === 'X' ? parseInt(name.slice(2), 16) : Number(name.slice(1));
|
|
26
|
+
return Number.isSafeInteger(code) && code > 0 && code <= 0x10ffff
|
|
27
|
+
? String.fromCodePoint(code)
|
|
28
|
+
: whole;
|
|
29
|
+
}
|
|
30
|
+
return NAMED_ENTITIES[name.toLowerCase()] ?? whole;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const PARAGRAPH_TAGS = new Set([
|
|
34
|
+
'p',
|
|
35
|
+
'div',
|
|
36
|
+
'section',
|
|
37
|
+
'article',
|
|
38
|
+
'blockquote',
|
|
39
|
+
'header',
|
|
40
|
+
'footer',
|
|
41
|
+
]);
|
|
42
|
+
const HEADING_TAGS = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']);
|
|
43
|
+
const BOLD_TAGS = new Set(['strong', 'b']);
|
|
44
|
+
const SKIPPED_TAGS = new Set(['script', 'style', 'template', 'head', 'iframe', 'svg', 'noscript']);
|
|
45
|
+
const TOKEN = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][a-zA-Z0-9]*)\b[^>]*?(\/?)>|[^<]+|</g;
|
|
46
|
+
function appendRun(runs, text, bold) {
|
|
47
|
+
const folded = text.replace(/\s+/g, ' ');
|
|
48
|
+
if (folded === '')
|
|
49
|
+
return;
|
|
50
|
+
const last = runs[runs.length - 1];
|
|
51
|
+
const joined = last !== undefined && last.text.endsWith(' ') && folded.startsWith(' ')
|
|
52
|
+
? folded.slice(1)
|
|
53
|
+
: folded;
|
|
54
|
+
if (joined === '')
|
|
55
|
+
return;
|
|
56
|
+
if (last !== undefined && last.bold === bold)
|
|
57
|
+
runs[runs.length - 1] = { text: last.text + joined, bold };
|
|
58
|
+
else
|
|
59
|
+
runs.push({ text: joined, bold });
|
|
60
|
+
}
|
|
61
|
+
function trimmedRuns(runs) {
|
|
62
|
+
const out = runs.map((run) => ({ ...run }));
|
|
63
|
+
if (out.length > 0)
|
|
64
|
+
out[0] = { ...out[0], text: out[0].text.trimStart() };
|
|
65
|
+
if (out.length > 0)
|
|
66
|
+
out[out.length - 1] = { ...out[out.length - 1], text: out[out.length - 1].text.trimEnd() };
|
|
67
|
+
return out.filter((run) => run.text !== '');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The merchant's description as Shopify holds it, taken apart into what a
|
|
71
|
+
* native screen can draw: paragraphs and headings of plain and bold runs,
|
|
72
|
+
* lists, and tables of facts, a label and a value per row. Nothing of the
|
|
73
|
+
* markup survives, so a script, a style or a link can never run on a phone:
|
|
74
|
+
* a link keeps its words and loses its address, and a list whose every item is
|
|
75
|
+
* a link is marked, for the merchant's lists of web pages ("you may also
|
|
76
|
+
* like") that lead out of the app. White space folds the way a browser folds
|
|
77
|
+
* it, and the common entities read as their characters.
|
|
78
|
+
*/
|
|
79
|
+
export function descriptionParts(html) {
|
|
80
|
+
const parts = [];
|
|
81
|
+
if (html === undefined || html === '')
|
|
82
|
+
return parts;
|
|
83
|
+
let runs = [];
|
|
84
|
+
let heading = false;
|
|
85
|
+
let bold = 0;
|
|
86
|
+
let link = 0;
|
|
87
|
+
let skip = 0;
|
|
88
|
+
let list = null;
|
|
89
|
+
let item = null;
|
|
90
|
+
let table = null;
|
|
91
|
+
let row = null;
|
|
92
|
+
let cell = null;
|
|
93
|
+
const flush = () => {
|
|
94
|
+
const kept = trimmedRuns(runs);
|
|
95
|
+
if (kept.length > 0)
|
|
96
|
+
parts.push({ kind: heading ? 'heading' : 'paragraph', runs: kept });
|
|
97
|
+
runs = [];
|
|
98
|
+
heading = false;
|
|
99
|
+
};
|
|
100
|
+
const closeItem = () => {
|
|
101
|
+
if (item === null || list === null)
|
|
102
|
+
return;
|
|
103
|
+
const kept = trimmedRuns(item.runs);
|
|
104
|
+
if (kept.length > 0) {
|
|
105
|
+
list.items.push(kept);
|
|
106
|
+
list.linkOnly.push(item.linked && !item.plain);
|
|
107
|
+
}
|
|
108
|
+
item = null;
|
|
109
|
+
};
|
|
110
|
+
const closeList = () => {
|
|
111
|
+
closeItem();
|
|
112
|
+
if (list !== null && list.items.length > 0) {
|
|
113
|
+
parts.push({
|
|
114
|
+
kind: 'list',
|
|
115
|
+
ordered: list.ordered,
|
|
116
|
+
items: list.items,
|
|
117
|
+
webLinks: list.linkOnly.every(Boolean),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
list = null;
|
|
121
|
+
};
|
|
122
|
+
const closeCell = () => {
|
|
123
|
+
if (cell !== null && row !== null)
|
|
124
|
+
row.push(cell.replace(/\s+/g, ' ').trim());
|
|
125
|
+
cell = null;
|
|
126
|
+
};
|
|
127
|
+
const closeRow = () => {
|
|
128
|
+
closeCell();
|
|
129
|
+
if (row !== null && table !== null && row.length >= 2 && row[0] !== '') {
|
|
130
|
+
const value = row
|
|
131
|
+
.slice(1)
|
|
132
|
+
.filter((text) => text !== '')
|
|
133
|
+
.join(' · ');
|
|
134
|
+
if (value !== '')
|
|
135
|
+
table.push({ label: row[0], value });
|
|
136
|
+
}
|
|
137
|
+
row = null;
|
|
138
|
+
};
|
|
139
|
+
const closeTable = () => {
|
|
140
|
+
closeRow();
|
|
141
|
+
if (table !== null && table.length > 0)
|
|
142
|
+
parts.push({ kind: 'table', rows: table });
|
|
143
|
+
table = null;
|
|
144
|
+
};
|
|
145
|
+
const text = (value) => {
|
|
146
|
+
if (skip > 0)
|
|
147
|
+
return;
|
|
148
|
+
if (table !== null) {
|
|
149
|
+
if (cell !== null)
|
|
150
|
+
cell += value;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (item !== null) {
|
|
154
|
+
appendRun(item.runs, value, bold > 0);
|
|
155
|
+
if (value.trim() !== '') {
|
|
156
|
+
if (link > 0)
|
|
157
|
+
item.linked = true;
|
|
158
|
+
else
|
|
159
|
+
item.plain = true;
|
|
160
|
+
}
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
appendRun(runs, value, bold > 0);
|
|
164
|
+
};
|
|
165
|
+
const space = () => text(' ');
|
|
166
|
+
for (const token of html.matchAll(TOKEN)) {
|
|
167
|
+
const [whole, closing, rawName, selfClosing] = token;
|
|
168
|
+
if (whole.startsWith('<!--'))
|
|
169
|
+
continue;
|
|
170
|
+
if (rawName === undefined) {
|
|
171
|
+
text(decodeEntities(whole));
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const name = rawName.toLowerCase();
|
|
175
|
+
const open = closing !== '/';
|
|
176
|
+
if (SKIPPED_TAGS.has(name)) {
|
|
177
|
+
if (selfClosing === '/')
|
|
178
|
+
continue;
|
|
179
|
+
skip = Math.max(0, skip + (open ? 1 : -1));
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (skip > 0)
|
|
183
|
+
continue;
|
|
184
|
+
if (BOLD_TAGS.has(name)) {
|
|
185
|
+
bold = Math.max(0, bold + (open ? 1 : -1));
|
|
186
|
+
}
|
|
187
|
+
else if (name === 'a') {
|
|
188
|
+
link = Math.max(0, link + (open ? 1 : -1));
|
|
189
|
+
}
|
|
190
|
+
else if (name === 'br') {
|
|
191
|
+
if (table !== null || item !== null)
|
|
192
|
+
space();
|
|
193
|
+
else
|
|
194
|
+
flush();
|
|
195
|
+
}
|
|
196
|
+
else if (PARAGRAPH_TAGS.has(name)) {
|
|
197
|
+
if (table !== null || item !== null)
|
|
198
|
+
space();
|
|
199
|
+
else
|
|
200
|
+
flush();
|
|
201
|
+
}
|
|
202
|
+
else if (HEADING_TAGS.has(name)) {
|
|
203
|
+
if (table !== null || item !== null)
|
|
204
|
+
space();
|
|
205
|
+
else {
|
|
206
|
+
flush();
|
|
207
|
+
heading = open;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (name === 'ul' || name === 'ol') {
|
|
211
|
+
if (table !== null)
|
|
212
|
+
continue;
|
|
213
|
+
if (open) {
|
|
214
|
+
if (list === null) {
|
|
215
|
+
flush();
|
|
216
|
+
list = { ordered: name === 'ol', depth: 1, items: [], linkOnly: [] };
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
closeItem();
|
|
220
|
+
list.depth += 1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (list !== null) {
|
|
224
|
+
list.depth -= 1;
|
|
225
|
+
if (list.depth <= 0)
|
|
226
|
+
closeList();
|
|
227
|
+
else
|
|
228
|
+
closeItem();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (name === 'li') {
|
|
232
|
+
if (table !== null)
|
|
233
|
+
continue;
|
|
234
|
+
if (open) {
|
|
235
|
+
if (list === null) {
|
|
236
|
+
flush();
|
|
237
|
+
list = { ordered: false, depth: 1, items: [], linkOnly: [] };
|
|
238
|
+
}
|
|
239
|
+
closeItem();
|
|
240
|
+
item = { runs: [], plain: false, linked: false };
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
closeItem();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (name === 'table') {
|
|
247
|
+
if (open) {
|
|
248
|
+
closeList();
|
|
249
|
+
flush();
|
|
250
|
+
table = [];
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
closeTable();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else if (name === 'tr') {
|
|
257
|
+
if (table === null)
|
|
258
|
+
continue;
|
|
259
|
+
if (open) {
|
|
260
|
+
closeRow();
|
|
261
|
+
row = [];
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
closeRow();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else if (name === 'td' || name === 'th') {
|
|
268
|
+
if (row === null)
|
|
269
|
+
continue;
|
|
270
|
+
if (open) {
|
|
271
|
+
closeCell();
|
|
272
|
+
cell = '';
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
closeCell();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
closeTable();
|
|
280
|
+
closeList();
|
|
281
|
+
flush();
|
|
282
|
+
return parts;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The parts a description draws: every one, less its tables where the
|
|
286
|
+
* specifications read them or the merchant hid them, and less its lists of
|
|
287
|
+
* web links, with the heading that stands over such a list.
|
|
288
|
+
*/
|
|
289
|
+
export function shownDescriptionParts(parts, options) {
|
|
290
|
+
const tables = options.tables ?? true;
|
|
291
|
+
const webLinks = options.webLinks ?? true;
|
|
292
|
+
const hidden = (part) => part !== undefined &&
|
|
293
|
+
((part.kind === 'table' && !tables) || (part.kind === 'list' && part.webLinks && !webLinks));
|
|
294
|
+
return parts.filter((part, index) => {
|
|
295
|
+
if (hidden(part))
|
|
296
|
+
return false;
|
|
297
|
+
return !(part.kind === 'heading' &&
|
|
298
|
+
!webLinks &&
|
|
299
|
+
hidden(parts[index + 1]) &&
|
|
300
|
+
parts[index + 1].kind === 'list');
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/** The words of a description in reading order, what its direction is read from. */
|
|
304
|
+
export function descriptionText(parts) {
|
|
305
|
+
return parts
|
|
306
|
+
.map((part) => {
|
|
307
|
+
if (part.kind === 'table')
|
|
308
|
+
return part.rows.map((fact) => `${fact.label} ${fact.value}`).join(' ');
|
|
309
|
+
if (part.kind === 'list')
|
|
310
|
+
return part.items.map((runs) => runs.map((run) => run.text).join('')).join(' ');
|
|
311
|
+
return part.runs.map((run) => run.text).join('');
|
|
312
|
+
})
|
|
313
|
+
.join(' ');
|
|
314
|
+
}
|
|
315
|
+
/** The facts of every table in the product's description, in its order. */
|
|
316
|
+
export function descriptionFacts(product) {
|
|
317
|
+
return descriptionParts(product.descriptionHtml)
|
|
318
|
+
.flatMap((part) => (part.kind === 'table' ? part.rows : []))
|
|
319
|
+
.map((fact, index) => ({ key: `description-${index}`, label: fact.label, value: fact.value }));
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* What a description block draws from the merchant's markup: its shown parts
|
|
323
|
+
* where the block is rich and the product carries markup, and null where the
|
|
324
|
+
* block draws the plain text instead.
|
|
325
|
+
*/
|
|
326
|
+
export function descriptionPartsOf(product, settings) {
|
|
327
|
+
const markup = product.descriptionHtml ?? '';
|
|
328
|
+
if (settings.rich !== true || markup === '')
|
|
329
|
+
return null;
|
|
330
|
+
return shownDescriptionParts(descriptionParts(markup), settings);
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../src/description.ts"],"names":[],"mappings":"AAwBA,MAAM,cAAc,GAAqC;IACvD,GAAG,EAAE,GAAG;IACR,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC9E,IAAI,IAAI,CA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