react-smart-copy 1.30.0 → 1.31.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 +4 -1
- package/dist/chunks/copy-machine-B6apNst5.d.ts +132 -0
- package/dist/chunks/copy-machine-CmqX9J4V.d.cts +132 -0
- package/dist/chunks/copy-machine-DwdB-qva.js +292 -0
- package/dist/chunks/copy-machine-DwdB-qva.js.map +1 -0
- package/dist/chunks/copy-machine-oNmnrjMc.cjs +345 -0
- package/dist/chunks/copy-machine-oNmnrjMc.cjs.map +1 -0
- package/dist/chunks/{core-B8_wVOSU.js → core-CNSd-EgZ.js} +4 -290
- package/dist/chunks/core-CNSd-EgZ.js.map +1 -0
- package/dist/chunks/{core-BR8Jgea1.cjs → core-DsMKPNx_.cjs} +20 -348
- package/dist/chunks/core-DsMKPNx_.cjs.map +1 -0
- package/dist/chunks/{index-DjqQGsNs.d.ts → index-B4SEFtkx.d.ts} +3 -131
- package/dist/chunks/{index-uHZHddq0.d.cts → index-BDxj1EqC.d.cts} +3 -131
- package/dist/chunks/text-C2OYT-3o.cjs +478 -0
- package/dist/chunks/text-C2OYT-3o.cjs.map +1 -0
- package/dist/chunks/text-nc1LhgIh.js +413 -0
- package/dist/chunks/text-nc1LhgIh.js.map +1 -0
- package/dist/chunks/utils-C7_VlH79.cjs +53 -0
- package/dist/chunks/utils-C7_VlH79.cjs.map +1 -0
- package/dist/chunks/utils-CBBX2HN6.js +30 -0
- package/dist/chunks/utils-CBBX2HN6.js.map +1 -0
- package/dist/compat.cjs +94 -0
- package/dist/compat.cjs.map +1 -0
- package/dist/compat.d.cts +57 -0
- package/dist/compat.d.ts +57 -0
- package/dist/compat.js +88 -0
- package/dist/compat.js.map +1 -0
- package/dist/core.cjs +8 -7
- package/dist/core.d.cts +2 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +2 -1
- package/dist/index.cjs +45 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -27
- package/dist/index.js.map +1 -1
- package/dist/rich.cjs +14 -422
- package/dist/rich.cjs.map +1 -1
- package/dist/rich.js +1 -409
- package/dist/rich.js.map +1 -1
- package/package.json +20 -1
- package/dist/chunks/core-B8_wVOSU.js.map +0 -1
- package/dist/chunks/core-BR8Jgea1.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4,8 +4,10 @@ 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
6
|
const require_clipboard_adapter = require("./chunks/clipboard-adapter-DYo79Fdq.cjs");
|
|
7
|
-
const require_core = require("./chunks/core-
|
|
7
|
+
const require_core = require("./chunks/core-DsMKPNx_.cjs");
|
|
8
|
+
const require_copy_machine = require("./chunks/copy-machine-oNmnrjMc.cjs");
|
|
8
9
|
const require_paste_reader = require("./chunks/paste-reader-BL51Jt1y.cjs");
|
|
10
|
+
const require_utils = require("./chunks/utils-C7_VlH79.cjs");
|
|
9
11
|
const require_share = require("./chunks/share-0QnaCaoQ.cjs");
|
|
10
12
|
const require_field = require("./chunks/field-C8A5Yxln.cjs");
|
|
11
13
|
let react = require("react");
|
|
@@ -29,33 +31,8 @@ function useCopyGroup() {
|
|
|
29
31
|
return (0, react.useContext)(CopyGroupContext);
|
|
30
32
|
}
|
|
31
33
|
//#endregion
|
|
32
|
-
//#region src/react/utils.ts
|
|
33
|
-
/** `useLayoutEffect` in the browser, `useEffect` on the server (no SSR warning). */
|
|
34
|
-
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
35
|
-
function mergeRefs(...refs) {
|
|
36
|
-
return (node) => {
|
|
37
|
-
for (const ref of refs) if (typeof ref === "function") ref(node);
|
|
38
|
-
else if (ref) ref.current = node;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/** Runs the consumer's handler first; ours is skipped if they call `preventDefault()`. */
|
|
42
|
-
function composeEventHandlers(theirs, ours) {
|
|
43
|
-
return (event) => {
|
|
44
|
-
theirs?.(event);
|
|
45
|
-
if (!event.defaultPrevented) ours(event);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The window an element is in: a pop-out window's (`window.open` plus a portal), not the
|
|
50
|
-
* opener's. Each window's clipboard only works while its own document has focus, and the click
|
|
51
|
-
* happened in this one. Falls back to the global window before the element mounts.
|
|
52
|
-
*/
|
|
53
|
-
function windowOf(element) {
|
|
54
|
-
return element?.ownerDocument.defaultView ?? (typeof window === "undefined" ? void 0 : window);
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
34
|
//#region src/react/useCopy.ts
|
|
58
|
-
const getServerSnapshot$2 = () =>
|
|
35
|
+
const getServerSnapshot$2 = () => require_copy_machine.IDLE_STATE;
|
|
59
36
|
/** An explicit `coordinator` (including `null`) wins over the surrounding `<CopyGroup>`. */
|
|
60
37
|
function withGroup(options, group) {
|
|
61
38
|
return options.coordinator !== void 0 || group === null ? options : {
|
|
@@ -70,13 +47,13 @@ function withGroup(options, group) {
|
|
|
70
47
|
function useCopy(options = {}) {
|
|
71
48
|
const effective = withGroup(options, useCopyGroup());
|
|
72
49
|
const optionsRef = (0, react.useRef)(effective);
|
|
73
|
-
useIsomorphicLayoutEffect(() => {
|
|
50
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
74
51
|
optionsRef.current = effective;
|
|
75
52
|
});
|
|
76
|
-
const [machine] = (0, react.useState)(() =>
|
|
53
|
+
const [machine] = (0, react.useState)(() => require_copy_machine.createCopyMachine(() => optionsRef.current));
|
|
77
54
|
(0, react.useEffect)(() => machine.connect(), [machine]);
|
|
78
55
|
const state = (0, react.useSyncExternalStore)(machine.subscribe, machine.getSnapshot, getServerSnapshot$2);
|
|
79
|
-
const canRetry =
|
|
56
|
+
const canRetry = require_copy_machine.canRetryState(state, effective.maxRetries);
|
|
80
57
|
return (0, react.useMemo)(() => ({
|
|
81
58
|
state,
|
|
82
59
|
status: state.status,
|
|
@@ -109,7 +86,7 @@ function useCopy(options = {}) {
|
|
|
109
86
|
*/
|
|
110
87
|
function useCopyInterceptor(options) {
|
|
111
88
|
const optionsRef = (0, react.useRef)(options);
|
|
112
|
-
useIsomorphicLayoutEffect(() => {
|
|
89
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
113
90
|
optionsRef.current = options;
|
|
114
91
|
});
|
|
115
92
|
const [node, setNode] = (0, react.useState)(null);
|
|
@@ -250,7 +227,7 @@ function useDisplayStatus(status, options = {}) {
|
|
|
250
227
|
const pendingDelayMs = Math.max(0, options.pendingDelayMs ?? 150);
|
|
251
228
|
const minPendingMs = Math.max(0, options.minPendingMs ?? 400);
|
|
252
229
|
const [settled, setSettled] = (0, react.useState)(status === "copying" ? "idle" : status);
|
|
253
|
-
useIsomorphicLayoutEffect(() => {
|
|
230
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
254
231
|
if (status !== "copying") setSettled(status);
|
|
255
232
|
}, [status]);
|
|
256
233
|
const [pendingShownAt, setPendingShownAt] = (0, react.useState)(null);
|
|
@@ -400,7 +377,7 @@ function getDisplayValue(value) {
|
|
|
400
377
|
}
|
|
401
378
|
const Root$1 = /* @__PURE__ */ (0, react.forwardRef)(function CopyFieldRoot({ value, label, copyOptions, messages: messageOverrides, alwaysVisible = false, announce = true, pendingDelayMs, minPendingMs, children, onPointerEnter, onPointerLeave, onPointerDown, onFocus, onBlur, ...rest }, forwardedRef) {
|
|
402
379
|
const rootRef = (0, react.useRef)(null);
|
|
403
|
-
const ownAdapter = (0, react.useMemo)(() => require_clipboard_adapter.createBrowserClipboardAdapter({ getEnvironment: () => windowOf(rootRef.current) }), []);
|
|
380
|
+
const ownAdapter = (0, react.useMemo)(() => require_clipboard_adapter.createBrowserClipboardAdapter({ getEnvironment: () => require_utils.windowOf(rootRef.current) }), []);
|
|
404
381
|
const copyState = useCopy(copyOptions?.adapter ? copyOptions : {
|
|
405
382
|
...copyOptions,
|
|
406
383
|
adapter: ownAdapter
|
|
@@ -420,7 +397,7 @@ const Root$1 = /* @__PURE__ */ (0, react.forwardRef)(function CopyFieldRoot({ va
|
|
|
420
397
|
const { copy } = copyState;
|
|
421
398
|
const copyValue = (0, react.useCallback)(() => copy(value), [copy, value]);
|
|
422
399
|
const { targetProps } = reveal;
|
|
423
|
-
const ref = (0, react.useMemo)(() => mergeRefs(rootRef, targetProps.ref, forwardedRef), [targetProps.ref, forwardedRef]);
|
|
400
|
+
const ref = (0, react.useMemo)(() => require_utils.mergeRefs(rootRef, targetProps.ref, forwardedRef), [targetProps.ref, forwardedRef]);
|
|
424
401
|
const context = (0, react.useMemo)(() => ({
|
|
425
402
|
...copyState,
|
|
426
403
|
label,
|
|
@@ -454,11 +431,11 @@ const Root$1 = /* @__PURE__ */ (0, react.forwardRef)(function CopyFieldRoot({ va
|
|
|
454
431
|
"data-state": state.status,
|
|
455
432
|
"data-display-state": displayStatus,
|
|
456
433
|
"data-revealed": reveal.visible ? "" : void 0,
|
|
457
|
-
onPointerEnter: composeEventHandlers(onPointerEnter, targetProps.onPointerEnter),
|
|
458
|
-
onPointerLeave: composeEventHandlers(onPointerLeave, targetProps.onPointerLeave),
|
|
459
|
-
onPointerDown: composeEventHandlers(onPointerDown, targetProps.onPointerDown),
|
|
460
|
-
onFocus: composeEventHandlers(onFocus, targetProps.onFocus),
|
|
461
|
-
onBlur: composeEventHandlers(onBlur, targetProps.onBlur),
|
|
434
|
+
onPointerEnter: require_utils.composeEventHandlers(onPointerEnter, targetProps.onPointerEnter),
|
|
435
|
+
onPointerLeave: require_utils.composeEventHandlers(onPointerLeave, targetProps.onPointerLeave),
|
|
436
|
+
onPointerDown: require_utils.composeEventHandlers(onPointerDown, targetProps.onPointerDown),
|
|
437
|
+
onFocus: require_utils.composeEventHandlers(onFocus, targetProps.onFocus),
|
|
438
|
+
onBlur: require_utils.composeEventHandlers(onBlur, targetProps.onBlur),
|
|
462
439
|
children: [children, announce ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LiveRegion, { message: announcement }) : null]
|
|
463
440
|
})
|
|
464
441
|
});
|
|
@@ -518,7 +495,7 @@ const CopyField = {
|
|
|
518
495
|
"data-state": field.status,
|
|
519
496
|
"data-display-state": field.displayStatus,
|
|
520
497
|
"data-revealed": field.revealed ? "" : void 0,
|
|
521
|
-
onClick: composeEventHandlers(onClick, () => {
|
|
498
|
+
onClick: require_utils.composeEventHandlers(onClick, () => {
|
|
522
499
|
field.copyValue();
|
|
523
500
|
}),
|
|
524
501
|
children: typeof children === "function" ? children(renderProps) : children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriggerLabel, {
|
|
@@ -551,7 +528,7 @@ const dropEffectFor = (allowed) => /^(all|uninitialized|copy)/.test(allowed) ? "
|
|
|
551
528
|
*/
|
|
552
529
|
function usePaste(options = {}) {
|
|
553
530
|
const optionsRef = (0, react.useRef)(options);
|
|
554
|
-
useIsomorphicLayoutEffect(() => {
|
|
531
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
555
532
|
optionsRef.current = options;
|
|
556
533
|
});
|
|
557
534
|
const [machine] = (0, react.useState)(() => require_core.createPasteMachine(() => optionsRef.current));
|
|
@@ -656,7 +633,7 @@ function usePasteDisplayStatus(status, options = {}) {
|
|
|
656
633
|
const pendingDelayMs = Math.max(0, options.pendingDelayMs ?? 150);
|
|
657
634
|
const minPendingMs = Math.max(0, options.minPendingMs ?? 400);
|
|
658
635
|
const [settled, setSettled] = (0, react.useState)(status === "reading" ? "idle" : status);
|
|
659
|
-
useIsomorphicLayoutEffect(() => {
|
|
636
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
660
637
|
if (status !== "reading") setSettled(status);
|
|
661
638
|
}, [status]);
|
|
662
639
|
const [pendingShownAt, setPendingShownAt] = (0, react.useState)(null);
|
|
@@ -704,7 +681,7 @@ function usePasteField() {
|
|
|
704
681
|
}
|
|
705
682
|
const Root = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldRoot({ label, pasteOptions, messages: messageOverrides, alwaysVisible = false, announce = true, pendingDelayMs, minPendingMs, children, onPointerEnter, onPointerLeave, onPointerDown, onFocus, onBlur, ...rest }, forwardedRef) {
|
|
706
683
|
const rootRef = (0, react.useRef)(null);
|
|
707
|
-
const ownAdapter = (0, react.useMemo)(() => require_core.createBrowserPasteAdapter({ getEnvironment: () => windowOf(rootRef.current) }), []);
|
|
684
|
+
const ownAdapter = (0, react.useMemo)(() => require_core.createBrowserPasteAdapter({ getEnvironment: () => require_utils.windowOf(rootRef.current) }), []);
|
|
708
685
|
const pasteState = usePaste(pasteOptions?.adapter ? pasteOptions : {
|
|
709
686
|
...pasteOptions,
|
|
710
687
|
adapter: ownAdapter
|
|
@@ -725,7 +702,7 @@ const Root = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldRoot({ lab
|
|
|
725
702
|
const { paste: machinePaste } = pasteState;
|
|
726
703
|
const doPaste = (0, react.useCallback)(() => machinePaste(), [machinePaste]);
|
|
727
704
|
const { targetProps } = reveal;
|
|
728
|
-
const ref = (0, react.useMemo)(() => mergeRefs(rootRef, targetProps.ref, forwardedRef), [targetProps.ref, forwardedRef]);
|
|
705
|
+
const ref = (0, react.useMemo)(() => require_utils.mergeRefs(rootRef, targetProps.ref, forwardedRef), [targetProps.ref, forwardedRef]);
|
|
729
706
|
const context = (0, react.useMemo)(() => ({
|
|
730
707
|
...pasteState,
|
|
731
708
|
label,
|
|
@@ -761,11 +738,11 @@ const Root = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldRoot({ lab
|
|
|
761
738
|
"data-state": state.status,
|
|
762
739
|
"data-display-state": displayStatus,
|
|
763
740
|
"data-revealed": reveal.visible ? "" : void 0,
|
|
764
|
-
onPointerEnter: composeEventHandlers(onPointerEnter, targetProps.onPointerEnter),
|
|
765
|
-
onPointerLeave: composeEventHandlers(onPointerLeave, targetProps.onPointerLeave),
|
|
766
|
-
onPointerDown: composeEventHandlers(onPointerDown, targetProps.onPointerDown),
|
|
767
|
-
onFocus: composeEventHandlers(onFocus, targetProps.onFocus),
|
|
768
|
-
onBlur: composeEventHandlers(onBlur, targetProps.onBlur),
|
|
741
|
+
onPointerEnter: require_utils.composeEventHandlers(onPointerEnter, targetProps.onPointerEnter),
|
|
742
|
+
onPointerLeave: require_utils.composeEventHandlers(onPointerLeave, targetProps.onPointerLeave),
|
|
743
|
+
onPointerDown: require_utils.composeEventHandlers(onPointerDown, targetProps.onPointerDown),
|
|
744
|
+
onFocus: require_utils.composeEventHandlers(onFocus, targetProps.onFocus),
|
|
745
|
+
onBlur: require_utils.composeEventHandlers(onBlur, targetProps.onBlur),
|
|
769
746
|
children: [children, announce ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LiveRegion, { message: announcement }) : null]
|
|
770
747
|
})
|
|
771
748
|
});
|
|
@@ -817,7 +794,7 @@ const Zone = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldZone({ chi
|
|
|
817
794
|
onDragLeave,
|
|
818
795
|
onDrop
|
|
819
796
|
};
|
|
820
|
-
if (droppable) for (const key of Object.keys(dropTargetProps)) drop[key] = composeEventHandlers(drop[key], dropTargetProps[key]);
|
|
797
|
+
if (droppable) for (const key of Object.keys(dropTargetProps)) drop[key] = require_utils.composeEventHandlers(drop[key], dropTargetProps[key]);
|
|
821
798
|
const safeAriaLabel = (ariaLabel ?? field.messages.zoneLabel(field.label)) || defaultPasteFieldMessages.zoneLabel(field.label);
|
|
822
799
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
823
800
|
"aria-keyshortcuts": "Control+V Meta+V",
|
|
@@ -831,7 +808,7 @@ const Zone = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldZone({ chi
|
|
|
831
808
|
"data-display-state": field.displayStatus,
|
|
832
809
|
"data-drag-over": droppable && field.isDragOver ? "" : void 0,
|
|
833
810
|
tabIndex: tabIndex ?? (focusable ? 0 : void 0),
|
|
834
|
-
onPaste: composeEventHandlers(onPaste, targetProps.onPaste),
|
|
811
|
+
onPaste: require_utils.composeEventHandlers(onPaste, targetProps.onPaste),
|
|
835
812
|
...drop,
|
|
836
813
|
children
|
|
837
814
|
});
|
|
@@ -861,7 +838,7 @@ const Trigger = /* @__PURE__ */ (0, react.forwardRef)(function PasteFieldTrigger
|
|
|
861
838
|
"data-state": field.status,
|
|
862
839
|
"data-display-state": field.displayStatus,
|
|
863
840
|
"data-revealed": field.revealed ? "" : void 0,
|
|
864
|
-
onClick: composeEventHandlers(onClick, () => {
|
|
841
|
+
onClick: require_utils.composeEventHandlers(onClick, () => {
|
|
865
842
|
field.doPaste();
|
|
866
843
|
}),
|
|
867
844
|
children: typeof children === "function" ? children(renderProps) : children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TriggerLabel, {
|
|
@@ -974,7 +951,7 @@ const PasteField = {
|
|
|
974
951
|
*/
|
|
975
952
|
function useDragCopy(options) {
|
|
976
953
|
const optionsRef = (0, react.useRef)(options);
|
|
977
|
-
useIsomorphicLayoutEffect(() => {
|
|
954
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
978
955
|
optionsRef.current = options;
|
|
979
956
|
});
|
|
980
957
|
const [node, setNode] = (0, react.useState)(null);
|
|
@@ -994,8 +971,8 @@ function useDragCopy(options) {
|
|
|
994
971
|
outcome
|
|
995
972
|
};
|
|
996
973
|
setState(next);
|
|
997
|
-
if (outcome.status === "failed")
|
|
998
|
-
|
|
974
|
+
if (outcome.status === "failed") require_copy_machine.invoke(onError, outcome.error);
|
|
975
|
+
require_copy_machine.invoke(onDrag, next);
|
|
999
976
|
}, []);
|
|
1000
977
|
(0, react.useEffect)(() => {
|
|
1001
978
|
if (!node || !enabled) return void 0;
|
|
@@ -1022,8 +999,8 @@ function useDragCopy(options) {
|
|
|
1022
999
|
outcome
|
|
1023
1000
|
};
|
|
1024
1001
|
setState(next);
|
|
1025
|
-
if (outcome.status === "failed")
|
|
1026
|
-
|
|
1002
|
+
if (outcome.status === "failed") require_copy_machine.invoke(onError, outcome.error);
|
|
1003
|
+
require_copy_machine.invoke(onDrag, next);
|
|
1027
1004
|
}
|
|
1028
1005
|
function handleDragEnd() {
|
|
1029
1006
|
const opts = optionsRef.current;
|
|
@@ -1032,7 +1009,7 @@ function useDragCopy(options) {
|
|
|
1032
1009
|
status: "done",
|
|
1033
1010
|
outcome: prev.outcome
|
|
1034
1011
|
};
|
|
1035
|
-
|
|
1012
|
+
require_copy_machine.invoke(opts.onDrag, next);
|
|
1036
1013
|
return next;
|
|
1037
1014
|
});
|
|
1038
1015
|
}
|
|
@@ -1069,7 +1046,7 @@ const IGNORED = /* @__PURE__ */ Object.freeze({
|
|
|
1069
1046
|
});
|
|
1070
1047
|
function resetDelay(value) {
|
|
1071
1048
|
if (value === false || value === Infinity) return null;
|
|
1072
|
-
return value === void 0 || Number.isNaN(value) ?
|
|
1049
|
+
return value === void 0 || Number.isNaN(value) ? require_copy_machine.DEFAULT_RESET_AFTER_MS : Math.max(0, value);
|
|
1073
1050
|
}
|
|
1074
1051
|
const statusOf = (outcome) => outcome.status === "cancelled" ? "idle" : outcome.status;
|
|
1075
1052
|
/**
|
|
@@ -1085,7 +1062,7 @@ const statusOf = (outcome) => outcome.status === "cancelled" ? "idle" : outcome.
|
|
|
1085
1062
|
*/
|
|
1086
1063
|
function useShare(options = {}) {
|
|
1087
1064
|
const optionsRef = (0, react.useRef)(options);
|
|
1088
|
-
useIsomorphicLayoutEffect(() => {
|
|
1065
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
1089
1066
|
optionsRef.current = options;
|
|
1090
1067
|
});
|
|
1091
1068
|
const [state, setState] = (0, react.useState)(IDLE);
|
|
@@ -1172,7 +1149,7 @@ const defaultLabel = (numeric) => (index, length) => `${numeric ? "Digit" : "Cha
|
|
|
1172
1149
|
*/
|
|
1173
1150
|
function useOtpField(options = {}) {
|
|
1174
1151
|
const latest = (0, react.useRef)(options);
|
|
1175
|
-
useIsomorphicLayoutEffect(() => {
|
|
1152
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
1176
1153
|
latest.current = options;
|
|
1177
1154
|
});
|
|
1178
1155
|
const length = options.length ?? 6;
|
|
@@ -1196,7 +1173,7 @@ function useOtpField(options = {}) {
|
|
|
1196
1173
|
elements.current[index] = element;
|
|
1197
1174
|
}), [length]);
|
|
1198
1175
|
const attached = (0, react.useRef)(null);
|
|
1199
|
-
useIsomorphicLayoutEffect(() => {
|
|
1176
|
+
require_utils.useIsomorphicLayoutEffect(() => {
|
|
1200
1177
|
const inputs = elements.current.slice(0, length).filter((element) => element !== null);
|
|
1201
1178
|
const current = attached.current;
|
|
1202
1179
|
if (current !== null && current.field === field && current.inputs.length === inputs.length && current.inputs.every((input, index) => input === inputs[index])) return;
|
|
@@ -1244,7 +1221,7 @@ exports.CopyFailure = require_errors.CopyFailure;
|
|
|
1244
1221
|
exports.CopyField = CopyField;
|
|
1245
1222
|
exports.CopyGroup = CopyGroup;
|
|
1246
1223
|
exports.DEFAULT_INTERCEPTED_EVENTS = require_core.DEFAULT_INTERCEPTED_EVENTS;
|
|
1247
|
-
exports.DEFAULT_MAX_RETRIES =
|
|
1224
|
+
exports.DEFAULT_MAX_RETRIES = require_copy_machine.DEFAULT_MAX_RETRIES;
|
|
1248
1225
|
exports.DEFAULT_MIN_PENDING_MS = DEFAULT_MIN_PENDING_MS;
|
|
1249
1226
|
exports.DEFAULT_PASTE_ACCEPT = require_paste_reader.DEFAULT_PASTE_ACCEPT;
|
|
1250
1227
|
exports.DEFAULT_PASTE_MAX_BYTES = require_paste_reader.DEFAULT_PASTE_MAX_BYTES;
|
|
@@ -1252,8 +1229,8 @@ exports.DEFAULT_PASTE_MAX_ITEMS = require_paste_reader.DEFAULT_PASTE_MAX_ITEMS;
|
|
|
1252
1229
|
exports.DEFAULT_PASTE_MIN_PENDING_MS = DEFAULT_PASTE_MIN_PENDING_MS;
|
|
1253
1230
|
exports.DEFAULT_PASTE_PENDING_DELAY_MS = DEFAULT_PASTE_PENDING_DELAY_MS;
|
|
1254
1231
|
exports.DEFAULT_PENDING_DELAY_MS = DEFAULT_PENDING_DELAY_MS;
|
|
1255
|
-
exports.DEFAULT_RESET_AFTER_MS =
|
|
1256
|
-
exports.IDLE_STATE =
|
|
1232
|
+
exports.DEFAULT_RESET_AFTER_MS = require_copy_machine.DEFAULT_RESET_AFTER_MS;
|
|
1233
|
+
exports.IDLE_STATE = require_copy_machine.IDLE_STATE;
|
|
1257
1234
|
exports.IMAGE_MIME_TYPE = require_payload.IMAGE_MIME_TYPE;
|
|
1258
1235
|
exports.LiveRegion = LiveRegion;
|
|
1259
1236
|
exports.PASTE_IDLE_STATE = require_core.PASTE_IDLE_STATE;
|
|
@@ -1263,13 +1240,13 @@ exports.WEB_CUSTOM_FORMAT_PREFIX = require_mime.WEB_CUSTOM_FORMAT_PREFIX;
|
|
|
1263
1240
|
exports.applyDragCopy = require_core.applyDragCopy;
|
|
1264
1241
|
exports.canAcceptDrag = require_paste_reader.canAcceptDrag;
|
|
1265
1242
|
exports.canRetryPasteState = require_core.canRetryPasteState;
|
|
1266
|
-
exports.canRetryState =
|
|
1243
|
+
exports.canRetryState = require_copy_machine.canRetryState;
|
|
1267
1244
|
exports.copyFailure = require_errors.copyFailure;
|
|
1268
1245
|
exports.createBrowserClipboardAdapter = require_clipboard_adapter.createBrowserClipboardAdapter;
|
|
1269
1246
|
exports.createBrowserPasteAdapter = require_core.createBrowserPasteAdapter;
|
|
1270
1247
|
exports.createCopyCoordinator = require_core.createCopyCoordinator;
|
|
1271
1248
|
exports.createCopyError = require_errors.createCopyError;
|
|
1272
|
-
exports.createCopyMachine =
|
|
1249
|
+
exports.createCopyMachine = require_copy_machine.createCopyMachine;
|
|
1273
1250
|
exports.createPasteMachine = require_core.createPasteMachine;
|
|
1274
1251
|
exports.defaultCopyFieldMessages = defaultCopyFieldMessages;
|
|
1275
1252
|
exports.defaultPasteFieldMessages = defaultPasteFieldMessages;
|
|
@@ -1289,7 +1266,7 @@ exports.readClipboardPermission = require_core.readClipboardPermission;
|
|
|
1289
1266
|
exports.readCopySelection = require_core.readCopySelection;
|
|
1290
1267
|
exports.registerCopyInterceptor = require_core.registerCopyInterceptor;
|
|
1291
1268
|
exports.registerDragCopy = require_core.registerDragCopy;
|
|
1292
|
-
exports.resolveMaxRetries =
|
|
1269
|
+
exports.resolveMaxRetries = require_copy_machine.resolveMaxRetries;
|
|
1293
1270
|
exports.resolvePasteReadOptions = require_paste_reader.resolvePasteReadOptions;
|
|
1294
1271
|
exports.serializeJson = require_payload.serializeJson;
|
|
1295
1272
|
exports.sniffImageBytes = require_mime.sniffImageBytes;
|