@vectoriox/iox-ui 5.132.0 → 5.134.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/commerce-core/index.d.ts +12 -1
- package/composite-core/index.d.ts +44 -22
- package/design-core/index.d.ts +436 -35
- package/domain-core/index.d.ts +353 -0
- package/domain-core/package.json +3 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +118 -62
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +13974 -12036
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs +288 -2
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +290 -16
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1419 -379
- package/harness-core/index.d.ts +6 -1
- package/index.d.ts +139 -10
- package/mail-core/index.d.ts +315 -39
- package/package.json +5 -1
- package/src/actions-core/element-actions.ts +2 -0
- package/src/assist-core/page-sections.ts +7 -37
- package/src/commerce-core/shop-display.ts +21 -0
- package/src/composite-core/consent.ts +6 -2
- package/src/composite-core/shop-runtime.ts +47 -3
- package/src/composite-core/shop.ts +76 -57
- package/src/design-core/design-settings.ts +16 -0
- package/src/design-core/design-token.model.ts +7 -1
- package/src/design-core/flavor-spec.generated.ts +374 -35
- package/src/design-core/flavor-tokens.ts +12 -1
- package/src/design-core/header-behaviour.ts +32 -0
- package/src/design-core/motion-language.ts +115 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +3 -0
- package/src/domain-core/domain-vocabulary.ts +125 -0
- package/src/domain-core/domain-wire.ts +95 -0
- package/src/domain-core/org-path-redirect.ts +105 -0
- package/src/domain-core/public-api.ts +12 -0
- package/src/domain-core/web-domain.ts +251 -0
- package/src/generation-core/carry-fill.ts +36 -0
- package/src/generation-core/carry.ts +398 -0
- package/src/generation-core/check-carry.ts +216 -0
- package/src/generation-core/check-layout.ts +71 -5
- package/src/generation-core/compose-layout.ts +187 -28
- package/src/generation-core/compose-site.ts +154 -31
- package/src/generation-core/entrances.ts +66 -10
- package/src/generation-core/header-edit.ts +299 -0
- package/src/generation-core/header-mix.ts +64 -5
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +20 -1
- package/src/generation-core/layout-space.ts +4 -4
- package/src/generation-core/layout-wire.ts +36 -1
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/public-api.ts +7 -0
- package/src/generation-core/redesign-additions.ts +273 -0
- package/src/generation-core/redesign-run.ts +364 -0
- package/src/generation-core/refit-page.ts +151 -0
- package/src/generation-core/section-stamp.ts +4 -4
- package/src/generation-core/shop-plan.ts +15 -0
- package/src/generation-core/site-build-run.ts +20 -3
- package/src/generation-core/site-spec.generated.ts +194 -94
- package/src/generation-core/site-tree.ts +19 -5
- package/src/generation-core/validate-site-plan.ts +37 -3
- package/src/harness-core/motion.ts +13 -3
- package/src/harness-core/starting-design.ts +1 -1
- package/src/mail-core/mail-domain.ts +305 -0
- package/src/mail-core/mail-standing.ts +58 -0
- package/src/mail-core/mail-vocabulary.ts +3 -0
- package/src/mail-core/mail-wire.ts +70 -1
- package/src/mail-core/public-api.ts +6 -1
- package/styles/iox-design.css +44 -2
|
@@ -89,6 +89,11 @@ export const SHOP_UNUSED_ATTRIBUTE = 'data-iox-shop-unused';
|
|
|
89
89
|
export const SHOP_ADDED_ATTRIBUTE = 'data-iox-added';
|
|
90
90
|
/** An empty bag: on the cart button (its count hides) and the drawer (its lines, summary and Check out hide). */
|
|
91
91
|
export const CART_EMPTY_ATTRIBUTE = 'data-iox-cart-empty';
|
|
92
|
+
/** client-engine#23: an empty bag while this browser holds an unpaid order — the drawer offers it (its Check out reads
|
|
93
|
+
* "Continue to payment", its empty words name the order). Only a live site's host sets it. */
|
|
94
|
+
export const CART_WAITING_ATTRIBUTE = 'data-iox-cart-waiting';
|
|
95
|
+
/** The words a part had before the runtime swapped them (restored when the swap ends). */
|
|
96
|
+
export const SHOP_REST_WORDS_ATTRIBUTE = 'data-iox-rest-words';
|
|
92
97
|
/** A cart line's id (`cartLineId`) on its line element. */
|
|
93
98
|
export const CART_LINE_ATTRIBUTE = 'data-iox-line-id';
|
|
94
99
|
/** The count the runtime adds to the drawer's title ("Your bag (2)"). */
|
|
@@ -201,33 +206,42 @@ enum Style {
|
|
|
201
206
|
Title = 'h3',
|
|
202
207
|
}
|
|
203
208
|
|
|
204
|
-
/** The words a fresh recipe shows
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
209
|
+
/** The words a fresh recipe shows, in the site's language (vectoriox/iox-ui#100 — a Hebrew store's bag, buttons and drawer
|
|
210
|
+
* speak Hebrew, as its header does). The sample product's own words (board 10's vase) are the runtime's to replace. */
|
|
211
|
+
export function shopRecipeWords(lang: string | null | undefined = 'en') {
|
|
212
|
+
const w = (word: ShopWord, fill: Readonly<Record<string, string | number>> = {}) => shopWord(word, lang, fill);
|
|
213
|
+
return Object.freeze({
|
|
214
|
+
price: '₪240.00',
|
|
215
|
+
compareAt: '₪280.00',
|
|
216
|
+
option: 'Glaze — Sand',
|
|
217
|
+
value: '32 cm',
|
|
218
|
+
note: 'Charcoal is sold out',
|
|
219
|
+
quantity: '1',
|
|
220
|
+
add: w(ShopWord.AddToCart),
|
|
221
|
+
added: w(ShopWord.Added),
|
|
222
|
+
buyNow: w(ShopWord.BuyNow),
|
|
223
|
+
cart: w(ShopWord.Cart),
|
|
224
|
+
count: '2',
|
|
225
|
+
drawer: w(ShopWord.YourBag),
|
|
226
|
+
close: w(ShopWord.Close),
|
|
227
|
+
lineTitle: 'Tall speckled vase',
|
|
228
|
+
lineVariant: 'Sand · 32 cm',
|
|
229
|
+
lineTotal: '₪240.00',
|
|
230
|
+
remove: w(ShopWord.RemoveLine),
|
|
231
|
+
empty: w(ShopWord.EmptyBag),
|
|
232
|
+
shippingNote: w(ShopWord.FreeShippingGap, { amount: '₪40.00' }),
|
|
233
|
+
subtotalLabel: w(ShopWord.Subtotal),
|
|
234
|
+
subtotal: '₪360.00',
|
|
235
|
+
vatNote: w(ShopWord.VatNote),
|
|
236
|
+
checkout: w(ShopWord.CheckOut),
|
|
237
|
+
keepShopping: w(ShopWord.KeepShopping),
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export type ShopRecipeWords = ReturnType<typeof shopRecipeWords>;
|
|
242
|
+
|
|
243
|
+
/** The English words (the palette's when it has no page language). */
|
|
244
|
+
export const SHOP_RECIPE_WORDS: ShopRecipeWords = shopRecipeWords('en');
|
|
231
245
|
|
|
232
246
|
export const SHOP_LABELS = Object.freeze({
|
|
233
247
|
price: 'Price', variants: 'Options', quantity: 'Quantity', add: 'Add to cart', buyNow: 'Buy now', cartButton: 'Cart button', cartDrawer: 'Cart drawer',
|
|
@@ -302,33 +316,36 @@ export function buildQuantityRecipe(create: CompositeNodeFactory, compact = fals
|
|
|
302
316
|
}
|
|
303
317
|
|
|
304
318
|
/** Add to cart: presses on pointer-down (its element style), then reads "Added ✓" in place for ADDED_HOLD_MS. */
|
|
305
|
-
export function buildAddToCartRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
319
|
+
export function buildAddToCartRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
320
|
+
const t = shopRecipeWords(lang);
|
|
306
321
|
const root = button(create, 'add', ShopRole.Add, Style.Primary, SHOP_LABELS.add, '',
|
|
307
322
|
{ display: 'inline-grid', alignItems: 'center', justifyItems: 'center', flexGrow: '1', width: 'auto', height: 'auto' });
|
|
308
323
|
root.children = [
|
|
309
|
-
text(create, 'add-label', ShopRole.AddLabel, Style.Label,
|
|
310
|
-
text(create, 'added-label', ShopRole.AddedLabel, Style.Label,
|
|
324
|
+
text(create, 'add-label', ShopRole.AddLabel, Style.Label, t.add, 'Add', STACKED, 'span'),
|
|
325
|
+
text(create, 'added-label', ShopRole.AddedLabel, Style.Label, t.added, 'Added', STACKED, 'span'),
|
|
311
326
|
];
|
|
312
327
|
onClick(root, 'addToCart');
|
|
313
328
|
return root;
|
|
314
329
|
}
|
|
315
330
|
|
|
316
331
|
/** Buy now: straight to checkout with this variant (inert on the canvas). */
|
|
317
|
-
export function buildBuyNowRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
332
|
+
export function buildBuyNowRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
333
|
+
const t = shopRecipeWords(lang);
|
|
318
334
|
const root = button(create, 'buy-now', ShopRole.BuyNow, Style.Secondary, SHOP_LABELS.buyNow, '',
|
|
319
335
|
{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
320
|
-
root.children = [text(create, 'buy-now-label', null, Style.Label,
|
|
336
|
+
root.children = [text(create, 'buy-now-label', null, Style.Label, t.buyNow, 'Text', WORDS, 'span')];
|
|
321
337
|
onClick(root, 'startCheckout');
|
|
322
338
|
return root;
|
|
323
339
|
}
|
|
324
340
|
|
|
325
341
|
/** The bag button with its live count ($cart.count); it opens the page's cart drawer. */
|
|
326
|
-
export function buildCartButtonRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
327
|
-
const
|
|
342
|
+
export function buildCartButtonRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
343
|
+
const t = shopRecipeWords(lang);
|
|
344
|
+
const root = button(create, 'cart-button', ShopRole.CartButton, Style.CartButton, SHOP_LABELS.cartButton, t.cart,
|
|
328
345
|
{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', padding: '6px 6px 6px 6px', position: 'relative' });
|
|
329
346
|
const count = part(create, 'cart-count', Type.Container, ShopRole.CartCount, Style.CartCount, {}, 'Count',
|
|
330
347
|
{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', minHeight: 'var(--iox-cart-count-size)', padding: '0px 4px 0px 4px', position: 'absolute', top: '-5px', right: '-5px' });
|
|
331
|
-
const words = text(create, 'cart-count-text', null, Style.Label,
|
|
348
|
+
const words = text(create, 'cart-count-text', null, Style.Label, t.count, 'Text', { ...WORDS, lineHeight: '1' }, 'span');
|
|
332
349
|
bindSlot(words, 'content', '$cart', 'count');
|
|
333
350
|
count.children = [words];
|
|
334
351
|
root.children = [icon(create, 'cart-icon', 'ph ph-handbag'), count];
|
|
@@ -336,56 +353,57 @@ export function buildCartButtonRecipe(create: CompositeNodeFactory): CompositeNo
|
|
|
336
353
|
}
|
|
337
354
|
|
|
338
355
|
/** One cart line: thumbnail · title, variant, quantity and Remove · line total (board 10). */
|
|
339
|
-
function buildCartLine(create: CompositeNodeFactory): CompositeNode {
|
|
356
|
+
function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords): CompositeNode {
|
|
340
357
|
const line = part(create, 'cart-line', Type.Container, ShopRole.CartLine, Style.CartLine, {}, 'Line',
|
|
341
358
|
{ display: 'grid', gridTemplateColumns: 'var(--iox-cart-thumb-size) minmax(0, 1fr) auto', alignItems: 'start', gap: '12px', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO });
|
|
342
359
|
const image = part(create, 'cart-line-image', Type.Image, ShopRole.CartLineImage, Style.Media, { src: '', alt: '' }, 'Image',
|
|
343
360
|
{ width: 'var(--iox-cart-thumb-size)', height: 'var(--iox-cart-thumb-size)', minHeight: '0px', objectFit: 'cover', aspectRatio: '1 / 1' });
|
|
344
361
|
const info = part(create, 'cart-line-info', Type.Container, null, null, {}, 'Details', { ...COLUMN, gap: '2px', minWidth: '0px' });
|
|
345
|
-
const title = text(create, 'cart-line-title', ShopRole.CartLineTitle, Style.Body,
|
|
346
|
-
const variant = text(create, 'cart-line-variant', ShopRole.CartLineVariant, Style.Small,
|
|
362
|
+
const title = text(create, 'cart-line-title', ShopRole.CartLineTitle, Style.Body, t.lineTitle, 'Title', { ...WORDS, fontWeight: '500' });
|
|
363
|
+
const variant = text(create, 'cart-line-variant', ShopRole.CartLineVariant, Style.Small, t.lineVariant, 'Variant', { ...WORDS, margin: '0px 0px 6px 0px' });
|
|
347
364
|
const actions = part(create, 'cart-line-actions', Type.Container, null, null, {}, 'Actions', { ...ROW, gap: '12px' });
|
|
348
365
|
const remove = button(create, 'cart-line-remove', ShopRole.CartLineRemove, Style.Ghost, 'Remove', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
349
|
-
remove.children = [text(create, 'cart-line-remove-text', null, Style.Small,
|
|
366
|
+
remove.children = [text(create, 'cart-line-remove-text', null, Style.Small, t.remove, 'Text', WORDS, 'span')];
|
|
350
367
|
actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity'), remove];
|
|
351
368
|
info.children = [title, variant, actions];
|
|
352
|
-
const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style.Price,
|
|
369
|
+
const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style.Price, t.lineTotal, 'Line total',
|
|
353
370
|
{ ...WORDS, fontSize: 'var(--iox-size-body)', textAlign: 'end' });
|
|
354
371
|
line.children = [image, info, total];
|
|
355
372
|
return line;
|
|
356
373
|
}
|
|
357
374
|
|
|
358
375
|
/** The cart drawer: a Dialog at the end edge (a bottom sheet on a phone — shared CSS), filled from the PRICED cart. */
|
|
359
|
-
export function buildCartDrawerRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
376
|
+
export function buildCartDrawerRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
377
|
+
const t = shopRecipeWords(lang);
|
|
360
378
|
const drawer = part(create, 'cart-drawer', Type.Dialog, ShopRole.CartDrawer, Style.Dialog, {}, SHOP_LABELS.cartDrawer,
|
|
361
379
|
{ width: '380px', maxWidth: '100%', display: 'flex', flexDirection: 'column', gap: '14px' });
|
|
362
380
|
writeProp(drawer, 'placement', 'end');
|
|
363
381
|
writeProp(drawer, 'closeOnBackdrop', true);
|
|
364
382
|
writeProp(drawer, 'showCloseButton', false);
|
|
365
|
-
writeProp(drawer, 'ariaLabel',
|
|
383
|
+
writeProp(drawer, 'ariaLabel', t.drawer);
|
|
366
384
|
|
|
367
385
|
const head = part(create, 'cart-head', Type.Container, null, null, {}, 'Head', { ...ROW, width: '100%', justifyContent: 'space-between', gap: '12px' });
|
|
368
|
-
const title = part(create, 'cart-title', Type.Heading, ShopRole.CartTitle, Style.Title, { content:
|
|
386
|
+
const title = part(create, 'cart-title', Type.Heading, ShopRole.CartTitle, Style.Title, { content: t.drawer, level: 'h2' }, 'Title', WORDS);
|
|
369
387
|
const close = button(create, 'cart-close', ShopRole.CartClose, Style.Ghost, 'Close', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
370
|
-
close.children = [text(create, 'cart-close-text', null, Style.Small,
|
|
388
|
+
close.children = [text(create, 'cart-close-text', null, Style.Small, t.close, 'Text', WORDS, 'span')];
|
|
371
389
|
onClick(close, 'closeDialog', drawer.id ?? '');
|
|
372
390
|
head.children = [title, close];
|
|
373
391
|
|
|
374
392
|
const lines = part(create, 'cart-lines', Type.Container, ShopRole.CartLines, null, {}, 'Lines', { ...COLUMN, gap: '16px' });
|
|
375
|
-
lines.children = [buildCartLine(create)];
|
|
393
|
+
lines.children = [buildCartLine(create, t)];
|
|
376
394
|
const issues = text(create, 'cart-issues', ShopRole.CartIssues, Style.Small, '', 'Issues', { ...WORDS, color: 'var(--iox-danger)' });
|
|
377
|
-
const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style.Body,
|
|
378
|
-
const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style.CartNote,
|
|
395
|
+
const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style.Body, t.empty, 'Empty');
|
|
396
|
+
const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style.CartNote, t.shippingNote, 'Free delivery note',
|
|
379
397
|
{ width: 'auto', minHeight: 'auto', margin: ZERO });
|
|
380
398
|
const summary = part(create, 'cart-summary', Type.Container, ShopRole.CartSummary, null, {}, 'Subtotal', { ...ROW, width: '100%', justifyContent: 'space-between', gap: '12px' });
|
|
381
|
-
const subtotal = text(create, 'cart-subtotal', ShopRole.CartSubtotal, Style.Body,
|
|
399
|
+
const subtotal = text(create, 'cart-subtotal', ShopRole.CartSubtotal, Style.Body, t.subtotal, 'Amount', { ...WORDS, fontVariantNumeric: 'tabular-nums', fontWeight: '600' }, 'span');
|
|
382
400
|
bindSlot(subtotal, 'content', '$cart', 'subtotal', true);
|
|
383
|
-
summary.children = [text(create, 'cart-subtotal-label', null, Style.Body,
|
|
384
|
-
const vat = text(create, 'cart-vat-note', ShopRole.CartVatNote, Style.Small,
|
|
401
|
+
summary.children = [text(create, 'cart-subtotal-label', null, Style.Body, t.subtotalLabel, 'Label', WORDS, 'span'), subtotal];
|
|
402
|
+
const vat = text(create, 'cart-vat-note', ShopRole.CartVatNote, Style.Small, t.vatNote, 'VAT note');
|
|
385
403
|
const checkout = button(create, 'checkout', ShopRole.Checkout, Style.Primary, 'Check out', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
386
|
-
checkout.children = [text(create, 'checkout-label', null, Style.Label,
|
|
404
|
+
checkout.children = [text(create, 'checkout-label', null, Style.Label, t.checkout, 'Text', WORDS, 'span')];
|
|
387
405
|
const keep = button(create, 'keep-shopping', ShopRole.KeepShopping, Style.Secondary, 'Keep shopping', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
388
|
-
keep.children = [text(create, 'keep-shopping-label', null, Style.Label,
|
|
406
|
+
keep.children = [text(create, 'keep-shopping-label', null, Style.Label, t.keepShopping, 'Text', WORDS, 'span')];
|
|
389
407
|
onClick(keep, 'closeDialog', drawer.id ?? '');
|
|
390
408
|
drawer.children = [head, lines, issues, empty, note, summary, vat, checkout, keep];
|
|
391
409
|
return drawer;
|
|
@@ -402,14 +420,15 @@ export enum ShopRecipe {
|
|
|
402
420
|
CartDrawer = 'cartDrawer',
|
|
403
421
|
}
|
|
404
422
|
|
|
405
|
-
|
|
423
|
+
/** Each recipe in the site's language (`lang` — vectoriox/iox-ui#100; English when the host has none). */
|
|
424
|
+
export const SHOP_RECIPES: Readonly<Record<ShopRecipe, (create: CompositeNodeFactory, lang?: string | null) => CompositeNode>> = Object.freeze({
|
|
406
425
|
[ShopRecipe.Price]: buildPriceRecipe,
|
|
407
426
|
[ShopRecipe.Variants]: buildVariantPickerRecipe,
|
|
408
427
|
[ShopRecipe.Quantity]: (create: CompositeNodeFactory) => buildQuantityRecipe(create),
|
|
409
|
-
[ShopRecipe.Add]: buildAddToCartRecipe,
|
|
410
|
-
[ShopRecipe.BuyNow]: buildBuyNowRecipe,
|
|
411
|
-
[ShopRecipe.CartButton]: buildCartButtonRecipe,
|
|
412
|
-
[ShopRecipe.CartDrawer]: buildCartDrawerRecipe,
|
|
428
|
+
[ShopRecipe.Add]: (create: CompositeNodeFactory, lang?: string | null) => buildAddToCartRecipe(create, lang ?? 'en'),
|
|
429
|
+
[ShopRecipe.BuyNow]: (create: CompositeNodeFactory, lang?: string | null) => buildBuyNowRecipe(create, lang ?? 'en'),
|
|
430
|
+
[ShopRecipe.CartButton]: (create: CompositeNodeFactory, lang?: string | null) => buildCartButtonRecipe(create, lang ?? 'en'),
|
|
431
|
+
[ShopRecipe.CartDrawer]: (create: CompositeNodeFactory, lang?: string | null) => buildCartDrawerRecipe(create, lang ?? 'en'),
|
|
413
432
|
});
|
|
414
433
|
|
|
415
434
|
/** The recipe a site holds ONCE, as a global element after the page (the bag every page opens) — never in a section. */
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SPEC_FLAVORS, TintId,
|
|
6
6
|
} from './design-token.model';
|
|
7
7
|
import type { FlavorRevertSnapshot } from './flavor-seed';
|
|
8
|
+
import { isArriveId, isMoveId } from './motion-language';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* The `settings.design` row (design-system plan §3f), read and written by ONE pair of functions so
|
|
@@ -38,6 +39,8 @@ export enum DesignConfigKey {
|
|
|
38
39
|
Scroll = 'scroll',
|
|
39
40
|
Animate = 'animate',
|
|
40
41
|
Between = 'between',
|
|
42
|
+
Feel = 'feel',
|
|
43
|
+
Headings = 'headings',
|
|
41
44
|
Revert = 'revert',
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -131,9 +134,17 @@ export function resolveDesignChoices(partial: Partial<DesignChoices> | null | un
|
|
|
131
134
|
tint: keyOf(SPEC_AXES.tints, asString(partial?.tint)) ?? pack.defaults.tint,
|
|
132
135
|
...(fonts ? { fonts } : {}),
|
|
133
136
|
...resolveDesignMotion(partial),
|
|
137
|
+
...resolveMotionLanguageChoices(partial),
|
|
134
138
|
};
|
|
135
139
|
}
|
|
136
140
|
|
|
141
|
+
/** The look's motion language as stored: a known Feel / Headings word is kept, anything else is absent (AW3). */
|
|
142
|
+
export function resolveMotionLanguageChoices(partial: Readonly<Partial<Record<'feel' | 'headings', unknown>>> | null | undefined): Pick<DesignChoices, 'feel' | 'headings'> {
|
|
143
|
+
const feel = asString(partial?.feel);
|
|
144
|
+
const headings = asString(partial?.headings);
|
|
145
|
+
return { ...(isArriveId(feel) ? { feel } : {}), ...(isMoveId(headings) ? { headings } : {}) };
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
/** The look's motion, completed: an absent or unknown choice reads `PRE_MOTION` — what the site already does. */
|
|
138
149
|
export function resolveDesignMotion(partial: Readonly<Partial<Record<keyof DesignMotion, unknown>>> | null | undefined): DesignMotion {
|
|
139
150
|
return {
|
|
@@ -184,6 +195,8 @@ export function readDesignConfig(config: ReadonlyArray<DesignConfigEntry> | null
|
|
|
184
195
|
scroll: map.get(DesignConfigKey.Scroll) as ScrollId,
|
|
185
196
|
animate: map.get(DesignConfigKey.Animate) as AnimateId,
|
|
186
197
|
between: map.get(DesignConfigKey.Between) as BetweenId,
|
|
198
|
+
feel: asString(map.get(DesignConfigKey.Feel)) ?? undefined,
|
|
199
|
+
headings: asString(map.get(DesignConfigKey.Headings)) ?? undefined,
|
|
187
200
|
});
|
|
188
201
|
return {
|
|
189
202
|
choices,
|
|
@@ -226,6 +239,8 @@ export function designConfigEntries(
|
|
|
226
239
|
{ key: DesignConfigKey.Scroll, value: c.scroll },
|
|
227
240
|
{ key: DesignConfigKey.Animate, value: c.animate },
|
|
228
241
|
{ key: DesignConfigKey.Between, value: c.between },
|
|
242
|
+
...(c.feel ? [{ key: DesignConfigKey.Feel, value: c.feel }] : []),
|
|
243
|
+
...(c.headings ? [{ key: DesignConfigKey.Headings, value: c.headings }] : []),
|
|
229
244
|
...(c.fonts ? [{ key: DesignConfigKey.Fonts, value: JSON.stringify(c.fonts) }] : []),
|
|
230
245
|
...(revert ? [{ key: DesignConfigKey.Revert, value: JSON.stringify(revert) }] : []),
|
|
231
246
|
];
|
|
@@ -239,5 +254,6 @@ export function sameDesignChoices(a: DesignChoices, b: DesignChoices): boolean {
|
|
|
239
254
|
&& x.shape === y.shape && x.density === y.density && x.motion === y.motion
|
|
240
255
|
&& x.pillButtons === y.pillButtons && x.mode === y.mode && x.tint === y.tint
|
|
241
256
|
&& x.scroll === y.scroll && x.animate === y.animate && x.between === y.between
|
|
257
|
+
&& (x.feel ?? '') === (y.feel ?? '') && (x.headings ?? '') === (y.headings ?? '')
|
|
242
258
|
&& JSON.stringify(x.fonts ?? {}) === JSON.stringify(y.fonts ?? {});
|
|
243
259
|
}
|
|
@@ -50,7 +50,7 @@ export const PRE_TINT_DEFAULT: TintId = 'neutral';
|
|
|
50
50
|
export type ScrollId = keyof typeof SPEC_AXES.scrolls;
|
|
51
51
|
/** How much the sections move in as they scroll into view: Still · Subtle · Standard · Lively. */
|
|
52
52
|
export type AnimateId = keyof typeof SPEC_AXES.animations;
|
|
53
|
-
/** What plays between pages: None · Fade · Slide · Cinematic. */
|
|
53
|
+
/** What plays between pages: None · Fade · Slide · Cinematic, and the covers (AW4). */
|
|
54
54
|
export type BetweenId = keyof typeof SPEC_AXES.betweens;
|
|
55
55
|
export const SCROLL_IDS = Object.keys(SPEC_AXES.scrolls) as ReadonlyArray<ScrollId>;
|
|
56
56
|
export const ANIMATE_IDS = Object.keys(SPEC_AXES.animations) as ReadonlyArray<AnimateId>;
|
|
@@ -86,6 +86,12 @@ export interface DesignChoices {
|
|
|
86
86
|
scroll?: ScrollId;
|
|
87
87
|
animate?: AnimateId;
|
|
88
88
|
between?: BetweenId;
|
|
89
|
+
/** The look's motion language (AW3, MB-D5) — Design ▸ Motion ▸ Feel: the curve things arrive on (the leave
|
|
90
|
+
* follows it). Absent = the contract's default arrival (a row stored before AW3). An `ArriveId`. */
|
|
91
|
+
feel?: string;
|
|
92
|
+
/** Design ▸ Motion ▸ Headings arrive: the look's ONE heading move. Absent = each level's own heading entrance
|
|
93
|
+
* (MB-D8 — what a page built before AW3 was stamped with). A `MoveId`. */
|
|
94
|
+
headings?: string;
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
export interface FlavorSpecToken {
|