@deshlo/react 0.1.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/build/src/GithubPlugin.d.ts +8 -0
- package/build/src/GithubPlugin.d.ts.map +1 -0
- package/build/src/GithubPlugin.js +11 -0
- package/build/src/OverlayGate.d.ts +6 -0
- package/build/src/OverlayGate.d.ts.map +1 -0
- package/build/src/OverlayGate.js +13 -0
- package/build/src/OverlayGatePanel.d.ts +5 -0
- package/build/src/OverlayGatePanel.d.ts.map +1 -0
- package/build/src/OverlayGatePanel.js +52 -0
- package/build/src/SourceInspector.d.ts +15 -0
- package/build/src/SourceInspector.d.ts.map +1 -0
- package/build/src/SourceInspector.js +171 -0
- package/build/src/adapters/vite.d.ts +15 -0
- package/build/src/adapters/vite.d.ts.map +1 -0
- package/build/src/adapters/vite.js +47 -0
- package/build/src/adapters/webpack.d.ts +5 -0
- package/build/src/adapters/webpack.d.ts.map +1 -0
- package/build/src/adapters/webpack.js +15 -0
- package/build/src/github.d.ts +3 -0
- package/build/src/github.d.ts.map +1 -0
- package/build/src/github.js +6 -0
- package/build/src/github.test.d.ts +2 -0
- package/build/src/github.test.d.ts.map +1 -0
- package/build/src/github.test.js +17 -0
- package/build/src/index.d.ts +5 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +11 -0
- package/build/src/overlay/OverlayGate.d.ts +6 -0
- package/build/src/overlay/OverlayGate.d.ts.map +1 -0
- package/build/src/overlay/OverlayGate.js +13 -0
- package/build/src/overlay/OverlayGatePanel.d.ts +5 -0
- package/build/src/overlay/OverlayGatePanel.d.ts.map +1 -0
- package/build/src/overlay/OverlayGatePanel.js +52 -0
- package/build/src/overlay/SourceInspector.d.ts +15 -0
- package/build/src/overlay/SourceInspector.d.ts.map +1 -0
- package/build/src/overlay/SourceInspector.js +174 -0
- package/build/src/overlay/overlay-plugin-provider.d.ts +9 -0
- package/build/src/overlay/overlay-plugin-provider.d.ts.map +1 -0
- package/build/src/overlay/overlay-plugin-provider.js +14 -0
- package/build/src/overlay/overlay-plugin.d.ts +2 -0
- package/build/src/overlay/overlay-plugin.d.ts.map +1 -0
- package/build/src/overlay/overlay-plugin.js +7 -0
- package/build/src/overlay/overlay-plugin.test.d.ts +2 -0
- package/build/src/overlay/overlay-plugin.test.d.ts.map +1 -0
- package/build/src/overlay/overlay-plugin.test.js +30 -0
- package/build/src/overlay/source-inspector-context.d.ts +20 -0
- package/build/src/overlay/source-inspector-context.d.ts.map +1 -0
- package/build/src/overlay/source-inspector-context.js +17 -0
- package/build/src/overlay/submit-handler.d.ts +7 -0
- package/build/src/overlay/submit-handler.d.ts.map +1 -0
- package/build/src/overlay/submit-handler.js +20 -0
- package/build/src/overlay/submit-handler.test.d.ts +2 -0
- package/build/src/overlay/submit-handler.test.d.ts.map +1 -0
- package/build/src/overlay/submit-handler.test.js +52 -0
- package/build/src/overlay-plugin-provider.d.ts +9 -0
- package/build/src/overlay-plugin-provider.d.ts.map +1 -0
- package/build/src/overlay-plugin-provider.js +14 -0
- package/build/src/overlay-plugin.d.ts +2 -0
- package/build/src/overlay-plugin.d.ts.map +1 -0
- package/build/src/overlay-plugin.js +7 -0
- package/build/src/overlay-plugin.test.d.ts +2 -0
- package/build/src/overlay-plugin.test.d.ts.map +1 -0
- package/build/src/overlay-plugin.test.js +29 -0
- package/build/src/overlay.d.ts +5 -0
- package/build/src/overlay.d.ts.map +1 -0
- package/build/src/overlay.js +12 -0
- package/build/src/plugins/github/GithubPlugin.d.ts +8 -0
- package/build/src/plugins/github/GithubPlugin.d.ts.map +1 -0
- package/build/src/plugins/github/GithubPlugin.js +11 -0
- package/build/src/plugins/github/github.test.d.ts +2 -0
- package/build/src/plugins/github/github.test.d.ts.map +1 -0
- package/build/src/plugins/github/github.test.js +17 -0
- package/build/src/source-inspector-context.d.ts +20 -0
- package/build/src/source-inspector-context.d.ts.map +1 -0
- package/build/src/source-inspector-context.js +17 -0
- package/build/src/submit-handler.d.ts +7 -0
- package/build/src/submit-handler.d.ts.map +1 -0
- package/build/src/submit-handler.js +20 -0
- package/build/src/submit-handler.test.d.ts +2 -0
- package/build/src/submit-handler.test.d.ts.map +1 -0
- package/build/src/submit-handler.test.js +52 -0
- package/build/src/vite.d.ts +2 -0
- package/build/src/vite.d.ts.map +1 -0
- package/build/src/vite.js +17 -0
- package/build/src/webpack.d.ts +2 -0
- package/build/src/webpack.d.ts.map +1 -0
- package/build/src/webpack.js +17 -0
- package/package.json +59 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = SourceInspector;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const overlay_plugin_1 = require("./overlay-plugin");
|
|
8
|
+
const overlay_plugin_provider_1 = require("./overlay-plugin-provider");
|
|
9
|
+
const source_inspector_context_1 = require("./source-inspector-context");
|
|
10
|
+
const submit_handler_1 = require("./submit-handler");
|
|
11
|
+
const DEFAULT_ATTRIBUTE_NAME = "data-src-loc";
|
|
12
|
+
const DEFAULT_REVISION_ATTRIBUTE_NAME = "data-src-rev";
|
|
13
|
+
const DEFAULT_TRIGGER_KEY = "alt";
|
|
14
|
+
function isTriggerPressed(event, triggerKey) {
|
|
15
|
+
switch (triggerKey) {
|
|
16
|
+
case "alt":
|
|
17
|
+
return event.altKey;
|
|
18
|
+
case "shift":
|
|
19
|
+
return event.shiftKey;
|
|
20
|
+
case "meta":
|
|
21
|
+
return event.metaKey;
|
|
22
|
+
case "ctrl":
|
|
23
|
+
return event.ctrlKey;
|
|
24
|
+
default:
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function SourceInspector({ children, enabled, attributeName = DEFAULT_ATTRIBUTE_NAME, triggerKey = DEFAULT_TRIGGER_KEY, onSubmit, onSelectionChange, onSubmitStart, onSubmitComplete, onSubmitError, }) {
|
|
29
|
+
const inspectorEnabled = typeof enabled === "boolean"
|
|
30
|
+
? enabled
|
|
31
|
+
: process.env.NEXT_PUBLIC_SOURCE_INSPECTOR === "1";
|
|
32
|
+
const wrapperPlugin = (0, overlay_plugin_provider_1.useOverlayPlugin)();
|
|
33
|
+
const resolvedSubmit = (0, submit_handler_1.resolveSubmitHandler)(wrapperPlugin, onSubmit);
|
|
34
|
+
const [selection, setSelection] = (0, react_1.useState)(null);
|
|
35
|
+
const [selectionWarning, setSelectionWarning] = (0, react_1.useState)("");
|
|
36
|
+
const [proposedText, setProposedTextState] = (0, react_1.useState)("");
|
|
37
|
+
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
38
|
+
const [result, setResult] = (0, react_1.useState)(null);
|
|
39
|
+
const highlightedElement = (0, react_1.useRef)(null);
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
onSelectionChange?.(selection);
|
|
42
|
+
}, [onSelectionChange, selection]);
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (!inspectorEnabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const onClick = (event) => {
|
|
48
|
+
if (!isTriggerPressed(event, triggerKey)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const target = event.target;
|
|
52
|
+
if (!(target instanceof Element)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const element = target.closest(`[${attributeName}]`);
|
|
56
|
+
if (!element) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const sourceLoc = element.getAttribute(attributeName) || "";
|
|
60
|
+
if (!sourceLoc) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const commitSha = element.getAttribute(DEFAULT_REVISION_ATTRIBUTE_NAME) || "unknown";
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
if (highlightedElement.current) {
|
|
67
|
+
highlightedElement.current.style.outline = "";
|
|
68
|
+
}
|
|
69
|
+
element.style.outline = "2px solid #f59e0b";
|
|
70
|
+
highlightedElement.current = element;
|
|
71
|
+
const selectedText = (0, overlay_plugin_1.normalizeOverlayText)(element.textContent || "");
|
|
72
|
+
const tagName = element.tagName.toLowerCase();
|
|
73
|
+
setResult(null);
|
|
74
|
+
if (!selectedText) {
|
|
75
|
+
setSelection(null);
|
|
76
|
+
setProposedTextState("");
|
|
77
|
+
setSelectionWarning("Selected element has no plain text content. Select an element with direct text.");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setSelectionWarning("");
|
|
81
|
+
setSelection({
|
|
82
|
+
sourceLoc,
|
|
83
|
+
tagName,
|
|
84
|
+
selectedText,
|
|
85
|
+
commitSha,
|
|
86
|
+
});
|
|
87
|
+
setProposedTextState(selectedText);
|
|
88
|
+
};
|
|
89
|
+
window.addEventListener("click", onClick, true);
|
|
90
|
+
return () => {
|
|
91
|
+
window.removeEventListener("click", onClick, true);
|
|
92
|
+
if (highlightedElement.current) {
|
|
93
|
+
highlightedElement.current.style.outline = "";
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, [attributeName, inspectorEnabled, triggerKey]);
|
|
97
|
+
function setProposedText(value) {
|
|
98
|
+
setProposedTextState(value);
|
|
99
|
+
setResult(null);
|
|
100
|
+
}
|
|
101
|
+
async function submit() {
|
|
102
|
+
if (!selection) {
|
|
103
|
+
setResult({
|
|
104
|
+
ok: false,
|
|
105
|
+
message: "Select an element with direct text first.",
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const trimmedProposedText = proposedText.trim();
|
|
110
|
+
if (!trimmedProposedText) {
|
|
111
|
+
setResult({
|
|
112
|
+
ok: false,
|
|
113
|
+
message: "Proposed changes cannot be empty.",
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const submitHandler = resolvedSubmit.submit;
|
|
118
|
+
if (!submitHandler) {
|
|
119
|
+
const missingHandlerResult = {
|
|
120
|
+
ok: false,
|
|
121
|
+
message: "PROVIDER_ERROR: No submit handler configured.",
|
|
122
|
+
};
|
|
123
|
+
setResult(missingHandlerResult);
|
|
124
|
+
onSubmitError?.(missingHandlerResult, selection);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setSubmitting(true);
|
|
128
|
+
setResult(null);
|
|
129
|
+
onSubmitStart?.(selection);
|
|
130
|
+
const submitInput = (0, overlay_plugin_1.buildOverlaySubmitInput)(selection, trimmedProposedText);
|
|
131
|
+
try {
|
|
132
|
+
const submitResult = await submitHandler(submitInput, {
|
|
133
|
+
host: window.location.host,
|
|
134
|
+
});
|
|
135
|
+
setResult(submitResult);
|
|
136
|
+
if (submitResult.ok) {
|
|
137
|
+
onSubmitComplete?.(submitResult, selection);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
onSubmitError?.(submitResult, selection);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
const errorResult = (0, overlay_plugin_1.toOverlayErrorResult)(error);
|
|
145
|
+
setResult(errorResult);
|
|
146
|
+
onSubmitError?.(errorResult, selection);
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
setSubmitting(false);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const contextValue = (0, react_1.useMemo)(() => ({
|
|
153
|
+
inspectorEnabled,
|
|
154
|
+
triggerKey,
|
|
155
|
+
pluginId: resolvedSubmit.pluginId,
|
|
156
|
+
selection,
|
|
157
|
+
selectionWarning,
|
|
158
|
+
proposedText,
|
|
159
|
+
submitting,
|
|
160
|
+
result,
|
|
161
|
+
setProposedText,
|
|
162
|
+
submit,
|
|
163
|
+
}), [
|
|
164
|
+
inspectorEnabled,
|
|
165
|
+
triggerKey,
|
|
166
|
+
resolvedSubmit.pluginId,
|
|
167
|
+
selection,
|
|
168
|
+
selectionWarning,
|
|
169
|
+
proposedText,
|
|
170
|
+
submitting,
|
|
171
|
+
result,
|
|
172
|
+
]);
|
|
173
|
+
return (0, jsx_runtime_1.jsx)(source_inspector_context_1.SourceInspectorProvider, { value: contextValue, children: children });
|
|
174
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { OverlayPlugin } from "./overlay-plugin";
|
|
3
|
+
export interface OverlayPluginProviderProps {
|
|
4
|
+
plugin: OverlayPlugin;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function OverlayPluginProvider({ plugin, children }: OverlayPluginProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function useOverlayPlugin(): OverlayPlugin | null;
|
|
9
|
+
//# sourceMappingURL=overlay-plugin-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin-provider.d.ts","sourceRoot":"","sources":["../../../src/overlay/overlay-plugin-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,0BAA0B,2CAErF;AAED,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CAEvD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OverlayPluginProvider = OverlayPluginProvider;
|
|
5
|
+
exports.useOverlayPlugin = useOverlayPlugin;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const OverlayPluginContext = (0, react_1.createContext)(null);
|
|
9
|
+
function OverlayPluginProvider({ plugin, children }) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(OverlayPluginContext.Provider, { value: plugin, children: children });
|
|
11
|
+
}
|
|
12
|
+
function useOverlayPlugin() {
|
|
13
|
+
return (0, react_1.useContext)(OverlayPluginContext);
|
|
14
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { buildOverlaySubmitInput, normalizeOverlayText, toOverlayErrorResult, type OverlayPlugin, type OverlayPluginContext, type OverlayResultLink, type OverlaySelection, type OverlaySubmitHandler, type OverlaySubmitInput, type OverlaySubmitResult, type TriggerKey, } from "@deshlo/core/overlay-plugin";
|
|
2
|
+
//# sourceMappingURL=overlay-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin.d.ts","sourceRoot":"","sources":["../../../src/overlay/overlay-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toOverlayErrorResult = exports.normalizeOverlayText = exports.buildOverlaySubmitInput = void 0;
|
|
4
|
+
var overlay_plugin_1 = require("@deshlo/core/overlay-plugin");
|
|
5
|
+
Object.defineProperty(exports, "buildOverlaySubmitInput", { enumerable: true, get: function () { return overlay_plugin_1.buildOverlaySubmitInput; } });
|
|
6
|
+
Object.defineProperty(exports, "normalizeOverlayText", { enumerable: true, get: function () { return overlay_plugin_1.normalizeOverlayText; } });
|
|
7
|
+
Object.defineProperty(exports, "toOverlayErrorResult", { enumerable: true, get: function () { return overlay_plugin_1.toOverlayErrorResult; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin.test.d.ts","sourceRoot":"","sources":["../../../src/overlay/overlay-plugin.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const overlay_plugin_1 = require("./overlay-plugin");
|
|
5
|
+
(0, vitest_1.describe)("overlay-plugin helpers", () => {
|
|
6
|
+
(0, vitest_1.it)("normalizes mixed whitespace for selected text", () => {
|
|
7
|
+
(0, vitest_1.expect)((0, overlay_plugin_1.normalizeOverlayText)("\n Hello world\t")).toBe("Hello world");
|
|
8
|
+
});
|
|
9
|
+
(0, vitest_1.it)("builds submit payload from selection and proposed text", () => {
|
|
10
|
+
const input = (0, overlay_plugin_1.buildOverlaySubmitInput)({
|
|
11
|
+
sourceLoc: "app/page.tsx:10:7",
|
|
12
|
+
tagName: "h1",
|
|
13
|
+
selectedText: "Current",
|
|
14
|
+
}, " Updated text ");
|
|
15
|
+
(0, vitest_1.expect)(input).toEqual({
|
|
16
|
+
sourceLoc: "app/page.tsx:10:7",
|
|
17
|
+
tagName: "h1",
|
|
18
|
+
selectedText: "Current",
|
|
19
|
+
commitSha: "unknown",
|
|
20
|
+
proposedText: "Updated text",
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
(0, vitest_1.it)("normalizes thrown errors into overlay result", () => {
|
|
24
|
+
const result = (0, overlay_plugin_1.toOverlayErrorResult)(new Error("provider failed"));
|
|
25
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
26
|
+
ok: false,
|
|
27
|
+
message: "provider failed",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { OverlaySelection, OverlaySubmitResult, TriggerKey } from "./overlay-plugin";
|
|
3
|
+
export interface SourceInspectorContextValue {
|
|
4
|
+
inspectorEnabled: boolean;
|
|
5
|
+
triggerKey: TriggerKey;
|
|
6
|
+
pluginId: string;
|
|
7
|
+
selection: OverlaySelection | null;
|
|
8
|
+
selectionWarning: string;
|
|
9
|
+
proposedText: string;
|
|
10
|
+
submitting: boolean;
|
|
11
|
+
result: OverlaySubmitResult | null;
|
|
12
|
+
setProposedText: (value: string) => void;
|
|
13
|
+
submit: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function SourceInspectorProvider({ value, children, }: {
|
|
16
|
+
value: SourceInspectorContextValue;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function useSourceInspectorContext(): SourceInspectorContextValue;
|
|
20
|
+
//# sourceMappingURL=source-inspector-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-inspector-context.d.ts","sourceRoot":"","sources":["../../../src/overlay/source-inspector-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAID,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,2BAA2B,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAIA;AAED,wBAAgB,yBAAyB,IAAI,2BAA2B,CAQvE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceInspectorProvider = SourceInspectorProvider;
|
|
4
|
+
exports.useSourceInspectorContext = useSourceInspectorContext;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const SourceInspectorContext = (0, react_1.createContext)(null);
|
|
8
|
+
function SourceInspectorProvider({ value, children, }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(SourceInspectorContext.Provider, { value: value, children: children }));
|
|
10
|
+
}
|
|
11
|
+
function useSourceInspectorContext() {
|
|
12
|
+
const context = (0, react_1.useContext)(SourceInspectorContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error("OverlayGatePanel must be rendered inside SourceInspector context.");
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OverlayPlugin, OverlaySubmitHandler } from "./overlay-plugin";
|
|
2
|
+
export interface ResolvedSubmitHandler {
|
|
3
|
+
pluginId: string;
|
|
4
|
+
submit?: OverlaySubmitHandler;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveSubmitHandler(plugin: OverlayPlugin | null, onSubmit?: OverlaySubmitHandler): ResolvedSubmitHandler;
|
|
7
|
+
//# sourceMappingURL=submit-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-handler.d.ts","sourceRoot":"","sources":["../../../src/overlay/submit-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,qBAAqB,CAkBvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSubmitHandler = resolveSubmitHandler;
|
|
4
|
+
function resolveSubmitHandler(plugin, onSubmit) {
|
|
5
|
+
if (plugin) {
|
|
6
|
+
return {
|
|
7
|
+
pluginId: plugin.id,
|
|
8
|
+
submit: plugin.submit,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
if (onSubmit) {
|
|
12
|
+
return {
|
|
13
|
+
pluginId: "custom-onsubmit",
|
|
14
|
+
submit: onSubmit,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
pluginId: "unconfigured",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-handler.test.d.ts","sourceRoot":"","sources":["../../../src/overlay/submit-handler.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const submit_handler_1 = require("./submit-handler");
|
|
5
|
+
(0, vitest_1.describe)("resolveSubmitHandler", () => {
|
|
6
|
+
(0, vitest_1.it)("prefers wrapper plugin submit over onSubmit", async () => {
|
|
7
|
+
const pluginSubmit = vitest_1.vi.fn().mockResolvedValue({
|
|
8
|
+
ok: true,
|
|
9
|
+
message: "plugin",
|
|
10
|
+
});
|
|
11
|
+
const onSubmit = vitest_1.vi.fn().mockResolvedValue({
|
|
12
|
+
ok: true,
|
|
13
|
+
message: "callback",
|
|
14
|
+
});
|
|
15
|
+
const plugin = {
|
|
16
|
+
id: "github-browser",
|
|
17
|
+
submit: pluginSubmit,
|
|
18
|
+
};
|
|
19
|
+
const resolved = (0, submit_handler_1.resolveSubmitHandler)(plugin, onSubmit);
|
|
20
|
+
(0, vitest_1.expect)(resolved.pluginId).toBe("github-browser");
|
|
21
|
+
const result = await resolved.submit?.({
|
|
22
|
+
sourceLoc: "app/page.tsx:1:1",
|
|
23
|
+
tagName: "h1",
|
|
24
|
+
selectedText: "Old",
|
|
25
|
+
proposedText: "New",
|
|
26
|
+
}, { host: "localhost:3000" });
|
|
27
|
+
(0, vitest_1.expect)(result?.message).toBe("plugin");
|
|
28
|
+
(0, vitest_1.expect)(pluginSubmit).toHaveBeenCalledTimes(1);
|
|
29
|
+
(0, vitest_1.expect)(onSubmit).not.toHaveBeenCalled();
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.it)("uses onSubmit when no wrapper plugin exists", async () => {
|
|
32
|
+
const onSubmit = vitest_1.vi.fn().mockResolvedValue({
|
|
33
|
+
ok: true,
|
|
34
|
+
message: "callback",
|
|
35
|
+
});
|
|
36
|
+
const resolved = (0, submit_handler_1.resolveSubmitHandler)(null, onSubmit);
|
|
37
|
+
(0, vitest_1.expect)(resolved.pluginId).toBe("custom-onsubmit");
|
|
38
|
+
const result = await resolved.submit?.({
|
|
39
|
+
sourceLoc: "app/page.tsx:1:1",
|
|
40
|
+
tagName: "h1",
|
|
41
|
+
selectedText: "Old",
|
|
42
|
+
proposedText: "New",
|
|
43
|
+
}, { host: "localhost:3000" });
|
|
44
|
+
(0, vitest_1.expect)(result?.message).toBe("callback");
|
|
45
|
+
(0, vitest_1.expect)(onSubmit).toHaveBeenCalledTimes(1);
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)("returns unconfigured when neither wrapper nor onSubmit exists", () => {
|
|
48
|
+
const resolved = (0, submit_handler_1.resolveSubmitHandler)(null, undefined);
|
|
49
|
+
(0, vitest_1.expect)(resolved.pluginId).toBe("unconfigured");
|
|
50
|
+
(0, vitest_1.expect)(resolved.submit).toBeUndefined();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { OverlayPlugin } from "./overlay-plugin";
|
|
3
|
+
export interface OverlayPluginProviderProps {
|
|
4
|
+
plugin: OverlayPlugin;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function OverlayPluginProvider({ plugin, children }: OverlayPluginProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function useOverlayPlugin(): OverlayPlugin | null;
|
|
9
|
+
//# sourceMappingURL=overlay-plugin-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin-provider.d.ts","sourceRoot":"","sources":["../../src/overlay-plugin-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,0BAA0B,2CAErF;AAED,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CAEvD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OverlayPluginProvider = OverlayPluginProvider;
|
|
5
|
+
exports.useOverlayPlugin = useOverlayPlugin;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const OverlayPluginContext = (0, react_1.createContext)(null);
|
|
9
|
+
function OverlayPluginProvider({ plugin, children }) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(OverlayPluginContext.Provider, { value: plugin, children: children });
|
|
11
|
+
}
|
|
12
|
+
function useOverlayPlugin() {
|
|
13
|
+
return (0, react_1.useContext)(OverlayPluginContext);
|
|
14
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { buildOverlaySubmitInput, normalizeOverlayText, toOverlayErrorResult, type OverlayPlugin, type OverlayPluginContext, type OverlayResultLink, type OverlaySelection, type OverlaySubmitHandler, type OverlaySubmitInput, type OverlaySubmitResult, type TriggerKey, } from "@fdb/core/overlay-plugin";
|
|
2
|
+
//# sourceMappingURL=overlay-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin.d.ts","sourceRoot":"","sources":["../../src/overlay-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toOverlayErrorResult = exports.normalizeOverlayText = exports.buildOverlaySubmitInput = void 0;
|
|
4
|
+
var overlay_plugin_1 = require("@fdb/core/overlay-plugin");
|
|
5
|
+
Object.defineProperty(exports, "buildOverlaySubmitInput", { enumerable: true, get: function () { return overlay_plugin_1.buildOverlaySubmitInput; } });
|
|
6
|
+
Object.defineProperty(exports, "normalizeOverlayText", { enumerable: true, get: function () { return overlay_plugin_1.normalizeOverlayText; } });
|
|
7
|
+
Object.defineProperty(exports, "toOverlayErrorResult", { enumerable: true, get: function () { return overlay_plugin_1.toOverlayErrorResult; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-plugin.test.d.ts","sourceRoot":"","sources":["../../src/overlay-plugin.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const overlay_plugin_1 = require("./overlay-plugin");
|
|
5
|
+
(0, vitest_1.describe)("overlay-plugin helpers", () => {
|
|
6
|
+
(0, vitest_1.it)("normalizes mixed whitespace for selected text", () => {
|
|
7
|
+
(0, vitest_1.expect)((0, overlay_plugin_1.normalizeOverlayText)("\n Hello world\t")).toBe("Hello world");
|
|
8
|
+
});
|
|
9
|
+
(0, vitest_1.it)("builds submit payload from selection and proposed text", () => {
|
|
10
|
+
const input = (0, overlay_plugin_1.buildOverlaySubmitInput)({
|
|
11
|
+
sourceLoc: "app/page.tsx:10:7",
|
|
12
|
+
tagName: "h1",
|
|
13
|
+
selectedText: "Current",
|
|
14
|
+
}, " Updated text ");
|
|
15
|
+
(0, vitest_1.expect)(input).toEqual({
|
|
16
|
+
sourceLoc: "app/page.tsx:10:7",
|
|
17
|
+
tagName: "h1",
|
|
18
|
+
selectedText: "Current",
|
|
19
|
+
proposedText: "Updated text",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
(0, vitest_1.it)("normalizes thrown errors into overlay result", () => {
|
|
23
|
+
const result = (0, overlay_plugin_1.toOverlayErrorResult)(new Error("provider failed"));
|
|
24
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
25
|
+
ok: false,
|
|
26
|
+
message: "provider failed",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as OverlayGate } from "./overlay/OverlayGate";
|
|
2
|
+
export type { OverlayGateProps } from "./overlay/OverlayGate";
|
|
3
|
+
export { OverlayPluginProvider, useOverlayPlugin, type OverlayPluginProviderProps, } from "./overlay/overlay-plugin-provider";
|
|
4
|
+
export type { OverlayPlugin, OverlayPluginContext, OverlayResultLink, OverlaySelection, OverlaySubmitHandler, OverlaySubmitInput, OverlaySubmitResult, TriggerKey, } from "./overlay/overlay-plugin";
|
|
5
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/overlay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,0BAA0B,GAChC,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,GACX,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useOverlayPlugin = exports.OverlayPluginProvider = exports.OverlayGate = void 0;
|
|
8
|
+
var OverlayGate_1 = require("./overlay/OverlayGate");
|
|
9
|
+
Object.defineProperty(exports, "OverlayGate", { enumerable: true, get: function () { return __importDefault(OverlayGate_1).default; } });
|
|
10
|
+
var overlay_plugin_provider_1 = require("./overlay/overlay-plugin-provider");
|
|
11
|
+
Object.defineProperty(exports, "OverlayPluginProvider", { enumerable: true, get: function () { return overlay_plugin_provider_1.OverlayPluginProvider; } });
|
|
12
|
+
Object.defineProperty(exports, "useOverlayPlugin", { enumerable: true, get: function () { return overlay_plugin_provider_1.useOverlayPlugin; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type GitHubBrowserPluginConfig } from "@fdb/plugin-github";
|
|
3
|
+
export interface GithubPluginProps {
|
|
4
|
+
config?: GitHubBrowserPluginConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function GithubPlugin({ children, config }: GithubPluginProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=GithubPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GithubPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/github/GithubPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,iBAAiB,2CAInE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GithubPlugin = GithubPlugin;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const plugin_github_1 = require("@fdb/plugin-github");
|
|
7
|
+
const overlay_plugin_provider_1 = require("../../overlay/overlay-plugin-provider");
|
|
8
|
+
function GithubPlugin({ children, config }) {
|
|
9
|
+
const plugin = (0, plugin_github_1.createGitHubBrowserPlugin)(config || {});
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(overlay_plugin_provider_1.OverlayPluginProvider, { plugin: plugin, children: children });
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/github/github.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const overlay_plugin_provider_1 = require("../../overlay/overlay-plugin-provider");
|
|
6
|
+
const GithubPlugin_1 = require("./GithubPlugin");
|
|
7
|
+
(0, vitest_1.describe)("GithubPlugin", () => {
|
|
8
|
+
(0, vitest_1.it)("wraps children in OverlayPluginProvider", () => {
|
|
9
|
+
const element = (0, GithubPlugin_1.GithubPlugin)({
|
|
10
|
+
config: { token: "ghp_test" },
|
|
11
|
+
children: "child",
|
|
12
|
+
});
|
|
13
|
+
(0, vitest_1.expect)((0, react_1.isValidElement)(element)).toBe(true);
|
|
14
|
+
(0, vitest_1.expect)(element.type).toBe(overlay_plugin_provider_1.OverlayPluginProvider);
|
|
15
|
+
(0, vitest_1.expect)(element.props.plugin.id).toBe("github-browser");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { OverlaySelection, OverlaySubmitResult, TriggerKey } from "./overlay-plugin";
|
|
3
|
+
export interface SourceInspectorContextValue {
|
|
4
|
+
inspectorEnabled: boolean;
|
|
5
|
+
triggerKey: TriggerKey;
|
|
6
|
+
pluginId: string;
|
|
7
|
+
selection: OverlaySelection | null;
|
|
8
|
+
selectionWarning: string;
|
|
9
|
+
proposedText: string;
|
|
10
|
+
submitting: boolean;
|
|
11
|
+
result: OverlaySubmitResult | null;
|
|
12
|
+
setProposedText: (value: string) => void;
|
|
13
|
+
submit: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function SourceInspectorProvider({ value, children, }: {
|
|
16
|
+
value: SourceInspectorContextValue;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function useSourceInspectorContext(): SourceInspectorContextValue;
|
|
20
|
+
//# sourceMappingURL=source-inspector-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-inspector-context.d.ts","sourceRoot":"","sources":["../../src/source-inspector-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAID,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,2BAA2B,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAIA;AAED,wBAAgB,yBAAyB,IAAI,2BAA2B,CAQvE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceInspectorProvider = SourceInspectorProvider;
|
|
4
|
+
exports.useSourceInspectorContext = useSourceInspectorContext;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const SourceInspectorContext = (0, react_1.createContext)(null);
|
|
8
|
+
function SourceInspectorProvider({ value, children, }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(SourceInspectorContext.Provider, { value: value, children: children }));
|
|
10
|
+
}
|
|
11
|
+
function useSourceInspectorContext() {
|
|
12
|
+
const context = (0, react_1.useContext)(SourceInspectorContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error("OverlayGatePanel must be rendered inside SourceInspector context.");
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OverlayPlugin, OverlaySubmitHandler } from "./overlay-plugin";
|
|
2
|
+
export interface ResolvedSubmitHandler {
|
|
3
|
+
pluginId: string;
|
|
4
|
+
submit?: OverlaySubmitHandler;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveSubmitHandler(plugin: OverlayPlugin | null, onSubmit?: OverlaySubmitHandler): ResolvedSubmitHandler;
|
|
7
|
+
//# sourceMappingURL=submit-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-handler.d.ts","sourceRoot":"","sources":["../../src/submit-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,qBAAqB,CAkBvB"}
|