@ohhwells/bridge 0.1.40 → 0.1.42

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.d.cts CHANGED
@@ -132,6 +132,26 @@ declare function SchedulingWidget({ notifyOnConnect, initialScheduleId, insertAf
132
132
 
133
133
  declare const DragHandle: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
134
134
 
135
+ /**
136
+ * Visual drop-gap line for navbar / footer / repeater reorder.
137
+ * Figma: Custom/Drop Indicator (8140:1731) — CSS class `.ov-gap-line`
138
+ *
139
+ * Opacity (Figma docs):
140
+ * - default: 0 (hidden)
141
+ * - hover: 1
142
+ * - dragIdle: 0.4
143
+ * - dragActive: 1
144
+ */
145
+ declare const dropIndicatorVariants: (props?: ({
146
+ direction?: "horizontal" | "vertical" | null | undefined;
147
+ state?: "default" | "hover" | "dragIdle" | "dragActive" | null | undefined;
148
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
149
+ type DropIndicatorProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof dropIndicatorVariants>;
150
+ declare const DropIndicator: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
151
+ direction?: "horizontal" | "vertical" | null | undefined;
152
+ state?: "default" | "hover" | "dragIdle" | "dragActive" | null | undefined;
153
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
154
+
135
155
  declare const CustomToolbar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
136
156
  declare function CustomToolbarDivider({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
137
157
  declare const CustomToolbarButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -175,4 +195,4 @@ declare function TooltipContent({ className, sideOffset, side, children, ...prop
175
195
 
176
196
  declare function isEditSessionActive(): boolean;
177
197
 
178
- export { CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, validateUrlInput };
198
+ export { CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, validateUrlInput };
package/dist/index.d.ts CHANGED
@@ -132,6 +132,26 @@ declare function SchedulingWidget({ notifyOnConnect, initialScheduleId, insertAf
132
132
 
133
133
  declare const DragHandle: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
134
134
 
135
+ /**
136
+ * Visual drop-gap line for navbar / footer / repeater reorder.
137
+ * Figma: Custom/Drop Indicator (8140:1731) — CSS class `.ov-gap-line`
138
+ *
139
+ * Opacity (Figma docs):
140
+ * - default: 0 (hidden)
141
+ * - hover: 1
142
+ * - dragIdle: 0.4
143
+ * - dragActive: 1
144
+ */
145
+ declare const dropIndicatorVariants: (props?: ({
146
+ direction?: "horizontal" | "vertical" | null | undefined;
147
+ state?: "default" | "hover" | "dragIdle" | "dragActive" | null | undefined;
148
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
149
+ type DropIndicatorProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof dropIndicatorVariants>;
150
+ declare const DropIndicator: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
151
+ direction?: "horizontal" | "vertical" | null | undefined;
152
+ state?: "default" | "hover" | "dragIdle" | "dragActive" | null | undefined;
153
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
154
+
135
155
  declare const CustomToolbar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
136
156
  declare function CustomToolbarDivider({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
137
157
  declare const CustomToolbarButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -175,4 +195,4 @@ declare function TooltipContent({ className, sideOffset, side, children, ...prop
175
195
 
176
196
  declare function isEditSessionActive(): boolean;
177
197
 
178
- export { CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, validateUrlInput };
198
+ export { CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, validateUrlInput };
package/dist/index.js CHANGED
@@ -7014,6 +7014,22 @@ function placeCaretAtPoint(el, x, y) {
7014
7014
  }
7015
7015
  }
7016
7016
  }
7017
+ function selectAllTextInEditable(el) {
7018
+ const selection = window.getSelection();
7019
+ if (!selection) return;
7020
+ const range = document.createRange();
7021
+ range.selectNodeContents(el);
7022
+ selection.removeAllRanges();
7023
+ selection.addRange(range);
7024
+ }
7025
+ function getNavigationLabelEditable(target) {
7026
+ const editable = target.closest('[data-ohw-editable="text"]');
7027
+ if (!editable) return null;
7028
+ const hrefCtx = getHrefKeyFromElement(editable);
7029
+ const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
7030
+ if (!navAnchor) return null;
7031
+ return { editable, navAnchor };
7032
+ }
7017
7033
  function collectSections() {
7018
7034
  return collectSectionsFromDom();
7019
7035
  }
@@ -8158,6 +8174,7 @@ function OhhwellsBridge() {
8158
8174
  e.preventDefault();
8159
8175
  e.stopPropagation();
8160
8176
  if (selectedElRef.current === navAnchor) {
8177
+ if (e.detail >= 2) return;
8161
8178
  activateRef.current(editable, { caretX: e.clientX, caretY: e.clientY });
8162
8179
  return;
8163
8180
  }
@@ -8218,6 +8235,28 @@ function OhhwellsBridge() {
8218
8235
  deselectRef.current();
8219
8236
  deactivateRef.current();
8220
8237
  };
8238
+ const handleDblClick = (e) => {
8239
+ const target = e.target;
8240
+ if (target.closest("[data-ohw-toolbar]")) return;
8241
+ if (target.closest("[data-ohw-state-toggle]")) return;
8242
+ if (target.closest("[data-ohw-max-badge]")) return;
8243
+ if (isInsideLinkEditor(target)) return;
8244
+ if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
8245
+ return;
8246
+ }
8247
+ const navLabel = getNavigationLabelEditable(target);
8248
+ if (!navLabel) return;
8249
+ const { editable } = navLabel;
8250
+ e.preventDefault();
8251
+ e.stopPropagation();
8252
+ if (activeElRef.current !== editable) {
8253
+ activateRef.current(editable);
8254
+ }
8255
+ requestAnimationFrame(() => {
8256
+ selectAllTextInEditable(editable);
8257
+ refreshActiveCommandsRef.current();
8258
+ });
8259
+ };
8221
8260
  const handleMouseOver = (e) => {
8222
8261
  if (document.documentElement.hasAttribute("data-ohw-section-picking")) return;
8223
8262
  const target = e.target;
@@ -8939,6 +8978,15 @@ function OhhwellsBridge() {
8939
8978
  window.addEventListener("message", handleUiEscape);
8940
8979
  const handleKeyDown = (e) => {
8941
8980
  if (e.key === "Escape" && document.querySelector("[data-ohw-section-picker]")) return;
8981
+ if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" && activeElRef.current) {
8982
+ const navAnchor = getNavigationItemAnchor(activeElRef.current);
8983
+ if (navAnchor) {
8984
+ e.preventDefault();
8985
+ selectAllTextInEditable(activeElRef.current);
8986
+ refreshActiveCommandsRef.current();
8987
+ return;
8988
+ }
8989
+ }
8942
8990
  if (e.key === "Escape" && linkPopoverOpenRef.current) {
8943
8991
  setLinkPopoverRef.current(null);
8944
8992
  return;
@@ -9271,6 +9319,7 @@ function OhhwellsBridge() {
9271
9319
  };
9272
9320
  window.addEventListener("resize", handleViewportResize, { passive: true });
9273
9321
  document.addEventListener("click", handleClick, true);
9322
+ document.addEventListener("dblclick", handleDblClick, true);
9274
9323
  document.addEventListener("paste", handlePaste, true);
9275
9324
  document.addEventListener("input", handleInput, true);
9276
9325
  document.addEventListener("mouseover", handleMouseOver, true);
@@ -9285,6 +9334,7 @@ function OhhwellsBridge() {
9285
9334
  window.addEventListener("scroll", handleScroll, true);
9286
9335
  return () => {
9287
9336
  document.removeEventListener("click", handleClick, true);
9337
+ document.removeEventListener("dblclick", handleDblClick, true);
9288
9338
  document.removeEventListener("paste", handlePaste, true);
9289
9339
  document.removeEventListener("input", handleInput, true);
9290
9340
  document.removeEventListener("mouseover", handleMouseOver, true);
@@ -9671,11 +9721,54 @@ function OhhwellsBridge() {
9671
9721
  bridgeRoot
9672
9722
  ) : null;
9673
9723
  }
9724
+
9725
+ // src/ui/drop-indicator.tsx
9726
+ import * as React10 from "react";
9727
+ import { jsx as jsx24 } from "react/jsx-runtime";
9728
+ var dropIndicatorVariants = cva(
9729
+ "ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
9730
+ {
9731
+ variants: {
9732
+ direction: {
9733
+ vertical: "h-6 w-[3px]",
9734
+ horizontal: "h-[3px] w-[200px]"
9735
+ },
9736
+ state: {
9737
+ default: "opacity-0",
9738
+ hover: "opacity-100",
9739
+ dragIdle: "opacity-40",
9740
+ dragActive: "opacity-100"
9741
+ }
9742
+ },
9743
+ defaultVariants: {
9744
+ direction: "vertical",
9745
+ state: "default"
9746
+ }
9747
+ }
9748
+ );
9749
+ var DropIndicator = React10.forwardRef(
9750
+ ({ className, direction, state, ...props }, ref) => {
9751
+ return /* @__PURE__ */ jsx24(
9752
+ "div",
9753
+ {
9754
+ ref,
9755
+ "data-slot": "drop-indicator",
9756
+ "data-direction": direction ?? "vertical",
9757
+ "data-state": state ?? "default",
9758
+ "aria-hidden": "true",
9759
+ className: cn(dropIndicatorVariants({ direction, state }), className),
9760
+ ...props
9761
+ }
9762
+ );
9763
+ }
9764
+ );
9765
+ DropIndicator.displayName = "DropIndicator";
9674
9766
  export {
9675
9767
  CustomToolbar,
9676
9768
  CustomToolbarButton,
9677
9769
  CustomToolbarDivider,
9678
9770
  DragHandle,
9771
+ DropIndicator,
9679
9772
  ItemActionToolbar,
9680
9773
  ItemInteractionLayer,
9681
9774
  LinkEditorPanel,
@@ -9690,6 +9783,7 @@ export {
9690
9783
  TooltipProvider,
9691
9784
  TooltipTrigger,
9692
9785
  buildTarget,
9786
+ dropIndicatorVariants,
9693
9787
  filterAvailablePages,
9694
9788
  getEditModeInitialState,
9695
9789
  isEditSessionActive,