@vectoriox/iox-ui 5.23.0 → 5.25.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/design-core/index.d.ts +53 -15
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +79 -21
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +81 -14
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/index.d.ts +35 -3
- package/package.json +1 -1
- package/src/design-core/design-apply.ts +57 -12
- package/src/design-core/flavor-seed.ts +40 -11
|
@@ -5260,13 +5260,76 @@ function partClassName(type, partKey) {
|
|
|
5260
5260
|
*/
|
|
5261
5261
|
/** Background fallback when a gradient/image type is selected but its value is empty. */
|
|
5262
5262
|
const EMPTY_BACKGROUND = '#fff';
|
|
5263
|
-
/** The
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5263
|
+
/** The three page-style fields a design-system page can inherit from the look. */
|
|
5264
|
+
var PageStyleField;
|
|
5265
|
+
(function (PageStyleField) {
|
|
5266
|
+
PageStyleField["Background"] = "background";
|
|
5267
|
+
PageStyleField["TextColor"] = "textColor";
|
|
5268
|
+
PageStyleField["FontFamily"] = "fontFamily";
|
|
5269
|
+
})(PageStyleField || (PageStyleField = {}));
|
|
5270
|
+
/** Where a page-style field's value comes from. */
|
|
5271
|
+
var PageStyleSource;
|
|
5272
|
+
(function (PageStyleSource) {
|
|
5273
|
+
/** The page sets it itself. */
|
|
5274
|
+
PageStyleSource["Own"] = "own";
|
|
5275
|
+
/** A design-system page that sets nothing wears the look's token. */
|
|
5276
|
+
PageStyleSource["Look"] = "look";
|
|
5277
|
+
/** A page without the flag that sets nothing: the consumer's own default shows through. */
|
|
5278
|
+
PageStyleSource["Unset"] = "unset";
|
|
5279
|
+
})(PageStyleSource || (PageStyleSource = {}));
|
|
5280
|
+
/** The token a design-system page falls back to, per field (spec tokens only). */
|
|
5281
|
+
const PAGE_STYLE_TOKENS = {
|
|
5282
|
+
[PageStyleField.Background]: 'page-bg',
|
|
5283
|
+
[PageStyleField.TextColor]: 'text',
|
|
5284
|
+
[PageStyleField.FontFamily]: 'font-body',
|
|
5285
|
+
};
|
|
5286
|
+
/** The CSS property each field compiles to when it falls back (`page-bg` is a PAINT, so the shorthand). */
|
|
5287
|
+
const FIELD_CSS_KEY = {
|
|
5288
|
+
[PageStyleField.Background]: 'background',
|
|
5289
|
+
[PageStyleField.TextColor]: 'color',
|
|
5290
|
+
[PageStyleField.FontFamily]: 'font-family',
|
|
5291
|
+
};
|
|
5292
|
+
const tokenVar = (name) => `var(--iox-${name})`;
|
|
5293
|
+
/** The token fallbacks of a design-system page, as CSS declarations. */
|
|
5294
|
+
const PAGE_TOKEN_FALLBACKS = Object.fromEntries(Object.values(PageStyleField).map(f => [FIELD_CSS_KEY[f], tokenVar(PAGE_STYLE_TOKENS[f])]));
|
|
5295
|
+
/** What each field clears to when it goes back to the look — '' (never a copied literal), so it keeps
|
|
5296
|
+
* following every future look. Background clears its image and gradient with it: they are one ground. */
|
|
5297
|
+
const FIELD_RESET = {
|
|
5298
|
+
[PageStyleField.Background]: { backgroundColor: '', backgroundGradient: '', backgroundImage: '', backgroundType: 'solid' },
|
|
5299
|
+
[PageStyleField.TextColor]: { textColor: '' },
|
|
5300
|
+
[PageStyleField.FontFamily]: { fontFamily: '' },
|
|
5268
5301
|
};
|
|
5269
5302
|
const BACKGROUND_KEYS = ['background', 'background-color'];
|
|
5303
|
+
/** The keys a field's OWN value compiles to — background has two (a flat colour, or a paint). */
|
|
5304
|
+
const FIELD_OWN_KEYS = {
|
|
5305
|
+
[PageStyleField.Background]: BACKGROUND_KEYS,
|
|
5306
|
+
[PageStyleField.TextColor]: ['color'],
|
|
5307
|
+
[PageStyleField.FontFamily]: ['font-family'],
|
|
5308
|
+
};
|
|
5309
|
+
/**
|
|
5310
|
+
* Where each page-style field comes from — decided by the SAME compile the renderers run, so the
|
|
5311
|
+
* Page panel can never say "from the look" for a field the canvas paints from the page, or the other
|
|
5312
|
+
* way round. A flagged page's empty field is the look's token; an unflagged page's is `Unset`.
|
|
5313
|
+
*/
|
|
5314
|
+
function describePageStyle(style, options = {}) {
|
|
5315
|
+
const own = compileOwnStyle(style);
|
|
5316
|
+
const describe = (field) => {
|
|
5317
|
+
if (FIELD_OWN_KEYS[field].some(k => k in own))
|
|
5318
|
+
return { field, source: PageStyleSource.Own, token: null };
|
|
5319
|
+
return options.designSystem
|
|
5320
|
+
? { field, source: PageStyleSource.Look, token: PAGE_STYLE_TOKENS[field] }
|
|
5321
|
+
: { field, source: PageStyleSource.Unset, token: null };
|
|
5322
|
+
};
|
|
5323
|
+
return {
|
|
5324
|
+
[PageStyleField.Background]: describe(PageStyleField.Background),
|
|
5325
|
+
[PageStyleField.TextColor]: describe(PageStyleField.TextColor),
|
|
5326
|
+
[PageStyleField.FontFamily]: describe(PageStyleField.FontFamily),
|
|
5327
|
+
};
|
|
5328
|
+
}
|
|
5329
|
+
/** The style with one field handed back to the look: cleared to '', every other key kept. */
|
|
5330
|
+
function resetPageStyleField(style, field) {
|
|
5331
|
+
return { ...(style ?? {}), ...FIELD_RESET[field] };
|
|
5332
|
+
}
|
|
5270
5333
|
/**
|
|
5271
5334
|
* Compile page style settings into CSS declarations.
|
|
5272
5335
|
*
|
|
@@ -5280,14 +5343,16 @@ function compilePageStyle(style, options = {}) {
|
|
|
5280
5343
|
const css = compileOwnStyle(style);
|
|
5281
5344
|
if (!options.designSystem)
|
|
5282
5345
|
return css;
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
if (!('font-family' in css))
|
|
5288
|
-
css['font-family'] = PAGE_TOKEN_FALLBACKS['font-family'];
|
|
5346
|
+
for (const field of Object.values(PageStyleField)) {
|
|
5347
|
+
if (!FIELD_OWN_KEYS[field].some(k => k in css))
|
|
5348
|
+
css[FIELD_CSS_KEY[field]] = tokenVar(PAGE_STYLE_TOKENS[field]);
|
|
5349
|
+
}
|
|
5289
5350
|
return css;
|
|
5290
5351
|
}
|
|
5352
|
+
/** A value only the `background` shorthand can carry: a `var()` (which may hold a gradient) or a gradient. */
|
|
5353
|
+
function isPaint(value) {
|
|
5354
|
+
return /var\(|gradient\(/i.test(value);
|
|
5355
|
+
}
|
|
5291
5356
|
/** What the page itself sets — the only thing a page without the design-system flag compiles to. */
|
|
5292
5357
|
function compileOwnStyle(style) {
|
|
5293
5358
|
if (!style)
|
|
@@ -5307,9 +5372,11 @@ function compileOwnStyle(style) {
|
|
|
5307
5372
|
: EMPTY_BACKGROUND;
|
|
5308
5373
|
break;
|
|
5309
5374
|
default:
|
|
5310
|
-
// 'solid' and legacy pages with no type at all.
|
|
5375
|
+
// 'solid' and legacy pages with no type at all. A token reference or a gradient is a
|
|
5376
|
+
// PAINT (page-bg is a gradient stack in Glass and Midnight): `background-color` would be
|
|
5377
|
+
// invalid at computed-value time and the page would lose its ground.
|
|
5311
5378
|
if (style.backgroundColor)
|
|
5312
|
-
css['background-color'] = style.backgroundColor;
|
|
5379
|
+
css[isPaint(style.backgroundColor) ? 'background' : 'background-color'] = style.backgroundColor;
|
|
5313
5380
|
break;
|
|
5314
5381
|
}
|
|
5315
5382
|
return css;
|
|
@@ -7100,5 +7167,5 @@ function effectiveTransitionId(anim) {
|
|
|
7100
7167
|
* Generated bundle index. Do not edit.
|
|
7101
7168
|
*/
|
|
7102
7169
|
|
|
7103
|
-
export { AOSService, BACKDROP_TWIN_KEY, BACKDROP_WHOLE_KEY, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CONTAINER_HTML_TAGS, CONTEXT_ACTION_TYPES, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ContainerComponent, ContextStore, DEFAULT_GALLERY_SCHEDULER, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_PHOSPHOR_WEIGHT, DEFAULT_WIDTH_BY_TYPE, DeclarationContext, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, HOVER_DEFAULT_TRANSITION, HOVER_STATES, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxDialogComponent, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LEGACY_HOVER_TRANSITION, LinkedContainerComponent, PAGE_TOKEN_FALLBACKS, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, RESERVED_ALIAS_PREFIX, STATE_PSEUDO_CLASS, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_RESPONSIVE_TRAITS, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VALIDATION_STATES, VALIDATION_STATE_CLASS, VIRTUAL_TRAIT_GROUPS, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, activeActions, applyBindingPipes, applyFeel, breakpointDef, breakpointForWidth, breakpointQueryFor, buildDataSourceFilter, buildPartSelector, buildRelatedFilter, buildSwiperBreakpoints, buildTargetedStateSelector, buildTransitionTimeline, cascadeChain, clearInputOverride, clearOverride, collectContextSlotKeys, collectReferencedAliases, compileDeclarations, compilePageStyle, composeVirtualTraits, computeRelative, containerHtmlTag, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, decomposeBackdropFilter, defaultHoverTransition, defaultMessageResolver, deriveSeoFromContent, describeSeoFields, effectiveTransitionId, excludeSelf, feelFor, getByPath, getSeoValue, hasHoverState, hasOwnTransition, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, isWholeBackdropSet, legacyEnterToTransition, matchRouteParams, mediaQueryFor, mergeSwiperBreakpoints, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, normalizeGalleryImage, normalizeIconClass, parentBreakpoint, parseUrlList, partClassName, planDataSource, planResponsiveRules, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resetSeoField, resolveBoundValue, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSeo, resolveSiblings, resolveSingleItemId, resolveStateStyles, resolveStyleProps, resolveValueChain, rewriteViewportUnits, safeSetInput, setInputOverride, setOverride, setSeoAuto, setSeoBinding, setSeoOverride, setSeoValue, stateNamesIn, statePseudoClass, stripSuppressedProps, variableAliases, variableItemsFrom, withContextSlots, withDefaultHoverTransition, wrapInBreakpointQuery, wrapInMediaQuery };
|
|
7170
|
+
export { AOSService, BACKDROP_TWIN_KEY, BACKDROP_WHOLE_KEY, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CONTAINER_HTML_TAGS, CONTEXT_ACTION_TYPES, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ContainerComponent, ContextStore, DEFAULT_GALLERY_SCHEDULER, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_PHOSPHOR_WEIGHT, DEFAULT_WIDTH_BY_TYPE, DeclarationContext, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, HOVER_DEFAULT_TRANSITION, HOVER_STATES, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxDialogComponent, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LEGACY_HOVER_TRANSITION, LinkedContainerComponent, PAGE_STYLE_TOKENS, PAGE_TOKEN_FALLBACKS, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, PageStyleField, PageStyleSource, RESERVED_ALIAS_PREFIX, STATE_PSEUDO_CLASS, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_RESPONSIVE_TRAITS, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VALIDATION_STATES, VALIDATION_STATE_CLASS, VIRTUAL_TRAIT_GROUPS, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, activeActions, applyBindingPipes, applyFeel, breakpointDef, breakpointForWidth, breakpointQueryFor, buildDataSourceFilter, buildPartSelector, buildRelatedFilter, buildSwiperBreakpoints, buildTargetedStateSelector, buildTransitionTimeline, cascadeChain, clearInputOverride, clearOverride, collectContextSlotKeys, collectReferencedAliases, compileDeclarations, compilePageStyle, composeVirtualTraits, computeRelative, containerHtmlTag, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, decomposeBackdropFilter, defaultHoverTransition, defaultMessageResolver, deriveSeoFromContent, describePageStyle, describeSeoFields, effectiveTransitionId, excludeSelf, feelFor, getByPath, getSeoValue, hasHoverState, hasOwnTransition, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, isWholeBackdropSet, legacyEnterToTransition, matchRouteParams, mediaQueryFor, mergeSwiperBreakpoints, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, normalizeGalleryImage, normalizeIconClass, parentBreakpoint, parseUrlList, partClassName, planDataSource, planResponsiveRules, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resetPageStyleField, resetSeoField, resolveBoundValue, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSeo, resolveSiblings, resolveSingleItemId, resolveStateStyles, resolveStyleProps, resolveValueChain, rewriteViewportUnits, safeSetInput, setInputOverride, setOverride, setSeoAuto, setSeoBinding, setSeoOverride, setSeoValue, stateNamesIn, statePseudoClass, stripSuppressedProps, variableAliases, variableItemsFrom, withContextSlots, withDefaultHoverTransition, wrapInBreakpointQuery, wrapInMediaQuery };
|
|
7104
7171
|
//# sourceMappingURL=vectoriox-iox-ui.mjs.map
|