@designfever/web-review-kit 0.6.0 → 0.7.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.
Files changed (41) hide show
  1. package/.env.sample +29 -0
  2. package/README.md +35 -10
  3. package/dist/chunk-AB5B6O77.js +584 -0
  4. package/dist/chunk-AB5B6O77.js.map +1 -0
  5. package/dist/{chunk-IN36JHEU.js → chunk-RPVLRULC.js} +504 -143
  6. package/dist/chunk-RPVLRULC.js.map +1 -0
  7. package/dist/image.types-BmzkFSPX.d.cts +71 -0
  8. package/dist/image.types-BmzkFSPX.d.ts +71 -0
  9. package/dist/index.cjs +1019 -144
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +27 -3
  12. package/dist/index.d.ts +27 -3
  13. package/dist/index.js +50 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/react-shell.cjs +10293 -5185
  16. package/dist/react-shell.cjs.map +1 -1
  17. package/dist/react-shell.d.cts +37 -4
  18. package/dist/react-shell.d.ts +37 -4
  19. package/dist/react-shell.js +9624 -4856
  20. package/dist/react-shell.js.map +1 -1
  21. package/dist/token-Dt-ZH-YO.d.cts +88 -0
  22. package/dist/token-nJXPPdYX.d.ts +88 -0
  23. package/dist/{types-DFHHVRBc.d.cts → types-DT9Z66mV.d.cts} +13 -1
  24. package/dist/{types-DFHHVRBc.d.ts → types-DT9Z66mV.d.ts} +13 -1
  25. package/dist/vite.cjs +1116 -5
  26. package/dist/vite.cjs.map +1 -1
  27. package/dist/vite.d.cts +45 -1
  28. package/dist/vite.d.ts +45 -1
  29. package/dist/vite.js +800 -5
  30. package/dist/vite.js.map +1 -1
  31. package/docs/README.md +11 -7
  32. package/docs/adapters.md +126 -0
  33. package/docs/adaptor.sample.ts +13 -1
  34. package/docs/architecture.md +2 -1
  35. package/docs/code-review-0.6.0.md +232 -0
  36. package/docs/db-setup.md +4 -2
  37. package/docs/figma-image-mvp-0.7.0.md +327 -0
  38. package/docs/installation.md +39 -7
  39. package/docs/release-notes-0.7.0.md +128 -0
  40. package/package.json +6 -2
  41. package/dist/chunk-IN36JHEU.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { b as ReviewFigmaImageTarget, d as ReviewFigmaImage, R as ReviewFigmaImageStore } from './image.types-BmzkFSPX.cjs';
2
+
3
+ type ReviewFigmaNodeRef = {
4
+ fileKey: string;
5
+ nodeId: string;
6
+ sourceUrl?: string;
7
+ };
8
+ declare const FIGMA_NODE_REF_SEPARATOR = "->";
9
+ declare function parseReviewFigmaNodeRef(value: string | ReviewFigmaNodeRef): ReviewFigmaNodeRef | null;
10
+ declare function requireReviewFigmaNodeRef(value: string | ReviewFigmaNodeRef): ReviewFigmaNodeRef;
11
+ declare function createReviewFigmaNodeValue(ref: ReviewFigmaNodeRef): string;
12
+ declare function createReviewFigmaFrameUrl(value: string | ReviewFigmaNodeRef): string | null;
13
+
14
+ type ReviewFigmaRenderFormat = 'png' | 'jpg' | 'svg' | 'pdf';
15
+ type ReviewFigmaImageRenderOptions = {
16
+ figmaUrl: string | ReviewFigmaNodeRef;
17
+ token?: string | null;
18
+ format?: ReviewFigmaRenderFormat;
19
+ scale?: number;
20
+ useAbsoluteBounds?: boolean;
21
+ apiBaseUrl?: string;
22
+ fetch?: typeof fetch;
23
+ signal?: AbortSignal;
24
+ };
25
+ type ReviewFigmaRenderedImage = {
26
+ fileKey: string;
27
+ nodeId: string;
28
+ figmaUrl?: string;
29
+ imageUrl: string;
30
+ renderFormat: ReviewFigmaRenderFormat;
31
+ };
32
+ declare function renderReviewFigmaImage(options: ReviewFigmaImageRenderOptions): Promise<ReviewFigmaRenderedImage>;
33
+ declare function createReviewFigmaImageApiUrl({ apiBaseUrl, fileKey, nodeId, format, scale, useAbsoluteBounds, }: {
34
+ apiBaseUrl?: string;
35
+ fileKey: string;
36
+ nodeId: string;
37
+ format?: ReviewFigmaRenderFormat;
38
+ scale?: number;
39
+ useAbsoluteBounds?: boolean;
40
+ }): string;
41
+
42
+ type ReviewFigmaImagesSnapshot = ReviewFigmaImage[];
43
+ type ReviewFigmaReleaseSnapshot = {
44
+ version: 1;
45
+ projectId: string;
46
+ releaseId?: string;
47
+ label?: string;
48
+ createdAt: string;
49
+ figmaImagesSnapshot: ReviewFigmaImagesSnapshot;
50
+ };
51
+ type CreateReviewFigmaImagesSnapshotOptions = {
52
+ projectId?: string;
53
+ targets?: readonly ReviewFigmaImageTarget[];
54
+ };
55
+ type CreateReviewFigmaReleaseSnapshotOptions = CreateReviewFigmaImagesSnapshotOptions & {
56
+ images: readonly ReviewFigmaImage[];
57
+ projectId: string;
58
+ releaseId?: string;
59
+ label?: string;
60
+ createdAt?: string;
61
+ };
62
+ type CollectReviewFigmaReleaseSnapshotOptions = Omit<CreateReviewFigmaReleaseSnapshotOptions, 'images'> & {
63
+ store: ReviewFigmaImageStore;
64
+ targets: readonly ReviewFigmaImageTarget[];
65
+ };
66
+ declare function createReviewFigmaImagesSnapshot(images: readonly ReviewFigmaImage[], options?: CreateReviewFigmaImagesSnapshotOptions): ReviewFigmaImagesSnapshot;
67
+ declare function createReviewFigmaReleaseSnapshot({ images, projectId, releaseId, label, createdAt, targets, }: CreateReviewFigmaReleaseSnapshotOptions): ReviewFigmaReleaseSnapshot;
68
+ declare function collectReviewFigmaReleaseSnapshot({ store, targets, ...snapshotOptions }: CollectReviewFigmaReleaseSnapshotOptions): Promise<ReviewFigmaReleaseSnapshot>;
69
+
70
+ declare const DEFAULT_REVIEW_FIGMA_TOKEN_ENV_KEY = "FIGMA_TOKEN";
71
+ declare const REVIEW_FIGMA_TOKEN_MISSING_CODE = "DFWR_FIGMA_TOKEN_MISSING";
72
+ type ReviewFigmaTokenEnv = Record<string, string | null | undefined>;
73
+ type ReviewFigmaTokenOptions = {
74
+ token?: string | null;
75
+ env?: ReviewFigmaTokenEnv;
76
+ envKey?: string;
77
+ enabled?: boolean;
78
+ };
79
+ declare class ReviewFigmaTokenError extends Error {
80
+ readonly code = "DFWR_FIGMA_TOKEN_MISSING";
81
+ readonly envKey: string;
82
+ constructor(envKey?: string);
83
+ }
84
+ declare function readReviewFigmaToken(options?: ReviewFigmaTokenOptions): string | null;
85
+ declare function requireReviewFigmaToken(options?: ReviewFigmaTokenOptions): string;
86
+ declare function isReviewFigmaTokenError(error: unknown): error is ReviewFigmaTokenError;
87
+
88
+ export { type CollectReviewFigmaReleaseSnapshotOptions as C, DEFAULT_REVIEW_FIGMA_TOKEN_ENV_KEY as D, FIGMA_NODE_REF_SEPARATOR as F, type ReviewFigmaRenderFormat as R, type CreateReviewFigmaImagesSnapshotOptions as a, type CreateReviewFigmaReleaseSnapshotOptions as b, REVIEW_FIGMA_TOKEN_MISSING_CODE as c, type ReviewFigmaImagesSnapshot as d, type ReviewFigmaNodeRef as e, type ReviewFigmaReleaseSnapshot as f, type ReviewFigmaTokenEnv as g, ReviewFigmaTokenError as h, type ReviewFigmaTokenOptions as i, collectReviewFigmaReleaseSnapshot as j, createReviewFigmaFrameUrl as k, createReviewFigmaImagesSnapshot as l, createReviewFigmaNodeValue as m, createReviewFigmaReleaseSnapshot as n, isReviewFigmaTokenError as o, parseReviewFigmaNodeRef as p, requireReviewFigmaNodeRef as q, readReviewFigmaToken as r, requireReviewFigmaToken as s, type ReviewFigmaImageRenderOptions as t, type ReviewFigmaRenderedImage as u, createReviewFigmaImageApiUrl as v, renderReviewFigmaImage as w };
@@ -0,0 +1,88 @@
1
+ import { b as ReviewFigmaImageTarget, d as ReviewFigmaImage, R as ReviewFigmaImageStore } from './image.types-BmzkFSPX.js';
2
+
3
+ type ReviewFigmaNodeRef = {
4
+ fileKey: string;
5
+ nodeId: string;
6
+ sourceUrl?: string;
7
+ };
8
+ declare const FIGMA_NODE_REF_SEPARATOR = "->";
9
+ declare function parseReviewFigmaNodeRef(value: string | ReviewFigmaNodeRef): ReviewFigmaNodeRef | null;
10
+ declare function requireReviewFigmaNodeRef(value: string | ReviewFigmaNodeRef): ReviewFigmaNodeRef;
11
+ declare function createReviewFigmaNodeValue(ref: ReviewFigmaNodeRef): string;
12
+ declare function createReviewFigmaFrameUrl(value: string | ReviewFigmaNodeRef): string | null;
13
+
14
+ type ReviewFigmaRenderFormat = 'png' | 'jpg' | 'svg' | 'pdf';
15
+ type ReviewFigmaImageRenderOptions = {
16
+ figmaUrl: string | ReviewFigmaNodeRef;
17
+ token?: string | null;
18
+ format?: ReviewFigmaRenderFormat;
19
+ scale?: number;
20
+ useAbsoluteBounds?: boolean;
21
+ apiBaseUrl?: string;
22
+ fetch?: typeof fetch;
23
+ signal?: AbortSignal;
24
+ };
25
+ type ReviewFigmaRenderedImage = {
26
+ fileKey: string;
27
+ nodeId: string;
28
+ figmaUrl?: string;
29
+ imageUrl: string;
30
+ renderFormat: ReviewFigmaRenderFormat;
31
+ };
32
+ declare function renderReviewFigmaImage(options: ReviewFigmaImageRenderOptions): Promise<ReviewFigmaRenderedImage>;
33
+ declare function createReviewFigmaImageApiUrl({ apiBaseUrl, fileKey, nodeId, format, scale, useAbsoluteBounds, }: {
34
+ apiBaseUrl?: string;
35
+ fileKey: string;
36
+ nodeId: string;
37
+ format?: ReviewFigmaRenderFormat;
38
+ scale?: number;
39
+ useAbsoluteBounds?: boolean;
40
+ }): string;
41
+
42
+ type ReviewFigmaImagesSnapshot = ReviewFigmaImage[];
43
+ type ReviewFigmaReleaseSnapshot = {
44
+ version: 1;
45
+ projectId: string;
46
+ releaseId?: string;
47
+ label?: string;
48
+ createdAt: string;
49
+ figmaImagesSnapshot: ReviewFigmaImagesSnapshot;
50
+ };
51
+ type CreateReviewFigmaImagesSnapshotOptions = {
52
+ projectId?: string;
53
+ targets?: readonly ReviewFigmaImageTarget[];
54
+ };
55
+ type CreateReviewFigmaReleaseSnapshotOptions = CreateReviewFigmaImagesSnapshotOptions & {
56
+ images: readonly ReviewFigmaImage[];
57
+ projectId: string;
58
+ releaseId?: string;
59
+ label?: string;
60
+ createdAt?: string;
61
+ };
62
+ type CollectReviewFigmaReleaseSnapshotOptions = Omit<CreateReviewFigmaReleaseSnapshotOptions, 'images'> & {
63
+ store: ReviewFigmaImageStore;
64
+ targets: readonly ReviewFigmaImageTarget[];
65
+ };
66
+ declare function createReviewFigmaImagesSnapshot(images: readonly ReviewFigmaImage[], options?: CreateReviewFigmaImagesSnapshotOptions): ReviewFigmaImagesSnapshot;
67
+ declare function createReviewFigmaReleaseSnapshot({ images, projectId, releaseId, label, createdAt, targets, }: CreateReviewFigmaReleaseSnapshotOptions): ReviewFigmaReleaseSnapshot;
68
+ declare function collectReviewFigmaReleaseSnapshot({ store, targets, ...snapshotOptions }: CollectReviewFigmaReleaseSnapshotOptions): Promise<ReviewFigmaReleaseSnapshot>;
69
+
70
+ declare const DEFAULT_REVIEW_FIGMA_TOKEN_ENV_KEY = "FIGMA_TOKEN";
71
+ declare const REVIEW_FIGMA_TOKEN_MISSING_CODE = "DFWR_FIGMA_TOKEN_MISSING";
72
+ type ReviewFigmaTokenEnv = Record<string, string | null | undefined>;
73
+ type ReviewFigmaTokenOptions = {
74
+ token?: string | null;
75
+ env?: ReviewFigmaTokenEnv;
76
+ envKey?: string;
77
+ enabled?: boolean;
78
+ };
79
+ declare class ReviewFigmaTokenError extends Error {
80
+ readonly code = "DFWR_FIGMA_TOKEN_MISSING";
81
+ readonly envKey: string;
82
+ constructor(envKey?: string);
83
+ }
84
+ declare function readReviewFigmaToken(options?: ReviewFigmaTokenOptions): string | null;
85
+ declare function requireReviewFigmaToken(options?: ReviewFigmaTokenOptions): string;
86
+ declare function isReviewFigmaTokenError(error: unknown): error is ReviewFigmaTokenError;
87
+
88
+ export { type CollectReviewFigmaReleaseSnapshotOptions as C, DEFAULT_REVIEW_FIGMA_TOKEN_ENV_KEY as D, FIGMA_NODE_REF_SEPARATOR as F, type ReviewFigmaRenderFormat as R, type CreateReviewFigmaImagesSnapshotOptions as a, type CreateReviewFigmaReleaseSnapshotOptions as b, REVIEW_FIGMA_TOKEN_MISSING_CODE as c, type ReviewFigmaImagesSnapshot as d, type ReviewFigmaNodeRef as e, type ReviewFigmaReleaseSnapshot as f, type ReviewFigmaTokenEnv as g, ReviewFigmaTokenError as h, type ReviewFigmaTokenOptions as i, collectReviewFigmaReleaseSnapshot as j, createReviewFigmaFrameUrl as k, createReviewFigmaImagesSnapshot as l, createReviewFigmaNodeValue as m, createReviewFigmaReleaseSnapshot as n, isReviewFigmaTokenError as o, parseReviewFigmaNodeRef as p, requireReviewFigmaNodeRef as q, readReviewFigmaToken as r, requireReviewFigmaToken as s, type ReviewFigmaImageRenderOptions as t, type ReviewFigmaRenderedImage as u, createReviewFigmaImageApiUrl as v, renderReviewFigmaImage as w };
@@ -40,6 +40,10 @@ interface ViewportSize {
40
40
  width: number;
41
41
  height: number;
42
42
  }
43
+ interface ReviewAssigneeOption {
44
+ value: string;
45
+ label: string;
46
+ }
43
47
  interface ReviewPoint {
44
48
  x: number;
45
49
  y: number;
@@ -64,6 +68,8 @@ interface ReviewItem {
64
68
  kind: ReviewItemKind;
65
69
  title?: string;
66
70
  comment: string;
71
+ assigneeId?: string | null;
72
+ assigneeName?: string;
67
73
  createdBy?: string;
68
74
  status: ReviewItemStatus;
69
75
  viewport: ViewportSize;
@@ -129,12 +135,18 @@ interface NumberedReviewItem {
129
135
  number?: number;
130
136
  displayLabel: string;
131
137
  }
138
+ interface ReviewFieldsConfig {
139
+ title?: boolean;
140
+ }
132
141
  interface WebReviewKitOptions {
133
142
  projectId: string;
134
143
  userId?: string;
135
144
  adapter?: WebReviewKitAdapter;
136
145
  target?: WebReviewKitTarget | (() => WebReviewKitTarget | undefined);
137
146
  adjustmentLabel?: string;
147
+ fields?: ReviewFieldsConfig;
148
+ assigneeTitle?: string;
149
+ assigneeOptions?: readonly ReviewAssigneeOption[];
138
150
  viewports?: {
139
151
  presets?: ReviewViewportPreset[];
140
152
  };
@@ -179,4 +191,4 @@ interface WebReviewKitTarget {
179
191
  getComposerHost?: () => HTMLElement | null | undefined;
180
192
  }
181
193
 
182
- export type { DomAnchor as D, LocalAdapterOptions as L, NumberedReviewItem as N, ReviewWorkflowStatus as R, SupabaseReviewAdapterOptions as S, ViewportSize as V, WebReviewKitAdapter as W, ReviewItemStatus as a, WebReviewKitOptions as b, WebReviewKitController as c, ReviewViewportPreset as d, ReviewItem as e, ReviewItemScope as f, DomAnchorCandidate as g, DomAnchorStrategy as h, DomSourceHint as i, RelativeSelection as j, ReviewItemKind as k, ReviewItemQuery as l, ReviewMarker as m, ReviewMode as n, ReviewPoint as o, ReviewRulerConfig as p, ReviewSelection as q, ReviewSource as r, ReviewSubmitStatus as s, ReviewViewportScope as t, SupabaseReviewClient as u, WebReviewKitTarget as v };
194
+ export type { DomAnchor as D, LocalAdapterOptions as L, NumberedReviewItem as N, ReviewWorkflowStatus as R, SupabaseReviewAdapterOptions as S, ViewportSize as V, WebReviewKitAdapter as W, ReviewItemStatus as a, WebReviewKitOptions as b, WebReviewKitController as c, ReviewViewportPreset as d, ReviewItem as e, ReviewItemScope as f, DomAnchorCandidate as g, DomAnchorStrategy as h, DomSourceHint as i, RelativeSelection as j, ReviewAssigneeOption as k, ReviewItemKind as l, ReviewItemQuery as m, ReviewMarker as n, ReviewMode as o, ReviewPoint as p, ReviewRulerConfig as q, ReviewSelection as r, ReviewSource as s, ReviewSubmitStatus as t, ReviewViewportScope as u, SupabaseReviewClient as v, WebReviewKitTarget as w, ReviewFieldsConfig as x };
@@ -40,6 +40,10 @@ interface ViewportSize {
40
40
  width: number;
41
41
  height: number;
42
42
  }
43
+ interface ReviewAssigneeOption {
44
+ value: string;
45
+ label: string;
46
+ }
43
47
  interface ReviewPoint {
44
48
  x: number;
45
49
  y: number;
@@ -64,6 +68,8 @@ interface ReviewItem {
64
68
  kind: ReviewItemKind;
65
69
  title?: string;
66
70
  comment: string;
71
+ assigneeId?: string | null;
72
+ assigneeName?: string;
67
73
  createdBy?: string;
68
74
  status: ReviewItemStatus;
69
75
  viewport: ViewportSize;
@@ -129,12 +135,18 @@ interface NumberedReviewItem {
129
135
  number?: number;
130
136
  displayLabel: string;
131
137
  }
138
+ interface ReviewFieldsConfig {
139
+ title?: boolean;
140
+ }
132
141
  interface WebReviewKitOptions {
133
142
  projectId: string;
134
143
  userId?: string;
135
144
  adapter?: WebReviewKitAdapter;
136
145
  target?: WebReviewKitTarget | (() => WebReviewKitTarget | undefined);
137
146
  adjustmentLabel?: string;
147
+ fields?: ReviewFieldsConfig;
148
+ assigneeTitle?: string;
149
+ assigneeOptions?: readonly ReviewAssigneeOption[];
138
150
  viewports?: {
139
151
  presets?: ReviewViewportPreset[];
140
152
  };
@@ -179,4 +191,4 @@ interface WebReviewKitTarget {
179
191
  getComposerHost?: () => HTMLElement | null | undefined;
180
192
  }
181
193
 
182
- export type { DomAnchor as D, LocalAdapterOptions as L, NumberedReviewItem as N, ReviewWorkflowStatus as R, SupabaseReviewAdapterOptions as S, ViewportSize as V, WebReviewKitAdapter as W, ReviewItemStatus as a, WebReviewKitOptions as b, WebReviewKitController as c, ReviewViewportPreset as d, ReviewItem as e, ReviewItemScope as f, DomAnchorCandidate as g, DomAnchorStrategy as h, DomSourceHint as i, RelativeSelection as j, ReviewItemKind as k, ReviewItemQuery as l, ReviewMarker as m, ReviewMode as n, ReviewPoint as o, ReviewRulerConfig as p, ReviewSelection as q, ReviewSource as r, ReviewSubmitStatus as s, ReviewViewportScope as t, SupabaseReviewClient as u, WebReviewKitTarget as v };
194
+ export type { DomAnchor as D, LocalAdapterOptions as L, NumberedReviewItem as N, ReviewWorkflowStatus as R, SupabaseReviewAdapterOptions as S, ViewportSize as V, WebReviewKitAdapter as W, ReviewItemStatus as a, WebReviewKitOptions as b, WebReviewKitController as c, ReviewViewportPreset as d, ReviewItem as e, ReviewItemScope as f, DomAnchorCandidate as g, DomAnchorStrategy as h, DomSourceHint as i, RelativeSelection as j, ReviewAssigneeOption as k, ReviewItemKind as l, ReviewItemQuery as m, ReviewMarker as n, ReviewMode as o, ReviewPoint as p, ReviewRulerConfig as q, ReviewSelection as r, ReviewSource as s, ReviewSubmitStatus as t, ReviewViewportScope as u, SupabaseReviewClient as v, WebReviewKitTarget as w, ReviewFieldsConfig as x };