@vectoriox/iox-ui 5.93.0 → 5.95.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/actions-core/index.d.ts +7 -2
- package/commerce-core/index.d.ts +863 -3
- package/composite-core/index.d.ts +290 -2
- package/design-core/index.d.ts +1049 -105
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +15 -4
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +1509 -5
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +1170 -177
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +1147 -43
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +2 -2
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +8 -1
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +2 -2
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/actions-core/action.model.ts +1 -1
- package/src/actions-core/element-actions.ts +17 -3
- package/src/commerce-core/cart-transport.ts +211 -0
- package/src/commerce-core/cart.ts +305 -0
- package/src/commerce-core/catalog.ts +42 -0
- package/src/commerce-core/checkout.ts +202 -0
- package/src/commerce-core/decimal.ts +28 -0
- package/src/commerce-core/labels.ts +29 -0
- package/src/commerce-core/limits.ts +9 -0
- package/src/commerce-core/money-error.ts +1 -0
- package/src/commerce-core/order-snapshot.ts +151 -0
- package/src/commerce-core/orders.ts +172 -0
- package/src/commerce-core/payments.ts +196 -0
- package/src/commerce-core/public-api.ts +19 -4
- package/src/commerce-core/quantity.ts +56 -0
- package/src/commerce-core/shipping.ts +168 -0
- package/src/commerce-core/shop-display.ts +117 -0
- package/src/commerce-core/text.ts +13 -0
- package/src/commerce-core/variants.ts +296 -0
- package/src/commerce-core/vat.ts +38 -0
- package/src/composite-core/exclusive-runtime.ts +20 -7
- package/src/composite-core/public-api.ts +2 -0
- package/src/composite-core/shop-runtime.ts +626 -0
- package/src/composite-core/shop.ts +433 -0
- package/src/design-core/flavor-spec.generated.ts +1147 -43
- package/src/generation-core/site-spec.generated.ts +2 -2
- package/styles/iox-design.css +95 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readOwnedTrait, writeOwnedTrait, ROW_INDEX_ATTRIBUTE, elementStyleById, switchElementStyle, LinkType, setColorScheme, COLOR_SCHEME_TRAIT, repeatedRowIndex, roleClass as roleClass$1, headerBehaviourOf, HeaderTrait, headerEdgeOf, headerStaysAtTop } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
export { ROW_INDEX_ATTRIBUTE } from '@vectoriox/iox-ui/design-core';
|
|
3
|
+
import { shopWord, ShopWord, emptyCartView, QuantityStep, stepQuantity, ShopSlot, productOptions, productVariants, defaultChoice, findVariant, quantityBounds, chooseValue, clampQuantity, variantWords, optionValueStates, canStep, cartIssueWords, formatMoney, CartTransportError, CartTransportErrorCode, CART_TRANSPORT_ERROR_LABELS } from '@vectoriox/iox-ui/commerce-core';
|
|
3
4
|
|
|
4
5
|
/** What a recipe asks its consumer to create: a NEW node of `type`, the way that consumer creates one
|
|
5
6
|
* (the builder's `createConfig`, generation-core's `createSerializedNode`), with these props and this
|
|
@@ -409,7 +410,7 @@ const ACCORDION_WORDS = [
|
|
|
409
410
|
{ question: 'Write the third question', answer: 'Answer it plainly, in two or three short sentences.' },
|
|
410
411
|
];
|
|
411
412
|
const ACCORDION_NEW_ITEM_WORDS = { question: 'Write a new question', answer: 'Answer it plainly, in two or three short sentences.' };
|
|
412
|
-
var Type$
|
|
413
|
+
var Type$8;
|
|
413
414
|
(function (Type) {
|
|
414
415
|
Type["Container"] = "Container";
|
|
415
416
|
Type["LinkedContainer"] = "LinkedContainer";
|
|
@@ -417,8 +418,8 @@ var Type$7;
|
|
|
417
418
|
Type["Text"] = "Text";
|
|
418
419
|
Type["Icon"] = "Icon";
|
|
419
420
|
Type["Repeater"] = "Repeater";
|
|
420
|
-
})(Type$
|
|
421
|
-
var Style$
|
|
421
|
+
})(Type$8 || (Type$8 = {}));
|
|
422
|
+
var Style$7;
|
|
422
423
|
(function (Style) {
|
|
423
424
|
Style["Root"] = "box";
|
|
424
425
|
Style["Item"] = "accordion-item";
|
|
@@ -427,7 +428,7 @@ var Style$6;
|
|
|
427
428
|
Style["Icon"] = "icon";
|
|
428
429
|
Style["Panel"] = "accordion-panel";
|
|
429
430
|
Style["Answer"] = "body";
|
|
430
|
-
})(Style$
|
|
431
|
+
})(Style$7 || (Style$7 = {}));
|
|
431
432
|
const ZERO_BOX$4 = '0px 0px 0px 0px';
|
|
432
433
|
const HEADING_LEVELS = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
|
433
434
|
const DEFAULT_LEVEL = 'h3';
|
|
@@ -454,7 +455,7 @@ function make$4(create, key, type, role, style, props = {}, label) {
|
|
|
454
455
|
* ITS item (`stateTriggers`). ONE builder for both kinds. */
|
|
455
456
|
function buildCompositeIcon(create, key, icon, itemId, role = AccordionRole.Icon) {
|
|
456
457
|
const glyph = ACCORDION_ICON_GLYPH[icon];
|
|
457
|
-
const node = makeCompositePart(create, { key, type: Type$
|
|
458
|
+
const node = makeCompositePart(create, { key, type: Type$8.Icon, props: { iconClass: glyph.iconClass }, elementStyle: Style$7.Icon }, role, 'Icon', PART_BASE$3[AccordionRole.Icon]);
|
|
458
459
|
node.stateStyles = { ...(node.stateStyles ?? {}), [ITEM_OPEN_STATE]: { rotate: glyph.turn } };
|
|
459
460
|
if (itemId)
|
|
460
461
|
node.stateTriggers = { ...(node.stateTriggers ?? {}), [ITEM_OPEN_STATE]: itemId };
|
|
@@ -462,14 +463,14 @@ function buildCompositeIcon(create, key, icon, itemId, role = AccordionRole.Icon
|
|
|
462
463
|
}
|
|
463
464
|
/** One item: header (question + icon) and panel (answer). `key` makes every part's recipe key unique. */
|
|
464
465
|
function buildAccordionItem(create, words, itemKey, icon = AccordionIcon.Chevron) {
|
|
465
|
-
const item = make$4(create, `${itemKey}`, Type$
|
|
466
|
+
const item = make$4(create, `${itemKey}`, Type$8.Container, AccordionRole.Item, Style$7.Item, {}, 'Item');
|
|
466
467
|
item.itemKey = itemKey;
|
|
467
|
-
const trigger = make$4(create, `${itemKey}-trigger`, Type$
|
|
468
|
-
const question = make$4(create, `${itemKey}-question`, Type$
|
|
468
|
+
const trigger = make$4(create, `${itemKey}-trigger`, Type$8.LinkedContainer, AccordionRole.Trigger, Style$7.Trigger, {}, 'Header');
|
|
469
|
+
const question = make$4(create, `${itemKey}-question`, Type$8.Heading, null, Style$7.Question, { content: words.question, level: DEFAULT_LEVEL }, 'Heading');
|
|
469
470
|
writeStyles(question, QUESTION_BASE);
|
|
470
471
|
trigger.children = [question, ...(icon === AccordionIcon.None ? [] : [buildCompositeIcon(create, `${itemKey}-icon`, icon, item.id)])];
|
|
471
|
-
const panel = make$4(create, `${itemKey}-panel`, Type$
|
|
472
|
-
const answer = make$4(create, `${itemKey}-answer`, Type$
|
|
472
|
+
const panel = make$4(create, `${itemKey}-panel`, Type$8.Container, AccordionRole.Panel, Style$7.Panel, {}, 'Panel');
|
|
473
|
+
const answer = make$4(create, `${itemKey}-answer`, Type$8.Text, null, Style$7.Answer, { content: words.answer, tag: 'p' }, 'Text');
|
|
473
474
|
writeStyles(answer, ANSWER_BASE);
|
|
474
475
|
panel.children = [answer];
|
|
475
476
|
item.children = [trigger, panel];
|
|
@@ -477,7 +478,7 @@ function buildAccordionItem(create, words, itemKey, icon = AccordionIcon.Chevron
|
|
|
477
478
|
}
|
|
478
479
|
/** A fresh Accordion: three items, one open at a time, the first open by default (board 4). */
|
|
479
480
|
function buildAccordionRecipe(create, options = {}) {
|
|
480
|
-
const root = make$4(create, 'accordion', Type$
|
|
481
|
+
const root = make$4(create, 'accordion', Type$8.Container, AccordionRole.Accordion, Style$7.Root, {}, 'Accordion');
|
|
481
482
|
writeProp(root, CompositeBehaviourTrait.Multiple, options.multiple ?? false);
|
|
482
483
|
writeProp(root, CompositeBehaviourTrait.DefaultOn, options.defaultOn ?? AccordionDefaultOn.First);
|
|
483
484
|
const words = options.items ?? ACCORDION_WORDS;
|
|
@@ -516,7 +517,7 @@ function accordionItemOf(node, path) {
|
|
|
516
517
|
}
|
|
517
518
|
/** True when the root takes its items from content (a Repeater bound to a list, R3). */
|
|
518
519
|
function isAccordionFromContent(root) {
|
|
519
|
-
return !!root && root.type === Type$
|
|
520
|
+
return !!root && root.type === Type$8.Repeater;
|
|
520
521
|
}
|
|
521
522
|
/** The root's items in order — every item (Manual), or the one template item (From content). */
|
|
522
523
|
function accordionItems(root) {
|
|
@@ -563,9 +564,9 @@ function accordionQuestionOf(item) {
|
|
|
563
564
|
let text;
|
|
564
565
|
if (trigger)
|
|
565
566
|
walkComposite(trigger, n => {
|
|
566
|
-
if (!hit && n.type === Type$
|
|
567
|
+
if (!hit && n.type === Type$8.Heading)
|
|
567
568
|
hit = n;
|
|
568
|
-
if (!text && n.type === Type$
|
|
569
|
+
if (!text && n.type === Type$8.Text)
|
|
569
570
|
text = n;
|
|
570
571
|
});
|
|
571
572
|
return hit ?? text;
|
|
@@ -575,7 +576,7 @@ function accordionAnswerOf(item) {
|
|
|
575
576
|
const panel = accordionPanelOf(item);
|
|
576
577
|
let hit;
|
|
577
578
|
if (panel)
|
|
578
|
-
walkComposite(panel, n => { if (!hit && n.type === Type$
|
|
579
|
+
walkComposite(panel, n => { if (!hit && n.type === Type$8.Text)
|
|
579
580
|
hit = n; });
|
|
580
581
|
return hit;
|
|
581
582
|
}
|
|
@@ -596,7 +597,7 @@ function accordionHeadingLevel(trigger) {
|
|
|
596
597
|
const visit = (n) => {
|
|
597
598
|
if (level !== undefined)
|
|
598
599
|
return;
|
|
599
|
-
if (n.type === Type$
|
|
600
|
+
if (n.type === Type$8.Heading) {
|
|
600
601
|
level = readProp(n, 'level');
|
|
601
602
|
return;
|
|
602
603
|
}
|
|
@@ -1004,7 +1005,7 @@ function behaviourOf$1(root) {
|
|
|
1004
1005
|
defaultOn: ACCORDION_DEFAULT_ONS.includes(raw) ? raw : AccordionDefaultOn.First,
|
|
1005
1006
|
};
|
|
1006
1007
|
}
|
|
1007
|
-
function setAttr$
|
|
1008
|
+
function setAttr$2(el, name, value) {
|
|
1008
1009
|
if (!el)
|
|
1009
1010
|
return;
|
|
1010
1011
|
if (value === null) {
|
|
@@ -1219,22 +1220,22 @@ class AccordionRuntime {
|
|
|
1219
1220
|
const ids = accordionDomIds(rootId, key, this.kind);
|
|
1220
1221
|
if (!item.hasAttribute(ITEM_KEY_ATTRIBUTE))
|
|
1221
1222
|
item.setAttribute(ITEM_KEY_ATTRIBUTE, key);
|
|
1222
|
-
setAttr$
|
|
1223
|
+
setAttr$2(item, ON_ATTRIBUTE, on ? '' : null);
|
|
1223
1224
|
const button = this.own(item, BUTTON_SELECTOR);
|
|
1224
1225
|
const track = this.own(item, TRACK_SELECTOR);
|
|
1225
1226
|
const region = this.own(item, REGION_SELECTOR);
|
|
1226
1227
|
const panel = this.own(item, PANEL_SELECTOR$1);
|
|
1227
|
-
setAttr$
|
|
1228
|
-
setAttr$
|
|
1229
|
-
setAttr$
|
|
1230
|
-
setAttr$
|
|
1231
|
-
setAttr$
|
|
1232
|
-
setAttr$
|
|
1233
|
-
setAttr$
|
|
1228
|
+
setAttr$2(button, 'type', 'button');
|
|
1229
|
+
setAttr$2(button, 'id', ids.trigger);
|
|
1230
|
+
setAttr$2(button, 'aria-expanded', on ? 'true' : 'false');
|
|
1231
|
+
setAttr$2(button, 'aria-controls', ids.panel);
|
|
1232
|
+
setAttr$2(button, ON_ATTRIBUTE, on ? '' : null);
|
|
1233
|
+
setAttr$2(track, ON_ATTRIBUTE, on ? '' : null);
|
|
1234
|
+
setAttr$2(panel, ON_ATTRIBUTE, on ? '' : null);
|
|
1234
1235
|
const labelled = hasLabelledRegion(this.kind);
|
|
1235
|
-
setAttr$
|
|
1236
|
-
setAttr$
|
|
1237
|
-
setAttr$
|
|
1236
|
+
setAttr$2(region, 'role', labelled ? 'region' : null);
|
|
1237
|
+
setAttr$2(region, 'id', ids.panel);
|
|
1238
|
+
setAttr$2(region, 'aria-labelledby', labelled ? ids.trigger : null);
|
|
1238
1239
|
if (!region)
|
|
1239
1240
|
return;
|
|
1240
1241
|
const pending = this.closing.get(key);
|
|
@@ -1243,7 +1244,7 @@ class AccordionRuntime {
|
|
|
1243
1244
|
clearTimeout(pending);
|
|
1244
1245
|
this.closing.delete(key);
|
|
1245
1246
|
}
|
|
1246
|
-
setAttr$
|
|
1247
|
+
setAttr$2(region, 'hidden', null);
|
|
1247
1248
|
return;
|
|
1248
1249
|
}
|
|
1249
1250
|
if (region.hasAttribute('hidden') || pending)
|
|
@@ -1251,13 +1252,13 @@ class AccordionRuntime {
|
|
|
1251
1252
|
// Closing: the track collapses first (its transition), THEN the region is hidden — hiding it at once
|
|
1252
1253
|
// would collapse it with no motion. At first paint, or under reduced motion, it is hidden at once.
|
|
1253
1254
|
if (first || this.reduced()) {
|
|
1254
|
-
setAttr$
|
|
1255
|
+
setAttr$2(region, 'hidden', UNTIL_FOUND);
|
|
1255
1256
|
return;
|
|
1256
1257
|
}
|
|
1257
1258
|
const hide = () => {
|
|
1258
1259
|
this.closing.delete(key);
|
|
1259
1260
|
if (!item.hasAttribute(ON_ATTRIBUTE))
|
|
1260
|
-
setAttr$
|
|
1261
|
+
setAttr$2(region, 'hidden', UNTIL_FOUND);
|
|
1261
1262
|
};
|
|
1262
1263
|
this.closing.set(key, setTimeout(hide, this.closeDelay(track)));
|
|
1263
1264
|
}
|
|
@@ -1347,20 +1348,20 @@ const DISCLOSURE_WORDS = {
|
|
|
1347
1348
|
};
|
|
1348
1349
|
/** A disclosure's one item key — its root IS its item. */
|
|
1349
1350
|
const DISCLOSURE_ITEM_KEY = 'k1';
|
|
1350
|
-
var Type$
|
|
1351
|
+
var Type$7;
|
|
1351
1352
|
(function (Type) {
|
|
1352
1353
|
Type["Container"] = "Container";
|
|
1353
1354
|
Type["LinkedContainer"] = "LinkedContainer";
|
|
1354
1355
|
Type["Text"] = "Text";
|
|
1355
|
-
})(Type$
|
|
1356
|
-
var Style$
|
|
1356
|
+
})(Type$7 || (Type$7 = {}));
|
|
1357
|
+
var Style$6;
|
|
1357
1358
|
(function (Style) {
|
|
1358
1359
|
Style["Root"] = "box";
|
|
1359
1360
|
Style["Trigger"] = "accordion-trigger";
|
|
1360
1361
|
Style["Word"] = "body";
|
|
1361
1362
|
Style["Panel"] = "accordion-panel";
|
|
1362
1363
|
Style["Body"] = "body";
|
|
1363
|
-
})(Style$
|
|
1364
|
+
})(Style$6 || (Style$6 = {}));
|
|
1364
1365
|
const ZERO_BOX$3 = '0px 0px 0px 0px';
|
|
1365
1366
|
const HIDDEN = 'none';
|
|
1366
1367
|
const INHERIT = 'inherit';
|
|
@@ -1390,7 +1391,7 @@ function make$3(create, key, type, role, style, props, label) {
|
|
|
1390
1391
|
}
|
|
1391
1392
|
/** One of the trigger's two words: shown while the disclosure is closed (`more`) or open (`less`). */
|
|
1392
1393
|
function buildWord(create, role, words, rootId) {
|
|
1393
|
-
const node = make$3(create, role === DisclosureRole.More ? 'more' : 'less', Type$
|
|
1394
|
+
const node = make$3(create, role === DisclosureRole.More ? 'more' : 'less', Type$7.Text, role, Style$6.Word, { content: words, tag: 'span' }, 'Text');
|
|
1394
1395
|
node.stateStyles = { ...(node.stateStyles ?? {}), [ITEM_OPEN_STATE]: { display: role === DisclosureRole.More ? HIDDEN : SHOWN } };
|
|
1395
1396
|
if (rootId)
|
|
1396
1397
|
node.stateTriggers = { ...(node.stateTriggers ?? {}), [ITEM_OPEN_STATE]: rootId };
|
|
@@ -1399,18 +1400,18 @@ function buildWord(create, role, words, rootId) {
|
|
|
1399
1400
|
/** A fresh Disclosure: "Read more" opens the text below and reads "Read less" while it is open; closed by default. */
|
|
1400
1401
|
function buildDisclosureRecipe(create, options = {}) {
|
|
1401
1402
|
const words = { ...DISCLOSURE_WORDS, ...(options.words ?? {}) };
|
|
1402
|
-
const root = make$3(create, 'disclosure', Type$
|
|
1403
|
+
const root = make$3(create, 'disclosure', Type$7.Container, DisclosureRole.Disclosure, Style$6.Root, {}, 'Disclosure');
|
|
1403
1404
|
root.itemKey = DISCLOSURE_ITEM_KEY;
|
|
1404
1405
|
writeProp(root, CompositeBehaviourTrait.DefaultOn, options.open ? AccordionDefaultOn.First : AccordionDefaultOn.None);
|
|
1405
1406
|
const icon = options.icon ?? AccordionIcon.Chevron;
|
|
1406
|
-
const trigger = make$3(create, 'trigger', Type$
|
|
1407
|
+
const trigger = make$3(create, 'trigger', Type$7.LinkedContainer, DisclosureRole.Trigger, Style$6.Trigger, {}, 'Toggle');
|
|
1407
1408
|
trigger.children = [
|
|
1408
1409
|
buildWord(create, DisclosureRole.More, words.more, root.id),
|
|
1409
1410
|
buildWord(create, DisclosureRole.Less, words.less, root.id),
|
|
1410
1411
|
...(icon === AccordionIcon.None ? [] : [buildCompositeIcon(create, 'icon', icon, root.id, DisclosureRole.Icon)]),
|
|
1411
1412
|
];
|
|
1412
|
-
const panel = make$3(create, 'panel', Type$
|
|
1413
|
-
const body = make$3(create, 'body', Type$
|
|
1413
|
+
const panel = make$3(create, 'panel', Type$7.Container, DisclosureRole.Panel, Style$6.Panel, {}, 'Panel');
|
|
1414
|
+
const body = make$3(create, 'body', Type$7.Text, null, Style$6.Body, { content: words.body, tag: 'p' }, 'Text');
|
|
1414
1415
|
writeStyles(body, BODY_BASE$1);
|
|
1415
1416
|
panel.children = [body];
|
|
1416
1417
|
root.children = [trigger, panel];
|
|
@@ -1573,7 +1574,7 @@ const CARD_WORDS = {
|
|
|
1573
1574
|
};
|
|
1574
1575
|
/** The breakpoint whose layer stacks an "Image side" card (Breakpoint.Mobile, ≤767px). */
|
|
1575
1576
|
const CARD_STACK_BREAKPOINT = 'mobile';
|
|
1576
|
-
var Type$
|
|
1577
|
+
var Type$6;
|
|
1577
1578
|
(function (Type) {
|
|
1578
1579
|
Type["Container"] = "Container";
|
|
1579
1580
|
Type["Image"] = "Image";
|
|
@@ -1581,8 +1582,8 @@ var Type$5;
|
|
|
1581
1582
|
Type["Text"] = "Text";
|
|
1582
1583
|
Type["Icon"] = "Icon";
|
|
1583
1584
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
1584
|
-
})(Type$
|
|
1585
|
-
var Style$
|
|
1585
|
+
})(Type$6 || (Type$6 = {}));
|
|
1586
|
+
var Style$5;
|
|
1586
1587
|
(function (Style) {
|
|
1587
1588
|
Style["Card"] = "card";
|
|
1588
1589
|
Style["Box"] = "box";
|
|
@@ -1595,7 +1596,7 @@ var Style$4;
|
|
|
1595
1596
|
Style["Ghost"] = "button-ghost";
|
|
1596
1597
|
Style["Icon"] = "icon";
|
|
1597
1598
|
Style["Scrim"] = "media-scrim";
|
|
1598
|
-
})(Style$
|
|
1599
|
+
})(Style$5 || (Style$5 = {}));
|
|
1599
1600
|
var Scheme;
|
|
1600
1601
|
(function (Scheme) {
|
|
1601
1602
|
Scheme["Default"] = "default";
|
|
@@ -1605,9 +1606,9 @@ const LINK_TYPE = 'linkType';
|
|
|
1605
1606
|
const SAVE_ICON = 'ph ph-bookmark-simple';
|
|
1606
1607
|
/** A value an element style writes — read from the contract, never retyped. */
|
|
1607
1608
|
const styleValue = (style, trait) => String(elementStyleById(style)?.base[trait] ?? '');
|
|
1608
|
-
const CARD_PAD = styleValue(Style$
|
|
1609
|
-
const IMAGE_RADIUS = styleValue(Style$
|
|
1610
|
-
const TITLE_SIZE = styleValue(Style$
|
|
1609
|
+
const CARD_PAD = styleValue(Style$5.Card, 'padding');
|
|
1610
|
+
const IMAGE_RADIUS = styleValue(Style$5.Media, 'borderRadius');
|
|
1611
|
+
const TITLE_SIZE = styleValue(Style$5.Title, 'fontSize');
|
|
1611
1612
|
const LEAD_SIZE = 'var(--iox-size-lead)';
|
|
1612
1613
|
const ZERO_BOX$2 = '0px 0px 0px 0px';
|
|
1613
1614
|
/** What every card part holds in every layout — the recipe's box. */
|
|
@@ -1635,7 +1636,7 @@ const LAYOUTS = {
|
|
|
1635
1636
|
card: { flexDirection: 'column', alignItems: 'stretch', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1636
1637
|
media: { ...IN_FLOW, flexBasis: 'auto' },
|
|
1637
1638
|
image: { aspectRatio: '4 / 3', height: 'auto', minHeight: 'auto', borderRadius: IMAGE_RADIUS },
|
|
1638
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1639
|
+
content: GROWING_CONTENT, contentStyle: Style$5.Box, contentScheme: Scheme.Default,
|
|
1639
1640
|
title: { fontSize: TITLE_SIZE },
|
|
1640
1641
|
badgeOnMedia: true,
|
|
1641
1642
|
},
|
|
@@ -1643,7 +1644,7 @@ const LAYOUTS = {
|
|
|
1643
1644
|
card: { flexDirection: 'row', alignItems: 'stretch', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1644
1645
|
media: { ...IN_FLOW, flexBasis: '42%' },
|
|
1645
1646
|
image: { aspectRatio: 'auto', height: '100%', minHeight: '180px', borderRadius: IMAGE_RADIUS },
|
|
1646
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1647
|
+
content: GROWING_CONTENT, contentStyle: Style$5.Box, contentScheme: Scheme.Default,
|
|
1647
1648
|
title: { fontSize: TITLE_SIZE },
|
|
1648
1649
|
badgeOnMedia: true,
|
|
1649
1650
|
stack: {
|
|
@@ -1657,7 +1658,7 @@ const LAYOUTS = {
|
|
|
1657
1658
|
media: { position: 'absolute', top: '0px', right: '0px', bottom: '0px', left: '0px', flexBasis: 'auto' },
|
|
1658
1659
|
image: { aspectRatio: 'auto', height: '100%', minHeight: 'auto', borderRadius: '0px' },
|
|
1659
1660
|
content: { position: 'relative', flexGrow: '0', flexShrink: '0', flexBasis: 'auto', padding: `72px ${CARD_PAD} ${CARD_PAD} ${CARD_PAD}` },
|
|
1660
|
-
contentStyle: Style$
|
|
1661
|
+
contentStyle: Style$5.Scrim, contentScheme: Scheme.Inverse,
|
|
1661
1662
|
title: { fontSize: TITLE_SIZE },
|
|
1662
1663
|
badgeOnMedia: false,
|
|
1663
1664
|
},
|
|
@@ -1665,7 +1666,7 @@ const LAYOUTS = {
|
|
|
1665
1666
|
card: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1666
1667
|
media: { ...IN_FLOW, flexBasis: '72px' },
|
|
1667
1668
|
image: { aspectRatio: '1 / 1', height: 'auto', minHeight: 'auto', borderRadius: IMAGE_RADIUS },
|
|
1668
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1669
|
+
content: GROWING_CONTENT, contentStyle: Style$5.Box, contentScheme: Scheme.Default,
|
|
1669
1670
|
title: { fontSize: LEAD_SIZE },
|
|
1670
1671
|
badgeOnMedia: false,
|
|
1671
1672
|
partsOff: [CardPart.Text, CardPart.Actions],
|
|
@@ -1686,15 +1687,15 @@ function make$2(create, key, type, role, elementStyle, props = {}, label) {
|
|
|
1686
1687
|
return node;
|
|
1687
1688
|
}
|
|
1688
1689
|
function buttonLabel(create, key, words) {
|
|
1689
|
-
const label = make$2(create, key, Type$
|
|
1690
|
+
const label = make$2(create, key, Type$6.Text, null, Style$5.Label, { content: words, tag: 'span' });
|
|
1690
1691
|
writeStyles(label, LABEL_BASE$2);
|
|
1691
1692
|
return label;
|
|
1692
1693
|
}
|
|
1693
1694
|
/** Each optional part (and the locked title) as the recipe builds it. */
|
|
1694
1695
|
const PART_BUILDERS = {
|
|
1695
1696
|
[CardPart.Media]: (create) => {
|
|
1696
|
-
const media = make$2(create, 'media', Type$
|
|
1697
|
-
const image = make$2(create, 'image', Type$
|
|
1697
|
+
const media = make$2(create, 'media', Type$6.Container, CardRole.Media, Style$5.Box, {}, 'Media');
|
|
1698
|
+
const image = make$2(create, 'image', Type$6.Image, null, Style$5.Media, { src: '', alt: '' });
|
|
1698
1699
|
writeStyles(image, IMAGE_BASE$2);
|
|
1699
1700
|
media.children = [image];
|
|
1700
1701
|
return media;
|
|
@@ -1705,14 +1706,14 @@ const PART_BUILDERS = {
|
|
|
1705
1706
|
badge.label = 'Badge';
|
|
1706
1707
|
return badge;
|
|
1707
1708
|
},
|
|
1708
|
-
[CardPart.Eyebrow]: (create, words) => make$2(create, 'eyebrow', Type$
|
|
1709
|
-
[CardPart.Text]: (create, words) => make$2(create, 'text', Type$
|
|
1709
|
+
[CardPart.Eyebrow]: (create, words) => make$2(create, 'eyebrow', Type$6.Text, CardRole.Eyebrow, Style$5.Eyebrow, { content: words.eyebrow, tag: 'p' }, 'Eyebrow'),
|
|
1710
|
+
[CardPart.Text]: (create, words) => make$2(create, 'text', Type$6.Text, CardRole.Text, Style$5.Body, { content: words.text, tag: 'p' }, 'Text'),
|
|
1710
1711
|
[CardPart.Actions]: (create, words) => {
|
|
1711
|
-
const actions = make$2(create, 'actions', Type$
|
|
1712
|
-
const primary = make$2(create, 'primary', Type$
|
|
1712
|
+
const actions = make$2(create, 'actions', Type$6.Container, CardRole.Actions, Style$5.Box, {}, 'Buttons');
|
|
1713
|
+
const primary = make$2(create, 'primary', Type$6.ButtonBlock, null, Style$5.Primary);
|
|
1713
1714
|
primary.children = [buttonLabel(create, 'primary-label', words.primary)];
|
|
1714
|
-
const ghost = make$2(create, 'secondary', Type$
|
|
1715
|
-
const icon = make$2(create, 'secondary-icon', Type$
|
|
1715
|
+
const ghost = make$2(create, 'secondary', Type$6.ButtonBlock, null, Style$5.Ghost);
|
|
1716
|
+
const icon = make$2(create, 'secondary-icon', Type$6.Icon, null, Style$5.Icon, { iconClass: SAVE_ICON });
|
|
1716
1717
|
writeStyles(icon, INLINE_ICON);
|
|
1717
1718
|
ghost.children = [icon, buttonLabel(create, 'secondary-label', words.secondary)];
|
|
1718
1719
|
actions.children = [primary, ghost];
|
|
@@ -1720,15 +1721,15 @@ const PART_BUILDERS = {
|
|
|
1720
1721
|
},
|
|
1721
1722
|
};
|
|
1722
1723
|
function buildTitle(create, words) {
|
|
1723
|
-
return make$2(create, 'title', Type$
|
|
1724
|
+
return make$2(create, 'title', Type$6.Heading, CardRole.Title, Style$5.Title, { content: words.title, level: 'h3', [LINK_TYPE]: LinkType.None }, 'Title');
|
|
1724
1725
|
}
|
|
1725
1726
|
/** A fresh Card v2: every part a node with its role and element style, laid out by `options.layout`. */
|
|
1726
1727
|
function buildCardRecipe(create, options = {}) {
|
|
1727
1728
|
const words = { ...CARD_WORDS, ...(options.words ?? {}) };
|
|
1728
1729
|
const tone = options.badgeTone ?? BadgeTone.Accent;
|
|
1729
1730
|
const on = (part) => options.parts?.[part] !== false;
|
|
1730
|
-
const card = make$2(create, 'card', Type$
|
|
1731
|
-
const content = make$2(create, 'content', Type$
|
|
1731
|
+
const card = make$2(create, 'card', Type$6.Container, CardRole.Card, Style$5.Card, {}, 'Card');
|
|
1732
|
+
const content = make$2(create, 'content', Type$6.Container, CardRole.Content, Style$5.Box, {}, 'Content');
|
|
1732
1733
|
content.children = [
|
|
1733
1734
|
...(on(CardPart.Eyebrow) ? [PART_BUILDERS[CardPart.Eyebrow](create, words, tone)] : []),
|
|
1734
1735
|
buildTitle(create, words),
|
|
@@ -1759,7 +1760,7 @@ function cardRootOf(node, path) {
|
|
|
1759
1760
|
function cardPartsOf(card) {
|
|
1760
1761
|
return Object.fromEntries(CARD_PARTS.map(part => [part, !!findByRole(card, CARD_PART_ROLE[part])]));
|
|
1761
1762
|
}
|
|
1762
|
-
const imageOf = (media) => media?.children?.find(c => c.type === Type$
|
|
1763
|
+
const imageOf = (media) => media?.children?.find(c => c.type === Type$6.Image);
|
|
1763
1764
|
/** Put the badge where the layout says: the Media's top corner, or the head of the content column
|
|
1764
1765
|
* (Image behind text, Compact, or no Media at all). The corner's insets are logical, in iox-design.css
|
|
1765
1766
|
* (mirrored in RTL); `position` is the node's own, because the editing canvas forces every node's
|
|
@@ -2142,13 +2143,13 @@ function marqueePauseGlyph(paused) {
|
|
|
2142
2143
|
return paused ? MARQUEE_PLAY_GLYPH : MARQUEE_PAUSE_GLYPH;
|
|
2143
2144
|
}
|
|
2144
2145
|
// ── the recipe ──────────────────────────────────────────────────────────────────────────────────────
|
|
2145
|
-
var Type$
|
|
2146
|
+
var Type$5;
|
|
2146
2147
|
(function (Type) {
|
|
2147
2148
|
Type["Container"] = "Container";
|
|
2148
2149
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
2149
2150
|
Type["Icon"] = "Icon";
|
|
2150
2151
|
Type["Text"] = "Text";
|
|
2151
|
-
})(Type$
|
|
2152
|
+
})(Type$5 || (Type$5 = {}));
|
|
2152
2153
|
var MarqueeStyle;
|
|
2153
2154
|
(function (MarqueeStyle) {
|
|
2154
2155
|
MarqueeStyle["Band"] = "marquee";
|
|
@@ -2156,41 +2157,41 @@ var MarqueeStyle;
|
|
|
2156
2157
|
MarqueeStyle["Item"] = "lead";
|
|
2157
2158
|
MarqueeStyle["Icon"] = "icon";
|
|
2158
2159
|
})(MarqueeStyle || (MarqueeStyle = {}));
|
|
2159
|
-
const ZERO$
|
|
2160
|
+
const ZERO$4 = '0px 0px 0px 0px';
|
|
2160
2161
|
const GAP = 'var(--iox-marquee-gap, 24px)';
|
|
2161
2162
|
/** The band: the control at its reading start, the rail taking the rest. */
|
|
2162
2163
|
const BAND_BASE = {
|
|
2163
|
-
display: 'flex', flexDirection: 'row', flexWrap: 'nowrap', alignItems: 'center', width: '100%', minHeight: 'auto', padding: ZERO$
|
|
2164
|
+
display: 'flex', flexDirection: 'row', flexWrap: 'nowrap', alignItems: 'center', width: '100%', minHeight: 'auto', padding: ZERO$4,
|
|
2164
2165
|
};
|
|
2165
2166
|
/** What the band is seen through: it clips the moving row and holds the track and its copy side by side. */
|
|
2166
2167
|
const RAIL_BASE = {
|
|
2167
2168
|
display: 'flex', flexDirection: 'row', flexWrap: 'nowrap', alignItems: 'center', flexGrow: '1', flexShrink: '1', flexBasis: '0%',
|
|
2168
|
-
minWidth: '0px', width: 'auto', minHeight: 'auto', overflow: 'hidden', padding: ZERO$
|
|
2169
|
+
minWidth: '0px', width: 'auto', minHeight: 'auto', overflow: 'hidden', padding: ZERO$4, margin: ZERO$4,
|
|
2169
2170
|
};
|
|
2170
2171
|
/** One row of items, as wide as they are; its trailing gap (inline-end padding) is part of its width, so the copy picks
|
|
2171
2172
|
* up exactly one gap after the last item and a loop of −100% is seamless. */
|
|
2172
2173
|
const TRACK_BASE = {
|
|
2173
2174
|
display: 'flex', flexDirection: 'row', flexWrap: 'nowrap', alignItems: 'center', gap: GAP, flexGrow: '0', flexShrink: '0',
|
|
2174
|
-
width: 'max-content', minHeight: 'auto', margin: ZERO$
|
|
2175
|
+
width: 'max-content', minHeight: 'auto', margin: ZERO$4, padding: `0px ${GAP} 0px 0px`,
|
|
2175
2176
|
};
|
|
2176
2177
|
/** A 44px round control (the slider's), in the flow at the band's start. */
|
|
2177
2178
|
const CONTROL_BASE$1 = {
|
|
2178
2179
|
display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: '0', width: '44px', height: '44px', minWidth: '44px',
|
|
2179
|
-
padding: ZERO$
|
|
2180
|
+
padding: ZERO$4, margin: ZERO$4, borderRadius: '999px',
|
|
2180
2181
|
};
|
|
2181
2182
|
const ICON_BASE$1 = { fontSize: '18px', color: 'inherit' };
|
|
2182
|
-
const ITEM_BASE = { flexShrink: '0', margin: ZERO$
|
|
2183
|
+
const ITEM_BASE = { flexShrink: '0', margin: ZERO$4, width: 'auto' };
|
|
2183
2184
|
const MARQUEE_SAMPLE_WORDS = ['Design', 'Branding', 'Photography', 'Websites', 'Motion'];
|
|
2184
2185
|
/** A band of words (Components ▸ Interactive ▸ Marquee). The words are ordinary Text nodes: bind, restyle, replace. */
|
|
2185
2186
|
function buildMarqueeRecipe(create, options = {}) {
|
|
2186
|
-
const root = makeCompositePart(create, { key: 'marquee', type: Type$
|
|
2187
|
+
const root = makeCompositePart(create, { key: 'marquee', type: Type$5.Container, props: {}, elementStyle: MarqueeStyle.Band }, MarqueeRole.Marquee, 'Marquee', BAND_BASE);
|
|
2187
2188
|
setMarqueeSettings(root, MARQUEE_DEFAULTS);
|
|
2188
|
-
const pause = makeCompositePart(create, { key: 'marquee-pause', type: Type$
|
|
2189
|
-
const icon = makeCompositePart(create, { key: 'marquee-pause-icon', type: Type$
|
|
2189
|
+
const pause = makeCompositePart(create, { key: 'marquee-pause', type: Type$5.ButtonBlock, props: { tag: 'button', type: 'button' }, elementStyle: MarqueeStyle.Control }, MarqueeRole.Pause, 'Pause', CONTROL_BASE$1);
|
|
2190
|
+
const icon = makeCompositePart(create, { key: 'marquee-pause-icon', type: Type$5.Icon, props: { iconClass: MARQUEE_PAUSE_GLYPH }, elementStyle: MarqueeStyle.Icon }, null, 'Icon', ICON_BASE$1);
|
|
2190
2191
|
pause.children = [icon];
|
|
2191
|
-
const rail = makeCompositePart(create, { key: 'marquee-rail', type: Type$
|
|
2192
|
-
const track = makeCompositePart(create, { key: 'marquee-track', type: Type$
|
|
2193
|
-
track.children = (options.words?.length ? options.words : MARQUEE_SAMPLE_WORDS).map((word, i) => makeCompositePart(create, { key: `marquee-item-${i + 1}`, type: Type$
|
|
2192
|
+
const rail = makeCompositePart(create, { key: 'marquee-rail', type: Type$5.Container, props: {}, elementStyle: NO_ELEMENT_STYLE }, MarqueeRole.Rail, 'Rail', RAIL_BASE);
|
|
2193
|
+
const track = makeCompositePart(create, { key: 'marquee-track', type: Type$5.Container, props: {}, elementStyle: NO_ELEMENT_STYLE }, MarqueeRole.Track, 'Items', TRACK_BASE);
|
|
2194
|
+
track.children = (options.words?.length ? options.words : MARQUEE_SAMPLE_WORDS).map((word, i) => makeCompositePart(create, { key: `marquee-item-${i + 1}`, type: Type$5.Text, props: { content: word }, elementStyle: MarqueeStyle.Item }, null, 'Item', ITEM_BASE));
|
|
2194
2195
|
rail.children = [track];
|
|
2195
2196
|
root.children = [pause, rail];
|
|
2196
2197
|
return root;
|
|
@@ -2326,20 +2327,20 @@ function sliderSlides(children) {
|
|
|
2326
2327
|
return (children ?? []).filter(c => !isSliderPart(c));
|
|
2327
2328
|
}
|
|
2328
2329
|
// ── the parts' recipe ───────────────────────────────────────────────────────────────────────────────
|
|
2329
|
-
var Type$
|
|
2330
|
+
var Type$4;
|
|
2330
2331
|
(function (Type) {
|
|
2331
2332
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
2332
2333
|
Type["Icon"] = "Icon";
|
|
2333
2334
|
Type["Container"] = "Container";
|
|
2334
2335
|
Type["Text"] = "Text";
|
|
2335
|
-
})(Type$
|
|
2336
|
-
var Style$
|
|
2336
|
+
})(Type$4 || (Type$4 = {}));
|
|
2337
|
+
var Style$4;
|
|
2337
2338
|
(function (Style) {
|
|
2338
2339
|
Style["Control"] = "button-secondary";
|
|
2339
2340
|
Style["Icon"] = "icon";
|
|
2340
2341
|
/** The caption and the count read as small print. */
|
|
2341
2342
|
Style["Words"] = "small";
|
|
2342
|
-
})(Style$
|
|
2343
|
+
})(Style$4 || (Style$4 = {}));
|
|
2343
2344
|
/** Each part's glyph (Phosphor) and its default accessible name. */
|
|
2344
2345
|
const SLIDER_PART_GLYPH = {
|
|
2345
2346
|
[SliderRole.Pause]: 'ph ph-pause',
|
|
@@ -2356,9 +2357,9 @@ const PART_LABEL = {
|
|
|
2356
2357
|
[SliderRole.Caption]: 'Caption',
|
|
2357
2358
|
[SliderRole.Count]: 'Count',
|
|
2358
2359
|
};
|
|
2359
|
-
const ZERO$
|
|
2360
|
+
const ZERO$3 = '0px 0px 0px 0px';
|
|
2360
2361
|
/** A control in the bar: in flow, its own size, no offsets (the bar spaces its parts). */
|
|
2361
|
-
const BAR_PART_LAYOUT = { position: 'static', top: 'auto', margin: ZERO$
|
|
2362
|
+
const BAR_PART_LAYOUT = { position: 'static', top: 'auto', margin: ZERO$3 };
|
|
2362
2363
|
/**
|
|
2363
2364
|
* The bar (M1.3): a row under the picture. Its inline padding keeps the PAGE's margin when the slider bleeds to the
|
|
2364
2365
|
* screen's edge — the gutter less however far the slider is already inset from the screen (`100%` is the slider's
|
|
@@ -2367,27 +2368,27 @@ const BAR_PART_LAYOUT = { position: 'static', top: 'auto', margin: ZERO$2 };
|
|
|
2367
2368
|
const BAR_INLINE_PAD = 'max(0px, calc(var(--iox-space-gutter, 24px) - (100vw - 100%) / 2))';
|
|
2368
2369
|
const BAR_BASE$1 = {
|
|
2369
2370
|
position: 'relative', display: 'flex', flexDirection: 'row', flexWrap: 'nowrap', alignItems: 'center', justifyContent: 'flex-start',
|
|
2370
|
-
gap: '12px', width: '100%', height: 'auto', minHeight: '44px', margin: ZERO$
|
|
2371
|
+
gap: '12px', width: '100%', height: 'auto', minHeight: '44px', margin: ZERO$3, padding: `12px ${BAR_INLINE_PAD} 0px ${BAR_INLINE_PAD}`, zIndex: '10',
|
|
2371
2372
|
};
|
|
2372
2373
|
/** The caption takes the room the controls leave; its words end in an ellipsis rather than push them off (the shared
|
|
2373
2374
|
* CSS's, because Text holds no `textOverflow`/`whiteSpace` trait and the builder drops them on save). */
|
|
2374
2375
|
const CAPTION_BASE$1 = {
|
|
2375
|
-
flexGrow: '1', flexShrink: '1', flexBasis: '0%', minWidth: '0px', width: 'auto', minHeight: 'auto', margin: ZERO$
|
|
2376
|
+
flexGrow: '1', flexShrink: '1', flexBasis: '0%', minWidth: '0px', width: 'auto', minHeight: 'auto', margin: ZERO$3, padding: ZERO$3,
|
|
2376
2377
|
overflow: 'hidden',
|
|
2377
2378
|
};
|
|
2378
|
-
const COUNT_BASE = { flexGrow: '0', flexShrink: '0', width: 'auto', minHeight: 'auto', margin: ZERO$
|
|
2379
|
+
const COUNT_BASE = { flexGrow: '0', flexShrink: '0', width: 'auto', minHeight: 'auto', margin: ZERO$3, padding: ZERO$3 };
|
|
2379
2380
|
/** A round 44px control (board 6 `.st-ctl`), over the slides (z above `.swiper-wrapper`). The PLACE (which edge) is the
|
|
2380
2381
|
* shared CSS's, in logical insets, so a carousel reads the same way in RTL. */
|
|
2381
2382
|
const CONTROL_BASE = {
|
|
2382
2383
|
position: 'absolute', zIndex: '10', display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
2383
|
-
width: '44px', height: '44px', minWidth: '44px', padding: ZERO$
|
|
2384
|
+
width: '44px', height: '44px', minWidth: '44px', padding: ZERO$3, margin: ZERO$3, borderRadius: '999px',
|
|
2384
2385
|
};
|
|
2385
2386
|
const ICON_BASE = { fontSize: '20px', color: 'inherit' };
|
|
2386
2387
|
/** The arrows' vertical middle over the slides: half the 44px control above the centre line. */
|
|
2387
2388
|
const ARROW_TOP = 'calc(50% - 22px)';
|
|
2388
2389
|
const PAGINATION_BASE = {
|
|
2389
2390
|
position: 'absolute', zIndex: '10', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '8px',
|
|
2390
|
-
width: 'auto', minHeight: 'auto', height: 'auto', padding: ZERO$
|
|
2391
|
+
width: 'auto', minHeight: 'auto', height: 'auto', padding: ZERO$3, margin: ZERO$3, color: 'var(--iox-accent)',
|
|
2391
2392
|
};
|
|
2392
2393
|
const SWIPER_THEME_COLOR = '#007aff';
|
|
2393
2394
|
function legacyLookOf(slider) {
|
|
@@ -2403,17 +2404,17 @@ function legacyLookOf(slider) {
|
|
|
2403
2404
|
/** One part, from the recipe (board 6: `button-secondary` controls, token dots) or in a migrated slider's legacy look. */
|
|
2404
2405
|
function buildSliderPart(create, role, legacy) {
|
|
2405
2406
|
if (role === SliderRole.Bar) {
|
|
2406
|
-
const bar = makeCompositePart(create, { key: 'bar', type: Type$
|
|
2407
|
+
const bar = makeCompositePart(create, { key: 'bar', type: Type$4.Container, props: {}, elementStyle: NO_ELEMENT_STYLE }, role, PART_LABEL[role], BAR_BASE$1);
|
|
2407
2408
|
bar.children = [];
|
|
2408
2409
|
return bar;
|
|
2409
2410
|
}
|
|
2410
2411
|
if (role === SliderRole.Caption || role === SliderRole.Count) {
|
|
2411
2412
|
// Their words are the runtime's (the slide in view), drawn as the part's generated content: the node's own
|
|
2412
2413
|
// content stays empty, so no renderer ever fights the runtime over the element's text.
|
|
2413
|
-
return makeCompositePart(create, { key: role.split('.')[1], type: Type$
|
|
2414
|
+
return makeCompositePart(create, { key: role.split('.')[1], type: Type$4.Text, props: { content: '', tag: 'p' }, elementStyle: Style$4.Words }, role, PART_LABEL[role], role === SliderRole.Caption ? CAPTION_BASE$1 : COUNT_BASE);
|
|
2414
2415
|
}
|
|
2415
2416
|
if (role === SliderRole.Pagination) {
|
|
2416
|
-
const dots = makeCompositePart(create, { key: 'pagination', type: Type$
|
|
2417
|
+
const dots = makeCompositePart(create, { key: 'pagination', type: Type$4.Container, props: {}, elementStyle: NO_ELEMENT_STYLE }, role, PART_LABEL[role], legacy?.paginationColor ? { ...PAGINATION_BASE, color: legacy.paginationColor } : PAGINATION_BASE);
|
|
2417
2418
|
dots.children = [];
|
|
2418
2419
|
return dots;
|
|
2419
2420
|
}
|
|
@@ -2422,16 +2423,16 @@ function buildSliderPart(create, role, legacy) {
|
|
|
2422
2423
|
// is the shared CSS's, logical, so the arrows swap sides in RTL.
|
|
2423
2424
|
const placed = role === SliderRole.Pause ? CONTROL_BASE : { ...CONTROL_BASE, top: ARROW_TOP };
|
|
2424
2425
|
const base = legacy
|
|
2425
|
-
? { ...placed, backgroundColor: 'transparent', borderWidth: ZERO$
|
|
2426
|
+
? { ...placed, backgroundColor: 'transparent', borderWidth: ZERO$3, color: legacy.navigationColor ?? SWIPER_THEME_COLOR, boxShadow: 'none' }
|
|
2426
2427
|
: placed;
|
|
2427
2428
|
// Previous / Next carry their accessible name (Swiper's A11y module reads it); the pause control's name is its
|
|
2428
2429
|
// runtime's — it says what pressing it will do.
|
|
2429
2430
|
const props = { tag: 'button', type: 'button' };
|
|
2430
2431
|
if (role !== SliderRole.Pause)
|
|
2431
2432
|
props[SLIDER_NAME_TRAIT] = role === SliderRole.Prev ? SLIDER_WORDS.en.prev : SLIDER_WORDS.en.next;
|
|
2432
|
-
const button = makeCompositePart(create, { key, type: Type$
|
|
2433
|
+
const button = makeCompositePart(create, { key, type: Type$4.ButtonBlock, props, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$4.Control }, role, PART_LABEL[role], base);
|
|
2433
2434
|
const iconBase = legacy ? { ...ICON_BASE, fontSize: `${Math.round((legacy.navigationSize ?? 44) * 0.6)}px` } : ICON_BASE;
|
|
2434
|
-
const icon = makeCompositePart(create, { key: `${key}-icon`, type: Type$
|
|
2435
|
+
const icon = makeCompositePart(create, { key: `${key}-icon`, type: Type$4.Icon, props: { iconClass: SLIDER_PART_GLYPH[role] }, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$4.Icon }, null, 'Icon', iconBase);
|
|
2435
2436
|
button.children = [icon];
|
|
2436
2437
|
return button;
|
|
2437
2438
|
}
|
|
@@ -2524,8 +2525,8 @@ function placeBeforeSlides(kept, part, role) {
|
|
|
2524
2525
|
/** The layout a control has over the picture (its recipe's place: absolute, the arrows at the vertical middle). */
|
|
2525
2526
|
function overLayoutFor(role) {
|
|
2526
2527
|
if (role === SliderRole.Pagination)
|
|
2527
|
-
return { position: 'absolute', margin: ZERO$
|
|
2528
|
-
return role === SliderRole.Pause ? { position: 'absolute', top: 'auto', margin: ZERO$
|
|
2528
|
+
return { position: 'absolute', margin: ZERO$3 };
|
|
2529
|
+
return role === SliderRole.Pause ? { position: 'absolute', top: 'auto', margin: ZERO$3 } : { position: 'absolute', top: ARROW_TOP, margin: ZERO$3 };
|
|
2529
2530
|
}
|
|
2530
2531
|
/**
|
|
2531
2532
|
* Move the controls over the picture or into the bar under it (premium M4, M1.3 — Slider ▸ Controls) — ONE edit and
|
|
@@ -2640,7 +2641,7 @@ const QUOTE_SLIDE_BASE = {
|
|
|
2640
2641
|
* page's direction), the dots under them. */
|
|
2641
2642
|
const ROW_CONTROL_BASE = { position: 'static', display: 'inline-flex', margin: '0px 4px 12px 4px' };
|
|
2642
2643
|
const ROW_DOTS_BASE = { position: 'static', margin: '12px 0px 0px 0px' };
|
|
2643
|
-
const QUOTE_TEXT_BASE = { margin: ZERO$
|
|
2644
|
+
const QUOTE_TEXT_BASE = { margin: ZERO$3, padding: ZERO$3, minHeight: 'auto', width: 'auto' };
|
|
2644
2645
|
/**
|
|
2645
2646
|
* The testimonial carousel (board 6): a named Slider, one quote per slide (each a `card`), rotating every 5s with its
|
|
2646
2647
|
* control parts — the pause control first, Previous · Next, the dots. ONE recipe for the composer and the builder.
|
|
@@ -3016,7 +3017,7 @@ const DIALOG = 'Dialog';
|
|
|
3016
3017
|
const REPEATER$1 = 'Repeater';
|
|
3017
3018
|
const SOURCE = 'source';
|
|
3018
3019
|
const SOURCE_PATH = 'sourcePath';
|
|
3019
|
-
const ZERO$
|
|
3020
|
+
const ZERO$2 = '0px 0px 0px 0px';
|
|
3020
3021
|
const DIALOG_BASE = {
|
|
3021
3022
|
width: '100vw', maxWidth: '100vw', height: '100dvh', maxHeight: '100dvh', borderRadius: '0px', padding: '18px 18px 18px 18px',
|
|
3022
3023
|
display: 'flex', flexDirection: 'column', gap: '0px',
|
|
@@ -3025,7 +3026,7 @@ const DIALOG_BASE = {
|
|
|
3025
3026
|
* the row so its counter shares it. */
|
|
3026
3027
|
const CLOSE_BASE = {
|
|
3027
3028
|
display: 'flex', alignItems: 'center', justifyContent: 'center', width: '44px', height: '44px', minWidth: '44px',
|
|
3028
|
-
padding: ZERO$
|
|
3029
|
+
padding: ZERO$2, margin: ZERO$2, borderRadius: '999px', alignSelf: 'flex-end', flexShrink: '0', position: 'relative', zIndex: '20',
|
|
3029
3030
|
};
|
|
3030
3031
|
const SLIDER_BASE = { width: '100%', height: '100%', minHeight: '0px', flexGrow: '1', margin: '-44px 0px 0px 0px' };
|
|
3031
3032
|
const SLIDE_BASE = {
|
|
@@ -3033,13 +3034,13 @@ const SLIDE_BASE = {
|
|
|
3033
3034
|
justifyContent: 'center', gap: '12px', padding: '56px 64px 16px 64px',
|
|
3034
3035
|
};
|
|
3035
3036
|
const IMAGE_BASE$1 = { width: '100%', height: 'auto', maxHeight: '72dvh', minHeight: '0px', objectFit: 'contain', aspectRatio: '4 / 3', flexShrink: '1' };
|
|
3036
|
-
const CAPTION_BASE = { textAlign: 'center', margin: ZERO$
|
|
3037
|
+
const CAPTION_BASE = { textAlign: 'center', margin: ZERO$2, padding: ZERO$2, minHeight: 'auto', width: 'auto' };
|
|
3037
3038
|
/** The counter "3 / 6" sits at the START of the top row, Close at its end (board 6). */
|
|
3038
3039
|
const COUNTER_BASE$1 = { color: 'var(--iox-text-muted)', top: '12px', alignItems: 'flex-start', justifyContent: 'flex-start' };
|
|
3039
3040
|
/** On a phone the arrows give way to a swipe (board 6, "the arrows hide on touch-only widths"). */
|
|
3040
3041
|
const LIGHTBOX_ARROWS_HIDE_AT = 'mobile';
|
|
3041
3042
|
/** A click on `node` runs one instant action on `target`. */
|
|
3042
|
-
function onClick(node, type, target, params) {
|
|
3043
|
+
function onClick$1(node, type, target, params) {
|
|
3043
3044
|
node.interactions = [{
|
|
3044
3045
|
id: `${node.id ?? 'node'}-click`, trigger: 'click',
|
|
3045
3046
|
actions: [{ type, target, duration: 0, delay: 0, easing: 'ease', ...(params ? { params } : {}) }],
|
|
@@ -3075,7 +3076,7 @@ function buildLightboxRecipe(create, options = {}) {
|
|
|
3075
3076
|
setColorScheme(dialog, 'inverse');
|
|
3076
3077
|
const close = makeCompositePart(create, { key: 'close', type: 'ButtonBlock', props: { tag: 'button', type: 'button', ariaLabel: 'Close' }, elementStyle: 'button-ghost' }, null, 'Close', CLOSE_BASE);
|
|
3077
3078
|
close.children = [makeCompositePart(create, { key: 'close-icon', type: 'Icon', props: { iconClass: 'ph ph-x' }, elementStyle: 'icon' }, null, 'Icon', { fontSize: '22px', color: 'inherit' })];
|
|
3078
|
-
onClick(close, 'closeDialog', dialog.id ?? '');
|
|
3079
|
+
onClick$1(close, 'closeDialog', dialog.id ?? '');
|
|
3079
3080
|
const slider = makeCompositePart(create, { key: 'slider', type: SLIDER_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slider', SLIDER_BASE);
|
|
3080
3081
|
for (const [name, value] of Object.entries({
|
|
3081
3082
|
slidesPerView: 1, spaceBetween: 0, loop: 'off', enableNavigation: true, enablePagination: true, paginationType: 'fraction',
|
|
@@ -3205,15 +3206,15 @@ const TABS_WORDS = [
|
|
|
3205
3206
|
{ label: 'Third tab', text: 'Say what this tab is about in a sentence or two. Its picture sits beside it.' },
|
|
3206
3207
|
];
|
|
3207
3208
|
const TABS_NEW_TAB_WORDS = { label: 'New tab', text: 'Say what this tab is about in a sentence or two. Its picture sits beside it.' };
|
|
3208
|
-
var Type$
|
|
3209
|
+
var Type$3;
|
|
3209
3210
|
(function (Type) {
|
|
3210
3211
|
Type["Container"] = "Container";
|
|
3211
3212
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
3212
3213
|
Type["Text"] = "Text";
|
|
3213
3214
|
Type["Image"] = "Image";
|
|
3214
3215
|
Type["Repeater"] = "Repeater";
|
|
3215
|
-
})(Type$
|
|
3216
|
-
var Style$
|
|
3216
|
+
})(Type$3 || (Type$3 = {}));
|
|
3217
|
+
var Style$3;
|
|
3217
3218
|
(function (Style) {
|
|
3218
3219
|
Style["Root"] = "box";
|
|
3219
3220
|
Style["List"] = "tab-list";
|
|
@@ -3223,10 +3224,10 @@ var Style$2;
|
|
|
3223
3224
|
Style["Panel"] = "box";
|
|
3224
3225
|
Style["Media"] = "media";
|
|
3225
3226
|
Style["Body"] = "body";
|
|
3226
|
-
})(Style$
|
|
3227
|
+
})(Style$3 || (Style$3 = {}));
|
|
3227
3228
|
const ZERO_BOX$1 = '0px 0px 0px 0px';
|
|
3228
3229
|
/** The list's hairline, as its element style writes it — read from the contract, never retyped. */
|
|
3229
|
-
const LIST_EDGE = String(elementStyleById(Style$
|
|
3230
|
+
const LIST_EDGE = String(elementStyleById(Style$3.List)?.base['borderWidth'] ?? ZERO_BOX$1);
|
|
3230
3231
|
/** What each part holds — layout only; its LOOK is its element style. The list WRAPS at narrow widths (board 3). */
|
|
3231
3232
|
const PART_BASE$1 = {
|
|
3232
3233
|
[TabsRole.Tabs]: { display: 'flex', width: '100%', minHeight: 'auto', height: 'auto' },
|
|
@@ -3260,30 +3261,30 @@ function make$1(create, key, type, role, style, props = {}, label) {
|
|
|
3260
3261
|
}
|
|
3261
3262
|
/** One tab and its panel, sharing `itemKey`. */
|
|
3262
3263
|
function buildTabPair(create, words, itemKey) {
|
|
3263
|
-
const tab = make$1(create, `${itemKey}-tab`, Type$
|
|
3264
|
+
const tab = make$1(create, `${itemKey}-tab`, Type$3.ButtonBlock, TabsRole.Trigger, Style$3.Tab, {}, 'Tab');
|
|
3264
3265
|
tab.itemKey = itemKey;
|
|
3265
|
-
const label = make$1(create, `${itemKey}-label`, Type$
|
|
3266
|
+
const label = make$1(create, `${itemKey}-label`, Type$3.Text, null, Style$3.Label, { content: words.label, tag: 'span' }, 'Text');
|
|
3266
3267
|
writeStyles(label, LABEL_BASE$1);
|
|
3267
3268
|
tab.children = [label];
|
|
3268
|
-
const panel = make$1(create, `${itemKey}-panel`, Type$
|
|
3269
|
+
const panel = make$1(create, `${itemKey}-panel`, Type$3.Container, TabsRole.Panel, Style$3.Panel, {}, 'Panel');
|
|
3269
3270
|
panel.itemKey = itemKey;
|
|
3270
3271
|
writeLayerStyles(panel, TABS_STACK_BREAKPOINT, PANEL_STACK);
|
|
3271
|
-
const image = make$1(create, `${itemKey}-image`, Type$
|
|
3272
|
+
const image = make$1(create, `${itemKey}-image`, Type$3.Image, null, Style$3.Media, { src: '', alt: '' }, 'Image');
|
|
3272
3273
|
writeStyles(image, IMAGE_BASE);
|
|
3273
|
-
const text = make$1(create, `${itemKey}-text`, Type$
|
|
3274
|
+
const text = make$1(create, `${itemKey}-text`, Type$3.Text, null, Style$3.Body, { content: words.text, tag: 'p' }, 'Text');
|
|
3274
3275
|
writeStyles(text, BODY_BASE);
|
|
3275
3276
|
panel.children = [image, text];
|
|
3276
3277
|
return { tab, panel };
|
|
3277
3278
|
}
|
|
3278
3279
|
/** A fresh Tabs: three tabs, the first on, activated by a click, the list across the top (board 3). */
|
|
3279
3280
|
function buildTabsRecipe(create, options = {}) {
|
|
3280
|
-
const root = make$1(create, 'tabs', Type$
|
|
3281
|
+
const root = make$1(create, 'tabs', Type$3.Container, TabsRole.Tabs, Style$3.Root, {}, 'Tabs');
|
|
3281
3282
|
writeProp(root, TabsBehaviourTrait.ActivateOn, options.activateOn ?? TabsActivateOn.Click);
|
|
3282
3283
|
writeProp(root, TabsBehaviourTrait.Orientation, options.orientation ?? TabsOrientation.Horizontal);
|
|
3283
3284
|
if (options.label)
|
|
3284
3285
|
writeProp(root, TabsBehaviourTrait.Label, options.label);
|
|
3285
|
-
const list = make$1(create, 'list', Type$
|
|
3286
|
-
const panels = make$1(create, 'panels', Type$
|
|
3286
|
+
const list = make$1(create, 'list', Type$3.Container, TabsRole.List, Style$3.List, {}, 'Tab list');
|
|
3287
|
+
const panels = make$1(create, 'panels', Type$3.Container, TabsRole.Panels, Style$3.Panels, {}, 'Panels');
|
|
3287
3288
|
const pairs = (options.tabs ?? TABS_WORDS).map((w, i) => buildTabPair(create, w, `k${i + 1}`));
|
|
3288
3289
|
list.children = pairs.map(p => p.tab);
|
|
3289
3290
|
panels.children = pairs.map(p => p.panel);
|
|
@@ -3313,7 +3314,7 @@ function tabsPanels(root) {
|
|
|
3313
3314
|
}
|
|
3314
3315
|
/** True when the Tabs takes its tabs from content (its list is a Repeater, R3). */
|
|
3315
3316
|
function isTabsFromContent(root) {
|
|
3316
|
-
return !!root && tabsListOf(root)?.type === Type$
|
|
3317
|
+
return !!root && tabsListOf(root)?.type === Type$3.Repeater;
|
|
3317
3318
|
}
|
|
3318
3319
|
/** The panel paired with `tab` (the same key), or undefined. From content the one template panel pairs the template tab. */
|
|
3319
3320
|
function tabPanelOf(root, tab) {
|
|
@@ -3338,7 +3339,7 @@ function tabsPartnerOf(root, node) {
|
|
|
3338
3339
|
/** The words a tab shows: its first Text's. */
|
|
3339
3340
|
function tabLabelNodeOf(tab) {
|
|
3340
3341
|
let hit;
|
|
3341
|
-
walkComposite(tab, n => { if (!hit && n !== tab && n.type === Type$
|
|
3342
|
+
walkComposite(tab, n => { if (!hit && n !== tab && n.type === Type$3.Text)
|
|
3342
3343
|
hit = n; });
|
|
3343
3344
|
return hit;
|
|
3344
3345
|
}
|
|
@@ -3356,14 +3357,14 @@ function renameTab(tab, words) {
|
|
|
3356
3357
|
/** The first Text inside a panel (the words From content binds to). */
|
|
3357
3358
|
function tabPanelTextOf(panel) {
|
|
3358
3359
|
let hit;
|
|
3359
|
-
walkComposite(panel, n => { if (!hit && n !== panel && n.type === Type$
|
|
3360
|
+
walkComposite(panel, n => { if (!hit && n !== panel && n.type === Type$3.Text)
|
|
3360
3361
|
hit = n; });
|
|
3361
3362
|
return hit;
|
|
3362
3363
|
}
|
|
3363
3364
|
/** The first Image inside a panel. */
|
|
3364
3365
|
function tabPanelImageOf(panel) {
|
|
3365
3366
|
let hit;
|
|
3366
|
-
walkComposite(panel, n => { if (!hit && n.type === Type$
|
|
3367
|
+
walkComposite(panel, n => { if (!hit && n.type === Type$3.Image)
|
|
3367
3368
|
hit = n; });
|
|
3368
3369
|
return hit;
|
|
3369
3370
|
}
|
|
@@ -3717,18 +3718,18 @@ const SEGMENTED_NAME = 'Billing period';
|
|
|
3717
3718
|
/** Q33: the saving badge's words start as a PLACEHOLDER — a saving is a price claim, never invented. */
|
|
3718
3719
|
const SEGMENTED_BADGE_WORDS = 'Yearly saving';
|
|
3719
3720
|
const SEGMENTED_BADGE_TONE = BadgeTone.Success;
|
|
3720
|
-
var Type$
|
|
3721
|
+
var Type$2;
|
|
3721
3722
|
(function (Type) {
|
|
3722
3723
|
Type["Container"] = "Container";
|
|
3723
3724
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
3724
3725
|
Type["Text"] = "Text";
|
|
3725
|
-
})(Type$
|
|
3726
|
-
var Style$
|
|
3726
|
+
})(Type$2 || (Type$2 = {}));
|
|
3727
|
+
var Style$2;
|
|
3727
3728
|
(function (Style) {
|
|
3728
3729
|
Style["Root"] = "segmented";
|
|
3729
3730
|
Style["Option"] = "segmented-option";
|
|
3730
3731
|
Style["Label"] = "button-label";
|
|
3731
|
-
})(Style$
|
|
3732
|
+
})(Style$2 || (Style$2 = {}));
|
|
3732
3733
|
const ZERO_BOX = '0px 0px 0px 0px';
|
|
3733
3734
|
/** What each part holds — layout only; its LOOK is its element style (the track's fill, border, radius and pad; the
|
|
3734
3735
|
* option's ink, pad, radius and 44px target). The options sit in a flex row a gap token apart (board 10); each GROWS,
|
|
@@ -3746,9 +3747,9 @@ function make(create, key, type, role, style, props = {}, label) {
|
|
|
3746
3747
|
}
|
|
3747
3748
|
/** One option: a ButtonBlock carrying its key, holding its words. */
|
|
3748
3749
|
function buildSegmentedOption(create, words) {
|
|
3749
|
-
const option = make(create, `${words.key}-option`, Type$
|
|
3750
|
+
const option = make(create, `${words.key}-option`, Type$2.ButtonBlock, SegmentedRole.Option, Style$2.Option, {}, 'Option');
|
|
3750
3751
|
option.itemKey = words.key;
|
|
3751
|
-
const label = make(create, `${words.key}-label`, Type$
|
|
3752
|
+
const label = make(create, `${words.key}-label`, Type$2.Text, null, Style$2.Label, { content: words.label, tag: 'span' }, 'Text');
|
|
3752
3753
|
writeStyles(label, LABEL_BASE);
|
|
3753
3754
|
option.children = [label];
|
|
3754
3755
|
return option;
|
|
@@ -3756,7 +3757,7 @@ function buildSegmentedOption(create, words) {
|
|
|
3756
3757
|
/** A fresh Segmented control: Monthly · Yearly, Monthly on, named "Billing period" (board 10 ▸ Palette). */
|
|
3757
3758
|
function buildSegmentedRecipe(create, options = {}) {
|
|
3758
3759
|
const words = options.options ?? SEGMENTED_WORDS;
|
|
3759
|
-
const root = make(create, 'segmented', Type$
|
|
3760
|
+
const root = make(create, 'segmented', Type$2.Container, SegmentedRole.Segmented, Style$2.Root, {}, 'Segmented');
|
|
3760
3761
|
root.children = words.map(w => buildSegmentedOption(create, w));
|
|
3761
3762
|
writeProp(root, SegmentedTrait.DefaultOn, options.defaultOn && words.some(w => w.key === options.defaultOn) ? options.defaultOn : words[0]?.key ?? '');
|
|
3762
3763
|
writeProp(root, SegmentedTrait.Label, options.label ?? SEGMENTED_NAME);
|
|
@@ -3783,10 +3784,10 @@ function segmentedOptionLabelNodeOf(option) {
|
|
|
3783
3784
|
for (const child of option.children ?? []) {
|
|
3784
3785
|
if (child.role === SegmentedRole.Badge)
|
|
3785
3786
|
continue;
|
|
3786
|
-
if (child.type === Type$
|
|
3787
|
+
if (child.type === Type$2.Text)
|
|
3787
3788
|
return child;
|
|
3788
3789
|
let hit;
|
|
3789
|
-
walkComposite(child, n => { if (!hit && n.type === Type$
|
|
3790
|
+
walkComposite(child, n => { if (!hit && n.type === Type$2.Text)
|
|
3790
3791
|
hit = n; });
|
|
3791
3792
|
if (hit)
|
|
3792
3793
|
return hit;
|
|
@@ -4041,6 +4042,11 @@ function closestExclusive(el) {
|
|
|
4041
4042
|
function closestExclusiveItemPart(el) {
|
|
4042
4043
|
return el?.closest?.(ITEM_PART_SELECTOR) ?? null;
|
|
4043
4044
|
}
|
|
4045
|
+
/** A trigger that cannot be turned on: `aria-disabled="true"` or a disabled button (a sold-out variant value). It stays
|
|
4046
|
+
* visible and announced, is skipped by the arrow keys and refuses a click (APG radio group). */
|
|
4047
|
+
function isExclusiveTriggerDisabled(el) {
|
|
4048
|
+
return !!el && (el.getAttribute('aria-disabled') === 'true' || el.disabled === true);
|
|
4049
|
+
}
|
|
4044
4050
|
const kindOf = (root) => {
|
|
4045
4051
|
const raw = root.getAttribute(COMPOSITE_ATTRIBUTE);
|
|
4046
4052
|
return isExclusiveKind(raw) ? raw : CompositeKind.Tabs;
|
|
@@ -4059,7 +4065,7 @@ function behaviourOf(root) {
|
|
|
4059
4065
|
orientation: TABS_ORIENTATIONS.includes(orientation) ? orientation : TabsOrientation.Horizontal,
|
|
4060
4066
|
};
|
|
4061
4067
|
}
|
|
4062
|
-
function setAttr(el, name, value) {
|
|
4068
|
+
function setAttr$1(el, name, value) {
|
|
4063
4069
|
if (!el)
|
|
4064
4070
|
return;
|
|
4065
4071
|
if (value === null) {
|
|
@@ -4105,9 +4111,9 @@ class ExclusiveRuntime {
|
|
|
4105
4111
|
const action = this.holdsTriggers ? segmentedKeyAction(e.key, rtl) : tabsKeyAction(e.key, this.behaviourValue.orientation, rtl);
|
|
4106
4112
|
if (!action)
|
|
4107
4113
|
return;
|
|
4108
|
-
const triggers = this.triggers();
|
|
4114
|
+
const triggers = this.triggers().filter(t => t === trigger || !isExclusiveTriggerDisabled(t));
|
|
4109
4115
|
const target = triggers[accordionFocusIndex(action, triggers.indexOf(trigger), triggers.length)];
|
|
4110
|
-
if (!target)
|
|
4116
|
+
if (!target || isExclusiveTriggerDisabled(target))
|
|
4111
4117
|
return;
|
|
4112
4118
|
e.preventDefault();
|
|
4113
4119
|
target.focus();
|
|
@@ -4145,7 +4151,7 @@ class ExclusiveRuntime {
|
|
|
4145
4151
|
}
|
|
4146
4152
|
/** THIS composite's triggers in document order (a nested composite's are its own). */
|
|
4147
4153
|
triggers() {
|
|
4148
|
-
return this.own(TRIGGER_SELECTOR);
|
|
4154
|
+
return this.own(this.options.triggerSelector ?? TRIGGER_SELECTOR);
|
|
4149
4155
|
}
|
|
4150
4156
|
/** THIS composite's panels in document order. */
|
|
4151
4157
|
panels() {
|
|
@@ -4174,7 +4180,8 @@ class ExclusiveRuntime {
|
|
|
4174
4180
|
}
|
|
4175
4181
|
/** Turn `key` on (a click, a key, a hover, the `openItem` action, "Showing on canvas"). */
|
|
4176
4182
|
activate(key) {
|
|
4177
|
-
|
|
4183
|
+
const trigger = this.triggers().find(t => this.keyOf(t) === key);
|
|
4184
|
+
if (!trigger || isExclusiveTriggerDisabled(trigger))
|
|
4178
4185
|
return;
|
|
4179
4186
|
const changed = key !== this.live;
|
|
4180
4187
|
this.live = key;
|
|
@@ -4207,9 +4214,13 @@ class ExclusiveRuntime {
|
|
|
4207
4214
|
}
|
|
4208
4215
|
/** The key on with no server state: the asked default when it names an item, else the first item. */
|
|
4209
4216
|
defaultKey() {
|
|
4210
|
-
const
|
|
4217
|
+
const triggers = this.triggers();
|
|
4218
|
+
const keys = triggers.map(t => this.keyOf(t));
|
|
4219
|
+
const enabled = triggers.filter(t => !isExclusiveTriggerDisabled(t)).map(t => this.keyOf(t));
|
|
4211
4220
|
const asked = this.options.defaultKey?.() ?? this.root.getAttribute(DEFAULT_ON_ATTRIBUTE);
|
|
4212
|
-
|
|
4221
|
+
if (asked && keys.includes(asked))
|
|
4222
|
+
return asked;
|
|
4223
|
+
return enabled[0] ?? keys[0] ?? null;
|
|
4213
4224
|
}
|
|
4214
4225
|
/** True for a Segmented control: the root IS its radio group and holds its options. */
|
|
4215
4226
|
get holdsTriggers() {
|
|
@@ -4256,10 +4267,10 @@ class ExclusiveRuntime {
|
|
|
4256
4267
|
const rootId = this.rootId();
|
|
4257
4268
|
const vertical = this.behaviourValue.orientation === TabsOrientation.Vertical;
|
|
4258
4269
|
for (const list of this.lists()) {
|
|
4259
|
-
setAttr(list, 'role', 'tablist');
|
|
4260
|
-
setAttr(list, 'aria-orientation', vertical ? 'vertical' : null);
|
|
4270
|
+
setAttr$1(list, 'role', 'tablist');
|
|
4271
|
+
setAttr$1(list, 'aria-orientation', vertical ? 'vertical' : null);
|
|
4261
4272
|
if (this.options.label)
|
|
4262
|
-
setAttr(list, 'aria-label', this.options.label() || null);
|
|
4273
|
+
setAttr$1(list, 'aria-label', this.options.label() || null);
|
|
4263
4274
|
}
|
|
4264
4275
|
const panels = this.panels();
|
|
4265
4276
|
const panelOf = (key) => panels.find(p => this.keyOf(p) === key) ?? null;
|
|
@@ -4267,43 +4278,43 @@ class ExclusiveRuntime {
|
|
|
4267
4278
|
const key = this.keyOf(trigger);
|
|
4268
4279
|
const on = key === next;
|
|
4269
4280
|
const ids = accordionDomIds(rootId, key, CompositeKind.Tabs);
|
|
4270
|
-
setAttr(trigger, ITEM_KEY_ATTRIBUTE, key);
|
|
4271
|
-
setAttr(trigger, 'type', trigger.tagName === 'BUTTON' ? 'button' : null);
|
|
4272
|
-
setAttr(trigger, 'role', 'tab');
|
|
4273
|
-
setAttr(trigger, 'id', ids.trigger);
|
|
4274
|
-
setAttr(trigger, 'aria-selected', on ? 'true' : 'false');
|
|
4275
|
-
setAttr(trigger, 'aria-controls', panelOf(key) ? ids.panel : null);
|
|
4276
|
-
setAttr(trigger, 'tabindex', on ? '0' : '-1');
|
|
4277
|
-
setAttr(trigger, ON_ATTRIBUTE, on ? '' : null);
|
|
4281
|
+
setAttr$1(trigger, ITEM_KEY_ATTRIBUTE, key);
|
|
4282
|
+
setAttr$1(trigger, 'type', trigger.tagName === 'BUTTON' ? 'button' : null);
|
|
4283
|
+
setAttr$1(trigger, 'role', 'tab');
|
|
4284
|
+
setAttr$1(trigger, 'id', ids.trigger);
|
|
4285
|
+
setAttr$1(trigger, 'aria-selected', on ? 'true' : 'false');
|
|
4286
|
+
setAttr$1(trigger, 'aria-controls', panelOf(key) ? ids.panel : null);
|
|
4287
|
+
setAttr$1(trigger, 'tabindex', on ? '0' : '-1');
|
|
4288
|
+
setAttr$1(trigger, ON_ATTRIBUTE, on ? '' : null);
|
|
4278
4289
|
}
|
|
4279
4290
|
for (const panel of panels) {
|
|
4280
4291
|
const key = this.keyOf(panel);
|
|
4281
4292
|
const on = key === next;
|
|
4282
4293
|
const ids = accordionDomIds(rootId, key, CompositeKind.Tabs);
|
|
4283
|
-
setAttr(panel, ITEM_KEY_ATTRIBUTE, key);
|
|
4284
|
-
setAttr(panel, 'role', 'tabpanel');
|
|
4285
|
-
setAttr(panel, 'id', ids.panel);
|
|
4286
|
-
setAttr(panel, 'aria-labelledby', ids.trigger);
|
|
4287
|
-
setAttr(panel, 'tabindex', '0');
|
|
4288
|
-
setAttr(panel, ON_ATTRIBUTE, on ? '' : null);
|
|
4289
|
-
setAttr(panel, 'hidden', on ? null : '');
|
|
4294
|
+
setAttr$1(panel, ITEM_KEY_ATTRIBUTE, key);
|
|
4295
|
+
setAttr$1(panel, 'role', 'tabpanel');
|
|
4296
|
+
setAttr$1(panel, 'id', ids.panel);
|
|
4297
|
+
setAttr$1(panel, 'aria-labelledby', ids.trigger);
|
|
4298
|
+
setAttr$1(panel, 'tabindex', '0');
|
|
4299
|
+
setAttr$1(panel, ON_ATTRIBUTE, on ? '' : null);
|
|
4300
|
+
setAttr$1(panel, 'hidden', on ? null : '');
|
|
4290
4301
|
}
|
|
4291
4302
|
this.announce(triggers, next, first, panelOf);
|
|
4292
4303
|
}
|
|
4293
4304
|
/** A Segmented control's markup (CC4b): the root a named radio group, each option a radio, one checked. */
|
|
4294
4305
|
stampRadioGroup(options, next, first) {
|
|
4295
|
-
setAttr(this.root, 'role', 'radiogroup');
|
|
4306
|
+
setAttr$1(this.root, 'role', 'radiogroup');
|
|
4296
4307
|
if (this.options.label)
|
|
4297
|
-
setAttr(this.root, 'aria-label', this.options.label() || null);
|
|
4308
|
+
setAttr$1(this.root, 'aria-label', this.options.label() || null);
|
|
4298
4309
|
for (const option of options) {
|
|
4299
4310
|
const key = this.keyOf(option);
|
|
4300
4311
|
const on = key === next;
|
|
4301
|
-
setAttr(option, ITEM_KEY_ATTRIBUTE, key);
|
|
4302
|
-
setAttr(option, 'type', option.tagName === 'BUTTON' ? 'button' : null);
|
|
4303
|
-
setAttr(option, 'role', 'radio');
|
|
4304
|
-
setAttr(option, 'aria-checked', on ? 'true' : 'false');
|
|
4305
|
-
setAttr(option, 'tabindex', on ? '0' : '-1');
|
|
4306
|
-
setAttr(option, ON_ATTRIBUTE, on ? '' : null);
|
|
4312
|
+
setAttr$1(option, ITEM_KEY_ATTRIBUTE, key);
|
|
4313
|
+
setAttr$1(option, 'type', option.tagName === 'BUTTON' ? 'button' : null);
|
|
4314
|
+
setAttr$1(option, 'role', 'radio');
|
|
4315
|
+
setAttr$1(option, 'aria-checked', on ? 'true' : 'false');
|
|
4316
|
+
setAttr$1(option, 'tabindex', on ? '0' : '-1');
|
|
4317
|
+
setAttr$1(option, ON_ATTRIBUTE, on ? '' : null);
|
|
4307
4318
|
}
|
|
4308
4319
|
this.announce(options, next, first);
|
|
4309
4320
|
}
|
|
@@ -4323,7 +4334,7 @@ class ExclusiveRuntime {
|
|
|
4323
4334
|
}
|
|
4324
4335
|
}
|
|
4325
4336
|
ownTrigger(target) {
|
|
4326
|
-
const trigger = target?.closest?.(TRIGGER_SELECTOR);
|
|
4337
|
+
const trigger = target?.closest?.(this.options.triggerSelector ?? TRIGGER_SELECTOR);
|
|
4327
4338
|
return trigger && closestExclusive(trigger.parentElement) === this.root ? trigger : null;
|
|
4328
4339
|
}
|
|
4329
4340
|
}
|
|
@@ -4686,25 +4697,25 @@ const MARQUEE_NOSCRIPT_CSS = `.${roleClass(MarqueeRole.Pause)}{display:none!impo
|
|
|
4686
4697
|
* hides it until it plays, so it counts in the first screen too (a number already read is never taken away).
|
|
4687
4698
|
* - the READING BAR (N7): a thin bar that fills as the page — or its section — is read, sticky at the top of what holds it.
|
|
4688
4699
|
*/
|
|
4689
|
-
var Type;
|
|
4700
|
+
var Type$1;
|
|
4690
4701
|
(function (Type) {
|
|
4691
4702
|
Type["Container"] = "Container";
|
|
4692
4703
|
Type["Text"] = "Text";
|
|
4693
|
-
})(Type || (Type = {}));
|
|
4694
|
-
var Style;
|
|
4704
|
+
})(Type$1 || (Type$1 = {}));
|
|
4705
|
+
var Style$1;
|
|
4695
4706
|
(function (Style) {
|
|
4696
4707
|
Style["Box"] = "box";
|
|
4697
4708
|
Style["Number"] = "price";
|
|
4698
4709
|
Style["Words"] = "small";
|
|
4699
4710
|
Style["Bar"] = "progress-bar";
|
|
4700
|
-
})(Style || (Style = {}));
|
|
4701
|
-
const ZERO = '0px 0px 0px 0px';
|
|
4702
|
-
const COUNTER_BASE = { display: 'flex', flexDirection: 'column', gap: '6px', minHeight: 'auto', width: 'auto', padding: ZERO };
|
|
4703
|
-
const NUMBER_BASE = { margin: ZERO, width: 'auto' };
|
|
4704
|
-
const WORDS_BASE = { margin: ZERO, width: 'auto' };
|
|
4711
|
+
})(Style$1 || (Style$1 = {}));
|
|
4712
|
+
const ZERO$1 = '0px 0px 0px 0px';
|
|
4713
|
+
const COUNTER_BASE = { display: 'flex', flexDirection: 'column', gap: '6px', minHeight: 'auto', width: 'auto', padding: ZERO$1 };
|
|
4714
|
+
const NUMBER_BASE = { margin: ZERO$1, width: 'auto' };
|
|
4715
|
+
const WORDS_BASE = { margin: ZERO$1, width: 'auto' };
|
|
4705
4716
|
/** Sticky at the top of what holds it, over its neighbours (a low layer — never past the app's scale), full width. */
|
|
4706
4717
|
const BAR_BASE = {
|
|
4707
|
-
display: 'block', position: 'sticky', top: '0px', zIndex: '2', width: '100%', minHeight: '0px', margin: ZERO, padding: ZERO,
|
|
4718
|
+
display: 'block', position: 'sticky', top: '0px', zIndex: '2', width: '100%', minHeight: '0px', margin: ZERO$1, padding: ZERO$1,
|
|
4708
4719
|
};
|
|
4709
4720
|
/** The entrance that hides a counter's number until it plays: lead content rises a little as it fades (Emil 46). */
|
|
4710
4721
|
const COUNTER_ENTRANCE = Object.freeze({ type: 'moveUp', duration: 500, distance: 12, easing: 'ease-enter' });
|
|
@@ -4714,9 +4725,9 @@ const COUNTER_SAMPLE_WORDS = Object.freeze({ number: '1,250+', label: 'projects
|
|
|
4714
4725
|
/** A number that counts up once, and its words (Components ▸ Interactive ▸ Counter). */
|
|
4715
4726
|
function buildCounterRecipe(create, words = {}) {
|
|
4716
4727
|
const text = { ...COUNTER_SAMPLE_WORDS, ...words };
|
|
4717
|
-
const root = makeCompositePart(create, { key: 'counter', type: Type.Container, props: {}, elementStyle: Style.Box }, null, 'Counter', COUNTER_BASE);
|
|
4718
|
-
const number = makeCompositePart(create, { key: 'counter-number', type: Type.Text, props: { content: text.number }, elementStyle: Style.Number }, null, 'Number', NUMBER_BASE);
|
|
4719
|
-
const label = makeCompositePart(create, { key: 'counter-label', type: Type.Text, props: { content: text.label }, elementStyle: Style.Words }, null, 'Words', WORDS_BASE);
|
|
4728
|
+
const root = makeCompositePart(create, { key: 'counter', type: Type$1.Container, props: {}, elementStyle: Style$1.Box }, null, 'Counter', COUNTER_BASE);
|
|
4729
|
+
const number = makeCompositePart(create, { key: 'counter-number', type: Type$1.Text, props: { content: text.number }, elementStyle: Style$1.Number }, null, 'Number', NUMBER_BASE);
|
|
4730
|
+
const label = makeCompositePart(create, { key: 'counter-label', type: Type$1.Text, props: { content: text.label }, elementStyle: Style$1.Words }, null, 'Words', WORDS_BASE);
|
|
4720
4731
|
const { distance, ...entrance } = COUNTER_ENTRANCE;
|
|
4721
4732
|
number.interactions = [{
|
|
4722
4733
|
id: `${number.id ?? 'counter'}-count`, trigger: 'viewportEnter',
|
|
@@ -4731,7 +4742,7 @@ function buildCounterRecipe(create, words = {}) {
|
|
|
4731
4742
|
/** A bar that fills as the page is read (Components ▸ Interactive ▸ Reading bar). Its range may be changed to "This
|
|
4732
4743
|
* section" in the Interactions panel. */
|
|
4733
4744
|
function buildReadingBarRecipe(create) {
|
|
4734
|
-
const bar = makeCompositePart(create, { key: 'reading-bar', type: Type.Container, props: {}, elementStyle: Style.Bar }, null, 'Reading bar', BAR_BASE);
|
|
4745
|
+
const bar = makeCompositePart(create, { key: 'reading-bar', type: Type$1.Container, props: {}, elementStyle: Style$1.Bar }, null, 'Reading bar', BAR_BASE);
|
|
4735
4746
|
bar.interactions = [{
|
|
4736
4747
|
id: `${bar.id ?? 'bar'}-read`, trigger: 'scrollProgress', range: 'page',
|
|
4737
4748
|
actions: [{ type: 'progressBar', target: 'self', duration: 1000, delay: 0, easing: 'linear' }],
|
|
@@ -4740,6 +4751,988 @@ function buildReadingBarRecipe(create) {
|
|
|
4740
4751
|
return bar;
|
|
4741
4752
|
}
|
|
4742
4753
|
|
|
4754
|
+
/**
|
|
4755
|
+
* THE SHOP PARTS (commerce E1c, C-D16 — commerce board 10). Not components: recipes of ordinary builder nodes, each part
|
|
4756
|
+
* carrying a role, so every part is selectable on the canvas, in the layer tree and the breadcrumb, and wears its own
|
|
4757
|
+
* element style (R2). ONE runtime (`shop-runtime.ts`, DOM only) fills them on the builder canvas and the live site:
|
|
4758
|
+
*
|
|
4759
|
+
* Price Container shop.price › Text shop.price-amount (`price`, $variant.price | money)
|
|
4760
|
+
* · Text shop.price-compare (`price-compare`, $variant.compareAt | money)
|
|
4761
|
+
* Options Container shop.variants › Container shop.variant-group (ONE template, stamped per option)
|
|
4762
|
+
* › Text shop.variant-label · Container shop.variant-values (the option's radio group)
|
|
4763
|
+
* › ButtonBlock shop.variant-value (`variant-chip`) › Text — the chip template
|
|
4764
|
+
* · ButtonBlock shop.variant-swatch (`variant-swatch`) — the swatch template
|
|
4765
|
+
* · Text shop.variant-note ("Charcoal is sold out")
|
|
4766
|
+
* Quantity Container shop.quantity (`quantity`) › − · Text shop.quantity-value · +
|
|
4767
|
+
* Add to cart ButtonBlock shop.add (`button-primary`, click → addToCart) › "Add to cart" · "Added ✓"
|
|
4768
|
+
* Buy now ButtonBlock shop.buy-now (`button-secondary`, click → startCheckout)
|
|
4769
|
+
* Cart button ButtonBlock shop.cart-button (`cart-button`) › Icon · Container shop.cart-count › Text $cart.count
|
|
4770
|
+
* Cart drawer Dialog shop.cart-drawer (end edge; a bottom sheet on a phone) › head · lines (ONE line template)
|
|
4771
|
+
* · issues · empty · free-delivery note · Subtotal ($cart.subtotal | money) · VAT note
|
|
4772
|
+
* · Check out · Keep shopping
|
|
4773
|
+
*
|
|
4774
|
+
* A template part (an option group, a value, a cart line) is the FIRST instance the runtime shows; the rest are its
|
|
4775
|
+
* copies (`data-iox-shop-clone`), so the template is what the author selects and styles, and every copy wears it.
|
|
4776
|
+
*/
|
|
4777
|
+
var ShopRole;
|
|
4778
|
+
(function (ShopRole) {
|
|
4779
|
+
ShopRole["Price"] = "shop.price";
|
|
4780
|
+
ShopRole["PriceAmount"] = "shop.price-amount";
|
|
4781
|
+
ShopRole["PriceCompare"] = "shop.price-compare";
|
|
4782
|
+
ShopRole["Variants"] = "shop.variants";
|
|
4783
|
+
ShopRole["VariantGroup"] = "shop.variant-group";
|
|
4784
|
+
ShopRole["VariantLabel"] = "shop.variant-label";
|
|
4785
|
+
ShopRole["VariantValues"] = "shop.variant-values";
|
|
4786
|
+
ShopRole["VariantValue"] = "shop.variant-value";
|
|
4787
|
+
ShopRole["VariantSwatch"] = "shop.variant-swatch";
|
|
4788
|
+
ShopRole["VariantNote"] = "shop.variant-note";
|
|
4789
|
+
ShopRole["Quantity"] = "shop.quantity";
|
|
4790
|
+
ShopRole["QuantityDown"] = "shop.quantity-down";
|
|
4791
|
+
ShopRole["QuantityValue"] = "shop.quantity-value";
|
|
4792
|
+
ShopRole["QuantityUp"] = "shop.quantity-up";
|
|
4793
|
+
ShopRole["Add"] = "shop.add";
|
|
4794
|
+
ShopRole["AddLabel"] = "shop.add-label";
|
|
4795
|
+
ShopRole["AddedLabel"] = "shop.added-label";
|
|
4796
|
+
ShopRole["BuyNow"] = "shop.buy-now";
|
|
4797
|
+
ShopRole["CartButton"] = "shop.cart-button";
|
|
4798
|
+
ShopRole["CartCount"] = "shop.cart-count";
|
|
4799
|
+
ShopRole["CartDrawer"] = "shop.cart-drawer";
|
|
4800
|
+
ShopRole["CartTitle"] = "shop.cart-title";
|
|
4801
|
+
ShopRole["CartClose"] = "shop.cart-close";
|
|
4802
|
+
ShopRole["CartLines"] = "shop.cart-lines";
|
|
4803
|
+
ShopRole["CartLine"] = "shop.cart-line";
|
|
4804
|
+
ShopRole["CartLineImage"] = "shop.cart-line-image";
|
|
4805
|
+
ShopRole["CartLineTitle"] = "shop.cart-line-title";
|
|
4806
|
+
ShopRole["CartLineVariant"] = "shop.cart-line-variant";
|
|
4807
|
+
ShopRole["CartLineRemove"] = "shop.cart-line-remove";
|
|
4808
|
+
ShopRole["CartLineTotal"] = "shop.cart-line-total";
|
|
4809
|
+
ShopRole["CartIssues"] = "shop.cart-issues";
|
|
4810
|
+
ShopRole["CartEmpty"] = "shop.cart-empty";
|
|
4811
|
+
ShopRole["CartShippingNote"] = "shop.cart-shipping-note";
|
|
4812
|
+
ShopRole["CartSummary"] = "shop.cart-summary";
|
|
4813
|
+
ShopRole["CartSubtotal"] = "shop.cart-subtotal";
|
|
4814
|
+
ShopRole["CartVatNote"] = "shop.cart-vat-note";
|
|
4815
|
+
ShopRole["Checkout"] = "shop.checkout";
|
|
4816
|
+
ShopRole["KeepShopping"] = "shop.keep-shopping";
|
|
4817
|
+
})(ShopRole || (ShopRole = {}));
|
|
4818
|
+
const SHOP_ROLES = new Set(Object.values(ShopRole));
|
|
4819
|
+
function isShopRole(role) {
|
|
4820
|
+
return !!role && SHOP_ROLES.has(role);
|
|
4821
|
+
}
|
|
4822
|
+
/** The CSS selector of a shop role (`.iox-role-shop-price`). */
|
|
4823
|
+
function shopSelector(role) {
|
|
4824
|
+
return `.${roleClass$1(role)}`;
|
|
4825
|
+
}
|
|
4826
|
+
/** The attributes the shop runtime writes (the shared CSS in `styles/iox-design.css` reads them). */
|
|
4827
|
+
const SHOP_CLONE_ATTRIBUTE = 'data-iox-shop-clone';
|
|
4828
|
+
/** A template the current product does not use (the swatch template of a word option) — never shown, never a trigger. */
|
|
4829
|
+
const SHOP_UNUSED_ATTRIBUTE = 'data-iox-shop-unused';
|
|
4830
|
+
/** "Added ✓" in place, for ADDED_HOLD_MS after a successful add. */
|
|
4831
|
+
const SHOP_ADDED_ATTRIBUTE = 'data-iox-added';
|
|
4832
|
+
/** An empty bag: on the cart button (its count hides) and the drawer (its lines, summary and Check out hide). */
|
|
4833
|
+
const CART_EMPTY_ATTRIBUTE = 'data-iox-cart-empty';
|
|
4834
|
+
/** A cart line's id (`cartLineId`) on its line element. */
|
|
4835
|
+
const CART_LINE_ATTRIBUTE = 'data-iox-line-id';
|
|
4836
|
+
/** The count the runtime adds to the drawer's title ("Your bag (2)"). */
|
|
4837
|
+
const CART_TITLE_COUNT_ATTRIBUTE = 'data-iox-cart-title-count';
|
|
4838
|
+
/** A part the runtime has no words for right now (a variant note with nothing sold out, a group with no option). */
|
|
4839
|
+
const SHOP_HIDDEN_ATTRIBUTE = 'data-iox-shop-hidden';
|
|
4840
|
+
/** The native select a long option list becomes (T26). */
|
|
4841
|
+
const SHOP_SELECT_CLASS = 'iox-shop-select';
|
|
4842
|
+
/** The polite live region the runtime announces "Added ✓" and refusals in. */
|
|
4843
|
+
const SHOP_LIVE_CLASS = 'iox-shop-live';
|
|
4844
|
+
/** How long "Added ✓" holds before the button reads "Add to cart" again (Emil: long enough to read, never a wait). */
|
|
4845
|
+
const ADDED_HOLD_MS = 1600;
|
|
4846
|
+
// ── the picker's kind (T26) ───────────────────────────────────────────────────────────────────
|
|
4847
|
+
var ShopPickerKind;
|
|
4848
|
+
(function (ShopPickerKind) {
|
|
4849
|
+
/** Words in outlined chips — up to SHOP_CHIP_MAX values. */
|
|
4850
|
+
ShopPickerKind["Chips"] = "chips";
|
|
4851
|
+
/** Round swatches of each value's colour — a colour option whose every value has a colour. */
|
|
4852
|
+
ShopPickerKind["Swatches"] = "swatches";
|
|
4853
|
+
/** A native select — past SHOP_CHIP_MAX values a row of chips no longer fits a phone (T26). */
|
|
4854
|
+
ShopPickerKind["Select"] = "select";
|
|
4855
|
+
})(ShopPickerKind || (ShopPickerKind = {}));
|
|
4856
|
+
/** The Segmented control's rule (Q40): four fit a phone row, five do not. */
|
|
4857
|
+
const SHOP_CHIP_MAX = 4;
|
|
4858
|
+
/** The option names that ARE a colour (en, he). */
|
|
4859
|
+
const COLOUR_OPTION_NAMES = ['color', 'colour', 'colors', 'colours', 'צבע', 'צבעים'];
|
|
4860
|
+
/** Colour words a value may be named by (en, he) — a value named "Navy" is drawn navy. Never a guess past these. */
|
|
4861
|
+
const NAMED_SWATCHES = Object.freeze({
|
|
4862
|
+
black: '#111111', white: '#FFFFFF', grey: '#8A8F98', gray: '#8A8F98', red: '#C62828', green: '#2E7D32', blue: '#1F4FD6',
|
|
4863
|
+
navy: '#1B2A4A', yellow: '#F2C94C', orange: '#E8833A', pink: '#E991B3', purple: '#7B4FA0', brown: '#7A5234', beige: '#D9C8A9',
|
|
4864
|
+
cream: '#F3EBD9', gold: '#C9A54C', silver: '#C0C4CA',
|
|
4865
|
+
'שחור': '#111111', 'לבן': '#FFFFFF', 'אפור': '#8A8F98', 'אדום': '#C62828', 'ירוק': '#2E7D32', 'כחול': '#1F4FD6',
|
|
4866
|
+
'צהוב': '#F2C94C', 'כתום': '#E8833A', 'ורוד': '#E991B3', 'סגול': '#7B4FA0', 'חום': '#7A5234', "בז'": '#D9C8A9',
|
|
4867
|
+
});
|
|
4868
|
+
const CSS_COLOUR = /^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla|oklch|oklab)\([^)]*\))$/i;
|
|
4869
|
+
/**
|
|
4870
|
+
* The fill a value is drawn with, or null: the host's own (the sample's glazes), else the value itself when it IS a CSS
|
|
4871
|
+
* colour (`#3A3B3D`), else a colour word. A value with no fill is never drawn as a blank swatch.
|
|
4872
|
+
*/
|
|
4873
|
+
function swatchFill(value, own) {
|
|
4874
|
+
const word = String(value ?? '').trim();
|
|
4875
|
+
if (!word)
|
|
4876
|
+
return null;
|
|
4877
|
+
if (own?.[word])
|
|
4878
|
+
return own[word];
|
|
4879
|
+
if (CSS_COLOUR.test(word))
|
|
4880
|
+
return word;
|
|
4881
|
+
return NAMED_SWATCHES[word.toLowerCase()] ?? null;
|
|
4882
|
+
}
|
|
4883
|
+
/**
|
|
4884
|
+
* How one option is chosen (T26): swatches when every value has a fill AND the option is a colour (or every value is
|
|
4885
|
+
* one — the sample's glazes), chips up to four values, a select past four.
|
|
4886
|
+
*/
|
|
4887
|
+
function shopPickerKind(option, own) {
|
|
4888
|
+
const fills = option.values.map(v => swatchFill(v, own));
|
|
4889
|
+
const colourName = COLOUR_OPTION_NAMES.includes(option.name.trim().toLowerCase());
|
|
4890
|
+
const allFilled = option.values.length > 0 && fills.every(Boolean);
|
|
4891
|
+
if (allFilled && (colourName || option.values.every(v => !!own?.[v])))
|
|
4892
|
+
return ShopPickerKind.Swatches;
|
|
4893
|
+
return option.values.length > SHOP_CHIP_MAX ? ShopPickerKind.Select : ShopPickerKind.Chips;
|
|
4894
|
+
}
|
|
4895
|
+
/** A group's label: "Glaze — Sand" when the chosen value has no words of its own on screen (a swatch), else "Size". */
|
|
4896
|
+
function variantGroupLabel(option, chosen, kind) {
|
|
4897
|
+
return kind === ShopPickerKind.Swatches && chosen ? `${option.name} — ${chosen}` : option.name;
|
|
4898
|
+
}
|
|
4899
|
+
/** The words under a swatch group: what is sold out ("Charcoal is sold out"), '' when nothing is or the values speak. */
|
|
4900
|
+
function variantGroupNote(soldOut, kind, lang) {
|
|
4901
|
+
if (kind !== ShopPickerKind.Swatches || !soldOut.length)
|
|
4902
|
+
return '';
|
|
4903
|
+
return soldOut.map(name => shopWord(ShopWord.ValueSoldOut, lang, { name })).join(' · ');
|
|
4904
|
+
}
|
|
4905
|
+
// ── recipes ─────────────────────────────────────────────────────────────────────────────────────
|
|
4906
|
+
var Type;
|
|
4907
|
+
(function (Type) {
|
|
4908
|
+
Type["Container"] = "Container";
|
|
4909
|
+
Type["ButtonBlock"] = "ButtonBlock";
|
|
4910
|
+
Type["Text"] = "Text";
|
|
4911
|
+
Type["Heading"] = "Heading";
|
|
4912
|
+
Type["Icon"] = "Icon";
|
|
4913
|
+
Type["Image"] = "Image";
|
|
4914
|
+
Type["Dialog"] = "Dialog";
|
|
4915
|
+
})(Type || (Type = {}));
|
|
4916
|
+
var Style;
|
|
4917
|
+
(function (Style) {
|
|
4918
|
+
Style["Price"] = "price";
|
|
4919
|
+
Style["PriceCompare"] = "price-compare";
|
|
4920
|
+
Style["Small"] = "small";
|
|
4921
|
+
Style["Body"] = "body";
|
|
4922
|
+
Style["Chip"] = "variant-chip";
|
|
4923
|
+
Style["Swatch"] = "variant-swatch";
|
|
4924
|
+
Style["Quantity"] = "quantity";
|
|
4925
|
+
Style["QuantityButton"] = "quantity-button";
|
|
4926
|
+
Style["Label"] = "button-label";
|
|
4927
|
+
Style["Primary"] = "button-primary";
|
|
4928
|
+
Style["Secondary"] = "button-secondary";
|
|
4929
|
+
Style["Ghost"] = "button-ghost";
|
|
4930
|
+
Style["CartButton"] = "cart-button";
|
|
4931
|
+
Style["CartCount"] = "cart-count";
|
|
4932
|
+
Style["CartLine"] = "cart-line";
|
|
4933
|
+
Style["CartNote"] = "cart-note";
|
|
4934
|
+
Style["Dialog"] = "dialog";
|
|
4935
|
+
Style["Media"] = "media";
|
|
4936
|
+
Style["Icon"] = "icon";
|
|
4937
|
+
Style["Title"] = "h3";
|
|
4938
|
+
})(Style || (Style = {}));
|
|
4939
|
+
/** The words a fresh recipe shows (board 10's sample) — the runtime writes the product's own over them. */
|
|
4940
|
+
const SHOP_RECIPE_WORDS = Object.freeze({
|
|
4941
|
+
price: '₪240.00',
|
|
4942
|
+
compareAt: '₪280.00',
|
|
4943
|
+
option: 'Glaze — Sand',
|
|
4944
|
+
value: '32 cm',
|
|
4945
|
+
note: 'Charcoal is sold out',
|
|
4946
|
+
quantity: '1',
|
|
4947
|
+
add: 'Add to cart',
|
|
4948
|
+
added: 'Added ✓',
|
|
4949
|
+
buyNow: 'Buy now',
|
|
4950
|
+
cart: 'Bag',
|
|
4951
|
+
count: '2',
|
|
4952
|
+
drawer: 'Your bag',
|
|
4953
|
+
close: 'Close',
|
|
4954
|
+
lineTitle: 'Tall speckled vase',
|
|
4955
|
+
lineVariant: 'Sand · 32 cm',
|
|
4956
|
+
lineTotal: '₪240.00',
|
|
4957
|
+
remove: 'Remove',
|
|
4958
|
+
empty: 'Your bag is empty.',
|
|
4959
|
+
shippingNote: 'Add ₪40.00 more for free delivery',
|
|
4960
|
+
subtotalLabel: 'Subtotal',
|
|
4961
|
+
subtotal: '₪360.00',
|
|
4962
|
+
vatNote: 'Includes VAT. Delivery is chosen at checkout.',
|
|
4963
|
+
checkout: 'Check out',
|
|
4964
|
+
keepShopping: 'Keep shopping',
|
|
4965
|
+
});
|
|
4966
|
+
const SHOP_LABELS = Object.freeze({
|
|
4967
|
+
price: 'Price', variants: 'Options', quantity: 'Quantity', add: 'Add to cart', buyNow: 'Buy now', cartButton: 'Cart button', cartDrawer: 'Cart drawer',
|
|
4968
|
+
});
|
|
4969
|
+
const ZERO = '0px 0px 0px 0px';
|
|
4970
|
+
const WORDS = { width: 'auto', minHeight: 'auto', padding: ZERO, margin: ZERO };
|
|
4971
|
+
const ROW = { display: 'flex', flexDirection: 'row', alignItems: 'center', width: 'auto', height: 'auto', minHeight: 'auto', padding: ZERO };
|
|
4972
|
+
const COLUMN = { display: 'flex', flexDirection: 'column', alignItems: 'stretch', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO };
|
|
4973
|
+
/** "Add to cart" and "Added ✓" share ONE grid cell, so the button never changes width as they swap (Emil: in place). */
|
|
4974
|
+
const STACKED = { gridColumn: '1', gridRow: '1', ...WORDS };
|
|
4975
|
+
/** A click on `node` runs one action (`target` '' = the runtime finds its own: the page's product, the page's drawer). */
|
|
4976
|
+
function onClick(node, type, target = '') {
|
|
4977
|
+
node.interactions = [{
|
|
4978
|
+
id: `${node.id ?? 'node'}-click`, trigger: 'click',
|
|
4979
|
+
actions: [{ type, target, duration: 0, delay: 0, easing: 'ease' }],
|
|
4980
|
+
}];
|
|
4981
|
+
}
|
|
4982
|
+
/** Bind `prop` to a shop slot path, through the money pipe when asked. */
|
|
4983
|
+
function bindSlot(node, prop, source, path, money = false) {
|
|
4984
|
+
const bindings = (node.bindings ?? []).filter(b => b.prop !== prop);
|
|
4985
|
+
bindings.push({ prop, source, path, ...(money ? { pipes: [{ name: 'money', args: [] }] } : {}) });
|
|
4986
|
+
node.bindings = bindings;
|
|
4987
|
+
}
|
|
4988
|
+
function part(create, key, type, role, style, props, label, base) {
|
|
4989
|
+
return makeCompositePart(create, { key, type, props, elementStyle: style ?? undefined }, role, label, base);
|
|
4990
|
+
}
|
|
4991
|
+
function text(create, key, role, style, words, label, base = WORDS, tag = 'p') {
|
|
4992
|
+
return part(create, key, Type.Text, role, style, { content: words, tag }, label, base);
|
|
4993
|
+
}
|
|
4994
|
+
function icon(create, key, iconClass, size = '18px') {
|
|
4995
|
+
return part(create, key, Type.Icon, null, Style.Icon, { iconClass }, 'Icon', { fontSize: size, color: 'inherit' });
|
|
4996
|
+
}
|
|
4997
|
+
function button(create, key, role, style, label, ariaLabel = '', base = {}) {
|
|
4998
|
+
return part(create, key, Type.ButtonBlock, role, style, { tag: 'button', type: 'button', ...(ariaLabel ? { ariaLabel } : {}) }, label, base);
|
|
4999
|
+
}
|
|
5000
|
+
/** Price: the variant's price and, when it is higher, its earlier price struck through (board 10). */
|
|
5001
|
+
function buildPriceRecipe(create) {
|
|
5002
|
+
const root = part(create, 'price', Type.Container, ShopRole.Price, null, {}, SHOP_LABELS.price, { ...ROW, alignItems: 'baseline', flexWrap: 'wrap', gap: '8px' });
|
|
5003
|
+
const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style.Price, SHOP_RECIPE_WORDS.price, 'Price');
|
|
5004
|
+
bindSlot(amount, 'content', '$variant', 'price', true);
|
|
5005
|
+
const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare, SHOP_RECIPE_WORDS.compareAt, 'Price before');
|
|
5006
|
+
bindSlot(compare, 'content', '$variant', 'compareAt', true);
|
|
5007
|
+
root.children = [amount, compare];
|
|
5008
|
+
return root;
|
|
5009
|
+
}
|
|
5010
|
+
/** Options: one group per option, each a radio group of chips, swatches or a select (T26). */
|
|
5011
|
+
function buildVariantPickerRecipe(create) {
|
|
5012
|
+
const root = part(create, 'variants', Type.Container, ShopRole.Variants, null, {}, SHOP_LABELS.variants, { ...COLUMN, gap: '16px' });
|
|
5013
|
+
const group = part(create, 'variant-group', Type.Container, ShopRole.VariantGroup, null, {}, 'Option', { ...COLUMN, gap: '6px' });
|
|
5014
|
+
const label = text(create, 'variant-label', ShopRole.VariantLabel, Style.Small, SHOP_RECIPE_WORDS.option, 'Option name');
|
|
5015
|
+
const values = part(create, 'variant-values', Type.Container, ShopRole.VariantValues, null, {}, 'Values', { ...ROW, flexWrap: 'wrap', gap: '8px' });
|
|
5016
|
+
const chip = button(create, 'variant-value', ShopRole.VariantValue, Style.Chip, 'Value', '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
5017
|
+
chip.children = [text(create, 'variant-value-text', null, Style.Label, SHOP_RECIPE_WORDS.value, 'Text', WORDS, 'span')];
|
|
5018
|
+
const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style.Swatch, 'Swatch', 'Sand', { padding: ZERO, minWidth: '0px', minHeight: '0px' });
|
|
5019
|
+
values.children = [chip, swatch];
|
|
5020
|
+
const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small, SHOP_RECIPE_WORDS.note, 'Sold-out note');
|
|
5021
|
+
group.children = [label, values, note];
|
|
5022
|
+
root.children = [group];
|
|
5023
|
+
return root;
|
|
5024
|
+
}
|
|
5025
|
+
/** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. */
|
|
5026
|
+
function buildQuantityRecipe(create, compact = false, key = 'quantity') {
|
|
5027
|
+
const size = compact ? '30px' : 'var(--iox-stepper-size)';
|
|
5028
|
+
const root = part(create, key, Type.Container, ShopRole.Quantity, Style.Quantity, {}, SHOP_LABELS.quantity, { ...ROW, alignItems: 'stretch', gap: '0px', ...(compact ? { minHeight: size } : {}) });
|
|
5029
|
+
const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease', 'Decrease quantity', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
5030
|
+
down.children = [icon(create, `${key}-down-icon`, 'ph ph-minus', compact ? '14px' : '16px')];
|
|
5031
|
+
const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body, SHOP_RECIPE_WORDS.quantity, 'Count', { ...WORDS, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: compact ? '32px' : '40px', fontVariantNumeric: 'tabular-nums' }, 'span');
|
|
5032
|
+
const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style.QuantityButton, 'Increase', 'Increase quantity', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
5033
|
+
up.children = [icon(create, `${key}-up-icon`, 'ph ph-plus', compact ? '14px' : '16px')];
|
|
5034
|
+
root.children = [down, value, up];
|
|
5035
|
+
return root;
|
|
5036
|
+
}
|
|
5037
|
+
/** Add to cart: presses on pointer-down (its element style), then reads "Added ✓" in place for ADDED_HOLD_MS. */
|
|
5038
|
+
function buildAddToCartRecipe(create) {
|
|
5039
|
+
const root = button(create, 'add', ShopRole.Add, Style.Primary, SHOP_LABELS.add, '', { display: 'inline-grid', alignItems: 'center', justifyItems: 'center', flexGrow: '1', width: 'auto', height: 'auto' });
|
|
5040
|
+
root.children = [
|
|
5041
|
+
text(create, 'add-label', ShopRole.AddLabel, Style.Label, SHOP_RECIPE_WORDS.add, 'Add', STACKED, 'span'),
|
|
5042
|
+
text(create, 'added-label', ShopRole.AddedLabel, Style.Label, SHOP_RECIPE_WORDS.added, 'Added', STACKED, 'span'),
|
|
5043
|
+
];
|
|
5044
|
+
onClick(root, 'addToCart');
|
|
5045
|
+
return root;
|
|
5046
|
+
}
|
|
5047
|
+
/** Buy now: straight to checkout with this variant (inert on the canvas). */
|
|
5048
|
+
function buildBuyNowRecipe(create) {
|
|
5049
|
+
const root = button(create, 'buy-now', ShopRole.BuyNow, Style.Secondary, SHOP_LABELS.buyNow, '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
5050
|
+
root.children = [text(create, 'buy-now-label', null, Style.Label, SHOP_RECIPE_WORDS.buyNow, 'Text', WORDS, 'span')];
|
|
5051
|
+
onClick(root, 'startCheckout');
|
|
5052
|
+
return root;
|
|
5053
|
+
}
|
|
5054
|
+
/** The bag button with its live count ($cart.count); it opens the page's cart drawer. */
|
|
5055
|
+
function buildCartButtonRecipe(create) {
|
|
5056
|
+
const root = button(create, 'cart-button', ShopRole.CartButton, Style.CartButton, SHOP_LABELS.cartButton, SHOP_RECIPE_WORDS.cart, { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', padding: '6px 6px 6px 6px', position: 'relative' });
|
|
5057
|
+
const count = part(create, 'cart-count', Type.Container, ShopRole.CartCount, Style.CartCount, {}, 'Count', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', minHeight: 'auto', padding: '0px 4px 0px 4px', position: 'absolute', top: '-5px', right: '-5px' });
|
|
5058
|
+
const words = text(create, 'cart-count-text', null, Style.Label, SHOP_RECIPE_WORDS.count, 'Text', { ...WORDS, lineHeight: '1' }, 'span');
|
|
5059
|
+
bindSlot(words, 'content', '$cart', 'count');
|
|
5060
|
+
count.children = [words];
|
|
5061
|
+
root.children = [icon(create, 'cart-icon', 'ph ph-handbag'), count];
|
|
5062
|
+
return root;
|
|
5063
|
+
}
|
|
5064
|
+
/** One cart line: thumbnail · title, variant, quantity and Remove · line total (board 10). */
|
|
5065
|
+
function buildCartLine(create) {
|
|
5066
|
+
const line = part(create, 'cart-line', Type.Container, ShopRole.CartLine, Style.CartLine, {}, 'Line', { display: 'grid', gridTemplateColumns: 'var(--iox-cart-thumb-size) minmax(0, 1fr) auto', alignItems: 'start', gap: '12px', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO });
|
|
5067
|
+
const image = part(create, 'cart-line-image', Type.Image, ShopRole.CartLineImage, Style.Media, { src: '', alt: '' }, 'Image', { width: 'var(--iox-cart-thumb-size)', height: 'var(--iox-cart-thumb-size)', minHeight: '0px', objectFit: 'cover', aspectRatio: '1 / 1' });
|
|
5068
|
+
const info = part(create, 'cart-line-info', Type.Container, null, null, {}, 'Details', { ...COLUMN, gap: '2px', minWidth: '0px' });
|
|
5069
|
+
const title = text(create, 'cart-line-title', ShopRole.CartLineTitle, Style.Body, SHOP_RECIPE_WORDS.lineTitle, 'Title', { ...WORDS, fontWeight: '500' });
|
|
5070
|
+
const variant = text(create, 'cart-line-variant', ShopRole.CartLineVariant, Style.Small, SHOP_RECIPE_WORDS.lineVariant, 'Variant', { ...WORDS, margin: '0px 0px 6px 0px' });
|
|
5071
|
+
const actions = part(create, 'cart-line-actions', Type.Container, null, null, {}, 'Actions', { ...ROW, gap: '12px' });
|
|
5072
|
+
const remove = button(create, 'cart-line-remove', ShopRole.CartLineRemove, Style.Ghost, 'Remove', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
5073
|
+
remove.children = [text(create, 'cart-line-remove-text', null, Style.Small, SHOP_RECIPE_WORDS.remove, 'Text', WORDS, 'span')];
|
|
5074
|
+
actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity'), remove];
|
|
5075
|
+
info.children = [title, variant, actions];
|
|
5076
|
+
const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style.Price, SHOP_RECIPE_WORDS.lineTotal, 'Line total', { ...WORDS, fontSize: 'var(--iox-size-body)', textAlign: 'end' });
|
|
5077
|
+
line.children = [image, info, total];
|
|
5078
|
+
return line;
|
|
5079
|
+
}
|
|
5080
|
+
/** The cart drawer: a Dialog at the end edge (a bottom sheet on a phone — shared CSS), filled from the PRICED cart. */
|
|
5081
|
+
function buildCartDrawerRecipe(create) {
|
|
5082
|
+
const drawer = part(create, 'cart-drawer', Type.Dialog, ShopRole.CartDrawer, Style.Dialog, {}, SHOP_LABELS.cartDrawer, { width: '380px', maxWidth: '100%', display: 'flex', flexDirection: 'column', gap: '14px' });
|
|
5083
|
+
writeProp(drawer, 'placement', 'end');
|
|
5084
|
+
writeProp(drawer, 'closeOnBackdrop', true);
|
|
5085
|
+
writeProp(drawer, 'showCloseButton', false);
|
|
5086
|
+
writeProp(drawer, 'ariaLabel', SHOP_RECIPE_WORDS.drawer);
|
|
5087
|
+
const head = part(create, 'cart-head', Type.Container, null, null, {}, 'Head', { ...ROW, width: '100%', justifyContent: 'space-between', gap: '12px' });
|
|
5088
|
+
const title = part(create, 'cart-title', Type.Heading, ShopRole.CartTitle, Style.Title, { content: SHOP_RECIPE_WORDS.drawer, level: 'h2' }, 'Title', WORDS);
|
|
5089
|
+
const close = button(create, 'cart-close', ShopRole.CartClose, Style.Ghost, 'Close', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
5090
|
+
close.children = [text(create, 'cart-close-text', null, Style.Small, SHOP_RECIPE_WORDS.close, 'Text', WORDS, 'span')];
|
|
5091
|
+
onClick(close, 'closeDialog', drawer.id ?? '');
|
|
5092
|
+
head.children = [title, close];
|
|
5093
|
+
const lines = part(create, 'cart-lines', Type.Container, ShopRole.CartLines, null, {}, 'Lines', { ...COLUMN, gap: '16px' });
|
|
5094
|
+
lines.children = [buildCartLine(create)];
|
|
5095
|
+
const issues = text(create, 'cart-issues', ShopRole.CartIssues, Style.Small, '', 'Issues', { ...WORDS, color: 'var(--iox-danger)' });
|
|
5096
|
+
const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style.Body, SHOP_RECIPE_WORDS.empty, 'Empty');
|
|
5097
|
+
const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style.CartNote, SHOP_RECIPE_WORDS.shippingNote, 'Free delivery note', { width: 'auto', minHeight: 'auto', margin: ZERO });
|
|
5098
|
+
const summary = part(create, 'cart-summary', Type.Container, ShopRole.CartSummary, null, {}, 'Subtotal', { ...ROW, width: '100%', justifyContent: 'space-between', gap: '12px' });
|
|
5099
|
+
const subtotal = text(create, 'cart-subtotal', ShopRole.CartSubtotal, Style.Body, SHOP_RECIPE_WORDS.subtotal, 'Amount', { ...WORDS, fontVariantNumeric: 'tabular-nums', fontWeight: '600' }, 'span');
|
|
5100
|
+
bindSlot(subtotal, 'content', '$cart', 'subtotal', true);
|
|
5101
|
+
summary.children = [text(create, 'cart-subtotal-label', null, Style.Body, SHOP_RECIPE_WORDS.subtotalLabel, 'Label', WORDS, 'span'), subtotal];
|
|
5102
|
+
const vat = text(create, 'cart-vat-note', ShopRole.CartVatNote, Style.Small, SHOP_RECIPE_WORDS.vatNote, 'VAT note');
|
|
5103
|
+
const checkout = button(create, 'checkout', ShopRole.Checkout, Style.Primary, 'Check out', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
5104
|
+
checkout.children = [text(create, 'checkout-label', null, Style.Label, SHOP_RECIPE_WORDS.checkout, 'Text', WORDS, 'span')];
|
|
5105
|
+
const keep = button(create, 'keep-shopping', ShopRole.KeepShopping, Style.Secondary, 'Keep shopping', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
5106
|
+
keep.children = [text(create, 'keep-shopping-label', null, Style.Label, SHOP_RECIPE_WORDS.keepShopping, 'Text', WORDS, 'span')];
|
|
5107
|
+
onClick(keep, 'closeDialog', drawer.id ?? '');
|
|
5108
|
+
drawer.children = [head, lines, issues, empty, note, summary, vat, checkout, keep];
|
|
5109
|
+
return drawer;
|
|
5110
|
+
}
|
|
5111
|
+
/** The recipes the palette's Shop group offers, in its order. */
|
|
5112
|
+
var ShopRecipe;
|
|
5113
|
+
(function (ShopRecipe) {
|
|
5114
|
+
ShopRecipe["Price"] = "price";
|
|
5115
|
+
ShopRecipe["Variants"] = "variants";
|
|
5116
|
+
ShopRecipe["Quantity"] = "quantity";
|
|
5117
|
+
ShopRecipe["Add"] = "add";
|
|
5118
|
+
ShopRecipe["BuyNow"] = "buyNow";
|
|
5119
|
+
ShopRecipe["CartButton"] = "cartButton";
|
|
5120
|
+
ShopRecipe["CartDrawer"] = "cartDrawer";
|
|
5121
|
+
})(ShopRecipe || (ShopRecipe = {}));
|
|
5122
|
+
const SHOP_RECIPES = Object.freeze({
|
|
5123
|
+
[ShopRecipe.Price]: buildPriceRecipe,
|
|
5124
|
+
[ShopRecipe.Variants]: buildVariantPickerRecipe,
|
|
5125
|
+
[ShopRecipe.Quantity]: (create) => buildQuantityRecipe(create),
|
|
5126
|
+
[ShopRecipe.Add]: buildAddToCartRecipe,
|
|
5127
|
+
[ShopRecipe.BuyNow]: buildBuyNowRecipe,
|
|
5128
|
+
[ShopRecipe.CartButton]: buildCartButtonRecipe,
|
|
5129
|
+
[ShopRecipe.CartDrawer]: buildCartDrawerRecipe,
|
|
5130
|
+
});
|
|
5131
|
+
|
|
5132
|
+
const sel = shopSelector;
|
|
5133
|
+
const CLONE = `[${SHOP_CLONE_ATTRIBUTE}]`;
|
|
5134
|
+
const VALUE_TRIGGERS = `${sel(ShopRole.VariantValue)}:not([${SHOP_UNUSED_ATTRIBUTE}]), ${sel(ShopRole.VariantSwatch)}:not([${SHOP_UNUSED_ATTRIBUTE}])`;
|
|
5135
|
+
const SCOPES = new Map();
|
|
5136
|
+
function setAttr(el, name, value) {
|
|
5137
|
+
if (!el)
|
|
5138
|
+
return;
|
|
5139
|
+
if (value === null) {
|
|
5140
|
+
if (el.hasAttribute(name))
|
|
5141
|
+
el.removeAttribute(name);
|
|
5142
|
+
}
|
|
5143
|
+
else if (el.getAttribute(name) !== value)
|
|
5144
|
+
el.setAttribute(name, value);
|
|
5145
|
+
}
|
|
5146
|
+
function setText(el, words) {
|
|
5147
|
+
if (el && el.textContent !== words)
|
|
5148
|
+
el.textContent = words;
|
|
5149
|
+
}
|
|
5150
|
+
/** The deepest element of a Text / Heading part that holds its words (a host may wrap them). */
|
|
5151
|
+
function wordsOf(el) {
|
|
5152
|
+
if (!el)
|
|
5153
|
+
return null;
|
|
5154
|
+
let cur = el;
|
|
5155
|
+
while (cur.children.length === 1 && !cur.hasAttribute(CART_TITLE_COUNT_ATTRIBUTE))
|
|
5156
|
+
cur = cur.children[0];
|
|
5157
|
+
return cur;
|
|
5158
|
+
}
|
|
5159
|
+
/** A part's own element when it is a copy's template part, so a copy's parts are found inside the copy. */
|
|
5160
|
+
function own(scope, selector) {
|
|
5161
|
+
return Array.from(scope.querySelectorAll(selector));
|
|
5162
|
+
}
|
|
5163
|
+
function first(scope, selector) {
|
|
5164
|
+
return scope.querySelector(selector);
|
|
5165
|
+
}
|
|
5166
|
+
/** Copies of `template` (siblings after it, marked as its copies), made or dropped to `count - 1`. */
|
|
5167
|
+
function stampCopies(template, count, key) {
|
|
5168
|
+
const parent = template.parentElement;
|
|
5169
|
+
if (!parent)
|
|
5170
|
+
return [template];
|
|
5171
|
+
const mark = template.getAttribute(SHOP_CLONE_ATTRIBUTE) === null ? key : '';
|
|
5172
|
+
const copies = Array.from(parent.children).filter(c => c !== template && c.getAttribute(SHOP_CLONE_ATTRIBUTE) === mark);
|
|
5173
|
+
while (copies.length > Math.max(0, count - 1))
|
|
5174
|
+
copies.pop().remove();
|
|
5175
|
+
let anchor = copies[copies.length - 1] ?? template;
|
|
5176
|
+
while (copies.length < count - 1) {
|
|
5177
|
+
const copy = template.cloneNode(true);
|
|
5178
|
+
copy.setAttribute(SHOP_CLONE_ATTRIBUTE, mark);
|
|
5179
|
+
for (const inner of Array.from(copy.querySelectorAll(CLONE)))
|
|
5180
|
+
inner.remove();
|
|
5181
|
+
for (const id of Array.from(copy.querySelectorAll('[id]')))
|
|
5182
|
+
id.removeAttribute('id');
|
|
5183
|
+
copy.removeAttribute('id');
|
|
5184
|
+
anchor.after(copy);
|
|
5185
|
+
anchor = copy;
|
|
5186
|
+
copies.push(copy);
|
|
5187
|
+
}
|
|
5188
|
+
return [template, ...copies];
|
|
5189
|
+
}
|
|
5190
|
+
/** Only the words on screen are in the button's name: "Add to cart", or "Added ✓" while it holds. */
|
|
5191
|
+
function syncAddedWords(button, added) {
|
|
5192
|
+
setAttr(button, SHOP_ADDED_ATTRIBUTE, added ? '' : null);
|
|
5193
|
+
for (const label of Array.from(button.querySelectorAll(sel(ShopRole.AddLabel))))
|
|
5194
|
+
setAttr(label, 'aria-hidden', added ? 'true' : null);
|
|
5195
|
+
for (const label of Array.from(button.querySelectorAll(sel(ShopRole.AddedLabel))))
|
|
5196
|
+
setAttr(label, 'aria-hidden', added ? null : 'true');
|
|
5197
|
+
}
|
|
5198
|
+
function announce(scope, words) {
|
|
5199
|
+
const doc = scope.ownerDocument;
|
|
5200
|
+
if (!doc)
|
|
5201
|
+
return;
|
|
5202
|
+
let live = scope.querySelector(`.${SHOP_LIVE_CLASS}`);
|
|
5203
|
+
if (!live) {
|
|
5204
|
+
live = doc.createElement('div');
|
|
5205
|
+
live.className = SHOP_LIVE_CLASS;
|
|
5206
|
+
live.setAttribute('role', 'status');
|
|
5207
|
+
live.setAttribute('aria-live', 'polite');
|
|
5208
|
+
scope.appendChild(live);
|
|
5209
|
+
}
|
|
5210
|
+
live.textContent = '';
|
|
5211
|
+
live.textContent = words;
|
|
5212
|
+
}
|
|
5213
|
+
class ShopRuntime {
|
|
5214
|
+
constructor(scope, host) {
|
|
5215
|
+
this.scope = scope;
|
|
5216
|
+
this.host = host;
|
|
5217
|
+
this.products = new Map();
|
|
5218
|
+
this.cart = emptyCartView();
|
|
5219
|
+
this.observer = null;
|
|
5220
|
+
this.stampQueued = false;
|
|
5221
|
+
this.stamping = false;
|
|
5222
|
+
this.addedTimers = new Map();
|
|
5223
|
+
this.pageProduct = null;
|
|
5224
|
+
this.destroyed = false;
|
|
5225
|
+
/** What each slot last carried: an unchanged value is never published again (a host's binding re-render must not
|
|
5226
|
+
* wake the runtime into publishing the same thing for ever). */
|
|
5227
|
+
this.published = new Map();
|
|
5228
|
+
this.onClick = (event) => {
|
|
5229
|
+
const target = event.target;
|
|
5230
|
+
if (!target?.closest)
|
|
5231
|
+
return;
|
|
5232
|
+
const copy = target.closest(CLONE);
|
|
5233
|
+
if (copy && this.host.onCloneClick)
|
|
5234
|
+
this.selectTemplateOf(copy, target);
|
|
5235
|
+
const step = target.closest(`${sel(ShopRole.QuantityDown)}, ${sel(ShopRole.QuantityUp)}`);
|
|
5236
|
+
if (step) {
|
|
5237
|
+
if (step.getAttribute('aria-disabled') === 'true')
|
|
5238
|
+
return;
|
|
5239
|
+
const dir = step.matches(sel(ShopRole.QuantityUp)) ? QuantityStep.Up : QuantityStep.Down;
|
|
5240
|
+
const line = step.closest(`[${CART_LINE_ATTRIBUTE}]`);
|
|
5241
|
+
if (line) {
|
|
5242
|
+
const known = this.cart.lines.find(l => l.lineId === line.getAttribute(CART_LINE_ATTRIBUTE));
|
|
5243
|
+
if (known)
|
|
5244
|
+
void this.changeLine(line, stepQuantity(known.quantity, dir, { min: 1, max: known.maxQuantity }));
|
|
5245
|
+
return;
|
|
5246
|
+
}
|
|
5247
|
+
const state = this.stateFor(step);
|
|
5248
|
+
if (!state)
|
|
5249
|
+
return;
|
|
5250
|
+
state.quantity = stepQuantity(state.quantity, dir, this.boundsOf(state));
|
|
5251
|
+
this.pageProduct = String(state.product._id);
|
|
5252
|
+
this.stamp();
|
|
5253
|
+
return;
|
|
5254
|
+
}
|
|
5255
|
+
const remove = target.closest(sel(ShopRole.CartLineRemove));
|
|
5256
|
+
const removeLine = remove?.closest(`[${CART_LINE_ATTRIBUTE}]`);
|
|
5257
|
+
if (removeLine) {
|
|
5258
|
+
void this.changeLine(removeLine, null);
|
|
5259
|
+
return;
|
|
5260
|
+
}
|
|
5261
|
+
if (target.closest(sel(ShopRole.CartButton))) {
|
|
5262
|
+
this.openCart();
|
|
5263
|
+
return;
|
|
5264
|
+
}
|
|
5265
|
+
if (target.closest(sel(ShopRole.Checkout)) && !this.cart.empty)
|
|
5266
|
+
this.host.goToCheckout?.();
|
|
5267
|
+
};
|
|
5268
|
+
this.onChange = (event) => {
|
|
5269
|
+
const select = event.target?.closest?.(`select.${SHOP_SELECT_CLASS}`);
|
|
5270
|
+
if (!select)
|
|
5271
|
+
return;
|
|
5272
|
+
const state = this.stateFor(select);
|
|
5273
|
+
const option = select.getAttribute('data-iox-option');
|
|
5274
|
+
if (state && option)
|
|
5275
|
+
this.choose(state, option, select.value);
|
|
5276
|
+
};
|
|
5277
|
+
SCOPES.set(scope, this);
|
|
5278
|
+
scope.addEventListener('click', this.onClick, true);
|
|
5279
|
+
scope.addEventListener('change', this.onChange, true);
|
|
5280
|
+
if (host.observe && typeof MutationObserver !== 'undefined') {
|
|
5281
|
+
this.observer = new MutationObserver(() => { if (!this.stamping)
|
|
5282
|
+
this.queueStamp(); });
|
|
5283
|
+
this.observer.observe(scope, { childList: true, subtree: true });
|
|
5284
|
+
}
|
|
5285
|
+
this.stamp();
|
|
5286
|
+
void this.host.transport.read().then(view => this.setCart(view), () => undefined);
|
|
5287
|
+
}
|
|
5288
|
+
get lang() {
|
|
5289
|
+
return this.host.locale?.() || 'en';
|
|
5290
|
+
}
|
|
5291
|
+
/** The cart the runtime shows (the transport's last answer). */
|
|
5292
|
+
get view() {
|
|
5293
|
+
return this.cart;
|
|
5294
|
+
}
|
|
5295
|
+
/** The variant an element's product has chosen, or null (no product, no full choice). */
|
|
5296
|
+
variantFor(el) {
|
|
5297
|
+
const state = this.stateFor(el);
|
|
5298
|
+
return state ? this.variantOf(state) : null;
|
|
5299
|
+
}
|
|
5300
|
+
/** The quantity an element's product would add. */
|
|
5301
|
+
quantityFor(el) {
|
|
5302
|
+
return this.stateFor(el)?.quantity ?? 1;
|
|
5303
|
+
}
|
|
5304
|
+
/** Re-read every product and restamp (the host's data changed). */
|
|
5305
|
+
refresh() {
|
|
5306
|
+
this.products.clear();
|
|
5307
|
+
this.stamp();
|
|
5308
|
+
}
|
|
5309
|
+
/** Add the element's product — its chosen variant, its quantity — then say "Added ✓" in place and open the bag. */
|
|
5310
|
+
async add(el) {
|
|
5311
|
+
const state = this.stateFor(el);
|
|
5312
|
+
const variant = state ? this.variantOf(state) : null;
|
|
5313
|
+
if (!state || !variant?.sellable) {
|
|
5314
|
+
if (state)
|
|
5315
|
+
this.refuse(shopWord(ShopWord.SoldOut, this.lang), null);
|
|
5316
|
+
return null;
|
|
5317
|
+
}
|
|
5318
|
+
const button = el.closest(sel(ShopRole.Add)) ?? el;
|
|
5319
|
+
setAttr(button, 'aria-busy', 'true');
|
|
5320
|
+
try {
|
|
5321
|
+
const view = await this.host.transport.add({ productId: String(state.product._id), variantId: variant.variantId, quantity: state.quantity });
|
|
5322
|
+
this.setCart(view);
|
|
5323
|
+
this.markAdded(button);
|
|
5324
|
+
this.openCart();
|
|
5325
|
+
return view;
|
|
5326
|
+
}
|
|
5327
|
+
catch (error) {
|
|
5328
|
+
this.refuse(this.refusalWords(error), error);
|
|
5329
|
+
return null;
|
|
5330
|
+
}
|
|
5331
|
+
finally {
|
|
5332
|
+
setAttr(button, 'aria-busy', null);
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
/** Buy now: add, then go straight to checkout. */
|
|
5336
|
+
async buyNow(el) {
|
|
5337
|
+
const view = await this.add(el);
|
|
5338
|
+
if (view && !view.empty)
|
|
5339
|
+
this.host.goToCheckout?.();
|
|
5340
|
+
return !!view;
|
|
5341
|
+
}
|
|
5342
|
+
/** Open the page's cart drawer. False when the page has none. */
|
|
5343
|
+
openCart() {
|
|
5344
|
+
const drawer = first(this.scope, sel(ShopRole.CartDrawer));
|
|
5345
|
+
if (!drawer)
|
|
5346
|
+
return false;
|
|
5347
|
+
if (this.host.openDrawer)
|
|
5348
|
+
this.host.openDrawer(drawer);
|
|
5349
|
+
else if (drawer instanceof HTMLDialogElement && !drawer.open && typeof drawer.showModal === 'function')
|
|
5350
|
+
drawer.showModal();
|
|
5351
|
+
return true;
|
|
5352
|
+
}
|
|
5353
|
+
/** The transport answered: publish `$cart` and fill the cart parts. */
|
|
5354
|
+
setCart(view) {
|
|
5355
|
+
if (this.destroyed)
|
|
5356
|
+
return;
|
|
5357
|
+
this.cart = view;
|
|
5358
|
+
this.publish(ShopSlot.Cart, view);
|
|
5359
|
+
this.stamp();
|
|
5360
|
+
}
|
|
5361
|
+
destroy() {
|
|
5362
|
+
this.destroyed = true;
|
|
5363
|
+
if (SCOPES.get(this.scope) === this)
|
|
5364
|
+
SCOPES.delete(this.scope);
|
|
5365
|
+
this.scope.removeEventListener('click', this.onClick, true);
|
|
5366
|
+
this.scope.removeEventListener('change', this.onChange, true);
|
|
5367
|
+
this.observer?.disconnect();
|
|
5368
|
+
this.observer = null;
|
|
5369
|
+
for (const timer of this.addedTimers.values())
|
|
5370
|
+
clearTimeout(timer);
|
|
5371
|
+
this.addedTimers.clear();
|
|
5372
|
+
}
|
|
5373
|
+
// ── state ─────────────────────────────────────────────────────────────────────────────────
|
|
5374
|
+
stateFor(el) {
|
|
5375
|
+
const product = this.host.productFor(el);
|
|
5376
|
+
if (!product || product._id === undefined || product._id === null)
|
|
5377
|
+
return null;
|
|
5378
|
+
const id = String(product._id);
|
|
5379
|
+
const known = this.products.get(id);
|
|
5380
|
+
if (known && known.product === product)
|
|
5381
|
+
return known;
|
|
5382
|
+
const options = productOptions(product);
|
|
5383
|
+
const views = productVariants(product);
|
|
5384
|
+
const state = {
|
|
5385
|
+
product, options, views,
|
|
5386
|
+
choice: known?.choice ?? defaultChoice(options, views),
|
|
5387
|
+
quantity: known?.quantity ?? 1,
|
|
5388
|
+
};
|
|
5389
|
+
this.products.set(id, state);
|
|
5390
|
+
return state;
|
|
5391
|
+
}
|
|
5392
|
+
variantOf(state) {
|
|
5393
|
+
return state.options.length ? findVariant(state.options, state.views, state.choice) : state.views[0] ?? null;
|
|
5394
|
+
}
|
|
5395
|
+
boundsOf(state) {
|
|
5396
|
+
const variant = this.variantOf(state);
|
|
5397
|
+
return quantityBounds(variant ? { availability: variant.availability } : undefined);
|
|
5398
|
+
}
|
|
5399
|
+
choose(state, option, value) {
|
|
5400
|
+
const next = chooseValue(state.options, state.views, state.choice, option, value);
|
|
5401
|
+
if (JSON.stringify(next) === JSON.stringify(state.choice))
|
|
5402
|
+
return;
|
|
5403
|
+
state.choice = next;
|
|
5404
|
+
state.quantity = clampQuantity(state.quantity, this.boundsOf(state));
|
|
5405
|
+
this.pageProduct = String(state.product._id);
|
|
5406
|
+
this.stamp();
|
|
5407
|
+
}
|
|
5408
|
+
publishVariant(state) {
|
|
5409
|
+
const variant = this.variantOf(state);
|
|
5410
|
+
this.publish(ShopSlot.Variant, variant ? {
|
|
5411
|
+
...variant,
|
|
5412
|
+
productId: state.product._id,
|
|
5413
|
+
words: variantWords(variant.choice, state.options),
|
|
5414
|
+
quantity: state.quantity,
|
|
5415
|
+
} : null);
|
|
5416
|
+
}
|
|
5417
|
+
publish(slot, value) {
|
|
5418
|
+
const json = JSON.stringify(value ?? null);
|
|
5419
|
+
if (this.published.get(slot) === json)
|
|
5420
|
+
return;
|
|
5421
|
+
this.published.set(slot, json);
|
|
5422
|
+
this.host.publish?.(slot, value);
|
|
5423
|
+
}
|
|
5424
|
+
// ── stamping ──────────────────────────────────────────────────────────────────────────────
|
|
5425
|
+
queueStamp() {
|
|
5426
|
+
if (this.stampQueued)
|
|
5427
|
+
return;
|
|
5428
|
+
this.stampQueued = true;
|
|
5429
|
+
const run = () => { this.stampQueued = false; this.stamp(); };
|
|
5430
|
+
if (typeof queueMicrotask === 'function')
|
|
5431
|
+
queueMicrotask(run);
|
|
5432
|
+
else
|
|
5433
|
+
Promise.resolve().then(run);
|
|
5434
|
+
}
|
|
5435
|
+
/** Write every part's state into its markup. Idempotent; the observer is deaf while it runs. */
|
|
5436
|
+
stamp() {
|
|
5437
|
+
if (this.destroyed)
|
|
5438
|
+
return;
|
|
5439
|
+
this.stamping = true;
|
|
5440
|
+
try {
|
|
5441
|
+
let page = null;
|
|
5442
|
+
for (const root of own(this.scope, sel(ShopRole.Variants)).filter(r => !r.closest(CLONE))) {
|
|
5443
|
+
const state = this.stateFor(root);
|
|
5444
|
+
this.stampPicker(root, state);
|
|
5445
|
+
page = page ?? state;
|
|
5446
|
+
}
|
|
5447
|
+
for (const el of own(this.scope, `${sel(ShopRole.Quantity)}, ${sel(ShopRole.Add)}, ${sel(ShopRole.BuyNow)}, ${sel(ShopRole.Price)}`)) {
|
|
5448
|
+
if (el.closest(sel(ShopRole.CartLine)))
|
|
5449
|
+
continue;
|
|
5450
|
+
const state = this.stateFor(el);
|
|
5451
|
+
page = page ?? state;
|
|
5452
|
+
if (!state)
|
|
5453
|
+
continue;
|
|
5454
|
+
if (el.matches(sel(ShopRole.Quantity)))
|
|
5455
|
+
this.stampQuantity(el, state.quantity, this.boundsOf(state));
|
|
5456
|
+
else if (!el.matches(sel(ShopRole.Price))) {
|
|
5457
|
+
setAttr(el, 'aria-disabled', this.variantOf(state)?.sellable ? null : 'true');
|
|
5458
|
+
if (el.matches(sel(ShopRole.Add)))
|
|
5459
|
+
syncAddedWords(el, this.addedTimers.has(el));
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
const shown = (this.pageProduct && this.products.get(this.pageProduct)) || page;
|
|
5463
|
+
if (shown)
|
|
5464
|
+
this.publishVariant(shown);
|
|
5465
|
+
this.stampCart();
|
|
5466
|
+
}
|
|
5467
|
+
finally {
|
|
5468
|
+
this.observer?.takeRecords();
|
|
5469
|
+
this.stamping = false;
|
|
5470
|
+
}
|
|
5471
|
+
}
|
|
5472
|
+
stampPicker(root, state) {
|
|
5473
|
+
const template = Array.from(root.querySelectorAll(sel(ShopRole.VariantGroup))).find(g => !g.closest(CLONE));
|
|
5474
|
+
if (!template)
|
|
5475
|
+
return;
|
|
5476
|
+
const options = state?.options ?? [];
|
|
5477
|
+
setAttr(root, SHOP_HIDDEN_ATTRIBUTE, options.length ? null : '');
|
|
5478
|
+
if (!state || !options.length) {
|
|
5479
|
+
stampCopies(template, 1, ShopRole.VariantGroup);
|
|
5480
|
+
return;
|
|
5481
|
+
}
|
|
5482
|
+
const groups = stampCopies(template, options.length, ShopRole.VariantGroup);
|
|
5483
|
+
const states = optionValueStates(options, state.views, state.choice);
|
|
5484
|
+
const own = this.host.swatches?.(state.product) ?? null;
|
|
5485
|
+
groups.forEach((group, i) => this.stampGroup(group, state, options[i], states[i].values, own));
|
|
5486
|
+
}
|
|
5487
|
+
stampGroup(group, state, option, values, fills) {
|
|
5488
|
+
const kind = shopPickerKind(option, fills);
|
|
5489
|
+
const chosen = state.choice[option.name];
|
|
5490
|
+
setText(wordsOf(first(group, sel(ShopRole.VariantLabel))), variantGroupLabel(option, chosen, kind));
|
|
5491
|
+
const soldOut = values.filter(v => !v.available).map(v => v.value);
|
|
5492
|
+
const note = first(group, sel(ShopRole.VariantNote));
|
|
5493
|
+
const noteWords = variantGroupNote(soldOut, kind, this.lang);
|
|
5494
|
+
setText(wordsOf(note), noteWords);
|
|
5495
|
+
setAttr(note, SHOP_HIDDEN_ATTRIBUTE, noteWords ? null : '');
|
|
5496
|
+
const box = first(group, sel(ShopRole.VariantValues));
|
|
5497
|
+
if (!box)
|
|
5498
|
+
return;
|
|
5499
|
+
const chip = Array.from(box.querySelectorAll(sel(ShopRole.VariantValue))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5500
|
+
const swatch = Array.from(box.querySelectorAll(sel(ShopRole.VariantSwatch))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5501
|
+
const used = kind === ShopPickerKind.Swatches ? swatch ?? chip : kind === ShopPickerKind.Chips ? chip ?? swatch : null;
|
|
5502
|
+
for (const t of [chip, swatch]) {
|
|
5503
|
+
if (!t)
|
|
5504
|
+
continue;
|
|
5505
|
+
setAttr(t, SHOP_UNUSED_ATTRIBUTE, t === used ? null : '');
|
|
5506
|
+
if (t !== used)
|
|
5507
|
+
stampCopies(t, 1, t === chip ? ShopRole.VariantValue : ShopRole.VariantSwatch);
|
|
5508
|
+
}
|
|
5509
|
+
this.stampSelect(box, kind === ShopPickerKind.Select ? option : null, values, chosen);
|
|
5510
|
+
if (!used) {
|
|
5511
|
+
exclusiveRuntimeOf(box)?.destroy();
|
|
5512
|
+
return;
|
|
5513
|
+
}
|
|
5514
|
+
const items = stampCopies(used, option.values.length, used === chip ? ShopRole.VariantValue : ShopRole.VariantSwatch);
|
|
5515
|
+
items.forEach((item, i) => {
|
|
5516
|
+
const value = values[i];
|
|
5517
|
+
setAttr(item, ITEM_KEY_ATTRIBUTE, value.value);
|
|
5518
|
+
setAttr(item, 'aria-disabled', value.available ? null : 'true');
|
|
5519
|
+
if (used === swatch) {
|
|
5520
|
+
const fill = swatchFill(value.value, fills);
|
|
5521
|
+
if (fill)
|
|
5522
|
+
item.style.setProperty('--iox-swatch-fill', fill);
|
|
5523
|
+
else
|
|
5524
|
+
item.style.removeProperty('--iox-swatch-fill');
|
|
5525
|
+
setAttr(item, 'aria-label', value.available ? value.value : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5526
|
+
setAttr(item, 'title', value.value);
|
|
5527
|
+
}
|
|
5528
|
+
else {
|
|
5529
|
+
setText(wordsOf(item), value.value);
|
|
5530
|
+
setAttr(item, 'aria-label', value.available ? null : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5531
|
+
}
|
|
5532
|
+
});
|
|
5533
|
+
const rt = exclusiveRuntimeOf(box) ?? this.attachValues(box, state, option.name);
|
|
5534
|
+
rt.refresh();
|
|
5535
|
+
if (chosen && rt.liveKey !== chosen)
|
|
5536
|
+
rt.activate(chosen);
|
|
5537
|
+
}
|
|
5538
|
+
attachValues(box, state, option) {
|
|
5539
|
+
const id = String(state.product._id);
|
|
5540
|
+
return attachExclusiveAt(box, {
|
|
5541
|
+
kind: CompositeKind.Segmented,
|
|
5542
|
+
triggerSelector: VALUE_TRIGGERS,
|
|
5543
|
+
label: () => option,
|
|
5544
|
+
defaultKey: () => this.products.get(id)?.choice[option] ?? null,
|
|
5545
|
+
onChange: key => { const s = this.products.get(id); if (s)
|
|
5546
|
+
this.choose(s, option, key); },
|
|
5547
|
+
});
|
|
5548
|
+
}
|
|
5549
|
+
/** Past four values (T26): a native select, sold-out values disabled with their words. */
|
|
5550
|
+
stampSelect(box, option, values, chosen) {
|
|
5551
|
+
let select = box.querySelector(`select.${SHOP_SELECT_CLASS}`);
|
|
5552
|
+
if (!option) {
|
|
5553
|
+
select?.remove();
|
|
5554
|
+
return;
|
|
5555
|
+
}
|
|
5556
|
+
if (!select) {
|
|
5557
|
+
select = box.ownerDocument.createElement('select');
|
|
5558
|
+
select.className = SHOP_SELECT_CLASS;
|
|
5559
|
+
box.appendChild(select);
|
|
5560
|
+
}
|
|
5561
|
+
select.setAttribute('aria-label', shopWord(ShopWord.ChooseOption, this.lang, { name: option.name }));
|
|
5562
|
+
select.setAttribute('data-iox-option', option.name);
|
|
5563
|
+
const signature = values.map(v => `${v.value}:${v.available}`).join('|');
|
|
5564
|
+
if (select.getAttribute('data-iox-values') !== signature) {
|
|
5565
|
+
select.setAttribute('data-iox-values', signature);
|
|
5566
|
+
select.textContent = '';
|
|
5567
|
+
for (const v of values) {
|
|
5568
|
+
const opt = box.ownerDocument.createElement('option');
|
|
5569
|
+
opt.value = v.value;
|
|
5570
|
+
opt.textContent = v.available ? v.value : `${v.value} — ${shopWord(ShopWord.SoldOut, this.lang)}`;
|
|
5571
|
+
opt.disabled = !v.available;
|
|
5572
|
+
select.appendChild(opt);
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
if (chosen !== undefined && select.value !== chosen)
|
|
5576
|
+
select.value = chosen;
|
|
5577
|
+
}
|
|
5578
|
+
stampQuantity(root, quantity, bounds) {
|
|
5579
|
+
setAttr(root, 'role', 'group');
|
|
5580
|
+
setAttr(root, 'aria-label', shopWord(ShopWord.Quantity, this.lang));
|
|
5581
|
+
const value = first(root, sel(ShopRole.QuantityValue));
|
|
5582
|
+
setText(wordsOf(value), String(quantity));
|
|
5583
|
+
setAttr(value, 'aria-live', 'polite');
|
|
5584
|
+
const down = first(root, sel(ShopRole.QuantityDown));
|
|
5585
|
+
const up = first(root, sel(ShopRole.QuantityUp));
|
|
5586
|
+
setAttr(down, 'aria-label', shopWord(ShopWord.Decrease, this.lang));
|
|
5587
|
+
setAttr(up, 'aria-label', shopWord(ShopWord.Increase, this.lang));
|
|
5588
|
+
setAttr(down, 'aria-disabled', canStep(quantity, QuantityStep.Down, bounds) ? null : 'true');
|
|
5589
|
+
setAttr(up, 'aria-disabled', canStep(quantity, QuantityStep.Up, bounds) ? null : 'true');
|
|
5590
|
+
}
|
|
5591
|
+
stampCart() {
|
|
5592
|
+
const view = this.cart;
|
|
5593
|
+
const lang = this.lang;
|
|
5594
|
+
for (const button of own(this.scope, sel(ShopRole.CartButton))) {
|
|
5595
|
+
setAttr(button, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5596
|
+
setAttr(button, 'aria-label', view.empty ? shopWord(ShopWord.Cart, lang) : shopWord(ShopWord.CartCount, lang, { n: view.count }));
|
|
5597
|
+
setAttr(button, 'aria-haspopup', 'dialog');
|
|
5598
|
+
}
|
|
5599
|
+
for (const drawer of own(this.scope, sel(ShopRole.CartDrawer))) {
|
|
5600
|
+
setAttr(drawer, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5601
|
+
const title = wordsOf(first(drawer, sel(ShopRole.CartTitle)));
|
|
5602
|
+
if (title) {
|
|
5603
|
+
let count = title.querySelector(`[${CART_TITLE_COUNT_ATTRIBUTE}]`);
|
|
5604
|
+
if (!count) {
|
|
5605
|
+
count = title.ownerDocument.createElement('span');
|
|
5606
|
+
count.setAttribute(CART_TITLE_COUNT_ATTRIBUTE, '');
|
|
5607
|
+
title.appendChild(count);
|
|
5608
|
+
}
|
|
5609
|
+
setText(count, view.empty ? '' : ` (${view.count})`);
|
|
5610
|
+
}
|
|
5611
|
+
const template = Array.from(drawer.querySelectorAll(sel(ShopRole.CartLine))).find(l => !l.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5612
|
+
if (template) {
|
|
5613
|
+
const lines = stampCopies(template, Math.max(1, view.lines.length), ShopRole.CartLine);
|
|
5614
|
+
setAttr(template, SHOP_HIDDEN_ATTRIBUTE, view.lines.length ? null : '');
|
|
5615
|
+
view.lines.forEach((line, i) => this.stampLine(lines[i], line));
|
|
5616
|
+
}
|
|
5617
|
+
const issues = first(drawer, sel(ShopRole.CartIssues));
|
|
5618
|
+
const words = cartIssueWords(view, lang).join(' ');
|
|
5619
|
+
setText(wordsOf(issues), words);
|
|
5620
|
+
setAttr(issues, 'role', words ? 'alert' : null);
|
|
5621
|
+
setAttr(issues, SHOP_HIDDEN_ATTRIBUTE, words ? null : '');
|
|
5622
|
+
const note = first(drawer, sel(ShopRole.CartShippingNote));
|
|
5623
|
+
const gap = view.freeShippingRemaining && view.freeShippingRemaining.amount > 0 ? formatMoney(view.freeShippingRemaining, lang) : '';
|
|
5624
|
+
setText(wordsOf(note), gap ? shopWord(ShopWord.FreeShippingGap, lang, { amount: gap }) : '');
|
|
5625
|
+
setAttr(note, SHOP_HIDDEN_ATTRIBUTE, gap ? null : '');
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
stampLine(el, line) {
|
|
5629
|
+
const lang = this.lang;
|
|
5630
|
+
setAttr(el, CART_LINE_ATTRIBUTE, line.lineId);
|
|
5631
|
+
const image = first(el, sel(ShopRole.CartLineImage));
|
|
5632
|
+
const img = image?.tagName === 'IMG' ? image : image?.querySelector('img');
|
|
5633
|
+
if (img) {
|
|
5634
|
+
if (line.image && img.getAttribute('src') !== line.image)
|
|
5635
|
+
img.setAttribute('src', line.image);
|
|
5636
|
+
setAttr(img, 'alt', '');
|
|
5637
|
+
}
|
|
5638
|
+
setText(wordsOf(first(el, sel(ShopRole.CartLineTitle))), line.title);
|
|
5639
|
+
const variant = first(el, sel(ShopRole.CartLineVariant));
|
|
5640
|
+
setText(wordsOf(variant), line.variantName ?? '');
|
|
5641
|
+
setAttr(variant, SHOP_HIDDEN_ATTRIBUTE, line.variantName ? null : '');
|
|
5642
|
+
setText(wordsOf(first(el, sel(ShopRole.CartLineTotal))), formatMoney(line.lineTotal, lang));
|
|
5643
|
+
const quantity = first(el, sel(ShopRole.Quantity));
|
|
5644
|
+
if (quantity)
|
|
5645
|
+
this.stampQuantity(quantity, line.quantity, { min: 1, max: line.maxQuantity });
|
|
5646
|
+
setAttr(first(el, sel(ShopRole.CartLineRemove)), 'aria-label', shopWord(ShopWord.Remove, lang, { name: line.title }));
|
|
5647
|
+
}
|
|
5648
|
+
markAdded(button) {
|
|
5649
|
+
const previous = this.addedTimers.get(button);
|
|
5650
|
+
if (previous)
|
|
5651
|
+
clearTimeout(previous);
|
|
5652
|
+
syncAddedWords(button, true);
|
|
5653
|
+
announce(this.scope, shopWord(ShopWord.Added, this.lang));
|
|
5654
|
+
this.addedTimers.set(button, setTimeout(() => {
|
|
5655
|
+
this.addedTimers.delete(button);
|
|
5656
|
+
syncAddedWords(button, false);
|
|
5657
|
+
}, ADDED_HOLD_MS));
|
|
5658
|
+
}
|
|
5659
|
+
refusalWords(error) {
|
|
5660
|
+
const code = error instanceof CartTransportError ? error.code : CartTransportErrorCode.Network;
|
|
5661
|
+
const label = CART_TRANSPORT_ERROR_LABELS[code];
|
|
5662
|
+
return this.lang.toLowerCase().startsWith('he') ? label.he : label.en;
|
|
5663
|
+
}
|
|
5664
|
+
refuse(words, error) {
|
|
5665
|
+
announce(this.scope, words);
|
|
5666
|
+
this.host.onRefused?.(words, error);
|
|
5667
|
+
}
|
|
5668
|
+
// ── events ────────────────────────────────────────────────────────────────────────────────
|
|
5669
|
+
async changeLine(line, quantity) {
|
|
5670
|
+
const id = line.getAttribute(CART_LINE_ATTRIBUTE);
|
|
5671
|
+
if (!id)
|
|
5672
|
+
return;
|
|
5673
|
+
try {
|
|
5674
|
+
this.setCart(quantity === null ? await this.host.transport.remove(id) : await this.host.transport.setQuantity(id, quantity));
|
|
5675
|
+
}
|
|
5676
|
+
catch (error) {
|
|
5677
|
+
this.refuse(this.refusalWords(error), error);
|
|
5678
|
+
}
|
|
5679
|
+
}
|
|
5680
|
+
/** A copy is display-only on the canvas: a click on it (or a part inside it) selects the template's part. */
|
|
5681
|
+
selectTemplateOf(copy, target) {
|
|
5682
|
+
const template = this.templateOf(copy);
|
|
5683
|
+
if (!template)
|
|
5684
|
+
return;
|
|
5685
|
+
const path = [];
|
|
5686
|
+
for (let el = target; el && el !== copy; el = el.parentElement) {
|
|
5687
|
+
path.unshift(Array.prototype.indexOf.call(el.parentElement?.children ?? [], el));
|
|
5688
|
+
}
|
|
5689
|
+
let part = template;
|
|
5690
|
+
for (const i of path)
|
|
5691
|
+
part = part.children[i] ?? part;
|
|
5692
|
+
// The bubble that follows would select whatever ancestor has a listener; the template's part wins.
|
|
5693
|
+
target.addEventListener('click', e => e.stopPropagation(), { once: true });
|
|
5694
|
+
this.host.onCloneClick?.(part);
|
|
5695
|
+
}
|
|
5696
|
+
templateOf(copy) {
|
|
5697
|
+
const mark = copy.getAttribute(SHOP_CLONE_ATTRIBUTE);
|
|
5698
|
+
for (let prev = copy.previousElementSibling; prev; prev = prev.previousElementSibling) {
|
|
5699
|
+
if (!prev.hasAttribute(SHOP_CLONE_ATTRIBUTE) && Array.from(prev.classList).some(c => c === roleClass$1(mark)))
|
|
5700
|
+
return prev;
|
|
5701
|
+
}
|
|
5702
|
+
return null;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
/** Attach the shop runtime to a page scope, unless one runs there already. */
|
|
5706
|
+
function attachShop(scope, host) {
|
|
5707
|
+
return SCOPES.get(scope) ?? new ShopRuntime(scope, host);
|
|
5708
|
+
}
|
|
5709
|
+
/** The shop runtime an element sits under, or null. */
|
|
5710
|
+
function shopRuntimeOf(el) {
|
|
5711
|
+
for (let cur = el; cur; cur = cur.parentElement) {
|
|
5712
|
+
const rt = SCOPES.get(cur);
|
|
5713
|
+
if (rt)
|
|
5714
|
+
return rt;
|
|
5715
|
+
}
|
|
5716
|
+
return null;
|
|
5717
|
+
}
|
|
5718
|
+
/** The shop actions (actions-core `SHOP_ACTION_TYPES`). */
|
|
5719
|
+
var ShopActionType;
|
|
5720
|
+
(function (ShopActionType) {
|
|
5721
|
+
ShopActionType["AddToCart"] = "addToCart";
|
|
5722
|
+
ShopActionType["StartCheckout"] = "startCheckout";
|
|
5723
|
+
})(ShopActionType || (ShopActionType = {}));
|
|
5724
|
+
/** Run a shop action from the element that fired it (both interaction engines call this). False when no shop runs. */
|
|
5725
|
+
async function runShopAction(el, type) {
|
|
5726
|
+
const rt = shopRuntimeOf(el);
|
|
5727
|
+
if (!rt)
|
|
5728
|
+
return false;
|
|
5729
|
+
if (type === ShopActionType.AddToCart)
|
|
5730
|
+
return !!(await rt.add(el));
|
|
5731
|
+
if (type === ShopActionType.StartCheckout)
|
|
5732
|
+
return rt.buyNow(el);
|
|
5733
|
+
return false;
|
|
5734
|
+
}
|
|
5735
|
+
|
|
4743
5736
|
/**
|
|
4744
5737
|
* @vectoriox/iox-ui/composite-core — composites built from the builder's own parts (composite-components
|
|
4745
5738
|
* plan §3a). FRAMEWORK-FREE: the builder, the SSR engine and iox-cms (generation-core's composer, the site
|
|
@@ -4755,5 +5748,5 @@ function buildReadingBarRecipe(create) {
|
|
|
4755
5748
|
* Generated bundle index. Do not edit.
|
|
4756
5749
|
*/
|
|
4757
5750
|
|
|
4758
|
-
export { ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, ACCORDION_DEFAULT_ONS, ACCORDION_ICONS, ACCORDION_ICON_GLYPH, ACCORDION_NEW_ITEM_WORDS, ACCORDION_WORDS, ACTIVATE_ON_ATTRIBUTE, AccordionClass, AccordionDefaultOn, AccordionEditRefusal, AccordionIcon, AccordionKeyAction, AccordionRole, AccordionRuntime, BADGE_TONES, BADGE_TONE_ICONS, BadgeTone, CARD_LAYOUTS, CARD_LAYOUT_CUSTOM, CARD_PARTS, CARD_PART_ROLE, CARD_STACK_BREAKPOINT, CARD_WORDS, CAROUSEL_QUOTES, CHIP_ICON, CHIP_STYLE, COMPOSITE_ATTRIBUTE, COMPOSITE_KIND_ROLES, COMPOSITE_ROLE_SPECS, COUNTER_COUNT, COUNTER_ENTRANCE, COUNTER_SAMPLE_WORDS, CardLayout, CardPart, CardRole, CarouselA11y, CompositeBehaviourTrait, CompositeItemAction, CompositeKind, DEFAULT_ON_ATTRIBUTE, DISCLOSURE_ITEM_KEY, DISCLOSURE_WORDS, DisclosureRole, EXCLUSIVE_KIND_ROLES, ExclusiveRuntime, ITEM_KEY_ATTRIBUTE, ITEM_OFF_EVENT, ITEM_ON_EVENT, ITEM_OPEN_STATE, LIGHTBOX_ARROWS_HIDE_AT, LIGHTBOX_LABEL, MARQUEE_DEFAULTS, MARQUEE_DEFAULT_SPEED_PX, MARQUEE_KEYFRAMES, MARQUEE_MAX_COPIES, MARQUEE_MIN_LOOP_S, MARQUEE_NODE_ATTRIBUTES, MARQUEE_NOSCRIPT_CSS, MARQUEE_PAUSE_GLYPH, MARQUEE_PLAY_GLYPH, MARQUEE_SAMPLE_WORDS, MARQUEE_SPEED_FACTOR, MARQUEE_WORDS, MULTIPLE_ATTRIBUTE, MarqueeAttribute, MarqueeDirection, MarqueeRole, MarqueeRuntime, MarqueeSpeed, MarqueeStyle, MarqueeTrait, NO_ELEMENT_STYLE, ON_ATTRIBUTE, ON_STATE, ORIENTATION_ATTRIBUTE, PILL_LABEL_STYLE, SCOPE_ATTRIBUTE, SEGMENTED_BADGE_TONE, SEGMENTED_BADGE_WORDS, SEGMENTED_BEHAVIOUR, SEGMENTED_MAX_OPTIONS, SEGMENTED_MIN_OPTIONS, SEGMENTED_NAME, SEGMENTED_NEW_OPTION_WORDS, SEGMENTED_WORDS, SLIDER_BAR_ORDER, SLIDER_NAME_TRAIT, SLIDER_PART_GLYPH, SLIDER_PART_ROLES, SLIDER_PLACEMENT_TRAIT, SLIDER_PLAY_GLYPH, SLIDER_SCROLL_PLAYS_TRAIT, SLIDER_SWAPPING_ATTRIBUTE, SLIDER_TEXT_ATTRIBUTE, SLIDER_TYPE, SLIDER_WORDS, SLIDE_CAPTION_TRAIT, SLIDE_TO_ROW, SLIDE_TYPE, SWIPER_THEME_COLOR, SceneRole, SegmentedEditRefusal, SegmentedRole, SegmentedTrait, SliderFlag, SliderPlacement, SliderRole, StructureEdit, StructureRefusal, TABS_ACTIVATE_ONS, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP, TABS_NEW_TAB_WORDS, TABS_ORIENTATIONS, TABS_STACK_BREAKPOINT, TABS_TEXT_BIND_PROP, TABS_WORDS, TabsActivateOn, TabsBehaviourTrait, TabsEditRefusal, TabsOrientation, TabsRole, UNTIL_FOUND, acceptsRefusal, accordionAnswerOf, accordionBehaviour, accordionDomIds, accordionFocusIndex, accordionHeadingLevel, accordionItemAttributes, accordionItemLabel, accordionItemOf, accordionItemState, accordionItems, accordionKeyAction, accordionPanelAttributes, accordionPanelOf, accordionPartStyle, accordionQuestionOf, accordionRegionAttributes, accordionRemovalRefusal, accordionRootAttributes, accordionRootOf, accordionRootOfItem, accordionRuntimeOf, accordionScope, accordionToContent, accordionToManual, accordionTrackAttributes, accordionTriggerAttributes, accordionTriggerOf, addAccordionItem, addSegmentedOption, addTabPair, applyCardLayout, attachAccordionAt, attachAccordions, attachCarouselA11y, attachCompositeAt, attachExclusiveAt, attachMarquees, attachSliderBar, badgeStyleId, badgeToneOf, buildAccordionItem, buildAccordionRecipe, buildBadge, buildCardRecipe, buildCarouselRecipe, buildChip, buildCompositeIcon, buildCounterRecipe, buildDisclosureRecipe, buildLightboxRecipe, buildMarqueeRecipe, buildReadingBarRecipe, buildSegmentedOption, buildSegmentedRecipe, buildSliderPart, buildTabPair, buildTabsRecipe, canOpenAtClickedItem, cardPartsOf, cardRootOf, cardTitleOf, carouselOf, clearLayerStyles, closeAccordionItem, closestAccordion, closestAccordionItem, closestExclusive, closestExclusiveItemPart, compositeItemOf, compositeItems, compositeKindOfRole, compositeRootOf, compositeRowKeys, compositeScopeId, detachAccordion, detectAccordionIcon, detectCardLayout, disclosureOpenByDefault, domSafeKey, exclusiveBehaviourOf, exclusiveDefaultOf, exclusiveItemLabel, exclusiveItemPartOf, exclusiveKindHasPanels, exclusiveKindOf, exclusiveLabelOf, exclusivePartAttributes, exclusiveRootAttributesOf, exclusiveRootHoldsTriggers, exclusiveRootOf, exclusiveRuntimeOf, exclusiveScopeFor, findByRole, hasLabelledRegion, hasSliderParts, headerBehaviourOfNode, initialAccordionOpen, isAccordionFromContent, isAccordionItemOn, isAccordionPart, isAccordionRoot, isAnyCompositeRoot, isCardLinked, isCardRoot, isCompositeItem, isCompositeItemOn, isCompositePanel, isCompositeRoot, isCompositeTrigger, isDisclosurePart, isDisclosureRoot, isExclusiveItemOn, isExclusiveItemPart, isExclusiveKind, isExclusiveList, isExclusivePanel, isExclusivePanels, isExclusiveRoot, isExclusiveTrigger, isLockedPart, isMarqueeRoot, isPartOfExclusiveScope, isPillNode, isSegmentedPart, isSegmentedRoot, isSlider, isSliderPart, isTabsFromContent, isTabsPart, isTabsRoot, isToggleKind, itemOpenTriggerIds, lightboxSliderOf, lookMarqueeSpeed, makeCompositePart, manualTabKeys, marqueeCopyCount, marqueeLoopSeconds, marqueePartElement, marqueePauseAttributes, marqueePauseGlyph, marqueeRootAttributes, marqueeRootOf, marqueeSettings, marqueeWords, migrateSliderControls, moveAccordionItem, moveSegmentedOption, moveTabPair, needsSliderMigration, nextAccordionState, nextItemKey, nextSegmentedKey, nextTabKey, onAccordionItemState, onCompositeItemState, onExclusiveItemState, openAccordionItem, parentInComposite, pickAccordionAutoBinds, pickTabsAutoBinds, readLayerStyle, readProp, readStyle, removeFromComposite, removeSegmentedOption, removeTabPair, renameAccordionItem, renameSegmentedOption, renameTab, repeatSourceOf, rowIndexOf, rowItemKey, rowSourceOf, runCompositeItemAction, sameRepeatSource, segmentedAddRefusal, segmentedBadgeOf, segmentedDefaultOn, segmentedItemTriggerIds, segmentedKeyAction, segmentedKeys, segmentedLabel, segmentedOptionAttributes, segmentedOptionKey, segmentedOptionLabel, segmentedOptionLabelNodeOf, segmentedOptions, segmentedPartAttributes, segmentedRemovalRefusal, segmentedRootAttributes, segmentedRootAttributesOf, segmentedScopeFor, serializeDomAttributes, setAccordionBehaviour, setAccordionIcon, setBadgeTone, setCardLinked, setCardPart, setHeaderBehaviour, setMarqueeSettings, setSegmentedBadge, setSegmentedBehaviour, setSliderFlag, setSliderPlacement, setTabsBehaviour, shouldScrollToItem, slideIndexForRow, sliderCaptionOf, sliderCountText, sliderLiveRegion, sliderPart, sliderPartElement, sliderPauseAttributes, sliderPauseGlyph, sliderPlacementOf, sliderSlides, sliderWords, splitSliderChildren, structureRefusal, syncSliderParts, tabLabel, tabLabelNodeOf, tabListAttributes, tabPanelAttributes, tabPanelImageOf, tabPanelOf, tabPanelTextOf, tabPartKey, tabTriggerAttributes, tabTriggerOf, tabsBehaviour, tabsItemState, tabsItemTriggerIds, tabsKeyAction, tabsLabel, tabsListOf, tabsPanels, tabsPanelsOf, tabsPartAttributes, tabsPartnerOf, tabsRemovalRefusal, tabsRootAttributes, tabsScope, tabsScopeFor, tabsToContent, tabsToManual, tabsTriggers, walkComposite, wantedSliderParts, writeLayerStyles, writeProp, writeStyles };
|
|
5751
|
+
export { ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, ACCORDION_DEFAULT_ONS, ACCORDION_ICONS, ACCORDION_ICON_GLYPH, ACCORDION_NEW_ITEM_WORDS, ACCORDION_WORDS, ACTIVATE_ON_ATTRIBUTE, ADDED_HOLD_MS, AccordionClass, AccordionDefaultOn, AccordionEditRefusal, AccordionIcon, AccordionKeyAction, AccordionRole, AccordionRuntime, BADGE_TONES, BADGE_TONE_ICONS, BadgeTone, CARD_LAYOUTS, CARD_LAYOUT_CUSTOM, CARD_PARTS, CARD_PART_ROLE, CARD_STACK_BREAKPOINT, CARD_WORDS, CAROUSEL_QUOTES, CART_EMPTY_ATTRIBUTE, CART_LINE_ATTRIBUTE, CART_TITLE_COUNT_ATTRIBUTE, CHIP_ICON, CHIP_STYLE, COLOUR_OPTION_NAMES, COMPOSITE_ATTRIBUTE, COMPOSITE_KIND_ROLES, COMPOSITE_ROLE_SPECS, COUNTER_COUNT, COUNTER_ENTRANCE, COUNTER_SAMPLE_WORDS, CardLayout, CardPart, CardRole, CarouselA11y, CompositeBehaviourTrait, CompositeItemAction, CompositeKind, DEFAULT_ON_ATTRIBUTE, DISCLOSURE_ITEM_KEY, DISCLOSURE_WORDS, DisclosureRole, EXCLUSIVE_KIND_ROLES, ExclusiveRuntime, ITEM_KEY_ATTRIBUTE, ITEM_OFF_EVENT, ITEM_ON_EVENT, ITEM_OPEN_STATE, LIGHTBOX_ARROWS_HIDE_AT, LIGHTBOX_LABEL, MARQUEE_DEFAULTS, MARQUEE_DEFAULT_SPEED_PX, MARQUEE_KEYFRAMES, MARQUEE_MAX_COPIES, MARQUEE_MIN_LOOP_S, MARQUEE_NODE_ATTRIBUTES, MARQUEE_NOSCRIPT_CSS, MARQUEE_PAUSE_GLYPH, MARQUEE_PLAY_GLYPH, MARQUEE_SAMPLE_WORDS, MARQUEE_SPEED_FACTOR, MARQUEE_WORDS, MULTIPLE_ATTRIBUTE, MarqueeAttribute, MarqueeDirection, MarqueeRole, MarqueeRuntime, MarqueeSpeed, MarqueeStyle, MarqueeTrait, NAMED_SWATCHES, NO_ELEMENT_STYLE, ON_ATTRIBUTE, ON_STATE, ORIENTATION_ATTRIBUTE, PILL_LABEL_STYLE, SCOPE_ATTRIBUTE, SEGMENTED_BADGE_TONE, SEGMENTED_BADGE_WORDS, SEGMENTED_BEHAVIOUR, SEGMENTED_MAX_OPTIONS, SEGMENTED_MIN_OPTIONS, SEGMENTED_NAME, SEGMENTED_NEW_OPTION_WORDS, SEGMENTED_WORDS, SHOP_ADDED_ATTRIBUTE, SHOP_CHIP_MAX, SHOP_CLONE_ATTRIBUTE, SHOP_HIDDEN_ATTRIBUTE, SHOP_LABELS, SHOP_LIVE_CLASS, SHOP_RECIPES, SHOP_RECIPE_WORDS, SHOP_ROLES, SHOP_SELECT_CLASS, SHOP_UNUSED_ATTRIBUTE, SLIDER_BAR_ORDER, SLIDER_NAME_TRAIT, SLIDER_PART_GLYPH, SLIDER_PART_ROLES, SLIDER_PLACEMENT_TRAIT, SLIDER_PLAY_GLYPH, SLIDER_SCROLL_PLAYS_TRAIT, SLIDER_SWAPPING_ATTRIBUTE, SLIDER_TEXT_ATTRIBUTE, SLIDER_TYPE, SLIDER_WORDS, SLIDE_CAPTION_TRAIT, SLIDE_TO_ROW, SLIDE_TYPE, SWIPER_THEME_COLOR, SceneRole, SegmentedEditRefusal, SegmentedRole, SegmentedTrait, ShopActionType, ShopPickerKind, ShopRecipe, ShopRole, ShopRuntime, SliderFlag, SliderPlacement, SliderRole, StructureEdit, StructureRefusal, TABS_ACTIVATE_ONS, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP, TABS_NEW_TAB_WORDS, TABS_ORIENTATIONS, TABS_STACK_BREAKPOINT, TABS_TEXT_BIND_PROP, TABS_WORDS, TabsActivateOn, TabsBehaviourTrait, TabsEditRefusal, TabsOrientation, TabsRole, UNTIL_FOUND, acceptsRefusal, accordionAnswerOf, accordionBehaviour, accordionDomIds, accordionFocusIndex, accordionHeadingLevel, accordionItemAttributes, accordionItemLabel, accordionItemOf, accordionItemState, accordionItems, accordionKeyAction, accordionPanelAttributes, accordionPanelOf, accordionPartStyle, accordionQuestionOf, accordionRegionAttributes, accordionRemovalRefusal, accordionRootAttributes, accordionRootOf, accordionRootOfItem, accordionRuntimeOf, accordionScope, accordionToContent, accordionToManual, accordionTrackAttributes, accordionTriggerAttributes, accordionTriggerOf, addAccordionItem, addSegmentedOption, addTabPair, applyCardLayout, attachAccordionAt, attachAccordions, attachCarouselA11y, attachCompositeAt, attachExclusiveAt, attachMarquees, attachShop, attachSliderBar, badgeStyleId, badgeToneOf, buildAccordionItem, buildAccordionRecipe, buildAddToCartRecipe, buildBadge, buildBuyNowRecipe, buildCardRecipe, buildCarouselRecipe, buildCartButtonRecipe, buildCartDrawerRecipe, buildChip, buildCompositeIcon, buildCounterRecipe, buildDisclosureRecipe, buildLightboxRecipe, buildMarqueeRecipe, buildPriceRecipe, buildQuantityRecipe, buildReadingBarRecipe, buildSegmentedOption, buildSegmentedRecipe, buildSliderPart, buildTabPair, buildTabsRecipe, buildVariantPickerRecipe, canOpenAtClickedItem, cardPartsOf, cardRootOf, cardTitleOf, carouselOf, clearLayerStyles, closeAccordionItem, closestAccordion, closestAccordionItem, closestExclusive, closestExclusiveItemPart, compositeItemOf, compositeItems, compositeKindOfRole, compositeRootOf, compositeRowKeys, compositeScopeId, detachAccordion, detectAccordionIcon, detectCardLayout, disclosureOpenByDefault, domSafeKey, exclusiveBehaviourOf, exclusiveDefaultOf, exclusiveItemLabel, exclusiveItemPartOf, exclusiveKindHasPanels, exclusiveKindOf, exclusiveLabelOf, exclusivePartAttributes, exclusiveRootAttributesOf, exclusiveRootHoldsTriggers, exclusiveRootOf, exclusiveRuntimeOf, exclusiveScopeFor, findByRole, hasLabelledRegion, hasSliderParts, headerBehaviourOfNode, initialAccordionOpen, isAccordionFromContent, isAccordionItemOn, isAccordionPart, isAccordionRoot, isAnyCompositeRoot, isCardLinked, isCardRoot, isCompositeItem, isCompositeItemOn, isCompositePanel, isCompositeRoot, isCompositeTrigger, isDisclosurePart, isDisclosureRoot, isExclusiveItemOn, isExclusiveItemPart, isExclusiveKind, isExclusiveList, isExclusivePanel, isExclusivePanels, isExclusiveRoot, isExclusiveTrigger, isExclusiveTriggerDisabled, isLockedPart, isMarqueeRoot, isPartOfExclusiveScope, isPillNode, isSegmentedPart, isSegmentedRoot, isShopRole, isSlider, isSliderPart, isTabsFromContent, isTabsPart, isTabsRoot, isToggleKind, itemOpenTriggerIds, lightboxSliderOf, lookMarqueeSpeed, makeCompositePart, manualTabKeys, marqueeCopyCount, marqueeLoopSeconds, marqueePartElement, marqueePauseAttributes, marqueePauseGlyph, marqueeRootAttributes, marqueeRootOf, marqueeSettings, marqueeWords, migrateSliderControls, moveAccordionItem, moveSegmentedOption, moveTabPair, needsSliderMigration, nextAccordionState, nextItemKey, nextSegmentedKey, nextTabKey, onAccordionItemState, onCompositeItemState, onExclusiveItemState, openAccordionItem, parentInComposite, pickAccordionAutoBinds, pickTabsAutoBinds, readLayerStyle, readProp, readStyle, removeFromComposite, removeSegmentedOption, removeTabPair, renameAccordionItem, renameSegmentedOption, renameTab, repeatSourceOf, rowIndexOf, rowItemKey, rowSourceOf, runCompositeItemAction, runShopAction, sameRepeatSource, segmentedAddRefusal, segmentedBadgeOf, segmentedDefaultOn, segmentedItemTriggerIds, segmentedKeyAction, segmentedKeys, segmentedLabel, segmentedOptionAttributes, segmentedOptionKey, segmentedOptionLabel, segmentedOptionLabelNodeOf, segmentedOptions, segmentedPartAttributes, segmentedRemovalRefusal, segmentedRootAttributes, segmentedRootAttributesOf, segmentedScopeFor, serializeDomAttributes, setAccordionBehaviour, setAccordionIcon, setBadgeTone, setCardLinked, setCardPart, setHeaderBehaviour, setMarqueeSettings, setSegmentedBadge, setSegmentedBehaviour, setSliderFlag, setSliderPlacement, setTabsBehaviour, shopPickerKind, shopRuntimeOf, shopSelector, shouldScrollToItem, slideIndexForRow, sliderCaptionOf, sliderCountText, sliderLiveRegion, sliderPart, sliderPartElement, sliderPauseAttributes, sliderPauseGlyph, sliderPlacementOf, sliderSlides, sliderWords, splitSliderChildren, structureRefusal, swatchFill, syncSliderParts, tabLabel, tabLabelNodeOf, tabListAttributes, tabPanelAttributes, tabPanelImageOf, tabPanelOf, tabPanelTextOf, tabPartKey, tabTriggerAttributes, tabTriggerOf, tabsBehaviour, tabsItemState, tabsItemTriggerIds, tabsKeyAction, tabsLabel, tabsListOf, tabsPanels, tabsPanelsOf, tabsPartAttributes, tabsPartnerOf, tabsRemovalRefusal, tabsRootAttributes, tabsScope, tabsScopeFor, tabsToContent, tabsToManual, tabsTriggers, variantGroupLabel, variantGroupNote, walkComposite, wantedSliderParts, writeLayerStyles, writeProp, writeStyles };
|
|
4759
5752
|
//# sourceMappingURL=vectoriox-iox-ui-composite-core.mjs.map
|