@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/render/Stack.d.ts
CHANGED
|
@@ -1,20 +1,51 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export declare const Stack: (<T extends keyof JSX.IntrinsicElements = "div">(props: {
|
|
3
3
|
as?: T | undefined;
|
|
4
|
+
hasGap?: boolean | undefined;
|
|
4
5
|
} & React.ComponentProps<T>) => React.ReactElement) & {
|
|
5
|
-
div: React.FC<React.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
div: React.FC<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
hasGap?: boolean | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
a: React.FC<React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
10
|
+
hasGap?: boolean | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
button: React.FC<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
13
|
+
hasGap?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
h1: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
16
|
+
hasGap?: boolean | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
h2: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
19
|
+
hasGap?: boolean | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
h3: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
22
|
+
hasGap?: boolean | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
h4: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
25
|
+
hasGap?: boolean | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
h5: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
28
|
+
hasGap?: boolean | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
h6: React.FC<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & {
|
|
31
|
+
hasGap?: boolean | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
label: React.FC<React.ClassAttributes<HTMLLabelElement> & React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
34
|
+
hasGap?: boolean | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
form: React.FC<React.ClassAttributes<HTMLFormElement> & React.FormHTMLAttributes<HTMLFormElement> & {
|
|
37
|
+
hasGap?: boolean | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
section: React.FC<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & {
|
|
40
|
+
hasGap?: boolean | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
head: React.FC<React.ClassAttributes<HTMLHeadElement> & React.HTMLAttributes<HTMLHeadElement> & {
|
|
43
|
+
hasGap?: boolean | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
main: React.FC<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & {
|
|
46
|
+
hasGap?: boolean | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
nav: React.FC<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & {
|
|
49
|
+
hasGap?: boolean | undefined;
|
|
50
|
+
}>;
|
|
20
51
|
};
|
|
@@ -42,6 +42,9 @@ export type Flex<DefaultElementType extends React.ElementType> = (Omit<DefaultOv
|
|
|
42
42
|
render?: never;
|
|
43
43
|
}) | ((props: React.ComponentProps<DefaultElementType>) => React.ReactNode);
|
|
44
44
|
export declare function hasVariant<V extends Variants>(variants: V | undefined, groupName: keyof V, variant: string): any;
|
|
45
|
+
export declare function wrapFlexContainerChildren(children: React.ReactNode, hasGap: boolean): React.DetailedReactHTMLElement<{
|
|
46
|
+
className: string;
|
|
47
|
+
}, HTMLElement> | null;
|
|
45
48
|
export declare function createPlasmicElementProxy<DefaultElementType extends React.ElementType>(defaultElement: DefaultElementType, props: Partial<React.ComponentProps<DefaultElementType>>, ...children: React.ReactNode[]): React.ReactNode;
|
|
46
49
|
export declare function makeFragment(...children: React.ReactNode[]): React.FunctionComponentElement<{
|
|
47
50
|
children?: React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.397",
|
|
4
4
|
"description": "plasmic library for rendering in the presentational style",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -95,14 +95,14 @@
|
|
|
95
95
|
"test-storybook": "test-storybook"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@plasmicapp/auth-react": "0.0.
|
|
99
|
-
"@plasmicapp/data-sources": "0.1.
|
|
100
|
-
"@plasmicapp/data-sources-context": "0.1.
|
|
101
|
-
"@plasmicapp/host": "1.0.
|
|
98
|
+
"@plasmicapp/auth-react": "0.0.23",
|
|
99
|
+
"@plasmicapp/data-sources": "0.1.188",
|
|
100
|
+
"@plasmicapp/data-sources-context": "0.1.22",
|
|
101
|
+
"@plasmicapp/host": "1.0.224",
|
|
102
102
|
"@plasmicapp/loader-splits": "1.0.64",
|
|
103
|
-
"@plasmicapp/nextjs-app-router": "1.0.
|
|
104
|
-
"@plasmicapp/prepass": "1.0.
|
|
105
|
-
"@plasmicapp/query": "0.1.
|
|
103
|
+
"@plasmicapp/nextjs-app-router": "1.0.17",
|
|
104
|
+
"@plasmicapp/prepass": "1.0.20",
|
|
105
|
+
"@plasmicapp/query": "0.1.80",
|
|
106
106
|
"@react-aria/checkbox": "^3.15.5",
|
|
107
107
|
"@react-aria/focus": "^3.20.3",
|
|
108
108
|
"@react-aria/interactions": "^3.25.1",
|
|
@@ -155,5 +155,5 @@
|
|
|
155
155
|
"react": ">=16.8.0",
|
|
156
156
|
"react-dom": ">=16.8.0"
|
|
157
157
|
},
|
|
158
|
-
"gitHead": "
|
|
158
|
+
"gitHead": "abfd8b249d026a1ac8eeaeba5a83a3043e5e82b3"
|
|
159
159
|
}
|
package/skinny/dist/index.js
CHANGED
|
@@ -146,18 +146,20 @@ function withPlasmicPageGuard(WrappedComponent, options) {
|
|
|
146
146
|
return PageGuard;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
function renderStack(as, props, ref) {
|
|
149
|
+
function renderStack(as, props, hasGap, ref) {
|
|
150
150
|
var children = props.children, rest = __rest(props, ["children"]);
|
|
151
|
-
|
|
151
|
+
var wrappedChildren = wrapFlexContainerChildren(children, hasGap !== null && hasGap !== void 0 ? hasGap : false);
|
|
152
|
+
return createElementWithChildren(as, __assign({ ref: ref }, rest), wrappedChildren);
|
|
152
153
|
}
|
|
153
154
|
function FlexStack_(props, outerRef) {
|
|
154
|
-
var as = props.as, rest = __rest(props, ["as"]);
|
|
155
|
-
return renderStack(as !== null && as !== void 0 ? as : "div", rest, outerRef);
|
|
155
|
+
var as = props.as, hasGap = props.hasGap, rest = __rest(props, ["as", "hasGap"]);
|
|
156
|
+
return renderStack(as !== null && as !== void 0 ? as : "div", rest, hasGap, outerRef);
|
|
156
157
|
}
|
|
157
158
|
var FlexStack = React.forwardRef(FlexStack_);
|
|
158
159
|
var makeStackImpl = function (as) {
|
|
159
160
|
return React.forwardRef(function (props, ref) {
|
|
160
|
-
|
|
161
|
+
var hasGap = props.hasGap, rest = __rest(props, ["hasGap"]);
|
|
162
|
+
return renderStack(as, rest, hasGap, ref);
|
|
161
163
|
});
|
|
162
164
|
};
|
|
163
165
|
var Stack = Object.assign(FlexStack, {
|
|
@@ -202,7 +204,23 @@ function hasVariant(variants, groupName, variant) {
|
|
|
202
204
|
return (groupVariants[variant] !== undefined && groupVariants[variant] !== false);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
|
-
function
|
|
207
|
+
function wrapFlexContainerChildren(children, hasGap) {
|
|
208
|
+
// We need to always wrap the children, even if there are no gaps, because
|
|
209
|
+
// otherwise if we toggle between with and without gap, React reconciliation
|
|
210
|
+
// will blow away the children tree and all state if we switch from having
|
|
211
|
+
// a wrapper and not.
|
|
212
|
+
var className = hasGap ? "__wab_flex-container ρfc" : "__wab_passthrough";
|
|
213
|
+
if (!children) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
else if (Array.isArray(children)) {
|
|
217
|
+
return React.createElement.apply(React, __spreadArray(["div", { className: className }], __read(children), false));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
return React.createElement("div", { className: className }, children);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenInFlex) {
|
|
206
224
|
if (!override ||
|
|
207
225
|
(typeof override === "object" && Object.keys(override).length === 0)) {
|
|
208
226
|
return createElementWithChildren(defaultRoot, defaultProps, defaultProps.children);
|
|
@@ -229,6 +247,10 @@ function createPlasmicElement(override, defaultRoot, defaultProps) {
|
|
|
229
247
|
if (override2.wrapChildren) {
|
|
230
248
|
children = override2.wrapChildren(ensureNotArray(children));
|
|
231
249
|
}
|
|
250
|
+
if (wrapChildrenInFlex) {
|
|
251
|
+
// For legacy, we still support data-plasmic-wrap-flex-children
|
|
252
|
+
children = wrapFlexContainerChildren(children, true);
|
|
253
|
+
}
|
|
232
254
|
var result = createElementWithChildren(root, props, children);
|
|
233
255
|
if (override2.wrap) {
|
|
234
256
|
result = override2.wrap(result);
|
|
@@ -289,13 +311,15 @@ function createPlasmicElementFromJsx(defaultElement, props) {
|
|
|
289
311
|
children[_i - 2] = arguments[_i];
|
|
290
312
|
}
|
|
291
313
|
var override = props["data-plasmic-override"];
|
|
314
|
+
var wrapFlexChild = props["data-plasmic-wrap-flex-child"];
|
|
292
315
|
var triggerProps = ((_a = props["data-plasmic-trigger-props"]) !== null && _a !== void 0 ? _a : []);
|
|
293
316
|
delete props["data-plasmic-override"];
|
|
317
|
+
delete props["data-plasmic-wrap-flex-child"];
|
|
294
318
|
delete props["data-plasmic-trigger-props"];
|
|
295
319
|
return createPlasmicElement(override, defaultElement, mergeProps.apply(void 0, __spreadArray([props,
|
|
296
320
|
children.length === 0
|
|
297
321
|
? {}
|
|
298
|
-
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)));
|
|
322
|
+
: { children: children.length === 1 ? children[0] : children }], __read(triggerProps), false)), wrapFlexChild);
|
|
299
323
|
}
|
|
300
324
|
function makeFragment() {
|
|
301
325
|
var children = [];
|