@plasmicpkgs/plasmic-basic-components 0.0.9 → 0.0.14
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/Data.d.ts +21 -14
- package/dist/Embed.d.ts +0 -1
- package/dist/EmbedCss.d.ts +0 -1
- package/dist/Iframe.d.ts +0 -1
- package/dist/plasmic-basic-components.cjs.development.js +85 -142
- package/dist/plasmic-basic-components.cjs.development.js.map +1 -1
- package/dist/plasmic-basic-components.cjs.production.min.js +1 -1
- package/dist/plasmic-basic-components.cjs.production.min.js.map +1 -1
- package/dist/plasmic-basic-components.esm.js +88 -144
- package/dist/plasmic-basic-components.esm.js.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plasmic-basic-components.cjs.production.min.js","sources":["../src/common.ts","../src/Data.tsx","../src/Embed.tsx","../src/Iframe.tsx","../src/ScrollRevealer.tsx","../src/Video.tsx","../src/EmbedCss.tsx"],"sourcesContent":["export const tuple = <T extends any[]>(...args: T): T => args;\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n","import { ComponentMeta, repeatedElement } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React, {\n ComponentProps,\n createContext,\n createElement,\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\nconst thisModule = \"@plasmicpkgs/plasmic-basic-components\";\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 name?: string;\n data?: any;\n children?: ReactNode;\n}\n\nexport function DataProvider({ name, data, children }: DataProviderProps) {\n const existingEnv = useDataEnv() ?? {};\n if (!name) {\n return <>{children}</>;\n } else {\n return (\n <DataContext.Provider value={{ ...existingEnv, [name]: data }}>\n {children}\n </DataContext.Provider>\n );\n }\n}\n\nexport interface CommonDynamicProps {\n className?: string;\n tag?: string;\n propSelectors?: SelectorDict;\n}\n\nexport function DynamicElement<\n Tag extends keyof JSX.IntrinsicElements = \"div\"\n>({\n tag = \"div\",\n className,\n children,\n propSelectors,\n ...props\n}: CommonDynamicProps & ComponentProps<Tag>) {\n const computed = useSelectors(propSelectors);\n return createElement(tag, {\n children,\n ...props,\n ...computed,\n className: className + \" \" + computed.className,\n });\n}\n\nexport interface DynamicTextProps extends CommonDynamicProps {\n selector?: string;\n}\n\nexport function DynamicText({\n selector,\n propSelectors,\n ...props\n}: DynamicTextProps) {\n return (\n <DynamicElement\n {...props}\n propSelectors={{ ...propSelectors, children: selector }}\n >\n {/*This is the default text*/}\n (DynamicText requires a selector)\n </DynamicElement>\n );\n}\n\nexport interface DynamicImageProps\n extends CommonDynamicProps,\n ComponentProps<\"img\"> {\n selector?: string;\n}\n\nexport function DynamicImage({\n selector,\n propSelectors,\n ...props\n}: DynamicImageProps) {\n return (\n <DynamicElement<\"img\">\n tag={\"img\"}\n loading={\"lazy\"}\n style={{\n objectFit: \"cover\",\n }}\n {...props}\n propSelectors={{ ...propSelectors, src: selector }}\n // Default image placeholder\n src=\"https://studio.plasmic.app/static/img/placeholder.png\"\n />\n );\n}\n\nexport interface DynamicRepeaterProps {\n children?: ReactNode;\n loopItemName?: string;\n keySelector?: string;\n selector?: string;\n data?: any;\n}\n\nexport function DynamicRepeater({\n children,\n loopItemName,\n keySelector,\n selector,\n data,\n}: DynamicRepeaterProps) {\n // Defaults to an array of three items.\n const finalData = data ?? useSelector(selector) ?? [1, 2, 3];\n return (\n <>\n {finalData?.map?.((item: any, index: number) => (\n <DataProvider\n key={applySelector(item, keySelector) ?? index}\n name={loopItemName}\n data={item}\n >\n {repeatedElement(index === 0, children)}\n </DataProvider>\n ))}\n </>\n );\n}\n\nexport const dynamicRepeaterProps = {\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the array of data to loop over, such as: someVariable.0.someField\",\n },\n loopItemName: {\n type: \"string\",\n defaultValue: \"item\",\n description:\n \"The name of the variable to use to store the current item in the loop\",\n },\n children: \"slot\",\n} as const;\n\nexport const dynamicRepeaterMeta: ComponentMeta<DynamicRepeaterProps> = {\n name: \"hostless-dynamic-repeater\",\n displayName: \"Dynamic Repeater\",\n importName: \"DynamicRepeater\",\n importPath: thisModule,\n props: dynamicRepeaterProps,\n};\n\nexport function registerDynamicRepeater(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicRepeaterMeta?: ComponentMeta<DynamicRepeaterProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicRepeater,\n customDynamicRepeaterMeta ?? dynamicRepeaterMeta\n );\n } else {\n registerComponent(\n DynamicRepeater,\n customDynamicRepeaterMeta ?? dynamicRepeaterMeta\n );\n }\n}\n\nexport const dataProviderMeta: ComponentMeta<DataProviderProps> = {\n name: \"hostless-data-provider\",\n displayName: \"Data Provider\",\n importName: \"DataProvider\",\n importPath: thisModule,\n // description: \"Makes some specified data available to the subtree in a context\",\n props: {\n name: {\n type: \"string\",\n defaultValue: \"celebrities\",\n description: \"The name of the variable to store the data in\",\n },\n data: {\n type: \"object\",\n defaultValue: [\n {\n name: \"Fill Murray\",\n birthYear: 1950,\n profilePicture: [\"https://www.fillmurray.com/200/300\"],\n },\n {\n name: \"Place Cage\",\n birthYear: 1950,\n profilePicture: [\"https://www.placecage.com/200/300\"],\n },\n ],\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"component\",\n name: \"hostless-dynamic-text\",\n props: {\n selector: \"celebrities.0.name\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-dynamic-image\",\n props: {\n selector: \"celebrities.0.profilePicture\",\n },\n },\n ],\n },\n },\n};\n\nexport function registerDataProvider(\n loader?: { registerComponent: typeof registerComponent },\n customDataProviderMeta?: ComponentMeta<DataProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n DataProvider,\n customDataProviderMeta ?? dataProviderMeta\n );\n } else {\n registerComponent(DataProvider, customDataProviderMeta ?? dataProviderMeta);\n }\n}\n\nconst dynamicPropsWithoutTag = {\n propSelectors: {\n type: \"object\",\n defaultValueHint: {},\n description:\n \"An object whose keys are prop names and values are selector expressions. Use this to set any prop to a dynamic value.\",\n },\n} as const;\n\nconst dynamicProps = {\n ...dynamicPropsWithoutTag,\n tag: {\n type: \"string\",\n defaultValueHint: \"div\",\n description: \"The HTML tag to use\",\n },\n} as const;\n\n// TODO Eventually we'll want to expose all the base HTML properties, but in the nicer way that we do within the studio.\n\nexport const dynamicElementMeta: ComponentMeta<CommonDynamicProps> = {\n name: \"hostless-dynamic-element\",\n displayName: \"Dynamic Element\",\n importName: \"DynamicElement\",\n importPath: thisModule,\n props: { ...dynamicProps, children: \"slot\" },\n};\n\nexport function registerDynamicElement(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicElementMeta?: ComponentMeta<CommonDynamicProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicElement,\n customDynamicElementMeta ?? dynamicElementMeta\n );\n } else {\n registerComponent(\n DynamicElement,\n customDynamicElementMeta ?? dynamicElementMeta\n );\n }\n}\n\nexport const dynamicTextMeta: ComponentMeta<DynamicTextProps> = {\n name: \"hostless-dynamic-text\",\n importName: \"DynamicText\",\n displayName: \"Dynamic Text\",\n importPath: thisModule,\n props: {\n ...dynamicProps,\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the text, such as: someVariable.0.someField\",\n },\n },\n};\n\nexport function registerDynamicText(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicTextMeta?: ComponentMeta<DynamicTextProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicText,\n customDynamicTextMeta ?? dynamicTextMeta\n );\n } else {\n registerComponent(DynamicText, customDynamicTextMeta ?? dynamicTextMeta);\n }\n}\n\nexport const dynamicImageMeta: ComponentMeta<DynamicImageProps> = {\n name: \"hostless-dynamic-image\",\n displayName: \"Dynamic Image\",\n importName: \"DynamicImage\",\n importPath: thisModule,\n props: {\n ...dynamicPropsWithoutTag,\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the image source URL, such as: someVariable.0.someField\",\n },\n },\n};\n\nexport function registerDynamicImage(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicImageMeta?: ComponentMeta<DynamicImageProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicImage,\n customDynamicImageMeta ?? dynamicImageMeta\n );\n } else {\n registerComponent(DynamicImage, customDynamicImageMeta ?? dynamicImageMeta);\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useEffect, useRef } from \"react\";\nimport { ensure } from \"./common\";\n\nexport interface EmbedProps {\n className?: string;\n code: string;\n hideInEditor?: boolean;\n}\n\nexport default function Embed({\n className,\n code,\n hideInEditor = false,\n}: EmbedProps) {\n const rootElt = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (hideInEditor) {\n return;\n }\n Array.from(ensure(rootElt.current).querySelectorAll(\"script\")).forEach(\n (oldScript) => {\n const newScript = document.createElement(\"script\");\n Array.from(oldScript.attributes).forEach((attr) =>\n newScript.setAttribute(attr.name, attr.value)\n );\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n ensure(oldScript.parentNode).replaceChild(newScript, oldScript);\n }\n );\n }, [code, hideInEditor]);\n const effectiveCode = hideInEditor ? \"\" : code;\n return (\n <div\n ref={rootElt}\n className={className}\n dangerouslySetInnerHTML={{ __html: effectiveCode }}\n />\n );\n}\n\nexport const embedMeta: ComponentMeta<EmbedProps> = {\n name: \"hostless-embed\",\n displayName: \"Embed HTML\",\n importName: \"Embed\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n code: {\n type: \"string\",\n defaultValue: \"https://www.example.com\",\n },\n hideInEditor: {\n type: \"boolean\",\n displayName: \"Hide in editor\",\n description:\n \"Disable running the code while editing in Plasmic Studio (may require reload)\",\n editOnly: true,\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n};\n\nexport function registerEmbed(\n loader?: { registerComponent: typeof registerComponent },\n customEmbedMeta?: ComponentMeta<EmbedProps>\n) {\n if (loader) {\n loader.registerComponent(Embed, customEmbedMeta ?? embedMeta);\n } else {\n registerComponent(Embed, customEmbedMeta ?? embedMeta);\n }\n}\n","import { ComponentMeta, PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\n\nexport interface IframeProps {\n src: string;\n preview?: boolean;\n className?: string;\n}\n\nexport default function Iframe({ preview, src, className }: IframeProps) {\n const isEditing = useContext(PlasmicCanvasContext);\n if (isEditing && !preview) {\n return (\n <div className={className}>\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background: \"#eee\",\n color: \"#888\",\n fontSize: \"36px\",\n fontFamily: \"sans-serif\",\n fontWeight: \"bold\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n }}\n >\n Iframe placeholder\n </div>\n </div>\n );\n }\n return <iframe src={src} className={className} />;\n}\n\nexport const iframeMeta: ComponentMeta<IframeProps> = {\n name: \"hostless-iframe\",\n displayName: \"Iframe\",\n importName: \"Iframe\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n src: {\n type: \"string\",\n defaultValue: \"https://www.example.com\",\n },\n preview: {\n type: \"boolean\",\n description: \"Load the iframe while editing in Plasmic Studio\",\n },\n },\n defaultStyles: {\n width: \"300px\",\n height: \"150px\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerIframe(\n loader?: { registerComponent: typeof registerComponent },\n customIframeMeta?: ComponentMeta<IframeProps>\n) {\n if (loader) {\n loader.registerComponent(Iframe, customIframeMeta ?? iframeMeta);\n } else {\n registerComponent(Iframe, customIframeMeta ?? iframeMeta);\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, {\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nexport function useDirectionalIntersection({\n ref,\n scrollDownThreshold = 0.5,\n scrollUpThreshold = 0,\n}: {\n ref: RefObject<HTMLElement>;\n scrollDownThreshold?: number;\n scrollUpThreshold?: number;\n}) {\n const [revealed, setRevealed] = useState(false);\n useEffect(() => {\n if (ref.current && typeof IntersectionObserver === \"function\") {\n const handler = (entries: IntersectionObserverEntry[]) => {\n if (entries[0].intersectionRatio >= scrollDownThreshold) {\n setRevealed(true);\n } else if (entries[0].intersectionRatio <= scrollUpThreshold) {\n setRevealed(false);\n }\n };\n\n const observer = new IntersectionObserver(handler, {\n root: null,\n rootMargin: \"0%\",\n threshold: [scrollUpThreshold, scrollDownThreshold],\n });\n observer.observe(ref.current);\n\n return () => {\n setRevealed(false);\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current, scrollDownThreshold, scrollUpThreshold]);\n return revealed;\n}\n\nexport interface ScrollRevealerProps {\n children?: ReactNode;\n className?: string;\n scrollUpThreshold?: number;\n scrollDownThreshold?: number;\n}\n\n/**\n * Unlike react-awesome-reveal, ScrollRevealer:\n *\n * - has configurable thresholds\n * - triggers arbitrary render/unrender animations\n *\n * TODO: Merge this inta a general Reveal component, perhaps forking react-awesome-reveal, so that we don't have two different reveal components for users.\n */\nexport default function ScrollRevealer({\n children,\n className,\n scrollDownThreshold = 0.5,\n scrollUpThreshold = 0,\n}: ScrollRevealerProps) {\n const intersectionRef = useRef<HTMLDivElement>(null);\n const revealed = useDirectionalIntersection({\n ref: intersectionRef,\n scrollUpThreshold,\n scrollDownThreshold,\n });\n return (\n <div className={className} ref={intersectionRef}>\n {revealed ? children : null}\n </div>\n );\n}\n\nexport const scrollRevealerMeta: ComponentMeta<ScrollRevealerProps> = {\n name: \"hostless-scroll-revealer\",\n importName: \"ScrollRevealer\",\n displayName: \"Scroll Revealer\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n children: \"slot\",\n scrollDownThreshold: {\n type: \"number\",\n displayName: \"Scroll down threshold\",\n defaultValueHint: 0.5,\n description:\n \"How much of the element (as a fraction) must you scroll into view for it to appear (defaults to 0.5)\",\n },\n scrollUpThreshold: {\n type: \"number\",\n displayName: \"Scroll up threshold\",\n defaultValueHint: 0,\n description:\n \"While scrolling up, how much of the element (as a fraction) can still be scrolled in view before it disappears (defaults to 0, meaning you must scroll up until it's completely out of view)\",\n },\n },\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerScrollRevealer(\n loader?: { registerComponent: typeof registerComponent },\n customScrollRevealerMeta?: ComponentMeta<ScrollRevealerProps>\n) {\n if (loader) {\n loader.registerComponent(\n ScrollRevealer,\n customScrollRevealerMeta ?? scrollRevealerMeta\n );\n } else {\n registerComponent(\n ScrollRevealer,\n customScrollRevealerMeta ?? scrollRevealerMeta\n );\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type VideoProps = Pick<\n React.ComponentProps<\"video\">,\n | \"autoPlay\"\n | \"controls\"\n | \"loop\"\n | \"muted\"\n | \"playsInline\"\n | \"poster\"\n | \"preload\"\n | \"src\"\n>;\n\nconst Video = React.forwardRef<HTMLVideoElement, VideoProps>(\n (props: VideoProps, ref) => {\n return <video ref={ref} {...props} />;\n }\n);\n\nexport default Video;\n\nexport const videoMeta: ComponentMeta<VideoProps> = {\n name: \"hostless-html-video\",\n importName: \"Video\",\n displayName: \"HTML Video\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n src: {\n type: \"string\",\n defaultValue:\n \"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm\",\n displayName: \"Source URL\",\n description: \"URL to a video file.\",\n },\n autoPlay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video show automatically start playing when the player loads\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description: \"Whether the video player controls should be displayed\",\n },\n playsInline: {\n type: \"boolean\",\n displayName: \"Plays inline\",\n description:\n \"Usually on mobile, when tilted landscape, videos can play fullscreen. Turn this on to prevent that.\",\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n },\n muted: {\n type: \"boolean\",\n displayName: \"Muted\",\n description: \"Whether audio should be muted\",\n },\n poster: {\n type: \"imageUrl\",\n displayName: \"Poster (placeholder) image\",\n description: \"Image to show while video is downloading\",\n },\n preload: {\n type: \"choice\",\n options: [\"none\", \"metadata\", \"auto\"],\n displayName: \"Preload\",\n description:\n \"Whether to preload nothing, metadata only, or the full video\",\n },\n },\n defaultStyles: {\n height: \"hug\",\n width: \"640px\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerVideo(\n loader?: { registerComponent: typeof registerComponent },\n customVideoMeta?: ComponentMeta<VideoProps>\n) {\n if (loader) {\n loader.registerComponent(Video, customVideoMeta ?? videoMeta);\n } else {\n registerComponent(Video, customVideoMeta ?? videoMeta);\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport interface EmbedCssProps {\n css: string;\n}\n\nexport default function EmbedCss({\n css\n}: EmbedCssProps) {\n return (\n <style\n dangerouslySetInnerHTML={{ __html: css }}\n />\n );\n}\n\nexport const embedCssMeta: ComponentMeta<EmbedCssProps> = { \n name: \"hostless-embed-css\",\n displayName: \"EmbedCss\",\n importName: \"EmbedCss\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n css: {\n type: \"string\",\n defaultValueHint: \"Some CSS snippet\",\n description: \"CSS rules to be inserted\",\n },\n },\n};\n\nexport function registerEmbedCss(\n loader?: { registerComponent: typeof registerComponent },\n customEmbedCssMeta?: ComponentMeta<EmbedCssProps>\n) {\n if (loader) {\n loader.registerComponent(EmbedCss, customEmbedCssMeta ?? embedCssMeta);\n } else {\n registerComponent(EmbedCss, customEmbedCssMeta ?? embedCssMeta);\n }\n}\n"],"names":["ensure","x","Error","DataContext","createContext","undefined","thisModule","applySelector","rawData","selector","curData","split","_curData","useSelector","useDataEnv","useSelectors","selectors","Object","fromEntries","entries","filter","map","args","tuple","useContext","DataProvider","name","data","children","existingEnv","React","Provider","value","DynamicElement","tag","className","propSelectors","props","computed","createElement","DynamicText","DynamicImage","loading","style","objectFit","src","DynamicRepeater","loopItemName","keySelector","finalData","item","index","key","repeatedElement","dynamicRepeaterProps","type","description","defaultValue","dynamicRepeaterMeta","displayName","importName","importPath","dataProviderMeta","birthYear","profilePicture","dynamicPropsWithoutTag","defaultValueHint","dynamicProps","dynamicElementMeta","dynamicTextMeta","dynamicImageMeta","Embed","code","hideInEditor","rootElt","useRef","useEffect","Array","from","current","querySelectorAll","forEach","oldScript","newScript","document","attributes","attr","setAttribute","appendChild","createTextNode","innerHTML","parentNode","replaceChild","ref","dangerouslySetInnerHTML","__html","embedMeta","editOnly","defaultStyles","maxWidth","Iframe","preview","PlasmicCanvasContext","position","top","left","right","bottom","background","color","fontSize","fontFamily","fontWeight","display","alignItems","justifyContent","overflow","iframeMeta","width","height","useDirectionalIntersection","scrollDownThreshold","scrollUpThreshold","useState","revealed","setRevealed","IntersectionObserver","observer","intersectionRatio","root","rootMargin","threshold","observe","disconnect","ScrollRevealer","intersectionRef","scrollRevealerMeta","Video","forwardRef","videoMeta","autoPlay","controls","playsInline","loop","muted","poster","preload","options","EmbedCss","css","embedCssMeta","loader","customDataProviderMeta","registerComponent","customDynamicElementMeta","customDynamicImageMeta","customDynamicRepeaterMeta","customDynamicTextMeta","customEmbedMeta","customEmbedCssMeta","customIframeMeta","customScrollRevealerMeta","customVideoMeta"],"mappings":"+rBAEgBA,EAAUC,MACpBA,MAAAA,QAEI,IAAIC,oDAEHD,MCMEE,EAAcC,qBAAoCC,GAEzDC,EAAa,iDAEHC,EACdC,EACAC,MAEKA,aAGDC,EAAUF,wrBACIC,EAASE,MAAM,qBAAM,OACrCD,WAAUA,UAAAE,kBAELF,YAKOG,EAAYJ,UAEnBF,EADSO,IACcL,YAGhBM,EAAaC,YAAAA,IAAAA,EAA0B,QAC/CR,EAAUM,WACTG,OAAOC,YACZD,OAAOE,QAAQH,GACZI,QAAO,oCACPC,KAAI,mBD3CU,sCAAqBC,2BAAAA,yBAAeA,EC2CzBC,MAAWhB,EAAcC,aAIzD,SAAgBM,WACPU,aAAWrB,YASJsB,aAAeC,IAAAA,KAAMC,IAAAA,KAAMC,IAAAA,SACnCC,WAAcf,OAAgB,UAC/BY,EAIDI,gBAAC3B,EAAY4B,UAASC,WAAYH,UAAcH,GAAOC,OACpDC,GAJEE,gCAAGF,YAgBEK,aAGdC,IAAAA,aAAM,QACNC,IAAAA,UACAP,IAAAA,SACAQ,IAAAA,cACGC,sDAEGC,EAAWvB,EAAaqB,UACvBG,gBAAcL,KACnBN,SAAAA,GACGS,EACAC,GACHH,UAAWA,EAAY,IAAMG,EAASH,sBAQ1BK,SACd/B,IAAAA,SACA2B,IAAAA,cACGC,2CAGDP,gBAACG,mBACKI,GACJD,mBAAoBA,GAAeR,SAAUnB,oDAcnCgC,SACdhC,IAAAA,SACA2B,IAAAA,cACGC,2CAGDP,gBAACG,iBACCC,IAAK,MACLQ,QAAS,OACTC,MAAO,CACLC,UAAW,UAETP,GACJD,mBAAoBA,GAAeS,IAAKpC,IAExCoC,IA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mF,EAAkBhH,QAAckH,EAAAA,EAA0BrF,6CAlL5DiF,EACAK,GAEIL,EACFA,EAAOE,kBACL3G,QACA8G,EAAAA,EAA6BlG,GAG/B+F,EACE3G,QACA8G,EAAAA,EAA6BlG,yCAiIjC6F,EACAM,GAEIN,EACFA,EAAOE,kBACLjH,QACAqH,EAAAA,EAAyBxF,GAG3BoF,EAAkBjH,QAAaqH,EAAAA,EAAyBxF,mCCtR1DkF,EACAO,GAEIP,EACFA,EAAOE,kBAAkBlF,QAAOuF,EAAAA,EAAmB9D,GAEnDyD,EAAkBlF,QAAOuF,EAAAA,EAAmB9D,sCIvC9CuD,EACAQ,GAEIR,EACFA,EAAOE,kBAAkBL,QAAUW,EAAAA,EAAsBT,GAEzDG,EAAkBL,QAAUW,EAAAA,EAAsBT,oCHwBpDC,EACAS,GAEIT,EACFA,EAAOE,kBAAkBrD,QAAQ4D,EAAAA,EAAoB3C,GAErDoC,EAAkBrD,QAAQ4D,EAAAA,EAAoB3C,4CCyChDkC,EACAU,GAEIV,EACFA,EAAOE,kBACLnB,QACA2B,EAAAA,EAA4BzB,GAG9BiB,EACEnB,QACA2B,EAAAA,EAA4BzB,mCCpChCe,EACAW,GAEIX,EACFA,EAAOE,kBAAkBhB,QAAOyB,EAAAA,EAAmBvB,GAEnDc,EAAkBhB,QAAOyB,EAAAA,EAAmBvB"}
|
|
1
|
+
{"version":3,"file":"plasmic-basic-components.cjs.production.min.js","sources":["../src/Data.tsx","../src/common.ts","../src/Embed.tsx","../src/Iframe.tsx","../src/ScrollRevealer.tsx","../src/Video.tsx","../src/EmbedCss.tsx"],"sourcesContent":["import {\n ComponentMeta,\n repeatedElement,\n SelectorDict,\n useSelectors as _useSelectors,\n useSelector as _useSelector,\n DataProvider as _DataProvider,\n DataProviderProps,\n applySelector as _applySelector,\n useDataEnv as _useDataEnv,\n} from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React, { ComponentProps, createElement, ReactNode } from \"react\";\n\nconst thisModule = \"@plasmicpkgs/plasmic-basic-components\";\n\n/**\n * @deprecated This should be imported from @plasmicapp/host instead.\n */\nexport const applySelector: typeof _applySelector = function(...args) {\n console.warn(\n \"DEPRECATED: Import applySelector from @plasmicapp/host instead.\"\n );\n return _applySelector(...args);\n};\n\n/**\n * @deprecated This should be imported from @plasmicapp/host instead.\n */\nexport const useSelector: typeof _useSelector = function(...args) {\n console.warn(\"DEPRECATED: Import useSelector from @plasmicapp/host instead.\");\n return _useSelector(...args);\n};\n\n/**\n * @deprecated This should be imported from @plasmicapp/host instead.\n */\nexport const useSelectors: typeof _useSelectors = function(...args) {\n console.warn(\n \"DEPRECATED: Import useSelectors from @plasmicapp/host instead.\"\n );\n return _useSelectors(...args);\n};\n\n/**\n * @deprecated This should be imported from @plasmicapp/host instead.\n */\nexport const useDataEnv: typeof _useDataEnv = function(...args) {\n console.warn(\"DEPRECATED: Import useDataEnv from @plasmicapp/host instead.\");\n return _useDataEnv(...args);\n};\n\n/**\n * @deprecated This should be imported from @plasmicapp/host instead.\n */\nexport const DataProvider: typeof _DataProvider = function(...args) {\n console.warn(\n \"DEPRECATED: Import DataProvider from @plasmicapp/host instead.\"\n );\n return _DataProvider(...args);\n};\n\nexport interface CommonDynamicProps {\n className?: string;\n tag?: string;\n propSelectors?: SelectorDict;\n}\n\nexport function DynamicElement<\n Tag extends keyof JSX.IntrinsicElements = \"div\"\n>({\n tag = \"div\",\n className,\n children,\n propSelectors,\n ...props\n}: CommonDynamicProps & ComponentProps<Tag>) {\n const computed = _useSelectors(propSelectors);\n return createElement(tag, {\n children,\n ...props,\n ...computed,\n className: className + \" \" + computed.className,\n });\n}\n\nexport interface DynamicTextProps extends CommonDynamicProps {\n selector?: string;\n}\n\nexport function DynamicText({\n selector,\n propSelectors,\n ...props\n}: DynamicTextProps) {\n return (\n <DynamicElement\n {...props}\n propSelectors={{ ...propSelectors, children: selector }}\n >\n {/*This is the default text*/}\n (DynamicText requires a selector)\n </DynamicElement>\n );\n}\n\nexport interface DynamicImageProps\n extends CommonDynamicProps,\n ComponentProps<\"img\"> {\n selector?: string;\n}\n\nexport function DynamicImage({\n selector,\n propSelectors,\n ...props\n}: DynamicImageProps) {\n return (\n <DynamicElement<\"img\">\n tag={\"img\"}\n loading={\"lazy\"}\n style={{\n objectFit: \"cover\",\n }}\n {...props}\n propSelectors={{ ...propSelectors, src: selector }}\n // Default image placeholder\n src=\"https://studio.plasmic.app/static/img/placeholder.png\"\n />\n );\n}\n\nexport interface DynamicRepeaterProps {\n children?: ReactNode;\n loopItemName?: string;\n keySelector?: string;\n selector?: string;\n data?: any;\n}\n\nexport function DynamicRepeater({\n children,\n loopItemName,\n keySelector,\n selector,\n data,\n}: DynamicRepeaterProps) {\n // Defaults to an array of three items.\n const finalData = data ?? _useSelector(selector) ?? [1, 2, 3];\n return (\n <>\n {finalData?.map?.((item: any, index: number) => (\n <_DataProvider\n key={_applySelector(item, keySelector) ?? index}\n name={loopItemName}\n data={item}\n >\n {repeatedElement(index === 0, children)}\n </_DataProvider>\n ))}\n </>\n );\n}\n\nexport const dynamicRepeaterProps = {\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the array of data to loop over, such as: someVariable.0.someField\",\n },\n loopItemName: {\n type: \"string\",\n defaultValue: \"item\",\n description:\n \"The name of the variable to use to store the current item in the loop\",\n },\n children: \"slot\",\n} as const;\n\nexport const dynamicRepeaterMeta: ComponentMeta<DynamicRepeaterProps> = {\n name: \"hostless-dynamic-repeater\",\n displayName: \"Dynamic Repeater\",\n importName: \"DynamicRepeater\",\n importPath: thisModule,\n props: dynamicRepeaterProps,\n};\n\nexport function registerDynamicRepeater(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicRepeaterMeta?: ComponentMeta<DynamicRepeaterProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicRepeater,\n customDynamicRepeaterMeta ?? dynamicRepeaterMeta\n );\n } else {\n registerComponent(\n DynamicRepeater,\n customDynamicRepeaterMeta ?? dynamicRepeaterMeta\n );\n }\n}\n\nexport const dataProviderMeta: ComponentMeta<DataProviderProps> = {\n name: \"hostless-data-provider\",\n displayName: \"Data Provider\",\n importName: \"DataProvider\",\n importPath: thisModule,\n // description: \"Makes some specified data available to the subtree in a context\",\n props: {\n name: {\n type: \"string\",\n defaultValue: \"celebrities\",\n description: \"The name of the variable to store the data in\",\n },\n data: {\n type: \"object\",\n defaultValue: [\n {\n name: \"Fill Murray\",\n birthYear: 1950,\n profilePicture: [\"https://www.fillmurray.com/200/300\"],\n },\n {\n name: \"Place Cage\",\n birthYear: 1950,\n profilePicture: [\"https://www.placecage.com/200/300\"],\n },\n ],\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"component\",\n name: \"hostless-dynamic-text\",\n props: {\n selector: \"celebrities.0.name\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-dynamic-image\",\n props: {\n selector: \"celebrities.0.profilePicture\",\n },\n },\n ],\n },\n },\n};\n\nexport function registerDataProvider(\n loader?: { registerComponent: typeof registerComponent },\n customDataProviderMeta?: ComponentMeta<DataProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n _DataProvider,\n customDataProviderMeta ?? dataProviderMeta\n );\n } else {\n registerComponent(\n _DataProvider,\n customDataProviderMeta ?? dataProviderMeta\n );\n }\n}\n\nconst dynamicPropsWithoutTag = {\n propSelectors: {\n type: \"object\",\n defaultValueHint: {},\n description:\n \"An object whose keys are prop names and values are selector expressions. Use this to set any prop to a dynamic value.\",\n },\n} as const;\n\nconst dynamicProps = {\n ...dynamicPropsWithoutTag,\n tag: {\n type: \"string\",\n defaultValueHint: \"div\",\n description: \"The HTML tag to use\",\n },\n} as const;\n\n// TODO Eventually we'll want to expose all the base HTML properties, but in the nicer way that we do within the studio.\n\nexport const dynamicElementMeta: ComponentMeta<CommonDynamicProps> = {\n name: \"hostless-dynamic-element\",\n displayName: \"Dynamic Element\",\n importName: \"DynamicElement\",\n importPath: thisModule,\n props: { ...dynamicProps, children: \"slot\" },\n};\n\nexport function registerDynamicElement(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicElementMeta?: ComponentMeta<CommonDynamicProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicElement,\n customDynamicElementMeta ?? dynamicElementMeta\n );\n } else {\n registerComponent(\n DynamicElement,\n customDynamicElementMeta ?? dynamicElementMeta\n );\n }\n}\n\nexport const dynamicTextMeta: ComponentMeta<DynamicTextProps> = {\n name: \"hostless-dynamic-text\",\n importName: \"DynamicText\",\n displayName: \"Dynamic Text\",\n importPath: thisModule,\n props: {\n ...dynamicProps,\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the text, such as: someVariable.0.someField\",\n },\n },\n};\n\nexport function registerDynamicText(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicTextMeta?: ComponentMeta<DynamicTextProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicText,\n customDynamicTextMeta ?? dynamicTextMeta\n );\n } else {\n registerComponent(DynamicText, customDynamicTextMeta ?? dynamicTextMeta);\n }\n}\n\nexport const dynamicImageMeta: ComponentMeta<DynamicImageProps> = {\n name: \"hostless-dynamic-image\",\n displayName: \"Dynamic Image\",\n importName: \"DynamicImage\",\n importPath: thisModule,\n props: {\n ...dynamicPropsWithoutTag,\n selector: {\n type: \"string\",\n description:\n \"The selector expression to use to get the image source URL, such as: someVariable.0.someField\",\n },\n },\n};\n\nexport function registerDynamicImage(\n loader?: { registerComponent: typeof registerComponent },\n customDynamicImageMeta?: ComponentMeta<DynamicImageProps>\n) {\n if (loader) {\n loader.registerComponent(\n DynamicImage,\n customDynamicImageMeta ?? dynamicImageMeta\n );\n } else {\n registerComponent(DynamicImage, customDynamicImageMeta ?? dynamicImageMeta);\n }\n}\n","export const tuple = <T extends any[]>(...args: T): T => args;\n\nexport function ensure<T>(x: T | null | undefined): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(`Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useEffect, useRef } from \"react\";\nimport { ensure } from \"./common\";\n\nexport interface EmbedProps {\n className?: string;\n code: string;\n hideInEditor?: boolean;\n}\n\nexport default function Embed({\n className,\n code,\n hideInEditor = false,\n}: EmbedProps) {\n const rootElt = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (hideInEditor) {\n return;\n }\n Array.from(ensure(rootElt.current).querySelectorAll(\"script\")).forEach(\n (oldScript) => {\n const newScript = document.createElement(\"script\");\n Array.from(oldScript.attributes).forEach((attr) =>\n newScript.setAttribute(attr.name, attr.value)\n );\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n ensure(oldScript.parentNode).replaceChild(newScript, oldScript);\n }\n );\n }, [code, hideInEditor]);\n const effectiveCode = hideInEditor ? \"\" : code;\n return (\n <div\n ref={rootElt}\n className={className}\n dangerouslySetInnerHTML={{ __html: effectiveCode }}\n />\n );\n}\n\nexport const embedMeta: ComponentMeta<EmbedProps> = {\n name: \"hostless-embed\",\n displayName: \"Embed HTML\",\n importName: \"Embed\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n code: {\n type: \"code\",\n lang: \"html\",\n defaultValueHint: \"<!-- HTML snippet -->\",\n description: \"The HTML code to be embedded\",\n },\n hideInEditor: {\n type: \"boolean\",\n displayName: \"Hide in editor\",\n description:\n \"Disable running the code while editing in Plasmic Studio (may require reload)\",\n editOnly: true,\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n};\n\nexport function registerEmbed(\n loader?: { registerComponent: typeof registerComponent },\n customEmbedMeta?: ComponentMeta<EmbedProps>\n) {\n if (loader) {\n loader.registerComponent(Embed, customEmbedMeta ?? embedMeta);\n } else {\n registerComponent(Embed, customEmbedMeta ?? embedMeta);\n }\n}\n","import { ComponentMeta, PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\n\nexport interface IframeProps {\n src: string;\n preview?: boolean;\n className?: string;\n}\n\nexport default function Iframe({ preview, src, className }: IframeProps) {\n const isEditing = useContext(PlasmicCanvasContext);\n if (isEditing && !preview) {\n return (\n <div className={className}>\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background: \"#eee\",\n color: \"#888\",\n fontSize: \"36px\",\n fontFamily: \"sans-serif\",\n fontWeight: \"bold\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n }}\n >\n Iframe placeholder\n </div>\n </div>\n );\n }\n return <iframe src={src} className={className} />;\n}\n\nexport const iframeMeta: ComponentMeta<IframeProps> = {\n name: \"hostless-iframe\",\n displayName: \"Iframe\",\n importName: \"Iframe\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n src: {\n type: \"string\",\n defaultValue: \"https://www.example.com\",\n },\n preview: {\n type: \"boolean\",\n description: \"Load the iframe while editing in Plasmic Studio\",\n },\n },\n defaultStyles: {\n width: \"300px\",\n height: \"150px\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerIframe(\n loader?: { registerComponent: typeof registerComponent },\n customIframeMeta?: ComponentMeta<IframeProps>\n) {\n if (loader) {\n loader.registerComponent(Iframe, customIframeMeta ?? iframeMeta);\n } else {\n registerComponent(Iframe, customIframeMeta ?? iframeMeta);\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, {\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nexport function useDirectionalIntersection({\n ref,\n scrollDownThreshold = 0.5,\n scrollUpThreshold = 0,\n}: {\n ref: RefObject<HTMLElement>;\n scrollDownThreshold?: number;\n scrollUpThreshold?: number;\n}) {\n const [revealed, setRevealed] = useState(false);\n useEffect(() => {\n if (ref.current && typeof IntersectionObserver === \"function\") {\n const handler = (entries: IntersectionObserverEntry[]) => {\n if (entries[0].intersectionRatio >= scrollDownThreshold) {\n setRevealed(true);\n } else if (entries[0].intersectionRatio <= scrollUpThreshold) {\n setRevealed(false);\n }\n };\n\n const observer = new IntersectionObserver(handler, {\n root: null,\n rootMargin: \"0%\",\n threshold: [scrollUpThreshold, scrollDownThreshold],\n });\n observer.observe(ref.current);\n\n return () => {\n setRevealed(false);\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current, scrollDownThreshold, scrollUpThreshold]);\n return revealed;\n}\n\nexport interface ScrollRevealerProps {\n children?: ReactNode;\n className?: string;\n scrollUpThreshold?: number;\n scrollDownThreshold?: number;\n}\n\n/**\n * Unlike react-awesome-reveal, ScrollRevealer:\n *\n * - has configurable thresholds\n * - triggers arbitrary render/unrender animations\n *\n * TODO: Merge this inta a general Reveal component, perhaps forking react-awesome-reveal, so that we don't have two different reveal components for users.\n */\nexport default function ScrollRevealer({\n children,\n className,\n scrollDownThreshold = 0.5,\n scrollUpThreshold = 0,\n}: ScrollRevealerProps) {\n const intersectionRef = useRef<HTMLDivElement>(null);\n const revealed = useDirectionalIntersection({\n ref: intersectionRef,\n scrollUpThreshold,\n scrollDownThreshold,\n });\n return (\n <div className={className} ref={intersectionRef}>\n {revealed ? children : null}\n </div>\n );\n}\n\nexport const scrollRevealerMeta: ComponentMeta<ScrollRevealerProps> = {\n name: \"hostless-scroll-revealer\",\n importName: \"ScrollRevealer\",\n displayName: \"Scroll Revealer\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n children: \"slot\",\n scrollDownThreshold: {\n type: \"number\",\n displayName: \"Scroll down threshold\",\n defaultValueHint: 0.5,\n description:\n \"How much of the element (as a fraction) must you scroll into view for it to appear (defaults to 0.5)\",\n },\n scrollUpThreshold: {\n type: \"number\",\n displayName: \"Scroll up threshold\",\n defaultValueHint: 0,\n description:\n \"While scrolling up, how much of the element (as a fraction) can still be scrolled in view before it disappears (defaults to 0, meaning you must scroll up until it's completely out of view)\",\n },\n },\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerScrollRevealer(\n loader?: { registerComponent: typeof registerComponent },\n customScrollRevealerMeta?: ComponentMeta<ScrollRevealerProps>\n) {\n if (loader) {\n loader.registerComponent(\n ScrollRevealer,\n customScrollRevealerMeta ?? scrollRevealerMeta\n );\n } else {\n registerComponent(\n ScrollRevealer,\n customScrollRevealerMeta ?? scrollRevealerMeta\n );\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type VideoProps = Pick<\n React.ComponentProps<\"video\">,\n | \"autoPlay\"\n | \"controls\"\n | \"loop\"\n | \"muted\"\n | \"playsInline\"\n | \"poster\"\n | \"preload\"\n | \"src\"\n>;\n\nconst Video = React.forwardRef<HTMLVideoElement, VideoProps>(\n (props: VideoProps, ref) => {\n return <video ref={ref} {...props} />;\n }\n);\n\nexport default Video;\n\nexport const videoMeta: ComponentMeta<VideoProps> = {\n name: \"hostless-html-video\",\n importName: \"Video\",\n displayName: \"HTML Video\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n src: {\n type: \"string\",\n defaultValue:\n \"https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm\",\n displayName: \"Source URL\",\n description: \"URL to a video file.\",\n },\n autoPlay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video show automatically start playing when the player loads\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description: \"Whether the video player controls should be displayed\",\n },\n playsInline: {\n type: \"boolean\",\n displayName: \"Plays inline\",\n description:\n \"Usually on mobile, when tilted landscape, videos can play fullscreen. Turn this on to prevent that.\",\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n },\n muted: {\n type: \"boolean\",\n displayName: \"Muted\",\n description: \"Whether audio should be muted\",\n },\n poster: {\n type: \"imageUrl\",\n displayName: \"Poster (placeholder) image\",\n description: \"Image to show while video is downloading\",\n },\n preload: {\n type: \"choice\",\n options: [\"none\", \"metadata\", \"auto\"],\n displayName: \"Preload\",\n description:\n \"Whether to preload nothing, metadata only, or the full video\",\n },\n },\n defaultStyles: {\n height: \"hug\",\n width: \"640px\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerVideo(\n loader?: { registerComponent: typeof registerComponent },\n customVideoMeta?: ComponentMeta<VideoProps>\n) {\n if (loader) {\n loader.registerComponent(Video, customVideoMeta ?? videoMeta);\n } else {\n registerComponent(Video, customVideoMeta ?? videoMeta);\n }\n}\n","import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport interface EmbedCssProps {\n css: string;\n}\n\nexport default function EmbedCss({\n css\n}: EmbedCssProps) {\n return (\n <style\n dangerouslySetInnerHTML={{ __html: css }}\n />\n );\n}\n\nexport const embedCssMeta: ComponentMeta<EmbedCssProps> = { \n name: \"hostless-embed-css\",\n displayName: \"Embed Css\",\n importName: \"EmbedCss\",\n importPath: \"@plasmicpkgs/plasmic-basic-components\",\n props: {\n css: {\n type: \"code\",\n lang: \"css\",\n defaultValueHint: \"/* CSS snippet */\",\n description: \"CSS rules to be inserted\",\n },\n },\n};\n\nexport function registerEmbedCss(\n loader?: { registerComponent: typeof registerComponent },\n customEmbedCssMeta?: ComponentMeta<EmbedCssProps>\n) {\n if (loader) {\n loader.registerComponent(EmbedCss, customEmbedCssMeta ?? embedCssMeta);\n } else {\n registerComponent(EmbedCss, customEmbedCssMeta ?? embedCssMeta);\n }\n}\n"],"names":["thisModule","DynamicElement","tag","className","children","propSelectors","props","computed","_useSelectors","createElement","DynamicText","selector","React","DynamicImage","loading","style","objectFit","src","DynamicRepeater","loopItemName","keySelector","data","finalData","_useSelector","map","item","index","_DataProvider","key","_applySelector","name","repeatedElement","dynamicRepeaterProps","type","description","defaultValue","dynamicRepeaterMeta","displayName","importName","importPath","dataProviderMeta","birthYear","profilePicture","dynamicPropsWithoutTag","defaultValueHint","dynamicProps","dynamicElementMeta","dynamicTextMeta","dynamicImageMeta","ensure","x","Error","Embed","code","hideInEditor","rootElt","useRef","useEffect","Array","from","current","querySelectorAll","forEach","oldScript","newScript","document","attributes","attr","setAttribute","value","appendChild","createTextNode","innerHTML","parentNode","replaceChild","ref","dangerouslySetInnerHTML","__html","embedMeta","lang","editOnly","defaultStyles","maxWidth","Iframe","preview","useContext","PlasmicCanvasContext","position","top","left","right","bottom","background","color","fontSize","fontFamily","fontWeight","display","alignItems","justifyContent","overflow","iframeMeta","width","height","useDirectionalIntersection","scrollDownThreshold","scrollUpThreshold","useState","revealed","setRevealed","IntersectionObserver","observer","entries","intersectionRatio","root","rootMargin","threshold","observe","disconnect","ScrollRevealer","intersectionRef","scrollRevealerMeta","Video","forwardRef","videoMeta","autoPlay","controls","playsInline","loop","muted","poster","preload","options","EmbedCss","css","embedCssMeta","console","warn","loader","customDataProviderMeta","registerComponent","customDynamicElementMeta","customDynamicImageMeta","customDynamicRepeaterMeta","customDynamicTextMeta","customEmbedMeta","customEmbedCssMeta","customIframeMeta","customScrollRevealerMeta","customVideoMeta","_useDataEnv"],"mappings":"+rBAcMA,EAAa,iDAsDHC,aAGdC,IAAAA,aAAM,QACNC,IAAAA,UACAC,IAAAA,SACAC,IAAAA,cACGC,SAEGC,EAAWC,eAAcH,UACxBI,gBAAcP,KACnBE,SAAAA,GACGE,EACAC,GACHJ,UAAWA,EAAY,IAAMI,EAASJ,sBAQ1BO,SACdC,IAAAA,SACAN,IAAAA,cACGC,gBAGDM,gBAACX,mBACKK,GACJD,mBAAoBA,GAAeD,SAAUO,oDAcnCE,SACdF,IAAAA,SACAN,IAAAA,cACGC,gBAGDM,gBAACX,iBACCC,IAAK,MACLY,QAAS,OACTC,MAAO,CACLC,UAAW,UAETV,GACJD,mBAAoBA,GAAeY,IAAKN,IAExCM,IAAI,oEAaMC,WACdd,IAAAA,SACAe,IAAAA,aACAC,IAAAA,YAEAC,IAAAA,KAGMC,iBAAYD,EAAAA,EAAQE,gBAJ1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B9F,GAG5B4F,EAAkB/H,QAAciI,EAAAA,EAA0B9F,6CArL5D0F,EACAK,GAEIL,EACFA,EAAOE,kBACL1H,QACA6H,EAAAA,EAA6B3G,GAG/BwG,EACE1H,QACA6H,EAAAA,EAA6B3G,yCAoIjCsG,EACAM,GAEIN,EACFA,EAAOE,kBACLlI,QACAsI,EAAAA,EAAyBjG,GAG3B6F,EAAkBlI,QAAasI,EAAAA,EAAyBjG,mCE/Q1D2F,EACAO,GAEIP,EACFA,EAAOE,kBAAkBxF,QAAO6F,EAAAA,EAAmBnE,GAEnD8D,EAAkBxF,QAAO6F,EAAAA,EAAmBnE,sCIxC9C4D,EACAQ,GAEIR,EACFA,EAAOE,kBAAkBP,QAAUa,EAAAA,EAAsBX,GAEzDK,EAAkBP,QAAUa,EAAAA,EAAsBX,oCHuBpDG,EACAS,GAEIT,EACFA,EAAOE,kBAAkBzD,QAAQgE,EAAAA,EAAoB9C,GAErDuC,EAAkBzD,QAAQgE,EAAAA,EAAoB9C,4CCyChDqC,EACAU,GAEIV,EACFA,EAAOE,kBACLrB,QACA6B,EAAAA,EAA4B3B,GAG9BmB,EACErB,QACA6B,EAAAA,EAA4B3B,mCCpChCiB,EACAW,GAEIX,EACFA,EAAOE,kBAAkBlB,QAAO2B,EAAAA,EAAmBzB,GAEnDgB,EAAkBlB,QAAO2B,EAAAA,EAAmBzB,oDL7CF,kBAC5CY,QAAQC,KAAK,gEACNa,+FApBuC,kBAC9Cd,QAAQC,KAAK,iEACNlH,4DAMyC,kBAChDiH,QAAQC,KACN,kEAEKjI"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { repeatedElement, PlasmicCanvasContext } from '@plasmicapp/host';
|
|
1
|
+
import { applySelector as applySelector$1, useSelector as useSelector$1, useSelectors as useSelectors$1, useDataEnv as useDataEnv$1, DataProvider as DataProvider$1, repeatedElement, PlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
2
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { createElement, useRef, useEffect, useContext, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
function _extends() {
|
|
6
6
|
_extends = Object.assign || function (target) {
|
|
@@ -35,138 +35,70 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
35
35
|
return target;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
42
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
43
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
44
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _arrayLikeToArray(arr, len) {
|
|
48
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
49
|
-
|
|
50
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
51
|
-
|
|
52
|
-
return arr2;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
56
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
57
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
58
|
-
|
|
59
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
60
|
-
if (it) o = it;
|
|
61
|
-
var i = 0;
|
|
62
|
-
return function () {
|
|
63
|
-
if (i >= o.length) return {
|
|
64
|
-
done: true
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
done: false,
|
|
68
|
-
value: o[i++]
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
var tuple = function tuple() {
|
|
77
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
|
-
args[_key] = arguments[_key];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return args;
|
|
82
|
-
};
|
|
83
|
-
function ensure(x) {
|
|
84
|
-
if (x === null || x === undefined) {
|
|
85
|
-
debugger;
|
|
86
|
-
throw new Error("Value must not be undefined or null");
|
|
87
|
-
} else {
|
|
88
|
-
return x;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var DataContext = /*#__PURE__*/createContext(undefined);
|
|
38
|
+
var _excluded = ["tag", "className", "children", "propSelectors"],
|
|
39
|
+
_excluded2 = ["selector", "propSelectors"],
|
|
40
|
+
_excluded3 = ["selector", "propSelectors"];
|
|
93
41
|
var thisModule = "@plasmicpkgs/plasmic-basic-components";
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var curData = rawData;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated This should be imported from @plasmicapp/host instead.
|
|
44
|
+
*/
|
|
100
45
|
|
|
101
|
-
|
|
102
|
-
|
|
46
|
+
var applySelector = function applySelector() {
|
|
47
|
+
console.warn("DEPRECATED: Import applySelector from @plasmicapp/host instead.");
|
|
48
|
+
return applySelector$1.apply(void 0, arguments);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated This should be imported from @plasmicapp/host instead.
|
|
52
|
+
*/
|
|
103
53
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
54
|
+
var useSelector = function useSelector() {
|
|
55
|
+
console.warn("DEPRECATED: Import useSelector from @plasmicapp/host instead.");
|
|
56
|
+
return useSelector$1.apply(void 0, arguments);
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated This should be imported from @plasmicapp/host instead.
|
|
60
|
+
*/
|
|
107
61
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (selectors === void 0) {
|
|
116
|
-
selectors = {};
|
|
117
|
-
}
|
|
62
|
+
var useSelectors = function useSelectors() {
|
|
63
|
+
console.warn("DEPRECATED: Import useSelectors from @plasmicapp/host instead.");
|
|
64
|
+
return useSelectors$1.apply(void 0, arguments);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated This should be imported from @plasmicapp/host instead.
|
|
68
|
+
*/
|
|
118
69
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
selector = _ref2[1];
|
|
127
|
-
return tuple(key, applySelector(rawData, selector));
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
function useDataEnv() {
|
|
131
|
-
return useContext(DataContext);
|
|
132
|
-
}
|
|
133
|
-
function DataProvider(_ref3) {
|
|
134
|
-
var _useDataEnv;
|
|
70
|
+
var useDataEnv = function useDataEnv() {
|
|
71
|
+
console.warn("DEPRECATED: Import useDataEnv from @plasmicapp/host instead.");
|
|
72
|
+
return useDataEnv$1.apply(void 0, arguments);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated This should be imported from @plasmicapp/host instead.
|
|
76
|
+
*/
|
|
135
77
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
78
|
+
var DataProvider = function DataProvider() {
|
|
79
|
+
console.warn("DEPRECATED: Import DataProvider from @plasmicapp/host instead.");
|
|
80
|
+
return DataProvider$1.apply(void 0, arguments);
|
|
81
|
+
};
|
|
82
|
+
function DynamicElement(_ref) {
|
|
83
|
+
var _ref$tag = _ref.tag,
|
|
84
|
+
tag = _ref$tag === void 0 ? "div" : _ref$tag,
|
|
85
|
+
className = _ref.className,
|
|
86
|
+
children = _ref.children,
|
|
87
|
+
propSelectors = _ref.propSelectors,
|
|
88
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
140
89
|
|
|
141
|
-
|
|
142
|
-
return React.createElement(React.Fragment, null, children);
|
|
143
|
-
} else {
|
|
144
|
-
var _extends2;
|
|
90
|
+
var computed = useSelectors$1(propSelectors);
|
|
145
91
|
|
|
146
|
-
return React.createElement(DataContext.Provider, {
|
|
147
|
-
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2))
|
|
148
|
-
}, children);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function DynamicElement(_ref4) {
|
|
152
|
-
var _ref4$tag = _ref4.tag,
|
|
153
|
-
tag = _ref4$tag === void 0 ? "div" : _ref4$tag,
|
|
154
|
-
className = _ref4.className,
|
|
155
|
-
children = _ref4.children,
|
|
156
|
-
propSelectors = _ref4.propSelectors,
|
|
157
|
-
props = _objectWithoutPropertiesLoose(_ref4, ["tag", "className", "children", "propSelectors"]);
|
|
158
|
-
|
|
159
|
-
var computed = useSelectors(propSelectors);
|
|
160
92
|
return createElement(tag, _extends({
|
|
161
93
|
children: children
|
|
162
94
|
}, props, computed, {
|
|
163
95
|
className: className + " " + computed.className
|
|
164
96
|
}));
|
|
165
97
|
}
|
|
166
|
-
function DynamicText(
|
|
167
|
-
var selector =
|
|
168
|
-
propSelectors =
|
|
169
|
-
props = _objectWithoutPropertiesLoose(
|
|
98
|
+
function DynamicText(_ref2) {
|
|
99
|
+
var selector = _ref2.selector,
|
|
100
|
+
propSelectors = _ref2.propSelectors,
|
|
101
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
170
102
|
|
|
171
103
|
return React.createElement(DynamicElement, Object.assign({}, props, {
|
|
172
104
|
propSelectors: _extends({}, propSelectors, {
|
|
@@ -174,10 +106,10 @@ function DynamicText(_ref5) {
|
|
|
174
106
|
})
|
|
175
107
|
}), "(DynamicText requires a selector)");
|
|
176
108
|
}
|
|
177
|
-
function DynamicImage(
|
|
178
|
-
var selector =
|
|
179
|
-
propSelectors =
|
|
180
|
-
props = _objectWithoutPropertiesLoose(
|
|
109
|
+
function DynamicImage(_ref3) {
|
|
110
|
+
var selector = _ref3.selector,
|
|
111
|
+
propSelectors = _ref3.propSelectors,
|
|
112
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
181
113
|
|
|
182
114
|
return React.createElement(DynamicElement, Object.assign({
|
|
183
115
|
tag: "img",
|
|
@@ -193,21 +125,21 @@ function DynamicImage(_ref6) {
|
|
|
193
125
|
src: "https://studio.plasmic.app/static/img/placeholder.png"
|
|
194
126
|
}));
|
|
195
127
|
}
|
|
196
|
-
function DynamicRepeater(
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
var children =
|
|
200
|
-
loopItemName =
|
|
201
|
-
keySelector =
|
|
202
|
-
selector =
|
|
203
|
-
data =
|
|
128
|
+
function DynamicRepeater(_ref4) {
|
|
129
|
+
var _ref5;
|
|
130
|
+
|
|
131
|
+
var children = _ref4.children,
|
|
132
|
+
loopItemName = _ref4.loopItemName,
|
|
133
|
+
keySelector = _ref4.keySelector,
|
|
134
|
+
selector = _ref4.selector,
|
|
135
|
+
data = _ref4.data;
|
|
204
136
|
// Defaults to an array of three items.
|
|
205
|
-
var finalData = (
|
|
137
|
+
var finalData = (_ref5 = data != null ? data : useSelector$1(selector)) != null ? _ref5 : [1, 2, 3];
|
|
206
138
|
return React.createElement(React.Fragment, null, finalData == null ? void 0 : finalData.map == null ? void 0 : finalData.map(function (item, index) {
|
|
207
|
-
var
|
|
139
|
+
var _applySelector2;
|
|
208
140
|
|
|
209
|
-
return React.createElement(DataProvider, {
|
|
210
|
-
key: (
|
|
141
|
+
return React.createElement(DataProvider$1, {
|
|
142
|
+
key: (_applySelector2 = applySelector$1(item, keySelector)) != null ? _applySelector2 : index,
|
|
211
143
|
name: loopItemName,
|
|
212
144
|
data: item
|
|
213
145
|
}, repeatedElement(index === 0, children));
|
|
@@ -283,9 +215,9 @@ var dataProviderMeta = {
|
|
|
283
215
|
};
|
|
284
216
|
function registerDataProvider(loader, customDataProviderMeta) {
|
|
285
217
|
if (loader) {
|
|
286
|
-
loader.registerComponent(DataProvider, customDataProviderMeta != null ? customDataProviderMeta : dataProviderMeta);
|
|
218
|
+
loader.registerComponent(DataProvider$1, customDataProviderMeta != null ? customDataProviderMeta : dataProviderMeta);
|
|
287
219
|
} else {
|
|
288
|
-
registerComponent(DataProvider, customDataProviderMeta != null ? customDataProviderMeta : dataProviderMeta);
|
|
220
|
+
registerComponent(DataProvider$1, customDataProviderMeta != null ? customDataProviderMeta : dataProviderMeta);
|
|
289
221
|
}
|
|
290
222
|
}
|
|
291
223
|
var dynamicPropsWithoutTag = {
|
|
@@ -360,6 +292,15 @@ function registerDynamicImage(loader, customDynamicImageMeta) {
|
|
|
360
292
|
}
|
|
361
293
|
}
|
|
362
294
|
|
|
295
|
+
function ensure(x) {
|
|
296
|
+
if (x === null || x === undefined) {
|
|
297
|
+
debugger;
|
|
298
|
+
throw new Error("Value must not be undefined or null");
|
|
299
|
+
} else {
|
|
300
|
+
return x;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
363
304
|
function Embed(_ref) {
|
|
364
305
|
var className = _ref.className,
|
|
365
306
|
code = _ref.code,
|
|
@@ -396,8 +337,10 @@ var embedMeta = {
|
|
|
396
337
|
importPath: "@plasmicpkgs/plasmic-basic-components",
|
|
397
338
|
props: {
|
|
398
339
|
code: {
|
|
399
|
-
type: "
|
|
400
|
-
|
|
340
|
+
type: "code",
|
|
341
|
+
lang: "html",
|
|
342
|
+
defaultValueHint: "<!-- HTML snippet -->",
|
|
343
|
+
description: "The HTML code to be embedded"
|
|
401
344
|
},
|
|
402
345
|
hideInEditor: {
|
|
403
346
|
type: "boolean",
|
|
@@ -656,13 +599,14 @@ function EmbedCss(_ref) {
|
|
|
656
599
|
}
|
|
657
600
|
var embedCssMeta = {
|
|
658
601
|
name: "hostless-embed-css",
|
|
659
|
-
displayName: "
|
|
602
|
+
displayName: "Embed Css",
|
|
660
603
|
importName: "EmbedCss",
|
|
661
604
|
importPath: "@plasmicpkgs/plasmic-basic-components",
|
|
662
605
|
props: {
|
|
663
606
|
css: {
|
|
664
|
-
type: "
|
|
665
|
-
|
|
607
|
+
type: "code",
|
|
608
|
+
lang: "css",
|
|
609
|
+
defaultValueHint: "/* CSS snippet */",
|
|
666
610
|
description: "CSS rules to be inserted"
|
|
667
611
|
}
|
|
668
612
|
}
|
|
@@ -675,5 +619,5 @@ function registerEmbedCss(loader, customEmbedCssMeta) {
|
|
|
675
619
|
}
|
|
676
620
|
}
|
|
677
621
|
|
|
678
|
-
export {
|
|
622
|
+
export { DataProvider, DynamicElement, DynamicImage, DynamicRepeater, DynamicText, Embed, EmbedCss, Iframe, ScrollRevealer, Video, applySelector, dataProviderMeta, dynamicElementMeta, dynamicImageMeta, dynamicRepeaterMeta, dynamicRepeaterProps, dynamicTextMeta, embedCssMeta, embedMeta, iframeMeta, registerDataProvider, registerDynamicElement, registerDynamicImage, registerDynamicRepeater, registerDynamicText, registerEmbed, registerEmbedCss, registerIframe, registerScrollRevealer, registerVideo, scrollRevealerMeta, useDataEnv, useDirectionalIntersection, useSelector, useSelectors, videoMeta };
|
|
679
623
|
//# sourceMappingURL=plasmic-basic-components.esm.js.map
|