@shoplix-ai/block-kit 5.29.0 → 5.30.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.
@@ -1,4 +1,4 @@
1
- import type { LocaleCode, MoneyStyle, ProductSummaryBlock, ThemeStyle } from '@shoplix-ai/sdui-schema';
1
+ import { type LocaleCode, type MoneyStyle, type ProductSummaryBlock, type ThemeStyle } from '@shoplix-ai/sdui-schema';
2
2
  import type { ChosenPrice } from './variant-rows.js';
3
3
  /** The parts of the product summary, each with the theme role it draws unless a component token names another. */
4
4
  declare const PRODUCT_SUMMARY_ROLES: {
@@ -20,6 +20,8 @@ declare const PRODUCT_SUMMARY_ROLES: {
20
20
  readonly amount: "text";
21
21
  readonly struck: "muted";
22
22
  readonly off: "action";
23
+ readonly button_surface: "sunken";
24
+ readonly button_ink: "muted";
23
25
  };
24
26
  export type ProductSummaryPart = keyof typeof PRODUCT_SUMMARY_ROLES;
25
27
  export type ProductSummaryColors = Readonly<Record<ProductSummaryPart, string>>;
@@ -27,9 +29,11 @@ export type ProductSummaryColors = Readonly<Record<ProductSummaryPart, string>>;
27
29
  * Every colour the summary draws, one per part, with `product_summary.<part>`
28
30
  * as the escape hatch over each theme role. The price and the vendor line read
29
31
  * the action role, so a merchant who changes one button colour changes the
30
- * whole product screen with it.
32
+ * whole product screen with it. The plain look's round buttons stand on the
33
+ * page header's own circle and ink unless the merchant chose a role for
34
+ * either.
31
35
  */
32
- export declare function productSummaryColors(theme: ThemeStyle): ProductSummaryColors;
36
+ export declare function productSummaryColors(theme: ThemeStyle, settings?: Pick<ProductSummaryBlock['props'], 'buttonSurface' | 'buttonInk'>): ProductSummaryColors;
33
37
  /**
34
38
  * What the summary says the compare-at price saves, in the way the merchant
35
39
  * chose: the amount ("Save 36.190 KWD"), the percent ("−17%"), or nothing.
@@ -1 +1 @@
1
- {"version":3,"file":"product-summary.d.ts","sourceRoot":"","sources":["../src/product-summary.ts"],"names":[],"mappings":"AAA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ClC,KAAK,EAAE,UAAU,EACjB,QAAQ,GAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,WAAW,CAAM,GAC/E,oBAAoB,CAOtB;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EAC9C,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,EAC3B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,GAAG,IAAI,CAaf"}
@@ -1,5 +1,6 @@
1
+ import { PAGE_HEADER_DEFAULT_INKS, } from '@shoplix-ai/sdui-schema';
1
2
  import { derivedMoney, discountPercent, moneyAmount } from './money.js';
2
- import { partColors } from './part-colors.js';
3
+ import { chosenRole, partColors } from './part-colors.js';
3
4
  import { platformWords } from './words.js';
4
5
  /** The parts of the product summary, each with the theme role it draws unless a component token names another. */
5
6
  const PRODUCT_SUMMARY_ROLES = {
@@ -21,15 +22,24 @@ const PRODUCT_SUMMARY_ROLES = {
21
22
  amount: 'text',
22
23
  struck: 'muted',
23
24
  off: 'action',
25
+ button_surface: PAGE_HEADER_DEFAULT_INKS.circle,
26
+ button_ink: PAGE_HEADER_DEFAULT_INKS.ink,
24
27
  };
25
28
  /**
26
29
  * Every colour the summary draws, one per part, with `product_summary.<part>`
27
30
  * as the escape hatch over each theme role. The price and the vendor line read
28
31
  * the action role, so a merchant who changes one button colour changes the
29
- * whole product screen with it.
32
+ * whole product screen with it. The plain look's round buttons stand on the
33
+ * page header's own circle and ink unless the merchant chose a role for
34
+ * either.
30
35
  */
31
- export function productSummaryColors(theme) {
32
- return partColors(theme, 'product_summary', PRODUCT_SUMMARY_ROLES);
36
+ export function productSummaryColors(theme, settings = {}) {
37
+ const table = partColors(theme, 'product_summary', PRODUCT_SUMMARY_ROLES);
38
+ return {
39
+ ...table,
40
+ button_surface: chosenRole(theme, settings.buttonSurface, table.button_surface),
41
+ button_ink: chosenRole(theme, settings.buttonInk, table.button_ink),
42
+ };
33
43
  }
34
44
  const MINUS = '\u2212';
35
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"product-summary.js","sourceRoot":"","sources":["../src/product-summary.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,kHAAkH;AAClH,MAAM,qBAAqB,GAAG;IAC5B,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,QAAQ;IACxB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,QAAQ;IACtB,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,QAAQ;IACvB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,MAAM;IACjB,cAAc,EAAE,QAAQ;IACxB,UAAU,EAAE,SAAS;IACrB,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,OAAO;IACf,GAAG,EAAE,QAAQ;CACgD,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAiB;IACpD,OAAO,UAAU,CAAC,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,MAAmB,EACnB,MAA8C,EAC9C,QAAoB,EACpB,eAA2B,EAC3B,KAA6B;IAE7B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACpC,IAAI,SAAS,KAAK,SAAS,IAAI,MAA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QAAE,OAAO,IAAI,CAAC;IAC/D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAClD,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,CAAC;IACzD,CAAC;IACD,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9D,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,GAAG,GAAG,EAAE,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5E,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;AACjH,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 = "5.29.0";
7
+ export declare const CONTRACT_VERSION = "5.30.0";
8
8
  export declare const CONTRACT_MAJOR = 5;
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 = '5.29.0';
7
+ export const CONTRACT_VERSION = '5.30.0';
8
8
  export const CONTRACT_MAJOR = 5;
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": "5.29.0",
3
+ "version": "5.30.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.78.0"
29
+ "@shoplix-ai/sdui-schema": "1.81.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=19.0.0"