@plasmicapp/react-web 0.2.364 → 0.2.366
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/index.cjs.js +3 -3
- package/dist/react-web.esm.js +3 -3
- package/lib/nextjs-app-router/react-server/index.cjs.js +3 -3
- package/lib/nextjs-app-router/react-server/index.js +3 -3
- package/package.json +4 -4
- package/skinny/dist/{collection-utils-b8088b18.js → collection-utils-690045f9.js} +4 -4
- package/skinny/dist/{collection-utils-b8088b18.js.map → collection-utils-690045f9.js.map} +1 -1
- package/skinny/dist/{common-7e2bbe30.js → common-a21bdc95.js} +4 -4
- package/skinny/dist/{common-7e2bbe30.js.map → common-a21bdc95.js.map} +1 -1
- package/skinny/dist/index.js +4 -4
- package/skinny/dist/plume/button/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js +5 -5
- package/skinny/dist/plume/menu/index.js +6 -6
- package/skinny/dist/plume/menu-button/index.js +5 -5
- package/skinny/dist/plume/select/index.js +6 -6
- package/skinny/dist/plume/switch/index.js +5 -5
- package/skinny/dist/plume/text-input/index.js +2 -2
- package/skinny/dist/plume/triggered-overlay/index.js +4 -4
- package/skinny/dist/{plume-utils-9472dfe6.js → plume-utils-bc11b672.js} +2 -2
- package/skinny/dist/{plume-utils-9472dfe6.js.map → plume-utils-bc11b672.js.map} +1 -1
- package/skinny/dist/{props-utils-b08721e5.js → props-utils-9d995f69.js} +2 -2
- package/skinny/dist/{props-utils-b08721e5.js.map → props-utils-9d995f69.js.map} +1 -1
- package/skinny/dist/{react-utils-d266354d.js → react-utils-2892a561.js} +2 -2
- package/skinny/dist/{react-utils-d266354d.js.map → react-utils-2892a561.js.map} +1 -1
- package/skinny/dist/render/PlasmicImg/index.js +2 -2
- package/skinny/dist/{ssr-61d6e91a.js → ssr-cfc9b457.js} +2 -2
- package/skinny/dist/{ssr-61d6e91a.js.map → ssr-cfc9b457.js.map} +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -62,7 +62,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
62
62
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
63
63
|
PERFORMANCE OF THIS SOFTWARE.
|
|
64
64
|
***************************************************************************** */
|
|
65
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
65
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
66
66
|
|
|
67
67
|
var extendStatics = function(d, b) {
|
|
68
68
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -113,8 +113,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function __generator(thisArg, body) {
|
|
116
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
117
|
-
return g =
|
|
116
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
117
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
118
118
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
119
119
|
function step(op) {
|
|
120
120
|
if (f) throw new TypeError("Generator is already executing.");
|
package/dist/react-web.esm.js
CHANGED
|
@@ -43,7 +43,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
43
43
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
44
|
PERFORMANCE OF THIS SOFTWARE.
|
|
45
45
|
***************************************************************************** */
|
|
46
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
46
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
47
47
|
|
|
48
48
|
var extendStatics = function(d, b) {
|
|
49
49
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -94,8 +94,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function __generator(thisArg, body) {
|
|
97
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
98
|
-
return g =
|
|
97
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
98
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
99
99
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
100
100
|
function step(op) {
|
|
101
101
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -19,7 +19,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
19
19
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
20
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
21
|
***************************************************************************** */
|
|
22
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
22
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -33,8 +33,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function __generator(thisArg, body) {
|
|
36
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
-
return g =
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
37
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
38
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
39
|
function step(op) {
|
|
40
40
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -18,7 +18,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -32,8 +32,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function __generator(thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g =
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
36
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
37
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
38
|
function step(op) {
|
|
39
39
|
if (f) throw new TypeError("Generator is already executing.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.366",
|
|
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",
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@plasmicapp/auth-react": "0.0.22",
|
|
100
|
-
"@plasmicapp/data-sources": "0.1.
|
|
100
|
+
"@plasmicapp/data-sources": "0.1.170",
|
|
101
101
|
"@plasmicapp/data-sources-context": "0.1.21",
|
|
102
|
-
"@plasmicapp/host": "1.0.
|
|
102
|
+
"@plasmicapp/host": "1.0.210",
|
|
103
103
|
"@plasmicapp/loader-splits": "1.0.62",
|
|
104
104
|
"@plasmicapp/nextjs-app-router": "1.0.15",
|
|
105
105
|
"@plasmicapp/prepass": "1.0.19",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"react": ">=16.8.0",
|
|
169
169
|
"react-dom": ">=16.8.0"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "7f923856013e0efa4eb893fa16c2f48bd4edc9c3"
|
|
172
172
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as __assign, k as isString } from './common-
|
|
1
|
+
import { a as __assign, k as isString } from './common-a21bdc95.js';
|
|
2
2
|
import { Item, Section } from '@react-stately/collections';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { t as toChildArray, g as getElementTypeName } from './react-utils-
|
|
5
|
-
import { g as getPlumeType, P as PLUME_STRICT_MODE } from './plume-utils-
|
|
4
|
+
import { t as toChildArray, g as getElementTypeName } from './react-utils-2892a561.js';
|
|
5
|
+
import { g as getPlumeType, P as PLUME_STRICT_MODE } from './plume-utils-bc11b672.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* In general, we try not to expose react-aria's Collections API to Plume users.
|
|
@@ -300,4 +300,4 @@ function cloneChild(child, props) {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export { renderAsCollectionChild as a, useDerivedItems as b, getChildProp as g, renderCollectionNode as r, useDerivedItemsFromChildren as u };
|
|
303
|
-
//# sourceMappingURL=collection-utils-
|
|
303
|
+
//# sourceMappingURL=collection-utils-690045f9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-utils-b8088b18.js","sources":["../../src/plume/collection-utils.tsx"],"sourcesContent":["/**\n * In general, we try not to expose react-aria's Collections API to Plume users.\n * The Collections API is how react-aria users pass data about collections of\n * things using the built-in Item and Section components, which are abstract,\n * metadata-only components that don't render anything but only serve to specify\n * data. For example, here's how you would use react-spectrum's Picker:\n *\n * <Picker>\n * <Section title=\"Asia\">\n * <Item key=\"taiwan\">Taiwan</Item>\n * <Item key=\"japan\">Japan</Item>\n * <Item key=\"china\">China</Item>\n * </Section>\n * <Section title=\"Europe\">\n * <Item key=\"germany\">Germany</Item>\n * <Item key=\"france\">France</Item>\n * </Section>\n * </Picker>\n *\n * You would re-use this same Item/Section components to pass similar things to\n * Menu, Tabs, etc.\n *\n * For Plasmic, this API is too abstract. The user has explicitly designed components\n * like Select.Option and Select.OptionGroup, and it is weird that they don't actually\n * use these components. It is more natural to do:\n *\n * <Select>\n * <Select.OptionGroup title=\"Asia\">\n * <Select.Option key=\"taiwan\">Taiwan</Select>\n * </Select.OptionGroup>\n * </Select>\n *\n * For Plume, we let users directly use the components they designed, both to collect\n * information and to perform actual rendering. For example, for Plume,\n * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.\n * This means that the Select.Option props will collect the same information Item\n * does.\n *\n * A component like Select.Option then serves two purposes:\n *\n * 1. Allow users to specify the collection of data, like in the above example\n * Here, we're mainly interested in the props in those ReactElements so\n * we can pass the Item/Section data onto react-aria's APIs. We are not\n * actually rendering these elements.\n * 2. Once react-aria's Collections API has gone through them and built\n * Collection \"nodes\", we then create cloned versions of these elements\n * with the corresponding node passed in as a secret prop. These ReactElements\n * are then actually used to _render_ the corresponding Option / OptionGroup.\n *\n * This file contains helper functions to help with implementing the above.\n *\n * Note also that most of the collections-based react-aria components expose\n * a parallel API that accepts a list of \"items\" and a render prop, instead\n * of list of Item/Section elements. This is for efficiency, but we are opting\n * to only support the composite-component pattern for now for simplicity.\n */\n\nimport { Item, Section } from \"@react-stately/collections\";\nimport { Node } from \"@react-types/shared\";\nimport React from \"react\";\nimport { isString } from \"../common\";\nimport { getElementTypeName, toChildArray } from \"../react-utils\";\nimport { getPlumeType, PLUME_STRICT_MODE } from \"./plume-utils\";\n\nexport interface PlasmicLoaderProps<T> {\n component: string;\n componentProps: T;\n}\n\n/**\n * Props for a Plume component that corresponds to an Item\n */\nexport interface ItemLikeProps {\n /**\n * value key corresponding to this item. Not required if you use the\n * `key` prop instead.\n */\n value?: string | null;\n\n /**\n * The text string value corresponding to this item. Used to support\n * keyboard type-ahead. If not specified, then will be derived from\n * `children` if it is a string, or the `value` or `key`.\n */\n textValue?: string;\n\n /**\n * aria-label for this item.\n */\n \"aria-label\"?: string;\n\n /**\n * Primary content label for this item.\n */\n children?: React.ReactNode;\n\n /**\n * If true, this item will not be selectable.\n */\n isDisabled?: boolean;\n}\n\ntype LoaderAwareItemLikeProps =\n | ItemLikeProps\n | PlasmicLoaderProps<ItemLikeProps>;\n\n/**\n * Props for a Plume component that corresponds to a Section\n */\nexport interface SectionLikeProps {\n /**\n * Heading content of the title\n */\n title?: React.ReactNode;\n\n /**\n * aria-label for this section\n */\n \"aria-label\"?: string;\n\n /**\n * A list of items that belong in this group\n */\n children?: React.ReactNode;\n}\n\ntype LoaderAwareSectionLikeProps =\n | SectionLikeProps\n | PlasmicLoaderProps<SectionLikeProps>;\n\nexport type ItemJson = LeafItemJson | SectionJson;\n\nexport type LeafItemJson =\n | string\n | {\n value: string;\n label?: string;\n textValue?: string;\n isDisabled?: boolean;\n };\n\nexport interface SectionJson {\n title: string;\n children: ItemJson[];\n}\n\nexport function deriveItemsFromProps(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n if (opts.itemsProp && opts.itemsProp in props) {\n if (!opts.ItemComponent || !opts.SectionComponent) {\n throw new Error(`You may need to re-generate your Plasmic* files`);\n }\n const items = props[opts.itemsProp] as ItemJson[] | undefined;\n return deriveItemsFromItemsProp(items, {\n ItemComponent: opts.ItemComponent,\n SectionComponent: opts.SectionComponent,\n });\n } else {\n return deriveItemsFromChildren(props.children as React.ReactNode, opts);\n }\n}\n\nfunction deriveItemsFromItemsProp(\n items: ItemJson[] | undefined,\n opts: {\n ItemComponent: React.ComponentType<ItemLikeProps>;\n SectionComponent: React.ComponentType<SectionLikeProps>;\n }\n) {\n const { ItemComponent, SectionComponent } = opts;\n const disabledKeys: string[] = [];\n const transform = (item: ItemJson) => {\n if (typeof item === \"string\") {\n return (\n <ItemComponent key={item} value={item}>\n {item}\n </ItemComponent>\n );\n } else if (\"children\" in item) {\n return (\n <SectionComponent key={item.title} title={item.title}>\n {item.children.map((x) => transform(x))}\n </SectionComponent>\n );\n } else {\n if (item.isDisabled) {\n disabledKeys.push(item.value);\n }\n return (\n <ItemComponent\n key={item.value}\n value={item.value}\n textValue={item.textValue}\n isDisabled={item.isDisabled}\n >\n {item.label ?? item.value}\n </ItemComponent>\n );\n }\n };\n return {\n items: items?.map((x) => transform(x)) ?? [],\n disabledKeys,\n };\n}\n\n/**\n * Given children of a component like Select or Menu, derive the items\n * that we will pass into the Collections API. These will be\n * ReactElement<ItemLikeProps|SectionLikeProps>[].\n *\n * Will also assign keys to items by their index in the collection,\n * and collect the keys of disabled items.\n */\nexport function deriveItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n if (!children) {\n return {\n items: [] as T[],\n disabledKeys: [] as React.Key[],\n };\n }\n\n const { itemPlumeType, sectionPlumeType, invalidChildError } = opts;\n\n // For Plume items without an explicit key, we assign a key as the index\n // of the collection.\n let itemCount = 0;\n let sectionCount = 0;\n\n const ensureValue = (element: React.ReactElement) => {\n if (!propInChild(element, \"value\")) {\n if (opts.requireItemValue && PLUME_STRICT_MODE) {\n throw new Error(\n `Must specify a \"value\" prop for ${getElementTypeName(element)}`\n );\n } else {\n return cloneChild(element, { value: `${itemCount++}` });\n }\n } else {\n // Still increment count even if key is present, so that the\n // auto-assigned key really reflects the index\n itemCount++;\n return element;\n }\n };\n\n const disabledKeys: React.Key[] = [];\n\n const flattenedChildren = (\n children: React.ReactNode\n ): React.ReactElement[] => {\n return toChildArray(children).flatMap((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return flattenedChildren(\n (child as React.ReactElement<{ children: React.ReactNode }>).props\n .children\n );\n }\n const type = getPlumeType(child);\n if (type === itemPlumeType) {\n child = ensureValue(child);\n const childKey = getItemLikeKey(child);\n if (getChildProp(child, \"isDisabled\") && !!childKey) {\n disabledKeys.push(childKey);\n }\n return [child];\n }\n if (type === sectionPlumeType) {\n return [\n cloneChild(child, {\n // key of section doesn't actually matter, just needs\n // to be unique\n key: child.key ?? `section-${sectionCount++}`,\n children: flattenedChildren(getChildProp(child, \"children\")),\n }),\n ];\n }\n }\n\n if (PLUME_STRICT_MODE) {\n throw new Error(invalidChildError ?? `Unexpected child`);\n } else {\n return [];\n }\n });\n };\n\n return { items: flattenedChildren(children) as T[], disabledKeys };\n}\n\nexport function useDerivedItems(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n const { children } = props;\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n itemsProp,\n } = opts;\n const items = itemsProp ? props[itemsProp] : undefined;\n return React.useMemo(() => {\n return deriveItemsFromProps(props, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n itemsProp,\n ItemComponent,\n SectionComponent,\n });\n }, [\n children,\n items,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n ]);\n}\n\nexport function useDerivedItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n } = opts;\n return React.useMemo(() => {\n return deriveItemsFromChildren<T>(children, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n });\n }, [\n children,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ]);\n}\n\n/**\n * Given a Collection node, create the React element that we should use\n * to render it.\n */\nexport function renderCollectionNode(node: Node<any>) {\n // node.rendered should already have our item-like or section-like Plume\n // component elements, so we just need to clone them with a secret\n // _node prop that we use to render.\n return cloneChild(node.rendered as React.ReactElement, {\n _node: node,\n key: node.key,\n });\n}\n\n/**\n * Renders a item-like or section-like Plume component element into an\n * Item or a Section element.\n */\nexport function renderAsCollectionChild<\n T extends React.ReactElement<\n LoaderAwareItemLikeProps | LoaderAwareSectionLikeProps\n >\n>(\n child: T,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n }\n) {\n const plumeType = getPlumeType(child);\n if (plumeType === opts.itemPlumeType) {\n const option = child as React.ReactElement<LoaderAwareItemLikeProps>;\n\n // We look at the children passed to the item-like element, and derive key\n // or textValue from it if it is a string\n const content = getChildProp(option, \"children\");\n\n // The children render prop needs to return an <Item/>\n return (\n <Item\n // We use ItemLike.value if the user explicitly specified a value,\n // and we fallback to key. If the user specified neither, then\n // the Collections API will generate a unique key for this item.\n key={getItemLikeKey(option)}\n // textValue is either explicitly specified by the user, or we\n // try to derive it if `content` is a string.\n textValue={\n getChildProp(option, \"textValue\") ??\n (isString(content)\n ? content\n : propInChild(option, \"value\")\n ? getChildProp(option, \"value\")\n : option.key)\n }\n aria-label={getChildProp(option, \"aria-label\")}\n >\n {\n // Note that what we setting the item-like element as the children\n // here, and not content; we want the entire item-like Plume element to\n // end up as Node.rendered.\n }\n {option}\n </Item>\n );\n } else {\n const group = child as React.ReactElement<LoaderAwareSectionLikeProps>;\n return (\n <Section\n // Note that we are using the whole section-like element as the title\n // here, and not group.props.title; we want the entire section-like\n // Plume element to end up as Node.rendered.\n title={group}\n aria-label={getChildProp(group, \"aria-label\")}\n // We are flattening and deriving the descendant Options as items here.\n // group.props.children should've already been cleaned up by\n // deriveItemsFromChildren()\n items={getChildProp(group, \"children\") as React.ReactElement[]}\n >\n {\n // We use the same render function to turn descendent Options into Items\n }\n {(c: React.ReactElement) => renderAsCollectionChild(c, opts)}\n </Section>\n );\n }\n}\n\nfunction getItemLikeKey(element: React.ReactElement<LoaderAwareItemLikeProps>) {\n return getChildProp(element, \"value\") ?? element.key;\n}\n\n// PlasmicLoader-aware function to get prop from child.\nexport function getChildProp(child: React.ReactElement, prop: string) {\n return \"componentProps\" in child.props\n ? child.props.componentProps[prop]\n : child.props[prop];\n}\n\n// PlasmicLoader-aware function to check `if (prop in element.props)`.\nfunction propInChild(child: React.ReactElement, prop: string): boolean {\n return \"componentProps\" in child.props\n ? prop in child.props.componentProps\n : prop in child.props;\n}\n\n// PlasmicLoader-aware function to clone React element.\nfunction cloneChild(child: React.ReactElement, props: Record<string, any>) {\n if ((child.type as any).getPlumeType) {\n // If React element has getPlumeType(), assume that it is PlasmicLoader,\n // so add nodeProps to componentProps instead of element props.\n return React.cloneElement(child, {\n componentProps: {\n ...child.props.componentProps,\n ...props,\n },\n ...(props.key ? { key: props.key } : {}),\n });\n }\n\n return React.cloneElement(child, props);\n}\n"],"names":["React"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDG;AA2Fa,SAAA,oBAAoB,CAClC,KAAU,EACV,IAQC,EAAA;IAED,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE;QAC7C,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;AACjD,YAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;AACpE,SAAA;QACD,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAA2B,CAAC;QAC9D,OAAO,wBAAwB,CAAC,KAAK,EAAE;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;AACxC,SAAA,CAAC,CAAC;AACJ,KAAA;AAAM,SAAA;QACL,OAAO,uBAAuB,CAAC,KAAK,CAAC,QAA2B,EAAE,IAAI,CAAC,CAAC;AACzE,KAAA;AACH,CAAC;AAED,SAAS,wBAAwB,CAC/B,KAA6B,EAC7B,IAGC,EAAA;;IAEO,IAAA,aAAa,GAAuB,IAAI,CAAA,aAA3B,EAAE,gBAAgB,GAAK,IAAI,CAAA,gBAAT,CAAU;IACjD,IAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAM,SAAS,GAAG,UAAC,IAAc,EAAA;;AAC/B,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC5B,YAAA,QACEA,cAAA,CAAA,aAAA,CAAC,aAAa,EAAA,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAA,EAClC,IAAI,CACS,EAChB;AACH,SAAA;aAAM,IAAI,UAAU,IAAI,I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,KAAK,CAAC,CAAC;AAC1C;;;;"}
|
|
1
|
+
{"version":3,"file":"collection-utils-690045f9.js","sources":["../../src/plume/collection-utils.tsx"],"sourcesContent":["/**\n * In general, we try not to expose react-aria's Collections API to Plume users.\n * The Collections API is how react-aria users pass data about collections of\n * things using the built-in Item and Section components, which are abstract,\n * metadata-only components that don't render anything but only serve to specify\n * data. For example, here's how you would use react-spectrum's Picker:\n *\n * <Picker>\n * <Section title=\"Asia\">\n * <Item key=\"taiwan\">Taiwan</Item>\n * <Item key=\"japan\">Japan</Item>\n * <Item key=\"china\">China</Item>\n * </Section>\n * <Section title=\"Europe\">\n * <Item key=\"germany\">Germany</Item>\n * <Item key=\"france\">France</Item>\n * </Section>\n * </Picker>\n *\n * You would re-use this same Item/Section components to pass similar things to\n * Menu, Tabs, etc.\n *\n * For Plasmic, this API is too abstract. The user has explicitly designed components\n * like Select.Option and Select.OptionGroup, and it is weird that they don't actually\n * use these components. It is more natural to do:\n *\n * <Select>\n * <Select.OptionGroup title=\"Asia\">\n * <Select.Option key=\"taiwan\">Taiwan</Select>\n * </Select.OptionGroup>\n * </Select>\n *\n * For Plume, we let users directly use the components they designed, both to collect\n * information and to perform actual rendering. For example, for Plume,\n * you'd use Select.Option instead of Item, and Select.OptionGroup instead of Section.\n * This means that the Select.Option props will collect the same information Item\n * does.\n *\n * A component like Select.Option then serves two purposes:\n *\n * 1. Allow users to specify the collection of data, like in the above example\n * Here, we're mainly interested in the props in those ReactElements so\n * we can pass the Item/Section data onto react-aria's APIs. We are not\n * actually rendering these elements.\n * 2. Once react-aria's Collections API has gone through them and built\n * Collection \"nodes\", we then create cloned versions of these elements\n * with the corresponding node passed in as a secret prop. These ReactElements\n * are then actually used to _render_ the corresponding Option / OptionGroup.\n *\n * This file contains helper functions to help with implementing the above.\n *\n * Note also that most of the collections-based react-aria components expose\n * a parallel API that accepts a list of \"items\" and a render prop, instead\n * of list of Item/Section elements. This is for efficiency, but we are opting\n * to only support the composite-component pattern for now for simplicity.\n */\n\nimport { Item, Section } from \"@react-stately/collections\";\nimport { Node } from \"@react-types/shared\";\nimport React from \"react\";\nimport { isString } from \"../common\";\nimport { getElementTypeName, toChildArray } from \"../react-utils\";\nimport { getPlumeType, PLUME_STRICT_MODE } from \"./plume-utils\";\n\nexport interface PlasmicLoaderProps<T> {\n component: string;\n componentProps: T;\n}\n\n/**\n * Props for a Plume component that corresponds to an Item\n */\nexport interface ItemLikeProps {\n /**\n * value key corresponding to this item. Not required if you use the\n * `key` prop instead.\n */\n value?: string | null;\n\n /**\n * The text string value corresponding to this item. Used to support\n * keyboard type-ahead. If not specified, then will be derived from\n * `children` if it is a string, or the `value` or `key`.\n */\n textValue?: string;\n\n /**\n * aria-label for this item.\n */\n \"aria-label\"?: string;\n\n /**\n * Primary content label for this item.\n */\n children?: React.ReactNode;\n\n /**\n * If true, this item will not be selectable.\n */\n isDisabled?: boolean;\n}\n\ntype LoaderAwareItemLikeProps =\n | ItemLikeProps\n | PlasmicLoaderProps<ItemLikeProps>;\n\n/**\n * Props for a Plume component that corresponds to a Section\n */\nexport interface SectionLikeProps {\n /**\n * Heading content of the title\n */\n title?: React.ReactNode;\n\n /**\n * aria-label for this section\n */\n \"aria-label\"?: string;\n\n /**\n * A list of items that belong in this group\n */\n children?: React.ReactNode;\n}\n\ntype LoaderAwareSectionLikeProps =\n | SectionLikeProps\n | PlasmicLoaderProps<SectionLikeProps>;\n\nexport type ItemJson = LeafItemJson | SectionJson;\n\nexport type LeafItemJson =\n | string\n | {\n value: string;\n label?: string;\n textValue?: string;\n isDisabled?: boolean;\n };\n\nexport interface SectionJson {\n title: string;\n children: ItemJson[];\n}\n\nexport function deriveItemsFromProps(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n if (opts.itemsProp && opts.itemsProp in props) {\n if (!opts.ItemComponent || !opts.SectionComponent) {\n throw new Error(`You may need to re-generate your Plasmic* files`);\n }\n const items = props[opts.itemsProp] as ItemJson[] | undefined;\n return deriveItemsFromItemsProp(items, {\n ItemComponent: opts.ItemComponent,\n SectionComponent: opts.SectionComponent,\n });\n } else {\n return deriveItemsFromChildren(props.children as React.ReactNode, opts);\n }\n}\n\nfunction deriveItemsFromItemsProp(\n items: ItemJson[] | undefined,\n opts: {\n ItemComponent: React.ComponentType<ItemLikeProps>;\n SectionComponent: React.ComponentType<SectionLikeProps>;\n }\n) {\n const { ItemComponent, SectionComponent } = opts;\n const disabledKeys: string[] = [];\n const transform = (item: ItemJson) => {\n if (typeof item === \"string\") {\n return (\n <ItemComponent key={item} value={item}>\n {item}\n </ItemComponent>\n );\n } else if (\"children\" in item) {\n return (\n <SectionComponent key={item.title} title={item.title}>\n {item.children.map((x) => transform(x))}\n </SectionComponent>\n );\n } else {\n if (item.isDisabled) {\n disabledKeys.push(item.value);\n }\n return (\n <ItemComponent\n key={item.value}\n value={item.value}\n textValue={item.textValue}\n isDisabled={item.isDisabled}\n >\n {item.label ?? item.value}\n </ItemComponent>\n );\n }\n };\n return {\n items: items?.map((x) => transform(x)) ?? [],\n disabledKeys,\n };\n}\n\n/**\n * Given children of a component like Select or Menu, derive the items\n * that we will pass into the Collections API. These will be\n * ReactElement<ItemLikeProps|SectionLikeProps>[].\n *\n * Will also assign keys to items by their index in the collection,\n * and collect the keys of disabled items.\n */\nexport function deriveItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n if (!children) {\n return {\n items: [] as T[],\n disabledKeys: [] as React.Key[],\n };\n }\n\n const { itemPlumeType, sectionPlumeType, invalidChildError } = opts;\n\n // For Plume items without an explicit key, we assign a key as the index\n // of the collection.\n let itemCount = 0;\n let sectionCount = 0;\n\n const ensureValue = (element: React.ReactElement) => {\n if (!propInChild(element, \"value\")) {\n if (opts.requireItemValue && PLUME_STRICT_MODE) {\n throw new Error(\n `Must specify a \"value\" prop for ${getElementTypeName(element)}`\n );\n } else {\n return cloneChild(element, { value: `${itemCount++}` });\n }\n } else {\n // Still increment count even if key is present, so that the\n // auto-assigned key really reflects the index\n itemCount++;\n return element;\n }\n };\n\n const disabledKeys: React.Key[] = [];\n\n const flattenedChildren = (\n children: React.ReactNode\n ): React.ReactElement[] => {\n return toChildArray(children).flatMap((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return flattenedChildren(\n (child as React.ReactElement<{ children: React.ReactNode }>).props\n .children\n );\n }\n const type = getPlumeType(child);\n if (type === itemPlumeType) {\n child = ensureValue(child);\n const childKey = getItemLikeKey(child);\n if (getChildProp(child, \"isDisabled\") && !!childKey) {\n disabledKeys.push(childKey);\n }\n return [child];\n }\n if (type === sectionPlumeType) {\n return [\n cloneChild(child, {\n // key of section doesn't actually matter, just needs\n // to be unique\n key: child.key ?? `section-${sectionCount++}`,\n children: flattenedChildren(getChildProp(child, \"children\")),\n }),\n ];\n }\n }\n\n if (PLUME_STRICT_MODE) {\n throw new Error(invalidChildError ?? `Unexpected child`);\n } else {\n return [];\n }\n });\n };\n\n return { items: flattenedChildren(children) as T[], disabledKeys };\n}\n\nexport function useDerivedItems(\n props: any,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n ItemComponent?: React.ComponentType<ItemLikeProps>;\n SectionComponent?: React.ComponentType<SectionLikeProps>;\n itemsProp?: string;\n }\n) {\n const { children } = props;\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n itemsProp,\n } = opts;\n const items = itemsProp ? props[itemsProp] : undefined;\n return React.useMemo(() => {\n return deriveItemsFromProps(props, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n itemsProp,\n ItemComponent,\n SectionComponent,\n });\n }, [\n children,\n items,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ItemComponent,\n SectionComponent,\n ]);\n}\n\nexport function useDerivedItemsFromChildren<T extends React.ReactElement>(\n children: React.ReactNode,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n invalidChildError?: string;\n requireItemValue: boolean;\n }\n) {\n const {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n } = opts;\n return React.useMemo(() => {\n return deriveItemsFromChildren<T>(children, {\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n });\n }, [\n children,\n itemPlumeType,\n sectionPlumeType,\n invalidChildError,\n requireItemValue,\n ]);\n}\n\n/**\n * Given a Collection node, create the React element that we should use\n * to render it.\n */\nexport function renderCollectionNode(node: Node<any>) {\n // node.rendered should already have our item-like or section-like Plume\n // component elements, so we just need to clone them with a secret\n // _node prop that we use to render.\n return cloneChild(node.rendered as React.ReactElement, {\n _node: node,\n key: node.key,\n });\n}\n\n/**\n * Renders a item-like or section-like Plume component element into an\n * Item or a Section element.\n */\nexport function renderAsCollectionChild<\n T extends React.ReactElement<\n LoaderAwareItemLikeProps | LoaderAwareSectionLikeProps\n >\n>(\n child: T,\n opts: {\n itemPlumeType: string;\n sectionPlumeType?: string;\n }\n) {\n const plumeType = getPlumeType(child);\n if (plumeType === opts.itemPlumeType) {\n const option = child as React.ReactElement<LoaderAwareItemLikeProps>;\n\n // We look at the children passed to the item-like element, and derive key\n // or textValue from it if it is a string\n const content = getChildProp(option, \"children\");\n\n // The children render prop needs to return an <Item/>\n return (\n <Item\n // We use ItemLike.value if the user explicitly specified a value,\n // and we fallback to key. If the user specified neither, then\n // the Collections API will generate a unique key for this item.\n key={getItemLikeKey(option)}\n // textValue is either explicitly specified by the user, or we\n // try to derive it if `content` is a string.\n textValue={\n getChildProp(option, \"textValue\") ??\n (isString(content)\n ? content\n : propInChild(option, \"value\")\n ? getChildProp(option, \"value\")\n : option.key)\n }\n aria-label={getChildProp(option, \"aria-label\")}\n >\n {\n // Note that what we setting the item-like element as the children\n // here, and not content; we want the entire item-like Plume element to\n // end up as Node.rendered.\n }\n {option}\n </Item>\n );\n } else {\n const group = child as React.ReactElement<LoaderAwareSectionLikeProps>;\n return (\n <Section\n // Note that we are using the whole section-like element as the title\n // here, and not group.props.title; we want the entire section-like\n // Plume element to end up as Node.rendered.\n title={group}\n aria-label={getChildProp(group, \"aria-label\")}\n // We are flattening and deriving the descendant Options as items here.\n // group.props.children should've already been cleaned up by\n // deriveItemsFromChildren()\n items={getChildProp(group, \"children\") as React.ReactElement[]}\n >\n {\n // We use the same render function to turn descendent Options into Items\n }\n {(c: React.ReactElement) => renderAsCollectionChild(c, opts)}\n </Section>\n );\n }\n}\n\nfunction getItemLikeKey(element: React.ReactElement<LoaderAwareItemLikeProps>) {\n return getChildProp(element, \"value\") ?? element.key;\n}\n\n// PlasmicLoader-aware function to get prop from child.\nexport function getChildProp(child: React.ReactElement, prop: string) {\n return \"componentProps\" in child.props\n ? child.props.componentProps[prop]\n : child.props[prop];\n}\n\n// PlasmicLoader-aware function to check `if (prop in element.props)`.\nfunction propInChild(child: React.ReactElement, prop: string): boolean {\n return \"componentProps\" in child.props\n ? prop in child.props.componentProps\n : prop in child.props;\n}\n\n// PlasmicLoader-aware function to clone React element.\nfunction cloneChild(child: React.ReactElement, props: Record<string, any>) {\n if ((child.type as any).getPlumeType) {\n // If React element has getPlumeType(), assume that it is PlasmicLoader,\n // so add nodeProps to componentProps instead of element props.\n return React.cloneElement(child, {\n componentProps: {\n ...child.props.componentProps,\n ...props,\n },\n ...(props.key ? { key: props.key } : {}),\n });\n }\n\n return React.cloneElement(child, props);\n}\n"],"names":["React"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDG;AA2Fa,SAAA,oBAAoB,CAClC,KAAU,EACV,IAQC,EAAA;IAED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AE,OAAO,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,OAAO,CAAC,GAAG,CAAC;AACvD,CAAC;AAED;AACgB,SAAA,YAAY,CAAC,KAAyB,EAAE,IAAY,EAAA;AAClE,IAAA,OAAO,gBAAgB,IAAI,KAAK,CAAC,KAAK;UAClC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;AAClC,UAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;AACA,SAAS,WAAW,CAAC,KAAyB,EAAE,IAAY,EAAA;AAC1D,IAAA,OAAO,gBAAgB,IAAI,KAAK,CAAC,KAAK;AACpC,UAAE,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc;AACpC,UAAE,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC;AAC1B,CAAC;AAED;AACA,SAAS,UAAU,CAAC,KAAyB,EAAE,KAA0B,EAAA;AACvE,IAAA,IAAK,KAAK,CAAC,IAAY,CAAC,YAAY,EAAE;;;AAGpC,QAAA,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,aAC7B,cAAc,EAAA,QAAA,CAAA,QAAA,CAAA,EAAA,EACT,KAAK,CAAC,KAAK,CAAC,cAAc,CAC1B,EAAA,KAAK,MAEN,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GACvC,CAAC;AACJ,KAAA;IAED,OAAOA,cAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C;;;;"}
|
|
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
16
16
|
|
|
17
17
|
var extendStatics = function(d, b) {
|
|
18
18
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -63,8 +63,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function __generator(thisArg, body) {
|
|
66
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
67
|
-
return g =
|
|
66
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
67
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
68
68
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
69
69
|
function step(op) {
|
|
70
70
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -266,4 +266,4 @@ function mapValues(obj, mapper) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
export { __awaiter as _, __assign as a, __generator as b, __rest as c, __spreadArray as d, __read as e, __values as f, chainSingleArgFuncs as g, __extends as h, isSubset as i, ensure as j, isString as k, groupBy as l, mapValues as m, notNil as n, omit as o, pick as p };
|
|
269
|
-
//# sourceMappingURL=common-
|
|
269
|
+
//# sourceMappingURL=common-a21bdc95.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-
|
|
1
|
+
{"version":3,"file":"common-a21bdc95.js","sources":["../../src/common.ts"],"sourcesContent":["export function notNil<T>(x: T | undefined | null): x is T {\n return x != null;\n}\n\nexport function pick<T extends {}>(\n obj: T,\n ...keys: (string | number | symbol)[]\n): Partial<T> {\n if (Object.keys(obj).length === 0) {\n return obj;\n }\n const res: any = {};\n for (const key of keys) {\n if (key in obj) {\n res[key] = obj[key as keyof T];\n }\n }\n return res as Partial<T>;\n}\n\nexport function pickBy<T extends {}>(\n obj: T,\n func: (key: string, val: any) => boolean\n): Partial<T> {\n const res: any = {};\n for (const [key, val] of Object.entries(obj)) {\n if (func(key, val)) {\n res[key] = obj[key as keyof T];\n }\n }\n return res as Partial<T>;\n}\n\nexport function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T> {\n if (Object.keys(obj).length === 0) {\n return obj;\n }\n const res: Partial<T> = {};\n for (const key of Object.keys(obj) as (keyof T)[]) {\n if (!keys.includes(key)) {\n res[key] = obj[key];\n }\n }\n return res;\n}\n\nexport function isSubset<T>(a1: T[], a2: T[]) {\n return a1.every((x) => a2.includes(x));\n}\n\nexport function chainSingleArgFuncs<A>(...funcs: ((arg: A) => A)[]) {\n if (funcs.length === 0) {\n return undefined;\n }\n return (arg: A) => {\n let res: A = arg;\n for (const func of funcs) {\n res = func(res);\n }\n return res;\n };\n}\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n\nexport function isString(x: any): x is string {\n return typeof x === \"string\";\n}\n\nexport function groupBy<T>(\n collection: T[],\n keyFunc: (x: T) => string\n): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n for (const obj of collection) {\n const key = keyFunc(obj);\n if (key in result) {\n result[key].push(obj);\n } else {\n result[key] = [obj];\n }\n }\n return result;\n}\n\nexport function mapValues<V, V2>(\n obj: Record<string, V>,\n mapper: (value: V) => V2\n): Record<string, V2> {\n const result: Record<string, V2> = {};\n for (const key in obj) {\n result[key] = mapper(obj[key]);\n }\n return result;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,SAAA,SAAS,CACvB,GAAsB,EACtB,MAAwB,EAAA;IAExB,IAAM,MAAM,GAAuB,EAAE,CAAC;AACtC,IAAA,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE;QACrB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,KAAA;AACD,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/skinny/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames$1 from 'classnames';
|
|
2
|
-
import { _ as __awaiter, a as __assign, b as __generator, c as __rest, d as __spreadArray, e as __read, o as omit, p as pick, f as __values, i as isSubset, g as chainSingleArgFuncs, n as notNil, h as __extends, j as ensure } from './common-
|
|
2
|
+
import { _ as __awaiter, a as __assign, b as __generator, c as __rest, d as __spreadArray, e as __read, o as omit, p as pick, f as __values, i as isSubset, g as chainSingleArgFuncs, n as notNil, h as __extends, j as ensure } from './common-a21bdc95.js';
|
|
3
3
|
import { usePlasmicDataSourceContext } from '@plasmicapp/data-sources-context';
|
|
4
4
|
export { PlasmicDataSourceContextProvider, useCurrentUser } from '@plasmicapp/data-sources-context';
|
|
5
5
|
import * as plasmicQuery from '@plasmicapp/query';
|
|
@@ -7,11 +7,11 @@ import * as React from 'react';
|
|
|
7
7
|
import React__default, { useLayoutEffect, useEffect } from 'react';
|
|
8
8
|
import get from 'dlv';
|
|
9
9
|
export { default as get } from 'dlv';
|
|
10
|
-
import { c as createElementWithChildren, m as mergeProps, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect$1 } from './react-utils-
|
|
10
|
+
import { c as createElementWithChildren, m as mergeProps, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect$1 } from './react-utils-2892a561.js';
|
|
11
11
|
export { PlasmicHead, plasmicHeadMeta } from './render/PlasmicHead/index.js';
|
|
12
12
|
export { PlasmicImg } from './render/PlasmicImg/index.js';
|
|
13
|
-
import { T as Trans } from './ssr-
|
|
14
|
-
export { P as PlasmicLink, a as PlasmicRootProvider, g as genTranslatableString, u as useIsSSR, b as usePlasmicTranslator } from './ssr-
|
|
13
|
+
import { T as Trans } from './ssr-cfc9b457.js';
|
|
14
|
+
export { P as PlasmicLink, a as PlasmicRootProvider, g as genTranslatableString, u as useIsSSR, b as usePlasmicTranslator } from './ssr-cfc9b457.js';
|
|
15
15
|
import ReactDOM__default from 'react-dom';
|
|
16
16
|
import { useFocusRing } from '@react-aria/focus';
|
|
17
17
|
import { proxy, useSnapshot, ref, getVersion, subscribe } from 'valtio';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as __rest, a as __assign, p as pick, d as __spreadArray, e as __read, o as omit } from '../../common-
|
|
2
|
-
import { m as mergeVariantToggles } from '../../plume-utils-
|
|
1
|
+
import { c as __rest, a as __assign, p as pick, d as __spreadArray, e as __read, o as omit } from '../../common-a21bdc95.js';
|
|
2
|
+
import { m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
function useButton(plasmicClass, props, config, ref) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-
|
|
1
|
+
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-a21bdc95.js';
|
|
2
2
|
import { useCheckbox as useCheckbox$1 } from '@react-aria/checkbox';
|
|
3
3
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
4
4
|
import { useToggleState } from '@react-stately/toggle';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { m as mergeProps } from '../../react-utils-
|
|
7
|
-
import { c as useEnsureSSRProvider } from '../../ssr-
|
|
8
|
-
import { m as mergeVariantToggles } from '../../plume-utils-
|
|
9
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
6
|
+
import { m as mergeProps } from '../../react-utils-2892a561.js';
|
|
7
|
+
import { c as useEnsureSSRProvider } from '../../ssr-cfc9b457.js';
|
|
8
|
+
import { m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
10
10
|
import 'classnames';
|
|
11
11
|
import '@plasmicapp/data-sources-context';
|
|
12
12
|
import '@plasmicapp/host';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as __assign, p as pick, d as __spreadArray, e as __read, c as __rest } from '../../common-
|
|
1
|
+
import { a as __assign, p as pick, d as __spreadArray, e as __read, c as __rest } from '../../common-a21bdc95.js';
|
|
2
2
|
import { useMenu as useMenu$1, useMenuSection, useMenuItem as useMenuItem$1 } from '@react-aria/menu';
|
|
3
3
|
import { useTreeState } from '@react-stately/tree';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { m as mergeProps } from '../../react-utils-
|
|
6
|
-
import { c as useEnsureSSRProvider } from '../../ssr-
|
|
7
|
-
import { r as renderCollectionNode, u as useDerivedItemsFromChildren, a as renderAsCollectionChild } from '../../collection-utils-
|
|
8
|
-
import { n as noOutline, m as mergeVariantToggles } from '../../plume-utils-
|
|
9
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
5
|
+
import { m as mergeProps } from '../../react-utils-2892a561.js';
|
|
6
|
+
import { c as useEnsureSSRProvider } from '../../ssr-cfc9b457.js';
|
|
7
|
+
import { r as renderCollectionNode, u as useDerivedItemsFromChildren, a as renderAsCollectionChild } from '../../collection-utils-690045f9.js';
|
|
8
|
+
import { n as noOutline, m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
10
10
|
import { T as TriggeredOverlayContext } from '../../context-e56b6773.js';
|
|
11
11
|
import { useSeparator } from '@react-aria/separator';
|
|
12
12
|
import 'classnames';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useMenuTriggerState } from '@react-stately/menu';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { m as mergeProps } from '../../react-utils-
|
|
3
|
+
import { m as mergeProps } from '../../react-utils-2892a561.js';
|
|
4
4
|
import { T as TriggeredOverlayContext } from '../../context-e56b6773.js';
|
|
5
|
-
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-
|
|
5
|
+
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-a21bdc95.js';
|
|
6
6
|
import { useMenuTrigger as useMenuTrigger$1 } from '@react-aria/menu';
|
|
7
7
|
import { usePress } from '@react-aria/interactions';
|
|
8
|
-
import { g as getPlumeType, m as mergeVariantToggles } from '../../plume-utils-
|
|
8
|
+
import { g as getPlumeType, m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
9
9
|
import { useFocusable } from '@react-aria/focus';
|
|
10
|
-
import { c as useEnsureSSRProvider } from '../../ssr-
|
|
11
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
10
|
+
import { c as useEnsureSSRProvider } from '../../ssr-cfc9b457.js';
|
|
11
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
12
12
|
import 'classnames';
|
|
13
13
|
import '@plasmicapp/data-sources-context';
|
|
14
14
|
import '@plasmicapp/host';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as __assign, p as pick, d as __spreadArray, e as __read, c as __rest } from '../../common-
|
|
1
|
+
import { a as __assign, p as pick, d as __spreadArray, e as __read, c as __rest } from '../../common-a21bdc95.js';
|
|
2
2
|
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
3
3
|
import { usePress } from '@react-aria/interactions';
|
|
4
4
|
import { useListBox, useOption, useListBoxSection } from '@react-aria/listbox';
|
|
5
5
|
import { useSelect as useSelect$1, HiddenSelect } from '@react-aria/select';
|
|
6
6
|
import { useSelectState } from '@react-stately/select';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { m as mergeProps, d as mergeRefs } from '../../react-utils-
|
|
9
|
-
import { c as useEnsureSSRProvider } from '../../ssr-
|
|
10
|
-
import { g as getChildProp, r as renderCollectionNode, b as useDerivedItems, a as renderAsCollectionChild } from '../../collection-utils-
|
|
11
|
-
import { m as mergeVariantToggles, n as noOutline } from '../../plume-utils-
|
|
12
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
8
|
+
import { m as mergeProps, d as mergeRefs } from '../../react-utils-2892a561.js';
|
|
9
|
+
import { c as useEnsureSSRProvider } from '../../ssr-cfc9b457.js';
|
|
10
|
+
import { g as getChildProp, r as renderCollectionNode, b as useDerivedItems, a as renderAsCollectionChild } from '../../collection-utils-690045f9.js';
|
|
11
|
+
import { m as mergeVariantToggles, n as noOutline } from '../../plume-utils-bc11b672.js';
|
|
12
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
13
13
|
import { T as TriggeredOverlayContext } from '../../context-e56b6773.js';
|
|
14
14
|
import { useSeparator } from '@react-aria/separator';
|
|
15
15
|
import 'classnames';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-
|
|
1
|
+
import { a as __assign, p as pick, d as __spreadArray, e as __read } from '../../common-a21bdc95.js';
|
|
2
2
|
import { useSwitch as useSwitch$1 } from '@react-aria/switch';
|
|
3
3
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
4
4
|
import { useToggleState } from '@react-stately/toggle';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { m as mergeProps } from '../../react-utils-
|
|
7
|
-
import { c as useEnsureSSRProvider } from '../../ssr-
|
|
8
|
-
import { m as mergeVariantToggles } from '../../plume-utils-
|
|
9
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
6
|
+
import { m as mergeProps } from '../../react-utils-2892a561.js';
|
|
7
|
+
import { c as useEnsureSSRProvider } from '../../ssr-cfc9b457.js';
|
|
8
|
+
import { m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
10
10
|
import 'classnames';
|
|
11
11
|
import '@plasmicapp/data-sources-context';
|
|
12
12
|
import '@plasmicapp/host';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as __rest, a as __assign, p as pick, d as __spreadArray, e as __read, o as omit } from '../../common-
|
|
1
|
+
import { c as __rest, a as __assign, p as pick, d as __spreadArray, e as __read, o as omit } from '../../common-a21bdc95.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { m as mergeVariantToggles } from '../../plume-utils-
|
|
3
|
+
import { m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
4
4
|
|
|
5
5
|
function useTextInput(plasmicClass, props, config, ref) {
|
|
6
6
|
var _a, _b, _c;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { e as __read, a as __assign, p as pick, d as __spreadArray } from '../../common-
|
|
1
|
+
import { e as __read, a as __assign, p as pick, d as __spreadArray } from '../../common-a21bdc95.js';
|
|
2
2
|
import { usePlasmicCanvasContext } from '@plasmicapp/host';
|
|
3
3
|
import { FocusScope } from '@react-aria/focus';
|
|
4
4
|
import { useOverlay, useOverlayPosition, DismissButton } from '@react-aria/overlays';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
|
-
import { u as useIsomorphicLayoutEffect, m as mergeProps, d as mergeRefs } from '../../react-utils-
|
|
8
|
-
import { m as mergeVariantToggles } from '../../plume-utils-
|
|
9
|
-
import { g as getStyleProps } from '../../props-utils-
|
|
7
|
+
import { u as useIsomorphicLayoutEffect, m as mergeProps, d as mergeRefs } from '../../react-utils-2892a561.js';
|
|
8
|
+
import { m as mergeVariantToggles } from '../../plume-utils-bc11b672.js';
|
|
9
|
+
import { g as getStyleProps } from '../../props-utils-9d995f69.js';
|
|
10
10
|
import { T as TriggeredOverlayContext } from '../../context-e56b6773.js';
|
|
11
11
|
import 'classnames';
|
|
12
12
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { l as groupBy, m as mapValues } from './common-
|
|
2
|
+
import { l as groupBy, m as mapValues } from './common-a21bdc95.js';
|
|
3
3
|
|
|
4
4
|
var PLUME_STRICT_MODE = true;
|
|
5
5
|
function mergeVariantToggles() {
|
|
@@ -32,4 +32,4 @@ function getPlumeType(child) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { PLUME_STRICT_MODE as P, getPlumeType as g, mergeVariantToggles as m, noOutline as n };
|
|
35
|
-
//# sourceMappingURL=plume-utils-
|
|
35
|
+
//# sourceMappingURL=plume-utils-bc11b672.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plume-utils-
|
|
1
|
+
{"version":3,"file":"plume-utils-bc11b672.js","sources":["../../src/plume/plume-utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { groupBy, mapValues } from \"../common\";\nimport { SingleChoiceArg } from \"../render/elements\";\n\nexport let PLUME_STRICT_MODE = true;\n\nexport function setPlumeStrictMode(mode: boolean) {\n PLUME_STRICT_MODE = mode;\n}\n\ntype VariantArgChoices<T> = T extends (infer M)[]\n ? M\n : T extends SingleChoiceArg<infer M>\n ? M\n : never;\ntype VariantArgsChoices<V> = { [k in keyof V]-?: VariantArgChoices<V[k]> };\ntype DictValues<V extends Record<string, any>> = V[keyof V];\ntype DictTuples<V extends Record<string, any>> = DictValues<\n { [K in keyof V]: [K, V[K]] }\n>;\nexport type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;\n\ntype DistributeTuple<T> = T extends [infer T1, infer T2]\n ? { group: T1; variant: T2 }\n : never;\n\nexport type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;\n\nexport type PlasmicClass<\n V extends Record<string, any>,\n A extends Record<string, any>,\n O extends Record<string, any>\n> = {\n (props: { variants?: V; args?: A; overrides?: O }): React.ReactNode;\n internalVariantProps: (keyof V)[];\n internalArgProps: (keyof A)[];\n};\n\nexport type AnyPlasmicClass = PlasmicClass<any, any, any>;\n\nexport type PlasmicClassVariants<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<infer V, any, any> ? V : unknown;\nexport type PlasmicClassArgs<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<any, infer A, any> ? A : unknown;\nexport type PlasmicClassOverrides<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<any, any, infer O> ? O : unknown;\n\ntype BooleanLike = boolean | undefined | null;\n\nexport function mergeVariantToggles<V>(\n ...toggles: { def?: VariantDef<V>; active: BooleanLike }[]\n) {\n const definedToggles = toggles.filter((x) => !!x.def) as {\n def: VariantDef<V>;\n active: BooleanLike;\n }[];\n const grouped = groupBy(definedToggles, ({ def }) => def.group as string);\n return mapValues(grouped, (subToggles) => {\n return Object.fromEntries(\n subToggles.map(({ def, active }) => [def.variant, !!active])\n );\n });\n}\n\nexport function noOutline() {\n return { outline: \"none\" };\n}\n\nexport function getPlumeType(child: React.ReactChild): string | undefined {\n if (!React.isValidElement(child)) {\n return undefined;\n }\n const childType = child.type as any;\n return (childType.__plumeType || childType.getPlumeType?.(child.props)) as\n | string\n | undefined;\n}\n"],"names":[],"mappings":";;;AAIO,IAAI,iBAAiB,GAAG,KAAK;SAgDpB,mBAAmB,GAAA;IACjC,IAA0D,OAAA,GAAA,EAAA,CAAA;SAA1D,IAA0D,EAAA,GAAA,CAAA,EAA1D,EAA0D,GAAA,SAAA,CAAA,MAAA,EAA1D,EAA0D,EAAA,EAAA;QAA1D,OAA0D,CAAA,EAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;AAE1D,IAAA,IAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAC,CAAC,EAAA,EAAK,OAAA,CAAC,CAAC,CAAC,CAAC,GAAG,CAAP,EAAO,CAGjD,CAAC;AACJ,IAAA,IAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,UAAC,EAAO,EAAA;AAAL,QAAA,IAAA,GAAG,GAAA,EAAA,CAAA,GAAA,CAAA;QAAO,OAAA,GAAG,CAAC,KAAe,CAAA;AAAnB,KAAmB,CAAC,CAAC;AAC1E,IAAA,OAAO,SAAS,CAAC,OAAO,EAAE,UAAC,UAAU,EAAA;QACnC,OAAO,MAAM,CAAC,WAAW,CACvB,UAAU,CAAC,GAAG,CAAC,UAAC,EAAe,EAAA;gBAAb,GAAG,GAAA,EAAA,CAAA,GAAA,EAAE,MAAM,GAAA,EAAA,CAAA,MAAA,CAAA;YAAO,OAAA,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;SAAA,CAAC,CAC7D,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;SAEe,SAAS,GAAA;AACvB,IAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAEK,SAAU,YAAY,CAAC,KAAuB,EAAA;;AAClD,IAAA,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;AAChC,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AACD,IAAA,IAAM,SAAS,GAAG,KAAK,CAAC,IAAW,CAAC;AACpC,IAAA,QAAQ,SAAS,CAAC,WAAW,KAAI,MAAA,SAAS,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,SAAA,EAAG,KAAK,CAAC,KAAK,CAAC,CAAA,EAExD;AAChB;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as pick } from './common-
|
|
1
|
+
import { p as pick } from './common-a21bdc95.js';
|
|
2
2
|
|
|
3
3
|
function getStyleProps(props) {
|
|
4
4
|
return pick(props, "className", "style");
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { getStyleProps as g };
|
|
8
|
-
//# sourceMappingURL=props-utils-
|
|
8
|
+
//# sourceMappingURL=props-utils-9d995f69.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props-utils-
|
|
1
|
+
{"version":3,"file":"props-utils-9d995f69.js","sources":["../../src/plume/props-utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { pick, pickBy } from \"../common\";\nimport {\n AnyPlasmicClass,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n} from \"./plume-utils\";\n\nexport interface StyleProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function getStyleProps<P extends StyleProps>(props: P): StyleProps {\n return pick(props, \"className\", \"style\");\n}\n\nexport function getDefaultPlasmicProps<C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: Record<string, any>\n) {\n return {\n plasmicProps: {\n variants: pick(\n props,\n ...plasmicClass.internalVariantProps\n ) as PlasmicClassVariants<C>,\n args: pick(\n props,\n ...plasmicClass.internalArgProps\n ) as PlasmicClassArgs<C>,\n overrides: {} as PlasmicClassOverrides<C>,\n },\n };\n}\n\nconst RE_DATA_PROP = /^(data-.*)$/;\n\nexport function getDataProps(props: Record<string, any>) {\n return pickBy(props, (k) => RE_DATA_PROP.test(k));\n}\n"],"names":[],"mappings":";;AAcM,SAAU,aAAa,CAAuB,KAAQ,EAAA;IAC1D,OAAO,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAC3C;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign, f as __values, d as __spreadArray, e as __read } from './common-
|
|
1
|
+
import { a as __assign, f as __values, d as __spreadArray, e as __read } from './common-a21bdc95.js';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
@@ -198,4 +198,4 @@ function getElementTypeName(element) {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export { NONE as N, mergePropVals as a, isBrowser as b, createElementWithChildren as c, mergeRefs as d, ensureNotArray as e, getElementTypeName as g, isReactNode as i, mergeProps as m, toChildArray as t, useIsomorphicLayoutEffect as u };
|
|
201
|
-
//# sourceMappingURL=react-utils-
|
|
201
|
+
//# sourceMappingURL=react-utils-2892a561.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-utils-d266354d.js","sources":["../../src/react-utils.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nexport const isBrowser = typeof window !== \"undefined\";\nexport const NONE = Symbol(\"NONE\");\n\nexport const useIsomorphicLayoutEffect = isBrowser\n ? React.useLayoutEffect\n : React.useEffect;\n\nexport function createElementWithChildren(\n elementType: any,\n props: any,\n children: React.ReactNode\n) {\n if (Array.isArray(children)) {\n return React.createElement(\n elementType,\n props,\n ...children\n ) as React.ReactElement;\n } else if (children || \"children\" in props) {\n // Only call React.createElement with `children` if there are actual children,\n // or if there was an explicit (albeit undefined) children passed via\n // props. Otherwise, if you pass `undefined` as the children argument\n // to React.createElement, the created element will have prop {children: undefined}.\n // If the `root` is an PlasmicGeneratedComponent, and these props with {children: undefined}\n // are used, then it will be taken as a `children` override, and will thus blank out\n // everything under the root node.\n return React.createElement(elementType, props, children);\n } else {\n return React.createElement(elementType, props);\n }\n}\n\nexport function ensureNotArray(children: React.ReactNode) {\n if (Array.isArray(children)) {\n if (children.length === 1) {\n return children[0];\n } else {\n return React.createElement(React.Fragment, {}, ...children);\n }\n } else {\n return children;\n }\n}\n\n/**\n * Flattens ReactNode into an array of ReactChild, but does NOT replace\n * missing keys with array index, as React.Children.toArray() does.\n */\nexport function toChildArray(children: React.ReactNode): React.ReactChild[] {\n if (isReactChild(children)) {\n return [children];\n } else if (Array.isArray(children)) {\n return children.flatMap(toChildArray);\n } else {\n return [];\n }\n}\n\nexport function isReactText(child: React.ReactNode): child is React.ReactText {\n return typeof child === \"string\" || typeof child === \"number\";\n}\n\nexport function isReactChild(\n child: React.ReactNode\n): child is React.ReactChild {\n return React.isValidElement(child) || isReactText(child);\n}\n\nexport function isReactFragment(\n child: React.ReactNode\n): child is React.ReactElement {\n return React.isValidElement(child) && child.type === React.Fragment;\n}\n\nexport function isReactNode(x: any) {\n return (\n typeof x === \"string\" || typeof x === \"number\" || React.isValidElement(x)\n );\n}\n\n// From https://stackoverflow.com/questions/54775790/forcing-excess-property-checking-on-variable-passed-to-typescript-function\n// We also wrap the error message in a Partial<> because otherwise Jetbrains IDEs will autocomplete the component with all the string methods as props - see https://github.com/plasmicapp/plasmic/issues/16.\nexport type StrictProps<T, TExpected> = Exclude<\n keyof T,\n keyof TExpected\n> extends never\n ? {}\n : Partial<\"Unexpected extraneous props\">;\n\nexport type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<\n React.ComponentProps<T>[\"ref\"],\n string\n>;\n\nexport function mergeProps(\n props: Record<string, any>,\n ...restProps: Record<string, any>[]\n): Record<string, any> {\n if (restProps.every((rest) => Object.keys(rest).length === 0)) {\n return props;\n }\n\n const result = { ...props };\n\n for (const rest of restProps) {\n for (const key of Object.keys(rest)) {\n result[key] = mergePropVals(key, result[key], rest[key]);\n }\n }\n\n return result;\n}\n\nfunction updateRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n } else {\n if (!Object.isFrozen(ref)) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n }\n}\n\nexport function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]) {\n return (value: T) => {\n for (const ref of refs) {\n updateRef(ref, value);\n }\n };\n}\n\nexport function mergePropVals(name: string, val1: any, val2: any): any {\n if (val1 === NONE || val2 === NONE) {\n // The NONE sentinel always skips all merging and returns null\n return null;\n } else if (val1 == null) {\n // If either of them is nil, prefer the other\n return val2;\n } else if (val2 == null) {\n return val1;\n } else if (name === \"className\") {\n // Special case for className -- always combine both class names\n return classNames(val1, val2);\n } else if (name === \"style\") {\n // Special case for style -- always shallow-merge style dicts\n return { ...val1, ...val2 };\n } else if (name === \"ref\") {\n // Special case for ref\n return mergeRefs(val1, val2);\n } else if (typeof val1 !== typeof val2) {\n // If the type of the two values are different, then no way to merge them.\n // Prefer val2.\n return val2;\n } else if (name.startsWith(\"on\") && typeof val1 === \"function\") {\n // Special case for event handlers -- always call both handlers\n return (...args: any[]) => {\n let res: any;\n if (typeof val1 === \"function\") {\n res = val1(...args);\n }\n if (typeof val2 === \"function\") {\n res = val2(...args);\n }\n return res;\n };\n } else {\n // For all else, prefer val2\n return val2;\n }\n}\n\nexport function getElementTypeName(element: React.ReactElement) {\n if (typeof element.type === \"string\") {\n return element.type;\n } else {\n const comp = element.type as any;\n return comp.displayName ?? comp.name ?? comp.render?.name ?? \"Component\";\n }\n}\n"],"names":["React"],"mappings":";;;;IAGa,SAAS,GAAG,OAAO,MAAM,KAAK,YAAY;IAC1C,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;AAE5B,IAAM,yBAAyB,GAAG,SAAS;MAC9CA,cAAK,CAAC,eAAe;AACvB,MAAEA,cAAK,CAAC,UAAU;SAEJ,yBAAyB,CACvC,WAAgB,EAChB,KAAU,EACV,QAAyB,EAAA;AAEzB,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC3B,QAAA,OAAOA,cAAK,CAAC,aAAa,CAAnB,KAAA,CAAAA,cAAK,iBACV,WAAW;YACX,KAAK,CAAA,EAAA,MAAA,CACF,QAAQ,CAAA,EAAA,KAAA,CAAA,CACU,CAAC;AACzB,KAAA;AAAM,SAAA,IAAI,QAAQ,IAAI,UAAU,IAAI,KAAK,EAAE;;;;;;;;QAQ1C,OAAOA,cAAK,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,KAAA;AAAM,SAAA;QACL,OAAOA,cAAK,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAChD,KAAA;AACH,CAAC;AAEK,SAAU,cAAc,CAAC,QAAyB,EAAA;AACtD,IAAA,IAAI,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,KAAA;AAAM,SAAA;;AAEL,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACH,CAAC;AAEK,SAAU,kBAAkB,CAAC,OAA2B,EAAA;;AAC5D,IAAA,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;QACpC,OAAO,OAAO,CAAC,IAAI,CAAC;AACrB,KAAA;AAAM,SAAA;AACL,QAAA,IAAM,IAAI,GAAG,OAAO,CAAC,IAAW,CAAC;AACjC,QAAA,OAAO,MAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,WAAW,mCAAI,IAAI,CAAC,IAAI,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,WAAW,CAAC;AAC1E,KAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"react-utils-2892a561.js","sources":["../../src/react-utils.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nexport const isBrowser = typeof window !== \"undefined\";\nexport const NONE = Symbol(\"NONE\");\n\nexport const useIsomorphicLayoutEffect = isBrowser\n ? React.useLayoutEffect\n : React.useEffect;\n\nexport function createElementWithChildren(\n elementType: any,\n props: any,\n children: React.ReactNode\n) {\n if (Array.isArray(children)) {\n return React.createElement(\n elementType,\n props,\n ...children\n ) as React.ReactElement;\n } else if (children || \"children\" in props) {\n // Only call React.createElement with `children` if there are actual children,\n // or if there was an explicit (albeit undefined) children passed via\n // props. Otherwise, if you pass `undefined` as the children argument\n // to React.createElement, the created element will have prop {children: undefined}.\n // If the `root` is an PlasmicGeneratedComponent, and these props with {children: undefined}\n // are used, then it will be taken as a `children` override, and will thus blank out\n // everything under the root node.\n return React.createElement(elementType, props, children);\n } else {\n return React.createElement(elementType, props);\n }\n}\n\nexport function ensureNotArray(children: React.ReactNode) {\n if (Array.isArray(children)) {\n if (children.length === 1) {\n return children[0];\n } else {\n return React.createElement(React.Fragment, {}, ...children);\n }\n } else {\n return children;\n }\n}\n\n/**\n * Flattens ReactNode into an array of ReactChild, but does NOT replace\n * missing keys with array index, as React.Children.toArray() does.\n */\nexport function toChildArray(children: React.ReactNode): React.ReactChild[] {\n if (isReactChild(children)) {\n return [children];\n } else if (Array.isArray(children)) {\n return children.flatMap(toChildArray);\n } else {\n return [];\n }\n}\n\nexport function isReactText(child: React.ReactNode): child is React.ReactText {\n return typeof child === \"string\" || typeof child === \"number\";\n}\n\nexport function isReactChild(\n child: React.ReactNode\n): child is React.ReactChild {\n return React.isValidElement(child) || isReactText(child);\n}\n\nexport function isReactFragment(\n child: React.ReactNode\n): child is React.ReactElement {\n return React.isValidElement(child) && child.type === React.Fragment;\n}\n\nexport function isReactNode(x: any) {\n return (\n typeof x === \"string\" || typeof x === \"number\" || React.isValidElement(x)\n );\n}\n\n// From https://stackoverflow.com/questions/54775790/forcing-excess-property-checking-on-variable-passed-to-typescript-function\n// We also wrap the error message in a Partial<> because otherwise Jetbrains IDEs will autocomplete the component with all the string methods as props - see https://github.com/plasmicapp/plasmic/issues/16.\nexport type StrictProps<T, TExpected> = Exclude<\n keyof T,\n keyof TExpected\n> extends never\n ? {}\n : Partial<\"Unexpected extraneous props\">;\n\nexport type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<\n React.ComponentProps<T>[\"ref\"],\n string\n>;\n\nexport function mergeProps(\n props: Record<string, any>,\n ...restProps: Record<string, any>[]\n): Record<string, any> {\n if (restProps.every((rest) => Object.keys(rest).length === 0)) {\n return props;\n }\n\n const result = { ...props };\n\n for (const rest of restProps) {\n for (const key of Object.keys(rest)) {\n result[key] = mergePropVals(key, result[key], rest[key]);\n }\n }\n\n return result;\n}\n\nfunction updateRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n } else {\n if (!Object.isFrozen(ref)) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n }\n}\n\nexport function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]) {\n return (value: T) => {\n for (const ref of refs) {\n updateRef(ref, value);\n }\n };\n}\n\nexport function mergePropVals(name: string, val1: any, val2: any): any {\n if (val1 === NONE || val2 === NONE) {\n // The NONE sentinel always skips all merging and returns null\n return null;\n } else if (val1 == null) {\n // If either of them is nil, prefer the other\n return val2;\n } else if (val2 == null) {\n return val1;\n } else if (name === \"className\") {\n // Special case for className -- always combine both class names\n return classNames(val1, val2);\n } else if (name === \"style\") {\n // Special case for style -- always shallow-merge style dicts\n return { ...val1, ...val2 };\n } else if (name === \"ref\") {\n // Special case for ref\n return mergeRefs(val1, val2);\n } else if (typeof val1 !== typeof val2) {\n // If the type of the two values are different, then no way to merge them.\n // Prefer val2.\n return val2;\n } else if (name.startsWith(\"on\") && typeof val1 === \"function\") {\n // Special case for event handlers -- always call both handlers\n return (...args: any[]) => {\n let res: any;\n if (typeof val1 === \"function\") {\n res = val1(...args);\n }\n if (typeof val2 === \"function\") {\n res = val2(...args);\n }\n return res;\n };\n } else {\n // For all else, prefer val2\n return val2;\n }\n}\n\nexport function getElementTypeName(element: React.ReactElement) {\n if (typeof element.type === \"string\") {\n return element.type;\n } else {\n const comp = element.type as any;\n return comp.displayName ?? comp.name ?? comp.render?.name ?? \"Component\";\n }\n}\n"],"names":["React"],"mappings":";;;;IAGa,SAAS,GAAG,OAAO,MAAM,KAAK,YAAY;IAC1C,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;AAE5B,IAAM,yBAAyB,GAAG,SAAS;MAC9CA,cAAK,CAAC,eAAe;AACvB,MAAEA,cAAK,CAAC,UAAU;SAEJ,yBAAyB,CACvC,WAAgB,EAChB,KAAU,EACV,QAAyB,EAAA;AAEzB,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC3B,QAAA,OAAOA,cAAK,C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A,CAAA;;AACpB,YAAA,IAAI,GAAQ,CAAC;AACb,YAAA,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;AAC9B,gBAAA,GAAG,GAAG,IAAI,CAAI,KAAA,CAAA,KAAA,CAAA,EAAA,aAAA,CAAA,EAAA,EAAA,MAAA,CAAA,IAAI,UAAC,CAAC;AACrB,aAAA;AACD,YAAA,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;AAC9B,gBAAA,GAAG,GAAG,IAAI,CAAI,KAAA,CAAA,KAAA,CAAA,EAAA,aAAA,CAAA,EAAA,EAAA,MAAA,CAAA,IAAI,UAAC,CAAC;AACrB,aAAA;AACD,YAAA,OAAO,GAAG,CAAC;AACb,SAAC,CAAC;AACH,KAAA;AAAM,SAAA;;AAEL,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACH,CAAC;AAEK,SAAU,kBAAkB,CAAC,OAA2B,EAAA;;AAC5D,IAAA,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;QACpC,OAAO,OAAO,CAAC,IAAI,CAAC;AACrB,KAAA;AAAM,SAAA;AACL,QAAA,IAAM,IAAI,GAAG,OAAO,CAAC,IAAW,CAAC;AACjC,QAAA,OAAO,MAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,WAAW,mCAAI,IAAI,CAAC,IAAI,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,WAAW,CAAC;AAC1E,KAAA;AACH;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as __spreadArray, e as __read, c as __rest, a as __assign, p as pick } from '../../common-
|
|
1
|
+
import { d as __spreadArray, e as __read, c as __rest, a as __assign, p as pick } from '../../common-a21bdc95.js';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { d as mergeRefs } from '../../react-utils-
|
|
4
|
+
import { d as mergeRefs } from '../../react-utils-2892a561.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Responsive `<img/>` replacement, based on `next/image`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign, o as omit, p as pick, d as __spreadArray, e as __read } from './common-
|
|
1
|
+
import { a as __assign, o as omit, p as pick, d as __spreadArray, e as __read } from './common-a21bdc95.js';
|
|
2
2
|
import { PlasmicDataSourceContextProvider } from '@plasmicapp/data-sources-context';
|
|
3
3
|
import { usePlasmicLinkMaybe, PlasmicTranslatorContext as PlasmicTranslatorContext$1, usePlasmicTranslator as usePlasmicTranslator$1, DataProvider, PlasmicLinkProvider } from '@plasmicapp/host';
|
|
4
4
|
import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
|
|
@@ -197,4 +197,4 @@ function MaybeWrap(props) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
export { PlasmicLink as P, Trans as T, PlasmicRootProvider as a, usePlasmicTranslator as b, useEnsureSSRProvider as c, genTranslatableString as g, useIsSSR as u };
|
|
200
|
-
//# sourceMappingURL=ssr-
|
|
200
|
+
//# sourceMappingURL=ssr-cfc9b457.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-61d6e91a.js","sources":["../../src/render/PlasmicLink.tsx","../../src/render/translation.tsx","../../src/render/ssr.tsx"],"sourcesContent":["import { usePlasmicLinkMaybe } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { omit, pick } from \"../common\";\n\nexport const PlasmicLink = React.forwardRef(function PlasmicLink(\n props: any,\n ref: React.Ref<any>\n) {\n // The usePlasmicLinkMaybe function may be undefined, if host is not up-to-date\n const Link = usePlasmicLinkMaybe?.() ?? PlasmicLinkInternal;\n if (Link === PlasmicLink || Link === PlasmicLinkInternal) {\n // Just in case, break the cycle\n return <PlasmicLinkInternal {...props} ref={ref} />;\n } else {\n // Don't pass component/platform props to non-PlasmicLinkInternal\n return <Link {...omit(props, \"component\", \"platform\")} ref={ref} />;\n }\n});\n\nexport const PlasmicLinkInternal = React.forwardRef(\n function PlasmicLinkInternal(props: any, ref: React.Ref<any>) {\n // props.href is required for nextjs; if no props.href,\n // then we just render the default anchor element\n if (props.platform === \"nextjs\" && props.href) {\n const nextjsProps = [\n \"href\",\n \"replace\",\n \"scroll\",\n \"shallow\",\n \"passHref\",\n \"prefetch\",\n \"locale\",\n ];\n\n // If this is a fragment identifier link, then we set\n // scroll={false} so that smooth scrolling works\n const isFragment = props.href?.startsWith(\"#\");\n\n return React.createElement(\n props.component,\n {\n scroll: !isFragment,\n ...pick(props, ...nextjsProps),\n legacyBehavior: true,\n },\n <a\n {...omit(props, \"component\", \"platform\", ...nextjsProps)}\n ref={ref}\n />\n );\n }\n\n if (props.platform === \"gatsby\" && isInternalHref(props.href)) {\n return React.createElement(props.component, {\n ...omit(props, \"component\", \"platform\", \"href\"),\n ...{ to: props.href, ref },\n });\n }\n\n return <a {...omit(props, \"component\", \"platform\")} ref={ref} />;\n }\n);\n\nfunction isInternalHref(href: string): boolean {\n return /^\\/(?!\\/)/.test(href);\n}\n","import {\n PlasmicTranslatorContext as HostPlasmicTranslatorContext,\n PlasmicI18NContextValue,\n PlasmicTranslator,\n usePlasmicTranslator as useHostPlasmicTranslator,\n} from \"@plasmicapp/host\";\nimport React from \"react\";\n\n// Make the refactor to host backwards compatible for loader\nexport const PlasmicTranslatorContext =\n HostPlasmicTranslatorContext ??\n React.createContext<PlasmicI18NContextValue | PlasmicTranslator | undefined>(\n undefined\n );\n\nexport const usePlasmicTranslator =\n useHostPlasmicTranslator ??\n (() => {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n return translator;\n });\n\nexport interface TransProps {\n transKey?: string;\n children?: React.ReactNode;\n}\n\nexport function genTranslatableString(\n elt: React.ReactNode,\n opts?: {\n tagPrefix?: string;\n }\n) {\n const components: {\n [key: string]: React.ReactElement;\n } = {};\n let componentsCount = 0;\n\n const getText = (node: React.ReactNode): string => {\n if (!node) {\n return \"\";\n }\n if (\n typeof node === \"number\" ||\n typeof node === \"boolean\" ||\n typeof node === \"string\"\n ) {\n return node.toString();\n }\n if (typeof node !== \"object\") {\n return \"\";\n }\n if (Array.isArray(node) || isIterable(node)) {\n return Array.from(node)\n .map((child) => getText(child))\n .filter((child) => !!child)\n .join(\"\");\n }\n const nodeChildren: React.ReactNode =\n (hasKey(node, \"props\") &&\n hasKey(node.props, \"children\") &&\n (node.props.children as React.ReactNode | undefined)) ||\n (hasKey(node, \"children\") && node.children) ||\n [];\n const contents = `${React.Children.toArray(nodeChildren)\n .map((child) => getText(child))\n .filter((child) => !!child)\n .join(\"\")}`;\n if (React.isValidElement(node) && node.type === React.Fragment) {\n return contents;\n }\n const prefix = opts?.tagPrefix ?? \"\";\n const componentId = `${prefix}${componentsCount + 1}`;\n componentsCount++;\n components[componentId] = React.isValidElement(node)\n ? React.cloneElement(node as any, {\n key: componentId,\n children: undefined,\n })\n : (node as never);\n return `<${componentId}>${contents}</${componentId}>`;\n };\n\n const str = getText(elt);\n return {\n str,\n components,\n componentsCount,\n };\n}\n\nexport function Trans({ transKey, children }: TransProps) {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n if (!translator) {\n warnNoTranslationFunctionAtMostOnce();\n return children;\n }\n\n const { str, components, componentsCount } = genTranslatableString(children, {\n tagPrefix: typeof _t === \"object\" ? _t.tagPrefix : undefined,\n });\n return translator(\n transKey ?? str,\n componentsCount > 0 ? { components } : undefined\n );\n}\n\nlet hasWarned = false;\nfunction warnNoTranslationFunctionAtMostOnce() {\n if (!hasWarned) {\n console.warn(\n \"Using Plasmic Translation but no translation function has been provided\"\n );\n hasWarned = true;\n }\n}\n\nfunction hasKey<K extends string>(v: any, key: K): v is Record<K, any> {\n return typeof v === \"object\" && v !== null && key in v;\n}\n\nfunction isIterable(val: any): val is Iterable<any> {\n return val != null && typeof val[Symbol.iterator] === \"function\";\n}\n","import {\n PlasmicDataSourceContextProvider,\n PlasmicDataSourceContextValue,\n} from \"@plasmicapp/data-sources-context\";\nimport {\n DataProvider,\n PlasmicI18NContextValue,\n PlasmicLinkProvider,\n PlasmicTranslator,\n} from \"@plasmicapp/host\";\nimport { SSRProvider, useIsSSR as useAriaIsSSR } from \"@react-aria/ssr\";\nimport * as React from \"react\";\nimport { PlasmicHeadContext } from \"./PlasmicHead\";\nimport { PlasmicLinkInternal } from \"./PlasmicLink\";\nimport { PlasmicTranslatorContext } from \"./translation\";\nexport {\n PlasmicDataSourceContextProvider,\n useCurrentUser,\n} from \"@plasmicapp/data-sources-context\";\n// import { PlasmicLink } from \"./PlasmicLink\";\n\nexport interface PlasmicRootContextValue {\n platform?: \"nextjs\" | \"gatsby\";\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface PlasmicRootProviderProps\n extends PlasmicDataSourceContextValue {\n platform?: \"nextjs\" | \"gatsby\";\n children?: React.ReactNode;\n i18n?: PlasmicI18NContextValue;\n /**\n * @deprecated use i18n.translator instead\n */\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n Link?: React.ComponentType<any>;\n disableLoadingBoundary?: boolean;\n suspenseFallback?: React.ReactNode;\n}\n\nexport function PlasmicRootProvider(props: PlasmicRootProviderProps) {\n const {\n platform,\n children,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n user,\n disableLoadingBoundary,\n suspenseFallback,\n } = props;\n const context = React.useMemo(\n () => ({\n platform,\n }),\n [platform]\n );\n const dataSourceContextValue = React.useMemo(\n () => ({\n userAuthToken,\n user,\n isUserLoading,\n authRedirectUri,\n }),\n [userAuthToken, isUserLoading, user, authRedirectUri]\n );\n const reactMajorVersion = +React.version.split(\".\")[0];\n\n return (\n <MaybeWrap\n cond={!disableLoadingBoundary && reactMajorVersion >= 18}\n wrapper={(children_) => (\n <DataProvider\n name=\"plasmicInternalEnableLoadingBoundary\"\n hidden\n data={true}\n >\n <React.Suspense fallback={suspenseFallback ?? \"Loading...\"}>\n {children_}\n </React.Suspense>\n </DataProvider>\n )}\n >\n <PlasmicRootContext.Provider value={context}>\n <MaybeWrap\n cond={reactMajorVersion < 18}\n wrapper={(children_) => <SSRProvider>{children_}</SSRProvider>}\n >\n <PlasmicDataSourceContextProvider value={dataSourceContextValue}>\n <PlasmicTranslatorContext.Provider\n value={props.i18n ?? props.translator}\n >\n <PlasmicHeadContext.Provider value={props.Head}>\n <SafePlasmicLinkProvider\n Link={props.Link ?? PlasmicLinkInternal}\n >\n {children}\n </SafePlasmicLinkProvider>\n </PlasmicHeadContext.Provider>\n </PlasmicTranslatorContext.Provider>\n </PlasmicDataSourceContextProvider>\n </MaybeWrap>\n </PlasmicRootContext.Provider>\n </MaybeWrap>\n );\n}\n\n/**\n * A PlasmicLinkProvider that anticipates PlasmicLinkProvider may not exist yet from\n * @plasmicapp/host if the user is using an older version\n */\nfunction SafePlasmicLinkProvider(\n props: React.ComponentProps<typeof PlasmicLinkProvider>\n) {\n if (PlasmicLinkProvider) {\n return <PlasmicLinkProvider {...props} />;\n } else {\n return <>{props.children}</>;\n }\n}\n\nexport const useIsSSR = useAriaIsSSR;\n\nexport function useHasPlasmicRoot() {\n return !!React.useContext(PlasmicRootContext);\n}\n\nlet hasWarnedSSR = false;\n/**\n * Warns the user if PlasmicRootProvider is not used\n */\nexport function useEnsureSSRProvider() {\n const hasRoot = useHasPlasmicRoot();\n if (hasRoot || hasWarnedSSR || process.env.NODE_ENV !== \"development\") {\n return;\n }\n\n hasWarnedSSR = true;\n console.warn(\n `Plasmic: To ensure your components work correctly with server-side rendering, please use PlasmicRootProvider at the root of your application. See https://docs.plasmic.app/learn/ssr`\n );\n}\n\nfunction MaybeWrap(props: {\n children: React.ReactElement;\n cond: boolean;\n wrapper: (children: React.ReactElement) => React.ReactElement;\n}) {\n return props.cond ? props.wrapper(props.children) : props.children;\n}\n"],"names":["React","HostPlasmicTranslatorContext","useHostPlasmicTranslator","useAriaIsSSR"],"mappings":";;;;;;;;AAIO,IAAM,WAAW,GAAGA,cAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAC9D,KAAU,EACV,GAAmB,EAAA;;;IAGnB,IAAM,IAAI,GAAG,CAAA,EAAA,GAAA,mBAAmB,KAAA,IAAA,IAAnB,mBAAmB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAnB,mBAAmB,EAAI,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,mBAAmB,CAAC;AAC5D,IAAA,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,mBAAmB,EAAE;;QAExD,OAAOA,cAAA,CAAA,aAAA,CAAC,mBAAmB,EAAK,QAAA,CAAA,EAAA,EAAA,KAAK,IAAE,GAAG,EAAE,GAAG,EAAA,CAAA,CAAI,CAAC;AACrD,KAAA;AAAM,SAAA;;AAEL,QAAA,OAAOA,6BAAC,IAAI,EAAA,QAAA,CAAA,EAAA,EAAK,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,EAAA,GAAG,EAAE,GAAG,IAAI,CAAC;AACrE,KAAA;AACH,CAAC,EAAE;AAEI,IAAM,mBAAmB,GAAGA,cAAK,CAAC,UAAU,CACjD,SAAS,mBAAmB,CAAC,KAAU,EAAE,GAAmB,EAAA;;;;IAG1D,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE;AAC7C,QAAA,IAAM,WAAW,GAAG;YAClB,MAAM;YACN,SAAS;YACT,QAAQ;YACR,SAAS;YACT,UAAU;YACV,UAAU;YACV,QAAQ;SACT,CAAC;;;QAIF,IAAM,UAAU,GAAG,CAAA,EAAA,GAAA,KAAK,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,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QACrE,OAAO;AACR,KAAA;IAED,YAAY,GAAG,IAAI,CAAC;AACpB,IAAA,OAAO,CAAC,IAAI,CACV,uLAAuL,CACxL,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAIlB,EAAA;IACC,OAAO,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;AACrE;;;;"}
|
|
1
|
+
{"version":3,"file":"ssr-cfc9b457.js","sources":["../../src/render/PlasmicLink.tsx","../../src/render/translation.tsx","../../src/render/ssr.tsx"],"sourcesContent":["import { usePlasmicLinkMaybe } from \"@plasmicapp/host\";\nimport React from \"react\";\nimport { omit, pick } from \"../common\";\n\nexport const PlasmicLink = React.forwardRef(function PlasmicLink(\n props: any,\n ref: React.Ref<any>\n) {\n // The usePlasmicLinkMaybe function may be undefined, if host is not up-to-date\n const Link = usePlasmicLinkMaybe?.() ?? PlasmicLinkInternal;\n if (Link === PlasmicLink || Link === PlasmicLinkInternal) {\n // Just in case, break the cycle\n return <PlasmicLinkInternal {...props} ref={ref} />;\n } else {\n // Don't pass component/platform props to non-PlasmicLinkInternal\n return <Link {...omit(props, \"component\", \"platform\")} ref={ref} />;\n }\n});\n\nexport const PlasmicLinkInternal = React.forwardRef(\n function PlasmicLinkInternal(props: any, ref: React.Ref<any>) {\n // props.href is required for nextjs; if no props.href,\n // then we just render the default anchor element\n if (props.platform === \"nextjs\" && props.href) {\n const nextjsProps = [\n \"href\",\n \"replace\",\n \"scroll\",\n \"shallow\",\n \"passHref\",\n \"prefetch\",\n \"locale\",\n ];\n\n // If this is a fragment identifier link, then we set\n // scroll={false} so that smooth scrolling works\n const isFragment = props.href?.startsWith(\"#\");\n\n return React.createElement(\n props.component,\n {\n scroll: !isFragment,\n ...pick(props, ...nextjsProps),\n legacyBehavior: true,\n },\n <a\n {...omit(props, \"component\", \"platform\", ...nextjsProps)}\n ref={ref}\n />\n );\n }\n\n if (props.platform === \"gatsby\" && isInternalHref(props.href)) {\n return React.createElement(props.component, {\n ...omit(props, \"component\", \"platform\", \"href\"),\n ...{ to: props.href, ref },\n });\n }\n\n return <a {...omit(props, \"component\", \"platform\")} ref={ref} />;\n }\n);\n\nfunction isInternalHref(href: string): boolean {\n return /^\\/(?!\\/)/.test(href);\n}\n","import {\n PlasmicTranslatorContext as HostPlasmicTranslatorContext,\n PlasmicI18NContextValue,\n PlasmicTranslator,\n usePlasmicTranslator as useHostPlasmicTranslator,\n} from \"@plasmicapp/host\";\nimport React from \"react\";\n\n// Make the refactor to host backwards compatible for loader\nexport const PlasmicTranslatorContext =\n HostPlasmicTranslatorContext ??\n React.createContext<PlasmicI18NContextValue | PlasmicTranslator | undefined>(\n undefined\n );\n\nexport const usePlasmicTranslator =\n useHostPlasmicTranslator ??\n (() => {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n return translator;\n });\n\nexport interface TransProps {\n transKey?: string;\n children?: React.ReactNode;\n}\n\nexport function genTranslatableString(\n elt: React.ReactNode,\n opts?: {\n tagPrefix?: string;\n }\n) {\n const components: {\n [key: string]: React.ReactElement;\n } = {};\n let componentsCount = 0;\n\n const getText = (node: React.ReactNode): string => {\n if (!node) {\n return \"\";\n }\n if (\n typeof node === \"number\" ||\n typeof node === \"boolean\" ||\n typeof node === \"string\"\n ) {\n return node.toString();\n }\n if (typeof node !== \"object\") {\n return \"\";\n }\n if (Array.isArray(node) || isIterable(node)) {\n return Array.from(node)\n .map((child) => getText(child))\n .filter((child) => !!child)\n .join(\"\");\n }\n const nodeChildren: React.ReactNode =\n (hasKey(node, \"props\") &&\n hasKey(node.props, \"children\") &&\n (node.props.children as React.ReactNode | undefined)) ||\n (hasKey(node, \"children\") && node.children) ||\n [];\n const contents = `${React.Children.toArray(nodeChildren)\n .map((child) => getText(child))\n .filter((child) => !!child)\n .join(\"\")}`;\n if (React.isValidElement(node) && node.type === React.Fragment) {\n return contents;\n }\n const prefix = opts?.tagPrefix ?? \"\";\n const componentId = `${prefix}${componentsCount + 1}`;\n componentsCount++;\n components[componentId] = React.isValidElement(node)\n ? React.cloneElement(node as any, {\n key: componentId,\n children: undefined,\n })\n : (node as never);\n return `<${componentId}>${contents}</${componentId}>`;\n };\n\n const str = getText(elt);\n return {\n str,\n components,\n componentsCount,\n };\n}\n\nexport function Trans({ transKey, children }: TransProps) {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n if (!translator) {\n warnNoTranslationFunctionAtMostOnce();\n return children;\n }\n\n const { str, components, componentsCount } = genTranslatableString(children, {\n tagPrefix: typeof _t === \"object\" ? _t.tagPrefix : undefined,\n });\n return translator(\n transKey ?? str,\n componentsCount > 0 ? { components } : undefined\n );\n}\n\nlet hasWarned = false;\nfunction warnNoTranslationFunctionAtMostOnce() {\n if (!hasWarned) {\n console.warn(\n \"Using Plasmic Translation but no translation function has been provided\"\n );\n hasWarned = true;\n }\n}\n\nfunction hasKey<K extends string>(v: any, key: K): v is Record<K, any> {\n return typeof v === \"object\" && v !== null && key in v;\n}\n\nfunction isIterable(val: any): val is Iterable<any> {\n return val != null && typeof val[Symbol.iterator] === \"function\";\n}\n","import {\n PlasmicDataSourceContextProvider,\n PlasmicDataSourceContextValue,\n} from \"@plasmicapp/data-sources-context\";\nimport {\n DataProvider,\n PlasmicI18NContextValue,\n PlasmicLinkProvider,\n PlasmicTranslator,\n} from \"@plasmicapp/host\";\nimport { SSRProvider, useIsSSR as useAriaIsSSR } from \"@react-aria/ssr\";\nimport * as React from \"react\";\nimport { PlasmicHeadContext } from \"./PlasmicHead\";\nimport { PlasmicLinkInternal } from \"./PlasmicLink\";\nimport { PlasmicTranslatorContext } from \"./translation\";\nexport {\n PlasmicDataSourceContextProvider,\n useCurrentUser,\n} from \"@plasmicapp/data-sources-context\";\n// import { PlasmicLink } from \"./PlasmicLink\";\n\nexport interface PlasmicRootContextValue {\n platform?: \"nextjs\" | \"gatsby\";\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface PlasmicRootProviderProps\n extends PlasmicDataSourceContextValue {\n platform?: \"nextjs\" | \"gatsby\";\n children?: React.ReactNode;\n i18n?: PlasmicI18NContextValue;\n /**\n * @deprecated use i18n.translator instead\n */\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n Link?: React.ComponentType<any>;\n disableLoadingBoundary?: boolean;\n suspenseFallback?: React.ReactNode;\n}\n\nexport function PlasmicRootProvider(props: PlasmicRootProviderProps) {\n const {\n platform,\n children,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n user,\n disableLoadingBoundary,\n suspenseFallback,\n } = props;\n const context = React.useMemo(\n () => ({\n platform,\n }),\n [platform]\n );\n const dataSourceContextValue = React.useMemo(\n () => ({\n userAuthToken,\n user,\n isUserLoading,\n authRedirectUri,\n }),\n [userAuthToken, isUserLoading, user, authRedirectUri]\n );\n const reactMajorVersion = +React.version.split(\".\")[0];\n\n return (\n <MaybeWrap\n cond={!disableLoadingBoundary && reactMajorVersion >= 18}\n wrapper={(children_) => (\n <DataProvider\n name=\"plasmicInternalEnableLoadingBoundary\"\n hidden\n data={true}\n >\n <React.Suspense fallback={suspenseFallback ?? \"Loading...\"}>\n {children_}\n </React.Suspense>\n </DataProvider>\n )}\n >\n <PlasmicRootContext.Provider value={context}>\n <MaybeWrap\n cond={reactMajorVersion < 18}\n wrapper={(children_) => <SSRProvider>{children_}</SSRProvider>}\n >\n <PlasmicDataSourceContextProvider value={dataSourceContextValue}>\n <PlasmicTranslatorContext.Provider\n value={props.i18n ?? props.translator}\n >\n <PlasmicHeadContext.Provider value={props.Head}>\n <SafePlasmicLinkProvider\n Link={props.Link ?? PlasmicLinkInternal}\n >\n {children}\n </SafePlasmicLinkProvider>\n </PlasmicHeadContext.Provider>\n </PlasmicTranslatorContext.Provider>\n </PlasmicDataSourceContextProvider>\n </MaybeWrap>\n </PlasmicRootContext.Provider>\n </MaybeWrap>\n );\n}\n\n/**\n * A PlasmicLinkProvider that anticipates PlasmicLinkProvider may not exist yet from\n * @plasmicapp/host if the user is using an older version\n */\nfunction SafePlasmicLinkProvider(\n props: React.ComponentProps<typeof PlasmicLinkProvider>\n) {\n if (PlasmicLinkProvider) {\n return <PlasmicLinkProvider {...props} />;\n } else {\n return <>{props.children}</>;\n }\n}\n\nexport const useIsSSR = useAriaIsSSR;\n\nexport function useHasPlasmicRoot() {\n return !!React.useContext(PlasmicRootContext);\n}\n\nlet hasWarnedSSR = false;\n/**\n * Warns the user if PlasmicRootProvider is not used\n */\nexport function useEnsureSSRProvider() {\n const hasRoot = useHasPlasmicRoot();\n if (hasRoot || hasWarnedSSR || process.env.NODE_ENV !== \"development\") {\n return;\n }\n\n hasWarnedSSR = true;\n console.warn(\n `Plasmic: To ensure your components work correctly with server-side rendering, please use PlasmicRootProvider at the root of your application. See https://docs.plasmic.app/learn/ssr`\n );\n}\n\nfunction MaybeWrap(props: {\n children: React.ReactElement;\n cond: boolean;\n wrapper: (children: React.ReactElement) => React.ReactElement;\n}) {\n return props.cond ? props.wrapper(props.children) : props.children;\n}\n"],"names":["React","HostPlasmicTranslatorContext","useHostPlasmicTranslator","useAriaIsSSR"],"mappings":";;;;;;;;AAIO,IAAM,WAAW,GAAGA,cAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAC9D,KAAU,EACV,GAAmB,EAAA;;;IAGnB,IAAM,IAAI,GAAG,CAAA,EAAA,GAAA,mBAAmB,KAAA,IAAA,IAAnB,mBAAmB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAnB,mBAAmB,EAAI,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,mBAAmB,CAAC;AAC5D,IAAA,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI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