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