@vectoriox/iox-builder 4.20.0 → 4.21.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.
|
@@ -16,7 +16,7 @@ import { SelectModule } from 'primeng/select';
|
|
|
16
16
|
import { TooltipModule } from 'primeng/tooltip';
|
|
17
17
|
import { DialogModule } from 'primeng/dialog';
|
|
18
18
|
import * as i18 from '@vectoriox/iox-ui';
|
|
19
|
-
import { DEFAULT_WIDTH_BY_TYPE, Breakpoint, BREAKPOINTS, countOverrides, setOverride, breakpointDef, breakpointForWidth, FormRenderState, safeSetInput, ContextStore, ComponentInstanceRegistryService, isActionEnabled, isContextAction, contextActionEffect, resolveContextValue, DeclarationContext, buildPartSelector, planResponsiveRules, resolveStyleProps, buildTargetedStateSelector, compileDeclarations, wrapInBreakpointQuery, BreakpointQueryKind, composeVirtualTraits, stateNamesIn, resolveInputs, setInputOverride, collectContextSlotKeys, withContextSlots, compilePageStyle, nodeUsesContext, resolveBoundValue, IS_PREVIEW, planDataSource, dataSourcePlanToRequest, normalizeCollectionResult, resolveRepeaterItems, getByPath, computeRelative, IoxPageModule } from '@vectoriox/iox-ui';
|
|
19
|
+
import { VALIDATION_STATES as VALIDATION_STATES$1, VALIDATION_STATE_CLASS as VALIDATION_STATE_CLASS$1, DEFAULT_WIDTH_BY_TYPE, Breakpoint, BREAKPOINTS, countOverrides, setOverride, breakpointDef, breakpointForWidth, FormRenderState, safeSetInput, ContextStore, ComponentInstanceRegistryService, isActionEnabled, isContextAction, contextActionEffect, resolveContextValue, DeclarationContext, buildPartSelector, planResponsiveRules, resolveStyleProps, buildTargetedStateSelector, compileDeclarations, wrapInBreakpointQuery, BreakpointQueryKind, composeVirtualTraits, stateNamesIn, partClassName, resolveInputs, setInputOverride, collectContextSlotKeys, withContextSlots, compilePageStyle, nodeUsesContext, resolveBoundValue, IS_PREVIEW, planDataSource, dataSourcePlanToRequest, normalizeCollectionResult, resolveRepeaterItems, getByPath, computeRelative, IoxPageModule, PART_CLASS_NAMES } from '@vectoriox/iox-ui';
|
|
20
20
|
export { ComponentInstanceRegistryService, VIRTUAL_TRAIT_KEYS, composeVirtualTraits } from '@vectoriox/iox-ui';
|
|
21
21
|
import Lenis from 'lenis';
|
|
22
22
|
import { Subject, BehaviorSubject, of, forkJoin } from 'rxjs';
|
|
@@ -145,13 +145,14 @@ const TARGETED_STATE_BASE = {
|
|
|
145
145
|
* `.iox-valid` host classes it sets from `forceInvalid`/`showValid` (decision D5), so authoring
|
|
146
146
|
* "Wrong"/"Accepted" styles compiles to a CLASS-compound selector, not `:state`. Currently only
|
|
147
147
|
* meaningful on Field (or any future component with the same host classes).
|
|
148
|
+
*
|
|
149
|
+
* Defined in `@vectoriox/iox-ui` (`style-compiler/parts.ts`), not here — the SSR engine needs
|
|
150
|
+
* this exact mapping too and does not depend on iox-builder. Re-exported for every existing
|
|
151
|
+
* `@vectoriox/iox-builder` consumer, so nothing importing from here needs to change.
|
|
148
152
|
*/
|
|
149
|
-
const VALIDATION_STATES = [
|
|
153
|
+
const VALIDATION_STATES = [...VALIDATION_STATES$1];
|
|
150
154
|
/** The host class each validation state maps to. */
|
|
151
|
-
const VALIDATION_STATE_CLASS =
|
|
152
|
-
wrong: 'iox-invalid',
|
|
153
|
-
accepted: 'iox-valid',
|
|
154
|
-
};
|
|
155
|
+
const VALIDATION_STATE_CLASS = VALIDATION_STATE_CLASS$1;
|
|
155
156
|
const SUPPORTED_STATES = [...INTERACTION_STATES, ...STRUCTURAL_STATES, ...RELATIONAL_STATES, ...TARGETED_STATES, ...VALIDATION_STATES];
|
|
156
157
|
/**
|
|
157
158
|
* Build a full StyleTraitGroup[] schema populated with values from a flat
|
|
@@ -3739,6 +3740,13 @@ class StyleRegistryService {
|
|
|
3739
3740
|
const base = RELATIONAL_STATE_BASE[state];
|
|
3740
3741
|
return relativeToId && base ? `iox-node-${relativeToId}:${base} .iox-node-${nodeId}` : null;
|
|
3741
3742
|
}
|
|
3743
|
+
// Validation states (wrong/accepted, board 7) are not real CSS pseudo-classes — `:wrong`
|
|
3744
|
+
// doesn't exist. Compound a CLASS instead, matching the host class IoxFieldComponent
|
|
3745
|
+
// already sets from forceInvalid/showValid. Reuses buildPartSelector with no part, since
|
|
3746
|
+
// "whole node, when wrong" is exactly that function's no-part case.
|
|
3747
|
+
const validationClass = VALIDATION_STATE_CLASS[state];
|
|
3748
|
+
if (validationClass)
|
|
3749
|
+
return buildPartSelector(nodeId, undefined, validationClass);
|
|
3742
3750
|
// Structural pseudo-classes (first-child, last-child, nth-child) target the
|
|
3743
3751
|
// outer wrapper element so they participate correctly in grid/flex layout.
|
|
3744
3752
|
const prefix = STRUCTURAL_STATES.includes(state) ? 'iox-outer' : 'iox-node';
|
|
@@ -4310,9 +4318,6 @@ const CONTAINER_TAGS = ['div', 'section', 'article', 'header', 'footer', 'main',
|
|
|
4310
4318
|
* </ng-container>
|
|
4311
4319
|
*/
|
|
4312
4320
|
class RenderDirective {
|
|
4313
|
-
/** type -> its declared parts (board 7), cached so partClassNameFor doesn't instantiate a
|
|
4314
|
-
* fresh ComponentConfig on every render — same precedent as the layer tree's own icon cache. */
|
|
4315
|
-
static { this.partsCache = new Map(); }
|
|
4316
4321
|
constructor(vcr, injector, envInjector, doc, registryService, overlayService, styleRegistry, interactionEngine, cdr, panelEventService, dragEngine) {
|
|
4317
4322
|
this.vcr = vcr;
|
|
4318
4323
|
this.injector = injector;
|
|
@@ -4400,19 +4405,6 @@ class RenderDirective {
|
|
|
4400
4405
|
* registry — at state-restore time the parent isn't registered yet, since it registers only
|
|
4401
4406
|
* AFTER rendering its children). Used to key relational (parent-hover) rules. (issue #1)
|
|
4402
4407
|
*/
|
|
4403
|
-
/** The stable class a declared part compiles against, e.g. ('Field', 'error') -> 'iox-field__error'.
|
|
4404
|
-
* Undefined when the type declares no such part (or no parts at all) — caller skips it. */
|
|
4405
|
-
partClassNameFor(type, partKey) {
|
|
4406
|
-
let byKey = RenderDirective.partsCache.get(type);
|
|
4407
|
-
if (!byKey) {
|
|
4408
|
-
const config = this.registryService.createConfig(type);
|
|
4409
|
-
byKey = {};
|
|
4410
|
-
for (const part of config?.parts ?? [])
|
|
4411
|
-
byKey[part.key] = part.className;
|
|
4412
|
-
RenderDirective.partsCache.set(type, byKey);
|
|
4413
|
-
}
|
|
4414
|
-
return byKey[partKey];
|
|
4415
|
-
}
|
|
4416
4408
|
resolveParentNodeId(childEl) {
|
|
4417
4409
|
let el = childEl?.parentElement ?? null;
|
|
4418
4410
|
while (el) {
|
|
@@ -4568,7 +4560,7 @@ class RenderDirective {
|
|
|
4568
4560
|
const partStyles = node.partStyles;
|
|
4569
4561
|
if (partStyles) {
|
|
4570
4562
|
for (const [partKey, part] of Object.entries(partStyles)) {
|
|
4571
|
-
const className =
|
|
4563
|
+
const className = partClassName(node.type, partKey);
|
|
4572
4564
|
if (!className)
|
|
4573
4565
|
continue;
|
|
4574
4566
|
const base = part.styleProps ?? {};
|
|
@@ -9803,18 +9795,18 @@ class GalleryConfig extends ComponentConfig {
|
|
|
9803
9795
|
}
|
|
9804
9796
|
|
|
9805
9797
|
/**
|
|
9806
|
-
* Field's styleable sub-elements (board 7 — "the failure design")
|
|
9807
|
-
*
|
|
9808
|
-
*
|
|
9809
|
-
* own base styling) is not listed here — the Style panel
|
|
9810
|
-
* choice, falling back to the node's ordinary `styleTraits`.
|
|
9798
|
+
* Field's styleable sub-elements (board 7 — "the failure design"), for the Style panel's picker.
|
|
9799
|
+
* Class names come from the SHARED `PART_CLASS_NAMES` (`@vectoriox/iox-ui`) — the same map the
|
|
9800
|
+
* SSR engine resolves a part's selector from — so the picker can never drift from what actually
|
|
9801
|
+
* gets compiled. "Whole field" (the node's own base styling) is not listed here — the Style panel
|
|
9802
|
+
* always offers it as the implicit first choice, falling back to the node's ordinary `styleTraits`.
|
|
9811
9803
|
*/
|
|
9812
9804
|
const FIELD_PARTS = [
|
|
9813
|
-
{ key: 'label', label: 'Label', className: '
|
|
9814
|
-
{ key: 'control', label: 'The box', className: '
|
|
9815
|
-
{ key: 'help', label: 'Note', className: '
|
|
9816
|
-
{ key: 'error', label: 'Error message', className: '
|
|
9817
|
-
{ key: 'required', label: 'Required mark', className: '
|
|
9805
|
+
{ key: 'label', label: 'Label', className: PART_CLASS_NAMES['Field']['label'] },
|
|
9806
|
+
{ key: 'control', label: 'The box', className: PART_CLASS_NAMES['Field']['control'] },
|
|
9807
|
+
{ key: 'help', label: 'Note', className: PART_CLASS_NAMES['Field']['help'] },
|
|
9808
|
+
{ key: 'error', label: 'Error message', className: PART_CLASS_NAMES['Field']['error'] },
|
|
9809
|
+
{ key: 'required', label: 'Required mark', className: PART_CLASS_NAMES['Field']['required'] },
|
|
9818
9810
|
];
|
|
9819
9811
|
/** Every style group — the state blocks and field group are ordinary containers to style. */
|
|
9820
9812
|
const fullStyles = () => buildFullStyleTraits();
|