@vectoriox/iox-ui 5.193.0 → 5.195.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 +1 -0
- package/commerce-core/index.d.ts +0 -1
- package/composite-core/index.d.ts +28 -11
- package/design-core/index.d.ts +44 -2
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +1 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +0 -2
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +65 -34
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +142 -60
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs +186 -122
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +244 -16
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +193 -95
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +209 -148
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/forms-core/index.d.ts +17 -2
- package/generation-core/index.d.ts +141 -4
- package/harness-core/index.d.ts +102 -12
- package/index.d.ts +15 -12
- package/package.json +1 -1
- package/src/actions-core/public-api.ts +3 -0
- package/src/commerce-core/shop-display.ts +0 -2
- package/src/composite-core/lightbox.ts +27 -8
- package/src/composite-core/shop.ts +45 -28
- package/src/design-core/close-word.ts +18 -0
- package/src/design-core/contrast-audit.ts +24 -14
- package/src/design-core/locale-direction.ts +17 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/token-css.ts +62 -3
- package/src/forms-core/messages.ts +72 -1
- package/src/forms-core/submit-lifecycle.ts +4 -5
- package/src/generation-core/audit-site.ts +26 -5
- package/src/generation-core/audit-words.ts +8 -0
- package/src/generation-core/compose-site.ts +3 -2
- package/src/generation-core/import-plan.ts +41 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/stock-photos.ts +23 -4
- package/src/generation-core/stock-search.ts +235 -0
- package/src/harness-core/business-types.ts +14 -9
- package/src/harness-core/harness-spec.generated.ts +168 -84
- package/src/harness-core/lint.ts +29 -11
package/index.d.ts
CHANGED
|
@@ -1255,12 +1255,13 @@ interface RegisteredField {
|
|
|
1255
1255
|
*
|
|
1256
1256
|
* Translation belongs to the consumer, not the library: the CMS client has ngx-translate, the SSR
|
|
1257
1257
|
* engine has the page's locale bundle. Providing this token is how each one plugs its own in. The
|
|
1258
|
-
* default below
|
|
1259
|
-
*
|
|
1258
|
+
* default below reads forms-core's ONE message catalog (`formMessage`) in the PAGE's language — the third argument,
|
|
1259
|
+
* `pageLanguageOf` the field — so a consumer that provides nothing (the engine, the builder's Preview) shows the site's
|
|
1260
|
+
* sentences, never raw keys and never English on a Hebrew page (iox-client-engine#15).
|
|
1260
1261
|
*/
|
|
1261
|
-
type FormMessageResolver = (key: string, params?: Record<string, any
|
|
1262
|
+
type FormMessageResolver = (key: string, params?: Record<string, any>, lang?: string | null) => string;
|
|
1262
1263
|
declare const IOX_FORM_MESSAGES: InjectionToken<FormMessageResolver>;
|
|
1263
|
-
/** `{{n}}` / `{{field}}`
|
|
1264
|
+
/** The catalog's sentence in the page's language, `{{n}}` / `{{field}}` placed — forms-core `formMessage`. */
|
|
1264
1265
|
declare const defaultMessageResolver: FormMessageResolver;
|
|
1265
1266
|
/**
|
|
1266
1267
|
* Per-form runtime. **Provided by `IoxFormComponent`**, so every Field created into that form's
|
|
@@ -1531,7 +1532,8 @@ declare class IoxFieldComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1531
1532
|
get fieldName(): string;
|
|
1532
1533
|
/** Failing AND allowed to say so — or forced, while an author designs the state. */
|
|
1533
1534
|
get invalid(): boolean;
|
|
1534
|
-
/** The message a visitor reads
|
|
1535
|
+
/** The message a visitor reads, in the page's language (`pageLanguageOf`) — IOX_FORM_MESSAGES, whose default is
|
|
1536
|
+
* forms-core's ONE catalog (iox-client-engine#15). */
|
|
1535
1537
|
get errorText(): string;
|
|
1536
1538
|
/** The field's spec under the name its form gave it — forms-core `fieldSpecOf`, the reading the saved spec uses. */
|
|
1537
1539
|
private toSpec;
|
|
@@ -1640,21 +1642,26 @@ declare class IoxFormErrorComponent {
|
|
|
1640
1642
|
* Directive-host: the `<dialog>` IS the host, carrying exactly the markup the string renderer
|
|
1641
1643
|
* writes (`data-iox-dialog`, the opt-in backdrop-close / consent-role / placement attributes and
|
|
1642
1644
|
* the close X), so the runtime's dialog actions, the consent prompt and `styles.scss` treat both
|
|
1643
|
-
* paths alike. Ships CLOSED — only the dialog actions open it.
|
|
1645
|
+
* paths alike. Ships CLOSED — only the dialog actions open it. The close X is named in the PAGE's language (actions-core
|
|
1646
|
+
* `closeWord`, the word the string path writes too — iox-ui#167). Before this existed, a page holding
|
|
1644
1647
|
* a Dialog fell back to the string renderer wholesale.
|
|
1645
1648
|
*/
|
|
1646
1649
|
declare class IoxDialogComponent {
|
|
1650
|
+
private readonly host?;
|
|
1647
1651
|
nodeId: string;
|
|
1648
1652
|
placement: string;
|
|
1649
1653
|
closeOnBackdrop: boolean | string;
|
|
1650
1654
|
showCloseButton: boolean | string;
|
|
1651
1655
|
consentRole: boolean | string;
|
|
1656
|
+
constructor(host?: ElementRef<HTMLElement> | undefined);
|
|
1652
1657
|
childrenHost: ViewContainerRef;
|
|
1653
1658
|
get backdropCloses(): boolean;
|
|
1654
1659
|
get closeButtonShown(): boolean;
|
|
1655
1660
|
get consentRoleOn(): boolean;
|
|
1661
|
+
/** The close X's accessible name: "Close" in the page's language (the nearest `lang`, else the document's). */
|
|
1662
|
+
get closeName(): string;
|
|
1656
1663
|
get placementAttr(): string | null;
|
|
1657
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<IoxDialogComponent,
|
|
1664
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IoxDialogComponent, [{ optional: true; }]>;
|
|
1658
1665
|
static ɵcmp: i0.ɵɵComponentDeclaration<IoxDialogComponent, "dialog[iox-dialog]", never, { "nodeId": { "alias": "nodeId"; "required": false; }; "placement": { "alias": "placement"; "required": false; }; "closeOnBackdrop": { "alias": "closeOnBackdrop"; "required": false; }; "showCloseButton": { "alias": "showCloseButton"; "required": false; }; "consentRole": { "alias": "consentRole"; "required": false; }; }, {}, never, never, false, never>;
|
|
1659
1666
|
}
|
|
1660
1667
|
|
|
@@ -4916,10 +4923,6 @@ declare const TOAST_MIN_MS = 4000;
|
|
|
4916
4923
|
declare const TOAST_MAX_MS = 10000;
|
|
4917
4924
|
/** … and this much longer per character it says (a reader's pace). */
|
|
4918
4925
|
declare const TOAST_MS_PER_CHAR = 60;
|
|
4919
|
-
/** The close control's words in the page's language. */
|
|
4920
|
-
declare const TOAST_CLOSE_WORDS: Readonly<Record<string, string>>;
|
|
4921
|
-
/** "Close" in `lang` (its base language), else English. */
|
|
4922
|
-
declare function toastCloseWord(lang: string | null | undefined): string;
|
|
4923
4926
|
/** How long a toast stays: long enough to read, within bounds. Pure. */
|
|
4924
4927
|
declare function toastDuration(text: string, override?: number | null): number;
|
|
4925
4928
|
/** Which toasts leave so a new one fits: the oldest first, keeping `max - 1` beside the newcomer. Pure. */
|
|
@@ -5099,5 +5102,5 @@ declare function formToastsOnSend(form: Element | null | undefined): boolean;
|
|
|
5099
5102
|
/** Raise the form's Sent toast (from the form — its scope and its look). */
|
|
5100
5103
|
declare function raiseFormToast(form: Element): ToastHandle | null;
|
|
5101
5104
|
|
|
5102
|
-
export { A11yAttribute, A11yTrait, ACCESSIBLE_NAME_TYPES, AOSService, ARIA_CURRENT_PAGE, BACKDROP_TWIN_KEY, BACKDROP_WHOLE_KEY, BLUR_IN_START_PX, BOUND_STYLE_PREFIX, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CALENDAR_CLOSING_ATTRIBUTE, CALENDAR_DESIGN_ATTRIBUTE, CALENDAR_INSTANT_ATTRIBUTE, CALENDAR_SHEET_QUERY, COMPONENT_STATE_SELECTOR, CONTAINER_HTML_TAGS, CONTEXT_ACTION_TYPES, COUNT_ATTRIBUTE, COUNT_DEFAULT_MS, COUNT_MAX_MS, COUNT_UP_ACTION, CURRENT_LINK_TYPES, CalendarClass, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ComponentState, ContainerComponent, ContextStore, CoverPaint, DECORATIVE_ROLES, DECORATIVE_TYPES, DEFAULT_GALLERY_SCHEDULER, DEFAULT_INTERACTION_EASING, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_PHOSPHOR_WEIGHT, DEFAULT_WIDTH_BY_TYPE, DEPTH_CLIP_ATTRIBUTE, DIALOG_CLOSE_ABOVE_ATTRIBUTE, DIALOG_NODE_TYPE, DISSOLVE_GROW_DEFAULT, DatePickerRuntime, DeclarationContext, EASING_KEYWORDS, EASING_TOKENS, ENTRANCE_ACTION_TYPES, ENTRANCE_FALLBACK_CSS, ENTRANCE_NOSCRIPT_CSS, ENTRANCE_PRESTATE_ATTRIBUTE, EXIT_ACTION_TYPES, EasingKeyword, EasingToken, FLOATING_GAP, FLOATING_LAYER_CLASS, FLOATING_MARGIN, FLOATING_SHEET_QUERY, FloatingAlign, FloatingSide, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, HEADER_SCROLL_HYSTERESIS_PX, HOVER_DEFAULT_TRANSITION_TRAITS, HOVER_MEDIA_QUERY, HOVER_STATES, HeaderInkRuntime, HeaderRuntime, IMAGE_DEFAULT_CSS, INTERACTION_ANIMATION_ID, INTERACTION_HIDDEN_ATTRIBUTE, INTERACTION_MARKER_ATTRIBUTES, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, InlineEditEvent, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxDialogComponent, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxPopoverComponent, IoxSubmitButtonComponent, IoxUiModule, IoxVideoComponent, LAST_EMITTED_STATES, LEGACY_DIRECTION_KEY, LEGACY_HOVER_TRANSITION_TRAITS, LEGACY_SWIPER_CONTROLS, LIST_GROUND_PIPE, LIST_INK_PIPE, LinkedContainerComponent, MANAGED_A11Y_ATTRIBUTES, MAX_LINES_KEY, NAMED_GROUP_ROLES, NO_PAGE_TRANSITION, ON_STATE_ROLES, OUTER_STYLE_PROPS, PAGE_LEAVE_RATIO, PAGE_STYLE_TOKENS, PAGE_TOKEN_FALLBACKS, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PART_PAGINATION_MODIFIER, PHONE_TRANSITION_QUERY, PIPE_DESCRIPTORS, PIPE_REGISTRY, POPOVER_SELECTOR, POPUP_ANNOUNCE_ATTRIBUTE, POPUP_SCALE_PROPERTY, POPUP_SELECTOR, POPUP_STILL_ATTRIBUTE, PRELOADER_AT_ATTRIBUTE, PRELOADER_CLASS, PRELOADER_CSS, PRELOADER_END_EVENT, PRELOADER_RUN_ATTRIBUTE, PRELOADING_ATTRIBUTE, PROGRESS_ATTRIBUTE, PageScrollProvider, PageStyleField, PageStyleSource, PausableTimer, PauseReason, PointerKind, PopoverAttribute, PopupRuntime, REDUCED_ENTRANCE_FRAMES, REDUCED_MOTION_QUERY, REDUCED_PAGE_LEAVE, RELATIONAL_STATE_PSEUDO, RevealActionType, SCROLLBARS_TAKE_WIDTH_CLASS, SCROLLED_ATTRIBUTE, SCROLLED_STATE_ROLE, SCROLLED_THRESHOLD_PX, SCROLL_ANIMATION_ID, SCROLL_EASINGS, SELF_PLAYING_TRIGGERS, SHAKE_DURATION_MS, SHAKE_EASING, SHAKE_KEYFRAMES, SLIDER_CARDS, SLIDER_FAN, SLIDER_FEEL, SLIDER_INPUTS_ATTRIBUTE, SLIDER_INPUT_NAMES, SLIDER_PHONE_BREAKPOINT, SLIDER_RUNWAY_CLASS, SLIDER_STEPS_PROPERTY, SLIDE_CAPTION_ATTRIBUTE, STATE_PSEUDO_CLASS, STRUCTURAL_STATES, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_A11Y_OPTIONS, SWIPER_RESPONSIVE_TRAITS, SWIPER_TRIGGER_EVENTS, ScrollActionType, ScrollEasing, SectionComponent, SettleMode, SliderCreativePreset, StringFormRuntime, SwiperModuleName, TARGETED_STATE_SUFFIX, TEXT_ALIGN_KEY, TEXT_DIRECTION_KEY,
|
|
5105
|
+
export { A11yAttribute, A11yTrait, ACCESSIBLE_NAME_TYPES, AOSService, ARIA_CURRENT_PAGE, BACKDROP_TWIN_KEY, BACKDROP_WHOLE_KEY, BLUR_IN_START_PX, BOUND_STYLE_PREFIX, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CALENDAR_CLOSING_ATTRIBUTE, CALENDAR_DESIGN_ATTRIBUTE, CALENDAR_INSTANT_ATTRIBUTE, CALENDAR_SHEET_QUERY, COMPONENT_STATE_SELECTOR, CONTAINER_HTML_TAGS, CONTEXT_ACTION_TYPES, COUNT_ATTRIBUTE, COUNT_DEFAULT_MS, COUNT_MAX_MS, COUNT_UP_ACTION, CURRENT_LINK_TYPES, CalendarClass, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ComponentState, ContainerComponent, ContextStore, CoverPaint, DECORATIVE_ROLES, DECORATIVE_TYPES, DEFAULT_GALLERY_SCHEDULER, DEFAULT_INTERACTION_EASING, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_PHOSPHOR_WEIGHT, DEFAULT_WIDTH_BY_TYPE, DEPTH_CLIP_ATTRIBUTE, DIALOG_CLOSE_ABOVE_ATTRIBUTE, DIALOG_NODE_TYPE, DISSOLVE_GROW_DEFAULT, DatePickerRuntime, DeclarationContext, EASING_KEYWORDS, EASING_TOKENS, ENTRANCE_ACTION_TYPES, ENTRANCE_FALLBACK_CSS, ENTRANCE_NOSCRIPT_CSS, ENTRANCE_PRESTATE_ATTRIBUTE, EXIT_ACTION_TYPES, EasingKeyword, EasingToken, FLOATING_GAP, FLOATING_LAYER_CLASS, FLOATING_MARGIN, FLOATING_SHEET_QUERY, FloatingAlign, FloatingSide, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, HEADER_SCROLL_HYSTERESIS_PX, HOVER_DEFAULT_TRANSITION_TRAITS, HOVER_MEDIA_QUERY, HOVER_STATES, HeaderInkRuntime, HeaderRuntime, IMAGE_DEFAULT_CSS, INTERACTION_ANIMATION_ID, INTERACTION_HIDDEN_ATTRIBUTE, INTERACTION_MARKER_ATTRIBUTES, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, InlineEditEvent, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxDialogComponent, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxPopoverComponent, IoxSubmitButtonComponent, IoxUiModule, IoxVideoComponent, LAST_EMITTED_STATES, LEGACY_DIRECTION_KEY, LEGACY_HOVER_TRANSITION_TRAITS, LEGACY_SWIPER_CONTROLS, LIST_GROUND_PIPE, LIST_INK_PIPE, LinkedContainerComponent, MANAGED_A11Y_ATTRIBUTES, MAX_LINES_KEY, NAMED_GROUP_ROLES, NO_PAGE_TRANSITION, ON_STATE_ROLES, OUTER_STYLE_PROPS, PAGE_LEAVE_RATIO, PAGE_STYLE_TOKENS, PAGE_TOKEN_FALLBACKS, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PART_PAGINATION_MODIFIER, PHONE_TRANSITION_QUERY, PIPE_DESCRIPTORS, PIPE_REGISTRY, POPOVER_SELECTOR, POPUP_ANNOUNCE_ATTRIBUTE, POPUP_SCALE_PROPERTY, POPUP_SELECTOR, POPUP_STILL_ATTRIBUTE, PRELOADER_AT_ATTRIBUTE, PRELOADER_CLASS, PRELOADER_CSS, PRELOADER_END_EVENT, PRELOADER_RUN_ATTRIBUTE, PRELOADING_ATTRIBUTE, PROGRESS_ATTRIBUTE, PageScrollProvider, PageStyleField, PageStyleSource, PausableTimer, PauseReason, PointerKind, PopoverAttribute, PopupRuntime, REDUCED_ENTRANCE_FRAMES, REDUCED_MOTION_QUERY, REDUCED_PAGE_LEAVE, RELATIONAL_STATE_PSEUDO, RevealActionType, SCROLLBARS_TAKE_WIDTH_CLASS, SCROLLED_ATTRIBUTE, SCROLLED_STATE_ROLE, SCROLLED_THRESHOLD_PX, SCROLL_ANIMATION_ID, SCROLL_EASINGS, SELF_PLAYING_TRIGGERS, SHAKE_DURATION_MS, SHAKE_EASING, SHAKE_KEYFRAMES, SLIDER_CARDS, SLIDER_FAN, SLIDER_FEEL, SLIDER_INPUTS_ATTRIBUTE, SLIDER_INPUT_NAMES, SLIDER_PHONE_BREAKPOINT, SLIDER_RUNWAY_CLASS, SLIDER_STEPS_PROPERTY, SLIDE_CAPTION_ATTRIBUTE, STATE_PSEUDO_CLASS, STRUCTURAL_STATES, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_A11Y_OPTIONS, SWIPER_RESPONSIVE_TRAITS, SWIPER_TRIGGER_EVENTS, ScrollActionType, ScrollEasing, SectionComponent, SettleMode, SliderCreativePreset, StringFormRuntime, SwiperModuleName, TARGETED_STATE_SUFFIX, TEXT_ALIGN_KEY, TEXT_DIRECTION_KEY, TOAST_DESIGN_ATTRIBUTE, TOAST_EDGE_ATTRIBUTE, TOAST_FIRST_LANDS_MS, TOAST_MAX_MS, TOAST_MAX_VISIBLE, TOAST_MIN_MS, TOAST_MS_PER_CHAR, TOOLTIP_ATTRIBUTE, TOOLTIP_FIRST_DELAY_MS, TOOLTIP_HIDE_GRACE_MS, TOOLTIP_INSTANT_ATTRIBUTE, TOOLTIP_PINNED_ATTRIBUTE, TOOLTIP_PLACEMENT_ATTRIBUTE, TOOLTIP_SIDE_ATTRIBUTE, TOOLTIP_TYPES, TOOLTIP_WARM_MS, TRANSITION_FEELS, TRANSITION_PROPERTY_KEY, TextAlign, TextBlockComponent, ToastClass, ToastEdge, TooltipClass, TooltipRuntime, VALIDATION_STATES, VALIDATION_STATE_CLASS, VIRTUAL_TRAIT_GROUPS, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, VisibilityActionType, activeActions, afterPreloader, animateAction, applyBindingPipes, applyBoundStyle, applyBoundStyles, applyFeel, armCountUp, armInteractionCounts, attachDatePicker, attachDatePickers, attachScrollProgress, attachStringForm, attachTooltips, bootSlider, boundStyleCss, boundStyleEntries, boundStyleOf, breakpointDef, breakpointForWidth, breakpointQueryFor, buildInteractionKeyframes, buildPartSelector, buildPreloaderLayer, buildSwiperBreakpoints, buildTargetedStateSelector, buildTargetedSuffixSelector, buildTransitionTimeline, canPopover, cascadeChain, clearInputOverride, clearOverride, clearToasts, closeAboveMediaQuery, closeAllPopovers, closePopover, collectContextSlotKeys, commitInlineEdit, compileDeclarations, compilePageStyle, componentStatesFor, composeVirtualTraits, containerHtmlTag, contextActionEffect, contextSlotKeys, countDuration, countIsReadable, countLocaleOf, countOverrides, countValueAt, coverPanelStyle, createCoverPanel, datePickerOf, declaredInputNames, decomposeBackdropFilter, defaultHoverTransitionTraits, defaultMessageResolver, deriveSeoFromContent, describePageStyle, describeSeoFields, dialogCloseAboveMinWidth, directionalFrames, dissolveGrowOf, domHasSliderParts, durationMs, effectiveActionType, effectiveTransitionId, ensurePreloaderStyles, entrancePreStateStyle, entranceStartsHidden, fanMiddle, feelFor, fieldLanguage, finalKeyframe, firstScreenReadiness, floatingLayer, floatingScope, formSentWords, formToastsOnSend, formatCount, framesFromLiveValue, gateHoverRule, getSeoValue, hasCounted, hasHoverState, hasOwnPageTransition, hasOwnTransition, headerShouldHide, heldFrames, hideFromTopLayer, hidingHeadersIn, holdsOnScreen, initialSlotValues, inkFollowingHeadersIn, interactionMarkerAttributes, isActionEnabled, isBoundProp, isBoundStyleProp, isContextAction, isCubicBezier, isCurrentLink, isEasingToken, isExternalOrFragment, isGradientPaint, isHoverPointer, isHoverState, isInputOverriddenAt, isInteractionEasing, isLastEmittedStateKey, isOpenPopover, isOperated, isOverriddenAt, isPopoverOpen, isPreloading, isPressFeedback, isScrolled, isStructuralState, isValidSlotKey, isWholeBackdropSet, keyframePropertyName, keyframeStyleEntries, layerFrame, legacyEnterToTransition, lookEaseOf, markScrollbarsTakeWidth, mediaQueryFor, mergeSwiperBreakpoints, migrateLegacyDirection, migrateLegacyTextAlign, motionAllowed, mountPreloader, nearestCommonAncestorId, needsAccessibleName, needsGroupName, nodeA11yAttributes, nodeCssId, nodeTraitValue, nodeUsesContext, normalizeAppPath, normalizeGalleryImage, normalizeIconClass, openPopover, openingPictureOf, orderStatesForEmit, pageTransitionOf, parentBreakpoint, parseCount, parseUrlList, partClassName, placeFloating, placePopover, planPartRule, planResponsiveRules, planScroll, planStateRule, planSwiperOptions, playCountUp, playDualLayerTransition, playInteraction, playPreloaderPreview, playsOnScroll, popoverPanelAttributes, popoverSide, popupAttributeGetter, popupIdOf, prefersReducedMotion, preloaderContentOf, preloaderHeadScript, raiseFloatingLayer, raiseFormToast, rectInLayer, reducedEntranceFades, reducedEntranceRun, renderDefaultDeclarations, resetPageStyleField, resetSeoField, resolveBoundValue, resolveContextValue, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolveInteractionEasing, resolvePageTransition, resolvePath, resolveSeo, resolveStateStyles, resolveStyleProps, resolveToggleVisibility, resolveValueChain, restoreCountUp, rewriteViewportUnits, runPreloader, safeSetInput, scrollActionKind, scrollMotionEnv, scrollbarsTakeWidthScript, scrubUntilOf, serializeA11yAttributes, setDateFieldValue, setInputOverride, setOverride, setSeoAuto, setSeoBinding, setSeoOverride, setSeoValue, settleInteraction, settleModeFor, shakeElement, showCalendarDesign, showInTopLayer, showToast, showToastDesign, sliderControlElements, sliderInputsFromProps, sliderInputsOf, sliderRunwayHtml, splitOuterProps, splitPressFeedback, stateNamesIn, statePseudoClass, stateSelectorSuffix, stateTransitionProperties, stringFormRuntimeOf, stripSuppressedProps, swiperAutoplayAllowed, swiperLoopOptions, swiperModuleNames, syncInteractionMarkers, syncNodeA11yAttributes, syncSubmitButtons, targetedStateSelector, toLayerRect, toastDuration, toastEdge, toastsToEvict, togglePopover, tooltipSide, tooltipTiming, tooltipWords, tooltipsOf, transitionPropertyList, translateYOf, viewportTransitionContext, watchHeaderInk, watchHeaders, watchScrolled, withContextSlots, withPhoneDefaults, withStateTransitions, wrapInBreakpointQuery, wrapInMediaQuery };
|
|
5103
5106
|
export type { A11yNodeSource, AnimateActionOptions, BoundStyleTarget, BoundValueSpec, BreakpointDef, ContextActionEffect, ContextActionLike, ContextItemRef, ContextSlotDefault, ContextValueSpec, ContextWriteScope, CountTarget, CoverPanelContext, CurrentLinkOptions, DatePickerOptions, FloatingLayerOptions, FloatingOptions, FloatingPlacement, FloatingRect, FloatingSize, FloatingViewport, FormMessageResolver, GalleryBoundSource, GalleryDurations, GalleryEffect, GalleryEffectDescriptor, GalleryImage, GalleryLoopOptions, GalleryLoopScheduler, GalleryLoopState, GallerySlideState, HeaderRuntimeOptions, IBuilderEventEmitter, InlineEditableNode, InputMap, InteractionKeyframe, IoxContextSlot, IoxPipe, LayerFrame, MatchMediaHost, NodeA11yContext, OverrideBreakpoint, PageCoverSpec, PageScrollStart, PageStyleFieldState, PageStyleOptions, PageStyleSettings, PageTransitionCategory, PageTransitionCategoryMeta, PageTransitionContext, PageTransitionOptions, PageTransitionPreset, PipeArgSpec, PipeContext, PipeDescriptor, PlannedPageTransition, PopoverCloseOptions, PopoverOpenOptions, PopupOverlayState, PopupRuntimeOptions, PreloaderContent, PreloaderPreviewOptions, PreloaderRunOptions, PressAction, RegisteredField, ResolvedPageCover, ResolvedPageTransition, ResponsiveLayer, ResponsiveOverrides, ResponsiveRuleSet, RouteAnimationLike, ScrollPlanContext, ScrollProgressAction, ScrollProgressHost, ScrollProgressInteraction, ScrollSource, SeoDerivedContent, SeoFieldSource, SeoFieldState, SeoResolveContext, SetContextParams, SettleOptions, SliderBootOptions, SliderControlElements, SliderInputs, StateRulePlan, StateScope, StateStyleMap, StringFormOptions, StyleMap, StyleTreeNode, SwiperBreakpointMap, SwiperModuleFlags, SwiperPlan, SwiperPlanContext, ToastHandle, ToastOptions, ToggleableAction, TooltipRuntimeOptions, TooltipTimingState, TransitionFeel, TransitionPhase, TransitionPreviewLayers, TransitionTimelineInput, TransitionViewport, ValueSource, VirtualTraitGroup };
|
package/package.json
CHANGED
|
@@ -16,3 +16,6 @@ export * from './popover-opener';
|
|
|
16
16
|
export * from './dialog-motion';
|
|
17
17
|
export * from './reveal-origin';
|
|
18
18
|
export * from './popup-arrival';
|
|
19
|
+
// The close word lives in design-core (composite-core's Lightbox recipe stamps it, and composite-core cannot import
|
|
20
|
+
// actions-core — actions-core imports composite-core); re-exported here for the overlays that already read it here.
|
|
21
|
+
export { CLOSE_WORDS, closeWord } from '@vectoriox/iox-ui/design-core';
|
|
@@ -58,7 +58,6 @@ export enum ShopWord {
|
|
|
58
58
|
AddToCart = 'addToCart',
|
|
59
59
|
BuyNow = 'buyNow',
|
|
60
60
|
YourBag = 'yourBag',
|
|
61
|
-
Close = 'close',
|
|
62
61
|
RemoveLine = 'removeLine',
|
|
63
62
|
EmptyBag = 'emptyBag',
|
|
64
63
|
Subtotal = 'subtotal',
|
|
@@ -85,7 +84,6 @@ export const SHOP_WORDS: Readonly<Record<ShopWord, CommerceLabel>> = Object.free
|
|
|
85
84
|
[ShopWord.AddToCart]: { en: 'Add to cart', he: 'הוספה לסל' },
|
|
86
85
|
[ShopWord.BuyNow]: { en: 'Buy now', he: 'קנייה עכשיו' },
|
|
87
86
|
[ShopWord.YourBag]: { en: 'Your bag', he: 'הסל שלך' },
|
|
88
|
-
[ShopWord.Close]: { en: 'Close', he: 'סגירה' },
|
|
89
87
|
[ShopWord.RemoveLine]: { en: 'Remove', he: 'הסרה' },
|
|
90
88
|
[ShopWord.EmptyBag]: { en: 'Your bag is empty.', he: 'הסל שלך ריק.' },
|
|
91
89
|
[ShopWord.Subtotal]: { en: 'Subtotal', he: 'סכום ביניים' },
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { repeatedRowIndex, ROW_INDEX_ATTRIBUTE, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { closeWord, repeatedRowIndex, ROW_INDEX_ATTRIBUTE, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { CompositeNode, CompositeNodeFactory, makeCompositePart, NO_ELEMENT_STYLE, readProp, writeProp, writeStyles } from './composite-node';
|
|
4
|
-
import {
|
|
4
|
+
import { recipeLang, RecipeLang } from './recipe-parts';
|
|
5
|
+
import { buildSliderPart, SLIDE_TYPE, SLIDER_NAME_TRAIT, SLIDER_TYPE, SliderRole, sliderWords } from './slider';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* THE LIGHTBOX (CC3 — complex-components plan §7d, board 6). Not a component: a Dialog holding a Slider bound to the
|
|
@@ -17,6 +18,11 @@ import { buildSliderPart, SLIDE_TYPE, SLIDER_TYPE, SliderRole } from './slider';
|
|
|
17
18
|
*
|
|
18
19
|
* Keyboard ← → are the Slider's Keyboard module; Esc and the focus trap are the `<dialog>`'s; focus returns to the
|
|
19
20
|
* thumbnail that opened it (the dialog opener's own rule).
|
|
21
|
+
*
|
|
22
|
+
* Its words are stored in the node, so they are stamped in the SITE's language (`LightboxOptions.lang`, vectoriox/iox-ui#170):
|
|
23
|
+
* Close's name is the ONE close word (design-core `closeWord`), the arrows' the slider's (`sliderWords`), the gallery's
|
|
24
|
+
* name and the sample caption `LIGHTBOX_WORDS`. The layer names stay the builder's (`LIGHTBOX_LABEL` is how the composer
|
|
25
|
+
* finds the lightbox it wires).
|
|
20
26
|
*/
|
|
21
27
|
|
|
22
28
|
export const SLIDE_TO_ROW = 'row';
|
|
@@ -38,8 +44,16 @@ export interface LightboxOptions {
|
|
|
38
44
|
captionField?: string;
|
|
39
45
|
/** The image's alt binding; '' = decorative (a bare URL row has no words of its own). */
|
|
40
46
|
altField?: string;
|
|
47
|
+
/** The site's language (a locale: `he`, `he-IL`) — the words the recipe stores (iox-ui#170). English when not given. */
|
|
48
|
+
lang?: string | null;
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
/** The lightbox's own stored words per recipe language: the gallery's accessible name and the manual slides' caption. */
|
|
52
|
+
export const LIGHTBOX_WORDS: Readonly<Record<RecipeLang, { name: string; caption: string }>> = Object.freeze({
|
|
53
|
+
en: { name: 'Gallery', caption: 'Caption' },
|
|
54
|
+
he: { name: 'גלריה', caption: 'כיתוב' },
|
|
55
|
+
});
|
|
56
|
+
|
|
43
57
|
const ZERO = '0px 0px 0px 0px';
|
|
44
58
|
const DIALOG_BASE: Readonly<Record<string, string>> = {
|
|
45
59
|
width: '100vw', maxWidth: '100vw', height: '100dvh', maxHeight: '100dvh', borderRadius: '0px', padding: '18px 18px 18px 18px',
|
|
@@ -80,10 +94,10 @@ function bindRow(node: CompositeNode, prop: string, source: string, field: strin
|
|
|
80
94
|
(node as { bindings?: unknown[] }).bindings = bindings;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
function buildSlide(create: CompositeNodeFactory, key: string, options: LightboxOptions, rowAlias: string | null): CompositeNode {
|
|
97
|
+
function buildSlide(create: CompositeNodeFactory, key: string, options: LightboxOptions, rowAlias: string | null, captionWord: string): CompositeNode {
|
|
84
98
|
const slide = makeCompositePart(create, { key, type: SLIDE_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slide', SLIDE_BASE);
|
|
85
99
|
const image = makeCompositePart(create, { key: `${key}-image`, type: 'Image', props: { src: '', alt: '' }, elementStyle: 'media' }, null, 'Image', IMAGE_BASE);
|
|
86
|
-
const caption = makeCompositePart(create, { key: `${key}-caption`, type: 'Text', props: { content:
|
|
100
|
+
const caption = makeCompositePart(create, { key: `${key}-caption`, type: 'Text', props: { content: captionWord, tag: 'p' }, elementStyle: 'small' }, null, 'Caption', CAPTION_BASE);
|
|
87
101
|
if (rowAlias) {
|
|
88
102
|
bindRow(image, 'src', rowAlias, options.imageField ?? 'item');
|
|
89
103
|
if (options.altField) bindRow(image, 'alt', rowAlias, options.altField);
|
|
@@ -95,21 +109,23 @@ function buildSlide(create: CompositeNodeFactory, key: string, options: Lightbox
|
|
|
95
109
|
|
|
96
110
|
/** A fresh lightbox: the Dialog, its Close part and the Slider (bound to `source`, or three manual slides). */
|
|
97
111
|
export function buildLightboxRecipe(create: CompositeNodeFactory, options: LightboxOptions = {}): CompositeNode {
|
|
112
|
+
const words = LIGHTBOX_WORDS[recipeLang(options.lang)];
|
|
113
|
+
const arrows = sliderWords(options.lang);
|
|
98
114
|
const dialog = makeCompositePart(create, { key: 'lightbox', type: DIALOG, props: {}, elementStyle: 'dialog' }, null, LIGHTBOX_LABEL, DIALOG_BASE);
|
|
99
115
|
writeProp(dialog, 'placement', 'center');
|
|
100
116
|
writeProp(dialog, 'closeOnBackdrop', true);
|
|
101
117
|
writeProp(dialog, 'showCloseButton', false);
|
|
102
|
-
writeProp(dialog, 'ariaLabel',
|
|
118
|
+
writeProp(dialog, 'ariaLabel', words.name);
|
|
103
119
|
setColorScheme(dialog, 'inverse');
|
|
104
120
|
|
|
105
|
-
const close = makeCompositePart(create, { key: 'close', type: 'ButtonBlock', props: { tag: 'button', type: 'button', ariaLabel:
|
|
121
|
+
const close = makeCompositePart(create, { key: 'close', type: 'ButtonBlock', props: { tag: 'button', type: 'button', ariaLabel: closeWord(options.lang) }, elementStyle: 'button-ghost' }, null, 'Close', CLOSE_BASE);
|
|
106
122
|
close.children = [makeCompositePart(create, { key: 'close-icon', type: 'Icon', props: { iconClass: 'ph ph-x' }, elementStyle: 'icon' }, null, 'Icon', { fontSize: '22px', color: 'inherit' })];
|
|
107
123
|
onClick(close, 'closeDialog', dialog.id ?? '');
|
|
108
124
|
|
|
109
125
|
const slider = makeCompositePart(create, { key: 'slider', type: SLIDER_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slider', SLIDER_BASE);
|
|
110
126
|
for (const [name, value] of Object.entries({
|
|
111
127
|
slidesPerView: 1, spaceBetween: 0, loop: 'off', enableNavigation: true, enablePagination: true, paginationType: 'fraction',
|
|
112
|
-
enableKeyboard: true,
|
|
128
|
+
enableKeyboard: true, [SLIDER_NAME_TRAIT]: words.name, limit: 50,
|
|
113
129
|
})) writeProp(slider, name, value);
|
|
114
130
|
const rowAlias = options.source ? lastSegment(options.sourcePath) || options.source : null;
|
|
115
131
|
if (options.source) {
|
|
@@ -118,6 +134,8 @@ export function buildLightboxRecipe(create: CompositeNodeFactory, options: Light
|
|
|
118
134
|
}
|
|
119
135
|
const prev = buildSliderPart(create, SliderRole.Prev);
|
|
120
136
|
const next = buildSliderPart(create, SliderRole.Next);
|
|
137
|
+
writeProp(prev, SLIDER_NAME_TRAIT, arrows.prev);
|
|
138
|
+
writeProp(next, SLIDER_NAME_TRAIT, arrows.next);
|
|
121
139
|
for (const arrow of [prev, next]) {
|
|
122
140
|
const layers = { ...(arrow.responsive ?? {}) };
|
|
123
141
|
layers[LIGHTBOX_ARROWS_HIDE_AT] = { styleProps: { display: 'none' } };
|
|
@@ -126,7 +144,8 @@ export function buildLightboxRecipe(create: CompositeNodeFactory, options: Light
|
|
|
126
144
|
const counter = buildSliderPart(create, SliderRole.Pagination);
|
|
127
145
|
counter.label = 'Counter';
|
|
128
146
|
writeStyles(counter, COUNTER_BASE);
|
|
129
|
-
const slides = rowAlias ? [buildSlide(create, 'slide', options, rowAlias
|
|
147
|
+
const slides = rowAlias ? [buildSlide(create, 'slide', options, rowAlias, words.caption)]
|
|
148
|
+
: [1, 2, 3].map(n => buildSlide(create, `slide-${n}`, options, null, words.caption));
|
|
130
149
|
slider.children = [prev, next, ...slides, counter];
|
|
131
150
|
dialog.children = [close, slider];
|
|
132
151
|
return dialog;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ShopWord, shopWord } from '@vectoriox/iox-ui/commerce-core';
|
|
2
2
|
import type { ProductOption } from '@vectoriox/iox-ui/commerce-core';
|
|
3
|
-
import { roleClass } from '@vectoriox/iox-ui/design-core';
|
|
3
|
+
import { closeWord, roleClass } from '@vectoriox/iox-ui/design-core';
|
|
4
4
|
|
|
5
5
|
import { CompositeNode, CompositeNodeFactory, findByRole, writeProp } from './composite-node';
|
|
6
|
-
import { bindSlot, COLUMN, onClick, recipeButton, recipeIcon, recipePart, recipeText, ROW, WORDS, ZERO } from './recipe-parts';
|
|
6
|
+
import { bindSlot, COLUMN, onClick, recipeButton, recipeIcon, recipeLang, RecipeLang, recipePart, recipeText, ROW, WORDS, ZERO } from './recipe-parts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* THE SHOP PARTS (commerce E1c, C-D16 — commerce board 10). Not components: recipes of ordinary builder nodes, each part
|
|
@@ -206,26 +206,39 @@ enum Style {
|
|
|
206
206
|
Title = 'h3',
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
/** The sample product a fresh recipe shows (board 10's vase) — the runtime replaces it with the page's product and the
|
|
210
|
+
* bag's lines, but the canvas and a page's first paint show it, so it is in the site's language too (vectoriox/iox-ui#100). */
|
|
211
|
+
const SHOP_SAMPLES: Readonly<Record<RecipeLang, { option: string; value: string; swatch: string; soldOut: string; lineTitle: string }>> = Object.freeze({
|
|
212
|
+
en: { option: 'Glaze — Sand', value: '32 cm', swatch: 'Sand', soldOut: 'Charcoal', lineTitle: 'Tall speckled vase' },
|
|
213
|
+
he: { option: 'זיגוג — חול', value: '32 ס״מ', swatch: 'חול', soldOut: 'פחם', lineTitle: 'אגרטל גבוה מנומר' },
|
|
214
|
+
});
|
|
215
|
+
|
|
209
216
|
/** The words a fresh recipe shows, in the site's language (vectoriox/iox-ui#100 — a Hebrew store's bag, buttons and drawer
|
|
210
|
-
* speak Hebrew, as its header does
|
|
217
|
+
* speak Hebrew, as its header does; so do the sample product's words and the names a screen reader hears). */
|
|
211
218
|
export function shopRecipeWords(lang: string | null | undefined = 'en') {
|
|
212
219
|
const w = (word: ShopWord, fill: Readonly<Record<string, string | number>> = {}) => shopWord(word, lang, fill);
|
|
220
|
+
const sample = SHOP_SAMPLES[recipeLang(lang)];
|
|
213
221
|
return Object.freeze({
|
|
214
222
|
price: '₪240.00',
|
|
215
223
|
compareAt: '₪280.00',
|
|
216
|
-
option:
|
|
217
|
-
value:
|
|
218
|
-
|
|
224
|
+
option: sample.option,
|
|
225
|
+
value: sample.value,
|
|
226
|
+
swatch: sample.swatch,
|
|
227
|
+
note: w(ShopWord.ValueSoldOut, { name: sample.soldOut }),
|
|
219
228
|
quantity: '1',
|
|
229
|
+
quantityLabel: w(ShopWord.Quantity),
|
|
230
|
+
decrease: w(ShopWord.Decrease),
|
|
231
|
+
increase: w(ShopWord.Increase),
|
|
220
232
|
add: w(ShopWord.AddToCart),
|
|
221
233
|
added: w(ShopWord.Added),
|
|
222
234
|
buyNow: w(ShopWord.BuyNow),
|
|
223
235
|
cart: w(ShopWord.Cart),
|
|
224
236
|
count: '2',
|
|
225
237
|
drawer: w(ShopWord.YourBag),
|
|
226
|
-
close
|
|
227
|
-
|
|
228
|
-
|
|
238
|
+
// The drawer's × is named by the ONE close word (design-core `closeWord`, iox-ui#170) — never a shop word of its own.
|
|
239
|
+
close: closeWord(lang),
|
|
240
|
+
lineTitle: sample.lineTitle,
|
|
241
|
+
lineVariant: `${sample.swatch} · ${sample.value}`,
|
|
229
242
|
lineTotal: '₪240.00',
|
|
230
243
|
remove: w(ShopWord.RemoveLine),
|
|
231
244
|
empty: w(ShopWord.EmptyBag),
|
|
@@ -270,45 +283,49 @@ function button(create: CompositeNodeFactory, key: string, role: ShopRole, style
|
|
|
270
283
|
}
|
|
271
284
|
|
|
272
285
|
/** Price: the variant's price and, when it is higher, its earlier price struck through (board 10). */
|
|
273
|
-
export function buildPriceRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
286
|
+
export function buildPriceRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
287
|
+
const t = shopRecipeWords(lang);
|
|
274
288
|
const root = part(create, 'price', Type.Container, ShopRole.Price, null, {}, SHOP_LABELS.price,
|
|
275
289
|
{ ...ROW, alignItems: 'baseline', flexWrap: 'wrap', gap: '8px' });
|
|
276
|
-
const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style.Price,
|
|
290
|
+
const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style.Price, t.price, 'Price');
|
|
277
291
|
bindSlot(amount, 'content', '$variant', 'price', true);
|
|
278
|
-
const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare,
|
|
292
|
+
const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare, t.compareAt, 'Price before');
|
|
279
293
|
bindSlot(compare, 'content', '$variant', 'compareAt', true);
|
|
280
294
|
root.children = [amount, compare];
|
|
281
295
|
return root;
|
|
282
296
|
}
|
|
283
297
|
|
|
284
298
|
/** Options: one group per option, each a radio group of chips, swatches or a select (T26). */
|
|
285
|
-
export function buildVariantPickerRecipe(create: CompositeNodeFactory): CompositeNode {
|
|
299
|
+
export function buildVariantPickerRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
|
|
300
|
+
const t = shopRecipeWords(lang);
|
|
286
301
|
const root = part(create, 'variants', Type.Container, ShopRole.Variants, null, {}, SHOP_LABELS.variants, { ...COLUMN, gap: '16px' });
|
|
287
302
|
const group = part(create, 'variant-group', Type.Container, ShopRole.VariantGroup, null, {}, 'Option', { ...COLUMN, gap: '6px' });
|
|
288
|
-
const label = text(create, 'variant-label', ShopRole.VariantLabel, Style.Small,
|
|
303
|
+
const label = text(create, 'variant-label', ShopRole.VariantLabel, Style.Small, t.option, 'Option name');
|
|
289
304
|
const values = part(create, 'variant-values', Type.Container, ShopRole.VariantValues, null, {}, 'Values',
|
|
290
305
|
{ ...ROW, flexWrap: 'wrap', gap: '8px' });
|
|
291
306
|
const chip = button(create, 'variant-value', ShopRole.VariantValue, Style.Chip, 'Value', '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
|
|
292
|
-
chip.children = [text(create, 'variant-value-text', null, Style.Label,
|
|
293
|
-
const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style.Swatch, 'Swatch',
|
|
307
|
+
chip.children = [text(create, 'variant-value-text', null, Style.Label, t.value, 'Text', WORDS, 'span')];
|
|
308
|
+
const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style.Swatch, 'Swatch', t.swatch, {}); // the swatch style owns its size and padding (iox-cms-client#89)
|
|
294
309
|
values.children = [chip, swatch];
|
|
295
|
-
const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small,
|
|
310
|
+
const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small, t.note, 'Sold-out note');
|
|
296
311
|
group.children = [label, values, note];
|
|
297
312
|
root.children = [group];
|
|
298
313
|
return root;
|
|
299
314
|
}
|
|
300
315
|
|
|
301
|
-
/** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's.
|
|
302
|
-
|
|
316
|
+
/** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. The − and + are named in
|
|
317
|
+
* the site's language (the runtime names them again once it fills them; a page's first paint already speaks it). */
|
|
318
|
+
export function buildQuantityRecipe(create: CompositeNodeFactory, compact = false, key = 'quantity', lang: string | null = 'en'): CompositeNode {
|
|
319
|
+
const t = shopRecipeWords(lang);
|
|
303
320
|
const size = compact ? '30px' : 'var(--iox-stepper-size)';
|
|
304
321
|
const root = part(create, key, Type.Container, ShopRole.Quantity, Style.Quantity, {}, SHOP_LABELS.quantity,
|
|
305
322
|
{ ...ROW, alignItems: 'stretch', gap: '0px', minHeight: size });
|
|
306
|
-
const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease',
|
|
323
|
+
const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease', t.decrease,
|
|
307
324
|
{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
308
325
|
down.children = [icon(create, `${key}-down-icon`, 'ph ph-minus', compact ? '14px' : '16px')];
|
|
309
|
-
const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body,
|
|
326
|
+
const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body, t.quantity, 'Count',
|
|
310
327
|
{ ...WORDS, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: compact ? '32px' : '40px', fontVariantNumeric: 'tabular-nums' }, 'span');
|
|
311
|
-
const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style.QuantityButton, 'Increase',
|
|
328
|
+
const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style.QuantityButton, 'Increase', t.increase,
|
|
312
329
|
{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
|
|
313
330
|
up.children = [icon(create, `${key}-up-icon`, 'ph ph-plus', compact ? '14px' : '16px')];
|
|
314
331
|
root.children = [down, value, up];
|
|
@@ -353,7 +370,7 @@ export function buildCartButtonRecipe(create: CompositeNodeFactory, lang: string
|
|
|
353
370
|
}
|
|
354
371
|
|
|
355
372
|
/** One cart line: thumbnail · title, variant, quantity and Remove · line total (board 10). */
|
|
356
|
-
function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords): CompositeNode {
|
|
373
|
+
function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords, lang: string | null): CompositeNode {
|
|
357
374
|
const line = part(create, 'cart-line', Type.Container, ShopRole.CartLine, Style.CartLine, {}, 'Line',
|
|
358
375
|
{ display: 'grid', gridTemplateColumns: 'var(--iox-cart-thumb-size) minmax(0, 1fr) auto', alignItems: 'start', gap: '12px', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO });
|
|
359
376
|
const image = part(create, 'cart-line-image', Type.Image, ShopRole.CartLineImage, Style.Media, { src: '', alt: '' }, 'Image',
|
|
@@ -364,7 +381,7 @@ function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords): Compos
|
|
|
364
381
|
const actions = part(create, 'cart-line-actions', Type.Container, null, null, {}, 'Actions', { ...ROW, gap: '12px' });
|
|
365
382
|
const remove = button(create, 'cart-line-remove', ShopRole.CartLineRemove, Style.Ghost, 'Remove', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
|
|
366
383
|
remove.children = [text(create, 'cart-line-remove-text', null, Style.Small, t.remove, 'Text', WORDS, 'span')];
|
|
367
|
-
actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity'), remove];
|
|
384
|
+
actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity', lang), remove];
|
|
368
385
|
info.children = [title, variant, actions];
|
|
369
386
|
const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style.Price, t.lineTotal, 'Line total',
|
|
370
387
|
{ ...WORDS, fontSize: 'var(--iox-size-body)', textAlign: 'end' });
|
|
@@ -390,7 +407,7 @@ export function buildCartDrawerRecipe(create: CompositeNodeFactory, lang: string
|
|
|
390
407
|
head.children = [title, close];
|
|
391
408
|
|
|
392
409
|
const lines = part(create, 'cart-lines', Type.Container, ShopRole.CartLines, null, {}, 'Lines', { ...COLUMN, gap: '16px' });
|
|
393
|
-
lines.children = [buildCartLine(create, t)];
|
|
410
|
+
lines.children = [buildCartLine(create, t, lang)];
|
|
394
411
|
const issues = text(create, 'cart-issues', ShopRole.CartIssues, Style.Small, '', 'Issues', { ...WORDS, color: 'var(--iox-danger)' });
|
|
395
412
|
const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style.Body, t.empty, 'Empty');
|
|
396
413
|
const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style.CartNote, t.shippingNote, 'Free delivery note',
|
|
@@ -422,9 +439,9 @@ export enum ShopRecipe {
|
|
|
422
439
|
|
|
423
440
|
/** Each recipe in the site's language (`lang` — vectoriox/iox-ui#100; English when the host has none). */
|
|
424
441
|
export const SHOP_RECIPES: Readonly<Record<ShopRecipe, (create: CompositeNodeFactory, lang?: string | null) => CompositeNode>> = Object.freeze({
|
|
425
|
-
[ShopRecipe.Price]: buildPriceRecipe,
|
|
426
|
-
[ShopRecipe.Variants]: buildVariantPickerRecipe,
|
|
427
|
-
[ShopRecipe.Quantity]: (create: CompositeNodeFactory) => buildQuantityRecipe(create),
|
|
442
|
+
[ShopRecipe.Price]: (create: CompositeNodeFactory, lang?: string | null) => buildPriceRecipe(create, lang ?? 'en'),
|
|
443
|
+
[ShopRecipe.Variants]: (create: CompositeNodeFactory, lang?: string | null) => buildVariantPickerRecipe(create, lang ?? 'en'),
|
|
444
|
+
[ShopRecipe.Quantity]: (create: CompositeNodeFactory, lang?: string | null) => buildQuantityRecipe(create, false, 'quantity', lang ?? 'en'),
|
|
428
445
|
[ShopRecipe.Add]: (create: CompositeNodeFactory, lang?: string | null) => buildAddToCartRecipe(create, lang ?? 'en'),
|
|
429
446
|
[ShopRecipe.BuyNow]: (create: CompositeNodeFactory, lang?: string | null) => buildBuyNowRecipe(create, lang ?? 'en'),
|
|
430
447
|
[ShopRecipe.CartButton]: (create: CompositeNodeFactory, lang?: string | null) => buildCartButtonRecipe(create, lang ?? 'en'),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { languageOf } from './locale-direction';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "Close" in the page's language — the accessible name of every × the platform names: the Dialog's close button (the
|
|
5
|
+
* iox-ui component path AND the engine's string path, vectoriox/iox-ui#167), the toast's close control (premium M5) and
|
|
6
|
+
* the Lightbox recipe's stamped Close part (composite-core, vectoriox/iox-ui#170). ONE table, so no overlay on a Hebrew
|
|
7
|
+
* site is ever named "Close". It lives in design-core — the entry every other one may import (composite-core cannot
|
|
8
|
+
* import actions-core, which imports it); actions-core re-exports it. Framework-free (the engine's string renderer and
|
|
9
|
+
* iox-cms read it); a locale is read by its language subtag (`he-IL` → `he`).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The close word by language subtag. English is the fallback for every language the table lacks. */
|
|
13
|
+
export const CLOSE_WORDS: Readonly<Record<string, string>> = Object.freeze({ en: 'Close', he: 'סגירה' });
|
|
14
|
+
|
|
15
|
+
/** "Close" in `lang` (its base language), else English. */
|
|
16
|
+
export function closeWord(lang: string | null | undefined): string {
|
|
17
|
+
return CLOSE_WORDS[languageOf(lang)] ?? CLOSE_WORDS['en'];
|
|
18
|
+
}
|
|
@@ -4,7 +4,7 @@ import { compositeOver, paintColours, parseCssColour, quantizeRgb, Rgba, ringCol
|
|
|
4
4
|
import { ElementStyle, ELEMENT_STYLES } from './element-styles';
|
|
5
5
|
import { SPEC_CONTRAST_AUDIT, SPEC_INK_SCOPES, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
6
6
|
import { SCHEME_INK } from './node-classes';
|
|
7
|
-
import { DesignTokenLike, ResolvedMode,
|
|
7
|
+
import { DesignTokenLike, ResolvedMode, schemeTokenResolver } from './token-css';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The contrast AUDIT (design-system DS9). The contract's token pairs were all AA and Doron still found a
|
|
@@ -12,7 +12,7 @@ import { DesignTokenLike, ResolvedMode, resolveSchemeTokenValues } from './token
|
|
|
12
12
|
* Icon dropped into a Primary button painted `icon-color` (accent-text) on the accent fill, 1:1 in a Brand
|
|
13
13
|
* section. So this resolves what each element style actually paints, the way CSS resolves it:
|
|
14
14
|
*
|
|
15
|
-
* - in every section scheme (`resolveSchemeTokenValues`), directly on the section and inside every
|
|
15
|
+
* - in every section scheme (`resolveSchemeTokenValues`, one `schemeTokenResolver` per look), directly on the section and inside every
|
|
16
16
|
* container style (Card, Panel, Navigation bar, Dialog);
|
|
17
17
|
* - `inherit` → the container's ink, a transparent fill → what is under it, translucent fills composited,
|
|
18
18
|
* a gradient ground (Glass's mesh, Midnight's glow) checked at its worst stop;
|
|
@@ -90,6 +90,8 @@ const TOKEN_REF = /var\(\s*--iox-([\w-]+)\s*(?:,([^()]*))?\)/g;
|
|
|
90
90
|
|
|
91
91
|
type Values = Readonly<Record<string, string>>;
|
|
92
92
|
type StyleMap = Readonly<Record<string, string>>;
|
|
93
|
+
/** One look's token values in a scheme (or a chain), in the audited mode. */
|
|
94
|
+
type SchemeValues = ReturnType<typeof schemeTokenResolver>;
|
|
93
95
|
|
|
94
96
|
/** A style value with its var() references resolved against `values` (already-resolved tokens). */
|
|
95
97
|
function resolveIn(values: Values, v: string | undefined): string {
|
|
@@ -163,9 +165,10 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
|
|
|
163
165
|
const section = ownStyle(byId.get(SECTION_STYLE) as ElementStyle);
|
|
164
166
|
const iconColour = ownStyle(byId.get(ICON_STYLE) as ElementStyle)['color'];
|
|
165
167
|
const bodyWeight = ownStyle(byId.get(BODY_STYLE) as ElementStyle)['fontWeight'];
|
|
168
|
+
const valuesIn = schemeTokenResolver(rows, mode);
|
|
166
169
|
|
|
167
170
|
for (const schemeId of SCHEME_IDS) {
|
|
168
|
-
const values =
|
|
171
|
+
const values = valuesIn(schemeId);
|
|
169
172
|
const pageInk = parseCssColour(values['text']);
|
|
170
173
|
const page = paintColours(values['page-bg'], pageInk);
|
|
171
174
|
const sectionPaint = paintColours(values['section-bg'], pageInk);
|
|
@@ -173,15 +176,23 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
|
|
|
173
176
|
? sectionPaint.map(c => (c.a < 1 ? compositeOver(c, page[0] ?? WHITE) : c))
|
|
174
177
|
: page;
|
|
175
178
|
const sectionInk = parseCssColour(resolveIn(values, section['color']), pageInk);
|
|
179
|
+
// What an ink-scoped element's Icon paints depends on the scheme alone, never the box: resolved once per scheme.
|
|
180
|
+
const scopedIcon = new Map<string, string>();
|
|
181
|
+
const iconIn = (styleId: string) => {
|
|
182
|
+
let v = scopedIcon.get(styleId);
|
|
183
|
+
if (v === undefined) scopedIcon.set(styleId, v = resolveIn(inkScoped(values, styleId), iconColour));
|
|
184
|
+
return v;
|
|
185
|
+
};
|
|
176
186
|
|
|
177
187
|
for (const box of containers) {
|
|
178
188
|
const boxStyle = box ? ownStyle(box) : null;
|
|
179
189
|
const bgs = boxStyle ? overAll(paintColours(resolveIn(values, boxStyle['backgroundColor']), sectionInk), ground) : ground;
|
|
180
190
|
const boxInk = boxStyle?.['color'] && boxStyle['color'] !== 'inherit'
|
|
181
191
|
? parseCssColour(resolveIn(values, boxStyle['color']), sectionInk) : sectionInk;
|
|
182
|
-
const
|
|
192
|
+
const container = box?.id ?? SECTION;
|
|
193
|
+
// A plain literal, one shape for every finding (a `{ ...where }` spread here was a fifth of the sweep's time).
|
|
183
194
|
const record = (element: string, part: string, fg: string, bg: string, ratio: number, min: number) =>
|
|
184
|
-
findings.push({
|
|
195
|
+
findings.push({ scheme: schemeId, container, element, part, fg, bg, ratio: Math.round(ratio * 100) / 100, min, pass: ratio >= min - 1e-9 });
|
|
185
196
|
const check = (element: string, part: string, fg: Rgba | null, under: Rgba[], min: number) => {
|
|
186
197
|
if (!fg) return;
|
|
187
198
|
for (const g of under) {
|
|
@@ -223,7 +234,7 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
|
|
|
223
234
|
if (state === 'selected' && (e.selected as StyleMap | undefined)?.['backgroundColor']) for (const f of fill) check(e.id, 'selected mark', f, bgs, WCAG_AA_UI);
|
|
224
235
|
// What a filled element HOLDS (inkScopes): a button's or a badge's icon reads its ink.
|
|
225
236
|
if (state === 'base' && INK_SCOPES.some(sc => sc.styles.includes(e.id))) {
|
|
226
|
-
check(e.id, 'icon', parseCssColour(
|
|
237
|
+
check(e.id, 'icon', parseCssColour(iconIn(e.id), ink), under, WCAG_AA_UI);
|
|
227
238
|
}
|
|
228
239
|
// Every focus ring an element style draws, on every ground the element sits on (CC4b: a Segmented
|
|
229
240
|
// option on its track — not only the buttons).
|
|
@@ -260,8 +271,8 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
|
|
|
260
271
|
}
|
|
261
272
|
}
|
|
262
273
|
}
|
|
263
|
-
findings.push(...schemedContainerFindings(
|
|
264
|
-
for (const scrim of SCRIMS) findings.push(...scrimFindings(
|
|
274
|
+
findings.push(...schemedContainerFindings(valuesIn, section, containers.filter((c): c is ElementStyle => !!c)));
|
|
275
|
+
for (const scrim of SCRIMS) findings.push(...scrimFindings(valuesIn, scrim, byId.get(scrim.style)));
|
|
265
276
|
return findings;
|
|
266
277
|
}
|
|
267
278
|
|
|
@@ -279,13 +290,12 @@ function sectionGround(values: Values): Rgba[] {
|
|
|
279
290
|
* section's (what it does not set, it inherits); a translucent fill composites over the OUTER section; the running text it holds (`body`, `lead`, a label: `color: inherit`)
|
|
280
291
|
* reads the scheme's ink, which is what the scheme-ink rule and `withSchemeInk` make CSS compute.
|
|
281
292
|
*/
|
|
282
|
-
function schemedContainerFindings(
|
|
283
|
-
containers: ReadonlyArray<ElementStyle>): ContrastFinding[] {
|
|
293
|
+
function schemedContainerFindings(valuesIn: SchemeValues, section: StyleMap, containers: ReadonlyArray<ElementStyle>): ContrastFinding[] {
|
|
284
294
|
const out: ContrastFinding[] = [];
|
|
285
295
|
for (const outer of SCHEME_IDS) {
|
|
286
|
-
const ground = sectionGround(
|
|
296
|
+
const ground = sectionGround(valuesIn(outer));
|
|
287
297
|
for (const inner of SCHEME_IDS.filter(id => id !== DEFAULT_SCHEME)) {
|
|
288
|
-
const values =
|
|
298
|
+
const values = valuesIn([outer, inner]);
|
|
289
299
|
const schemeInk = parseCssColour(resolveIn(values, SCHEME_INK), parseCssColour(resolveIn(values, section['color'])));
|
|
290
300
|
for (const box of containers) {
|
|
291
301
|
const style = ownStyle(box);
|
|
@@ -310,8 +320,8 @@ function schemedContainerFindings(rows: ReadonlyArray<DesignTokenLike>, mode: Re
|
|
|
310
320
|
/** Text over an image: the block's ink — and every token its ink scope pins to it — over the scrim
|
|
311
321
|
* composited on the WORST-CASE image, in the scheme the block wears. Never over the section: the image
|
|
312
322
|
* covers it. */
|
|
313
|
-
function scrimFindings(
|
|
314
|
-
const values =
|
|
323
|
+
function scrimFindings(valuesIn: SchemeValues, scrim: Scrim, style: ElementStyle | undefined): ContrastFinding[] {
|
|
324
|
+
const values = valuesIn(scrim.scheme);
|
|
315
325
|
const layer = parseCssColour(values[scrim.token]);
|
|
316
326
|
const image = parseCssColour(scrim.image);
|
|
317
327
|
if (!style || !layer || !image) return [];
|
|
@@ -13,6 +13,23 @@ export enum LocaleDirection {
|
|
|
13
13
|
/** The languages written right to left (their BCP 47 language subtags). */
|
|
14
14
|
export const RTL_LANGUAGES: ReadonlySet<string> = new Set(['ar', 'ckb', 'dv', 'fa', 'he', 'iw', 'ps', 'sd', 'ug', 'ur', 'yi']);
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* The languages whose script has NO letter case (their BCP 47 language subtags): every right-to-left language (Hebrew,
|
|
18
|
+
* Arabic and the Arabic-script languages, Thaana) plus the common caseless scripts of Asia and Ethiopia. In them
|
|
19
|
+
* `text-transform: uppercase` touches only the Latin words a label borrows ("המשך עם GOOGLE", vectoriox/iox-ui#124) and
|
|
20
|
+
* letter-spacing opens up letters their typography never spaces — so the look's case and tracking tokens stand down
|
|
21
|
+
* (design-core `CASELESS_SCRIPT_OVERRIDES`, emitted by `compileTokenCss`).
|
|
22
|
+
*/
|
|
23
|
+
export const CASELESS_LANGUAGES: ReadonlySet<string> = new Set([
|
|
24
|
+
...RTL_LANGUAGES,
|
|
25
|
+
'am', 'bn', 'gu', 'hi', 'ja', 'km', 'kn', 'ko', 'lo', 'ml', 'mr', 'my', 'ne', 'pa', 'si', 'ta', 'te', 'th', 'zh',
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** True when `locale`'s language is written in a script without letter case (`he-IL`, `ar`, `ja`…). */
|
|
29
|
+
export function isCaselessLocale(locale: string | null | undefined): boolean {
|
|
30
|
+
return CASELESS_LANGUAGES.has(languageOf(locale));
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
/** The language subtag of a locale (`he-IL` → `he`, `pt_BR` → `pt`), lower-cased; '' when there is none. */
|
|
17
34
|
export function languageOf(locale: string | null | undefined): string {
|
|
18
35
|
return String(locale ?? '').trim().split(/[-_]/)[0].toLowerCase();
|