@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
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
10
10
|
the buyer's language and text direction with the Shop's default language as
|
|
11
11
|
fallback, `navigate` (the document's action, and the implicit taps: a
|
|
12
12
|
product, a collection, search, the account, and on a host that knows them an
|
|
13
|
-
order, the page Shopify hosts for it and the Address Sheet on
|
|
14
|
-
address), `cart` (how many items the
|
|
13
|
+
order, its tracking, the page Shopify hosts for it and the Address Sheet on
|
|
14
|
+
one saved address), `cart` (how many items the
|
|
15
15
|
cart holds for a badge, and whether a change is on its way so every block
|
|
16
16
|
goes quiet together; never the cart itself, which a cart Binding resolves),
|
|
17
17
|
`account` (whether a shopper is signed in, the name to greet them by and its
|
|
@@ -50,7 +50,10 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
50
50
|
stock is clamped by Shopify and not refused, and the host names what is
|
|
51
51
|
left; a shopper who holds no Account Session gets the refusal too, so a
|
|
52
52
|
block never has to ask whether a capability is reachable before it calls
|
|
53
|
-
one. `
|
|
53
|
+
one. `signOut` asks the shopper first, in the host's Log-out Sheet, which no
|
|
54
|
+
block can skip: it resolves once they chose to log out and the sign-out
|
|
55
|
+
landed, and rejects with the `refused` outcome when they stay signed in.
|
|
56
|
+
`isCapabilityRefusal` tells a refusal apart from any other rejection.
|
|
54
57
|
Nothing repaints before Shopify's answer, and the block decides how to show
|
|
55
58
|
a refusal.
|
|
56
59
|
- **The authoring shape of a Code Block.** `defineSettings()` and
|
|
@@ -77,14 +80,37 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
77
80
|
`moneyAmount` and `discountPercent`, the money presentation below, and
|
|
78
81
|
`productCardColors`, `collectionTileColors`, `heroBannerColors` beside
|
|
79
82
|
`heroBannerRadius`, `promoBannerColors` beside `promoBannerRadius`,
|
|
80
|
-
`sectionHeaderColors`, `featureStripColors`, `storeHeaderColors
|
|
83
|
+
`sectionHeaderColors`, `featureStripColors`, `storeHeaderColors` (its
|
|
84
|
+
`drawer_group` part paints the card an open menu parent stands on) beside
|
|
85
|
+
`storeMenuMetrics` and `STORE_MENU_DIM`,
|
|
81
86
|
`brandRailColors`, `buyBoxColors`, `announcementBarColors`, `shippingProgressColors`, `productGalleryColors`,
|
|
82
87
|
`productSummaryColors`, `productSpecsColors`, `reviewsSlotColors`,
|
|
83
88
|
`cartLinesColors`, `cartEmptyColors`, `cartDiscountCodeColors`,
|
|
84
89
|
`cartSummaryColors`, `checkoutButtonColors`, `signInColors`,
|
|
85
90
|
`profileHeaderColors` and `accountLinksColors`, the colour tables the
|
|
86
91
|
promoted blocks read on the phone and on the web alike: a theme role per part
|
|
87
|
-
of the block, with a component token at `<block>.<part>` over it.
|
|
92
|
+
of the block, with a component token at `<block>.<part>` over it. The
|
|
93
|
+
sign-in block is retired, so `signInColors` is deprecated and stays until the
|
|
94
|
+
next major; the profile header's table carries the title, the subtitle and
|
|
95
|
+
the button it draws while nobody is signed in.
|
|
96
|
+
The three sections of the product page read the specs' table:
|
|
97
|
+
`productSpecsColors` takes the surface a merchant chose for one of them over
|
|
98
|
+
its own, `productSectionTitle` writes a section's title, the merchant's or
|
|
99
|
+
the catalog's (`PRODUCT_SECTION_TITLES`), `productSpecRows` lists the
|
|
100
|
+
facts, the merchant's rows or the vendor and the type, and `shippingRowsOf`
|
|
101
|
+
the shipping rows the buyer can read. The plain look of the product page
|
|
102
|
+
reads `contentDirection` (a product's own words laid out the way they were
|
|
103
|
+
written), `descriptionParts` and `shownDescriptionParts` (the merchant's
|
|
104
|
+
description markup as paragraphs, lists and tables, with nothing of the
|
|
105
|
+
markup kept), `descriptionFacts` (the facts of those tables, which
|
|
106
|
+
`productSpecRows` leads with where a block asks), `chosenPrice` (the chosen
|
|
107
|
+
variant's price, never the cheapest's), `savingText` (the saving the
|
|
108
|
+
summary says, as an amount, a percent or nothing), `descriptionPartsOf` (what
|
|
109
|
+
a description block draws, the one rule the phone, the twin and the canvas
|
|
110
|
+
read), `variantRows` and `variantLabel` (one priced row per variant, a
|
|
111
|
+
variant in one line), and `valuesAfterEarlierChoices` and `choicesAfterPick`
|
|
112
|
+
(a later option offers only what the earlier choices leave, and a pick moves
|
|
113
|
+
the later choices to a variant for sale).
|
|
88
114
|
`readableInk` is the one rule for words on a colour the merchant chose, so a
|
|
89
115
|
bar cannot be white on the phone and dark on the canvas. `shippingProgress`
|
|
90
116
|
reads how far a held cart is from a free shipping threshold, `cartSavings`
|
|
@@ -95,24 +121,69 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
95
121
|
`BUY_QUANTITY_CEILING` the most of one variant a buy control offers to add in
|
|
96
122
|
one tap. `customerInitials` is the letters an avatar draws for a shopper,
|
|
97
123
|
and `accountLinkRows` the rows of the account links as both renderers draw
|
|
98
|
-
them: named, the hidden ones left out, sign out and delete set apart.
|
|
124
|
+
them: named, the hidden ones left out, sign out and delete set apart. The
|
|
125
|
+
Sign in row reads the platform's `account.sign_in`.
|
|
126
|
+
`accountLinksLayout` lays those rows out for the shopper's state, the one
|
|
127
|
+
filter both renderers share: handed `signed_in` or `signed_out`, it keeps
|
|
128
|
+
only the rows the schema's `ACCOUNT_LINK_ROW_STATES` lets draw in it, then
|
|
129
|
+
puts consecutive rows of one section on one card under its title, the
|
|
130
|
+
destructive rows in the list, and the log-out as a pill or pinned at the
|
|
131
|
+
foot of the hub where the merchant says so; handed no state, it keeps every
|
|
132
|
+
row. `accountLinksCard` is the card they stand on and the circle behind a
|
|
133
|
+
glyph.
|
|
99
134
|
`orderColors` and `orderRadius` are the one table and the one corner the
|
|
100
135
|
eight order blocks share at `order.<part>`; `fulfillmentPillOf` and
|
|
101
136
|
`paymentPillOf` are the two pills of an order, a word and one of four tones,
|
|
102
|
-
and `orderPillColors` the ink and the surface of a tone
|
|
137
|
+
and `orderPillColors` the ink and the surface of a tone, read from the pair
|
|
138
|
+
the theme names for the tone's state at `status.pending`, `status.delivered`
|
|
139
|
+
or `status.cancelled` (a `label` and a `surface`), which `orderStatusColors`
|
|
140
|
+
hands an editor whole. `orderListCards` is the card a row of the orders list
|
|
141
|
+
stands on and the card its first line stands on, `orderLineCard` the card a
|
|
142
|
+
line stands on in the list and on the order screen alike, `orderSummaryBox`
|
|
143
|
+
the box of the money rows, `orderItemsOf` the first line of an order, how
|
|
144
|
+
many lines follow it and how many items it holds, `orderItemCount` that
|
|
145
|
+
count in the buyer's language and `orderSubtotalLabel` the subtotal that
|
|
146
|
+
names it, and `orderHasShipments` whether Shopify holds a shipment to
|
|
147
|
+
track; `SHIPMENT_STEPS`
|
|
103
148
|
and `shipmentStepReached` are the progress rail of a shipment,
|
|
104
|
-
`fulfillmentEventWord` and `shipmentWord` its words
|
|
149
|
+
`fulfillmentEventWord` and `shipmentWord` its words, Delivered where its
|
|
150
|
+
newest event says it arrived, the one reading `fulfillmentPillOf` makes of
|
|
151
|
+
every live shipment, on a row of the list as on the opened order; `orderMoneyRows` lists
|
|
105
152
|
the money rows Shopify wrote, and `orderDay` and `orderTime` write a
|
|
106
153
|
timestamp as a shopper reads it. `addressListColors` and `addressListRadius`
|
|
107
154
|
are the table and the corner of the address list at `address_list.<part>`,
|
|
108
|
-
`addressCardOf` the title and the lines of one saved address,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Delete, because Shopify refuses that delete in English in every
|
|
112
|
-
refuses it for the only saved address too.
|
|
155
|
+
`addressCardOf` the title and the lines of one saved address, the lines the
|
|
156
|
+
Provider composed in the standard postal shape, and `addressControlsOf`
|
|
157
|
+
which of its three controls a card offers: the default address is never
|
|
158
|
+
offered Delete, because Shopify refuses that delete in English in every
|
|
159
|
+
language and refuses it for the only saved address too. The card draws no
|
|
160
|
+
note about it; `defaultLocked` and the `address.default_before_delete` word
|
|
161
|
+
stay in the contract, unused by the platform, until its next major. `heroPageLabel` says which page of how many a hero carousel rests
|
|
113
162
|
on, because its marks carry no words of their own. `promoSetLabel` says how
|
|
114
163
|
many promotions a promo banner stacks, and `promoCardLabel` which of them a
|
|
115
164
|
card is, beside the merchant's words or in place of them.
|
|
165
|
+
`categoryTileOf` is the tile of one collection a category grid's Binding
|
|
166
|
+
answered, with what the merchant changed on it over the collection's own:
|
|
167
|
+
the words, a picture or an icon, and where a tap goes, the collection where
|
|
168
|
+
they pointed it nowhere. `categoryGridRow` is how many tiles stand in a row
|
|
169
|
+
and the gap between them, `categoryTileWidth` the width a row hands a tile,
|
|
170
|
+
`categoryGridLook` every measure of a tile at that width, and
|
|
171
|
+
`categoryGridColors` its colours, the tile on the role the merchant chose
|
|
172
|
+
and the icon in whichever of ink and paper stands out on it.
|
|
173
|
+
`listingToolbarLook` and `listingToolbarColors` are the listing toolbar's
|
|
174
|
+
parts, measures and colours at `listing_toolbar.<part>`, the role the
|
|
175
|
+
merchant chose for the bar, its stroke, its words or the switch's track over
|
|
176
|
+
them; `listingCount` is the count of the products a listing has loaded,
|
|
177
|
+
"24+" while Shopify names more, with its word in the form the buyer's
|
|
178
|
+
language counts it in; `listingSortRows` and `listingSortLabel` are the
|
|
179
|
+
sorts the sheet offers in the merchant's order and words, the catalog's
|
|
180
|
+
`listing.sort.<key>` where they wrote none; `listingFilterRows` is the filter
|
|
181
|
+
sheet's rows out of the filters Shopify offers the collection, a switch, a
|
|
182
|
+
price range or a list, in the merchant's order and words; `activeFilterOf`
|
|
183
|
+
and `activePriceFilter` are a filter the shopper turned on, Shopify's own
|
|
184
|
+
input for a value unchanged or the price range they gave, with the words of
|
|
185
|
+
its chip; `listingFilterWords` the words of the button, the sheet and the
|
|
186
|
+
chips; and `PRODUCT_ROW_LOOK` is the row a product takes in a list.
|
|
116
187
|
`derivedPrice` writes a figure a block worked out for itself, in the style the
|
|
117
188
|
theme chose and at the currency's own places so it lines up in a column with
|
|
118
189
|
the ones Shopify sent; `derivedMoney` is the same figure with an empty
|
|
@@ -151,6 +222,14 @@ fallback is always a theme role, never a literal: a merchant who names nothing
|
|
|
151
222
|
still gets their own palette, and the token is the escape hatch over it. A
|
|
152
223
|
token of another type is not drawn, the fallback is.
|
|
153
224
|
|
|
225
|
+
One colour is the exception, by the owner's decision: the dim behind the store
|
|
226
|
+
header's open menu. A theme's `overlay` role may be a light wash, and the menu
|
|
227
|
+
must dim the screen dark on every theme, so `storeHeaderColors` falls back to
|
|
228
|
+
`STORE_MENU_DIM` (the Cart Drawer's dim) with `store_header.scrim` over it.
|
|
229
|
+
Sizes are not colours: `storeMenuMetrics` answers the menu's row height and
|
|
230
|
+
label size, 48 and 16 points, with `store_header.menu_row_height` and
|
|
231
|
+
`store_header.menu_text_size` over them.
|
|
232
|
+
|
|
154
233
|
## The words a renderer owns
|
|
155
234
|
|
|
156
235
|
A renderer never carries its own literal. Every functional word the platform
|
package/dist/account-links.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccountLinkRow, type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
1
|
+
import { type AccountLinkRow, type AccountLinksBlock, type AccountLinkState, type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
2
|
/**
|
|
3
3
|
* The parts of the account links, each with the theme role it draws unless a
|
|
4
4
|
* component token names another. No theme role is a red, so the destructive
|
|
@@ -43,5 +43,54 @@ export interface AccountLinkRows {
|
|
|
43
43
|
* than drawn blank. Sign out and delete are set apart from the group.
|
|
44
44
|
*/
|
|
45
45
|
export declare function accountLinkRows(rows: readonly AccountLinkRow[] | undefined, language: LocaleCode, defaultLanguage: LocaleCode): AccountLinkRows;
|
|
46
|
+
/** The card the rows stand on, and the circle behind each row's glyph, as both renderers draw them. */
|
|
47
|
+
export interface AccountLinksCard {
|
|
48
|
+
readonly surface: string;
|
|
49
|
+
/** The line around the card; none, and the card stands on its surface alone. */
|
|
50
|
+
readonly stroke: string | null;
|
|
51
|
+
readonly radius: number;
|
|
52
|
+
readonly shadow: boolean;
|
|
53
|
+
readonly iconCircle: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The card of the account links: what the merchant set, and the theme's own
|
|
57
|
+
* look for every part they left out, which is the look the links had before
|
|
58
|
+
* the card was a setting: the links' surface, no stroke, their own corner and
|
|
59
|
+
* the soft shadow. The corner is the block's one corner, so the destructive
|
|
60
|
+
* rows and the log-out pill are cut with it too.
|
|
61
|
+
*/
|
|
62
|
+
export declare function accountLinksCard(theme: ThemeStyle, settings: AccountLinksBlock['props']): AccountLinksCard;
|
|
63
|
+
/** One run of consecutive rows on one card, under the title of the section they name; none, and no title. */
|
|
64
|
+
export interface AccountLinkSection {
|
|
65
|
+
readonly title: string;
|
|
66
|
+
readonly rows: readonly NamedAccountLink[];
|
|
67
|
+
}
|
|
68
|
+
/** How a destructive row draws: a row like the others, or the design's centred pill. */
|
|
69
|
+
export type AccountLinkShape = 'row' | 'pill';
|
|
70
|
+
export interface DestructiveAccountLink extends NamedAccountLink {
|
|
71
|
+
readonly shape: AccountLinkShape;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The account links as both renderers lay them out: the sections on their
|
|
75
|
+
* cards, the destructive rows drawn in the list under them, and the log-out
|
|
76
|
+
* the merchant pinned below the hub's scrolling content.
|
|
77
|
+
*/
|
|
78
|
+
export interface AccountLinksLayout {
|
|
79
|
+
readonly sections: readonly AccountLinkSection[];
|
|
80
|
+
readonly destructive: readonly DestructiveAccountLink[];
|
|
81
|
+
readonly pinned: DestructiveAccountLink | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The layout of the account links, in the merchant's order. Handed the
|
|
85
|
+
* shopper's state, it keeps only the rows `ACCOUNT_LINK_ROW_STATES` lets draw
|
|
86
|
+
* in it, before anything is laid out; handed none, it keeps every row.
|
|
87
|
+
* Consecutive rows that name the same section, as the buyer reads it, share
|
|
88
|
+
* one card under its title; a section named again further down starts a card
|
|
89
|
+
* of its own. The two log-out settings move the first log-out row alone: the
|
|
90
|
+
* pill style draws it as the centred pill, the bottom placement pins it below
|
|
91
|
+
* the hub's scrolling content. Delete is always a row in the list, so it is
|
|
92
|
+
* always reachable.
|
|
93
|
+
*/
|
|
94
|
+
export declare function accountLinksLayout(settings: AccountLinksBlock['props'], language: LocaleCode, defaultLanguage: LocaleCode, state?: AccountLinkState): AccountLinksLayout;
|
|
46
95
|
export {};
|
|
47
96
|
//# sourceMappingURL=account-links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-links.d.ts","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"account-links.d.ts","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAMjC;;;;GAIG;AACH,QAAA,MAAM,mBAAmB;;;;;;;;;;CAUsC,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,2GAA2G;AAC3G,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,CAExE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE5D;AAWD,2FAA2F;AAC3F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uGAAuG;AACvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACnD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,cAAc,E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B,CAiBpB"}
|
package/dist/account-links.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { componentTokenValue, isDestructiveTarget, shownAccountLinkRows, } from '@shoplix-ai/sdui-schema';
|
|
1
|
+
import { accountLinkRowDraws, componentTokenValue, isDestructiveTarget, shownAccountLinkRows, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { colorChoiceOf } from './color-choice.js';
|
|
2
3
|
import { localize } from './locale.js';
|
|
3
4
|
import { partColors } from './part-colors.js';
|
|
4
5
|
import { platformWords } from './words.js';
|
|
@@ -34,6 +35,7 @@ const ROW_WORDS = {
|
|
|
34
35
|
open_orders: 'account.orders',
|
|
35
36
|
open_addresses: 'account.addresses',
|
|
36
37
|
open_profile: 'account.profile',
|
|
38
|
+
sign_in: 'account.sign_in',
|
|
37
39
|
sign_out: 'account.sign_out',
|
|
38
40
|
delete_account: 'account.delete_account',
|
|
39
41
|
};
|
|
@@ -58,4 +60,62 @@ export function accountLinkRows(rows, language, defaultLanguage) {
|
|
|
58
60
|
destructive: named.filter(({ row }) => isDestructiveTarget(row.target)),
|
|
59
61
|
};
|
|
60
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The card of the account links: what the merchant set, and the theme's own
|
|
65
|
+
* look for every part they left out, which is the look the links had before
|
|
66
|
+
* the card was a setting: the links' surface, no stroke, their own corner and
|
|
67
|
+
* the soft shadow. The corner is the block's one corner, so the destructive
|
|
68
|
+
* rows and the log-out pill are cut with it too.
|
|
69
|
+
*/
|
|
70
|
+
export function accountLinksCard(theme, settings) {
|
|
71
|
+
const colors = accountLinksColors(theme);
|
|
72
|
+
const card = settings.card ?? {};
|
|
73
|
+
return {
|
|
74
|
+
surface: colorChoiceOf(theme, card.surface) ?? colors.group,
|
|
75
|
+
stroke: colorChoiceOf(theme, card.stroke) ?? null,
|
|
76
|
+
radius: card.radius ?? accountLinksRadius(theme),
|
|
77
|
+
shadow: card.shadow ?? true,
|
|
78
|
+
iconCircle: colorChoiceOf(theme, settings.iconCircle) ?? colors.icon_well,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function sectionsOf(grouped, language, defaultLanguage) {
|
|
82
|
+
const sections = [];
|
|
83
|
+
for (const link of grouped) {
|
|
84
|
+
const section = link.row.section;
|
|
85
|
+
const title = section === undefined ? '' : localize(section, language, defaultLanguage);
|
|
86
|
+
const last = sections[sections.length - 1];
|
|
87
|
+
if (last !== undefined && last.title === title)
|
|
88
|
+
last.rows.push(link);
|
|
89
|
+
else
|
|
90
|
+
sections.push({ title, rows: [link] });
|
|
91
|
+
}
|
|
92
|
+
return sections;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The layout of the account links, in the merchant's order. Handed the
|
|
96
|
+
* shopper's state, it keeps only the rows `ACCOUNT_LINK_ROW_STATES` lets draw
|
|
97
|
+
* in it, before anything is laid out; handed none, it keeps every row.
|
|
98
|
+
* Consecutive rows that name the same section, as the buyer reads it, share
|
|
99
|
+
* one card under its title; a section named again further down starts a card
|
|
100
|
+
* of its own. The two log-out settings move the first log-out row alone: the
|
|
101
|
+
* pill style draws it as the centred pill, the bottom placement pins it below
|
|
102
|
+
* the hub's scrolling content. Delete is always a row in the list, so it is
|
|
103
|
+
* always reachable.
|
|
104
|
+
*/
|
|
105
|
+
export function accountLinksLayout(settings, language, defaultLanguage, state) {
|
|
106
|
+
const rows = state === undefined
|
|
107
|
+
? settings.rows
|
|
108
|
+
: settings.rows?.filter((row) => accountLinkRowDraws(row.target, state));
|
|
109
|
+
const { grouped, destructive } = accountLinkRows(rows, language, defaultLanguage);
|
|
110
|
+
const logOut = destructive.find(({ row }) => row.target.type === 'sign_out');
|
|
111
|
+
const shapeOf = (link) => link === logOut && settings.destructiveStyle === 'pill' ? 'pill' : 'row';
|
|
112
|
+
const pinned = settings.destructivePlacement === 'bottom' ? logOut : undefined;
|
|
113
|
+
return {
|
|
114
|
+
sections: sectionsOf(grouped, language, defaultLanguage),
|
|
115
|
+
destructive: destructive
|
|
116
|
+
.filter((link) => link !== pinned)
|
|
117
|
+
.map((link) => ({ ...link, shape: shapeOf(link) })),
|
|
118
|
+
pinned: pinned === undefined ? null : { ...pinned, shape: shapeOf(pinned) },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
61
121
|
//# sourceMappingURL=account-links.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-links.js","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"account-links.js","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GAOrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,QAAQ;CACgC,CAAC;AAMhE,2GAA2G;AAC3G,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,OAAO,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,OAAO,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,EAAE,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EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrD,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;KAC5E,CAAC;AACJ,CAAC"}
|
package/dist/address-list.d.ts
CHANGED
|
@@ -29,19 +29,21 @@ export interface AddressCard {
|
|
|
29
29
|
readonly lines: readonly string[];
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* The lines of a card are
|
|
33
|
-
*
|
|
34
|
-
* lines carry no phone, so the one
|
|
32
|
+
* The lines of a card are the ones the Provider composed in the standard
|
|
33
|
+
* postal shape from the address's own fields: the first, the name, titles
|
|
34
|
+
* the card and the rest stand under it. Those lines carry no phone, so the one
|
|
35
|
+
* the shopper wrote is drawn last.
|
|
35
36
|
*/
|
|
36
37
|
export declare function addressCardOf(address: AddressDisplay): AddressCard;
|
|
37
|
-
/** Which of the three controls a card offers
|
|
38
|
+
/** Which of the three controls a card offers. */
|
|
38
39
|
export interface AddressControls {
|
|
39
40
|
readonly edit: boolean;
|
|
40
41
|
readonly remove: boolean;
|
|
41
42
|
readonly makeDefault: boolean;
|
|
42
43
|
/**
|
|
43
|
-
* The merchant left Delete on, and this card is the default
|
|
44
|
-
*
|
|
44
|
+
* The merchant left Delete on, and this card is the default. The platform's
|
|
45
|
+
* renderers draw nothing for it any more: the default card simply offers no
|
|
46
|
+
* Delete. It stays in the contract until its next major.
|
|
45
47
|
*/
|
|
46
48
|
readonly defaultLocked: boolean;
|
|
47
49
|
}
|
|
@@ -49,8 +51,7 @@ export interface AddressControls {
|
|
|
49
51
|
* Each control is offered unless the merchant hid it. The default address is
|
|
50
52
|
* offered neither the control that would make it the default nor the one that
|
|
51
53
|
* would delete it: Shopify refuses to delete a default address, in English in
|
|
52
|
-
* every language, and refuses it for the only saved address too.
|
|
53
|
-
* so in the shopper's own words before the tap instead of after it.
|
|
54
|
+
* every language, and refuses it for the only saved address too.
|
|
54
55
|
*/
|
|
55
56
|
export declare function addressControlsOf(address: AddressDisplay, settings: AddressListBlock['props']): AddressControls;
|
|
56
57
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-list.d.ts","sourceRoot":"","sources":["../src/address-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;CAYuC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE;AAED,sGAAsG;AACtG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED,6FAA6F;AAC7F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED
|
|
1
|
+
{"version":3,"file":"address-list.d.ts","sourceRoot":"","sources":["../src/address-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;CAYuC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE;AAED,sGAAsG;AACtG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED,6FAA6F;AAC7F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAMlE;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAClC,eAAe,CAQjB"}
|
package/dist/address-list.js
CHANGED
|
@@ -27,9 +27,10 @@ export function addressListRadius(theme) {
|
|
|
27
27
|
return componentTokenValue(theme, 'address_list.radius', theme.radius);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* The lines of a card are
|
|
31
|
-
*
|
|
32
|
-
* lines carry no phone, so the one
|
|
30
|
+
* The lines of a card are the ones the Provider composed in the standard
|
|
31
|
+
* postal shape from the address's own fields: the first, the name, titles
|
|
32
|
+
* the card and the rest stand under it. Those lines carry no phone, so the one
|
|
33
|
+
* the shopper wrote is drawn last.
|
|
33
34
|
*/
|
|
34
35
|
export function addressCardOf(address) {
|
|
35
36
|
const [title = '', ...rest] = address.formatted;
|
|
@@ -42,8 +43,7 @@ export function addressCardOf(address) {
|
|
|
42
43
|
* Each control is offered unless the merchant hid it. The default address is
|
|
43
44
|
* offered neither the control that would make it the default nor the one that
|
|
44
45
|
* would delete it: Shopify refuses to delete a default address, in English in
|
|
45
|
-
* every language, and refuses it for the only saved address too.
|
|
46
|
-
* so in the shopper's own words before the tap instead of after it.
|
|
46
|
+
* every language, and refuses it for the only saved address too.
|
|
47
47
|
*/
|
|
48
48
|
export function addressControlsOf(address, settings) {
|
|
49
49
|
const deletable = settings.deleteControl !== false;
|
package/dist/address-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-list.js","sourceRoot":"","sources":["../src/address-list.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,UAAU;IACxB,WAAW,EAAE,SAAS;IACtB,KAAK,EAAE,OAAO;CAC+C,CAAC;AAMhE,0GAA0G;AAC1G,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAC/D,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AACzE,CAAC;AAQD
|
|
1
|
+
{"version":3,"file":"address-list.js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AAE,QAAQ,CAAC,WAAW,KAAK,KAAK;QACpC,MAAM,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS;QACvC,WAAW,EAAE,QAAQ,CAAC,cAAc,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS;QACpE,aAAa,EAAE,SAAS,IAAI,OAAO,CAAC,SAAS;KAC9C,CAAC;AACJ,CAAC"}
|
package/dist/buy-box.d.ts
CHANGED
|
@@ -24,6 +24,14 @@ declare const BUY_BOX_ROLES: {
|
|
|
24
24
|
readonly buy: "action";
|
|
25
25
|
readonly notify: "text";
|
|
26
26
|
readonly notify_done: "success";
|
|
27
|
+
readonly primary: "action";
|
|
28
|
+
readonly secondary: "text";
|
|
29
|
+
readonly secondary_hint: "muted";
|
|
30
|
+
readonly choice: "text";
|
|
31
|
+
readonly row_selected: "sunken";
|
|
32
|
+
readonly radio: "subtle";
|
|
33
|
+
readonly bar: "elevated";
|
|
34
|
+
readonly bar_border: "border";
|
|
27
35
|
};
|
|
28
36
|
export type BuyBoxPart = keyof typeof BUY_BOX_ROLES;
|
|
29
37
|
export type BuyBoxColors = Readonly<Record<BuyBoxPart, string>>;
|
package/dist/buy-box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-box.d.ts","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC,mHAAmH;AACnH,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"buy-box.d.ts","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC,mHAAmH;AACnH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC4C,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,aAAa,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAE5D;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAKvC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAI9F;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,EAC7C,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,IAAI,CAWf"}
|
package/dist/buy-box.js
CHANGED
|
@@ -25,6 +25,14 @@ const BUY_BOX_ROLES = {
|
|
|
25
25
|
buy: 'action',
|
|
26
26
|
notify: 'text',
|
|
27
27
|
notify_done: 'success',
|
|
28
|
+
primary: 'action',
|
|
29
|
+
secondary: 'text',
|
|
30
|
+
secondary_hint: 'muted',
|
|
31
|
+
choice: 'text',
|
|
32
|
+
row_selected: 'sunken',
|
|
33
|
+
radio: 'subtle',
|
|
34
|
+
bar: 'elevated',
|
|
35
|
+
bar_border: 'border',
|
|
28
36
|
};
|
|
29
37
|
/**
|
|
30
38
|
* Every colour the welded panel draws, one per part, with `buy_box.<part>` as
|
package/dist/buy-box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-box.js","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAIf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,mHAAmH;AACnH,MAAM,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,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CACrE,CACF,CAAC;IACF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IACpD,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC"}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -65,7 +65,10 @@ export interface NotificationInvitation {
|
|
|
65
65
|
* repaint only on Shopify's answer, never before. A sign-in resolves once the
|
|
66
66
|
* shopper holds an Account Session, and each account write once Shopify wrote
|
|
67
67
|
* it; a shopper who is not signed in gets the refusal, so a block never has to
|
|
68
|
-
* ask whether a capability is reachable before it calls one.
|
|
68
|
+
* ask whether a capability is reachable before it calls one. A sign-out asks
|
|
69
|
+
* the shopper first, in the host's own sheet that no block can skip: it
|
|
70
|
+
* resolves once they chose to log out and the sign-out landed, and rejects
|
|
71
|
+
* with the `refused` outcome when they stay signed in.
|
|
69
72
|
*/
|
|
70
73
|
export interface Capabilities {
|
|
71
74
|
readonly addToCart: (line: CartLineInput) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBA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AK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type Action, type CategoryGridBlock, type CategoryTile, type CollectionDisplay, type DisplayImage, type LocaleCode, type LocalizedText, type ThemeColorRole, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
type CategoryGridSettings = CategoryGridBlock['props'];
|
|
3
|
+
/** The parts of the category grid, each with the theme role it draws unless a component token names another. */
|
|
4
|
+
declare const CATEGORY_GRID_ROLES: {
|
|
5
|
+
readonly title: "text";
|
|
6
|
+
readonly label: "text";
|
|
7
|
+
readonly scrim: "overlay";
|
|
8
|
+
};
|
|
9
|
+
export type CategoryGridPart = keyof typeof CATEGORY_GRID_ROLES | 'tile' | 'icon';
|
|
10
|
+
export type CategoryGridColors = Readonly<Record<CategoryGridPart, string>>;
|
|
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 declare function categoryGridColors(theme: ThemeStyle, background: ThemeColorRole | undefined): CategoryGridColors;
|
|
20
|
+
/** What a tile draws where its collection's own picture would stand. */
|
|
21
|
+
export type CategoryTileArt = {
|
|
22
|
+
readonly kind: 'picture';
|
|
23
|
+
readonly assetId: string;
|
|
24
|
+
readonly alt: LocalizedText;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'icon';
|
|
27
|
+
readonly icon: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: 'collection';
|
|
30
|
+
readonly image: DisplayImage;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'none';
|
|
33
|
+
};
|
|
34
|
+
/** One tile as both renderers draw it: its words, its picture and where a tap goes. */
|
|
35
|
+
export interface CategoryTileContent {
|
|
36
|
+
readonly collectionId: string;
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly art: CategoryTileArt;
|
|
39
|
+
readonly action: Exclude<Action, {
|
|
40
|
+
type: 'none';
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tile of one collection the Binding answered, with what the merchant
|
|
45
|
+
* changed on it over the collection's own: their words where they wrote them
|
|
46
|
+
* in a language the buyer reads, and the collection's title otherwise; their
|
|
47
|
+
* picture or icon, and the collection's picture otherwise; the place they
|
|
48
|
+
* pointed it at, and the collection otherwise. An action that opens nothing,
|
|
49
|
+
* which is what a build reads an action it does not know as, opens the
|
|
50
|
+
* collection too, so no tile is ever dead.
|
|
51
|
+
*/
|
|
52
|
+
export declare function categoryTileOf(collection: CollectionDisplay, tiles: readonly CategoryTile[] | undefined, language: LocaleCode, defaultLanguage: LocaleCode): CategoryTileContent;
|
|
53
|
+
/** How many tiles stand in a row and the space between two, across and down. */
|
|
54
|
+
export interface CategoryGridRow {
|
|
55
|
+
readonly columns: number;
|
|
56
|
+
readonly gap: number;
|
|
57
|
+
}
|
|
58
|
+
/** The row the merchant set, each measure falling back to the default. */
|
|
59
|
+
export declare function categoryGridRow(settings: CategoryGridSettings): CategoryGridRow;
|
|
60
|
+
/** How one tile of a category grid is drawn at the width its row hands it. */
|
|
61
|
+
export interface CategoryGridLook {
|
|
62
|
+
readonly shape: 'circle' | 'rounded' | 'square';
|
|
63
|
+
readonly radius: number;
|
|
64
|
+
readonly fit: 'fill' | 'fit';
|
|
65
|
+
readonly iconSize: number;
|
|
66
|
+
readonly iconStroke: number;
|
|
67
|
+
readonly labelPosition: 'below' | 'over';
|
|
68
|
+
readonly labelGap: number;
|
|
69
|
+
readonly overInset: number;
|
|
70
|
+
readonly scrimHeight: `${number}%`;
|
|
71
|
+
readonly labelSize: number;
|
|
72
|
+
readonly labelLineHeight: number;
|
|
73
|
+
readonly labelLines: number;
|
|
74
|
+
readonly labelHeight: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The width one tile keeps in a row: the content width less the gaps, shared
|
|
78
|
+
* by the columns, in whole points, the way the phone's row hands its cells.
|
|
79
|
+
*/
|
|
80
|
+
export declare function categoryTileWidth(contentWidth: number, row: CategoryGridRow): number;
|
|
81
|
+
/**
|
|
82
|
+
* Every measure of a tile the merchant set, each falling back to the default,
|
|
83
|
+
* at the tile's width: a circle is cut at half the tile, a rounded square at
|
|
84
|
+
* `category_grid.radius` over the theme's corner, a square at none, and an
|
|
85
|
+
* icon takes a share of the tile. Words over a circle stand higher up its
|
|
86
|
+
* lower edge than over a square, where the curve leaves them room. Words
|
|
87
|
+
* under a tile hold every line they may take, so one title that wraps never
|
|
88
|
+
* stands its row lower than the next.
|
|
89
|
+
*/
|
|
90
|
+
export declare function categoryGridLook(settings: CategoryGridSettings, theme: ThemeStyle, tileWidth: number): CategoryGridLook;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=category-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category-grid.d.ts","sourceRoot":"","sources":["../src/category-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAKjC,KAAK,oBAAoB,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEvD,gHAAgH;AAChH,QAAA,MAAM,mBAAmB;;;;CAI0B,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,mBAAmB,GAAG,MAAM,GAA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