@shoplix-ai/block-kit 4.6.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 +34 -7
- 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/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 +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -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/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/dist/words.d.ts +120 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +351 -4
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,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,c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Y,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAClF,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACxF,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,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;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,8 +17,8 @@ export { cartEmptyColors } from './cart-empty.js';
|
|
|
17
17
|
export { cartDiscountCodeColors } from './cart-discount-code.js';
|
|
18
18
|
export { cartSavings, cartSummaryColors } from './cart-summary.js';
|
|
19
19
|
export { checkoutButtonColors } from './checkout-button.js';
|
|
20
|
-
export { heroBannerColors, heroBannerRadius } from './hero-banner.js';
|
|
21
|
-
export { promoBannerColors, promoBannerRadius } from './promo-banner.js';
|
|
20
|
+
export { heroBannerColors, heroBannerRadius, heroPageLabel } from './hero-banner.js';
|
|
21
|
+
export { promoBannerColors, promoBannerRadius, promoCardLabel, promoSetLabel, } from './promo-banner.js';
|
|
22
22
|
export { sectionHeaderColors } from './section-header.js';
|
|
23
23
|
export { featureStripColors } from './feature-strip.js';
|
|
24
24
|
export { brandRailColors } from './brand-rail.js';
|
|
@@ -27,9 +27,14 @@ export { defaultSelections, effectiveSelections, selectedVariant, valueAvailable
|
|
|
27
27
|
export { announcementBarColors } from './announcement-bar.js';
|
|
28
28
|
export { aroundAmount, shippingProgress, shippingProgressColors } from './shipping-progress.js';
|
|
29
29
|
export { cartBadgeCount, storeHeaderColors } from './store-header.js';
|
|
30
|
+
export { signInColors } from './sign-in.js';
|
|
31
|
+
export { customerInitials, profileHeaderColors } from './profile-header.js';
|
|
32
|
+
export { accountLinkRows, accountLinksColors, accountLinksRadius } from './account-links.js';
|
|
33
|
+
export { addressCardOf, addressControlsOf, addressListColors, addressListRadius, } from './address-list.js';
|
|
34
|
+
export { SHIPMENT_STEPS, fulfillmentEventWord, fulfillmentPillOf, orderColors, orderDay, orderMoneyRows, orderPillColors, orderRadius, orderTime, paymentPillOf, shipmentStepReached, shipmentWord, } from './orders.js';
|
|
30
35
|
export { readableInk } from './readable.js';
|
|
31
36
|
export { derivedMoney, derivedPrice, discountPercent, formatMoney, moneyAmount, moneyParts, moneyText, } from './money.js';
|
|
32
37
|
export { imageSourceFor } from './renditions.js';
|
|
33
38
|
export { localize, pickLocale, textDirection } from './locale.js';
|
|
34
|
-
export { CATALOG_LANGUAGES, WORD_KEYS, cartItemCount, platformWords } from './words.js';
|
|
39
|
+
export { CATALOG_LANGUAGES, DELETION_FACTS, WORD_KEYS, cartItemCount, platformWords, } from './words.js';
|
|
35
40
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts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M,eAAe,CAAC;AAW5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
|
package/dist/navigation.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ import type { Action } from '@shoplix-ai/sdui-schema';
|
|
|
3
3
|
* The only way a renderer moves the buyer, and it is as closed as the
|
|
4
4
|
* capability set: the action the document itself carries, and the implicit
|
|
5
5
|
* taps a block owns by its own kind — a card opening its entity, a search bar
|
|
6
|
-
* opening search
|
|
7
|
-
*
|
|
6
|
+
* opening search, a row of the orders opening its order, the order opening
|
|
7
|
+
* the page Shopify hosts for it, a saved address opening the Address Sheet on
|
|
8
|
+
* itself. A renderer never sees a route, never a screen the document did not
|
|
9
|
+
* name, and never the router that owns them. The last three are absent on a
|
|
10
|
+
* host written before them, so a renderer calls each only where it is there.
|
|
8
11
|
*/
|
|
9
12
|
export interface BlockNavigation {
|
|
10
13
|
readonly run: (action: Action) => void;
|
|
@@ -12,5 +15,8 @@ export interface BlockNavigation {
|
|
|
12
15
|
readonly openCollection: (collectionId: string) => void;
|
|
13
16
|
readonly openSearch: () => void;
|
|
14
17
|
readonly openAccount: () => void;
|
|
18
|
+
readonly openOrder?: (orderId: string) => void;
|
|
19
|
+
readonly openOrderPage?: (url: string) => void;
|
|
20
|
+
readonly openAddress?: (addressId: string) => void;
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=navigation.d.ts.map
|
package/dist/navigation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD"}
|
package/dist/orders.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type DisplayMoney, type FulfillmentDisplay, type FulfillmentEventStatus, type FulfillmentStatus, type LocaleCode, type OrderDisplay, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import type { WordKey } from './words.js';
|
|
3
|
+
/**
|
|
4
|
+
* How a pill reads at a glance: a state still moving, one that ended well,
|
|
5
|
+
* one that ended otherwise, and one that says nothing either way.
|
|
6
|
+
*/
|
|
7
|
+
export type OrderPillTone = 'progress' | 'done' | 'stopped' | 'quiet';
|
|
8
|
+
/** One pill as both renderers draw it: the platform's word for the state, and its tone. */
|
|
9
|
+
export interface OrderPill {
|
|
10
|
+
readonly word: WordKey;
|
|
11
|
+
readonly tone: OrderPillTone;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Where the shipping of an order stands. A cancelled order says so whatever
|
|
15
|
+
* its shipping state was. Delivered is read off the shipments, so only the
|
|
16
|
+
* opened order can say it: a row of the list carries no shipment.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fulfillmentPillOf(order: OrderDisplay): OrderPill;
|
|
19
|
+
/** Where the payment of an order stands. */
|
|
20
|
+
export declare function paymentPillOf(order: OrderDisplay): OrderPill;
|
|
21
|
+
export interface OrderPillColors {
|
|
22
|
+
readonly ink: string;
|
|
23
|
+
readonly surface: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The ink and the surface of a pill. No theme role is a red and none is a
|
|
27
|
+
* tint, so a stopped pill draws the warning role on the sunken well until a
|
|
28
|
+
* design names `order.pill_<tone>` and `order.pill_<tone>_surface`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function orderPillColors(theme: ThemeStyle, tone: OrderPillTone): OrderPillColors;
|
|
31
|
+
/** The four steps of the progress rail, in the order a parcel passes them. */
|
|
32
|
+
export declare const SHIPMENT_STEPS: readonly ["confirmed", "in_transit", "out_for_delivery", "delivered"];
|
|
33
|
+
export type ShipmentStep = (typeof SHIPMENT_STEPS)[number];
|
|
34
|
+
/**
|
|
35
|
+
* The furthest step of the rail a shipment has reached, by the events the
|
|
36
|
+
* carrier told Shopify. A shipment Shopify holds with no event yet stands on
|
|
37
|
+
* the first step; one that was cancelled or failed stands on none.
|
|
38
|
+
*/
|
|
39
|
+
export declare function shipmentStepReached(shipment: FulfillmentDisplay): number;
|
|
40
|
+
/** The platform's word for one step of a shipment's way, which is also the word under a step of the rail. */
|
|
41
|
+
export declare function fulfillmentEventWord(status: FulfillmentEventStatus): WordKey;
|
|
42
|
+
/** The platform's word for the state of one shipment. */
|
|
43
|
+
export declare function shipmentWord(status: FulfillmentStatus): WordKey;
|
|
44
|
+
/** One money row of the order summary: the platform's word and Shopify's amount. */
|
|
45
|
+
export interface OrderMoneyRow {
|
|
46
|
+
readonly key: 'subtotal' | 'discount' | 'shipping' | 'tax';
|
|
47
|
+
readonly word: WordKey;
|
|
48
|
+
readonly money: DisplayMoney;
|
|
49
|
+
}
|
|
50
|
+
/** The money rows over the total, in reading order, each only where Shopify wrote it. */
|
|
51
|
+
export declare function orderMoneyRows(order: OrderDisplay): readonly OrderMoneyRow[];
|
|
52
|
+
/** A timestamp as the day a shopper reads, in their language and the phone's own time zone. */
|
|
53
|
+
export declare function orderDay(iso: string, language: LocaleCode, timeZone?: string): string;
|
|
54
|
+
/** A timestamp as a time of day, beside the day a timeline row already names. */
|
|
55
|
+
export declare function orderTime(iso: string, language: LocaleCode, timeZone?: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* The parts the order blocks share, each with the theme role it draws unless a
|
|
58
|
+
* component token names another. The eight blocks read one table, so a design
|
|
59
|
+
* names the stroke of an order card once.
|
|
60
|
+
*/
|
|
61
|
+
declare const ORDER_ROLES: {
|
|
62
|
+
readonly card: "surface";
|
|
63
|
+
readonly border: "border";
|
|
64
|
+
readonly title: "text";
|
|
65
|
+
readonly body: "muted";
|
|
66
|
+
readonly picture: "sunken";
|
|
67
|
+
readonly summary: "elevated";
|
|
68
|
+
readonly rule: "border";
|
|
69
|
+
readonly total: "text";
|
|
70
|
+
readonly rail_done: "text";
|
|
71
|
+
readonly rail_todo: "border";
|
|
72
|
+
readonly rail_dash: "subtle";
|
|
73
|
+
readonly link: "action";
|
|
74
|
+
readonly button: "action";
|
|
75
|
+
readonly chevron: "muted";
|
|
76
|
+
};
|
|
77
|
+
export type OrderPart = keyof typeof ORDER_ROLES;
|
|
78
|
+
export type OrderColors = Readonly<Record<OrderPart, string>>;
|
|
79
|
+
/** Every colour the order blocks draw beside the pills, one per part, with `order.<part>` over each theme role. */
|
|
80
|
+
export declare function orderColors(theme: ThemeStyle): OrderColors;
|
|
81
|
+
/** The corner an order card is cut with: the merchant's own, with `order.radius` over it. */
|
|
82
|
+
export declare function orderRadius(theme: ThemeStyle): number;
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=orders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../src/orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,EAGjB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtE,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B;AAkCD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAOhE;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAE5D;AASD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,eAAe,CAKvF;AAED,8EAA8E;AAC9E,eAAO,MAAM,cAAc,uEAAwE,CAAC;AAEpG,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CA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@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { componentTokenValue, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { partColors } from './part-colors.js';
|
|
3
|
+
const CANCELLED = { word: 'order.cancelled', tone: 'stopped' };
|
|
4
|
+
const DELIVERED = { word: 'order.delivered', tone: 'done' };
|
|
5
|
+
const FULFILLMENT_PILLS = {
|
|
6
|
+
fulfilled: { word: 'order.fulfillment.fulfilled', tone: 'done' },
|
|
7
|
+
in_progress: { word: 'order.fulfillment.in_progress', tone: 'progress' },
|
|
8
|
+
on_hold: { word: 'order.fulfillment.on_hold', tone: 'progress' },
|
|
9
|
+
open: { word: 'order.fulfillment.open', tone: 'progress' },
|
|
10
|
+
partially_fulfilled: { word: 'order.fulfillment.partially_fulfilled', tone: 'progress' },
|
|
11
|
+
pending_fulfillment: { word: 'order.fulfillment.pending_fulfillment', tone: 'progress' },
|
|
12
|
+
restocked: { word: 'order.fulfillment.restocked', tone: 'stopped' },
|
|
13
|
+
scheduled: { word: 'order.fulfillment.scheduled', tone: 'progress' },
|
|
14
|
+
unfulfilled: { word: 'order.fulfillment.unfulfilled', tone: 'progress' },
|
|
15
|
+
};
|
|
16
|
+
const PAYMENT_PILLS = {
|
|
17
|
+
authorized: { word: 'order.payment.authorized', tone: 'progress' },
|
|
18
|
+
expired: { word: 'order.payment.expired', tone: 'stopped' },
|
|
19
|
+
paid: { word: 'order.payment.paid', tone: 'done' },
|
|
20
|
+
partially_paid: { word: 'order.payment.partially_paid', tone: 'progress' },
|
|
21
|
+
partially_refunded: { word: 'order.payment.partially_refunded', tone: 'quiet' },
|
|
22
|
+
pending: { word: 'order.payment.pending', tone: 'progress' },
|
|
23
|
+
refunded: { word: 'order.payment.refunded', tone: 'stopped' },
|
|
24
|
+
voided: { word: 'order.payment.voided', tone: 'stopped' },
|
|
25
|
+
};
|
|
26
|
+
const ARRIVED = new Set(['delivered', 'picked_up']);
|
|
27
|
+
function arrived(shipment) {
|
|
28
|
+
return (shipment.events ?? []).some((event) => ARRIVED.has(event.status));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Where the shipping of an order stands. A cancelled order says so whatever
|
|
32
|
+
* its shipping state was. Delivered is read off the shipments, so only the
|
|
33
|
+
* opened order can say it: a row of the list carries no shipment.
|
|
34
|
+
*/
|
|
35
|
+
export function fulfillmentPillOf(order) {
|
|
36
|
+
if (order.cancelledAt !== undefined)
|
|
37
|
+
return CANCELLED;
|
|
38
|
+
const live = (order.fulfillments ?? []).filter((shipment) => shipment.status === 'success');
|
|
39
|
+
if (order.fulfillmentStatus === 'fulfilled' && live.length > 0 && live.every(arrived)) {
|
|
40
|
+
return DELIVERED;
|
|
41
|
+
}
|
|
42
|
+
return FULFILLMENT_PILLS[order.fulfillmentStatus];
|
|
43
|
+
}
|
|
44
|
+
/** Where the payment of an order stands. */
|
|
45
|
+
export function paymentPillOf(order) {
|
|
46
|
+
return PAYMENT_PILLS[order.financialStatus];
|
|
47
|
+
}
|
|
48
|
+
const PILL_ROLES = {
|
|
49
|
+
progress: 'warning',
|
|
50
|
+
done: 'success',
|
|
51
|
+
stopped: 'warning',
|
|
52
|
+
quiet: 'muted',
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The ink and the surface of a pill. No theme role is a red and none is a
|
|
56
|
+
* tint, so a stopped pill draws the warning role on the sunken well until a
|
|
57
|
+
* design names `order.pill_<tone>` and `order.pill_<tone>_surface`.
|
|
58
|
+
*/
|
|
59
|
+
export function orderPillColors(theme, tone) {
|
|
60
|
+
return {
|
|
61
|
+
ink: componentTokenValue(theme, `order.pill_${tone}`, theme.colors[PILL_ROLES[tone]]),
|
|
62
|
+
surface: componentTokenValue(theme, `order.pill_${tone}_surface`, theme.colors.sunken),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** The four steps of the progress rail, in the order a parcel passes them. */
|
|
66
|
+
export const SHIPMENT_STEPS = ['confirmed', 'in_transit', 'out_for_delivery', 'delivered'];
|
|
67
|
+
const STEP_OF_EVENT = {
|
|
68
|
+
label_purchased: 0,
|
|
69
|
+
label_printed: 0,
|
|
70
|
+
confirmed: 0,
|
|
71
|
+
ready_for_pickup: 0,
|
|
72
|
+
carrier_picked_up: 1,
|
|
73
|
+
in_transit: 1,
|
|
74
|
+
delayed: 1,
|
|
75
|
+
failure: 1,
|
|
76
|
+
out_for_delivery: 2,
|
|
77
|
+
attempted_delivery: 2,
|
|
78
|
+
delivered: 3,
|
|
79
|
+
picked_up: 3,
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The furthest step of the rail a shipment has reached, by the events the
|
|
83
|
+
* carrier told Shopify. A shipment Shopify holds with no event yet stands on
|
|
84
|
+
* the first step; one that was cancelled or failed stands on none.
|
|
85
|
+
*/
|
|
86
|
+
export function shipmentStepReached(shipment) {
|
|
87
|
+
if (shipment.status !== 'success' &&
|
|
88
|
+
shipment.status !== 'open' &&
|
|
89
|
+
shipment.status !== 'pending') {
|
|
90
|
+
return -1;
|
|
91
|
+
}
|
|
92
|
+
return (shipment.events ?? []).reduce((reached, event) => Math.max(reached, STEP_OF_EVENT[event.status]), 0);
|
|
93
|
+
}
|
|
94
|
+
const EVENT_WORDS = {
|
|
95
|
+
attempted_delivery: 'order.event.attempted_delivery',
|
|
96
|
+
carrier_picked_up: 'order.event.carrier_picked_up',
|
|
97
|
+
confirmed: 'order.event.confirmed',
|
|
98
|
+
delayed: 'order.event.delayed',
|
|
99
|
+
delivered: 'order.delivered',
|
|
100
|
+
failure: 'order.event.failure',
|
|
101
|
+
in_transit: 'order.event.in_transit',
|
|
102
|
+
label_printed: 'order.event.label_printed',
|
|
103
|
+
label_purchased: 'order.event.label_purchased',
|
|
104
|
+
out_for_delivery: 'order.event.out_for_delivery',
|
|
105
|
+
picked_up: 'order.event.picked_up',
|
|
106
|
+
ready_for_pickup: 'order.event.ready_for_pickup',
|
|
107
|
+
};
|
|
108
|
+
/** The platform's word for one step of a shipment's way, which is also the word under a step of the rail. */
|
|
109
|
+
export function fulfillmentEventWord(status) {
|
|
110
|
+
return EVENT_WORDS[status];
|
|
111
|
+
}
|
|
112
|
+
const SHIPMENT_WORDS = {
|
|
113
|
+
cancelled: 'order.cancelled',
|
|
114
|
+
error: 'order.shipment_failed',
|
|
115
|
+
failure: 'order.shipment_failed',
|
|
116
|
+
open: 'order.fulfillment.open',
|
|
117
|
+
pending: 'order.fulfillment.pending_fulfillment',
|
|
118
|
+
success: 'order.fulfillment.fulfilled',
|
|
119
|
+
};
|
|
120
|
+
/** The platform's word for the state of one shipment. */
|
|
121
|
+
export function shipmentWord(status) {
|
|
122
|
+
return SHIPMENT_WORDS[status];
|
|
123
|
+
}
|
|
124
|
+
const MONEY_ROWS = [
|
|
125
|
+
['subtotal', 'cart.subtotal'],
|
|
126
|
+
['discount', 'cart.discount'],
|
|
127
|
+
['shipping', 'cart.shipping'],
|
|
128
|
+
['tax', 'order.tax'],
|
|
129
|
+
];
|
|
130
|
+
/** The money rows over the total, in reading order, each only where Shopify wrote it. */
|
|
131
|
+
export function orderMoneyRows(order) {
|
|
132
|
+
const rows = [];
|
|
133
|
+
for (const [key, word] of MONEY_ROWS) {
|
|
134
|
+
const money = order[key];
|
|
135
|
+
if (money !== undefined)
|
|
136
|
+
rows.push({ key, word, money });
|
|
137
|
+
}
|
|
138
|
+
return rows;
|
|
139
|
+
}
|
|
140
|
+
function written(iso, language, options, timeZone) {
|
|
141
|
+
const moment = new Date(iso);
|
|
142
|
+
if (Number.isNaN(moment.getTime()))
|
|
143
|
+
return iso;
|
|
144
|
+
try {
|
|
145
|
+
return new Intl.DateTimeFormat(language, { ...options, timeZone }).format(moment);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return iso;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** A timestamp as the day a shopper reads, in their language and the phone's own time zone. */
|
|
152
|
+
export function orderDay(iso, language, timeZone) {
|
|
153
|
+
return written(iso, language, { year: 'numeric', month: 'short', day: 'numeric' }, timeZone);
|
|
154
|
+
}
|
|
155
|
+
/** A timestamp as a time of day, beside the day a timeline row already names. */
|
|
156
|
+
export function orderTime(iso, language, timeZone) {
|
|
157
|
+
return written(iso, language, { hour: 'numeric', minute: '2-digit' }, timeZone);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The parts the order blocks share, each with the theme role it draws unless a
|
|
161
|
+
* component token names another. The eight blocks read one table, so a design
|
|
162
|
+
* names the stroke of an order card once.
|
|
163
|
+
*/
|
|
164
|
+
const ORDER_ROLES = {
|
|
165
|
+
card: 'surface',
|
|
166
|
+
border: 'border',
|
|
167
|
+
title: 'text',
|
|
168
|
+
body: 'muted',
|
|
169
|
+
picture: 'sunken',
|
|
170
|
+
summary: 'elevated',
|
|
171
|
+
rule: 'border',
|
|
172
|
+
total: 'text',
|
|
173
|
+
rail_done: 'text',
|
|
174
|
+
rail_todo: 'border',
|
|
175
|
+
rail_dash: 'subtle',
|
|
176
|
+
link: 'action',
|
|
177
|
+
button: 'action',
|
|
178
|
+
chevron: 'muted',
|
|
179
|
+
};
|
|
180
|
+
/** Every colour the order blocks draw beside the pills, one per part, with `order.<part>` over each theme role. */
|
|
181
|
+
export function orderColors(theme) {
|
|
182
|
+
return partColors(theme, 'order', ORDER_ROLES);
|
|
183
|
+
}
|
|
184
|
+
/** The corner an order card is cut with: the merchant's own, with `order.radius` over it. */
|
|
185
|
+
export function orderRadius(theme) {
|
|
186
|
+
return componentTokenValue(theme, 'order.radius', theme.radius);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=orders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../src/orders.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAUpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAe9C,MAAM,SAAS,GAAc,EAAE,IAAI,EAAE,iBAAiB,EAAE,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EAAE,OAAO;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,OAAO;CAC6C,CAAC;AAMhE,mHAAmH;AACnH,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CustomerDisplay, ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/** The parts of the profile header, each with the theme role it draws unless a component token names another. */
|
|
3
|
+
declare const PROFILE_HEADER_ROLES: {
|
|
4
|
+
readonly avatar: "sunken";
|
|
5
|
+
readonly initials: "text";
|
|
6
|
+
readonly name: "text";
|
|
7
|
+
readonly email: "muted";
|
|
8
|
+
readonly edit: "elevated";
|
|
9
|
+
readonly edit_border: "border";
|
|
10
|
+
readonly edit_glyph: "text";
|
|
11
|
+
};
|
|
12
|
+
export type ProfileHeaderPart = keyof typeof PROFILE_HEADER_ROLES;
|
|
13
|
+
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. */
|
|
15
|
+
export declare function profileHeaderColors(theme: ThemeStyle): ProfileHeaderColors;
|
|
16
|
+
/**
|
|
17
|
+
* The letters an avatar draws for a shopper: the first of each name they
|
|
18
|
+
* gave, or the first of the display name for one who gave none. A letter is
|
|
19
|
+
* taken whole, so a script with no capitals stands as it is written.
|
|
20
|
+
*/
|
|
21
|
+
export declare function customerInitials(customer: Pick<CustomerDisplay, 'firstName' | 'lastName' | 'displayName'>): string;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=profile-header.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { partColors } from './part-colors.js';
|
|
2
|
+
/** The parts of the profile header, each with the theme role it draws unless a component token names another. */
|
|
3
|
+
const PROFILE_HEADER_ROLES = {
|
|
4
|
+
avatar: 'sunken',
|
|
5
|
+
initials: 'text',
|
|
6
|
+
name: 'text',
|
|
7
|
+
email: 'muted',
|
|
8
|
+
edit: 'elevated',
|
|
9
|
+
edit_border: 'border',
|
|
10
|
+
edit_glyph: 'text',
|
|
11
|
+
};
|
|
12
|
+
/** Every colour the profile header draws, one per part, with `profile_header.<part>` over each theme role. */
|
|
13
|
+
export function profileHeaderColors(theme) {
|
|
14
|
+
return partColors(theme, 'profile_header', PROFILE_HEADER_ROLES);
|
|
15
|
+
}
|
|
16
|
+
function firstLetter(word) {
|
|
17
|
+
const [letter] = Array.from((word ?? '').trim());
|
|
18
|
+
return letter === undefined ? '' : letter.toLocaleUpperCase();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The letters an avatar draws for a shopper: the first of each name they
|
|
22
|
+
* gave, or the first of the display name for one who gave none. A letter is
|
|
23
|
+
* taken whole, so a script with no capitals stands as it is written.
|
|
24
|
+
*/
|
|
25
|
+
export function customerInitials(customer) {
|
|
26
|
+
const named = `${firstLetter(customer.firstName)}${firstLetter(customer.lastName)}`;
|
|
27
|
+
return named === '' ? firstLetter(customer.displayName) : named;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=profile-header.js.map
|
|
@@ -0,0 +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,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,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/promo-banner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
1
|
+
import { type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
2
|
/** The parts of a promo card, each with the theme role it draws unless a component token names another. */
|
|
3
3
|
declare const PROMO_BANNER_ROLES: {
|
|
4
4
|
readonly artwork: "sunken";
|
|
@@ -20,5 +20,15 @@ export declare function promoBannerColors(theme: ThemeStyle): PromoBannerColors;
|
|
|
20
20
|
* softer than its cards.
|
|
21
21
|
*/
|
|
22
22
|
export declare function promoBannerRadius(theme: ThemeStyle): number;
|
|
23
|
+
/** How many promotions a banner stacks, in the form the buyer's language counts them in. */
|
|
24
|
+
export declare function promoSetLabel(cards: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
|
|
25
|
+
/**
|
|
26
|
+
* The name a screen reader reads for one promo card. A card in a set of more
|
|
27
|
+
* than one says which of how many it is, beside the merchant's own words where
|
|
28
|
+
* they wrote any and in place of them where they wrote none; a card standing
|
|
29
|
+
* alone is its words, or the platform's word for a promotion. The merchant's
|
|
30
|
+
* words go in last, so text of theirs that looks like a slot stays as written.
|
|
31
|
+
*/
|
|
32
|
+
export declare function promoCardLabel(merchantLabel: string, cardIndex: number, cards: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
|
|
23
33
|
export {};
|
|
24
34
|
//# sourceMappingURL=promo-banner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promo-banner.d.ts","sourceRoot":"","sources":["../src/promo-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"promo-banner.d.ts","sourceRoot":"","sources":["../src/promo-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIhG,2GAA2G;AAC3G,QAAA,MAAM,kBAAkB;;;;;CAKuC,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;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,MAAM,CAUR"}
|
package/dist/promo-banner.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { componentTokenValue } from '@shoplix-ai/sdui-schema';
|
|
2
2
|
import { partColors } from './part-colors.js';
|
|
3
|
+
import { countedWord, platformWords } from './words.js';
|
|
3
4
|
/** The parts of a promo card, each with the theme role it draws unless a component token names another. */
|
|
4
5
|
const PROMO_BANNER_ROLES = {
|
|
5
6
|
artwork: 'sunken',
|
|
@@ -23,4 +24,27 @@ export function promoBannerColors(theme) {
|
|
|
23
24
|
export function promoBannerRadius(theme) {
|
|
24
25
|
return componentTokenValue(theme, 'promo_banner.radius', theme.radius);
|
|
25
26
|
}
|
|
27
|
+
/** How many promotions a banner stacks, in the form the buyer's language counts them in. */
|
|
28
|
+
export function promoSetLabel(cards, language, defaultLanguage) {
|
|
29
|
+
return countedWord('promo.cards', cards, language, defaultLanguage);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The name a screen reader reads for one promo card. A card in a set of more
|
|
33
|
+
* than one says which of how many it is, beside the merchant's own words where
|
|
34
|
+
* they wrote any and in place of them where they wrote none; a card standing
|
|
35
|
+
* alone is its words, or the platform's word for a promotion. The merchant's
|
|
36
|
+
* words go in last, so text of theirs that looks like a slot stays as written.
|
|
37
|
+
*/
|
|
38
|
+
export function promoCardLabel(merchantLabel, cardIndex, cards, language, defaultLanguage) {
|
|
39
|
+
const words = platformWords(language, defaultLanguage);
|
|
40
|
+
if (cards <= 1)
|
|
41
|
+
return merchantLabel === '' ? words.own('promo.promotion') : merchantLabel;
|
|
42
|
+
const slots = {
|
|
43
|
+
position: String(cardIndex + 1),
|
|
44
|
+
count: String(cards),
|
|
45
|
+
label: merchantLabel,
|
|
46
|
+
};
|
|
47
|
+
const pattern = words.own(merchantLabel === '' ? 'promo.card_of' : 'promo.card_named');
|
|
48
|
+
return pattern.replace(/\{(position|count|label)\}/g, (_slot, name) => slots[name]);
|
|
49
|
+
}
|
|
26
50
|
//# sourceMappingURL=promo-banner.js.map
|
package/dist/promo-banner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promo-banner.js","sourceRoot":"","sources":["../src/promo-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"promo-banner.js","sourceRoot":"","sources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,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,aAAa;KACrB,CAAC;IACF,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACvF,OAAO,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,CAAC;AAC/F,CAAC"}
|
package/dist/section-header.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the section header, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. The collection heading draws the title part
|
|
5
|
+
* alone.
|
|
6
|
+
*/
|
|
3
7
|
declare const SECTION_HEADER_ROLES: {
|
|
4
8
|
readonly title: "text";
|
|
5
9
|
readonly link: "action";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-header.d.ts","sourceRoot":"","sources":["../src/section-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D
|
|
1
|
+
{"version":3,"file":"section-header.d.ts","sourceRoot":"","sources":["../src/section-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;;;GAIG;AACH,QAAA,MAAM,oBAAoB;;;CAGqC,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;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAE1E"}
|
package/dist/section-header.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { partColors } from './part-colors.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the section header, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. The collection heading draws the title part
|
|
5
|
+
* alone.
|
|
6
|
+
*/
|
|
3
7
|
const SECTION_HEADER_ROLES = {
|
|
4
8
|
title: 'text',
|
|
5
9
|
link: 'action',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-header.js","sourceRoot":"","sources":["../src/section-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"section-header.js","sourceRoot":"","sources":["../src/section-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,oBAAoB,GAAG;IAC3B,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;CAC+C,CAAC;AAMhE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,OAAO,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/** The parts of the sign-in block, each with the theme role it draws unless a component token names another. */
|
|
3
|
+
declare const SIGN_IN_ROLES: {
|
|
4
|
+
readonly title: "text";
|
|
5
|
+
readonly subtitle: "muted";
|
|
6
|
+
readonly label: "text";
|
|
7
|
+
readonly field: "surface";
|
|
8
|
+
readonly field_border: "border";
|
|
9
|
+
readonly input: "text";
|
|
10
|
+
readonly placeholder: "subtle";
|
|
11
|
+
readonly error: "warning";
|
|
12
|
+
readonly button: "action";
|
|
13
|
+
readonly note: "muted";
|
|
14
|
+
readonly terms: "text";
|
|
15
|
+
};
|
|
16
|
+
export type SignInPart = keyof typeof SIGN_IN_ROLES;
|
|
17
|
+
export type SignInColors = Readonly<Record<SignInPart, string>>;
|
|
18
|
+
/**
|
|
19
|
+
* Every colour the sign-in block draws, one per part, with `sign_in.<part>` as
|
|
20
|
+
* the escape hatch over each theme role. The words on a solid button are
|
|
21
|
+
* whichever of ink and paper stands out on it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function signInColors(theme: ThemeStyle): SignInColors;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=sign-in.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/sign-in.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { partColors } from './part-colors.js';
|
|
2
|
+
/** The parts of the sign-in block, each with the theme role it draws unless a component token names another. */
|
|
3
|
+
const SIGN_IN_ROLES = {
|
|
4
|
+
title: 'text',
|
|
5
|
+
subtitle: 'muted',
|
|
6
|
+
label: 'text',
|
|
7
|
+
field: 'surface',
|
|
8
|
+
field_border: 'border',
|
|
9
|
+
input: 'text',
|
|
10
|
+
placeholder: 'subtle',
|
|
11
|
+
error: 'warning',
|
|
12
|
+
button: 'action',
|
|
13
|
+
note: 'muted',
|
|
14
|
+
terms: 'text',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Every colour the sign-in block draws, one per part, with `sign_in.<part>` as
|
|
18
|
+
* the escape hatch over each theme role. The words on a solid button are
|
|
19
|
+
* whichever of ink and paper stands out on it.
|
|
20
|
+
*/
|
|
21
|
+
export function signInColors(theme) {
|
|
22
|
+
return partColors(theme, 'sign_in', SIGN_IN_ROLES);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sign-in.js.map
|
|
@@ -0,0 +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"}
|
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 = "
|
|
8
|
-
export declare const CONTRACT_MAJOR =
|
|
7
|
+
export declare const CONTRACT_VERSION = "5.0.0";
|
|
8
|
+
export declare const CONTRACT_MAJOR = 5;
|
|
9
9
|
//# sourceMappingURL=version.d.ts.map
|