@plasmicapp/host 1.0.206 → 1.0.208

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/exports.d.ts CHANGED
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
package/dist/host.esm.js CHANGED
@@ -552,6 +552,17 @@ var setRepeatedElementFn = (_b = (_a$1 = root$1 === null || root$1 === void 0 ?
552
552
  repeatedElementFn = fn;
553
553
  };
554
554
 
555
+ var PlasmicTranslatorContext = React__default.createContext(undefined);
556
+ function usePlasmicTranslator() {
557
+ var _t = React__default.useContext(PlasmicTranslatorContext);
558
+ var translator = _t
559
+ ? typeof _t === "function"
560
+ ? _t
561
+ : _t.translator
562
+ : undefined;
563
+ return translator;
564
+ }
565
+
555
566
  var hostModule = /*#__PURE__*/Object.freeze({
556
567
  __proto__: null,
557
568
  DataContext: DataContext,
@@ -563,6 +574,7 @@ var hostModule = /*#__PURE__*/Object.freeze({
563
574
  PlasmicCanvasContext: PlasmicCanvasContext,
564
575
  PlasmicCanvasHost: PlasmicCanvasHost,
565
576
  PlasmicLinkProvider: PlasmicLinkProvider,
577
+ PlasmicTranslatorContext: PlasmicTranslatorContext,
566
578
  applySelector: applySelector,
567
579
  mkMetaName: mkMetaName,
568
580
  mkMetaValue: mkMetaValue,
@@ -580,11 +592,12 @@ var hostModule = /*#__PURE__*/Object.freeze({
580
592
  usePlasmicCanvasContext: usePlasmicCanvasContext,
581
593
  usePlasmicLink: usePlasmicLink,
582
594
  usePlasmicLinkMaybe: usePlasmicLinkMaybe,
595
+ usePlasmicTranslator: usePlasmicTranslator,
583
596
  useSelector: useSelector,
584
597
  useSelectors: useSelectors
585
598
  });
586
599
 
587
- var hostVersion = "1.0.206";
600
+ var hostVersion = "1.0.208";
588
601
 
589
602
  var _a;
590
603
  var root = globalThis;
@@ -608,5 +621,5 @@ else {
608
621
  root.__Sub.duplicateHostVersions.push(hostVersion);
609
622
  }
610
623
 
611
- export { DataContext, DataCtxReader, DataProvider, GlobalActionsContext, GlobalActionsProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, PlasmicLinkProvider, applySelector, mkMetaName, mkMetaValue, registerComponent, registerFunction, registerGlobalContext, registerToken, registerTrait, repeatedElement, stateHelpersKeys, registerFetcher as unstable_registerFetcher, useDataEnv, useGlobalActions, usePlasmicCanvasComponentInfo, usePlasmicCanvasContext, usePlasmicLink, usePlasmicLinkMaybe, useSelector, useSelectors };
624
+ export { DataContext, DataCtxReader, DataProvider, GlobalActionsContext, GlobalActionsProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, PlasmicLinkProvider, PlasmicTranslatorContext, applySelector, mkMetaName, mkMetaValue, registerComponent, registerFunction, registerGlobalContext, registerToken, registerTrait, repeatedElement, stateHelpersKeys, registerFetcher as unstable_registerFetcher, useDataEnv, useGlobalActions, usePlasmicCanvasComponentInfo, usePlasmicCanvasContext, usePlasmicLink, usePlasmicLinkMaybe, usePlasmicTranslator, useSelector, useSelectors };
612
625
  //# sourceMappingURL=host.esm.js.map
@@ -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/link.tsx","../src/registerComponent.ts","../src/registerFunction.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../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.prepend(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\nconst INTERNAL_CC_CANVAS_SELECTION_PROP = \"__plasmic_selection_prop__\";\n\nexport function usePlasmicCanvasComponentInfo(props: any) {\n return React.useMemo(() => {\n // Inside Plasmic Studio, code components will receive an additional prop\n // that contains selection information for that specific code component.\n // This hook will return that selection information which is useful for\n // changing the behavior of the code component when it is selected, making\n // it easier to interact with code components and slots that aren't always\n // visible in the canvas. (e.g. automatically opening a modal when it's selected)\n const selectionInfo = props?.[INTERNAL_CC_CANVAS_SELECTION_PROP];\n if (selectionInfo) {\n return {\n isSelected: selectionInfo.isSelected as boolean,\n selectedSlotName: selectionInfo.selectedSlotName as string | undefined,\n };\n }\n return null;\n }, [props]);\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\n/**\n * This transforms `{ \"...slug\": \"a/b/c\" }` into `{ \"slug\": [\"a\", \"b\", \"c\"] }.\n */\nfunction fixCatchallParams(\n params: Record<string, string | string[] | undefined>\n) {\n const newParams: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(params)) {\n if (!value) {\n continue;\n }\n if (key.startsWith(\"...\")) {\n newParams[key.slice(3)] =\n typeof value === \"string\"\n ? value.replace(/^\\/|\\/$/g, \"\").split(\"/\")\n : value;\n } else {\n newParams[key] = value;\n }\n }\n return newParams;\n}\n\nfunction mkPathFromRouteAndParams(\n route: string,\n params: Record<string, string | string[] | undefined>\n) {\n if (!params) {\n return route;\n }\n let path = route;\n for (const [key, value] of Object.entries(params)) {\n if (typeof value === \"string\") {\n path = path.replace(`[${key}]`, value);\n } else if (Array.isArray(value)) {\n if (path.includes(`[[...${key}]]`)) {\n path = path.replace(`[[...${key}]]`, value.join(\"/\"));\n } else if (path.includes(`[...${key}]`)) {\n path = path.replace(`[...${key}]`, value.join(\"/\"));\n }\n }\n }\n return path;\n}\n\nexport interface PageParamsProviderProps {\n children?: ReactNode;\n\n /**\n * Page route without params substituted (e.g. /products/[slug]).\n */\n route?: string;\n\n /**\n * Page params (e.g. { slug: \"jacket\" })\n */\n params?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query params (e.g. { q: \"search term\" })\n */\n query?: Record<string, string | string[] | undefined>;\n\n /**\n * @deprecated Use `route` instead.\n */\n path?: string;\n}\n\nexport function PageParamsProvider({\n children,\n route,\n path: deprecatedRoute,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n route = route ?? deprecatedRoute;\n params = fixCatchallParams(params);\n const $ctx = useDataEnv() || {};\n const path = route ? mkPathFromRouteAndParams(route, params) : undefined;\n return (\n <DataProvider\n name={\"pageRoute\"}\n data={route}\n label={\"Page route\"}\n advanced={true}\n >\n <DataProvider name={\"pagePath\"} data={path} label={\"Page path\"}>\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 </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 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","import { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object describing the component interaction variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n interactionVariants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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","const root = globalThis as any;\n\nexport type StringType<T extends string = string> = \"string\" | `'${T}'`;\n\nexport type NumberType<T extends number = number> =\n | \"number\"\n | `${number extends T ? number : T}`;\n\nexport type BooleanType<T extends boolean = boolean> =\n | \"boolean\"\n | `${boolean extends T ? boolean : T}`;\n\nexport type NullType = \"null\";\n\nexport type UndefinedType = \"undefined\";\n\nexport type ArrayType = \"array\";\n\nexport type ObjectType = \"object\";\n\nexport type AnyType = \"any\";\n\nexport type VoidType = \"void\";\n\nexport type RestrictedType<T> = T extends string\n ? StringType<T>\n : T extends number\n ? NumberType<T>\n : T extends boolean\n ? BooleanType<T>\n : T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\nexport type OrType<T> = RestrictedType<T>[];\n\nexport type ParamType<T> = AnyType | RestrictedType<T> | OrType<T>;\n\nexport interface BaseParam<T> {\n name: string;\n type?: ParamType<T>;\n description?: string;\n isOptional?: boolean;\n isRestParam?: boolean;\n}\n\n// Param name and optionally param type\nexport interface RequiredParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter?: false;\n}\n\nexport interface OptionalParam<T> extends BaseParam<T | undefined> {\n isRestParameter?: false;\n}\n\nexport interface RestParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter: true;\n}\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [string | RequiredParam<H>, ...HandleRequiredParams<T>]\n : [];\n\ntype HandleOptionalParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [] | [string | OptionalParam<H | undefined>, ...HandleOptionalParams<T>]\n : P extends []\n ? []\n : P extends Array<infer T>\n ? [] | [RestParam<T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<RequiredParams<P>>,\n ...HandleOptionalParams<Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<T> = VoidType | ParamType<T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n DataSourceType,\n JSONLikeType,\n NumberType,\n StringType,\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 | DataSourceType<P>\n | CustomType<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 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","export const hostVersion = \"1.0.206\";\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,MA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I,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/link.tsx","../src/registerComponent.ts","../src/registerFunction.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/translation.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.prepend(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\nconst INTERNAL_CC_CANVAS_SELECTION_PROP = \"__plasmic_selection_prop__\";\n\nexport function usePlasmicCanvasComponentInfo(props: any) {\n return React.useMemo(() => {\n // Inside Plasmic Studio, code components will receive an additional prop\n // that contains selection information for that specific code component.\n // This hook will return that selection information which is useful for\n // changing the behavior of the code component when it is selected, making\n // it easier to interact with code components and slots that aren't always\n // visible in the canvas. (e.g. automatically opening a modal when it's selected)\n const selectionInfo = props?.[INTERNAL_CC_CANVAS_SELECTION_PROP];\n if (selectionInfo) {\n return {\n isSelected: selectionInfo.isSelected as boolean,\n selectedSlotName: selectionInfo.selectedSlotName as string | undefined,\n };\n }\n return null;\n }, [props]);\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\n/**\n * This transforms `{ \"...slug\": \"a/b/c\" }` into `{ \"slug\": [\"a\", \"b\", \"c\"] }.\n */\nfunction fixCatchallParams(\n params: Record<string, string | string[] | undefined>\n) {\n const newParams: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(params)) {\n if (!value) {\n continue;\n }\n if (key.startsWith(\"...\")) {\n newParams[key.slice(3)] =\n typeof value === \"string\"\n ? value.replace(/^\\/|\\/$/g, \"\").split(\"/\")\n : value;\n } else {\n newParams[key] = value;\n }\n }\n return newParams;\n}\n\nfunction mkPathFromRouteAndParams(\n route: string,\n params: Record<string, string | string[] | undefined>\n) {\n if (!params) {\n return route;\n }\n let path = route;\n for (const [key, value] of Object.entries(params)) {\n if (typeof value === \"string\") {\n path = path.replace(`[${key}]`, value);\n } else if (Array.isArray(value)) {\n if (path.includes(`[[...${key}]]`)) {\n path = path.replace(`[[...${key}]]`, value.join(\"/\"));\n } else if (path.includes(`[...${key}]`)) {\n path = path.replace(`[...${key}]`, value.join(\"/\"));\n }\n }\n }\n return path;\n}\n\nexport interface PageParamsProviderProps {\n children?: ReactNode;\n\n /**\n * Page route without params substituted (e.g. /products/[slug]).\n */\n route?: string;\n\n /**\n * Page params (e.g. { slug: \"jacket\" })\n */\n params?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query params (e.g. { q: \"search term\" })\n */\n query?: Record<string, string | string[] | undefined>;\n\n /**\n * @deprecated Use `route` instead.\n */\n path?: string;\n}\n\nexport function PageParamsProvider({\n children,\n route,\n path: deprecatedRoute,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n route = route ?? deprecatedRoute;\n params = fixCatchallParams(params);\n const $ctx = useDataEnv() || {};\n const path = route ? mkPathFromRouteAndParams(route, params) : undefined;\n return (\n <DataProvider\n name={\"pageRoute\"}\n data={route}\n label={\"Page route\"}\n advanced={true}\n >\n <DataProvider name={\"pagePath\"} data={path} label={\"Page path\"}>\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 </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 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","import { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object registering code component's variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n variants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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","const root = globalThis as any;\n\nexport type StringType<T extends string = string> = \"string\" | `'${T}'`;\n\nexport type NumberType<T extends number = number> =\n | \"number\"\n | `${number extends T ? number : T}`;\n\nexport type BooleanType<T extends boolean = boolean> =\n | \"boolean\"\n | `${boolean extends T ? boolean : T}`;\n\nexport type NullType = \"null\";\n\nexport type UndefinedType = \"undefined\";\n\nexport type ArrayType = \"array\";\n\nexport type ObjectType = \"object\";\n\nexport type AnyType = \"any\";\n\nexport type VoidType = \"void\";\n\nexport type RestrictedType<T> = T extends string\n ? StringType<T>\n : T extends number\n ? NumberType<T>\n : T extends boolean\n ? BooleanType<T>\n : T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\nexport type OrType<T> = RestrictedType<T>[];\n\nexport type ParamType<T> = AnyType | RestrictedType<T> | OrType<T>;\n\nexport interface BaseParam<T> {\n name: string;\n type?: ParamType<T>;\n description?: string;\n isOptional?: boolean;\n isRestParam?: boolean;\n}\n\n// Param name and optionally param type\nexport interface RequiredParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter?: false;\n}\n\nexport interface OptionalParam<T> extends BaseParam<T | undefined> {\n isRestParameter?: false;\n}\n\nexport interface RestParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter: true;\n}\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [string | RequiredParam<H>, ...HandleRequiredParams<T>]\n : [];\n\ntype HandleOptionalParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [] | [string | OptionalParam<H | undefined>, ...HandleOptionalParams<T>]\n : P extends []\n ? []\n : P extends Array<infer T>\n ? [] | [RestParam<T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<RequiredParams<P>>,\n ...HandleOptionalParams<Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<T> = VoidType | ParamType<T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n DataSourceType,\n JSONLikeType,\n NumberType,\n StringType,\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 | DataSourceType<P>\n | CustomType<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 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\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement;\n };\n }\n) => React.ReactNode;\n\nexport interface PlasmicI18NContextValue {\n translator?: PlasmicTranslator;\n tagPrefix?: string;\n}\n\nexport const PlasmicTranslatorContext = React.createContext<\n PlasmicI18NContextValue | PlasmicTranslator | undefined\n>(undefined);\n\nexport function usePlasmicTranslator() {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n return translator;\n}\n","export const hostVersion = \"1.0.208\";\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,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n;
575
575
  };
576
576
 
577
+ var PlasmicTranslatorContext = React.createContext(undefined);
578
+ function usePlasmicTranslator() {
579
+ var _t = React.useContext(PlasmicTranslatorContext);
580
+ var translator = _t
581
+ ? typeof _t === "function"
582
+ ? _t
583
+ : _t.translator
584
+ : undefined;
585
+ return translator;
586
+ }
587
+
577
588
  var hostModule = /*#__PURE__*/Object.freeze({
578
589
  __proto__: null,
579
590
  DataContext: DataContext,
@@ -585,6 +596,7 @@ var hostModule = /*#__PURE__*/Object.freeze({
585
596
  PlasmicCanvasContext: PlasmicCanvasContext,
586
597
  PlasmicCanvasHost: PlasmicCanvasHost,
587
598
  PlasmicLinkProvider: PlasmicLinkProvider,
599
+ PlasmicTranslatorContext: PlasmicTranslatorContext,
588
600
  applySelector: applySelector,
589
601
  mkMetaName: mkMetaName,
590
602
  mkMetaValue: mkMetaValue,
@@ -602,11 +614,12 @@ var hostModule = /*#__PURE__*/Object.freeze({
602
614
  usePlasmicCanvasContext: usePlasmicCanvasContext,
603
615
  usePlasmicLink: usePlasmicLink,
604
616
  usePlasmicLinkMaybe: usePlasmicLinkMaybe,
617
+ usePlasmicTranslator: usePlasmicTranslator,
605
618
  useSelector: useSelector,
606
619
  useSelectors: useSelectors
607
620
  });
608
621
 
609
- var hostVersion = "1.0.206";
622
+ var hostVersion = "1.0.208";
610
623
 
611
624
  var _a;
612
625
  var root = globalThis;
@@ -639,6 +652,7 @@ exports.PageParamsProvider = PageParamsProvider;
639
652
  exports.PlasmicCanvasContext = PlasmicCanvasContext;
640
653
  exports.PlasmicCanvasHost = PlasmicCanvasHost;
641
654
  exports.PlasmicLinkProvider = PlasmicLinkProvider;
655
+ exports.PlasmicTranslatorContext = PlasmicTranslatorContext;
642
656
  exports.applySelector = applySelector;
643
657
  exports.mkMetaName = mkMetaName;
644
658
  exports.mkMetaValue = mkMetaValue;
@@ -656,6 +670,7 @@ exports.usePlasmicCanvasComponentInfo = usePlasmicCanvasComponentInfo;
656
670
  exports.usePlasmicCanvasContext = usePlasmicCanvasContext;
657
671
  exports.usePlasmicLink = usePlasmicLink;
658
672
  exports.usePlasmicLinkMaybe = usePlasmicLinkMaybe;
673
+ exports.usePlasmicTranslator = usePlasmicTranslator;
659
674
  exports.useSelector = useSelector;
660
675
  exports.useSelectors = useSelectors;
661
676
  //# sourceMappingURL=index.cjs.js.map
@@ -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/link.tsx","../src/registerComponent.ts","../src/registerFunction.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../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.prepend(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\nconst INTERNAL_CC_CANVAS_SELECTION_PROP = \"__plasmic_selection_prop__\";\n\nexport function usePlasmicCanvasComponentInfo(props: any) {\n return React.useMemo(() => {\n // Inside Plasmic Studio, code components will receive an additional prop\n // that contains selection information for that specific code component.\n // This hook will return that selection information which is useful for\n // changing the behavior of the code component when it is selected, making\n // it easier to interact with code components and slots that aren't always\n // visible in the canvas. (e.g. automatically opening a modal when it's selected)\n const selectionInfo = props?.[INTERNAL_CC_CANVAS_SELECTION_PROP];\n if (selectionInfo) {\n return {\n isSelected: selectionInfo.isSelected as boolean,\n selectedSlotName: selectionInfo.selectedSlotName as string | undefined,\n };\n }\n return null;\n }, [props]);\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\n/**\n * This transforms `{ \"...slug\": \"a/b/c\" }` into `{ \"slug\": [\"a\", \"b\", \"c\"] }.\n */\nfunction fixCatchallParams(\n params: Record<string, string | string[] | undefined>\n) {\n const newParams: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(params)) {\n if (!value) {\n continue;\n }\n if (key.startsWith(\"...\")) {\n newParams[key.slice(3)] =\n typeof value === \"string\"\n ? value.replace(/^\\/|\\/$/g, \"\").split(\"/\")\n : value;\n } else {\n newParams[key] = value;\n }\n }\n return newParams;\n}\n\nfunction mkPathFromRouteAndParams(\n route: string,\n params: Record<string, string | string[] | undefined>\n) {\n if (!params) {\n return route;\n }\n let path = route;\n for (const [key, value] of Object.entries(params)) {\n if (typeof value === \"string\") {\n path = path.replace(`[${key}]`, value);\n } else if (Array.isArray(value)) {\n if (path.includes(`[[...${key}]]`)) {\n path = path.replace(`[[...${key}]]`, value.join(\"/\"));\n } else if (path.includes(`[...${key}]`)) {\n path = path.replace(`[...${key}]`, value.join(\"/\"));\n }\n }\n }\n return path;\n}\n\nexport interface PageParamsProviderProps {\n children?: ReactNode;\n\n /**\n * Page route without params substituted (e.g. /products/[slug]).\n */\n route?: string;\n\n /**\n * Page params (e.g. { slug: \"jacket\" })\n */\n params?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query params (e.g. { q: \"search term\" })\n */\n query?: Record<string, string | string[] | undefined>;\n\n /**\n * @deprecated Use `route` instead.\n */\n path?: string;\n}\n\nexport function PageParamsProvider({\n children,\n route,\n path: deprecatedRoute,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n route = route ?? deprecatedRoute;\n params = fixCatchallParams(params);\n const $ctx = useDataEnv() || {};\n const path = route ? mkPathFromRouteAndParams(route, params) : undefined;\n return (\n <DataProvider\n name={\"pageRoute\"}\n data={route}\n label={\"Page route\"}\n advanced={true}\n >\n <DataProvider name={\"pagePath\"} data={path} label={\"Page path\"}>\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 </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 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","import { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object describing the component interaction variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n interactionVariants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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","const root = globalThis as any;\n\nexport type StringType<T extends string = string> = \"string\" | `'${T}'`;\n\nexport type NumberType<T extends number = number> =\n | \"number\"\n | `${number extends T ? number : T}`;\n\nexport type BooleanType<T extends boolean = boolean> =\n | \"boolean\"\n | `${boolean extends T ? boolean : T}`;\n\nexport type NullType = \"null\";\n\nexport type UndefinedType = \"undefined\";\n\nexport type ArrayType = \"array\";\n\nexport type ObjectType = \"object\";\n\nexport type AnyType = \"any\";\n\nexport type VoidType = \"void\";\n\nexport type RestrictedType<T> = T extends string\n ? StringType<T>\n : T extends number\n ? NumberType<T>\n : T extends boolean\n ? BooleanType<T>\n : T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\nexport type OrType<T> = RestrictedType<T>[];\n\nexport type ParamType<T> = AnyType | RestrictedType<T> | OrType<T>;\n\nexport interface BaseParam<T> {\n name: string;\n type?: ParamType<T>;\n description?: string;\n isOptional?: boolean;\n isRestParam?: boolean;\n}\n\n// Param name and optionally param type\nexport interface RequiredParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter?: false;\n}\n\nexport interface OptionalParam<T> extends BaseParam<T | undefined> {\n isRestParameter?: false;\n}\n\nexport interface RestParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter: true;\n}\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [string | RequiredParam<H>, ...HandleRequiredParams<T>]\n : [];\n\ntype HandleOptionalParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [] | [string | OptionalParam<H | undefined>, ...HandleOptionalParams<T>]\n : P extends []\n ? []\n : P extends Array<infer T>\n ? [] | [RestParam<T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<RequiredParams<P>>,\n ...HandleOptionalParams<Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<T> = VoidType | ParamType<T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n DataSourceType,\n JSONLikeType,\n NumberType,\n StringType,\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 | DataSourceType<P>\n | CustomType<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 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","export const hostVersion = \"1.0.206\";\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,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,E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EAAAC,mBAAA,EACR,YAAY,EAAAM,uBAAA,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":"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/link.tsx","../src/registerComponent.ts","../src/registerFunction.ts","../src/registerGlobalContext.ts","../src/registerToken.ts","../src/registerTrait.ts","../src/repeatedElement.ts","../src/translation.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.prepend(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\nconst INTERNAL_CC_CANVAS_SELECTION_PROP = \"__plasmic_selection_prop__\";\n\nexport function usePlasmicCanvasComponentInfo(props: any) {\n return React.useMemo(() => {\n // Inside Plasmic Studio, code components will receive an additional prop\n // that contains selection information for that specific code component.\n // This hook will return that selection information which is useful for\n // changing the behavior of the code component when it is selected, making\n // it easier to interact with code components and slots that aren't always\n // visible in the canvas. (e.g. automatically opening a modal when it's selected)\n const selectionInfo = props?.[INTERNAL_CC_CANVAS_SELECTION_PROP];\n if (selectionInfo) {\n return {\n isSelected: selectionInfo.isSelected as boolean,\n selectedSlotName: selectionInfo.selectedSlotName as string | undefined,\n };\n }\n return null;\n }, [props]);\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\n/**\n * This transforms `{ \"...slug\": \"a/b/c\" }` into `{ \"slug\": [\"a\", \"b\", \"c\"] }.\n */\nfunction fixCatchallParams(\n params: Record<string, string | string[] | undefined>\n) {\n const newParams: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(params)) {\n if (!value) {\n continue;\n }\n if (key.startsWith(\"...\")) {\n newParams[key.slice(3)] =\n typeof value === \"string\"\n ? value.replace(/^\\/|\\/$/g, \"\").split(\"/\")\n : value;\n } else {\n newParams[key] = value;\n }\n }\n return newParams;\n}\n\nfunction mkPathFromRouteAndParams(\n route: string,\n params: Record<string, string | string[] | undefined>\n) {\n if (!params) {\n return route;\n }\n let path = route;\n for (const [key, value] of Object.entries(params)) {\n if (typeof value === \"string\") {\n path = path.replace(`[${key}]`, value);\n } else if (Array.isArray(value)) {\n if (path.includes(`[[...${key}]]`)) {\n path = path.replace(`[[...${key}]]`, value.join(\"/\"));\n } else if (path.includes(`[...${key}]`)) {\n path = path.replace(`[...${key}]`, value.join(\"/\"));\n }\n }\n }\n return path;\n}\n\nexport interface PageParamsProviderProps {\n children?: ReactNode;\n\n /**\n * Page route without params substituted (e.g. /products/[slug]).\n */\n route?: string;\n\n /**\n * Page params (e.g. { slug: \"jacket\" })\n */\n params?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query params (e.g. { q: \"search term\" })\n */\n query?: Record<string, string | string[] | undefined>;\n\n /**\n * @deprecated Use `route` instead.\n */\n path?: string;\n}\n\nexport function PageParamsProvider({\n children,\n route,\n path: deprecatedRoute,\n params = {},\n query = {},\n}: PageParamsProviderProps) {\n route = route ?? deprecatedRoute;\n params = fixCatchallParams(params);\n const $ctx = useDataEnv() || {};\n const path = route ? mkPathFromRouteAndParams(route, params) : undefined;\n return (\n <DataProvider\n name={\"pageRoute\"}\n data={route}\n label={\"Page route\"}\n advanced={true}\n >\n <DataProvider name={\"pagePath\"} data={path} label={\"Page path\"}>\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 </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 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","import { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object registering code component's variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n variants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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","const root = globalThis as any;\n\nexport type StringType<T extends string = string> = \"string\" | `'${T}'`;\n\nexport type NumberType<T extends number = number> =\n | \"number\"\n | `${number extends T ? number : T}`;\n\nexport type BooleanType<T extends boolean = boolean> =\n | \"boolean\"\n | `${boolean extends T ? boolean : T}`;\n\nexport type NullType = \"null\";\n\nexport type UndefinedType = \"undefined\";\n\nexport type ArrayType = \"array\";\n\nexport type ObjectType = \"object\";\n\nexport type AnyType = \"any\";\n\nexport type VoidType = \"void\";\n\nexport type RestrictedType<T> = T extends string\n ? StringType<T>\n : T extends number\n ? NumberType<T>\n : T extends boolean\n ? BooleanType<T>\n : T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\nexport type OrType<T> = RestrictedType<T>[];\n\nexport type ParamType<T> = AnyType | RestrictedType<T> | OrType<T>;\n\nexport interface BaseParam<T> {\n name: string;\n type?: ParamType<T>;\n description?: string;\n isOptional?: boolean;\n isRestParam?: boolean;\n}\n\n// Param name and optionally param type\nexport interface RequiredParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter?: false;\n}\n\nexport interface OptionalParam<T> extends BaseParam<T | undefined> {\n isRestParameter?: false;\n}\n\nexport interface RestParam<T> extends BaseParam<T> {\n isOptional?: false;\n isRestParameter: true;\n}\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [string | RequiredParam<H>, ...HandleRequiredParams<T>]\n : [];\n\ntype HandleOptionalParams<P extends any[]> = P extends [infer H, ...infer T]\n ? [] | [string | OptionalParam<H | undefined>, ...HandleOptionalParams<T>]\n : P extends []\n ? []\n : P extends Array<infer T>\n ? [] | [RestParam<T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<RequiredParams<P>>,\n ...HandleOptionalParams<Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<T> = VoidType | ParamType<T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n","import {\n BooleanType,\n ChoiceType,\n CustomType,\n DataSourceType,\n JSONLikeType,\n NumberType,\n StringType,\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 | DataSourceType<P>\n | CustomType<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 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\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement;\n };\n }\n) => React.ReactNode;\n\nexport interface PlasmicI18NContextValue {\n translator?: PlasmicTranslator;\n tagPrefix?: string;\n}\n\nexport const PlasmicTranslatorContext = React.createContext<\n PlasmicI18NContextValue | PlasmicTranslator | undefined\n>(undefined);\n\nexport function usePlasmicTranslator() {\n const _t = React.useContext(PlasmicTranslatorContext);\n const translator = _t\n ? typeof _t === \"function\"\n ? _t\n : _t.translator\n : undefined;\n return translator;\n}\n","export const hostVersion = \"1.0.208\";\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,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,GAAcA,cAAQ,CAAC,CAAC,CAAC,EAAtB,OAAO,QAAe,CAAC;IAChC,IAAM,MAAM,GAAGC,iBAAW,CAAC,YAAA;QACzB,OAAO,CAAC,UAAC,IAAI,EAAK,EAAA,OAAA,IAAI,GAAG,CAAC,CAAA,EAAA,CAAC,CAAC;KAC7B,EAAE,EAAE,CAAC,CAAC;AACP,IAAA,OAAO,MAAM,CAAC;AAChB;;ACGA,IAAK,UAAkB,CAAC,oBAAoB,IAAI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,EACL,QAAQ,EAAAC,mBAAA,EACR,YAAY,EAAAM,uBAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/host",
3
- "version": "1.0.206",
3
+ "version": "1.0.208",
4
4
  "description": "plasmic library for app hosting",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,5 +66,5 @@
66
66
  "react": ">=16.8.0",
67
67
  "react-dom": ">=16.8.0"
68
68
  },
69
- "gitHead": "94d5603125aac87b0d1952dad0241fba1a6be371"
69
+ "gitHead": "879304149b902b453a47fe674997fcad01ae4af8"
70
70
  }
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/registerComponent.ts"],"sourcesContent":["import { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object describing the component interaction variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n interactionVariants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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":";;;;;AAYA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0H/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAwPF,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 { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object registering code component's variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n variants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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":";;;;;AAYA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0H/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAwPF,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 { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object describing the component interaction variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n interactionVariants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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":";AAYA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0H/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAwPF,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 { CodeComponentElement, CSSProperties } from \"./element-types\";\nimport {\n ContextDependentConfig,\n InferDataType,\n ProjectData,\n PropType,\n RestrictPropType,\n StudioOps,\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 /**\n * Operations available to the editor that allow modifying the entire component.\n */\n studioOps: StudioOps;\n /**\n * Metadata from the studio project.\n */\n projectData: ProjectData;\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: \"readonly\";\n variableType: \"dateString\";\n initVal?: string;\n }\n | {\n type: \"readonly\";\n variableType: \"dateRangeStrings\";\n initVal?: [string, string];\n }\n | {\n type: \"writable\";\n variableType:\n | \"text\"\n | \"number\"\n | \"boolean\"\n | \"array\"\n | \"object\"\n | \"dateString\"\n | \"dateRangeStrings\";\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 * A specific section to which the component should be displayed in Studio. By default, the component will be displayed in the \"Custom Components\" section.\n * A new section will be created to display the components with the same `section` value.\n */\n section?: string;\n /**\n * A link to an image that will be displayed as a thumbnail of the component in the Studio, if the component has a `section` specified.\n */\n thumbnailUrl?: 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 specified, then Figma components will have their properties transformed\n * before being applied to this component. This is useful for transforming Figma\n * properties to the format expected by the component.\n */\n figmaPropsTransform?: (\n props: Record<string, string | number | boolean>\n ) => Record<\n string,\n string | number | boolean | null | unknown[] | Record<string, unknown>\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 /**\n * An object registering code component's variants that should be allowed in Studio, when the component is\n * used as the root of a Studio component.\n */\n variants?: Record<\n string,\n {\n cssSelector: string;\n displayName: string;\n }\n >;\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":";AAYA,IAAM,IAAI,GAAG,UAAiB,CAAC;AA0H/B;AACA;AACa,IAAA,gBAAgB,GAA6C;IACxE,UAAU;IACV,qBAAqB;IACrB,UAAU;EACV;AAwPF,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;;;;"}
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";
@@ -11,3 +11,4 @@ export { GlobalContextMeta, PropType as GlobalContextPropType, GlobalContextRegi
11
11
  export { TokenRegistration, TokenType, default as registerToken, } from "./registerToken";
12
12
  export { BasicTrait, ChoiceTrait, TraitMeta, TraitRegistration, default as registerTrait, } from "./registerTrait";
13
13
  export { default as repeatedElement } from "./repeatedElement";
14
+ export * from "./translation";
@@ -267,10 +267,10 @@ export interface CodeComponentMeta<P> {
267
267
  */
268
268
  trapsFocus?: boolean;
269
269
  /**
270
- * An object describing the component interaction variants that should be allowed in Studio, when the component is
270
+ * An object registering code component's variants that should be allowed in Studio, when the component is
271
271
  * used as the root of a Studio component.
272
272
  */
273
- interactionVariants?: Record<string, {
273
+ variants?: Record<string, {
274
274
  cssSelector: string;
275
275
  displayName: string;
276
276
  }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type PlasmicTranslator = (str: string, opts?: {
3
+ components?: {
4
+ [key: string]: React.ReactElement;
5
+ };
6
+ }) => React.ReactNode;
7
+ export interface PlasmicI18NContextValue {
8
+ translator?: PlasmicTranslator;
9
+ tagPrefix?: string;
10
+ }
11
+ export declare const PlasmicTranslatorContext: React.Context<PlasmicI18NContextValue | PlasmicTranslator | undefined>;
12
+ export declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
@@ -1 +1 @@
1
- export declare const hostVersion = "1.0.206";
1
+ export declare const hostVersion = "1.0.208";