react-grab 0.0.73 → 0.0.74
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/{chunk-6ZPKD3CA.cjs → chunk-DV467MQN.cjs} +37 -16
- package/dist/{chunk-KXX6WKZA.js → chunk-ZK4APTZS.js} +37 -16
- package/dist/{core-eQvDkDGv.d.cts → core-CzaOp9UL.d.cts} +22 -1
- package/dist/{core-eQvDkDGv.d.ts → core-CzaOp9UL.d.ts} +22 -1
- package/dist/core.cjs +7 -7
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +19 -19
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1080,7 +1080,7 @@ var buildOpenFileUrl = (filePath, lineNumber) => {
|
|
|
1080
1080
|
};
|
|
1081
1081
|
|
|
1082
1082
|
// src/constants.ts
|
|
1083
|
-
var VERSION = "0.0.
|
|
1083
|
+
var VERSION = "0.0.74";
|
|
1084
1084
|
var VIEWPORT_MARGIN_PX = 8;
|
|
1085
1085
|
var OFFSCREEN_POSITION = -1e3;
|
|
1086
1086
|
var SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -1089,6 +1089,7 @@ var COPIED_LABEL_DURATION_MS = 1500;
|
|
|
1089
1089
|
var SELECTION_CURSOR_SETTLE_DELAY_MS = 500;
|
|
1090
1090
|
var BLUR_DEACTIVATION_THRESHOLD_MS = 500;
|
|
1091
1091
|
var INPUT_FOCUS_ACTIVATION_DELAY_MS = 150;
|
|
1092
|
+
var DEFAULT_KEY_HOLD_DURATION_MS = 200;
|
|
1092
1093
|
var DRAG_THRESHOLD_PX = 2;
|
|
1093
1094
|
var ELEMENT_DETECTION_THROTTLE_MS = 32;
|
|
1094
1095
|
var BOUNDS_RECALC_INTERVAL_MS = 100;
|
|
@@ -3809,7 +3810,7 @@ var Crosshair = (props) => {
|
|
|
3809
3810
|
var useSpeechRecognition = (options) => {
|
|
3810
3811
|
let speechRecognition;
|
|
3811
3812
|
const [isListening, setIsListening] = createSignal(false);
|
|
3812
|
-
const isSupported = () => typeof window !== "undefined" && (
|
|
3813
|
+
const isSupported = () => typeof window !== "undefined" && (Boolean(window.SpeechRecognition) || Boolean(window.webkitSpeechRecognition));
|
|
3813
3814
|
const start = () => {
|
|
3814
3815
|
if (!isSupported()) return;
|
|
3815
3816
|
const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
@@ -4171,6 +4172,15 @@ var SelectionLabel = (props) => {
|
|
|
4171
4172
|
resetIdleTimer();
|
|
4172
4173
|
}
|
|
4173
4174
|
});
|
|
4175
|
+
createEffect(() => {
|
|
4176
|
+
void props.tagName;
|
|
4177
|
+
void props.componentName;
|
|
4178
|
+
void props.statusText;
|
|
4179
|
+
void props.inputValue;
|
|
4180
|
+
void props.hasAgent;
|
|
4181
|
+
void props.isInputExpanded;
|
|
4182
|
+
requestAnimationFrame(measureContainer);
|
|
4183
|
+
});
|
|
4174
4184
|
createEffect(() => {
|
|
4175
4185
|
if (props.visible) {
|
|
4176
4186
|
requestAnimationFrame(measureContainer);
|
|
@@ -4395,7 +4405,7 @@ var SelectionLabel = (props) => {
|
|
|
4395
4405
|
onClick: handleSubmit,
|
|
4396
4406
|
shrink: true,
|
|
4397
4407
|
get hasParent() {
|
|
4398
|
-
return
|
|
4408
|
+
return Boolean(props.componentName);
|
|
4399
4409
|
},
|
|
4400
4410
|
get hasAgent() {
|
|
4401
4411
|
return props.hasAgent;
|
|
@@ -4482,7 +4492,7 @@ var SelectionLabel = (props) => {
|
|
|
4482
4492
|
dimmed: true,
|
|
4483
4493
|
shrink: true,
|
|
4484
4494
|
get hasParent() {
|
|
4485
|
-
return
|
|
4495
|
+
return Boolean(props.componentName);
|
|
4486
4496
|
},
|
|
4487
4497
|
get hasAgent() {
|
|
4488
4498
|
return props.hasAgent;
|
|
@@ -6728,13 +6738,15 @@ var init = (rawOptions) => {
|
|
|
6728
6738
|
},
|
|
6729
6739
|
getTheme: () => initialTheme,
|
|
6730
6740
|
setAgent: () => {
|
|
6741
|
+
},
|
|
6742
|
+
updateOptions: () => {
|
|
6731
6743
|
}
|
|
6732
6744
|
};
|
|
6733
6745
|
}
|
|
6734
6746
|
const scriptOptions = getScriptOptions();
|
|
6735
|
-
|
|
6747
|
+
let options = {
|
|
6736
6748
|
enabled: true,
|
|
6737
|
-
keyHoldDuration:
|
|
6749
|
+
keyHoldDuration: DEFAULT_KEY_HOLD_DURATION_MS,
|
|
6738
6750
|
allowActivationInsideInput: true,
|
|
6739
6751
|
maxContextLines: 3,
|
|
6740
6752
|
...scriptOptions,
|
|
@@ -6765,13 +6777,15 @@ var init = (rawOptions) => {
|
|
|
6765
6777
|
},
|
|
6766
6778
|
getTheme: () => mergedTheme,
|
|
6767
6779
|
setAgent: () => {
|
|
6780
|
+
},
|
|
6781
|
+
updateOptions: () => {
|
|
6768
6782
|
}
|
|
6769
6783
|
};
|
|
6770
6784
|
}
|
|
6771
6785
|
hasInited = true;
|
|
6772
6786
|
const logIntro = () => {
|
|
6773
6787
|
try {
|
|
6774
|
-
const version = "0.0.
|
|
6788
|
+
const version = "0.0.74";
|
|
6775
6789
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
6776
6790
|
console.log(`%cReact Grab${version ? ` v${version}` : ""}%c
|
|
6777
6791
|
https://react-grab.com`, `background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${logoDataUri}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`, "");
|
|
@@ -7025,9 +7039,6 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7025
7039
|
});
|
|
7026
7040
|
}
|
|
7027
7041
|
}
|
|
7028
|
-
if (didCopy) {
|
|
7029
|
-
options.onCopySuccess?.(elements, copiedContent);
|
|
7030
|
-
}
|
|
7031
7042
|
} catch (error) {
|
|
7032
7043
|
options.onCopyError?.(error);
|
|
7033
7044
|
const plainTextContentOnly = createCombinedTextContent(elements);
|
|
@@ -7041,6 +7052,9 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7041
7052
|
});
|
|
7042
7053
|
}
|
|
7043
7054
|
}
|
|
7055
|
+
if (didCopy) {
|
|
7056
|
+
options.onCopySuccess?.(elements, copiedContent);
|
|
7057
|
+
}
|
|
7044
7058
|
options.onAfterCopy?.(elements, didCopy);
|
|
7045
7059
|
return didCopy;
|
|
7046
7060
|
};
|
|
@@ -7306,7 +7320,7 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7306
7320
|
}));
|
|
7307
7321
|
const startProgressAnimation = (duration) => {
|
|
7308
7322
|
const startTime = Date.now();
|
|
7309
|
-
const animationDuration = options.keyHoldDuration;
|
|
7323
|
+
const animationDuration = options.keyHoldDuration ?? DEFAULT_KEY_HOLD_DURATION_MS;
|
|
7310
7324
|
setProgressStartTime(startTime);
|
|
7311
7325
|
const animateProgress = () => {
|
|
7312
7326
|
const currentStartTime = progressStartTime();
|
|
@@ -7813,7 +7827,8 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7813
7827
|
if (!isHoldingKeys()) {
|
|
7814
7828
|
setIsHoldingKeys(true);
|
|
7815
7829
|
}
|
|
7816
|
-
const
|
|
7830
|
+
const keyHoldDuration = options.keyHoldDuration ?? DEFAULT_KEY_HOLD_DURATION_MS;
|
|
7831
|
+
const activationDuration = isKeyboardEventTriggeredByInput(event) ? keyHoldDuration + INPUT_FOCUS_ACTIVATION_DELAY_MS : keyHoldDuration;
|
|
7817
7832
|
holdTimerId = window.setTimeout(() => {
|
|
7818
7833
|
activateRenderer();
|
|
7819
7834
|
}, activationDuration);
|
|
@@ -7835,10 +7850,10 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7835
7850
|
altKey
|
|
7836
7851
|
} = options.activationKey;
|
|
7837
7852
|
return {
|
|
7838
|
-
metaKey:
|
|
7839
|
-
ctrlKey:
|
|
7840
|
-
shiftKey:
|
|
7841
|
-
altKey:
|
|
7853
|
+
metaKey: Boolean(metaKey),
|
|
7854
|
+
ctrlKey: Boolean(ctrlKey),
|
|
7855
|
+
shiftKey: Boolean(shiftKey),
|
|
7856
|
+
altKey: Boolean(altKey)
|
|
7842
7857
|
};
|
|
7843
7858
|
}
|
|
7844
7859
|
return {
|
|
@@ -8316,6 +8331,12 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
8316
8331
|
});
|
|
8317
8332
|
}
|
|
8318
8333
|
agentManager.tryResumeSessions();
|
|
8334
|
+
},
|
|
8335
|
+
updateOptions: (newOptions) => {
|
|
8336
|
+
options = {
|
|
8337
|
+
...options,
|
|
8338
|
+
...newOptions
|
|
8339
|
+
};
|
|
8319
8340
|
}
|
|
8320
8341
|
};
|
|
8321
8342
|
});
|
|
@@ -1078,7 +1078,7 @@ var buildOpenFileUrl = (filePath, lineNumber) => {
|
|
|
1078
1078
|
};
|
|
1079
1079
|
|
|
1080
1080
|
// src/constants.ts
|
|
1081
|
-
var VERSION = "0.0.
|
|
1081
|
+
var VERSION = "0.0.74";
|
|
1082
1082
|
var VIEWPORT_MARGIN_PX = 8;
|
|
1083
1083
|
var OFFSCREEN_POSITION = -1e3;
|
|
1084
1084
|
var SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -1087,6 +1087,7 @@ var COPIED_LABEL_DURATION_MS = 1500;
|
|
|
1087
1087
|
var SELECTION_CURSOR_SETTLE_DELAY_MS = 500;
|
|
1088
1088
|
var BLUR_DEACTIVATION_THRESHOLD_MS = 500;
|
|
1089
1089
|
var INPUT_FOCUS_ACTIVATION_DELAY_MS = 150;
|
|
1090
|
+
var DEFAULT_KEY_HOLD_DURATION_MS = 200;
|
|
1090
1091
|
var DRAG_THRESHOLD_PX = 2;
|
|
1091
1092
|
var ELEMENT_DETECTION_THROTTLE_MS = 32;
|
|
1092
1093
|
var BOUNDS_RECALC_INTERVAL_MS = 100;
|
|
@@ -3807,7 +3808,7 @@ var Crosshair = (props) => {
|
|
|
3807
3808
|
var useSpeechRecognition = (options) => {
|
|
3808
3809
|
let speechRecognition;
|
|
3809
3810
|
const [isListening, setIsListening] = createSignal(false);
|
|
3810
|
-
const isSupported = () => typeof window !== "undefined" && (
|
|
3811
|
+
const isSupported = () => typeof window !== "undefined" && (Boolean(window.SpeechRecognition) || Boolean(window.webkitSpeechRecognition));
|
|
3811
3812
|
const start = () => {
|
|
3812
3813
|
if (!isSupported()) return;
|
|
3813
3814
|
const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
@@ -4169,6 +4170,15 @@ var SelectionLabel = (props) => {
|
|
|
4169
4170
|
resetIdleTimer();
|
|
4170
4171
|
}
|
|
4171
4172
|
});
|
|
4173
|
+
createEffect(() => {
|
|
4174
|
+
void props.tagName;
|
|
4175
|
+
void props.componentName;
|
|
4176
|
+
void props.statusText;
|
|
4177
|
+
void props.inputValue;
|
|
4178
|
+
void props.hasAgent;
|
|
4179
|
+
void props.isInputExpanded;
|
|
4180
|
+
requestAnimationFrame(measureContainer);
|
|
4181
|
+
});
|
|
4172
4182
|
createEffect(() => {
|
|
4173
4183
|
if (props.visible) {
|
|
4174
4184
|
requestAnimationFrame(measureContainer);
|
|
@@ -4393,7 +4403,7 @@ var SelectionLabel = (props) => {
|
|
|
4393
4403
|
onClick: handleSubmit,
|
|
4394
4404
|
shrink: true,
|
|
4395
4405
|
get hasParent() {
|
|
4396
|
-
return
|
|
4406
|
+
return Boolean(props.componentName);
|
|
4397
4407
|
},
|
|
4398
4408
|
get hasAgent() {
|
|
4399
4409
|
return props.hasAgent;
|
|
@@ -4480,7 +4490,7 @@ var SelectionLabel = (props) => {
|
|
|
4480
4490
|
dimmed: true,
|
|
4481
4491
|
shrink: true,
|
|
4482
4492
|
get hasParent() {
|
|
4483
|
-
return
|
|
4493
|
+
return Boolean(props.componentName);
|
|
4484
4494
|
},
|
|
4485
4495
|
get hasAgent() {
|
|
4486
4496
|
return props.hasAgent;
|
|
@@ -6726,13 +6736,15 @@ var init = (rawOptions) => {
|
|
|
6726
6736
|
},
|
|
6727
6737
|
getTheme: () => initialTheme,
|
|
6728
6738
|
setAgent: () => {
|
|
6739
|
+
},
|
|
6740
|
+
updateOptions: () => {
|
|
6729
6741
|
}
|
|
6730
6742
|
};
|
|
6731
6743
|
}
|
|
6732
6744
|
const scriptOptions = getScriptOptions();
|
|
6733
|
-
|
|
6745
|
+
let options = {
|
|
6734
6746
|
enabled: true,
|
|
6735
|
-
keyHoldDuration:
|
|
6747
|
+
keyHoldDuration: DEFAULT_KEY_HOLD_DURATION_MS,
|
|
6736
6748
|
allowActivationInsideInput: true,
|
|
6737
6749
|
maxContextLines: 3,
|
|
6738
6750
|
...scriptOptions,
|
|
@@ -6763,13 +6775,15 @@ var init = (rawOptions) => {
|
|
|
6763
6775
|
},
|
|
6764
6776
|
getTheme: () => mergedTheme,
|
|
6765
6777
|
setAgent: () => {
|
|
6778
|
+
},
|
|
6779
|
+
updateOptions: () => {
|
|
6766
6780
|
}
|
|
6767
6781
|
};
|
|
6768
6782
|
}
|
|
6769
6783
|
hasInited = true;
|
|
6770
6784
|
const logIntro = () => {
|
|
6771
6785
|
try {
|
|
6772
|
-
const version = "0.0.
|
|
6786
|
+
const version = "0.0.74";
|
|
6773
6787
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
6774
6788
|
console.log(`%cReact Grab${version ? ` v${version}` : ""}%c
|
|
6775
6789
|
https://react-grab.com`, `background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${logoDataUri}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`, "");
|
|
@@ -7023,9 +7037,6 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7023
7037
|
});
|
|
7024
7038
|
}
|
|
7025
7039
|
}
|
|
7026
|
-
if (didCopy) {
|
|
7027
|
-
options.onCopySuccess?.(elements, copiedContent);
|
|
7028
|
-
}
|
|
7029
7040
|
} catch (error) {
|
|
7030
7041
|
options.onCopyError?.(error);
|
|
7031
7042
|
const plainTextContentOnly = createCombinedTextContent(elements);
|
|
@@ -7039,6 +7050,9 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7039
7050
|
});
|
|
7040
7051
|
}
|
|
7041
7052
|
}
|
|
7053
|
+
if (didCopy) {
|
|
7054
|
+
options.onCopySuccess?.(elements, copiedContent);
|
|
7055
|
+
}
|
|
7042
7056
|
options.onAfterCopy?.(elements, didCopy);
|
|
7043
7057
|
return didCopy;
|
|
7044
7058
|
};
|
|
@@ -7304,7 +7318,7 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7304
7318
|
}));
|
|
7305
7319
|
const startProgressAnimation = (duration) => {
|
|
7306
7320
|
const startTime = Date.now();
|
|
7307
|
-
const animationDuration = options.keyHoldDuration;
|
|
7321
|
+
const animationDuration = options.keyHoldDuration ?? DEFAULT_KEY_HOLD_DURATION_MS;
|
|
7308
7322
|
setProgressStartTime(startTime);
|
|
7309
7323
|
const animateProgress = () => {
|
|
7310
7324
|
const currentStartTime = progressStartTime();
|
|
@@ -7811,7 +7825,8 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7811
7825
|
if (!isHoldingKeys()) {
|
|
7812
7826
|
setIsHoldingKeys(true);
|
|
7813
7827
|
}
|
|
7814
|
-
const
|
|
7828
|
+
const keyHoldDuration = options.keyHoldDuration ?? DEFAULT_KEY_HOLD_DURATION_MS;
|
|
7829
|
+
const activationDuration = isKeyboardEventTriggeredByInput(event) ? keyHoldDuration + INPUT_FOCUS_ACTIVATION_DELAY_MS : keyHoldDuration;
|
|
7815
7830
|
holdTimerId = window.setTimeout(() => {
|
|
7816
7831
|
activateRenderer();
|
|
7817
7832
|
}, activationDuration);
|
|
@@ -7833,10 +7848,10 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
7833
7848
|
altKey
|
|
7834
7849
|
} = options.activationKey;
|
|
7835
7850
|
return {
|
|
7836
|
-
metaKey:
|
|
7837
|
-
ctrlKey:
|
|
7838
|
-
shiftKey:
|
|
7839
|
-
altKey:
|
|
7851
|
+
metaKey: Boolean(metaKey),
|
|
7852
|
+
ctrlKey: Boolean(ctrlKey),
|
|
7853
|
+
shiftKey: Boolean(shiftKey),
|
|
7854
|
+
altKey: Boolean(altKey)
|
|
7840
7855
|
};
|
|
7841
7856
|
}
|
|
7842
7857
|
return {
|
|
@@ -8314,6 +8329,12 @@ ${plainTextContentOnly}` : plainTextContentOnly;
|
|
|
8314
8329
|
});
|
|
8315
8330
|
}
|
|
8316
8331
|
agentManager.tryResumeSessions();
|
|
8332
|
+
},
|
|
8333
|
+
updateOptions: (newOptions) => {
|
|
8334
|
+
options = {
|
|
8335
|
+
...options,
|
|
8336
|
+
...newOptions
|
|
8337
|
+
};
|
|
8317
8338
|
}
|
|
8318
8339
|
};
|
|
8319
8340
|
});
|
|
@@ -168,6 +168,26 @@ interface Options {
|
|
|
168
168
|
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
169
169
|
agent?: AgentOptions;
|
|
170
170
|
}
|
|
171
|
+
interface UpdatableOptions {
|
|
172
|
+
onActivate?: () => void;
|
|
173
|
+
onDeactivate?: () => void;
|
|
174
|
+
onElementHover?: (element: Element) => void;
|
|
175
|
+
onElementSelect?: (element: Element) => void;
|
|
176
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
177
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
178
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
179
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
180
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
181
|
+
onCopyError?: (error: Error) => void;
|
|
182
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
183
|
+
onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
|
|
184
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
|
|
185
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
186
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
187
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
188
|
+
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
189
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
190
|
+
}
|
|
171
191
|
interface ReactGrabAPI {
|
|
172
192
|
activate: () => void;
|
|
173
193
|
deactivate: () => void;
|
|
@@ -179,6 +199,7 @@ interface ReactGrabAPI {
|
|
|
179
199
|
updateTheme: (theme: DeepPartial<Theme>) => void;
|
|
180
200
|
getTheme: () => Required<Theme>;
|
|
181
201
|
setAgent: (options: AgentOptions) => void;
|
|
202
|
+
updateOptions: (options: UpdatableOptions) => void;
|
|
182
203
|
}
|
|
183
204
|
interface OverlayBounds {
|
|
184
205
|
borderRadius: string;
|
|
@@ -279,4 +300,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
|
|
|
279
300
|
|
|
280
301
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
281
302
|
|
|
282
|
-
export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type ReactGrabAPI as R, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
|
|
303
|
+
export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type ReactGrabAPI as R, type Theme as T, type UpdatableOptions as U, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
|
|
@@ -168,6 +168,26 @@ interface Options {
|
|
|
168
168
|
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
169
169
|
agent?: AgentOptions;
|
|
170
170
|
}
|
|
171
|
+
interface UpdatableOptions {
|
|
172
|
+
onActivate?: () => void;
|
|
173
|
+
onDeactivate?: () => void;
|
|
174
|
+
onElementHover?: (element: Element) => void;
|
|
175
|
+
onElementSelect?: (element: Element) => void;
|
|
176
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
177
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
178
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
179
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
180
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
181
|
+
onCopyError?: (error: Error) => void;
|
|
182
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
183
|
+
onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
|
|
184
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
|
|
185
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
186
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
187
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
188
|
+
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
189
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
190
|
+
}
|
|
171
191
|
interface ReactGrabAPI {
|
|
172
192
|
activate: () => void;
|
|
173
193
|
deactivate: () => void;
|
|
@@ -179,6 +199,7 @@ interface ReactGrabAPI {
|
|
|
179
199
|
updateTheme: (theme: DeepPartial<Theme>) => void;
|
|
180
200
|
getTheme: () => Required<Theme>;
|
|
181
201
|
setAgent: (options: AgentOptions) => void;
|
|
202
|
+
updateOptions: (options: UpdatableOptions) => void;
|
|
182
203
|
}
|
|
183
204
|
interface OverlayBounds {
|
|
184
205
|
borderRadius: string;
|
|
@@ -279,4 +300,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
|
|
|
279
300
|
|
|
280
301
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
281
302
|
|
|
282
|
-
export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type ReactGrabAPI as R, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
|
|
303
|
+
export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type ReactGrabAPI as R, type Theme as T, type UpdatableOptions as U, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
|
package/dist/core.cjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDV467MQN_cjs = require('./chunk-DV467MQN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkDV467MQN_cjs.DEFAULT_THEME; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "formatElementInfo", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkDV467MQN_cjs.getElementContext; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "generateSnippet", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkDV467MQN_cjs.generateSnippet; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getStack", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkDV467MQN_cjs.getStack; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "init", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkDV467MQN_cjs.init; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkDV467MQN_cjs.Ee; }
|
|
30
30
|
});
|
package/dist/core.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-
|
|
1
|
+
export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.cjs';
|
|
2
2
|
export { isInstrumentationActive } from 'bippy';
|
|
3
3
|
import 'bippy/source';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-
|
|
1
|
+
export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.js';
|
|
2
2
|
export { isInstrumentationActive } from 'bippy';
|
|
3
3
|
import 'bippy/source';
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getStack, init, Ee as isInstrumentationActive } from './chunk-
|
|
1
|
+
export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getStack, init, Ee as isInstrumentationActive } from './chunk-ZK4APTZS.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDV467MQN_cjs = require('./chunk-DV467MQN.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @license MIT
|
|
@@ -31,7 +31,7 @@ if (typeof window !== "undefined") {
|
|
|
31
31
|
if (window.__REACT_GRAB__) {
|
|
32
32
|
globalApi = window.__REACT_GRAB__;
|
|
33
33
|
} else {
|
|
34
|
-
globalApi =
|
|
34
|
+
globalApi = chunkDV467MQN_cjs.init();
|
|
35
35
|
window.__REACT_GRAB__ = globalApi;
|
|
36
36
|
window.dispatchEvent(
|
|
37
37
|
new CustomEvent("react-grab:init", { detail: globalApi })
|
|
@@ -41,27 +41,27 @@ if (typeof window !== "undefined") {
|
|
|
41
41
|
|
|
42
42
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkDV467MQN_cjs.DEFAULT_THEME; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "formatElementInfo", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkDV467MQN_cjs.getElementContext; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "generateSnippet", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkDV467MQN_cjs.generateSnippet; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "getStack", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkDV467MQN_cjs.getStack; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "init", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkDV467MQN_cjs.init; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkDV467MQN_cjs.Ee; }
|
|
65
65
|
});
|
|
66
66
|
exports.getGlobalApi = getGlobalApi;
|
|
67
67
|
exports.setGlobalApi = setGlobalApi;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-
|
|
1
|
+
import { R as ReactGrabAPI } from './core-CzaOp9UL.cjs';
|
|
2
|
+
export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.cjs';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-
|
|
1
|
+
import { R as ReactGrabAPI } from './core-CzaOp9UL.js';
|
|
2
|
+
export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.js';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|