@plasmicapp/host 1.0.164 → 1.0.165

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/host.esm.js CHANGED
@@ -499,7 +499,7 @@ var hostModule = /*#__PURE__*/Object.freeze({
499
499
  useSelectors: useSelectors
500
500
  });
501
501
 
502
- var hostVersion = "1.0.164";
502
+ var hostVersion = "1.0.165";
503
503
 
504
504
  var _a;
505
505
  var root = globalThis;
@@ -1 +1 @@
1
- {"version":3,"file":"host.esm.js","sources":["../src/lang-utils.ts","../src/useForceUpdate.ts","../src/canvas-host.tsx","../src/common.ts","../src/data.tsx","../src/fetcher.ts","../src/global-actions.tsx","../src/registerComponent.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/link.tsx","../src/version.ts","../src/index.ts"],"sourcesContent":["function isString(x: any): x is string {\n return typeof x === \"string\";\n}\n\ntype StringGen = string | (() => string);\n\nexport function ensure<T>(x: T | null | undefined, msg: StringGen = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n msg = (isString(msg) ? msg : msg()) || \"\";\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n","import { useCallback, useState } from \"react\";\n\nexport default function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ensure } from \"./lang-utils\";\nimport useForceUpdate from \"./useForceUpdate\";\n\ndeclare global {\n interface Window {\n __PlasmicHostVersion: string;\n }\n}\n\nif ((globalThis as any).__PlasmicHostVersion == null) {\n (globalThis as any).__PlasmicHostVersion = \"3\";\n}\n\nconst rootChangeListeners: (() => void)[] = [];\nclass PlasmicRootNodeWrapper {\n constructor(private value: null | React.ReactElement) {}\n set = (val: null | React.ReactElement) => {\n this.value = val;\n rootChangeListeners.forEach((f) => f());\n };\n get = () => this.value;\n}\n\nconst plasmicRootNode = new PlasmicRootNodeWrapper(null);\n\nfunction getHashParams() {\n return new URLSearchParams(location.hash.replace(/^#/, \"?\"));\n}\n\nfunction getPlasmicOrigin() {\n const params = getHashParams();\n return ensure(\n params.get(\"origin\"),\n \"Missing information from Plasmic window.\"\n );\n}\n\nfunction getStudioHash() {\n const hashParams = getHashParams();\n if (hashParams.has(\"studioHash\")) {\n return hashParams.get(\"studioHash\");\n }\n const urlParams = new URL(location.href).searchParams;\n return urlParams.get(\"studio-hash\");\n}\n\nfunction renderStudioIntoIframe() {\n const script = document.createElement(\"script\");\n const plasmicOrigin = getPlasmicOrigin();\n const hash = getStudioHash();\n script.src = `${plasmicOrigin}/static/js/studio${\n hash ? `.${hash}.js` : `.js`\n }`;\n document.body.appendChild(script);\n}\n\nlet renderCount = 0;\nexport function setPlasmicRootNode(node: React.ReactElement | null) {\n // Keep track of renderCount, which we use as key to ErrorBoundary, so\n // we can reset the error on each render\n renderCount++;\n plasmicRootNode.set(node);\n}\n\nexport interface PlasmicCanvasContextValue {\n componentName: string | null;\n globalVariants: Record<string, string>;\n interactive?: boolean;\n}\n\n/**\n * React context to detect whether the component is rendered on Plasmic editor.\n * If not, return false.\n * If so, return an object with more information about the component\n */\nexport const PlasmicCanvasContext = React.createContext<\n PlasmicCanvasContextValue | false\n>(false);\nexport const usePlasmicCanvasContext = () =>\n React.useContext(PlasmicCanvasContext);\n\nfunction _PlasmicCanvasHost() {\n // If window.parent is null, then this is a window whose containing iframe\n // has been detached from the DOM (for the top window, window.parent === window).\n // In that case, we shouldn't do anything. If window.parent is null, by the way,\n // location.hash will also be null.\n const isFrameAttached = !!window.parent;\n const isCanvas = !!location.hash?.match(/\\bcanvas=true\\b/);\n const isLive = !!location.hash?.match(/\\blive=true\\b/) || !isFrameAttached;\n const shouldRenderStudio =\n isFrameAttached &&\n !document.querySelector(\"#plasmic-studio-tag\") &&\n !isCanvas &&\n !isLive;\n const forceUpdate = useForceUpdate();\n React.useLayoutEffect(() => {\n rootChangeListeners.push(forceUpdate);\n return () => {\n const index = rootChangeListeners.indexOf(forceUpdate);\n if (index >= 0) {\n rootChangeListeners.splice(index, 1);\n }\n };\n }, [forceUpdate]);\n React.useEffect(() => {\n if (shouldRenderStudio && isFrameAttached && window.parent !== window) {\n renderStudioIntoIframe();\n }\n }, [shouldRenderStudio, isFrameAttached]);\n React.useEffect(() => {\n if (!shouldRenderStudio && !document.querySelector(\"#getlibs\") && isLive) {\n const scriptElt = document.createElement(\"script\");\n scriptElt.id = \"getlibs\";\n scriptElt.src = getPlasmicOrigin() + \"/static/js/getlibs.js\";\n scriptElt.async = false;\n scriptElt.onload = () => {\n (window as any).__GetlibsReadyResolver?.();\n };\n document.head.append(scriptElt);\n }\n }, [shouldRenderStudio]);\n\n const [canvasContextValue, setCanvasContextValue] = React.useState(() =>\n deriveCanvasContextValue()\n );\n\n React.useEffect(() => {\n if (isCanvas) {\n const listener = () => {\n setCanvasContextValue(deriveCanvasContextValue());\n };\n window.addEventListener(\"hashchange\", listener);\n return () => window.removeEventListener(\"hashchange\", listener);\n }\n return undefined;\n }, [isCanvas]);\n if (!isFrameAttached) {\n return null;\n }\n if (isCanvas || isLive) {\n let appDiv = document.querySelector(\"#plasmic-app.__wab_user-body\");\n if (!appDiv) {\n appDiv = document.createElement(\"div\");\n appDiv.id = \"plasmic-app\";\n appDiv.classList.add(\"__wab_user-body\");\n document.body.appendChild(appDiv);\n }\n return ReactDOM.createPortal(\n <ErrorBoundary key={`${renderCount}`}>\n <PlasmicCanvasContext.Provider value={canvasContextValue}>\n {plasmicRootNode.get()}\n </PlasmicCanvasContext.Provider>\n </ErrorBoundary>,\n appDiv,\n \"plasmic-app\"\n );\n }\n if (shouldRenderStudio && window.parent === window) {\n return (\n <iframe\n src={`https://docs.plasmic.app/app-content/app-host-ready#appHostUrl=${encodeURIComponent(\n location.href\n )}`}\n style={{\n width: \"100vw\",\n height: \"100vh\",\n border: \"none\",\n position: \"fixed\",\n top: 0,\n left: 0,\n zIndex: 99999999,\n }}\n ></iframe>\n );\n }\n return null;\n}\n\ninterface PlasmicCanvasHostProps {\n /**\n * Webpack hmr uses EventSource to\tlisten to hot reloads, but that\n * resultsin a persistent\tconnection from\teach window. In Plasmic\n * Studio, if a project is configured to use app-hosting with a\n * nextjs or gatsby server running in dev mode, each artboard will\n * be holding a persistent connection to the dev server.\n * Because browsers\thave a limit to\thow many connections can\n * be held\tat a time by domain, this means\tafter X\tartboards, new\n * artboards will freeze and not load.\n *\n * By default, <PlasmicCanvasHost /> will globally mutate\n * window.EventSource to avoid using EventSource for HMR, which you\n * typically don't need for your custom host page. If you do still\n * want to retain HRM, then youc an pass enableWebpackHmr={true}.\n */\n enableWebpackHmr?: boolean;\n}\n\nexport const PlasmicCanvasHost: React.FunctionComponent<\n PlasmicCanvasHostProps\n> = (props) => {\n const { enableWebpackHmr } = props;\n const [node, setNode] = React.useState<React.ReactElement<any, any> | null>(\n null\n );\n React.useEffect(() => {\n setNode(<_PlasmicCanvasHost />);\n }, []);\n return (\n <>\n {!enableWebpackHmr && <DisableWebpackHmr />}\n {node}\n </>\n );\n};\n\ntype RenderErrorListener = (err: Error) => void;\nconst renderErrorListeners: RenderErrorListener[] = [];\nexport function registerRenderErrorListener(listener: RenderErrorListener) {\n renderErrorListeners.push(listener);\n return () => {\n const index = renderErrorListeners.indexOf(listener);\n if (index >= 0) {\n renderErrorListeners.splice(index, 1);\n }\n };\n}\n\ninterface ErrorBoundaryProps {\n children?: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error?: Error;\n}\n\nclass ErrorBoundary extends React.Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n renderErrorListeners.forEach((listener) => listener(error));\n }\n\n render() {\n if (this.state.error) {\n return <div>Error: {`${this.state.error.message}`}</div>;\n } else {\n return <>{this.props.children}</>;\n }\n }\n}\n\nfunction DisableWebpackHmr() {\n if (process.env.NODE_ENV === \"production\") {\n return null;\n }\n return (\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n `,\n }}\n ></script>\n );\n}\n\nfunction deriveCanvasContextValue(): PlasmicCanvasContextValue | false {\n const hash = window.location.hash;\n if (hash && hash.length > 0) {\n // create URLsearchParams skipping the initial # character\n const params = new URLSearchParams(hash.substring(1));\n if (params.get(\"canvas\") === \"true\") {\n const globalVariants = params.get(\"globalVariants\");\n return {\n componentName: params.get(\"componentName\") ?? null,\n globalVariants: globalVariants ? JSON.parse(globalVariants) : {},\n interactive: params.get(\"interactive\") === \"true\",\n };\n }\n }\n return false;\n}\n","export const tuple = <T extends any[]>(...args: T): T => args;\n","import React, {\n createContext,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\nimport { tuple } from \"./common\";\n\nexport type DataDict = Record<string, any>;\n\nexport const DataContext = createContext<DataDict | undefined>(undefined);\n\nexport type DataMeta = {\n advanced?: boolean;\n hidden?: boolean;\n label?: string;\n};\n\nexport function mkMetaName(name: string) {\n return `__plasmic_meta_${name}`;\n}\n\nexport function mkMetaValue(meta: Partial<DataMeta>): DataMeta {\n return meta;\n}\n\nexport function applySelector(\n rawData: DataDict | undefined,\n selector: string | undefined\n): any {\n if (!selector) {\n return undefined;\n }\n let curData = rawData;\n for (const key of selector.split(\".\")) {\n curData = curData?.[key];\n }\n return curData;\n}\n\nexport type SelectorDict = Record<string, string | undefined>;\n\nexport function useSelector(selector: string | undefined): any {\n const rawData = useDataEnv();\n return applySelector(rawData, selector);\n}\n\nexport function useSelectors(selectors: SelectorDict = {}): any {\n const rawData = useDataEnv();\n return Object.fromEntries(\n Object.entries(selectors)\n .filter(([key, selector]) => !!key && !!selector)\n .map(([key, selector]) => tuple(key, applySelector(rawData, selector)))\n );\n}\n\nexport function useDataEnv() {\n return useContext(DataContext);\n}\n\nexport interface DataProviderProps {\n /**\n * Key to set in data context.\n */\n name?: string;\n /**\n * Value to set for `name` in data context.\n */\n data?: any;\n /**\n * If true, hide this item in studio data picker.\n */\n hidden?: boolean;\n /**\n * If true, mark this item as advanced in studio.\n */\n advanced?: boolean;\n /**\n * Label to be shown in the studio data picker for easier navigation (data binding).\n */\n label?: string;\n children?: ReactNode;\n}\n\nexport function DataProvider({\n name,\n data,\n hidden,\n advanced,\n label,\n children,\n}: DataProviderProps) {\n const existingEnv = useDataEnv() ?? {};\n if (!name) {\n return <>{children}</>;\n } else {\n return (\n <DataContext.Provider\n value={{\n ...existingEnv,\n [name]: data,\n [mkMetaName(name)]: mkMetaValue({ hidden, advanced, label }),\n }}\n >\n {children}\n </DataContext.Provider>\n );\n }\n}\n\nexport interface PageParamsProviderProps {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n children?: ReactNode;\n}\n\nexport function PageParamsProvider({\n children,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n const $ctx = useDataEnv() || {};\n return (\n <DataProvider\n name={\"params\"}\n data={{ ...$ctx.params, ...params }}\n label={\"Page URL path params\"}\n >\n <DataProvider\n name={\"query\"}\n data={{ ...$ctx.query, ...query }}\n label={\"Page URL query params\"}\n >\n {children}\n </DataProvider>\n </DataProvider>\n );\n}\n\nexport function DataCtxReader({\n children,\n}: {\n children: ($ctx: DataDict | undefined) => ReactNode;\n}) {\n const $ctx = useDataEnv();\n return children($ctx) as ReactElement | null;\n}\n","import { PrimitiveType } from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport type Fetcher = (...args: any[]) => Promise<any>;\n\nexport interface FetcherMeta {\n /**\n * Any unique identifying string for this fetcher.\n */\n name: string;\n /**\n * The Studio-user-friendly display name.\n */\n displayName?: string;\n /**\n * The symbol to import from the importPath.\n */\n importName?: string;\n args: { name: string; type: PrimitiveType }[];\n returns: PrimitiveType;\n /**\n * Either the path to the fetcher relative to `rootDir` or the npm\n * package name\n */\n importPath: string;\n /**\n * Whether it's a default export or named export\n */\n isDefaultExport?: boolean;\n}\n\nexport interface FetcherRegistration {\n fetcher: Fetcher;\n meta: FetcherMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFetcherRegistry: FetcherRegistration[];\n }\n}\n\nroot.__PlasmicFetcherRegistry = [];\n\nexport function registerFetcher(fetcher: Fetcher, meta: FetcherMeta) {\n root.__PlasmicFetcherRegistry.push({ fetcher, meta });\n}\n","import React from \"react\";\n\nexport type GlobalActionDict = Record<string, Function>;\n\nexport const GlobalActionsContext = React.createContext<\n GlobalActionDict | undefined\n>(undefined);\n\nexport function GlobalActionsProvider(props: {\n contextName: string;\n children?: React.ReactNode;\n actions: GlobalActionDict;\n}) {\n const { contextName, children, actions } = props;\n const existingActions = useGlobalActions();\n const namespacedActions = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(actions).map(([key, val]) => [\n `${contextName}.${key}`,\n val,\n ])\n ),\n [contextName, actions]\n );\n return (\n <GlobalActionsContext.Provider\n value={{\n ...existingActions,\n ...namespacedActions,\n }}\n >\n {children}\n </GlobalActionsContext.Provider>\n );\n}\n\nexport function useGlobalActions() {\n return React.useContext(GlobalActionsContext) ?? {};\n}\n","import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n JSONLikeType,\n NumberType,\n StringType,\n DataSourceType,\n} from \"./prop-types\";\nimport { FunctionParam } from \"./registerComponent\";\n\nconst root = globalThis as any;\n\n// Using just a subset of types from prop-types\nexport type PropType<P> =\n | StringType<P>\n | BooleanType<P>\n | NumberType<P>\n | JSONLikeType<P>\n | ChoiceType<P>\n | CustomType<P>\n | DataSourceType<P>;\n\ntype RestrictPropType<T, P> = T extends string\n ? StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>\n : T extends boolean\n ? BooleanType<P> | JSONLikeType<P> | CustomType<P>\n : T extends number\n ? NumberType<P> | JSONLikeType<P> | CustomType<P>\n : PropType<P>;\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\nexport interface GlobalContextMeta<P> {\n /**\n * Any unique string name used to identify that context. Each context\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the context in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the context to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the context properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * The path to be used when importing the context in the generated code.\n * It can be the name of the package that contains the context, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the context is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Whether the global context provides data to its children using DataProvider.\n */\n providesData?: boolean;\n\n unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;\n}\n\nexport interface GlobalContextRegistration {\n component: React.ComponentType<any>;\n meta: GlobalContextMeta<any>;\n}\n\nexport interface GlobalActionRegistration<P> {\n displayName?: string;\n description?: string;\n parameters: FunctionParam<P>[];\n}\n\ndeclare global {\n interface Window {\n __PlasmicContextRegistry: GlobalContextRegistration[];\n }\n}\n\nif (root.__PlasmicContextRegistry == null) {\n root.__PlasmicContextRegistry = [];\n}\n\nexport default function registerGlobalContext<\n T extends React.ComponentType<any>\n>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>) {\n // Check for duplicates\n if (\n root.__PlasmicContextRegistry.some(\n (r: GlobalContextRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicContextRegistry.push({ component, meta });\n}\n","export type TokenType =\n | \"color\"\n | \"spacing\"\n | \"font-family\"\n | \"font-size\"\n | \"line-height\"\n | \"opacity\";\n\nexport interface TokenRegistration {\n /**\n * Name for this token; should be stable across updates\n */\n name: string;\n /**\n * Value for the token, which can either be a valid css value or a css reference\n * to a css variable provided by your host app, like `var(--my-token)`\n */\n value: string;\n /**\n * Type of token\n */\n type: TokenType;\n /**\n * Optional display name to use for this token, if you'd like to use a friendlier\n * name to display to Studio users\n */\n displayName?: string;\n /**\n * By default, if this token is a css variable reference like `var(--my-token)`,\n * then it is assumed that `--my-token` is defined on `:root`. If it is defined\n * in another element, then you can pass in a selector for that element,\n * like `.themeRoot`.\n */\n selector?: string;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTokenRegistry: TokenRegistration[];\n }\n}\n\nconst root = globalThis as any;\n\nif (root.__PlasmicTokenRegistry == null) {\n root.__PlasmicTokenRegistry = [];\n}\n\nexport default function registerToken(token: TokenRegistration) {\n root.__PlasmicTokenRegistry.push(token);\n}\n","const root = globalThis as any;\n\nexport interface BasicTrait {\n label?: string;\n type: \"text\" | \"number\" | \"boolean\";\n}\n\nexport interface ChoiceTrait {\n label?: string;\n type: \"choice\";\n options: string[];\n}\n\nexport type TraitMeta = BasicTrait | ChoiceTrait;\n\nexport interface TraitRegistration {\n trait: string;\n meta: TraitMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTraitRegistry: TraitRegistration[];\n }\n}\n\nif (root.__PlasmicTraitRegistry == null) {\n root.__PlasmicTraitRegistry = [];\n}\n\nexport default function registerTrait(trait: string, meta: TraitMeta) {\n root.__PlasmicTraitRegistry.push({\n trait,\n meta,\n });\n}\n","import { cloneElement, isValidElement } from \"react\";\n\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param index The index of the copy (starting at 0).\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(index: number, elt: T): T;\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param isPrimary should be true for at most one instance of the element, and\n * indicates which copy of the element will be highlighted when the element is\n * selected in Studio.\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(isPrimary: boolean, elt: T): T;\nexport default function repeatedElement<T>(index: boolean | number, elt: T): T {\n return repeatedElementFn(index as any, elt);\n}\n\nlet repeatedElementFn: typeof repeatedElement = (\n index: boolean | number,\n elt: any\n) => {\n if (Array.isArray(elt)) {\n return elt.map((v) => repeatedElementFn(index as any, v)) as any;\n }\n if (elt && isValidElement(elt) && typeof elt !== \"string\") {\n return cloneElement(elt) as any;\n }\n return elt;\n};\n\nconst root = globalThis as any;\nexport const setRepeatedElementFn: (fn: typeof repeatedElement) => void =\n root?.__Sub?.setRepeatedElementFn ??\n function (fn: typeof repeatedElement) {\n repeatedElementFn = fn;\n };\n","import React from \"react\";\n\nconst PlasmicLinkContext = React.createContext<\n React.ComponentType<any> | undefined\n>(undefined);\n\nexport function usePlasmicLinkMaybe():\n | React.ComponentType<React.ComponentProps<\"a\">>\n | undefined {\n return React.useContext(PlasmicLinkContext);\n}\n\nconst AnchorLink = React.forwardRef(function AnchorLink(\n props: React.ComponentProps<\"a\">,\n ref: React.Ref<HTMLAnchorElement>\n) {\n return <a {...props} ref={ref} />;\n});\n\nexport function usePlasmicLink(): React.ComponentType<\n React.ComponentProps<\"a\">\n> {\n const Link = React.useContext(PlasmicLinkContext);\n if (Link) {\n return Link;\n } else {\n return AnchorLink as React.ComponentType<React.ComponentProps<\"a\">>;\n }\n}\n\nexport function PlasmicLinkProvider(props: {\n Link: React.ComponentType<any> | undefined;\n children?: React.ReactNode;\n}) {\n const { Link, children } = props;\n return (\n <PlasmicLinkContext.Provider value={Link}>\n {children}\n </PlasmicLinkContext.Provider>\n );\n}\n","export const hostVersion = \"1.0.164\";\n","import * as PlasmicQuery from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { registerRenderErrorListener, setPlasmicRootNode } from \"./canvas-host\";\nimport * as hostModule from \"./exports\";\nimport { setRepeatedElementFn } from \"./repeatedElement\";\n// version.ts is automatically generated by `yarn build` and not committed.\nimport { hostVersion } from \"./version\";\n\n// All exports must come from \"./exports\"\nexport * from \"./exports\";\n\nconst root = globalThis as any;\n\nif (root.__Sub == null) {\n // Creating a side effect here by logging, so that vite won't\n // ignore this block for whatever reason. Hiding this for now\n // as users are complaining; will have to check if this has\n // been fixed with vite.\n // console.log(\"Plasmic: Setting up app host dependencies\");\n root.__Sub = {\n React,\n ReactDOM,\n PlasmicQuery,\n hostModule,\n hostVersion,\n hostUtils: {\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n },\n\n // For backwards compatibility:\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n ...hostModule,\n };\n} else {\n console.warn(\n `Encountered likely duplicate host version: ${root.__Sub.hostVersion} vs ${hostVersion}`\n );\n root.__Sub.duplicateHostVersions = root.__Sub.duplicateHostVersions ?? [];\n root.__Sub.duplicateHostVersions.push(hostVersion);\n}\n"],"names":["React","root"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,CAAC,CAAM,EAAA;AACtB,IAAA,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAIe,SAAA,MAAM,CAAI,CAAuB,EAAE,GAAmB,EAAA;AAAnB,IAAA,IAAA,GAAA,KAAA,KAAA,CAAA,EAAA,EAAA,GAAmB,GAAA,EAAA,CAAA,EAAA;AACpE,IAAA,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE;AACjC,QAAA,SAAS;AACT,QAAA,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC;AAC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AAS;;;ACYpC,IAAM,IAAI,GAAG,UAAiB,CAAC;AAE/B,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;;;;;;AAMtB,IAAA,IAAI,CAAC,KAAK,GAAA,QAAA,CAAA,EACR,KAAK,EAAA,KAAA,EACL,QAAQ,EAAA,QAAA,EACR,YAAY,EAAA,YAAA,EACZ,UAAU,EAAA,UAAA,EACV,WAAW,EAAA,WAAA,EACX,SAAS,EAAE;AACT,YAAA,kBAAkB,EAAA,kBAAA;AAClB,YAAA,2BAA2B,EAAA,2BAAA;AAC3B,YAAA,oBAAoB,EAAA,oBAAA;AACrB,SAAA;;QAGD,kBAAkB,EAAA,kBAAA,EAClB,2BAA2B,EAAA,2BAAA,EAC3B,oBAAoB,EAAA,oBAAA,EAAA,EACjB,UAAU,CACd,CAAC;AACH,CAAA;AAAM,KAAA;AACL,IAAA,OAAO,CAAC,IAAI,CACV,6CAAA,CAAA,MAAA,CAA8C,IAAI,CAAC,KAAK,CAAC,WAAW,EAAA,MAAA,CAAA,CAAA,MAAA,CAAO,WAAW,CAAE,CACzF,CAAC;AACF,IAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC;IAC1E,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACpD;;;;"}
1
+ {"version":3,"file":"host.esm.js","sources":["../src/lang-utils.ts","../src/useForceUpdate.ts","../src/canvas-host.tsx","../src/common.ts","../src/data.tsx","../src/fetcher.ts","../src/global-actions.tsx","../src/registerComponent.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/link.tsx","../src/version.ts","../src/index.ts"],"sourcesContent":["function isString(x: any): x is string {\n return typeof x === \"string\";\n}\n\ntype StringGen = string | (() => string);\n\nexport function ensure<T>(x: T | null | undefined, msg: StringGen = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n msg = (isString(msg) ? msg : msg()) || \"\";\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n","import { useCallback, useState } from \"react\";\n\nexport default function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ensure } from \"./lang-utils\";\nimport useForceUpdate from \"./useForceUpdate\";\n\ndeclare global {\n interface Window {\n __PlasmicHostVersion: string;\n }\n}\n\nif ((globalThis as any).__PlasmicHostVersion == null) {\n (globalThis as any).__PlasmicHostVersion = \"3\";\n}\n\nconst rootChangeListeners: (() => void)[] = [];\nclass PlasmicRootNodeWrapper {\n constructor(private value: null | React.ReactElement) {}\n set = (val: null | React.ReactElement) => {\n this.value = val;\n rootChangeListeners.forEach((f) => f());\n };\n get = () => this.value;\n}\n\nconst plasmicRootNode = new PlasmicRootNodeWrapper(null);\n\nfunction getHashParams() {\n return new URLSearchParams(location.hash.replace(/^#/, \"?\"));\n}\n\nfunction getPlasmicOrigin() {\n const params = getHashParams();\n return ensure(\n params.get(\"origin\"),\n \"Missing information from Plasmic window.\"\n );\n}\n\nfunction getStudioHash() {\n const hashParams = getHashParams();\n if (hashParams.has(\"studioHash\")) {\n return hashParams.get(\"studioHash\");\n }\n const urlParams = new URL(location.href).searchParams;\n return urlParams.get(\"studio-hash\");\n}\n\nfunction renderStudioIntoIframe() {\n const script = document.createElement(\"script\");\n const plasmicOrigin = getPlasmicOrigin();\n const hash = getStudioHash();\n script.src = `${plasmicOrigin}/static/js/studio${\n hash ? `.${hash}.js` : `.js`\n }`;\n document.body.appendChild(script);\n}\n\nlet renderCount = 0;\nexport function setPlasmicRootNode(node: React.ReactElement | null) {\n // Keep track of renderCount, which we use as key to ErrorBoundary, so\n // we can reset the error on each render\n renderCount++;\n plasmicRootNode.set(node);\n}\n\nexport interface PlasmicCanvasContextValue {\n componentName: string | null;\n globalVariants: Record<string, string>;\n interactive?: boolean;\n}\n\n/**\n * React context to detect whether the component is rendered on Plasmic editor.\n * If not, return false.\n * If so, return an object with more information about the component\n */\nexport const PlasmicCanvasContext = React.createContext<\n PlasmicCanvasContextValue | false\n>(false);\nexport const usePlasmicCanvasContext = () =>\n React.useContext(PlasmicCanvasContext);\n\nfunction _PlasmicCanvasHost() {\n // If window.parent is null, then this is a window whose containing iframe\n // has been detached from the DOM (for the top window, window.parent === window).\n // In that case, we shouldn't do anything. If window.parent is null, by the way,\n // location.hash will also be null.\n const isFrameAttached = !!window.parent;\n const isCanvas = !!location.hash?.match(/\\bcanvas=true\\b/);\n const isLive = !!location.hash?.match(/\\blive=true\\b/) || !isFrameAttached;\n const shouldRenderStudio =\n isFrameAttached &&\n !document.querySelector(\"#plasmic-studio-tag\") &&\n !isCanvas &&\n !isLive;\n const forceUpdate = useForceUpdate();\n React.useLayoutEffect(() => {\n rootChangeListeners.push(forceUpdate);\n return () => {\n const index = rootChangeListeners.indexOf(forceUpdate);\n if (index >= 0) {\n rootChangeListeners.splice(index, 1);\n }\n };\n }, [forceUpdate]);\n React.useEffect(() => {\n if (shouldRenderStudio && isFrameAttached && window.parent !== window) {\n renderStudioIntoIframe();\n }\n }, [shouldRenderStudio, isFrameAttached]);\n React.useEffect(() => {\n if (!shouldRenderStudio && !document.querySelector(\"#getlibs\") && isLive) {\n const scriptElt = document.createElement(\"script\");\n scriptElt.id = \"getlibs\";\n scriptElt.src = getPlasmicOrigin() + \"/static/js/getlibs.js\";\n scriptElt.async = false;\n scriptElt.onload = () => {\n (window as any).__GetlibsReadyResolver?.();\n };\n document.head.append(scriptElt);\n }\n }, [shouldRenderStudio]);\n\n const [canvasContextValue, setCanvasContextValue] = React.useState(() =>\n deriveCanvasContextValue()\n );\n\n React.useEffect(() => {\n if (isCanvas) {\n const listener = () => {\n setCanvasContextValue(deriveCanvasContextValue());\n };\n window.addEventListener(\"hashchange\", listener);\n return () => window.removeEventListener(\"hashchange\", listener);\n }\n return undefined;\n }, [isCanvas]);\n if (!isFrameAttached) {\n return null;\n }\n if (isCanvas || isLive) {\n let appDiv = document.querySelector(\"#plasmic-app.__wab_user-body\");\n if (!appDiv) {\n appDiv = document.createElement(\"div\");\n appDiv.id = \"plasmic-app\";\n appDiv.classList.add(\"__wab_user-body\");\n document.body.appendChild(appDiv);\n }\n return ReactDOM.createPortal(\n <ErrorBoundary key={`${renderCount}`}>\n <PlasmicCanvasContext.Provider value={canvasContextValue}>\n {plasmicRootNode.get()}\n </PlasmicCanvasContext.Provider>\n </ErrorBoundary>,\n appDiv,\n \"plasmic-app\"\n );\n }\n if (shouldRenderStudio && window.parent === window) {\n return (\n <iframe\n src={`https://docs.plasmic.app/app-content/app-host-ready#appHostUrl=${encodeURIComponent(\n location.href\n )}`}\n style={{\n width: \"100vw\",\n height: \"100vh\",\n border: \"none\",\n position: \"fixed\",\n top: 0,\n left: 0,\n zIndex: 99999999,\n }}\n ></iframe>\n );\n }\n return null;\n}\n\ninterface PlasmicCanvasHostProps {\n /**\n * Webpack hmr uses EventSource to\tlisten to hot reloads, but that\n * resultsin a persistent\tconnection from\teach window. In Plasmic\n * Studio, if a project is configured to use app-hosting with a\n * nextjs or gatsby server running in dev mode, each artboard will\n * be holding a persistent connection to the dev server.\n * Because browsers\thave a limit to\thow many connections can\n * be held\tat a time by domain, this means\tafter X\tartboards, new\n * artboards will freeze and not load.\n *\n * By default, <PlasmicCanvasHost /> will globally mutate\n * window.EventSource to avoid using EventSource for HMR, which you\n * typically don't need for your custom host page. If you do still\n * want to retain HRM, then youc an pass enableWebpackHmr={true}.\n */\n enableWebpackHmr?: boolean;\n}\n\nexport const PlasmicCanvasHost: React.FunctionComponent<\n PlasmicCanvasHostProps\n> = (props) => {\n const { enableWebpackHmr } = props;\n const [node, setNode] = React.useState<React.ReactElement<any, any> | null>(\n null\n );\n React.useEffect(() => {\n setNode(<_PlasmicCanvasHost />);\n }, []);\n return (\n <>\n {!enableWebpackHmr && <DisableWebpackHmr />}\n {node}\n </>\n );\n};\n\ntype RenderErrorListener = (err: Error) => void;\nconst renderErrorListeners: RenderErrorListener[] = [];\nexport function registerRenderErrorListener(listener: RenderErrorListener) {\n renderErrorListeners.push(listener);\n return () => {\n const index = renderErrorListeners.indexOf(listener);\n if (index >= 0) {\n renderErrorListeners.splice(index, 1);\n }\n };\n}\n\ninterface ErrorBoundaryProps {\n children?: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error?: Error;\n}\n\nclass ErrorBoundary extends React.Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n renderErrorListeners.forEach((listener) => listener(error));\n }\n\n render() {\n if (this.state.error) {\n return <div>Error: {`${this.state.error.message}`}</div>;\n } else {\n return <>{this.props.children}</>;\n }\n }\n}\n\nfunction DisableWebpackHmr() {\n if (process.env.NODE_ENV === \"production\") {\n return null;\n }\n return (\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n `,\n }}\n ></script>\n );\n}\n\nfunction deriveCanvasContextValue(): PlasmicCanvasContextValue | false {\n const hash = window.location.hash;\n if (hash && hash.length > 0) {\n // create URLsearchParams skipping the initial # character\n const params = new URLSearchParams(hash.substring(1));\n if (params.get(\"canvas\") === \"true\") {\n const globalVariants = params.get(\"globalVariants\");\n return {\n componentName: params.get(\"componentName\") ?? null,\n globalVariants: globalVariants ? JSON.parse(globalVariants) : {},\n interactive: params.get(\"interactive\") === \"true\",\n };\n }\n }\n return false;\n}\n","export const tuple = <T extends any[]>(...args: T): T => args;\n","import React, {\n createContext,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\nimport { tuple } from \"./common\";\n\nexport type DataDict = Record<string, any>;\n\nexport const DataContext = createContext<DataDict | undefined>(undefined);\n\nexport type DataMeta = {\n advanced?: boolean;\n hidden?: boolean;\n label?: string;\n};\n\nexport function mkMetaName(name: string) {\n return `__plasmic_meta_${name}`;\n}\n\nexport function mkMetaValue(meta: Partial<DataMeta>): DataMeta {\n return meta;\n}\n\nexport function applySelector(\n rawData: DataDict | undefined,\n selector: string | undefined\n): any {\n if (!selector) {\n return undefined;\n }\n let curData = rawData;\n for (const key of selector.split(\".\")) {\n curData = curData?.[key];\n }\n return curData;\n}\n\nexport type SelectorDict = Record<string, string | undefined>;\n\nexport function useSelector(selector: string | undefined): any {\n const rawData = useDataEnv();\n return applySelector(rawData, selector);\n}\n\nexport function useSelectors(selectors: SelectorDict = {}): any {\n const rawData = useDataEnv();\n return Object.fromEntries(\n Object.entries(selectors)\n .filter(([key, selector]) => !!key && !!selector)\n .map(([key, selector]) => tuple(key, applySelector(rawData, selector)))\n );\n}\n\nexport function useDataEnv() {\n return useContext(DataContext);\n}\n\nexport interface DataProviderProps {\n /**\n * Key to set in data context.\n */\n name?: string;\n /**\n * Value to set for `name` in data context.\n */\n data?: any;\n /**\n * If true, hide this item in studio data picker.\n */\n hidden?: boolean;\n /**\n * If true, mark this item as advanced in studio.\n */\n advanced?: boolean;\n /**\n * Label to be shown in the studio data picker for easier navigation (data binding).\n */\n label?: string;\n children?: ReactNode;\n}\n\nexport function DataProvider({\n name,\n data,\n hidden,\n advanced,\n label,\n children,\n}: DataProviderProps) {\n const existingEnv = useDataEnv() ?? {};\n if (!name) {\n return <>{children}</>;\n } else {\n return (\n <DataContext.Provider\n value={{\n ...existingEnv,\n [name]: data,\n [mkMetaName(name)]: mkMetaValue({ hidden, advanced, label }),\n }}\n >\n {children}\n </DataContext.Provider>\n );\n }\n}\n\nexport interface PageParamsProviderProps {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n children?: ReactNode;\n}\n\nexport function PageParamsProvider({\n children,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n const $ctx = useDataEnv() || {};\n return (\n <DataProvider\n name={\"params\"}\n data={{ ...$ctx.params, ...params }}\n label={\"Page URL path params\"}\n >\n <DataProvider\n name={\"query\"}\n data={{ ...$ctx.query, ...query }}\n label={\"Page URL query params\"}\n >\n {children}\n </DataProvider>\n </DataProvider>\n );\n}\n\nexport function DataCtxReader({\n children,\n}: {\n children: ($ctx: DataDict | undefined) => ReactNode;\n}) {\n const $ctx = useDataEnv();\n return children($ctx) as ReactElement | null;\n}\n","import { PrimitiveType } from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport type Fetcher = (...args: any[]) => Promise<any>;\n\nexport interface FetcherMeta {\n /**\n * Any unique identifying string for this fetcher.\n */\n name: string;\n /**\n * The Studio-user-friendly display name.\n */\n displayName?: string;\n /**\n * The symbol to import from the importPath.\n */\n importName?: string;\n args: { name: string; type: PrimitiveType }[];\n returns: PrimitiveType;\n /**\n * Either the path to the fetcher relative to `rootDir` or the npm\n * package name\n */\n importPath: string;\n /**\n * Whether it's a default export or named export\n */\n isDefaultExport?: boolean;\n}\n\nexport interface FetcherRegistration {\n fetcher: Fetcher;\n meta: FetcherMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFetcherRegistry: FetcherRegistration[];\n }\n}\n\nroot.__PlasmicFetcherRegistry = [];\n\nexport function registerFetcher(fetcher: Fetcher, meta: FetcherMeta) {\n root.__PlasmicFetcherRegistry.push({ fetcher, meta });\n}\n","import React from \"react\";\n\nexport type GlobalActionDict = Record<string, Function>;\n\nexport const GlobalActionsContext = React.createContext<\n GlobalActionDict | undefined\n>(undefined);\n\nexport function GlobalActionsProvider(props: {\n contextName: string;\n children?: React.ReactNode;\n actions: GlobalActionDict;\n}) {\n const { contextName, children, actions } = props;\n const existingActions = useGlobalActions();\n const namespacedActions = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(actions).map(([key, val]) => [\n `${contextName}.${key}`,\n val,\n ])\n ),\n [contextName, actions]\n );\n return (\n <GlobalActionsContext.Provider\n value={{\n ...existingActions,\n ...namespacedActions,\n }}\n >\n {children}\n </GlobalActionsContext.Provider>\n );\n}\n\nexport function useGlobalActions() {\n return React.useContext(GlobalActionsContext) ?? {};\n}\n","import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n\n /**\n * When true, when you click for the first time anywhere in the component including its slots, the component itself is\n * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a\n * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its\n * slot. Clicking again will deep-select the slot content.\n */\n trapsFocus?: boolean;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n JSONLikeType,\n NumberType,\n StringType,\n DataSourceType,\n} from \"./prop-types\";\nimport { FunctionParam } from \"./registerComponent\";\n\nconst root = globalThis as any;\n\n// Using just a subset of types from prop-types\nexport type PropType<P> =\n | StringType<P>\n | BooleanType<P>\n | NumberType<P>\n | JSONLikeType<P>\n | ChoiceType<P>\n | CustomType<P>\n | DataSourceType<P>;\n\ntype RestrictPropType<T, P> = T extends string\n ? StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>\n : T extends boolean\n ? BooleanType<P> | JSONLikeType<P> | CustomType<P>\n : T extends number\n ? NumberType<P> | JSONLikeType<P> | CustomType<P>\n : PropType<P>;\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\nexport interface GlobalContextMeta<P> {\n /**\n * Any unique string name used to identify that context. Each context\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the context in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the context to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the context properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * The path to be used when importing the context in the generated code.\n * It can be the name of the package that contains the context, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the context is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Whether the global context provides data to its children using DataProvider.\n */\n providesData?: boolean;\n\n unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;\n}\n\nexport interface GlobalContextRegistration {\n component: React.ComponentType<any>;\n meta: GlobalContextMeta<any>;\n}\n\nexport interface GlobalActionRegistration<P> {\n displayName?: string;\n description?: string;\n parameters: FunctionParam<P>[];\n}\n\ndeclare global {\n interface Window {\n __PlasmicContextRegistry: GlobalContextRegistration[];\n }\n}\n\nif (root.__PlasmicContextRegistry == null) {\n root.__PlasmicContextRegistry = [];\n}\n\nexport default function registerGlobalContext<\n T extends React.ComponentType<any>\n>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>) {\n // Check for duplicates\n if (\n root.__PlasmicContextRegistry.some(\n (r: GlobalContextRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicContextRegistry.push({ component, meta });\n}\n","export type TokenType =\n | \"color\"\n | \"spacing\"\n | \"font-family\"\n | \"font-size\"\n | \"line-height\"\n | \"opacity\";\n\nexport interface TokenRegistration {\n /**\n * Name for this token; should be stable across updates\n */\n name: string;\n /**\n * Value for the token, which can either be a valid css value or a css reference\n * to a css variable provided by your host app, like `var(--my-token)`\n */\n value: string;\n /**\n * Type of token\n */\n type: TokenType;\n /**\n * Optional display name to use for this token, if you'd like to use a friendlier\n * name to display to Studio users\n */\n displayName?: string;\n /**\n * By default, if this token is a css variable reference like `var(--my-token)`,\n * then it is assumed that `--my-token` is defined on `:root`. If it is defined\n * in another element, then you can pass in a selector for that element,\n * like `.themeRoot`.\n */\n selector?: string;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTokenRegistry: TokenRegistration[];\n }\n}\n\nconst root = globalThis as any;\n\nif (root.__PlasmicTokenRegistry == null) {\n root.__PlasmicTokenRegistry = [];\n}\n\nexport default function registerToken(token: TokenRegistration) {\n root.__PlasmicTokenRegistry.push(token);\n}\n","const root = globalThis as any;\n\nexport interface BasicTrait {\n label?: string;\n type: \"text\" | \"number\" | \"boolean\";\n}\n\nexport interface ChoiceTrait {\n label?: string;\n type: \"choice\";\n options: string[];\n}\n\nexport type TraitMeta = BasicTrait | ChoiceTrait;\n\nexport interface TraitRegistration {\n trait: string;\n meta: TraitMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTraitRegistry: TraitRegistration[];\n }\n}\n\nif (root.__PlasmicTraitRegistry == null) {\n root.__PlasmicTraitRegistry = [];\n}\n\nexport default function registerTrait(trait: string, meta: TraitMeta) {\n root.__PlasmicTraitRegistry.push({\n trait,\n meta,\n });\n}\n","import { cloneElement, isValidElement } from \"react\";\n\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param index The index of the copy (starting at 0).\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(index: number, elt: T): T;\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param isPrimary should be true for at most one instance of the element, and\n * indicates which copy of the element will be highlighted when the element is\n * selected in Studio.\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(isPrimary: boolean, elt: T): T;\nexport default function repeatedElement<T>(index: boolean | number, elt: T): T {\n return repeatedElementFn(index as any, elt);\n}\n\nlet repeatedElementFn: typeof repeatedElement = (\n index: boolean | number,\n elt: any\n) => {\n if (Array.isArray(elt)) {\n return elt.map((v) => repeatedElementFn(index as any, v)) as any;\n }\n if (elt && isValidElement(elt) && typeof elt !== \"string\") {\n return cloneElement(elt) as any;\n }\n return elt;\n};\n\nconst root = globalThis as any;\nexport const setRepeatedElementFn: (fn: typeof repeatedElement) => void =\n root?.__Sub?.setRepeatedElementFn ??\n function (fn: typeof repeatedElement) {\n repeatedElementFn = fn;\n };\n","import React from \"react\";\n\nconst PlasmicLinkContext = React.createContext<\n React.ComponentType<any> | undefined\n>(undefined);\n\nexport function usePlasmicLinkMaybe():\n | React.ComponentType<React.ComponentProps<\"a\">>\n | undefined {\n return React.useContext(PlasmicLinkContext);\n}\n\nconst AnchorLink = React.forwardRef(function AnchorLink(\n props: React.ComponentProps<\"a\">,\n ref: React.Ref<HTMLAnchorElement>\n) {\n return <a {...props} ref={ref} />;\n});\n\nexport function usePlasmicLink(): React.ComponentType<\n React.ComponentProps<\"a\">\n> {\n const Link = React.useContext(PlasmicLinkContext);\n if (Link) {\n return Link;\n } else {\n return AnchorLink as React.ComponentType<React.ComponentProps<\"a\">>;\n }\n}\n\nexport function PlasmicLinkProvider(props: {\n Link: React.ComponentType<any> | undefined;\n children?: React.ReactNode;\n}) {\n const { Link, children } = props;\n return (\n <PlasmicLinkContext.Provider value={Link}>\n {children}\n </PlasmicLinkContext.Provider>\n );\n}\n","export const hostVersion = \"1.0.165\";\n","import * as PlasmicQuery from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { registerRenderErrorListener, setPlasmicRootNode } from \"./canvas-host\";\nimport * as hostModule from \"./exports\";\nimport { setRepeatedElementFn } from \"./repeatedElement\";\n// version.ts is automatically generated by `yarn build` and not committed.\nimport { hostVersion } from \"./version\";\n\n// All exports must come from \"./exports\"\nexport * from \"./exports\";\n\nconst root = globalThis as any;\n\nif (root.__Sub == null) {\n // Creating a side effect here by logging, so that vite won't\n // ignore this block for whatever reason. Hiding this for now\n // as users are complaining; will have to check if this has\n // been fixed with vite.\n // console.log(\"Plasmic: Setting up app host dependencies\");\n root.__Sub = {\n React,\n ReactDOM,\n PlasmicQuery,\n hostModule,\n hostVersion,\n hostUtils: {\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n },\n\n // For backwards compatibility:\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n ...hostModule,\n };\n} else {\n console.warn(\n `Encountered likely duplicate host version: ${root.__Sub.hostVersion} vs ${hostVersion}`\n );\n root.__Sub.duplicateHostVersions = root.__Sub.duplicateHostVersions ?? [];\n root.__Sub.duplicateHostVersions.push(hostVersion);\n}\n"],"names":["React","root"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,CAAC,CAAM,EAAA;AACtB,IAAA,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAIe,SAAA,MAAM,CAAI,CAAuB,EAAE,GAAmB,EAAA;AAAnB,IAAA,IAAA,GAAA,KAAA,KAAA,CAAA,EAAA,EAAA,GAAmB,GAAA,EAAA,CAAA,EAAA;AACpE,IAAA,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE;AACjC,QAAA,SAAS;AACT,QAAA,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC;AAC1C,QAAA,MAAM,IAAI,KAAK,CACb,qCAAsC,CAAA,MAAA,CAAA,GAAG,GAAG,IAAK,CAAA,MAAA,CAAA,GAAG,CAAE,GAAG,EAAE,CAAE,CAC9D,CAAC;AACH,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,CAAC,CAAC;AACV,KAAA;AACH;;ACdc,SAAU,cAAc,GAAA;IAC9B,IAAA,EAAA,GAAc,QAAQ,CAAC,CAAC,CAAC,EAAtB,OAAO,QAAe,CAAC;IAChC,IAAM,MAAM,GAAG,WAAW,CAAC,YAAA;QACzB,OAAO,CAAC,UAAC,IAAI,EAAK,EAAA,OAAA,IAAI,GAAG,CAAC,CAAA,EAAA,CAA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,2BAA2B,EAAA,2BAAA,EAC3B,oBAAoB,EAAA,oBAAA,EAAA,EACjB,UAAU,CACd,CAAC;AACH,CAAA;AAAM,KAAA;AACL,IAAA,OAAO,CAAC,IAAI,CACV,6CAAA,CAAA,MAAA,CAA8C,IAAI,CAAC,KAAK,CAAC,WAAW,EAAA,MAAA,CAAA,CAAA,MAAA,CAAO,WAAW,CAAE,CACzF,CAAC;AACF,IAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC;IAC1E,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACpD;;;;"}
package/dist/index.cjs.js CHANGED
@@ -521,7 +521,7 @@ var hostModule = /*#__PURE__*/Object.freeze({
521
521
  useSelectors: useSelectors
522
522
  });
523
523
 
524
- var hostVersion = "1.0.164";
524
+ var hostVersion = "1.0.165";
525
525
 
526
526
  var _a;
527
527
  var root = globalThis;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/lang-utils.ts","../src/useForceUpdate.ts","../src/canvas-host.tsx","../src/common.ts","../src/data.tsx","../src/fetcher.ts","../src/global-actions.tsx","../src/registerComponent.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/link.tsx","../src/version.ts","../src/index.ts"],"sourcesContent":["function isString(x: any): x is string {\n return typeof x === \"string\";\n}\n\ntype StringGen = string | (() => string);\n\nexport function ensure<T>(x: T | null | undefined, msg: StringGen = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n msg = (isString(msg) ? msg : msg()) || \"\";\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n","import { useCallback, useState } from \"react\";\n\nexport default function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ensure } from \"./lang-utils\";\nimport useForceUpdate from \"./useForceUpdate\";\n\ndeclare global {\n interface Window {\n __PlasmicHostVersion: string;\n }\n}\n\nif ((globalThis as any).__PlasmicHostVersion == null) {\n (globalThis as any).__PlasmicHostVersion = \"3\";\n}\n\nconst rootChangeListeners: (() => void)[] = [];\nclass PlasmicRootNodeWrapper {\n constructor(private value: null | React.ReactElement) {}\n set = (val: null | React.ReactElement) => {\n this.value = val;\n rootChangeListeners.forEach((f) => f());\n };\n get = () => this.value;\n}\n\nconst plasmicRootNode = new PlasmicRootNodeWrapper(null);\n\nfunction getHashParams() {\n return new URLSearchParams(location.hash.replace(/^#/, \"?\"));\n}\n\nfunction getPlasmicOrigin() {\n const params = getHashParams();\n return ensure(\n params.get(\"origin\"),\n \"Missing information from Plasmic window.\"\n );\n}\n\nfunction getStudioHash() {\n const hashParams = getHashParams();\n if (hashParams.has(\"studioHash\")) {\n return hashParams.get(\"studioHash\");\n }\n const urlParams = new URL(location.href).searchParams;\n return urlParams.get(\"studio-hash\");\n}\n\nfunction renderStudioIntoIframe() {\n const script = document.createElement(\"script\");\n const plasmicOrigin = getPlasmicOrigin();\n const hash = getStudioHash();\n script.src = `${plasmicOrigin}/static/js/studio${\n hash ? `.${hash}.js` : `.js`\n }`;\n document.body.appendChild(script);\n}\n\nlet renderCount = 0;\nexport function setPlasmicRootNode(node: React.ReactElement | null) {\n // Keep track of renderCount, which we use as key to ErrorBoundary, so\n // we can reset the error on each render\n renderCount++;\n plasmicRootNode.set(node);\n}\n\nexport interface PlasmicCanvasContextValue {\n componentName: string | null;\n globalVariants: Record<string, string>;\n interactive?: boolean;\n}\n\n/**\n * React context to detect whether the component is rendered on Plasmic editor.\n * If not, return false.\n * If so, return an object with more information about the component\n */\nexport const PlasmicCanvasContext = React.createContext<\n PlasmicCanvasContextValue | false\n>(false);\nexport const usePlasmicCanvasContext = () =>\n React.useContext(PlasmicCanvasContext);\n\nfunction _PlasmicCanvasHost() {\n // If window.parent is null, then this is a window whose containing iframe\n // has been detached from the DOM (for the top window, window.parent === window).\n // In that case, we shouldn't do anything. If window.parent is null, by the way,\n // location.hash will also be null.\n const isFrameAttached = !!window.parent;\n const isCanvas = !!location.hash?.match(/\\bcanvas=true\\b/);\n const isLive = !!location.hash?.match(/\\blive=true\\b/) || !isFrameAttached;\n const shouldRenderStudio =\n isFrameAttached &&\n !document.querySelector(\"#plasmic-studio-tag\") &&\n !isCanvas &&\n !isLive;\n const forceUpdate = useForceUpdate();\n React.useLayoutEffect(() => {\n rootChangeListeners.push(forceUpdate);\n return () => {\n const index = rootChangeListeners.indexOf(forceUpdate);\n if (index >= 0) {\n rootChangeListeners.splice(index, 1);\n }\n };\n }, [forceUpdate]);\n React.useEffect(() => {\n if (shouldRenderStudio && isFrameAttached && window.parent !== window) {\n renderStudioIntoIframe();\n }\n }, [shouldRenderStudio, isFrameAttached]);\n React.useEffect(() => {\n if (!shouldRenderStudio && !document.querySelector(\"#getlibs\") && isLive) {\n const scriptElt = document.createElement(\"script\");\n scriptElt.id = \"getlibs\";\n scriptElt.src = getPlasmicOrigin() + \"/static/js/getlibs.js\";\n scriptElt.async = false;\n scriptElt.onload = () => {\n (window as any).__GetlibsReadyResolver?.();\n };\n document.head.append(scriptElt);\n }\n }, [shouldRenderStudio]);\n\n const [canvasContextValue, setCanvasContextValue] = React.useState(() =>\n deriveCanvasContextValue()\n );\n\n React.useEffect(() => {\n if (isCanvas) {\n const listener = () => {\n setCanvasContextValue(deriveCanvasContextValue());\n };\n window.addEventListener(\"hashchange\", listener);\n return () => window.removeEventListener(\"hashchange\", listener);\n }\n return undefined;\n }, [isCanvas]);\n if (!isFrameAttached) {\n return null;\n }\n if (isCanvas || isLive) {\n let appDiv = document.querySelector(\"#plasmic-app.__wab_user-body\");\n if (!appDiv) {\n appDiv = document.createElement(\"div\");\n appDiv.id = \"plasmic-app\";\n appDiv.classList.add(\"__wab_user-body\");\n document.body.appendChild(appDiv);\n }\n return ReactDOM.createPortal(\n <ErrorBoundary key={`${renderCount}`}>\n <PlasmicCanvasContext.Provider value={canvasContextValue}>\n {plasmicRootNode.get()}\n </PlasmicCanvasContext.Provider>\n </ErrorBoundary>,\n appDiv,\n \"plasmic-app\"\n );\n }\n if (shouldRenderStudio && window.parent === window) {\n return (\n <iframe\n src={`https://docs.plasmic.app/app-content/app-host-ready#appHostUrl=${encodeURIComponent(\n location.href\n )}`}\n style={{\n width: \"100vw\",\n height: \"100vh\",\n border: \"none\",\n position: \"fixed\",\n top: 0,\n left: 0,\n zIndex: 99999999,\n }}\n ></iframe>\n );\n }\n return null;\n}\n\ninterface PlasmicCanvasHostProps {\n /**\n * Webpack hmr uses EventSource to\tlisten to hot reloads, but that\n * resultsin a persistent\tconnection from\teach window. In Plasmic\n * Studio, if a project is configured to use app-hosting with a\n * nextjs or gatsby server running in dev mode, each artboard will\n * be holding a persistent connection to the dev server.\n * Because browsers\thave a limit to\thow many connections can\n * be held\tat a time by domain, this means\tafter X\tartboards, new\n * artboards will freeze and not load.\n *\n * By default, <PlasmicCanvasHost /> will globally mutate\n * window.EventSource to avoid using EventSource for HMR, which you\n * typically don't need for your custom host page. If you do still\n * want to retain HRM, then youc an pass enableWebpackHmr={true}.\n */\n enableWebpackHmr?: boolean;\n}\n\nexport const PlasmicCanvasHost: React.FunctionComponent<\n PlasmicCanvasHostProps\n> = (props) => {\n const { enableWebpackHmr } = props;\n const [node, setNode] = React.useState<React.ReactElement<any, any> | null>(\n null\n );\n React.useEffect(() => {\n setNode(<_PlasmicCanvasHost />);\n }, []);\n return (\n <>\n {!enableWebpackHmr && <DisableWebpackHmr />}\n {node}\n </>\n );\n};\n\ntype RenderErrorListener = (err: Error) => void;\nconst renderErrorListeners: RenderErrorListener[] = [];\nexport function registerRenderErrorListener(listener: RenderErrorListener) {\n renderErrorListeners.push(listener);\n return () => {\n const index = renderErrorListeners.indexOf(listener);\n if (index >= 0) {\n renderErrorListeners.splice(index, 1);\n }\n };\n}\n\ninterface ErrorBoundaryProps {\n children?: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error?: Error;\n}\n\nclass ErrorBoundary extends React.Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n renderErrorListeners.forEach((listener) => listener(error));\n }\n\n render() {\n if (this.state.error) {\n return <div>Error: {`${this.state.error.message}`}</div>;\n } else {\n return <>{this.props.children}</>;\n }\n }\n}\n\nfunction DisableWebpackHmr() {\n if (process.env.NODE_ENV === \"production\") {\n return null;\n }\n return (\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n `,\n }}\n ></script>\n );\n}\n\nfunction deriveCanvasContextValue(): PlasmicCanvasContextValue | false {\n const hash = window.location.hash;\n if (hash && hash.length > 0) {\n // create URLsearchParams skipping the initial # character\n const params = new URLSearchParams(hash.substring(1));\n if (params.get(\"canvas\") === \"true\") {\n const globalVariants = params.get(\"globalVariants\");\n return {\n componentName: params.get(\"componentName\") ?? null,\n globalVariants: globalVariants ? JSON.parse(globalVariants) : {},\n interactive: params.get(\"interactive\") === \"true\",\n };\n }\n }\n return false;\n}\n","export const tuple = <T extends any[]>(...args: T): T => args;\n","import React, {\n createContext,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\nimport { tuple } from \"./common\";\n\nexport type DataDict = Record<string, any>;\n\nexport const DataContext = createContext<DataDict | undefined>(undefined);\n\nexport type DataMeta = {\n advanced?: boolean;\n hidden?: boolean;\n label?: string;\n};\n\nexport function mkMetaName(name: string) {\n return `__plasmic_meta_${name}`;\n}\n\nexport function mkMetaValue(meta: Partial<DataMeta>): DataMeta {\n return meta;\n}\n\nexport function applySelector(\n rawData: DataDict | undefined,\n selector: string | undefined\n): any {\n if (!selector) {\n return undefined;\n }\n let curData = rawData;\n for (const key of selector.split(\".\")) {\n curData = curData?.[key];\n }\n return curData;\n}\n\nexport type SelectorDict = Record<string, string | undefined>;\n\nexport function useSelector(selector: string | undefined): any {\n const rawData = useDataEnv();\n return applySelector(rawData, selector);\n}\n\nexport function useSelectors(selectors: SelectorDict = {}): any {\n const rawData = useDataEnv();\n return Object.fromEntries(\n Object.entries(selectors)\n .filter(([key, selector]) => !!key && !!selector)\n .map(([key, selector]) => tuple(key, applySelector(rawData, selector)))\n );\n}\n\nexport function useDataEnv() {\n return useContext(DataContext);\n}\n\nexport interface DataProviderProps {\n /**\n * Key to set in data context.\n */\n name?: string;\n /**\n * Value to set for `name` in data context.\n */\n data?: any;\n /**\n * If true, hide this item in studio data picker.\n */\n hidden?: boolean;\n /**\n * If true, mark this item as advanced in studio.\n */\n advanced?: boolean;\n /**\n * Label to be shown in the studio data picker for easier navigation (data binding).\n */\n label?: string;\n children?: ReactNode;\n}\n\nexport function DataProvider({\n name,\n data,\n hidden,\n advanced,\n label,\n children,\n}: DataProviderProps) {\n const existingEnv = useDataEnv() ?? {};\n if (!name) {\n return <>{children}</>;\n } else {\n return (\n <DataContext.Provider\n value={{\n ...existingEnv,\n [name]: data,\n [mkMetaName(name)]: mkMetaValue({ hidden, advanced, label }),\n }}\n >\n {children}\n </DataContext.Provider>\n );\n }\n}\n\nexport interface PageParamsProviderProps {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n children?: ReactNode;\n}\n\nexport function PageParamsProvider({\n children,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n const $ctx = useDataEnv() || {};\n return (\n <DataProvider\n name={\"params\"}\n data={{ ...$ctx.params, ...params }}\n label={\"Page URL path params\"}\n >\n <DataProvider\n name={\"query\"}\n data={{ ...$ctx.query, ...query }}\n label={\"Page URL query params\"}\n >\n {children}\n </DataProvider>\n </DataProvider>\n );\n}\n\nexport function DataCtxReader({\n children,\n}: {\n children: ($ctx: DataDict | undefined) => ReactNode;\n}) {\n const $ctx = useDataEnv();\n return children($ctx) as ReactElement | null;\n}\n","import { PrimitiveType } from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport type Fetcher = (...args: any[]) => Promise<any>;\n\nexport interface FetcherMeta {\n /**\n * Any unique identifying string for this fetcher.\n */\n name: string;\n /**\n * The Studio-user-friendly display name.\n */\n displayName?: string;\n /**\n * The symbol to import from the importPath.\n */\n importName?: string;\n args: { name: string; type: PrimitiveType }[];\n returns: PrimitiveType;\n /**\n * Either the path to the fetcher relative to `rootDir` or the npm\n * package name\n */\n importPath: string;\n /**\n * Whether it's a default export or named export\n */\n isDefaultExport?: boolean;\n}\n\nexport interface FetcherRegistration {\n fetcher: Fetcher;\n meta: FetcherMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFetcherRegistry: FetcherRegistration[];\n }\n}\n\nroot.__PlasmicFetcherRegistry = [];\n\nexport function registerFetcher(fetcher: Fetcher, meta: FetcherMeta) {\n root.__PlasmicFetcherRegistry.push({ fetcher, meta });\n}\n","import React from \"react\";\n\nexport type GlobalActionDict = Record<string, Function>;\n\nexport const GlobalActionsContext = React.createContext<\n GlobalActionDict | undefined\n>(undefined);\n\nexport function GlobalActionsProvider(props: {\n contextName: string;\n children?: React.ReactNode;\n actions: GlobalActionDict;\n}) {\n const { contextName, children, actions } = props;\n const existingActions = useGlobalActions();\n const namespacedActions = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(actions).map(([key, val]) => [\n `${contextName}.${key}`,\n val,\n ])\n ),\n [contextName, actions]\n );\n return (\n <GlobalActionsContext.Provider\n value={{\n ...existingActions,\n ...namespacedActions,\n }}\n >\n {children}\n </GlobalActionsContext.Provider>\n );\n}\n\nexport function useGlobalActions() {\n return React.useContext(GlobalActionsContext) ?? {};\n}\n","import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n JSONLikeType,\n NumberType,\n StringType,\n DataSourceType,\n} from \"./prop-types\";\nimport { FunctionParam } from \"./registerComponent\";\n\nconst root = globalThis as any;\n\n// Using just a subset of types from prop-types\nexport type PropType<P> =\n | StringType<P>\n | BooleanType<P>\n | NumberType<P>\n | JSONLikeType<P>\n | ChoiceType<P>\n | CustomType<P>\n | DataSourceType<P>;\n\ntype RestrictPropType<T, P> = T extends string\n ? StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>\n : T extends boolean\n ? BooleanType<P> | JSONLikeType<P> | CustomType<P>\n : T extends number\n ? NumberType<P> | JSONLikeType<P> | CustomType<P>\n : PropType<P>;\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\nexport interface GlobalContextMeta<P> {\n /**\n * Any unique string name used to identify that context. Each context\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the context in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the context to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the context properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * The path to be used when importing the context in the generated code.\n * It can be the name of the package that contains the context, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the context is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Whether the global context provides data to its children using DataProvider.\n */\n providesData?: boolean;\n\n unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;\n}\n\nexport interface GlobalContextRegistration {\n component: React.ComponentType<any>;\n meta: GlobalContextMeta<any>;\n}\n\nexport interface GlobalActionRegistration<P> {\n displayName?: string;\n description?: string;\n parameters: FunctionParam<P>[];\n}\n\ndeclare global {\n interface Window {\n __PlasmicContextRegistry: GlobalContextRegistration[];\n }\n}\n\nif (root.__PlasmicContextRegistry == null) {\n root.__PlasmicContextRegistry = [];\n}\n\nexport default function registerGlobalContext<\n T extends React.ComponentType<any>\n>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>) {\n // Check for duplicates\n if (\n root.__PlasmicContextRegistry.some(\n (r: GlobalContextRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicContextRegistry.push({ component, meta });\n}\n","export type TokenType =\n | \"color\"\n | \"spacing\"\n | \"font-family\"\n | \"font-size\"\n | \"line-height\"\n | \"opacity\";\n\nexport interface TokenRegistration {\n /**\n * Name for this token; should be stable across updates\n */\n name: string;\n /**\n * Value for the token, which can either be a valid css value or a css reference\n * to a css variable provided by your host app, like `var(--my-token)`\n */\n value: string;\n /**\n * Type of token\n */\n type: TokenType;\n /**\n * Optional display name to use for this token, if you'd like to use a friendlier\n * name to display to Studio users\n */\n displayName?: string;\n /**\n * By default, if this token is a css variable reference like `var(--my-token)`,\n * then it is assumed that `--my-token` is defined on `:root`. If it is defined\n * in another element, then you can pass in a selector for that element,\n * like `.themeRoot`.\n */\n selector?: string;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTokenRegistry: TokenRegistration[];\n }\n}\n\nconst root = globalThis as any;\n\nif (root.__PlasmicTokenRegistry == null) {\n root.__PlasmicTokenRegistry = [];\n}\n\nexport default function registerToken(token: TokenRegistration) {\n root.__PlasmicTokenRegistry.push(token);\n}\n","const root = globalThis as any;\n\nexport interface BasicTrait {\n label?: string;\n type: \"text\" | \"number\" | \"boolean\";\n}\n\nexport interface ChoiceTrait {\n label?: string;\n type: \"choice\";\n options: string[];\n}\n\nexport type TraitMeta = BasicTrait | ChoiceTrait;\n\nexport interface TraitRegistration {\n trait: string;\n meta: TraitMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTraitRegistry: TraitRegistration[];\n }\n}\n\nif (root.__PlasmicTraitRegistry == null) {\n root.__PlasmicTraitRegistry = [];\n}\n\nexport default function registerTrait(trait: string, meta: TraitMeta) {\n root.__PlasmicTraitRegistry.push({\n trait,\n meta,\n });\n}\n","import { cloneElement, isValidElement } from \"react\";\n\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param index The index of the copy (starting at 0).\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(index: number, elt: T): T;\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param isPrimary should be true for at most one instance of the element, and\n * indicates which copy of the element will be highlighted when the element is\n * selected in Studio.\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(isPrimary: boolean, elt: T): T;\nexport default function repeatedElement<T>(index: boolean | number, elt: T): T {\n return repeatedElementFn(index as any, elt);\n}\n\nlet repeatedElementFn: typeof repeatedElement = (\n index: boolean | number,\n elt: any\n) => {\n if (Array.isArray(elt)) {\n return elt.map((v) => repeatedElementFn(index as any, v)) as any;\n }\n if (elt && isValidElement(elt) && typeof elt !== \"string\") {\n return cloneElement(elt) as any;\n }\n return elt;\n};\n\nconst root = globalThis as any;\nexport const setRepeatedElementFn: (fn: typeof repeatedElement) => void =\n root?.__Sub?.setRepeatedElementFn ??\n function (fn: typeof repeatedElement) {\n repeatedElementFn = fn;\n };\n","import React from \"react\";\n\nconst PlasmicLinkContext = React.createContext<\n React.ComponentType<any> | undefined\n>(undefined);\n\nexport function usePlasmicLinkMaybe():\n | React.ComponentType<React.ComponentProps<\"a\">>\n | undefined {\n return React.useContext(PlasmicLinkContext);\n}\n\nconst AnchorLink = React.forwardRef(function AnchorLink(\n props: React.ComponentProps<\"a\">,\n ref: React.Ref<HTMLAnchorElement>\n) {\n return <a {...props} ref={ref} />;\n});\n\nexport function usePlasmicLink(): React.ComponentType<\n React.ComponentProps<\"a\">\n> {\n const Link = React.useContext(PlasmicLinkContext);\n if (Link) {\n return Link;\n } else {\n return AnchorLink as React.ComponentType<React.ComponentProps<\"a\">>;\n }\n}\n\nexport function PlasmicLinkProvider(props: {\n Link: React.ComponentType<any> | undefined;\n children?: React.ReactNode;\n}) {\n const { Link, children } = props;\n return (\n <PlasmicLinkContext.Provider value={Link}>\n {children}\n </PlasmicLinkContext.Provider>\n );\n}\n","export const hostVersion = \"1.0.164\";\n","import * as PlasmicQuery from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { registerRenderErrorListener, setPlasmicRootNode } from \"./canvas-host\";\nimport * as hostModule from \"./exports\";\nimport { setRepeatedElementFn } from \"./repeatedElement\";\n// version.ts is automatically generated by `yarn build` and not committed.\nimport { hostVersion } from \"./version\";\n\n// All exports must come from \"./exports\"\nexport * from \"./exports\";\n\nconst root = globalThis as any;\n\nif (root.__Sub == null) {\n // Creating a side effect here by logging, so that vite won't\n // ignore this block for whatever reason. Hiding this for now\n // as users are complaining; will have to check if this has\n // been fixed with vite.\n // console.log(\"Plasmic: Setting up app host dependencies\");\n root.__Sub = {\n React,\n ReactDOM,\n PlasmicQuery,\n hostModule,\n hostVersion,\n hostUtils: {\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n },\n\n // For backwards compatibility:\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n ...hostModule,\n };\n} else {\n console.warn(\n `Encountered likely duplicate host version: ${root.__Sub.hostVersion} vs ${hostVersion}`\n );\n root.__Sub.duplicateHostVersions = root.__Sub.duplicateHostVersions ?? [];\n root.__Sub.duplicateHostVersions.push(hostVersion);\n}\n"],"names":["useState","useCallback","React","ReactDOM","createContext","useContext","root","isValidElement","cloneElement","PlasmicQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,CAAC,KAAK,CAAC,qBAAqB,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC;IAC1E,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/lang-utils.ts","../src/useForceUpdate.ts","../src/canvas-host.tsx","../src/common.ts","../src/data.tsx","../src/fetcher.ts","../src/global-actions.tsx","../src/registerComponent.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/link.tsx","../src/version.ts","../src/index.ts"],"sourcesContent":["function isString(x: any): x is string {\n return typeof x === \"string\";\n}\n\ntype StringGen = string | (() => string);\n\nexport function ensure<T>(x: T | null | undefined, msg: StringGen = \"\"): T {\n if (x === null || x === undefined) {\n debugger;\n msg = (isString(msg) ? msg : msg()) || \"\";\n throw new Error(\n `Value must not be undefined or null${msg ? `- ${msg}` : \"\"}`\n );\n } else {\n return x;\n }\n}\n","import { useCallback, useState } from \"react\";\n\nexport default function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ensure } from \"./lang-utils\";\nimport useForceUpdate from \"./useForceUpdate\";\n\ndeclare global {\n interface Window {\n __PlasmicHostVersion: string;\n }\n}\n\nif ((globalThis as any).__PlasmicHostVersion == null) {\n (globalThis as any).__PlasmicHostVersion = \"3\";\n}\n\nconst rootChangeListeners: (() => void)[] = [];\nclass PlasmicRootNodeWrapper {\n constructor(private value: null | React.ReactElement) {}\n set = (val: null | React.ReactElement) => {\n this.value = val;\n rootChangeListeners.forEach((f) => f());\n };\n get = () => this.value;\n}\n\nconst plasmicRootNode = new PlasmicRootNodeWrapper(null);\n\nfunction getHashParams() {\n return new URLSearchParams(location.hash.replace(/^#/, \"?\"));\n}\n\nfunction getPlasmicOrigin() {\n const params = getHashParams();\n return ensure(\n params.get(\"origin\"),\n \"Missing information from Plasmic window.\"\n );\n}\n\nfunction getStudioHash() {\n const hashParams = getHashParams();\n if (hashParams.has(\"studioHash\")) {\n return hashParams.get(\"studioHash\");\n }\n const urlParams = new URL(location.href).searchParams;\n return urlParams.get(\"studio-hash\");\n}\n\nfunction renderStudioIntoIframe() {\n const script = document.createElement(\"script\");\n const plasmicOrigin = getPlasmicOrigin();\n const hash = getStudioHash();\n script.src = `${plasmicOrigin}/static/js/studio${\n hash ? `.${hash}.js` : `.js`\n }`;\n document.body.appendChild(script);\n}\n\nlet renderCount = 0;\nexport function setPlasmicRootNode(node: React.ReactElement | null) {\n // Keep track of renderCount, which we use as key to ErrorBoundary, so\n // we can reset the error on each render\n renderCount++;\n plasmicRootNode.set(node);\n}\n\nexport interface PlasmicCanvasContextValue {\n componentName: string | null;\n globalVariants: Record<string, string>;\n interactive?: boolean;\n}\n\n/**\n * React context to detect whether the component is rendered on Plasmic editor.\n * If not, return false.\n * If so, return an object with more information about the component\n */\nexport const PlasmicCanvasContext = React.createContext<\n PlasmicCanvasContextValue | false\n>(false);\nexport const usePlasmicCanvasContext = () =>\n React.useContext(PlasmicCanvasContext);\n\nfunction _PlasmicCanvasHost() {\n // If window.parent is null, then this is a window whose containing iframe\n // has been detached from the DOM (for the top window, window.parent === window).\n // In that case, we shouldn't do anything. If window.parent is null, by the way,\n // location.hash will also be null.\n const isFrameAttached = !!window.parent;\n const isCanvas = !!location.hash?.match(/\\bcanvas=true\\b/);\n const isLive = !!location.hash?.match(/\\blive=true\\b/) || !isFrameAttached;\n const shouldRenderStudio =\n isFrameAttached &&\n !document.querySelector(\"#plasmic-studio-tag\") &&\n !isCanvas &&\n !isLive;\n const forceUpdate = useForceUpdate();\n React.useLayoutEffect(() => {\n rootChangeListeners.push(forceUpdate);\n return () => {\n const index = rootChangeListeners.indexOf(forceUpdate);\n if (index >= 0) {\n rootChangeListeners.splice(index, 1);\n }\n };\n }, [forceUpdate]);\n React.useEffect(() => {\n if (shouldRenderStudio && isFrameAttached && window.parent !== window) {\n renderStudioIntoIframe();\n }\n }, [shouldRenderStudio, isFrameAttached]);\n React.useEffect(() => {\n if (!shouldRenderStudio && !document.querySelector(\"#getlibs\") && isLive) {\n const scriptElt = document.createElement(\"script\");\n scriptElt.id = \"getlibs\";\n scriptElt.src = getPlasmicOrigin() + \"/static/js/getlibs.js\";\n scriptElt.async = false;\n scriptElt.onload = () => {\n (window as any).__GetlibsReadyResolver?.();\n };\n document.head.append(scriptElt);\n }\n }, [shouldRenderStudio]);\n\n const [canvasContextValue, setCanvasContextValue] = React.useState(() =>\n deriveCanvasContextValue()\n );\n\n React.useEffect(() => {\n if (isCanvas) {\n const listener = () => {\n setCanvasContextValue(deriveCanvasContextValue());\n };\n window.addEventListener(\"hashchange\", listener);\n return () => window.removeEventListener(\"hashchange\", listener);\n }\n return undefined;\n }, [isCanvas]);\n if (!isFrameAttached) {\n return null;\n }\n if (isCanvas || isLive) {\n let appDiv = document.querySelector(\"#plasmic-app.__wab_user-body\");\n if (!appDiv) {\n appDiv = document.createElement(\"div\");\n appDiv.id = \"plasmic-app\";\n appDiv.classList.add(\"__wab_user-body\");\n document.body.appendChild(appDiv);\n }\n return ReactDOM.createPortal(\n <ErrorBoundary key={`${renderCount}`}>\n <PlasmicCanvasContext.Provider value={canvasContextValue}>\n {plasmicRootNode.get()}\n </PlasmicCanvasContext.Provider>\n </ErrorBoundary>,\n appDiv,\n \"plasmic-app\"\n );\n }\n if (shouldRenderStudio && window.parent === window) {\n return (\n <iframe\n src={`https://docs.plasmic.app/app-content/app-host-ready#appHostUrl=${encodeURIComponent(\n location.href\n )}`}\n style={{\n width: \"100vw\",\n height: \"100vh\",\n border: \"none\",\n position: \"fixed\",\n top: 0,\n left: 0,\n zIndex: 99999999,\n }}\n ></iframe>\n );\n }\n return null;\n}\n\ninterface PlasmicCanvasHostProps {\n /**\n * Webpack hmr uses EventSource to\tlisten to hot reloads, but that\n * resultsin a persistent\tconnection from\teach window. In Plasmic\n * Studio, if a project is configured to use app-hosting with a\n * nextjs or gatsby server running in dev mode, each artboard will\n * be holding a persistent connection to the dev server.\n * Because browsers\thave a limit to\thow many connections can\n * be held\tat a time by domain, this means\tafter X\tartboards, new\n * artboards will freeze and not load.\n *\n * By default, <PlasmicCanvasHost /> will globally mutate\n * window.EventSource to avoid using EventSource for HMR, which you\n * typically don't need for your custom host page. If you do still\n * want to retain HRM, then youc an pass enableWebpackHmr={true}.\n */\n enableWebpackHmr?: boolean;\n}\n\nexport const PlasmicCanvasHost: React.FunctionComponent<\n PlasmicCanvasHostProps\n> = (props) => {\n const { enableWebpackHmr } = props;\n const [node, setNode] = React.useState<React.ReactElement<any, any> | null>(\n null\n );\n React.useEffect(() => {\n setNode(<_PlasmicCanvasHost />);\n }, []);\n return (\n <>\n {!enableWebpackHmr && <DisableWebpackHmr />}\n {node}\n </>\n );\n};\n\ntype RenderErrorListener = (err: Error) => void;\nconst renderErrorListeners: RenderErrorListener[] = [];\nexport function registerRenderErrorListener(listener: RenderErrorListener) {\n renderErrorListeners.push(listener);\n return () => {\n const index = renderErrorListeners.indexOf(listener);\n if (index >= 0) {\n renderErrorListeners.splice(index, 1);\n }\n };\n}\n\ninterface ErrorBoundaryProps {\n children?: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error?: Error;\n}\n\nclass ErrorBoundary extends React.Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {};\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n renderErrorListeners.forEach((listener) => listener(error));\n }\n\n render() {\n if (this.state.error) {\n return <div>Error: {`${this.state.error.message}`}</div>;\n } else {\n return <>{this.props.children}</>;\n }\n }\n}\n\nfunction DisableWebpackHmr() {\n if (process.env.NODE_ENV === \"production\") {\n return null;\n }\n return (\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n `,\n }}\n ></script>\n );\n}\n\nfunction deriveCanvasContextValue(): PlasmicCanvasContextValue | false {\n const hash = window.location.hash;\n if (hash && hash.length > 0) {\n // create URLsearchParams skipping the initial # character\n const params = new URLSearchParams(hash.substring(1));\n if (params.get(\"canvas\") === \"true\") {\n const globalVariants = params.get(\"globalVariants\");\n return {\n componentName: params.get(\"componentName\") ?? null,\n globalVariants: globalVariants ? JSON.parse(globalVariants) : {},\n interactive: params.get(\"interactive\") === \"true\",\n };\n }\n }\n return false;\n}\n","export const tuple = <T extends any[]>(...args: T): T => args;\n","import React, {\n createContext,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\nimport { tuple } from \"./common\";\n\nexport type DataDict = Record<string, any>;\n\nexport const DataContext = createContext<DataDict | undefined>(undefined);\n\nexport type DataMeta = {\n advanced?: boolean;\n hidden?: boolean;\n label?: string;\n};\n\nexport function mkMetaName(name: string) {\n return `__plasmic_meta_${name}`;\n}\n\nexport function mkMetaValue(meta: Partial<DataMeta>): DataMeta {\n return meta;\n}\n\nexport function applySelector(\n rawData: DataDict | undefined,\n selector: string | undefined\n): any {\n if (!selector) {\n return undefined;\n }\n let curData = rawData;\n for (const key of selector.split(\".\")) {\n curData = curData?.[key];\n }\n return curData;\n}\n\nexport type SelectorDict = Record<string, string | undefined>;\n\nexport function useSelector(selector: string | undefined): any {\n const rawData = useDataEnv();\n return applySelector(rawData, selector);\n}\n\nexport function useSelectors(selectors: SelectorDict = {}): any {\n const rawData = useDataEnv();\n return Object.fromEntries(\n Object.entries(selectors)\n .filter(([key, selector]) => !!key && !!selector)\n .map(([key, selector]) => tuple(key, applySelector(rawData, selector)))\n );\n}\n\nexport function useDataEnv() {\n return useContext(DataContext);\n}\n\nexport interface DataProviderProps {\n /**\n * Key to set in data context.\n */\n name?: string;\n /**\n * Value to set for `name` in data context.\n */\n data?: any;\n /**\n * If true, hide this item in studio data picker.\n */\n hidden?: boolean;\n /**\n * If true, mark this item as advanced in studio.\n */\n advanced?: boolean;\n /**\n * Label to be shown in the studio data picker for easier navigation (data binding).\n */\n label?: string;\n children?: ReactNode;\n}\n\nexport function DataProvider({\n name,\n data,\n hidden,\n advanced,\n label,\n children,\n}: DataProviderProps) {\n const existingEnv = useDataEnv() ?? {};\n if (!name) {\n return <>{children}</>;\n } else {\n return (\n <DataContext.Provider\n value={{\n ...existingEnv,\n [name]: data,\n [mkMetaName(name)]: mkMetaValue({ hidden, advanced, label }),\n }}\n >\n {children}\n </DataContext.Provider>\n );\n }\n}\n\nexport interface PageParamsProviderProps {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n children?: ReactNode;\n}\n\nexport function PageParamsProvider({\n children,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n const $ctx = useDataEnv() || {};\n return (\n <DataProvider\n name={\"params\"}\n data={{ ...$ctx.params, ...params }}\n label={\"Page URL path params\"}\n >\n <DataProvider\n name={\"query\"}\n data={{ ...$ctx.query, ...query }}\n label={\"Page URL query params\"}\n >\n {children}\n </DataProvider>\n </DataProvider>\n );\n}\n\nexport function DataCtxReader({\n children,\n}: {\n children: ($ctx: DataDict | undefined) => ReactNode;\n}) {\n const $ctx = useDataEnv();\n return children($ctx) as ReactElement | null;\n}\n","import { PrimitiveType } from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport type Fetcher = (...args: any[]) => Promise<any>;\n\nexport interface FetcherMeta {\n /**\n * Any unique identifying string for this fetcher.\n */\n name: string;\n /**\n * The Studio-user-friendly display name.\n */\n displayName?: string;\n /**\n * The symbol to import from the importPath.\n */\n importName?: string;\n args: { name: string; type: PrimitiveType }[];\n returns: PrimitiveType;\n /**\n * Either the path to the fetcher relative to `rootDir` or the npm\n * package name\n */\n importPath: string;\n /**\n * Whether it's a default export or named export\n */\n isDefaultExport?: boolean;\n}\n\nexport interface FetcherRegistration {\n fetcher: Fetcher;\n meta: FetcherMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFetcherRegistry: FetcherRegistration[];\n }\n}\n\nroot.__PlasmicFetcherRegistry = [];\n\nexport function registerFetcher(fetcher: Fetcher, meta: FetcherMeta) {\n root.__PlasmicFetcherRegistry.push({ fetcher, meta });\n}\n","import React from \"react\";\n\nexport type GlobalActionDict = Record<string, Function>;\n\nexport const GlobalActionsContext = React.createContext<\n GlobalActionDict | undefined\n>(undefined);\n\nexport function GlobalActionsProvider(props: {\n contextName: string;\n children?: React.ReactNode;\n actions: GlobalActionDict;\n}) {\n const { contextName, children, actions } = props;\n const existingActions = useGlobalActions();\n const namespacedActions = React.useMemo(\n () =>\n Object.fromEntries(\n Object.entries(actions).map(([key, val]) => [\n `${contextName}.${key}`,\n val,\n ])\n ),\n [contextName, actions]\n );\n return (\n <GlobalActionsContext.Provider\n value={{\n ...existingActions,\n ...namespacedActions,\n }}\n >\n {children}\n </GlobalActionsContext.Provider>\n );\n}\n\nexport function useGlobalActions() {\n return React.useContext(GlobalActionsContext) ?? {};\n}\n","import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n\n /**\n * When true, when you click for the first time anywhere in the component including its slots, the component itself is\n * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a\n * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its\n * slot. Clicking again will deep-select the slot content.\n */\n trapsFocus?: boolean;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n JSONLikeType,\n NumberType,\n StringType,\n DataSourceType,\n} from \"./prop-types\";\nimport { FunctionParam } from \"./registerComponent\";\n\nconst root = globalThis as any;\n\n// Using just a subset of types from prop-types\nexport type PropType<P> =\n | StringType<P>\n | BooleanType<P>\n | NumberType<P>\n | JSONLikeType<P>\n | ChoiceType<P>\n | CustomType<P>\n | DataSourceType<P>;\n\ntype RestrictPropType<T, P> = T extends string\n ? StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>\n : T extends boolean\n ? BooleanType<P> | JSONLikeType<P> | CustomType<P>\n : T extends number\n ? NumberType<P> | JSONLikeType<P> | CustomType<P>\n : PropType<P>;\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\nexport interface GlobalContextMeta<P> {\n /**\n * Any unique string name used to identify that context. Each context\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the context in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the context to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the context properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * The path to be used when importing the context in the generated code.\n * It can be the name of the package that contains the context, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the context is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Whether the global context provides data to its children using DataProvider.\n */\n providesData?: boolean;\n\n unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;\n}\n\nexport interface GlobalContextRegistration {\n component: React.ComponentType<any>;\n meta: GlobalContextMeta<any>;\n}\n\nexport interface GlobalActionRegistration<P> {\n displayName?: string;\n description?: string;\n parameters: FunctionParam<P>[];\n}\n\ndeclare global {\n interface Window {\n __PlasmicContextRegistry: GlobalContextRegistration[];\n }\n}\n\nif (root.__PlasmicContextRegistry == null) {\n root.__PlasmicContextRegistry = [];\n}\n\nexport default function registerGlobalContext<\n T extends React.ComponentType<any>\n>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>) {\n // Check for duplicates\n if (\n root.__PlasmicContextRegistry.some(\n (r: GlobalContextRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicContextRegistry.push({ component, meta });\n}\n","export type TokenType =\n | \"color\"\n | \"spacing\"\n | \"font-family\"\n | \"font-size\"\n | \"line-height\"\n | \"opacity\";\n\nexport interface TokenRegistration {\n /**\n * Name for this token; should be stable across updates\n */\n name: string;\n /**\n * Value for the token, which can either be a valid css value or a css reference\n * to a css variable provided by your host app, like `var(--my-token)`\n */\n value: string;\n /**\n * Type of token\n */\n type: TokenType;\n /**\n * Optional display name to use for this token, if you'd like to use a friendlier\n * name to display to Studio users\n */\n displayName?: string;\n /**\n * By default, if this token is a css variable reference like `var(--my-token)`,\n * then it is assumed that `--my-token` is defined on `:root`. If it is defined\n * in another element, then you can pass in a selector for that element,\n * like `.themeRoot`.\n */\n selector?: string;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTokenRegistry: TokenRegistration[];\n }\n}\n\nconst root = globalThis as any;\n\nif (root.__PlasmicTokenRegistry == null) {\n root.__PlasmicTokenRegistry = [];\n}\n\nexport default function registerToken(token: TokenRegistration) {\n root.__PlasmicTokenRegistry.push(token);\n}\n","const root = globalThis as any;\n\nexport interface BasicTrait {\n label?: string;\n type: \"text\" | \"number\" | \"boolean\";\n}\n\nexport interface ChoiceTrait {\n label?: string;\n type: \"choice\";\n options: string[];\n}\n\nexport type TraitMeta = BasicTrait | ChoiceTrait;\n\nexport interface TraitRegistration {\n trait: string;\n meta: TraitMeta;\n}\n\ndeclare global {\n interface Window {\n __PlasmicTraitRegistry: TraitRegistration[];\n }\n}\n\nif (root.__PlasmicTraitRegistry == null) {\n root.__PlasmicTraitRegistry = [];\n}\n\nexport default function registerTrait(trait: string, meta: TraitMeta) {\n root.__PlasmicTraitRegistry.push({\n trait,\n meta,\n });\n}\n","import { cloneElement, isValidElement } from \"react\";\n\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param index The index of the copy (starting at 0).\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(index: number, elt: T): T;\n/**\n * Allows elements to be repeated in Plasmic Studio.\n * @param isPrimary should be true for at most one instance of the element, and\n * indicates which copy of the element will be highlighted when the element is\n * selected in Studio.\n * @param elt the React element to be repeated (or an array of such).\n */\nexport default function repeatedElement<T>(isPrimary: boolean, elt: T): T;\nexport default function repeatedElement<T>(index: boolean | number, elt: T): T {\n return repeatedElementFn(index as any, elt);\n}\n\nlet repeatedElementFn: typeof repeatedElement = (\n index: boolean | number,\n elt: any\n) => {\n if (Array.isArray(elt)) {\n return elt.map((v) => repeatedElementFn(index as any, v)) as any;\n }\n if (elt && isValidElement(elt) && typeof elt !== \"string\") {\n return cloneElement(elt) as any;\n }\n return elt;\n};\n\nconst root = globalThis as any;\nexport const setRepeatedElementFn: (fn: typeof repeatedElement) => void =\n root?.__Sub?.setRepeatedElementFn ??\n function (fn: typeof repeatedElement) {\n repeatedElementFn = fn;\n };\n","import React from \"react\";\n\nconst PlasmicLinkContext = React.createContext<\n React.ComponentType<any> | undefined\n>(undefined);\n\nexport function usePlasmicLinkMaybe():\n | React.ComponentType<React.ComponentProps<\"a\">>\n | undefined {\n return React.useContext(PlasmicLinkContext);\n}\n\nconst AnchorLink = React.forwardRef(function AnchorLink(\n props: React.ComponentProps<\"a\">,\n ref: React.Ref<HTMLAnchorElement>\n) {\n return <a {...props} ref={ref} />;\n});\n\nexport function usePlasmicLink(): React.ComponentType<\n React.ComponentProps<\"a\">\n> {\n const Link = React.useContext(PlasmicLinkContext);\n if (Link) {\n return Link;\n } else {\n return AnchorLink as React.ComponentType<React.ComponentProps<\"a\">>;\n }\n}\n\nexport function PlasmicLinkProvider(props: {\n Link: React.ComponentType<any> | undefined;\n children?: React.ReactNode;\n}) {\n const { Link, children } = props;\n return (\n <PlasmicLinkContext.Provider value={Link}>\n {children}\n </PlasmicLinkContext.Provider>\n );\n}\n","export const hostVersion = \"1.0.165\";\n","import * as PlasmicQuery from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { registerRenderErrorListener, setPlasmicRootNode } from \"./canvas-host\";\nimport * as hostModule from \"./exports\";\nimport { setRepeatedElementFn } from \"./repeatedElement\";\n// version.ts is automatically generated by `yarn build` and not committed.\nimport { hostVersion } from \"./version\";\n\n// All exports must come from \"./exports\"\nexport * from \"./exports\";\n\nconst root = globalThis as any;\n\nif (root.__Sub == null) {\n // Creating a side effect here by logging, so that vite won't\n // ignore this block for whatever reason. Hiding this for now\n // as users are complaining; will have to check if this has\n // been fixed with vite.\n // console.log(\"Plasmic: Setting up app host dependencies\");\n root.__Sub = {\n React,\n ReactDOM,\n PlasmicQuery,\n hostModule,\n hostVersion,\n hostUtils: {\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n },\n\n // For backwards compatibility:\n setPlasmicRootNode,\n registerRenderErrorListener,\n setRepeatedElementFn,\n ...hostModule,\n };\n} else {\n console.warn(\n `Encountered likely duplicate host version: ${root.__Sub.hostVersion} vs ${hostVersion}`\n );\n root.__Sub.duplicateHostVersions = root.__Sub.duplicateHostVersions ?? [];\n root.__Sub.duplicateHostVersions.push(hostVersion);\n}\n"],"names":["useState","useCallback","React","ReactDOM","createContext","useContext","root","isValidElement","cloneElement","PlasmicQuery"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,CAAC,CAAM,EAAA;AACtB,IAAA,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAIe,SAAA,MAAM,CAAI,CAAuB,EAAE,GAAmB,EAAA;AAAnB,IAAA,IAAA,GAAA,KAAA,KAAA,CAAA,EAAA,EAAA,GAAm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;;;;;;;"}
@@ -357,6 +357,20 @@ interface RichSlotType<P> {
357
357
  */
358
358
  unstable__isMainContentSlot?: boolean;
359
359
  defaultValue?: PlasmicElement | PlasmicElement[];
360
+ /**
361
+ * When true, when you click for the first time in this slot and the component was not selected, the component itself
362
+ * is selected, making it easier to select the component instead of slot contents. So for
363
+ * instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
364
+ * the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
365
+ *
366
+ * Furthermore, the component further shows the props of whatever is in the slot on
367
+ * the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
368
+ */
369
+ mergeWithParent?: ContextDependentConfig<P, boolean>;
370
+ /**
371
+ * A function that returns true to hide the merged props conditionally.
372
+ */
373
+ hiddenMergedProps?: ContextDependentConfig<P, boolean>;
360
374
  }
361
375
  type SlotType<P> = "slot" | RichSlotType<P>;
362
376
  interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
@@ -237,6 +237,13 @@ export interface CodeComponentMeta<P> {
237
237
  * Defaults to "flex".
238
238
  */
239
239
  defaultDisplay?: string;
240
+ /**
241
+ * When true, when you click for the first time anywhere in the component including its slots, the component itself is
242
+ * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a
243
+ * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its
244
+ * slot. Clicking again will deep-select the slot content.
245
+ */
246
+ trapsFocus?: boolean;
240
247
  }
241
248
  export type CodeComponentMode = "advanced" | "simplified" | "database-schema-driven";
242
249
  /**
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.164";
1
+ export declare const hostVersion = "1.0.165";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/host",
3
- "version": "1.0.164",
3
+ "version": "1.0.165",
4
4
  "description": "plasmic library for app hosting",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -80,5 +80,5 @@
80
80
  "react": ">=16.8.0",
81
81
  "react-dom": ">=16.8.0"
82
82
  },
83
- "gitHead": "83b92a98990acc021cc904ef919c6176e88a3238"
83
+ "gitHead": "7fcbeeb029e7a41aaa58fa554034e21886517bbe"
84
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/registerComponent.ts"],"sourcesContent":["import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n"],"names":[],"mappings":";;;;;AAeA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0G/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AA+MF,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,iBAAiB,CACvC,SAAY,EACZ,IAAgD,EAAA;;AAGhD,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAAwB,EAAA;AACvB,QAAA,OAAA,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAA;AAAtD,KAAsD,CACzD,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,SAAS,EAAA,SAAA,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC5D;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/registerComponent.ts"],"sourcesContent":["import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n\n /**\n * When true, when you click for the first time anywhere in the component including its slots, the component itself is\n * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a\n * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its\n * slot. Clicking again will deep-select the slot content.\n */\n trapsFocus?: boolean;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n"],"names":[],"mappings":";;;;;AAeA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0G/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAuNF,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,iBAAiB,CACvC,SAAY,EACZ,IAAgD,EAAA;;AAGhD,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAAwB,EAAA;AACvB,QAAA,OAAA,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAA;AAAtD,KAAsD,CACzD,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,SAAS,EAAA,SAAA,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC5D;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/registerComponent.ts"],"sourcesContent":["import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n"],"names":[],"mappings":";AAeA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0G/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AA+MF,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,iBAAiB,CACvC,SAAY,EACZ,IAAgD,EAAA;;AAGhD,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAAwB,EAAA;AACvB,QAAA,OAAA,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAA;AAAtD,KAAsD,CACzD,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,SAAS,EAAA,SAAA,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC5D;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/registerComponent.ts"],"sourcesContent":["import {\n CodeComponentElement,\n CSSProperties,\n PlasmicElement,\n} from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ModalProps,\n PropType,\n RestrictPropType,\n} from \"./prop-types\";\nimport { TupleUnion } from \"./type-utils\";\nexport type * from \"./prop-types\";\n\nconst root = globalThis as any;\n\nexport interface ActionProps<P> {\n componentProps: P;\n /**\n * `contextData` can be `null` if the prop controls are rendering before\n * the component instance itself (it will re-render once the component\n * calls `setControlContextData`)\n */\n contextData: InferDataType<P> | null;\n studioOps: {\n showModal: (\n modalProps: Omit<ModalProps, \"onClose\"> & { onClose?: () => void }\n ) => void;\n refreshQueryData: () => void;\n appendToSlot: (element: PlasmicElement, slotName: string) => void;\n removeFromSlotAt: (pos: number, slotName: string) => void;\n updateProps: (newValues: any) => void;\n };\n /**\n * The document that the component will be rendered into; instead of using\n * `document` directly (for, say, `document.querySelector()` etc.), you\n * should use this instead.\n */\n studioDocument: typeof document;\n}\n\nexport type Action<P> =\n | {\n type: \"button-action\";\n label: string;\n onClick: (props: ActionProps<P>) => void;\n hidden?: ContextDependentConfig<P, boolean>;\n }\n | {\n type: \"custom-action\";\n control: React.ComponentType<ActionProps<P>>;\n hidden?: ContextDependentConfig<P, boolean>;\n };\n\ntype DistributedKeyOf<T> = T extends any ? keyof T : never;\n\ninterface ComponentTemplate<P>\n extends Omit<CodeComponentElement<P>, \"type\" | \"name\"> {\n /**\n * A preview picture for the template.\n */\n previewImg?: string;\n}\n\nexport interface ComponentTemplates<P> {\n [name: string]: ComponentTemplate<P>;\n}\n\nexport type StateSpec<P> = {\n onChangeProp: string;\n\n /**\n * If true, will hide the state on studio.\n */\n hidden?: ContextDependentConfig<P, boolean>;\n\n /**\n * If true, will hide the state in a collapsed section; good for states that\n * should not usually be used.\n */\n advanced?: ContextDependentConfig<P, boolean>;\n} & (\n | {\n type: \"readonly\";\n variableType: \"text\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"number\";\n initVal?: number;\n }\n | {\n type: \"readonly\";\n variableType: \"boolean\";\n initVal?: boolean;\n }\n | {\n type: \"readonly\";\n variableType: \"array\";\n initVal?: any[];\n }\n | {\n type: \"readonly\";\n variableType: \"object\";\n initVal?: object;\n }\n | {\n type: \"writable\";\n variableType: \"text\" | \"number\" | \"boolean\" | \"array\" | \"object\";\n valueProp: string;\n }\n);\n\nexport interface StateHelpers<P, T> {\n initFunc?: ($props: P) => T;\n onChangeArgsToValue?: (...args: any) => T;\n onMutate?: (stateValue: T, $ref: any) => void;\n}\n\n// A compile-time error will occur if a new field is added to the StateHelper\n// interface but not included in the keys array of state helper.\nexport const stateHelpersKeys: TupleUnion<keyof StateHelpers<any, any>> = [\n \"initFunc\",\n \"onChangeArgsToValue\",\n \"onMutate\",\n];\n\nexport type ComponentHelpers<P> = {\n states: Record<string, StateHelpers<P, any>>;\n};\n\nexport type ExternalComponentHelpers<P> = {\n helpers: ComponentHelpers<P>;\n importPath: string;\n} & (\n | {\n importName: string;\n }\n | {\n isDefaultExport: true;\n }\n);\n\nexport type StyleSection =\n | \"visibility\"\n | \"typography\"\n | \"sizing\"\n | \"spacing\"\n | \"background\"\n | \"transform\"\n | \"transitions\"\n | \"layout\"\n | \"overflow\"\n | \"border\"\n | \"shadows\"\n | \"effects\";\n\nexport interface CodeComponentMeta<P> {\n /**\n * Any unique string name used to identify that component. Each component\n * should be registered with a different `meta.name`, even if they have the\n * same name in the code.\n */\n name: string;\n /**\n * The name to be displayed for the component in Studio. Optional: if not\n * specified, `meta.name` is used.\n */\n displayName?: string;\n /**\n * The description of the component to be shown in Studio.\n */\n description?: string;\n /**\n * The javascript name to be used when generating code. Optional: if not\n * provided, `meta.name` is used.\n */\n importName?: string;\n /**\n * An object describing the component properties to be used in Studio.\n * For each `prop`, there should be an entry `meta.props[prop]` describing\n * its type.\n */\n props: { [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P> } & {\n [prop: string]: PropType<P>;\n };\n /**\n * An object describing the component states to be used in Studio.\n */\n states?: Record<string, StateSpec<P>>;\n /**\n * An object describing the components helpers to be used in Studio.\n * 1. states helpers: Each state can receive an \"initFunc\" prop to initialize\n * the implicit state in Studio, and an \"onChangeArgsToValue\" prop to\n * transform the event handler arguments into a value\n */\n componentHelpers?: ExternalComponentHelpers<P>;\n /**\n * An array describing the component actions to be used in Studio.\n */\n actions?: Action<P>[];\n /**\n * Whether style sections should be shown in Studio. For styles to work, the\n * component must accept a `className` prop. If unset, defaults to all styles.\n * Set to `false` if this component cannot be styled (for example, if it doesn't\n * render any DOM elements).\n */\n styleSections?: StyleSection[] | boolean;\n /**\n * Whether the element can be repeated in Studio. If unset, defaults to true.\n */\n isRepeatable?: boolean;\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the component is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n /**\n * The prop that expects the CSS classes with styles to be applied to the\n * component. Optional: if not specified, Plasmic will expect it to be\n * `className`. Notice that if the component does not accept CSS classes, the\n * component will not be able to receive styles from the Studio.\n */\n classNameProp?: string;\n /**\n * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`\n * to interact with components, so it's not used in the generated code.\n * Optional: If not provided, the usual `ref` is used.\n */\n refProp?: string;\n /**\n * Default styles to start with when instantiating the component in Plasmic.\n */\n defaultStyles?: CSSProperties;\n /**\n * Component templates to start with on Plasmic.\n */\n templates?: ComponentTemplates<P>;\n /**\n * Registered name of parent component, used for grouping related components.\n */\n parentComponentName?: string;\n /**\n * Whether the component can be used as an attachment to an element.\n */\n isAttachment?: boolean;\n /**\n * Whether the component provides data to its slots using DataProvider.\n */\n providesData?: boolean;\n\n /**\n * If specified, then Figma components with the specified names will be mapped\n * to this component when you paste Figma content into Plasmic\n */\n figmaMappings?: {\n figmaComponentName: string;\n }[];\n\n /**\n * If true, when an instance of this component is added, the element\n * will always be named by the name of this component.\n */\n alwaysAutoName?: boolean;\n\n /**\n * If true, then won't be listed in the insert menu for content creators.\n */\n hideFromContentCreators?: boolean;\n\n refActions?: Record<string, RefActionRegistration<P>>;\n\n /**\n * Optional function that takes in component props and context, and returns\n * a string that will be used for labeling this element in the Outline panel\n * on the left of the Studio. This makes it easy to identify an element when\n * looking at the tree.\n */\n treeLabel?: ContextDependentConfig<P, string>;\n\n /**\n * The value of the CSS display property used by this component.\n * Plasmic passes in a class name prop to components to let users style them,\n * but normally this does not include layout properties like display.\n * However, if the user has set the components visibility to be visible\n * (for instance, in the base variant it was set to not visible ie display none,\n * but in a variant it's overridden to be visible), then Plasmic needs to know\n * what display property to set.\n * Defaults to \"flex\".\n */\n defaultDisplay?: string;\n\n /**\n * When true, when you click for the first time anywhere in the component including its slots, the component itself is\n * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a\n * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its\n * slot. Clicking again will deep-select the slot content.\n */\n trapsFocus?: boolean;\n}\n\nexport type CodeComponentMode =\n | \"advanced\"\n | \"simplified\"\n | \"database-schema-driven\";\n\n/**\n * @deprecated use CodeComponentMeta instead\n */\nexport type ComponentMeta<P> = CodeComponentMeta<P>;\n\nexport interface FunctionParam<P> {\n name: string;\n displayName?: string;\n type: PropType<P>;\n}\n\nexport interface RefActionRegistration<P> {\n displayName?: string;\n description?: string;\n argTypes: FunctionParam<P>[];\n}\n\nexport interface ComponentRegistration {\n component: React.ComponentType<any>;\n meta: CodeComponentMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicComponentRegistry: ComponentRegistration[];\n }\n}\n\nif (root.__PlasmicComponentRegistry == null) {\n root.__PlasmicComponentRegistry = [];\n}\n\nexport default function registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n) {\n // Check for duplicates\n if (\n root.__PlasmicComponentRegistry.some(\n (r: ComponentRegistration) =>\n r.component === component && r.meta.name === meta.name\n )\n ) {\n return;\n }\n root.__PlasmicComponentRegistry.push({ component, meta });\n}\n"],"names":[],"mappings":";AAeA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0G/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAuNF,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,iBAAiB,CACvC,SAAY,EACZ,IAAgD,EAAA;;AAGhD,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAAwB,EAAA;AACvB,QAAA,OAAA,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAA;AAAtD,KAAsD,CACzD,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,SAAS,EAAA,SAAA,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC5D;;;;"}
@@ -357,6 +357,20 @@ interface RichSlotType<P> {
357
357
  */
358
358
  unstable__isMainContentSlot?: boolean;
359
359
  defaultValue?: PlasmicElement | PlasmicElement[];
360
+ /**
361
+ * When true, when you click for the first time in this slot and the component was not selected, the component itself
362
+ * is selected, making it easier to select the component instead of slot contents. So for
363
+ * instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
364
+ * the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
365
+ *
366
+ * Furthermore, the component further shows the props of whatever is in the slot on
367
+ * the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
368
+ */
369
+ mergeWithParent?: ContextDependentConfig<P, boolean>;
370
+ /**
371
+ * A function that returns true to hide the merged props conditionally.
372
+ */
373
+ hiddenMergedProps?: ContextDependentConfig<P, boolean>;
360
374
  }
361
375
  type SlotType<P> = "slot" | RichSlotType<P>;
362
376
  interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
@@ -237,6 +237,13 @@ export interface CodeComponentMeta<P> {
237
237
  * Defaults to "flex".
238
238
  */
239
239
  defaultDisplay?: string;
240
+ /**
241
+ * When true, when you click for the first time anywhere in the component including its slots, the component itself is
242
+ * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a
243
+ * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its
244
+ * slot. Clicking again will deep-select the slot content.
245
+ */
246
+ trapsFocus?: boolean;
240
247
  }
241
248
  export type CodeComponentMode = "advanced" | "simplified" | "database-schema-driven";
242
249
  /**
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.164";
1
+ export declare const hostVersion = "1.0.165";
@@ -357,6 +357,20 @@ interface RichSlotType<P> {
357
357
  */
358
358
  unstable__isMainContentSlot?: boolean;
359
359
  defaultValue?: PlasmicElement | PlasmicElement[];
360
+ /**
361
+ * When true, when you click for the first time in this slot and the component was not selected, the component itself
362
+ * is selected, making it easier to select the component instead of slot contents. So for
363
+ * instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
364
+ * the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
365
+ *
366
+ * Furthermore, the component further shows the props of whatever is in the slot on
367
+ * the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
368
+ */
369
+ mergeWithParent?: ContextDependentConfig<P, boolean>;
370
+ /**
371
+ * A function that returns true to hide the merged props conditionally.
372
+ */
373
+ hiddenMergedProps?: ContextDependentConfig<P, boolean>;
360
374
  }
361
375
  type SlotType<P> = "slot" | RichSlotType<P>;
362
376
  interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
@@ -237,6 +237,13 @@ export interface CodeComponentMeta<P> {
237
237
  * Defaults to "flex".
238
238
  */
239
239
  defaultDisplay?: string;
240
+ /**
241
+ * When true, when you click for the first time anywhere in the component including its slots, the component itself is
242
+ * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a
243
+ * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its
244
+ * slot. Clicking again will deep-select the slot content.
245
+ */
246
+ trapsFocus?: boolean;
240
247
  }
241
248
  export type CodeComponentMode = "advanced" | "simplified" | "database-schema-driven";
242
249
  /**
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.164";
1
+ export declare const hostVersion = "1.0.165";
@@ -357,6 +357,20 @@ interface RichSlotType<P> {
357
357
  */
358
358
  unstable__isMainContentSlot?: boolean;
359
359
  defaultValue?: PlasmicElement | PlasmicElement[];
360
+ /**
361
+ * When true, when you click for the first time in this slot and the component was not selected, the component itself
362
+ * is selected, making it easier to select the component instead of slot contents. So for
363
+ * instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
364
+ * the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
365
+ *
366
+ * Furthermore, the component further shows the props of whatever is in the slot on
367
+ * the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
368
+ */
369
+ mergeWithParent?: ContextDependentConfig<P, boolean>;
370
+ /**
371
+ * A function that returns true to hide the merged props conditionally.
372
+ */
373
+ hiddenMergedProps?: ContextDependentConfig<P, boolean>;
360
374
  }
361
375
  type SlotType<P> = "slot" | RichSlotType<P>;
362
376
  interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
@@ -237,6 +237,13 @@ export interface CodeComponentMeta<P> {
237
237
  * Defaults to "flex".
238
238
  */
239
239
  defaultDisplay?: string;
240
+ /**
241
+ * When true, when you click for the first time anywhere in the component including its slots, the component itself is
242
+ * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a
243
+ * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its
244
+ * slot. Clicking again will deep-select the slot content.
245
+ */
246
+ trapsFocus?: boolean;
240
247
  }
241
248
  export type CodeComponentMode = "advanced" | "simplified" | "database-schema-driven";
242
249
  /**
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.164";
1
+ export declare const hostVersion = "1.0.165";
@@ -357,6 +357,20 @@ interface RichSlotType<P> {
357
357
  */
358
358
  unstable__isMainContentSlot?: boolean;
359
359
  defaultValue?: PlasmicElement | PlasmicElement[];
360
+ /**
361
+ * When true, when you click for the first time in this slot and the component was not selected, the component itself
362
+ * is selected, making it easier to select the component instead of slot contents. So for
363
+ * instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
364
+ * the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
365
+ *
366
+ * Furthermore, the component further shows the props of whatever is in the slot on
367
+ * the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
368
+ */
369
+ mergeWithParent?: ContextDependentConfig<P, boolean>;
370
+ /**
371
+ * A function that returns true to hide the merged props conditionally.
372
+ */
373
+ hiddenMergedProps?: ContextDependentConfig<P, boolean>;
360
374
  }
361
375
  type SlotType<P> = "slot" | RichSlotType<P>;
362
376
  interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
@@ -237,6 +237,13 @@ export interface CodeComponentMeta<P> {
237
237
  * Defaults to "flex".
238
238
  */
239
239
  defaultDisplay?: string;
240
+ /**
241
+ * When true, when you click for the first time anywhere in the component including its slots, the component itself is
242
+ * selected, making it easier to select the component instead of slot contents. So for instance, setting this on a
243
+ * Button ensures that clicking on the Button’s text will still select the Button and not the text element in its
244
+ * slot. Clicking again will deep-select the slot content.
245
+ */
246
+ trapsFocus?: boolean;
240
247
  }
241
248
  export type CodeComponentMode = "advanced" | "simplified" | "database-schema-driven";
242
249
  /**
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.164";
1
+ export declare const hostVersion = "1.0.165";