@plasmicapp/react-web
Advanced tools
Comparing version 0.1.25 to 0.1.27
import * as React from "react"; | ||
export declare type ElementTag = keyof JSX.IntrinsicElements; | ||
export declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : "Unexpected extraneous props"; | ||
interface Variants { | ||
@@ -22,3 +22,3 @@ [vg: string]: any; | ||
as: C; | ||
props: Partial<React.ComponentProps<C>>; | ||
props?: Partial<React.ComponentProps<C>>; | ||
} & OverrideTwiddle; | ||
@@ -28,2 +28,3 @@ export declare type RenderOverride<C extends React.ElementType> = { | ||
render: (props: React.ComponentProps<C>) => React.ReactNode; | ||
props?: Partial<React.ComponentProps<C>>; | ||
} & OverrideTwiddle; | ||
@@ -43,3 +44,2 @@ export declare type Override<DefaultElementType extends React.ElementType> = DefaultOverride<DefaultElementType> | AsOverride<any> | RenderOverride<DefaultElementType>; | ||
as?: never; | ||
props?: never; | ||
}) | React.ReactChild | null | undefined | (Partial<React.ComponentProps<DefaultElementType>> & { | ||
@@ -46,0 +46,0 @@ wrap?: never; |
@@ -72,9 +72,7 @@ "use strict"; | ||
var override2 = deriveOverride(override); | ||
var props = mergeOverrideProps(defaultProps, override2.props); | ||
if (override2.type === "render") { | ||
return override2.render(defaultProps); | ||
return override2.render(props); | ||
} | ||
var root = override2.type === "as" ? override2.as || defaultRoot : defaultRoot; | ||
var props = mergeOverrideProps(defaultProps, override2.type === "default" || override2.type === "as" | ||
? override2.props | ||
: {}); | ||
var children = props.children; | ||
@@ -285,3 +283,3 @@ if (override2.wrapChildren) { | ||
} | ||
return React.createElement(as || "div", mergeOverrideProps({ className: "__wab_slot" }, rest), content); | ||
return React.createElement(as || "div", mergeProps({ className: "__wab_slot" }, rest), content); | ||
} | ||
@@ -460,3 +458,3 @@ exports.PlasmicSlot = PlasmicSlot; | ||
function mergeFlexOverride(fo1, fo2) { | ||
var _a; | ||
var _a, _b; | ||
if (!fo1) { | ||
@@ -472,6 +470,8 @@ return fo2; | ||
var wrapChildren = chainSingleArgFuncs.apply(void 0, [o1.wrapChildren, o2.wrapChildren].filter(notNil)); | ||
// "render" type always takes precedence | ||
// "render" type always takes precedence, but we still merge the props | ||
var props = mergeOverrideProps((_a = o1.props, (_a !== null && _a !== void 0 ? _a : {})), o2.props); | ||
if (o2.type === "render") { | ||
return { | ||
render: o2.render, | ||
props: props, | ||
wrap: wrap, | ||
@@ -484,2 +484,3 @@ wrapChildren: wrapChildren | ||
render: o1.render, | ||
props: props, | ||
wrap: wrap, | ||
@@ -489,5 +490,4 @@ wrapChildren: wrapChildren | ||
} | ||
var props = mergeOverrideProps(o1.props, o2.props); | ||
// "as" will take precedence | ||
var as = (_a = (o2.type === "as" ? o2.as : undefined), (_a !== null && _a !== void 0 ? _a : (o1.type === "as" ? o1.as : undefined))); | ||
var as = (_b = (o2.type === "as" ? o2.as : undefined), (_b !== null && _b !== void 0 ? _b : (o1.type === "as" ? o1.as : undefined))); | ||
return __assign({ props: props, | ||
@@ -494,0 +494,0 @@ wrap: wrap, |
{ | ||
"name": "@plasmicapp/react-web", | ||
"version": "0.1.25", | ||
"version": "0.1.27", | ||
"description": "plasmic library for rendering in the presentational style", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
35095