@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/all.d.ts
CHANGED
|
@@ -12876,22 +12876,53 @@ declare const useIsSSR: typeof useIsSSR$1;
|
|
|
12876
12876
|
|
|
12877
12877
|
declare const Stack: (<T extends keyof JSX.IntrinsicElements = "div">(props: {
|
|
12878
12878
|
as?: T | undefined;
|
|
12879
|
+
hasGap?: boolean | undefined;
|
|
12879
12880
|
} & React$1.ComponentProps<T>) => React$1.ReactElement) & {
|
|
12880
|
-
div: React$1.FC<React$1.
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12881
|
+
div: React$1.FC<React$1.ClassAttributes<HTMLDivElement> & React$1.HTMLAttributes<HTMLDivElement> & {
|
|
12882
|
+
hasGap?: boolean | undefined;
|
|
12883
|
+
}>;
|
|
12884
|
+
a: React$1.FC<React$1.ClassAttributes<HTMLAnchorElement> & React$1.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
12885
|
+
hasGap?: boolean | undefined;
|
|
12886
|
+
}>;
|
|
12887
|
+
button: React$1.FC<React$1.ClassAttributes<HTMLButtonElement> & React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
12888
|
+
hasGap?: boolean | undefined;
|
|
12889
|
+
}>;
|
|
12890
|
+
h1: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12891
|
+
hasGap?: boolean | undefined;
|
|
12892
|
+
}>;
|
|
12893
|
+
h2: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12894
|
+
hasGap?: boolean | undefined;
|
|
12895
|
+
}>;
|
|
12896
|
+
h3: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12897
|
+
hasGap?: boolean | undefined;
|
|
12898
|
+
}>;
|
|
12899
|
+
h4: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12900
|
+
hasGap?: boolean | undefined;
|
|
12901
|
+
}>;
|
|
12902
|
+
h5: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12903
|
+
hasGap?: boolean | undefined;
|
|
12904
|
+
}>;
|
|
12905
|
+
h6: React$1.FC<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & {
|
|
12906
|
+
hasGap?: boolean | undefined;
|
|
12907
|
+
}>;
|
|
12908
|
+
label: React$1.FC<React$1.ClassAttributes<HTMLLabelElement> & React$1.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
12909
|
+
hasGap?: boolean | undefined;
|
|
12910
|
+
}>;
|
|
12911
|
+
form: React$1.FC<React$1.ClassAttributes<HTMLFormElement> & React$1.FormHTMLAttributes<HTMLFormElement> & {
|
|
12912
|
+
hasGap?: boolean | undefined;
|
|
12913
|
+
}>;
|
|
12914
|
+
section: React$1.FC<React$1.ClassAttributes<HTMLElement> & React$1.HTMLAttributes<HTMLElement> & {
|
|
12915
|
+
hasGap?: boolean | undefined;
|
|
12916
|
+
}>;
|
|
12917
|
+
head: React$1.FC<React$1.ClassAttributes<HTMLHeadElement> & React$1.HTMLAttributes<HTMLHeadElement> & {
|
|
12918
|
+
hasGap?: boolean | undefined;
|
|
12919
|
+
}>;
|
|
12920
|
+
main: React$1.FC<React$1.ClassAttributes<HTMLElement> & React$1.HTMLAttributes<HTMLElement> & {
|
|
12921
|
+
hasGap?: boolean | undefined;
|
|
12922
|
+
}>;
|
|
12923
|
+
nav: React$1.FC<React$1.ClassAttributes<HTMLElement> & React$1.HTMLAttributes<HTMLElement> & {
|
|
12924
|
+
hasGap?: boolean | undefined;
|
|
12925
|
+
}>;
|
|
12895
12926
|
};
|
|
12896
12927
|
|
|
12897
12928
|
declare const usePlasmicTranslator: typeof usePlasmicTranslator$1;
|
package/dist/index.cjs.js
CHANGED
|
@@ -656,18 +656,20 @@ function getElementTypeName(element) {
|
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
-
function renderStack(as, props, ref) {
|
|
659
|
+
function renderStack(as, props, hasGap, ref) {
|
|
660
660
|
var children = props.children, rest = __rest(props, ["children"]);
|
|
661
|
-
|
|
661
|
+
var wrappedChildren = wrapFlexContainerChildren(children, hasGap !== null && hasGap !== void 0 ? hasGap : false);
|
|
662
|
+
return createElementWithChildren(as, __assign({ ref: ref }, rest), wrappedChildren);
|
|
662
663
|
}
|
|
663
664
|
function FlexStack_(props, outerRef) {
|
|
664
|
-
var as = props.as, rest = __rest(props, ["as"]);
|
|
665
|
-
return renderStack(as !== null && as !== void 0 ? as : "div", rest, outerRef);
|
|
665
|
+
var as = props.as, hasGap = props.hasGap, rest = __rest(props, ["as", "hasGap"]);
|
|
666
|
+
return renderStack(as !== null && as !== void 0 ? as : "div", rest, hasGap, outerRef);
|
|
666
667
|
}
|
|
667
668
|
var FlexStack = React__namespace.forwardRef(FlexStack_);
|
|
668
669
|
var makeStackImpl = function (as) {
|
|
669
670
|
return React__namespace.forwardRef(function (props, ref) {
|
|
670
|
-
|
|
671
|
+
var hasGap = props.hasGap, rest = __rest(props, ["hasGap"]);
|
|
672
|
+
return renderStack(as, rest, hasGap, ref);
|
|
671
673
|
});
|
|
672
674
|
};
|
|
673
675
|
var Stack = Object.assign(FlexStack, {
|
|
@@ -712,7 +714,23 @@ function hasVariant(variants, groupName, variant) {
|
|
|
712
714
|
return (groupVariants[variant] !== undefined && groupVariants[variant] !== false);
|
|
713
715
|
}
|
|
714
716
|
}
|
|
715
|
-
function
|
|
717
|
+
function wrapFlexContainerChildren(children, hasGap) {
|
|
718
|
+
// We need to always wrap the children, even if there are no gaps, because
|
|
719
|
+
// otherwise if we toggle between with and without gap, React reconciliation
|
|
720
|
+
// will blow away the children tree and all state if we switch from having
|
|
721
|
+
// a wrapper and not.
|
|
722
|
+
var className = hasGap ? "__wab_flex-container ρfc" : "__wab_passthrough";
|
|
723
|
+
if (!children) {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
else if (Array.isArray(children)) {
|
|
727
|
+
return React__namespace.createElement.apply(React__namespace, __spreadArray(["div", { className: className }], __read(children), false));
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
return React__namespace.createElement("div", { className: className }, children);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenInFlex) {
|
|
716
734
|
if (!override ||
|
|
717
735
|
(typeof override === "object" && Object.keys(override).length === 0)) {
|
|
718
736
|
return createElementWithChildren(defaultRoot, defaultProps, defaultProps.children);
|
|
@@ -739,6 +757,10 @@ function createPlasmicElement(override, defaultRoot, defaultProps) {
|
|
|
739
757
|
if (override2.wrapChildren) {
|
|
740
758
|
children = override2.wrapChildren(ensureNotArray(children));
|
|
741
759
|
}
|
|
760
|
+
if (wrapChildrenInFlex) {
|
|
761
|
+
// For legacy, we still support data-plasmic-wrap-flex-children
|
|
762
|
+
children = wrapFlexContainerChildren(children, true);
|
|
763
|
+
}
|
|
742
764
|
var result = createElementWithChildren(root, props, children);
|
|
743
765
|
if (override2.wrap) {
|
|
744
766
|
result = override2.wrap(result);
|
|
@@ -799,13 +821,15 @@ function createPlasmicElementFromJsx(defaultElement, props) {
|
|
|
799
821
|
children[_i - 2] = arguments[_i];
|
|
800
822
|
}
|
|
801
823
|
var override = props["data-plasmic-override"];
|
|
824
|
+
var wrapFlexChild = props["data-plasmic-wrap-flex-child"];
|
|
802
825
|
var triggerProps = ((_a = props["data-plasmic-trigger-props"]) !== null && _a !== void 0 ? _a : []);
|
|
803
826
|
delete props["data-plasmic-override"];
|
|
827
|
+
delete props["data-plasmic-wrap-flex-child"];
|
|
804
828
|
delete props["data-plasmic-trigger-props"];
|
|
805
829
|
return createPlasmicElement(override, defaultElement, mergeProps.apply(void 0, __spreadArray([props,
|
|
806
830
|
children.length === 0
|
|
807
831
|
? {}
|
|
808
|
-
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)));
|
|
832
|
+
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)), wrapFlexChild);
|
|
809
833
|
}
|
|
810
834
|
function makeFragment() {
|
|
811
835
|
var children = [];
|