@vectoriox/iox-builder 4.19.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, 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';
|
|
@@ -139,7 +139,21 @@ const TARGETED_STATES = ['trigger-hover'];
|
|
|
139
139
|
const TARGETED_STATE_BASE = {
|
|
140
140
|
'trigger-hover': 'hover',
|
|
141
141
|
};
|
|
142
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Design-time validation states (forms-and-inputs-plan.md Part 2, board 7 — "the failure
|
|
144
|
+
* design"). Not real CSS pseudo-classes: `IoxFieldComponent` already carries `.iox-invalid`/
|
|
145
|
+
* `.iox-valid` host classes it sets from `forceInvalid`/`showValid` (decision D5), so authoring
|
|
146
|
+
* "Wrong"/"Accepted" styles compiles to a CLASS-compound selector, not `:state`. Currently only
|
|
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.
|
|
152
|
+
*/
|
|
153
|
+
const VALIDATION_STATES = [...VALIDATION_STATES$1];
|
|
154
|
+
/** The host class each validation state maps to. */
|
|
155
|
+
const VALIDATION_STATE_CLASS = VALIDATION_STATE_CLASS$1;
|
|
156
|
+
const SUPPORTED_STATES = [...INTERACTION_STATES, ...STRUCTURAL_STATES, ...RELATIONAL_STATES, ...TARGETED_STATES, ...VALIDATION_STATES];
|
|
143
157
|
/**
|
|
144
158
|
* Build a full StyleTraitGroup[] schema populated with values from a flat
|
|
145
159
|
* styleProps map. Used when editing a preset in the Style panel — the panel
|
|
@@ -3619,6 +3633,28 @@ class StyleRegistryService {
|
|
|
3619
3633
|
this.rules.delete(nodeId);
|
|
3620
3634
|
this.flush();
|
|
3621
3635
|
}
|
|
3636
|
+
/**
|
|
3637
|
+
* Write or clear the styles for one PART of a compound component (board 7 — "the failure
|
|
3638
|
+
* design"), optionally further scoped to a validation state ('wrong'/'accepted'). Compiles
|
|
3639
|
+
* through the exact same `compile()` every other rule uses — `buildPartSelector` (shared,
|
|
3640
|
+
* `@vectoriox/iox-ui`) just builds a different selector string. Unlike interaction/relational/
|
|
3641
|
+
* targeted states, a validation state compounds a CLASS onto the node (`.iox-invalid`), not a
|
|
3642
|
+
* `:pseudo-class`, since `IoxFieldComponent` sets that class itself from `forceInvalid`/
|
|
3643
|
+
* `showValid` — there is no real "wrong" pseudo-class to hook.
|
|
3644
|
+
*/
|
|
3645
|
+
upsertPart(nodeId, partClassName, styles, state) {
|
|
3646
|
+
if (!nodeId || !partClassName)
|
|
3647
|
+
return;
|
|
3648
|
+
const key = `${nodeId}:part:${partClassName}${state ? ':' + state : ''}`;
|
|
3649
|
+
const validationClass = state ? VALIDATION_STATE_CLASS[state] : undefined;
|
|
3650
|
+
const selector = buildPartSelector(nodeId, partClassName, validationClass);
|
|
3651
|
+
const css = Object.keys(styles).length ? this.compile(selector, styles) : '';
|
|
3652
|
+
if (css)
|
|
3653
|
+
this.rules.set(key, css);
|
|
3654
|
+
else
|
|
3655
|
+
this.rules.delete(key);
|
|
3656
|
+
this.flush();
|
|
3657
|
+
}
|
|
3622
3658
|
/**
|
|
3623
3659
|
* Emit (or clear) a node's breakpoint rules. `planResponsiveRules` — shared with the SSR engine —
|
|
3624
3660
|
* decides what each breakpoint emits; this only turns it into selectors, through the SAME
|
|
@@ -3704,6 +3740,13 @@ class StyleRegistryService {
|
|
|
3704
3740
|
const base = RELATIONAL_STATE_BASE[state];
|
|
3705
3741
|
return relativeToId && base ? `iox-node-${relativeToId}:${base} .iox-node-${nodeId}` : null;
|
|
3706
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);
|
|
3707
3750
|
// Structural pseudo-classes (first-child, last-child, nth-child) target the
|
|
3708
3751
|
// outer wrapper element so they participate correctly in grid/flex layout.
|
|
3709
3752
|
const prefix = STRUCTURAL_STATES.includes(state) ? 'iox-outer' : 'iox-node';
|
|
@@ -4511,6 +4554,22 @@ class RenderDirective {
|
|
|
4511
4554
|
}
|
|
4512
4555
|
// Breakpoint layers — AFTER the state loop, so every scope resolved above is recorded.
|
|
4513
4556
|
this.styleRegistry.upsertResponsive(cssId, initialStyle, node.stateStyles, node.responsive);
|
|
4557
|
+
// Part styles (board 7 — "the failure design"). Simpler than the state loop above:
|
|
4558
|
+
// a part+state combo always compounds onto THIS node (no relational/targeted scope
|
|
4559
|
+
// to resolve), so every entry just needs its base plus each of its own state overrides.
|
|
4560
|
+
const partStyles = node.partStyles;
|
|
4561
|
+
if (partStyles) {
|
|
4562
|
+
for (const [partKey, part] of Object.entries(partStyles)) {
|
|
4563
|
+
const className = partClassName(node.type, partKey);
|
|
4564
|
+
if (!className)
|
|
4565
|
+
continue;
|
|
4566
|
+
const base = part.styleProps ?? {};
|
|
4567
|
+
this.styleRegistry.upsertPart(cssId, className, composeVirtualTraits(base));
|
|
4568
|
+
for (const [state, stateMap] of Object.entries(part.stateStyles ?? {})) {
|
|
4569
|
+
this.styleRegistry.upsertPart(cssId, className, composeVirtualTraits(stateMap, base), state);
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4514
4573
|
}
|
|
4515
4574
|
// Set nodeId — declared as @Input() on every builder component.
|
|
4516
4575
|
if (cssId) {
|
|
@@ -9735,6 +9794,20 @@ class GalleryConfig extends ComponentConfig {
|
|
|
9735
9794
|
}
|
|
9736
9795
|
}
|
|
9737
9796
|
|
|
9797
|
+
/**
|
|
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`.
|
|
9803
|
+
*/
|
|
9804
|
+
const FIELD_PARTS = [
|
|
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'] },
|
|
9810
|
+
];
|
|
9738
9811
|
/** Every style group — the state blocks and field group are ordinary containers to style. */
|
|
9739
9812
|
const fullStyles = () => buildFullStyleTraits();
|
|
9740
9813
|
/** Layout-ish groups for a form shell: it arranges fields, it is not text. */
|
|
@@ -9815,6 +9888,7 @@ class FormComponentConfig extends ComponentConfig {
|
|
|
9815
9888
|
class FieldComponentConfig extends ComponentConfig {
|
|
9816
9889
|
constructor() {
|
|
9817
9890
|
super('Field', 'iox-field', 'ph-thin ph-text-box', 'Forms');
|
|
9891
|
+
this.parts = FIELD_PARTS;
|
|
9818
9892
|
this.traits = [
|
|
9819
9893
|
new TraitConfig('__contentLabel', 'Content', TraitInputType.SectionLabel),
|
|
9820
9894
|
new TraitConfig('label', 'Label', TraitInputType.Text, undefined, 'Label'),
|
|
@@ -10369,5 +10443,5 @@ class BuilderSpacerComponentConfig extends ComponentConfig {
|
|
|
10369
10443
|
* Generated bundle index. Do not edit.
|
|
10370
10444
|
*/
|
|
10371
10445
|
|
|
10372
|
-
export { ACTION_TYPE_OPTIONS, AuditCode, AuditPanelComponent, AuditSeverity, BODY_CRUMB_LABEL, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, BUILDER_CHROME_EN, BackgroundGroupStyleConfig, BorderGroupStyleConfig, BreadcrumbBarComponent, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderClipboardService, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDataSourceService, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderHistoryService, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderListComponentConfig, BuilderListItemComponentConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ChildLayoutGroupStyleConfig, ComponentConfig, ComponentRegistryService, DEFAULT_ESSENTIAL_TRAITS, DRAG_HANDLE_ATTR, DataSourceRegistryService, DataSourceType, DimensionsGroupStyleConfig, DragEngineService, EASING_OPTIONS$1 as EASING_OPTIONS, ESSENTIAL_TRAITS_BY_TYPE, EffectsGroupStyleConfig, FORM_PRESETS, FORM_TYPE, FieldComponentConfig, FieldGroupComponentConfig, FormComponentConfig, FormErrorComponentConfig, FormStateService, FormSuccessComponentConfig, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_BUILDER_LABELS, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LAYOUT_PRESETS, LayerTreeComponent, LayoutGroupStyleConfig, ListGroupStyleConfig, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, PositionGroupStyleConfig, PresetRegistryService, RELATIONAL_STATES, RELATIONAL_STATE_BASE, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, STRUCTURAL_STATES, SUPPORTED_STATES, SectionComponent, SectionComponentConfig, SizeGroupStyleConfig, SliderContainerComponent, SliderContainerConfig, SliderSlideComponent, SliderSlideConfig, SpacingGroupStyleConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, SubmitButtonComponentConfig, SymbolRegistryService, TARGETED_STATES, TARGETED_STATE_BASE, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, TypographyGroupStyleConfig, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, ViewportService, ZOOM_OPTIONS, arrayItemSchemaFields, arraySchemaFields, auditNodes, buildFormPreset, buildFullStyleTraits, buildLayoutPreset, buildPresetStyleTraits, canFluidise, collapseColumnsProps, columnCountOf, defaultBuilderLabels, defaultPageSettings, dropTargetLabel, essentialTraitsFor, findNodeLocation, findParentOf, flattenSchemaFields, fluidiseProps, generateNodeId, isHiddenAt, matchesControlSearch, nearestFormNode, nodeAncestorPath, nodeAncestorPathInEither, reorderProps, resolveInsertTarget, resolveTraitControllerType, resolveTraitOptions, setStyleTrait, stackChildrenProps, summarise, visibilityProps, wrapNode };
|
|
10446
|
+
export { ACTION_TYPE_OPTIONS, AuditCode, AuditPanelComponent, AuditSeverity, BODY_CRUMB_LABEL, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, BUILDER_CHROME_EN, BackgroundGroupStyleConfig, BorderGroupStyleConfig, BreadcrumbBarComponent, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderClipboardService, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDataSourceService, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderHistoryService, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderListComponentConfig, BuilderListItemComponentConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ChildLayoutGroupStyleConfig, ComponentConfig, ComponentRegistryService, DEFAULT_ESSENTIAL_TRAITS, DRAG_HANDLE_ATTR, DataSourceRegistryService, DataSourceType, DimensionsGroupStyleConfig, DragEngineService, EASING_OPTIONS$1 as EASING_OPTIONS, ESSENTIAL_TRAITS_BY_TYPE, EffectsGroupStyleConfig, FIELD_PARTS, FORM_PRESETS, FORM_TYPE, FieldComponentConfig, FieldGroupComponentConfig, FormComponentConfig, FormErrorComponentConfig, FormStateService, FormSuccessComponentConfig, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_BUILDER_LABELS, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LAYOUT_PRESETS, LayerTreeComponent, LayoutGroupStyleConfig, ListGroupStyleConfig, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, PositionGroupStyleConfig, PresetRegistryService, RELATIONAL_STATES, RELATIONAL_STATE_BASE, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, STRUCTURAL_STATES, SUPPORTED_STATES, SectionComponent, SectionComponentConfig, SizeGroupStyleConfig, SliderContainerComponent, SliderContainerConfig, SliderSlideComponent, SliderSlideConfig, SpacingGroupStyleConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, SubmitButtonComponentConfig, SymbolRegistryService, TARGETED_STATES, TARGETED_STATE_BASE, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, TypographyGroupStyleConfig, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, VALIDATION_STATES, VALIDATION_STATE_CLASS, ViewportService, ZOOM_OPTIONS, arrayItemSchemaFields, arraySchemaFields, auditNodes, buildFormPreset, buildFullStyleTraits, buildLayoutPreset, buildPresetStyleTraits, canFluidise, collapseColumnsProps, columnCountOf, defaultBuilderLabels, defaultPageSettings, dropTargetLabel, essentialTraitsFor, findNodeLocation, findParentOf, flattenSchemaFields, fluidiseProps, generateNodeId, isHiddenAt, matchesControlSearch, nearestFormNode, nodeAncestorPath, nodeAncestorPathInEither, reorderProps, resolveInsertTarget, resolveTraitControllerType, resolveTraitOptions, setStyleTrait, stackChildrenProps, summarise, visibilityProps, wrapNode };
|
|
10373
10447
|
//# sourceMappingURL=vectoriox-iox-builder.mjs.map
|