@vectoriox/iox-ui 5.2.0 → 5.3.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/fesm2022/vectoriox-iox-ui.mjs +90 -1
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/index.d.ts +62 -2
- package/package.json +1 -1
|
@@ -4995,6 +4995,95 @@ function compileTokenCss(tokens) {
|
|
|
4995
4995
|
};
|
|
4996
4996
|
}
|
|
4997
4997
|
|
|
4998
|
+
/** trait → `var(--iox-<token>, <packValue>)` for one node type. Unknown type → {}. */
|
|
4999
|
+
function resolveFlavorDefaults(type, pack) {
|
|
5000
|
+
const map = pack?.defaults?.[type];
|
|
5001
|
+
if (!map)
|
|
5002
|
+
return {};
|
|
5003
|
+
const byName = new Map((pack.tokens ?? []).map(t => [t.name, t.value]));
|
|
5004
|
+
const out = {};
|
|
5005
|
+
for (const [trait, tokenName] of Object.entries(map)) {
|
|
5006
|
+
const fallback = byName.get(tokenName);
|
|
5007
|
+
if (fallback === undefined)
|
|
5008
|
+
continue; // validator fails the build; runtime stays safe
|
|
5009
|
+
out[trait] = `var(--iox-${tokenName}, ${fallback})`;
|
|
5010
|
+
}
|
|
5011
|
+
return out;
|
|
5012
|
+
}
|
|
5013
|
+
/**
|
|
5014
|
+
* The ENGINE's half of the cascade: kebab `prop: var(…)` declarations for every pack default
|
|
5015
|
+
* the node's persisted styleProps does NOT set. Appended beside renderDefaultDeclarations —
|
|
5016
|
+
* same guard-on-undefined discipline, so a node saved post-F1 (var already serialised via the
|
|
5017
|
+
* builder's trait defaults) is untouched, and a legacy node picks the pack default up at
|
|
5018
|
+
* render time. Node styleProps always wins.
|
|
5019
|
+
*/
|
|
5020
|
+
function flavorDefaultDeclarations(type, styleProps, pack) {
|
|
5021
|
+
const sp = styleProps ?? {};
|
|
5022
|
+
const out = [];
|
|
5023
|
+
for (const [trait, value] of Object.entries(resolveFlavorDefaults(type, pack))) {
|
|
5024
|
+
if (sp[trait] === undefined)
|
|
5025
|
+
out.push(`${styleKeyToKebab(trait)}: ${value}`);
|
|
5026
|
+
}
|
|
5027
|
+
return out;
|
|
5028
|
+
}
|
|
5029
|
+
/**
|
|
5030
|
+
* The CI gate (flavors plan §10 C4): a pack may only name types and traits that exist in the
|
|
5031
|
+
* live component registry, and tokens it defines itself. Returns human-readable errors; a
|
|
5032
|
+
* consumer spec feeds it the REAL registry and asserts [].
|
|
5033
|
+
*/
|
|
5034
|
+
function validateFlavorPack(pack, knownTraitsByType) {
|
|
5035
|
+
const errors = [];
|
|
5036
|
+
const tokenNames = new Set((pack.tokens ?? []).map(t => t.name));
|
|
5037
|
+
for (const t of pack.tokens ?? []) {
|
|
5038
|
+
if (!t.name)
|
|
5039
|
+
errors.push(`${pack.id}: token with empty name`);
|
|
5040
|
+
if (!t.value)
|
|
5041
|
+
errors.push(`${pack.id}: token "${t.name}" has no value`);
|
|
5042
|
+
}
|
|
5043
|
+
for (const [type, traits] of Object.entries(pack.defaults ?? {})) {
|
|
5044
|
+
const known = knownTraitsByType[type];
|
|
5045
|
+
if (!known) {
|
|
5046
|
+
errors.push(`${pack.id}: unknown component type "${type}"`);
|
|
5047
|
+
continue;
|
|
5048
|
+
}
|
|
5049
|
+
const knownSet = known instanceof Set ? known : new Set(known);
|
|
5050
|
+
for (const [trait, tokenName] of Object.entries(traits)) {
|
|
5051
|
+
if (!knownSet.has(trait))
|
|
5052
|
+
errors.push(`${pack.id}: "${type}" has no style trait "${trait}"`);
|
|
5053
|
+
if (!tokenNames.has(tokenName))
|
|
5054
|
+
errors.push(`${pack.id}: "${type}.${trait}" references undefined token "${tokenName}"`);
|
|
5055
|
+
if (/[:(]|^#|\d/.test(tokenName))
|
|
5056
|
+
errors.push(`${pack.id}: "${type}.${trait}" must name a token, not a value ("${tokenName}")`);
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
return errors;
|
|
5060
|
+
}
|
|
5061
|
+
/**
|
|
5062
|
+
* Swiss — the default pack (flavors plan §8: "the flavor that can never embarrass anyone").
|
|
5063
|
+
* Deliberately SMALL at F1: radius + control padding on the clickables, surface radius on Card.
|
|
5064
|
+
* Colour, type and motion arrive with the brand step (F2) — a colour default here would repaint
|
|
5065
|
+
* legacy pages before anyone chose anything.
|
|
5066
|
+
*/
|
|
5067
|
+
const SWISS_FLAVOR = {
|
|
5068
|
+
id: 'swiss',
|
|
5069
|
+
version: 1,
|
|
5070
|
+
label: 'Swiss',
|
|
5071
|
+
blurb: 'Grid discipline, hairline rules, near-zero motion.',
|
|
5072
|
+
tokens: [
|
|
5073
|
+
{ name: 'radius-control', value: '4px', type: 'size', group: 'radius' },
|
|
5074
|
+
{ name: 'radius-surface', value: '4px', type: 'size', group: 'radius' },
|
|
5075
|
+
{ name: 'space-control', value: '10px 18px', type: 'spacing', group: 'space' },
|
|
5076
|
+
{ name: 'space-stack', value: '12px', type: 'spacing', group: 'space' },
|
|
5077
|
+
],
|
|
5078
|
+
defaults: {
|
|
5079
|
+
Button: { borderRadius: 'radius-control', padding: 'space-control' },
|
|
5080
|
+
ButtonBlock: { borderRadius: 'radius-control', padding: 'space-control' },
|
|
5081
|
+
Card: { borderRadius: 'radius-surface' },
|
|
5082
|
+
},
|
|
5083
|
+
};
|
|
5084
|
+
/** What both renderers use until F2 lets an org choose. */
|
|
5085
|
+
const DEFAULT_FLAVOR = SWISS_FLAVOR;
|
|
5086
|
+
|
|
4998
5087
|
/**
|
|
4999
5088
|
* page-style — the ONE compiler that turns a page's style settings into CSS.
|
|
5000
5089
|
*
|
|
@@ -6832,5 +6921,5 @@ function effectiveTransitionId(anim) {
|
|
|
6832
6921
|
* Generated bundle index. Do not edit.
|
|
6833
6922
|
*/
|
|
6834
6923
|
|
|
6835
|
-
export { AOSService, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, 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, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, RESERVED_ALIAS_PREFIX, 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, compileTokenCss, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, defaultMessageResolver, deriveSeoFromContent, describeSeoFields, effectiveTransitionId, excludeSelf, feelFor, getByPath, getSeoValue, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, 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, stripSuppressedProps, styleKeyToKebab, tokensToDarkVarMap, tokensToVarMap, variableAliases, variableItemsFrom, withContextSlots, wrapInBreakpointQuery, wrapInMediaQuery };
|
|
6924
|
+
export { AOSService, BREAKPOINTS, Breakpoint, BreakpointQueryKind, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CONTEXT_ACTION_TYPES, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ContainerComponent, ContextStore, DEFAULT_FLAVOR, 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, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PART_CLASS_NAMES, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_RESPONSIVE_TRAITS, SWISS_FLAVOR, 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, compileTokenCss, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, defaultMessageResolver, deriveSeoFromContent, describeSeoFields, effectiveTransitionId, excludeSelf, feelFor, flavorDefaultDeclarations, getByPath, getSeoValue, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, legacyEnterToTransition, matchRouteParams, mediaQueryFor, mergeSwiperBreakpoints, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, normalizeGalleryImage, normalizeIconClass, parentBreakpoint, parseUrlList, partClassName, planDataSource, planResponsiveRules, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resetSeoField, resolveBoundValue, resolveContextValue, resolveDerivedInto, resolveFlavorDefaults, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSeo, resolveSiblings, resolveSingleItemId, resolveStateStyles, resolveStyleProps, resolveValueChain, rewriteViewportUnits, safeSetInput, setInputOverride, setOverride, setSeoAuto, setSeoBinding, setSeoOverride, setSeoValue, stateNamesIn, stripSuppressedProps, styleKeyToKebab, tokensToDarkVarMap, tokensToVarMap, validateFlavorPack, variableAliases, variableItemsFrom, withContextSlots, wrapInBreakpointQuery, wrapInMediaQuery };
|
|
6836
6925
|
//# sourceMappingURL=vectoriox-iox-ui.mjs.map
|