@designfever/web-review-kit 0.8.2 → 0.8.3

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 CHANGED
@@ -27,10 +27,10 @@ This package does not own internal operator tools, private admin keys, or produc
27
27
  - [Testing](docs/testing.md): Vitest adapter contract tests and local verification commands.
28
28
  - [Custom adapter sample](docs/adaptor.sample.ts): starting point for host-owned remote adapters.
29
29
  - [DB setup](docs/db-setup.md): optional Supabase `review_items` setup, RLS, presence notes, and validation.
30
- - [Architecture and runtime logic](docs/architecture.md): core runtime, React shell, coordinate, anchor, and extension boundaries.
31
- - [Figma overlay](docs/figma-overlay.md): how the shell toggles a host Figma overlay.
30
+ - [Architecture and runtime logic](docs/architecture.md): core runtime, React shell, coordinate, anchor, sitemap, and feature ownership boundaries.
31
+ - [Figma overlay](docs/figma-overlay.md): host helper behavior and package-managed image overlay state.
32
32
  - [Grid overlay](docs/grid-overlay.md): how the shell toggles a host grid/helper overlay.
33
- - [Release notes 0.8.2](docs/release-notes-0.8.2.md): Figma image layer edit/delete tooltip removal.
33
+ - [Release notes 0.8.3](docs/release-notes-0.8.3.md): code-review bug fixes, sitemap state persistence and status filtering.
34
34
 
35
35
  ## Quick Start
36
36
 
@@ -931,6 +931,15 @@ function isMeaningfulClass(value) {
931
931
  ) && !normalized.startsWith("mq-");
932
932
  }
933
933
 
934
+ // src/core/error.ts
935
+ function getErrorMessage(error, fallback) {
936
+ if (error instanceof Error) return error.message;
937
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
938
+ return error.message;
939
+ }
940
+ return fallback;
941
+ }
942
+
934
943
  // src/core/id.ts
935
944
  function createId() {
936
945
  if ("randomUUID" in crypto) return crypto.randomUUID();
@@ -966,6 +975,13 @@ var HOTKEY_KEY_ALIASES = {
966
975
  n: ["\u315C"],
967
976
  m: ["\u3161"]
968
977
  };
978
+ function isEditableEventTarget(event) {
979
+ const path = event.composedPath?.() ?? [];
980
+ const element = path[0] ?? event.target;
981
+ if (!element || typeof element.tagName !== "string") return false;
982
+ const tag = element.tagName;
983
+ return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || element.isContentEditable === true;
984
+ }
969
985
  function isHotkey(event, hotkey) {
970
986
  const parts = hotkey.split("+").map((part) => part.trim().toLowerCase()).filter(Boolean);
971
987
  const key = parts.find(
@@ -4443,13 +4459,6 @@ var WebReviewKitView = class {
4443
4459
  // src/core/web.review.kit.app.ts
4444
4460
  var ROOT_ID = "df-web-review-kit-root";
4445
4461
  var VIEWPORT_SCROLL_OPTIONS = { capture: true, passive: true };
4446
- function isEditableEventTarget(event) {
4447
- const path = event.composedPath?.() ?? [];
4448
- const element = path[0] ?? event.target;
4449
- if (!element || typeof element.tagName !== "string") return false;
4450
- const tag = element.tagName;
4451
- return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || element.isContentEditable === true;
4452
- }
4453
4462
  function createWebReviewKit(options) {
4454
4463
  if (typeof window === "undefined" || typeof document === "undefined") {
4455
4464
  return createNoopController();
@@ -5004,46 +5013,28 @@ var WebReviewKitApp = class {
5004
5013
  this.root.style.display = previousDisplay;
5005
5014
  }
5006
5015
  }
5007
- async captureDomDraft(input) {
5008
- if (this.isCapturingViewport) return;
5009
- const environment = this.getEnvironment();
5010
- const draft = this.domDraft;
5011
- if (!draft) return;
5012
- if (!environment?.captureViewport) {
5013
- this.draftError = "Viewport capture helper is not available.";
5014
- this.render();
5015
- return;
5016
- }
5017
- const captureInput = this.createViewportCaptureInput(
5018
- environment,
5016
+ captureDomDraft(input) {
5017
+ return this.captureDraft(
5019
5018
  input,
5020
- input.selection?.viewport
5019
+ () => this.domDraft,
5020
+ (draft) => {
5021
+ this.domDraft = draft;
5022
+ }
5023
+ );
5024
+ }
5025
+ captureAreaDraft(input) {
5026
+ return this.captureDraft(
5027
+ input,
5028
+ () => this.areaDraft,
5029
+ (draft) => {
5030
+ this.areaDraft = draft;
5031
+ }
5021
5032
  );
5022
- this.draftError = "";
5023
- this.isCapturingViewport = true;
5024
- this.render();
5025
- try {
5026
- const result = await environment.captureViewport(captureInput);
5027
- const attachment = this.createCaptureDraftAttachment(result, captureInput);
5028
- const currentDraft = this.domDraft ?? draft;
5029
- this.domDraft = {
5030
- ...currentDraft,
5031
- attachments: [...currentDraft.attachments ?? [], attachment]
5032
- };
5033
- } catch (error) {
5034
- this.draftError = this.getErrorMessage(
5035
- error,
5036
- "Failed to capture viewport."
5037
- );
5038
- } finally {
5039
- this.isCapturingViewport = false;
5040
- this.render();
5041
- }
5042
5033
  }
5043
- async captureAreaDraft(input) {
5034
+ async captureDraft(input, getDraft, setDraft) {
5044
5035
  if (this.isCapturingViewport) return;
5045
5036
  const environment = this.getEnvironment();
5046
- const draft = this.areaDraft;
5037
+ const draft = getDraft();
5047
5038
  if (!draft) return;
5048
5039
  if (!environment?.captureViewport) {
5049
5040
  this.draftError = "Viewport capture helper is not available.";
@@ -5061,16 +5052,13 @@ var WebReviewKitApp = class {
5061
5052
  try {
5062
5053
  const result = await environment.captureViewport(captureInput);
5063
5054
  const attachment = this.createCaptureDraftAttachment(result, captureInput);
5064
- const currentDraft = this.areaDraft ?? draft;
5065
- this.areaDraft = {
5055
+ const currentDraft = getDraft() ?? draft;
5056
+ setDraft({
5066
5057
  ...currentDraft,
5067
5058
  attachments: [...currentDraft.attachments ?? [], attachment]
5068
- };
5059
+ });
5069
5060
  } catch (error) {
5070
- this.draftError = this.getErrorMessage(
5071
- error,
5072
- "Failed to capture viewport."
5073
- );
5061
+ this.draftError = getErrorMessage(error, "Failed to capture viewport.");
5074
5062
  } finally {
5075
5063
  this.isCapturingViewport = false;
5076
5064
  this.render();
@@ -5209,17 +5197,10 @@ var WebReviewKitApp = class {
5209
5197
  );
5210
5198
  }
5211
5199
  getCreateItemErrorMessage(error, wasUploadingAttachments) {
5212
- const message = this.getErrorMessage(error, "Failed to save QA.");
5200
+ const message = getErrorMessage(error, "Failed to save QA.");
5213
5201
  const reason = error && typeof error === "object" && "reason" in error && typeof error.reason === "string" ? ` (${error.reason})` : "";
5214
5202
  return wasUploadingAttachments && reason ? `Attachment upload failed${reason}: ${message}` : message;
5215
5203
  }
5216
- getErrorMessage(error, fallback) {
5217
- if (error instanceof Error) return error.message;
5218
- if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
5219
- return error.message;
5220
- }
5221
- return fallback;
5222
- }
5223
5204
  async restoreItem(item) {
5224
5205
  this.setModeState("idle");
5225
5206
  this.clearDrafts();
@@ -5283,6 +5264,8 @@ export {
5283
5264
  isPointInViewport,
5284
5265
  toHostPoint,
5285
5266
  clamp,
5267
+ getErrorMessage,
5268
+ isEditableEventTarget,
5286
5269
  isHotkey,
5287
5270
  getHotkeyActionKey,
5288
5271
  DEFAULT_REVIEW_VIEWPORTS,
@@ -5299,4 +5282,4 @@ export {
5299
5282
  reviewTypographyTokens,
5300
5283
  createWebReviewKit
5301
5284
  };
5302
- //# sourceMappingURL=chunk-ZWJNUOYV.js.map
5285
+ //# sourceMappingURL=chunk-FWN7RQCW.js.map