@vectoriox/iox-ui 5.98.0 → 5.100.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 -4
- package/composite-core/index.d.ts +222 -2
- package/design-core/index.d.ts +334 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +16 -7
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +948 -256
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +416 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs +3 -24
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +23 -13
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs +633 -0
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -0
- package/fesm2022/vectoriox-iox-ui.mjs +2 -59
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/forms-core/index.d.ts +2 -23
- package/generation-core/index.d.ts +3 -1
- package/identity-core/index.d.ts +426 -0
- package/identity-core/package.json +3 -0
- package/index.d.ts +0 -1
- package/package.json +5 -1
- package/src/actions-core/action.model.ts +1 -1
- package/src/actions-core/element-actions.ts +16 -6
- package/src/composite-core/account-runtime.ts +428 -0
- package/src/composite-core/account.ts +281 -0
- package/src/composite-core/public-api.ts +2 -0
- package/src/composite-core/recipe-parts.ts +48 -0
- package/src/composite-core/shop.ts +6 -26
- package/src/design-core/field-classes.ts +65 -0
- package/src/design-core/flavor-spec.generated.ts +346 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/forms-core/field-markup.ts +2 -22
- package/src/generation-core/compose-site.ts +19 -9
- package/src/generation-core/nav-shape.ts +4 -4
- package/src/identity-core/guards.ts +87 -0
- package/src/identity-core/public-api.ts +14 -0
- package/src/identity-core/sign-in.ts +223 -0
- package/src/identity-core/site-auth-transport.ts +134 -0
- package/src/identity-core/site-auth.ts +182 -0
- package/src/identity-core/words.ts +194 -0
- package/styles/iox-design.css +38 -0
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
1
|
+
import { readOwnedTrait, writeOwnedTrait, ROW_INDEX_ATTRIBUTE, elementStyleById, switchElementStyle, LinkType, setColorScheme, COLOR_SCHEME_TRAIT, repeatedRowIndex, roleClass as roleClass$1, headerBehaviourOf, HeaderTrait, headerEdgeOf, headerStaysAtTop, writeFieldError } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
export { ROW_INDEX_ATTRIBUTE } from '@vectoriox/iox-ui/design-core';
|
|
3
3
|
import { shopWord, ShopWord, emptyCartView, QuantityStep, stepQuantity, ShopSlot, productOptions, productVariants, defaultChoice, findVariant, quantityBounds, chooseValue, clampQuantity, variantSlotOf, optionValueStates, canStep, cartIssueWords, formatMoney, CartTransportError, CartTransportErrorCode, CART_TRANSPORT_ERROR_LABELS } from '@vectoriox/iox-ui/commerce-core';
|
|
4
|
+
import { signInWord, signInLanguage, SignInLanguage, SignInWord, EMAIL_CODE_TTL_MINUTES, CUSTOMER_SLOT, SignInProvider, signInRefusal, SignInSlot, siteAuthErrorCode, normalizeSignInEmail, SiteSignInRefusalCode, normalizeEmailCode, isEmailCodeShape, customerSlotOf, customerDisplayName } from '@vectoriox/iox-ui/identity-core';
|
|
4
5
|
|
|
5
6
|
/** What a recipe asks its consumer to create: a NEW node of `type`, the way that consumer creates one
|
|
6
7
|
* (the builder's `createConfig`, generation-core's `createSerializedNode`), with these props and this
|
|
@@ -419,7 +420,7 @@ var Type$8;
|
|
|
419
420
|
Type["Icon"] = "Icon";
|
|
420
421
|
Type["Repeater"] = "Repeater";
|
|
421
422
|
})(Type$8 || (Type$8 = {}));
|
|
422
|
-
var Style$
|
|
423
|
+
var Style$8;
|
|
423
424
|
(function (Style) {
|
|
424
425
|
Style["Root"] = "box";
|
|
425
426
|
Style["Item"] = "accordion-item";
|
|
@@ -428,7 +429,7 @@ var Style$7;
|
|
|
428
429
|
Style["Icon"] = "icon";
|
|
429
430
|
Style["Panel"] = "accordion-panel";
|
|
430
431
|
Style["Answer"] = "body";
|
|
431
|
-
})(Style$
|
|
432
|
+
})(Style$8 || (Style$8 = {}));
|
|
432
433
|
const ZERO_BOX$4 = '0px 0px 0px 0px';
|
|
433
434
|
const HEADING_LEVELS = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
|
434
435
|
const DEFAULT_LEVEL = 'h3';
|
|
@@ -455,7 +456,7 @@ function make$4(create, key, type, role, style, props = {}, label) {
|
|
|
455
456
|
* ITS item (`stateTriggers`). ONE builder for both kinds. */
|
|
456
457
|
function buildCompositeIcon(create, key, icon, itemId, role = AccordionRole.Icon) {
|
|
457
458
|
const glyph = ACCORDION_ICON_GLYPH[icon];
|
|
458
|
-
const node = makeCompositePart(create, { key, type: Type$8.Icon, props: { iconClass: glyph.iconClass }, elementStyle: Style$
|
|
459
|
+
const node = makeCompositePart(create, { key, type: Type$8.Icon, props: { iconClass: glyph.iconClass }, elementStyle: Style$8.Icon }, role, 'Icon', PART_BASE$3[AccordionRole.Icon]);
|
|
459
460
|
node.stateStyles = { ...(node.stateStyles ?? {}), [ITEM_OPEN_STATE]: { rotate: glyph.turn } };
|
|
460
461
|
if (itemId)
|
|
461
462
|
node.stateTriggers = { ...(node.stateTriggers ?? {}), [ITEM_OPEN_STATE]: itemId };
|
|
@@ -463,14 +464,14 @@ function buildCompositeIcon(create, key, icon, itemId, role = AccordionRole.Icon
|
|
|
463
464
|
}
|
|
464
465
|
/** One item: header (question + icon) and panel (answer). `key` makes every part's recipe key unique. */
|
|
465
466
|
function buildAccordionItem(create, words, itemKey, icon = AccordionIcon.Chevron) {
|
|
466
|
-
const item = make$4(create, `${itemKey}`, Type$8.Container, AccordionRole.Item, Style$
|
|
467
|
+
const item = make$4(create, `${itemKey}`, Type$8.Container, AccordionRole.Item, Style$8.Item, {}, 'Item');
|
|
467
468
|
item.itemKey = itemKey;
|
|
468
|
-
const trigger = make$4(create, `${itemKey}-trigger`, Type$8.LinkedContainer, AccordionRole.Trigger, Style$
|
|
469
|
-
const question = make$4(create, `${itemKey}-question`, Type$8.Heading, null, Style$
|
|
469
|
+
const trigger = make$4(create, `${itemKey}-trigger`, Type$8.LinkedContainer, AccordionRole.Trigger, Style$8.Trigger, {}, 'Header');
|
|
470
|
+
const question = make$4(create, `${itemKey}-question`, Type$8.Heading, null, Style$8.Question, { content: words.question, level: DEFAULT_LEVEL }, 'Heading');
|
|
470
471
|
writeStyles(question, QUESTION_BASE);
|
|
471
472
|
trigger.children = [question, ...(icon === AccordionIcon.None ? [] : [buildCompositeIcon(create, `${itemKey}-icon`, icon, item.id)])];
|
|
472
|
-
const panel = make$4(create, `${itemKey}-panel`, Type$8.Container, AccordionRole.Panel, Style$
|
|
473
|
-
const answer = make$4(create, `${itemKey}-answer`, Type$8.Text, null, Style$
|
|
473
|
+
const panel = make$4(create, `${itemKey}-panel`, Type$8.Container, AccordionRole.Panel, Style$8.Panel, {}, 'Panel');
|
|
474
|
+
const answer = make$4(create, `${itemKey}-answer`, Type$8.Text, null, Style$8.Answer, { content: words.answer, tag: 'p' }, 'Text');
|
|
474
475
|
writeStyles(answer, ANSWER_BASE);
|
|
475
476
|
panel.children = [answer];
|
|
476
477
|
item.children = [trigger, panel];
|
|
@@ -478,7 +479,7 @@ function buildAccordionItem(create, words, itemKey, icon = AccordionIcon.Chevron
|
|
|
478
479
|
}
|
|
479
480
|
/** A fresh Accordion: three items, one open at a time, the first open by default (board 4). */
|
|
480
481
|
function buildAccordionRecipe(create, options = {}) {
|
|
481
|
-
const root = make$4(create, 'accordion', Type$8.Container, AccordionRole.Accordion, Style$
|
|
482
|
+
const root = make$4(create, 'accordion', Type$8.Container, AccordionRole.Accordion, Style$8.Root, {}, 'Accordion');
|
|
482
483
|
writeProp(root, CompositeBehaviourTrait.Multiple, options.multiple ?? false);
|
|
483
484
|
writeProp(root, CompositeBehaviourTrait.DefaultOn, options.defaultOn ?? AccordionDefaultOn.First);
|
|
484
485
|
const words = options.items ?? ACCORDION_WORDS;
|
|
@@ -1005,7 +1006,7 @@ function behaviourOf$1(root) {
|
|
|
1005
1006
|
defaultOn: ACCORDION_DEFAULT_ONS.includes(raw) ? raw : AccordionDefaultOn.First,
|
|
1006
1007
|
};
|
|
1007
1008
|
}
|
|
1008
|
-
function setAttr$
|
|
1009
|
+
function setAttr$3(el, name, value) {
|
|
1009
1010
|
if (!el)
|
|
1010
1011
|
return;
|
|
1011
1012
|
if (value === null) {
|
|
@@ -1220,22 +1221,22 @@ class AccordionRuntime {
|
|
|
1220
1221
|
const ids = accordionDomIds(rootId, key, this.kind);
|
|
1221
1222
|
if (!item.hasAttribute(ITEM_KEY_ATTRIBUTE))
|
|
1222
1223
|
item.setAttribute(ITEM_KEY_ATTRIBUTE, key);
|
|
1223
|
-
setAttr$
|
|
1224
|
+
setAttr$3(item, ON_ATTRIBUTE, on ? '' : null);
|
|
1224
1225
|
const button = this.own(item, BUTTON_SELECTOR);
|
|
1225
1226
|
const track = this.own(item, TRACK_SELECTOR);
|
|
1226
1227
|
const region = this.own(item, REGION_SELECTOR);
|
|
1227
1228
|
const panel = this.own(item, PANEL_SELECTOR$1);
|
|
1228
|
-
setAttr$
|
|
1229
|
-
setAttr$
|
|
1230
|
-
setAttr$
|
|
1231
|
-
setAttr$
|
|
1232
|
-
setAttr$
|
|
1233
|
-
setAttr$
|
|
1234
|
-
setAttr$
|
|
1229
|
+
setAttr$3(button, 'type', 'button');
|
|
1230
|
+
setAttr$3(button, 'id', ids.trigger);
|
|
1231
|
+
setAttr$3(button, 'aria-expanded', on ? 'true' : 'false');
|
|
1232
|
+
setAttr$3(button, 'aria-controls', ids.panel);
|
|
1233
|
+
setAttr$3(button, ON_ATTRIBUTE, on ? '' : null);
|
|
1234
|
+
setAttr$3(track, ON_ATTRIBUTE, on ? '' : null);
|
|
1235
|
+
setAttr$3(panel, ON_ATTRIBUTE, on ? '' : null);
|
|
1235
1236
|
const labelled = hasLabelledRegion(this.kind);
|
|
1236
|
-
setAttr$
|
|
1237
|
-
setAttr$
|
|
1238
|
-
setAttr$
|
|
1237
|
+
setAttr$3(region, 'role', labelled ? 'region' : null);
|
|
1238
|
+
setAttr$3(region, 'id', ids.panel);
|
|
1239
|
+
setAttr$3(region, 'aria-labelledby', labelled ? ids.trigger : null);
|
|
1239
1240
|
if (!region)
|
|
1240
1241
|
return;
|
|
1241
1242
|
const pending = this.closing.get(key);
|
|
@@ -1244,7 +1245,7 @@ class AccordionRuntime {
|
|
|
1244
1245
|
clearTimeout(pending);
|
|
1245
1246
|
this.closing.delete(key);
|
|
1246
1247
|
}
|
|
1247
|
-
setAttr$
|
|
1248
|
+
setAttr$3(region, 'hidden', null);
|
|
1248
1249
|
return;
|
|
1249
1250
|
}
|
|
1250
1251
|
if (region.hasAttribute('hidden') || pending)
|
|
@@ -1252,13 +1253,13 @@ class AccordionRuntime {
|
|
|
1252
1253
|
// Closing: the track collapses first (its transition), THEN the region is hidden — hiding it at once
|
|
1253
1254
|
// would collapse it with no motion. At first paint, or under reduced motion, it is hidden at once.
|
|
1254
1255
|
if (first || this.reduced()) {
|
|
1255
|
-
setAttr$
|
|
1256
|
+
setAttr$3(region, 'hidden', UNTIL_FOUND);
|
|
1256
1257
|
return;
|
|
1257
1258
|
}
|
|
1258
1259
|
const hide = () => {
|
|
1259
1260
|
this.closing.delete(key);
|
|
1260
1261
|
if (!item.hasAttribute(ON_ATTRIBUTE))
|
|
1261
|
-
setAttr$
|
|
1262
|
+
setAttr$3(region, 'hidden', UNTIL_FOUND);
|
|
1262
1263
|
};
|
|
1263
1264
|
this.closing.set(key, setTimeout(hide, this.closeDelay(track)));
|
|
1264
1265
|
}
|
|
@@ -1354,14 +1355,14 @@ var Type$7;
|
|
|
1354
1355
|
Type["LinkedContainer"] = "LinkedContainer";
|
|
1355
1356
|
Type["Text"] = "Text";
|
|
1356
1357
|
})(Type$7 || (Type$7 = {}));
|
|
1357
|
-
var Style$
|
|
1358
|
+
var Style$7;
|
|
1358
1359
|
(function (Style) {
|
|
1359
1360
|
Style["Root"] = "box";
|
|
1360
1361
|
Style["Trigger"] = "accordion-trigger";
|
|
1361
1362
|
Style["Word"] = "body";
|
|
1362
1363
|
Style["Panel"] = "accordion-panel";
|
|
1363
1364
|
Style["Body"] = "body";
|
|
1364
|
-
})(Style$
|
|
1365
|
+
})(Style$7 || (Style$7 = {}));
|
|
1365
1366
|
const ZERO_BOX$3 = '0px 0px 0px 0px';
|
|
1366
1367
|
const HIDDEN = 'none';
|
|
1367
1368
|
const INHERIT = 'inherit';
|
|
@@ -1391,7 +1392,7 @@ function make$3(create, key, type, role, style, props, label) {
|
|
|
1391
1392
|
}
|
|
1392
1393
|
/** One of the trigger's two words: shown while the disclosure is closed (`more`) or open (`less`). */
|
|
1393
1394
|
function buildWord(create, role, words, rootId) {
|
|
1394
|
-
const node = make$3(create, role === DisclosureRole.More ? 'more' : 'less', Type$7.Text, role, Style$
|
|
1395
|
+
const node = make$3(create, role === DisclosureRole.More ? 'more' : 'less', Type$7.Text, role, Style$7.Word, { content: words, tag: 'span' }, 'Text');
|
|
1395
1396
|
node.stateStyles = { ...(node.stateStyles ?? {}), [ITEM_OPEN_STATE]: { display: role === DisclosureRole.More ? HIDDEN : SHOWN } };
|
|
1396
1397
|
if (rootId)
|
|
1397
1398
|
node.stateTriggers = { ...(node.stateTriggers ?? {}), [ITEM_OPEN_STATE]: rootId };
|
|
@@ -1400,18 +1401,18 @@ function buildWord(create, role, words, rootId) {
|
|
|
1400
1401
|
/** A fresh Disclosure: "Read more" opens the text below and reads "Read less" while it is open; closed by default. */
|
|
1401
1402
|
function buildDisclosureRecipe(create, options = {}) {
|
|
1402
1403
|
const words = { ...DISCLOSURE_WORDS, ...(options.words ?? {}) };
|
|
1403
|
-
const root = make$3(create, 'disclosure', Type$7.Container, DisclosureRole.Disclosure, Style$
|
|
1404
|
+
const root = make$3(create, 'disclosure', Type$7.Container, DisclosureRole.Disclosure, Style$7.Root, {}, 'Disclosure');
|
|
1404
1405
|
root.itemKey = DISCLOSURE_ITEM_KEY;
|
|
1405
1406
|
writeProp(root, CompositeBehaviourTrait.DefaultOn, options.open ? AccordionDefaultOn.First : AccordionDefaultOn.None);
|
|
1406
1407
|
const icon = options.icon ?? AccordionIcon.Chevron;
|
|
1407
|
-
const trigger = make$3(create, 'trigger', Type$7.LinkedContainer, DisclosureRole.Trigger, Style$
|
|
1408
|
+
const trigger = make$3(create, 'trigger', Type$7.LinkedContainer, DisclosureRole.Trigger, Style$7.Trigger, {}, 'Toggle');
|
|
1408
1409
|
trigger.children = [
|
|
1409
1410
|
buildWord(create, DisclosureRole.More, words.more, root.id),
|
|
1410
1411
|
buildWord(create, DisclosureRole.Less, words.less, root.id),
|
|
1411
1412
|
...(icon === AccordionIcon.None ? [] : [buildCompositeIcon(create, 'icon', icon, root.id, DisclosureRole.Icon)]),
|
|
1412
1413
|
];
|
|
1413
|
-
const panel = make$3(create, 'panel', Type$7.Container, DisclosureRole.Panel, Style$
|
|
1414
|
-
const body = make$3(create, 'body', Type$7.Text, null, Style$
|
|
1414
|
+
const panel = make$3(create, 'panel', Type$7.Container, DisclosureRole.Panel, Style$7.Panel, {}, 'Panel');
|
|
1415
|
+
const body = make$3(create, 'body', Type$7.Text, null, Style$7.Body, { content: words.body, tag: 'p' }, 'Text');
|
|
1415
1416
|
writeStyles(body, BODY_BASE$1);
|
|
1416
1417
|
panel.children = [body];
|
|
1417
1418
|
root.children = [trigger, panel];
|
|
@@ -1583,7 +1584,7 @@ var Type$6;
|
|
|
1583
1584
|
Type["Icon"] = "Icon";
|
|
1584
1585
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
1585
1586
|
})(Type$6 || (Type$6 = {}));
|
|
1586
|
-
var Style$
|
|
1587
|
+
var Style$6;
|
|
1587
1588
|
(function (Style) {
|
|
1588
1589
|
Style["Card"] = "card";
|
|
1589
1590
|
Style["Box"] = "box";
|
|
@@ -1596,7 +1597,7 @@ var Style$5;
|
|
|
1596
1597
|
Style["Ghost"] = "button-ghost";
|
|
1597
1598
|
Style["Icon"] = "icon";
|
|
1598
1599
|
Style["Scrim"] = "media-scrim";
|
|
1599
|
-
})(Style$
|
|
1600
|
+
})(Style$6 || (Style$6 = {}));
|
|
1600
1601
|
var Scheme;
|
|
1601
1602
|
(function (Scheme) {
|
|
1602
1603
|
Scheme["Default"] = "default";
|
|
@@ -1606,9 +1607,9 @@ const LINK_TYPE = 'linkType';
|
|
|
1606
1607
|
const SAVE_ICON = 'ph ph-bookmark-simple';
|
|
1607
1608
|
/** A value an element style writes — read from the contract, never retyped. */
|
|
1608
1609
|
const styleValue = (style, trait) => String(elementStyleById(style)?.base[trait] ?? '');
|
|
1609
|
-
const CARD_PAD = styleValue(Style$
|
|
1610
|
-
const IMAGE_RADIUS = styleValue(Style$
|
|
1611
|
-
const TITLE_SIZE = styleValue(Style$
|
|
1610
|
+
const CARD_PAD = styleValue(Style$6.Card, 'padding');
|
|
1611
|
+
const IMAGE_RADIUS = styleValue(Style$6.Media, 'borderRadius');
|
|
1612
|
+
const TITLE_SIZE = styleValue(Style$6.Title, 'fontSize');
|
|
1612
1613
|
const LEAD_SIZE = 'var(--iox-size-lead)';
|
|
1613
1614
|
const ZERO_BOX$2 = '0px 0px 0px 0px';
|
|
1614
1615
|
/** What every card part holds in every layout — the recipe's box. */
|
|
@@ -1636,7 +1637,7 @@ const LAYOUTS = {
|
|
|
1636
1637
|
card: { flexDirection: 'column', alignItems: 'stretch', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1637
1638
|
media: { ...IN_FLOW, flexBasis: 'auto' },
|
|
1638
1639
|
image: { aspectRatio: '4 / 3', height: 'auto', minHeight: 'auto', borderRadius: IMAGE_RADIUS },
|
|
1639
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1640
|
+
content: GROWING_CONTENT, contentStyle: Style$6.Box, contentScheme: Scheme.Default,
|
|
1640
1641
|
title: { fontSize: TITLE_SIZE },
|
|
1641
1642
|
badgeOnMedia: true,
|
|
1642
1643
|
},
|
|
@@ -1644,7 +1645,7 @@ const LAYOUTS = {
|
|
|
1644
1645
|
card: { flexDirection: 'row', alignItems: 'stretch', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1645
1646
|
media: { ...IN_FLOW, flexBasis: '42%' },
|
|
1646
1647
|
image: { aspectRatio: 'auto', height: '100%', minHeight: '180px', borderRadius: IMAGE_RADIUS },
|
|
1647
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1648
|
+
content: GROWING_CONTENT, contentStyle: Style$6.Box, contentScheme: Scheme.Default,
|
|
1648
1649
|
title: { fontSize: TITLE_SIZE },
|
|
1649
1650
|
badgeOnMedia: true,
|
|
1650
1651
|
stack: {
|
|
@@ -1658,7 +1659,7 @@ const LAYOUTS = {
|
|
|
1658
1659
|
media: { position: 'absolute', top: '0px', right: '0px', bottom: '0px', left: '0px', flexBasis: 'auto' },
|
|
1659
1660
|
image: { aspectRatio: 'auto', height: '100%', minHeight: 'auto', borderRadius: '0px' },
|
|
1660
1661
|
content: { position: 'relative', flexGrow: '0', flexShrink: '0', flexBasis: 'auto', padding: `72px ${CARD_PAD} ${CARD_PAD} ${CARD_PAD}` },
|
|
1661
|
-
contentStyle: Style$
|
|
1662
|
+
contentStyle: Style$6.Scrim, contentScheme: Scheme.Inverse,
|
|
1662
1663
|
title: { fontSize: TITLE_SIZE },
|
|
1663
1664
|
badgeOnMedia: false,
|
|
1664
1665
|
},
|
|
@@ -1666,7 +1667,7 @@ const LAYOUTS = {
|
|
|
1666
1667
|
card: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', minHeight: 'auto', padding: CARD_PAD },
|
|
1667
1668
|
media: { ...IN_FLOW, flexBasis: '72px' },
|
|
1668
1669
|
image: { aspectRatio: '1 / 1', height: 'auto', minHeight: 'auto', borderRadius: IMAGE_RADIUS },
|
|
1669
|
-
content: GROWING_CONTENT, contentStyle: Style$
|
|
1670
|
+
content: GROWING_CONTENT, contentStyle: Style$6.Box, contentScheme: Scheme.Default,
|
|
1670
1671
|
title: { fontSize: LEAD_SIZE },
|
|
1671
1672
|
badgeOnMedia: false,
|
|
1672
1673
|
partsOff: [CardPart.Text, CardPart.Actions],
|
|
@@ -1687,15 +1688,15 @@ function make$2(create, key, type, role, elementStyle, props = {}, label) {
|
|
|
1687
1688
|
return node;
|
|
1688
1689
|
}
|
|
1689
1690
|
function buttonLabel(create, key, words) {
|
|
1690
|
-
const label = make$2(create, key, Type$6.Text, null, Style$
|
|
1691
|
+
const label = make$2(create, key, Type$6.Text, null, Style$6.Label, { content: words, tag: 'span' });
|
|
1691
1692
|
writeStyles(label, LABEL_BASE$2);
|
|
1692
1693
|
return label;
|
|
1693
1694
|
}
|
|
1694
1695
|
/** Each optional part (and the locked title) as the recipe builds it. */
|
|
1695
1696
|
const PART_BUILDERS = {
|
|
1696
1697
|
[CardPart.Media]: (create) => {
|
|
1697
|
-
const media = make$2(create, 'media', Type$6.Container, CardRole.Media, Style$
|
|
1698
|
-
const image = make$2(create, 'image', Type$6.Image, null, Style$
|
|
1698
|
+
const media = make$2(create, 'media', Type$6.Container, CardRole.Media, Style$6.Box, {}, 'Media');
|
|
1699
|
+
const image = make$2(create, 'image', Type$6.Image, null, Style$6.Media, { src: '', alt: '' });
|
|
1699
1700
|
writeStyles(image, IMAGE_BASE$2);
|
|
1700
1701
|
media.children = [image];
|
|
1701
1702
|
return media;
|
|
@@ -1706,14 +1707,14 @@ const PART_BUILDERS = {
|
|
|
1706
1707
|
badge.label = 'Badge';
|
|
1707
1708
|
return badge;
|
|
1708
1709
|
},
|
|
1709
|
-
[CardPart.Eyebrow]: (create, words) => make$2(create, 'eyebrow', Type$6.Text, CardRole.Eyebrow, Style$
|
|
1710
|
-
[CardPart.Text]: (create, words) => make$2(create, 'text', Type$6.Text, CardRole.Text, Style$
|
|
1710
|
+
[CardPart.Eyebrow]: (create, words) => make$2(create, 'eyebrow', Type$6.Text, CardRole.Eyebrow, Style$6.Eyebrow, { content: words.eyebrow, tag: 'p' }, 'Eyebrow'),
|
|
1711
|
+
[CardPart.Text]: (create, words) => make$2(create, 'text', Type$6.Text, CardRole.Text, Style$6.Body, { content: words.text, tag: 'p' }, 'Text'),
|
|
1711
1712
|
[CardPart.Actions]: (create, words) => {
|
|
1712
|
-
const actions = make$2(create, 'actions', Type$6.Container, CardRole.Actions, Style$
|
|
1713
|
-
const primary = make$2(create, 'primary', Type$6.ButtonBlock, null, Style$
|
|
1713
|
+
const actions = make$2(create, 'actions', Type$6.Container, CardRole.Actions, Style$6.Box, {}, 'Buttons');
|
|
1714
|
+
const primary = make$2(create, 'primary', Type$6.ButtonBlock, null, Style$6.Primary);
|
|
1714
1715
|
primary.children = [buttonLabel(create, 'primary-label', words.primary)];
|
|
1715
|
-
const ghost = make$2(create, 'secondary', Type$6.ButtonBlock, null, Style$
|
|
1716
|
-
const icon = make$2(create, 'secondary-icon', Type$6.Icon, null, Style$
|
|
1716
|
+
const ghost = make$2(create, 'secondary', Type$6.ButtonBlock, null, Style$6.Ghost);
|
|
1717
|
+
const icon = make$2(create, 'secondary-icon', Type$6.Icon, null, Style$6.Icon, { iconClass: SAVE_ICON });
|
|
1717
1718
|
writeStyles(icon, INLINE_ICON);
|
|
1718
1719
|
ghost.children = [icon, buttonLabel(create, 'secondary-label', words.secondary)];
|
|
1719
1720
|
actions.children = [primary, ghost];
|
|
@@ -1721,15 +1722,15 @@ const PART_BUILDERS = {
|
|
|
1721
1722
|
},
|
|
1722
1723
|
};
|
|
1723
1724
|
function buildTitle(create, words) {
|
|
1724
|
-
return make$2(create, 'title', Type$6.Heading, CardRole.Title, Style$
|
|
1725
|
+
return make$2(create, 'title', Type$6.Heading, CardRole.Title, Style$6.Title, { content: words.title, level: 'h3', [LINK_TYPE]: LinkType.None }, 'Title');
|
|
1725
1726
|
}
|
|
1726
1727
|
/** A fresh Card v2: every part a node with its role and element style, laid out by `options.layout`. */
|
|
1727
1728
|
function buildCardRecipe(create, options = {}) {
|
|
1728
1729
|
const words = { ...CARD_WORDS, ...(options.words ?? {}) };
|
|
1729
1730
|
const tone = options.badgeTone ?? BadgeTone.Accent;
|
|
1730
1731
|
const on = (part) => options.parts?.[part] !== false;
|
|
1731
|
-
const card = make$2(create, 'card', Type$6.Container, CardRole.Card, Style$
|
|
1732
|
-
const content = make$2(create, 'content', Type$6.Container, CardRole.Content, Style$
|
|
1732
|
+
const card = make$2(create, 'card', Type$6.Container, CardRole.Card, Style$6.Card, {}, 'Card');
|
|
1733
|
+
const content = make$2(create, 'content', Type$6.Container, CardRole.Content, Style$6.Box, {}, 'Content');
|
|
1733
1734
|
content.children = [
|
|
1734
1735
|
...(on(CardPart.Eyebrow) ? [PART_BUILDERS[CardPart.Eyebrow](create, words, tone)] : []),
|
|
1735
1736
|
buildTitle(create, words),
|
|
@@ -2334,13 +2335,13 @@ var Type$4;
|
|
|
2334
2335
|
Type["Container"] = "Container";
|
|
2335
2336
|
Type["Text"] = "Text";
|
|
2336
2337
|
})(Type$4 || (Type$4 = {}));
|
|
2337
|
-
var Style$
|
|
2338
|
+
var Style$5;
|
|
2338
2339
|
(function (Style) {
|
|
2339
2340
|
Style["Control"] = "button-secondary";
|
|
2340
2341
|
Style["Icon"] = "icon";
|
|
2341
2342
|
/** The caption and the count read as small print. */
|
|
2342
2343
|
Style["Words"] = "small";
|
|
2343
|
-
})(Style$
|
|
2344
|
+
})(Style$5 || (Style$5 = {}));
|
|
2344
2345
|
/** Each part's glyph (Phosphor) and its default accessible name. */
|
|
2345
2346
|
const SLIDER_PART_GLYPH = {
|
|
2346
2347
|
[SliderRole.Pause]: 'ph ph-pause',
|
|
@@ -2411,7 +2412,7 @@ function buildSliderPart(create, role, legacy) {
|
|
|
2411
2412
|
if (role === SliderRole.Caption || role === SliderRole.Count) {
|
|
2412
2413
|
// Their words are the runtime's (the slide in view), drawn as the part's generated content: the node's own
|
|
2413
2414
|
// content stays empty, so no renderer ever fights the runtime over the element's text.
|
|
2414
|
-
return makeCompositePart(create, { key: role.split('.')[1], type: Type$4.Text, props: { content: '', tag: 'p' }, elementStyle: Style$
|
|
2415
|
+
return makeCompositePart(create, { key: role.split('.')[1], type: Type$4.Text, props: { content: '', tag: 'p' }, elementStyle: Style$5.Words }, role, PART_LABEL[role], role === SliderRole.Caption ? CAPTION_BASE$1 : COUNT_BASE);
|
|
2415
2416
|
}
|
|
2416
2417
|
if (role === SliderRole.Pagination) {
|
|
2417
2418
|
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);
|
|
@@ -2430,9 +2431,9 @@ function buildSliderPart(create, role, legacy) {
|
|
|
2430
2431
|
const props = { tag: 'button', type: 'button' };
|
|
2431
2432
|
if (role !== SliderRole.Pause)
|
|
2432
2433
|
props[SLIDER_NAME_TRAIT] = role === SliderRole.Prev ? SLIDER_WORDS.en.prev : SLIDER_WORDS.en.next;
|
|
2433
|
-
const button = makeCompositePart(create, { key, type: Type$4.ButtonBlock, props, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$
|
|
2434
|
+
const button = makeCompositePart(create, { key, type: Type$4.ButtonBlock, props, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$5.Control }, role, PART_LABEL[role], base);
|
|
2434
2435
|
const iconBase = legacy ? { ...ICON_BASE, fontSize: `${Math.round((legacy.navigationSize ?? 44) * 0.6)}px` } : ICON_BASE;
|
|
2435
|
-
const icon = makeCompositePart(create, { key: `${key}-icon`, type: Type$4.Icon, props: { iconClass: SLIDER_PART_GLYPH[role] }, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$
|
|
2436
|
+
const icon = makeCompositePart(create, { key: `${key}-icon`, type: Type$4.Icon, props: { iconClass: SLIDER_PART_GLYPH[role] }, elementStyle: legacy ? NO_ELEMENT_STYLE : Style$5.Icon }, null, 'Icon', iconBase);
|
|
2436
2437
|
button.children = [icon];
|
|
2437
2438
|
return button;
|
|
2438
2439
|
}
|
|
@@ -3214,7 +3215,7 @@ var Type$3;
|
|
|
3214
3215
|
Type["Image"] = "Image";
|
|
3215
3216
|
Type["Repeater"] = "Repeater";
|
|
3216
3217
|
})(Type$3 || (Type$3 = {}));
|
|
3217
|
-
var Style$
|
|
3218
|
+
var Style$4;
|
|
3218
3219
|
(function (Style) {
|
|
3219
3220
|
Style["Root"] = "box";
|
|
3220
3221
|
Style["List"] = "tab-list";
|
|
@@ -3224,10 +3225,10 @@ var Style$3;
|
|
|
3224
3225
|
Style["Panel"] = "box";
|
|
3225
3226
|
Style["Media"] = "media";
|
|
3226
3227
|
Style["Body"] = "body";
|
|
3227
|
-
})(Style$
|
|
3228
|
+
})(Style$4 || (Style$4 = {}));
|
|
3228
3229
|
const ZERO_BOX$1 = '0px 0px 0px 0px';
|
|
3229
3230
|
/** The list's hairline, as its element style writes it — read from the contract, never retyped. */
|
|
3230
|
-
const LIST_EDGE = String(elementStyleById(Style$
|
|
3231
|
+
const LIST_EDGE = String(elementStyleById(Style$4.List)?.base['borderWidth'] ?? ZERO_BOX$1);
|
|
3231
3232
|
/** What each part holds — layout only; its LOOK is its element style. The list WRAPS at narrow widths (board 3). */
|
|
3232
3233
|
const PART_BASE$1 = {
|
|
3233
3234
|
[TabsRole.Tabs]: { display: 'flex', width: '100%', minHeight: 'auto', height: 'auto' },
|
|
@@ -3261,30 +3262,30 @@ function make$1(create, key, type, role, style, props = {}, label) {
|
|
|
3261
3262
|
}
|
|
3262
3263
|
/** One tab and its panel, sharing `itemKey`. */
|
|
3263
3264
|
function buildTabPair(create, words, itemKey) {
|
|
3264
|
-
const tab = make$1(create, `${itemKey}-tab`, Type$3.ButtonBlock, TabsRole.Trigger, Style$
|
|
3265
|
+
const tab = make$1(create, `${itemKey}-tab`, Type$3.ButtonBlock, TabsRole.Trigger, Style$4.Tab, {}, 'Tab');
|
|
3265
3266
|
tab.itemKey = itemKey;
|
|
3266
|
-
const label = make$1(create, `${itemKey}-label`, Type$3.Text, null, Style$
|
|
3267
|
+
const label = make$1(create, `${itemKey}-label`, Type$3.Text, null, Style$4.Label, { content: words.label, tag: 'span' }, 'Text');
|
|
3267
3268
|
writeStyles(label, LABEL_BASE$1);
|
|
3268
3269
|
tab.children = [label];
|
|
3269
|
-
const panel = make$1(create, `${itemKey}-panel`, Type$3.Container, TabsRole.Panel, Style$
|
|
3270
|
+
const panel = make$1(create, `${itemKey}-panel`, Type$3.Container, TabsRole.Panel, Style$4.Panel, {}, 'Panel');
|
|
3270
3271
|
panel.itemKey = itemKey;
|
|
3271
3272
|
writeLayerStyles(panel, TABS_STACK_BREAKPOINT, PANEL_STACK);
|
|
3272
|
-
const image = make$1(create, `${itemKey}-image`, Type$3.Image, null, Style$
|
|
3273
|
+
const image = make$1(create, `${itemKey}-image`, Type$3.Image, null, Style$4.Media, { src: '', alt: '' }, 'Image');
|
|
3273
3274
|
writeStyles(image, IMAGE_BASE);
|
|
3274
|
-
const text = make$1(create, `${itemKey}-text`, Type$3.Text, null, Style$
|
|
3275
|
+
const text = make$1(create, `${itemKey}-text`, Type$3.Text, null, Style$4.Body, { content: words.text, tag: 'p' }, 'Text');
|
|
3275
3276
|
writeStyles(text, BODY_BASE);
|
|
3276
3277
|
panel.children = [image, text];
|
|
3277
3278
|
return { tab, panel };
|
|
3278
3279
|
}
|
|
3279
3280
|
/** A fresh Tabs: three tabs, the first on, activated by a click, the list across the top (board 3). */
|
|
3280
3281
|
function buildTabsRecipe(create, options = {}) {
|
|
3281
|
-
const root = make$1(create, 'tabs', Type$3.Container, TabsRole.Tabs, Style$
|
|
3282
|
+
const root = make$1(create, 'tabs', Type$3.Container, TabsRole.Tabs, Style$4.Root, {}, 'Tabs');
|
|
3282
3283
|
writeProp(root, TabsBehaviourTrait.ActivateOn, options.activateOn ?? TabsActivateOn.Click);
|
|
3283
3284
|
writeProp(root, TabsBehaviourTrait.Orientation, options.orientation ?? TabsOrientation.Horizontal);
|
|
3284
3285
|
if (options.label)
|
|
3285
3286
|
writeProp(root, TabsBehaviourTrait.Label, options.label);
|
|
3286
|
-
const list = make$1(create, 'list', Type$3.Container, TabsRole.List, Style$
|
|
3287
|
-
const panels = make$1(create, 'panels', Type$3.Container, TabsRole.Panels, Style$
|
|
3287
|
+
const list = make$1(create, 'list', Type$3.Container, TabsRole.List, Style$4.List, {}, 'Tab list');
|
|
3288
|
+
const panels = make$1(create, 'panels', Type$3.Container, TabsRole.Panels, Style$4.Panels, {}, 'Panels');
|
|
3288
3289
|
const pairs = (options.tabs ?? TABS_WORDS).map((w, i) => buildTabPair(create, w, `k${i + 1}`));
|
|
3289
3290
|
list.children = pairs.map(p => p.tab);
|
|
3290
3291
|
panels.children = pairs.map(p => p.panel);
|
|
@@ -3724,12 +3725,12 @@ var Type$2;
|
|
|
3724
3725
|
Type["ButtonBlock"] = "ButtonBlock";
|
|
3725
3726
|
Type["Text"] = "Text";
|
|
3726
3727
|
})(Type$2 || (Type$2 = {}));
|
|
3727
|
-
var Style$
|
|
3728
|
+
var Style$3;
|
|
3728
3729
|
(function (Style) {
|
|
3729
3730
|
Style["Root"] = "segmented";
|
|
3730
3731
|
Style["Option"] = "segmented-option";
|
|
3731
3732
|
Style["Label"] = "button-label";
|
|
3732
|
-
})(Style$
|
|
3733
|
+
})(Style$3 || (Style$3 = {}));
|
|
3733
3734
|
const ZERO_BOX = '0px 0px 0px 0px';
|
|
3734
3735
|
/** What each part holds — layout only; its LOOK is its element style (the track's fill, border, radius and pad; the
|
|
3735
3736
|
* option's ink, pad, radius and 44px target). The options sit in a flex row a gap token apart (board 10); each GROWS,
|
|
@@ -3747,9 +3748,9 @@ function make(create, key, type, role, style, props = {}, label) {
|
|
|
3747
3748
|
}
|
|
3748
3749
|
/** One option: a ButtonBlock carrying its key, holding its words. */
|
|
3749
3750
|
function buildSegmentedOption(create, words) {
|
|
3750
|
-
const option = make(create, `${words.key}-option`, Type$2.ButtonBlock, SegmentedRole.Option, Style$
|
|
3751
|
+
const option = make(create, `${words.key}-option`, Type$2.ButtonBlock, SegmentedRole.Option, Style$3.Option, {}, 'Option');
|
|
3751
3752
|
option.itemKey = words.key;
|
|
3752
|
-
const label = make(create, `${words.key}-label`, Type$2.Text, null, Style$
|
|
3753
|
+
const label = make(create, `${words.key}-label`, Type$2.Text, null, Style$3.Label, { content: words.label, tag: 'span' }, 'Text');
|
|
3753
3754
|
writeStyles(label, LABEL_BASE);
|
|
3754
3755
|
option.children = [label];
|
|
3755
3756
|
return option;
|
|
@@ -3757,7 +3758,7 @@ function buildSegmentedOption(create, words) {
|
|
|
3757
3758
|
/** A fresh Segmented control: Monthly · Yearly, Monthly on, named "Billing period" (board 10 ▸ Palette). */
|
|
3758
3759
|
function buildSegmentedRecipe(create, options = {}) {
|
|
3759
3760
|
const words = options.options ?? SEGMENTED_WORDS;
|
|
3760
|
-
const root = make(create, 'segmented', Type$2.Container, SegmentedRole.Segmented, Style$
|
|
3761
|
+
const root = make(create, 'segmented', Type$2.Container, SegmentedRole.Segmented, Style$3.Root, {}, 'Segmented');
|
|
3761
3762
|
root.children = words.map(w => buildSegmentedOption(create, w));
|
|
3762
3763
|
writeProp(root, SegmentedTrait.DefaultOn, options.defaultOn && words.some(w => w.key === options.defaultOn) ? options.defaultOn : words[0]?.key ?? '');
|
|
3763
3764
|
writeProp(root, SegmentedTrait.Label, options.label ?? SEGMENTED_NAME);
|
|
@@ -4065,7 +4066,7 @@ function behaviourOf(root) {
|
|
|
4065
4066
|
orientation: TABS_ORIENTATIONS.includes(orientation) ? orientation : TabsOrientation.Horizontal,
|
|
4066
4067
|
};
|
|
4067
4068
|
}
|
|
4068
|
-
function setAttr$
|
|
4069
|
+
function setAttr$2(el, name, value) {
|
|
4069
4070
|
if (!el)
|
|
4070
4071
|
return;
|
|
4071
4072
|
if (value === null) {
|
|
@@ -4267,10 +4268,10 @@ class ExclusiveRuntime {
|
|
|
4267
4268
|
const rootId = this.rootId();
|
|
4268
4269
|
const vertical = this.behaviourValue.orientation === TabsOrientation.Vertical;
|
|
4269
4270
|
for (const list of this.lists()) {
|
|
4270
|
-
setAttr$
|
|
4271
|
-
setAttr$
|
|
4271
|
+
setAttr$2(list, 'role', 'tablist');
|
|
4272
|
+
setAttr$2(list, 'aria-orientation', vertical ? 'vertical' : null);
|
|
4272
4273
|
if (this.options.label)
|
|
4273
|
-
setAttr$
|
|
4274
|
+
setAttr$2(list, 'aria-label', this.options.label() || null);
|
|
4274
4275
|
}
|
|
4275
4276
|
const panels = this.panels();
|
|
4276
4277
|
const panelOf = (key) => panels.find(p => this.keyOf(p) === key) ?? null;
|
|
@@ -4278,43 +4279,43 @@ class ExclusiveRuntime {
|
|
|
4278
4279
|
const key = this.keyOf(trigger);
|
|
4279
4280
|
const on = key === next;
|
|
4280
4281
|
const ids = accordionDomIds(rootId, key, CompositeKind.Tabs);
|
|
4281
|
-
setAttr$
|
|
4282
|
-
setAttr$
|
|
4283
|
-
setAttr$
|
|
4284
|
-
setAttr$
|
|
4285
|
-
setAttr$
|
|
4286
|
-
setAttr$
|
|
4287
|
-
setAttr$
|
|
4288
|
-
setAttr$
|
|
4282
|
+
setAttr$2(trigger, ITEM_KEY_ATTRIBUTE, key);
|
|
4283
|
+
setAttr$2(trigger, 'type', trigger.tagName === 'BUTTON' ? 'button' : null);
|
|
4284
|
+
setAttr$2(trigger, 'role', 'tab');
|
|
4285
|
+
setAttr$2(trigger, 'id', ids.trigger);
|
|
4286
|
+
setAttr$2(trigger, 'aria-selected', on ? 'true' : 'false');
|
|
4287
|
+
setAttr$2(trigger, 'aria-controls', panelOf(key) ? ids.panel : null);
|
|
4288
|
+
setAttr$2(trigger, 'tabindex', on ? '0' : '-1');
|
|
4289
|
+
setAttr$2(trigger, ON_ATTRIBUTE, on ? '' : null);
|
|
4289
4290
|
}
|
|
4290
4291
|
for (const panel of panels) {
|
|
4291
4292
|
const key = this.keyOf(panel);
|
|
4292
4293
|
const on = key === next;
|
|
4293
4294
|
const ids = accordionDomIds(rootId, key, CompositeKind.Tabs);
|
|
4294
|
-
setAttr$
|
|
4295
|
-
setAttr$
|
|
4296
|
-
setAttr$
|
|
4297
|
-
setAttr$
|
|
4298
|
-
setAttr$
|
|
4299
|
-
setAttr$
|
|
4300
|
-
setAttr$
|
|
4295
|
+
setAttr$2(panel, ITEM_KEY_ATTRIBUTE, key);
|
|
4296
|
+
setAttr$2(panel, 'role', 'tabpanel');
|
|
4297
|
+
setAttr$2(panel, 'id', ids.panel);
|
|
4298
|
+
setAttr$2(panel, 'aria-labelledby', ids.trigger);
|
|
4299
|
+
setAttr$2(panel, 'tabindex', '0');
|
|
4300
|
+
setAttr$2(panel, ON_ATTRIBUTE, on ? '' : null);
|
|
4301
|
+
setAttr$2(panel, 'hidden', on ? null : '');
|
|
4301
4302
|
}
|
|
4302
4303
|
this.announce(triggers, next, first, panelOf);
|
|
4303
4304
|
}
|
|
4304
4305
|
/** A Segmented control's markup (CC4b): the root a named radio group, each option a radio, one checked. */
|
|
4305
4306
|
stampRadioGroup(options, next, first) {
|
|
4306
|
-
setAttr$
|
|
4307
|
+
setAttr$2(this.root, 'role', 'radiogroup');
|
|
4307
4308
|
if (this.options.label)
|
|
4308
|
-
setAttr$
|
|
4309
|
+
setAttr$2(this.root, 'aria-label', this.options.label() || null);
|
|
4309
4310
|
for (const option of options) {
|
|
4310
4311
|
const key = this.keyOf(option);
|
|
4311
4312
|
const on = key === next;
|
|
4312
|
-
setAttr$
|
|
4313
|
-
setAttr$
|
|
4314
|
-
setAttr$
|
|
4315
|
-
setAttr$
|
|
4316
|
-
setAttr$
|
|
4317
|
-
setAttr$
|
|
4313
|
+
setAttr$2(option, ITEM_KEY_ATTRIBUTE, key);
|
|
4314
|
+
setAttr$2(option, 'type', option.tagName === 'BUTTON' ? 'button' : null);
|
|
4315
|
+
setAttr$2(option, 'role', 'radio');
|
|
4316
|
+
setAttr$2(option, 'aria-checked', on ? 'true' : 'false');
|
|
4317
|
+
setAttr$2(option, 'tabindex', on ? '0' : '-1');
|
|
4318
|
+
setAttr$2(option, ON_ATTRIBUTE, on ? '' : null);
|
|
4318
4319
|
}
|
|
4319
4320
|
this.announce(options, next, first);
|
|
4320
4321
|
}
|
|
@@ -4702,13 +4703,13 @@ var Type$1;
|
|
|
4702
4703
|
Type["Container"] = "Container";
|
|
4703
4704
|
Type["Text"] = "Text";
|
|
4704
4705
|
})(Type$1 || (Type$1 = {}));
|
|
4705
|
-
var Style$
|
|
4706
|
+
var Style$2;
|
|
4706
4707
|
(function (Style) {
|
|
4707
4708
|
Style["Box"] = "box";
|
|
4708
4709
|
Style["Number"] = "price";
|
|
4709
4710
|
Style["Words"] = "small";
|
|
4710
4711
|
Style["Bar"] = "progress-bar";
|
|
4711
|
-
})(Style$
|
|
4712
|
+
})(Style$2 || (Style$2 = {}));
|
|
4712
4713
|
const ZERO$1 = '0px 0px 0px 0px';
|
|
4713
4714
|
const COUNTER_BASE = { display: 'flex', flexDirection: 'column', gap: '6px', minHeight: 'auto', width: 'auto', padding: ZERO$1 };
|
|
4714
4715
|
const NUMBER_BASE = { margin: ZERO$1, width: 'auto' };
|
|
@@ -4725,9 +4726,9 @@ const COUNTER_SAMPLE_WORDS = Object.freeze({ number: '1,250+', label: 'projects
|
|
|
4725
4726
|
/** A number that counts up once, and its words (Components ▸ Interactive ▸ Counter). */
|
|
4726
4727
|
function buildCounterRecipe(create, words = {}) {
|
|
4727
4728
|
const text = { ...COUNTER_SAMPLE_WORDS, ...words };
|
|
4728
|
-
const root = makeCompositePart(create, { key: 'counter', type: Type$1.Container, props: {}, elementStyle: Style$
|
|
4729
|
-
const number = makeCompositePart(create, { key: 'counter-number', type: Type$1.Text, props: { content: text.number }, elementStyle: Style$
|
|
4730
|
-
const label = makeCompositePart(create, { key: 'counter-label', type: Type$1.Text, props: { content: text.label }, elementStyle: Style$
|
|
4729
|
+
const root = makeCompositePart(create, { key: 'counter', type: Type$1.Container, props: {}, elementStyle: Style$2.Box }, null, 'Counter', COUNTER_BASE);
|
|
4730
|
+
const number = makeCompositePart(create, { key: 'counter-number', type: Type$1.Text, props: { content: text.number }, elementStyle: Style$2.Number }, null, 'Number', NUMBER_BASE);
|
|
4731
|
+
const label = makeCompositePart(create, { key: 'counter-label', type: Type$1.Text, props: { content: text.label }, elementStyle: Style$2.Words }, null, 'Words', WORDS_BASE);
|
|
4731
4732
|
const { distance, ...entrance } = COUNTER_ENTRANCE;
|
|
4732
4733
|
number.interactions = [{
|
|
4733
4734
|
id: `${number.id ?? 'counter'}-count`, trigger: 'viewportEnter',
|
|
@@ -4742,7 +4743,7 @@ function buildCounterRecipe(create, words = {}) {
|
|
|
4742
4743
|
/** A bar that fills as the page is read (Components ▸ Interactive ▸ Reading bar). Its range may be changed to "This
|
|
4743
4744
|
* section" in the Interactions panel. */
|
|
4744
4745
|
function buildReadingBarRecipe(create) {
|
|
4745
|
-
const bar = makeCompositePart(create, { key: 'reading-bar', type: Type$1.Container, props: {}, elementStyle: Style$
|
|
4746
|
+
const bar = makeCompositePart(create, { key: 'reading-bar', type: Type$1.Container, props: {}, elementStyle: Style$2.Bar }, null, 'Reading bar', BAR_BASE);
|
|
4746
4747
|
bar.interactions = [{
|
|
4747
4748
|
id: `${bar.id ?? 'bar'}-read`, trigger: 'scrollProgress', range: 'page',
|
|
4748
4749
|
actions: [{ type: 'progressBar', target: 'self', duration: 1000, delay: 0, easing: 'linear' }],
|
|
@@ -4751,6 +4752,41 @@ function buildReadingBarRecipe(create) {
|
|
|
4751
4752
|
return bar;
|
|
4752
4753
|
}
|
|
4753
4754
|
|
|
4755
|
+
/**
|
|
4756
|
+
* The small builders the commerce recipes share (shop.ts — E1c, account.ts — E3a): a part, its words, an icon, a button,
|
|
4757
|
+
* a click that runs one action, a binding to a context slot. Internal to composite-core — not part of its public API.
|
|
4758
|
+
*/
|
|
4759
|
+
const ZERO = '0px 0px 0px 0px';
|
|
4760
|
+
/** Words that take their own size (a recipe never stamps a Text's 10px or a box's 200px — W1.1 `BASELINE_ROLES`). */
|
|
4761
|
+
const WORDS = { width: 'auto', minHeight: 'auto', padding: ZERO, margin: ZERO };
|
|
4762
|
+
const ROW = { display: 'flex', flexDirection: 'row', alignItems: 'center', width: 'auto', height: 'auto', minHeight: 'auto', padding: ZERO };
|
|
4763
|
+
const COLUMN = { display: 'flex', flexDirection: 'column', alignItems: 'stretch', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO };
|
|
4764
|
+
/** A click on `node` runs one action (`target` '' = the runtime finds its own). */
|
|
4765
|
+
function onClick(node, type, target = '') {
|
|
4766
|
+
node.interactions = [{
|
|
4767
|
+
id: `${node.id ?? 'node'}-click`, trigger: 'click',
|
|
4768
|
+
actions: [{ type, target, duration: 0, delay: 0, easing: 'ease' }],
|
|
4769
|
+
}];
|
|
4770
|
+
}
|
|
4771
|
+
/** Bind `prop` to a context slot path, through the money pipe when asked. */
|
|
4772
|
+
function bindSlot(node, prop, source, path, money = false) {
|
|
4773
|
+
const bindings = (node.bindings ?? []).filter(b => b.prop !== prop);
|
|
4774
|
+
bindings.push({ prop, source, path, ...(money ? { pipes: [{ name: 'money', args: [] }] } : {}) });
|
|
4775
|
+
node.bindings = bindings;
|
|
4776
|
+
}
|
|
4777
|
+
function recipePart(create, key, type, role, style, props, label, base) {
|
|
4778
|
+
return makeCompositePart(create, { key, type, props, elementStyle: style ?? undefined }, role, label, base);
|
|
4779
|
+
}
|
|
4780
|
+
function recipeText(create, key, role, style, words, label, base = WORDS, tag = 'p') {
|
|
4781
|
+
return recipePart(create, key, 'Text', role, style, { content: words, tag }, label, base);
|
|
4782
|
+
}
|
|
4783
|
+
function recipeIcon(create, key, iconClass, size = '18px') {
|
|
4784
|
+
return recipePart(create, key, 'Icon', null, 'icon', { iconClass }, 'Icon', { fontSize: size, color: 'inherit' });
|
|
4785
|
+
}
|
|
4786
|
+
function recipeButton(create, key, role, style, label, ariaLabel = '', base = {}) {
|
|
4787
|
+
return recipePart(create, key, 'ButtonBlock', role, style, { tag: 'button', type: 'button', ...(ariaLabel ? { ariaLabel } : {}) }, label, base);
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4754
4790
|
/**
|
|
4755
4791
|
* THE SHOP PARTS (commerce E1c, C-D16 — commerce board 10). Not components: recipes of ordinary builder nodes, each part
|
|
4756
4792
|
* carrying a role, so every part is selectable on the canvas, in the layer tree and the breadcrumb, and wears its own
|
|
@@ -4913,7 +4949,7 @@ var Type;
|
|
|
4913
4949
|
Type["Image"] = "Image";
|
|
4914
4950
|
Type["Dialog"] = "Dialog";
|
|
4915
4951
|
})(Type || (Type = {}));
|
|
4916
|
-
var Style;
|
|
4952
|
+
var Style$1;
|
|
4917
4953
|
(function (Style) {
|
|
4918
4954
|
Style["Price"] = "price";
|
|
4919
4955
|
Style["PriceCompare"] = "price-compare";
|
|
@@ -4935,7 +4971,7 @@ var Style;
|
|
|
4935
4971
|
Style["Media"] = "media";
|
|
4936
4972
|
Style["Icon"] = "icon";
|
|
4937
4973
|
Style["Title"] = "h3";
|
|
4938
|
-
})(Style || (Style = {}));
|
|
4974
|
+
})(Style$1 || (Style$1 = {}));
|
|
4939
4975
|
/** The words a fresh recipe shows (board 10's sample) — the runtime writes the product's own over them. */
|
|
4940
4976
|
const SHOP_RECIPE_WORDS = Object.freeze({
|
|
4941
4977
|
price: '₪240.00',
|
|
@@ -4966,43 +5002,26 @@ const SHOP_RECIPE_WORDS = Object.freeze({
|
|
|
4966
5002
|
const SHOP_LABELS = Object.freeze({
|
|
4967
5003
|
price: 'Price', variants: 'Options', quantity: 'Quantity', add: 'Add to cart', buyNow: 'Buy now', cartButton: 'Cart button', cartDrawer: 'Cart drawer',
|
|
4968
5004
|
});
|
|
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
5005
|
/** "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
|
-
}
|
|
5006
|
+
const STACKED$1 = { gridColumn: '1', gridRow: '1', ...WORDS };
|
|
4988
5007
|
function part(create, key, type, role, style, props, label, base) {
|
|
4989
|
-
return
|
|
5008
|
+
return recipePart(create, key, type, role, style, props, label, base);
|
|
4990
5009
|
}
|
|
4991
5010
|
function text(create, key, role, style, words, label, base = WORDS, tag = 'p') {
|
|
4992
|
-
return
|
|
5011
|
+
return recipeText(create, key, role, style, words, label, base, tag);
|
|
4993
5012
|
}
|
|
4994
5013
|
function icon(create, key, iconClass, size = '18px') {
|
|
4995
|
-
return
|
|
5014
|
+
return recipeIcon(create, key, iconClass, size);
|
|
4996
5015
|
}
|
|
4997
5016
|
function button(create, key, role, style, label, ariaLabel = '', base = {}) {
|
|
4998
|
-
return
|
|
5017
|
+
return recipeButton(create, key, role, style, label, ariaLabel, base);
|
|
4999
5018
|
}
|
|
5000
5019
|
/** Price: the variant's price and, when it is higher, its earlier price struck through (board 10). */
|
|
5001
5020
|
function buildPriceRecipe(create) {
|
|
5002
5021
|
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');
|
|
5022
|
+
const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style$1.Price, SHOP_RECIPE_WORDS.price, 'Price');
|
|
5004
5023
|
bindSlot(amount, 'content', '$variant', 'price', true);
|
|
5005
|
-
const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare, SHOP_RECIPE_WORDS.compareAt, 'Price before');
|
|
5024
|
+
const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style$1.PriceCompare, SHOP_RECIPE_WORDS.compareAt, 'Price before');
|
|
5006
5025
|
bindSlot(compare, 'content', '$variant', 'compareAt', true);
|
|
5007
5026
|
root.children = [amount, compare];
|
|
5008
5027
|
return root;
|
|
@@ -5011,13 +5030,13 @@ function buildPriceRecipe(create) {
|
|
|
5011
5030
|
function buildVariantPickerRecipe(create) {
|
|
5012
5031
|
const root = part(create, 'variants', Type.Container, ShopRole.Variants, null, {}, SHOP_LABELS.variants, { ...COLUMN, gap: '16px' });
|
|
5013
5032
|
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');
|
|
5033
|
+
const label = text(create, 'variant-label', ShopRole.VariantLabel, Style$1.Small, SHOP_RECIPE_WORDS.option, 'Option name');
|
|
5015
5034
|
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' });
|
|
5035
|
+
const chip = button(create, 'variant-value', ShopRole.VariantValue, Style$1.Chip, 'Value', '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
5036
|
+
chip.children = [text(create, 'variant-value-text', null, Style$1.Label, SHOP_RECIPE_WORDS.value, 'Text', WORDS, 'span')];
|
|
5037
|
+
const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style$1.Swatch, 'Swatch', 'Sand', { padding: ZERO, minWidth: '0px', minHeight: '0px' });
|
|
5019
5038
|
values.children = [chip, swatch];
|
|
5020
|
-
const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small, SHOP_RECIPE_WORDS.note, 'Sold-out note');
|
|
5039
|
+
const note = text(create, 'variant-note', ShopRole.VariantNote, Style$1.Small, SHOP_RECIPE_WORDS.note, 'Sold-out note');
|
|
5021
5040
|
group.children = [label, values, note];
|
|
5022
5041
|
root.children = [group];
|
|
5023
5042
|
return root;
|
|
@@ -5025,37 +5044,37 @@ function buildVariantPickerRecipe(create) {
|
|
|
5025
5044
|
/** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. */
|
|
5026
5045
|
function buildQuantityRecipe(create, compact = false, key = 'quantity') {
|
|
5027
5046
|
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', 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 });
|
|
5047
|
+
const root = part(create, key, Type.Container, ShopRole.Quantity, Style$1.Quantity, {}, SHOP_LABELS.quantity, { ...ROW, alignItems: 'stretch', gap: '0px', minHeight: size });
|
|
5048
|
+
const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style$1.QuantityButton, 'Decrease', 'Decrease quantity', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
5030
5049
|
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 });
|
|
5050
|
+
const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style$1.Body, SHOP_RECIPE_WORDS.quantity, 'Count', { ...WORDS, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: compact ? '32px' : '40px', fontVariantNumeric: 'tabular-nums' }, 'span');
|
|
5051
|
+
const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style$1.QuantityButton, 'Increase', 'Increase quantity', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
5033
5052
|
up.children = [icon(create, `${key}-up-icon`, 'ph ph-plus', compact ? '14px' : '16px')];
|
|
5034
5053
|
root.children = [down, value, up];
|
|
5035
5054
|
return root;
|
|
5036
5055
|
}
|
|
5037
5056
|
/** Add to cart: presses on pointer-down (its element style), then reads "Added ✓" in place for ADDED_HOLD_MS. */
|
|
5038
5057
|
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' });
|
|
5058
|
+
const root = button(create, 'add', ShopRole.Add, Style$1.Primary, SHOP_LABELS.add, '', { display: 'inline-grid', alignItems: 'center', justifyItems: 'center', flexGrow: '1', width: 'auto', height: 'auto' });
|
|
5040
5059
|
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'),
|
|
5060
|
+
text(create, 'add-label', ShopRole.AddLabel, Style$1.Label, SHOP_RECIPE_WORDS.add, 'Add', STACKED$1, 'span'),
|
|
5061
|
+
text(create, 'added-label', ShopRole.AddedLabel, Style$1.Label, SHOP_RECIPE_WORDS.added, 'Added', STACKED$1, 'span'),
|
|
5043
5062
|
];
|
|
5044
5063
|
onClick(root, 'addToCart');
|
|
5045
5064
|
return root;
|
|
5046
5065
|
}
|
|
5047
5066
|
/** Buy now: straight to checkout with this variant (inert on the canvas). */
|
|
5048
5067
|
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')];
|
|
5068
|
+
const root = button(create, 'buy-now', ShopRole.BuyNow, Style$1.Secondary, SHOP_LABELS.buyNow, '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
5069
|
+
root.children = [text(create, 'buy-now-label', null, Style$1.Label, SHOP_RECIPE_WORDS.buyNow, 'Text', WORDS, 'span')];
|
|
5051
5070
|
onClick(root, 'startCheckout');
|
|
5052
5071
|
return root;
|
|
5053
5072
|
}
|
|
5054
5073
|
/** The bag button with its live count ($cart.count); it opens the page's cart drawer. */
|
|
5055
5074
|
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: 'var(--iox-cart-count-size)', 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');
|
|
5075
|
+
const root = button(create, 'cart-button', ShopRole.CartButton, Style$1.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' });
|
|
5076
|
+
const count = part(create, 'cart-count', Type.Container, ShopRole.CartCount, Style$1.CartCount, {}, 'Count', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', minHeight: 'var(--iox-cart-count-size)', padding: '0px 4px 0px 4px', position: 'absolute', top: '-5px', right: '-5px' });
|
|
5077
|
+
const words = text(create, 'cart-count-text', null, Style$1.Label, SHOP_RECIPE_WORDS.count, 'Text', { ...WORDS, lineHeight: '1' }, 'span');
|
|
5059
5078
|
bindSlot(words, 'content', '$cart', 'count');
|
|
5060
5079
|
count.children = [words];
|
|
5061
5080
|
root.children = [icon(create, 'cart-icon', 'ph ph-handbag'), count];
|
|
@@ -5063,47 +5082,47 @@ function buildCartButtonRecipe(create) {
|
|
|
5063
5082
|
}
|
|
5064
5083
|
/** One cart line: thumbnail · title, variant, quantity and Remove · line total (board 10). */
|
|
5065
5084
|
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' });
|
|
5085
|
+
const line = part(create, 'cart-line', Type.Container, ShopRole.CartLine, Style$1.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 });
|
|
5086
|
+
const image = part(create, 'cart-line-image', Type.Image, ShopRole.CartLineImage, Style$1.Media, { src: '', alt: '' }, 'Image', { width: 'var(--iox-cart-thumb-size)', height: 'var(--iox-cart-thumb-size)', minHeight: '0px', objectFit: 'cover', aspectRatio: '1 / 1' });
|
|
5068
5087
|
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' });
|
|
5088
|
+
const title = text(create, 'cart-line-title', ShopRole.CartLineTitle, Style$1.Body, SHOP_RECIPE_WORDS.lineTitle, 'Title', { ...WORDS, fontWeight: '500' });
|
|
5089
|
+
const variant = text(create, 'cart-line-variant', ShopRole.CartLineVariant, Style$1.Small, SHOP_RECIPE_WORDS.lineVariant, 'Variant', { ...WORDS, margin: '0px 0px 6px 0px' });
|
|
5071
5090
|
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')];
|
|
5091
|
+
const remove = button(create, 'cart-line-remove', ShopRole.CartLineRemove, Style$1.Ghost, 'Remove', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
5092
|
+
remove.children = [text(create, 'cart-line-remove-text', null, Style$1.Small, SHOP_RECIPE_WORDS.remove, 'Text', WORDS, 'span')];
|
|
5074
5093
|
actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity'), remove];
|
|
5075
5094
|
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' });
|
|
5095
|
+
const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style$1.Price, SHOP_RECIPE_WORDS.lineTotal, 'Line total', { ...WORDS, fontSize: 'var(--iox-size-body)', textAlign: 'end' });
|
|
5077
5096
|
line.children = [image, info, total];
|
|
5078
5097
|
return line;
|
|
5079
5098
|
}
|
|
5080
5099
|
/** The cart drawer: a Dialog at the end edge (a bottom sheet on a phone — shared CSS), filled from the PRICED cart. */
|
|
5081
5100
|
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' });
|
|
5101
|
+
const drawer = part(create, 'cart-drawer', Type.Dialog, ShopRole.CartDrawer, Style$1.Dialog, {}, SHOP_LABELS.cartDrawer, { width: '380px', maxWidth: '100%', display: 'flex', flexDirection: 'column', gap: '14px' });
|
|
5083
5102
|
writeProp(drawer, 'placement', 'end');
|
|
5084
5103
|
writeProp(drawer, 'closeOnBackdrop', true);
|
|
5085
5104
|
writeProp(drawer, 'showCloseButton', false);
|
|
5086
5105
|
writeProp(drawer, 'ariaLabel', SHOP_RECIPE_WORDS.drawer);
|
|
5087
5106
|
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')];
|
|
5107
|
+
const title = part(create, 'cart-title', Type.Heading, ShopRole.CartTitle, Style$1.Title, { content: SHOP_RECIPE_WORDS.drawer, level: 'h2' }, 'Title', WORDS);
|
|
5108
|
+
const close = button(create, 'cart-close', ShopRole.CartClose, Style$1.Ghost, 'Close', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
5109
|
+
close.children = [text(create, 'cart-close-text', null, Style$1.Small, SHOP_RECIPE_WORDS.close, 'Text', WORDS, 'span')];
|
|
5091
5110
|
onClick(close, 'closeDialog', drawer.id ?? '');
|
|
5092
5111
|
head.children = [title, close];
|
|
5093
5112
|
const lines = part(create, 'cart-lines', Type.Container, ShopRole.CartLines, null, {}, 'Lines', { ...COLUMN, gap: '16px' });
|
|
5094
5113
|
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 });
|
|
5114
|
+
const issues = text(create, 'cart-issues', ShopRole.CartIssues, Style$1.Small, '', 'Issues', { ...WORDS, color: 'var(--iox-danger)' });
|
|
5115
|
+
const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style$1.Body, SHOP_RECIPE_WORDS.empty, 'Empty');
|
|
5116
|
+
const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style$1.CartNote, SHOP_RECIPE_WORDS.shippingNote, 'Free delivery note', { width: 'auto', minHeight: 'auto', margin: ZERO });
|
|
5098
5117
|
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');
|
|
5118
|
+
const subtotal = text(create, 'cart-subtotal', ShopRole.CartSubtotal, Style$1.Body, SHOP_RECIPE_WORDS.subtotal, 'Amount', { ...WORDS, fontVariantNumeric: 'tabular-nums', fontWeight: '600' }, 'span');
|
|
5100
5119
|
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')];
|
|
5120
|
+
summary.children = [text(create, 'cart-subtotal-label', null, Style$1.Body, SHOP_RECIPE_WORDS.subtotalLabel, 'Label', WORDS, 'span'), subtotal];
|
|
5121
|
+
const vat = text(create, 'cart-vat-note', ShopRole.CartVatNote, Style$1.Small, SHOP_RECIPE_WORDS.vatNote, 'VAT note');
|
|
5122
|
+
const checkout = button(create, 'checkout', ShopRole.Checkout, Style$1.Primary, 'Check out', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
5123
|
+
checkout.children = [text(create, 'checkout-label', null, Style$1.Label, SHOP_RECIPE_WORDS.checkout, 'Text', WORDS, 'span')];
|
|
5124
|
+
const keep = button(create, 'keep-shopping', ShopRole.KeepShopping, Style$1.Secondary, 'Keep shopping', '', { display: 'inline-flex', justifyContent: 'center', alignItems: 'center', width: '100%', height: 'auto' });
|
|
5125
|
+
keep.children = [text(create, 'keep-shopping-label', null, Style$1.Label, SHOP_RECIPE_WORDS.keepShopping, 'Text', WORDS, 'span')];
|
|
5107
5126
|
onClick(keep, 'closeDialog', drawer.id ?? '');
|
|
5108
5127
|
drawer.children = [head, lines, issues, empty, note, summary, vat, checkout, keep];
|
|
5109
5128
|
return drawer;
|
|
@@ -5152,11 +5171,11 @@ function bindShopPart(root, target, source, path) {
|
|
|
5152
5171
|
return true;
|
|
5153
5172
|
}
|
|
5154
5173
|
|
|
5155
|
-
const sel = shopSelector;
|
|
5174
|
+
const sel$1 = shopSelector;
|
|
5156
5175
|
const CLONE = `[${SHOP_CLONE_ATTRIBUTE}]`;
|
|
5157
|
-
const VALUE_TRIGGERS = `${sel(ShopRole.VariantValue)}:not([${SHOP_UNUSED_ATTRIBUTE}]), ${sel(ShopRole.VariantSwatch)}:not([${SHOP_UNUSED_ATTRIBUTE}])`;
|
|
5158
|
-
const SCOPES = new Map();
|
|
5159
|
-
function setAttr(el, name, value) {
|
|
5176
|
+
const VALUE_TRIGGERS = `${sel$1(ShopRole.VariantValue)}:not([${SHOP_UNUSED_ATTRIBUTE}]), ${sel$1(ShopRole.VariantSwatch)}:not([${SHOP_UNUSED_ATTRIBUTE}])`;
|
|
5177
|
+
const SCOPES$1 = new Map();
|
|
5178
|
+
function setAttr$1(el, name, value) {
|
|
5160
5179
|
if (!el)
|
|
5161
5180
|
return;
|
|
5162
5181
|
if (value === null) {
|
|
@@ -5171,7 +5190,7 @@ function setText(el, words) {
|
|
|
5171
5190
|
el.textContent = words;
|
|
5172
5191
|
}
|
|
5173
5192
|
/** The deepest element of a Text / Heading part that holds its words (a host may wrap them). */
|
|
5174
|
-
function wordsOf(el) {
|
|
5193
|
+
function wordsOf$1(el) {
|
|
5175
5194
|
if (!el)
|
|
5176
5195
|
return null;
|
|
5177
5196
|
let cur = el;
|
|
@@ -5213,11 +5232,11 @@ function stampCopies(template, count, key) {
|
|
|
5213
5232
|
}
|
|
5214
5233
|
/** Only the words on screen are in the button's name: "Add to cart", or "Added ✓" while it holds. */
|
|
5215
5234
|
function syncAddedWords(button, added) {
|
|
5216
|
-
setAttr(button, SHOP_ADDED_ATTRIBUTE, added ? '' : null);
|
|
5217
|
-
for (const label of Array.from(button.querySelectorAll(sel(ShopRole.AddLabel))))
|
|
5218
|
-
setAttr(label, 'aria-hidden', added ? 'true' : null);
|
|
5219
|
-
for (const label of Array.from(button.querySelectorAll(sel(ShopRole.AddedLabel))))
|
|
5220
|
-
setAttr(label, 'aria-hidden', added ? null : 'true');
|
|
5235
|
+
setAttr$1(button, SHOP_ADDED_ATTRIBUTE, added ? '' : null);
|
|
5236
|
+
for (const label of Array.from(button.querySelectorAll(sel$1(ShopRole.AddLabel))))
|
|
5237
|
+
setAttr$1(label, 'aria-hidden', added ? 'true' : null);
|
|
5238
|
+
for (const label of Array.from(button.querySelectorAll(sel$1(ShopRole.AddedLabel))))
|
|
5239
|
+
setAttr$1(label, 'aria-hidden', added ? null : 'true');
|
|
5221
5240
|
}
|
|
5222
5241
|
function announce(scope, words) {
|
|
5223
5242
|
const doc = scope.ownerDocument;
|
|
@@ -5256,11 +5275,11 @@ class ShopRuntime {
|
|
|
5256
5275
|
const copy = target.closest(CLONE);
|
|
5257
5276
|
if (copy && this.host.onCloneClick)
|
|
5258
5277
|
this.selectTemplateOf(copy, target);
|
|
5259
|
-
const step = target.closest(`${sel(ShopRole.QuantityDown)}, ${sel(ShopRole.QuantityUp)}`);
|
|
5278
|
+
const step = target.closest(`${sel$1(ShopRole.QuantityDown)}, ${sel$1(ShopRole.QuantityUp)}`);
|
|
5260
5279
|
if (step) {
|
|
5261
5280
|
if (step.getAttribute('aria-disabled') === 'true')
|
|
5262
5281
|
return;
|
|
5263
|
-
const dir = step.matches(sel(ShopRole.QuantityUp)) ? QuantityStep.Up : QuantityStep.Down;
|
|
5282
|
+
const dir = step.matches(sel$1(ShopRole.QuantityUp)) ? QuantityStep.Up : QuantityStep.Down;
|
|
5264
5283
|
const line = step.closest(`[${CART_LINE_ATTRIBUTE}]`);
|
|
5265
5284
|
if (line) {
|
|
5266
5285
|
const known = this.cart.lines.find(l => l.lineId === line.getAttribute(CART_LINE_ATTRIBUTE));
|
|
@@ -5276,17 +5295,17 @@ class ShopRuntime {
|
|
|
5276
5295
|
this.stamp();
|
|
5277
5296
|
return;
|
|
5278
5297
|
}
|
|
5279
|
-
const remove = target.closest(sel(ShopRole.CartLineRemove));
|
|
5298
|
+
const remove = target.closest(sel$1(ShopRole.CartLineRemove));
|
|
5280
5299
|
const removeLine = remove?.closest(`[${CART_LINE_ATTRIBUTE}]`);
|
|
5281
5300
|
if (removeLine) {
|
|
5282
5301
|
void this.changeLine(removeLine, null);
|
|
5283
5302
|
return;
|
|
5284
5303
|
}
|
|
5285
|
-
if (target.closest(sel(ShopRole.CartButton))) {
|
|
5304
|
+
if (target.closest(sel$1(ShopRole.CartButton))) {
|
|
5286
5305
|
this.openCart();
|
|
5287
5306
|
return;
|
|
5288
5307
|
}
|
|
5289
|
-
if (target.closest(sel(ShopRole.Checkout)) && !this.cart.empty)
|
|
5308
|
+
if (target.closest(sel$1(ShopRole.Checkout)) && !this.cart.empty)
|
|
5290
5309
|
this.host.goToCheckout?.();
|
|
5291
5310
|
};
|
|
5292
5311
|
this.onChange = (event) => {
|
|
@@ -5298,7 +5317,7 @@ class ShopRuntime {
|
|
|
5298
5317
|
if (state && option)
|
|
5299
5318
|
this.choose(state, option, select.value);
|
|
5300
5319
|
};
|
|
5301
|
-
SCOPES.set(scope, this);
|
|
5320
|
+
SCOPES$1.set(scope, this);
|
|
5302
5321
|
scope.addEventListener('click', this.onClick, true);
|
|
5303
5322
|
scope.addEventListener('change', this.onChange, true);
|
|
5304
5323
|
if (host.observe && typeof MutationObserver !== 'undefined') {
|
|
@@ -5339,8 +5358,8 @@ class ShopRuntime {
|
|
|
5339
5358
|
this.refuse(shopWord(ShopWord.SoldOut, this.lang), null);
|
|
5340
5359
|
return null;
|
|
5341
5360
|
}
|
|
5342
|
-
const button = el.closest(sel(ShopRole.Add)) ?? el;
|
|
5343
|
-
setAttr(button, 'aria-busy', 'true');
|
|
5361
|
+
const button = el.closest(sel$1(ShopRole.Add)) ?? el;
|
|
5362
|
+
setAttr$1(button, 'aria-busy', 'true');
|
|
5344
5363
|
try {
|
|
5345
5364
|
const view = await this.host.transport.add({ productId: String(state.product._id), variantId: variant.variantId, quantity: state.quantity });
|
|
5346
5365
|
this.setCart(view);
|
|
@@ -5353,7 +5372,7 @@ class ShopRuntime {
|
|
|
5353
5372
|
return null;
|
|
5354
5373
|
}
|
|
5355
5374
|
finally {
|
|
5356
|
-
setAttr(button, 'aria-busy', null);
|
|
5375
|
+
setAttr$1(button, 'aria-busy', null);
|
|
5357
5376
|
}
|
|
5358
5377
|
}
|
|
5359
5378
|
/** Buy now: add, then go straight to checkout. */
|
|
@@ -5365,7 +5384,7 @@ class ShopRuntime {
|
|
|
5365
5384
|
}
|
|
5366
5385
|
/** Open the page's cart drawer. False when the page has none. */
|
|
5367
5386
|
openCart() {
|
|
5368
|
-
const drawer = first(this.scope, sel(ShopRole.CartDrawer));
|
|
5387
|
+
const drawer = first(this.scope, sel$1(ShopRole.CartDrawer));
|
|
5369
5388
|
if (!drawer)
|
|
5370
5389
|
return false;
|
|
5371
5390
|
if (this.host.openDrawer)
|
|
@@ -5384,8 +5403,8 @@ class ShopRuntime {
|
|
|
5384
5403
|
}
|
|
5385
5404
|
destroy() {
|
|
5386
5405
|
this.destroyed = true;
|
|
5387
|
-
if (SCOPES.get(this.scope) === this)
|
|
5388
|
-
SCOPES.delete(this.scope);
|
|
5406
|
+
if (SCOPES$1.get(this.scope) === this)
|
|
5407
|
+
SCOPES$1.delete(this.scope);
|
|
5389
5408
|
this.scope.removeEventListener('click', this.onClick, true);
|
|
5390
5409
|
this.scope.removeEventListener('change', this.onChange, true);
|
|
5391
5410
|
this.observer?.disconnect();
|
|
@@ -5457,23 +5476,23 @@ class ShopRuntime {
|
|
|
5457
5476
|
this.stamping = true;
|
|
5458
5477
|
try {
|
|
5459
5478
|
let page = null;
|
|
5460
|
-
for (const root of own(this.scope, sel(ShopRole.Variants)).filter(r => !r.closest(CLONE))) {
|
|
5479
|
+
for (const root of own(this.scope, sel$1(ShopRole.Variants)).filter(r => !r.closest(CLONE))) {
|
|
5461
5480
|
const state = this.stateFor(root);
|
|
5462
5481
|
this.stampPicker(root, state);
|
|
5463
5482
|
page = page ?? state;
|
|
5464
5483
|
}
|
|
5465
|
-
for (const el of own(this.scope, `${sel(ShopRole.Quantity)}, ${sel(ShopRole.Add)}, ${sel(ShopRole.BuyNow)}, ${sel(ShopRole.Price)}`)) {
|
|
5466
|
-
if (el.closest(sel(ShopRole.CartLine)))
|
|
5484
|
+
for (const el of own(this.scope, `${sel$1(ShopRole.Quantity)}, ${sel$1(ShopRole.Add)}, ${sel$1(ShopRole.BuyNow)}, ${sel$1(ShopRole.Price)}`)) {
|
|
5485
|
+
if (el.closest(sel$1(ShopRole.CartLine)))
|
|
5467
5486
|
continue;
|
|
5468
5487
|
const state = this.stateFor(el);
|
|
5469
5488
|
page = page ?? state;
|
|
5470
5489
|
if (!state)
|
|
5471
5490
|
continue;
|
|
5472
|
-
if (el.matches(sel(ShopRole.Quantity)))
|
|
5491
|
+
if (el.matches(sel$1(ShopRole.Quantity)))
|
|
5473
5492
|
this.stampQuantity(el, state.quantity, this.boundsOf(state));
|
|
5474
|
-
else if (!el.matches(sel(ShopRole.Price))) {
|
|
5475
|
-
setAttr(el, 'aria-disabled', this.variantOf(state)?.sellable ? null : 'true');
|
|
5476
|
-
if (el.matches(sel(ShopRole.Add)))
|
|
5493
|
+
else if (!el.matches(sel$1(ShopRole.Price))) {
|
|
5494
|
+
setAttr$1(el, 'aria-disabled', this.variantOf(state)?.sellable ? null : 'true');
|
|
5495
|
+
if (el.matches(sel$1(ShopRole.Add)))
|
|
5477
5496
|
syncAddedWords(el, this.addedTimers.has(el));
|
|
5478
5497
|
}
|
|
5479
5498
|
}
|
|
@@ -5488,11 +5507,11 @@ class ShopRuntime {
|
|
|
5488
5507
|
}
|
|
5489
5508
|
}
|
|
5490
5509
|
stampPicker(root, state) {
|
|
5491
|
-
const template = Array.from(root.querySelectorAll(sel(ShopRole.VariantGroup))).find(g => !g.closest(CLONE));
|
|
5510
|
+
const template = Array.from(root.querySelectorAll(sel$1(ShopRole.VariantGroup))).find(g => !g.closest(CLONE));
|
|
5492
5511
|
if (!template)
|
|
5493
5512
|
return;
|
|
5494
5513
|
const options = state?.options ?? [];
|
|
5495
|
-
setAttr(root, SHOP_HIDDEN_ATTRIBUTE, options.length ? null : '');
|
|
5514
|
+
setAttr$1(root, SHOP_HIDDEN_ATTRIBUTE, options.length ? null : '');
|
|
5496
5515
|
if (!state || !options.length) {
|
|
5497
5516
|
stampCopies(template, 1, ShopRole.VariantGroup);
|
|
5498
5517
|
return;
|
|
@@ -5505,22 +5524,22 @@ class ShopRuntime {
|
|
|
5505
5524
|
stampGroup(group, state, option, values, fills) {
|
|
5506
5525
|
const kind = shopPickerKind(option, fills);
|
|
5507
5526
|
const chosen = state.choice[option.name];
|
|
5508
|
-
setText(wordsOf(first(group, sel(ShopRole.VariantLabel))), variantGroupLabel(option, chosen, kind));
|
|
5527
|
+
setText(wordsOf$1(first(group, sel$1(ShopRole.VariantLabel))), variantGroupLabel(option, chosen, kind));
|
|
5509
5528
|
const soldOut = values.filter(v => !v.available).map(v => v.value);
|
|
5510
|
-
const note = first(group, sel(ShopRole.VariantNote));
|
|
5529
|
+
const note = first(group, sel$1(ShopRole.VariantNote));
|
|
5511
5530
|
const noteWords = variantGroupNote(soldOut, kind, this.lang);
|
|
5512
|
-
setText(wordsOf(note), noteWords);
|
|
5513
|
-
setAttr(note, SHOP_HIDDEN_ATTRIBUTE, noteWords ? null : '');
|
|
5514
|
-
const box = first(group, sel(ShopRole.VariantValues));
|
|
5531
|
+
setText(wordsOf$1(note), noteWords);
|
|
5532
|
+
setAttr$1(note, SHOP_HIDDEN_ATTRIBUTE, noteWords ? null : '');
|
|
5533
|
+
const box = first(group, sel$1(ShopRole.VariantValues));
|
|
5515
5534
|
if (!box)
|
|
5516
5535
|
return;
|
|
5517
|
-
const chip = Array.from(box.querySelectorAll(sel(ShopRole.VariantValue))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5518
|
-
const swatch = Array.from(box.querySelectorAll(sel(ShopRole.VariantSwatch))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5536
|
+
const chip = Array.from(box.querySelectorAll(sel$1(ShopRole.VariantValue))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5537
|
+
const swatch = Array.from(box.querySelectorAll(sel$1(ShopRole.VariantSwatch))).find(v => !v.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5519
5538
|
const used = kind === ShopPickerKind.Swatches ? swatch ?? chip : kind === ShopPickerKind.Chips ? chip ?? swatch : null;
|
|
5520
5539
|
for (const t of [chip, swatch]) {
|
|
5521
5540
|
if (!t)
|
|
5522
5541
|
continue;
|
|
5523
|
-
setAttr(t, SHOP_UNUSED_ATTRIBUTE, t === used ? null : '');
|
|
5542
|
+
setAttr$1(t, SHOP_UNUSED_ATTRIBUTE, t === used ? null : '');
|
|
5524
5543
|
if (t !== used)
|
|
5525
5544
|
stampCopies(t, 1, t === chip ? ShopRole.VariantValue : ShopRole.VariantSwatch);
|
|
5526
5545
|
}
|
|
@@ -5532,20 +5551,20 @@ class ShopRuntime {
|
|
|
5532
5551
|
const items = stampCopies(used, option.values.length, used === chip ? ShopRole.VariantValue : ShopRole.VariantSwatch);
|
|
5533
5552
|
items.forEach((item, i) => {
|
|
5534
5553
|
const value = values[i];
|
|
5535
|
-
setAttr(item, ITEM_KEY_ATTRIBUTE, value.value);
|
|
5536
|
-
setAttr(item, 'aria-disabled', value.available ? null : 'true');
|
|
5554
|
+
setAttr$1(item, ITEM_KEY_ATTRIBUTE, value.value);
|
|
5555
|
+
setAttr$1(item, 'aria-disabled', value.available ? null : 'true');
|
|
5537
5556
|
if (used === swatch) {
|
|
5538
5557
|
const fill = swatchFill(value.value, fills);
|
|
5539
5558
|
if (fill)
|
|
5540
5559
|
item.style.setProperty('--iox-swatch-fill', fill);
|
|
5541
5560
|
else
|
|
5542
5561
|
item.style.removeProperty('--iox-swatch-fill');
|
|
5543
|
-
setAttr(item, 'aria-label', value.available ? value.value : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5544
|
-
setAttr(item, 'title', value.value);
|
|
5562
|
+
setAttr$1(item, 'aria-label', value.available ? value.value : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5563
|
+
setAttr$1(item, 'title', value.value);
|
|
5545
5564
|
}
|
|
5546
5565
|
else {
|
|
5547
|
-
setText(wordsOf(item), value.value);
|
|
5548
|
-
setAttr(item, 'aria-label', value.available ? null : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5566
|
+
setText(wordsOf$1(item), value.value);
|
|
5567
|
+
setAttr$1(item, 'aria-label', value.available ? null : shopWord(ShopWord.ValueSoldOut, this.lang, { name: value.value }));
|
|
5549
5568
|
}
|
|
5550
5569
|
});
|
|
5551
5570
|
const rt = exclusiveRuntimeOf(box) ?? this.attachValues(box, state, option.name);
|
|
@@ -5594,29 +5613,29 @@ class ShopRuntime {
|
|
|
5594
5613
|
select.value = chosen;
|
|
5595
5614
|
}
|
|
5596
5615
|
stampQuantity(root, quantity, bounds) {
|
|
5597
|
-
setAttr(root, 'role', 'group');
|
|
5598
|
-
setAttr(root, 'aria-label', shopWord(ShopWord.Quantity, this.lang));
|
|
5599
|
-
const value = first(root, sel(ShopRole.QuantityValue));
|
|
5600
|
-
setText(wordsOf(value), String(quantity));
|
|
5601
|
-
setAttr(value, 'aria-live', 'polite');
|
|
5602
|
-
const down = first(root, sel(ShopRole.QuantityDown));
|
|
5603
|
-
const up = first(root, sel(ShopRole.QuantityUp));
|
|
5604
|
-
setAttr(down, 'aria-label', shopWord(ShopWord.Decrease, this.lang));
|
|
5605
|
-
setAttr(up, 'aria-label', shopWord(ShopWord.Increase, this.lang));
|
|
5606
|
-
setAttr(down, 'aria-disabled', canStep(quantity, QuantityStep.Down, bounds) ? null : 'true');
|
|
5607
|
-
setAttr(up, 'aria-disabled', canStep(quantity, QuantityStep.Up, bounds) ? null : 'true');
|
|
5616
|
+
setAttr$1(root, 'role', 'group');
|
|
5617
|
+
setAttr$1(root, 'aria-label', shopWord(ShopWord.Quantity, this.lang));
|
|
5618
|
+
const value = first(root, sel$1(ShopRole.QuantityValue));
|
|
5619
|
+
setText(wordsOf$1(value), String(quantity));
|
|
5620
|
+
setAttr$1(value, 'aria-live', 'polite');
|
|
5621
|
+
const down = first(root, sel$1(ShopRole.QuantityDown));
|
|
5622
|
+
const up = first(root, sel$1(ShopRole.QuantityUp));
|
|
5623
|
+
setAttr$1(down, 'aria-label', shopWord(ShopWord.Decrease, this.lang));
|
|
5624
|
+
setAttr$1(up, 'aria-label', shopWord(ShopWord.Increase, this.lang));
|
|
5625
|
+
setAttr$1(down, 'aria-disabled', canStep(quantity, QuantityStep.Down, bounds) ? null : 'true');
|
|
5626
|
+
setAttr$1(up, 'aria-disabled', canStep(quantity, QuantityStep.Up, bounds) ? null : 'true');
|
|
5608
5627
|
}
|
|
5609
5628
|
stampCart() {
|
|
5610
5629
|
const view = this.cart;
|
|
5611
5630
|
const lang = this.lang;
|
|
5612
|
-
for (const button of own(this.scope, sel(ShopRole.CartButton))) {
|
|
5613
|
-
setAttr(button, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5614
|
-
setAttr(button, 'aria-label', view.empty ? shopWord(ShopWord.Cart, lang) : shopWord(ShopWord.CartCount, lang, { n: view.count }));
|
|
5615
|
-
setAttr(button, 'aria-haspopup', 'dialog');
|
|
5631
|
+
for (const button of own(this.scope, sel$1(ShopRole.CartButton))) {
|
|
5632
|
+
setAttr$1(button, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5633
|
+
setAttr$1(button, 'aria-label', view.empty ? shopWord(ShopWord.Cart, lang) : shopWord(ShopWord.CartCount, lang, { n: view.count }));
|
|
5634
|
+
setAttr$1(button, 'aria-haspopup', 'dialog');
|
|
5616
5635
|
}
|
|
5617
|
-
for (const drawer of own(this.scope, sel(ShopRole.CartDrawer))) {
|
|
5618
|
-
setAttr(drawer, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5619
|
-
const title = wordsOf(first(drawer, sel(ShopRole.CartTitle)));
|
|
5636
|
+
for (const drawer of own(this.scope, sel$1(ShopRole.CartDrawer))) {
|
|
5637
|
+
setAttr$1(drawer, CART_EMPTY_ATTRIBUTE, view.empty ? '' : null);
|
|
5638
|
+
const title = wordsOf$1(first(drawer, sel$1(ShopRole.CartTitle)));
|
|
5620
5639
|
if (title) {
|
|
5621
5640
|
let count = title.querySelector(`[${CART_TITLE_COUNT_ATTRIBUTE}]`);
|
|
5622
5641
|
if (!count) {
|
|
@@ -5626,42 +5645,42 @@ class ShopRuntime {
|
|
|
5626
5645
|
}
|
|
5627
5646
|
setText(count, view.empty ? '' : ` (${view.count})`);
|
|
5628
5647
|
}
|
|
5629
|
-
const template = Array.from(drawer.querySelectorAll(sel(ShopRole.CartLine))).find(l => !l.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5648
|
+
const template = Array.from(drawer.querySelectorAll(sel$1(ShopRole.CartLine))).find(l => !l.hasAttribute(SHOP_CLONE_ATTRIBUTE));
|
|
5630
5649
|
if (template) {
|
|
5631
5650
|
const lines = stampCopies(template, Math.max(1, view.lines.length), ShopRole.CartLine);
|
|
5632
|
-
setAttr(template, SHOP_HIDDEN_ATTRIBUTE, view.lines.length ? null : '');
|
|
5651
|
+
setAttr$1(template, SHOP_HIDDEN_ATTRIBUTE, view.lines.length ? null : '');
|
|
5633
5652
|
view.lines.forEach((line, i) => this.stampLine(lines[i], line));
|
|
5634
5653
|
}
|
|
5635
|
-
const issues = first(drawer, sel(ShopRole.CartIssues));
|
|
5654
|
+
const issues = first(drawer, sel$1(ShopRole.CartIssues));
|
|
5636
5655
|
const words = cartIssueWords(view, lang).join(' ');
|
|
5637
|
-
setText(wordsOf(issues), words);
|
|
5638
|
-
setAttr(issues, 'role', words ? 'alert' : null);
|
|
5639
|
-
setAttr(issues, SHOP_HIDDEN_ATTRIBUTE, words ? null : '');
|
|
5640
|
-
const note = first(drawer, sel(ShopRole.CartShippingNote));
|
|
5656
|
+
setText(wordsOf$1(issues), words);
|
|
5657
|
+
setAttr$1(issues, 'role', words ? 'alert' : null);
|
|
5658
|
+
setAttr$1(issues, SHOP_HIDDEN_ATTRIBUTE, words ? null : '');
|
|
5659
|
+
const note = first(drawer, sel$1(ShopRole.CartShippingNote));
|
|
5641
5660
|
const gap = view.freeShippingRemaining && view.freeShippingRemaining.amount > 0 ? formatMoney(view.freeShippingRemaining, lang) : '';
|
|
5642
|
-
setText(wordsOf(note), gap ? shopWord(ShopWord.FreeShippingGap, lang, { amount: gap }) : '');
|
|
5643
|
-
setAttr(note, SHOP_HIDDEN_ATTRIBUTE, gap ? null : '');
|
|
5661
|
+
setText(wordsOf$1(note), gap ? shopWord(ShopWord.FreeShippingGap, lang, { amount: gap }) : '');
|
|
5662
|
+
setAttr$1(note, SHOP_HIDDEN_ATTRIBUTE, gap ? null : '');
|
|
5644
5663
|
}
|
|
5645
5664
|
}
|
|
5646
5665
|
stampLine(el, line) {
|
|
5647
5666
|
const lang = this.lang;
|
|
5648
|
-
setAttr(el, CART_LINE_ATTRIBUTE, line.lineId);
|
|
5649
|
-
const image = first(el, sel(ShopRole.CartLineImage));
|
|
5667
|
+
setAttr$1(el, CART_LINE_ATTRIBUTE, line.lineId);
|
|
5668
|
+
const image = first(el, sel$1(ShopRole.CartLineImage));
|
|
5650
5669
|
const img = image?.tagName === 'IMG' ? image : image?.querySelector('img');
|
|
5651
5670
|
if (img) {
|
|
5652
5671
|
if (line.image && img.getAttribute('src') !== line.image)
|
|
5653
5672
|
img.setAttribute('src', line.image);
|
|
5654
|
-
setAttr(img, 'alt', '');
|
|
5673
|
+
setAttr$1(img, 'alt', '');
|
|
5655
5674
|
}
|
|
5656
|
-
setText(wordsOf(first(el, sel(ShopRole.CartLineTitle))), line.title);
|
|
5657
|
-
const variant = first(el, sel(ShopRole.CartLineVariant));
|
|
5658
|
-
setText(wordsOf(variant), line.variantName ?? '');
|
|
5659
|
-
setAttr(variant, SHOP_HIDDEN_ATTRIBUTE, line.variantName ? null : '');
|
|
5660
|
-
setText(wordsOf(first(el, sel(ShopRole.CartLineTotal))), formatMoney(line.lineTotal, lang));
|
|
5661
|
-
const quantity = first(el, sel(ShopRole.Quantity));
|
|
5675
|
+
setText(wordsOf$1(first(el, sel$1(ShopRole.CartLineTitle))), line.title);
|
|
5676
|
+
const variant = first(el, sel$1(ShopRole.CartLineVariant));
|
|
5677
|
+
setText(wordsOf$1(variant), line.variantName ?? '');
|
|
5678
|
+
setAttr$1(variant, SHOP_HIDDEN_ATTRIBUTE, line.variantName ? null : '');
|
|
5679
|
+
setText(wordsOf$1(first(el, sel$1(ShopRole.CartLineTotal))), formatMoney(line.lineTotal, lang));
|
|
5680
|
+
const quantity = first(el, sel$1(ShopRole.Quantity));
|
|
5662
5681
|
if (quantity)
|
|
5663
5682
|
this.stampQuantity(quantity, line.quantity, { min: 1, max: line.maxQuantity });
|
|
5664
|
-
setAttr(first(el, sel(ShopRole.CartLineRemove)), 'aria-label', shopWord(ShopWord.Remove, lang, { name: line.title }));
|
|
5683
|
+
setAttr$1(first(el, sel$1(ShopRole.CartLineRemove)), 'aria-label', shopWord(ShopWord.Remove, lang, { name: line.title }));
|
|
5665
5684
|
}
|
|
5666
5685
|
markAdded(button) {
|
|
5667
5686
|
const previous = this.addedTimers.get(button);
|
|
@@ -5722,12 +5741,12 @@ class ShopRuntime {
|
|
|
5722
5741
|
}
|
|
5723
5742
|
/** Attach the shop runtime to a page scope, unless one runs there already. */
|
|
5724
5743
|
function attachShop(scope, host) {
|
|
5725
|
-
return SCOPES.get(scope) ?? new ShopRuntime(scope, host);
|
|
5744
|
+
return SCOPES$1.get(scope) ?? new ShopRuntime(scope, host);
|
|
5726
5745
|
}
|
|
5727
5746
|
/** The shop runtime an element sits under, or null. */
|
|
5728
5747
|
function shopRuntimeOf(el) {
|
|
5729
5748
|
for (let cur = el; cur; cur = cur.parentElement) {
|
|
5730
|
-
const rt = SCOPES.get(cur);
|
|
5749
|
+
const rt = SCOPES$1.get(cur);
|
|
5731
5750
|
if (rt)
|
|
5732
5751
|
return rt;
|
|
5733
5752
|
}
|
|
@@ -5751,6 +5770,679 @@ async function runShopAction(el, type) {
|
|
|
5751
5770
|
return false;
|
|
5752
5771
|
}
|
|
5753
5772
|
|
|
5773
|
+
/**
|
|
5774
|
+
* THE ACCOUNT PARTS (commerce E3a, C-D5/C-D6 — commerce board 12). Recipes of ordinary builder nodes with roles, like the
|
|
5775
|
+
* shop parts, run by ONE DOM runtime (`account-runtime.ts`) over the host's `SiteAuthTransport` — the same on the builder
|
|
5776
|
+
* canvas (simulated) and the live site. Buying never needs an account (C-D4): every part is optional.
|
|
5777
|
+
*
|
|
5778
|
+
* Account entry Container account › ButtonBlock account.entry (`account-button`)
|
|
5779
|
+
* › Icon · Text account.sign-in-label "Sign in"
|
|
5780
|
+
* · Container account.avatar (`account-avatar`) › Text $customer.initial · Text account.name $customer.name
|
|
5781
|
+
* · Popover account.menu › Text account.menu-greeting · ButtonBlock account.orders (a link to the
|
|
5782
|
+
* account page) · ButtonBlock account.sign-out (signOut)
|
|
5783
|
+
* Sign-in dialog Dialog account.sign-in › head (Heading account.title · Close) · Text account.why
|
|
5784
|
+
* · ButtonBlock account.google "Continue with Google" · Text account.provider-error · Text account.or
|
|
5785
|
+
* · Container account.email-step › Field account.email · ButtonBlock account.send-code
|
|
5786
|
+
* · Container account.code-step › Text account.code-sent · Field account.code · ButtonBlock account.verify
|
|
5787
|
+
* · row (Text account.code-valid · Send again · Use another email)
|
|
5788
|
+
* · Text account.dialog-error
|
|
5789
|
+
*
|
|
5790
|
+
* Words are the recipe's in English (board 12); the runtime writes the visitor's language over the ones it owns
|
|
5791
|
+
* (the code-sent line, refusals) and a studio edits the rest like any Text.
|
|
5792
|
+
*/
|
|
5793
|
+
var AccountRole;
|
|
5794
|
+
(function (AccountRole) {
|
|
5795
|
+
AccountRole["Account"] = "account";
|
|
5796
|
+
AccountRole["Entry"] = "account.entry";
|
|
5797
|
+
AccountRole["SignInLabel"] = "account.sign-in-label";
|
|
5798
|
+
AccountRole["Avatar"] = "account.avatar";
|
|
5799
|
+
AccountRole["Initial"] = "account.initial";
|
|
5800
|
+
AccountRole["Name"] = "account.name";
|
|
5801
|
+
AccountRole["Menu"] = "account.menu";
|
|
5802
|
+
AccountRole["MenuGreeting"] = "account.menu-greeting";
|
|
5803
|
+
AccountRole["Orders"] = "account.orders";
|
|
5804
|
+
AccountRole["SignOut"] = "account.sign-out";
|
|
5805
|
+
AccountRole["SignIn"] = "account.sign-in";
|
|
5806
|
+
AccountRole["Title"] = "account.title";
|
|
5807
|
+
AccountRole["Close"] = "account.close";
|
|
5808
|
+
AccountRole["Why"] = "account.why";
|
|
5809
|
+
AccountRole["Google"] = "account.google";
|
|
5810
|
+
AccountRole["ProviderError"] = "account.provider-error";
|
|
5811
|
+
AccountRole["Or"] = "account.or";
|
|
5812
|
+
AccountRole["EmailStep"] = "account.email-step";
|
|
5813
|
+
AccountRole["Email"] = "account.email";
|
|
5814
|
+
AccountRole["SendCode"] = "account.send-code";
|
|
5815
|
+
AccountRole["CodeStep"] = "account.code-step";
|
|
5816
|
+
AccountRole["CodeSent"] = "account.code-sent";
|
|
5817
|
+
AccountRole["Code"] = "account.code";
|
|
5818
|
+
AccountRole["Verify"] = "account.verify";
|
|
5819
|
+
AccountRole["CodeValid"] = "account.code-valid";
|
|
5820
|
+
AccountRole["SendAgain"] = "account.send-again";
|
|
5821
|
+
AccountRole["OtherEmail"] = "account.other-email";
|
|
5822
|
+
AccountRole["DialogError"] = "account.dialog-error";
|
|
5823
|
+
})(AccountRole || (AccountRole = {}));
|
|
5824
|
+
const ACCOUNT_ROLES = new Set(Object.values(AccountRole));
|
|
5825
|
+
function isAccountRole(role) {
|
|
5826
|
+
return !!role && ACCOUNT_ROLES.has(role);
|
|
5827
|
+
}
|
|
5828
|
+
/** The CSS selector of an account role (`.iox-role-account-entry`). */
|
|
5829
|
+
function accountSelector(role) {
|
|
5830
|
+
return `.${roleClass$1(role)}`;
|
|
5831
|
+
}
|
|
5832
|
+
/** On the account root and the dialog: the buyer is signed in (the shared CSS swaps "Sign in" for the initial). */
|
|
5833
|
+
const SIGNED_IN_ATTRIBUTE = 'data-iox-signed-in';
|
|
5834
|
+
/** On the sign-in dialog: `email` (asking for an email) or `code` (asking for the code just sent). */
|
|
5835
|
+
const SIGN_IN_STEP_ATTRIBUTE = 'data-iox-sign-in-step';
|
|
5836
|
+
/** On a part the runtime has no words for right now (an empty error line). */
|
|
5837
|
+
const ACCOUNT_HIDDEN_ATTRIBUTE = 'data-iox-account-hidden';
|
|
5838
|
+
/** The polite live region the account speaks in ("You are signed in."). */
|
|
5839
|
+
const ACCOUNT_LIVE_CLASS = 'iox-account-live';
|
|
5840
|
+
var SignInStep;
|
|
5841
|
+
(function (SignInStep) {
|
|
5842
|
+
SignInStep["Email"] = "email";
|
|
5843
|
+
SignInStep["Code"] = "code";
|
|
5844
|
+
})(SignInStep || (SignInStep = {}));
|
|
5845
|
+
/** The Field names the dialog's two inputs submit under. */
|
|
5846
|
+
var SignInFieldName;
|
|
5847
|
+
(function (SignInFieldName) {
|
|
5848
|
+
SignInFieldName["Email"] = "email";
|
|
5849
|
+
SignInFieldName["Code"] = "code";
|
|
5850
|
+
})(SignInFieldName || (SignInFieldName = {}));
|
|
5851
|
+
/** The words a fresh recipe shows in `lang` (board 12's sample) — the studio edits them like any Text; the composer
|
|
5852
|
+
* stamps them in the site's language. */
|
|
5853
|
+
function accountRecipeWords(lang = 'en') {
|
|
5854
|
+
const w = (word, fill = {}) => signInWord(word, lang, fill);
|
|
5855
|
+
const name = signInLanguage(lang) === SignInLanguage.He ? 'נועה' : 'Noa';
|
|
5856
|
+
return Object.freeze({
|
|
5857
|
+
signIn: w(SignInWord.SignIn),
|
|
5858
|
+
initial: Array.from(name)[0],
|
|
5859
|
+
name,
|
|
5860
|
+
greeting: w(SignInWord.Hello, { name }),
|
|
5861
|
+
orders: w(SignInWord.YourOrders),
|
|
5862
|
+
signOut: w(SignInWord.SignOut),
|
|
5863
|
+
title: w(SignInWord.SignIn),
|
|
5864
|
+
close: w(SignInWord.Close),
|
|
5865
|
+
why: w(SignInWord.Why),
|
|
5866
|
+
google: w(SignInWord.ContinueWithGoogle),
|
|
5867
|
+
or: w(SignInWord.Or),
|
|
5868
|
+
email: w(SignInWord.Email),
|
|
5869
|
+
emailPlaceholder: w(SignInWord.EmailPlaceholder),
|
|
5870
|
+
sendCode: w(SignInWord.SendCode),
|
|
5871
|
+
codeSent: w(SignInWord.CodeSent, { email: 'noa.levi@example.com' }),
|
|
5872
|
+
code: w(SignInWord.Code),
|
|
5873
|
+
verify: w(SignInWord.Verify),
|
|
5874
|
+
codeValid: w(SignInWord.CodeValid, { minutes: EMAIL_CODE_TTL_MINUTES }),
|
|
5875
|
+
sendAgain: w(SignInWord.SendAgain),
|
|
5876
|
+
otherEmail: w(SignInWord.OtherEmail),
|
|
5877
|
+
});
|
|
5878
|
+
}
|
|
5879
|
+
/** The English sample (the palette's — the canvas has no page language yet). */
|
|
5880
|
+
const ACCOUNT_RECIPE_WORDS = accountRecipeWords('en');
|
|
5881
|
+
const ACCOUNT_LABELS = Object.freeze({ account: 'Account entry', menu: 'Account menu', signIn: 'Sign-in dialog' });
|
|
5882
|
+
var Style;
|
|
5883
|
+
(function (Style) {
|
|
5884
|
+
Style["AccountButton"] = "account-button";
|
|
5885
|
+
Style["Avatar"] = "account-avatar";
|
|
5886
|
+
Style["Label"] = "button-label";
|
|
5887
|
+
Style["Primary"] = "button-primary";
|
|
5888
|
+
Style["Secondary"] = "button-secondary";
|
|
5889
|
+
Style["Ghost"] = "button-ghost";
|
|
5890
|
+
Style["Small"] = "small";
|
|
5891
|
+
Style["Body"] = "body";
|
|
5892
|
+
Style["Error"] = "sign-in-error";
|
|
5893
|
+
Style["Dialog"] = "dialog";
|
|
5894
|
+
Style["Popover"] = "popover";
|
|
5895
|
+
Style["Title"] = "h3";
|
|
5896
|
+
Style["Field"] = "field";
|
|
5897
|
+
})(Style || (Style = {}));
|
|
5898
|
+
const PILL = { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' };
|
|
5899
|
+
const FULL = { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: '100%', height: 'auto' };
|
|
5900
|
+
const TEXT_BUTTON = { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' };
|
|
5901
|
+
/** "Sign in" and the initial share ONE grid cell, so the entry never jumps as the buyer signs in (Emil: in place). */
|
|
5902
|
+
const STACKED = { gridColumn: '1', gridRow: '1' };
|
|
5903
|
+
function words(create, key, role, style, text, label, base = WORDS, tag = 'p') {
|
|
5904
|
+
return recipeText(create, key, role, style, text, label, base, tag);
|
|
5905
|
+
}
|
|
5906
|
+
function labelled(create, key, role, style, text, label, base, labelStyle = Style.Label) {
|
|
5907
|
+
const root = recipeButton(create, key, role, style, label, '', base);
|
|
5908
|
+
root.children = [words(create, `${key}-label`, null, labelStyle, text, 'Text', WORDS, 'span')];
|
|
5909
|
+
return root;
|
|
5910
|
+
}
|
|
5911
|
+
function field(create, key, role, name, control, label, placeholder) {
|
|
5912
|
+
return recipePart(create, key, 'Field', role, Style.Field, { control, label, name, placeholder, required: true }, label, { width: '100%', minHeight: 'auto', margin: ZERO });
|
|
5913
|
+
}
|
|
5914
|
+
/** The menu a signed-in buyer opens from the account button: hello, their orders, sign out. */
|
|
5915
|
+
function buildAccountMenuRecipe(create, lang = 'en') {
|
|
5916
|
+
const t = accountRecipeWords(lang);
|
|
5917
|
+
const menu = recipePart(create, 'account-menu', 'Popover', AccountRole.Menu, Style.Popover, {}, ACCOUNT_LABELS.menu, { display: 'flex', flexDirection: 'column', alignItems: 'stretch', width: '220px', height: 'auto', minHeight: 'auto', gap: '4px' });
|
|
5918
|
+
writeProp(menu, 'placement', 'below');
|
|
5919
|
+
writeProp(menu, 'ariaLabel', t.title);
|
|
5920
|
+
const greeting = words(create, 'account-menu-greeting', AccountRole.MenuGreeting, Style.Body, t.greeting, 'Greeting', { ...WORDS, margin: '0px 0px 6px 0px', fontWeight: '600' });
|
|
5921
|
+
const orders = recipePart(create, 'account-orders', 'ButtonBlock', AccountRole.Orders, Style.Ghost, { tag: 'a', linkType: 'external', href: '/account', target: '_self' }, 'Your orders', { ...TEXT_BUTTON, justifyContent: 'flex-start', width: '100%' });
|
|
5922
|
+
orders.children = [words(create, 'account-orders-label', null, Style.Label, t.orders, 'Text', WORDS, 'span')];
|
|
5923
|
+
const signOut = labelled(create, 'account-sign-out', AccountRole.SignOut, Style.Ghost, t.signOut, 'Sign out', { ...TEXT_BUTTON, justifyContent: 'flex-start', width: '100%' });
|
|
5924
|
+
onClick(signOut, 'signOut');
|
|
5925
|
+
menu.children = [greeting, orders, signOut];
|
|
5926
|
+
return menu;
|
|
5927
|
+
}
|
|
5928
|
+
/**
|
|
5929
|
+
* The header's account entry: "Sign in" while signed out, the buyer's initial and name once signed in ($customer). A
|
|
5930
|
+
* press opens the page's sign-in dialog, or — signed in — the menu beside it. The menu is part of the entry.
|
|
5931
|
+
*/
|
|
5932
|
+
function buildAccountEntryRecipe(create, lang = 'en') {
|
|
5933
|
+
const t = accountRecipeWords(lang);
|
|
5934
|
+
const root = recipePart(create, 'account', 'Container', AccountRole.Account, null, {}, ACCOUNT_LABELS.account, { ...ROW, gap: '0px' });
|
|
5935
|
+
const entry = recipeButton(create, 'account-entry', AccountRole.Entry, Style.AccountButton, 'Account button', t.signIn, { ...PILL, display: 'inline-grid', gridTemplateColumns: 'auto', alignItems: 'center', justifyItems: 'center' });
|
|
5936
|
+
const signedOut = recipePart(create, 'account-signed-out', 'Container', null, null, {}, 'Signed out', { ...ROW, ...STACKED, gap: '6px' });
|
|
5937
|
+
signedOut.children = [
|
|
5938
|
+
recipeIcon(create, 'account-icon', 'ph ph-user-circle', '18px'),
|
|
5939
|
+
words(create, 'account-sign-in-label', AccountRole.SignInLabel, Style.Label, t.signIn, 'Sign in', WORDS, 'span'),
|
|
5940
|
+
];
|
|
5941
|
+
const signedIn = recipePart(create, 'account-signed-in', 'Container', null, null, {}, 'Signed in', { ...ROW, ...STACKED, gap: '8px' });
|
|
5942
|
+
const avatar = recipePart(create, 'account-avatar', 'Container', AccountRole.Avatar, Style.Avatar, {}, 'Initial', { ...PILL, minHeight: 'var(--iox-account-avatar-size)', padding: ZERO });
|
|
5943
|
+
const initial = words(create, 'account-initial', AccountRole.Initial, Style.Label, t.initial, 'Initial', { ...WORDS, lineHeight: '1' }, 'span');
|
|
5944
|
+
bindSlot(initial, 'content', CUSTOMER_SLOT, 'initial');
|
|
5945
|
+
avatar.children = [initial];
|
|
5946
|
+
const name = words(create, 'account-name', AccountRole.Name, Style.Label, t.name, 'Name', WORDS, 'span');
|
|
5947
|
+
bindSlot(name, 'content', CUSTOMER_SLOT, 'name');
|
|
5948
|
+
signedIn.children = [avatar, name];
|
|
5949
|
+
entry.children = [signedOut, signedIn];
|
|
5950
|
+
root.children = [entry, buildAccountMenuRecipe(create, lang)];
|
|
5951
|
+
return root;
|
|
5952
|
+
}
|
|
5953
|
+
/** The sign-in dialog (board 12): Google, or an email and the six-digit code sent to it. Never a password. */
|
|
5954
|
+
function buildSignInDialogRecipe(create, lang = 'en') {
|
|
5955
|
+
const t = accountRecipeWords(lang);
|
|
5956
|
+
const dialog = recipePart(create, 'sign-in', 'Dialog', AccountRole.SignIn, Style.Dialog, {}, ACCOUNT_LABELS.signIn, { width: '400px', maxWidth: '100%', display: 'flex', flexDirection: 'column', gap: '14px' });
|
|
5957
|
+
writeProp(dialog, 'placement', 'center');
|
|
5958
|
+
writeProp(dialog, 'closeOnBackdrop', true);
|
|
5959
|
+
writeProp(dialog, 'showCloseButton', false);
|
|
5960
|
+
writeProp(dialog, 'ariaLabel', t.title);
|
|
5961
|
+
const head = recipePart(create, 'sign-in-head', 'Container', null, null, {}, 'Head', { ...ROW, width: '100%', justifyContent: 'space-between', gap: '12px' });
|
|
5962
|
+
const title = recipePart(create, 'sign-in-title', 'Heading', AccountRole.Title, Style.Title, { content: t.title, level: 'h2' }, 'Title', WORDS);
|
|
5963
|
+
const close = labelled(create, 'sign-in-close', AccountRole.Close, Style.Ghost, t.close, 'Close', TEXT_BUTTON, Style.Small);
|
|
5964
|
+
onClick(close, 'closeDialog', dialog.id ?? '');
|
|
5965
|
+
head.children = [title, close];
|
|
5966
|
+
const why = words(create, 'sign-in-why', AccountRole.Why, Style.Small, t.why, 'Why sign in');
|
|
5967
|
+
const google = recipeButton(create, 'sign-in-google', AccountRole.Google, Style.Secondary, 'Continue with Google', '', { ...FULL, gap: '8px' });
|
|
5968
|
+
google.children = [
|
|
5969
|
+
recipeIcon(create, 'sign-in-google-icon', 'ph ph-google-logo', '18px'),
|
|
5970
|
+
words(create, 'sign-in-google-label', null, Style.Label, t.google, 'Text', WORDS, 'span'),
|
|
5971
|
+
];
|
|
5972
|
+
const providerError = words(create, 'sign-in-provider-error', AccountRole.ProviderError, Style.Error, '', 'Google error');
|
|
5973
|
+
const or = words(create, 'sign-in-or', AccountRole.Or, Style.Small, t.or, 'Or', { ...WORDS, width: '100%', textAlign: 'center' });
|
|
5974
|
+
const emailStep = recipePart(create, 'sign-in-email-step', 'Container', AccountRole.EmailStep, null, {}, 'Email step', { ...COLUMN, gap: '10px' });
|
|
5975
|
+
const sendCode = labelled(create, 'sign-in-send-code', AccountRole.SendCode, Style.Primary, t.sendCode, 'Send me a code', FULL);
|
|
5976
|
+
emailStep.children = [
|
|
5977
|
+
field(create, 'sign-in-email', AccountRole.Email, SignInFieldName.Email, 'email', t.email, t.emailPlaceholder),
|
|
5978
|
+
sendCode,
|
|
5979
|
+
];
|
|
5980
|
+
const codeStep = recipePart(create, 'sign-in-code-step', 'Container', AccountRole.CodeStep, null, {}, 'Code step', { ...COLUMN, gap: '10px' });
|
|
5981
|
+
const sent = words(create, 'sign-in-code-sent', AccountRole.CodeSent, Style.Small, t.codeSent, 'Code sent to');
|
|
5982
|
+
const verify = labelled(create, 'sign-in-verify', AccountRole.Verify, Style.Primary, t.verify, 'Sign in', FULL);
|
|
5983
|
+
const again = recipePart(create, 'sign-in-again', 'Container', null, null, {}, 'Send again', { ...ROW, flexWrap: 'wrap', gap: '4px 12px' });
|
|
5984
|
+
again.children = [
|
|
5985
|
+
words(create, 'sign-in-code-valid', AccountRole.CodeValid, Style.Small, t.codeValid, 'Valid for', WORDS, 'span'),
|
|
5986
|
+
labelled(create, 'sign-in-send-again', AccountRole.SendAgain, Style.Ghost, t.sendAgain, 'Send again', TEXT_BUTTON, Style.Small),
|
|
5987
|
+
labelled(create, 'sign-in-other-email', AccountRole.OtherEmail, Style.Ghost, t.otherEmail, 'Use another email', TEXT_BUTTON, Style.Small),
|
|
5988
|
+
];
|
|
5989
|
+
codeStep.children = [
|
|
5990
|
+
sent,
|
|
5991
|
+
field(create, 'sign-in-code', AccountRole.Code, SignInFieldName.Code, 'text', t.code, ''),
|
|
5992
|
+
verify,
|
|
5993
|
+
again,
|
|
5994
|
+
];
|
|
5995
|
+
const dialogError = words(create, 'sign-in-dialog-error', AccountRole.DialogError, Style.Error, '', 'Error');
|
|
5996
|
+
dialog.children = [head, why, google, providerError, or, emailStep, codeStep, dialogError];
|
|
5997
|
+
return dialog;
|
|
5998
|
+
}
|
|
5999
|
+
/** The account recipes, by name. */
|
|
6000
|
+
var AccountRecipe;
|
|
6001
|
+
(function (AccountRecipe) {
|
|
6002
|
+
AccountRecipe["Entry"] = "accountEntry";
|
|
6003
|
+
AccountRecipe["Menu"] = "accountMenu";
|
|
6004
|
+
AccountRecipe["SignInDialog"] = "signInDialog";
|
|
6005
|
+
})(AccountRecipe || (AccountRecipe = {}));
|
|
6006
|
+
const ACCOUNT_RECIPES = Object.freeze({
|
|
6007
|
+
[AccountRecipe.Entry]: buildAccountEntryRecipe,
|
|
6008
|
+
[AccountRecipe.Menu]: buildAccountMenuRecipe,
|
|
6009
|
+
[AccountRecipe.SignInDialog]: buildSignInDialogRecipe,
|
|
6010
|
+
});
|
|
6011
|
+
/** The recipe a site holds ONCE, as a global element after the page — every page's entry opens it. */
|
|
6012
|
+
const ACCOUNT_GLOBAL_RECIPES = new Set([AccountRecipe.SignInDialog]);
|
|
6013
|
+
|
|
6014
|
+
const sel = accountSelector;
|
|
6015
|
+
const SCOPES = new Map();
|
|
6016
|
+
function setAttr(el, name, value) {
|
|
6017
|
+
if (!el)
|
|
6018
|
+
return;
|
|
6019
|
+
if (value === null) {
|
|
6020
|
+
if (el.hasAttribute(name))
|
|
6021
|
+
el.removeAttribute(name);
|
|
6022
|
+
}
|
|
6023
|
+
else if (el.getAttribute(name) !== value)
|
|
6024
|
+
el.setAttribute(name, value);
|
|
6025
|
+
}
|
|
6026
|
+
/** The deepest element of a Text part that holds its words (a host may wrap them). */
|
|
6027
|
+
function wordsOf(el) {
|
|
6028
|
+
let cur = el;
|
|
6029
|
+
while (cur.children.length === 1)
|
|
6030
|
+
cur = cur.children[0];
|
|
6031
|
+
return cur;
|
|
6032
|
+
}
|
|
6033
|
+
function setWords(el, words) {
|
|
6034
|
+
if (!el)
|
|
6035
|
+
return;
|
|
6036
|
+
const target = wordsOf(el);
|
|
6037
|
+
if (target.textContent !== words)
|
|
6038
|
+
target.textContent = words;
|
|
6039
|
+
setAttr(el, ACCOUNT_HIDDEN_ATTRIBUTE, words ? null : '');
|
|
6040
|
+
}
|
|
6041
|
+
function controlOf(field) {
|
|
6042
|
+
return field?.querySelector('.iox-field__control, input') ?? null;
|
|
6043
|
+
}
|
|
6044
|
+
/** The Field element (`.iox-field`) of a field part — the part itself on the string path, inside it on the canvas. */
|
|
6045
|
+
function fieldElementOf(part) {
|
|
6046
|
+
if (!part)
|
|
6047
|
+
return null;
|
|
6048
|
+
return (part.matches('.iox-field') ? part : part.querySelector('.iox-field') ?? part);
|
|
6049
|
+
}
|
|
6050
|
+
class AccountRuntime {
|
|
6051
|
+
constructor(scope, host) {
|
|
6052
|
+
this.scope = scope;
|
|
6053
|
+
this.host = host;
|
|
6054
|
+
this.customer = null;
|
|
6055
|
+
this.step = SignInStep.Email;
|
|
6056
|
+
this.email = '';
|
|
6057
|
+
this.busy = false;
|
|
6058
|
+
this.destroyed = false;
|
|
6059
|
+
this.observer = null;
|
|
6060
|
+
this.syncing = false;
|
|
6061
|
+
this.syncQueued = false;
|
|
6062
|
+
this.lastPublished = '';
|
|
6063
|
+
// ── events ────────────────────────────────────────────────────────────────────────────────
|
|
6064
|
+
this.onClick = (event) => {
|
|
6065
|
+
const target = event.target;
|
|
6066
|
+
if (!target?.closest)
|
|
6067
|
+
return;
|
|
6068
|
+
const button = (role) => target.closest(sel(role));
|
|
6069
|
+
const entry = button(AccountRole.Entry);
|
|
6070
|
+
if (entry) {
|
|
6071
|
+
this.signIn(entry);
|
|
6072
|
+
return;
|
|
6073
|
+
}
|
|
6074
|
+
if (!target.closest(sel(AccountRole.SignIn)))
|
|
6075
|
+
return;
|
|
6076
|
+
if (button(AccountRole.Google)) {
|
|
6077
|
+
void this.startProvider(SignInProvider.Google, button(AccountRole.Google));
|
|
6078
|
+
return;
|
|
6079
|
+
}
|
|
6080
|
+
if (button(AccountRole.SendCode)) {
|
|
6081
|
+
void this.sendCode(button(AccountRole.SendCode));
|
|
6082
|
+
return;
|
|
6083
|
+
}
|
|
6084
|
+
if (button(AccountRole.SendAgain)) {
|
|
6085
|
+
void this.sendCode(button(AccountRole.SendAgain));
|
|
6086
|
+
return;
|
|
6087
|
+
}
|
|
6088
|
+
if (button(AccountRole.Verify)) {
|
|
6089
|
+
void this.verify(button(AccountRole.Verify));
|
|
6090
|
+
return;
|
|
6091
|
+
}
|
|
6092
|
+
if (button(AccountRole.OtherEmail))
|
|
6093
|
+
this.otherEmail();
|
|
6094
|
+
};
|
|
6095
|
+
/** Enter in a field presses its step's button — the dialog holds no `<form>` that could post. */
|
|
6096
|
+
this.onKeydown = (event) => {
|
|
6097
|
+
const key = event;
|
|
6098
|
+
if (key.key !== 'Enter' || key.isComposing)
|
|
6099
|
+
return;
|
|
6100
|
+
const target = key.target;
|
|
6101
|
+
if (!target?.closest)
|
|
6102
|
+
return;
|
|
6103
|
+
if (target.closest(sel(AccountRole.Email))) {
|
|
6104
|
+
key.preventDefault();
|
|
6105
|
+
void this.sendCode(this.part(AccountRole.SendCode));
|
|
6106
|
+
}
|
|
6107
|
+
else if (target.closest(sel(AccountRole.Code))) {
|
|
6108
|
+
key.preventDefault();
|
|
6109
|
+
void this.verify(this.part(AccountRole.Verify));
|
|
6110
|
+
}
|
|
6111
|
+
};
|
|
6112
|
+
SCOPES.set(scope, this);
|
|
6113
|
+
scope.addEventListener('click', this.onClick, true);
|
|
6114
|
+
scope.addEventListener('keydown', this.onKeydown, true);
|
|
6115
|
+
if (host.observe && typeof MutationObserver !== 'undefined') {
|
|
6116
|
+
this.observer = new MutationObserver(() => { if (!this.syncing)
|
|
6117
|
+
this.queueSync(); });
|
|
6118
|
+
this.observer.observe(scope, { childList: true, subtree: true });
|
|
6119
|
+
}
|
|
6120
|
+
this.sync();
|
|
6121
|
+
void this.host.transport.me().then(customer => {
|
|
6122
|
+
this.setCustomer(customer);
|
|
6123
|
+
const pending = this.host.pendingError?.();
|
|
6124
|
+
if (pending)
|
|
6125
|
+
this.openSignIn(pending);
|
|
6126
|
+
}, () => this.setCustomer(null));
|
|
6127
|
+
}
|
|
6128
|
+
get lang() {
|
|
6129
|
+
return this.host.locale?.() || 'en';
|
|
6130
|
+
}
|
|
6131
|
+
/** The signed-in buyer, or null. */
|
|
6132
|
+
get signedIn() {
|
|
6133
|
+
return this.customer;
|
|
6134
|
+
}
|
|
6135
|
+
get currentStep() {
|
|
6136
|
+
return this.step;
|
|
6137
|
+
}
|
|
6138
|
+
destroy() {
|
|
6139
|
+
this.destroyed = true;
|
|
6140
|
+
if (SCOPES.get(this.scope) === this)
|
|
6141
|
+
SCOPES.delete(this.scope);
|
|
6142
|
+
this.scope.removeEventListener('click', this.onClick, true);
|
|
6143
|
+
this.scope.removeEventListener('keydown', this.onKeydown, true);
|
|
6144
|
+
this.observer?.disconnect();
|
|
6145
|
+
this.observer = null;
|
|
6146
|
+
}
|
|
6147
|
+
// ── the actions ───────────────────────────────────────────────────────────────────────────
|
|
6148
|
+
/** Sign in: open the page's sign-in dialog — or, already signed in, the menu beside `from`. False when neither exists. */
|
|
6149
|
+
signIn(from) {
|
|
6150
|
+
if (this.customer)
|
|
6151
|
+
return this.openMenu(from ?? null);
|
|
6152
|
+
return this.openSignIn(null);
|
|
6153
|
+
}
|
|
6154
|
+
async signOut() {
|
|
6155
|
+
try {
|
|
6156
|
+
await this.host.transport.signOut();
|
|
6157
|
+
}
|
|
6158
|
+
catch {
|
|
6159
|
+
return false;
|
|
6160
|
+
}
|
|
6161
|
+
for (const menu of this.all(AccountRole.Menu))
|
|
6162
|
+
this.host.closeMenu?.(menu);
|
|
6163
|
+
this.setCustomer(null);
|
|
6164
|
+
this.announce(signInWord(SignInWord.SignedOut, this.lang));
|
|
6165
|
+
return true;
|
|
6166
|
+
}
|
|
6167
|
+
/** Open the sign-in dialog at the email step, saying `error` (a refusal code) when given. */
|
|
6168
|
+
openSignIn(error) {
|
|
6169
|
+
const dialog = this.dialog();
|
|
6170
|
+
if (!dialog)
|
|
6171
|
+
return false;
|
|
6172
|
+
this.toStep(SignInStep.Email);
|
|
6173
|
+
this.clearErrors();
|
|
6174
|
+
if (error)
|
|
6175
|
+
this.say(error);
|
|
6176
|
+
if (this.host.openDialog)
|
|
6177
|
+
this.host.openDialog(dialog);
|
|
6178
|
+
else if (dialog instanceof HTMLDialogElement && !dialog.open && typeof dialog.showModal === 'function')
|
|
6179
|
+
dialog.showModal();
|
|
6180
|
+
return true;
|
|
6181
|
+
}
|
|
6182
|
+
/** The transport answered who is signed in: publish `$customer`, mark the parts. */
|
|
6183
|
+
setCustomer(customer) {
|
|
6184
|
+
if (this.destroyed)
|
|
6185
|
+
return;
|
|
6186
|
+
const changed = (this.customer?.id ?? null) !== (customer?.id ?? null) || this.customer?.name !== customer?.name;
|
|
6187
|
+
this.customer = customer;
|
|
6188
|
+
this.sync();
|
|
6189
|
+
if (changed)
|
|
6190
|
+
this.host.onChange?.(customer);
|
|
6191
|
+
}
|
|
6192
|
+
// ── the dialog ────────────────────────────────────────────────────────────────────────────
|
|
6193
|
+
dialog() {
|
|
6194
|
+
return this.scope.querySelector(sel(AccountRole.SignIn));
|
|
6195
|
+
}
|
|
6196
|
+
part(role) {
|
|
6197
|
+
return this.dialog()?.querySelector(sel(role)) ?? null;
|
|
6198
|
+
}
|
|
6199
|
+
all(role) {
|
|
6200
|
+
return Array.from(this.scope.querySelectorAll(sel(role)));
|
|
6201
|
+
}
|
|
6202
|
+
toStep(step) {
|
|
6203
|
+
this.step = step;
|
|
6204
|
+
setAttr(this.dialog(), SIGN_IN_STEP_ATTRIBUTE, step);
|
|
6205
|
+
}
|
|
6206
|
+
clearErrors() {
|
|
6207
|
+
for (const role of [AccountRole.Email, AccountRole.Code]) {
|
|
6208
|
+
const field = fieldElementOf(this.part(role));
|
|
6209
|
+
if (field)
|
|
6210
|
+
writeFieldError(field, '');
|
|
6211
|
+
}
|
|
6212
|
+
setWords(this.part(AccountRole.ProviderError), '');
|
|
6213
|
+
setWords(this.part(AccountRole.DialogError), '');
|
|
6214
|
+
}
|
|
6215
|
+
/** Say a refusal on its slot, and move focus to the field it is about. */
|
|
6216
|
+
say(code) {
|
|
6217
|
+
const refusal = signInRefusal(code, this.lang);
|
|
6218
|
+
if (refusal.slot === SignInSlot.Email || refusal.slot === SignInSlot.Code) {
|
|
6219
|
+
const role = refusal.slot === SignInSlot.Email ? AccountRole.Email : AccountRole.Code;
|
|
6220
|
+
const field = fieldElementOf(this.part(role));
|
|
6221
|
+
if (field) {
|
|
6222
|
+
writeFieldError(field, refusal.words);
|
|
6223
|
+
controlOf(field)?.focus();
|
|
6224
|
+
return;
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
const line = refusal.slot === SignInSlot.Provider ? this.part(AccountRole.ProviderError) : this.part(AccountRole.DialogError);
|
|
6228
|
+
setWords(line, refusal.words);
|
|
6229
|
+
if (line)
|
|
6230
|
+
setAttr(line, 'role', 'alert');
|
|
6231
|
+
}
|
|
6232
|
+
async run(button, work) {
|
|
6233
|
+
if (this.busy)
|
|
6234
|
+
return;
|
|
6235
|
+
this.busy = true;
|
|
6236
|
+
const dialog = this.dialog();
|
|
6237
|
+
setAttr(dialog, 'aria-busy', 'true');
|
|
6238
|
+
setAttr(button, 'aria-busy', 'true');
|
|
6239
|
+
setAttr(button, 'aria-disabled', 'true');
|
|
6240
|
+
try {
|
|
6241
|
+
await work();
|
|
6242
|
+
}
|
|
6243
|
+
catch (error) {
|
|
6244
|
+
this.say(siteAuthErrorCode(error));
|
|
6245
|
+
}
|
|
6246
|
+
finally {
|
|
6247
|
+
this.busy = false;
|
|
6248
|
+
setAttr(dialog, 'aria-busy', null);
|
|
6249
|
+
setAttr(button, 'aria-busy', null);
|
|
6250
|
+
setAttr(button, 'aria-disabled', null);
|
|
6251
|
+
}
|
|
6252
|
+
}
|
|
6253
|
+
/** Continue with Google: the studio asks the broker for a ticket; the browser goes to its start address. */
|
|
6254
|
+
async startProvider(provider = SignInProvider.Google, button = null) {
|
|
6255
|
+
this.clearErrors();
|
|
6256
|
+
await this.run(button, async () => {
|
|
6257
|
+
const { startUrl } = await this.host.transport.startProvider(provider, this.host.returnPath?.() ?? '/');
|
|
6258
|
+
this.host.navigate?.(startUrl);
|
|
6259
|
+
});
|
|
6260
|
+
}
|
|
6261
|
+
/** Send a code to the typed email, then ask for it. */
|
|
6262
|
+
async sendCode(button = null) {
|
|
6263
|
+
const email = normalizeSignInEmail(controlOf(this.part(AccountRole.Email))?.value ?? this.email);
|
|
6264
|
+
this.clearErrors();
|
|
6265
|
+
if (!email) {
|
|
6266
|
+
this.say(SiteSignInRefusalCode.InvalidEmail);
|
|
6267
|
+
return;
|
|
6268
|
+
}
|
|
6269
|
+
await this.run(button, async () => {
|
|
6270
|
+
await this.host.transport.sendCode(email);
|
|
6271
|
+
this.email = email;
|
|
6272
|
+
this.toStep(SignInStep.Code);
|
|
6273
|
+
setWords(this.part(AccountRole.CodeSent), signInWord(SignInWord.CodeSent, this.lang, { email }));
|
|
6274
|
+
setWords(this.part(AccountRole.CodeValid), signInWord(SignInWord.CodeValid, this.lang, { minutes: EMAIL_CODE_TTL_MINUTES }));
|
|
6275
|
+
const code = controlOf(this.part(AccountRole.Code));
|
|
6276
|
+
if (code) {
|
|
6277
|
+
code.value = '';
|
|
6278
|
+
code.focus();
|
|
6279
|
+
}
|
|
6280
|
+
});
|
|
6281
|
+
}
|
|
6282
|
+
/** Check the code; signed in, the dialog closes and the page says so. */
|
|
6283
|
+
async verify(button = null) {
|
|
6284
|
+
const code = normalizeEmailCode(controlOf(this.part(AccountRole.Code))?.value ?? '');
|
|
6285
|
+
this.clearErrors();
|
|
6286
|
+
if (!isEmailCodeShape(code)) {
|
|
6287
|
+
this.say(SiteSignInRefusalCode.CodeWrong);
|
|
6288
|
+
return;
|
|
6289
|
+
}
|
|
6290
|
+
await this.run(button, async () => {
|
|
6291
|
+
const customer = await this.host.transport.verifyCode(this.email, code);
|
|
6292
|
+
this.setCustomer(customer);
|
|
6293
|
+
const dialog = this.dialog();
|
|
6294
|
+
if (dialog) {
|
|
6295
|
+
if (this.host.closeDialog)
|
|
6296
|
+
this.host.closeDialog(dialog);
|
|
6297
|
+
else if (dialog instanceof HTMLDialogElement && dialog.open)
|
|
6298
|
+
dialog.close();
|
|
6299
|
+
}
|
|
6300
|
+
this.toStep(SignInStep.Email);
|
|
6301
|
+
this.announce(signInWord(SignInWord.SignedIn, this.lang));
|
|
6302
|
+
});
|
|
6303
|
+
}
|
|
6304
|
+
/** Back to the email step, the typed email kept for editing. */
|
|
6305
|
+
otherEmail() {
|
|
6306
|
+
this.clearErrors();
|
|
6307
|
+
this.toStep(SignInStep.Email);
|
|
6308
|
+
const input = controlOf(this.part(AccountRole.Email));
|
|
6309
|
+
if (input) {
|
|
6310
|
+
input.value = this.email;
|
|
6311
|
+
input.focus();
|
|
6312
|
+
}
|
|
6313
|
+
}
|
|
6314
|
+
openMenu(from) {
|
|
6315
|
+
const root = from?.closest(sel(AccountRole.Account)) ?? this.scope.querySelector(sel(AccountRole.Account));
|
|
6316
|
+
const menu = root?.querySelector(sel(AccountRole.Menu));
|
|
6317
|
+
const opener = (from?.closest(sel(AccountRole.Entry)) ?? root?.querySelector(sel(AccountRole.Entry)));
|
|
6318
|
+
if (!menu || !opener)
|
|
6319
|
+
return false;
|
|
6320
|
+
this.host.openMenu?.(menu, opener);
|
|
6321
|
+
return true;
|
|
6322
|
+
}
|
|
6323
|
+
// ── the parts ─────────────────────────────────────────────────────────────────────────────
|
|
6324
|
+
queueSync() {
|
|
6325
|
+
if (this.syncQueued)
|
|
6326
|
+
return;
|
|
6327
|
+
this.syncQueued = true;
|
|
6328
|
+
const run = () => { this.syncQueued = false; this.sync(); };
|
|
6329
|
+
if (typeof queueMicrotask === 'function')
|
|
6330
|
+
queueMicrotask(run);
|
|
6331
|
+
else
|
|
6332
|
+
Promise.resolve().then(run);
|
|
6333
|
+
}
|
|
6334
|
+
/** Write the signed-in state into every part. Idempotent; the observer is deaf while it runs. */
|
|
6335
|
+
sync() {
|
|
6336
|
+
if (this.destroyed)
|
|
6337
|
+
return;
|
|
6338
|
+
this.syncing = true;
|
|
6339
|
+
try {
|
|
6340
|
+
const slot = customerSlotOf(this.customer);
|
|
6341
|
+
const json = JSON.stringify(slot);
|
|
6342
|
+
if (json !== this.lastPublished) {
|
|
6343
|
+
this.lastPublished = json;
|
|
6344
|
+
this.host.publish?.(CUSTOMER_SLOT, slot);
|
|
6345
|
+
}
|
|
6346
|
+
const signedIn = this.customer ? '' : null;
|
|
6347
|
+
const name = customerDisplayName(this.customer);
|
|
6348
|
+
for (const root of this.all(AccountRole.Account))
|
|
6349
|
+
setAttr(root, SIGNED_IN_ATTRIBUTE, signedIn);
|
|
6350
|
+
for (const entry of this.all(AccountRole.Entry)) {
|
|
6351
|
+
setAttr(entry, SIGNED_IN_ATTRIBUTE, signedIn);
|
|
6352
|
+
setAttr(entry, 'aria-haspopup', 'dialog');
|
|
6353
|
+
setAttr(entry, 'aria-label', this.customer
|
|
6354
|
+
? `${signInWord(SignInWord.Account, this.lang)} — ${name}`
|
|
6355
|
+
: signInWord(SignInWord.SignIn, this.lang));
|
|
6356
|
+
}
|
|
6357
|
+
for (const greeting of this.all(AccountRole.MenuGreeting))
|
|
6358
|
+
if (this.customer)
|
|
6359
|
+
setWords(greeting, signInWord(SignInWord.Hello, this.lang, { name }));
|
|
6360
|
+
const href = this.host.accountHref?.();
|
|
6361
|
+
if (href)
|
|
6362
|
+
for (const link of this.all(AccountRole.Orders)) {
|
|
6363
|
+
const a = link.matches('a') ? link : link.querySelector('a');
|
|
6364
|
+
setAttr(a, 'href', href);
|
|
6365
|
+
}
|
|
6366
|
+
const dialog = this.dialog();
|
|
6367
|
+
if (dialog) {
|
|
6368
|
+
setAttr(dialog, SIGN_IN_STEP_ATTRIBUTE, this.step);
|
|
6369
|
+
for (const role of [AccountRole.ProviderError, AccountRole.DialogError]) {
|
|
6370
|
+
const line = this.part(role);
|
|
6371
|
+
if (line && !wordsOf(line).textContent)
|
|
6372
|
+
setAttr(line, ACCOUNT_HIDDEN_ATTRIBUTE, '');
|
|
6373
|
+
}
|
|
6374
|
+
this.prepareInputs();
|
|
6375
|
+
}
|
|
6376
|
+
}
|
|
6377
|
+
finally {
|
|
6378
|
+
this.observer?.takeRecords();
|
|
6379
|
+
this.syncing = false;
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
/** What a browser and a phone keyboard need to know about the two inputs (autofill, the one-time code). */
|
|
6383
|
+
prepareInputs() {
|
|
6384
|
+
const email = controlOf(this.part(AccountRole.Email));
|
|
6385
|
+
if (email) {
|
|
6386
|
+
setAttr(email, 'type', 'email');
|
|
6387
|
+
setAttr(email, 'autocomplete', 'email');
|
|
6388
|
+
setAttr(email, 'inputmode', 'email');
|
|
6389
|
+
setAttr(email, 'spellcheck', 'false');
|
|
6390
|
+
}
|
|
6391
|
+
const code = controlOf(this.part(AccountRole.Code));
|
|
6392
|
+
if (code) {
|
|
6393
|
+
setAttr(code, 'autocomplete', 'one-time-code');
|
|
6394
|
+
setAttr(code, 'inputmode', 'numeric');
|
|
6395
|
+
setAttr(code, 'maxlength', '7');
|
|
6396
|
+
setAttr(code, 'dir', 'ltr');
|
|
6397
|
+
}
|
|
6398
|
+
}
|
|
6399
|
+
announce(words) {
|
|
6400
|
+
const doc = this.scope.ownerDocument;
|
|
6401
|
+
if (!doc)
|
|
6402
|
+
return;
|
|
6403
|
+
let live = this.scope.querySelector(`.${ACCOUNT_LIVE_CLASS}`);
|
|
6404
|
+
if (!live) {
|
|
6405
|
+
live = doc.createElement('div');
|
|
6406
|
+
live.className = ACCOUNT_LIVE_CLASS;
|
|
6407
|
+
live.setAttribute('role', 'status');
|
|
6408
|
+
live.setAttribute('aria-live', 'polite');
|
|
6409
|
+
this.scope.appendChild(live);
|
|
6410
|
+
}
|
|
6411
|
+
live.textContent = '';
|
|
6412
|
+
live.textContent = words;
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
/** Attach the account runtime to a page scope, unless one runs there already. */
|
|
6416
|
+
function attachAccount(scope, host) {
|
|
6417
|
+
return SCOPES.get(scope) ?? new AccountRuntime(scope, host);
|
|
6418
|
+
}
|
|
6419
|
+
/** The account runtime an element sits under, or null. */
|
|
6420
|
+
function accountRuntimeOf(el) {
|
|
6421
|
+
for (let cur = el; cur; cur = cur.parentElement) {
|
|
6422
|
+
const rt = SCOPES.get(cur);
|
|
6423
|
+
if (rt)
|
|
6424
|
+
return rt;
|
|
6425
|
+
}
|
|
6426
|
+
return null;
|
|
6427
|
+
}
|
|
6428
|
+
/** The account actions (actions-core `ACCOUNT_ACTION_TYPES`). */
|
|
6429
|
+
var AccountActionType;
|
|
6430
|
+
(function (AccountActionType) {
|
|
6431
|
+
AccountActionType["SignIn"] = "signIn";
|
|
6432
|
+
AccountActionType["SignOut"] = "signOut";
|
|
6433
|
+
})(AccountActionType || (AccountActionType = {}));
|
|
6434
|
+
/** Run an account action from the element that fired it (both interaction engines call this). False when none runs. */
|
|
6435
|
+
async function runAccountAction(el, type) {
|
|
6436
|
+
const rt = accountRuntimeOf(el);
|
|
6437
|
+
if (!rt)
|
|
6438
|
+
return false;
|
|
6439
|
+
if (type === AccountActionType.SignIn)
|
|
6440
|
+
return rt.signIn(el);
|
|
6441
|
+
if (type === AccountActionType.SignOut)
|
|
6442
|
+
return rt.signOut();
|
|
6443
|
+
return false;
|
|
6444
|
+
}
|
|
6445
|
+
|
|
5754
6446
|
/**
|
|
5755
6447
|
* @vectoriox/iox-ui/composite-core — composites built from the builder's own parts (composite-components
|
|
5756
6448
|
* plan §3a). FRAMEWORK-FREE: the builder, the SSR engine and iox-cms (generation-core's composer, the site
|
|
@@ -5766,5 +6458,5 @@ async function runShopAction(el, type) {
|
|
|
5766
6458
|
* Generated bundle index. Do not edit.
|
|
5767
6459
|
*/
|
|
5768
6460
|
|
|
5769
|
-
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_BINDS, SHOP_CHIP_MAX, SHOP_CLONE_ATTRIBUTE, SHOP_GLOBAL_RECIPES, 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, ShopBindTarget, 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, bindShopPart, 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 };
|
|
6461
|
+
export { ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, ACCORDION_DEFAULT_ONS, ACCORDION_ICONS, ACCORDION_ICON_GLYPH, ACCORDION_NEW_ITEM_WORDS, ACCORDION_WORDS, ACCOUNT_GLOBAL_RECIPES, ACCOUNT_HIDDEN_ATTRIBUTE, ACCOUNT_LABELS, ACCOUNT_LIVE_CLASS, ACCOUNT_RECIPES, ACCOUNT_RECIPE_WORDS, ACCOUNT_ROLES, ACTIVATE_ON_ATTRIBUTE, ADDED_HOLD_MS, AccordionClass, AccordionDefaultOn, AccordionEditRefusal, AccordionIcon, AccordionKeyAction, AccordionRole, AccordionRuntime, AccountActionType, AccountRecipe, AccountRole, AccountRuntime, 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_BINDS, SHOP_CHIP_MAX, SHOP_CLONE_ATTRIBUTE, SHOP_GLOBAL_RECIPES, SHOP_HIDDEN_ATTRIBUTE, SHOP_LABELS, SHOP_LIVE_CLASS, SHOP_RECIPES, SHOP_RECIPE_WORDS, SHOP_ROLES, SHOP_SELECT_CLASS, SHOP_UNUSED_ATTRIBUTE, SIGNED_IN_ATTRIBUTE, SIGN_IN_STEP_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, ShopBindTarget, ShopPickerKind, ShopRecipe, ShopRole, ShopRuntime, SignInFieldName, SignInStep, 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, accountRecipeWords, accountRuntimeOf, accountSelector, addAccordionItem, addSegmentedOption, addTabPair, applyCardLayout, attachAccordionAt, attachAccordions, attachAccount, attachCarouselA11y, attachCompositeAt, attachExclusiveAt, attachMarquees, attachShop, attachSliderBar, badgeStyleId, badgeToneOf, bindShopPart, buildAccordionItem, buildAccordionRecipe, buildAccountEntryRecipe, buildAccountMenuRecipe, buildAddToCartRecipe, buildBadge, buildBuyNowRecipe, buildCardRecipe, buildCarouselRecipe, buildCartButtonRecipe, buildCartDrawerRecipe, buildChip, buildCompositeIcon, buildCounterRecipe, buildDisclosureRecipe, buildLightboxRecipe, buildMarqueeRecipe, buildPriceRecipe, buildQuantityRecipe, buildReadingBarRecipe, buildSegmentedOption, buildSegmentedRecipe, buildSignInDialogRecipe, 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, isAccountRole, 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, runAccountAction, 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 };
|
|
5770
6462
|
//# sourceMappingURL=vectoriox-iox-ui-composite-core.mjs.map
|