@shoplix-ai/block-kit 4.5.0 → 5.0.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 +37 -8
- package/dist/account-links.d.ts +47 -0
- package/dist/account-links.d.ts.map +1 -0
- package/dist/account-links.js +61 -0
- package/dist/account-links.js.map +1 -0
- package/dist/address-list.d.ts +57 -0
- package/dist/address-list.d.ts.map +1 -0
- package/dist/address-list.js +57 -0
- package/dist/address-list.js.map +1 -0
- package/dist/buy-box.d.ts +59 -0
- package/dist/buy-box.d.ts.map +1 -0
- package/dist/buy-box.js +72 -0
- package/dist/buy-box.js.map +1 -0
- package/dist/capabilities.d.ts +8 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/contract.d.ts +20 -14
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -2
- package/dist/contract.js.map +1 -1
- package/dist/hero-banner.d.ts +10 -1
- package/dist/hero-banner.d.ts.map +1 -1
- package/dist/hero-banner.js +17 -0
- package/dist/hero-banner.js.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/navigation.d.ts +8 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/orders.d.ts +84 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +188 -0
- package/dist/orders.js.map +1 -0
- package/dist/profile-header.d.ts +23 -0
- package/dist/profile-header.d.ts.map +1 -0
- package/dist/profile-header.js +29 -0
- package/dist/profile-header.js.map +1 -0
- package/dist/promo-banner.d.ts +11 -1
- package/dist/promo-banner.d.ts.map +1 -1
- package/dist/promo-banner.js +24 -0
- package/dist/promo-banner.js.map +1 -1
- package/dist/section-header.d.ts +5 -1
- package/dist/section-header.d.ts.map +1 -1
- package/dist/section-header.js +5 -1
- package/dist/section-header.js.map +1 -1
- package/dist/sign-in.d.ts +25 -0
- package/dist/sign-in.d.ts.map +1 -0
- package/dist/sign-in.js +24 -0
- package/dist/sign-in.js.map +1 -0
- package/dist/variant-choice.d.ts +14 -0
- package/dist/variant-choice.d.ts.map +1 -0
- package/dist/variant-choice.js +24 -0
- package/dist/variant-choice.js.map +1 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/dist/words.d.ts +123 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +360 -4
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,14 +9,17 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
9
9
|
screen in hand, the Shop's tokens and resolved theme style,
|
|
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
|
-
product, a collection, search, the account
|
|
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 one saved
|
|
14
|
+
address), `cart` (how many items the
|
|
13
15
|
cart holds for a badge, and whether a change is on its way so every block
|
|
14
16
|
goes quiet together; never the cart itself, which a cart Binding resolves),
|
|
15
17
|
`account` (whether a shopper is signed in, the name to greet them by and its
|
|
16
18
|
own pending flag; never the Account Session), and a capability object holding
|
|
17
19
|
only the capabilities the Block Type declared. A Block Type may also declare
|
|
18
20
|
`rows` beside `render` and hand its items to the host instead of drawing them
|
|
19
|
-
itself
|
|
21
|
+
itself; a block of the shopper's own data names the item its rows draw, an
|
|
22
|
+
order or a line of one.
|
|
20
23
|
- **The registry.** `createBlockRegistry()` keyed by Block Type, one owner per
|
|
21
24
|
type. A second owner is refused; the same owner may register again. Packages
|
|
22
25
|
outside the app register through it. `defineBlock()` is the typed authoring
|
|
@@ -34,7 +37,8 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
34
37
|
notification decision as one host state: whether the invitation is still
|
|
35
38
|
offered, the tap that opens the phone's prompt and the tap that hides it
|
|
36
39
|
until the next completed checkout. Then the nine of the shopper's own
|
|
37
|
-
account: `signIn
|
|
40
|
+
account: `signIn` (with the email the shopper typed, where a block has one,
|
|
41
|
+
as the hint Shopify's hosted step opens with), `signOut`, `updateProfile` (the names, the email marketing
|
|
38
42
|
choice and the Profile Fields), `addAddress`, `updateAddress`,
|
|
39
43
|
`deleteAddress`, `setDefaultAddress` (each address by its id, the fields the
|
|
40
44
|
Address Sheet sends), `buyAgain` (an order's own lines back into the cart)
|
|
@@ -74,10 +78,11 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
74
78
|
`productCardColors`, `collectionTileColors`, `heroBannerColors` beside
|
|
75
79
|
`heroBannerRadius`, `promoBannerColors` beside `promoBannerRadius`,
|
|
76
80
|
`sectionHeaderColors`, `featureStripColors`, `storeHeaderColors`,
|
|
77
|
-
`brandRailColors`, `announcementBarColors`, `shippingProgressColors`, `productGalleryColors`,
|
|
81
|
+
`brandRailColors`, `buyBoxColors`, `announcementBarColors`, `shippingProgressColors`, `productGalleryColors`,
|
|
78
82
|
`productSummaryColors`, `productSpecsColors`, `reviewsSlotColors`,
|
|
79
83
|
`cartLinesColors`, `cartEmptyColors`, `cartDiscountCodeColors`,
|
|
80
|
-
`cartSummaryColors
|
|
84
|
+
`cartSummaryColors`, `checkoutButtonColors`, `signInColors`,
|
|
85
|
+
`profileHeaderColors` and `accountLinksColors`, the colour tables the
|
|
81
86
|
promoted blocks read on the phone and on the web alike: a theme role per part
|
|
82
87
|
of the block, with a component token at `<block>.<part>` over it.
|
|
83
88
|
`readableInk` is the one rule for words on a colour the merchant chose, so a
|
|
@@ -86,7 +91,28 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
86
91
|
what its lines save against their compare-at prices, `compareAtUnit` what one
|
|
87
92
|
unit of a line cost before its discount, `cartItemCount` how many
|
|
88
93
|
items it holds in the form the buyer's language counts that number in, and
|
|
89
|
-
`cartBadgeCount` what a cart badge writes over a glyph, capped at 99
|
|
94
|
+
`cartBadgeCount` what a cart badge writes over a glyph, capped at 99+, and
|
|
95
|
+
`BUY_QUANTITY_CEILING` the most of one variant a buy control offers to add in
|
|
96
|
+
one tap. `customerInitials` is the letters an avatar draws for a shopper,
|
|
97
|
+
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.
|
|
99
|
+
`orderColors` and `orderRadius` are the one table and the one corner the
|
|
100
|
+
eight order blocks share at `order.<part>`; `fulfillmentPillOf` and
|
|
101
|
+
`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; `SHIPMENT_STEPS`
|
|
103
|
+
and `shipmentStepReached` are the progress rail of a shipment,
|
|
104
|
+
`fulfillmentEventWord` and `shipmentWord` its words; `orderMoneyRows` lists
|
|
105
|
+
the money rows Shopify wrote, and `orderDay` and `orderTime` write a
|
|
106
|
+
timestamp as a shopper reads it. `addressListColors` and `addressListRadius`
|
|
107
|
+
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, and
|
|
109
|
+
`addressControlsOf` which of its three controls a card offers, and whether
|
|
110
|
+
the card says why it offers no Delete: the default address is never offered
|
|
111
|
+
Delete, because Shopify refuses that delete in English in every language and
|
|
112
|
+
refuses it for the only saved address too. `heroPageLabel` says which page of how many a hero carousel rests
|
|
113
|
+
on, because its marks carry no words of their own. `promoSetLabel` says how
|
|
114
|
+
many promotions a promo banner stacks, and `promoCardLabel` which of them a
|
|
115
|
+
card is, beside the merchant's words or in place of them.
|
|
90
116
|
`derivedPrice` writes a figure a block worked out for itself, in the style the
|
|
91
117
|
theme chose and at the currency's own places so it lines up in a column with
|
|
92
118
|
the ones Shopify sent; `derivedMoney` is the same figure with an empty
|
|
@@ -146,8 +172,11 @@ when they wrote a language the buyer reads and the catalog's word otherwise.
|
|
|
146
172
|
|
|
147
173
|
The name a screen reader reads is functional too, whatever the drawing shows.
|
|
148
174
|
A promotion the buyer can tap that carries no words of the merchant's own is
|
|
149
|
-
announced as `promo.promotion`
|
|
150
|
-
merchant's headline still wins
|
|
175
|
+
announced by which of how many it is, or as `promo.promotion` when it stands
|
|
176
|
+
alone, rather than as a button with no name; the merchant's headline still wins
|
|
177
|
+
wherever they wrote one, with its place in the set beside it. A horizontal rail
|
|
178
|
+
of more than one item is named by `rail.scroll_hint`, so a buyer who cannot see
|
|
179
|
+
it is told it scrolls sideways.
|
|
151
180
|
|
|
152
181
|
The catalog answers in English, Arabic and Turkish. A language it does not
|
|
153
182
|
carry falls back to English, written down here rather than left to whichever
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AccountLinkRow, type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the account links, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. No theme role is a red, so the destructive
|
|
5
|
+
* rows draw the warning role until a design names its own.
|
|
6
|
+
*/
|
|
7
|
+
declare const ACCOUNT_LINKS_ROLES: {
|
|
8
|
+
readonly title: "subtle";
|
|
9
|
+
readonly group: "surface";
|
|
10
|
+
readonly rule: "border";
|
|
11
|
+
readonly icon_well: "sunken";
|
|
12
|
+
readonly icon: "text";
|
|
13
|
+
readonly label: "text";
|
|
14
|
+
readonly chevron: "muted";
|
|
15
|
+
readonly destructive: "warning";
|
|
16
|
+
readonly destructive_surface: "sunken";
|
|
17
|
+
};
|
|
18
|
+
export type AccountLinksPart = keyof typeof ACCOUNT_LINKS_ROLES;
|
|
19
|
+
export type AccountLinksColors = Readonly<Record<AccountLinksPart, string>>;
|
|
20
|
+
/** Every colour the account links draw, one per part, with `account_links.<part>` over each theme role. */
|
|
21
|
+
export declare function accountLinksColors(theme: ThemeStyle): AccountLinksColors;
|
|
22
|
+
/**
|
|
23
|
+
* The corner the group and a destructive row are cut with: the merchant's own,
|
|
24
|
+
* with `account_links.radius` over it for a design whose lists are softer than
|
|
25
|
+
* its buttons.
|
|
26
|
+
*/
|
|
27
|
+
export declare function accountLinksRadius(theme: ThemeStyle): number;
|
|
28
|
+
/** One row as it is drawn: the row of the document and the words a shopper reads on it. */
|
|
29
|
+
export interface NamedAccountLink {
|
|
30
|
+
readonly row: AccountLinkRow;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}
|
|
33
|
+
/** The rows a shopper is shown: the group, and the rows that take something from them, drawn apart. */
|
|
34
|
+
export interface AccountLinkRows {
|
|
35
|
+
readonly grouped: readonly NamedAccountLink[];
|
|
36
|
+
readonly destructive: readonly NamedAccountLink[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The rows of the account links as both renderers draw them, in the
|
|
40
|
+
* merchant's order. A row the merchant left unnamed reads the platform's word
|
|
41
|
+
* for where it leads; a custom screen and a web address have no such word, so
|
|
42
|
+
* one of those with no label in a language the buyer reads is left out rather
|
|
43
|
+
* than drawn blank. Sign out and delete are set apart from the group.
|
|
44
|
+
*/
|
|
45
|
+
export declare function accountLinkRows(rows: readonly AccountLinkRow[] | undefined, language: LocaleCode, defaultLanguage: LocaleCode): AccountLinkRows;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=account-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-links.d.ts","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAEnB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAKjC;;;;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;AAUD,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,EAAE,GAAG,SAAS,EAC3C,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,eAAe,CAajB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { componentTokenValue, isDestructiveTarget, shownAccountLinkRows, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { localize } from './locale.js';
|
|
3
|
+
import { partColors } from './part-colors.js';
|
|
4
|
+
import { platformWords } from './words.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parts of the account links, each with the theme role it draws unless a
|
|
7
|
+
* component token names another. No theme role is a red, so the destructive
|
|
8
|
+
* rows draw the warning role until a design names its own.
|
|
9
|
+
*/
|
|
10
|
+
const ACCOUNT_LINKS_ROLES = {
|
|
11
|
+
title: 'subtle',
|
|
12
|
+
group: 'surface',
|
|
13
|
+
rule: 'border',
|
|
14
|
+
icon_well: 'sunken',
|
|
15
|
+
icon: 'text',
|
|
16
|
+
label: 'text',
|
|
17
|
+
chevron: 'muted',
|
|
18
|
+
destructive: 'warning',
|
|
19
|
+
destructive_surface: 'sunken',
|
|
20
|
+
};
|
|
21
|
+
/** Every colour the account links draw, one per part, with `account_links.<part>` over each theme role. */
|
|
22
|
+
export function accountLinksColors(theme) {
|
|
23
|
+
return partColors(theme, 'account_links', ACCOUNT_LINKS_ROLES);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The corner the group and a destructive row are cut with: the merchant's own,
|
|
27
|
+
* with `account_links.radius` over it for a design whose lists are softer than
|
|
28
|
+
* its buttons.
|
|
29
|
+
*/
|
|
30
|
+
export function accountLinksRadius(theme) {
|
|
31
|
+
return componentTokenValue(theme, 'account_links.radius', theme.radius);
|
|
32
|
+
}
|
|
33
|
+
const ROW_WORDS = {
|
|
34
|
+
open_orders: 'account.orders',
|
|
35
|
+
open_addresses: 'account.addresses',
|
|
36
|
+
open_profile: 'account.profile',
|
|
37
|
+
sign_out: 'account.sign_out',
|
|
38
|
+
delete_account: 'account.delete_account',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The rows of the account links as both renderers draw them, in the
|
|
42
|
+
* merchant's order. A row the merchant left unnamed reads the platform's word
|
|
43
|
+
* for where it leads; a custom screen and a web address have no such word, so
|
|
44
|
+
* one of those with no label in a language the buyer reads is left out rather
|
|
45
|
+
* than drawn blank. Sign out and delete are set apart from the group.
|
|
46
|
+
*/
|
|
47
|
+
export function accountLinkRows(rows, language, defaultLanguage) {
|
|
48
|
+
const words = platformWords(language, defaultLanguage);
|
|
49
|
+
const named = shownAccountLinkRows(rows)
|
|
50
|
+
.map((row) => {
|
|
51
|
+
const word = ROW_WORDS[row.target.type];
|
|
52
|
+
const written = row.label === undefined ? '' : localize(row.label, language, defaultLanguage);
|
|
53
|
+
return { row, label: word === undefined ? written : words.merchantOr(row.label, word) };
|
|
54
|
+
})
|
|
55
|
+
.filter(({ label }) => label !== '');
|
|
56
|
+
return {
|
|
57
|
+
grouped: named.filter(({ row }) => !isDestructiveTarget(row.target)),
|
|
58
|
+
destructive: named.filter(({ row }) => isDestructiveTarget(row.target)),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=account-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-links.js","sourceRoot":"","sources":["../src/account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;QACX,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC9F,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;IAC1F,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACvC,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type AddressDisplay, type AddressListBlock, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the address list, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. No theme role is a red, so the delete control
|
|
5
|
+
* draws the warning role until a design names its own.
|
|
6
|
+
*/
|
|
7
|
+
declare const ADDRESS_LIST_ROLES: {
|
|
8
|
+
readonly card: "sunken";
|
|
9
|
+
readonly strip: "elevated";
|
|
10
|
+
readonly well: "sunken";
|
|
11
|
+
readonly glyph: "text";
|
|
12
|
+
readonly title: "text";
|
|
13
|
+
readonly body: "text";
|
|
14
|
+
readonly link: "muted";
|
|
15
|
+
readonly mark: "success";
|
|
16
|
+
readonly mark_surface: "elevated";
|
|
17
|
+
readonly destructive: "warning";
|
|
18
|
+
readonly empty: "muted";
|
|
19
|
+
};
|
|
20
|
+
export type AddressListPart = keyof typeof ADDRESS_LIST_ROLES;
|
|
21
|
+
export type AddressListColors = Readonly<Record<AddressListPart, string>>;
|
|
22
|
+
/** Every colour the address list draws, one per part, with `address_list.<part>` over each theme role. */
|
|
23
|
+
export declare function addressListColors(theme: ThemeStyle): AddressListColors;
|
|
24
|
+
/** The corner an address card is cut with: the merchant's own, with `address_list.radius` over it. */
|
|
25
|
+
export declare function addressListRadius(theme: ThemeStyle): number;
|
|
26
|
+
/** One address as both renderers draw it: the line over the card, and the lines under it. */
|
|
27
|
+
export interface AddressCard {
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly lines: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The lines of a card are Shopify's own, formatted for the country of the
|
|
33
|
+
* address: the first titles the card and the rest stand under it. Shopify's
|
|
34
|
+
* lines carry no phone, so the one the shopper wrote is drawn last.
|
|
35
|
+
*/
|
|
36
|
+
export declare function addressCardOf(address: AddressDisplay): AddressCard;
|
|
37
|
+
/** Which of the three controls a card offers, and whether it says why Delete is missing. */
|
|
38
|
+
export interface AddressControls {
|
|
39
|
+
readonly edit: boolean;
|
|
40
|
+
readonly remove: boolean;
|
|
41
|
+
readonly makeDefault: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The merchant left Delete on, and this card is the default, so the card
|
|
44
|
+
* says another address must be the default first in place of the control.
|
|
45
|
+
*/
|
|
46
|
+
readonly defaultLocked: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
50
|
+
* offered neither the control that would make it the default nor the one that
|
|
51
|
+
* 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. The card says
|
|
53
|
+
* so in the shopper's own words before the tap instead of after it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function addressControlsOf(address: AddressDisplay, settings: AddressListBlock['props']): AddressControls;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=address-list.d.ts.map
|
|
@@ -0,0 +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;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAMlE;AAED,4FAA4F;AAC5F,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;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAClC,eAAe,CAQjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { componentTokenValue, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { partColors } from './part-colors.js';
|
|
3
|
+
/**
|
|
4
|
+
* The parts of the address list, each with the theme role it draws unless a
|
|
5
|
+
* component token names another. No theme role is a red, so the delete control
|
|
6
|
+
* draws the warning role until a design names its own.
|
|
7
|
+
*/
|
|
8
|
+
const ADDRESS_LIST_ROLES = {
|
|
9
|
+
card: 'sunken',
|
|
10
|
+
strip: 'elevated',
|
|
11
|
+
well: 'sunken',
|
|
12
|
+
glyph: 'text',
|
|
13
|
+
title: 'text',
|
|
14
|
+
body: 'text',
|
|
15
|
+
link: 'muted',
|
|
16
|
+
mark: 'success',
|
|
17
|
+
mark_surface: 'elevated',
|
|
18
|
+
destructive: 'warning',
|
|
19
|
+
empty: 'muted',
|
|
20
|
+
};
|
|
21
|
+
/** Every colour the address list draws, one per part, with `address_list.<part>` over each theme role. */
|
|
22
|
+
export function addressListColors(theme) {
|
|
23
|
+
return partColors(theme, 'address_list', ADDRESS_LIST_ROLES);
|
|
24
|
+
}
|
|
25
|
+
/** The corner an address card is cut with: the merchant's own, with `address_list.radius` over it. */
|
|
26
|
+
export function addressListRadius(theme) {
|
|
27
|
+
return componentTokenValue(theme, 'address_list.radius', theme.radius);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The lines of a card are Shopify's own, formatted for the country of the
|
|
31
|
+
* address: the first titles the card and the rest stand under it. Shopify's
|
|
32
|
+
* lines carry no phone, so the one the shopper wrote is drawn last.
|
|
33
|
+
*/
|
|
34
|
+
export function addressCardOf(address) {
|
|
35
|
+
const [title = '', ...rest] = address.formatted;
|
|
36
|
+
return {
|
|
37
|
+
title,
|
|
38
|
+
lines: address.phoneNumber === undefined ? rest : [...rest, address.phoneNumber],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
43
|
+
* offered neither the control that would make it the default nor the one that
|
|
44
|
+
* 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. The card says
|
|
46
|
+
* so in the shopper's own words before the tap instead of after it.
|
|
47
|
+
*/
|
|
48
|
+
export function addressControlsOf(address, settings) {
|
|
49
|
+
const deletable = settings.deleteControl !== false;
|
|
50
|
+
return {
|
|
51
|
+
edit: settings.editControl !== false,
|
|
52
|
+
remove: deletable && !address.isDefault,
|
|
53
|
+
makeDefault: settings.defaultControl !== false && !address.isDefault,
|
|
54
|
+
defaultLocked: deletable && address.isDefault,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=address-list.js.map
|
|
@@ -0,0 +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;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAChD,OAAO;QACL,KAAK;QACL,KAAK,EAAE,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC;KACjF,CAAC;AACJ,CAAC;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAuB,EACvB,QAAmC;IAEnC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,KAAK,KAAK,CAAC;IACnD,OAAO;QACL,IAAI,EAAE,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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type BuyBoxSwatch, type ProductDisplay, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/** The parts of the welded buy panel, each with the theme role it draws unless a component token names another. */
|
|
3
|
+
declare const BUY_BOX_ROLES: {
|
|
4
|
+
readonly panel: "elevated";
|
|
5
|
+
readonly heading: "text";
|
|
6
|
+
readonly option_value: "action";
|
|
7
|
+
readonly chip: "elevated";
|
|
8
|
+
readonly chip_border: "border";
|
|
9
|
+
readonly chip_ink: "text";
|
|
10
|
+
readonly chip_selected: "action";
|
|
11
|
+
readonly chip_selected_surface: "sunken";
|
|
12
|
+
readonly chip_idle: "subtle";
|
|
13
|
+
readonly swatch_border: "border";
|
|
14
|
+
readonly step_surface: "elevated";
|
|
15
|
+
readonly step_border: "border";
|
|
16
|
+
readonly step_ink: "text";
|
|
17
|
+
readonly step_idle: "subtle";
|
|
18
|
+
readonly step_add: "action";
|
|
19
|
+
readonly hint: "action";
|
|
20
|
+
readonly total_label: "subtle";
|
|
21
|
+
readonly total: "text";
|
|
22
|
+
readonly add: "action";
|
|
23
|
+
readonly add_surface: "sunken";
|
|
24
|
+
readonly buy: "action";
|
|
25
|
+
readonly notify: "text";
|
|
26
|
+
readonly notify_done: "success";
|
|
27
|
+
};
|
|
28
|
+
export type BuyBoxPart = keyof typeof BUY_BOX_ROLES;
|
|
29
|
+
export type BuyBoxColors = Readonly<Record<BuyBoxPart, string>>;
|
|
30
|
+
/**
|
|
31
|
+
* Every colour the welded panel draws, one per part, with `buy_box.<part>` as
|
|
32
|
+
* the escape hatch over each theme role. The phone's panel and its web twin
|
|
33
|
+
* read this one table, so a merchant with a dark theme gets their own choices,
|
|
34
|
+
* stepper and buttons rather than a white card with a red button on it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buyBoxColors(theme: ThemeStyle): BuyBoxColors;
|
|
37
|
+
/**
|
|
38
|
+
* The most of one variant a buyer may send to the cart in one tap. It is the
|
|
39
|
+
* platform's answer for every shop rather than a question each merchant has to
|
|
40
|
+
* answer, and it is a stop rather than a promise: Shopify still holds the
|
|
41
|
+
* stock, and a line it cannot fill is refused or reduced whatever this says.
|
|
42
|
+
*/
|
|
43
|
+
export declare const BUY_QUANTITY_CEILING = 10;
|
|
44
|
+
/**
|
|
45
|
+
* The option groups worth putting on a screen. A product the merchant never
|
|
46
|
+
* gave a choice still carries one group of one invented value, which is
|
|
47
|
+
* Shopify's bookkeeping rather than a question to ask a buyer.
|
|
48
|
+
*/
|
|
49
|
+
export declare function productChoices(product: ProductDisplay): NonNullable<ProductDisplay['options']>;
|
|
50
|
+
/**
|
|
51
|
+
* The colour a merchant's swatch table gives one option value: the hex they
|
|
52
|
+
* wrote, or the theme's own value for the role they named. Null where they
|
|
53
|
+
* listed no colour for it, so the value draws as a word rather than a dot.
|
|
54
|
+
* The match ignores case and the language the row was typed in, because a
|
|
55
|
+
* merchant types a table once and a buyer reads the values in their own.
|
|
56
|
+
*/
|
|
57
|
+
export declare function swatchColor(theme: ThemeStyle, swatches: readonly BuyBoxSwatch[] | undefined, value: string): string | null;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=buy-box.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;CAwB4C,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
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { tokenRoleValue, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { partColors } from './part-colors.js';
|
|
3
|
+
/** The parts of the welded buy panel, each with the theme role it draws unless a component token names another. */
|
|
4
|
+
const BUY_BOX_ROLES = {
|
|
5
|
+
panel: 'elevated',
|
|
6
|
+
heading: 'text',
|
|
7
|
+
option_value: 'action',
|
|
8
|
+
chip: 'elevated',
|
|
9
|
+
chip_border: 'border',
|
|
10
|
+
chip_ink: 'text',
|
|
11
|
+
chip_selected: 'action',
|
|
12
|
+
chip_selected_surface: 'sunken',
|
|
13
|
+
chip_idle: 'subtle',
|
|
14
|
+
swatch_border: 'border',
|
|
15
|
+
step_surface: 'elevated',
|
|
16
|
+
step_border: 'border',
|
|
17
|
+
step_ink: 'text',
|
|
18
|
+
step_idle: 'subtle',
|
|
19
|
+
step_add: 'action',
|
|
20
|
+
hint: 'action',
|
|
21
|
+
total_label: 'subtle',
|
|
22
|
+
total: 'text',
|
|
23
|
+
add: 'action',
|
|
24
|
+
add_surface: 'sunken',
|
|
25
|
+
buy: 'action',
|
|
26
|
+
notify: 'text',
|
|
27
|
+
notify_done: 'success',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Every colour the welded panel draws, one per part, with `buy_box.<part>` as
|
|
31
|
+
* the escape hatch over each theme role. The phone's panel and its web twin
|
|
32
|
+
* read this one table, so a merchant with a dark theme gets their own choices,
|
|
33
|
+
* stepper and buttons rather than a white card with a red button on it.
|
|
34
|
+
*/
|
|
35
|
+
export function buyBoxColors(theme) {
|
|
36
|
+
return partColors(theme, 'buy_box', BUY_BOX_ROLES);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The most of one variant a buyer may send to the cart in one tap. It is the
|
|
40
|
+
* platform's answer for every shop rather than a question each merchant has to
|
|
41
|
+
* answer, and it is a stop rather than a promise: Shopify still holds the
|
|
42
|
+
* stock, and a line it cannot fill is refused or reduced whatever this says.
|
|
43
|
+
*/
|
|
44
|
+
export const BUY_QUANTITY_CEILING = 10;
|
|
45
|
+
/** The one value Shopify invents for a product the merchant gave no choices. */
|
|
46
|
+
const NO_CHOICE = 'Default Title';
|
|
47
|
+
/**
|
|
48
|
+
* The option groups worth putting on a screen. A product the merchant never
|
|
49
|
+
* gave a choice still carries one group of one invented value, which is
|
|
50
|
+
* Shopify's bookkeeping rather than a question to ask a buyer.
|
|
51
|
+
*/
|
|
52
|
+
export function productChoices(product) {
|
|
53
|
+
return (product.options ?? []).filter((group) => !(group.values.length === 1 && group.values[0] === NO_CHOICE));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The colour a merchant's swatch table gives one option value: the hex they
|
|
57
|
+
* wrote, or the theme's own value for the role they named. Null where they
|
|
58
|
+
* listed no colour for it, so the value draws as a word rather than a dot.
|
|
59
|
+
* The match ignores case and the language the row was typed in, because a
|
|
60
|
+
* merchant types a table once and a buyer reads the values in their own.
|
|
61
|
+
*/
|
|
62
|
+
export function swatchColor(theme, swatches, value) {
|
|
63
|
+
const wanted = value.trim().toLowerCase();
|
|
64
|
+
const row = (swatches ?? []).find((candidate) => Object.values(candidate.value).some((text) => text !== undefined && text.trim().toLowerCase() === wanted));
|
|
65
|
+
if (row === undefined)
|
|
66
|
+
return null;
|
|
67
|
+
if (typeof row.color === 'string')
|
|
68
|
+
return row.color;
|
|
69
|
+
const role = tokenRoleValue(theme, row.color.token);
|
|
70
|
+
return role === undefined || role === null ? theme.colors.border : String(role);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=buy-box.js.map
|
|
@@ -0,0 +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,aAAa,G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,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAC9C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CACjC,CAAC,IAAI,EAAE,EAAE,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
|
@@ -40,6 +40,13 @@ export interface AddressUpdateInput {
|
|
|
40
40
|
readonly addressId: string;
|
|
41
41
|
readonly address: AddressInput;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* What a block may hand a sign-in: the email the shopper typed, which Shopify's
|
|
45
|
+
* hosted step opens with already in its field. None, and that step asks for it.
|
|
46
|
+
*/
|
|
47
|
+
export interface SignInInput {
|
|
48
|
+
readonly email?: string;
|
|
49
|
+
}
|
|
43
50
|
/**
|
|
44
51
|
* The Notification Invitation as a renderer sees it: whether there is still
|
|
45
52
|
* anything to ask, the tap that opens the phone's own prompt, and the tap
|
|
@@ -71,7 +78,7 @@ export interface Capabilities {
|
|
|
71
78
|
readonly setCartNote: (note: string) => Promise<void>;
|
|
72
79
|
readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
|
|
73
80
|
readonly notificationInvitation: NotificationInvitation;
|
|
74
|
-
readonly signIn: () => Promise<void>;
|
|
81
|
+
readonly signIn: (input?: SignInInput) => Promise<void>;
|
|
75
82
|
readonly signOut: () => Promise<void>;
|
|
76
83
|
readonly updateProfile: (input: ProfileUpdateInput) => Promise<void>;
|
|
77
84
|
readonly addAddress: (input: AddressInput) => 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,gBAAgB,wUAAyB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,UAAU,GAAG,uBAAuB,GAAG,eAAe,CAAC,CAC5F,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAA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AG,KAAK,IAAI,iBAAiB,CAU9E"}
|
package/dist/capabilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAKvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAKvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAuGvD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAoB;IAC/D,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAI/B;IACA;IAJO,IAAI,GAAG,mBAAmB,CAAC;IAE7C,YACW,OAA0B,EAC1B,QAA2B;QAEpC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAHjD,YAAO,GAAP,OAAO,CAAmB;QAC1B,aAAQ,GAAR,QAAQ,CAAmB;IAGtC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAkE,CAAC;IAC/E,OAAO,CACL,GAAG,CAAC,IAAI,KAAK,mBAAmB;QAChC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC3B,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { BindingData, BoundItem, EnvelopeAssets, LocaleCode, ThemeStyle, ThemeTokens } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import type { BindingData, BoundItem, EnvelopeAssets, LocaleCode, RowItem, ThemeStyle, ThemeTokens } from '@shoplix-ai/sdui-schema';
|
|
3
3
|
import type { CapabilityName, CapabilityObject } from './capabilities.js';
|
|
4
4
|
import type { BlockNavigation } from './navigation.js';
|
|
5
5
|
export type TextDirection = 'ltr' | 'rtl';
|
|
@@ -58,11 +58,13 @@ export interface BlockRenderProps<TSettings extends BlockSettings = BlockSetting
|
|
|
58
58
|
export type BlockRenderer<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> = ComponentType<BlockRenderProps<TSettings, K>>;
|
|
59
59
|
/**
|
|
60
60
|
* What the item renderer of a row receives: everything the block receives,
|
|
61
|
-
* plus the one
|
|
62
|
-
*
|
|
61
|
+
* plus the one item this cell draws, its place in the Binding's items and the
|
|
62
|
+
* width the host gives the cell. The item is a bound item unless the block
|
|
63
|
+
* names another: a block of the shopper's own data draws an order, or a line
|
|
64
|
+
* of one.
|
|
63
65
|
*/
|
|
64
|
-
export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> extends BlockRenderProps<TSettings, K> {
|
|
65
|
-
readonly item:
|
|
66
|
+
export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> extends BlockRenderProps<TSettings, K> {
|
|
67
|
+
readonly item: TItem;
|
|
66
68
|
readonly index: number;
|
|
67
69
|
readonly width: number;
|
|
68
70
|
}
|
|
@@ -70,15 +72,18 @@ export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSet
|
|
|
70
72
|
* How a bound block hands its items to the host instead of drawing them
|
|
71
73
|
* itself: an optional header, one item renderer, an optional footer, and how
|
|
72
74
|
* many items stand side by side with how much space between them. `columns`
|
|
73
|
-
* defaults to 1 and `gap` to 0 where the host lays rows out.
|
|
74
|
-
* the
|
|
75
|
+
* defaults to 1 and `gap` to 0 where the host lays rows out. `empty` stands in
|
|
76
|
+
* the place of all of it when the Binding answered no item; without one an
|
|
77
|
+
* empty block draws nothing. A host without the row layout ignores all of it
|
|
78
|
+
* and calls `render`.
|
|
75
79
|
*/
|
|
76
|
-
export interface BlockRows<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
|
|
80
|
+
export interface BlockRows<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> {
|
|
77
81
|
readonly columns?: (props: BlockRenderProps<TSettings, K>) => number;
|
|
78
82
|
readonly gap?: (props: BlockRenderProps<TSettings, K>) => number;
|
|
79
83
|
readonly header?: BlockRenderer<TSettings, K>;
|
|
80
|
-
readonly item: ComponentType<BlockItemRenderProps<TSettings, K>>;
|
|
84
|
+
readonly item: ComponentType<BlockItemRenderProps<TSettings, K, TItem>>;
|
|
81
85
|
readonly footer?: BlockRenderer<TSettings, K>;
|
|
86
|
+
readonly empty?: BlockRenderer<TSettings, K>;
|
|
82
87
|
}
|
|
83
88
|
/** Who answers for a Block Type: the platform, or the Shop whose package registered it. */
|
|
84
89
|
export type BlockOwner = string;
|
|
@@ -91,13 +96,13 @@ export type BlockOwner = string;
|
|
|
91
96
|
*/
|
|
92
97
|
export type BlockChrome = 'header';
|
|
93
98
|
/** The typed authoring shape: settings and capabilities are inferred from the definition. */
|
|
94
|
-
export interface BlockDefinition<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
|
|
99
|
+
export interface BlockDefinition<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> {
|
|
95
100
|
readonly type: string;
|
|
96
101
|
readonly owner: BlockOwner;
|
|
97
102
|
readonly capabilities?: readonly K[];
|
|
98
103
|
readonly chrome?: BlockChrome;
|
|
99
104
|
readonly render: BlockRenderer<TSettings, K>;
|
|
100
|
-
readonly rows?: BlockRows<TSettings, K> | undefined;
|
|
105
|
+
readonly rows?: BlockRows<TSettings, K, TItem> | undefined;
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
108
|
* The shape a registry stores and a host renders: one entry per Block Type.
|
|
@@ -119,8 +124,9 @@ export interface BlockRegistration {
|
|
|
119
124
|
}
|
|
120
125
|
/**
|
|
121
126
|
* Turns a typed definition into a registration. The settings a renderer
|
|
122
|
-
* receives come from a document parsed against the schema for its type,
|
|
123
|
-
* the
|
|
127
|
+
* receives come from a document parsed against the schema for its type, and
|
|
128
|
+
* the items its rows draw from the Binding its type is welded to, so the
|
|
129
|
+
* widening to the stored shape happens here, once, and nowhere else.
|
|
124
130
|
*/
|
|
125
|
-
export declare function defineBlock<TSettings extends BlockSettings = BlockSettings, const K extends CapabilityName = never>(definition: BlockDefinition<TSettings, K>): BlockRegistration;
|
|
131
|
+
export declare function defineBlock<TSettings extends BlockSettings = BlockSettings, const K extends CapabilityName = never, TItem extends RowItem = BoundItem>(definition: BlockDefinition<TSettings, K, TItem>): BlockRegistration;
|
|
126
132
|
//# sourceMappingURL=contract.d.ts.map
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,UAAU,EACV,UAAU,EACV,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C7C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;CAC5D;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,sGAAsG;IACtG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,oFAAoF;IACpF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EACtC,KAAK,SAAS,OAAO,GAAG,SAAS,EACjC,UAAU,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,iBAAiB,CASrE"}
|
package/dist/contract.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Turns a typed definition into a registration. The settings a renderer
|
|
3
|
-
* receives come from a document parsed against the schema for its type,
|
|
4
|
-
* the
|
|
3
|
+
* receives come from a document parsed against the schema for its type, and
|
|
4
|
+
* the items its rows draw from the Binding its type is welded to, so the
|
|
5
|
+
* widening to the stored shape happens here, once, and nowhere else.
|
|
5
6
|
*/
|
|
6
7
|
export function defineBlock(definition) {
|
|
7
8
|
return {
|