@vectoriox/iox-builder 4.23.0 → 4.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.
|
@@ -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 { 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';
|
|
19
|
+
import { VALIDATION_STATES as VALIDATION_STATES$1, VALIDATION_STATE_CLASS as VALIDATION_STATE_CLASS$1, DEFAULT_WIDTH_BY_TYPE, resolveFlavorDefaults, Breakpoint, BREAKPOINTS, countOverrides, setOverride, DEFAULT_FLAVOR, 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';
|
|
@@ -237,6 +237,26 @@ class ComponentConfig {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Layer 2 of the flavor cascade (flavors plan §4), applied by the registry factory to every
|
|
242
|
+
* BRAND-NEW element: overwrite matching styleTrait defaults with the pack's token references
|
|
243
|
+
* (`var(--iox-<token>, <packValue>)`). Runs AFTER the subclass constructor, so a pack beats the
|
|
244
|
+
* constructor's literals; the author's own edits (layer 4) beat everything as always. Self-
|
|
245
|
+
* describing serialisation then writes the var into styleProps on save — which is why the
|
|
246
|
+
* engine's `flavorDefaultDeclarations` only has to cover LEGACY nodes.
|
|
247
|
+
*/
|
|
248
|
+
function applyFlavorDefaults(config, pack) {
|
|
249
|
+
const defaults = resolveFlavorDefaults(config.type, pack);
|
|
250
|
+
const names = Object.keys(defaults);
|
|
251
|
+
if (!names.length)
|
|
252
|
+
return;
|
|
253
|
+
for (const group of config.styleTraits) {
|
|
254
|
+
for (const trait of group.traits) {
|
|
255
|
+
if (defaults[trait.name] !== undefined)
|
|
256
|
+
trait.default = defaults[trait.name];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
240
260
|
class TraitConfig {
|
|
241
261
|
constructor(name, label, type, options, defaultValue, inline, showWhen, responsive) {
|
|
242
262
|
this.name = name;
|
|
@@ -325,19 +345,19 @@ class PositionGroupStyleConfig extends GroupStyleConfig {
|
|
|
325
345
|
class LayoutGroupStyleConfig extends GroupStyleConfig {
|
|
326
346
|
constructor() {
|
|
327
347
|
super(StyleCategory.Layout, [
|
|
328
|
-
new TraitConfig('display', 'Display', TraitInputType.Select, ['block', 'inline', 'inline-block', 'flex', 'grid'], 'block'),
|
|
348
|
+
new TraitConfig('display', 'Display', TraitInputType.Select, ['block', 'inline', 'inline-block', 'flex', 'inline-flex', 'grid'], 'block'),
|
|
329
349
|
// ── Flex-only ─────────────────────────────────────────────────────
|
|
330
350
|
new TraitConfig('flexDirection', 'Direction', TraitInputType.SelectButton, [
|
|
331
351
|
{ value: 'row', label: 'Horizontal', icon: 'ph-thin ph-arrow-right' },
|
|
332
352
|
{ value: 'row-reverse', label: 'Horizontal Reversed', icon: 'ph-thin ph-arrow-left' },
|
|
333
353
|
{ value: 'column', label: 'Vertical', icon: 'ph-thin ph-arrow-down' },
|
|
334
354
|
{ value: 'column-reverse', label: 'Vertical Reversed', icon: 'ph-thin ph-arrow-up' },
|
|
335
|
-
], 'row', false, { trait: 'display', values: 'flex' }),
|
|
355
|
+
], 'row', false, { trait: 'display', values: ['flex', 'inline-flex'] }),
|
|
336
356
|
new TraitConfig('flexWrap', 'Flex Wrap', TraitInputType.SelectButton, [
|
|
337
357
|
{ value: 'nowrap', label: 'No Wrap', icon: 'ph-thin ph-minus' },
|
|
338
358
|
{ value: 'wrap', label: 'Wrap', icon: 'ph-thin ph-arrow-elbow-down-right' },
|
|
339
359
|
{ value: 'wrap-reverse', label: 'Wrap Reversed', icon: 'ph-thin ph-arrow-elbow-up-right' },
|
|
340
|
-
], 'nowrap', false, { trait: 'display', values: 'flex' }),
|
|
360
|
+
], 'nowrap', false, { trait: 'display', values: ['flex', 'inline-flex'] }),
|
|
341
361
|
// ── Shared flex + grid ────────────────────────────────────────────
|
|
342
362
|
new TraitConfig('justifyContent', 'Justify', TraitInputType.SelectButton, [
|
|
343
363
|
{ value: 'flex-start', label: 'Start', icon: 'ph-thin ph-align-left' },
|
|
@@ -346,14 +366,14 @@ class LayoutGroupStyleConfig extends GroupStyleConfig {
|
|
|
346
366
|
{ value: 'space-between', label: 'Space Between', icon: 'ph-thin ph-arrows-out-line-horizontal' },
|
|
347
367
|
{ value: 'space-around', label: 'Space Around', icon: 'ph-thin ph-dots-three' },
|
|
348
368
|
{ value: 'space-evenly', label: 'Space Evenly', icon: 'ph-thin ph-dots-six' },
|
|
349
|
-
], 'flex-start', false, { trait: 'display', values: ['flex', 'grid'] }),
|
|
369
|
+
], 'flex-start', false, { trait: 'display', values: ['flex', 'inline-flex', 'grid'] }),
|
|
350
370
|
new TraitConfig('alignItems', 'Align Items', TraitInputType.SelectButton, [
|
|
351
371
|
{ value: 'stretch', label: 'Stretch', icon: 'ph-thin ph-arrows-vertical' },
|
|
352
372
|
{ value: 'start', label: 'Start', icon: 'ph-thin ph-align-top' },
|
|
353
373
|
{ value: 'center', label: 'Center', icon: 'ph-thin ph-align-center-vertical' },
|
|
354
374
|
{ value: 'end', label: 'End', icon: 'ph-thin ph-align-bottom' },
|
|
355
|
-
], 'stretch', false, { trait: 'display', values: ['flex', 'grid'] }),
|
|
356
|
-
new TraitConfig('gap', 'Gap', TraitInputType.Scrub, { min: 0, max: 200, step: 1, units: UNITS_FIXED }, '0px', false, { trait: 'display', values: ['flex', 'grid'] }),
|
|
375
|
+
], 'stretch', false, { trait: 'display', values: ['flex', 'inline-flex', 'grid'] }),
|
|
376
|
+
new TraitConfig('gap', 'Gap', TraitInputType.Scrub, { min: 0, max: 200, step: 1, units: UNITS_FIXED }, '0px', false, { trait: 'display', values: ['flex', 'inline-flex', 'grid'] }),
|
|
357
377
|
// ── Grid-only ─────────────────────────────────────────────────────
|
|
358
378
|
new TraitConfig('gridTemplateColumns', 'Columns', TraitInputType.GridTemplate, undefined, '1fr', false, { trait: 'display', values: 'grid' }),
|
|
359
379
|
new TraitConfig('gridTemplateRows', 'Rows', TraitInputType.GridTemplate, undefined, 'auto', false, { trait: 'display', values: 'grid' }),
|
|
@@ -390,8 +410,11 @@ class LayoutGroupStyleConfig extends GroupStyleConfig {
|
|
|
390
410
|
// is hidden and the style panel drops the whole (now-empty) group. `align-self`/`order`
|
|
391
411
|
// apply to both flex and grid items; `justify-self`/`grid-column`/`grid-row` are grid-only;
|
|
392
412
|
// `flex-grow`/`flex-shrink`/`flex-basis` are flex-only.
|
|
393
|
-
|
|
394
|
-
|
|
413
|
+
// 'inline-flex' IS flex for every layout question asked here — ButtonBlock has shipped it as a
|
|
414
|
+
// constructor default forever, which made Layout badge "4" with three of the four controls hidden
|
|
415
|
+
// and the Display select blank (no option for its own value). The families, not the keywords.
|
|
416
|
+
const PARENT_FLEX_OR_GRID = { trait: 'display', values: ['flex', 'inline-flex', 'grid'], scope: 'parent' };
|
|
417
|
+
const PARENT_FLEX = { trait: 'display', values: ['flex', 'inline-flex'], scope: 'parent' };
|
|
395
418
|
const PARENT_GRID = { trait: 'display', values: 'grid', scope: 'parent' };
|
|
396
419
|
class ChildLayoutGroupStyleConfig extends GroupStyleConfig {
|
|
397
420
|
constructor() {
|
|
@@ -1523,7 +1546,13 @@ class ComponentRegistryService {
|
|
|
1523
1546
|
}
|
|
1524
1547
|
createConfig(type) {
|
|
1525
1548
|
const configType = this.components[type]?.config;
|
|
1526
|
-
|
|
1549
|
+
if (!configType)
|
|
1550
|
+
return null;
|
|
1551
|
+
const config = new configType();
|
|
1552
|
+
// Flavor layer (F1): every new element is born wearing the pack's token references.
|
|
1553
|
+
// DEFAULT_FLAVOR until F2 lets the org choose; see flavors-and-theming-plan.md §4.
|
|
1554
|
+
applyFlavorDefaults(config, DEFAULT_FLAVOR);
|
|
1555
|
+
return config;
|
|
1527
1556
|
}
|
|
1528
1557
|
register(type, component, config) {
|
|
1529
1558
|
this.components[type] = { type, component, config };
|