blocfeed 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/LICENSE +201 -0
- package/README.md +210 -0
- package/dist/chunk-4EGJPVEG.js +1 -0
- package/dist/chunk-52FWOTRN.cjs +1 -0
- package/dist/controller-5O3OHUFm.d.cts +217 -0
- package/dist/controller-5O3OHUFm.d.ts +217 -0
- package/dist/engine.cjs +1 -0
- package/dist/engine.d.cts +19 -0
- package/dist/engine.d.ts +19 -0
- package/dist/engine.js +1 -0
- package/dist/main.cjs +223 -0
- package/dist/main.d.cts +30 -0
- package/dist/main.d.ts +30 -0
- package/dist/main.js +223 -0
- package/package.json +71 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2
|
+
type ScreenshotMime = "image/png" | "image/jpeg";
|
|
3
|
+
interface ImageAsset {
|
|
4
|
+
mime: ScreenshotMime;
|
|
5
|
+
/**
|
|
6
|
+
* A Data URL representation of the image (default capture output).
|
|
7
|
+
* Consumers that need a Blob can convert via `dataUrlToBlob`.
|
|
8
|
+
*/
|
|
9
|
+
dataUrl: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
interface Rect {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
interface ElementDescriptor {
|
|
20
|
+
selector: string;
|
|
21
|
+
tagName: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
textSnippet?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional host-provided React/Next.js component name.
|
|
27
|
+
*
|
|
28
|
+
* Set by adding `data-blocfeed-component="MyComponent"` to a DOM element
|
|
29
|
+
* (usually the root element of a component).
|
|
30
|
+
*/
|
|
31
|
+
componentName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Best-effort test identifier extracted from common attributes like:
|
|
34
|
+
* `data-testid`, `data-test-id`, `data-cy`, etc.
|
|
35
|
+
*/
|
|
36
|
+
testId?: string;
|
|
37
|
+
rect: Rect;
|
|
38
|
+
pageRect: Rect;
|
|
39
|
+
}
|
|
40
|
+
interface CaptureDiagnostics {
|
|
41
|
+
startedAt: number;
|
|
42
|
+
finishedAt: number;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
errors?: BlocFeedError[];
|
|
45
|
+
}
|
|
46
|
+
interface CaptureResult {
|
|
47
|
+
element?: ImageAsset;
|
|
48
|
+
fullPage?: ImageAsset;
|
|
49
|
+
diagnostics: CaptureDiagnostics;
|
|
50
|
+
}
|
|
51
|
+
interface BlocFeedError {
|
|
52
|
+
kind: "unknown" | "configuration" | "capture_failed" | "webhook_failed" | "callback_failed" | "aborted";
|
|
53
|
+
message: string;
|
|
54
|
+
detail?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface MetadataContext {
|
|
57
|
+
selection?: ElementDescriptor;
|
|
58
|
+
capture?: CaptureResult;
|
|
59
|
+
}
|
|
60
|
+
interface ScreenshotAdapterOptions {
|
|
61
|
+
mime: ScreenshotMime;
|
|
62
|
+
quality?: number;
|
|
63
|
+
pixelRatio: number;
|
|
64
|
+
/**
|
|
65
|
+
* Upper bound for width/height of the generated image.
|
|
66
|
+
*/
|
|
67
|
+
maxDimension: number;
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
}
|
|
70
|
+
interface ScreenshotAdapter {
|
|
71
|
+
captureElement: (element: Element, options: ScreenshotAdapterOptions) => MaybePromise<ImageAsset>;
|
|
72
|
+
captureFullPage: (options: ScreenshotAdapterOptions) => MaybePromise<ImageAsset>;
|
|
73
|
+
}
|
|
74
|
+
interface CaptureConfig {
|
|
75
|
+
element?: boolean;
|
|
76
|
+
fullPage?: boolean;
|
|
77
|
+
mime?: ScreenshotMime;
|
|
78
|
+
quality?: number;
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Upper bound for width/height of generated screenshots.
|
|
82
|
+
* Prevents pathological memory use on very large pages.
|
|
83
|
+
*/
|
|
84
|
+
maxDimension?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Screenshot scale multiplier. Default is `window.devicePixelRatio` (capped).
|
|
87
|
+
*/
|
|
88
|
+
pixelRatio?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Override the screenshot capture implementation.
|
|
91
|
+
*/
|
|
92
|
+
adapter?: ScreenshotAdapter;
|
|
93
|
+
}
|
|
94
|
+
interface PickerConfig {
|
|
95
|
+
/**
|
|
96
|
+
* CSS selectors to exclude from picking. Any element matching (or contained by)
|
|
97
|
+
* one of these selectors is not selectable.
|
|
98
|
+
*/
|
|
99
|
+
ignoreSelectors?: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* Optional predicate to allow/deny selection.
|
|
102
|
+
*/
|
|
103
|
+
isSelectable?: (element: Element) => boolean;
|
|
104
|
+
}
|
|
105
|
+
interface MetadataConfig {
|
|
106
|
+
enabled?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Hook to add host-specific metadata (e.g. user/org ids, route names).
|
|
109
|
+
* Must return JSON-serializable values.
|
|
110
|
+
*/
|
|
111
|
+
enrich?: (context: MetadataContext) => MaybePromise<Record<string, unknown>>;
|
|
112
|
+
}
|
|
113
|
+
interface WebhookConfig {
|
|
114
|
+
url: string;
|
|
115
|
+
headers?: Record<string, string> | (() => MaybePromise<Record<string, string>>);
|
|
116
|
+
timeoutMs?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Optional: set fetch credentials mode for the request.
|
|
119
|
+
*/
|
|
120
|
+
credentials?: RequestCredentials;
|
|
121
|
+
/**
|
|
122
|
+
* Basic retry behavior for transient failures (network errors, 5xx).
|
|
123
|
+
*/
|
|
124
|
+
retry?: {
|
|
125
|
+
/**
|
|
126
|
+
* Total attempts including the initial request. Default: 2.
|
|
127
|
+
*/
|
|
128
|
+
attempts?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Base delay used for exponential backoff. Default: 500ms.
|
|
131
|
+
*/
|
|
132
|
+
backoffMs?: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
interface SubmitConfig {
|
|
136
|
+
/**
|
|
137
|
+
* Local delivery mode. If provided, called with the final payload.
|
|
138
|
+
*/
|
|
139
|
+
onSubmit?: (payload: FeedbackPayload) => MaybePromise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Remote delivery mode. If provided, BlocFeed will POST the payload to the webhook.
|
|
142
|
+
*/
|
|
143
|
+
webhook?: WebhookConfig;
|
|
144
|
+
/**
|
|
145
|
+
* If both `onSubmit` and `webhook` are present, require both to succeed.
|
|
146
|
+
* Default: false (success if at least one succeeds).
|
|
147
|
+
*/
|
|
148
|
+
requireAll?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Last chance to transform/redact the payload before delivery.
|
|
151
|
+
*/
|
|
152
|
+
beforeSubmit?: (payload: FeedbackPayload) => MaybePromise<FeedbackPayload>;
|
|
153
|
+
}
|
|
154
|
+
interface BlocFeedConfig {
|
|
155
|
+
capture?: CaptureConfig;
|
|
156
|
+
picker?: PickerConfig;
|
|
157
|
+
metadata?: MetadataConfig;
|
|
158
|
+
submit?: SubmitConfig;
|
|
159
|
+
ui?: {
|
|
160
|
+
/**
|
|
161
|
+
* z-index for the widget overlay/panel.
|
|
162
|
+
*/
|
|
163
|
+
zIndex?: number;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
interface FeedbackPayload {
|
|
167
|
+
version: 1;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
message: string;
|
|
170
|
+
selection?: ElementDescriptor;
|
|
171
|
+
screenshots?: CaptureResult;
|
|
172
|
+
metadata: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
interface TransportResult {
|
|
175
|
+
ok: boolean;
|
|
176
|
+
error?: BlocFeedError;
|
|
177
|
+
status?: number;
|
|
178
|
+
}
|
|
179
|
+
interface SubmitResult {
|
|
180
|
+
ok: boolean;
|
|
181
|
+
callback?: TransportResult;
|
|
182
|
+
webhook?: TransportResult;
|
|
183
|
+
}
|
|
184
|
+
type SessionPhase = "idle" | "picking" | "review" | "capturing" | "submitting" | "success" | "error";
|
|
185
|
+
interface BlocFeedState {
|
|
186
|
+
phase: SessionPhase;
|
|
187
|
+
selection?: ElementDescriptor;
|
|
188
|
+
capture?: CaptureResult;
|
|
189
|
+
lastSubmit?: SubmitResult;
|
|
190
|
+
lastError?: BlocFeedError;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
type HoverInfo = {
|
|
194
|
+
element: Element;
|
|
195
|
+
rect: Rect;
|
|
196
|
+
} | null;
|
|
197
|
+
|
|
198
|
+
type StateListener = (state: BlocFeedState) => void;
|
|
199
|
+
type HoverListener = (hover: HoverInfo) => void;
|
|
200
|
+
interface BlocFeedController {
|
|
201
|
+
getState: () => BlocFeedState;
|
|
202
|
+
subscribe: (listener: StateListener) => () => void;
|
|
203
|
+
subscribeHover: (listener: HoverListener) => () => void;
|
|
204
|
+
start: () => void;
|
|
205
|
+
stop: () => void;
|
|
206
|
+
clearSelection: () => void;
|
|
207
|
+
setConfig: (nextConfig: BlocFeedConfig) => void;
|
|
208
|
+
submit: (message: string, options?: {
|
|
209
|
+
capture?: CaptureConfig;
|
|
210
|
+
}) => Promise<SubmitResult>;
|
|
211
|
+
/** Internal: used by UI to access the live element handle. */
|
|
212
|
+
__unsafeGetSelectedElement: () => Element | null;
|
|
213
|
+
destroy: () => void;
|
|
214
|
+
}
|
|
215
|
+
declare function createBlocFeedController(config: BlocFeedConfig): BlocFeedController;
|
|
216
|
+
|
|
217
|
+
export { type BlocFeedConfig as B, type CaptureConfig as C, type ElementDescriptor as E, type FeedbackPayload as F, type HoverListener as H, type ImageAsset as I, type MaybePromise as M, type PickerConfig as P, type Rect as R, type SubmitResult as S, type TransportResult as T, type WebhookConfig as W, type BlocFeedState as a, type BlocFeedController as b, type BlocFeedError as c, type CaptureDiagnostics as d, type CaptureResult as e, type MetadataConfig as f, type MetadataContext as g, type ScreenshotAdapter as h, type ScreenshotAdapterOptions as i, type ScreenshotMime as j, type SessionPhase as k, type SubmitConfig as l, type StateListener as m, createBlocFeedController as n };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2
|
+
type ScreenshotMime = "image/png" | "image/jpeg";
|
|
3
|
+
interface ImageAsset {
|
|
4
|
+
mime: ScreenshotMime;
|
|
5
|
+
/**
|
|
6
|
+
* A Data URL representation of the image (default capture output).
|
|
7
|
+
* Consumers that need a Blob can convert via `dataUrlToBlob`.
|
|
8
|
+
*/
|
|
9
|
+
dataUrl: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
interface Rect {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
interface ElementDescriptor {
|
|
20
|
+
selector: string;
|
|
21
|
+
tagName: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
textSnippet?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional host-provided React/Next.js component name.
|
|
27
|
+
*
|
|
28
|
+
* Set by adding `data-blocfeed-component="MyComponent"` to a DOM element
|
|
29
|
+
* (usually the root element of a component).
|
|
30
|
+
*/
|
|
31
|
+
componentName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Best-effort test identifier extracted from common attributes like:
|
|
34
|
+
* `data-testid`, `data-test-id`, `data-cy`, etc.
|
|
35
|
+
*/
|
|
36
|
+
testId?: string;
|
|
37
|
+
rect: Rect;
|
|
38
|
+
pageRect: Rect;
|
|
39
|
+
}
|
|
40
|
+
interface CaptureDiagnostics {
|
|
41
|
+
startedAt: number;
|
|
42
|
+
finishedAt: number;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
errors?: BlocFeedError[];
|
|
45
|
+
}
|
|
46
|
+
interface CaptureResult {
|
|
47
|
+
element?: ImageAsset;
|
|
48
|
+
fullPage?: ImageAsset;
|
|
49
|
+
diagnostics: CaptureDiagnostics;
|
|
50
|
+
}
|
|
51
|
+
interface BlocFeedError {
|
|
52
|
+
kind: "unknown" | "configuration" | "capture_failed" | "webhook_failed" | "callback_failed" | "aborted";
|
|
53
|
+
message: string;
|
|
54
|
+
detail?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface MetadataContext {
|
|
57
|
+
selection?: ElementDescriptor;
|
|
58
|
+
capture?: CaptureResult;
|
|
59
|
+
}
|
|
60
|
+
interface ScreenshotAdapterOptions {
|
|
61
|
+
mime: ScreenshotMime;
|
|
62
|
+
quality?: number;
|
|
63
|
+
pixelRatio: number;
|
|
64
|
+
/**
|
|
65
|
+
* Upper bound for width/height of the generated image.
|
|
66
|
+
*/
|
|
67
|
+
maxDimension: number;
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
}
|
|
70
|
+
interface ScreenshotAdapter {
|
|
71
|
+
captureElement: (element: Element, options: ScreenshotAdapterOptions) => MaybePromise<ImageAsset>;
|
|
72
|
+
captureFullPage: (options: ScreenshotAdapterOptions) => MaybePromise<ImageAsset>;
|
|
73
|
+
}
|
|
74
|
+
interface CaptureConfig {
|
|
75
|
+
element?: boolean;
|
|
76
|
+
fullPage?: boolean;
|
|
77
|
+
mime?: ScreenshotMime;
|
|
78
|
+
quality?: number;
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Upper bound for width/height of generated screenshots.
|
|
82
|
+
* Prevents pathological memory use on very large pages.
|
|
83
|
+
*/
|
|
84
|
+
maxDimension?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Screenshot scale multiplier. Default is `window.devicePixelRatio` (capped).
|
|
87
|
+
*/
|
|
88
|
+
pixelRatio?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Override the screenshot capture implementation.
|
|
91
|
+
*/
|
|
92
|
+
adapter?: ScreenshotAdapter;
|
|
93
|
+
}
|
|
94
|
+
interface PickerConfig {
|
|
95
|
+
/**
|
|
96
|
+
* CSS selectors to exclude from picking. Any element matching (or contained by)
|
|
97
|
+
* one of these selectors is not selectable.
|
|
98
|
+
*/
|
|
99
|
+
ignoreSelectors?: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* Optional predicate to allow/deny selection.
|
|
102
|
+
*/
|
|
103
|
+
isSelectable?: (element: Element) => boolean;
|
|
104
|
+
}
|
|
105
|
+
interface MetadataConfig {
|
|
106
|
+
enabled?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Hook to add host-specific metadata (e.g. user/org ids, route names).
|
|
109
|
+
* Must return JSON-serializable values.
|
|
110
|
+
*/
|
|
111
|
+
enrich?: (context: MetadataContext) => MaybePromise<Record<string, unknown>>;
|
|
112
|
+
}
|
|
113
|
+
interface WebhookConfig {
|
|
114
|
+
url: string;
|
|
115
|
+
headers?: Record<string, string> | (() => MaybePromise<Record<string, string>>);
|
|
116
|
+
timeoutMs?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Optional: set fetch credentials mode for the request.
|
|
119
|
+
*/
|
|
120
|
+
credentials?: RequestCredentials;
|
|
121
|
+
/**
|
|
122
|
+
* Basic retry behavior for transient failures (network errors, 5xx).
|
|
123
|
+
*/
|
|
124
|
+
retry?: {
|
|
125
|
+
/**
|
|
126
|
+
* Total attempts including the initial request. Default: 2.
|
|
127
|
+
*/
|
|
128
|
+
attempts?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Base delay used for exponential backoff. Default: 500ms.
|
|
131
|
+
*/
|
|
132
|
+
backoffMs?: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
interface SubmitConfig {
|
|
136
|
+
/**
|
|
137
|
+
* Local delivery mode. If provided, called with the final payload.
|
|
138
|
+
*/
|
|
139
|
+
onSubmit?: (payload: FeedbackPayload) => MaybePromise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Remote delivery mode. If provided, BlocFeed will POST the payload to the webhook.
|
|
142
|
+
*/
|
|
143
|
+
webhook?: WebhookConfig;
|
|
144
|
+
/**
|
|
145
|
+
* If both `onSubmit` and `webhook` are present, require both to succeed.
|
|
146
|
+
* Default: false (success if at least one succeeds).
|
|
147
|
+
*/
|
|
148
|
+
requireAll?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Last chance to transform/redact the payload before delivery.
|
|
151
|
+
*/
|
|
152
|
+
beforeSubmit?: (payload: FeedbackPayload) => MaybePromise<FeedbackPayload>;
|
|
153
|
+
}
|
|
154
|
+
interface BlocFeedConfig {
|
|
155
|
+
capture?: CaptureConfig;
|
|
156
|
+
picker?: PickerConfig;
|
|
157
|
+
metadata?: MetadataConfig;
|
|
158
|
+
submit?: SubmitConfig;
|
|
159
|
+
ui?: {
|
|
160
|
+
/**
|
|
161
|
+
* z-index for the widget overlay/panel.
|
|
162
|
+
*/
|
|
163
|
+
zIndex?: number;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
interface FeedbackPayload {
|
|
167
|
+
version: 1;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
message: string;
|
|
170
|
+
selection?: ElementDescriptor;
|
|
171
|
+
screenshots?: CaptureResult;
|
|
172
|
+
metadata: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
interface TransportResult {
|
|
175
|
+
ok: boolean;
|
|
176
|
+
error?: BlocFeedError;
|
|
177
|
+
status?: number;
|
|
178
|
+
}
|
|
179
|
+
interface SubmitResult {
|
|
180
|
+
ok: boolean;
|
|
181
|
+
callback?: TransportResult;
|
|
182
|
+
webhook?: TransportResult;
|
|
183
|
+
}
|
|
184
|
+
type SessionPhase = "idle" | "picking" | "review" | "capturing" | "submitting" | "success" | "error";
|
|
185
|
+
interface BlocFeedState {
|
|
186
|
+
phase: SessionPhase;
|
|
187
|
+
selection?: ElementDescriptor;
|
|
188
|
+
capture?: CaptureResult;
|
|
189
|
+
lastSubmit?: SubmitResult;
|
|
190
|
+
lastError?: BlocFeedError;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
type HoverInfo = {
|
|
194
|
+
element: Element;
|
|
195
|
+
rect: Rect;
|
|
196
|
+
} | null;
|
|
197
|
+
|
|
198
|
+
type StateListener = (state: BlocFeedState) => void;
|
|
199
|
+
type HoverListener = (hover: HoverInfo) => void;
|
|
200
|
+
interface BlocFeedController {
|
|
201
|
+
getState: () => BlocFeedState;
|
|
202
|
+
subscribe: (listener: StateListener) => () => void;
|
|
203
|
+
subscribeHover: (listener: HoverListener) => () => void;
|
|
204
|
+
start: () => void;
|
|
205
|
+
stop: () => void;
|
|
206
|
+
clearSelection: () => void;
|
|
207
|
+
setConfig: (nextConfig: BlocFeedConfig) => void;
|
|
208
|
+
submit: (message: string, options?: {
|
|
209
|
+
capture?: CaptureConfig;
|
|
210
|
+
}) => Promise<SubmitResult>;
|
|
211
|
+
/** Internal: used by UI to access the live element handle. */
|
|
212
|
+
__unsafeGetSelectedElement: () => Element | null;
|
|
213
|
+
destroy: () => void;
|
|
214
|
+
}
|
|
215
|
+
declare function createBlocFeedController(config: BlocFeedConfig): BlocFeedController;
|
|
216
|
+
|
|
217
|
+
export { type BlocFeedConfig as B, type CaptureConfig as C, type ElementDescriptor as E, type FeedbackPayload as F, type HoverListener as H, type ImageAsset as I, type MaybePromise as M, type PickerConfig as P, type Rect as R, type SubmitResult as S, type TransportResult as T, type WebhookConfig as W, type BlocFeedState as a, type BlocFeedController as b, type BlocFeedError as c, type CaptureDiagnostics as d, type CaptureResult as e, type MetadataConfig as f, type MetadataContext as g, type ScreenshotAdapter as h, type ScreenshotAdapterOptions as i, type ScreenshotMime as j, type SessionPhase as k, type SubmitConfig as l, type StateListener as m, createBlocFeedController as n };
|
package/dist/engine.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk52FWOTRN_cjs=require('./chunk-52FWOTRN.cjs');function d(n){let[r,o]=n.split(",",2);if(!r||!o)throw new Error("Invalid data URL");let c=/data:(.*?);base64/.exec(r)?.[1]||"application/octet-stream",t=atob(o),a=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=t.charCodeAt(e);return new Blob([a],{type:c})}Object.defineProperty(exports,"collectMetadata",{enumerable:true,get:function(){return chunk52FWOTRN_cjs.e}});Object.defineProperty(exports,"createBlocFeedController",{enumerable:true,get:function(){return chunk52FWOTRN_cjs.f}});Object.defineProperty(exports,"createHtmlToImageAdapter",{enumerable:true,get:function(){return chunk52FWOTRN_cjs.c}});Object.defineProperty(exports,"runCapture",{enumerable:true,get:function(){return chunk52FWOTRN_cjs.d}});exports.dataUrlToBlob=d;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h as ScreenshotAdapter, C as CaptureConfig, e as CaptureResult, f as MetadataConfig, g as MetadataContext } from './controller-5O3OHUFm.cjs';
|
|
2
|
+
export { B as BlocFeedConfig, b as BlocFeedController, c as BlocFeedError, a as BlocFeedState, E as ElementDescriptor, F as FeedbackPayload, H as HoverListener, I as ImageAsset, R as Rect, i as ScreenshotAdapterOptions, j as ScreenshotMime, k as SessionPhase, m as StateListener, S as SubmitResult, n as createBlocFeedController } from './controller-5O3OHUFm.cjs';
|
|
3
|
+
|
|
4
|
+
declare function createHtmlToImageAdapter(): ScreenshotAdapter;
|
|
5
|
+
|
|
6
|
+
declare function runCapture(params: {
|
|
7
|
+
selectionElement: Element | null;
|
|
8
|
+
capture: CaptureConfig | undefined;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}): Promise<CaptureResult | undefined>;
|
|
11
|
+
|
|
12
|
+
declare function collectMetadata(params: {
|
|
13
|
+
config: MetadataConfig | undefined;
|
|
14
|
+
context: MetadataContext;
|
|
15
|
+
}): Promise<Record<string, unknown>>;
|
|
16
|
+
|
|
17
|
+
declare function dataUrlToBlob(dataUrl: string): Blob;
|
|
18
|
+
|
|
19
|
+
export { CaptureResult, ScreenshotAdapter, collectMetadata, createHtmlToImageAdapter, dataUrlToBlob, runCapture };
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h as ScreenshotAdapter, C as CaptureConfig, e as CaptureResult, f as MetadataConfig, g as MetadataContext } from './controller-5O3OHUFm.js';
|
|
2
|
+
export { B as BlocFeedConfig, b as BlocFeedController, c as BlocFeedError, a as BlocFeedState, E as ElementDescriptor, F as FeedbackPayload, H as HoverListener, I as ImageAsset, R as Rect, i as ScreenshotAdapterOptions, j as ScreenshotMime, k as SessionPhase, m as StateListener, S as SubmitResult, n as createBlocFeedController } from './controller-5O3OHUFm.js';
|
|
3
|
+
|
|
4
|
+
declare function createHtmlToImageAdapter(): ScreenshotAdapter;
|
|
5
|
+
|
|
6
|
+
declare function runCapture(params: {
|
|
7
|
+
selectionElement: Element | null;
|
|
8
|
+
capture: CaptureConfig | undefined;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}): Promise<CaptureResult | undefined>;
|
|
11
|
+
|
|
12
|
+
declare function collectMetadata(params: {
|
|
13
|
+
config: MetadataConfig | undefined;
|
|
14
|
+
context: MetadataContext;
|
|
15
|
+
}): Promise<Record<string, unknown>>;
|
|
16
|
+
|
|
17
|
+
declare function dataUrlToBlob(dataUrl: string): Blob;
|
|
18
|
+
|
|
19
|
+
export { CaptureResult, ScreenshotAdapter, collectMetadata, createHtmlToImageAdapter, dataUrlToBlob, runCapture };
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{e as collectMetadata,f as createBlocFeedController,c as createHtmlToImageAdapter,d as runCapture}from'./chunk-4EGJPVEG.js';function d(n){let[r,o]=n.split(",",2);if(!r||!o)throw new Error("Invalid data URL");let c=/data:(.*?);base64/.exec(r)?.[1]||"application/octet-stream",t=atob(o),a=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=t.charCodeAt(e);return new Blob([a],{type:c})}export{d as dataUrlToBlob};
|