skema-core 2.1.1 → 2.1.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.mjs CHANGED
@@ -319,8 +319,7 @@ function useDaemon(options = {}) {
319
319
  pending.resolve(msg);
320
320
  }
321
321
  }
322
- } catch (e) {
323
- console.error("[useDaemon] Failed to parse message:", e);
322
+ } catch {
324
323
  }
325
324
  }, []);
326
325
  const connect = useCallback(() => {
@@ -332,27 +331,20 @@ function useDaemon(options = {}) {
332
331
  try {
333
332
  const ws = new WebSocket(url);
334
333
  ws.onopen = () => {
335
- console.log("[useDaemon] Connected to daemon");
336
334
  };
337
335
  ws.onmessage = handleMessage;
338
336
  ws.onclose = () => {
339
- console.log("[useDaemon] Disconnected from daemon");
340
337
  setState((prev) => ({ ...prev, connected: false }));
341
338
  wsRef.current = null;
342
339
  if (autoReconnect) {
343
- reconnectTimeoutRef.current = setTimeout(() => {
344
- console.log("[useDaemon] Attempting to reconnect...");
345
- connect();
346
- }, reconnectDelay);
340
+ reconnectTimeoutRef.current = setTimeout(connect, reconnectDelay);
347
341
  }
348
342
  };
349
- ws.onerror = (e) => {
350
- console.error("[useDaemon] WebSocket error:", e);
343
+ ws.onerror = () => {
351
344
  setError("Failed to connect to Skema daemon. Is it running?");
352
345
  };
353
346
  wsRef.current = ws;
354
- } catch (e) {
355
- console.error("[useDaemon] Failed to create WebSocket:", e);
347
+ } catch {
356
348
  setError("Failed to connect to Skema daemon");
357
349
  }
358
350
  }, [url, autoReconnect, reconnectDelay, handleMessage]);
@@ -371,8 +363,7 @@ function useDaemon(options = {}) {
371
363
  try {
372
364
  const response = await sendRequest("set-provider", { provider });
373
365
  return response.type === "provider-changed";
374
- } catch (e) {
375
- console.error("[useDaemon] Failed to set provider:", e);
366
+ } catch {
376
367
  return false;
377
368
  }
378
369
  }, [sendRequest]);
@@ -380,16 +371,14 @@ function useDaemon(options = {}) {
380
371
  try {
381
372
  const response = await sendRequest("set-mode", { mode });
382
373
  return response.type === "mode-changed";
383
- } catch (e) {
384
- console.error("[useDaemon] Failed to set mode:", e);
374
+ } catch {
385
375
  return false;
386
376
  }
387
377
  }, [sendRequest]);
388
378
  const refreshProviderStatus = useCallback(async () => {
389
379
  try {
390
380
  await sendRequest("check-providers", {});
391
- } catch (e) {
392
- console.error("[useDaemon] Failed to refresh provider status:", e);
381
+ } catch {
393
382
  }
394
383
  }, [sendRequest]);
395
384
  const generate = useCallback(async (annotation, onEvent, options2) => {
@@ -411,7 +400,10 @@ function useDaemon(options = {}) {
411
400
  annotation,
412
401
  // Include optional overrides
413
402
  ...options2?.mode && { mode: options2.mode },
414
- ...options2?.provider && { provider: options2.provider }
403
+ ...options2?.provider && { provider: options2.provider },
404
+ ...options2?.visionApiKey != null && options2.visionApiKey !== "" && { visionApiKey: options2.visionApiKey },
405
+ ...options2?.visionProvider && { visionProvider: options2.visionProvider },
406
+ ...options2?.visionModel && { visionModel: options2.visionModel }
415
407
  }));
416
408
  });
417
409
  }, [nextId]);
@@ -953,6 +945,76 @@ function extractTextFromShapes(shapes) {
953
945
  }
954
946
  return textContent.filter(Boolean).join("\n");
955
947
  }
948
+
949
+ // src/lib/settingsStorage.ts
950
+ var VISION_API_KEY_PREFIX = "skema-vision-api-key-";
951
+ var VISION_PROVIDER_KEY = "skema-vision-provider";
952
+ var VISION_MODEL_KEY = "skema-vision-model";
953
+ var OLD_GEMINI_KEY = "skema-gemini-api-key";
954
+ function getStoredVisionApiKey(provider) {
955
+ if (typeof window === "undefined" || !window.localStorage) return null;
956
+ try {
957
+ let value = localStorage.getItem(VISION_API_KEY_PREFIX + provider);
958
+ if (!value && provider === "gemini") {
959
+ value = localStorage.getItem(OLD_GEMINI_KEY);
960
+ if (value) {
961
+ localStorage.setItem(VISION_API_KEY_PREFIX + "gemini", value);
962
+ localStorage.removeItem(OLD_GEMINI_KEY);
963
+ }
964
+ }
965
+ return value && value.trim() ? value.trim() : null;
966
+ } catch {
967
+ return null;
968
+ }
969
+ }
970
+ function setStoredVisionApiKey(provider, value) {
971
+ if (typeof window === "undefined" || !window.localStorage) return;
972
+ try {
973
+ const trimmed = value.trim();
974
+ if (trimmed) {
975
+ localStorage.setItem(VISION_API_KEY_PREFIX + provider, trimmed);
976
+ } else {
977
+ localStorage.removeItem(VISION_API_KEY_PREFIX + provider);
978
+ }
979
+ } catch {
980
+ }
981
+ }
982
+ function getStoredVisionProvider() {
983
+ if (typeof window === "undefined" || !window.localStorage) return "gemini";
984
+ try {
985
+ const value = localStorage.getItem(VISION_PROVIDER_KEY);
986
+ if (value === "gemini" || value === "claude" || value === "openai") return value;
987
+ return "gemini";
988
+ } catch {
989
+ return "gemini";
990
+ }
991
+ }
992
+ function setStoredVisionProvider(provider) {
993
+ if (typeof window === "undefined" || !window.localStorage) return;
994
+ try {
995
+ localStorage.setItem(VISION_PROVIDER_KEY, provider);
996
+ } catch {
997
+ }
998
+ }
999
+ function getStoredVisionModel() {
1000
+ if (typeof window === "undefined" || !window.localStorage) return null;
1001
+ try {
1002
+ return localStorage.getItem(VISION_MODEL_KEY);
1003
+ } catch {
1004
+ return null;
1005
+ }
1006
+ }
1007
+ function setStoredVisionModel(model) {
1008
+ if (typeof window === "undefined" || !window.localStorage) return;
1009
+ try {
1010
+ if (model) {
1011
+ localStorage.setItem(VISION_MODEL_KEY, model);
1012
+ } else {
1013
+ localStorage.removeItem(VISION_MODEL_KEY);
1014
+ }
1015
+ } catch {
1016
+ }
1017
+ }
956
1018
  var SLogoIcon = ({ size = 32 }) => /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 166 161", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
957
1019
  /* @__PURE__ */ jsx(
958
1020
  "path",
@@ -2528,6 +2590,40 @@ var svg2 = `<svg width="560" height="132" viewBox="378 168 560 132" fill="none"
2528
2590
  </svg>`;
2529
2591
  var logo_light_default = "data:image/svg+xml," + encodeURIComponent(svg2);
2530
2592
  var SKEMA_VERSION = "0.2.0";
2593
+ var VISION_PROVIDERS = [
2594
+ { value: "gemini", label: "Gemini" },
2595
+ { value: "claude", label: "Claude" },
2596
+ { value: "openai", label: "OpenAI" }
2597
+ ];
2598
+ var VISION_PROVIDER_MODELS = {
2599
+ gemini: [
2600
+ { value: "gemini-2.5-flash", label: "2.5 Flash" },
2601
+ { value: "gemini-2.5-pro", label: "2.5 Pro" },
2602
+ { value: "gemini-3-flash-preview", label: "3 Flash" },
2603
+ { value: "gemini-3-pro-preview", label: "3 Pro" }
2604
+ ],
2605
+ claude: [
2606
+ { value: "claude-haiku-4-5-20251001", label: "Haiku 4.5" },
2607
+ { value: "claude-sonnet-4-5-20250929", label: "Sonnet 4.5" },
2608
+ { value: "claude-opus-4-6", label: "Opus 4.6" }
2609
+ ],
2610
+ openai: [
2611
+ { value: "gpt-4o-mini", label: "GPT-4o Mini" },
2612
+ { value: "gpt-4o", label: "GPT-4o" },
2613
+ { value: "gpt-4.1", label: "GPT-4.1" },
2614
+ { value: "gpt-5.2", label: "GPT-5.2" }
2615
+ ]
2616
+ };
2617
+ var VISION_PROVIDER_DEFAULT_MODEL = {
2618
+ gemini: "gemini-2.5-flash",
2619
+ claude: "claude-haiku-4-5-20251001",
2620
+ openai: "gpt-4o-mini"
2621
+ };
2622
+ var VISION_PROVIDER_KEY_LINKS = {
2623
+ gemini: { label: "Google AI Studio", url: "https://aistudio.google.com/apikey" },
2624
+ claude: { label: "Anthropic Console", url: "https://console.anthropic.com/settings/keys" },
2625
+ openai: { label: "OpenAI Platform", url: "https://platform.openai.com/api-keys" }
2626
+ };
2531
2627
  var SettingsPanel = ({
2532
2628
  isOpen,
2533
2629
  onClose,
@@ -2545,6 +2641,40 @@ var SettingsPanel = ({
2545
2641
  theme,
2546
2642
  onThemeChange
2547
2643
  }) => {
2644
+ const [visionProvider, setVisionProvider] = useState("gemini");
2645
+ const [visionModel, setVisionModel] = useState("");
2646
+ const [visionApiKey, setVisionApiKey] = useState("");
2647
+ const [showApiKey, setShowApiKey] = useState(false);
2648
+ useEffect(() => {
2649
+ if (isOpen) {
2650
+ const storedProvider = getStoredVisionProvider();
2651
+ setVisionProvider(storedProvider);
2652
+ setVisionModel(getStoredVisionModel() || VISION_PROVIDER_DEFAULT_MODEL[storedProvider]);
2653
+ const storedKey = getStoredVisionApiKey(storedProvider);
2654
+ setVisionApiKey(storedKey ?? "");
2655
+ }
2656
+ }, [isOpen]);
2657
+ const handleVisionProviderChange = (e) => {
2658
+ const newProvider = e.target.value;
2659
+ setVisionProvider(newProvider);
2660
+ setStoredVisionProvider(newProvider);
2661
+ const storedKey = getStoredVisionApiKey(newProvider);
2662
+ setVisionApiKey(storedKey ?? "");
2663
+ setShowApiKey(false);
2664
+ const defaultModel = VISION_PROVIDER_DEFAULT_MODEL[newProvider];
2665
+ setVisionModel(defaultModel);
2666
+ setStoredVisionModel(defaultModel);
2667
+ };
2668
+ const handleVisionModelChange = (e) => {
2669
+ const newModel = e.target.value;
2670
+ setVisionModel(newModel);
2671
+ setStoredVisionModel(newModel);
2672
+ };
2673
+ const handleVisionApiKeyChange = (e) => {
2674
+ const v = e.target.value;
2675
+ setVisionApiKey(v);
2676
+ setStoredVisionApiKey(visionProvider, v || "");
2677
+ };
2548
2678
  if (!isOpen) return null;
2549
2679
  const isDark = theme === "dark";
2550
2680
  const bgColor = isDark ? "#1a1a1a" : "#ffffff";
@@ -2604,6 +2734,130 @@ var SettingsPanel = ({
2604
2734
  ),
2605
2735
  /* @__PURE__ */ jsxs("div", { style: { padding: "16px 20px" }, children: [
2606
2736
  /* @__PURE__ */ jsx(SettingRow, { label: "Theme", isDark, textColor, mutedColor, children: /* @__PURE__ */ jsx(ThemeIconToggle, { isDark, onToggle: () => onThemeChange(isDark ? "light" : "dark") }) }),
2737
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: 12 }, children: [
2738
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 14, color: textColor, marginBottom: 6, display: "flex", alignItems: "center", gap: 6 }, children: [
2739
+ "Vision API key",
2740
+ /* @__PURE__ */ jsx(
2741
+ InfoTooltip,
2742
+ {
2743
+ text: "Used to analyze drawing annotations so the AI understands what you've sketched.",
2744
+ isDark,
2745
+ mutedColor
2746
+ }
2747
+ )
2748
+ ] }),
2749
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
2750
+ /* @__PURE__ */ jsx(
2751
+ "input",
2752
+ {
2753
+ type: showApiKey ? "text" : "password",
2754
+ placeholder: "",
2755
+ value: visionApiKey,
2756
+ onChange: handleVisionApiKeyChange,
2757
+ autoComplete: "off",
2758
+ style: {
2759
+ width: "100%",
2760
+ boxSizing: "border-box",
2761
+ padding: "8px 32px 8px 10px",
2762
+ fontSize: 12,
2763
+ fontFamily: "monospace",
2764
+ border: `1px solid ${borderColor}`,
2765
+ borderRadius: 8,
2766
+ backgroundColor: isDark ? "#2a2a2a" : "#f5f5f5",
2767
+ color: textColor,
2768
+ outline: "none"
2769
+ }
2770
+ }
2771
+ ),
2772
+ visionApiKey && /* @__PURE__ */ jsx(
2773
+ "button",
2774
+ {
2775
+ type: "button",
2776
+ onClick: () => setShowApiKey(!showApiKey),
2777
+ title: showApiKey ? "Hide API key" : "Show API key",
2778
+ style: {
2779
+ position: "absolute",
2780
+ right: 6,
2781
+ top: "50%",
2782
+ transform: "translateY(-50%)",
2783
+ display: "flex",
2784
+ alignItems: "center",
2785
+ justifyContent: "center",
2786
+ width: 24,
2787
+ height: 24,
2788
+ border: "none",
2789
+ borderRadius: 4,
2790
+ backgroundColor: "transparent",
2791
+ cursor: "pointer",
2792
+ padding: 0,
2793
+ color: mutedColor
2794
+ },
2795
+ children: showApiKey ? /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2796
+ /* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94" }),
2797
+ /* @__PURE__ */ jsx("path", { d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19" }),
2798
+ /* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2799
+ ] }) : /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2800
+ /* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
2801
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
2802
+ ] })
2803
+ }
2804
+ )
2805
+ ] }),
2806
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 10, color: mutedColor, marginTop: 4, lineHeight: 1.3 }, children: [
2807
+ "Stored in this browser only. Get a key at",
2808
+ " ",
2809
+ /* @__PURE__ */ jsx(
2810
+ "a",
2811
+ {
2812
+ href: VISION_PROVIDER_KEY_LINKS[visionProvider].url,
2813
+ target: "_blank",
2814
+ rel: "noopener noreferrer",
2815
+ style: { color: isDark ? "#93c5fd" : "#2563eb" },
2816
+ children: VISION_PROVIDER_KEY_LINKS[visionProvider].label
2817
+ }
2818
+ )
2819
+ ] }),
2820
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, marginTop: 8 }, children: [
2821
+ /* @__PURE__ */ jsx(
2822
+ "select",
2823
+ {
2824
+ value: visionProvider,
2825
+ onChange: handleVisionProviderChange,
2826
+ style: {
2827
+ flex: 1,
2828
+ padding: "6px 8px",
2829
+ fontSize: 12,
2830
+ border: `1px solid ${borderColor}`,
2831
+ borderRadius: 6,
2832
+ backgroundColor: isDark ? "#2a2a2a" : "#f5f5f5",
2833
+ color: textColor,
2834
+ outline: "none",
2835
+ cursor: "pointer"
2836
+ },
2837
+ children: VISION_PROVIDERS.map((p) => /* @__PURE__ */ jsx("option", { value: p.value, children: p.label }, p.value))
2838
+ }
2839
+ ),
2840
+ /* @__PURE__ */ jsx(
2841
+ "select",
2842
+ {
2843
+ value: visionModel,
2844
+ onChange: handleVisionModelChange,
2845
+ style: {
2846
+ flex: 1.5,
2847
+ padding: "6px 8px",
2848
+ fontSize: 11,
2849
+ border: `1px solid ${borderColor}`,
2850
+ borderRadius: 6,
2851
+ backgroundColor: isDark ? "#2a2a2a" : "#f5f5f5",
2852
+ color: textColor,
2853
+ outline: "none",
2854
+ cursor: "pointer"
2855
+ },
2856
+ children: VISION_PROVIDER_MODELS[visionProvider].map((m) => /* @__PURE__ */ jsx("option", { value: m.value, children: m.label }, m.value))
2857
+ }
2858
+ )
2859
+ ] })
2860
+ ] }),
2607
2861
  !connected && /* @__PURE__ */ jsxs(
2608
2862
  "div",
2609
2863
  {
@@ -2689,6 +2943,70 @@ var SettingsPanel = ({
2689
2943
  }
2690
2944
  );
2691
2945
  };
2946
+ var InfoTooltip = ({ text, isDark, mutedColor }) => {
2947
+ const [show, setShow] = useState(false);
2948
+ return /* @__PURE__ */ jsxs(
2949
+ "span",
2950
+ {
2951
+ style: { position: "relative", display: "inline-flex" },
2952
+ onMouseEnter: () => setShow(true),
2953
+ onMouseLeave: () => setShow(false),
2954
+ children: [
2955
+ /* @__PURE__ */ jsxs(
2956
+ "svg",
2957
+ {
2958
+ width: "16",
2959
+ height: "16",
2960
+ viewBox: "0 0 16 16",
2961
+ fill: "none",
2962
+ style: { cursor: "help", flexShrink: 0 },
2963
+ children: [
2964
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: mutedColor, strokeWidth: "1.5" }),
2965
+ /* @__PURE__ */ jsx(
2966
+ "text",
2967
+ {
2968
+ x: "8",
2969
+ y: "12",
2970
+ textAnchor: "middle",
2971
+ fill: mutedColor,
2972
+ fontSize: "11",
2973
+ fontWeight: "600",
2974
+ fontStyle: "italic",
2975
+ fontFamily: 'Georgia, "Times New Roman", serif',
2976
+ children: "i"
2977
+ }
2978
+ )
2979
+ ]
2980
+ }
2981
+ ),
2982
+ show && /* @__PURE__ */ jsx(
2983
+ "div",
2984
+ {
2985
+ style: {
2986
+ position: "absolute",
2987
+ bottom: "100%",
2988
+ left: "50%",
2989
+ transform: "translateX(-50%)",
2990
+ marginBottom: 8,
2991
+ width: 240,
2992
+ padding: "10px 12px",
2993
+ borderRadius: 10,
2994
+ backgroundColor: isDark ? "#2a2a2a" : "#ffffff",
2995
+ border: `1px solid ${isDark ? "#444" : "#e0e0e0"}`,
2996
+ boxShadow: "0 4px 16px rgba(0,0,0,0.15)",
2997
+ fontSize: 11,
2998
+ lineHeight: 1.5,
2999
+ color: isDark ? "#ccc" : "#444",
3000
+ zIndex: 10,
3001
+ pointerEvents: "none"
3002
+ },
3003
+ children: text
3004
+ }
3005
+ )
3006
+ ]
3007
+ }
3008
+ );
3009
+ };
2692
3010
  var SettingRow = ({ label, textColor, disabled, children }) => /* @__PURE__ */ jsxs(
2693
3011
  "div",
2694
3012
  {
@@ -3440,26 +3758,24 @@ var Skema = ({
3440
3758
  const isProcessing = externalIsProcessing !== void 0 ? externalIsProcessing : internalIsProcessing || isGenerating;
3441
3759
  const internalOnAnnotationSubmit = useCallback(async (annotation, comment) => {
3442
3760
  if (!daemonState.connected) {
3443
- console.warn("[Skema] Not connected to daemon. Run: npx skema-serve");
3444
3761
  return;
3445
3762
  }
3446
3763
  setInternalIsProcessing(true);
3447
3764
  try {
3448
3765
  const result = await generate(
3449
3766
  { ...annotation, comment },
3450
- (event) => {
3451
- if (event.type === "text") {
3452
- console.log(`%c[Skema ${daemonState.provider}]`, "color: #10b981", event.content);
3453
- } else if (event.type === "error") {
3454
- console.error("[Skema Error]", event.content);
3455
- }
3767
+ () => {
3768
+ },
3769
+ {
3770
+ visionApiKey: getStoredVisionApiKey(getStoredVisionProvider()),
3771
+ visionProvider: getStoredVisionProvider(),
3772
+ visionModel: getStoredVisionModel() || void 0
3456
3773
  }
3457
3774
  );
3458
3775
  if (result.annotationId) {
3459
3776
  annotationChangesRef.current.set(annotation.id, result.annotationId);
3460
3777
  }
3461
- } catch (error) {
3462
- console.error("[Skema] Failed to generate:", error);
3778
+ } catch {
3463
3779
  } finally {
3464
3780
  setInternalIsProcessing(false);
3465
3781
  }
@@ -3472,8 +3788,7 @@ var Skema = ({
3472
3788
  try {
3473
3789
  await revert(trackedId);
3474
3790
  annotationChangesRef.current.delete(annotationId);
3475
- } catch (error) {
3476
- console.error("[Skema] Failed to revert:", error);
3791
+ } catch {
3477
3792
  }
3478
3793
  }, [revert]);
3479
3794
  const internalOnProcessingCancel = useCallback(() => {
@@ -3809,22 +4124,19 @@ var Skema = ({
3809
4124
  if (svgResult?.svg) {
3810
4125
  drawingSvg = addGridToSvg(svgResult.svg, gridConfig);
3811
4126
  }
3812
- } catch (e) {
3813
- console.warn("[Skema] Failed to export drawing SVG:", e);
4127
+ } catch {
3814
4128
  }
3815
4129
  try {
3816
4130
  const imageResult = await editor.toImage(shapeIds, { format: "png", padding: 20, background: true });
3817
4131
  if (imageResult?.blob) {
3818
4132
  drawingImage = await blobToBase64(imageResult.blob);
3819
4133
  }
3820
- } catch (e) {
3821
- console.warn("[Skema] Failed to export drawing image:", e);
4134
+ } catch {
3822
4135
  }
3823
4136
  try {
3824
4137
  const shapes = shapeIds.map((id) => editor.getShape(id)).filter(Boolean);
3825
4138
  extractedText = extractTextFromShapes(shapes);
3826
- } catch (e) {
3827
- console.warn("[Skema] Failed to extract text from shapes:", e);
4139
+ } catch {
3828
4140
  }
3829
4141
  }
3830
4142
  const nearbyElements = pendingAnnotation.boundingBox ? findNearbyElementsWithStyles(pendingAnnotation.boundingBox, 5) : [];
@@ -3904,7 +4216,6 @@ var Skema = ({
3904
4216
  annotations
3905
4217
  };
3906
4218
  navigator.clipboard.writeText(JSON.stringify(exportData, null, 2));
3907
- console.log("[Skema] Exported annotations:", exportData);
3908
4219
  alert("Annotations copied to clipboard!");
3909
4220
  }, [annotations]);
3910
4221
  const handleBrushSelection = useCallback((brushBounds) => {
@@ -4031,8 +4342,7 @@ var Skema = ({
4031
4342
  }
4032
4343
  };
4033
4344
  }
4034
- } catch (e) {
4035
- console.warn("Failed to override double click behavior", e);
4345
+ } catch {
4036
4346
  }
4037
4347
  editor.setCamera({ x: -window.scrollX, y: -window.scrollY, z: 1 });
4038
4348
  editor.sideEffects.registerAfterChangeHandler("camera", () => {
@@ -4111,11 +4421,21 @@ var Skema = ({
4111
4421
  ${isToolbarExpanded && (currentToolId === "draw" || currentToolId === "geo") ? "" : "display: none !important;"}
4112
4422
  }
4113
4423
  ` }),
4114
- isToolbarExpanded && /* @__PURE__ */ jsx(
4424
+ /* @__PURE__ */ jsx("style", { children: `
4425
+ @keyframes skema-pulse {
4426
+ 0%, 100% { transform: scale(1); opacity: 1; }
4427
+ 50% { transform: scale(1.15); opacity: 0.8; }
4428
+ }
4429
+ @keyframes skema-glow {
4430
+ 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
4431
+ 50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
4432
+ }
4433
+ ` }),
4434
+ isToolbarExpanded && /* @__PURE__ */ jsxs(
4115
4435
  "button",
4116
4436
  {
4117
4437
  onClick: () => setIsStylePanelOpen((prev) => !prev),
4118
- title: isStylePanelOpen ? "Hide style settings" : "Show style settings",
4438
+ title: isStylePanelOpen ? "Hide style settings" : !daemonState.connected ? "Daemon not connected - click to configure" : "Show style settings",
4119
4439
  style: {
4120
4440
  position: "fixed",
4121
4441
  bottom: 16,
@@ -4126,36 +4446,68 @@ var Skema = ({
4126
4446
  alignItems: "center",
4127
4447
  justifyContent: "center",
4128
4448
  backgroundColor: isStylePanelOpen ? "#FF6800" : isDark ? "#2a2a2a" : "white",
4129
- border: "none",
4449
+ border: !daemonState.connected && !isStylePanelOpen ? "2px solid #ef4444" : "none",
4130
4450
  borderRadius: 12,
4131
4451
  boxShadow: "0 2px 10px rgba(0,0,0,0.15)",
4132
4452
  cursor: "pointer",
4133
4453
  pointerEvents: "auto",
4134
4454
  zIndex: zIndex + 5,
4135
- transition: "all 0.2s ease"
4455
+ transition: "all 0.2s ease",
4456
+ animation: !daemonState.connected && !isStylePanelOpen ? "skema-glow 2s ease-in-out infinite" : "none"
4136
4457
  },
4137
- children: /* @__PURE__ */ jsxs("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
4138
- /* @__PURE__ */ jsx(
4139
- "path",
4140
- {
4141
- d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
4142
- stroke: isStylePanelOpen ? "white" : isDark ? "#9CA3AF" : "#6B7280",
4143
- strokeWidth: "2",
4144
- strokeLinecap: "round",
4145
- strokeLinejoin: "round"
4146
- }
4147
- ),
4148
- /* @__PURE__ */ jsx(
4149
- "path",
4458
+ children: [
4459
+ /* @__PURE__ */ jsxs("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
4460
+ /* @__PURE__ */ jsx(
4461
+ "path",
4462
+ {
4463
+ d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
4464
+ stroke: isStylePanelOpen ? "white" : isDark ? "#9CA3AF" : "#6B7280",
4465
+ strokeWidth: "2",
4466
+ strokeLinecap: "round",
4467
+ strokeLinejoin: "round"
4468
+ }
4469
+ ),
4470
+ /* @__PURE__ */ jsx(
4471
+ "path",
4472
+ {
4473
+ d: "M19.4 15C19.2669 15.3016 19.2272 15.6362 19.286 15.9606C19.3448 16.285 19.4995 16.5843 19.73 16.82L19.79 16.88C19.976 17.0657 20.1235 17.2863 20.2241 17.5291C20.3248 17.7719 20.3766 18.0322 20.3766 18.295C20.3766 18.5578 20.3248 18.8181 20.2241 19.0609C20.1235 19.3037 19.976 19.5243 19.79 19.71C19.6043 19.896 19.3837 20.0435 19.1409 20.1441C18.8981 20.2448 18.6378 20.2966 18.375 20.2966C18.1122 20.2966 17.8519 20.2448 17.6091 20.1441C17.3663 20.0435 17.1457 19.896 16.96 19.71L16.9 19.65C16.6643 19.4195 16.365 19.2648 16.0406 19.206C15.7162 19.1472 15.3816 19.1869 15.08 19.32C14.7842 19.4468 14.532 19.6572 14.3543 19.9255C14.1766 20.1938 14.0813 20.5082 14.08 20.83V21C14.08 21.5304 13.8693 22.0391 13.4942 22.4142C13.1191 22.7893 12.6104 23 12.08 23C11.5496 23 11.0409 22.7893 10.6658 22.4142C10.2907 22.0391 10.08 21.5304 10.08 21V20.91C10.0723 20.579 9.96512 20.258 9.77251 19.9887C9.5799 19.7194 9.31074 19.5143 9 19.4C8.69838 19.2669 8.36381 19.2272 8.03941 19.286C7.71502 19.3448 7.41568 19.4995 7.18 19.73L7.12 19.79C6.93425 19.976 6.71368 20.1235 6.47088 20.2241C6.22808 20.3248 5.96783 20.3766 5.705 20.3766C5.44217 20.3766 5.18192 20.3248 4.93912 20.2241C4.69632 20.1235 4.47575 19.976 4.29 19.79C4.10405 19.6043 3.95653 19.3837 3.85588 19.1409C3.75523 18.8981 3.70343 18.6378 3.70343 18.375C3.70343 18.1122 3.75523 17.8519 3.85588 17.6091C3.95653 17.3663 4.10405 17.1457 4.29 16.96L4.35 16.9C4.58054 16.6643 4.73519 16.365 4.794 16.0406C4.85282 15.7162 4.81312 15.3816 4.68 15.08C4.55324 14.7842 4.34276 14.532 4.07447 14.3543C3.80618 14.1766 3.49179 14.0813 3.17 14.08H3C2.46957 14.08 1.96086 13.8693 1.58579 13.4942C1.21071 13.1191 1 12.6104 1 12.08C1 11.5496 1.21071 11.0409 1.58579 10.6658C1.96086 10.2907 2.46957 10.08 3 10.08H3.09C3.42099 10.0723 3.742 9.96512 4.0113 9.77251C4.28059 9.5799 4.48572 9.31074 4.6 9C4.73312 8.69838 4.77282 8.36381 4.714 8.03941C4.65519 7.71502 4.50054 7.41568 4.27 7.18L4.21 7.12C4.02405 6.93425 3.87653 6.71368 3.77588 6.47088C3.67523 6.22808 3.62343 5.96783 3.62343 5.705C3.62343 5.44217 3.67523 5.18192 3.77588 4.93912C3.87653 4.69632 4.02405 4.47575 4.21 4.29C4.39575 4.10405 4.61632 3.95653 4.85912 3.85588C5.10192 3.75523 5.36217 3.70343 5.625 3.70343C5.88783 3.70343 6.14808 3.75523 6.39088 3.85588C6.63368 3.95653 6.85425 4.10405 7.04 4.29L7.1 4.35C7.33568 4.58054 7.63502 4.73519 7.95941 4.794C8.28381 4.85282 8.61838 4.81312 8.92 4.68H9C9.29577 4.55324 9.54802 4.34276 9.72569 4.07447C9.90337 3.80618 9.99872 3.49179 10 3.17V3C10 2.46957 10.2107 1.96086 10.5858 1.58579C10.9609 1.21071 11.4696 1 12 1C12.5304 1 13.0391 1.21071 13.4142 1.58579C13.7893 1.96086 14 2.46957 14 3V3.09C14.0013 3.41179 14.0966 3.72618 14.2743 3.99447C14.452 4.26276 14.7042 4.47324 15 4.6C15.3016 4.73312 15.6362 4.77282 15.9606 4.714C16.285 4.65519 16.5843 4.50054 16.82 4.27L16.88 4.21C17.0657 4.02405 17.2863 3.87653 17.5291 3.77588C17.7719 3.67523 18.0322 3.62343 18.295 3.62343C18.5578 3.62343 18.8181 3.67523 19.0609 3.77588C19.3037 3.87653 19.5243 4.02405 19.71 4.21C19.896 4.39575 20.0435 4.61632 20.1441 4.85912C20.2448 5.10192 20.2966 5.36217 20.2966 5.625C20.2966 5.88783 20.2448 6.14808 20.1441 6.39088C20.0435 6.63368 19.896 6.85425 19.71 7.04L19.65 7.1C19.4195 7.33568 19.2648 7.63502 19.206 7.95941C19.1472 8.28381 19.1869 8.61838 19.32 8.92V9C19.4468 9.29577 19.6572 9.54802 19.9255 9.72569C20.1938 9.90337 20.5082 9.99872 20.83 10H21C21.5304 10 22.0391 10.2107 22.4142 10.5858C22.7893 10.9609 23 11.4696 23 12C23 12.5304 22.7893 13.0391 22.4142 13.4142C22.0391 13.7893 21.5304 14 21 14H20.91C20.5882 14.0013 20.2738 14.0966 20.0055 14.2743C19.7372 14.452 19.5268 14.7042 19.4 15Z",
4474
+ stroke: isStylePanelOpen ? "white" : isDark ? "#9CA3AF" : "#6B7280",
4475
+ strokeWidth: "2",
4476
+ strokeLinecap: "round",
4477
+ strokeLinejoin: "round"
4478
+ }
4479
+ )
4480
+ ] }),
4481
+ !daemonState.connected && !isStylePanelOpen && /* @__PURE__ */ jsx(
4482
+ "div",
4150
4483
  {
4151
- d: "M19.4 15C19.2669 15.3016 19.2272 15.6362 19.286 15.9606C19.3448 16.285 19.4995 16.5843 19.73 16.82L19.79 16.88C19.976 17.0657 20.1235 17.2863 20.2241 17.5291C20.3248 17.7719 20.3766 18.0322 20.3766 18.295C20.3766 18.5578 20.3248 18.8181 20.2241 19.0609C20.1235 19.3037 19.976 19.5243 19.79 19.71C19.6043 19.896 19.3837 20.0435 19.1409 20.1441C18.8981 20.2448 18.6378 20.2966 18.375 20.2966C18.1122 20.2966 17.8519 20.2448 17.6091 20.1441C17.3663 20.0435 17.1457 19.896 16.96 19.71L16.9 19.65C16.6643 19.4195 16.365 19.2648 16.0406 19.206C15.7162 19.1472 15.3816 19.1869 15.08 19.32C14.7842 19.4468 14.532 19.6572 14.3543 19.9255C14.1766 20.1938 14.0813 20.5082 14.08 20.83V21C14.08 21.5304 13.8693 22.0391 13.4942 22.4142C13.1191 22.7893 12.6104 23 12.08 23C11.5496 23 11.0409 22.7893 10.6658 22.4142C10.2907 22.0391 10.08 21.5304 10.08 21V20.91C10.0723 20.579 9.96512 20.258 9.77251 19.9887C9.5799 19.7194 9.31074 19.5143 9 19.4C8.69838 19.2669 8.36381 19.2272 8.03941 19.286C7.71502 19.3448 7.41568 19.4995 7.18 19.73L7.12 19.79C6.93425 19.976 6.71368 20.1235 6.47088 20.2241C6.22808 20.3248 5.96783 20.3766 5.705 20.3766C5.44217 20.3766 5.18192 20.3248 4.93912 20.2241C4.69632 20.1235 4.47575 19.976 4.29 19.79C4.10405 19.6043 3.95653 19.3837 3.85588 19.1409C3.75523 18.8981 3.70343 18.6378 3.70343 18.375C3.70343 18.1122 3.75523 17.8519 3.85588 17.6091C3.95653 17.3663 4.10405 17.1457 4.29 16.96L4.35 16.9C4.58054 16.6643 4.73519 16.365 4.794 16.0406C4.85282 15.7162 4.81312 15.3816 4.68 15.08C4.55324 14.7842 4.34276 14.532 4.07447 14.3543C3.80618 14.1766 3.49179 14.0813 3.17 14.08H3C2.46957 14.08 1.96086 13.8693 1.58579 13.4942C1.21071 13.1191 1 12.6104 1 12.08C1 11.5496 1.21071 11.0409 1.58579 10.6658C1.96086 10.2907 2.46957 10.08 3 10.08H3.09C3.42099 10.0723 3.742 9.96512 4.0113 9.77251C4.28059 9.5799 4.48572 9.31074 4.6 9C4.73312 8.69838 4.77282 8.36381 4.714 8.03941C4.65519 7.71502 4.50054 7.41568 4.27 7.18L4.21 7.12C4.02405 6.93425 3.87653 6.71368 3.77588 6.47088C3.67523 6.22808 3.62343 5.96783 3.62343 5.705C3.62343 5.44217 3.67523 5.18192 3.77588 4.93912C3.87653 4.69632 4.02405 4.47575 4.21 4.29C4.39575 4.10405 4.61632 3.95653 4.85912 3.85588C5.10192 3.75523 5.36217 3.70343 5.625 3.70343C5.88783 3.70343 6.14808 3.75523 6.39088 3.85588C6.63368 3.95653 6.85425 4.10405 7.04 4.29L7.1 4.35C7.33568 4.58054 7.63502 4.73519 7.95941 4.794C8.28381 4.85282 8.61838 4.81312 8.92 4.68H9C9.29577 4.55324 9.54802 4.34276 9.72569 4.07447C9.90337 3.80618 9.99872 3.49179 10 3.17V3C10 2.46957 10.2107 1.96086 10.5858 1.58579C10.9609 1.21071 11.4696 1 12 1C12.5304 1 13.0391 1.21071 13.4142 1.58579C13.7893 1.96086 14 2.46957 14 3V3.09C14.0013 3.41179 14.0966 3.72618 14.2743 3.99447C14.452 4.26276 14.7042 4.47324 15 4.6C15.3016 4.73312 15.6362 4.77282 15.9606 4.714C16.285 4.65519 16.5843 4.50054 16.82 4.27L16.88 4.21C17.0657 4.02405 17.2863 3.87653 17.5291 3.77588C17.7719 3.67523 18.0322 3.62343 18.295 3.62343C18.5578 3.62343 18.8181 3.67523 19.0609 3.77588C19.3037 3.87653 19.5243 4.02405 19.71 4.21C19.896 4.39575 20.0435 4.61632 20.1441 4.85912C20.2448 5.10192 20.2966 5.36217 20.2966 5.625C20.2966 5.88783 20.2448 6.14808 20.1441 6.39088C20.0435 6.63368 19.896 6.85425 19.71 7.04L19.65 7.1C19.4195 7.33568 19.2648 7.63502 19.206 7.95941C19.1472 8.28381 19.1869 8.61838 19.32 8.92V9C19.4468 9.29577 19.6572 9.54802 19.9255 9.72569C20.1938 9.90337 20.5082 9.99872 20.83 10H21C21.5304 10 22.0391 10.2107 22.4142 10.5858C22.7893 10.9609 23 11.4696 23 12C23 12.5304 22.7893 13.0391 22.4142 13.4142C22.0391 13.7893 21.5304 14 21 14H20.91C20.5882 14.0013 20.2738 14.0966 20.0055 14.2743C19.7372 14.452 19.5268 14.7042 19.4 15Z",
4152
- stroke: isStylePanelOpen ? "white" : isDark ? "#9CA3AF" : "#6B7280",
4153
- strokeWidth: "2",
4154
- strokeLinecap: "round",
4155
- strokeLinejoin: "round"
4484
+ style: {
4485
+ position: "absolute",
4486
+ top: -4,
4487
+ right: -4,
4488
+ width: 20,
4489
+ height: 20,
4490
+ backgroundColor: "#ef4444",
4491
+ borderRadius: "50%",
4492
+ display: "flex",
4493
+ alignItems: "center",
4494
+ justifyContent: "center",
4495
+ animation: "skema-pulse 2s ease-in-out infinite",
4496
+ boxShadow: "0 2px 4px rgba(239, 68, 68, 0.4)"
4497
+ },
4498
+ children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
4499
+ "path",
4500
+ {
4501
+ d: "M12 9V13M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",
4502
+ stroke: "white",
4503
+ strokeWidth: "2.5",
4504
+ strokeLinecap: "round",
4505
+ strokeLinejoin: "round"
4506
+ }
4507
+ ) })
4156
4508
  }
4157
4509
  )
4158
- ] })
4510
+ ]
4159
4511
  }
4160
4512
  ),
4161
4513
  /* @__PURE__ */ jsx(