diff --git a/index.esm.js.map b/index.esm.js.map index 7768895..77566e3 100644 --- a/index.esm.js.map +++ b/index.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"index.esm.js","sources":["src/components/BaseComponent.tsx","src/components/SimpleComponents.tsx","src/components/Audio.tsx","src/components/Code.tsx","src/components/Iframe.tsx","src/components/Image.tsx","src/components/Link.tsx","src/components/Note.tsx","src/components/RevealProvider.tsx","src/components/RevealJS.tsx","src/components/Slide.tsx","src/components/Video.tsx","src/hooks/useReveal.ts","src/index.ts"],"sourcesContent":["import { createElement, DetailedHTMLFactory, ReactHTML } from 'react';\n\nexport interface BaseProps {\n id?: string;\n className?: string;\n fragment?: boolean;\n fragmentStyle?: string;\n fragmentIndex?: number;\n fitText?: boolean;\n}\n\nexport type MakeProps = Interface & BaseProps & SimpleComponentProps[0];\nexport type MakeFullProps = BaseProps & SimpleComponentProps[0];\n\nexport type SimpleComponent =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'blockquote'\n | 'div'\n | 'figcaption'\n | 'figure'\n | 'footer'\n | 'header'\n | 'li'\n | 'main'\n | 'ol'\n | 'p'\n | 'span'\n | 'ul';\n\nexport type SimpleComponentProps =\n ReactHTML[T] extends DetailedHTMLFactory\n ? [Attributes, Element]\n : never;\n\nexport interface RevealProps {\n component: SimpleComponent;\n}\n\nexport type Props = MakeProps;\n\nexport function getClassNameProps(\n baseProps: BaseProps\n) {\n const { className, fragment, fragmentStyle, fitText, ...props } = baseProps;\n const classes = className ? [className] : [];\n if (fragment) classes.push(\"fragment\");\n if (fitText) classes.push(\"r-fit-text\");\n if (fragmentStyle) classes.push(fragmentStyle);\n if (!classes.length) return props;\n return {\n ...props,\n className: classes.join(' '),\n }\n}\n\nexport function generateBaseComponent(component: T) {\n const Component = (props: MakeFullProps) =>\n BaseComponent({ ...props, component });\n Component.displayName = `${component[0].toUpperCase()}${component.slice(1)}`;\n return Component;\n}\n\nexport default function BaseComponent({\n component,\n id,\n fragmentIndex,\n children,\n ...props\n}: Props) {\n return createElement(component, {\n ...getClassNameProps(props),\n 'data-id': id,\n id,\n 'data-fragment-index': fragmentIndex,\n children,\n });\n}\n","import { generateBaseComponent, SimpleComponent } from \"./BaseComponent\";\n\nconst componentsToGenerate = {\n h1: generateBaseComponent('h1'),\n h2: generateBaseComponent('h2'),\n h3: generateBaseComponent('h3'),\n h4: generateBaseComponent('h4'),\n h5: generateBaseComponent('h5'),\n h6: generateBaseComponent('h6'),\n blockquote: generateBaseComponent('blockquote'),\n div: generateBaseComponent('div'),\n figcaption: generateBaseComponent('figcaption'),\n figure: generateBaseComponent('figure'),\n footer: generateBaseComponent('footer'),\n header: generateBaseComponent('header'),\n li: generateBaseComponent('li'),\n main: generateBaseComponent('main'),\n ol: generateBaseComponent('ol'),\n p: generateBaseComponent('p'),\n span: generateBaseComponent('span'),\n ul: generateBaseComponent('ul'),\n}\n\ntype SimpleComponentTypes = {\n [P in SimpleComponent]: Parameters[0];\n}\n\nexport type HProps = SimpleComponentTypes['h1'];\nexport type BlockQuoteProps = SimpleComponentTypes['blockquote'];\nexport type DivProps = SimpleComponentTypes['div'];\nexport type FigCaptionProps = SimpleComponentTypes['figcaption'];\nexport type FigureProps = SimpleComponentTypes['figure'];\nexport type FooterProps = SimpleComponentTypes['footer'];\nexport type HeaderProps = SimpleComponentTypes['header'];\nexport type LiProps = SimpleComponentTypes['li'];\nexport type MainProps = SimpleComponentTypes['main'];\nexport type OlProps = SimpleComponentTypes['ol'];\nexport type PProps = SimpleComponentTypes['p'];\nexport type SpanProps = SimpleComponentTypes['span'];\nexport type UlProps = SimpleComponentTypes['ul'];\n\nexport const H1 = componentsToGenerate.h1;\nexport const H2 = componentsToGenerate.h2;\nexport const H3 = componentsToGenerate.h3;\nexport const H4 = componentsToGenerate.h4;\nexport const H5 = componentsToGenerate.h5;\nexport const H6 = componentsToGenerate.h6;\nexport const BlockQuote = componentsToGenerate.blockquote;\nexport const Div = componentsToGenerate.div;\nexport const FigCaption = componentsToGenerate.figcaption;\nexport const Figure = componentsToGenerate.figure;\nexport const Footer = componentsToGenerate.footer;\nexport const Header = componentsToGenerate.header;\nexport const Li = componentsToGenerate.li;\nexport const Main = componentsToGenerate.main;\nexport const Ol = componentsToGenerate.ol;\nexport const P = componentsToGenerate.p;\nexport const Span = componentsToGenerate.span;\nexport const Ul = componentsToGenerate.ul;","import React from 'react';\nimport { getClassNameProps, MakeProps } from './BaseComponent';\n\nexport type AudioTypes =\n | '3gp'\n | 'aac'\n | 'flac'\n | 'mpg'\n | 'mpeg'\n | 'mp3'\n | 'mp4'\n | 'm4a'\n | 'oga'\n | 'ogg'\n | 'wav'\n | 'webm';\n\nconst formatMap: {\n [P in AudioTypes]: string;\n} = {\n '3gp': 'audio/3gp',\n aac: 'audio/aac',\n flac: 'audio/flac',\n mpg: 'audio/mpeg',\n mpeg: 'audio/mpeg',\n mp3: 'audio/mp3',\n mp4: 'audio/mp4',\n m4a: 'audio/mp4',\n oga: 'audio/ogg',\n ogg: 'audio/ogg',\n wav: 'audio/wav',\n webm: 'audio/webm',\n};\n\nexport interface AudioProps {\n autoplay?: boolean;\n controls?: boolean;\n lazy?: string;\n loop?: boolean;\n muted?: boolean;\n preload?: boolean;\n src: string;\n}\n\nfunction Audio({\n id,\n autoplay,\n className,\n controls,\n fragment,\n fragmentIndex,\n fragmentStyle,\n lazy,\n loop,\n muted,\n preload,\n src,\n ...props\n}: MakeProps) {\n if (Array.isArray(src)) {\n return (\n \n {src.map((element) => (\n \n ))}\n \n );\n }\n\n return (\n \n );\n}\n\nexport default Audio;\n","import React from 'react';\nimport { MakeProps, getClassNameProps } from './BaseComponent';\n\nexport interface CodeProps {\n children: { code: string };\n language?: string;\n escape?: boolean;\n lineNumbers?: string | true;\n noTrim?: boolean;\n autoAnimateId?: string;\n}\n\nfunction Code({\n id,\n children,\n language,\n escape,\n fragmentIndex,\n lineNumbers,\n noTrim,\n autoAnimateId,\n ...props\n}: MakeProps) {\n return (\n \n \n {children.code}\n \n \n );\n}\n\nexport default Code;\n","import React from 'react';\nimport { MakeProps, getClassNameProps } from './BaseComponent';\n\nexport interface IFrameProps {\n height?: number;\n lazy?: boolean;\n preload?: string;\n src: string;\n width?: number;\n}\n\nfunction IFrame({\n id,\n fragmentIndex,\n height,\n lazy,\n preload,\n src,\n width,\n ...props\n}: MakeProps) {\n return (\n \n );\n}\n\nexport default IFrame;\n","import React from 'react';\nimport { MakeProps, getClassNameProps } from './BaseComponent';\n\nexport interface ImageProps {\n alt?: string;\n height?: number;\n width?: number;\n src: string;\n}\n\nfunction Image({\n id,\n alt,\n fragmentIndex,\n height,\n src,\n width,\n ...props\n}: MakeProps) {\n return (\n \n );\n}\n\nexport default Image;\n","import React from 'react';\nimport { MakeProps, getClassNameProps } from './BaseComponent';\n\nexport interface LinkProps {\n children: React.ReactNode;\n href?: string;\n slide?: string | [string, string];\n}\n\nfunction Link({\n id,\n children,\n fragmentIndex,\n href,\n slide,\n ...props\n}: MakeProps) {\n return (\n \n {children}\n \n );\n}\n\nexport default Link;\n","import React from 'react';\nimport { MakeFullProps } from \"./BaseComponent\";\n\nexport type NoteProps = MakeFullProps<'aside'>;\n\nfunction Note(props: NoteProps) {\n return