@kolkrabbi/kol-component 0.387.0 → 0.389.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.
@@ -163,8 +163,9 @@ export function usePopover({
163
163
  const anchorEl = (anchor) => (anchor && 'current' in anchor ? anchor.current : anchor)
164
164
  const later = (a, b) => !!(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)
165
165
  /* spend a press: stop it here, and swallow the mouse events and the click it raises until the press ends. Several
166
- layers may close on one press; the first spends it, the rest find it stopped and do nothing more. */
167
- function spend(e) {
166
+ layers may close on one press; the first spends it, the rest find it stopped and do nothing more. Menu's press outside
167
+ spends a press on the canvas the same way (plan-2026-11-29-one-set-fold W3). */
168
+ export function spend(e) {
168
169
  if (e.cancelBubble) return
169
170
  e.stopPropagation(); e.preventDefault()
170
171
  const stop = (ev) => { ev.stopPropagation(); ev.preventDefault() }
@@ -555,6 +556,9 @@ function PopoverPanelOn({
555
556
  motion,
556
557
  className = '',
557
558
  style: extraStyle,
559
+ /* Menu's panel (plan-2026-11-29-one-set-fold W3): its own attributes and handlers on the floating node, and its ref */
560
+ floatingProps,
561
+ panelRef,
558
562
  }) {
559
563
  const depth = useContext(FloatDepth)
560
564
  const fm = motion == null ? null : floatMotion(motion)
@@ -577,13 +581,13 @@ function PopoverPanelOn({
577
581
  * for non-editor consumers since they ignore the attr. */
578
582
  const node = (
579
583
  <div
580
- ref={refs.setFloating}
584
+ ref={panelRef ? (n) => { refs.setFloating(n); panelRef(n) } : refs.setFloating}
581
585
  style={{ ...floatingStyles, ...(depth ? { '--kol-float-depth': depth } : null), ...fm?.style, ...extraStyle }}
582
586
  className={cls}
583
587
  data-editor-keep-selection
584
588
  data-side={fm ? popover.placement?.split('-')[0] : undefined}
585
589
  data-exit={fm && presence.exiting ? '' : undefined}
586
- {...getFloatingProps()}
590
+ {...getFloatingProps(floatingProps)}
587
591
  >
588
592
  <FloatDepth.Provider value={depth + 1}>{children}</FloatDepth.Provider>
589
593
  </div>