react-smart-copy 1.27.1 → 1.29.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/README.md +3 -3
- package/dist/capture.d.cts +1 -1
- package/dist/capture.d.ts +1 -1
- package/dist/chunks/{clipboard-adapter-CUvmAcRE.d.cts → clipboard-adapter-B55TgPYd.d.ts} +8 -2
- package/dist/chunks/{clipboard-adapter-CdOzN135.d.ts → clipboard-adapter-C1_Mvpcc.d.cts} +8 -2
- package/dist/chunks/{clipboard-adapter-q_pp9q_x.cjs → clipboard-adapter-DYo79Fdq.cjs} +45 -6
- package/dist/chunks/clipboard-adapter-DYo79Fdq.cjs.map +1 -0
- package/dist/chunks/{clipboard-adapter-B-9XTqUp.js → clipboard-adapter-XS23N-Gg.js} +45 -6
- package/dist/chunks/clipboard-adapter-XS23N-Gg.js.map +1 -0
- package/dist/chunks/{copy-interceptor-BClcHS_P.d.cts → copy-interceptor-7NVPsNOK.d.cts} +2 -2
- package/dist/chunks/{copy-interceptor-D8c9EDnO.d.ts → copy-interceptor-CjF0OD8t.d.ts} +2 -2
- package/dist/chunks/{core-BrmkVinL.js → core-BRqanpvy.js} +60 -40
- package/dist/chunks/core-BRqanpvy.js.map +1 -0
- package/dist/chunks/{core-Bi4HUuRs.cjs → core-pOm_foSY.cjs} +59 -39
- package/dist/chunks/core-pOm_foSY.cjs.map +1 -0
- package/dist/chunks/{index-U91G1nS9.d.ts → index-DjqQGsNs.d.ts} +6 -5
- package/dist/chunks/{index-Ct2V52et.d.cts → index-uHZHddq0.d.cts} +6 -5
- package/dist/chunks/{paste-adapter-CfIDT3mp.d.ts → paste-adapter-D6OGeYxr.d.ts} +2 -2
- package/dist/chunks/{paste-adapter-B6eucH3E.d.cts → paste-adapter-DlwtI3qZ.d.cts} +2 -2
- package/dist/chunks/payload-5uJedhwz.js.map +1 -1
- package/dist/chunks/{payload-qkAWVXWA.d.cts → payload-BKDabKYy.d.cts} +15 -5
- package/dist/chunks/{payload-CcvSx_Hq.d.ts → payload-D7CJ6e2W.d.ts} +15 -5
- package/dist/chunks/payload-DjSSLonm.cjs.map +1 -1
- package/dist/chunks/{share-K1GpVQdH.cjs → share-0QnaCaoQ.cjs} +2 -2
- package/dist/chunks/{share-K1GpVQdH.cjs.map → share-0QnaCaoQ.cjs.map} +1 -1
- package/dist/chunks/{share-DQFF73gt.d.cts → share-BueRwILH.d.cts} +3 -3
- package/dist/chunks/{share-CW1SnFz5.js → share-BwgSAtH6.js} +2 -2
- package/dist/chunks/{share-CW1SnFz5.js.map → share-BwgSAtH6.js.map} +1 -1
- package/dist/chunks/{share-DMqvWz32.d.ts → share-DDIsWxbC.d.ts} +3 -3
- package/dist/code.d.cts +1 -1
- package/dist/code.d.ts +1 -1
- package/dist/color.d.cts +1 -1
- package/dist/color.d.ts +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.d.cts +6 -6
- package/dist/core.d.ts +6 -6
- package/dist/core.js +2 -2
- package/dist/email.d.cts +1 -1
- package/dist/email.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/link.d.cts +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/number.d.cts +1 -1
- package/dist/number.d.ts +1 -1
- package/dist/rich.d.cts +2 -2
- package/dist/rich.d.ts +2 -2
- package/dist/secrets.d.cts +1 -1
- package/dist/secrets.d.ts +1 -1
- package/dist/share.cjs +1 -1
- package/dist/share.d.cts +1 -1
- package/dist/share.d.ts +1 -1
- package/dist/share.js +1 -1
- package/dist/table.d.cts +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/package.json +8 -8
- package/dist/chunks/clipboard-adapter-B-9XTqUp.js.map +0 -1
- package/dist/chunks/clipboard-adapter-q_pp9q_x.cjs.map +0 -1
- package/dist/chunks/core-Bi4HUuRs.cjs.map +0 -1
- package/dist/chunks/core-BrmkVinL.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share-K1GpVQdH.cjs","names":["createCopyError","linkUrlResolver","toCopyError","cleanTitle","linkPayload","normalizePayload","validatePayload","createBrowserClipboardAdapter","describeCopyError"],"sources":["../../src/share/share.ts"],"sourcesContent":["import { createBrowserClipboardAdapter, type ClipboardAdapter } from '../core/clipboard-adapter';\nimport { createCopyError, describeCopyError, toCopyError, type CopyError, type CopyErrorType } from '../core/errors';\nimport { normalizePayload, validatePayload, type CopyInput, type CopyPayload } from '../core/payload';\nimport { cleanTitle, DEFAULT_LINK_TITLE_LENGTH, linkPayload } from '../link/payload';\nimport { linkUrlResolver, type LinkUrlOptions } from '../link/url';\n\n/** What to share: a link, a message, files, or any mix of them. */\nexport interface ShareContent {\n /** Validated like every link in this package: allowed schemes only, credentials removed. */\n readonly url?: string | URL;\n readonly title?: string;\n /** A message to share alongside (or instead of) the link. */\n readonly text?: string;\n /** Files for the share sheet, where the browser can share them (`navigator.canShare({ files })`). Never copied. */\n readonly files?: readonly File[];\n}\n\n/** The content after validation: what the share sheet or the clipboard receives. */\nexport interface ResolvedShare {\n readonly url: string | null;\n /** Cleaned of hidden characters; `null` when there is none. */\n readonly title: string | null;\n readonly text: string | null;\n readonly files: readonly File[];\n}\n\n/**\n * How to share:\n * - `auto` (default): the share sheet on phones and tablets, where people expect it; copy elsewhere.\n * - `native`: the share sheet wherever the browser has one (also desktop Safari, Edge and Chrome on Windows and macOS).\n * - `copy`: always copy.\n */\nexport type ShareMode = 'auto' | 'native' | 'copy';\n\nexport type ShareMethod = 'native' | 'copy';\n\n/** Structural view of what sharing needs from the browser; `window` by default. */\nexport interface ShareEnvironment {\n readonly navigator?: {\n readonly share?: (data: ShareData) => Promise<void>;\n readonly canShare?: (data: ShareData) => boolean;\n };\n readonly matchMedia?: (query: string) => { readonly matches: boolean };\n}\n\nexport interface ShareOptions extends LinkUrlOptions {\n /** Default `\"auto\"`. */\n readonly mode?: ShareMode;\n /** When the share sheet fails for a reason other than the user closing it, copy instead. Default `true`. */\n readonly fallback?: boolean;\n /**\n * What to copy. Default: a titled link (`linkPayload`) when there is a URL,\n * otherwise the text. Return a string or any copy payload.\n */\n readonly copy?: (content: ResolvedShare) => CopyInput;\n /** Default: the browser Clipboard API, as `useCopy` uses. */\n readonly adapter?: ClipboardAdapter;\n /** Default: `window`. For tests, webviews and other hosts. */\n readonly environment?: ShareEnvironment;\n /** Aborting it stops a copy in progress; the share sheet itself can only be closed by the user. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * Why the content was copied rather than shared: `preferred` (the mode chose\n * copy, as on desktop in `auto`), `unsupported` (no share sheet, or it can't\n * take this content) or `fallback` (the share sheet failed).\n */\nexport type CopyReason = 'preferred' | 'unsupported' | 'fallback';\n\n/** What `shareOrCopy` resolves to. It never rejects. */\nexport type ShareOutcome =\n | { readonly status: 'shared'; readonly method: 'native'; readonly content: ResolvedShare }\n | { readonly status: 'copied'; readonly method: 'copy'; readonly reason: CopyReason; readonly payload: CopyPayload; readonly content: ResolvedShare }\n /** The user closed the share sheet. Nothing to report. */\n | { readonly status: 'cancelled'; readonly method: 'native' }\n | { readonly status: 'error'; readonly method: ShareMethod; readonly error: CopyError };\n\n/** Phones and tablets: a touch screen is the main input and nothing hovers. */\nexport const TOUCH_FIRST = '(hover: none) and (pointer: coarse)';\n\nconst defaultEnvironment = (): ShareEnvironment | undefined => (typeof window === 'undefined' ? undefined : window);\n\nconst invalid = (message: string): CopyError => createCopyError('invalid-payload', message);\n\n/** Validates and cleans what to share, or returns the typed error for invalid input. */\nfunction resolveContent(content: ShareContent, options: LinkUrlOptions): ResolvedShare | CopyError {\n const value: unknown = content;\n if (typeof value !== 'object' || value === null) return invalid('Share content must be an object with a url, text or files.');\n const { url, title, text, files } = value as Record<string, unknown>;\n let href: string | null = null;\n if (url !== undefined && url !== null) {\n try {\n href = linkUrlResolver(options)(url as string | URL);\n } catch (error) {\n return toCopyError(error);\n }\n }\n if (title !== undefined && typeof title !== 'string') return invalid('`title` must be a string.');\n if (text !== undefined && typeof text !== 'string') return invalid('`text` must be a string.');\n const list: unknown = files ?? [];\n if (!Array.isArray(list) || !list.every((file: unknown) => typeof File !== 'undefined' && file instanceof File)) {\n return invalid('`files` must be a list of File objects.');\n }\n const cleanName = title === undefined ? '' : cleanTitle(title, DEFAULT_LINK_TITLE_LENGTH);\n const message = text === undefined || text.trim() === '' ? null : text;\n if (href === null && message === null && list.length === 0) return invalid('There is nothing to share: give a url, text or files.');\n return { url: href, title: cleanName === '' ? null : cleanName, text: message, files: list as File[] };\n}\n\n/** The `ShareData` the browser receives: only the fields that are set. */\nfunction shareData(content: ResolvedShare): ShareData {\n return {\n ...(content.url === null ? {} : { url: content.url }),\n ...(content.title === null ? {} : { title: content.title }),\n ...(content.text === null ? {} : { text: content.text }),\n ...(content.files.length === 0 ? {} : { files: [...content.files] }),\n };\n}\n\n/** Whether this browser can open its share sheet for `data`. */\nfunction canShareNatively(environment: ShareEnvironment | undefined, data: ShareData | null): boolean {\n const nav = environment?.navigator;\n if (typeof nav?.share !== 'function') return false;\n if (data === null) return true;\n // Without canShare (older Safari), only links and text can be shared.\n return typeof nav.canShare === 'function' ? nav.canShare(data) : data.files === undefined;\n}\n\nfunction isTouchFirst(environment: ShareEnvironment | undefined): boolean {\n return typeof environment?.matchMedia === 'function' && environment.matchMedia(TOUCH_FIRST).matches;\n}\n\nfunction resolveMode(mode: unknown): ShareMode | CopyError {\n if (mode === undefined) return 'auto';\n return mode === 'auto' || mode === 'native' || mode === 'copy' ? mode : invalid('`mode` must be \"auto\", \"native\" or \"copy\".');\n}\n\n/**\n * How {@link shareOrCopy} would share right now: `\"native\"` (the share sheet) or\n * `\"copy\"`. Use it to label the button (\"Share…\" or \"Copy link\"). Pass the\n * content when it has files, since not every share sheet takes them.\n */\nexport function shareMethod(options: Pick<ShareOptions, 'mode' | 'environment'> = {}, content?: ShareContent): ShareMethod {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string' || mode === 'copy') return 'copy';\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'auto' && !isTouchFirst(environment)) return 'copy';\n const resolved = content === undefined ? null : resolveContent(content, {});\n const data = resolved === null ? null : 'type' in resolved ? undefined : shareData(resolved);\n return data !== undefined && canShareNatively(environment, data) ? 'native' : 'copy';\n}\n\n/** The default copy: a titled link when there is a URL, otherwise the text (one of them is always set here). */\nfunction defaultCopy(content: ResolvedShare): CopyInput {\n if (content.url !== null) return linkPayload({ url: content.url, ...(content.title === null ? {} : { title: content.title }) });\n return content.text as string;\n}\n\nasync function copyContent(content: ResolvedShare, reason: CopyReason, options: ShareOptions): Promise<ShareOutcome> {\n if (options.copy === undefined && content.url === null && content.text === null) {\n return { status: 'error', method: 'copy', error: createCopyError('unsupported-format', 'Files can only be shared through a share sheet, and this browser has none for them.') };\n }\n let payload: CopyPayload;\n try {\n payload = normalizePayload((options.copy ?? defaultCopy)(content));\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n const problem = validatePayload(payload);\n if (problem !== null) return { status: 'error', method: 'copy', error: problem };\n if (options.signal?.aborted === true) return { status: 'error', method: 'copy', error: createCopyError('aborted', 'The share was aborted.') };\n try {\n await (options.adapter ?? createBrowserClipboardAdapter()).write(payload, options.signal === undefined ? undefined : { signal: options.signal });\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n return { status: 'copied', method: 'copy', reason, payload, content };\n}\n\n/**\n * Shares through the device's share sheet where people expect one, and copies a\n * titled link everywhere else. Call it directly in a click handler: the share\n * sheet needs the user's gesture.\n *\n * It never rejects. It resolves to `shared`, `copied` (with why), `cancelled`\n * (the user closed the share sheet: nothing to report) or `error` with a typed\n * {@link CopyError}.\n *\n * @example\n * button.addEventListener('click', async () => {\n * const outcome = await shareOrCopy({ url: location.href, title: document.title });\n * if (outcome.status === 'copied') toast('Link copied');\n * });\n */\nexport async function shareOrCopy(content: ShareContent, options: ShareOptions = {}): Promise<ShareOutcome> {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string') return { status: 'error', method: 'copy', error: mode };\n const resolved = resolveContent(content, options);\n if ('type' in resolved) return { status: 'error', method: 'copy', error: resolved };\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'copy' || (mode === 'auto' && !isTouchFirst(environment))) return copyContent(resolved, 'preferred', options);\n const data = shareData(resolved);\n if (!canShareNatively(environment, data)) return copyContent(resolved, 'unsupported', options);\n try {\n // Called before any await: the share sheet needs the click's user activation.\n await (environment?.navigator?.share as (data: ShareData) => Promise<void>)(data);\n return { status: 'shared', method: 'native', content: resolved };\n } catch (error) {\n if (readName(error) === 'AbortError') return { status: 'cancelled', method: 'native' };\n if (options.fallback === false) return { status: 'error', method: 'native', error: shareError(error) };\n return copyContent(resolved, 'fallback', options);\n }\n}\n\nfunction readName(error: unknown): string | undefined {\n const name: unknown = typeof error === 'object' && error !== null ? (error as { name?: unknown }).name : undefined;\n return typeof name === 'string' ? name : undefined;\n}\n\n/** Classifies a share sheet failure. */\nfunction shareError(cause: unknown): CopyError {\n switch (readName(cause)) {\n case 'NotAllowedError':\n return createCopyError('permission-denied', 'The share sheet was blocked: it needs a click, and an iframe needs the web-share permission.', cause);\n case 'InvalidStateError':\n return createCopyError('unknown', 'Another share sheet is already open.', cause);\n case 'DataError':\n case 'TypeError':\n return createCopyError('unsupported-format', 'The share sheet rejected this content.', cause);\n default:\n return toCopyError(cause);\n }\n}\n\nconst SHARE_DESCRIPTIONS: Partial<Readonly<Record<CopyErrorType, string>>> = {\n 'permission-denied': \"Sharing isn't allowed here.\",\n 'unsupported-format': \"This can't be shared from this browser.\",\n timeout: 'Sharing took too long. Try again.',\n};\n\n/**\n * Default English, user-facing sentence for a failed share: a share sheet\n * failure is described as sharing, a failed copy as copying. Replace for i18n.\n */\nexport function describeShareError(error: CopyError, method: ShareMethod): string {\n if (method === 'copy') return describeCopyError(error);\n return SHARE_DESCRIPTIONS[error.type] ??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CACtB,SAAS;AACX;;;;;AAMA,SAAgB,mBAAmB,OAAkB,QAA6B;CAChF,IAAI,WAAW,QAAQ,OAAOM,eAAAA,kBAAkB,KAAK;CACrD,OAAO,mBAAmB,MAAM,SAAS;AAC3C"}
|
|
1
|
+
{"version":3,"file":"share-0QnaCaoQ.cjs","names":["createCopyError","linkUrlResolver","toCopyError","cleanTitle","linkPayload","normalizePayload","validatePayload","createBrowserClipboardAdapter","describeCopyError"],"sources":["../../src/share/share.ts"],"sourcesContent":["import { createBrowserClipboardAdapter, type ClipboardAdapter } from '../core/clipboard-adapter';\nimport { createCopyError, describeCopyError, toCopyError, type CopyError, type CopyErrorType } from '../core/errors';\nimport { normalizePayload, validatePayload, type CopyInput, type CopyPayload } from '../core/payload';\nimport { cleanTitle, DEFAULT_LINK_TITLE_LENGTH, linkPayload } from '../link/payload';\nimport { linkUrlResolver, type LinkUrlOptions } from '../link/url';\n\n/** What to share: a link, a message, files, or any mix of them. */\nexport interface ShareContent {\n /** Validated like every link in this package: allowed schemes only, credentials removed. */\n readonly url?: string | URL;\n readonly title?: string;\n /** A message to share alongside (or instead of) the link. */\n readonly text?: string;\n /** Files for the share sheet, where the browser can share them (`navigator.canShare({ files })`). Never copied. */\n readonly files?: readonly File[];\n}\n\n/** The content after validation: what the share sheet or the clipboard receives. */\nexport interface ResolvedShare {\n readonly url: string | null;\n /** Cleaned of hidden characters; `null` when there is none. */\n readonly title: string | null;\n readonly text: string | null;\n readonly files: readonly File[];\n}\n\n/**\n * How to share:\n * - `auto` (default): the share sheet on phones and tablets, where people expect it; copy elsewhere.\n * - `native`: the share sheet wherever the browser has one (also desktop Safari, Edge and Chrome on Windows and macOS).\n * - `copy`: always copy.\n */\nexport type ShareMode = 'auto' | 'native' | 'copy';\n\nexport type ShareMethod = 'native' | 'copy';\n\n/** Structural view of what sharing needs from the browser; `window` by default. */\nexport interface ShareEnvironment {\n readonly navigator?: {\n readonly share?: (data: ShareData) => Promise<void>;\n readonly canShare?: (data: ShareData) => boolean;\n };\n readonly matchMedia?: (query: string) => { readonly matches: boolean };\n}\n\nexport interface ShareOptions extends LinkUrlOptions {\n /** Default `\"auto\"`. */\n readonly mode?: ShareMode;\n /** When the share sheet fails for a reason other than the user closing it, copy instead. Default `true`. */\n readonly fallback?: boolean;\n /**\n * What to copy. Default: a titled link (`linkPayload`) when there is a URL,\n * otherwise the text. Return a string or any copy payload.\n */\n readonly copy?: (content: ResolvedShare) => CopyInput;\n /** Default: the browser Clipboard API, as `useCopy` uses. */\n readonly adapter?: ClipboardAdapter;\n /** Default: `window`. For tests, webviews and other hosts. */\n readonly environment?: ShareEnvironment;\n /** Aborting it stops a copy in progress; the share sheet itself can only be closed by the user. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * Why the content was copied rather than shared: `preferred` (the mode chose\n * copy, as on desktop in `auto`), `unsupported` (no share sheet, or it can't\n * take this content) or `fallback` (the share sheet failed).\n */\nexport type CopyReason = 'preferred' | 'unsupported' | 'fallback';\n\n/** What `shareOrCopy` resolves to. It never rejects. */\nexport type ShareOutcome =\n | { readonly status: 'shared'; readonly method: 'native'; readonly content: ResolvedShare }\n | { readonly status: 'copied'; readonly method: 'copy'; readonly reason: CopyReason; readonly payload: CopyPayload; readonly content: ResolvedShare }\n /** The user closed the share sheet. Nothing to report. */\n | { readonly status: 'cancelled'; readonly method: 'native' }\n | { readonly status: 'error'; readonly method: ShareMethod; readonly error: CopyError };\n\n/** Phones and tablets: a touch screen is the main input and nothing hovers. */\nexport const TOUCH_FIRST = '(hover: none) and (pointer: coarse)';\n\nconst defaultEnvironment = (): ShareEnvironment | undefined => (typeof window === 'undefined' ? undefined : window);\n\nconst invalid = (message: string): CopyError => createCopyError('invalid-payload', message);\n\n/** Validates and cleans what to share, or returns the typed error for invalid input. */\nfunction resolveContent(content: ShareContent, options: LinkUrlOptions): ResolvedShare | CopyError {\n const value: unknown = content;\n if (typeof value !== 'object' || value === null) return invalid('Share content must be an object with a url, text or files.');\n const { url, title, text, files } = value as Record<string, unknown>;\n let href: string | null = null;\n if (url !== undefined && url !== null) {\n try {\n href = linkUrlResolver(options)(url as string | URL);\n } catch (error) {\n return toCopyError(error);\n }\n }\n if (title !== undefined && typeof title !== 'string') return invalid('`title` must be a string.');\n if (text !== undefined && typeof text !== 'string') return invalid('`text` must be a string.');\n const list: unknown = files ?? [];\n if (!Array.isArray(list) || !list.every((file: unknown) => typeof File !== 'undefined' && file instanceof File)) {\n return invalid('`files` must be a list of File objects.');\n }\n const cleanName = title === undefined ? '' : cleanTitle(title, DEFAULT_LINK_TITLE_LENGTH);\n const message = text === undefined || text.trim() === '' ? null : text;\n if (href === null && message === null && list.length === 0) return invalid('There is nothing to share: give a url, text or files.');\n return { url: href, title: cleanName === '' ? null : cleanName, text: message, files: list as File[] };\n}\n\n/** The `ShareData` the browser receives: only the fields that are set. */\nfunction shareData(content: ResolvedShare): ShareData {\n return {\n ...(content.url === null ? {} : { url: content.url }),\n ...(content.title === null ? {} : { title: content.title }),\n ...(content.text === null ? {} : { text: content.text }),\n ...(content.files.length === 0 ? {} : { files: [...content.files] }),\n };\n}\n\n/** Whether this browser can open its share sheet for `data`. */\nfunction canShareNatively(environment: ShareEnvironment | undefined, data: ShareData | null): boolean {\n const nav = environment?.navigator;\n if (typeof nav?.share !== 'function') return false;\n if (data === null) return true;\n // Without canShare (older Safari), only links and text can be shared.\n return typeof nav.canShare === 'function' ? nav.canShare(data) : data.files === undefined;\n}\n\nfunction isTouchFirst(environment: ShareEnvironment | undefined): boolean {\n return typeof environment?.matchMedia === 'function' && environment.matchMedia(TOUCH_FIRST).matches;\n}\n\nfunction resolveMode(mode: unknown): ShareMode | CopyError {\n if (mode === undefined) return 'auto';\n return mode === 'auto' || mode === 'native' || mode === 'copy' ? mode : invalid('`mode` must be \"auto\", \"native\" or \"copy\".');\n}\n\n/**\n * How {@link shareOrCopy} would share right now: `\"native\"` (the share sheet) or\n * `\"copy\"`. Use it to label the button (\"Share…\" or \"Copy link\"). Pass the\n * content when it has files, since not every share sheet takes them.\n */\nexport function shareMethod(options: Pick<ShareOptions, 'mode' | 'environment'> = {}, content?: ShareContent): ShareMethod {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string' || mode === 'copy') return 'copy';\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'auto' && !isTouchFirst(environment)) return 'copy';\n const resolved = content === undefined ? null : resolveContent(content, {});\n const data = resolved === null ? null : 'type' in resolved ? undefined : shareData(resolved);\n return data !== undefined && canShareNatively(environment, data) ? 'native' : 'copy';\n}\n\n/** The default copy: a titled link when there is a URL, otherwise the text (one of them is always set here). */\nfunction defaultCopy(content: ResolvedShare): CopyInput {\n if (content.url !== null) return linkPayload({ url: content.url, ...(content.title === null ? {} : { title: content.title }) });\n return content.text as string;\n}\n\nasync function copyContent(content: ResolvedShare, reason: CopyReason, options: ShareOptions): Promise<ShareOutcome> {\n if (options.copy === undefined && content.url === null && content.text === null) {\n return { status: 'error', method: 'copy', error: createCopyError('unsupported-format', 'Files can only be shared through a share sheet, and this browser has none for them.') };\n }\n let payload: CopyPayload;\n try {\n payload = normalizePayload((options.copy ?? defaultCopy)(content));\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n const problem = validatePayload(payload);\n if (problem !== null) return { status: 'error', method: 'copy', error: problem };\n if (options.signal?.aborted === true) return { status: 'error', method: 'copy', error: createCopyError('aborted', 'The share was aborted.') };\n try {\n await (options.adapter ?? createBrowserClipboardAdapter()).write(payload, options.signal === undefined ? undefined : { signal: options.signal });\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n return { status: 'copied', method: 'copy', reason, payload, content };\n}\n\n/**\n * Shares through the device's share sheet where people expect one, and copies a\n * titled link everywhere else. Call it directly in a click handler: the share\n * sheet needs the user's gesture.\n *\n * It never rejects. It resolves to `shared`, `copied` (with why), `cancelled`\n * (the user closed the share sheet: nothing to report) or `error` with a typed\n * {@link CopyError}.\n *\n * @example\n * button.addEventListener('click', async () => {\n * const outcome = await shareOrCopy({ url: location.href, title: document.title });\n * if (outcome.status === 'copied') toast('Link copied');\n * });\n */\nexport async function shareOrCopy(content: ShareContent, options: ShareOptions = {}): Promise<ShareOutcome> {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string') return { status: 'error', method: 'copy', error: mode };\n const resolved = resolveContent(content, options);\n if ('type' in resolved) return { status: 'error', method: 'copy', error: resolved };\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'copy' || (mode === 'auto' && !isTouchFirst(environment))) return copyContent(resolved, 'preferred', options);\n const data = shareData(resolved);\n if (!canShareNatively(environment, data)) return copyContent(resolved, 'unsupported', options);\n try {\n // Called before any await: the share sheet needs the click's user activation.\n await (environment?.navigator?.share as (data: ShareData) => Promise<void>)(data);\n return { status: 'shared', method: 'native', content: resolved };\n } catch (error) {\n if (readName(error) === 'AbortError') return { status: 'cancelled', method: 'native' };\n if (options.fallback === false) return { status: 'error', method: 'native', error: shareError(error) };\n return copyContent(resolved, 'fallback', options);\n }\n}\n\nfunction readName(error: unknown): string | undefined {\n const name: unknown = typeof error === 'object' && error !== null ? (error as { name?: unknown }).name : undefined;\n return typeof name === 'string' ? name : undefined;\n}\n\n/** Classifies a share sheet failure. */\nfunction shareError(cause: unknown): CopyError {\n switch (readName(cause)) {\n case 'NotAllowedError':\n return createCopyError('permission-denied', 'The share sheet was blocked: it needs a click, and an iframe needs the web-share permission.', cause);\n case 'InvalidStateError':\n return createCopyError('unknown', 'Another share sheet is already open.', cause);\n case 'DataError':\n case 'TypeError':\n return createCopyError('unsupported-format', 'The share sheet rejected this content.', cause);\n default:\n return toCopyError(cause);\n }\n}\n\nconst SHARE_DESCRIPTIONS: Partial<Readonly<Record<CopyErrorType, string>>> = {\n 'permission-denied': \"Sharing isn't allowed here.\",\n 'unsupported-format': \"This can't be shared from this browser.\",\n timeout: 'Sharing took too long. Try again.',\n};\n\n/**\n * Default English, user-facing sentence for a failed share: a share sheet\n * failure is described as sharing, a failed copy as copying. Replace for i18n.\n */\nexport function describeShareError(error: CopyError, method: ShareMethod): string {\n if (method === 'copy') return describeCopyError(error);\n return SHARE_DESCRIPTIONS[error.type] ?? \"Couldn't share. Try again.\";\n}\n"],"mappings":";;;;;;;;AA+EA,MAAa,cAAc;AAE3B,MAAM,2BAA0D,OAAO,WAAW,cAAc,KAAA,IAAY;AAE5G,MAAM,WAAW,YAA+BA,eAAAA,gBAAgB,mBAAmB,OAAO;;AAG1F,SAAS,eAAe,SAAuB,SAAoD;CACjG,MAAM,QAAiB;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,QAAQ,4DAA4D;CAC5H,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU;CACpC,IAAI,OAAsB;CAC1B,IAAI,QAAQ,KAAA,KAAa,QAAQ,MAC/B,IAAI;EACF,OAAOC,YAAAA,gBAAgB,OAAO,CAAC,CAAC,GAAmB;CACrD,SAAS,OAAO;EACd,OAAOC,eAAAA,YAAY,KAAK;CAC1B;CAEF,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO,QAAQ,2BAA2B;CAChG,IAAI,SAAS,KAAA,KAAa,OAAO,SAAS,UAAU,OAAO,QAAQ,0BAA0B;CAC7F,MAAM,OAAgB,SAAS,CAAC;CAChC,IAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,CAAC,KAAK,OAAO,SAAkB,OAAO,SAAS,eAAe,gBAAgB,IAAI,GAC5G,OAAO,QAAQ,yCAAyC;CAE1D,MAAM,YAAY,UAAU,KAAA,IAAY,KAAKC,kBAAAA,WAAW,OAAA,GAAgC;CACxF,MAAM,UAAU,SAAS,KAAA,KAAa,KAAK,KAAK,MAAM,KAAK,OAAO;CAClE,IAAI,SAAS,QAAQ,YAAY,QAAQ,KAAK,WAAW,GAAG,OAAO,QAAQ,uDAAuD;CAClI,OAAO;EAAE,KAAK;EAAM,OAAO,cAAc,KAAK,OAAO;EAAW,MAAM;EAAS,OAAO;CAAe;AACvG;;AAGA,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;EAC9F,SACE,OAAOE,eAAAA,YAAY,KAAK;CAC5B;AACF;AAEA,MAAM,qBAAuE;CAC3E,qBAAqB;CACrB,sBAAsB;CACtB,SAAS;AACX;;;;;AAMA,SAAgB,mBAAmB,OAAkB,QAA6B;CAChF,IAAI,WAAW,QAAQ,OAAOM,eAAAA,kBAAkB,KAAK;CACrD,OAAO,mBAAmB,MAAM,SAAS;AAC3C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { n as ClipboardAdapter } from "./clipboard-adapter-
|
|
2
|
+
import { b as CopyError, i as CopyPayload, r as CopyInput } from "./payload-BKDabKYy.cjs";
|
|
3
|
+
import { n as ClipboardAdapter } from "./clipboard-adapter-C1_Mvpcc.cjs";
|
|
4
4
|
import { r as LinkUrlOptions } from "./url-DWdElCT3.cjs";
|
|
5
5
|
//#region src/share/share.d.ts
|
|
6
6
|
/** What to share: a link, a message, files, or any mix of them. */
|
|
@@ -112,4 +112,4 @@ declare function shareOrCopy(content: ShareContent, options?: ShareOptions): Pro
|
|
|
112
112
|
declare function describeShareError(error: CopyError, method: ShareMethod): string;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { ShareMethod as a, ShareOutcome as c, shareOrCopy as d, ShareEnvironment as i, describeShareError as l, ResolvedShare as n, ShareMode as o, ShareContent as r, ShareOptions as s, CopyReason as t, shareMethod as u };
|
|
115
|
-
//# sourceMappingURL=share-
|
|
115
|
+
//# sourceMappingURL=share-BueRwILH.d.cts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { c as toCopyError, i as describeCopyError, r as createCopyError } from "./errors-CGcMvbhJ.js";
|
|
3
3
|
import { a as validatePayload, r as normalizePayload } from "./payload-5uJedhwz.js";
|
|
4
|
-
import { t as createBrowserClipboardAdapter } from "./clipboard-adapter-
|
|
4
|
+
import { t as createBrowserClipboardAdapter } from "./clipboard-adapter-XS23N-Gg.js";
|
|
5
5
|
import { i as linkUrlResolver } from "./url-zB_krkuF.js";
|
|
6
6
|
import { n as cleanTitle, r as linkPayload } from "./payload-DZnXoBmF.js";
|
|
7
7
|
//#region src/share/share.ts
|
|
@@ -205,4 +205,4 @@ function describeShareError(error, method) {
|
|
|
205
205
|
//#endregion
|
|
206
206
|
export { shareOrCopy as i, describeShareError as n, shareMethod as r, TOUCH_FIRST as t };
|
|
207
207
|
|
|
208
|
-
//# sourceMappingURL=share-
|
|
208
|
+
//# sourceMappingURL=share-BwgSAtH6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share-CW1SnFz5.js","names":[],"sources":["../../src/share/share.ts"],"sourcesContent":["import { createBrowserClipboardAdapter, type ClipboardAdapter } from '../core/clipboard-adapter';\nimport { createCopyError, describeCopyError, toCopyError, type CopyError, type CopyErrorType } from '../core/errors';\nimport { normalizePayload, validatePayload, type CopyInput, type CopyPayload } from '../core/payload';\nimport { cleanTitle, DEFAULT_LINK_TITLE_LENGTH, linkPayload } from '../link/payload';\nimport { linkUrlResolver, type LinkUrlOptions } from '../link/url';\n\n/** What to share: a link, a message, files, or any mix of them. */\nexport interface ShareContent {\n /** Validated like every link in this package: allowed schemes only, credentials removed. */\n readonly url?: string | URL;\n readonly title?: string;\n /** A message to share alongside (or instead of) the link. */\n readonly text?: string;\n /** Files for the share sheet, where the browser can share them (`navigator.canShare({ files })`). Never copied. */\n readonly files?: readonly File[];\n}\n\n/** The content after validation: what the share sheet or the clipboard receives. */\nexport interface ResolvedShare {\n readonly url: string | null;\n /** Cleaned of hidden characters; `null` when there is none. */\n readonly title: string | null;\n readonly text: string | null;\n readonly files: readonly File[];\n}\n\n/**\n * How to share:\n * - `auto` (default): the share sheet on phones and tablets, where people expect it; copy elsewhere.\n * - `native`: the share sheet wherever the browser has one (also desktop Safari, Edge and Chrome on Windows and macOS).\n * - `copy`: always copy.\n */\nexport type ShareMode = 'auto' | 'native' | 'copy';\n\nexport type ShareMethod = 'native' | 'copy';\n\n/** Structural view of what sharing needs from the browser; `window` by default. */\nexport interface ShareEnvironment {\n readonly navigator?: {\n readonly share?: (data: ShareData) => Promise<void>;\n readonly canShare?: (data: ShareData) => boolean;\n };\n readonly matchMedia?: (query: string) => { readonly matches: boolean };\n}\n\nexport interface ShareOptions extends LinkUrlOptions {\n /** Default `\"auto\"`. */\n readonly mode?: ShareMode;\n /** When the share sheet fails for a reason other than the user closing it, copy instead. Default `true`. */\n readonly fallback?: boolean;\n /**\n * What to copy. Default: a titled link (`linkPayload`) when there is a URL,\n * otherwise the text. Return a string or any copy payload.\n */\n readonly copy?: (content: ResolvedShare) => CopyInput;\n /** Default: the browser Clipboard API, as `useCopy` uses. */\n readonly adapter?: ClipboardAdapter;\n /** Default: `window`. For tests, webviews and other hosts. */\n readonly environment?: ShareEnvironment;\n /** Aborting it stops a copy in progress; the share sheet itself can only be closed by the user. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * Why the content was copied rather than shared: `preferred` (the mode chose\n * copy, as on desktop in `auto`), `unsupported` (no share sheet, or it can't\n * take this content) or `fallback` (the share sheet failed).\n */\nexport type CopyReason = 'preferred' | 'unsupported' | 'fallback';\n\n/** What `shareOrCopy` resolves to. It never rejects. */\nexport type ShareOutcome =\n | { readonly status: 'shared'; readonly method: 'native'; readonly content: ResolvedShare }\n | { readonly status: 'copied'; readonly method: 'copy'; readonly reason: CopyReason; readonly payload: CopyPayload; readonly content: ResolvedShare }\n /** The user closed the share sheet. Nothing to report. */\n | { readonly status: 'cancelled'; readonly method: 'native' }\n | { readonly status: 'error'; readonly method: ShareMethod; readonly error: CopyError };\n\n/** Phones and tablets: a touch screen is the main input and nothing hovers. */\nexport const TOUCH_FIRST = '(hover: none) and (pointer: coarse)';\n\nconst defaultEnvironment = (): ShareEnvironment | undefined => (typeof window === 'undefined' ? undefined : window);\n\nconst invalid = (message: string): CopyError => createCopyError('invalid-payload', message);\n\n/** Validates and cleans what to share, or returns the typed error for invalid input. */\nfunction resolveContent(content: ShareContent, options: LinkUrlOptions): ResolvedShare | CopyError {\n const value: unknown = content;\n if (typeof value !== 'object' || value === null) return invalid('Share content must be an object with a url, text or files.');\n const { url, title, text, files } = value as Record<string, unknown>;\n let href: string | null = null;\n if (url !== undefined && url !== null) {\n try {\n href = linkUrlResolver(options)(url as string | URL);\n } catch (error) {\n return toCopyError(error);\n }\n }\n if (title !== undefined && typeof title !== 'string') return invalid('`title` must be a string.');\n if (text !== undefined && typeof text !== 'string') return invalid('`text` must be a string.');\n const list: unknown = files ?? [];\n if (!Array.isArray(list) || !list.every((file: unknown) => typeof File !== 'undefined' && file instanceof File)) {\n return invalid('`files` must be a list of File objects.');\n }\n const cleanName = title === undefined ? '' : cleanTitle(title, DEFAULT_LINK_TITLE_LENGTH);\n const message = text === undefined || text.trim() === '' ? null : text;\n if (href === null && message === null && list.length === 0) return invalid('There is nothing to share: give a url, text or files.');\n return { url: href, title: cleanName === '' ? null : cleanName, text: message, files: list as File[] };\n}\n\n/** The `ShareData` the browser receives: only the fields that are set. */\nfunction shareData(content: ResolvedShare): ShareData {\n return {\n ...(content.url === null ? {} : { url: content.url }),\n ...(content.title === null ? {} : { title: content.title }),\n ...(content.text === null ? {} : { text: content.text }),\n ...(content.files.length === 0 ? {} : { files: [...content.files] }),\n };\n}\n\n/** Whether this browser can open its share sheet for `data`. */\nfunction canShareNatively(environment: ShareEnvironment | undefined, data: ShareData | null): boolean {\n const nav = environment?.navigator;\n if (typeof nav?.share !== 'function') return false;\n if (data === null) return true;\n // Without canShare (older Safari), only links and text can be shared.\n return typeof nav.canShare === 'function' ? nav.canShare(data) : data.files === undefined;\n}\n\nfunction isTouchFirst(environment: ShareEnvironment | undefined): boolean {\n return typeof environment?.matchMedia === 'function' && environment.matchMedia(TOUCH_FIRST).matches;\n}\n\nfunction resolveMode(mode: unknown): ShareMode | CopyError {\n if (mode === undefined) return 'auto';\n return mode === 'auto' || mode === 'native' || mode === 'copy' ? mode : invalid('`mode` must be \"auto\", \"native\" or \"copy\".');\n}\n\n/**\n * How {@link shareOrCopy} would share right now: `\"native\"` (the share sheet) or\n * `\"copy\"`. Use it to label the button (\"Share…\" or \"Copy link\"). Pass the\n * content when it has files, since not every share sheet takes them.\n */\nexport function shareMethod(options: Pick<ShareOptions, 'mode' | 'environment'> = {}, content?: ShareContent): ShareMethod {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string' || mode === 'copy') return 'copy';\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'auto' && !isTouchFirst(environment)) return 'copy';\n const resolved = content === undefined ? null : resolveContent(content, {});\n const data = resolved === null ? null : 'type' in resolved ? undefined : shareData(resolved);\n return data !== undefined && canShareNatively(environment, data) ? 'native' : 'copy';\n}\n\n/** The default copy: a titled link when there is a URL, otherwise the text (one of them is always set here). */\nfunction defaultCopy(content: ResolvedShare): CopyInput {\n if (content.url !== null) return linkPayload({ url: content.url, ...(content.title === null ? {} : { title: content.title }) });\n return content.text as string;\n}\n\nasync function copyContent(content: ResolvedShare, reason: CopyReason, options: ShareOptions): Promise<ShareOutcome> {\n if (options.copy === undefined && content.url === null && content.text === null) {\n return { status: 'error', method: 'copy', error: createCopyError('unsupported-format', 'Files can only be shared through a share sheet, and this browser has none for them.') };\n }\n let payload: CopyPayload;\n try {\n payload = normalizePayload((options.copy ?? defaultCopy)(content));\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n const problem = validatePayload(payload);\n if (problem !== null) return { status: 'error', method: 'copy', error: problem };\n if (options.signal?.aborted === true) return { status: 'error', method: 'copy', error: createCopyError('aborted', 'The share was aborted.') };\n try {\n await (options.adapter ?? createBrowserClipboardAdapter()).write(payload, options.signal === undefined ? undefined : { signal: options.signal });\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n return { status: 'copied', method: 'copy', reason, payload, content };\n}\n\n/**\n * Shares through the device's share sheet where people expect one, and copies a\n * titled link everywhere else. Call it directly in a click handler: the share\n * sheet needs the user's gesture.\n *\n * It never rejects. It resolves to `shared`, `copied` (with why), `cancelled`\n * (the user closed the share sheet: nothing to report) or `error` with a typed\n * {@link CopyError}.\n *\n * @example\n * button.addEventListener('click', async () => {\n * const outcome = await shareOrCopy({ url: location.href, title: document.title });\n * if (outcome.status === 'copied') toast('Link copied');\n * });\n */\nexport async function shareOrCopy(content: ShareContent, options: ShareOptions = {}): Promise<ShareOutcome> {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string') return { status: 'error', method: 'copy', error: mode };\n const resolved = resolveContent(content, options);\n if ('type' in resolved) return { status: 'error', method: 'copy', error: resolved };\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'copy' || (mode === 'auto' && !isTouchFirst(environment))) return copyContent(resolved, 'preferred', options);\n const data = shareData(resolved);\n if (!canShareNatively(environment, data)) return copyContent(resolved, 'unsupported', options);\n try {\n // Called before any await: the share sheet needs the click's user activation.\n await (environment?.navigator?.share as (data: ShareData) => Promise<void>)(data);\n return { status: 'shared', method: 'native', content: resolved };\n } catch (error) {\n if (readName(error) === 'AbortError') return { status: 'cancelled', method: 'native' };\n if (options.fallback === false) return { status: 'error', method: 'native', error: shareError(error) };\n return copyContent(resolved, 'fallback', options);\n }\n}\n\nfunction readName(error: unknown): string | undefined {\n const name: unknown = typeof error === 'object' && error !== null ? (error as { name?: unknown }).name : undefined;\n return typeof name === 'string' ? name : undefined;\n}\n\n/** Classifies a share sheet failure. */\nfunction shareError(cause: unknown): CopyError {\n switch (readName(cause)) {\n case 'NotAllowedError':\n return createCopyError('permission-denied', 'The share sheet was blocked: it needs a click, and an iframe needs the web-share permission.', cause);\n case 'InvalidStateError':\n return createCopyError('unknown', 'Another share sheet is already open.', cause);\n case 'DataError':\n case 'TypeError':\n return createCopyError('unsupported-format', 'The share sheet rejected this content.', cause);\n default:\n return toCopyError(cause);\n }\n}\n\nconst SHARE_DESCRIPTIONS: Partial<Readonly<Record<CopyErrorType, string>>> = {\n 'permission-denied': \"Sharing isn't allowed here.\",\n 'unsupported-format': \"This can't be shared from this browser.\",\n timeout: 'Sharing took too long. Try again.',\n};\n\n/**\n * Default English, user-facing sentence for a failed share: a share sheet\n * failure is described as sharing, a failed copy as copying. Replace for i18n.\n */\nexport function describeShareError(error: CopyError, method: ShareMethod): string {\n if (method === 'copy') return describeCopyError(error);\n return SHARE_DESCRIPTIONS[error.type] ?? \"Couldn't share. Try again.\";\n}\n"],"mappings":";;;;;;;;AA+EA,MAAa,cAAc;AAE3B,MAAM,2BAA0D,OAAO,WAAW,cAAc,KAAA,IAAY;AAE5G,MAAM,WAAW,YAA+B,gBAAgB,mBAAmB,OAAO;;AAG1F,SAAS,eAAe,SAAuB,SAAoD;CACjG,MAAM,QAAiB;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,QAAQ,4DAA4D;CAC5H,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU;CACpC,IAAI,OAAsB;CAC1B,IAAI,QAAQ,KAAA,KAAa,QAAQ,MAC/B,IAAI;EACF,OAAO,gBAAgB,OAAO,CAAC,CAAC,GAAmB;CACrD,SAAS,OAAO;EACd,OAAO,YAAY,KAAK;CAC1B;CAEF,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO,QAAQ,2BAA2B;CAChG,IAAI,SAAS,KAAA,KAAa,OAAO,SAAS,UAAU,OAAO,QAAQ,0BAA0B;CAC7F,MAAM,OAAgB,SAAS,CAAC;CAChC,IAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,CAAC,KAAK,OAAO,SAAkB,OAAO,SAAS,eAAe,gBAAgB,IAAI,GAC5G,OAAO,QAAQ,yCAAyC;CAE1D,MAAM,YAAY,UAAU,KAAA,IAAY,KAAK,WAAW,OAAA,GAAgC;CACxF,MAAM,UAAU,SAAS,KAAA,KAAa,KAAK,KAAK,MAAM,KAAK,OAAO;CAClE,IAAI,SAAS,QAAQ,YAAY,QAAQ,KAAK,WAAW,GAAG,OAAO,QAAQ,uDAAuD;CAClI,OAAO;EAAE,KAAK;EAAM,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;CAC5B;AACF;AAEA,MAAM,qBAAuE;CAC3E,qBAAqB;CACrB,sBAAsB;CACtB,SAAS;AACX;;;;;AAMA,SAAgB,mBAAmB,OAAkB,QAA6B;CAChF,IAAI,WAAW,QAAQ,OAAO,kBAAkB,KAAK;CACrD,OAAO,mBAAmB,MAAM,SAAS;AAC3C"}
|
|
1
|
+
{"version":3,"file":"share-BwgSAtH6.js","names":[],"sources":["../../src/share/share.ts"],"sourcesContent":["import { createBrowserClipboardAdapter, type ClipboardAdapter } from '../core/clipboard-adapter';\nimport { createCopyError, describeCopyError, toCopyError, type CopyError, type CopyErrorType } from '../core/errors';\nimport { normalizePayload, validatePayload, type CopyInput, type CopyPayload } from '../core/payload';\nimport { cleanTitle, DEFAULT_LINK_TITLE_LENGTH, linkPayload } from '../link/payload';\nimport { linkUrlResolver, type LinkUrlOptions } from '../link/url';\n\n/** What to share: a link, a message, files, or any mix of them. */\nexport interface ShareContent {\n /** Validated like every link in this package: allowed schemes only, credentials removed. */\n readonly url?: string | URL;\n readonly title?: string;\n /** A message to share alongside (or instead of) the link. */\n readonly text?: string;\n /** Files for the share sheet, where the browser can share them (`navigator.canShare({ files })`). Never copied. */\n readonly files?: readonly File[];\n}\n\n/** The content after validation: what the share sheet or the clipboard receives. */\nexport interface ResolvedShare {\n readonly url: string | null;\n /** Cleaned of hidden characters; `null` when there is none. */\n readonly title: string | null;\n readonly text: string | null;\n readonly files: readonly File[];\n}\n\n/**\n * How to share:\n * - `auto` (default): the share sheet on phones and tablets, where people expect it; copy elsewhere.\n * - `native`: the share sheet wherever the browser has one (also desktop Safari, Edge and Chrome on Windows and macOS).\n * - `copy`: always copy.\n */\nexport type ShareMode = 'auto' | 'native' | 'copy';\n\nexport type ShareMethod = 'native' | 'copy';\n\n/** Structural view of what sharing needs from the browser; `window` by default. */\nexport interface ShareEnvironment {\n readonly navigator?: {\n readonly share?: (data: ShareData) => Promise<void>;\n readonly canShare?: (data: ShareData) => boolean;\n };\n readonly matchMedia?: (query: string) => { readonly matches: boolean };\n}\n\nexport interface ShareOptions extends LinkUrlOptions {\n /** Default `\"auto\"`. */\n readonly mode?: ShareMode;\n /** When the share sheet fails for a reason other than the user closing it, copy instead. Default `true`. */\n readonly fallback?: boolean;\n /**\n * What to copy. Default: a titled link (`linkPayload`) when there is a URL,\n * otherwise the text. Return a string or any copy payload.\n */\n readonly copy?: (content: ResolvedShare) => CopyInput;\n /** Default: the browser Clipboard API, as `useCopy` uses. */\n readonly adapter?: ClipboardAdapter;\n /** Default: `window`. For tests, webviews and other hosts. */\n readonly environment?: ShareEnvironment;\n /** Aborting it stops a copy in progress; the share sheet itself can only be closed by the user. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * Why the content was copied rather than shared: `preferred` (the mode chose\n * copy, as on desktop in `auto`), `unsupported` (no share sheet, or it can't\n * take this content) or `fallback` (the share sheet failed).\n */\nexport type CopyReason = 'preferred' | 'unsupported' | 'fallback';\n\n/** What `shareOrCopy` resolves to. It never rejects. */\nexport type ShareOutcome =\n | { readonly status: 'shared'; readonly method: 'native'; readonly content: ResolvedShare }\n | { readonly status: 'copied'; readonly method: 'copy'; readonly reason: CopyReason; readonly payload: CopyPayload; readonly content: ResolvedShare }\n /** The user closed the share sheet. Nothing to report. */\n | { readonly status: 'cancelled'; readonly method: 'native' }\n | { readonly status: 'error'; readonly method: ShareMethod; readonly error: CopyError };\n\n/** Phones and tablets: a touch screen is the main input and nothing hovers. */\nexport const TOUCH_FIRST = '(hover: none) and (pointer: coarse)';\n\nconst defaultEnvironment = (): ShareEnvironment | undefined => (typeof window === 'undefined' ? undefined : window);\n\nconst invalid = (message: string): CopyError => createCopyError('invalid-payload', message);\n\n/** Validates and cleans what to share, or returns the typed error for invalid input. */\nfunction resolveContent(content: ShareContent, options: LinkUrlOptions): ResolvedShare | CopyError {\n const value: unknown = content;\n if (typeof value !== 'object' || value === null) return invalid('Share content must be an object with a url, text or files.');\n const { url, title, text, files } = value as Record<string, unknown>;\n let href: string | null = null;\n if (url !== undefined && url !== null) {\n try {\n href = linkUrlResolver(options)(url as string | URL);\n } catch (error) {\n return toCopyError(error);\n }\n }\n if (title !== undefined && typeof title !== 'string') return invalid('`title` must be a string.');\n if (text !== undefined && typeof text !== 'string') return invalid('`text` must be a string.');\n const list: unknown = files ?? [];\n if (!Array.isArray(list) || !list.every((file: unknown) => typeof File !== 'undefined' && file instanceof File)) {\n return invalid('`files` must be a list of File objects.');\n }\n const cleanName = title === undefined ? '' : cleanTitle(title, DEFAULT_LINK_TITLE_LENGTH);\n const message = text === undefined || text.trim() === '' ? null : text;\n if (href === null && message === null && list.length === 0) return invalid('There is nothing to share: give a url, text or files.');\n return { url: href, title: cleanName === '' ? null : cleanName, text: message, files: list as File[] };\n}\n\n/** The `ShareData` the browser receives: only the fields that are set. */\nfunction shareData(content: ResolvedShare): ShareData {\n return {\n ...(content.url === null ? {} : { url: content.url }),\n ...(content.title === null ? {} : { title: content.title }),\n ...(content.text === null ? {} : { text: content.text }),\n ...(content.files.length === 0 ? {} : { files: [...content.files] }),\n };\n}\n\n/** Whether this browser can open its share sheet for `data`. */\nfunction canShareNatively(environment: ShareEnvironment | undefined, data: ShareData | null): boolean {\n const nav = environment?.navigator;\n if (typeof nav?.share !== 'function') return false;\n if (data === null) return true;\n // Without canShare (older Safari), only links and text can be shared.\n return typeof nav.canShare === 'function' ? nav.canShare(data) : data.files === undefined;\n}\n\nfunction isTouchFirst(environment: ShareEnvironment | undefined): boolean {\n return typeof environment?.matchMedia === 'function' && environment.matchMedia(TOUCH_FIRST).matches;\n}\n\nfunction resolveMode(mode: unknown): ShareMode | CopyError {\n if (mode === undefined) return 'auto';\n return mode === 'auto' || mode === 'native' || mode === 'copy' ? mode : invalid('`mode` must be \"auto\", \"native\" or \"copy\".');\n}\n\n/**\n * How {@link shareOrCopy} would share right now: `\"native\"` (the share sheet) or\n * `\"copy\"`. Use it to label the button (\"Share…\" or \"Copy link\"). Pass the\n * content when it has files, since not every share sheet takes them.\n */\nexport function shareMethod(options: Pick<ShareOptions, 'mode' | 'environment'> = {}, content?: ShareContent): ShareMethod {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string' || mode === 'copy') return 'copy';\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'auto' && !isTouchFirst(environment)) return 'copy';\n const resolved = content === undefined ? null : resolveContent(content, {});\n const data = resolved === null ? null : 'type' in resolved ? undefined : shareData(resolved);\n return data !== undefined && canShareNatively(environment, data) ? 'native' : 'copy';\n}\n\n/** The default copy: a titled link when there is a URL, otherwise the text (one of them is always set here). */\nfunction defaultCopy(content: ResolvedShare): CopyInput {\n if (content.url !== null) return linkPayload({ url: content.url, ...(content.title === null ? {} : { title: content.title }) });\n return content.text as string;\n}\n\nasync function copyContent(content: ResolvedShare, reason: CopyReason, options: ShareOptions): Promise<ShareOutcome> {\n if (options.copy === undefined && content.url === null && content.text === null) {\n return { status: 'error', method: 'copy', error: createCopyError('unsupported-format', 'Files can only be shared through a share sheet, and this browser has none for them.') };\n }\n let payload: CopyPayload;\n try {\n payload = normalizePayload((options.copy ?? defaultCopy)(content));\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n const problem = validatePayload(payload);\n if (problem !== null) return { status: 'error', method: 'copy', error: problem };\n if (options.signal?.aborted === true) return { status: 'error', method: 'copy', error: createCopyError('aborted', 'The share was aborted.') };\n try {\n await (options.adapter ?? createBrowserClipboardAdapter()).write(payload, options.signal === undefined ? undefined : { signal: options.signal });\n } catch (error) {\n return { status: 'error', method: 'copy', error: toCopyError(error) };\n }\n return { status: 'copied', method: 'copy', reason, payload, content };\n}\n\n/**\n * Shares through the device's share sheet where people expect one, and copies a\n * titled link everywhere else. Call it directly in a click handler: the share\n * sheet needs the user's gesture.\n *\n * It never rejects. It resolves to `shared`, `copied` (with why), `cancelled`\n * (the user closed the share sheet: nothing to report) or `error` with a typed\n * {@link CopyError}.\n *\n * @example\n * button.addEventListener('click', async () => {\n * const outcome = await shareOrCopy({ url: location.href, title: document.title });\n * if (outcome.status === 'copied') toast('Link copied');\n * });\n */\nexport async function shareOrCopy(content: ShareContent, options: ShareOptions = {}): Promise<ShareOutcome> {\n const mode = resolveMode(options.mode);\n if (typeof mode !== 'string') return { status: 'error', method: 'copy', error: mode };\n const resolved = resolveContent(content, options);\n if ('type' in resolved) return { status: 'error', method: 'copy', error: resolved };\n const environment = options.environment ?? defaultEnvironment();\n if (mode === 'copy' || (mode === 'auto' && !isTouchFirst(environment))) return copyContent(resolved, 'preferred', options);\n const data = shareData(resolved);\n if (!canShareNatively(environment, data)) return copyContent(resolved, 'unsupported', options);\n try {\n // Called before any await: the share sheet needs the click's user activation.\n await (environment?.navigator?.share as (data: ShareData) => Promise<void>)(data);\n return { status: 'shared', method: 'native', content: resolved };\n } catch (error) {\n if (readName(error) === 'AbortError') return { status: 'cancelled', method: 'native' };\n if (options.fallback === false) return { status: 'error', method: 'native', error: shareError(error) };\n return copyContent(resolved, 'fallback', options);\n }\n}\n\nfunction readName(error: unknown): string | undefined {\n const name: unknown = typeof error === 'object' && error !== null ? (error as { name?: unknown }).name : undefined;\n return typeof name === 'string' ? name : undefined;\n}\n\n/** Classifies a share sheet failure. */\nfunction shareError(cause: unknown): CopyError {\n switch (readName(cause)) {\n case 'NotAllowedError':\n return createCopyError('permission-denied', 'The share sheet was blocked: it needs a click, and an iframe needs the web-share permission.', cause);\n case 'InvalidStateError':\n return createCopyError('unknown', 'Another share sheet is already open.', cause);\n case 'DataError':\n case 'TypeError':\n return createCopyError('unsupported-format', 'The share sheet rejected this content.', cause);\n default:\n return toCopyError(cause);\n }\n}\n\nconst SHARE_DESCRIPTIONS: Partial<Readonly<Record<CopyErrorType, string>>> = {\n 'permission-denied': \"Sharing isn't allowed here.\",\n 'unsupported-format': \"This can't be shared from this browser.\",\n timeout: 'Sharing took too long. Try again.',\n};\n\n/**\n * Default English, user-facing sentence for a failed share: a share sheet\n * failure is described as sharing, a failed copy as copying. Replace for i18n.\n */\nexport function describeShareError(error: CopyError, method: ShareMethod): string {\n if (method === 'copy') return describeCopyError(error);\n return SHARE_DESCRIPTIONS[error.type] ?? \"Couldn't share. Try again.\";\n}\n"],"mappings":";;;;;;;;AA+EA,MAAa,cAAc;AAE3B,MAAM,2BAA0D,OAAO,WAAW,cAAc,KAAA,IAAY;AAE5G,MAAM,WAAW,YAA+B,gBAAgB,mBAAmB,OAAO;;AAG1F,SAAS,eAAe,SAAuB,SAAoD;CACjG,MAAM,QAAiB;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,QAAQ,4DAA4D;CAC5H,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU;CACpC,IAAI,OAAsB;CAC1B,IAAI,QAAQ,KAAA,KAAa,QAAQ,MAC/B,IAAI;EACF,OAAO,gBAAgB,OAAO,CAAC,CAAC,GAAmB;CACrD,SAAS,OAAO;EACd,OAAO,YAAY,KAAK;CAC1B;CAEF,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO,QAAQ,2BAA2B;CAChG,IAAI,SAAS,KAAA,KAAa,OAAO,SAAS,UAAU,OAAO,QAAQ,0BAA0B;CAC7F,MAAM,OAAgB,SAAS,CAAC;CAChC,IAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,CAAC,KAAK,OAAO,SAAkB,OAAO,SAAS,eAAe,gBAAgB,IAAI,GAC5G,OAAO,QAAQ,yCAAyC;CAE1D,MAAM,YAAY,UAAU,KAAA,IAAY,KAAK,WAAW,OAAA,GAAgC;CACxF,MAAM,UAAU,SAAS,KAAA,KAAa,KAAK,KAAK,MAAM,KAAK,OAAO;CAClE,IAAI,SAAS,QAAQ,YAAY,QAAQ,KAAK,WAAW,GAAG,OAAO,QAAQ,uDAAuD;CAClI,OAAO;EAAE,KAAK;EAAM,OAAO,cAAc,KAAK,OAAO;EAAW,MAAM;EAAS,OAAO;CAAe;AACvG;;AAGA,SAAS,UAAU,SAAmC;CACpD,OAAO;EACL,GAAI,QAAQ,QAAQ,OAAO,CA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,WAAW,QAAQ,OAAO,kBAAkB,KAAK;CACrD,OAAO,mBAAmB,MAAM,SAAS;AAC3C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { n as ClipboardAdapter } from "./clipboard-adapter-
|
|
2
|
+
import { b as CopyError, i as CopyPayload, r as CopyInput } from "./payload-D7CJ6e2W.js";
|
|
3
|
+
import { n as ClipboardAdapter } from "./clipboard-adapter-B55TgPYd.js";
|
|
4
4
|
import { r as LinkUrlOptions } from "./url-DWdElCT3.js";
|
|
5
5
|
//#region src/share/share.d.ts
|
|
6
6
|
/** What to share: a link, a message, files, or any mix of them. */
|
|
@@ -112,4 +112,4 @@ declare function shareOrCopy(content: ShareContent, options?: ShareOptions): Pro
|
|
|
112
112
|
declare function describeShareError(error: CopyError, method: ShareMethod): string;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { ShareMethod as a, ShareOutcome as c, shareOrCopy as d, ShareEnvironment as i, describeShareError as l, ResolvedShare as n, ShareMode as o, ShareContent as r, ShareOptions as s, CopyReason as t, shareMethod as u };
|
|
115
|
-
//# sourceMappingURL=share-
|
|
115
|
+
//# sourceMappingURL=share-DDIsWxbC.d.ts.map
|
package/dist/code.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, m as TextPayload } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.cjs";
|
|
4
4
|
//#region src/code/inspect.d.ts
|
|
5
5
|
/**
|
package/dist/code.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, m as TextPayload } from "./chunks/payload-D7CJ6e2W.js";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.js";
|
|
4
4
|
//#region src/code/inspect.d.ts
|
|
5
5
|
/**
|
package/dist/color.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, m as TextPayload } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.cjs";
|
|
4
4
|
//#region src/color/convert.d.ts
|
|
5
5
|
/**
|
package/dist/color.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, m as TextPayload } from "./chunks/payload-D7CJ6e2W.js";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.js";
|
|
4
4
|
//#region src/color/convert.d.ts
|
|
5
5
|
/**
|
package/dist/core.cjs
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_errors = require("./chunks/errors-CF2EQNbc.cjs");
|
|
4
4
|
const require_payload = require("./chunks/payload-DjSSLonm.cjs");
|
|
5
5
|
const require_mime = require("./chunks/mime--LB7kdqG.cjs");
|
|
6
|
-
const require_clipboard_adapter = require("./chunks/clipboard-adapter-
|
|
7
|
-
const require_core = require("./chunks/core-
|
|
6
|
+
const require_clipboard_adapter = require("./chunks/clipboard-adapter-DYo79Fdq.cjs");
|
|
7
|
+
const require_core = require("./chunks/core-pOm_foSY.cjs");
|
|
8
8
|
const require_paste_reader = require("./chunks/paste-reader-BL51Jt1y.cjs");
|
|
9
9
|
exports.CopyFailure = require_errors.CopyFailure;
|
|
10
10
|
exports.DEFAULT_INTERCEPTED_EVENTS = require_core.DEFAULT_INTERCEPTED_EVENTS;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as DEFAULT_MAX_RETRIES, C as copyFailure, D as isCopyFailure, E as describePasteError, M as resolveMaxRetries, O as isRetryableError, S as CopyFailure, T as describeCopyError, _ as serializeJson, a as CopyPayloadKind, b as CopyError, c as HtmlPayload, d as JsonPayload, f as MultiPayload, g as normalizePayload, h as isBlob, i as CopyPayload, j as OperationContext, k as toCopyError, l as IMAGE_MIME_TYPE, m as TextPayload, n as BlobSource, o as CopySource, p as MultiPayloadItem, r as CopyInput, s as CopySourceContext, t as AsyncCopyInput, u as ImagePayload, v as validatePayload, w as createCopyError, x as CopyErrorType, y as ClipboardOperation } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.cjs";
|
|
4
|
-
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-
|
|
8
|
-
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
4
|
+
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-uHZHddq0.cjs";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-C1_Mvpcc.cjs";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-7NVPsNOK.cjs";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-DlwtI3qZ.cjs";
|
|
8
|
+
export { AsyncCopyInput, BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopySourceContext, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as DEFAULT_MAX_RETRIES, C as copyFailure, D as isCopyFailure, E as describePasteError, M as resolveMaxRetries, O as isRetryableError, S as CopyFailure, T as describeCopyError, _ as serializeJson, a as CopyPayloadKind, b as CopyError, c as HtmlPayload, d as JsonPayload, f as MultiPayload, g as normalizePayload, h as isBlob, i as CopyPayload, j as OperationContext, k as toCopyError, l as IMAGE_MIME_TYPE, m as TextPayload, n as BlobSource, o as CopySource, p as MultiPayloadItem, r as CopyInput, s as CopySourceContext, t as AsyncCopyInput, u as ImagePayload, v as validatePayload, w as createCopyError, x as CopyErrorType, y as ClipboardOperation } from "./chunks/payload-D7CJ6e2W.js";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.js";
|
|
4
|
-
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-
|
|
8
|
-
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
4
|
+
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-DjqQGsNs.js";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-B55TgPYd.js";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-CjF0OD8t.js";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-D6OGeYxr.js";
|
|
8
|
+
export { AsyncCopyInput, BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopySourceContext, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { a as describePasteError, c as toCopyError, i as describeCopyError, n as copyFailure, o as isCopyFailure, r as createCopyError, s as isRetryableError, t as CopyFailure } from "./chunks/errors-CGcMvbhJ.js";
|
|
3
3
|
import { a as validatePayload, i as serializeJson, n as isBlob, r as normalizePayload, t as IMAGE_MIME_TYPE } from "./chunks/payload-5uJedhwz.js";
|
|
4
4
|
import { a as matchesMimePattern, c as sniffImageBytes, i as isWebCustomFormat, l as sniffImageType, n as WEB_CUSTOM_FORMAT_PREFIX, o as normalizeClipboardType, r as isTextualMimeType, s as normalizeMimeType, t as SVG_MIME_TYPE } from "./chunks/mime-aa-HA2dm.js";
|
|
5
|
-
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as DEFAULT_MAX_RETRIES, a as readClipboardPermission, b as createCopyCoordinator, c as registerDragCopy, d as readCopySelection, f as registerCopyInterceptor, g as createCopyMachine, h as canRetryState, i as createBrowserPasteAdapter, l as DEFAULT_INTERCEPTED_EVENTS, m as IDLE_STATE, n as canRetryPasteState, o as watchClipboardPermission, p as DEFAULT_RESET_AFTER_MS, r as createPasteMachine, s as applyDragCopy, t as PASTE_IDLE_STATE, u as interceptCopyEvent, y as resolveMaxRetries } from "./chunks/core-
|
|
5
|
+
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-XS23N-Gg.js";
|
|
6
|
+
import { _ as DEFAULT_MAX_RETRIES, a as readClipboardPermission, b as createCopyCoordinator, c as registerDragCopy, d as readCopySelection, f as registerCopyInterceptor, g as createCopyMachine, h as canRetryState, i as createBrowserPasteAdapter, l as DEFAULT_INTERCEPTED_EVENTS, m as IDLE_STATE, n as canRetryPasteState, o as watchClipboardPermission, p as DEFAULT_RESET_AFTER_MS, r as createPasteMachine, s as applyDragCopy, t as PASTE_IDLE_STATE, u as interceptCopyEvent, y as resolveMaxRetries } from "./chunks/core-BRqanpvy.js";
|
|
7
7
|
import { i as canAcceptDrag, l as resolvePasteReadOptions, n as DEFAULT_PASTE_MAX_BYTES, r as DEFAULT_PASTE_MAX_ITEMS, t as DEFAULT_PASTE_ACCEPT } from "./chunks/paste-reader-BpXOH_Px.js";
|
|
8
8
|
export { CopyFailure, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, IDLE_STATE, IMAGE_MIME_TYPE, PASTE_IDLE_STATE, SVG_MIME_TYPE, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
package/dist/email.d.cts
CHANGED
package/dist/email.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_errors = require("./chunks/errors-CF2EQNbc.cjs");
|
|
4
4
|
const require_payload = require("./chunks/payload-DjSSLonm.cjs");
|
|
5
5
|
const require_mime = require("./chunks/mime--LB7kdqG.cjs");
|
|
6
|
-
const require_clipboard_adapter = require("./chunks/clipboard-adapter-
|
|
7
|
-
const require_core = require("./chunks/core-
|
|
6
|
+
const require_clipboard_adapter = require("./chunks/clipboard-adapter-DYo79Fdq.cjs");
|
|
7
|
+
const require_core = require("./chunks/core-pOm_foSY.cjs");
|
|
8
8
|
const require_paste_reader = require("./chunks/paste-reader-BL51Jt1y.cjs");
|
|
9
|
-
const require_share = require("./chunks/share-
|
|
9
|
+
const require_share = require("./chunks/share-0QnaCaoQ.cjs");
|
|
10
10
|
const require_field = require("./chunks/field-C8A5Yxln.cjs");
|
|
11
11
|
let react = require("react");
|
|
12
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as DEFAULT_MAX_RETRIES, C as copyFailure, D as isCopyFailure, E as describePasteError, M as resolveMaxRetries, O as isRetryableError, S as CopyFailure, T as describeCopyError, _ as serializeJson, a as CopyPayloadKind, b as CopyError, c as HtmlPayload, d as JsonPayload, f as MultiPayload, g as normalizePayload, h as isBlob, i as CopyPayload, j as OperationContext, k as toCopyError, l as IMAGE_MIME_TYPE, m as TextPayload, n as BlobSource, o as CopySource, p as MultiPayloadItem, r as CopyInput, s as CopySourceContext, t as AsyncCopyInput, u as ImagePayload, v as validatePayload, w as createCopyError, x as CopyErrorType, y as ClipboardOperation } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.cjs";
|
|
4
|
-
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-
|
|
8
|
-
import { a as ShareMethod, c as ShareOutcome, i as ShareEnvironment, n as ResolvedShare, o as ShareMode, r as ShareContent, s as ShareOptions, t as CopyReason } from "./chunks/share-
|
|
4
|
+
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-uHZHddq0.cjs";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-C1_Mvpcc.cjs";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-7NVPsNOK.cjs";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-DlwtI3qZ.cjs";
|
|
8
|
+
import { a as ShareMethod, c as ShareOutcome, i as ShareEnvironment, n as ResolvedShare, o as ShareMode, r as ShareContent, s as ShareOptions, t as CopyReason } from "./chunks/share-BueRwILH.cjs";
|
|
9
9
|
import { n as OtpFieldOptions, r as OtpSnapshot } from "./chunks/field-BTsKTs2M.cjs";
|
|
10
10
|
import { ButtonHTMLAttributes, CSSProperties, ClipboardEventHandler, DragEventHandler, FocusEventHandler, ForwardRefExoticComponent, HTMLAttributes, JSX, PointerEventHandler, ReactNode, RefAttributes, RefCallback } from "react";
|
|
11
11
|
//#region src/react/useCopy.d.ts
|
|
@@ -594,5 +594,5 @@ interface UseOtpFieldResult extends OtpSnapshot {
|
|
|
594
594
|
*/
|
|
595
595
|
export declare function useOtpField(options?: UseOtpFieldOptions): UseOtpFieldResult;
|
|
596
596
|
//#endregion
|
|
597
|
-
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, type CopyFieldContextValue, type CopyFieldLabelProps, type CopyFieldMessages, type CopyFieldRootProps, type CopyFieldTriggerProps, type CopyFieldTriggerRenderProps, type CopyFieldValueProps, type CopyGroupProps, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, type CopyReason, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, type LiveRegionProps, MultiPayload, MultiPayloadItem, type OperationContext, type OtpInputProps, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteDropTargetProps, type PasteEnvironment, PasteErrorState, PasteEventLike, type PasteFieldContextValue, type PasteFieldLabelProps, type PasteFieldMessages, type PasteFieldPreviewProps, type PasteFieldPreviewRenderProps, type PasteFieldRootProps, type PasteFieldStatusProps, type PasteFieldTriggerProps, type PasteFieldTriggerRenderProps, type PasteFieldZoneProps, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, type PasteTargetProps, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, type ResolvedShare, type RevealReason, type RevealTargetProps, SVG_MIME_TYPE, type ShareContent, type ShareEnvironment, type ShareMethod, type ShareMode, type ShareOptions, type ShareOutcome, type ShareStatus, SyncCopyPayload, SyncMultiPayload, TextPayload, type UseClipboardPermissionResult, type UseCopyInterceptorOptions, type UseCopyInterceptorResult, type UseCopyOptions, type UseCopyResult, type UseDisplayStatusOptions, type UseDragCopyOptions, type UseDragCopyResult, type UseOtpFieldOptions, type UseOtpFieldResult, type UsePasteDisplayStatusOptions, type UsePasteOptions, type UsePasteResult, type UseRevealOnInteractionOptions, type UseRevealOnInteractionResult, type UseShareOptions, type UseShareOutcome, type UseShareResult, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
597
|
+
export { AsyncCopyInput, BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, type CopyFieldContextValue, type CopyFieldLabelProps, type CopyFieldMessages, type CopyFieldRootProps, type CopyFieldTriggerProps, type CopyFieldTriggerRenderProps, type CopyFieldValueProps, type CopyGroupProps, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, type CopyReason, CopySelection, CopySource, CopySourceContext, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, type LiveRegionProps, MultiPayload, MultiPayloadItem, type OperationContext, type OtpInputProps, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteDropTargetProps, type PasteEnvironment, PasteErrorState, PasteEventLike, type PasteFieldContextValue, type PasteFieldLabelProps, type PasteFieldMessages, type PasteFieldPreviewProps, type PasteFieldPreviewRenderProps, type PasteFieldRootProps, type PasteFieldStatusProps, type PasteFieldTriggerProps, type PasteFieldTriggerRenderProps, type PasteFieldZoneProps, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, type PasteTargetProps, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, type ResolvedShare, type RevealReason, type RevealTargetProps, SVG_MIME_TYPE, type ShareContent, type ShareEnvironment, type ShareMethod, type ShareMode, type ShareOptions, type ShareOutcome, type ShareStatus, SyncCopyPayload, SyncMultiPayload, TextPayload, type UseClipboardPermissionResult, type UseCopyInterceptorOptions, type UseCopyInterceptorResult, type UseCopyOptions, type UseCopyResult, type UseDisplayStatusOptions, type UseDragCopyOptions, type UseDragCopyResult, type UseOtpFieldOptions, type UseOtpFieldResult, type UsePasteDisplayStatusOptions, type UsePasteOptions, type UsePasteResult, type UseRevealOnInteractionOptions, type UseRevealOnInteractionResult, type UseShareOptions, type UseShareOutcome, type UseShareResult, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
598
598
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as DEFAULT_MAX_RETRIES, C as copyFailure, D as isCopyFailure, E as describePasteError, M as resolveMaxRetries, O as isRetryableError, S as CopyFailure, T as describeCopyError, _ as serializeJson, a as CopyPayloadKind, b as CopyError, c as HtmlPayload, d as JsonPayload, f as MultiPayload, g as normalizePayload, h as isBlob, i as CopyPayload, j as OperationContext, k as toCopyError, l as IMAGE_MIME_TYPE, m as TextPayload, n as BlobSource, o as CopySource, p as MultiPayloadItem, r as CopyInput, s as CopySourceContext, t as AsyncCopyInput, u as ImagePayload, v as validatePayload, w as createCopyError, x as CopyErrorType, y as ClipboardOperation } from "./chunks/payload-D7CJ6e2W.js";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.js";
|
|
4
|
-
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-
|
|
8
|
-
import { a as ShareMethod, c as ShareOutcome, i as ShareEnvironment, n as ResolvedShare, o as ShareMode, r as ShareContent, s as ShareOptions, t as CopyReason } from "./chunks/share-
|
|
4
|
+
import { $ as CopyCoordinator, A as DragCopyStatus, B as CopyMachine, C as DragCopyItem, D as DragCopyPayload, E as DragCopyPassReason, F as applyDragCopy, G as CopyStatus, H as CopyMachineOptionsSource, I as registerDragCopy, J as ErrorState, K as CopyingState, L as CopiedState, M as DragMultiPayload, N as DragStartEventLike, O as DragCopySource, P as RegisterDragCopyResult, Q as createCopyMachine, R as CopyCancelReason, S as DragCopyDecision, T as DragCopyOutcome, U as CopyOutcome, V as CopyMachineOptions, W as CopyState, X as IdleState, Y as IDLE_STATE, Z as canRetryState, _ as createPasteMachine, a as PasteEventLike, at as isTextualMimeType, b as readClipboardPermission, c as PasteMachine, ct as normalizeClipboardType, d as PasteOutcome, dt as sniffImageType, et as CopyCoordinatorMember, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as WEB_CUSTOM_FORMAT_PREFIX, j as DragEffectAllowed, k as DragCopyState, l as PasteMachineOptions, lt as normalizeMimeType, m as PasteState, n as PasteCancelReason, nt as RasterImageMimeType, o as PasteIdleState, ot as isWebCustomFormat, p as PasteReadingState, q as DEFAULT_RESET_AFTER_MS, r as PasteDropEventLike, rt as SVG_MIME_TYPE, s as PasteIgnoredReason, st as matchesMimePattern, t as PASTE_IDLE_STATE, tt as createCopyCoordinator, u as PasteMachineOptionsSource, ut as sniffImageBytes, v as ClipboardPermissionName, w as DragCopyOptions, x as watchClipboardPermission, y as ClipboardPermissionState, z as CopyIgnoredReason } from "./chunks/index-DjqQGsNs.js";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-B55TgPYd.js";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-CjF0OD8t.js";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-D6OGeYxr.js";
|
|
8
|
+
import { a as ShareMethod, c as ShareOutcome, i as ShareEnvironment, n as ResolvedShare, o as ShareMode, r as ShareContent, s as ShareOptions, t as CopyReason } from "./chunks/share-DDIsWxbC.js";
|
|
9
9
|
import { n as OtpFieldOptions, r as OtpSnapshot } from "./chunks/field-BTsKTs2M.js";
|
|
10
10
|
import { ButtonHTMLAttributes, CSSProperties, ClipboardEventHandler, DragEventHandler, FocusEventHandler, ForwardRefExoticComponent, HTMLAttributes, JSX, PointerEventHandler, ReactNode, RefAttributes, RefCallback } from "react";
|
|
11
11
|
//#region src/react/useCopy.d.ts
|
|
@@ -594,5 +594,5 @@ interface UseOtpFieldResult extends OtpSnapshot {
|
|
|
594
594
|
*/
|
|
595
595
|
export declare function useOtpField(options?: UseOtpFieldOptions): UseOtpFieldResult;
|
|
596
596
|
//#endregion
|
|
597
|
-
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, type CopyFieldContextValue, type CopyFieldLabelProps, type CopyFieldMessages, type CopyFieldRootProps, type CopyFieldTriggerProps, type CopyFieldTriggerRenderProps, type CopyFieldValueProps, type CopyGroupProps, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, type CopyReason, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, type LiveRegionProps, MultiPayload, MultiPayloadItem, type OperationContext, type OtpInputProps, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteDropTargetProps, type PasteEnvironment, PasteErrorState, PasteEventLike, type PasteFieldContextValue, type PasteFieldLabelProps, type PasteFieldMessages, type PasteFieldPreviewProps, type PasteFieldPreviewRenderProps, type PasteFieldRootProps, type PasteFieldStatusProps, type PasteFieldTriggerProps, type PasteFieldTriggerRenderProps, type PasteFieldZoneProps, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, type PasteTargetProps, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, type ResolvedShare, type RevealReason, type RevealTargetProps, SVG_MIME_TYPE, type ShareContent, type ShareEnvironment, type ShareMethod, type ShareMode, type ShareOptions, type ShareOutcome, type ShareStatus, SyncCopyPayload, SyncMultiPayload, TextPayload, type UseClipboardPermissionResult, type UseCopyInterceptorOptions, type UseCopyInterceptorResult, type UseCopyOptions, type UseCopyResult, type UseDisplayStatusOptions, type UseDragCopyOptions, type UseDragCopyResult, type UseOtpFieldOptions, type UseOtpFieldResult, type UsePasteDisplayStatusOptions, type UsePasteOptions, type UsePasteResult, type UseRevealOnInteractionOptions, type UseRevealOnInteractionResult, type UseShareOptions, type UseShareOutcome, type UseShareResult, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
597
|
+
export { AsyncCopyInput, BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, ClipboardPermissionName, ClipboardPermissionState, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, type CopyFieldContextValue, type CopyFieldLabelProps, type CopyFieldMessages, type CopyFieldRootProps, type CopyFieldTriggerProps, type CopyFieldTriggerRenderProps, type CopyFieldValueProps, type CopyGroupProps, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, type CopyReason, CopySelection, CopySource, CopySourceContext, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, type LiveRegionProps, MultiPayload, MultiPayloadItem, type OperationContext, type OtpInputProps, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteDropTargetProps, type PasteEnvironment, PasteErrorState, PasteEventLike, type PasteFieldContextValue, type PasteFieldLabelProps, type PasteFieldMessages, type PasteFieldPreviewProps, type PasteFieldPreviewRenderProps, type PasteFieldRootProps, type PasteFieldStatusProps, type PasteFieldTriggerProps, type PasteFieldTriggerRenderProps, type PasteFieldZoneProps, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, type PasteTargetProps, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, type ResolvedShare, type RevealReason, type RevealTargetProps, SVG_MIME_TYPE, type ShareContent, type ShareEnvironment, type ShareMethod, type ShareMode, type ShareOptions, type ShareOutcome, type ShareStatus, SyncCopyPayload, SyncMultiPayload, TextPayload, type UseClipboardPermissionResult, type UseCopyInterceptorOptions, type UseCopyInterceptorResult, type UseCopyOptions, type UseCopyResult, type UseDisplayStatusOptions, type UseDragCopyOptions, type UseDragCopyResult, type UseOtpFieldOptions, type UseOtpFieldResult, type UsePasteDisplayStatusOptions, type UsePasteOptions, type UsePasteResult, type UseRevealOnInteractionOptions, type UseRevealOnInteractionResult, type UseShareOptions, type UseShareOutcome, type UseShareResult, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readClipboardPermission, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload, watchClipboardPermission };
|
|
598
598
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { a as describePasteError, c as toCopyError, i as describeCopyError, n as copyFailure, o as isCopyFailure, r as createCopyError, s as isRetryableError, t as CopyFailure } from "./chunks/errors-CGcMvbhJ.js";
|
|
3
3
|
import { a as validatePayload, i as serializeJson, n as isBlob, r as normalizePayload, t as IMAGE_MIME_TYPE } from "./chunks/payload-5uJedhwz.js";
|
|
4
4
|
import { a as matchesMimePattern, c as sniffImageBytes, i as isWebCustomFormat, l as sniffImageType, n as WEB_CUSTOM_FORMAT_PREFIX, o as normalizeClipboardType, r as isTextualMimeType, s as normalizeMimeType, t as SVG_MIME_TYPE } from "./chunks/mime-aa-HA2dm.js";
|
|
5
|
-
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as DEFAULT_MAX_RETRIES, a as readClipboardPermission, b as createCopyCoordinator, c as registerDragCopy, d as readCopySelection, f as registerCopyInterceptor, g as createCopyMachine, h as canRetryState, i as createBrowserPasteAdapter, l as DEFAULT_INTERCEPTED_EVENTS, m as IDLE_STATE, n as canRetryPasteState, o as watchClipboardPermission, p as DEFAULT_RESET_AFTER_MS, r as createPasteMachine, s as applyDragCopy, t as PASTE_IDLE_STATE, u as interceptCopyEvent, v as invoke, y as resolveMaxRetries } from "./chunks/core-
|
|
5
|
+
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-XS23N-Gg.js";
|
|
6
|
+
import { _ as DEFAULT_MAX_RETRIES, a as readClipboardPermission, b as createCopyCoordinator, c as registerDragCopy, d as readCopySelection, f as registerCopyInterceptor, g as createCopyMachine, h as canRetryState, i as createBrowserPasteAdapter, l as DEFAULT_INTERCEPTED_EVENTS, m as IDLE_STATE, n as canRetryPasteState, o as watchClipboardPermission, p as DEFAULT_RESET_AFTER_MS, r as createPasteMachine, s as applyDragCopy, t as PASTE_IDLE_STATE, u as interceptCopyEvent, v as invoke, y as resolveMaxRetries } from "./chunks/core-BRqanpvy.js";
|
|
7
7
|
import { i as canAcceptDrag, l as resolvePasteReadOptions, n as DEFAULT_PASTE_MAX_BYTES, r as DEFAULT_PASTE_MAX_ITEMS, t as DEFAULT_PASTE_ACCEPT } from "./chunks/paste-reader-BpXOH_Px.js";
|
|
8
|
-
import { i as shareOrCopy, r as shareMethod, t as TOUCH_FIRST } from "./chunks/share-
|
|
8
|
+
import { i as shareOrCopy, r as shareMethod, t as TOUCH_FIRST } from "./chunks/share-BwgSAtH6.js";
|
|
9
9
|
import { t as createOtpField } from "./chunks/field-CDCN9x0L.js";
|
|
10
10
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
package/dist/link.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, f as MultiPayload } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.cjs";
|
|
4
4
|
import { a as cleanLinkUrl, i as TRACKING_PARAMETERS, n as DEFAULT_LINK_PROTOCOLS, o as resolveLinkUrl, r as LinkUrlOptions, t as CleanLinkOptions } from "./chunks/url-DWdElCT3.cjs";
|
|
5
5
|
//#region src/link/payload.d.ts
|
package/dist/link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { c as HtmlPayload, f as MultiPayload } from "./chunks/payload-D7CJ6e2W.js";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.js";
|
|
4
4
|
import { a as cleanLinkUrl, i as TRACKING_PARAMETERS, n as DEFAULT_LINK_PROTOCOLS, o as resolveLinkUrl, r as LinkUrlOptions, t as CleanLinkOptions } from "./chunks/url-DWdElCT3.js";
|
|
5
5
|
//#region src/link/payload.d.ts
|
package/dist/number.d.cts
CHANGED
package/dist/number.d.ts
CHANGED
package/dist/rich.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { c as CopyInterceptTransform } from "./chunks/copy-interceptor-
|
|
2
|
+
import { c as HtmlPayload } from "./chunks/payload-BKDabKYy.cjs";
|
|
3
|
+
import { c as CopyInterceptTransform } from "./chunks/copy-interceptor-7NVPsNOK.cjs";
|
|
4
4
|
import { r as LinkUrlOptions } from "./chunks/url-DWdElCT3.cjs";
|
|
5
5
|
//#region src/rich/style.d.ts
|
|
6
6
|
/** Where styles come from: `getComputedStyle` for a live element, the `style` attribute otherwise. */
|