@vectoriox/iox-builder 7.0.0 → 7.0.2
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.
|
@@ -5076,13 +5076,16 @@ class RenderDirective {
|
|
|
5076
5076
|
// template node is selectable/editable. Skip overlay registration + interaction
|
|
5077
5077
|
// wiring for them so they can't be hovered, selected, or edited on the canvas.
|
|
5078
5078
|
const isPreviewClone = !!node.__previewClone;
|
|
5079
|
+
// WRAPPER-COLLAPSE (opt-in via ioxDragSourceId): the HOST is the flex/grid item, so it carries
|
|
5080
|
+
// `iox-outer-{id}` (margin, width, grid placement) IN ADDITION to `iox-node-{id}` (visual) — one
|
|
5081
|
+
// element, like the engine. A display-only clone (a repeater row, a design specimen) is laid out
|
|
5082
|
+
// the same way: it only skips drag and selection below. Without the class a clone lost every
|
|
5083
|
+
// OUTER prop — its width, margin and grid placement — on the canvas alone.
|
|
5084
|
+
if (nativeEl && this.ioxDragSourceId != null && cssId)
|
|
5085
|
+
nativeEl.classList.add(`iox-outer-${cssId}`);
|
|
5079
5086
|
if (nativeEl && !isPreviewClone) {
|
|
5080
|
-
//
|
|
5081
|
-
// carries `iox-outer-{id}` (margin/width) IN ADDITION to `iox-node-{id}` (visual) — one
|
|
5082
|
-
// element, like the engine — and drag is registered on it (the wrapper is gone). The
|
|
5083
|
-
// StyleRegistry's split still works: both classes are on this one host.
|
|
5087
|
+
// Drag is registered on the collapsed host (the wrapper is gone).
|
|
5084
5088
|
if (this.ioxDragSourceId != null && cssId) {
|
|
5085
|
-
nativeEl.classList.add(`iox-outer-${cssId}`);
|
|
5086
5089
|
const sourceId = this.ioxDragSourceId;
|
|
5087
5090
|
this.dragEngine.registerDraggable(nativeEl, () => ({
|
|
5088
5091
|
type: 'internal',
|
|
@@ -10634,12 +10637,18 @@ function wearing(node, styleId) {
|
|
|
10634
10637
|
applyElementStyle(node, styleId);
|
|
10635
10638
|
return node;
|
|
10636
10639
|
}
|
|
10640
|
+
/** A Text node: a new Text wears `body` and the palette's 10px padding; a specimen's text sits flush. */
|
|
10637
10641
|
function text(content, createConfig, styleId, styles = {}) {
|
|
10638
10642
|
const node = textNode(content, createConfig);
|
|
10639
10643
|
if (styleId)
|
|
10640
10644
|
wearing(node, styleId);
|
|
10641
|
-
return styled(node, styles);
|
|
10645
|
+
return styled(node, { padding: '0', margin: '0', ...styles });
|
|
10642
10646
|
}
|
|
10647
|
+
/** A button's label takes the BUTTON's type (the style's size, weight, case, tracking) — not body's. */
|
|
10648
|
+
const BUTTON_LABEL = {
|
|
10649
|
+
color: 'inherit', fontFamily: 'inherit', fontSize: 'inherit', fontWeight: 'inherit', lineHeight: 'inherit',
|
|
10650
|
+
letterSpacing: 'inherit', textTransform: 'inherit',
|
|
10651
|
+
};
|
|
10643
10652
|
function withChildren(node, children) {
|
|
10644
10653
|
if (!node || children.some(c => !c))
|
|
10645
10654
|
return null;
|
|
@@ -10665,10 +10674,18 @@ function button(styleId, label, createConfig, styles = {}) {
|
|
|
10665
10674
|
return null;
|
|
10666
10675
|
setTrait(btn, 'tag', 'button');
|
|
10667
10676
|
styled(btn, styles);
|
|
10668
|
-
return withChildren(btn, [text(label, createConfig, undefined,
|
|
10677
|
+
return withChildren(btn, [text(label, createConfig, undefined, BUTTON_LABEL)]);
|
|
10678
|
+
}
|
|
10679
|
+
/** A Container sized by its content: the palette Container's 200px drop-zone min-height is canvas
|
|
10680
|
+
* furniture, and a specimen has no drop zone. */
|
|
10681
|
+
function box(createConfig, styleId) {
|
|
10682
|
+
const node = createConfig('Container');
|
|
10683
|
+
if (styleId)
|
|
10684
|
+
wearing(node, styleId);
|
|
10685
|
+
return styled(node, { minHeight: '0' });
|
|
10669
10686
|
}
|
|
10670
10687
|
function boxed(styleId, createConfig, children, styles) {
|
|
10671
|
-
return withChildren(styled(
|
|
10688
|
+
return withChildren(styled(box(createConfig, styleId), styles), children);
|
|
10672
10689
|
}
|
|
10673
10690
|
/**
|
|
10674
10691
|
* The specimen for one element style (Board 6, Element styles tab). Null for an unknown id or a
|
|
@@ -10749,8 +10766,8 @@ function layoutSpecimen(id, createConfig, copy) {
|
|
|
10749
10766
|
* so the tile wears whichever look's tokens its wrapper declares.
|
|
10750
10767
|
*/
|
|
10751
10768
|
function buildFlavorSpecimen(name, createConfig, copy) {
|
|
10752
|
-
const dots = styled(createConfig
|
|
10753
|
-
const dotNodes = TILE_DOTS.map(token => styled(createConfig
|
|
10769
|
+
const dots = styled(box(createConfig), { display: 'flex', gap: '4px', alignSelf: 'start', width: 'auto' });
|
|
10770
|
+
const dotNodes = TILE_DOTS.map(token => styled(box(createConfig), {
|
|
10754
10771
|
width: '14px', height: '14px', borderRadius: '50%', backgroundColor: `var(--iox-${token})`,
|
|
10755
10772
|
borderWidth: '1px', borderStyle: 'solid', borderColor: 'rgba(127, 127, 127, 0.25)', flexShrink: '0',
|
|
10756
10773
|
}));
|
|
@@ -10764,7 +10781,7 @@ function buildFlavorSpecimen(name, createConfig, copy) {
|
|
|
10764
10781
|
gridColumn: '1 / -1', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
|
10765
10782
|
gap: '10px', padding: '7px 9px', width: 'auto',
|
|
10766
10783
|
});
|
|
10767
|
-
const root = styled(createConfig
|
|
10784
|
+
const root = styled(box(createConfig), {
|
|
10768
10785
|
display: 'grid', gridTemplateColumns: '1fr auto', gap: '6px', alignContent: 'space-between',
|
|
10769
10786
|
height: '96px', padding: '10px', width: '100%',
|
|
10770
10787
|
});
|