@vectoriox/iox-builder 4.1.2 → 4.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.
|
@@ -8534,6 +8534,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.31", ngImpo
|
|
|
8534
8534
|
/** Optional font manager. Provide from the host app to populate the fontFamily dropdown. */
|
|
8535
8535
|
const IOX_FONT_MANAGER = new InjectionToken('IOX_FONT_MANAGER');
|
|
8536
8536
|
|
|
8537
|
+
/**
|
|
8538
|
+
* STRUCTURE OPS (A4) — the one-click layout changes people actually make at a narrow width, as pure
|
|
8539
|
+
* "what to write" functions. Each returns a flat style map the caller stores in the node's
|
|
8540
|
+
* `responsive[bp]` layer (or in the base styles at Base) through the shared `setOverride`.
|
|
8541
|
+
*
|
|
8542
|
+
* All of it is ordinary CSS the SSR engine already renders — there is no second tree and no
|
|
8543
|
+
* per-width HTML. See responsive-breakpoints-plan.md (D5).
|
|
8544
|
+
*/
|
|
8545
|
+
/** CSS lengths that are a FIXED pixel size — the ones that stop a layout fitting a phone. */
|
|
8546
|
+
const PX_LENGTH = /^-?\d+(\.\d+)?px$/i;
|
|
8547
|
+
/**
|
|
8548
|
+
* Hide / show at a width. Hiding is `display: none` INSIDE that breakpoint's rules — the node stays
|
|
8549
|
+
* in the DOM and in the SSR output (one HTML document serves every width), so hidden content still
|
|
8550
|
+
* ships bytes and is still indexed. Showing again clears the override rather than guessing a value.
|
|
8551
|
+
*
|
|
8552
|
+
* @returns the props to write, or `null` meaning "clear the display override at this breakpoint".
|
|
8553
|
+
*/
|
|
8554
|
+
function visibilityProps(hidden) {
|
|
8555
|
+
return hidden ? { display: 'none' } : null;
|
|
8556
|
+
}
|
|
8557
|
+
/** True when this node is hidden by the resolved styles at some width. */
|
|
8558
|
+
function isHiddenAt(resolvedStyleProps) {
|
|
8559
|
+
return String(resolvedStyleProps?.['display'] ?? '') === 'none';
|
|
8560
|
+
}
|
|
8561
|
+
/**
|
|
8562
|
+
* Stack a container's children in one column — the most common mobile edit, and four separate
|
|
8563
|
+
* controls today (display, direction, wrap, columns). A grid becomes a single-column grid; anything
|
|
8564
|
+
* else becomes a column flex box.
|
|
8565
|
+
*/
|
|
8566
|
+
function stackChildrenProps(resolvedStyleProps) {
|
|
8567
|
+
const display = String(resolvedStyleProps?.['display'] ?? '');
|
|
8568
|
+
if (display === 'grid' || display === 'inline-grid') {
|
|
8569
|
+
return { gridTemplateColumns: 'repeat(1, minmax(0, 1fr))' };
|
|
8570
|
+
}
|
|
8571
|
+
return { display: 'flex', flexDirection: 'column', flexWrap: 'nowrap' };
|
|
8572
|
+
}
|
|
8573
|
+
/**
|
|
8574
|
+
* Collapse a grid to `count` columns (a flex row is stacked instead — it has no column track).
|
|
8575
|
+
* `count` is clamped to at least 1.
|
|
8576
|
+
*/
|
|
8577
|
+
function collapseColumnsProps(resolvedStyleProps, count) {
|
|
8578
|
+
const columns = Math.max(1, Math.floor(count));
|
|
8579
|
+
const display = String(resolvedStyleProps?.['display'] ?? '');
|
|
8580
|
+
if (display === 'grid' || display === 'inline-grid') {
|
|
8581
|
+
return { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` };
|
|
8582
|
+
}
|
|
8583
|
+
return columns === 1 ? stackChildrenProps(resolvedStyleProps) : { flexWrap: 'wrap' };
|
|
8584
|
+
}
|
|
8585
|
+
/** How many equal columns a `repeat(N, …)` track list describes, or null when it isn't one. */
|
|
8586
|
+
function columnCountOf(resolvedStyleProps) {
|
|
8587
|
+
const match = /^repeat\(\s*(\d+)\s*,/.exec(String(resolvedStyleProps?.['gridTemplateColumns'] ?? ''));
|
|
8588
|
+
return match ? Number(match[1]) : null;
|
|
8589
|
+
}
|
|
8590
|
+
/**
|
|
8591
|
+
* Make fixed pixel sizes fluid: `width: 520px` → `width: 100%` with the original kept as
|
|
8592
|
+
* `max-width`, so the element still never exceeds its designed size on a wide screen. `minWidth` in
|
|
8593
|
+
* px is dropped to 0 — it is what actually forces horizontal scrolling on a phone.
|
|
8594
|
+
*
|
|
8595
|
+
* @returns the props to write; EMPTY when there is nothing fixed to fluidise.
|
|
8596
|
+
*/
|
|
8597
|
+
function fluidiseProps(resolvedStyleProps) {
|
|
8598
|
+
const out = {};
|
|
8599
|
+
const width = String(resolvedStyleProps?.['width'] ?? '');
|
|
8600
|
+
const minWidth = String(resolvedStyleProps?.['minWidth'] ?? '');
|
|
8601
|
+
if (PX_LENGTH.test(width)) {
|
|
8602
|
+
out['width'] = '100%';
|
|
8603
|
+
const maxWidth = String(resolvedStyleProps?.['maxWidth'] ?? '');
|
|
8604
|
+
if (!maxWidth || maxWidth === 'none')
|
|
8605
|
+
out['maxWidth'] = width;
|
|
8606
|
+
}
|
|
8607
|
+
if (PX_LENGTH.test(minWidth) && parseFloat(minWidth) > 0)
|
|
8608
|
+
out['minWidth'] = '0px';
|
|
8609
|
+
return out;
|
|
8610
|
+
}
|
|
8611
|
+
/** True when `fluidiseProps` would change anything — drives the button's disabled state. */
|
|
8612
|
+
function canFluidise(resolvedStyleProps) {
|
|
8613
|
+
return Object.keys(fluidiseProps(resolvedStyleProps)).length > 0;
|
|
8614
|
+
}
|
|
8615
|
+
/**
|
|
8616
|
+
* Reorder children AT ONE WIDTH using CSS `order`, leaving the tree — and so the DOM and
|
|
8617
|
+
* screen-reader order — untouched. Returns one value per child BY CHILD INDEX: the `order` it must
|
|
8618
|
+
* take, or `null` for "no override needed".
|
|
8619
|
+
*
|
|
8620
|
+
* Either every child gets an explicit `order` or none does: CSS defaults `order` to 0, so a partial
|
|
8621
|
+
* set would mix overridden children with unordered ones and read as an arbitrary interleave.
|
|
8622
|
+
*
|
|
8623
|
+
* @param count How many children there are.
|
|
8624
|
+
* @param from Index of the child being moved.
|
|
8625
|
+
* @param to Index it should occupy.
|
|
8626
|
+
*/
|
|
8627
|
+
function reorderProps(count, from, to) {
|
|
8628
|
+
const none = Array.from({ length: Math.max(0, count) }, () => null);
|
|
8629
|
+
if (from < 0 || from >= count || to < 0 || to >= count || from === to)
|
|
8630
|
+
return none;
|
|
8631
|
+
// Visual order after the move, as a list of CHILD indices.
|
|
8632
|
+
const sequence = Array.from({ length: count }, (_, i) => i);
|
|
8633
|
+
sequence.splice(to, 0, ...sequence.splice(from, 1));
|
|
8634
|
+
const orderByChild = none.slice();
|
|
8635
|
+
sequence.forEach((childIndex, position) => { orderByChild[childIndex] = position; });
|
|
8636
|
+
return orderByChild;
|
|
8637
|
+
}
|
|
8638
|
+
|
|
8639
|
+
/**
|
|
8640
|
+
* ESSENTIALS (B3) — the handful of style controls that matter first for each component type.
|
|
8641
|
+
*
|
|
8642
|
+
* The style panel carries 94 controls across ten groups, ranked by nothing: the control you want for
|
|
8643
|
+
* a heading sits at the same visual weight as `backdrop-filter`. The panel shows this short list in
|
|
8644
|
+
* a band at the top; everything else stays exactly where it is, one click away, and reachable by
|
|
8645
|
+
* search. Nothing is removed and nothing changes group.
|
|
8646
|
+
*
|
|
8647
|
+
* A data table, not per-component code: adding a type is one row. Types with no row fall back to
|
|
8648
|
+
* `DEFAULT_ESSENTIAL_TRAITS`, so a new component is never worse off than today.
|
|
8649
|
+
*/
|
|
8650
|
+
const ESSENTIAL_TRAITS_BY_TYPE = Object.freeze({
|
|
8651
|
+
Heading: ['fontFamily', 'fontSize', 'fontWeight', 'color', 'textAlign', 'margin'],
|
|
8652
|
+
Text: ['fontFamily', 'fontSize', 'color', 'lineHeight', 'textAlign', 'margin'],
|
|
8653
|
+
Button: ['backgroundColor', 'color', 'padding', 'borderRadius', 'fontSize'],
|
|
8654
|
+
ButtonBlock: ['backgroundColor', 'padding', 'borderRadius', 'width', 'justifyContent'],
|
|
8655
|
+
Link: ['color', 'fontSize', 'textDecoration', 'fontWeight'],
|
|
8656
|
+
Image: ['width', 'height', 'objectFit', 'aspectRatio', 'borderRadius'],
|
|
8657
|
+
Icon: ['fontSize', 'color'],
|
|
8658
|
+
Container: ['display', 'flexDirection', 'gap', 'padding', 'width', 'backgroundColor'],
|
|
8659
|
+
LinkedContainer: ['display', 'flexDirection', 'gap', 'padding', 'width', 'backgroundColor'],
|
|
8660
|
+
Section: ['padding', 'backgroundColor', 'minHeight', 'display', 'justifyContent'],
|
|
8661
|
+
Card: ['width', 'padding', 'backgroundColor', 'borderRadius', 'boxShadow'],
|
|
8662
|
+
List: ['display', 'gap', 'padding', 'markerColor'],
|
|
8663
|
+
ListItem: ['padding', 'fontSize', 'color'],
|
|
8664
|
+
Repeater: ['display', 'flexDirection', 'gap', 'gridTemplateColumns'],
|
|
8665
|
+
Divider: ['borderWidth', 'borderColor', 'width', 'margin'],
|
|
8666
|
+
Spacer: ['height'],
|
|
8667
|
+
SliderContainer: ['width', 'height', 'gap'],
|
|
8668
|
+
SliderSlide: ['width', 'padding', 'backgroundColor'],
|
|
8669
|
+
Gallery: ['width', 'aspectRatio', 'gap', 'borderRadius'],
|
|
8670
|
+
});
|
|
8671
|
+
/** For any type without its own row — size, spacing and background suit almost anything. */
|
|
8672
|
+
const DEFAULT_ESSENTIAL_TRAITS = Object.freeze(['width', 'height', 'padding', 'margin', 'backgroundColor']);
|
|
8673
|
+
/** The essential trait NAMES for a component type, in the order they should be shown. */
|
|
8674
|
+
function essentialTraitsFor(type) {
|
|
8675
|
+
return (type && ESSENTIAL_TRAITS_BY_TYPE[type]) || DEFAULT_ESSENTIAL_TRAITS;
|
|
8676
|
+
}
|
|
8677
|
+
/**
|
|
8678
|
+
* Does `label` or `name` match a control search? Case-insensitive substring on either, so "shadow"
|
|
8679
|
+
* finds `boxShadow` ("Box shadow") and "radius" finds `borderRadius`.
|
|
8680
|
+
*/
|
|
8681
|
+
function matchesControlSearch(name, label, term) {
|
|
8682
|
+
const needle = term.trim().toLowerCase();
|
|
8683
|
+
if (!needle)
|
|
8684
|
+
return true;
|
|
8685
|
+
return name.toLowerCase().includes(needle) || (label ?? '').toLowerCase().includes(needle);
|
|
8686
|
+
}
|
|
8687
|
+
|
|
8537
8688
|
class BuilderButtonComponentConfig extends ComponentConfig {
|
|
8538
8689
|
constructor() {
|
|
8539
8690
|
super('Button', 'app-builder-button', 'ph-thin ph-cursor-click', 'Basic');
|
|
@@ -9087,5 +9238,5 @@ class BuilderSpacerComponentConfig extends ComponentConfig {
|
|
|
9087
9238
|
* Generated bundle index. Do not edit.
|
|
9088
9239
|
*/
|
|
9089
9240
|
|
|
9090
|
-
export { ACTION_TYPE_OPTIONS, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, 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, DRAG_HANDLE_ATTR, DataSourceRegistryService, DataSourceType, DimensionsGroupStyleConfig, DragEngineService, EASING_OPTIONS$1 as EASING_OPTIONS, EffectsGroupStyleConfig, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, 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, 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, buildFullStyleTraits, buildPresetStyleTraits, defaultPageSettings, findNodeLocation, findParentOf, flattenSchemaFields, generateNodeId, nodeAncestorPath, nodeAncestorPathInEither, resolveTraitControllerType, resolveTraitOptions, wrapNode };
|
|
9241
|
+
export { ACTION_TYPE_OPTIONS, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, 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, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, 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, 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, buildFullStyleTraits, buildPresetStyleTraits, canFluidise, collapseColumnsProps, columnCountOf, defaultPageSettings, dropTargetLabel, essentialTraitsFor, findNodeLocation, findParentOf, flattenSchemaFields, fluidiseProps, generateNodeId, isHiddenAt, matchesControlSearch, nodeAncestorPath, nodeAncestorPathInEither, reorderProps, resolveInsertTarget, resolveTraitControllerType, resolveTraitOptions, stackChildrenProps, visibilityProps, wrapNode };
|
|
9091
9242
|
//# sourceMappingURL=vectoriox-iox-builder.mjs.map
|