@maayan-albert/moab-sdk 1.0.0 → 1.0.2

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/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var jsxRuntime = require('react/jsx-runtime');
4
6
  var react = require('react');
5
7
  var lucideReact = require('lucide-react');
@@ -10,574 +12,614 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
12
  var html2canvas__default = /*#__PURE__*/_interopDefault(html2canvas);
11
13
 
12
14
  var __defProp = Object.defineProperty;
13
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
- var __getOwnPropNames = Object.getOwnPropertyNames;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __esm = (fn, res) => function __init() {
17
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
- };
19
- var __commonJS = (cb, mod) => function __require() {
20
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
17
+ var Button = ({
18
+ children,
19
+ variant = "primary",
20
+ size = "medium",
21
+ disabled = false,
22
+ onClick,
23
+ className = "",
24
+ ...props
25
+ }) => {
26
+ const baseStyles = "font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2";
27
+ const variantStyles = {
28
+ primary: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
29
+ secondary: "bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",
30
+ outline: "border-2 border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500"
31
+ };
32
+ const sizeStyles = {
33
+ small: "px-3 py-1.5 text-sm",
34
+ medium: "px-4 py-2 text-base",
35
+ large: "px-6 py-3 text-lg"
36
+ };
37
+ const disabledStyles = disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
38
+ return /* @__PURE__ */ jsxRuntime.jsx(
39
+ "button",
40
+ {
41
+ className: `${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${disabledStyles} ${className}`,
42
+ disabled,
43
+ onClick,
44
+ ...props,
45
+ children
46
+ }
47
+ );
21
48
  };
22
- var __export = (target, all) => {
23
- for (var name in all)
24
- __defProp(target, name, { get: all[name], enumerable: true });
49
+ var Button_default = Button;
50
+ var Card = ({
51
+ children,
52
+ title,
53
+ className = "",
54
+ ...props
55
+ }) => {
56
+ return /* @__PURE__ */ jsxRuntime.jsxs(
57
+ "div",
58
+ {
59
+ className: `bg-white rounded-lg shadow-md p-6 border border-gray-200 ${className}`,
60
+ ...props,
61
+ children: [
62
+ title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold mb-4 text-gray-800", children: title }),
63
+ children
64
+ ]
65
+ }
66
+ );
25
67
  };
26
- var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
28
- for (let key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
- }
32
- return to;
68
+ var Card_default = Card;
69
+ var Input = ({
70
+ label,
71
+ type = "text",
72
+ placeholder,
73
+ value,
74
+ onChange,
75
+ required = false,
76
+ className = "",
77
+ ...props
78
+ }) => {
79
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
80
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
81
+ label,
82
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-1", children: "*" })
83
+ ] }),
84
+ /* @__PURE__ */ jsxRuntime.jsx(
85
+ "input",
86
+ {
87
+ type,
88
+ placeholder,
89
+ value,
90
+ onChange,
91
+ required,
92
+ className: `w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${className}`,
93
+ ...props
94
+ }
95
+ )
96
+ ] });
33
97
  };
34
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
- var Button, Button_default;
36
- var init_Button = __esm({
37
- "src/components/Button.tsx"() {
38
- Button = ({
39
- children,
40
- variant = "primary",
41
- size = "medium",
42
- disabled = false,
43
- onClick,
44
- className = "",
45
- ...props
46
- }) => {
47
- const baseStyles = "font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2";
48
- const variantStyles = {
49
- primary: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
50
- secondary: "bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",
51
- outline: "border-2 border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500"
52
- };
53
- const sizeStyles = {
54
- small: "px-3 py-1.5 text-sm",
55
- medium: "px-4 py-2 text-base",
56
- large: "px-6 py-3 text-lg"
98
+ var Input_default = Input;
99
+ var DrawingTool = ({
100
+ width,
101
+ height,
102
+ className = "",
103
+ overlay = true,
104
+ ...props
105
+ }) => {
106
+ const canvasRef = react.useRef(null);
107
+ const toolbarRef = react.useRef(null);
108
+ const [isDrawing, setIsDrawing] = react.useState(false);
109
+ const brushColor = "#EF4444";
110
+ const brushSize = 5;
111
+ const [canvasSize, setCanvasSize] = react.useState({ width: 0, height: 0 });
112
+ const [enabled, setEnabled] = react.useState(false);
113
+ const [hasContent, setHasContent] = react.useState(false);
114
+ const [isDragging, setIsDragging] = react.useState(false);
115
+ const [corner, setCorner] = react.useState("bottom-right");
116
+ const [dragStart, setDragStart] = react.useState({ x: 0, y: 0 });
117
+ const [showClearTooltip, setShowClearTooltip] = react.useState(false);
118
+ react.useEffect(() => {
119
+ if (overlay) {
120
+ const updateSize = () => {
121
+ setCanvasSize({
122
+ width: window.innerWidth,
123
+ height: window.innerHeight
124
+ });
57
125
  };
58
- const disabledStyles = disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
59
- return /* @__PURE__ */ jsxRuntime.jsx(
60
- "button",
61
- {
62
- className: `${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${disabledStyles} ${className}`,
63
- disabled,
64
- onClick,
65
- ...props,
66
- children
126
+ updateSize();
127
+ window.addEventListener("resize", updateSize);
128
+ return () => window.removeEventListener("resize", updateSize);
129
+ } else {
130
+ setCanvasSize({
131
+ width: width || 800,
132
+ height: height || 600
133
+ });
134
+ }
135
+ }, [overlay, width, height]);
136
+ react.useEffect(() => {
137
+ const canvas = canvasRef.current;
138
+ if (!canvas || canvasSize.width === 0 || canvasSize.height === 0) return;
139
+ const ctx = canvas.getContext("2d");
140
+ if (!ctx) return;
141
+ canvas.width = canvasSize.width;
142
+ canvas.height = canvasSize.height;
143
+ ctx.strokeStyle = brushColor;
144
+ ctx.lineWidth = brushSize;
145
+ ctx.lineCap = "round";
146
+ ctx.lineJoin = "round";
147
+ setHasContent(false);
148
+ }, [canvasSize, brushColor, brushSize]);
149
+ const getCoordinates = react.useCallback(
150
+ (e) => {
151
+ const canvas = canvasRef.current;
152
+ if (!canvas) return { x: 0, y: 0 };
153
+ const rect = canvas.getBoundingClientRect();
154
+ const scaleX = canvas.width / rect.width;
155
+ const scaleY = canvas.height / rect.height;
156
+ if ("touches" in e) {
157
+ return {
158
+ x: (e.touches[0].clientX - rect.left) * scaleX,
159
+ y: (e.touches[0].clientY - rect.top) * scaleY
160
+ };
161
+ } else {
162
+ return {
163
+ x: (e.clientX - rect.left) * scaleX,
164
+ y: (e.clientY - rect.top) * scaleY
165
+ };
166
+ }
167
+ },
168
+ []
169
+ );
170
+ const startDrawing = react.useCallback(
171
+ (e) => {
172
+ if (!enabled) return;
173
+ e.preventDefault();
174
+ const canvas = canvasRef.current;
175
+ const ctx = canvas?.getContext("2d");
176
+ if (!canvas || !ctx) return;
177
+ const { x, y } = getCoordinates(e);
178
+ ctx.beginPath();
179
+ ctx.moveTo(x, y);
180
+ setIsDrawing(true);
181
+ },
182
+ [enabled, getCoordinates]
183
+ );
184
+ const draw = react.useCallback(
185
+ (e) => {
186
+ if (!isDrawing) return;
187
+ e.preventDefault();
188
+ const canvas = canvasRef.current;
189
+ const ctx = canvas?.getContext("2d");
190
+ if (!canvas || !ctx) return;
191
+ const { x, y } = getCoordinates(e);
192
+ ctx.lineTo(x, y);
193
+ ctx.stroke();
194
+ setHasContent(true);
195
+ },
196
+ [isDrawing, getCoordinates]
197
+ );
198
+ const stopDrawing = react.useCallback(() => {
199
+ setIsDrawing(false);
200
+ }, []);
201
+ const clearCanvas = react.useCallback(() => {
202
+ const canvas = canvasRef.current;
203
+ const ctx = canvas?.getContext("2d");
204
+ if (!canvas || !ctx) return;
205
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
206
+ setHasContent(false);
207
+ }, []);
208
+ const takeScreenshot = react.useCallback(async () => {
209
+ try {
210
+ const toolbar = toolbarRef.current;
211
+ if (toolbar) {
212
+ toolbar.style.opacity = "0";
213
+ }
214
+ const canvas = await html2canvas__default.default(document.body, {
215
+ useCORS: true,
216
+ logging: false,
217
+ windowWidth: window.innerWidth,
218
+ windowHeight: window.innerHeight
219
+ });
220
+ if (toolbar) {
221
+ toolbar.style.opacity = "";
222
+ }
223
+ canvas.toBlob(async (blob) => {
224
+ if (!blob) return;
225
+ try {
226
+ await navigator.clipboard.write([
227
+ new ClipboardItem({
228
+ "image/png": blob
229
+ })
230
+ ]);
231
+ } catch (err) {
232
+ console.error("Failed to copy to clipboard:", err);
233
+ const url = URL.createObjectURL(blob);
234
+ const a = document.createElement("a");
235
+ a.href = url;
236
+ a.download = "screenshot.png";
237
+ a.click();
238
+ URL.revokeObjectURL(url);
67
239
  }
240
+ }, "image/png");
241
+ } catch (error) {
242
+ console.error("Failed to take screenshot:", error);
243
+ }
244
+ }, []);
245
+ react.useEffect(() => {
246
+ const canvas = canvasRef.current;
247
+ const ctx = canvas?.getContext("2d");
248
+ if (!ctx) return;
249
+ ctx.strokeStyle = brushColor;
250
+ ctx.lineWidth = brushSize;
251
+ }, [brushColor, brushSize]);
252
+ const getTargetCorner = react.useCallback(
253
+ (startX, startY, currentX, currentY) => {
254
+ const deltaX = currentX - startX;
255
+ const deltaY = currentY - startY;
256
+ const threshold = 50;
257
+ if (Math.abs(deltaX) < threshold && Math.abs(deltaY) < threshold) {
258
+ return null;
259
+ }
260
+ const viewportWidth = window.innerWidth;
261
+ const viewportHeight = window.innerHeight;
262
+ const horizontal = currentX < viewportWidth / 2 ? "left" : "right";
263
+ const vertical = currentY < viewportHeight / 2 ? "top" : "bottom";
264
+ if (vertical === "top" && horizontal === "left") return "top-left";
265
+ if (vertical === "top" && horizontal === "right") return "top-right";
266
+ if (vertical === "bottom" && horizontal === "left") return "bottom-left";
267
+ if (vertical === "bottom" && horizontal === "right")
268
+ return "bottom-right";
269
+ return null;
270
+ },
271
+ []
272
+ );
273
+ const handleMouseDown = react.useCallback((e) => {
274
+ if (e.target.closest("button")) {
275
+ return;
276
+ }
277
+ e.preventDefault();
278
+ e.stopPropagation();
279
+ setIsDragging(true);
280
+ setDragStart({
281
+ x: e.clientX,
282
+ y: e.clientY
283
+ });
284
+ }, []);
285
+ react.useEffect(() => {
286
+ const handleMouseMove = (e) => {
287
+ if (!isDragging) return;
288
+ e.preventDefault();
289
+ e.stopPropagation();
290
+ const targetCorner = getTargetCorner(
291
+ dragStart.x,
292
+ dragStart.y,
293
+ e.clientX,
294
+ e.clientY
68
295
  );
296
+ if (targetCorner) {
297
+ setCorner(targetCorner);
298
+ } else {
299
+ const viewportWidth = window.innerWidth;
300
+ const viewportHeight = window.innerHeight;
301
+ const horizontal = e.clientX < viewportWidth / 2 ? "left" : "right";
302
+ const vertical = e.clientY < viewportHeight / 2 ? "top" : "bottom";
303
+ if (vertical === "top" && horizontal === "left") setCorner("top-left");
304
+ else if (vertical === "top" && horizontal === "right")
305
+ setCorner("top-right");
306
+ else if (vertical === "bottom" && horizontal === "left")
307
+ setCorner("bottom-left");
308
+ else setCorner("bottom-right");
309
+ }
69
310
  };
70
- Button_default = Button;
71
- }
72
- });
73
- var Card, Card_default;
74
- var init_Card = __esm({
75
- "src/components/Card.tsx"() {
76
- Card = ({
77
- children,
78
- title,
79
- className = "",
80
- ...props
81
- }) => {
82
- return /* @__PURE__ */ jsxRuntime.jsxs(
83
- "div",
84
- {
85
- className: `bg-white rounded-lg shadow-md p-6 border border-gray-200 ${className}`,
86
- ...props,
87
- children: [
88
- title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold mb-4 text-gray-800", children: title }),
89
- children
90
- ]
91
- }
92
- );
311
+ const handleMouseUp = (e) => {
312
+ e.preventDefault();
313
+ e.stopPropagation();
314
+ setIsDragging(false);
93
315
  };
94
- Card_default = Card;
95
- }
96
- });
97
- var Input, Input_default;
98
- var init_Input = __esm({
99
- "src/components/Input.tsx"() {
100
- Input = ({
101
- label,
102
- type = "text",
103
- placeholder,
104
- value,
105
- onChange,
106
- required = false,
107
- className = "",
108
- ...props
109
- }) => {
110
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
111
- label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
112
- label,
113
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-1", children: "*" })
114
- ] }),
115
- /* @__PURE__ */ jsxRuntime.jsx(
116
- "input",
117
- {
118
- type,
119
- placeholder,
120
- value,
121
- onChange,
122
- required,
123
- className: `w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${className}`,
124
- ...props
125
- }
126
- )
127
- ] });
316
+ if (isDragging) {
317
+ document.addEventListener("mousemove", handleMouseMove, {
318
+ passive: false
319
+ });
320
+ document.addEventListener("mouseup", handleMouseUp, { passive: false });
321
+ }
322
+ return () => {
323
+ document.removeEventListener("mousemove", handleMouseMove);
324
+ document.removeEventListener("mouseup", handleMouseUp);
128
325
  };
129
- Input_default = Input;
130
- }
131
- });
132
- var DrawingTool, DrawingTool_default;
133
- var init_DrawingTool = __esm({
134
- "src/components/DrawingTool.tsx"() {
135
- DrawingTool = ({
136
- width,
137
- height,
138
- className = "",
139
- overlay = true,
140
- ...props
141
- }) => {
142
- const canvasRef = react.useRef(null);
143
- const toolbarRef = react.useRef(null);
144
- const [isDrawing, setIsDrawing] = react.useState(false);
145
- const brushColor = "#EF4444";
146
- const brushSize = 5;
147
- const [canvasSize, setCanvasSize] = react.useState({ width: 0, height: 0 });
148
- const [enabled, setEnabled] = react.useState(false);
149
- const [hasContent, setHasContent] = react.useState(false);
150
- const [isDragging, setIsDragging] = react.useState(false);
151
- const [corner, setCorner] = react.useState("bottom-right");
152
- const [dragStart, setDragStart] = react.useState({ x: 0, y: 0 });
153
- const [showClearTooltip, setShowClearTooltip] = react.useState(false);
154
- react.useEffect(() => {
155
- if (overlay) {
156
- const updateSize = () => {
157
- setCanvasSize({
158
- width: window.innerWidth,
159
- height: window.innerHeight
160
- });
161
- };
162
- updateSize();
163
- window.addEventListener("resize", updateSize);
164
- return () => window.removeEventListener("resize", updateSize);
165
- } else {
166
- setCanvasSize({
167
- width: width || 800,
168
- height: height || 600
169
- });
170
- }
171
- }, [overlay, width, height]);
172
- react.useEffect(() => {
173
- const canvas = canvasRef.current;
174
- if (!canvas || canvasSize.width === 0 || canvasSize.height === 0) return;
175
- const ctx = canvas.getContext("2d");
176
- if (!ctx) return;
177
- canvas.width = canvasSize.width;
178
- canvas.height = canvasSize.height;
179
- ctx.strokeStyle = brushColor;
180
- ctx.lineWidth = brushSize;
181
- ctx.lineCap = "round";
182
- ctx.lineJoin = "round";
183
- setHasContent(false);
184
- }, [canvasSize, brushColor, brushSize]);
185
- const getCoordinates = react.useCallback(
186
- (e) => {
187
- const canvas = canvasRef.current;
188
- if (!canvas) return { x: 0, y: 0 };
189
- const rect = canvas.getBoundingClientRect();
190
- const scaleX = canvas.width / rect.width;
191
- const scaleY = canvas.height / rect.height;
192
- if ("touches" in e) {
193
- return {
194
- x: (e.touches[0].clientX - rect.left) * scaleX,
195
- y: (e.touches[0].clientY - rect.top) * scaleY
196
- };
197
- } else {
198
- return {
199
- x: (e.clientX - rect.left) * scaleX,
200
- y: (e.clientY - rect.top) * scaleY
201
- };
202
- }
203
- },
204
- []
205
- );
206
- const startDrawing = react.useCallback(
207
- (e) => {
208
- if (!enabled) return;
209
- e.preventDefault();
210
- const canvas = canvasRef.current;
211
- const ctx = canvas?.getContext("2d");
212
- if (!canvas || !ctx) return;
213
- const { x, y } = getCoordinates(e);
214
- ctx.beginPath();
215
- ctx.moveTo(x, y);
216
- setIsDrawing(true);
217
- },
218
- [enabled, getCoordinates]
219
- );
220
- const draw = react.useCallback(
221
- (e) => {
222
- if (!isDrawing) return;
223
- e.preventDefault();
224
- const canvas = canvasRef.current;
225
- const ctx = canvas?.getContext("2d");
226
- if (!canvas || !ctx) return;
227
- const { x, y } = getCoordinates(e);
228
- ctx.lineTo(x, y);
229
- ctx.stroke();
230
- setHasContent(true);
231
- },
232
- [isDrawing, getCoordinates]
233
- );
234
- const stopDrawing = react.useCallback(() => {
235
- setIsDrawing(false);
236
- }, []);
237
- const clearCanvas = react.useCallback(() => {
238
- const canvas = canvasRef.current;
239
- const ctx = canvas?.getContext("2d");
240
- if (!canvas || !ctx) return;
241
- ctx.clearRect(0, 0, canvas.width, canvas.height);
242
- setHasContent(false);
243
- }, []);
244
- const takeScreenshot = react.useCallback(async () => {
245
- try {
246
- const toolbar = toolbarRef.current;
247
- if (toolbar) {
248
- toolbar.style.opacity = "0";
249
- }
250
- const canvas = await html2canvas__default.default(document.body, {
251
- useCORS: true,
252
- logging: false,
253
- windowWidth: window.innerWidth,
254
- windowHeight: window.innerHeight
255
- });
256
- if (toolbar) {
257
- toolbar.style.opacity = "";
258
- }
259
- canvas.toBlob(async (blob) => {
260
- if (!blob) return;
261
- try {
262
- await navigator.clipboard.write([
263
- new ClipboardItem({
264
- "image/png": blob
265
- })
266
- ]);
267
- } catch (err) {
268
- console.error("Failed to copy to clipboard:", err);
269
- const url = URL.createObjectURL(blob);
270
- const a = document.createElement("a");
271
- a.href = url;
272
- a.download = "screenshot.png";
273
- a.click();
274
- URL.revokeObjectURL(url);
275
- }
276
- }, "image/png");
277
- } catch (error) {
278
- console.error("Failed to take screenshot:", error);
279
- }
280
- }, []);
281
- react.useEffect(() => {
282
- const canvas = canvasRef.current;
283
- const ctx = canvas?.getContext("2d");
284
- if (!ctx) return;
285
- ctx.strokeStyle = brushColor;
286
- ctx.lineWidth = brushSize;
287
- }, [brushColor, brushSize]);
288
- const getTargetCorner = react.useCallback(
289
- (startX, startY, currentX, currentY) => {
290
- const deltaX = currentX - startX;
291
- const deltaY = currentY - startY;
292
- const threshold = 50;
293
- if (Math.abs(deltaX) < threshold && Math.abs(deltaY) < threshold) {
294
- return null;
295
- }
296
- const viewportWidth = window.innerWidth;
297
- const viewportHeight = window.innerHeight;
298
- const horizontal = currentX < viewportWidth / 2 ? "left" : "right";
299
- const vertical = currentY < viewportHeight / 2 ? "top" : "bottom";
300
- if (vertical === "top" && horizontal === "left") return "top-left";
301
- if (vertical === "top" && horizontal === "right") return "top-right";
302
- if (vertical === "bottom" && horizontal === "left") return "bottom-left";
303
- if (vertical === "bottom" && horizontal === "right")
304
- return "bottom-right";
305
- return null;
306
- },
307
- []
308
- );
309
- const handleMouseDown = react.useCallback((e) => {
310
- if (e.target.closest("button")) {
311
- return;
312
- }
313
- e.preventDefault();
314
- e.stopPropagation();
315
- setIsDragging(true);
316
- setDragStart({
317
- x: e.clientX,
318
- y: e.clientY
319
- });
320
- }, []);
321
- react.useEffect(() => {
322
- const handleMouseMove = (e) => {
323
- if (!isDragging) return;
324
- e.preventDefault();
325
- e.stopPropagation();
326
- const targetCorner = getTargetCorner(
327
- dragStart.x,
328
- dragStart.y,
329
- e.clientX,
330
- e.clientY
331
- );
332
- if (targetCorner) {
333
- setCorner(targetCorner);
334
- } else {
335
- const viewportWidth = window.innerWidth;
336
- const viewportHeight = window.innerHeight;
337
- const horizontal = e.clientX < viewportWidth / 2 ? "left" : "right";
338
- const vertical = e.clientY < viewportHeight / 2 ? "top" : "bottom";
339
- if (vertical === "top" && horizontal === "left") setCorner("top-left");
340
- else if (vertical === "top" && horizontal === "right")
341
- setCorner("top-right");
342
- else if (vertical === "bottom" && horizontal === "left")
343
- setCorner("bottom-left");
344
- else setCorner("bottom-right");
326
+ }, [isDragging, dragStart, getTargetCorner]);
327
+ if (overlay) {
328
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
329
+ /* @__PURE__ */ jsxRuntime.jsx(
330
+ "canvas",
331
+ {
332
+ ref: canvasRef,
333
+ onMouseDown: startDrawing,
334
+ onMouseMove: draw,
335
+ onMouseUp: stopDrawing,
336
+ onMouseLeave: stopDrawing,
337
+ onTouchStart: startDrawing,
338
+ onTouchMove: draw,
339
+ onTouchEnd: stopDrawing,
340
+ className: `fixed top-0 left-0 touch-none z-50 transition-opacity ${enabled && !isDragging ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
341
+ style: {
342
+ width: `${canvasSize.width}px`,
343
+ height: `${canvasSize.height}px`
345
344
  }
346
- };
347
- const handleMouseUp = (e) => {
348
- e.preventDefault();
349
- e.stopPropagation();
350
- setIsDragging(false);
351
- };
352
- if (isDragging) {
353
- document.addEventListener("mousemove", handleMouseMove, {
354
- passive: false
355
- });
356
- document.addEventListener("mouseup", handleMouseUp, { passive: false });
357
345
  }
358
- return () => {
359
- document.removeEventListener("mousemove", handleMouseMove);
360
- document.removeEventListener("mouseup", handleMouseUp);
361
- };
362
- }, [isDragging, dragStart, getTargetCorner]);
363
- if (overlay) {
364
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
365
- /* @__PURE__ */ jsxRuntime.jsx(
366
- "canvas",
367
- {
368
- ref: canvasRef,
369
- onMouseDown: startDrawing,
370
- onMouseMove: draw,
371
- onMouseUp: stopDrawing,
372
- onMouseLeave: stopDrawing,
373
- onTouchStart: startDrawing,
374
- onTouchMove: draw,
375
- onTouchEnd: stopDrawing,
376
- className: `fixed top-0 left-0 touch-none z-50 transition-opacity ${enabled && !isDragging ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
377
- style: {
378
- width: `${canvasSize.width}px`,
379
- height: `${canvasSize.height}px`
380
- }
381
- }
382
- ),
383
- /* @__PURE__ */ jsxRuntime.jsxs(
384
- "div",
385
- {
386
- ref: toolbarRef,
387
- className: `fixed flex flex-row items-center px-2 py-1.5 bg-neutral-800 rounded-full shadow-lg z-[60] ${isDragging ? "cursor-grabbing" : "cursor-grab"} ${className}`,
388
- style: {
389
- gap: enabled ? "8px" : "0px",
390
- transition: "gap 300ms ease-in-out",
391
- ...corner === "top-left" ? { top: "16px", left: "16px", bottom: "auto", right: "auto" } : corner === "top-right" ? { top: "16px", right: "16px", bottom: "auto", left: "auto" } : corner === "bottom-left" ? { bottom: "16px", left: "16px", top: "auto", right: "auto" } : { bottom: "16px", right: "16px", top: "auto", left: "auto" }
392
- },
393
- onMouseDown: handleMouseDown,
394
- ...props,
395
- onClick: (e) => e.stopPropagation(),
396
- children: [
397
- /* @__PURE__ */ jsxRuntime.jsx(
398
- "div",
346
+ ),
347
+ /* @__PURE__ */ jsxRuntime.jsxs(
348
+ "div",
349
+ {
350
+ ref: toolbarRef,
351
+ className: `fixed flex flex-row items-center px-2 py-1.5 bg-neutral-800 rounded-full shadow-lg z-[60] ${isDragging ? "cursor-grabbing" : "cursor-grab"} ${className}`,
352
+ style: {
353
+ gap: enabled ? "8px" : "0px",
354
+ transition: "gap 300ms ease-in-out",
355
+ ...corner === "top-left" ? { top: "16px", left: "16px", bottom: "auto", right: "auto" } : corner === "top-right" ? { top: "16px", right: "16px", bottom: "auto", left: "auto" } : corner === "bottom-left" ? { bottom: "16px", left: "16px", top: "auto", right: "auto" } : { bottom: "16px", right: "16px", top: "auto", left: "auto" }
356
+ },
357
+ onMouseDown: handleMouseDown,
358
+ ...props,
359
+ onClick: (e) => e.stopPropagation(),
360
+ children: [
361
+ /* @__PURE__ */ jsxRuntime.jsx(
362
+ "div",
363
+ {
364
+ className: "overflow-hidden flex-shrink-0",
365
+ style: {
366
+ maxWidth: enabled ? "100px" : "0px",
367
+ opacity: enabled ? 1 : 0,
368
+ transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
369
+ },
370
+ children: /* @__PURE__ */ jsxRuntime.jsx(
371
+ "button",
399
372
  {
400
- className: "overflow-hidden flex-shrink-0",
401
- style: {
402
- maxWidth: enabled ? "100px" : "0px",
403
- opacity: enabled ? 1 : 0,
404
- transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
373
+ onClick: (e) => {
374
+ e.stopPropagation();
375
+ takeScreenshot();
405
376
  },
406
- children: /* @__PURE__ */ jsxRuntime.jsx(
407
- "button",
377
+ className: "p-2 text-white hover:bg-neutral-600/30 rounded-full transition-colors focus:outline-none whitespace-nowrap",
378
+ "aria-label": "Take screenshot",
379
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
380
+ "svg",
408
381
  {
409
- onClick: (e) => {
410
- e.stopPropagation();
411
- takeScreenshot();
412
- },
413
- className: "p-2 text-white hover:bg-neutral-600/30 rounded-full transition-colors focus:outline-none whitespace-nowrap",
414
- "aria-label": "Take screenshot",
415
- children: /* @__PURE__ */ jsxRuntime.jsxs(
416
- "svg",
417
- {
418
- xmlns: "http://www.w3.org/2000/svg",
419
- width: "18",
420
- height: "18",
421
- viewBox: "0 0 24 24",
422
- fill: "none",
423
- stroke: "currentColor",
424
- strokeWidth: "2",
425
- strokeLinecap: "round",
426
- strokeLinejoin: "round",
427
- className: "lucide lucide-camera",
428
- children: [
429
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
430
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "13", r: "3" })
431
- ]
432
- }
433
- )
382
+ xmlns: "http://www.w3.org/2000/svg",
383
+ width: "18",
384
+ height: "18",
385
+ viewBox: "0 0 24 24",
386
+ fill: "none",
387
+ stroke: "currentColor",
388
+ strokeWidth: "2",
389
+ strokeLinecap: "round",
390
+ strokeLinejoin: "round",
391
+ className: "lucide lucide-camera",
392
+ children: [
393
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
394
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "13", r: "3" })
395
+ ]
434
396
  }
435
397
  )
436
398
  }
437
- ),
438
- /* @__PURE__ */ jsxRuntime.jsxs(
439
- "div",
440
- {
441
- className: "overflow-hidden flex-shrink-0 relative",
442
- style: {
443
- maxWidth: enabled ? "100px" : "0px",
444
- opacity: enabled ? 1 : 0,
445
- transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
446
- },
447
- children: [
448
- /* @__PURE__ */ jsxRuntime.jsxs(
399
+ )
400
+ }
401
+ ),
402
+ /* @__PURE__ */ jsxRuntime.jsxs(
403
+ "div",
404
+ {
405
+ className: "overflow-hidden flex-shrink-0 relative",
406
+ style: {
407
+ maxWidth: enabled ? "100px" : "0px",
408
+ opacity: enabled ? 1 : 0,
409
+ transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
410
+ },
411
+ children: [
412
+ /* @__PURE__ */ jsxRuntime.jsxs(
413
+ "button",
414
+ {
415
+ onClick: (e) => {
416
+ e.stopPropagation();
417
+ clearCanvas();
418
+ setShowClearTooltip(false);
419
+ },
420
+ onMouseEnter: () => {
421
+ if (hasContent) {
422
+ setShowClearTooltip(true);
423
+ }
424
+ },
425
+ onMouseLeave: () => setShowClearTooltip(false),
426
+ disabled: !hasContent,
427
+ className: "p-2 text-white rounded-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed relative group",
428
+ "aria-label": "Clear canvas",
429
+ children: [
430
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-red-600/30 opacity-0 group-hover:opacity-100 transition-opacity disabled:group-hover:opacity-0" }),
431
+ /* @__PURE__ */ jsxRuntime.jsx(
432
+ lucideReact.Trash2,
433
+ {
434
+ size: 18,
435
+ strokeWidth: 2,
436
+ className: "relative z-10 group-hover:text-red-600 transition-colors"
437
+ }
438
+ )
439
+ ]
440
+ }
441
+ ),
442
+ showClearTooltip && hasContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-neutral-800 rounded-full shadow-lg whitespace-nowrap z-[70]", children: [
443
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
444
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white text-sm", children: "Clear all" }),
445
+ /* @__PURE__ */ jsxRuntime.jsx(
449
446
  "button",
450
447
  {
451
448
  onClick: (e) => {
452
449
  e.stopPropagation();
453
- clearCanvas();
454
450
  setShowClearTooltip(false);
455
451
  },
456
- onMouseEnter: () => {
457
- if (hasContent) {
458
- setShowClearTooltip(true);
459
- }
460
- },
461
- onMouseLeave: () => setShowClearTooltip(false),
462
- disabled: !hasContent,
463
- className: "p-2 text-white rounded-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed relative group",
464
- "aria-label": "Clear canvas",
465
- children: [
466
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-red-600/30 opacity-0 group-hover:opacity-100 transition-opacity disabled:group-hover:opacity-0" }),
467
- /* @__PURE__ */ jsxRuntime.jsx(
468
- lucideReact.Trash2,
469
- {
470
- size: 18,
471
- strokeWidth: 2,
472
- className: "relative z-10 group-hover:text-red-600 transition-colors"
473
- }
474
- )
475
- ]
452
+ onMouseDown: (e) => e.stopPropagation(),
453
+ className: "text-white hover:text-neutral-300 transition-colors rounded-full",
454
+ "aria-label": "Dismiss tooltip",
455
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14, strokeWidth: 2 })
476
456
  }
477
- ),
478
- showClearTooltip && hasContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-neutral-800 rounded-full shadow-lg whitespace-nowrap z-[70]", children: [
479
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
480
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white text-sm", children: "Clear all" }),
481
- /* @__PURE__ */ jsxRuntime.jsx(
482
- "button",
483
- {
484
- onClick: (e) => {
485
- e.stopPropagation();
486
- setShowClearTooltip(false);
487
- },
488
- onMouseDown: (e) => e.stopPropagation(),
489
- className: "text-white hover:text-neutral-300 transition-colors rounded-full",
490
- "aria-label": "Dismiss tooltip",
491
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14, strokeWidth: 2 })
492
- }
493
- )
494
- ] }),
495
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 -mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-neutral-800 rotate-45" }) })
496
- ] })
497
- ]
498
- }
499
- ),
500
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-shrink-0", children: [
501
- /* @__PURE__ */ jsxRuntime.jsx(
457
+ )
458
+ ] }),
459
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 -mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 bg-neutral-800 rotate-45" }) })
460
+ ] })
461
+ ]
462
+ }
463
+ ),
464
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-shrink-0", children: [
465
+ /* @__PURE__ */ jsxRuntime.jsx(
466
+ "button",
467
+ {
468
+ onClick: (e) => {
469
+ e.stopPropagation();
470
+ setEnabled(!enabled);
471
+ },
472
+ className: "p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
473
+ style: {
474
+ opacity: enabled ? 0 : 1,
475
+ pointerEvents: enabled ? "none" : "auto",
476
+ transition: "opacity 300ms ease-in-out"
477
+ },
478
+ "aria-label": "Turn on drawing",
479
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
480
+ "svg",
481
+ {
482
+ xmlns: "http://www.w3.org/2000/svg",
483
+ width: "18",
484
+ height: "18",
485
+ viewBox: "0 0 24 24",
486
+ fill: "none",
487
+ stroke: "currentColor",
488
+ strokeWidth: "2",
489
+ strokeLinecap: "round",
490
+ strokeLinejoin: "round",
491
+ className: "lucide lucide-brush",
492
+ children: [
493
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m11 10 3 3" }),
494
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
495
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
496
+ ]
497
+ }
498
+ )
499
+ }
500
+ ),
501
+ /* @__PURE__ */ jsxRuntime.jsx(
502
+ "button",
503
+ {
504
+ onClick: (e) => {
505
+ e.stopPropagation();
506
+ setEnabled(false);
507
+ },
508
+ className: "absolute inset-0 p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
509
+ style: {
510
+ opacity: enabled ? 1 : 0,
511
+ pointerEvents: enabled ? "auto" : "none",
512
+ transition: "opacity 300ms ease-in-out"
513
+ },
514
+ "aria-label": "Close",
515
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 18, strokeWidth: 2.5 })
516
+ }
517
+ )
518
+ ] })
519
+ ]
520
+ }
521
+ )
522
+ ] });
523
+ }
524
+ return /* @__PURE__ */ jsxRuntime.jsxs(
525
+ "div",
526
+ {
527
+ className: `flex flex-col items-center gap-4 p-6 bg-white rounded-full shadow-lg border border-gray-200 ${className}`,
528
+ ...props,
529
+ children: [
530
+ /* @__PURE__ */ jsxRuntime.jsxs(
531
+ "div",
532
+ {
533
+ className: "flex flex-row items-center w-full justify-center transition-all duration-300 ease-in-out",
534
+ style: {
535
+ gap: enabled ? "12px" : "0px"
536
+ },
537
+ children: [
538
+ /* @__PURE__ */ jsxRuntime.jsx(
539
+ "button",
540
+ {
541
+ onClick: () => setEnabled(!enabled),
542
+ className: `p-3 rounded-xl transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 ${enabled ? "bg-emerald-500 text-white hover:bg-emerald-600 active:bg-emerald-700" : "bg-slate-500 text-white hover:bg-slate-600 active:bg-slate-700"}`,
543
+ "aria-label": enabled ? "Turn off drawing" : "Turn on drawing",
544
+ children: enabled ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 20, strokeWidth: 2.5 }) : /* @__PURE__ */ jsxRuntime.jsxs(
545
+ "svg",
546
+ {
547
+ xmlns: "http://www.w3.org/2000/svg",
548
+ width: "20",
549
+ height: "20",
550
+ viewBox: "0 0 24 24",
551
+ fill: "none",
552
+ stroke: "currentColor",
553
+ strokeWidth: "2",
554
+ strokeLinecap: "round",
555
+ strokeLinejoin: "round",
556
+ className: "lucide lucide-brush",
557
+ children: [
558
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m11 10 3 3" }),
559
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
560
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
561
+ ]
562
+ }
563
+ )
564
+ }
565
+ ),
566
+ /* @__PURE__ */ jsxRuntime.jsx(
567
+ "div",
568
+ {
569
+ className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
570
+ style: {
571
+ width: enabled ? "52px" : "0px",
572
+ minWidth: enabled ? "52px" : "0px",
573
+ opacity: enabled ? 1 : 0
574
+ },
575
+ children: /* @__PURE__ */ jsxRuntime.jsx(
502
576
  "button",
503
577
  {
504
- onClick: (e) => {
505
- e.stopPropagation();
506
- setEnabled(!enabled);
507
- },
508
- className: "p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
509
- style: {
510
- opacity: enabled ? 0 : 1,
511
- pointerEvents: enabled ? "none" : "auto",
512
- transition: "opacity 300ms ease-in-out"
513
- },
514
- "aria-label": "Turn on drawing",
578
+ onClick: clearCanvas,
579
+ disabled: !hasContent,
580
+ className: "p-3 bg-red-500 text-white hover:text-red-200 rounded-xl hover:bg-red-600 active:bg-red-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-red-500 disabled:hover:shadow-md disabled:active:scale-100 whitespace-nowrap",
581
+ "aria-label": "Clear canvas",
515
582
  children: /* @__PURE__ */ jsxRuntime.jsxs(
516
583
  "svg",
517
584
  {
518
585
  xmlns: "http://www.w3.org/2000/svg",
519
- width: "18",
520
- height: "18",
586
+ width: "20",
587
+ height: "20",
521
588
  viewBox: "0 0 24 24",
522
589
  fill: "none",
523
590
  stroke: "currentColor",
524
591
  strokeWidth: "2",
525
592
  strokeLinecap: "round",
526
593
  strokeLinejoin: "round",
527
- className: "lucide lucide-brush",
594
+ className: "lucide lucide-brush-cleaning",
528
595
  children: [
529
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m11 10 3 3" }),
530
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
531
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
596
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16 22-1-4" }),
597
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1" }),
598
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z" }),
599
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 22 1-4" })
532
600
  ]
533
601
  }
534
602
  )
535
603
  }
536
- ),
537
- /* @__PURE__ */ jsxRuntime.jsx(
538
- "button",
539
- {
540
- onClick: (e) => {
541
- e.stopPropagation();
542
- setEnabled(false);
543
- },
544
- className: "absolute inset-0 p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
545
- style: {
546
- opacity: enabled ? 1 : 0,
547
- pointerEvents: enabled ? "auto" : "none",
548
- transition: "opacity 300ms ease-in-out"
549
- },
550
- "aria-label": "Close",
551
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 18, strokeWidth: 2.5 })
552
- }
553
604
  )
554
- ] })
555
- ]
556
- }
557
- )
558
- ] });
559
- }
560
- return /* @__PURE__ */ jsxRuntime.jsxs(
561
- "div",
562
- {
563
- className: `flex flex-col items-center gap-4 p-6 bg-white rounded-full shadow-lg border border-gray-200 ${className}`,
564
- ...props,
565
- children: [
566
- /* @__PURE__ */ jsxRuntime.jsxs(
567
- "div",
568
- {
569
- className: "flex flex-row items-center w-full justify-center transition-all duration-300 ease-in-out",
570
- style: {
571
- gap: enabled ? "12px" : "0px"
572
- },
573
- children: [
574
- /* @__PURE__ */ jsxRuntime.jsx(
605
+ }
606
+ ),
607
+ /* @__PURE__ */ jsxRuntime.jsx(
608
+ "div",
609
+ {
610
+ className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
611
+ style: {
612
+ width: enabled ? "52px" : "0px",
613
+ minWidth: enabled ? "52px" : "0px",
614
+ opacity: enabled ? 1 : 0
615
+ },
616
+ children: /* @__PURE__ */ jsxRuntime.jsx(
575
617
  "button",
576
618
  {
577
- onClick: () => setEnabled(!enabled),
578
- className: `p-3 rounded-xl transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 ${enabled ? "bg-emerald-500 text-white hover:bg-emerald-600 active:bg-emerald-700" : "bg-slate-500 text-white hover:bg-slate-600 active:bg-slate-700"}`,
579
- "aria-label": enabled ? "Turn off drawing" : "Turn on drawing",
580
- children: enabled ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 20, strokeWidth: 2.5 }) : /* @__PURE__ */ jsxRuntime.jsxs(
619
+ onClick: takeScreenshot,
620
+ className: "p-3 bg-neutral-500 text-white rounded-xl hover:bg-neutral-600 active:bg-neutral-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 whitespace-nowrap",
621
+ "aria-label": "Take screenshot",
622
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
581
623
  "svg",
582
624
  {
583
625
  xmlns: "http://www.w3.org/2000/svg",
@@ -589,176 +631,69 @@ var init_DrawingTool = __esm({
589
631
  strokeWidth: "2",
590
632
  strokeLinecap: "round",
591
633
  strokeLinejoin: "round",
592
- className: "lucide lucide-brush",
634
+ className: "lucide lucide-camera",
593
635
  children: [
594
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m11 10 3 3" }),
595
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
596
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
636
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
637
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "13", r: "3" })
597
638
  ]
598
639
  }
599
640
  )
600
641
  }
601
- ),
602
- /* @__PURE__ */ jsxRuntime.jsx(
603
- "div",
604
- {
605
- className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
606
- style: {
607
- width: enabled ? "52px" : "0px",
608
- minWidth: enabled ? "52px" : "0px",
609
- opacity: enabled ? 1 : 0
610
- },
611
- children: /* @__PURE__ */ jsxRuntime.jsx(
612
- "button",
613
- {
614
- onClick: clearCanvas,
615
- disabled: !hasContent,
616
- className: "p-3 bg-red-500 text-white hover:text-red-200 rounded-xl hover:bg-red-600 active:bg-red-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-red-500 disabled:hover:shadow-md disabled:active:scale-100 whitespace-nowrap",
617
- "aria-label": "Clear canvas",
618
- children: /* @__PURE__ */ jsxRuntime.jsxs(
619
- "svg",
620
- {
621
- xmlns: "http://www.w3.org/2000/svg",
622
- width: "20",
623
- height: "20",
624
- viewBox: "0 0 24 24",
625
- fill: "none",
626
- stroke: "currentColor",
627
- strokeWidth: "2",
628
- strokeLinecap: "round",
629
- strokeLinejoin: "round",
630
- className: "lucide lucide-brush-cleaning",
631
- children: [
632
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16 22-1-4" }),
633
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1" }),
634
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z" }),
635
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 22 1-4" })
636
- ]
637
- }
638
- )
639
- }
640
- )
641
- }
642
- ),
643
- /* @__PURE__ */ jsxRuntime.jsx(
644
- "div",
645
- {
646
- className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
647
- style: {
648
- width: enabled ? "52px" : "0px",
649
- minWidth: enabled ? "52px" : "0px",
650
- opacity: enabled ? 1 : 0
651
- },
652
- children: /* @__PURE__ */ jsxRuntime.jsx(
653
- "button",
654
- {
655
- onClick: takeScreenshot,
656
- className: "p-3 bg-neutral-500 text-white rounded-xl hover:bg-neutral-600 active:bg-neutral-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 whitespace-nowrap",
657
- "aria-label": "Take screenshot",
658
- children: /* @__PURE__ */ jsxRuntime.jsxs(
659
- "svg",
660
- {
661
- xmlns: "http://www.w3.org/2000/svg",
662
- width: "20",
663
- height: "20",
664
- viewBox: "0 0 24 24",
665
- fill: "none",
666
- stroke: "currentColor",
667
- strokeWidth: "2",
668
- strokeLinecap: "round",
669
- strokeLinejoin: "round",
670
- className: "lucide lucide-camera",
671
- children: [
672
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
673
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "13", r: "3" })
674
- ]
675
- }
676
- )
677
- }
678
- )
679
- }
680
642
  )
681
- ]
682
- }
683
- ),
684
- /* @__PURE__ */ jsxRuntime.jsx(
685
- "canvas",
686
- {
687
- ref: canvasRef,
688
- onMouseDown: startDrawing,
689
- onMouseMove: draw,
690
- onMouseUp: stopDrawing,
691
- onMouseLeave: stopDrawing,
692
- onTouchStart: startDrawing,
693
- onTouchMove: draw,
694
- onTouchEnd: stopDrawing,
695
- className: `border border-gray-300 rounded touch-none transition-opacity ${enabled ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
696
- style: {
697
- width: `${canvasSize.width}px`,
698
- height: `${canvasSize.height}px`,
699
- maxWidth: "100%"
700
643
  }
701
- }
702
- )
703
- ]
704
- }
705
- );
706
- };
707
- DrawingTool_default = DrawingTool;
708
- }
709
- });
644
+ )
645
+ ]
646
+ }
647
+ ),
648
+ /* @__PURE__ */ jsxRuntime.jsx(
649
+ "canvas",
650
+ {
651
+ ref: canvasRef,
652
+ onMouseDown: startDrawing,
653
+ onMouseMove: draw,
654
+ onMouseUp: stopDrawing,
655
+ onMouseLeave: stopDrawing,
656
+ onTouchStart: startDrawing,
657
+ onTouchMove: draw,
658
+ onTouchEnd: stopDrawing,
659
+ className: `border border-gray-300 rounded touch-none transition-opacity ${enabled ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
660
+ style: {
661
+ width: `${canvasSize.width}px`,
662
+ height: `${canvasSize.height}px`,
663
+ maxWidth: "100%"
664
+ }
665
+ }
666
+ )
667
+ ]
668
+ }
669
+ );
670
+ };
671
+ var DrawingTool_default = DrawingTool;
710
672
 
711
- // src/components.ts
712
- var components_exports = {};
713
- __export(components_exports, {
714
- Button: () => Button,
715
- ButtonDefault: () => Button_default,
716
- Card: () => Card,
717
- CardDefault: () => Card_default,
718
- DrawingTool: () => DrawingTool,
719
- DrawingToolDefault: () => DrawingTool_default,
720
- Input: () => Input,
721
- InputDefault: () => Input_default
722
- });
723
- var init_components = __esm({
724
- "src/components.ts"() {
725
- init_Button();
726
- init_Card();
727
- init_Input();
728
- init_DrawingTool();
729
- init_Button();
730
- init_Card();
731
- init_Input();
732
- init_DrawingTool();
673
+ // src/index.ts
674
+ var MoabSDK = class {
675
+ constructor(options = {}) {
676
+ __publicField(this, "options");
677
+ this.options = options;
733
678
  }
734
- });
735
-
736
- // src/index.js
737
- var require_src = __commonJS({
738
- "src/index.js"(exports$1, module) {
739
- var MoabSDK = class {
740
- constructor(options = {}) {
741
- this.options = options;
742
- }
743
- /**
744
- * Example method - replace with your SDK functionality
745
- */
746
- hello() {
747
- return "Hello from Moab SDK!";
748
- }
749
- };
750
- module.exports = MoabSDK;
751
- module.exports.default = MoabSDK;
752
- if (typeof module !== "undefined" && module.exports) {
753
- try {
754
- module.exports.components = (init_components(), __toCommonJS(components_exports));
755
- } catch (e) {
756
- }
757
- }
679
+ /**
680
+ * Example method - replace with your SDK functionality
681
+ */
682
+ hello() {
683
+ return "Hello from Moab SDK!";
758
684
  }
759
- });
760
- var index = require_src();
685
+ };
686
+ var src_default = MoabSDK;
761
687
 
762
- module.exports = index;
688
+ exports.Button = Button;
689
+ exports.ButtonDefault = Button_default;
690
+ exports.Card = Card;
691
+ exports.CardDefault = Card_default;
692
+ exports.DrawingTool = DrawingTool;
693
+ exports.DrawingToolDefault = DrawingTool_default;
694
+ exports.Input = Input;
695
+ exports.InputDefault = Input_default;
696
+ exports.MoabSDK = MoabSDK;
697
+ exports.default = src_default;
763
698
  //# sourceMappingURL=index.js.map
764
699
  //# sourceMappingURL=index.js.map