@framed-dev/react 0.3.0 → 0.3.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
@@ -3387,7 +3387,8 @@ function ElementSelector({ onSelect }) {
3387
3387
  }
3388
3388
  function TextEditOverlay({
3389
3389
  onSubmit,
3390
- author = "Anonymous"
3390
+ author = "Anonymous",
3391
+ demoMode = false
3391
3392
  }) {
3392
3393
  const textareaRef = useRef(null);
3393
3394
  const {
@@ -3403,13 +3404,6 @@ function TextEditOverlay({
3403
3404
  showToast
3404
3405
  } = useWidgetStore();
3405
3406
  const isOpen = annotationMode === "text-edit" && selectedElement && originalText;
3406
- useEffect(() => {
3407
- if (isOpen && textareaRef.current) {
3408
- textareaRef.current.focus();
3409
- textareaRef.current.select();
3410
- isolateKeyboardEvents(textareaRef.current);
3411
- }
3412
- }, [isOpen]);
3413
3407
  const getElementPath2 = useCallback(() => {
3414
3408
  if (!selectedElement) return "";
3415
3409
  const parts = [];
@@ -3430,7 +3424,8 @@ function TextEditOverlay({
3430
3424
  }
3431
3425
  clearSelection();
3432
3426
  closeQuickInput();
3433
- }, [selectedElement, originalText, clearSelection, closeQuickInput]);
3427
+ setAnnotationMode(null);
3428
+ }, [selectedElement, originalText, clearSelection, closeQuickInput, setAnnotationMode]);
3434
3429
  const handleApply = useCallback(() => {
3435
3430
  const newText = textareaRef.current?.value || "";
3436
3431
  if (!selectedElement) {
@@ -3500,9 +3495,30 @@ To: "${newText.substring(0, 150)}${newText.length > 150 ? "..." : ""}"`;
3500
3495
  showToast,
3501
3496
  handleClose
3502
3497
  ]);
3498
+ useEffect(() => {
3499
+ if (isOpen && textareaRef.current) {
3500
+ textareaRef.current.focus();
3501
+ textareaRef.current.select();
3502
+ isolateKeyboardEvents(textareaRef.current);
3503
+ }
3504
+ }, [isOpen]);
3505
+ useEffect(() => {
3506
+ if (!isOpen) return;
3507
+ const handleKeyDown = (e) => {
3508
+ if (e.key === "Escape") {
3509
+ e.preventDefault();
3510
+ e.stopPropagation();
3511
+ handleClose();
3512
+ }
3513
+ };
3514
+ document.addEventListener("keydown", handleKeyDown, true);
3515
+ return () => {
3516
+ document.removeEventListener("keydown", handleKeyDown, true);
3517
+ };
3518
+ }, [isOpen, handleClose]);
3503
3519
  const displayOriginal = originalText && originalText.length > 200 ? originalText.substring(0, 200) + "..." : originalText || "";
3504
3520
  if (!isOpen) return null;
3505
- return /* @__PURE__ */ jsxs("div", { className: "framed-text-edit-overlay", "data-framed-widget": true, children: [
3521
+ return /* @__PURE__ */ jsx("div", { className: `framed-text-edit-container ${demoMode ? "framed-demo-mode" : ""}`, "data-framed-widget": true, children: /* @__PURE__ */ jsxs("div", { className: `framed-text-edit-overlay ${demoMode ? "framed-demo-mode" : ""}`, "data-framed-widget": true, children: [
3506
3522
  /* @__PURE__ */ jsxs("div", { className: "framed-text-edit-header", children: [
3507
3523
  /* @__PURE__ */ jsx("span", { className: "framed-text-edit-label-header", children: "Text Edit" }),
3508
3524
  /* @__PURE__ */ jsx("span", { className: "framed-text-edit-divider", children: "|" }),
@@ -3572,7 +3588,7 @@ To: "${newText.substring(0, 150)}${newText.length > 150 ? "..." : ""}"`;
3572
3588
  }
3573
3589
  )
3574
3590
  ] })
3575
- ] });
3591
+ ] }) });
3576
3592
  }
3577
3593
  function RegionSelectOverlay() {
3578
3594
  const {
@@ -6641,6 +6657,32 @@ var WIDGET_CSS = `/* Framed Widget Styles - Figma-style floating toolbar */
6641
6657
  transform: scale(1);
6642
6658
  }
6643
6659
  }
6660
+
6661
+ /* Text Edit Overlay - Demo mode (flexbox centering to avoid transform conflicts) */
6662
+ .framed-text-edit-container.framed-demo-mode {
6663
+ position: fixed;
6664
+ top: 0;
6665
+ left: 0;
6666
+ width: 100vw;
6667
+ height: 100vh;
6668
+ display: flex;
6669
+ align-items: center;
6670
+ justify-content: center;
6671
+ pointer-events: none;
6672
+ z-index: 2147483647;
6673
+ }
6674
+
6675
+ .framed-text-edit-overlay.framed-demo-mode {
6676
+ /* Reset transform-based positioning */
6677
+ position: relative !important;
6678
+ top: auto !important;
6679
+ left: auto !important;
6680
+ bottom: auto !important;
6681
+ transform: none !important;
6682
+ /* Use a simple scale animation without translate */
6683
+ animation: framed-demo-scale-in 0.3s var(--framed-ease-spring) forwards !important;
6684
+ pointer-events: auto;
6685
+ }
6644
6686
  `;
6645
6687
  var WIDGET_STYLE_ID = "framed-widget-styles";
6646
6688
  function Widget({
@@ -6791,7 +6833,7 @@ function Widget({
6791
6833
  /* @__PURE__ */ jsx(FeedbackDrawer, { onExport, onLocateComment }),
6792
6834
  /* @__PURE__ */ jsx(QuickInput, { author, onSubmit, demoMode, onCommentAdded: demoMode ? openFeedbackPanel : void 0 }),
6793
6835
  /* @__PURE__ */ jsx(ChatModal, { author, onSubmit }),
6794
- /* @__PURE__ */ jsx(TextEditOverlay, { author, onSubmit }),
6836
+ /* @__PURE__ */ jsx(TextEditOverlay, { author, onSubmit, demoMode }),
6795
6837
  /* @__PURE__ */ jsx(RegionSelectOverlay, {}),
6796
6838
  /* @__PURE__ */ jsx(ExportModal, {}),
6797
6839
  animationsPaused && /* @__PURE__ */ jsxs("div", { className: "framed-animations-paused-indicator", "data-framed-widget": true, children: [