tempest-react-sdk 0.26.1 → 0.27.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 (33) hide show
  1. package/README.md +1 -1
  2. package/bin/lib/doctor/doctor.e2e.test.mjs +201 -0
  3. package/bin/tempest.mjs +103 -29
  4. package/dist/components/ImageCropper/ImageCropper.cjs +2 -0
  5. package/dist/components/ImageCropper/ImageCropper.cjs.map +1 -0
  6. package/dist/components/ImageCropper/ImageCropper.js +240 -0
  7. package/dist/components/ImageCropper/ImageCropper.js.map +1 -0
  8. package/dist/components/ImageCropper/ImageCropper.module.cjs +2 -0
  9. package/dist/components/ImageCropper/ImageCropper.module.cjs.map +1 -0
  10. package/dist/components/ImageCropper/ImageCropper.module.js +15 -0
  11. package/dist/components/ImageCropper/ImageCropper.module.js.map +1 -0
  12. package/dist/components/ImageCropper/crop-geometry.cjs +2 -0
  13. package/dist/components/ImageCropper/crop-geometry.cjs.map +1 -0
  14. package/dist/components/ImageCropper/crop-geometry.js +52 -0
  15. package/dist/components/ImageCropper/crop-geometry.js.map +1 -0
  16. package/dist/components/Scheduler/Scheduler.cjs +2 -0
  17. package/dist/components/Scheduler/Scheduler.cjs.map +1 -0
  18. package/dist/components/Scheduler/Scheduler.js +134 -0
  19. package/dist/components/Scheduler/Scheduler.js.map +1 -0
  20. package/dist/components/Scheduler/Scheduler.module.cjs +2 -0
  21. package/dist/components/Scheduler/Scheduler.module.cjs.map +1 -0
  22. package/dist/components/Scheduler/Scheduler.module.js +26 -0
  23. package/dist/components/Scheduler/Scheduler.module.js.map +1 -0
  24. package/dist/components/Scheduler/scheduler-layout.cjs +2 -0
  25. package/dist/components/Scheduler/scheduler-layout.cjs.map +1 -0
  26. package/dist/components/Scheduler/scheduler-layout.js +97 -0
  27. package/dist/components/Scheduler/scheduler-layout.js.map +1 -0
  28. package/dist/styles.css +1 -1
  29. package/dist/tempest-react-sdk.cjs +1 -1
  30. package/dist/tempest-react-sdk.d.ts +162 -0
  31. package/dist/tempest-react-sdk.js +151 -149
  32. package/package.json +1 -1
  33. package/template/package.json +1 -1
package/README.md CHANGED
@@ -149,7 +149,7 @@ Via `package.json`:
149
149
  ```json
150
150
  {
151
151
  "dependencies": {
152
- "tempest-react-sdk": "^0.26.0"
152
+ "tempest-react-sdk": "^0.27.0"
153
153
  }
154
154
  }
155
155
  ```
@@ -0,0 +1,201 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
7
+
8
+ const CLI = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "tempest.mjs");
9
+
10
+ let root;
11
+
12
+ beforeEach(() => {
13
+ root = mkdtempSync(join(tmpdir(), "tempest-doctor-"));
14
+ });
15
+
16
+ afterEach(() => {
17
+ rmSync(root, { recursive: true, force: true });
18
+ });
19
+
20
+ /** Write a file under the fixture, creating parent directories. */
21
+ function write(rel, contents) {
22
+ const path = join(root, rel);
23
+ mkdirSync(dirname(path), { recursive: true });
24
+ writeFileSync(path, typeof contents === "string" ? contents : JSON.stringify(contents));
25
+ }
26
+
27
+ /** Fake an installed package so `installedVersion` finds it. */
28
+ function installed(name, version, extra = {}) {
29
+ write(`node_modules/${name}/package.json`, { name, version, ...extra });
30
+ }
31
+
32
+ /**
33
+ * Run the real CLI in the fixture directory.
34
+ *
35
+ * A subprocess rather than an imported function on purpose: `doctor` reads
36
+ * `process.cwd()` and reports through the exit code, and the exit code is the part
37
+ * that matters most — it decides whether a project "fails" the audit. Only running
38
+ * it the way a user does tests that.
39
+ */
40
+ function doctor() {
41
+ const result = spawnSync(process.execPath, [CLI, "doctor"], {
42
+ cwd: root,
43
+ encoding: "utf8",
44
+ env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" },
45
+ });
46
+ return { code: result.status, out: `${result.stdout}${result.stderr}` };
47
+ }
48
+
49
+ /** A plain, healthy React + Vite app that has never heard of the SDK. */
50
+ function thirdPartyApp() {
51
+ write("package.json", {
52
+ name: "app-de-terceiro",
53
+ type: "module",
54
+ dependencies: { react: "^19.0.0", "react-dom": "^19.0.0" },
55
+ devDependencies: { vite: "^7.0.0", "@vitejs/plugin-react": "^5.0.0", eslint: "^9.0.0" },
56
+ });
57
+ write("tsconfig.json", {
58
+ compilerOptions: { strict: true, jsx: "react-jsx", moduleResolution: "bundler" },
59
+ });
60
+ write(
61
+ "vite.config.ts",
62
+ 'import { defineConfig } from "vite";\nexport default defineConfig({});',
63
+ );
64
+ write("src/App.tsx", "export const App = () => null;");
65
+ write("package-lock.json", "{}");
66
+ write("eslint.config.js", "export default [];");
67
+ installed("react", "19.0.0");
68
+ installed("react-dom", "19.0.0");
69
+ installed("vite", "7.0.0");
70
+ installed("@vitejs/plugin-react", "5.0.0");
71
+ installed("eslint", "9.0.0");
72
+ installed("prettier", "3.0.0");
73
+ installed(".bin/eslint", "0.0.0");
74
+ }
75
+
76
+ describe("tempest doctor — a third-party project that does not use the SDK", () => {
77
+ beforeEach(thirdPartyApp);
78
+
79
+ it("does not fail the audit just for not having the SDK", () => {
80
+ const { code, out } = doctor();
81
+ expect(out).toContain("tempest-react-sdk not installed");
82
+ expect(out).toContain("generic React/Vite health only");
83
+ expect(code).toBe(0);
84
+ });
85
+
86
+ it("never reports the missing SDK as a problem", () => {
87
+ const { out } = doctor();
88
+ expect(out).not.toMatch(/✗.*tempest-react-sdk/);
89
+ });
90
+
91
+ it("drops the SDK's own conventions from the report", () => {
92
+ const { out } = doctor();
93
+ // The `@/*` alias and `createViteConfig` are preferences, not health.
94
+ expect(out).not.toContain('tsconfig "@/*" alias');
95
+ expect(out).not.toContain("not using createViteConfig");
96
+ // The stylesheet is only *demanded* of an SDK project; the adoption hint at
97
+ // the end still mentions it, which is the point of that section.
98
+ expect(out).not.toContain('add import "tempest-react-sdk/styles.css"');
99
+ });
100
+
101
+ it("does not demand a src/main.tsx it has no reason to expect", () => {
102
+ const { out } = doctor();
103
+ expect(out).not.toContain("app entry");
104
+ });
105
+
106
+ it("explains moduleResolution without naming SDK subpaths", () => {
107
+ write("tsconfig.json", { compilerOptions: { strict: true, jsx: "react-jsx" } });
108
+ const { out } = doctor();
109
+ expect(out).toContain("moduleResolution");
110
+ expect(out).not.toContain("tempest-react-sdk/br");
111
+ expect(out).toContain("subpath exports");
112
+ });
113
+
114
+ it("closes with how to adopt, so the audit is not a dead end", () => {
115
+ const { out } = doctor();
116
+ expect(out).toContain("Adopting the SDK (optional)");
117
+ expect(out).toContain("npm i tempest-react-sdk");
118
+ expect(out).toContain("not all-or-nothing");
119
+ });
120
+ });
121
+
122
+ describe("tempest doctor — generic findings still surface", () => {
123
+ it("flags a missing lockfile", () => {
124
+ thirdPartyApp();
125
+ rmSync(join(root, "package-lock.json"));
126
+ expect(doctor().out).toContain("no lockfile");
127
+ });
128
+
129
+ it("flags a missing @vitejs/plugin-react", () => {
130
+ thirdPartyApp();
131
+ rmSync(join(root, "node_modules", "@vitejs", "plugin-react"), {
132
+ recursive: true,
133
+ force: true,
134
+ });
135
+ expect(doctor().out).toContain("@vitejs/plugin-react");
136
+ });
137
+
138
+ it("flags declared dependencies that are not installed", () => {
139
+ thirdPartyApp();
140
+ rmSync(join(root, "node_modules", "react"), { recursive: true, force: true });
141
+ expect(doctor().out).toMatch(/dependency\(ies\) not installed/);
142
+ });
143
+
144
+ it("flags env vars that Vite will not expose", () => {
145
+ thirdPartyApp();
146
+ write("src/api.ts", "export const url = import.meta.env.API_URL;");
147
+ expect(doctor().out).toContain("client env without VITE_ prefix");
148
+ });
149
+
150
+ it("still fails on a genuinely broken project", () => {
151
+ write("package.json", { name: "broken", dependencies: {} });
152
+ const { code, out } = doctor();
153
+ expect(out).toContain("react + react-dom present");
154
+ expect(code).toBe(1);
155
+ });
156
+ });
157
+
158
+ describe("tempest doctor — a project that does use the SDK", () => {
159
+ beforeEach(() => {
160
+ thirdPartyApp();
161
+ write("package.json", {
162
+ name: "sdk-app",
163
+ type: "module",
164
+ dependencies: {
165
+ "tempest-react-sdk": "^0.26.1",
166
+ react: "^19.0.0",
167
+ "react-dom": "^19.0.0",
168
+ },
169
+ });
170
+ installed("tempest-react-sdk", "0.26.1", { dependencies: { "lucide-react": "^1.26.0" } });
171
+ installed("lucide-react", "1.26.0");
172
+ });
173
+
174
+ it("checks the SDK's conventions again", () => {
175
+ write("tsconfig.json", {
176
+ compilerOptions: { strict: true, jsx: "react-jsx", moduleResolution: "bundler" },
177
+ });
178
+ const { out } = doctor();
179
+ expect(out).toContain('tsconfig "@/*" alias');
180
+ });
181
+
182
+ it("asks for the stylesheet import, which is a real defect without it", () => {
183
+ write("src/main.tsx", "export const main = 1;");
184
+ expect(doctor().out).toContain("styles.css");
185
+ });
186
+
187
+ it("omits the adoption hint — it has already adopted", () => {
188
+ expect(doctor().out).not.toContain("Adopting the SDK (optional)");
189
+ });
190
+
191
+ it("warns when the SDK is installed but undeclared", () => {
192
+ write("package.json", {
193
+ name: "sdk-app",
194
+ dependencies: { react: "^19.0.0", "react-dom": "^19.0.0" },
195
+ });
196
+ const { out, code } = doctor();
197
+ expect(out).toContain("tempest-react-sdk not in dependencies");
198
+ // Undeclared-but-present is a warning, not a blocking failure.
199
+ expect(code).toBe(0);
200
+ });
201
+ });
package/bin/tempest.mjs CHANGED
@@ -312,16 +312,45 @@ function doctor() {
312
312
  checks.push(["section", "Project"]);
313
313
  checks.push(["ok", "package.json found"]);
314
314
  const sdkInstalled = installedVersion("tempest-react-sdk");
315
- checks.push(
316
- deps["tempest-react-sdk"]
317
- ? ["ok", "tempest-react-sdk in dependencies", deps["tempest-react-sdk"]]
318
- : ["fail", "tempest-react-sdk in dependencies", "npm install tempest-react-sdk"],
319
- );
320
- checks.push(
321
- sdkInstalled
322
- ? ["ok", "tempest-react-sdk installed", `v${sdkInstalled}`]
323
- : ["fail", "tempest-react-sdk installed", "run npm install"],
324
- );
315
+
316
+ /**
317
+ * Whether this project has adopted the SDK.
318
+ *
319
+ * When it has not, `doctor` runs in **generic mode**: the checks that only make
320
+ * sense once you use the SDK (its `@/*` alias, `createViteConfig`, the
321
+ * `styles.css` import, its optional peers) drop out, and not having the SDK is
322
+ * reported as information rather than as a defect.
323
+ *
324
+ * Without this the tool is useless on the exact project it should help most —
325
+ * somebody's existing app, being evaluated. It reported two hard failures for the
326
+ * single fact "you have not installed this yet", exited non-zero, and buried the
327
+ * findings that *were* actionable (no lockfile, no plugin-react, no linter) among
328
+ * warnings that were really just the SDK's own conventions.
329
+ */
330
+ const usesSdk = Boolean(deps["tempest-react-sdk"] || sdkInstalled);
331
+
332
+ if (usesSdk) {
333
+ checks.push(
334
+ deps["tempest-react-sdk"]
335
+ ? ["ok", "tempest-react-sdk in dependencies", deps["tempest-react-sdk"]]
336
+ : [
337
+ "warn",
338
+ "tempest-react-sdk not in dependencies",
339
+ `installed as v${sdkInstalled} but undeclared — add it to package.json`,
340
+ ],
341
+ );
342
+ checks.push(
343
+ sdkInstalled
344
+ ? ["ok", "tempest-react-sdk installed", `v${sdkInstalled}`]
345
+ : ["fail", "tempest-react-sdk installed", "run npm install"],
346
+ );
347
+ } else {
348
+ checks.push([
349
+ "info",
350
+ "tempest-react-sdk not installed",
351
+ "checking generic React/Vite health only — `npm i tempest-react-sdk` to adopt it",
352
+ ]);
353
+ }
325
354
  const reactV = installedVersion("react");
326
355
  checks.push(
327
356
  deps.react && deps["react-dom"]
@@ -438,11 +467,15 @@ function doctor() {
438
467
  if (tsc) {
439
468
  checks.push(["section", "TypeScript"]);
440
469
  const co = tsc.compilerOptions;
441
- checks.push(
442
- co.paths?.["@/*"]
443
- ? ["ok", 'tsconfig "@/*" alias']
444
- : ["warn", 'tsconfig "@/*" alias', 'add "paths": { "@/*": ["./src/*"] }'],
445
- );
470
+ // The `@/*` alias is the SDK's convention, not a health property: a project
471
+ // that has not adopted the SDK is not wrong for lacking it.
472
+ if (usesSdk) {
473
+ checks.push(
474
+ co.paths?.["@/*"]
475
+ ? ["ok", 'tsconfig "@/*" alias']
476
+ : ["warn", 'tsconfig "@/*" alias', 'add "paths": { "@/*": ["./src/*"] }'],
477
+ );
478
+ }
446
479
  const mr = String(co.moduleResolution ?? "").toLowerCase();
447
480
  checks.push(
448
481
  ["bundler", "node16", "nodenext"].includes(mr)
@@ -450,7 +483,9 @@ function doctor() {
450
483
  : [
451
484
  "warn",
452
485
  `moduleResolution: ${co.moduleResolution ?? "(unset)"}`,
453
- 'use "bundler" — otherwise subpath types (tempest-react-sdk/br, /charts…) won\'t resolve',
486
+ usesSdk
487
+ ? 'use "bundler" — otherwise subpath types (tempest-react-sdk/br, /charts…) won\'t resolve'
488
+ : 'use "bundler" — a bundled app needs it for any package that ships subpath exports',
454
489
  ],
455
490
  );
456
491
  checks.push(
@@ -491,11 +526,21 @@ function doctor() {
491
526
  if (!viteCfg) {
492
527
  checks.push(["warn", "vite config", "no vite.config.* found"]);
493
528
  } else {
494
- checks.push(
495
- fileIncludes(join(ROOT, viteCfg), "createViteConfig")
496
- ? ["ok", `${viteCfg} uses createViteConfig`]
497
- : ["warn", `${viteCfg}`, "not using createViteConfig from tempest-react-sdk/vite"],
498
- );
529
+ // `createViteConfig` is a convenience, not a requirement — only worth
530
+ // mentioning to a project that already uses the SDK, and even then as info.
531
+ if (usesSdk) {
532
+ checks.push(
533
+ fileIncludes(join(ROOT, viteCfg), "createViteConfig")
534
+ ? ["ok", `${viteCfg} uses createViteConfig`]
535
+ : [
536
+ "info",
537
+ `${viteCfg}`,
538
+ "not using createViteConfig from tempest-react-sdk/vite — optional",
539
+ ],
540
+ );
541
+ } else {
542
+ checks.push(["ok", `${viteCfg} found`]);
543
+ }
499
544
  // React plugin is required for JSX/Fast Refresh in a Vite React app.
500
545
  checks.push(
501
546
  installedVersion("@vitejs/plugin-react")
@@ -508,14 +553,23 @@ function doctor() {
508
553
  );
509
554
  }
510
555
  const entry = firstExisting(["src/main.tsx", "src/main.ts", "src/index.tsx", "src/index.ts"]);
511
- if (entry) {
512
- checks.push(
513
- fileIncludes(join(ROOT, entry), "tempest-react-sdk/styles.css")
514
- ? ["ok", `${entry} imports styles.css`]
515
- : ["warn", `${entry}`, 'add import "tempest-react-sdk/styles.css"'],
516
- );
517
- } else {
518
- checks.push(["warn", "app entry", "no src/main.tsx found"]);
556
+ if (usesSdk) {
557
+ // Without the stylesheet every component renders unstyled, so for an SDK
558
+ // project this is a real defect. For anyone else the entry's filename is
559
+ // their business, not ours.
560
+ if (entry) {
561
+ checks.push(
562
+ fileIncludes(join(ROOT, entry), "tempest-react-sdk/styles.css")
563
+ ? ["ok", `${entry} imports styles.css`]
564
+ : ["warn", `${entry}`, 'add import "tempest-react-sdk/styles.css"'],
565
+ );
566
+ } else {
567
+ checks.push([
568
+ "warn",
569
+ "app entry",
570
+ "none of src/main.tsx, src/main.ts, src/index.tsx, src/index.ts found — cannot verify the styles.css import",
571
+ ]);
572
+ }
519
573
  }
520
574
  // styles.css should be imported once — duplicates re-inject the whole sheet.
521
575
  const stylesImports = (src.match(/tempest-react-sdk\/styles\.css/g) ?? []).length;
@@ -600,6 +654,26 @@ function doctor() {
600
654
  checks.push(["ok", "client env vars use the VITE_ prefix"]);
601
655
  }
602
656
 
657
+ /*
658
+ * In generic mode, close with what adoption would actually take. A tool that
659
+ * audits somebody's project and then says nothing about the next step reads as an
660
+ * ad for a product they cannot find the door to.
661
+ */
662
+ if (!usesSdk) {
663
+ checks.push(["section", "Adopting the SDK (optional)"]);
664
+ checks.push(["info", "install", "npm i tempest-react-sdk"]);
665
+ checks.push([
666
+ "info",
667
+ "import the stylesheet once, in your entry",
668
+ 'import "tempest-react-sdk/styles.css"',
669
+ ]);
670
+ checks.push([
671
+ "info",
672
+ "not all-or-nothing",
673
+ "one component at a time works — the @/* alias, createViteConfig and the scaffold are all optional",
674
+ ]);
675
+ }
676
+
603
677
  return report(checks);
604
678
  }
605
679
 
@@ -0,0 +1,2 @@
1
+ const e=require("../../utils/cn.cjs"),t=require("./crop-geometry.cjs"),n=require("./ImageCropper.module.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=12,o=.15;function s({src:s,aspect:c=1,maxZoom:l=4,maxSize:u,outputType:d=`image/png`,outputQuality:f=.92,shape:p=`rect`,onCropChange:m,label:h=`Área de recorte`,className:g,ref:_,...v}){let y=`${(0,r.useId)()}-hint`,b=(0,r.useRef)(null),x=(0,r.useRef)(null),S=(0,r.useRef)(null),[C,w]=(0,r.useState)(null),[T,E]=(0,r.useState)(null),[D,O]=(0,r.useState)({width:0,height:0}),[k,A]=(0,r.useState)(1),[j,M]=(0,r.useState)({x:0,y:0});(0,r.useEffect)(()=>{if(typeof s==`string`){w(s);return}let e=URL.createObjectURL(s);return w(e),()=>URL.revokeObjectURL(e)},[s]),(0,r.useEffect)(()=>{E(null),A(1),M({x:0,y:0})},[C]),(0,r.useEffect)(()=>{let e=b.current;if(!e)return;let t=()=>O({width:e.clientWidth,height:e.clientHeight});if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let N=T?t.coverScale(T,D)*k:0,P=(0,r.useMemo)(()=>T?{width:T.width*N,height:T.height*N}:{width:0,height:0},[T,N]),F=(0,r.useCallback)(e=>{M(n=>{let r=t.clampOffset(e,P,D);return r.x===n.x&&r.y===n.y?n:(m?.({zoom:k,offset:r}),r)})},[P,D,m,k]),I=(0,r.useCallback)(e=>{let n=Math.min(l,Math.max(1,e));if(A(n),!T)return;let r=t.coverScale(T,D)*n,i={width:T.width*r,height:T.height*r};M(e=>{let r=t.clampOffset(e,i,D);return m?.({zoom:n,offset:r}),r})},[D,l,T,m]),L=(0,r.useCallback)(()=>{A(1),M({x:0,y:0}),m?.({zoom:1,offset:{x:0,y:0}})},[m]),R=(0,r.useCallback)(async()=>{let e=x.current;if(!e||!T)return null;let n=t.computeCropRect({image:T,frame:D,zoom:k,offset:j});if(n.sWidth<=0||n.sHeight<=0)return null;let r=t.outputSize(n,u),i=document.createElement(`canvas`);i.width=r.width,i.height=r.height;let a=i.getContext(`2d`);return a?(a.drawImage(e,n.sx,n.sy,n.sWidth,n.sHeight,0,0,r.width,r.height),new Promise(e=>{i.toBlob(t=>e(t),d,f)})):null},[D,u,T,j,f,d,k]);(0,r.useImperativeHandle)(_,()=>({crop:R,reset:L}),[R,L]);let z=e=>{T&&(S.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,from:j},e.currentTarget.setPointerCapture?.(e.pointerId))},B=e=>{let t=S.current;!t||t.pointerId!==e.pointerId||F({x:t.from.x+(e.clientX-t.startX),y:t.from.y+(e.clientY-t.startY)})},V=e=>{S.current?.pointerId===e.pointerId&&(S.current=null)},H=e=>{let t=e.shiftKey?a*4:a,n={ArrowLeft:{x:-t,y:0},ArrowRight:{x:t,y:0},ArrowUp:{x:0,y:-t},ArrowDown:{x:0,y:t}}[e.key];if(n){e.preventDefault(),F({x:j.x+n.x,y:j.y+n.y});return}e.key===`+`||e.key===`=`?(e.preventDefault(),I(k+o)):e.key===`-`||e.key===`_`?(e.preventDefault(),I(k-o)):e.key===`0`&&(e.preventDefault(),L())};return(0,i.jsxs)(`div`,{className:e.cn(n.default.wrapper,g),...v,children:[(0,i.jsx)(`div`,{ref:b,className:e.cn(n.default.frame,p===`circle`&&n.default.circle),style:{aspectRatio:String(c)},role:`group`,"aria-label":h,"aria-describedby":y,tabIndex:0,onPointerDown:z,onPointerMove:B,onPointerUp:V,onPointerCancel:V,onKeyDown:H,onWheel:e=>{e.preventDefault(),I(k+(e.deltaY<0?o:-.15))},children:C&&(0,i.jsx)(`img`,{ref:x,src:C,alt:``,draggable:!1,className:n.default.image,style:{width:P.width||void 0,height:P.height||void 0,transform:`translate(${j.x}px, ${j.y}px)`},onLoad:e=>{let t=e.currentTarget;t.naturalWidth>0&&t.naturalHeight>0&&E({width:t.naturalWidth,height:t.naturalHeight})}})}),(0,i.jsxs)(`div`,{className:n.default.controls,children:[(0,i.jsx)(`input`,{type:`range`,className:n.default.zoom,min:1,max:l,step:.01,value:k,onChange:e=>I(Number(e.target.value)),"aria-label":`Zoom`,disabled:!T}),(0,i.jsx)(`button`,{type:`button`,className:n.default.reset,onClick:L,disabled:!T,children:`Centralizar`})]}),(0,i.jsxs)(`p`,{id:y,className:n.default.hint,children:[`Arraste para reposicionar. Setas movem, `,(0,i.jsx)(`kbd`,{children:`+`}),` e `,(0,i.jsx)(`kbd`,{children:`−`}),` dão zoom,`,` `,(0,i.jsx)(`kbd`,{children:`0`}),` centraliza.`]})]})}exports.ImageCropper=s;
2
+ //# sourceMappingURL=ImageCropper.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageCropper.cjs","names":[],"sources":["../../../src/components/ImageCropper/ImageCropper.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type KeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { cn } from \"@/utils/cn\";\n\nimport {\n clampOffset,\n computeCropRect,\n coverScale,\n type Offset,\n outputSize,\n type Size,\n} from \"./crop-geometry\";\nimport styles from \"./ImageCropper.module.css\";\n\n/** Imperative handle for exporting the current crop. */\nexport interface ImageCropperHandle {\n /**\n * Render the current crop and resolve with it.\n *\n * Resolves `null` when the image has not loaded yet or the browser refuses to\n * encode — never throws, so a submit handler does not need a try/catch.\n */\n crop: () => Promise<Blob | null>;\n /** Recentre at zoom 1. */\n reset: () => void;\n}\n\nexport interface ImageCropperProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** The image to crop: a `File`/`Blob` from an input, or a URL. */\n src: File | Blob | string;\n /** Crop aspect ratio as `width / height`. Default `1` (square). */\n aspect?: number;\n /** Maximum zoom over the cover scale. Default `4`. */\n maxZoom?: number;\n /**\n * Cap on the longest edge of the exported image, in px.\n *\n * Without it the export keeps the source resolution, which is right for a\n * document scan and wasteful for an avatar.\n */\n maxSize?: number;\n /** Output MIME type. Default `\"image/png\"`. */\n outputType?: string;\n /** Output quality for lossy types, `0`–`1`. Default `0.92`. */\n outputQuality?: number;\n /** Overlay shape. `\"circle\"` for an avatar, `\"rect\"` for a document. Default `\"rect\"`. */\n shape?: \"rect\" | \"circle\";\n /** Called whenever the crop changes, e.g. to enable a submit button. */\n onCropChange?: (state: { zoom: number; offset: Offset }) => void;\n /** Accessible name for the crop area. */\n label?: string;\n ref?: React.Ref<ImageCropperHandle>;\n}\n\n/** Pixels moved per arrow-key press. */\nconst KEY_STEP = 12;\n\n/** Zoom added or removed per `+`/`-` press, and per wheel notch. */\nconst ZOOM_STEP = 0.15;\n\n/**\n * Crop an image to a fixed aspect ratio.\n *\n * The frame stays put and the image pans and zooms behind it — the model an avatar\n * or document-photo flow wants, where the output shape is decided by the app and\n * the user only chooses what lands inside it. (A free-form draggable rectangle is a\n * different component; this one cannot produce an off-ratio crop by construction.)\n *\n * The export reads the *natural* pixels through a canvas, so a 4000 px photo is not\n * silently downsampled to whatever the on-screen preview measured. The image is\n * also always clamped to cover the frame, so an export can never contain the empty\n * bands you get from panning past an edge.\n *\n * Works by pointer, wheel and keyboard: arrows pan, `+`/`-` zoom, `0` resets.\n *\n * @example\n * const cropper = useRef<ImageCropperHandle>(null);\n *\n * <ImageCropper ref={cropper} src={file} aspect={1} shape=\"circle\" maxSize={512} />\n * <Button onClick={async () => upload(await cropper.current?.crop())}>Salvar</Button>\n */\nexport function ImageCropper({\n src,\n aspect = 1,\n maxZoom = 4,\n maxSize,\n outputType = \"image/png\",\n outputQuality = 0.92,\n shape = \"rect\",\n onCropChange,\n label = \"Área de recorte\",\n className,\n ref,\n ...rest\n}: ImageCropperProps) {\n /**\n * Id for the shortcut hint.\n *\n * Generated rather than derived from `label`: a label with spaces would produce\n * an id with spaces, and `aria-describedby` splits on whitespace — so the\n * description would silently never associate with the frame.\n */\n const hintId = `${useId()}-hint`;\n\n const frameRef = useRef<HTMLDivElement>(null);\n const imageRef = useRef<HTMLImageElement | null>(null);\n const dragRef = useRef<{\n pointerId: number;\n startX: number;\n startY: number;\n from: Offset;\n } | null>(null);\n\n const [url, setUrl] = useState<string | null>(null);\n const [natural, setNatural] = useState<Size | null>(null);\n const [frame, setFrame] = useState<Size>({ width: 0, height: 0 });\n const [zoom, setZoom] = useState(1);\n const [offset, setOffset] = useState<Offset>({ x: 0, y: 0 });\n\n /**\n * Resolve `src` to a displayable URL.\n *\n * A `File`/`Blob` needs `createObjectURL`, and the URL must be revoked when the\n * source changes or the component unmounts — otherwise every re-pick of a photo\n * leaks the previous one for the lifetime of the document.\n */\n useEffect(() => {\n if (typeof src === \"string\") {\n setUrl(src);\n return;\n }\n const objectUrl = URL.createObjectURL(src);\n setUrl(objectUrl);\n return () => URL.revokeObjectURL(objectUrl);\n }, [src]);\n\n // A new source invalidates the previous framing.\n useEffect(() => {\n setNatural(null);\n setZoom(1);\n setOffset({ x: 0, y: 0 });\n }, [url]);\n\n /** Track the frame's rendered size — the crop math is all relative to it. */\n useEffect(() => {\n const element = frameRef.current;\n if (!element) return;\n const measure = () =>\n setFrame({ width: element.clientWidth, height: element.clientHeight });\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n const scale = natural ? coverScale(natural, frame) * zoom : 0;\n\n /**\n * On-screen image size.\n *\n * Memoized because the pan callback depends on it: a fresh object every render\n * would rebuild that callback every render, and the pointer handlers close over\n * it during a drag.\n */\n const displayed = useMemo<Size>(\n () =>\n natural\n ? { width: natural.width * scale, height: natural.height * scale }\n : { width: 0, height: 0 },\n [natural, scale],\n );\n\n /** Apply a pan, clamped so the frame stays covered. */\n const pan = useCallback(\n (next: Offset) => {\n setOffset((current) => {\n const clamped = clampOffset(next, displayed, frame);\n if (clamped.x === current.x && clamped.y === current.y) return current;\n onCropChange?.({ zoom, offset: clamped });\n return clamped;\n });\n },\n [displayed, frame, onCropChange, zoom],\n );\n\n /**\n * Apply a zoom, then re-clamp the offset.\n *\n * Re-clamping is not optional: zooming *out* shrinks the image, so an offset\n * that was legal a moment ago can now expose background.\n */\n const applyZoom = useCallback(\n (next: number) => {\n const clampedZoom = Math.min(maxZoom, Math.max(1, next));\n setZoom(clampedZoom);\n if (!natural) return;\n const nextScale = coverScale(natural, frame) * clampedZoom;\n const nextDisplayed = {\n width: natural.width * nextScale,\n height: natural.height * nextScale,\n };\n setOffset((current) => {\n const clamped = clampOffset(current, nextDisplayed, frame);\n onCropChange?.({ zoom: clampedZoom, offset: clamped });\n return clamped;\n });\n },\n [frame, maxZoom, natural, onCropChange],\n );\n\n const reset = useCallback(() => {\n setZoom(1);\n setOffset({ x: 0, y: 0 });\n onCropChange?.({ zoom: 1, offset: { x: 0, y: 0 } });\n }, [onCropChange]);\n\n /**\n * Draw the current crop and encode it.\n *\n * Returns `null` rather than throwing on the paths a caller cannot do anything\n * about: no image yet, no 2D context, or an encoder that declined.\n */\n const crop = useCallback(async (): Promise<Blob | null> => {\n const image = imageRef.current;\n if (!image || !natural) return null;\n\n const rect = computeCropRect({ image: natural, frame, zoom, offset });\n if (rect.sWidth <= 0 || rect.sHeight <= 0) return null;\n\n const out = outputSize(rect, maxSize);\n const canvas = document.createElement(\"canvas\");\n canvas.width = out.width;\n canvas.height = out.height;\n const context = canvas.getContext(\"2d\");\n if (!context) return null;\n\n context.drawImage(\n image,\n rect.sx,\n rect.sy,\n rect.sWidth,\n rect.sHeight,\n 0,\n 0,\n out.width,\n out.height,\n );\n\n return new Promise((resolve) => {\n canvas.toBlob((blob) => resolve(blob), outputType, outputQuality);\n });\n }, [frame, maxSize, natural, offset, outputQuality, outputType, zoom]);\n\n useImperativeHandle(ref, () => ({ crop, reset }), [crop, reset]);\n\n const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>): void => {\n if (!natural) return;\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n from: offset,\n };\n event.currentTarget.setPointerCapture?.(event.pointerId);\n };\n\n const onPointerMove = (event: ReactPointerEvent<HTMLDivElement>): void => {\n const drag = dragRef.current;\n if (!drag || drag.pointerId !== event.pointerId) return;\n pan({\n x: drag.from.x + (event.clientX - drag.startX),\n y: drag.from.y + (event.clientY - drag.startY),\n });\n };\n\n const endDrag = (event: ReactPointerEvent<HTMLDivElement>): void => {\n if (dragRef.current?.pointerId !== event.pointerId) return;\n dragRef.current = null;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n const step = event.shiftKey ? KEY_STEP * 4 : KEY_STEP;\n const moves: Record<string, Offset> = {\n ArrowLeft: { x: -step, y: 0 },\n ArrowRight: { x: step, y: 0 },\n ArrowUp: { x: 0, y: -step },\n ArrowDown: { x: 0, y: step },\n };\n const move = moves[event.key];\n if (move) {\n event.preventDefault();\n pan({ x: offset.x + move.x, y: offset.y + move.y });\n return;\n }\n if (event.key === \"+\" || event.key === \"=\") {\n event.preventDefault();\n applyZoom(zoom + ZOOM_STEP);\n } else if (event.key === \"-\" || event.key === \"_\") {\n event.preventDefault();\n applyZoom(zoom - ZOOM_STEP);\n } else if (event.key === \"0\") {\n event.preventDefault();\n reset();\n }\n };\n\n return (\n <div className={cn(styles.wrapper, className)} {...rest}>\n <div\n ref={frameRef}\n className={cn(styles.frame, shape === \"circle\" && styles.circle)}\n style={{ aspectRatio: String(aspect) }}\n role=\"group\"\n aria-label={label}\n aria-describedby={hintId}\n tabIndex={0}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n onWheel={(event) => {\n event.preventDefault();\n applyZoom(zoom + (event.deltaY < 0 ? ZOOM_STEP : -ZOOM_STEP));\n }}\n >\n {url && (\n <img\n ref={imageRef}\n src={url}\n alt=\"\"\n draggable={false}\n className={styles.image}\n style={{\n width: displayed.width || undefined,\n height: displayed.height || undefined,\n transform: `translate(${offset.x}px, ${offset.y}px)`,\n }}\n onLoad={(event) => {\n const element = event.currentTarget;\n // A decode can succeed and still report no intrinsic size —\n // an SVG without a viewBox is the common case. Accepting\n // that would enable the controls over an image the crop\n // maths can do nothing with.\n if (element.naturalWidth > 0 && element.naturalHeight > 0) {\n setNatural({\n width: element.naturalWidth,\n height: element.naturalHeight,\n });\n }\n }}\n />\n )}\n </div>\n\n <div className={styles.controls}>\n <input\n type=\"range\"\n className={styles.zoom}\n min={1}\n max={maxZoom}\n step={0.01}\n value={zoom}\n onChange={(event) => applyZoom(Number(event.target.value))}\n aria-label=\"Zoom\"\n disabled={!natural}\n />\n <button type=\"button\" className={styles.reset} onClick={reset} disabled={!natural}>\n Centralizar\n </button>\n </div>\n\n <p id={hintId} className={styles.hint}>\n Arraste para reposicionar. Setas movem, <kbd>+</kbd> e <kbd>−</kbd> dão zoom,{\" \"}\n <kbd>0</kbd> centraliza.\n </p>\n </div>\n );\n}\n"],"mappings":"oKAkEA,IAAM,EAAW,GAGX,EAAY,IAuBlB,SAAgB,EAAa,CACzB,MACA,SAAS,EACT,UAAU,EACV,UACA,aAAa,YACb,gBAAgB,IAChB,QAAQ,OACR,eACA,QAAQ,kBACR,YACA,MACA,GAAG,GACe,CAQlB,IAAM,EAAS,IAAA,EAAA,EAAA,MAAA,CAAS,EAAE,OAEpB,GAAA,EAAA,EAAA,OAAA,CAAkC,IAAI,EACtC,GAAA,EAAA,EAAA,OAAA,CAA2C,IAAI,EAC/C,GAAA,EAAA,EAAA,OAAA,CAKI,IAAI,EAER,CAAC,EAAK,IAAA,EAAA,EAAA,SAAA,CAAkC,IAAI,EAC5C,CAAC,EAAS,IAAA,EAAA,EAAA,SAAA,CAAoC,IAAI,EAClD,CAAC,EAAO,IAAA,EAAA,EAAA,SAAA,CAA2B,CAAE,MAAO,EAAG,OAAQ,CAAE,CAAC,EAC1D,CAAC,EAAM,IAAA,EAAA,EAAA,SAAA,CAAoB,CAAC,EAC5B,CAAC,EAAQ,IAAA,EAAA,EAAA,SA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