@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.
Files changed (99) hide show
  1. package/README.md +92 -13
  2. package/dist/account-links.d.ts +50 -1
  3. package/dist/account-links.d.ts.map +1 -1
  4. package/dist/account-links.js +61 -1
  5. package/dist/account-links.js.map +1 -1
  6. package/dist/address-list.d.ts +9 -8
  7. package/dist/address-list.d.ts.map +1 -1
  8. package/dist/address-list.js +5 -5
  9. package/dist/address-list.js.map +1 -1
  10. package/dist/buy-box.d.ts +8 -0
  11. package/dist/buy-box.d.ts.map +1 -1
  12. package/dist/buy-box.js +8 -0
  13. package/dist/buy-box.js.map +1 -1
  14. package/dist/capabilities.d.ts +4 -1
  15. package/dist/capabilities.d.ts.map +1 -1
  16. package/dist/capabilities.js.map +1 -1
  17. package/dist/category-grid.d.ts +92 -0
  18. package/dist/category-grid.d.ts.map +1 -0
  19. package/dist/category-grid.js +123 -0
  20. package/dist/category-grid.js.map +1 -0
  21. package/dist/color-choice.d.ts +4 -0
  22. package/dist/color-choice.d.ts.map +1 -0
  23. package/dist/color-choice.js +11 -0
  24. package/dist/color-choice.js.map +1 -0
  25. package/dist/content-direction.d.ts +10 -0
  26. package/dist/content-direction.d.ts.map +1 -0
  27. package/dist/content-direction.js +20 -0
  28. package/dist/content-direction.js.map +1 -0
  29. package/dist/description.d.ts +60 -0
  30. package/dist/description.d.ts.map +1 -0
  31. package/dist/description.js +332 -0
  32. package/dist/description.js.map +1 -0
  33. package/dist/index.d.ts +23 -12
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +14 -8
  36. package/dist/index.js.map +1 -1
  37. package/dist/listing-filters.d.ts +114 -0
  38. package/dist/listing-filters.d.ts.map +1 -0
  39. package/dist/listing-filters.js +195 -0
  40. package/dist/listing-filters.js.map +1 -0
  41. package/dist/listing-toolbar.d.ts +117 -0
  42. package/dist/listing-toolbar.d.ts.map +1 -0
  43. package/dist/listing-toolbar.js +130 -0
  44. package/dist/listing-toolbar.js.map +1 -0
  45. package/dist/money.d.ts +7 -0
  46. package/dist/money.d.ts.map +1 -1
  47. package/dist/money.js +15 -0
  48. package/dist/money.js.map +1 -1
  49. package/dist/navigation.d.ts +7 -5
  50. package/dist/navigation.d.ts.map +1 -1
  51. package/dist/orders.d.ts +87 -9
  52. package/dist/orders.d.ts.map +1 -1
  53. package/dist/orders.js +127 -13
  54. package/dist/orders.js.map +1 -1
  55. package/dist/product-card.d.ts +4 -0
  56. package/dist/product-card.d.ts.map +1 -1
  57. package/dist/product-card.js +4 -0
  58. package/dist/product-card.js.map +1 -1
  59. package/dist/product-gallery.d.ts +3 -0
  60. package/dist/product-gallery.d.ts.map +1 -1
  61. package/dist/product-gallery.js +3 -0
  62. package/dist/product-gallery.js.map +1 -1
  63. package/dist/product-specs.d.ts +33 -2
  64. package/dist/product-specs.d.ts.map +1 -1
  65. package/dist/product-specs.js +51 -2
  66. package/dist/product-specs.js.map +1 -1
  67. package/dist/product-summary.d.ts +12 -1
  68. package/dist/product-summary.d.ts.map +1 -1
  69. package/dist/product-summary.js +29 -0
  70. package/dist/product-summary.js.map +1 -1
  71. package/dist/profile-header.d.ts +8 -1
  72. package/dist/profile-header.d.ts.map +1 -1
  73. package/dist/profile-header.js +8 -1
  74. package/dist/profile-header.js.map +1 -1
  75. package/dist/sign-in.d.ts +3 -0
  76. package/dist/sign-in.d.ts.map +1 -1
  77. package/dist/sign-in.js +3 -0
  78. package/dist/sign-in.js.map +1 -1
  79. package/dist/store-header.d.ts +49 -6
  80. package/dist/store-header.d.ts.map +1 -1
  81. package/dist/store-header.js +59 -5
  82. package/dist/store-header.js.map +1 -1
  83. package/dist/variant-choice.d.ts +14 -0
  84. package/dist/variant-choice.d.ts.map +1 -1
  85. package/dist/variant-choice.js +36 -0
  86. package/dist/variant-choice.js.map +1 -1
  87. package/dist/variant-rows.d.ts +33 -0
  88. package/dist/variant-rows.d.ts.map +1 -0
  89. package/dist/variant-rows.js +52 -0
  90. package/dist/variant-rows.js.map +1 -0
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.d.ts.map +1 -1
  93. package/dist/version.js +1 -1
  94. package/dist/version.js.map +1 -1
  95. package/dist/words.d.ts +67 -2
  96. package/dist/words.d.ts.map +1 -1
  97. package/dist/words.js +180 -1
  98. package/dist/words.js.map +1 -1
  99. package/package.json +2 -2
@@ -13,6 +13,10 @@ declare const PRODUCT_CARD_ROLES: {
13
13
  readonly notify: "text";
14
14
  readonly notify_done: "success";
15
15
  readonly notify_done_surface: "elevated";
16
+ readonly amount: "text";
17
+ readonly plus: "elevated";
18
+ readonly plus_ink: "text";
19
+ readonly plus_ring: "border";
16
20
  };
17
21
  export type ProductCardPart = keyof typeof PRODUCT_CARD_ROLES;
18
22
  export type ProductCardColors = Readonly<Record<ProductCardPart, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../src/product-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,+GAA+G;AAC/G,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;CAauC,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;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE"}
1
+ {"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../src/product-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,+GAA+G;AAC/G,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAiBuC,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;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE"}
@@ -13,6 +13,10 @@ const PRODUCT_CARD_ROLES = {
13
13
  notify: 'text',
14
14
  notify_done: 'success',
15
15
  notify_done_surface: 'elevated',
16
+ amount: 'text',
17
+ plus: 'elevated',
18
+ plus_ink: 'text',
19
+ plus_ring: 'border',
16
20
  };
17
21
  /**
18
22
  * Every colour the product card draws, one per part: the theme role behind
@@ -1 +1 @@
1
- {"version":3,"file":"product-card.js","sourceRoot":"","sources":["../src/product-card.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,+GAA+G;AAC/G,MAAM,kBAAkB,GAAG;IACzB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,SAAS;IACzB,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,UAAU;CAC8B,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAC/D,CAAC"}
1
+ {"version":3,"file":"product-card.js","sourceRoot":"","sources":["../src/product-card.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,+GAA+G;AAC/G,MAAM,kBAAkB,GAAG;IACzB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,SAAS;IACzB,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,UAAU;IAC/B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,QAAQ;CAC0C,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAC/D,CAAC"}
@@ -8,6 +8,9 @@ declare const PRODUCT_GALLERY_ROLES: {
8
8
  readonly thumb_border: "border";
9
9
  readonly thumb_active: "action";
10
10
  readonly sold_out_chip: "text";
11
+ readonly strip: "elevated";
12
+ readonly segment: "border";
13
+ readonly segment_active: "text";
11
14
  };
12
15
  export type ProductGalleryPart = keyof typeof PRODUCT_GALLERY_ROLES;
13
16
  export type ProductGalleryColors = Readonly<Record<ProductGalleryPart, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"product-gallery.d.ts","sourceRoot":"","sources":["../src/product-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,kHAAkH;AAClH,QAAA,MAAM,qBAAqB;;;;;;;;CAQoC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,oBAAoB,CAE5E"}
1
+ {"version":3,"file":"product-gallery.d.ts","sourceRoot":"","sources":["../src/product-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,kHAAkH;AAClH,QAAA,MAAM,qBAAqB;;;;;;;;;;;CAWoC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,oBAAoB,CAE5E"}
@@ -8,6 +8,9 @@ const PRODUCT_GALLERY_ROLES = {
8
8
  thumb_border: 'border',
9
9
  thumb_active: 'action',
10
10
  sold_out_chip: 'text',
11
+ strip: 'elevated',
12
+ segment: 'border',
13
+ segment_active: 'text',
11
14
  };
12
15
  /**
13
16
  * Every colour the gallery draws, one per part, with `product_gallery.<part>`
@@ -1 +1 @@
1
- {"version":3,"file":"product-gallery.js","sourceRoot":"","sources":["../src/product-gallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,kHAAkH;AAClH,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,UAAU;IACjB,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,MAAM;CACwC,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAiB;IACpD,OAAO,UAAU,CAAC,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AACrE,CAAC"}
1
+ {"version":3,"file":"product-gallery.js","sourceRoot":"","sources":["../src/product-gallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,kHAAkH;AAClH,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,UAAU;IACjB,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,MAAM;IACrB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,QAAQ;IACjB,cAAc,EAAE,MAAM;CACuC,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAiB;IACpD,OAAO,UAAU,CAAC,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AACrE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ThemeStyle } from '@shoplix-ai/sdui-schema';
1
+ import type { ColorChoice, LocaleCode, ProductDisplay, ProductSectionProps, ProductSectionType, ProductSpecificationsBlock, ShippingReturnsBlock, ThemeStyle } from '@shoplix-ai/sdui-schema';
2
2
  /** The parts of the product specs, each with the theme role it draws unless a component token names another. */
3
3
  declare const PRODUCT_SPECS_ROLES: {
4
4
  readonly surface: "elevated";
@@ -12,6 +12,7 @@ declare const PRODUCT_SPECS_ROLES: {
12
12
  readonly glyph_surface: "sunken";
13
13
  readonly glyph: "text";
14
14
  readonly note: "muted";
15
+ readonly ledger_label: "muted";
15
16
  };
16
17
  export type ProductSpecsPart = keyof typeof PRODUCT_SPECS_ROLES;
17
18
  export type ProductSpecsColors = Readonly<Record<ProductSpecsPart, string>>;
@@ -19,7 +20,37 @@ export type ProductSpecsColors = Readonly<Record<ProductSpecsPart, string>>;
19
20
  * Every colour the specs draw, one per part, with `product_specs.<part>` as
20
21
  * the escape hatch over each theme role. The body and the table's values take
21
22
  * the text role rather than the muted one: a size chart is read, not skimmed.
23
+ * The three sections of the product page read the same table, so a theme
24
+ * paints them as it painted the specs, and a surface the merchant chose for
25
+ * one section wins over it.
22
26
  */
23
- export declare function productSpecsColors(theme: ThemeStyle): ProductSpecsColors;
27
+ export declare function productSpecsColors(theme: ThemeStyle, settings?: {
28
+ readonly surface?: ColorChoice;
29
+ }): ProductSpecsColors;
30
+ /** The catalog's title of each section of the product page, the one the specs drew over it. */
31
+ export declare const PRODUCT_SECTION_TITLES: {
32
+ readonly product_description: "product.details";
33
+ readonly product_specifications: "product.specifications";
34
+ readonly shipping_returns: "product.shipping_returns";
35
+ };
36
+ /** A section's title: the merchant's own where they wrote one the buyer reads, the catalog's otherwise. */
37
+ export declare function productSectionTitle(type: ProductSectionType, title: ProductSectionProps['title'], language: LocaleCode, defaultLanguage: LocaleCode): string;
38
+ export interface ProductSpecRow {
39
+ readonly key: string;
40
+ readonly label: string;
41
+ readonly value: string;
42
+ }
43
+ /**
44
+ * The rows the table draws: the facts table of the product's description
45
+ * first where the block reads it, then the merchant's own rows, and the facts
46
+ * the Storefront answers where neither says anything, so a merchant who has
47
+ * written nothing still gets a table rather than a heading over a gap.
48
+ */
49
+ export declare function productSpecRows(specs: ProductSpecificationsBlock['props']['specs'], product: ProductDisplay, language: LocaleCode, defaultLanguage: LocaleCode, options?: {
50
+ readonly descriptionTable?: boolean;
51
+ }): ProductSpecRow[];
52
+ export type ShippingRow = NonNullable<ShippingReturnsBlock['props']['shipping']>[number];
53
+ /** The shipping rows a card draws: every row whose title the buyer can read, in the merchant's order. */
54
+ export declare function shippingRowsOf(shipping: readonly ShippingRow[] | undefined, language: LocaleCode, defaultLanguage: LocaleCode): ShippingRow[];
24
55
  export {};
25
56
  //# sourceMappingURL=product-specs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-specs.d.ts","sourceRoot":"","sources":["../src/product-specs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,gHAAgH;AAChH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;CAYsC,CA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AAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EACnD,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,EAC3B,OAAO,GAAE;IAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,cAAc,EAAE,CAmBlB;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzF,yGAAyG;AACzG,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,EAC5C,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,WAAW,EAAE,CAEf"}
@@ -1,4 +1,8 @@
1
+ import { colorChoiceOf } from './color-choice.js';
2
+ import { localize } from './locale.js';
1
3
  import { partColors } from './part-colors.js';
4
+ import { platformWords } from './words.js';
5
+ import { descriptionFacts } from './description.js';
2
6
  /** The parts of the product specs, each with the theme role it draws unless a component token names another. */
3
7
  const PRODUCT_SPECS_ROLES = {
4
8
  surface: 'elevated',
@@ -12,13 +16,58 @@ const PRODUCT_SPECS_ROLES = {
12
16
  glyph_surface: 'sunken',
13
17
  glyph: 'text',
14
18
  note: 'muted',
19
+ ledger_label: 'muted',
15
20
  };
16
21
  /**
17
22
  * Every colour the specs draw, one per part, with `product_specs.<part>` as
18
23
  * the escape hatch over each theme role. The body and the table's values take
19
24
  * the text role rather than the muted one: a size chart is read, not skimmed.
25
+ * The three sections of the product page read the same table, so a theme
26
+ * paints them as it painted the specs, and a surface the merchant chose for
27
+ * one section wins over it.
20
28
  */
21
- export function productSpecsColors(theme) {
22
- return partColors(theme, 'product_specs', PRODUCT_SPECS_ROLES);
29
+ export function productSpecsColors(theme, settings = {}) {
30
+ const table = partColors(theme, 'product_specs', PRODUCT_SPECS_ROLES);
31
+ return { ...table, surface: colorChoiceOf(theme, settings.surface) ?? table.surface };
32
+ }
33
+ /** The catalog's title of each section of the product page, the one the specs drew over it. */
34
+ export const PRODUCT_SECTION_TITLES = {
35
+ product_description: 'product.details',
36
+ product_specifications: 'product.specifications',
37
+ shipping_returns: 'product.shipping_returns',
38
+ };
39
+ /** A section's title: the merchant's own where they wrote one the buyer reads, the catalog's otherwise. */
40
+ export function productSectionTitle(type, title, language, defaultLanguage) {
41
+ return platformWords(language, defaultLanguage).merchantOr(title, PRODUCT_SECTION_TITLES[type]);
42
+ }
43
+ /**
44
+ * The rows the table draws: the facts table of the product's description
45
+ * first where the block reads it, then the merchant's own rows, and the facts
46
+ * the Storefront answers where neither says anything, so a merchant who has
47
+ * written nothing still gets a table rather than a heading over a gap.
48
+ */
49
+ export function productSpecRows(specs, product, language, defaultLanguage, options = {}) {
50
+ const described = options.descriptionTable === true ? descriptionFacts(product) : [];
51
+ const typed = (specs ?? [])
52
+ .map((row, index) => ({
53
+ key: `typed-${index}`,
54
+ label: localize(row.name, language, defaultLanguage),
55
+ value: localize(row.value, language, defaultLanguage),
56
+ }))
57
+ .filter((row) => row.label !== '');
58
+ if (described.length > 0 || typed.length > 0)
59
+ return [...described, ...typed];
60
+ const words = platformWords(language, defaultLanguage);
61
+ const known = [
62
+ { key: 'vendor', word: 'product.brand', value: product.vendor },
63
+ { key: 'productType', word: 'product.type', value: product.productType },
64
+ ];
65
+ return known
66
+ .filter((fact) => fact.value !== undefined && fact.value !== '')
67
+ .map((fact) => ({ key: fact.key, label: words.own(fact.word), value: fact.value }));
68
+ }
69
+ /** The shipping rows a card draws: every row whose title the buyer can read, in the merchant's order. */
70
+ export function shippingRowsOf(shipping, language, defaultLanguage) {
71
+ return (shipping ?? []).filter((row) => localize(row.title, language, defaultLanguage) !== '');
23
72
  }
24
73
  //# sourceMappingURL=product-specs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-specs.js","sourceRoot":"","sources":["../src/product-specs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gHAAgH;AAChH,MAAM,mBAAmB,GAAG;IAC1B,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,QAAQ;IACvB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,UAAU;IAChB,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,OAAO;CACgD,CAAC;AAMhE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,OAAO,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;AACjE,CAAC"}
1
+ {"version":3,"file":"product-specs.js","sourceRoot":"","sources":["../src/product-specs.ts"],"names":[],"mappings":"AAUA,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;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,gHAAgH;AAChH,MAAM,mBAAmB,GAAG;IAC1B,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,QAAQ;IACvB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,UAAU;IAChB,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,OAAO;CACwC,CAAC;AA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} from '@shoplix-ai/sdui-schema';
1
+ import type { LocaleCode, MoneyStyle, ProductSummaryBlock, ThemeStyle } from '@shoplix-ai/sdui-schema';
2
+ import type { ChosenPrice } from './variant-rows.js';
2
3
  /** The parts of the product summary, each with the theme role it draws unless a component token names another. */
3
4
  declare const PRODUCT_SUMMARY_ROLES: {
4
5
  readonly sheet: "elevated";
@@ -15,6 +16,10 @@ declare const PRODUCT_SUMMARY_ROLES: {
15
16
  readonly stock_ink: "text";
16
17
  readonly saving_surface: "sunken";
17
18
  readonly saving_ink: "success";
19
+ readonly byline: "muted";
20
+ readonly amount: "text";
21
+ readonly struck: "muted";
22
+ readonly off: "action";
18
23
  };
19
24
  export type ProductSummaryPart = keyof typeof PRODUCT_SUMMARY_ROLES;
20
25
  export type ProductSummaryColors = Readonly<Record<ProductSummaryPart, string>>;
@@ -25,5 +30,11 @@ export type ProductSummaryColors = Readonly<Record<ProductSummaryPart, string>>;
25
30
  * whole product screen with it.
26
31
  */
27
32
  export declare function productSummaryColors(theme: ThemeStyle): ProductSummaryColors;
33
+ /**
34
+ * What the summary says the compare-at price saves, in the way the merchant
35
+ * chose: the amount ("Save 36.190 KWD"), the percent ("−17%"), or nothing.
36
+ * Nothing either where the chosen variant saves nothing.
37
+ */
38
+ export declare function savingText(chosen: ChosenPrice, saving: ProductSummaryBlock['props']['saving'], language: LocaleCode, defaultLanguage: LocaleCode, money: MoneyStyle | undefined): string | null;
28
39
  export {};
29
40
  //# sourceMappingURL=product-summary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-summary.d.ts","sourceRoot":"","sources":["../src/product-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,kHAAkH;AAClH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;CAeoC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,oBAAoB,CAE5E"}
1
+ {"version":3,"file":"product-summary.d.ts","sourceRoot":"","sources":["../src/product-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,kHAAkH;AAClH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;CAmBoC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,oBAAoB,CAE5E;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,4 +1,6 @@
1
+ import { derivedMoney, discountPercent, moneyAmount } from './money.js';
1
2
  import { partColors } from './part-colors.js';
3
+ import { platformWords } from './words.js';
2
4
  /** The parts of the product summary, each with the theme role it draws unless a component token names another. */
3
5
  const PRODUCT_SUMMARY_ROLES = {
4
6
  sheet: 'elevated',
@@ -15,6 +17,10 @@ const PRODUCT_SUMMARY_ROLES = {
15
17
  stock_ink: 'text',
16
18
  saving_surface: 'sunken',
17
19
  saving_ink: 'success',
20
+ byline: 'muted',
21
+ amount: 'text',
22
+ struck: 'muted',
23
+ off: 'action',
18
24
  };
19
25
  /**
20
26
  * Every colour the summary draws, one per part, with `product_summary.<part>`
@@ -25,4 +31,27 @@ const PRODUCT_SUMMARY_ROLES = {
25
31
  export function productSummaryColors(theme) {
26
32
  return partColors(theme, 'product_summary', PRODUCT_SUMMARY_ROLES);
27
33
  }
34
+ const MINUS = '\u2212';
35
+ /**
36
+ * What the summary says the compare-at price saves, in the way the merchant
37
+ * chose: the amount ("Save 36.190 KWD"), the percent ("−17%"), or nothing.
38
+ * Nothing either where the chosen variant saves nothing.
39
+ */
40
+ export function savingText(chosen, saving, language, defaultLanguage, money) {
41
+ const { price, compareAt } = chosen;
42
+ if (compareAt === undefined || saving === 'none')
43
+ return null;
44
+ if (compareAt.currencyCode !== price.currencyCode)
45
+ return null;
46
+ if (saving === 'percent') {
47
+ const percent = discountPercent(price, compareAt);
48
+ return percent === null ? null : `${MINUS}${percent}%`;
49
+ }
50
+ const now = moneyAmount(price);
51
+ const then = moneyAmount(compareAt);
52
+ if (now === null || then === null || then <= now)
53
+ return null;
54
+ const saved = derivedMoney(then - now, price.currencyCode, language, money);
55
+ return `${platformWords(language, defaultLanguage).own('product.save')} ${saved.digits} ${saved.label}`.trim();
56
+ }
28
57
  //# sourceMappingURL=product-summary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-summary.js","sourceRoot":"","sources":["../src/product-summary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,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,SA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AAmB,EACnB,MAA8C,EAC9C,QAAoB,EACpB,eAA2B,EAC3B,KAA6B;IAE7B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACpC,IAAI,SAAS,KAAK,SAAS,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAC9D,IAAI,SAAS,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY;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"}
@@ -8,10 +8,17 @@ declare const PROFILE_HEADER_ROLES: {
8
8
  readonly edit: "elevated";
9
9
  readonly edit_border: "border";
10
10
  readonly edit_glyph: "text";
11
+ readonly title: "text";
12
+ readonly subtitle: "muted";
13
+ readonly button: "action";
11
14
  };
12
15
  export type ProfileHeaderPart = keyof typeof PROFILE_HEADER_ROLES;
13
16
  export type ProfileHeaderColors = Readonly<Record<ProfileHeaderPart, string>>;
14
- /** Every colour the profile header draws, one per part, with `profile_header.<part>` over each theme role. */
17
+ /**
18
+ * Every colour the profile header draws, one per part, with
19
+ * `profile_header.<part>` over each theme role. The title, the subtitle and
20
+ * the button are what it draws while nobody is signed in.
21
+ */
15
22
  export declare function profileHeaderColors(theme: ThemeStyle): ProfileHeaderColors;
16
23
  /**
17
24
  * The letters an avatar draws for a shopper: the first of each name they
@@ -1 +1 @@
1
- {"version":3,"file":"profile-header.d.ts","sourceRoot":"","sources":["../src/profile-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG3E,iHAAiH;AACjH,QAAA,MAAM,oBAAoB;;;;;;;;CAQqC,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9E,8GAA8G;AAC9G,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAE1E;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC,GACxE,MAAM,CAGR"}
1
+ {"version":3,"file":"profile-header.d.ts","sourceRoot":"","sources":["../src/profile-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG3E,iHAAiH;AACjH,QAAA,MAAM,oBAAoB;;;;;;;;;;;CAWqC,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAE1E;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC,GACxE,MAAM,CAGR"}
@@ -8,8 +8,15 @@ const PROFILE_HEADER_ROLES = {
8
8
  edit: 'elevated',
9
9
  edit_border: 'border',
10
10
  edit_glyph: 'text',
11
+ title: 'text',
12
+ subtitle: 'muted',
13
+ button: 'action',
11
14
  };
12
- /** Every colour the profile header draws, one per part, with `profile_header.<part>` over each theme role. */
15
+ /**
16
+ * Every colour the profile header draws, one per part, with
17
+ * `profile_header.<part>` over each theme role. The title, the subtitle and
18
+ * the button are what it draws while nobody is signed in.
19
+ */
13
20
  export function profileHeaderColors(theme) {
14
21
  return partColors(theme, 'profile_header', PROFILE_HEADER_ROLES);
15
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"profile-header.js","sourceRoot":"","sources":["../src/profile-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,iHAAiH;AACjH,MAAM,oBAAoB,GAAG;IAC3B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,MAAM;CAC2C,CAAC;AAMhE,8GAA8G;AAC9G,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,OAAO,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,WAAW,CAAC,IAAwB;IAC3C,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IA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C,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAyE;IAEzE,MAAM,KAAK,GAAG,GAAG,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IACpF,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClE,CAAC"}
package/dist/sign-in.d.ts CHANGED
@@ -19,6 +19,9 @@ export type SignInColors = Readonly<Record<SignInPart, string>>;
19
19
  * Every colour the sign-in block draws, one per part, with `sign_in.<part>` as
20
20
  * the escape hatch over each theme role. The words on a solid button are
21
21
  * whichever of ink and paper stands out on it.
22
+ *
23
+ * @deprecated The sign-in block is retired: no draft places it, and only a
24
+ * Release published before still carries it. Kept until the next major.
22
25
  */
23
26
  export declare function signInColors(theme: ThemeStyle): SignInColors;
24
27
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../src/sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,gHAAgH;AAChH,QAAA,MAAM,aAAa;;;;;;;;;;;;CAY4C,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;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAE5D"}
1
+ {"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../src/sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,gHAAgH;AAChH,QAAA,MAAM,aAAa;;;;;;;;;;;;CAY4C,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;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAE5D"}
package/dist/sign-in.js CHANGED
@@ -17,6 +17,9 @@ const SIGN_IN_ROLES = {
17
17
  * Every colour the sign-in block draws, one per part, with `sign_in.<part>` as
18
18
  * the escape hatch over each theme role. The words on a solid button are
19
19
  * whichever of ink and paper stands out on it.
20
+ *
21
+ * @deprecated The sign-in block is retired: no draft places it, and only a
22
+ * Release published before still carries it. Kept until the next major.
20
23
  */
21
24
  export function signInColors(theme) {
22
25
  return partColors(theme, 'sign_in', SIGN_IN_ROLES);
@@ -1 +1 @@
1
- {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../src/sign-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gHAAgH;AAChH,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,SAAS;IAChB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;CACgD,CAAC;AAMhE;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../src/sign-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gHAAgH;AAChH,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,SAAS;IAChB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;CACgD,CAAC;AAMhE;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ThemeStyle } from '@shoplix-ai/sdui-schema';
1
+ import { type LocaleCode, type SearchBarBlock, type StoreHeaderBlock, type ThemeStyle } from '@shoplix-ai/sdui-schema';
2
2
  /** The parts of the store header, each with the theme role it draws unless a component token names another. */
3
3
  declare const STORE_HEADER_ROLES: {
4
4
  readonly bar: "elevated";
@@ -13,22 +13,65 @@ declare const STORE_HEADER_ROLES: {
13
13
  readonly drawer_ink: "text";
14
14
  readonly drawer_subtle: "subtle";
15
15
  readonly drawer_divider: "border";
16
- readonly scrim: "overlay";
16
+ readonly drawer_group: "sunken";
17
17
  };
18
- export type StoreHeaderPart = keyof typeof STORE_HEADER_ROLES;
18
+ export type StoreHeaderPart = keyof typeof STORE_HEADER_ROLES | 'scrim';
19
19
  export type StoreHeaderColors = Readonly<Record<StoreHeaderPart, string>>;
20
+ /** The dim behind the open menu: dark, the way the Cart Drawer dims, and no theme role, since a theme's overlay is a wash. */
21
+ export declare const STORE_MENU_DIM = "rgba(0, 0, 0, 0.35)";
20
22
  /**
21
23
  * Every colour the store header draws, one per part, with `store_header.<part>`
22
- * as the escape hatch over each theme role. The phone's header and its web twin
23
- * read this one table, so the chrome a merchant sees on the canvas and the
24
- * chrome their shopper sees cannot disagree.
24
+ * as the escape hatch over each theme role, and over the dark dim behind the
25
+ * open menu. The phone's header and its web twin read this one table, so the
26
+ * chrome a merchant sees on the canvas and the chrome their shopper sees cannot
27
+ * disagree.
25
28
  */
26
29
  export declare function storeHeaderColors(theme: ThemeStyle): StoreHeaderColors;
30
+ /** How tall a row of the open menu stands and how large its words are, in points. */
31
+ export interface StoreMenuMetrics {
32
+ readonly rowHeight: number;
33
+ readonly labelSize: number;
34
+ }
35
+ /** The menu's rows as the theme sizes them, 48 points tall with 16 point words where it names nothing. */
36
+ export declare function storeMenuMetrics(theme: ThemeStyle): StoreMenuMetrics;
27
37
  /**
28
38
  * What the cart badge writes, or nothing at all for an empty cart. Both readers
29
39
  * cap it the same way, so a merchant never sees a count on the canvas the phone
30
40
  * would not draw.
31
41
  */
32
42
  export declare function cartBadgeCount(totalQuantity: number): string | null;
43
+ /** What the search entry holds in one language: the lead, the hints it types, its steady label, and the line for the letters typed so far. */
44
+ export interface SearchEntryWords {
45
+ readonly lead: string;
46
+ readonly hints: readonly string[];
47
+ readonly label: string;
48
+ readonly line: (typed: string) => string;
49
+ }
50
+ type SearchBarSettings = SearchBarBlock['props'];
51
+ type SearchEntrySettings = Pick<StoreHeaderBlock['props'], 'searchPlaceholder' | 'typeSearchHints' | 'searchHintLead' | 'searchHints'>;
52
+ /**
53
+ * The search bar's words in the buyer's language, the one rule the phone and
54
+ * its canvas twin read. Typing off, or no hint in the buyer's language or the
55
+ * Shop's default, holds the placeholder.
56
+ */
57
+ export declare function searchBarWords(settings: Pick<SearchBarSettings, 'placeholder' | 'typeHints' | 'hintLead' | 'hints'>, language: LocaleCode, defaultLanguage: LocaleCode): SearchEntryWords;
58
+ /** The store header's search entry in the buyer's language, read by the rule of the search bar. */
59
+ export declare function searchEntryWords(settings: SearchEntrySettings, language: LocaleCode, defaultLanguage: LocaleCode): SearchEntryWords;
60
+ /** The box the search entry stands in: its size and corner in points, its colours, its band. */
61
+ export interface SearchEntryBox {
62
+ readonly height: number;
63
+ readonly radius: number;
64
+ readonly surface: string;
65
+ readonly stroke: string;
66
+ readonly ink: string;
67
+ readonly band: string;
68
+ }
69
+ /**
70
+ * The search entry's box as the merchant set it on the search bar, and the
71
+ * entry the store header drew for every part they left out, so a search moved
72
+ * out of the header draws as it drew there, on the header's band. The
73
+ * header's entry is this box with nothing set.
74
+ */
75
+ export declare function searchEntryBox(theme: ThemeStyle, settings?: Pick<SearchBarSettings, 'height' | 'radius' | 'surface' | 'stroke' | 'ink'>): SearchEntryBox;
33
76
  export {};
34
77
  //# sourceMappingURL=store-header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-header.d.ts","sourceRoot":"","sources":["../src/store-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,+GAA+G;AAC/G,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;CAcuC,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;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE;AAKD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnE"}
1
+ {"version":3,"file":"store-header.d.ts","sourceRoot":"","sources":["../src/store-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEf,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAMjC,+GAA+G;AAC/G,QAAA,MAAM,kBAAkB;;;;;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AAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,gBAAgB,CAelB;AAED,mGAAmG;AACnG,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,gBAAgB,CAElB;AAED,gGAAgG;AAChG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,QAAQ,GAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAM,GACzF,cAAc,CAUhB"}
@@ -1,4 +1,8 @@
1
+ import { componentTokenValue, SEARCH_BAR_DEFAULTS, searchBarOfHeader, } from '@shoplix-ai/sdui-schema';
2
+ import { colorChoiceOf } from './color-choice.js';
3
+ import { readable } from './locale.js';
1
4
  import { partColors } from './part-colors.js';
5
+ import { platformWords } from './words.js';
2
6
  /** The parts of the store header, each with the theme role it draws unless a component token names another. */
3
7
  const STORE_HEADER_ROLES = {
4
8
  bar: 'elevated',
@@ -13,16 +17,29 @@ const STORE_HEADER_ROLES = {
13
17
  drawer_ink: 'text',
14
18
  drawer_subtle: 'subtle',
15
19
  drawer_divider: 'border',
16
- scrim: 'overlay',
20
+ drawer_group: 'sunken',
17
21
  };
22
+ /** The dim behind the open menu: dark, the way the Cart Drawer dims, and no theme role, since a theme's overlay is a wash. */
23
+ export const STORE_MENU_DIM = 'rgba(0, 0, 0, 0.35)';
18
24
  /**
19
25
  * Every colour the store header draws, one per part, with `store_header.<part>`
20
- * as the escape hatch over each theme role. The phone's header and its web twin
21
- * read this one table, so the chrome a merchant sees on the canvas and the
22
- * chrome their shopper sees cannot disagree.
26
+ * as the escape hatch over each theme role, and over the dark dim behind the
27
+ * open menu. The phone's header and its web twin read this one table, so the
28
+ * chrome a merchant sees on the canvas and the chrome their shopper sees cannot
29
+ * disagree.
23
30
  */
24
31
  export function storeHeaderColors(theme) {
25
- return partColors(theme, 'store_header', STORE_HEADER_ROLES);
32
+ return {
33
+ ...partColors(theme, 'store_header', STORE_HEADER_ROLES),
34
+ scrim: componentTokenValue(theme, 'store_header.scrim', STORE_MENU_DIM),
35
+ };
36
+ }
37
+ /** The menu's rows as the theme sizes them, 48 points tall with 16 point words where it names nothing. */
38
+ export function storeMenuMetrics(theme) {
39
+ return {
40
+ rowHeight: componentTokenValue(theme, 'store_header.menu_row_height', 48),
41
+ labelSize: componentTokenValue(theme, 'store_header.menu_text_size', 16),
42
+ };
26
43
  }
27
44
  /** Past this the badge stops counting and says so, because a wider badge covers the glyph under it. */
28
45
  const BADGE_CEILING = 99;
@@ -36,4 +53,41 @@ export function cartBadgeCount(totalQuantity) {
36
53
  return null;
37
54
  return totalQuantity > BADGE_CEILING ? `${BADGE_CEILING}+` : String(totalQuantity);
38
55
  }
56
+ /**
57
+ * The search bar's words in the buyer's language, the one rule the phone and
58
+ * its canvas twin read. Typing off, or no hint in the buyer's language or the
59
+ * Shop's default, holds the placeholder.
60
+ */
61
+ export function searchBarWords(settings, language, defaultLanguage) {
62
+ const placeholder = platformWords(language, defaultLanguage).merchantOr(settings.placeholder, 'search.placeholder');
63
+ const wordsOf = (text) => text === undefined ? '' : (readable(text, language, defaultLanguage) ?? '').trim();
64
+ const lead = wordsOf(settings.hintLead);
65
+ const line = (typed) => (lead === '' ? typed : typed === '' ? lead : `${lead} ${typed}`);
66
+ const hints = settings.typeHints === true
67
+ ? (settings.hints ?? []).map((hint) => wordsOf(hint.text)).filter((hint) => hint !== '')
68
+ : [];
69
+ const first = hints[0];
70
+ return { lead, hints, label: first === undefined ? placeholder : line(first), line };
71
+ }
72
+ /** The store header's search entry in the buyer's language, read by the rule of the search bar. */
73
+ export function searchEntryWords(settings, language, defaultLanguage) {
74
+ return searchBarWords(searchBarOfHeader(settings), language, defaultLanguage);
75
+ }
76
+ /**
77
+ * The search entry's box as the merchant set it on the search bar, and the
78
+ * entry the store header drew for every part they left out, so a search moved
79
+ * out of the header draws as it drew there, on the header's band. The
80
+ * header's entry is this box with nothing set.
81
+ */
82
+ export function searchEntryBox(theme, settings = {}) {
83
+ const colors = storeHeaderColors(theme);
84
+ return {
85
+ height: settings.height ?? SEARCH_BAR_DEFAULTS.height,
86
+ radius: settings.radius ?? SEARCH_BAR_DEFAULTS.radius,
87
+ surface: colorChoiceOf(theme, settings.surface) ?? colors.search,
88
+ stroke: colorChoiceOf(theme, settings.stroke) ?? colors.search_border,
89
+ ink: colorChoiceOf(theme, settings.ink) ?? colors.search_ink,
90
+ band: colors.bar,
91
+ };
92
+ }
39
93
  //# sourceMappingURL=store-header.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-header.js","sourceRoot":"","sources":["../src/store-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,+GAA+G;AAC/G,MAAM,kBAAkB,GAAG;IACzB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,UAAU;IAClB,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,QAAQ;IACvB,cAAc,EAAE,QAAQ;IACxB,KAAK,EAAE,SAAS;CAC6C,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAA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MAAM,CAAC,MAAM;QAChE,MAAM,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,aAAa;QACrE,GAAG,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,UAAU;QAC5D,IAAI,EAAE,MAAM,CAAC,GAAG;KACjB,CAAC;AACJ,CAAC"}
@@ -11,4 +11,18 @@ export declare function effectiveSelections(product: ProductDisplay, chosen: Opt
11
11
  export declare function selectedVariant(product: ProductDisplay, selections: OptionSelections): ProductVariantDisplay | null;
12
12
  /** Whether choosing this value, keeping the other choices, can still be bought. */
13
13
  export declare function valueAvailable(product: ProductDisplay, selections: OptionSelections, optionName: string, value: string): boolean;
14
+ /**
15
+ * The values of one option that any variant offers together with the choices
16
+ * made in the options before it: a later option shows only what the earlier
17
+ * ones leave possible, so a weight the chosen box never comes in is not drawn.
18
+ * The first option shows all its values.
19
+ */
20
+ export declare function valuesAfterEarlierChoices(product: ProductDisplay, selections: OptionSelections, optionName: string): string[];
21
+ /**
22
+ * The choices after the shopper picks one value: theirs where they name a
23
+ * variant for sale, else those of the first variant for sale that keeps the
24
+ * pick and every choice before it, so a pick never leaves the box without a
25
+ * variant while one can be bought.
26
+ */
27
+ export declare function choicesAfterPick(product: ProductDisplay, selections: OptionSelections, optionName: string, value: string): OptionSelections;
14
28
  //# sourceMappingURL=variant-choice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant-choice.d.ts","sourceRoot":"","sources":["../src/variant-choice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB,C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