@plasmicapp/react-web 0.2.395 → 0.2.397
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.
- package/dist/all.d.ts +46 -15
- package/dist/index.cjs.js +31 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +31 -7
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/Stack.d.ts +46 -15
- package/dist/render/elements.d.ts +3 -0
- package/package.json +9 -9
- package/skinny/dist/index.js +31 -7
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/render/Stack.d.ts +46 -15
- package/skinny/dist/render/elements.d.ts +3 -0
package/dist/react-web.esm.js
CHANGED
|
@@ -637,18 +637,20 @@ function getElementTypeName(element) {
|
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
function renderStack(as, props, ref) {
|
|
640
|
+
function renderStack(as, props, hasGap, ref) {
|
|
641
641
|
var children = props.children, rest = __rest(props, ["children"]);
|
|
642
|
-
|
|
642
|
+
var wrappedChildren = wrapFlexContainerChildren(children, hasGap !== null && hasGap !== void 0 ? hasGap : false);
|
|
643
|
+
return createElementWithChildren(as, __assign({ ref: ref }, rest), wrappedChildren);
|
|
643
644
|
}
|
|
644
645
|
function FlexStack_(props, outerRef) {
|
|
645
|
-
var as = props.as, rest = __rest(props, ["as"]);
|
|
646
|
-
return renderStack(as !== null && as !== void 0 ? as : "div", rest, outerRef);
|
|
646
|
+
var as = props.as, hasGap = props.hasGap, rest = __rest(props, ["as", "hasGap"]);
|
|
647
|
+
return renderStack(as !== null && as !== void 0 ? as : "div", rest, hasGap, outerRef);
|
|
647
648
|
}
|
|
648
649
|
var FlexStack = React.forwardRef(FlexStack_);
|
|
649
650
|
var makeStackImpl = function (as) {
|
|
650
651
|
return React.forwardRef(function (props, ref) {
|
|
651
|
-
|
|
652
|
+
var hasGap = props.hasGap, rest = __rest(props, ["hasGap"]);
|
|
653
|
+
return renderStack(as, rest, hasGap, ref);
|
|
652
654
|
});
|
|
653
655
|
};
|
|
654
656
|
var Stack = Object.assign(FlexStack, {
|
|
@@ -693,7 +695,23 @@ function hasVariant(variants, groupName, variant) {
|
|
|
693
695
|
return (groupVariants[variant] !== undefined && groupVariants[variant] !== false);
|
|
694
696
|
}
|
|
695
697
|
}
|
|
696
|
-
function
|
|
698
|
+
function wrapFlexContainerChildren(children, hasGap) {
|
|
699
|
+
// We need to always wrap the children, even if there are no gaps, because
|
|
700
|
+
// otherwise if we toggle between with and without gap, React reconciliation
|
|
701
|
+
// will blow away the children tree and all state if we switch from having
|
|
702
|
+
// a wrapper and not.
|
|
703
|
+
var className = hasGap ? "__wab_flex-container ρfc" : "__wab_passthrough";
|
|
704
|
+
if (!children) {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
else if (Array.isArray(children)) {
|
|
708
|
+
return React.createElement.apply(React, __spreadArray(["div", { className: className }], __read(children), false));
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
return React.createElement("div", { className: className }, children);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenInFlex) {
|
|
697
715
|
if (!override ||
|
|
698
716
|
(typeof override === "object" && Object.keys(override).length === 0)) {
|
|
699
717
|
return createElementWithChildren(defaultRoot, defaultProps, defaultProps.children);
|
|
@@ -720,6 +738,10 @@ function createPlasmicElement(override, defaultRoot, defaultProps) {
|
|
|
720
738
|
if (override2.wrapChildren) {
|
|
721
739
|
children = override2.wrapChildren(ensureNotArray(children));
|
|
722
740
|
}
|
|
741
|
+
if (wrapChildrenInFlex) {
|
|
742
|
+
// For legacy, we still support data-plasmic-wrap-flex-children
|
|
743
|
+
children = wrapFlexContainerChildren(children, true);
|
|
744
|
+
}
|
|
723
745
|
var result = createElementWithChildren(root, props, children);
|
|
724
746
|
if (override2.wrap) {
|
|
725
747
|
result = override2.wrap(result);
|
|
@@ -780,13 +802,15 @@ function createPlasmicElementFromJsx(defaultElement, props) {
|
|
|
780
802
|
children[_i - 2] = arguments[_i];
|
|
781
803
|
}
|
|
782
804
|
var override = props["data-plasmic-override"];
|
|
805
|
+
var wrapFlexChild = props["data-plasmic-wrap-flex-child"];
|
|
783
806
|
var triggerProps = ((_a = props["data-plasmic-trigger-props"]) !== null && _a !== void 0 ? _a : []);
|
|
784
807
|
delete props["data-plasmic-override"];
|
|
808
|
+
delete props["data-plasmic-wrap-flex-child"];
|
|
785
809
|
delete props["data-plasmic-trigger-props"];
|
|
786
810
|
return createPlasmicElement(override, defaultElement, mergeProps.apply(void 0, __spreadArray([props,
|
|
787
811
|
children.length === 0
|
|
788
812
|
? {}
|
|
789
|
-
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)));
|
|
813
|
+
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)), wrapFlexChild);
|
|
790
814
|
}
|
|
791
815
|
function makeFragment() {
|
|
792
816
|
var children = [];
|