d2d-feedbackkit 0.1.0 → 0.1.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/README.md +6 -0
- package/package.json +1 -1
- package/src/solid.tsx +75 -59
- package/src/types.ts +10 -0
package/README.md
CHANGED
|
@@ -64,6 +64,12 @@ const locator = createFeedbackLocator({
|
|
|
64
64
|
appKey: "host-app",
|
|
65
65
|
appName: "Host App",
|
|
66
66
|
showFloatingButton: false,
|
|
67
|
+
enableVideoRecording: false,
|
|
68
|
+
theme: {
|
|
69
|
+
primary: "45 96% 53%",
|
|
70
|
+
primaryForeground: "30 70% 8%",
|
|
71
|
+
ring: "45 96% 53%",
|
|
72
|
+
},
|
|
67
73
|
submitFeedback: async (input) => {
|
|
68
74
|
const response = await fetch("https://feedbackkit.d2d.cloud/api/submissions", {
|
|
69
75
|
method: "POST",
|
package/package.json
CHANGED
package/src/solid.tsx
CHANGED
|
@@ -37,10 +37,11 @@ import type {
|
|
|
37
37
|
FeedbackLocatorHotkey,
|
|
38
38
|
FeedbackLocatorPoint,
|
|
39
39
|
FeedbackLocatorSourceMetadata,
|
|
40
|
+
FeedbackLocatorTheme,
|
|
40
41
|
} from "./types";
|
|
41
42
|
import { createShortcutResolver } from "./shortcuts";
|
|
42
43
|
|
|
43
|
-
type FeedbackLocatorRootProps = {
|
|
44
|
+
export type FeedbackLocatorRootProps = {
|
|
44
45
|
locator: FeedbackLocator;
|
|
45
46
|
open?: boolean;
|
|
46
47
|
defaultOpen?: boolean;
|
|
@@ -48,6 +49,8 @@ type FeedbackLocatorRootProps = {
|
|
|
48
49
|
onClose?: (reason: FeedbackLocatorCloseReason) => void;
|
|
49
50
|
onSubmitted?: (result: FeedbackLocatorHostedSubmitResult) => void;
|
|
50
51
|
showFloatingButton?: boolean;
|
|
52
|
+
enableVideoRecording?: boolean;
|
|
53
|
+
theme?: FeedbackLocatorTheme;
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
type FeedbackLocatorMode = "idle" | "selecting" | "annotating" | "submitting";
|
|
@@ -1309,6 +1312,17 @@ export const FeedbackLocatorRoot: Component<FeedbackLocatorRootProps> = (props)
|
|
|
1309
1312
|
const snapshot = () => selected();
|
|
1310
1313
|
const selectionRect = () => hoverRect();
|
|
1311
1314
|
const currentTextDraft = () => textDraft();
|
|
1315
|
+
const isVideoRecordingEnabled = () =>
|
|
1316
|
+
(props.enableVideoRecording ?? props.locator.config.enableVideoRecording) === true;
|
|
1317
|
+
const themeStyle = (): JSX.CSSProperties => {
|
|
1318
|
+
const theme = props.theme ?? props.locator.config.theme;
|
|
1319
|
+
|
|
1320
|
+
return {
|
|
1321
|
+
...(theme?.primary ? { "--primary": theme.primary } : {}),
|
|
1322
|
+
...(theme?.primaryForeground ? { "--primary-foreground": theme.primaryForeground } : {}),
|
|
1323
|
+
...(theme?.ring ? { "--ring": theme.ring } : {}),
|
|
1324
|
+
};
|
|
1325
|
+
};
|
|
1312
1326
|
const canvasCursor = () => {
|
|
1313
1327
|
if (tool() === "select") {
|
|
1314
1328
|
return isMovingAnnotation() ? "grabbing" : "grab";
|
|
@@ -1322,7 +1336,7 @@ export const FeedbackLocatorRoot: Component<FeedbackLocatorRootProps> = (props)
|
|
|
1322
1336
|
};
|
|
1323
1337
|
|
|
1324
1338
|
return (
|
|
1325
|
-
<div data-feedback-locator-ui="true">
|
|
1339
|
+
<div data-feedback-locator-ui="true" style={themeStyle()}>
|
|
1326
1340
|
<Show
|
|
1327
1341
|
when={
|
|
1328
1342
|
mode() === "idle" &&
|
|
@@ -1615,70 +1629,72 @@ export const FeedbackLocatorRoot: Component<FeedbackLocatorRootProps> = (props)
|
|
|
1615
1629
|
</Show>
|
|
1616
1630
|
</div>
|
|
1617
1631
|
|
|
1618
|
-
<
|
|
1619
|
-
<
|
|
1620
|
-
|
|
1621
|
-
<div class="
|
|
1622
|
-
<
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
type="button"
|
|
1627
|
-
class="inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm font-medium transition hover:bg-muted disabled:opacity-60"
|
|
1628
|
-
disabled={mode() === "submitting" || !supportsScreenRecording()}
|
|
1629
|
-
onClick={startRecording}
|
|
1630
|
-
>
|
|
1631
|
-
<Video class="h-4 w-4" />
|
|
1632
|
-
Neem video op
|
|
1633
|
-
</button>
|
|
1634
|
-
}
|
|
1635
|
-
>
|
|
1636
|
-
<button
|
|
1637
|
-
type="button"
|
|
1638
|
-
class="inline-flex h-9 items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 text-sm font-medium transition hover:bg-destructive/15"
|
|
1639
|
-
disabled={mode() === "submitting"}
|
|
1640
|
-
onClick={stopRecording}
|
|
1641
|
-
>
|
|
1642
|
-
<StopCircle class="h-4 w-4" />
|
|
1643
|
-
Stop opname
|
|
1644
|
-
</button>
|
|
1645
|
-
</Show>
|
|
1646
|
-
|
|
1647
|
-
<Show when={recordingBlob()}>
|
|
1648
|
-
{(blob) => (
|
|
1649
|
-
<>
|
|
1650
|
-
<a
|
|
1651
|
-
class="inline-flex h-9 max-w-full items-center gap-2 truncate rounded-md border px-3 text-sm underline-offset-4 hover:bg-muted hover:underline"
|
|
1652
|
-
href={recordingUrl() ?? undefined}
|
|
1653
|
-
target="_blank"
|
|
1654
|
-
rel="noreferrer"
|
|
1655
|
-
>
|
|
1656
|
-
<Video class="h-4 w-4 shrink-0" />
|
|
1657
|
-
<span class="truncate">
|
|
1658
|
-
screen-recording.webm ({formatBytes(blob().size)},{" "}
|
|
1659
|
-
{formatDuration(recordingDurationMs())})
|
|
1660
|
-
</span>
|
|
1661
|
-
</a>
|
|
1632
|
+
<Show when={isVideoRecordingEnabled()}>
|
|
1633
|
+
<div>
|
|
1634
|
+
<label class="mb-2 block text-sm font-medium">Video-opname</label>
|
|
1635
|
+
<div class="space-y-2 rounded-md border bg-background p-3">
|
|
1636
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
1637
|
+
<Show
|
|
1638
|
+
when={recordingState() === "recording"}
|
|
1639
|
+
fallback={
|
|
1662
1640
|
<button
|
|
1663
1641
|
type="button"
|
|
1664
|
-
class="inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm font-medium transition hover:bg-muted"
|
|
1665
|
-
disabled={mode() === "submitting"}
|
|
1666
|
-
onClick={
|
|
1642
|
+
class="inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm font-medium transition hover:bg-muted disabled:opacity-60"
|
|
1643
|
+
disabled={mode() === "submitting" || !supportsScreenRecording()}
|
|
1644
|
+
onClick={startRecording}
|
|
1667
1645
|
>
|
|
1668
|
-
<
|
|
1669
|
-
|
|
1646
|
+
<Video class="h-4 w-4" />
|
|
1647
|
+
Neem video op
|
|
1670
1648
|
</button>
|
|
1671
|
-
|
|
1672
|
-
|
|
1649
|
+
}
|
|
1650
|
+
>
|
|
1651
|
+
<button
|
|
1652
|
+
type="button"
|
|
1653
|
+
class="inline-flex h-9 items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 text-sm font-medium transition hover:bg-destructive/15"
|
|
1654
|
+
disabled={mode() === "submitting"}
|
|
1655
|
+
onClick={stopRecording}
|
|
1656
|
+
>
|
|
1657
|
+
<StopCircle class="h-4 w-4" />
|
|
1658
|
+
Stop opname
|
|
1659
|
+
</button>
|
|
1660
|
+
</Show>
|
|
1661
|
+
|
|
1662
|
+
<Show when={recordingBlob()}>
|
|
1663
|
+
{(blob) => (
|
|
1664
|
+
<>
|
|
1665
|
+
<a
|
|
1666
|
+
class="inline-flex h-9 max-w-full items-center gap-2 truncate rounded-md border px-3 text-sm underline-offset-4 hover:bg-muted hover:underline"
|
|
1667
|
+
href={recordingUrl() ?? undefined}
|
|
1668
|
+
target="_blank"
|
|
1669
|
+
rel="noreferrer"
|
|
1670
|
+
>
|
|
1671
|
+
<Video class="h-4 w-4 shrink-0" />
|
|
1672
|
+
<span class="truncate">
|
|
1673
|
+
screen-recording.webm ({formatBytes(blob().size)},{" "}
|
|
1674
|
+
{formatDuration(recordingDurationMs())})
|
|
1675
|
+
</span>
|
|
1676
|
+
</a>
|
|
1677
|
+
<button
|
|
1678
|
+
type="button"
|
|
1679
|
+
class="inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm font-medium transition hover:bg-muted"
|
|
1680
|
+
disabled={mode() === "submitting"}
|
|
1681
|
+
onClick={clearRecording}
|
|
1682
|
+
>
|
|
1683
|
+
<Trash2 class="h-4 w-4" />
|
|
1684
|
+
Wissen
|
|
1685
|
+
</button>
|
|
1686
|
+
</>
|
|
1687
|
+
)}
|
|
1688
|
+
</Show>
|
|
1689
|
+
</div>
|
|
1690
|
+
<Show when={!supportsScreenRecording()}>
|
|
1691
|
+
<div class="text-xs text-muted-foreground">
|
|
1692
|
+
Video-opname is niet beschikbaar in deze browser.
|
|
1693
|
+
</div>
|
|
1673
1694
|
</Show>
|
|
1674
1695
|
</div>
|
|
1675
|
-
<Show when={!supportsScreenRecording()}>
|
|
1676
|
-
<div class="text-xs text-muted-foreground">
|
|
1677
|
-
Video-opname is niet beschikbaar in deze browser.
|
|
1678
|
-
</div>
|
|
1679
|
-
</Show>
|
|
1680
1696
|
</div>
|
|
1681
|
-
</
|
|
1697
|
+
</Show>
|
|
1682
1698
|
|
|
1683
1699
|
<Accordion title="Broncontext" defaultOpen>
|
|
1684
1700
|
<div class="space-y-1">
|
package/src/types.ts
CHANGED
|
@@ -191,6 +191,12 @@ export type FeedbackLocatorSourceCollector = (
|
|
|
191
191
|
target: HTMLElement,
|
|
192
192
|
) => FeedbackLocatorSourceMetadata | null;
|
|
193
193
|
|
|
194
|
+
export type FeedbackLocatorTheme = {
|
|
195
|
+
primary?: string;
|
|
196
|
+
primaryForeground?: string;
|
|
197
|
+
ring?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
194
200
|
export type FeedbackLocatorConfig = {
|
|
195
201
|
appKey: string;
|
|
196
202
|
appName: string;
|
|
@@ -209,6 +215,8 @@ export type FeedbackLocatorConfig = {
|
|
|
209
215
|
contextProviders?: FeedbackLocatorContextProvider[];
|
|
210
216
|
hotkey?: FeedbackLocatorHotkey;
|
|
211
217
|
showFloatingButton?: boolean;
|
|
218
|
+
enableVideoRecording?: boolean;
|
|
219
|
+
theme?: FeedbackLocatorTheme;
|
|
212
220
|
sourceCollector?: FeedbackLocatorSourceCollector;
|
|
213
221
|
};
|
|
214
222
|
|
|
@@ -219,6 +227,8 @@ export type FeedbackLocator = {
|
|
|
219
227
|
| "contextProviders"
|
|
220
228
|
| "hotkey"
|
|
221
229
|
| "showFloatingButton"
|
|
230
|
+
| "enableVideoRecording"
|
|
231
|
+
| "theme"
|
|
222
232
|
| "sourceCollector"
|
|
223
233
|
| "startAgentSession"
|
|
224
234
|
| "startCodexThread"
|