@designfever/web-review-kit 0.8.2 → 0.8.4
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 +3 -3
- package/dist/{chunk-ZWJNUOYV.js → chunk-FWN7RQCW.js} +41 -58
- package/dist/chunk-FWN7RQCW.js.map +1 -0
- package/dist/index.cjs +39 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/react-shell.cjs +770 -796
- package/dist/react-shell.cjs.map +1 -1
- package/dist/react-shell.js +752 -756
- package/dist/react-shell.js.map +1 -1
- package/docs/README.md +4 -2
- package/docs/architecture.md +33 -7
- package/docs/figma-overlay.md +24 -0
- package/docs/release-notes-0.8.3.md +48 -0
- package/docs/release-notes-0.8.4.md +23 -0
- package/docs/testing.md +12 -4
- package/package.json +1 -1
- package/dist/chunk-ZWJNUOYV.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -248,7 +248,7 @@ function normalizeItemForSupabaseCreate(item, source, options) {
|
|
|
248
248
|
const normalizedStatus = normalizeReviewItemStatus(item.status);
|
|
249
249
|
const routeKey = item.routeKey || item.normalizedPath || "/";
|
|
250
250
|
const viewport = item.viewport ?? { width: 390, height: 720 };
|
|
251
|
-
|
|
251
|
+
return {
|
|
252
252
|
...item,
|
|
253
253
|
id,
|
|
254
254
|
reviewNumber: void 0,
|
|
@@ -269,10 +269,6 @@ function normalizeItemForSupabaseCreate(item, source, options) {
|
|
|
269
269
|
createdAt: now,
|
|
270
270
|
updatedAt: now
|
|
271
271
|
};
|
|
272
|
-
return {
|
|
273
|
-
...nextItem,
|
|
274
|
-
externalIssueUrl: nextItem.externalIssueUrl ?? buildSupabaseReviewUrl(nextItem, source, options)
|
|
275
|
-
};
|
|
276
272
|
}
|
|
277
273
|
async function createItemWithRpc(item, source, options) {
|
|
278
274
|
const rpcName = options.createRpc ?? DEFAULT_SUPABASE_CREATE_REVIEW_ITEM_RPC;
|
|
@@ -1979,6 +1975,15 @@ function isMeaningfulClass(value) {
|
|
|
1979
1975
|
) && !normalized.startsWith("mq-");
|
|
1980
1976
|
}
|
|
1981
1977
|
|
|
1978
|
+
// src/core/error.ts
|
|
1979
|
+
function getErrorMessage(error, fallback) {
|
|
1980
|
+
if (error instanceof Error) return error.message;
|
|
1981
|
+
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
|
|
1982
|
+
return error.message;
|
|
1983
|
+
}
|
|
1984
|
+
return fallback;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1982
1987
|
// src/core/id.ts
|
|
1983
1988
|
function createId() {
|
|
1984
1989
|
if ("randomUUID" in crypto) return crypto.randomUUID();
|
|
@@ -2014,6 +2019,13 @@ var HOTKEY_KEY_ALIASES = {
|
|
|
2014
2019
|
n: ["\u315C"],
|
|
2015
2020
|
m: ["\u3161"]
|
|
2016
2021
|
};
|
|
2022
|
+
function isEditableEventTarget(event) {
|
|
2023
|
+
const path = event.composedPath?.() ?? [];
|
|
2024
|
+
const element = path[0] ?? event.target;
|
|
2025
|
+
if (!element || typeof element.tagName !== "string") return false;
|
|
2026
|
+
const tag = element.tagName;
|
|
2027
|
+
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || element.isContentEditable === true;
|
|
2028
|
+
}
|
|
2017
2029
|
function isHotkey(event, hotkey) {
|
|
2018
2030
|
const parts = hotkey.split("+").map((part) => part.trim().toLowerCase()).filter(Boolean);
|
|
2019
2031
|
const key = parts.find(
|
|
@@ -5582,13 +5594,6 @@ var WebReviewKitView = class {
|
|
|
5582
5594
|
// src/core/web.review.kit.app.ts
|
|
5583
5595
|
var ROOT_ID = "df-web-review-kit-root";
|
|
5584
5596
|
var VIEWPORT_SCROLL_OPTIONS = { capture: true, passive: true };
|
|
5585
|
-
function isEditableEventTarget(event) {
|
|
5586
|
-
const path = event.composedPath?.() ?? [];
|
|
5587
|
-
const element = path[0] ?? event.target;
|
|
5588
|
-
if (!element || typeof element.tagName !== "string") return false;
|
|
5589
|
-
const tag = element.tagName;
|
|
5590
|
-
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || element.isContentEditable === true;
|
|
5591
|
-
}
|
|
5592
5597
|
function createWebReviewKit(options) {
|
|
5593
5598
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
5594
5599
|
return createNoopController();
|
|
@@ -6143,46 +6148,28 @@ var WebReviewKitApp = class {
|
|
|
6143
6148
|
this.root.style.display = previousDisplay;
|
|
6144
6149
|
}
|
|
6145
6150
|
}
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
const environment = this.getEnvironment();
|
|
6149
|
-
const draft = this.domDraft;
|
|
6150
|
-
if (!draft) return;
|
|
6151
|
-
if (!environment?.captureViewport) {
|
|
6152
|
-
this.draftError = "Viewport capture helper is not available.";
|
|
6153
|
-
this.render();
|
|
6154
|
-
return;
|
|
6155
|
-
}
|
|
6156
|
-
const captureInput = this.createViewportCaptureInput(
|
|
6157
|
-
environment,
|
|
6151
|
+
captureDomDraft(input) {
|
|
6152
|
+
return this.captureDraft(
|
|
6158
6153
|
input,
|
|
6159
|
-
|
|
6154
|
+
() => this.domDraft,
|
|
6155
|
+
(draft) => {
|
|
6156
|
+
this.domDraft = draft;
|
|
6157
|
+
}
|
|
6160
6158
|
);
|
|
6161
|
-
this.draftError = "";
|
|
6162
|
-
this.isCapturingViewport = true;
|
|
6163
|
-
this.render();
|
|
6164
|
-
try {
|
|
6165
|
-
const result = await environment.captureViewport(captureInput);
|
|
6166
|
-
const attachment = this.createCaptureDraftAttachment(result, captureInput);
|
|
6167
|
-
const currentDraft = this.domDraft ?? draft;
|
|
6168
|
-
this.domDraft = {
|
|
6169
|
-
...currentDraft,
|
|
6170
|
-
attachments: [...currentDraft.attachments ?? [], attachment]
|
|
6171
|
-
};
|
|
6172
|
-
} catch (error) {
|
|
6173
|
-
this.draftError = this.getErrorMessage(
|
|
6174
|
-
error,
|
|
6175
|
-
"Failed to capture viewport."
|
|
6176
|
-
);
|
|
6177
|
-
} finally {
|
|
6178
|
-
this.isCapturingViewport = false;
|
|
6179
|
-
this.render();
|
|
6180
|
-
}
|
|
6181
6159
|
}
|
|
6182
|
-
|
|
6160
|
+
captureAreaDraft(input) {
|
|
6161
|
+
return this.captureDraft(
|
|
6162
|
+
input,
|
|
6163
|
+
() => this.areaDraft,
|
|
6164
|
+
(draft) => {
|
|
6165
|
+
this.areaDraft = draft;
|
|
6166
|
+
}
|
|
6167
|
+
);
|
|
6168
|
+
}
|
|
6169
|
+
async captureDraft(input, getDraft, setDraft) {
|
|
6183
6170
|
if (this.isCapturingViewport) return;
|
|
6184
6171
|
const environment = this.getEnvironment();
|
|
6185
|
-
const draft =
|
|
6172
|
+
const draft = getDraft();
|
|
6186
6173
|
if (!draft) return;
|
|
6187
6174
|
if (!environment?.captureViewport) {
|
|
6188
6175
|
this.draftError = "Viewport capture helper is not available.";
|
|
@@ -6200,16 +6187,13 @@ var WebReviewKitApp = class {
|
|
|
6200
6187
|
try {
|
|
6201
6188
|
const result = await environment.captureViewport(captureInput);
|
|
6202
6189
|
const attachment = this.createCaptureDraftAttachment(result, captureInput);
|
|
6203
|
-
const currentDraft =
|
|
6204
|
-
|
|
6190
|
+
const currentDraft = getDraft() ?? draft;
|
|
6191
|
+
setDraft({
|
|
6205
6192
|
...currentDraft,
|
|
6206
6193
|
attachments: [...currentDraft.attachments ?? [], attachment]
|
|
6207
|
-
};
|
|
6194
|
+
});
|
|
6208
6195
|
} catch (error) {
|
|
6209
|
-
this.draftError =
|
|
6210
|
-
error,
|
|
6211
|
-
"Failed to capture viewport."
|
|
6212
|
-
);
|
|
6196
|
+
this.draftError = getErrorMessage(error, "Failed to capture viewport.");
|
|
6213
6197
|
} finally {
|
|
6214
6198
|
this.isCapturingViewport = false;
|
|
6215
6199
|
this.render();
|
|
@@ -6348,17 +6332,10 @@ var WebReviewKitApp = class {
|
|
|
6348
6332
|
);
|
|
6349
6333
|
}
|
|
6350
6334
|
getCreateItemErrorMessage(error, wasUploadingAttachments) {
|
|
6351
|
-
const message =
|
|
6335
|
+
const message = getErrorMessage(error, "Failed to save QA.");
|
|
6352
6336
|
const reason = error && typeof error === "object" && "reason" in error && typeof error.reason === "string" ? ` (${error.reason})` : "";
|
|
6353
6337
|
return wasUploadingAttachments && reason ? `Attachment upload failed${reason}: ${message}` : message;
|
|
6354
6338
|
}
|
|
6355
|
-
getErrorMessage(error, fallback) {
|
|
6356
|
-
if (error instanceof Error) return error.message;
|
|
6357
|
-
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
|
|
6358
|
-
return error.message;
|
|
6359
|
-
}
|
|
6360
|
-
return fallback;
|
|
6361
|
-
}
|
|
6362
6339
|
async restoreItem(item) {
|
|
6363
6340
|
this.setModeState("idle");
|
|
6364
6341
|
this.clearDrafts();
|