@shoplix-ai/block-kit 1.1.0 → 2.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 CHANGED
@@ -10,14 +10,24 @@ 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), `cart` (how many items the
13
- cart holds, for a badge, never the cart itself), and a capability object
14
- holding only the capabilities the Block Type declared.
13
+ cart holds for a badge, and whether a change is on its way so every block
14
+ goes quiet together; never the cart itself, which a cart Binding resolves),
15
+ and a capability object holding only the capabilities the Block Type
16
+ declared. A Block Type may also declare `rows` beside `render` and hand its
17
+ items to the host instead of drawing them itself.
15
18
  - **The registry.** `createBlockRegistry()` keyed by Block Type, one owner per
16
19
  type. A second owner is refused; the same owner may register again. Packages
17
20
  outside the app register through it. `defineBlock()` is the typed authoring
18
21
  helper: settings and capabilities are inferred from the definition.
19
- - **The capability set.** `addToCart`, `openCart`, `beginCheckout`. Closed, and
20
- the same list the schema package lets a Block Definition declare.
22
+ - **The capability set.** `addToCart` (with optional line attributes),
23
+ `openCart`, `beginCheckout`, `setLineQuantity`, `removeLines` (one or many
24
+ line ids), `applyDiscountCode`, `removeDiscountCode`, `setCartNote`,
25
+ `setLineAttributes`. Closed, and the same list the schema package lets a
26
+ Block Definition declare. A cart capability resolves once Shopify accepted
27
+ and rejects with a `CapabilityRefusal`: the outcome (`refused`, `not_found`,
28
+ `failed`) and Shopify's messages; `isCapabilityRefusal` tells it apart from
29
+ any other rejection. Nothing repaints before Shopify's answer, and the block
30
+ decides how to show a refusal.
21
31
  - **The authoring shape of a Code Block.** `defineSettings()` and
22
32
  `defineBinding()` type a block's settings and binding files; `SettingsValues`
23
33
  derives the renderer's settings type from the settings file;
@@ -31,17 +41,61 @@ written against this package and nothing else from the runtime. It holds:
31
41
  major; the api's package registry records it at push, and taking a version
32
42
  refuses a major other than the runtime's before anything is built.
33
43
  - **Helpers.** `resolveToken` (follow an alias to its value), `formatMoney`
34
- (amount plus currency code, formatted in the buyer's language), `pickLocale`
35
- (the buyer's language from the Shop's languages with default fallback),
36
- `localize` (one string out of a locale object), `textDirection`,
44
+ (amount plus currency code, formatted in the buyer's language; the one way a
45
+ block formats a figure it derived from display money amounts, in one
46
+ currency, for display only: the total a buyer sees is always Shopify's),
47
+ `pickLocale` (the buyer's language from the Shop's languages with default
48
+ fallback), `localize` (one string out of a locale object), `textDirection`,
37
49
  `imageSourceFor` (the rendition to paint at a given display width).
38
50
 
51
+ ## Rows: what the host lays out
52
+
53
+ A Block Type may declare `rows` next to `render`:
54
+
55
+ ```ts
56
+ defineBlock({
57
+ type: 'product_grid',
58
+ owner: 'platform',
59
+ render: ProductGrid,
60
+ rows: {
61
+ columns: (props) => props.settings.per_row,
62
+ gap: (props) => props.theme.spacing,
63
+ header: ProductGridHeading,
64
+ item: ProductTile,
65
+ footer: ProductGridFooter,
66
+ },
67
+ });
68
+ ```
69
+
70
+ `item` is the only part a row declaration must carry. It receives everything
71
+ `render` receives plus the one bound item it draws, the item's place in the
72
+ Binding's items and the width the host gives the cell. `columns` and `gap` are
73
+ read off the same render props: `columns` says how many items stand side by
74
+ side and defaults to 1, `gap` says how much space stands between them and
75
+ defaults to 0. `header` and `footer` are ordinary renderers.
76
+
77
+ On the phone a bound block that declares `rows` is not drawn whole. The host
78
+ takes it apart into one header row, one row per `columns` items and one footer
79
+ row, hands those rows to the screen's list, and never calls `render` for that
80
+ block. A block that declares no `rows`, or whose Binding resolved to a single
81
+ entity, stays one row drawn by `render`.
82
+
83
+ `render` therefore stays required. A host with no row layout of its own, the
84
+ dashboard's previewer canvas and the CLI's dev page, draws every block through
85
+ `render` and ignores the row declaration.
86
+
87
+ The host keys each item element by the item's own id. A cell that receives a
88
+ new product is a new element, so per-item state inside a Code Block, a quick
89
+ add that is waiting for the cart for example, never leaks from one product to
90
+ the next while the rows themselves recycle.
91
+
39
92
  No renderers live here. The package depends on `@shoplix-ai/sdui-schema` and on
40
- React types only. Its runtime export list is pinned by a test; it is imported by
41
- code outside this repo, so growing it is a reviewed change. The package follows
93
+ React types only. Its export list, the runtime names and the type names alike,
94
+ is pinned by a test; it is imported by code outside this repo, so growing it is
95
+ a reviewed change. The package follows
42
96
  semver and is publishable: a change a Shop package would have to follow is a
43
- major bump, announced with a migration note, and the runtime moves to the new
44
- major before any Shop package may.
97
+ major bump, announced with a migration note in `CHANGELOG.md`, and the runtime
98
+ moves to the new major before any Shop package may.
45
99
 
46
100
  ```sh
47
101
  pnpm build
@@ -1,22 +1,64 @@
1
- import { type BlockCapabilityName } from '@shoplix-ai/sdui-schema';
1
+ import { type BlockCapabilityName, type CartAttribute } from '@shoplix-ai/sdui-schema';
2
2
  /**
3
3
  * The closed capability set. A renderer reaches commerce only through these
4
- * three; the Storefront token, the cart id and navigation never cross the
4
+ * nine; the Storefront token, the cart id and navigation never cross the
5
5
  * contract. The set is code, never document content, and it does not grow
6
6
  * without a new contract major. The schema package names the same list, so a
7
7
  * Block Definition can declare only what a renderer can be handed.
8
8
  */
9
- export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout"];
9
+ export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout", "setLineQuantity", "removeLines", "applyDiscountCode", "removeDiscountCode", "setCartNote", "setLineAttributes"];
10
10
  export type CapabilityName = BlockCapabilityName;
11
11
  export interface CartLineInput {
12
12
  readonly variantId: string;
13
13
  readonly quantity: number;
14
+ readonly attributes?: readonly CartAttribute[];
14
15
  }
16
+ export interface CartLineQuantityInput {
17
+ readonly lineId: string;
18
+ readonly quantity: number;
19
+ }
20
+ export interface CartLineAttributesInput {
21
+ readonly lineId: string;
22
+ readonly attributes: readonly CartAttribute[];
23
+ }
24
+ /**
25
+ * Every cart capability answers through the host's one serialized queue and
26
+ * resolves once Shopify accepted; it rejects with a CapabilityRefusal, and
27
+ * the held cart repaints only on Shopify's answer, never before.
28
+ */
15
29
  export interface Capabilities {
16
30
  readonly addToCart: (line: CartLineInput) => Promise<void>;
17
31
  readonly openCart: () => void;
18
32
  readonly beginCheckout: () => Promise<void>;
33
+ readonly setLineQuantity: (input: CartLineQuantityInput) => Promise<void>;
34
+ readonly removeLines: (lineIds: readonly string[]) => Promise<void>;
35
+ readonly applyDiscountCode: (code: string) => Promise<void>;
36
+ readonly removeDiscountCode: (code: string) => Promise<void>;
37
+ readonly setCartNote: (note: string) => Promise<void>;
38
+ readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
19
39
  }
20
40
  /** What a renderer sees: exactly the capabilities its Block Type declared. */
21
41
  export type CapabilityObject<K extends CapabilityName = never> = Pick<Capabilities, K>;
42
+ /**
43
+ * Why a capability's promise rejected: Shopify refused the change (a quantity
44
+ * it will not sell, a code it does not honour), the cart is gone, or the call
45
+ * never got an answer.
46
+ */
47
+ export type CapabilityOutcome = 'refused' | 'not_found' | 'failed';
48
+ /**
49
+ * The typed refusal a cart capability rejects with: the outcome, and what
50
+ * Shopify said, in the buyer's language where Shopify gave it. A block
51
+ * decides how to show it; the host never shows it for the block.
52
+ */
53
+ export declare class CapabilityRefusal extends Error {
54
+ readonly outcome: CapabilityOutcome;
55
+ readonly messages: readonly string[];
56
+ readonly name = "CapabilityRefusal";
57
+ constructor(outcome: CapabilityOutcome, messages: readonly string[]);
58
+ }
59
+ /**
60
+ * Whether a rejection is a capability refusal, by its shape and never by
61
+ * its class: a Shop package and the app may each carry a copy of this module.
62
+ */
63
+ export declare function isCapabilityRefusal(error: unknown): error is CapabilityRefusal;
22
64
  //# sourceMappingURL=capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,qDAAyB,CAAC;AAE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AAiB,EAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE;CAIvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAU9E"}
@@ -1,10 +1,44 @@
1
- import { BLOCK_CAPABILITY_NAMES } from '@shoplix-ai/sdui-schema';
1
+ import { BLOCK_CAPABILITY_NAMES, } from '@shoplix-ai/sdui-schema';
2
2
  /**
3
3
  * The closed capability set. A renderer reaches commerce only through these
4
- * three; the Storefront token, the cart id and navigation never cross the
4
+ * nine; the Storefront token, the cart id and navigation never cross the
5
5
  * contract. The set is code, never document content, and it does not grow
6
6
  * without a new contract major. The schema package names the same list, so a
7
7
  * Block Definition can declare only what a renderer can be handed.
8
8
  */
9
9
  export const CAPABILITY_NAMES = BLOCK_CAPABILITY_NAMES;
10
+ const OUTCOMES = new Set([
11
+ 'refused',
12
+ 'not_found',
13
+ 'failed',
14
+ ]);
15
+ /**
16
+ * The typed refusal a cart capability rejects with: the outcome, and what
17
+ * Shopify said, in the buyer's language where Shopify gave it. A block
18
+ * decides how to show it; the host never shows it for the block.
19
+ */
20
+ export class CapabilityRefusal extends Error {
21
+ outcome;
22
+ messages;
23
+ name = 'CapabilityRefusal';
24
+ constructor(outcome, messages) {
25
+ super(messages.length > 0 ? messages.join(' ') : outcome);
26
+ this.outcome = outcome;
27
+ this.messages = messages;
28
+ }
29
+ }
30
+ /**
31
+ * Whether a rejection is a capability refusal, by its shape and never by
32
+ * its class: a Shop package and the app may each carry a copy of this module.
33
+ */
34
+ export function isCapabilityRefusal(error) {
35
+ if (typeof error !== 'object' || error === null)
36
+ return false;
37
+ const bag = error;
38
+ return (bag.name === 'CapabilityRefusal' &&
39
+ typeof bag.outcome === 'string' &&
40
+ OUTCOMES.has(bag.outcome) &&
41
+ Array.isArray(bag.messages) &&
42
+ bag.messages.every((message) => typeof message === 'string'));
43
+ }
10
44
  //# sourceMappingURL=capabilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA4B,MAAM,yBAAyB,CAAC;AAE3F;;;;;;GAMG;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,GAGvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AA+CvD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAoB;IAC/D,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH;;;;GAIG;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"}
@@ -1,5 +1,5 @@
1
1
  import type { CapabilityName } from './capabilities.js';
2
- import type { BlockRegistration, BlockRenderer, BlockSettings } from './contract.js';
2
+ import type { BlockRegistration, BlockRenderer, BlockRows, BlockSettings } from './contract.js';
3
3
  /**
4
4
  * What a Code Block's component file exports: the renderer, the capabilities
5
5
  * it reaches for, the version of this renderer, and how tall the canvas card
@@ -11,13 +11,19 @@ export interface CodeBlockModule<TSettings extends BlockSettings = BlockSettings
11
11
  readonly capabilities?: readonly K[];
12
12
  readonly heightHint?: number;
13
13
  readonly render: BlockRenderer<TSettings, K>;
14
+ readonly rows?: BlockRows<TSettings, K> | undefined;
14
15
  }
15
- /** The stored shape: every field present, the renderer widened as `defineBlock` widens it. */
16
+ /**
17
+ * The stored shape: the renderer widened as `defineBlock` widens it. `rows`
18
+ * is the one optional field, so a Code Block written against 1.1 is still one
19
+ * here.
20
+ */
16
21
  export interface CodeBlock {
17
22
  readonly rendererVersion: number;
18
23
  readonly capabilities: readonly CapabilityName[];
19
24
  readonly heightHint: number | undefined;
20
25
  readonly render: BlockRenderer;
26
+ readonly rows?: BlockRows | undefined;
21
27
  }
22
28
  /** The typed authoring shape of a Code Block: settings and capabilities are inferred. */
23
29
  export declare function defineCodeBlock<TSettings extends BlockSettings = BlockSettings, const K extends CapabilityName = never>(module: CodeBlockModule<TSettings, K>): CodeBlock;
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../src/code-block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAErF;;;;;GAKG;AACH,MAAM,WAAW,eAAe,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S,cAAc,GAAG,KAAK;IAEhC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAC7B,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EACtC,MAAM,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,SAAS,CAQlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAC1C,SAAS,iBAAiB,EAAE,CAS9B"}
@@ -6,6 +6,7 @@ export function defineCodeBlock(module) {
6
6
  capabilities: module.capabilities ?? [],
7
7
  heightHint: module.heightHint,
8
8
  render: module.render,
9
+ rows: module.rows,
9
10
  };
10
11
  }
11
12
  /**
@@ -21,6 +22,7 @@ export function shopBlocks(shopSlug, blocks) {
21
22
  capabilities: block.capabilities,
22
23
  rendererVersion: block.rendererVersion,
23
24
  render: block.render,
25
+ rows: block.rows,
24
26
  }));
25
27
  }
26
28
  //# sourceMappingURL=code-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.js","sourceRoot":"","sources":["../src/code-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA4B7D,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAG7B,MAAqC;IACrC,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;QACvC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAkC;KAClD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,MAA2C;IAE3C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"code-block.js","sourceRoot":"","sources":["../src/code-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAkC7D,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAG7B,MAAqC;IACrC,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;QACvC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAkC;QACjD,IAAI,EAAE,MAAM,CAAC,IAAwC;KACtD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,MAA2C;IAE3C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1,12 +1,17 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { BindingData, EnvelopeAssets, LocaleCode, ThemeStyle, ThemeTokens } from '@shoplix-ai/sdui-schema';
2
+ import type { BindingData, BoundItem, EnvelopeAssets, LocaleCode, 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';
6
6
  export type BlockSettings = Readonly<Record<string, unknown>>;
7
- /** What a renderer may know of the cart without holding it: how many items it carries. */
7
+ /**
8
+ * What every renderer may know of the cart without holding it: how many
9
+ * items it carries, and whether a change is on its way. The host's serialized
10
+ * queue sets pending, so every block on the screen goes quiet together.
11
+ */
8
12
  export interface CartSummary {
9
13
  readonly totalQuantity: number;
14
+ readonly pending: boolean;
10
15
  }
11
16
  /**
12
17
  * Everything a renderer receives, and all it may know. Settings are the
@@ -15,8 +20,9 @@ export interface CartSummary {
15
20
  * display entries for the screen in hand, keyed by asset id; tokens and theme
16
21
  * are the Shop's; language and direction are the buyer's, with the Shop's default
17
22
  * language as the fallback every locale object resolves through; navigate is the
18
- * closed way to move the buyer; cart is the count a badge draws, never the
19
- * cart itself; capabilities hold only what the Block Type declared.
23
+ * closed way to move the buyer; cart is the count a badge draws and the pending
24
+ * flag, never the cart itself, which a cart Binding resolves; capabilities hold
25
+ * only what the Block Type declared.
20
26
  */
21
27
  export interface BlockRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
22
28
  readonly blockId: string;
@@ -33,6 +39,30 @@ export interface BlockRenderProps<TSettings extends BlockSettings = BlockSetting
33
39
  readonly capabilities: CapabilityObject<K>;
34
40
  }
35
41
  export type BlockRenderer<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> = ComponentType<BlockRenderProps<TSettings, K>>;
42
+ /**
43
+ * What the item renderer of a row receives: everything the block receives,
44
+ * plus the one bound item this cell draws, its place in the Binding's items
45
+ * and the width the host gives the cell.
46
+ */
47
+ export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> extends BlockRenderProps<TSettings, K> {
48
+ readonly item: BoundItem;
49
+ readonly index: number;
50
+ readonly width: number;
51
+ }
52
+ /**
53
+ * How a bound block hands its items to the host instead of drawing them
54
+ * itself: an optional header, one item renderer, an optional footer, and how
55
+ * many items stand side by side with how much space between them. `columns`
56
+ * defaults to 1 and `gap` to 0 where the host lays rows out. A host without
57
+ * the row layout ignores all of it and calls `render`.
58
+ */
59
+ export interface BlockRows<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
60
+ readonly columns?: (props: BlockRenderProps<TSettings, K>) => number;
61
+ readonly gap?: (props: BlockRenderProps<TSettings, K>) => number;
62
+ readonly header?: BlockRenderer<TSettings, K>;
63
+ readonly item: ComponentType<BlockItemRenderProps<TSettings, K>>;
64
+ readonly footer?: BlockRenderer<TSettings, K>;
65
+ }
36
66
  /** Who answers for a Block Type: the platform, or the Shop whose package registered it. */
37
67
  export type BlockOwner = string;
38
68
  /** The typed authoring shape: settings and capabilities are inferred from the definition. */
@@ -41,6 +71,7 @@ export interface BlockDefinition<TSettings extends BlockSettings = BlockSettings
41
71
  readonly owner: BlockOwner;
42
72
  readonly capabilities?: readonly K[];
43
73
  readonly render: BlockRenderer<TSettings, K>;
74
+ readonly rows?: BlockRows<TSettings, K> | undefined;
44
75
  }
45
76
  /**
46
77
  * The shape a registry stores and a host renders: one entry per Block Type.
@@ -55,6 +86,8 @@ export interface BlockRegistration {
55
86
  /** A Code Block's renderer version, the one its Block Definition names; a platform block has none. */
56
87
  readonly rendererVersion?: number;
57
88
  readonly render: BlockRenderer;
89
+ /** The row declaration, for a host that lays rows out itself; absent when the block draws whole. */
90
+ readonly rows?: BlockRows | undefined;
58
91
  }
59
92
  /**
60
93
  * Turns a typed definition into a registration. The settings a renderer
@@ -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,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9D,0FAA0F;AAC1F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,CAAC,SAAS,cAAc,GAAG,KAAK;IAEhC,QAAQ,CAAC,OAAO,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AAS,aAAa,GAAG,aAAa,EAC/C,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EACtC,UAAU,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAQ9D"}
package/dist/contract.js CHANGED
@@ -9,6 +9,7 @@ export function defineBlock(definition) {
9
9
  owner: definition.owner,
10
10
  capabilities: definition.capabilities ?? [],
11
11
  render: definition.render,
12
+ rows: definition.rows,
12
13
  };
13
14
  }
14
15
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAkFA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAGzB,UAAyC;IACzC,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,EAAE;QAC3C,MAAM,EAAE,UAAU,CAAC,MAAkC;KACtD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AA4HA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAGzB,UAAyC;IACzC,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,EAAE;QAC3C,MAAM,EAAE,UAAU,CAAC,MAAkC;QACrD,IAAI,EAAE,UAAU,CAAC,IAAwC;KAC1D,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { CAPABILITY_NAMES } from './capabilities.js';
2
- export type { Capabilities, CapabilityName, CapabilityObject, CartLineInput, } from './capabilities.js';
1
+ export { CAPABILITY_NAMES, CapabilityRefusal, isCapabilityRefusal } from './capabilities.js';
2
+ export type { Capabilities, CapabilityName, CapabilityObject, CapabilityOutcome, CartLineAttributesInput, CartLineInput, CartLineQuantityInput, } from './capabilities.js';
3
3
  export { defineBlock } from './contract.js';
4
- export type { BlockDefinition, BlockOwner, BlockRegistration, BlockRenderProps, BlockRenderer, BlockSettings, CartSummary, TextDirection, } from './contract.js';
4
+ export type { BlockDefinition, BlockItemRenderProps, BlockOwner, BlockRegistration, BlockRenderProps, BlockRenderer, BlockRows, BlockSettings, CartSummary, TextDirection, } from './contract.js';
5
5
  export type { BlockNavigation } from './navigation.js';
6
6
  export { createBlockRegistry } from './registry.js';
7
7
  export type { BlockRegistry } from './registry.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAA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CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CAPABILITY_NAMES } from './capabilities.js';
1
+ export { CAPABILITY_NAMES, CapabilityRefusal, isCapabilityRefusal } from './capabilities.js';
2
2
  export { defineBlock } from './contract.js';
3
3
  export { createBlockRegistry } from './registry.js';
4
4
  export { defineBinding, defineSettings } from './authoring.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAc5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAW7F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/dist/version.d.ts CHANGED
@@ -4,6 +4,6 @@
4
4
  * The major is the compatibility line: a Shop package built against another
5
5
  * major never meets this runtime, and a major bump is an announced event.
6
6
  */
7
- export declare const CONTRACT_VERSION = "1.1.0";
8
- export declare const CONTRACT_MAJOR = 1;
7
+ export declare const CONTRACT_VERSION = "2.0.0";
8
+ export declare const CONTRACT_MAJOR = 2;
9
9
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -4,6 +4,6 @@
4
4
  * The major is the compatibility line: a Shop package built against another
5
5
  * major never meets this runtime, and a major bump is an announced event.
6
6
  */
7
- export const CONTRACT_VERSION = '1.1.0';
8
- export const CONTRACT_MAJOR = 1;
7
+ export const CONTRACT_VERSION = '2.0.0';
8
+ export const CONTRACT_MAJOR = 2;
9
9
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplix-ai/block-kit",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "The renderer contract every Block Type renderer is written against: what a renderer receives, how a Block Type is registered with its owner, the closed capability set, and the small helpers renderers share. Contract only, no renderers.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@shoplix-ai/sdui-schema": "1.1.0"
29
+ "@shoplix-ai/sdui-schema": "1.5.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=19.0.0"