@useupup/preact 3.3.0
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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/AudioUploader-2WITC5YR-4WGBUCEB.js +298 -0
- package/dist/AudioUploader-2WITC5YR-4WGBUCEB.js.map +1 -0
- package/dist/AudioUploader-2WITC5YR-GCKVRJAT.cjs +298 -0
- package/dist/AudioUploader-2WITC5YR-GCKVRJAT.cjs.map +1 -0
- package/dist/BoxUploader-VE5LRJ7M-CWGNYYJV.js +170 -0
- package/dist/BoxUploader-VE5LRJ7M-CWGNYYJV.js.map +1 -0
- package/dist/BoxUploader-VE5LRJ7M-IE7LYW5P.cjs +170 -0
- package/dist/BoxUploader-VE5LRJ7M-IE7LYW5P.cjs.map +1 -0
- package/dist/CameraUploader-WF5A6UIS-3KBW647M.cjs +628 -0
- package/dist/CameraUploader-WF5A6UIS-3KBW647M.cjs.map +1 -0
- package/dist/CameraUploader-WF5A6UIS-DONVXSEZ.js +628 -0
- package/dist/CameraUploader-WF5A6UIS-DONVXSEZ.js.map +1 -0
- package/dist/DropboxUploader-VMUYG3OP-7FKTLIIL.cjs +172 -0
- package/dist/DropboxUploader-VMUYG3OP-7FKTLIIL.cjs.map +1 -0
- package/dist/DropboxUploader-VMUYG3OP-DBUPHIG7.js +172 -0
- package/dist/DropboxUploader-VMUYG3OP-DBUPHIG7.js.map +1 -0
- package/dist/GoogleDriveUploader-YA56X3QR-FMS6MTYU.js +175 -0
- package/dist/GoogleDriveUploader-YA56X3QR-FMS6MTYU.js.map +1 -0
- package/dist/GoogleDriveUploader-YA56X3QR-OR3CQLX2.cjs +175 -0
- package/dist/GoogleDriveUploader-YA56X3QR-OR3CQLX2.cjs.map +1 -0
- package/dist/ImageEditorInline-N2NSAODR-QWXPP3ON.js +184 -0
- package/dist/ImageEditorInline-N2NSAODR-QWXPP3ON.js.map +1 -0
- package/dist/ImageEditorInline-N2NSAODR-ZVAM6EOA.cjs +184 -0
- package/dist/ImageEditorInline-N2NSAODR-ZVAM6EOA.cjs.map +1 -0
- package/dist/ImageEditorModal-CWKMDVPY-PRD43JPH.cjs +236 -0
- package/dist/ImageEditorModal-CWKMDVPY-PRD43JPH.cjs.map +1 -0
- package/dist/ImageEditorModal-CWKMDVPY-ZRPTYHYN.js +236 -0
- package/dist/ImageEditorModal-CWKMDVPY-ZRPTYHYN.js.map +1 -0
- package/dist/OneDriveUploader-I25Y6AJP-FVXK6RGT.js +173 -0
- package/dist/OneDriveUploader-I25Y6AJP-FVXK6RGT.js.map +1 -0
- package/dist/OneDriveUploader-I25Y6AJP-GBOBEJQR.cjs +173 -0
- package/dist/OneDriveUploader-I25Y6AJP-GBOBEJQR.cjs.map +1 -0
- package/dist/ScreenCaptureUploader-WKDO4S75-3TT6GNEN.js +286 -0
- package/dist/ScreenCaptureUploader-WKDO4S75-3TT6GNEN.js.map +1 -0
- package/dist/ScreenCaptureUploader-WKDO4S75-G7ADH264.cjs +286 -0
- package/dist/ScreenCaptureUploader-WKDO4S75-G7ADH264.cjs.map +1 -0
- package/dist/chunk-2XFVSPFN.cjs +293 -0
- package/dist/chunk-2XFVSPFN.cjs.map +1 -0
- package/dist/chunk-7JLN2HMZ.cjs +4296 -0
- package/dist/chunk-7JLN2HMZ.cjs.map +1 -0
- package/dist/chunk-BVMKSTAE.js +4296 -0
- package/dist/chunk-BVMKSTAE.js.map +1 -0
- package/dist/chunk-C7QBCXAH.js +39 -0
- package/dist/chunk-C7QBCXAH.js.map +1 -0
- package/dist/chunk-CR6CXFRP.js +195 -0
- package/dist/chunk-CR6CXFRP.js.map +1 -0
- package/dist/chunk-ETIJATY7.cjs +39 -0
- package/dist/chunk-ETIJATY7.cjs.map +1 -0
- package/dist/chunk-FH3LYESR.js +411 -0
- package/dist/chunk-FH3LYESR.js.map +1 -0
- package/dist/chunk-GKMTOOTQ.cjs +411 -0
- package/dist/chunk-GKMTOOTQ.cjs.map +1 -0
- package/dist/chunk-KHH3WHWU.js +74 -0
- package/dist/chunk-KHH3WHWU.js.map +1 -0
- package/dist/chunk-V2O5HRJV.cjs +74 -0
- package/dist/chunk-V2O5HRJV.cjs.map +1 -0
- package/dist/chunk-WCI3AGJV.js +831 -0
- package/dist/chunk-WCI3AGJV.js.map +1 -0
- package/dist/chunk-YWJHE7U4.cjs +195 -0
- package/dist/chunk-YWJHE7U4.cjs.map +1 -0
- package/dist/chunk-ZGWETRKI.js +293 -0
- package/dist/chunk-ZGWETRKI.js.map +1 -0
- package/dist/chunk-ZKZJ5PPP.cjs +831 -0
- package/dist/chunk-ZKZJ5PPP.cjs.map +1 -0
- package/dist/filerobot-bridge-52YH7W2M.cjs +92 -0
- package/dist/filerobot-bridge-52YH7W2M.cjs.map +1 -0
- package/dist/filerobot-bridge-ED4XMHX4.js +92 -0
- package/dist/filerobot-bridge-ED4XMHX4.js.map +1 -0
- package/dist/filerobot-island.css +97 -0
- package/dist/filerobot-island.css.map +1 -0
- package/dist/filerobot-island.js +77951 -0
- package/dist/filerobot-island.js.map +1 -0
- package/dist/index.cjs +5600 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5600 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +4 -0
- package/dist/tailwind-prefixed.css +2529 -0
- package/package.json +130 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../react/src/context/UploaderContext.ts","../../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/jsx-runtime/src/utils.js","../../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/src/constants.js","../../../node_modules/.pnpm/preact@10.29.8_preact-render-to-string@6.7.0/node_modules/preact/jsx-runtime/src/index.js"],"sourcesContent":["import {\r\n createContext,\r\n createElement,\r\n Dispatch,\r\n RefObject,\r\n SetStateAction,\r\n useContext,\r\n useMemo,\r\n type Context,\r\n type ReactNode,\r\n} from 'react'\r\nimport type { FileSource, ResolvedImageEditorOptions } from '@useupup/core'\r\nimport type { MotionMode } from '@useupup/core/internal'\r\nimport type {\r\n BaseContextUpload,\r\n BaseContextRuntime,\r\n BaseContextSource,\r\n BaseContextI18n,\r\n BaseContextFiles,\r\n BaseContextUploadControls,\r\n BaseContextView,\r\n BaseContextEditor,\r\n BaseContextTheme,\r\n} from '@useupup/core/internal'\r\nimport { UploadStatus } from '@useupup/core'\r\nimport type { UploaderProps, UploaderIcons } from '../shared/types'\r\n\r\nexport { UploadStatus }\r\n\r\nexport type ContextUpload = BaseContextUpload & {\r\n setUploadStatus: Dispatch<SetStateAction<UploadStatus>>\r\n}\r\n\r\n/** Like Required but also strips `| undefined` — necessary under exactOptionalPropertyTypes. */\r\ntype RequiredDefined<T, K extends keyof T> = {\r\n [P in K]-?: NonNullable<T[P]>\r\n}\r\n\r\nexport type ContextProps = RequiredDefined<\r\n UploaderProps,\r\n | 'sources'\r\n | 'isProcessing'\r\n | 'allowPreview'\r\n | 'mini'\r\n | 'onFileClick'\r\n | 'onIntegrationClick'\r\n | 'onFilesDragOver'\r\n | 'onFilesDragLeave'\r\n | 'onFilesDrop'\r\n | 'onWarn'\r\n | 'enablePaste'\r\n | 'onError'\r\n | 'icons'\r\n | 'showBranding'\r\n | 'quietCompletion'\r\n | 'className'\r\n | 'style'\r\n | 'disableDragDrop'\r\n> &\r\n Pick<UploaderProps, 'maxFileSize' | 'maxRetries' | 'resumable'> & {\r\n allowedFileTypes: string\r\n limit: number\r\n folderUploadAllowDrop: boolean\r\n folderPickerButtonVisible: boolean\r\n multiple: boolean\r\n icons: { [K in keyof UploaderIcons]-?: NonNullable<UploaderIcons[K]> }\r\n imageEditor: ResolvedImageEditorOptions\r\n }\r\n\r\nexport type ContextRuntime = BaseContextRuntime & {\r\n /** @deprecated Use openFilePicker() instead */\r\n inputRef: RefObject<HTMLInputElement | null>\r\n /** Resolved `data-motion` value ('on' | 'off') from the core motion gate. */\r\n motionMode: MotionMode\r\n}\r\n\r\nexport type ContextSource = Omit<BaseContextSource, 'setActiveSource'> & {\r\n setActiveSource: Dispatch<SetStateAction<FileSource | undefined>>\r\n}\r\n\r\nexport type ContextI18n = BaseContextI18n\r\n\r\nexport type ContextFiles = BaseContextFiles & {\r\n /** Transient: file ids currently playing their exit animation. Read by\r\n * FileList (hero) and FileItem (cards) to render `upup-fx-exit`. Sourced\r\n * from the core transient-UI store (deferred removal). */\r\n leavingFileIds: ReadonlySet<string>\r\n}\r\n\r\nexport type ContextUploadControls = Omit<\r\n BaseContextUploadControls,\r\n 'upload'\r\n> & {\r\n upload: ContextUpload\r\n}\r\n\r\nexport type ContextView = Omit<\r\n BaseContextView,\r\n 'isAddingMore' | 'setIsAddingMore' | 'setViewMode'\r\n> & {\r\n /** Add-more source overlay: source surface mounted above the dimmed,\r\n * still-mounted file list. Sourced from the core transient-UI store\r\n * (replaces the retired `isAddingMore` flag in the React canon). */\r\n sourceOverlayOpen: boolean\r\n /** Overlay is playing its reverse close-slide before it unmounts. */\r\n sourceOverlayClosing: boolean\r\n openSourceOverlay: () => void\r\n closeSourceOverlay: () => void\r\n /** Human provider label whose read-only picker just rejected an OS drop —\r\n * drives the drop-rejection toast. Null when no rejection is showing.\r\n * Auto-clears via the core transient-UI store's 3s window. */\r\n dropRejected: string | null\r\n /** Raise the drop-rejection toast for a read-only drive source (resolves the\r\n * provider label, then flags the core store). Wired to core's\r\n * DragDropController.onReadonlyDropRejected. */\r\n flagDriveDropRejected: (source: FileSource) => void\r\n setViewMode: Dispatch<SetStateAction<'grid' | 'list'>>\r\n}\r\n\r\nexport type ContextEditor = BaseContextEditor\r\n\r\nexport type ContextTheme = BaseContextTheme\r\n\r\nexport interface IUploaderContext\r\n extends\r\n ContextRuntime,\r\n ContextSource,\r\n ContextI18n,\r\n ContextFiles,\r\n ContextUploadControls,\r\n ContextView,\r\n ContextEditor {\r\n props: ContextProps\r\n theme: ContextTheme\r\n}\r\n\r\nconst UploaderContext = createContext<IUploaderContext | null>(null)\r\nconst RuntimeContext = createContext<ContextRuntime | null>(null)\r\nconst SourceContext = createContext<ContextSource | null>(null)\r\nconst I18nContext = createContext<ContextI18n | null>(null)\r\nconst FilesContext = createContext<ContextFiles | null>(null)\r\nconst UploadControlsContext = createContext<ContextUploadControls | null>(null)\r\nconst ViewContext = createContext<ContextView | null>(null)\r\nconst EditorContext = createContext<ContextEditor | null>(null)\r\nconst OptionsContext = createContext<ContextProps | null>(null)\r\nconst ThemeContext = createContext<ContextTheme | null>(null)\r\n\r\nfunction useContextOrThrow<T>(context: Context<T | null>, name: string): T {\r\n const value = useContext(context)\r\n if (!value) {\r\n throw new Error(`${name} must be used inside <UpupUploader />`)\r\n }\r\n return value\r\n}\r\n\r\nexport function UploaderContextProvider({\r\n value,\r\n children,\r\n}: {\r\n value: IUploaderContext\r\n children: ReactNode\r\n}): ReactNode {\r\n const runtime = useMemo<ContextRuntime>(\r\n () => ({\r\n core: value.core,\r\n orchestrator: value.orchestrator,\r\n mode: value.mode,\r\n serverUrl: value.serverUrl,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- runtime context must still expose inputRef for back-compat consumers; v3 removal tracked\r\n inputRef: value.inputRef,\r\n openFilePicker: value.openFilePicker,\r\n isOnline: value.isOnline,\r\n motionMode: value.motionMode,\r\n }),\r\n [\r\n value.core,\r\n value.orchestrator,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- see above\r\n value.inputRef,\r\n value.isOnline,\r\n value.motionMode,\r\n value.mode,\r\n value.openFilePicker,\r\n value.serverUrl,\r\n ],\r\n )\r\n\r\n const source = useMemo<ContextSource>(\r\n () => ({\r\n activeSource: value.activeSource,\r\n setActiveSource: value.setActiveSource,\r\n cloudDrives: value.cloudDrives,\r\n }),\r\n [value.activeSource, value.cloudDrives, value.setActiveSource],\r\n )\r\n\r\n const i18n = useMemo<ContextI18n>(\r\n () => ({\r\n translations: value.translations,\r\n translator: value.translator,\r\n lang: value.lang,\r\n dir: value.dir,\r\n }),\r\n [value.dir, value.lang, value.translations, value.translator],\r\n )\r\n\r\n const files = useMemo<ContextFiles>(\r\n () => ({\r\n files: value.files,\r\n leavingFileIds: value.leavingFileIds,\r\n setFiles: value.setFiles,\r\n replaceFiles: value.replaceFiles,\r\n resetState: value.resetState,\r\n uploadFiles: value.uploadFiles,\r\n handleFileRemove: value.handleFileRemove,\r\n }),\r\n [\r\n value.uploadFiles,\r\n value.replaceFiles,\r\n value.files,\r\n value.leavingFileIds,\r\n value.handleFileRemove,\r\n value.resetState,\r\n value.setFiles,\r\n ],\r\n )\r\n\r\n const uploadControls = useMemo<ContextUploadControls>(\r\n () => ({\r\n upload: value.upload,\r\n handleDone: value.handleDone,\r\n handleCancel: value.handleCancel,\r\n handlePause: value.handlePause,\r\n handleResume: value.handleResume,\r\n }),\r\n [\r\n value.handleCancel,\r\n value.handleDone,\r\n value.handlePause,\r\n value.handleResume,\r\n value.upload,\r\n ],\r\n )\r\n\r\n const view = useMemo<ContextView>(\r\n () => ({\r\n sourceOverlayOpen: value.sourceOverlayOpen,\r\n sourceOverlayClosing: value.sourceOverlayClosing,\r\n openSourceOverlay: value.openSourceOverlay,\r\n closeSourceOverlay: value.closeSourceOverlay,\r\n dropRejected: value.dropRejected,\r\n flagDriveDropRejected: value.flagDriveDropRejected,\r\n viewMode: value.viewMode,\r\n setViewMode: value.setViewMode,\r\n }),\r\n [\r\n value.sourceOverlayOpen,\r\n value.sourceOverlayClosing,\r\n value.openSourceOverlay,\r\n value.closeSourceOverlay,\r\n value.dropRejected,\r\n value.flagDriveDropRejected,\r\n value.setViewMode,\r\n value.viewMode,\r\n ],\r\n )\r\n\r\n const editor = useMemo<ContextEditor>(\r\n () => ({\r\n editingFile: value.editingFile,\r\n openImageEditor: value.openImageEditor,\r\n closeImageEditor: value.closeImageEditor,\r\n saveImageEdit: value.saveImageEdit,\r\n replaceFile: value.replaceFile,\r\n }),\r\n [\r\n value.closeImageEditor,\r\n value.editingFile,\r\n value.openImageEditor,\r\n value.replaceFile,\r\n value.saveImageEdit,\r\n ],\r\n )\r\n\r\n const options = useMemo(\r\n () => value.props,\r\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: memoize on granular prop fields, not the parent object identity (which changes every render)\r\n [\r\n value.props.allowedFileTypes,\r\n value.props.allowPreview,\r\n value.props.className,\r\n value.props.disableDragDrop,\r\n value.props.enablePaste,\r\n value.props.folderPickerButtonVisible,\r\n value.props.folderUploadAllowDrop,\r\n value.props.icons,\r\n value.props.imageEditor,\r\n value.props.isProcessing,\r\n value.props.limit,\r\n value.props.maxFileSize,\r\n value.props.maxRetries,\r\n value.props.mini,\r\n value.props.multiple,\r\n value.props.onError,\r\n value.props.onFileClick,\r\n value.props.onFilesDragLeave,\r\n value.props.onFilesDragOver,\r\n value.props.onFilesDrop,\r\n value.props.onWarn,\r\n value.props.onIntegrationClick,\r\n value.props.resumable,\r\n value.props.showBranding,\r\n value.props.quietCompletion,\r\n value.props.sources,\r\n value.props.style,\r\n ],\r\n )\r\n\r\n const theme = useMemo(\r\n () => value.theme,\r\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: memoize on granular theme fields, not the parent object identity (which changes every render)\r\n [\r\n value.theme.isDark,\r\n value.theme.resolved,\r\n value.theme.slotOverrides,\r\n value.theme.slots,\r\n value.theme.themeMode,\r\n value.theme.tokens,\r\n ],\r\n )\r\n\r\n return createElement(\r\n UploaderContext.Provider,\r\n { value },\r\n createElement(\r\n RuntimeContext.Provider,\r\n { value: runtime },\r\n createElement(\r\n SourceContext.Provider,\r\n { value: source },\r\n createElement(\r\n I18nContext.Provider,\r\n { value: i18n },\r\n createElement(\r\n FilesContext.Provider,\r\n { value: files },\r\n createElement(\r\n UploadControlsContext.Provider,\r\n { value: uploadControls },\r\n createElement(\r\n ViewContext.Provider,\r\n { value: view },\r\n createElement(\r\n EditorContext.Provider,\r\n { value: editor },\r\n createElement(\r\n OptionsContext.Provider,\r\n { value: options },\r\n createElement(\r\n ThemeContext.Provider,\r\n { value: theme },\r\n children,\r\n ),\r\n ),\r\n ),\r\n ),\r\n ),\r\n ),\r\n ),\r\n ),\r\n ),\r\n )\r\n}\r\n\r\n/** Compatibility aggregate hook. New internals should use the focused hooks. */\r\nexport function useUploaderContext(): IUploaderContext {\r\n return useContextOrThrow(UploaderContext, 'useUploaderContext')\r\n}\r\n\r\nexport function useUploaderRuntime(): ContextRuntime {\r\n return useContextOrThrow(RuntimeContext, 'useUploaderRuntime')\r\n}\r\n\r\nexport function useUploaderSource(): ContextSource {\r\n return useContextOrThrow(SourceContext, 'useUploaderSource')\r\n}\r\n\r\nexport function useUploaderI18n(): ContextI18n {\r\n return useContextOrThrow(I18nContext, 'useUploaderI18n')\r\n}\r\n\r\nexport function useUploaderFiles(): ContextFiles {\r\n return useContextOrThrow(FilesContext, 'useUploaderFiles')\r\n}\r\n\r\nexport function useUploaderUploadControls(): ContextUploadControls {\r\n return useContextOrThrow(UploadControlsContext, 'useUploaderUploadControls')\r\n}\r\n\r\nexport function useUploaderView(): ContextView {\r\n return useContextOrThrow(ViewContext, 'useUploaderView')\r\n}\r\n\r\nexport function useUploaderEditor(): ContextEditor {\r\n return useContextOrThrow(EditorContext, 'useUploaderEditor')\r\n}\r\n\r\nexport function useUploaderOptions(): ContextProps {\r\n return useContextOrThrow(OptionsContext, 'useUploaderOptions')\r\n}\r\n\r\nexport function useUploaderTheme(): ContextTheme {\r\n return useContextOrThrow(ThemeContext, 'useUploaderTheme')\r\n}\r\n\r\nexport default UploaderContext\r\n","const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n"],"mappings":";;;;;;;;AAAA;AAwBA,SAAS,oBAAoB;AAgH7B,IAAM,kBAAkB,cAAuC,IAAI;AACnE,IAAM,iBAAiB,cAAqC,IAAI;AAChE,IAAM,gBAAgB,cAAoC,IAAI;AAC9D,IAAM,cAAc,cAAkC,IAAI;AAC1D,IAAM,eAAe,cAAmC,IAAI;AAC5D,IAAM,wBAAwB,cAA4C,IAAI;AAC9E,IAAM,cAAc,cAAkC,IAAI;AAC1D,IAAM,gBAAgB,cAAoC,IAAI;AAC9D,IAAM,iBAAiB,cAAmC,IAAI;AAC9D,IAAM,eAAe,cAAmC,IAAI;AAE5D,SAAS,kBAAqB,SAA4B,MAAiB;AACvE,QAAM,YAAQ,kCAAW,OAAO;AAChC,MAAI,CAAC,OAAO;AACR,UAAM,IAAI,MAAM,GAAG,IAAI,uCAAuC;EAClE;AACA,SAAO;AACX;AAEO,SAAS,wBAAwB;EACpC;EACA;AACJ,GAGc;AACV,QAAM,cAAU;IACZ,OA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ACAC,OAAOO,GACPN,KAAAA,GACAI,KAAAA,GACAI,KAAW,MACXC,IAAS,MACTC,KAAQ,GACRC,KAAM,MACNC,KAAY,MACZC,aAAAA,QACAC,KAAAA,EAAaC,GACbC,KAAAA,IACAC,KAAQ,GACRf,UAAAA,GACAC,QAAAA,GAAAA;AAKD,MAAoB,cAAA,OAATL,OAAwBM,IAAMN,GAAKoB,cAC7C,MAAKb,KAAKD,EAAAA,YACLE,EAAgBD,CAAAA,MACnBC,EAAgBD,CAAAA,IAAKD,EAAIC,CAAAA;AAK5B,SADIc,EAAQZ,SAAOY,EAAQZ,MAAMA,CAAAA,GAC1BA;AACR;","names":["vnodeId","createVNode","type","props","key","isStaticChildren","__source","__self","ref","i","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","__v","vnodeId","__i","__u","defaultProps","options"]}
|