react-smart-copy 1.27.0 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{clipboard-adapter-0haPt4jJ.js → clipboard-adapter-B-9XTqUp.js} +2 -3
- package/dist/chunks/clipboard-adapter-B-9XTqUp.js.map +1 -0
- package/dist/chunks/{clipboard-adapter-5bmjKbyK.cjs → clipboard-adapter-q_pp9q_x.cjs} +2 -3
- package/dist/chunks/clipboard-adapter-q_pp9q_x.cjs.map +1 -0
- package/dist/chunks/{core-BRMlZOtj.cjs → core-Bi4HUuRs.cjs} +2 -2
- package/dist/chunks/{core-BRMlZOtj.cjs.map → core-Bi4HUuRs.cjs.map} +1 -1
- package/dist/chunks/{core-CnAFS4Wh.js → core-BrmkVinL.js} +2 -2
- package/dist/chunks/{core-CnAFS4Wh.js.map → core-BrmkVinL.js.map} +1 -1
- package/dist/chunks/{inert-html-D75NyVvT.js → inert-html-BxuTrb6R.js} +11 -2
- package/dist/chunks/{inert-html-D75NyVvT.js.map → inert-html-BxuTrb6R.js.map} +1 -1
- package/dist/chunks/{inert-html-DyxjWDok.cjs → inert-html-aAsKvgJC.cjs} +16 -1
- package/dist/chunks/{inert-html-DyxjWDok.cjs.map → inert-html-aAsKvgJC.cjs.map} +1 -1
- package/dist/chunks/{share-CL72PUqq.js → share-CW1SnFz5.js} +2 -2
- package/dist/chunks/{share-CL72PUqq.js.map → share-CW1SnFz5.js.map} +1 -1
- package/dist/chunks/{share-Bu5u2ItX.cjs → share-K1GpVQdH.cjs} +2 -2
- package/dist/chunks/{share-Bu5u2ItX.cjs.map → share-K1GpVQdH.cjs.map} +1 -1
- package/dist/code.cjs +1 -1
- package/dist/code.js +1 -1
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/link.cjs +1 -1
- package/dist/link.js +1 -1
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.js +1 -1
- package/dist/rich.cjs +1 -1
- package/dist/rich.js +1 -1
- package/dist/share.cjs +1 -1
- package/dist/share.js +1 -1
- package/dist/table.cjs +9 -2
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +9 -2
- package/dist/table.js.map +1 -1
- package/package.json +3 -2
- package/dist/chunks/clipboard-adapter-0haPt4jJ.js.map +0 -1
- package/dist/chunks/clipboard-adapter-5bmjKbyK.cjs.map +0 -1
|
@@ -54,7 +54,6 @@ function restoreFocus(doc, saved) {
|
|
|
54
54
|
*/
|
|
55
55
|
function legacyCopy(doc, entries) {
|
|
56
56
|
if (typeof doc.execCommand !== "function" || !doc.body) return false;
|
|
57
|
-
const plain = entries.find(([format]) => format === "text/plain")?.[1];
|
|
58
57
|
const seen = { written: false };
|
|
59
58
|
const onCopy = (event) => {
|
|
60
59
|
const data = event.clipboardData;
|
|
@@ -71,7 +70,7 @@ function legacyCopy(doc, entries) {
|
|
|
71
70
|
const ranges = [];
|
|
72
71
|
if (selection) for (let index = 0; index < selection.rangeCount; index += 1) ranges.push(selection.getRangeAt(index));
|
|
73
72
|
const holder = doc.createElement("span");
|
|
74
|
-
holder.textContent =
|
|
73
|
+
holder.textContent = "\xA0";
|
|
75
74
|
holder.setAttribute("aria-hidden", "true");
|
|
76
75
|
holder.style.cssText = "position:fixed;top:0;left:0;clip-path:inset(50%);white-space:pre;user-select:text;-webkit-user-select:text";
|
|
77
76
|
doc.addEventListener("copy", onCopy, true);
|
|
@@ -214,4 +213,4 @@ function createBrowserClipboardAdapter(options = {}) {
|
|
|
214
213
|
//#endregion
|
|
215
214
|
export { createBrowserClipboardAdapter as t };
|
|
216
215
|
|
|
217
|
-
//# sourceMappingURL=clipboard-adapter-
|
|
216
|
+
//# sourceMappingURL=clipboard-adapter-B-9XTqUp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-adapter-B-9XTqUp.js","names":[],"sources":["../../src/core/legacy-copy.ts","../../src/core/clipboard-adapter.ts"],"sourcesContent":["/**\n * The copy that works where the async Clipboard API does not: plain HTTP pages (intranets,\n * internal tools on an IP address) and webviews without `navigator.clipboard`.\n *\n * `document.execCommand('copy')` fires a `copy` event whose `clipboardData` takes any text\n * format, so the payload is written exactly, as text and HTML alike. Nothing is shown and\n * nothing moves: the selection the command needs is made on a node outside the layout, and\n * the user's own selection and focus are put back before the function returns. It runs\n * synchronously, inside the user's gesture. Internal: not part of the public API.\n */\nimport { isWebCustomFormat } from './mime';\nimport { serializeJson, type CopyPayload } from './payload';\n\n/** Each format and its text, in the order written. */\nexport type LegacyEntries = readonly (readonly [format: string, data: string])[];\n\n/** What can travel through a copy event: every text format, no images, no blobs, no web custom formats. */\nexport function legacyEntries(payload: CopyPayload): LegacyEntries | null {\n switch (payload.kind) {\n case 'text':\n return [['text/plain', payload.value]];\n case 'json':\n return [['text/plain', serializeJson(payload)]];\n case 'html':\n return [\n ['text/html', payload.html],\n ['text/plain', payload.text],\n ];\n case 'image':\n return null;\n case 'multi': {\n const entries: (readonly [string, string])[] = [];\n for (const { mimeType, data, optional } of payload.items) {\n if (typeof data === 'string' && !isWebCustomFormat(mimeType)) entries.push([mimeType, data]);\n // A required format that a copy event cannot carry: the copy would be incomplete.\n else if (optional !== true) return null;\n }\n return entries.length > 0 ? entries : null;\n }\n }\n}\n\ntype SavedFocus = readonly [element: HTMLElement, range: readonly [number, number, 'forward' | 'backward' | 'none'] | null];\n\nfunction saveFocus(doc: Document): SavedFocus | null {\n const element = doc.activeElement as (HTMLElement & Partial<HTMLInputElement>) | null;\n if (!element || element === doc.body) return null;\n try {\n const { selectionStart: start, selectionEnd: end, selectionDirection: direction } = element;\n return [element, typeof start === 'number' && typeof end === 'number' ? [start, end, direction ?? 'none'] : null];\n } catch {\n // Older engines throw for inputs without a selection API (email, number).\n return [element, null];\n }\n}\n\nfunction restoreFocus(doc: Document, saved: SavedFocus | null): void {\n if (!saved?.[0].isConnected) return;\n const [element, range] = saved;\n if (doc.activeElement !== element) element.focus({ preventScroll: true });\n if (range) (element as HTMLInputElement).setSelectionRange(...range);\n}\n\n/**\n * Writes `entries` through `execCommand('copy')`. Returns whether the browser took them;\n * `false` leaves the clipboard as it was (the caller reports its own, classified error).\n */\nexport function legacyCopy(doc: Document, entries: LegacyEntries): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-deprecated -- missing in some webviews; the only copy without the async API\n if (typeof doc.execCommand !== 'function' || !doc.body) return false;\n // Set by the listener: an object, so the check after `execCommand` reads its latest value.\n const seen = { written: false };\n const onCopy = (event: Event): void => {\n const data = (event as ClipboardEvent).clipboardData;\n if (!data) return;\n event.preventDefault();\n // This copy carries an exact payload: page copy handlers and interceptors must not rewrite it.\n event.stopImmediatePropagation();\n try {\n for (const [format, value] of entries) data.setData(format, value);\n seen.written = true;\n } catch {\n // A format the browser refuses: the copy is reported as failed, not thrown into the page.\n }\n };\n\n // Saved first: in some engines reading or moving the selection already moves focus.\n const focus = saveFocus(doc);\n const selection = doc.getSelection();\n const ranges: Range[] = [];\n if (selection) for (let index = 0; index < selection.rangeCount; index += 1) ranges.push(selection.getRangeAt(index));\n\n // The copy command is only enabled over a selection, so select something nobody can see.\n const holder = doc.createElement('span');\n // One character enables the command; the payload itself goes through the event.\n // (The full text here cost 100 ms of layout for a megabyte.)\n holder.textContent = '\\u00a0';\n holder.setAttribute('aria-hidden', 'true');\n // CSSOM, not a style attribute: allowed under a strict Content Security Policy.\n holder.style.cssText = 'position:fixed;top:0;left:0;clip-path:inset(50%);white-space:pre;user-select:text;-webkit-user-select:text';\n\n doc.addEventListener('copy', onCopy, true);\n doc.body.append(holder);\n try {\n if (selection) {\n const range = doc.createRange();\n range.selectNodeContents(holder);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- the only copy without the async API\n doc.execCommand('copy');\n } catch {\n // Reported through `written`, which the listener never set.\n } finally {\n doc.removeEventListener('copy', onCopy, true);\n holder.remove();\n if (selection) {\n selection.removeAllRanges();\n for (const range of ranges) selection.addRange(range);\n }\n restoreFocus(doc, focus);\n }\n return seen.written;\n}\n","import { CopyFailure, createCopyError, type CopyErrorType } from './errors';\nimport { legacyCopy, legacyEntries } from './legacy-copy';\nimport type { OperationContext } from './machine-shared';\nimport { IMAGE_MIME_TYPE, isBlob, serializeJson, type BlobSource, type CopyPayload } from './payload';\n\n/** Minimal structural view of `navigator.clipboard`, so fakes and polyfills fit. */\nexport interface ClipboardLike {\n writeText?(text: string): Promise<void>;\n write?(items: readonly unknown[]): Promise<void>;\n}\n\nexport type ClipboardItemData = Blob | PromiseLike<Blob>;\n\nexport interface ClipboardItemConstructorLike {\n new (items: Record<string, ClipboardItemData>): unknown;\n supports?(type: string): boolean;\n}\n\nexport interface ClipboardEnvironment {\n readonly isSecureContext?: boolean;\n /** For the `execCommand('copy')` fallback; `window` has it. */\n readonly document?: Document | undefined;\n readonly navigator?: { readonly clipboard?: ClipboardLike | undefined } | undefined;\n readonly ClipboardItem?: ClipboardItemConstructorLike | undefined;\n}\n\n/**\n * The only thing the state machine needs. Implement it to target Electron,\n * a native bridge, a test double, or anything else.\n *\n * Contract: start the platform write synchronously (before any `await`) so the\n * browser still sees the user gesture, and reject with a `CopyFailure` when you\n * can classify the error. `context.signal` aborts when the copy is reset or its\n * host unmounts; honour it to stop expensive work early.\n */\nexport interface ClipboardAdapter {\n write(payload: CopyPayload, context?: OperationContext): Promise<void>;\n}\n\nexport interface BrowserClipboardAdapterOptions {\n /** Defaults to `window`, read lazily at copy time (SSR-safe). */\n readonly getEnvironment?: () => ClipboardEnvironment | undefined;\n /** When rich HTML copy is unavailable, fall back to its plain text. Default `true`. */\n readonly degradeHtmlToText?: boolean;\n /**\n * When the async Clipboard API is unavailable (a plain-HTTP page, a webview without\n * `navigator.clipboard`, no `ClipboardItem` for HTML), copy text, HTML and JSON through the\n * browser's `copy` command instead, as `react-copy-to-clipboard` does. Images still need the\n * async API. Default `true`; `false` reports `insecure-context` / `unsupported` instead.\n */\n readonly legacyFallback?: boolean;\n}\n\ninterface RichClipboard {\n readonly Item: ClipboardItemConstructorLike;\n readonly write: (items: readonly unknown[]) => Promise<void>;\n}\n\nconst fail = (type: CopyErrorType, message: string, cause?: unknown): CopyFailure =>\n new CopyFailure(createCopyError(type, message, cause));\n\nconst noop = (): void => undefined;\n\nfunction defaultEnvironment(): ClipboardEnvironment | undefined {\n return typeof window === 'undefined' ? undefined : window;\n}\n\nfunction getRichClipboard(env: ClipboardEnvironment, clipboard: ClipboardLike): RichClipboard | null {\n const Item = env.ClipboardItem;\n if (!Item || typeof clipboard.write !== 'function') return null;\n return { Item, write: clipboard.write.bind(clipboard) };\n}\n\nfunction isTypeSupported(Item: ClipboardItemConstructorLike, type: string): boolean {\n return typeof Item.supports !== 'function' || Item.supports(type);\n}\n\nasync function resolveImageBlob(source: BlobSource, context: OperationContext | undefined): Promise<Blob> {\n let blob: unknown;\n try {\n // Invoked before the first await, i.e. synchronously inside the gesture.\n blob = await (typeof source === 'function' ? source(context ?? { signal: new AbortController().signal }) : source);\n } catch (cause) {\n if (context?.signal.aborted) throw fail('aborted', 'The image copy was cancelled.', cause);\n throw fail('blob-generation-failed', 'The image source threw or rejected while producing a Blob.', cause);\n }\n if (!isBlob(blob)) throw fail('blob-generation-failed', 'The image source did not produce a Blob.');\n if (blob.type !== IMAGE_MIME_TYPE) {\n throw fail(\n 'unsupported-format',\n `Only ${IMAGE_MIME_TYPE} can be written to the clipboard (received \"${blob.type || 'unknown'}\"). ` +\n `Convert with canvas.toBlob(cb, \"${IMAGE_MIME_TYPE}\").`,\n );\n }\n return blob;\n}\n\nasync function writeImage(\n rich: RichClipboard,\n source: BlobSource,\n context: OperationContext | undefined,\n): Promise<void> {\n if (!isTypeSupported(rich.Item, IMAGE_MIME_TYPE)) {\n throw fail('unsupported-format', `This browser cannot write ${IMAGE_MIME_TYPE} to the clipboard.`);\n }\n // Hand ClipboardItem a *promise* so Safari keeps the gesture while the blob is produced.\n const blob = resolveImageBlob(source, context);\n blob.catch(noop); // Never an unhandled rejection, whichever side fails first.\n try {\n await rich.write([new rich.Item({ [IMAGE_MIME_TYPE]: blob })]);\n } catch (error) {\n // Browsers replace our classified reason with a generic DOMException. Prefer ours.\n const reason = await blob.then(noop, (inner: unknown) => inner);\n throw reason ?? error;\n }\n // Conforming browsers have consumed `blob` by now. Lax polyfills/webviews may resolve\n // without reading it: never report an image that failed to generate as copied.\n await blob;\n}\n\nasync function writeToClipboard(\n payload: CopyPayload,\n env: ClipboardEnvironment | undefined,\n settings: Required<Omit<BrowserClipboardAdapterOptions, 'getEnvironment'>>,\n context: OperationContext | undefined,\n): Promise<void> {\n if (!env) throw fail('unsupported', 'No browser environment: the clipboard only exists in the browser.');\n /** Without the async API: the copy command if it can carry this payload, else `failure`. */\n const legacy = (failure: CopyFailure): void => {\n const entries = settings.legacyFallback && env.document ? legacyEntries(payload) : null;\n if (entries && legacyCopy(env.document as Document, entries)) return;\n throw failure;\n };\n if (env.isSecureContext === false) {\n legacy(fail('insecure-context', 'The Clipboard API requires a secure context (HTTPS or localhost).'));\n return;\n }\n const clipboard = env.navigator?.clipboard;\n if (!clipboard) {\n legacy(fail('unsupported', 'navigator.clipboard is not available in this browser.'));\n return;\n }\n\n switch (payload.kind) {\n case 'text':\n case 'json': {\n const text = payload.kind === 'text' ? payload.value : serializeJson(payload);\n if (typeof clipboard.writeText === 'function') return clipboard.writeText(text);\n legacy(fail('unsupported', 'navigator.clipboard.writeText() is not available.'));\n return;\n }\n\n case 'html': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich || !isTypeSupported(rich.Item, 'text/html')) {\n const failure = fail('unsupported-format', 'Rich HTML copy requires ClipboardItem and navigator.clipboard.write().');\n try {\n legacy(failure);\n return;\n } catch {\n if (settings.degradeHtmlToText && typeof clipboard.writeText === 'function') return clipboard.writeText(payload.text);\n throw failure;\n }\n }\n return rich.write([\n new rich.Item({\n 'text/html': new Blob([payload.html], { type: 'text/html' }),\n 'text/plain': new Blob([payload.text], { type: 'text/plain' }),\n }),\n ]);\n }\n\n case 'image': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich) throw fail('unsupported-format', 'Image copy requires ClipboardItem and navigator.clipboard.write().');\n return writeImage(rich, payload.blob, context);\n }\n\n case 'multi': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich) {\n legacy(fail('unsupported-format', 'Multi-format copy requires ClipboardItem and navigator.clipboard.write().'));\n return;\n }\n const record: Record<string, ClipboardItemData> = Object.create(null) as Record<string, ClipboardItemData>;\n let written = 0;\n for (const { mimeType, data, optional } of payload.items) {\n // Optional items need positive confirmation: an unknown type can make the whole write reject.\n if (optional === true && !(typeof rich.Item.supports === 'function' && rich.Item.supports(mimeType))) continue;\n if (!isTypeSupported(rich.Item, mimeType)) {\n throw fail('unsupported-format', `This browser cannot write \"${mimeType}\" to the clipboard.`);\n }\n record[mimeType] = typeof data === 'string' ? new Blob([data], { type: mimeType }) : data;\n written += 1;\n }\n if (written === 0) throw fail('unsupported-format', 'This browser can write none of the payload types.');\n return rich.write([new rich.Item(record)]);\n }\n }\n}\n\n/** The default adapter: async Clipboard API with feature detection and honest errors. */\nexport function createBrowserClipboardAdapter(options: BrowserClipboardAdapterOptions = {}): ClipboardAdapter {\n const getEnvironment = options.getEnvironment ?? defaultEnvironment;\n const settings = { degradeHtmlToText: options.degradeHtmlToText ?? true, legacyFallback: options.legacyFallback ?? true };\n return {\n write: (payload, context) => writeToClipboard(payload, getEnvironment(), settings, context),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAgB,cAAc,SAA4C;CACxE,QAAQ,QAAQ,MAAhB;EACE,KAAK,QACH,OAAO,CAAC,CAAC,cAAc,QAAQ,KAAK,CAAC;EACvC,KAAK,QACH,OAAO,CAAC,CAAC,cAAc,cAAc,OAAO,CAAC,CAAC;EAChD,KAAK,QACH,OAAO,CACL,CAAC,aAAa,QAAQ,IAAI,GAC1B,CAAC,cAAc,QA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cAAc,QAAQ,OAAO;IAExD,IAAI,aAAa,QAAQ,EAAE,OAAO,KAAK,KAAK,aAAa,cAAc,KAAK,KAAK,SAAS,QAAQ,IAAI;IACtG,IAAI,CAAC,gBAAgB,KAAK,MAAM,QAAQ,GACtC,MAAM,KAAK,sBAAsB,8BAA8B,SAAS,oBAAoB;IAE9F,OAAO,YAAY,OAAO,SAAS,WAAW,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC,IAAI;IACrF,WAAW;GACb;GACA,IAAI,YAAY,GAAG,MAAM,KAAK,sBAAsB,mDAAmD;GACvG,OAAO,KAAK,MAAM,CAAC,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC;EAC3C;CACF;AACF;;AAGA,SAAgB,8BAA8B,UAA0C,CAAC,GAAqB;CAC5G,MAAM,iBAAiB,QAAQ,kBAAkB;CACjD,MAAM,WAAW;EAAE,mBAAmB,QAAQ,qBAAqB;EAAM,gBAAgB,QAAQ,kBAAkB;CAAK;CACxH,OAAO,EACL,QAAQ,SAAS,YAAY,iBAAiB,SAAS,eAAe,GAAG,UAAU,OAAO,EAC5F;AACF"}
|
|
@@ -54,7 +54,6 @@ function restoreFocus(doc, saved) {
|
|
|
54
54
|
*/
|
|
55
55
|
function legacyCopy(doc, entries) {
|
|
56
56
|
if (typeof doc.execCommand !== "function" || !doc.body) return false;
|
|
57
|
-
const plain = entries.find(([format]) => format === "text/plain")?.[1];
|
|
58
57
|
const seen = { written: false };
|
|
59
58
|
const onCopy = (event) => {
|
|
60
59
|
const data = event.clipboardData;
|
|
@@ -71,7 +70,7 @@ function legacyCopy(doc, entries) {
|
|
|
71
70
|
const ranges = [];
|
|
72
71
|
if (selection) for (let index = 0; index < selection.rangeCount; index += 1) ranges.push(selection.getRangeAt(index));
|
|
73
72
|
const holder = doc.createElement("span");
|
|
74
|
-
holder.textContent =
|
|
73
|
+
holder.textContent = "\xA0";
|
|
75
74
|
holder.setAttribute("aria-hidden", "true");
|
|
76
75
|
holder.style.cssText = "position:fixed;top:0;left:0;clip-path:inset(50%);white-space:pre;user-select:text;-webkit-user-select:text";
|
|
77
76
|
doc.addEventListener("copy", onCopy, true);
|
|
@@ -219,4 +218,4 @@ Object.defineProperty(exports, "createBrowserClipboardAdapter", {
|
|
|
219
218
|
}
|
|
220
219
|
});
|
|
221
220
|
|
|
222
|
-
//# sourceMappingURL=clipboard-adapter-
|
|
221
|
+
//# sourceMappingURL=clipboard-adapter-q_pp9q_x.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-adapter-q_pp9q_x.cjs","names":["serializeJson","isWebCustomFormat","CopyFailure","createCopyError","isBlob","IMAGE_MIME_TYPE","serializeJson"],"sources":["../../src/core/legacy-copy.ts","../../src/core/clipboard-adapter.ts"],"sourcesContent":["/**\n * The copy that works where the async Clipboard API does not: plain HTTP pages (intranets,\n * internal tools on an IP address) and webviews without `navigator.clipboard`.\n *\n * `document.execCommand('copy')` fires a `copy` event whose `clipboardData` takes any text\n * format, so the payload is written exactly, as text and HTML alike. Nothing is shown and\n * nothing moves: the selection the command needs is made on a node outside the layout, and\n * the user's own selection and focus are put back before the function returns. It runs\n * synchronously, inside the user's gesture. Internal: not part of the public API.\n */\nimport { isWebCustomFormat } from './mime';\nimport { serializeJson, type CopyPayload } from './payload';\n\n/** Each format and its text, in the order written. */\nexport type LegacyEntries = readonly (readonly [format: string, data: string])[];\n\n/** What can travel through a copy event: every text format, no images, no blobs, no web custom formats. */\nexport function legacyEntries(payload: CopyPayload): LegacyEntries | null {\n switch (payload.kind) {\n case 'text':\n return [['text/plain', payload.value]];\n case 'json':\n return [['text/plain', serializeJson(payload)]];\n case 'html':\n return [\n ['text/html', payload.html],\n ['text/plain', payload.text],\n ];\n case 'image':\n return null;\n case 'multi': {\n const entries: (readonly [string, string])[] = [];\n for (const { mimeType, data, optional } of payload.items) {\n if (typeof data === 'string' && !isWebCustomFormat(mimeType)) entries.push([mimeType, data]);\n // A required format that a copy event cannot carry: the copy would be incomplete.\n else if (optional !== true) return null;\n }\n return entries.length > 0 ? entries : null;\n }\n }\n}\n\ntype SavedFocus = readonly [element: HTMLElement, range: readonly [number, number, 'forward' | 'backward' | 'none'] | null];\n\nfunction saveFocus(doc: Document): SavedFocus | null {\n const element = doc.activeElement as (HTMLElement & Partial<HTMLInputElement>) | null;\n if (!element || element === doc.body) return null;\n try {\n const { selectionStart: start, selectionEnd: end, selectionDirection: direction } = element;\n return [element, typeof start === 'number' && typeof end === 'number' ? [start, end, direction ?? 'none'] : null];\n } catch {\n // Older engines throw for inputs without a selection API (email, number).\n return [element, null];\n }\n}\n\nfunction restoreFocus(doc: Document, saved: SavedFocus | null): void {\n if (!saved?.[0].isConnected) return;\n const [element, range] = saved;\n if (doc.activeElement !== element) element.focus({ preventScroll: true });\n if (range) (element as HTMLInputElement).setSelectionRange(...range);\n}\n\n/**\n * Writes `entries` through `execCommand('copy')`. Returns whether the browser took them;\n * `false` leaves the clipboard as it was (the caller reports its own, classified error).\n */\nexport function legacyCopy(doc: Document, entries: LegacyEntries): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-deprecated -- missing in some webviews; the only copy without the async API\n if (typeof doc.execCommand !== 'function' || !doc.body) return false;\n // Set by the listener: an object, so the check after `execCommand` reads its latest value.\n const seen = { written: false };\n const onCopy = (event: Event): void => {\n const data = (event as ClipboardEvent).clipboardData;\n if (!data) return;\n event.preventDefault();\n // This copy carries an exact payload: page copy handlers and interceptors must not rewrite it.\n event.stopImmediatePropagation();\n try {\n for (const [format, value] of entries) data.setData(format, value);\n seen.written = true;\n } catch {\n // A format the browser refuses: the copy is reported as failed, not thrown into the page.\n }\n };\n\n // Saved first: in some engines reading or moving the selection already moves focus.\n const focus = saveFocus(doc);\n const selection = doc.getSelection();\n const ranges: Range[] = [];\n if (selection) for (let index = 0; index < selection.rangeCount; index += 1) ranges.push(selection.getRangeAt(index));\n\n // The copy command is only enabled over a selection, so select something nobody can see.\n const holder = doc.createElement('span');\n // One character enables the command; the payload itself goes through the event.\n // (The full text here cost 100 ms of layout for a megabyte.)\n holder.textContent = '\\u00a0';\n holder.setAttribute('aria-hidden', 'true');\n // CSSOM, not a style attribute: allowed under a strict Content Security Policy.\n holder.style.cssText = 'position:fixed;top:0;left:0;clip-path:inset(50%);white-space:pre;user-select:text;-webkit-user-select:text';\n\n doc.addEventListener('copy', onCopy, true);\n doc.body.append(holder);\n try {\n if (selection) {\n const range = doc.createRange();\n range.selectNodeContents(holder);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- the only copy without the async API\n doc.execCommand('copy');\n } catch {\n // Reported through `written`, which the listener never set.\n } finally {\n doc.removeEventListener('copy', onCopy, true);\n holder.remove();\n if (selection) {\n selection.removeAllRanges();\n for (const range of ranges) selection.addRange(range);\n }\n restoreFocus(doc, focus);\n }\n return seen.written;\n}\n","import { CopyFailure, createCopyError, type CopyErrorType } from './errors';\nimport { legacyCopy, legacyEntries } from './legacy-copy';\nimport type { OperationContext } from './machine-shared';\nimport { IMAGE_MIME_TYPE, isBlob, serializeJson, type BlobSource, type CopyPayload } from './payload';\n\n/** Minimal structural view of `navigator.clipboard`, so fakes and polyfills fit. */\nexport interface ClipboardLike {\n writeText?(text: string): Promise<void>;\n write?(items: readonly unknown[]): Promise<void>;\n}\n\nexport type ClipboardItemData = Blob | PromiseLike<Blob>;\n\nexport interface ClipboardItemConstructorLike {\n new (items: Record<string, ClipboardItemData>): unknown;\n supports?(type: string): boolean;\n}\n\nexport interface ClipboardEnvironment {\n readonly isSecureContext?: boolean;\n /** For the `execCommand('copy')` fallback; `window` has it. */\n readonly document?: Document | undefined;\n readonly navigator?: { readonly clipboard?: ClipboardLike | undefined } | undefined;\n readonly ClipboardItem?: ClipboardItemConstructorLike | undefined;\n}\n\n/**\n * The only thing the state machine needs. Implement it to target Electron,\n * a native bridge, a test double, or anything else.\n *\n * Contract: start the platform write synchronously (before any `await`) so the\n * browser still sees the user gesture, and reject with a `CopyFailure` when you\n * can classify the error. `context.signal` aborts when the copy is reset or its\n * host unmounts; honour it to stop expensive work early.\n */\nexport interface ClipboardAdapter {\n write(payload: CopyPayload, context?: OperationContext): Promise<void>;\n}\n\nexport interface BrowserClipboardAdapterOptions {\n /** Defaults to `window`, read lazily at copy time (SSR-safe). */\n readonly getEnvironment?: () => ClipboardEnvironment | undefined;\n /** When rich HTML copy is unavailable, fall back to its plain text. Default `true`. */\n readonly degradeHtmlToText?: boolean;\n /**\n * When the async Clipboard API is unavailable (a plain-HTTP page, a webview without\n * `navigator.clipboard`, no `ClipboardItem` for HTML), copy text, HTML and JSON through the\n * browser's `copy` command instead, as `react-copy-to-clipboard` does. Images still need the\n * async API. Default `true`; `false` reports `insecure-context` / `unsupported` instead.\n */\n readonly legacyFallback?: boolean;\n}\n\ninterface RichClipboard {\n readonly Item: ClipboardItemConstructorLike;\n readonly write: (items: readonly unknown[]) => Promise<void>;\n}\n\nconst fail = (type: CopyErrorType, message: string, cause?: unknown): CopyFailure =>\n new CopyFailure(createCopyError(type, message, cause));\n\nconst noop = (): void => undefined;\n\nfunction defaultEnvironment(): ClipboardEnvironment | undefined {\n return typeof window === 'undefined' ? undefined : window;\n}\n\nfunction getRichClipboard(env: ClipboardEnvironment, clipboard: ClipboardLike): RichClipboard | null {\n const Item = env.ClipboardItem;\n if (!Item || typeof clipboard.write !== 'function') return null;\n return { Item, write: clipboard.write.bind(clipboard) };\n}\n\nfunction isTypeSupported(Item: ClipboardItemConstructorLike, type: string): boolean {\n return typeof Item.supports !== 'function' || Item.supports(type);\n}\n\nasync function resolveImageBlob(source: BlobSource, context: OperationContext | undefined): Promise<Blob> {\n let blob: unknown;\n try {\n // Invoked before the first await, i.e. synchronously inside the gesture.\n blob = await (typeof source === 'function' ? source(context ?? { signal: new AbortController().signal }) : source);\n } catch (cause) {\n if (context?.signal.aborted) throw fail('aborted', 'The image copy was cancelled.', cause);\n throw fail('blob-generation-failed', 'The image source threw or rejected while producing a Blob.', cause);\n }\n if (!isBlob(blob)) throw fail('blob-generation-failed', 'The image source did not produce a Blob.');\n if (blob.type !== IMAGE_MIME_TYPE) {\n throw fail(\n 'unsupported-format',\n `Only ${IMAGE_MIME_TYPE} can be written to the clipboard (received \"${blob.type || 'unknown'}\"). ` +\n `Convert with canvas.toBlob(cb, \"${IMAGE_MIME_TYPE}\").`,\n );\n }\n return blob;\n}\n\nasync function writeImage(\n rich: RichClipboard,\n source: BlobSource,\n context: OperationContext | undefined,\n): Promise<void> {\n if (!isTypeSupported(rich.Item, IMAGE_MIME_TYPE)) {\n throw fail('unsupported-format', `This browser cannot write ${IMAGE_MIME_TYPE} to the clipboard.`);\n }\n // Hand ClipboardItem a *promise* so Safari keeps the gesture while the blob is produced.\n const blob = resolveImageBlob(source, context);\n blob.catch(noop); // Never an unhandled rejection, whichever side fails first.\n try {\n await rich.write([new rich.Item({ [IMAGE_MIME_TYPE]: blob })]);\n } catch (error) {\n // Browsers replace our classified reason with a generic DOMException. Prefer ours.\n const reason = await blob.then(noop, (inner: unknown) => inner);\n throw reason ?? error;\n }\n // Conforming browsers have consumed `blob` by now. Lax polyfills/webviews may resolve\n // without reading it: never report an image that failed to generate as copied.\n await blob;\n}\n\nasync function writeToClipboard(\n payload: CopyPayload,\n env: ClipboardEnvironment | undefined,\n settings: Required<Omit<BrowserClipboardAdapterOptions, 'getEnvironment'>>,\n context: OperationContext | undefined,\n): Promise<void> {\n if (!env) throw fail('unsupported', 'No browser environment: the clipboard only exists in the browser.');\n /** Without the async API: the copy command if it can carry this payload, else `failure`. */\n const legacy = (failure: CopyFailure): void => {\n const entries = settings.legacyFallback && env.document ? legacyEntries(payload) : null;\n if (entries && legacyCopy(env.document as Document, entries)) return;\n throw failure;\n };\n if (env.isSecureContext === false) {\n legacy(fail('insecure-context', 'The Clipboard API requires a secure context (HTTPS or localhost).'));\n return;\n }\n const clipboard = env.navigator?.clipboard;\n if (!clipboard) {\n legacy(fail('unsupported', 'navigator.clipboard is not available in this browser.'));\n return;\n }\n\n switch (payload.kind) {\n case 'text':\n case 'json': {\n const text = payload.kind === 'text' ? payload.value : serializeJson(payload);\n if (typeof clipboard.writeText === 'function') return clipboard.writeText(text);\n legacy(fail('unsupported', 'navigator.clipboard.writeText() is not available.'));\n return;\n }\n\n case 'html': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich || !isTypeSupported(rich.Item, 'text/html')) {\n const failure = fail('unsupported-format', 'Rich HTML copy requires ClipboardItem and navigator.clipboard.write().');\n try {\n legacy(failure);\n return;\n } catch {\n if (settings.degradeHtmlToText && typeof clipboard.writeText === 'function') return clipboard.writeText(payload.text);\n throw failure;\n }\n }\n return rich.write([\n new rich.Item({\n 'text/html': new Blob([payload.html], { type: 'text/html' }),\n 'text/plain': new Blob([payload.text], { type: 'text/plain' }),\n }),\n ]);\n }\n\n case 'image': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich) throw fail('unsupported-format', 'Image copy requires ClipboardItem and navigator.clipboard.write().');\n return writeImage(rich, payload.blob, context);\n }\n\n case 'multi': {\n const rich = getRichClipboard(env, clipboard);\n if (!rich) {\n legacy(fail('unsupported-format', 'Multi-format copy requires ClipboardItem and navigator.clipboard.write().'));\n return;\n }\n const record: Record<string, ClipboardItemData> = Object.create(null) as Record<string, ClipboardItemData>;\n let written = 0;\n for (const { mimeType, data, optional } of payload.items) {\n // Optional items need positive confirmation: an unknown type can make the whole write reject.\n if (optional === true && !(typeof rich.Item.supports === 'function' && rich.Item.supports(mimeType))) continue;\n if (!isTypeSupported(rich.Item, mimeType)) {\n throw fail('unsupported-format', `This browser cannot write \"${mimeType}\" to the clipboard.`);\n }\n record[mimeType] = typeof data === 'string' ? new Blob([data], { type: mimeType }) : data;\n written += 1;\n }\n if (written === 0) throw fail('unsupported-format', 'This browser can write none of the payload types.');\n return rich.write([new rich.Item(record)]);\n }\n }\n}\n\n/** The default adapter: async Clipboard API with feature detection and honest errors. */\nexport function createBrowserClipboardAdapter(options: BrowserClipboardAdapterOptions = {}): ClipboardAdapter {\n const getEnvironment = options.getEnvironment ?? defaultEnvironment;\n const settings = { degradeHtmlToText: options.degradeHtmlToText ?? true, legacyFallback: options.legacyFallback ?? true };\n return {\n write: (payload, context) => writeToClipboard(payload, getEnvironment(), settings, context),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAgB,cAAc,SAA4C;CACxE,QAAQ,QAAQ,MAAhB;EACE,KAAK,QACH,OAAO,CAAC,CAAC,cAAc,QAAQ,KAAK,CAAC;EACvC,KAAK,QACH,OAAO,CAAC,CAAC,cAAcA,gBAAAA,cAAc,OAAO,CAAC,CAAC;EAChD,KAAK,QACH,OAAO,CACL,CAAC,aAAa,QAAQ,IAAI,GAC1B,CAAC,cAAc,QAAQ,IAAI,CAC7B;EACF,KAAK,SACH,OAAO;EACT,KAAK,SAAS;GACZ,MAAM,UAAyC,CAAC;GAChD,KAAK,MAAM,EAAE,UAAU,MAAM,cAAc,QAAQ,OACjD,IAAI,OAAO,SAAS,YAAY,CAACC,aAAAA,kBAAkB,QAAQ,GAAG,QAAQ,KAAK,CAAC,UAAU,IAAI,CAAC;QAEtF,IAAI,aAAa,MAAM,OAAO;GAErC,OAAO,QAAQ,SAAS,IAAI,UAAU;EACxC;CACF;AACF;AAIA,SAAS,UAAU,KAAkC;CACnD,MAAM,UAAU,IAAI;CACpB,IAAI,CAAC,WAAW,YAAY,IAAI,MAAM,OAAO;CAC7C,IAAI;EACF,MAAM,EAAE,gBAAgB,OAAO,cAAc,KAAK,oBAAoB,cAAc;EACpF,OAAO,CAAC,SAAS,OAAO,UAAU,YAAY,OAAO,QAAQ,WAAW;GAAC;GAAO;GAAK,aAAa;EAAM,IAAI,IAAI;CAClH,QAAQ;EAEN,OAAO,CAAC,SAAS,IAAI;CACvB;AACF;AAEA,SAAS,aAAa,KAAe,OAAgC;CACnE,IAAI,CAAC,QAAQ,EAAE,CAAC,aAAa;CAC7B,MAAM,CAAC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BAAiB,SAAS,eAAe,GAAG,UAAU,OAAO,EAC5F;AACF"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const require_errors = require("./errors-CF2EQNbc.cjs");
|
|
3
3
|
const require_payload = require("./payload-DjSSLonm.cjs");
|
|
4
4
|
const require_mime = require("./mime--LB7kdqG.cjs");
|
|
5
|
-
const require_clipboard_adapter = require("./clipboard-adapter-
|
|
5
|
+
const require_clipboard_adapter = require("./clipboard-adapter-q_pp9q_x.cjs");
|
|
6
6
|
const require_paste_reader = require("./paste-reader-BL51Jt1y.cjs");
|
|
7
7
|
//#region src/core/copy-coordinator.ts
|
|
8
8
|
function createCopyCoordinator() {
|
|
@@ -1234,4 +1234,4 @@ Object.defineProperty(exports, "watchClipboardPermission", {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
});
|
|
1236
1236
|
|
|
1237
|
-
//# sourceMappingURL=core-
|
|
1237
|
+
//# sourceMappingURL=core-Bi4HUuRs.cjs.map
|