@agent-ui-kit/web-components 0.0.1
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/agent-ui.css +1 -0
- package/dist/chunks/agent-ciCayeod.js +1241 -0
- package/dist/chunks/agent-ciCayeod.js.map +1 -0
- package/dist/chunks/registry-BNb5ABBs.js +25 -0
- package/dist/chunks/registry-BNb5ABBs.js.map +1 -0
- package/dist/components/agent.js +13 -0
- package/dist/components/agent.js.map +1 -0
- package/dist/components/editor.js +200 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/graph.js +352 -0
- package/dist/components/graph.js.map +1 -0
- package/dist/components.js +3137 -0
- package/dist/components.js.map +1 -0
- package/dist/element.js +10 -0
- package/dist/element.js.map +1 -0
- package/dist/icons.js +104 -0
- package/dist/icons.js.map +1 -0
- package/dist/reactivity.js +9 -0
- package/dist/reactivity.js.map +1 -0
- package/dist/register.js +1441 -0
- package/dist/register.js.map +1 -0
- package/dist/store.js +34 -0
- package/dist/store.js.map +1 -0
- package/dist/styles.js +2 -0
- package/dist/styles.js.map +1 -0
- package/dist/traits.js +2453 -0
- package/dist/traits.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traits.js","sources":["../src/traits/drag/drag.trait.ts","../src/traits/press-hold/press-hold.trait.ts","../src/traits/swipe/swipe.trait.ts","../src/traits/sort/sort.trait.ts","../src/traits/resize/resize.trait.ts","../src/traits/pan-zoom/pan-zoom.trait.ts","../src/traits/hover/hover.trait.ts","../src/traits/toggle-state/toggle-state.trait.ts","../src/traits/toggle-scheme/toggle-scheme.trait.ts","../src/traits/copy/copy.trait.ts","../src/traits/clipboard/clipboard.trait.ts","../src/traits/shortcut/shortcut.trait.ts","../src/traits/search/search.trait.ts","../src/traits/drop-zone/drop-zone.trait.ts","../src/traits/edit/edit.trait.ts","../src/traits/intersect/intersect.trait.ts","../src/traits/link-paste/link-paste.trait.ts","../src/traits/linked-scroll/linked-scroll.trait.ts","../src/traits/mention/mention.trait.ts","../src/traits/persist/persist.trait.ts","../src/traits/range-select/range-select.trait.ts","../src/traits/selection/selection.trait.ts","../src/traits/slash-command/slash-command.trait.ts","../src/traits/store/store.trait.ts","../src/traits/text-trigger/text-trigger.trait.ts","../src/traits/backtick-wrap/backtick-wrap.trait.ts","../src/traits/validate/validate.trait.ts","../src/traits/trap-focus/trap-focus.trait.ts","../src/traits/roving-focus/roving-focus.trait.ts","../src/traits/list-navigate/list-navigate.trait.ts","../src/traits/tooltip/tooltip.trait.ts","../src/traits/collapsible/collapsible.trait.ts","../src/traits/popover/overlay.ts","../src/traits/popover/popover.trait.ts","../src/traits/modal/modal.trait.ts","../src/traits/dismiss/dismiss.trait.ts","../src/traits/auto-dismiss/auto-dismiss.trait.ts","../src/traits/gateway/gateway.trait.ts","../src/traits/present/present.trait.ts","../src/traits/toast/toast.trait.ts","../src/traits/virtual-scroll/virtual-scroll.trait.ts","../src/traits/ripple/ripple.trait.ts","../src/traits/confetti/confetti.trait.ts","../src/traits/flip/flip.trait.ts","../src/traits/parallax/parallax.trait.ts","../src/traits/toss/toss.trait.ts","../src/traits/magnet/magnet.trait.ts","../src/traits/noodle/noodle.trait.ts","../src/traits/css-inspect/css-inspect-controller.ts","../src/traits/css-inspect/css-inspect.trait.ts","../src/traits/snap-resize/snap-resize.trait.ts","../src/traits/index.ts"],"sourcesContent":["// ── drag trait ───────────────────────────────────────────────\n//\n// Composable pointer-driven drag-and-drop with three modes:\n// - drop: Outlines the hovered target element\n// - slot: Shows gap indicator between items for insertion\n// - preview: Live DOM reordering (item moves in real time)\n//\n// Supports:\n// - Axis constraint (vertical / horizontal / both)\n// - Separate drag items vs drop zone selectors\n// - Cross-zone dragging (kanban boards via zoneSelector)\n// - Ghost via popover API (renders in top layer)\n// - View Transition animation (preview mode)\n// - Escape to cancel + restore\n//\n// Events:\n// drag-start — first pointer move, detail: { item, index }\n// drag-move — every move, detail: { item, x, y }\n// drag-over — target/insertion update\n// drop — completion, detail: { item, fromIndex, toIndex, ... }\n// drag-cancel — escape or pointer cancel\n//\n// Attributes set during drag:\n// [dragging] on the dragged item\n// [drag-over] on drop target (drop mode)\n// [drag-slot-before] on item after insertion gap (slot mode)\n// [drag-slot-after] on item before insertion gap (slot mode)\n// [drag-zone-active] on the zone the ghost is over\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const dragTrait: TraitDefinition = {\n name: 'drag',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n selector: '',\n 'drop-zone-selector': '',\n 'zone-selector': '',\n axis: 'both',\n mode: 'drop',\n animate: 'true',\n },\n\n attach(ctx) {\n const selector = ctx.config('selector') ?? ''\n const dropZoneSelector = ctx.config('drop-zone-selector') ?? ''\n const zoneSelector = ctx.config('zone-selector') ?? ''\n const axis = (ctx.config('axis') ?? 'both') as 'vertical' | 'horizontal' | 'both'\n const mode = (ctx.config('mode') ?? 'drop') as 'drop' | 'slot' | 'preview' | 'free'\n const animate = ctx.config('animate') !== 'false'\n const ignore = ctx.config('ignore') ?? 'aui-button, aui-select, aui-textarea, aui-input, aui-segment, aui-radio, aui-checkbox, aui-switch, aui-tab, aui-option, aui-range, aui-calendar, [data-resize-handle], [contenteditable]'\n const modifier = ctx.config('modifier') as string | undefined\n\n // ── Free mode: host itself is draggable ─────────────────\n if (!selector || mode === 'free') {\n let isDragging = false\n let startX = 0, startY = 0, origX = 0, origY = 0\n\n const computed = getComputedStyle(ctx.host)\n if (computed.position === 'static') ctx.host.style.position = 'relative'\n\n const onDown = (e: PointerEvent) => {\n if (e.button !== 0) return\n if (ignore && (e.target as HTMLElement).closest(ignore)) return\n if (modifier === 'alt' && !e.altKey) return\n if (modifier === 'meta' && !e.metaKey) return\n if (modifier === 'ctrl' && !e.ctrlKey) return\n if (modifier === 'shift' && !e.shiftKey) return\n\n isDragging = true\n startX = e.clientX\n startY = e.clientY\n\n const t = ctx.host.style.transform\n const m = t.match(/translate\\((-?[\\d.]+)px,\\s*(-?[\\d.]+)px\\)/)\n origX = m ? parseFloat(m[1]) : 0\n origY = m ? parseFloat(m[2]) : 0\n\n ctx.host.setPointerCapture(e.pointerId)\n ctx.host.style.cursor = 'grabbing'\n ctx.host.style.zIndex = '10'\n ctx.expose('dragging', true)\n ctx.emit('drag-start', { item: ctx.host })\n }\n\n const onMove = (e: PointerEvent) => {\n if (!isDragging) return\n const dx = axis === 'vertical' ? 0 : e.clientX - startX\n const dy = axis === 'horizontal' ? 0 : e.clientY - startY\n ctx.host.style.transform = `translate(${origX + dx}px, ${origY + dy}px)`\n ctx.emit('drag-move', { item: ctx.host, x: e.clientX, y: e.clientY })\n }\n\n const onUp = () => {\n if (!isDragging) return\n isDragging = false\n ctx.host.style.cursor = ''\n ctx.host.style.zIndex = ''\n ctx.unexpose('dragging')\n ctx.emit('drag-end', { item: ctx.host })\n }\n\n ctx.host.addEventListener('pointerdown', onDown)\n ctx.host.addEventListener('pointermove', onMove)\n ctx.host.addEventListener('pointerup', onUp)\n\n return () => {\n if (isDragging) onUp()\n ctx.host.removeEventListener('pointerdown', onDown)\n ctx.host.removeEventListener('pointermove', onMove)\n ctx.host.removeEventListener('pointerup', onUp)\n }\n }\n\n // ── Sort/drop modes: selector-based dragging ────────────\n\n let dragItem: HTMLElement | null = null\n let ghost: HTMLElement | null = null\n let placeholder: HTMLElement | null = null\n let startX = 0\n let startY = 0\n let grabOffsetX = 0\n let grabOffsetY = 0\n let dragIndex = -1\n let lastSlotIndex = -1\n let sourceZone: HTMLElement | null = null\n let currentZone: HTMLElement | null = null\n let previewOriginParent: HTMLElement | null = null\n let previewOriginNext: HTMLElement | null = null\n let lastPreviewIndex = -1\n let pointerId = -1\n\n // ── Queries ──\n\n const getItems = (): HTMLElement[] =>\n [...ctx.host.querySelectorAll<HTMLElement>(selector)]\n .filter(el => !el.hasAttribute('popover'))\n\n const getDropZones = (): HTMLElement[] =>\n dropZoneSelector\n ? [...ctx.host.querySelectorAll<HTMLElement>(dropZoneSelector)].filter(el => !el.hasAttribute('popover'))\n : getItems()\n\n const getZones = (): HTMLElement[] =>\n zoneSelector ? [...ctx.host.querySelectorAll<HTMLElement>(zoneSelector)] : []\n\n const getItemsInZone = (zone: HTMLElement): HTMLElement[] =>\n [...zone.querySelectorAll<HTMLElement>(selector)]\n .filter(el => !el.hasAttribute('popover'))\n\n const findZoneAt = (x: number, y: number): HTMLElement | null => {\n // Find the nearest zone by distance to its center\n let nearest: HTMLElement | null = null\n let minDist = Infinity\n for (const zone of getZones()) {\n const r = zone.getBoundingClientRect()\n const cx = r.left + r.width / 2\n const cy = r.top + r.height / 2\n const dist = Math.hypot(x - cx, y - cy)\n if (dist < minDist) {\n minDist = dist\n nearest = zone\n }\n }\n return nearest\n }\n\n // ── Hit testing (shared by all modes) ──\n //\n // Euclidean distance to find nearest item, then binary-partition\n // by centroid to determine before/after. Auto-detects list direction\n // from the first two items. Works for vertical, horizontal, and grid.\n\n const findInsertIndex = (\n targets: HTMLElement[],\n px: number,\n py: number,\n ): number => {\n if (targets.length === 0) return 0\n\n // Find nearest item by Euclidean distance\n let closestIdx = 0\n let closestDist = Infinity\n for (let i = 0; i < targets.length; i++) {\n const r = targets[i].getBoundingClientRect()\n const cx = r.left + r.width / 2\n const cy = r.top + r.height / 2\n const dist = Math.hypot(px - cx, py - cy)\n if (dist < closestDist) {\n closestDist = dist\n closestIdx = i\n }\n }\n\n // Auto-detect direction from first two items\n let dir: 'h' | 'v' = axis === 'horizontal' ? 'h' : 'v'\n if (targets.length >= 2) {\n const a = targets[0].getBoundingClientRect()\n const b = targets[1].getBoundingClientRect()\n const dx = Math.abs(b.left + b.width / 2 - a.left - a.width / 2)\n const dy = Math.abs(b.top + b.height / 2 - a.top - a.height / 2)\n dir = dx > dy ? 'h' : 'v'\n }\n\n // Binary partition: pointer past centroid = insert after\n const r = targets[closestIdx].getBoundingClientRect()\n const mid = dir === 'h' ? r.left + r.width / 2 : r.top + r.height / 2\n const pos = dir === 'h' ? px : py\n return pos > mid ? closestIdx + 1 : closestIdx\n }\n\n // ── Ghost ──\n\n const createGhost = (e: PointerEvent) => {\n if (!dragItem) return\n const rect = dragItem.getBoundingClientRect()\n const g = dragItem.cloneNode(true) as HTMLElement\n g.setAttribute('popover', 'manual')\n g.setAttribute('aria-hidden', 'true')\n document.body.appendChild(g)\n g.showPopover()\n g.style.position = 'fixed'\n g.style.inset = 'unset'\n g.style.left = `${rect.left}px`\n g.style.top = `${rect.top}px`\n g.style.width = `${rect.width}px`\n g.style.height = `${rect.height}px`\n g.style.margin = '0'\n g.style.pointerEvents = 'none'\n g.style.opacity = '0.7'\n g.style.transform = 'scale(0.85)'\n g.style.transformOrigin = 'center center'\n g.style.border = 'none'\n g.style.outline = 'none'\n ghost = g\n startX = e.clientX\n startY = e.clientY\n }\n\n // ── View Transition names (preview mode) ──\n\n const assignTransitionNames = () => {\n const items = getItems()\n for (let i = 0; i < items.length; i++) {\n items[i].style.viewTransitionName = items[i] === dragItem ? 'none' : `drag-item-${i}`\n }\n }\n\n const clearTransitionNames = () => {\n for (const item of getItems()) item.style.removeProperty('view-transition-name')\n }\n\n const restorePreview = () => {\n if (mode !== 'preview' || !dragItem || !previewOriginParent) return\n const item = dragItem\n const next = previewOriginNext\n const parent = previewOriginParent\n const doRestore = () => {\n if (next && next.isConnected) next.before(item)\n else parent.appendChild(item)\n }\n if (animate && typeof document.startViewTransition === 'function') {\n const t = document.startViewTransition(() => { doRestore(); assignTransitionNames() })\n t.finished.catch(() => {})\n } else doRestore()\n }\n\n // ── Slot mode helpers ──\n\n const clearSlotAttributes = (items: HTMLElement[]) => {\n for (const item of items) {\n item.removeAttribute('drag-slot-before')\n item.removeAttribute('drag-slot-after')\n }\n }\n\n const updateSlot = (items: HTMLElement[], insertIndex: number, container?: HTMLElement) => {\n if (insertIndex === -1 || insertIndex === lastSlotIndex) return\n lastSlotIndex = insertIndex\n clearSlotAttributes(items)\n\n const liveItems = items.filter(el => el !== dragItem && el !== placeholder)\n const ci = Math.min(insertIndex, liveItems.length)\n\n // No placeholder in grid mode — it breaks grid layout\n if (axis !== 'both') {\n if (!placeholder && dragItem) {\n // Clone the dragged item as a translucent drop preview\n placeholder = dragItem.cloneNode(true) as HTMLElement\n placeholder.setAttribute('data-drag-placeholder', '')\n placeholder.setAttribute('aria-hidden', 'true')\n placeholder.removeAttribute('dragging')\n placeholder.style.display = ''\n placeholder.style.opacity = '0.5'\n placeholder.style.pointerEvents = 'none'\n placeholder.style.outline = '2px dashed var(--aui-accent, highlight)'\n placeholder.style.outlineOffset = '-2px'\n }\n if (placeholder) {\n if (ci < liveItems.length) liveItems[ci].before(placeholder)\n else if (liveItems.length > 0) liveItems[liveItems.length - 1].after(placeholder)\n else (container ?? ctx.host).appendChild(placeholder)\n }\n }\n\n if (ci < liveItems.length) liveItems[ci].setAttribute('drag-slot-before', '')\n if (ci > 0 && ci - 1 < liveItems.length) liveItems[ci - 1].setAttribute('drag-slot-after', '')\n\n const insertBefore = ci < liveItems.length ? liveItems[ci] : null\n ctx.emit('drag-over', { item: dragItem, index: insertIndex, insertBefore })\n }\n\n // ── Preview mode ──\n\n const updatePreview = (items: HTMLElement[], gx: number, gy: number, container?: HTMLElement) => {\n const liveItems = items.filter(el => el !== dragItem)\n if (liveItems.length === 0) {\n if (container && dragItem && lastPreviewIndex !== 0) {\n lastPreviewIndex = 0\n const doMove = () => container.appendChild(dragItem!)\n if (animate && typeof document.startViewTransition === 'function') {\n const t = document.startViewTransition(() => { doMove(); assignTransitionNames() })\n t.finished.catch(() => {})\n } else doMove()\n ctx.emit('drag-over', { item: dragItem, index: 0, insertBefore: null })\n }\n return\n }\n\n let insertIndex = findInsertIndex(liveItems, gx, gy)\n if (insertIndex === lastPreviewIndex) return\n lastPreviewIndex = insertIndex\n\n const insertBefore = insertIndex < liveItems.length ? liveItems[insertIndex] : null\n const doMove = () => {\n if (insertBefore) insertBefore.before(dragItem!)\n else liveItems[liveItems.length - 1].after(dragItem!)\n }\n\n if (animate && typeof document.startViewTransition === 'function') {\n const t = document.startViewTransition(() => { doMove(); assignTransitionNames() })\n t.finished.catch(() => {})\n } else doMove()\n\n ctx.emit('drag-over', { item: dragItem, index: insertIndex, insertBefore })\n }\n\n // ── Drop mode ──\n\n const updateDropOver = (zones: HTMLElement[], overZone: HTMLElement | null, overIndex: number) => {\n for (const zone of zones) {\n if (zone !== overZone) {\n zone.removeAttribute('drag-over')\n zone.style.removeProperty('outline')\n zone.style.removeProperty('outline-offset')\n }\n }\n if (overZone) {\n overZone.setAttribute('drag-over', '')\n overZone.style.outline = '2px solid var(--aui-focus, highlight)'\n overZone.style.outlineOffset = '2px'\n ctx.emit('drag-over', { item: dragItem, target: overZone, index: overIndex })\n }\n }\n\n // ── Cleanup ──\n\n const cleanup = () => {\n if (ghost) {\n if (ghost.isConnected) try { ghost.hidePopover() } catch {}\n ghost.remove()\n ghost = null\n }\n if (dragItem) {\n dragItem.removeAttribute('dragging')\n dragItem.style.removeProperty('display')\n }\n if (mode === 'preview' && animate) clearTransitionNames()\n\n const zones = getDropZones()\n if (mode === 'slot') {\n clearSlotAttributes(zones)\n } else {\n for (const zone of zones) {\n zone.removeAttribute('drag-over')\n zone.style.removeProperty('outline')\n zone.style.removeProperty('outline-offset')\n }\n }\n if (placeholder) { placeholder.remove(); placeholder = null }\n if (zoneSelector) for (const zone of getZones()) zone.removeAttribute('drag-zone-active')\n\n if (dragItem && pointerId >= 0) {\n dragItem.removeEventListener('lostpointercapture', onLostCapture)\n try { dragItem.releasePointerCapture(pointerId) } catch {}\n }\n\n dragItem = null\n dragIndex = -1\n lastSlotIndex = -1\n sourceZone = null\n currentZone = null\n previewOriginParent = null\n previewOriginNext = null\n lastPreviewIndex = -1\n pointerId = -1\n\n document.removeEventListener('pointermove', onPointerMove)\n document.removeEventListener('pointerup', onPointerUp)\n document.removeEventListener('pointercancel', onPointerCancel)\n document.removeEventListener('keydown', onKeyDown)\n }\n\n // ── Hover feedback ──\n\n const onHoverIn = (e: Event) => {\n if (ghost) return\n const pe = e as PointerEvent\n const target = (pe.target as HTMLElement).closest?.(selector) as HTMLElement | null\n if (!target || !ctx.host.contains(target)) return\n target.style.outline = '2px solid var(--aui-focus, highlight)'\n target.style.outlineOffset = '2px'\n }\n\n const onHoverOut = (e: Event) => {\n const pe = e as PointerEvent\n const target = (pe.target as HTMLElement).closest?.(selector) as HTMLElement | null\n if (!target || !ctx.host.contains(target)) return\n target.style.removeProperty('outline')\n target.style.removeProperty('outline-offset')\n }\n\n // ── Pointer lifecycle ──\n\n const onPointerDown = (e: Event) => {\n const pe = e as PointerEvent\n if (pe.button !== 0) return\n if (modifier === 'alt' && !pe.altKey) return\n if (modifier === 'meta' && !pe.metaKey) return\n if (modifier === 'ctrl' && !pe.ctrlKey) return\n if (modifier === 'shift' && !pe.shiftKey) return\n\n const target = (pe.target as HTMLElement).closest?.(selector) as HTMLElement | null\n if (!target || !ctx.host.contains(target)) return\n\n const items = getItems()\n const index = items.indexOf(target)\n if (index === -1) return\n\n pe.preventDefault()\n dragItem = target\n dragIndex = index\n startX = pe.clientX\n startY = pe.clientY\n\n const itemRect = target.getBoundingClientRect()\n grabOffsetX = (itemRect.left + itemRect.width / 2) - pe.clientX\n grabOffsetY = (itemRect.top + itemRect.height / 2) - pe.clientY\n\n if (zoneSelector) sourceZone = target.closest(zoneSelector) as HTMLElement | null\n\n document.addEventListener('pointermove', onPointerMove)\n document.addEventListener('pointerup', onPointerUp)\n document.addEventListener('pointercancel', onPointerCancel)\n document.addEventListener('keydown', onKeyDown)\n\n try { target.setPointerCapture(pe.pointerId) } catch {}\n pointerId = pe.pointerId\n target.addEventListener('lostpointercapture', onLostCapture)\n }\n\n const onPointerMove = (e: Event) => {\n if (!dragItem) return\n const pe = e as PointerEvent\n\n // Create ghost on first move (not on pointerdown) to avoid ghost on click\n if (!ghost) {\n dragItem.style.removeProperty('outline')\n dragItem.style.removeProperty('outline-offset')\n\n try { createGhost(pe) } catch { cleanup(); return }\n dragItem.setAttribute('dragging', '')\n if (mode === 'slot') dragItem.style.display = 'none'\n\n if (mode === 'preview') {\n previewOriginParent = dragItem.parentElement\n previewOriginNext = dragItem.nextElementSibling as HTMLElement | null\n lastPreviewIndex = -1\n if (animate) assignTransitionNames()\n }\n ctx.emit('drag-start', { item: dragItem, index: dragIndex })\n }\n\n // Ghost follows pointer freely — axis only constrains hit-testing\n const dx = pe.clientX - startX\n const dy = pe.clientY - startY\n ghost!.style.transform = `translate(${dx}px, ${dy}px) scale(0.85)`\n\n ctx.emit('drag-move', { item: dragItem, x: pe.clientX, y: pe.clientY })\n\n const zones = getDropZones().filter(z => z !== ghost)\n\n if (mode === 'slot') {\n const gx = pe.clientX + grabOffsetX\n const gy = pe.clientY + grabOffsetY\n let items: HTMLElement[]\n let container: HTMLElement | undefined\n\n if (zoneSelector) {\n const zone = findZoneAt(gx, gy)\n if (!zone) return\n if (zone !== currentZone) {\n if (currentZone) {\n clearSlotAttributes(getItemsInZone(currentZone))\n currentZone.removeAttribute('drag-zone-active')\n }\n zone.setAttribute('drag-zone-active', '')\n currentZone = zone\n lastSlotIndex = -1\n }\n items = getItemsInZone(zone).filter(el => el !== ghost)\n container = zone\n } else {\n items = zones\n }\n\n const targets = items.filter(z => z !== dragItem && z !== placeholder)\n const insertIndex = findInsertIndex(targets, gx, gy)\n\n updateSlot(items, insertIndex, container)\n } else if (mode === 'preview') {\n const gx = pe.clientX + grabOffsetX\n const gy = pe.clientY + grabOffsetY\n\n if (zoneSelector) {\n const zone = findZoneAt(gx, gy)\n if (!zone) return\n if (zone !== currentZone) {\n if (currentZone) currentZone.removeAttribute('drag-zone-active')\n zone.setAttribute('drag-zone-active', '')\n currentZone = zone\n lastPreviewIndex = -1\n }\n const zoneItems = getItemsInZone(zone).filter(el => el !== ghost)\n updatePreview(zoneItems, gx, gy, zone)\n } else {\n updatePreview(zones, gx, gy)\n }\n } else {\n // Drop mode — find nearest target using shared hit testing\n const dropTargets = zones.filter(z => z !== dragItem)\n const gx = pe.clientX + grabOffsetX\n const gy = pe.clientY + grabOffsetY\n\n let overZone: HTMLElement | null = null\n let overIndex = -1\n\n if (dropTargets.length > 0) {\n // Find nearest by Euclidean distance\n let closestDist = Infinity\n for (let i = 0; i < dropTargets.length; i++) {\n const r = dropTargets[i].getBoundingClientRect()\n const dist = Math.hypot(gx - r.left - r.width / 2, gy - r.top - r.height / 2)\n if (dist < closestDist) {\n closestDist = dist\n overZone = dropTargets[i]\n overIndex = i\n }\n }\n }\n\n updateDropOver(zones, overZone, overIndex)\n }\n }\n\n const onPointerUp = (e: Event) => {\n if (!dragItem) return\n const pe = e as PointerEvent\n\n dragItem.removeEventListener('lostpointercapture', onLostCapture)\n if (pointerId >= 0) try { dragItem.releasePointerCapture(pointerId) } catch {}\n\n document.removeEventListener('pointermove', onPointerMove)\n document.removeEventListener('pointerup', onPointerUp)\n document.removeEventListener('pointercancel', onPointerCancel)\n document.removeEventListener('keydown', onKeyDown)\n\n if (ghost) {\n if (mode === 'slot') {\n let liveItems: HTMLElement[]\n if (zoneSelector && currentZone) {\n liveItems = getItemsInZone(currentZone).filter(el => el !== dragItem)\n } else {\n liveItems = getItems().filter(el => el !== dragItem)\n }\n const insertBefore = lastSlotIndex >= 0 && lastSlotIndex < liveItems.length\n ? liveItems[lastSlotIndex] : null\n\n ctx.emit('drop', {\n item: dragItem, fromIndex: dragIndex, toIndex: lastSlotIndex,\n insertBefore, sourceZone, targetZone: currentZone,\n })\n } else if (mode === 'preview') {\n let items: HTMLElement[]\n if (zoneSelector && currentZone) items = getItemsInZone(currentZone)\n else items = getItems()\n const toIndex = dragItem ? items.indexOf(dragItem) : -1\n previewOriginParent = null\n previewOriginNext = null\n\n ctx.emit('drop', {\n item: dragItem, fromIndex: dragIndex, toIndex,\n sourceZone, targetZone: currentZone,\n })\n } else {\n const zones = getDropZones()\n const overZone = zones.find(z => z.hasAttribute('drag-over')) ?? null\n const toIndex = overZone ? zones.indexOf(overZone) : -1\n\n ctx.emit('drop', {\n item: dragItem, target: overZone, fromIndex: dragIndex, toIndex,\n sourceZone, targetZone: currentZone,\n })\n }\n }\n\n cleanup()\n }\n\n const onLostCapture = () => {\n if (!dragItem) return\n onPointerUp(null as unknown as Event)\n }\n\n const onPointerCancel = () => {\n if (!dragItem) return\n restorePreview()\n if (ghost) ctx.emit('drag-cancel', { item: dragItem })\n cleanup()\n }\n\n const onKeyDown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (ke.key === 'Escape' && dragItem) {\n ke.preventDefault()\n restorePreview()\n if (ghost) ctx.emit('drag-cancel', { item: dragItem })\n cleanup()\n }\n }\n\n // ── Attach ──\n\n ctx.host.addEventListener('pointerdown', onPointerDown)\n ctx.host.addEventListener('pointerenter', onHoverIn, true)\n ctx.host.addEventListener('pointerleave', onHoverOut, true)\n\n return () => {\n if (dragItem && ghost) {\n restorePreview()\n ctx.emit('drag-cancel', { item: dragItem })\n }\n cleanup()\n ctx.host.removeEventListener('pointerdown', onPointerDown)\n ctx.host.removeEventListener('pointerenter', onHoverIn, true)\n ctx.host.removeEventListener('pointerleave', onHoverOut, true)\n }\n },\n}\n","// ── press-hold trait ─────────────────────────────────────────\n//\n// Emits `hold` after a configurable delay while the pointer\n// is held down. Cancels if pointer leaves or releases early.\n//\n// Usage:\n// <aui-button traits=\"press-hold\">\n// <aui-button traits=\"{ trait: 'press-hold', delay: '600' }\">\n//\n// Events:\n// hold — fires when hold threshold reached\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const pressHoldTrait: TraitDefinition = {\n name: 'press-hold',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n delay: '500',\n },\n\n attach(ctx) {\n const delay = parseInt(ctx.config('delay') ?? '500', 10)\n let timer: ReturnType<typeof setTimeout> | null = null\n\n const clear = () => {\n if (timer !== null) {\n clearTimeout(timer)\n timer = null\n }\n }\n\n const onDown = (e: Event) => {\n if ((e as PointerEvent).button !== 0) return\n clear()\n timer = setTimeout(() => {\n timer = null\n ctx.emit('hold')\n ctx.expose('held', true)\n }, delay)\n }\n\n const onUp = () => {\n clear()\n ctx.unexpose('held')\n }\n\n ctx.host.addEventListener('pointerdown', onDown)\n ctx.host.addEventListener('pointerup', onUp)\n ctx.host.addEventListener('pointerleave', onUp)\n ctx.host.addEventListener('pointercancel', onUp)\n\n return () => {\n clear()\n ctx.host.removeEventListener('pointerdown', onDown)\n ctx.host.removeEventListener('pointerup', onUp)\n ctx.host.removeEventListener('pointerleave', onUp)\n ctx.host.removeEventListener('pointercancel', onUp)\n }\n },\n}\n","// ── swipe trait ──────────────────────────────────────────────\n//\n// Detects swipe gestures on the host via pointer events.\n// During drag, applies CSS custom properties --_swipe-x and\n// --_swipe-y for live tracking. On release, determines direction\n// based on distance and velocity.\n//\n// Usage:\n// <aui-surface traits=\"swipe\">\n// <aui-surface traits=\"{ trait: 'swipe', threshold: '80', timeout: '400' }\">\n//\n// Events:\n// swipe-move — fires during drag, detail: { dx, dy }\n// swipe — fires on successful swipe, detail: { direction, distance, velocity, dx, dy }\n//\n// CSS custom properties (during drag):\n// --_swipe-x, --_swipe-y\n//\n// Exposed state:\n// data-swipe-swiping=\"\" (present while dragging)\n// data-swipe-direction=\"left|right|up|down\" (set after swipe, cleared after 500ms)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const swipeTrait: TraitDefinition = {\n name: 'swipe',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n threshold: '50',\n timeout: '300',\n },\n\n attach(ctx) {\n const threshold = parseInt(ctx.config('threshold') ?? '50', 10)\n const timeout = parseInt(ctx.config('timeout') ?? '300', 10)\n\n let startX = 0\n let startY = 0\n let startTime = 0\n let tracking = false\n let pointerId = -1\n let clearTimer: ReturnType<typeof setTimeout> | null = null\n\n const onDown = (e: Event) => {\n const pe = e as PointerEvent\n if (pe.button !== 0) return\n\n pe.preventDefault()\n startX = pe.clientX\n startY = pe.clientY\n startTime = Date.now()\n tracking = true\n pointerId = pe.pointerId\n\n try { ctx.host.setPointerCapture(pe.pointerId) } catch {}\n ctx.host.style.touchAction = 'none'\n ctx.expose('swiping', true)\n }\n\n const onMove = (e: Event) => {\n if (!tracking) return\n const pe = e as PointerEvent\n\n const dx = pe.clientX - startX\n const dy = pe.clientY - startY\n\n ctx.host.style.setProperty('--_swipe-x', `${dx}px`)\n ctx.host.style.setProperty('--_swipe-y', `${dy}px`)\n\n ctx.emit('swipe-move', { dx, dy })\n }\n\n const onUp = (e: Event) => {\n if (!tracking) return\n tracking = false\n\n const pe = e as PointerEvent\n if (pointerId >= 0) {\n try { ctx.host.releasePointerCapture(pointerId) } catch {}\n pointerId = -1\n }\n ctx.host.style.touchAction = ''\n ctx.host.style.removeProperty('--_swipe-x')\n ctx.host.style.removeProperty('--_swipe-y')\n ctx.unexpose('swiping')\n\n const dx = pe.clientX - startX\n const dy = pe.clientY - startY\n const elapsed = Date.now() - startTime\n\n if (elapsed > timeout) return\n\n const absDx = Math.abs(dx)\n const absDy = Math.abs(dy)\n const distance = Math.sqrt(dx * dx + dy * dy)\n\n if (distance < threshold) return\n\n const direction: 'left' | 'right' | 'up' | 'down' =\n absDx > absDy\n ? dx > 0 ? 'right' : 'left'\n : dy > 0 ? 'down' : 'up'\n\n const velocity = distance / elapsed\n\n ctx.emit('swipe', { direction, distance, velocity, dx, dy })\n\n if (clearTimer !== null) clearTimeout(clearTimer)\n ctx.expose('direction', direction)\n clearTimer = setTimeout(() => {\n ctx.unexpose('direction')\n clearTimer = null\n }, 500)\n }\n\n const onCancel = () => {\n if (!tracking) return\n tracking = false\n\n if (pointerId >= 0) {\n try { ctx.host.releasePointerCapture(pointerId) } catch {}\n pointerId = -1\n }\n ctx.host.style.touchAction = ''\n ctx.host.style.removeProperty('--_swipe-x')\n ctx.host.style.removeProperty('--_swipe-y')\n ctx.unexpose('swiping')\n }\n\n ctx.host.addEventListener('pointerdown', onDown)\n ctx.host.addEventListener('pointermove', onMove)\n ctx.host.addEventListener('pointerup', onUp)\n ctx.host.addEventListener('pointercancel', onCancel)\n\n return () => {\n if (clearTimer !== null) clearTimeout(clearTimer)\n if (pointerId >= 0) {\n try { ctx.host.releasePointerCapture(pointerId) } catch {}\n }\n ctx.host.style.touchAction = ''\n ctx.host.style.removeProperty('--_swipe-x')\n ctx.host.style.removeProperty('--_swipe-y')\n ctx.host.removeEventListener('pointerdown', onDown)\n ctx.host.removeEventListener('pointermove', onMove)\n ctx.host.removeEventListener('pointerup', onUp)\n ctx.host.removeEventListener('pointercancel', onCancel)\n }\n },\n}\n","// ── sort trait ───────────────────────────────────────────────\n//\n// Convenience trait that combines the drag trait (slot mode) with\n// automatic DOM reordering on drop. For when you just want a\n// sortable list without writing a drop handler.\n//\n// Usage:\n// <aui-list traits=\"sort\"> (sorts direct children)\n// <aui-list traits=\"{ trait: 'sort', selector: '.item', handle: '.grip' }\">\n//\n// Events:\n// sort — fires on reorder complete, detail: { order: string[] }\n//\n// This trait delegates to the drag trait under the hood. If you need\n// more control (cross-zone, preview mode, drop-zone separation),\n// use the drag trait directly.\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const sortTrait: TraitDefinition = {\n name: 'sort',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n selector: '> *',\n handle: '',\n axis: 'vertical',\n },\n\n attach(ctx) {\n const selectorRaw = ctx.config('selector') ?? '> *'\n const handleSelector = ctx.config('handle') ?? ''\n const axis = (ctx.config('axis') ?? 'vertical') as 'vertical' | 'horizontal' | 'both'\n\n // Normalize \"> *\" to \":scope > *\" for querySelectorAll\n const selector = selectorRaw.startsWith('> ') ? `:scope ${selectorRaw}` : selectorRaw\n\n let dragItem: HTMLElement | null = null\n let ghost: HTMLElement | null = null\n let placeholder: HTMLElement | null = null\n let startX = 0\n let startY = 0\n let grabOffsetX = 0\n let grabOffsetY = 0\n let pointerId = -1\n let lastSlotIndex = -1\n\n const getItems = (): HTMLElement[] =>\n [...ctx.host.querySelectorAll<HTMLElement>(selector)]\n .filter(el => !el.hasAttribute('popover'))\n\n // ── Grid geometry (for axis='both') ──\n\n const detectGridGeometry = (items: HTMLElement[]) => {\n const firstRect = items[0].getBoundingClientRect()\n let cols = 1\n for (let i = 1; i < items.length; i++) {\n if (Math.abs(items[i].getBoundingClientRect().top - firstRect.top) < firstRect.height * 0.5) {\n cols = i + 1\n } else break\n }\n const stepX = cols > 1\n ? items[1].getBoundingClientRect().left - firstRect.left\n : firstRect.width\n const stepY = cols < items.length\n ? items[cols].getBoundingClientRect().top - firstRect.top\n : firstRect.height\n return { cols, stepX, stepY, firstRect }\n }\n\n const ghostToGridIndex = (gx: number, gy: number, items: HTMLElement[], maxIndex: number): number => {\n const { cols, stepX, stepY, firstRect } = detectGridGeometry(items)\n const col = Math.round((gx - (firstRect.left + firstRect.width / 2)) / stepX)\n const row = Math.round((gy - (firstRect.top + firstRect.height / 2)) / stepY)\n const maxRow = Math.ceil(maxIndex / cols) - 1\n const cc = Math.max(0, Math.min(col, cols - 1))\n const cr = Math.max(0, Math.min(row, Math.max(0, maxRow)))\n return Math.max(0, Math.min(cr * cols + cc, maxIndex))\n }\n\n // ── Ghost ──\n\n const createGhost = (e: PointerEvent) => {\n if (!dragItem) return\n const rect = dragItem.getBoundingClientRect()\n const g = dragItem.cloneNode(true) as HTMLElement\n g.setAttribute('popover', 'manual')\n g.setAttribute('aria-hidden', 'true')\n ctx.host.appendChild(g)\n g.showPopover()\n g.style.position = 'fixed'\n g.style.inset = 'unset'\n g.style.left = `${rect.left}px`\n g.style.top = `${rect.top}px`\n g.style.width = `${rect.width}px`\n g.style.height = `${rect.height}px`\n g.style.margin = '0'\n g.style.pointerEvents = 'none'\n g.style.opacity = '0.8'\n g.style.transformOrigin = 'center center'\n g.style.border = 'none'\n g.style.outline = 'none'\n ghost = g\n startX = e.clientX\n startY = e.clientY\n }\n\n const clearSlotAttributes = (items: HTMLElement[]) => {\n for (const item of items) {\n item.removeAttribute('drag-slot-before')\n item.removeAttribute('drag-slot-after')\n }\n }\n\n // ── Cleanup ──\n\n const cleanup = () => {\n if (ghost) {\n if (ghost.isConnected) try { ghost.hidePopover() } catch {}\n ghost.remove()\n ghost = null\n }\n if (dragItem) dragItem.removeAttribute('dragging')\n clearSlotAttributes(getItems())\n if (placeholder) { placeholder.remove(); placeholder = null }\n if (dragItem && pointerId >= 0) {\n dragItem.removeEventListener('lostpointercapture', onLostCapture)\n try { dragItem.releasePointerCapture(pointerId) } catch {}\n }\n dragItem = null\n lastSlotIndex = -1\n pointerId = -1\n document.removeEventListener('pointermove', onPointerMove)\n document.removeEventListener('pointerup', onPointerUp)\n document.removeEventListener('pointercancel', onPointerCancel)\n document.removeEventListener('keydown', onKeyDown)\n }\n\n // ── Pointer lifecycle ──\n\n const onPointerDown = (e: Event) => {\n const pe = e as PointerEvent\n if (pe.button !== 0) return\n\n const target = (pe.target as HTMLElement)\n const items = getItems()\n\n let item: HTMLElement | null = null\n for (const child of items) {\n if (child.contains(target)) {\n if (handleSelector) {\n const handle = child.querySelector(handleSelector)\n if (!handle || !handle.contains(target)) continue\n }\n item = child\n break\n }\n }\n if (!item) return\n\n pe.preventDefault()\n dragItem = item\n startX = pe.clientX\n startY = pe.clientY\n\n const itemRect = item.getBoundingClientRect()\n grabOffsetX = (itemRect.left + itemRect.width / 2) - pe.clientX\n grabOffsetY = (itemRect.top + itemRect.height / 2) - pe.clientY\n\n document.addEventListener('pointermove', onPointerMove)\n document.addEventListener('pointerup', onPointerUp)\n document.addEventListener('pointercancel', onPointerCancel)\n document.addEventListener('keydown', onKeyDown)\n\n try { item.setPointerCapture(pe.pointerId) } catch {}\n pointerId = pe.pointerId\n item.addEventListener('lostpointercapture', onLostCapture)\n }\n\n const onPointerMove = (e: Event) => {\n if (!dragItem) return\n const pe = e as PointerEvent\n\n if (!ghost) {\n dragItem.style.removeProperty('outline')\n dragItem.style.removeProperty('outline-offset')\n try { createGhost(pe) } catch { cleanup(); return }\n dragItem.setAttribute('dragging', '')\n ctx.expose('dragging', true)\n }\n\n const dx = pe.clientX - startX\n const dy = pe.clientY - startY\n ghost!.style.transform = `translate(${dx}px, ${dy}px) scale(0.9)`\n\n const gx = pe.clientX + grabOffsetX\n const gy = pe.clientY + grabOffsetY\n const items = getItems().filter(el => el !== ghost)\n const targets = items.filter(z => z !== dragItem)\n\n let insertIndex = 0\n if (axis === 'both' && items.length >= 2) {\n insertIndex = ghostToGridIndex(gx, gy, items, targets.length)\n } else {\n for (let i = 0; i < targets.length; i++) {\n const rect = targets[i].getBoundingClientRect()\n const cx = rect.left + rect.width / 2\n const cy = rect.top + rect.height / 2\n const isPast = axis === 'horizontal' ? gx > cx : gy > cy\n if (isPast) insertIndex = i + 1\n else break\n }\n }\n\n if (insertIndex === lastSlotIndex) return\n lastSlotIndex = insertIndex\n clearSlotAttributes(items)\n\n const liveItems = items.filter(el => el !== dragItem)\n const ci = Math.min(insertIndex, liveItems.length)\n\n if (axis !== 'both') {\n if (!placeholder) {\n placeholder = document.createElement('div')\n placeholder.setAttribute('data-drag-placeholder', '')\n placeholder.setAttribute('aria-hidden', 'true')\n }\n if (ci < liveItems.length) liveItems[ci].before(placeholder)\n else if (liveItems.length > 0) liveItems[liveItems.length - 1].after(placeholder)\n else ctx.host.appendChild(placeholder)\n }\n\n if (ci < liveItems.length) liveItems[ci].setAttribute('drag-slot-before', '')\n if (ci > 0 && ci - 1 < liveItems.length) liveItems[ci - 1].setAttribute('drag-slot-after', '')\n }\n\n const onPointerUp = () => {\n if (!dragItem) return\n\n if (ghost) {\n // Auto-reorder DOM\n const items = getItems().filter(el => el !== ghost)\n const liveItems = items.filter(el => el !== dragItem)\n const ci = Math.min(Math.max(lastSlotIndex, 0), liveItems.length)\n const insertBefore = ci < liveItems.length ? liveItems[ci] : null\n\n if (insertBefore) insertBefore.before(dragItem)\n else if (liveItems.length > 0) liveItems[liveItems.length - 1].after(dragItem)\n\n // Emit order\n const finalItems = getItems().filter(el => !el.hasAttribute('popover'))\n const order = finalItems.map((el, i) => (el as HTMLElement).dataset.sortKey ?? String(i))\n ctx.emit('sort', { order })\n }\n\n ctx.unexpose('dragging')\n cleanup()\n }\n\n const onLostCapture = () => {\n if (!dragItem) return\n onPointerUp()\n }\n\n const onPointerCancel = () => {\n if (!dragItem) return\n ctx.unexpose('dragging')\n cleanup()\n }\n\n const onKeyDown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (ke.key === 'Escape' && dragItem) {\n ke.preventDefault()\n ctx.unexpose('dragging')\n cleanup()\n }\n }\n\n // ── Hover feedback ──\n\n const onHoverIn = (e: Event) => {\n if (ghost) return\n const pe = e as PointerEvent\n const items = getItems()\n let target: HTMLElement | null = null\n for (const child of items) {\n if (child.contains(pe.target as HTMLElement)) { target = child; break }\n }\n if (!target) return\n target.style.outline = '2px solid var(--aui-focus, highlight)'\n target.style.outlineOffset = '2px'\n }\n\n const onHoverOut = (e: Event) => {\n const pe = e as PointerEvent\n const items = getItems()\n let target: HTMLElement | null = null\n for (const child of items) {\n if (child.contains(pe.target as HTMLElement)) { target = child; break }\n }\n if (!target) return\n target.style.removeProperty('outline')\n target.style.removeProperty('outline-offset')\n }\n\n ctx.host.addEventListener('pointerdown', onPointerDown)\n ctx.host.addEventListener('pointerenter', onHoverIn, true)\n ctx.host.addEventListener('pointerleave', onHoverOut, true)\n\n return () => {\n cleanup()\n ctx.host.removeEventListener('pointerdown', onPointerDown)\n ctx.host.removeEventListener('pointerenter', onHoverIn, true)\n ctx.host.removeEventListener('pointerleave', onHoverOut, true)\n }\n },\n}\n","// ── resize trait ─────────────────────────────────────────────\n//\n// Figma-style handle-based resize with per-axis sizing modes.\n//\n// Sizing model (per axis, independent):\n// \"hug\" — no inline size, element sizes to content (default)\n// \"fixed\" — explicit pixel size, overflow hidden, content clips\n//\n// Dragging a handle switches that axis to \"fixed\".\n// Double-clicking an edge handle resets that axis to \"hug\".\n//\n// Usage:\n// <aui-panel traits=\"resize\">\n// <aui-panel traits=\"{ trait: 'resize', handles: 'se,e,s', min-width: '100', min-height: '100' }\">\n//\n// Events:\n// aui:resize-start — fires on resize begin, detail: { width, height }\n// aui:resize-move — fires on each move, detail: { width, height }\n// aui:resize-end — fires on resize end, detail: { width, height }\n// aui:resize-reset — fires when axis reset to hug, detail: { axis: 'width' | 'height' | 'both' }\n//\n// Exposed state:\n// data-resize-resizing=\"\" (present while resizing)\n// data-resize-fixed-w=\"\" (width is in fixed mode)\n// data-resize-fixed-h=\"\" (height is in fixed mode)\n\nimport type { TraitDefinition } from '../types.ts'\n\ntype Edge = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw'\n\nconst CURSORS: Record<Edge, string> = {\n n: 'ns-resize',\n s: 'ns-resize',\n e: 'ew-resize',\n w: 'ew-resize',\n ne: 'nesw-resize',\n sw: 'nesw-resize',\n nw: 'nwse-resize',\n se: 'nwse-resize',\n}\n\n/** Does this edge affect the horizontal axis? */\nconst touchesX = (e: Edge) => e.includes('e') || e.includes('w')\n/** Does this edge affect the vertical axis? */\nconst touchesY = (e: Edge) => e.includes('n') || e.includes('s')\n\nexport const resizeTrait: TraitDefinition = {\n name: 'resize',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n handles: 'n,s,e,w,ne,nw,se,sw',\n 'min-width': '1',\n 'min-height': '1',\n },\n\n attach(ctx) {\n const handleEdges = (ctx.config('handles') ?? 'se')\n .split(',')\n .map((s) => s.trim()) as Edge[]\n const minWidth = parseInt(ctx.config('min-width') ?? '50', 10)\n const minHeight = parseInt(ctx.config('min-height') ?? '50', 10)\n const modifier = ctx.config('modifier') as string | undefined\n\n // Ensure host is positioned\n const computed = getComputedStyle(ctx.host)\n if (computed.position === 'static') {\n ctx.host.style.position = 'relative'\n }\n\n let resizing = false\n let activeEdge: Edge | null = null\n let startX = 0\n let startY = 0\n let startWidth = 0\n let startHeight = 0\n let startLeft = 0\n let startTop = 0\n\n // ── Sizing mode helpers ──\n\n const setFixedW = (px: number) => {\n ctx.host.style.width = `${px}px`\n ctx.host.style.overflowX = 'hidden'\n ctx.host.setAttribute('data-resize-fixed-w', '')\n }\n\n const setFixedH = (px: number) => {\n ctx.host.style.height = `${px}px`\n ctx.host.style.overflowY = 'hidden'\n ctx.host.setAttribute('data-resize-fixed-h', '')\n }\n\n const resetToHugW = () => {\n ctx.host.style.width = ''\n ctx.host.style.overflowX = ''\n ctx.host.removeAttribute('data-resize-fixed-w')\n }\n\n const resetToHugH = () => {\n ctx.host.style.height = ''\n ctx.host.style.overflowY = ''\n ctx.host.removeAttribute('data-resize-fixed-h')\n }\n\n // ── Drag handlers ──\n\n const onPointerMove = (e: PointerEvent) => {\n if (!resizing || !activeEdge) return\n\n const dx = e.clientX - startX\n const dy = e.clientY - startY\n\n let newWidth = startWidth\n let newHeight = startHeight\n let newLeft = startLeft\n let newTop = startTop\n\n if (activeEdge.includes('e')) {\n newWidth = Math.max(minWidth, startWidth + dx)\n }\n if (activeEdge.includes('w')) {\n const w = Math.max(minWidth, startWidth - dx)\n newLeft = startLeft + (startWidth - w)\n newWidth = w\n }\n if (activeEdge.includes('s')) {\n newHeight = Math.max(minHeight, startHeight + dy)\n }\n if (activeEdge.includes('n')) {\n const h = Math.max(minHeight, startHeight - dy)\n newTop = startTop + (startHeight - h)\n newHeight = h\n }\n\n // Switch touched axes to fixed mode\n if (touchesX(activeEdge)) setFixedW(newWidth)\n if (touchesY(activeEdge)) setFixedH(newHeight)\n\n if (activeEdge.includes('w')) ctx.host.style.left = `${newLeft}px`\n if (activeEdge.includes('n')) ctx.host.style.top = `${newTop}px`\n\n syncOverlay()\n ctx.emit('aui:resize-move', { width: newWidth, height: newHeight })\n }\n\n const onPointerUp = (e: PointerEvent) => {\n if (!resizing) return\n resizing = false\n activeEdge = null\n\n label.removeAttribute('data-resize-label-visible')\n ;(e.target as Element)?.releasePointerCapture(e.pointerId)\n document.documentElement.style.cursor = ''\n ctx.unexpose('resizing')\n\n const rect = ctx.host.getBoundingClientRect()\n ctx.emit('aui:resize-end', { width: rect.width, height: rect.height })\n\n document.removeEventListener('pointermove', onPointerMove)\n document.removeEventListener('pointerup', onPointerUp)\n }\n\n // ── Overlay (sibling, outside host content tree) ──\n\n const overlay = document.createElement('div')\n overlay.setAttribute('data-resize-overlay', '')\n\n const label = document.createElement('div')\n label.setAttribute('data-resize-label', '')\n overlay.appendChild(label)\n\n // Position overlay to match host's bounding box\n const syncOverlay = () => {\n overlay.style.left = `${ctx.host.offsetLeft}px`\n overlay.style.top = `${ctx.host.offsetTop}px`\n overlay.style.width = `${ctx.host.offsetWidth}px`\n overlay.style.height = `${ctx.host.offsetHeight}px`\n overlay.style.transform = ctx.host.style.transform || 'none'\n overlay.style.transformOrigin = ctx.host.style.transformOrigin || ''\n label.textContent = `${Math.round(ctx.host.offsetWidth)} \\u00d7 ${Math.round(ctx.host.offsetHeight)}`\n }\n\n // Watch host style changes (drag sets transform inline)\n const styleObserver = new MutationObserver(syncOverlay)\n styleObserver.observe(ctx.host, { attributes: true, attributeFilter: ['style'] })\n\n // ── Handles ──\n\n for (const edge of handleEdges) {\n const el = document.createElement('div')\n el.setAttribute('data-resize-handle', edge)\n\n // Double-click edge → reset that axis to \"hug\"\n el.addEventListener('dblclick', (e: MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n\n const resetW = touchesX(edge) && ctx.host.hasAttribute('data-resize-fixed-w')\n const resetH = touchesY(edge) && ctx.host.hasAttribute('data-resize-fixed-h')\n\n if (resetW) resetToHugW()\n if (resetH) resetToHugH()\n\n if (resetW || resetH) {\n syncOverlay()\n const axis = resetW && resetH ? 'both' : resetW ? 'width' : 'height'\n ctx.emit('aui:resize-reset', { axis })\n }\n })\n\n el.addEventListener('pointerdown', (e: PointerEvent) => {\n if (e.button !== 0) return\n if (modifier === 'alt' && !e.altKey) return\n if (modifier === 'meta' && !e.metaKey) return\n if (modifier === 'ctrl' && !e.ctrlKey) return\n if (modifier === 'shift' && !e.shiftKey) return\n e.preventDefault()\n e.stopPropagation()\n\n resizing = true\n activeEdge = edge\n startX = e.clientX\n startY = e.clientY\n\n startWidth = ctx.host.offsetWidth\n startHeight = ctx.host.offsetHeight\n startLeft = ctx.host.offsetLeft\n startTop = ctx.host.offsetTop\n\n el.setPointerCapture(e.pointerId)\n document.documentElement.style.cursor = CURSORS[edge]\n ctx.expose('resizing', true)\n label.setAttribute('data-resize-label-visible', '')\n\n ctx.emit('aui:resize-start', { width: startWidth, height: startHeight })\n\n document.addEventListener('pointermove', onPointerMove)\n document.addEventListener('pointerup', onPointerUp)\n })\n\n overlay.appendChild(el)\n }\n\n // Insert overlay: prefer editor chrome layer, fall back to sibling\n const editorChrome = ctx.host.closest('aui-editor, aui-graph-ui')\n ?.querySelector('aui-editor-layer[name=\"chrome\"], aui-graph-layer[name=\"chrome\"]')\n if (editorChrome) {\n editorChrome.appendChild(overlay)\n } else {\n ctx.host.after(overlay)\n }\n\n // ── RAF poll for position sync ──\n\n let rafId = 0\n let lastRect = ''\n\n const startPolling = () => {\n const poll = () => {\n const key = `${ctx.host.offsetLeft},${ctx.host.offsetTop},${ctx.host.offsetWidth},${ctx.host.offsetHeight}`\n if (key !== lastRect) {\n lastRect = key\n syncOverlay()\n }\n rafId = requestAnimationFrame(poll)\n }\n lastRect = ''\n rafId = requestAnimationFrame(poll)\n }\n\n const stopPolling = () => {\n cancelAnimationFrame(rafId)\n rafId = 0\n }\n\n // ── Proximity show/hide ──\n\n const showOverlay = () => {\n overlay.setAttribute('data-resize-visible', '')\n syncOverlay()\n startPolling()\n }\n\n const hideOverlay = () => {\n if (resizing) return\n overlay.removeAttribute('data-resize-visible')\n label.removeAttribute('data-resize-label-visible')\n stopPolling()\n }\n\n const HIT_MARGIN = 12\n let overlayVisible = false\n\n const modifierHeld = (e: PointerEvent) => {\n if (!modifier) return true\n if (modifier === 'alt') return e.altKey\n if (modifier === 'meta') return e.metaKey\n if (modifier === 'ctrl') return e.ctrlKey\n if (modifier === 'shift') return e.shiftKey\n return true\n }\n\n const onProximity = (e: PointerEvent) => {\n if (resizing) return\n\n if (!modifierHeld(e)) {\n if (overlayVisible) { overlayVisible = false; hideOverlay() }\n return\n }\n\n const rect = ctx.host.getBoundingClientRect()\n const inZone =\n e.clientX >= rect.left - HIT_MARGIN &&\n e.clientX <= rect.right + HIT_MARGIN &&\n e.clientY >= rect.top - HIT_MARGIN &&\n e.clientY <= rect.bottom + HIT_MARGIN\n\n if (inZone && !overlayVisible) {\n overlayVisible = true\n showOverlay()\n } else if (!inZone && overlayVisible) {\n overlayVisible = false\n hideOverlay()\n }\n }\n\n document.addEventListener('pointermove', onProximity, { passive: true })\n\n // ── Cleanup ──\n\n return () => {\n if (resizing) {\n document.documentElement.style.cursor = ''\n ctx.unexpose('resizing')\n }\n document.removeEventListener('pointermove', onProximity)\n document.removeEventListener('pointermove', onPointerMove)\n document.removeEventListener('pointerup', onPointerUp)\n styleObserver.disconnect()\n stopPolling()\n overlay.remove()\n }\n },\n}\n","// ── pan-zoom trait ────────────────────────────────────────────\n//\n// Makes any element a pannable/zoomable canvas surface.\n//\n// Usage:\n// <div traits=\"pan-zoom\">\n// <div traits=\"{ trait: 'pan-zoom', min-zoom: '0.25', max-zoom: '4' }\">\n//\n// Gestures:\n// Middle-click drag or Space+drag → pan\n// Ctrl+wheel → zoom toward pointer\n// Double-click → reset to origin\n//\n// CSS custom properties set on host:\n// --_pan-x, --_pan-y, --_pan-zoom\n//\n// Events:\n// pan-zoom-change (detail: { x, y, scale })\n//\n// Exposed state:\n// data-pan-zoom-scale, data-pan-zoom-x, data-pan-zoom-y\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const panZoomTrait: TraitDefinition = {\n name: 'pan-zoom',\n category: 'gesture',\n channel: 'pointer',\n\n defaults: {\n 'min-zoom': '0.1',\n 'max-zoom': '5',\n 'zoom-step': '0.1',\n },\n\n attach(ctx) {\n const minZoom = Number(ctx.config('min-zoom') ?? '0.1')\n const maxZoom = Number(ctx.config('max-zoom') ?? '5')\n const zoomStep = Number(ctx.config('zoom-step') ?? '0.1')\n\n let panX = 0\n let panY = 0\n let scale = 1\n let isPanning = false\n let spaceDown = false\n let startX = 0\n let startY = 0\n let startPanX = 0\n let startPanY = 0\n\n const apply = () => {\n ctx.host.style.setProperty('--_pan-x', `${panX}px`)\n ctx.host.style.setProperty('--_pan-y', `${panY}px`)\n ctx.host.style.setProperty('--_pan-zoom', `${scale}`)\n ctx.expose('scale', scale.toFixed(2))\n ctx.expose('x', Math.round(panX).toString())\n ctx.expose('y', Math.round(panY).toString())\n ctx.emit('pan-zoom-change', { x: panX, y: panY, scale })\n }\n\n const clampScale = (v: number) => Math.min(maxZoom, Math.max(minZoom, v))\n\n // ── Pan via middle-click or Space+drag ──\n const onPointerDown = (e: PointerEvent) => {\n // Middle button (1) or left button (0) while Space held\n if (e.button === 1 || (e.button === 0 && spaceDown)) {\n e.preventDefault()\n isPanning = true\n startX = e.clientX\n startY = e.clientY\n startPanX = panX\n startPanY = panY\n ctx.host.setPointerCapture(e.pointerId)\n }\n }\n\n const onPointerMove = (e: PointerEvent) => {\n if (!isPanning) return\n e.preventDefault()\n panX = startPanX + (e.clientX - startX)\n panY = startPanY + (e.clientY - startY)\n apply()\n }\n\n const onPointerUp = (e: PointerEvent) => {\n if (!isPanning) return\n isPanning = false\n ctx.host.releasePointerCapture(e.pointerId)\n }\n\n // ── Zoom toward pointer via Ctrl+wheel ──\n const onWheel = (e: WheelEvent) => {\n if (!e.ctrlKey) return\n e.preventDefault()\n\n const rect = ctx.host.getBoundingClientRect()\n // Pointer position relative to element\n const pointerX = e.clientX - rect.left\n const pointerY = e.clientY - rect.top\n\n const prevScale = scale\n const delta = e.deltaY > 0 ? -zoomStep : zoomStep\n scale = clampScale(scale + delta)\n\n // Adjust pan so point under cursor stays fixed\n const ratio = scale / prevScale\n panX = pointerX - ratio * (pointerX - panX)\n panY = pointerY - ratio * (pointerY - panY)\n\n apply()\n }\n\n // ── Space key for pan mode ──\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.code === 'Space' && !e.repeat && !spaceDown) {\n const tag = (e.target as HTMLElement).tagName\n // Don't hijack Space in inputs\n if (tag === 'INPUT' || tag === 'TEXTAREA') return\n spaceDown = true\n ctx.expose('panning', true)\n }\n }\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.code === 'Space') {\n spaceDown = false\n ctx.unexpose('panning')\n }\n }\n\n // ── Double-click to reset ──\n const onDblClick = (e: MouseEvent) => {\n // Only reset on middle-double-click or when holding Ctrl\n if (e.button !== 1 && !e.ctrlKey) return\n panX = 0\n panY = 0\n scale = 1\n apply()\n }\n\n ctx.host.addEventListener('pointerdown', onPointerDown)\n ctx.host.addEventListener('pointermove', onPointerMove)\n ctx.host.addEventListener('pointerup', onPointerUp)\n ctx.host.addEventListener('wheel', onWheel, { passive: false })\n ctx.host.addEventListener('dblclick', onDblClick)\n document.addEventListener('keydown', onKeyDown)\n document.addEventListener('keyup', onKeyUp)\n\n // Set initial values\n apply()\n\n return () => {\n ctx.host.removeEventListener('pointerdown', onPointerDown)\n ctx.host.removeEventListener('pointermove', onPointerMove)\n ctx.host.removeEventListener('pointerup', onPointerUp)\n ctx.host.removeEventListener('wheel', onWheel)\n ctx.host.removeEventListener('dblclick', onDblClick)\n document.removeEventListener('keydown', onKeyDown)\n document.removeEventListener('keyup', onKeyUp)\n ctx.host.style.removeProperty('--_pan-x')\n ctx.host.style.removeProperty('--_pan-y')\n ctx.host.style.removeProperty('--_pan-zoom')\n }\n },\n}\n","// ── hover trait ──────────────────────────────────────────────\n//\n// Tracks hover state with optional enter/leave delays.\n// Cancels pending timers when the opposite event fires.\n//\n// Usage:\n// <aui-card traits=\"hover\">\n// <aui-card traits=\"{ trait: 'hover', delay: '200', leave-delay: '100' }\">\n//\n// Exposed state:\n// data-hover-active (true when hovered)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const hoverTrait: TraitDefinition = {\n name: 'hover',\n category: 'state',\n targets: 'self',\n\n defaults: {\n delay: '0',\n 'leave-delay': '0',\n },\n\n attach(ctx) {\n const delay = Number(ctx.config('delay') ?? '0')\n const leaveDelay = Number(ctx.config('leave-delay') ?? '0')\n\n let enterTimer: ReturnType<typeof setTimeout> | undefined\n let leaveTimer: ReturnType<typeof setTimeout> | undefined\n\n const activate = () => {\n ctx.expose('active', true)\n ctx.emit('hover-enter', {})\n }\n\n const deactivate = () => {\n ctx.expose('active', false)\n ctx.emit('hover-leave', {})\n }\n\n const onMouseEnter = () => {\n clearTimeout(leaveTimer)\n if (delay > 0) {\n enterTimer = setTimeout(activate, delay)\n } else {\n activate()\n }\n }\n\n const onMouseLeave = () => {\n clearTimeout(enterTimer)\n if (leaveDelay > 0) {\n leaveTimer = setTimeout(deactivate, leaveDelay)\n } else {\n deactivate()\n }\n }\n\n ctx.host.addEventListener('mouseenter', onMouseEnter)\n ctx.host.addEventListener('mouseleave', onMouseLeave)\n\n return () => {\n ctx.host.removeEventListener('mouseenter', onMouseEnter)\n ctx.host.removeEventListener('mouseleave', onMouseLeave)\n clearTimeout(enterTimer)\n clearTimeout(leaveTimer)\n }\n },\n}\n","// ── toggle-state trait ───────────────────────────────────────\n//\n// Generic boolean toggle. Flips on `press` and exposes\n// the active state as a data attribute + aria-pressed.\n//\n// Usage:\n// <aui-button traits=\"toggle-state\">\n// <aui-button traits=\"{ trait: 'toggle-state', active: 'true' }\">\n//\n// Exposed state:\n// data-toggle-state-active=\"\" (present when active)\n// aria-pressed=\"true|false\"\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\nexport const toggleStateTrait: TraitDefinition = {\n name: 'toggle-state',\n category: 'state',\n targets: 'self',\n\n defaults: {\n active: 'false',\n },\n actions: ['press'],\n\n attach(ctx) {\n const active = signal(ctx.config('active') === 'true')\n\n const handlePress = () => {\n active.value = !active.value\n ctx.emit('toggle', { active: active.value })\n }\n ctx.host.addEventListener('press', handlePress)\n\n ctx.addEffect(() => {\n ctx.expose('active', active.value)\n ctx.host.setAttribute('aria-pressed', String(active.value))\n })\n\n return () => {\n ctx.host.removeEventListener('press', handlePress)\n ctx.host.removeAttribute('aria-pressed')\n }\n },\n}\n","// ── toggle-scheme trait ──────────────────────────────────────\n//\n// Cycles color-scheme on a target element (system → light → dark).\n// Attach to any element that emits `press` (e.g., aui-button).\n//\n// Usage:\n// <aui-button traits=\"toggle-scheme\">\n// <aui-button traits=\"{ trait: 'toggle-scheme', persist: 'true' }\">\n//\n// Exposed state:\n// data-toggle-scheme-scheme=\"system|light|dark\"\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\ntype Scheme = 'system' | 'light' | 'dark'\n\nconst STORAGE_KEY = 'aui-color-scheme'\n\nconst SCHEME_ICONS: Record<Scheme, string> = {\n system: 'desktop',\n light: 'sun',\n dark: 'moon',\n}\n\nconst systemScheme = (): 'light' | 'dark' =>\n matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n\nconst nextScheme = (current: Scheme, list: readonly Scheme[]): Scheme => {\n const resolved = current === 'system' ? systemScheme() : current\n const preferred = resolved === 'dark' ? 'light' : 'dark'\n\n const idx = list.indexOf(current)\n for (let i = 1; i < list.length; i++) {\n const candidate = list[(idx + i) % list.length]!\n const candidateResolved = candidate === 'system' ? systemScheme() : candidate\n if (candidateResolved === preferred) return candidate\n }\n\n return list[(idx + 1) % list.length]!\n}\n\nconst parseScheme = (value: string | undefined): Scheme => {\n if (value === 'light' || value === 'dark' || value === 'system') return value\n return 'system'\n}\n\nconst parseSchemes = (value: string | undefined): readonly Scheme[] => {\n if (!value) return ['system', 'light', 'dark']\n return value.split(',').map(s => s.trim()).filter(\n (s): s is Scheme => s === 'system' || s === 'light' || s === 'dark'\n )\n}\n\nconst loadStored = (): Scheme | null => {\n try {\n const v = localStorage.getItem(STORAGE_KEY)\n if (v === 'light' || v === 'dark' || v === 'system') return v\n } catch { /* storage unavailable */ }\n return null\n}\n\nconst saveStored = (scheme: Scheme): void => {\n try { localStorage.setItem(STORAGE_KEY, scheme) } catch { /* */ }\n}\n\nconst applyToTarget = (target: string, scheme: Scheme, resolved: 'light' | 'dark'): void => {\n const el = target === 'document'\n ? document.documentElement\n : document.querySelector(target)\n\n if (!el) return\n\n if (scheme === 'system') {\n (el as HTMLElement).style.removeProperty('color-scheme')\n el.removeAttribute('data-color-scheme')\n } else {\n ;(el as HTMLElement).style.colorScheme = resolved\n el.setAttribute('data-color-scheme', resolved)\n }\n}\n\nexport const toggleSchemeTrait: TraitDefinition = {\n name: 'toggle-scheme',\n category: 'state',\n targets: 'external',\n\n defaults: {\n scheme: 'system',\n schemes: 'system,light,dark',\n target: 'document',\n persist: 'false',\n },\n actions: ['press'],\n\n attach(ctx) {\n const persist = ctx.config('persist') === 'true'\n const schemes = parseSchemes(ctx.config('schemes'))\n const targetSelector = ctx.config('target') ?? 'document'\n\n const stored = persist ? loadStored() : null\n const scheme = signal<Scheme>(stored ?? parseScheme(ctx.config('scheme')))\n\n // Listen for press from the host\n const handlePress = () => {\n const next = nextScheme(scheme.value, schemes)\n scheme.value = next\n if (persist) saveStored(next)\n ctx.emit('scheme-change', { scheme: next })\n }\n ctx.host.addEventListener('press', handlePress)\n\n // Reactive effect: update icon, label, target color-scheme\n ctx.addEffect(() => {\n const s = scheme.value\n const resolved = s === 'system' ? systemScheme() : s\n\n // Update host icon-button\n ctx.host.setAttribute('icon', SCHEME_ICONS[s])\n ctx.host.setAttribute('label', `Color scheme: ${s}`)\n\n // Expose state\n ctx.expose('scheme', s)\n\n // Apply to target\n applyToTarget(targetSelector, s, resolved)\n })\n\n // Watch system preference changes\n const mq = matchMedia('(prefers-color-scheme: dark)')\n const mqHandler = () => {\n // Re-trigger effect when system preference changes and scheme is \"system\"\n if (scheme.value === 'system') {\n scheme.value = 'system'\n }\n }\n mq.addEventListener('change', mqHandler)\n\n // Cleanup: non-reactive listeners\n return () => {\n ctx.host.removeEventListener('press', handlePress)\n mq.removeEventListener('change', mqHandler)\n }\n },\n}\n","// ── copy trait ───────────────────────────────────────────────\n//\n// Copies text to the clipboard on `press`. Shows a brief\n// \"Copied!\" feedback state before restoring the original label.\n//\n// Usage:\n// <aui-button traits=\"copy\">\n// <aui-button traits=\"{ trait: 'copy', text: 'hello', feedback: '2000' }\">\n//\n// Events:\n// copy — fires after successful copy, detail: { text }\n//\n// Exposed state:\n// data-copy-copied=\"\" (present during feedback window)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const copyTrait: TraitDefinition = {\n name: 'copy',\n category: 'state',\n targets: 'self',\n\n defaults: {\n text: '',\n feedback: '1500',\n },\n actions: ['press'],\n\n attach(ctx) {\n const feedbackMs = parseInt(ctx.config('feedback') ?? '1500', 10)\n let timer: ReturnType<typeof setTimeout> | null = null\n let originalLabel: string | null = null\n\n const clearTimer = () => {\n if (timer !== null) {\n clearTimeout(timer)\n timer = null\n }\n }\n\n const restore = () => {\n clearTimer()\n ctx.unexpose('copied')\n if (originalLabel !== null) {\n ctx.host.setAttribute('label', originalLabel)\n originalLabel = null\n }\n }\n\n const handlePress = () => {\n const text = ctx.config('text') || ctx.host.textContent || ''\n\n navigator.clipboard.writeText(text).then(() => {\n // Cancel any in-flight feedback cycle\n restore()\n\n // Capture current label before overwriting\n originalLabel = ctx.host.getAttribute('label')\n ctx.expose('copied', true)\n ctx.host.setAttribute('label', 'Copied!')\n\n ctx.emit('copy', { text })\n\n timer = setTimeout(restore, feedbackMs)\n })\n }\n\n ctx.host.addEventListener('press', handlePress)\n\n return () => {\n restore()\n ctx.host.removeEventListener('press', handlePress)\n }\n },\n}\n","// ── clipboard trait ─────────────────────────────────────────\n//\n// Handles paste events on the host, parsing clipboard data\n// into structured text, HTML, and file components.\n//\n// Usage:\n// <aui-editor traits=\"clipboard\">\n// <aui-editor traits=\"{ trait: 'clipboard', accept: 'text/plain', prevent: 'true' }\">\n//\n// Events:\n// paste — fires on paste, detail: { text, html, files, types }\n//\n// Exposed state:\n// data-clipboard-has-data=\"\" (present after a paste)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const clipboardTrait: TraitDefinition = {\n name: 'clipboard',\n category: 'state',\n targets: 'self',\n\n defaults: {\n accept: 'text/plain,text/html,image/*',\n prevent: 'true',\n },\n\n attach(ctx) {\n const handlePaste = (e: Event) => {\n const event = e as ClipboardEvent\n const prevent = ctx.config('prevent') !== 'false'\n const accept = (ctx.config('accept') ?? '').split(',').map(s => s.trim())\n\n if (prevent) event.preventDefault()\n\n const clipboard = event.clipboardData\n if (!clipboard) return\n\n const types = Array.from(clipboard.types)\n let text: string | undefined\n let html: string | undefined\n const files: File[] = []\n\n // Check if a type matches any accept pattern\n const isAccepted = (type: string): boolean =>\n accept.some(pattern => {\n if (pattern.endsWith('/*')) {\n return type.startsWith(pattern.slice(0, -1))\n }\n return type === pattern\n })\n\n if (isAccepted('text/plain')) {\n text = clipboard.getData('text/plain') || undefined\n }\n\n if (isAccepted('text/html')) {\n html = clipboard.getData('text/html') || undefined\n }\n\n for (let i = 0; i < clipboard.files.length; i++) {\n const file = clipboard.files[i]!\n if (isAccepted(file.type)) {\n files.push(file)\n }\n }\n\n ctx.expose('has-data', true)\n ctx.emit('paste', {\n text: text ?? '',\n html: html ?? '',\n files,\n types,\n })\n }\n\n ctx.host.addEventListener('paste', handlePaste)\n\n return () => {\n ctx.host.removeEventListener('paste', handlePaste)\n ctx.unexpose('has-data')\n }\n },\n}\n","// ── shortcut trait ───────────────────────────────────────────\n//\n// Keyboard shortcut binding. Parses a key combo string and\n// listens for matching keydown events, emitting shortcut\n// and press on the host.\n//\n// Usage:\n// <aui-button traits=\"{ trait: 'shortcut', key: 'ctrl+k' }\">\n// <aui-button traits=\"{ trait: 'shortcut', key: 'meta+shift+p', global: 'true' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\ninterface ParsedCombo {\n readonly ctrl: boolean\n readonly alt: boolean\n readonly shift: boolean\n readonly meta: boolean\n readonly key: string\n}\n\nconst parseCombo = (combo: string): ParsedCombo => {\n const parts = combo.toLowerCase().split('+').map((s) => s.trim())\n return {\n ctrl: parts.includes('ctrl'),\n alt: parts.includes('alt'),\n shift: parts.includes('shift'),\n meta: parts.includes('meta'),\n key: parts.filter((p) => !['ctrl', 'alt', 'shift', 'meta'].includes(p))[0] ?? '',\n }\n}\n\nconst matchesCombo = (e: KeyboardEvent, combo: ParsedCombo): boolean =>\n e.ctrlKey === combo.ctrl &&\n e.altKey === combo.alt &&\n e.shiftKey === combo.shift &&\n e.metaKey === combo.meta &&\n e.key.toLowerCase() === combo.key\n\nexport const shortcutTrait: TraitDefinition = {\n name: 'shortcut',\n category: 'state',\n\n defaults: {\n key: '',\n global: 'false',\n },\n\n attach(ctx) {\n const keyCombo = ctx.config('key') ?? ''\n if (keyCombo === '') return\n\n const global = (ctx.config('global') ?? 'false') === 'true'\n const parsed = parseCombo(keyCombo)\n const target = global ? document : ctx.host\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (matchesCombo(ke, parsed)) {\n ke.preventDefault()\n ctx.emit('shortcut', { key: keyCombo })\n ctx.emit('press', {})\n }\n }\n\n target.addEventListener('keydown', onKeydown)\n\n return () => {\n target.removeEventListener('keydown', onKeydown)\n }\n },\n}\n","// ── search trait ─────────────────────────────────────────────\n//\n// Full-text search filter on host's children. Listens for\n// search events or input events on a child input element,\n// then shows/hides children based on case-insensitive substring match.\n//\n// Usage:\n// <aui-list traits=\"search\">\n// <aui-list traits=\"{ trait: 'search', debounce: '200', attr: 'data-label' }\">\n//\n// Exposed state:\n// data-search-count (number of visible matches)\n// data-search-query (current query string)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const searchTrait: TraitDefinition = {\n name: 'search',\n category: 'state',\n targets: 'self',\n\n defaults: {\n selector: '> *',\n attr: 'textContent',\n debounce: '150',\n },\n actions: ['search'],\n\n attach(ctx) {\n const selector = ctx.config('selector') ?? '> *'\n const attr = ctx.config('attr') ?? 'textContent'\n const debounceMs = Number(ctx.config('debounce') ?? '150')\n\n let debounceTimer: ReturnType<typeof setTimeout> | undefined\n let currentQuery = ''\n\n const sel = selector.startsWith('> ') ? `:scope ${selector}` : selector\n const getItems = (): HTMLElement[] =>\n [...ctx.host.querySelectorAll<HTMLElement>(sel)]\n .filter((el) => el.tagName !== 'INPUT')\n\n const getTextOf = (el: HTMLElement): string => {\n if (attr === 'textContent') return (el.textContent ?? '').trim()\n return (el.getAttribute(attr) ?? '').trim()\n }\n\n const applyFilter = (query: string) => {\n currentQuery = query\n const normalized = query.toLowerCase()\n const items = getItems()\n let count = 0\n\n for (const item of items) {\n const text = getTextOf(item).toLowerCase()\n if (normalized === '' || text.includes(normalized)) {\n item.removeAttribute('hidden')\n count++\n } else {\n item.setAttribute('hidden', '')\n }\n }\n\n ctx.expose('count', String(count))\n ctx.expose('query', currentQuery)\n ctx.emit('search-results', { count, query: currentQuery })\n }\n\n const scheduleFilter = (query: string) => {\n clearTimeout(debounceTimer)\n debounceTimer = setTimeout(() => applyFilter(query), debounceMs)\n }\n\n const onSearchEvent = (e: Event) => {\n const ce = e as CustomEvent<{ query?: string }>\n const query = ce.detail?.query ?? ''\n scheduleFilter(query)\n }\n\n const onInput = (e: Event) => {\n const target = e.target as HTMLInputElement | null\n if (target?.tagName === 'INPUT') {\n scheduleFilter(target.value)\n }\n }\n\n ctx.host.addEventListener('search', onSearchEvent)\n ctx.host.addEventListener('input', onInput)\n\n return () => {\n ctx.host.removeEventListener('search', onSearchEvent)\n ctx.host.removeEventListener('input', onInput)\n clearTimeout(debounceTimer)\n }\n },\n}\n","// ── drop-zone trait ─────────────────────────────────────────\n//\n// Makes the host a drag-and-drop target for files and data.\n// Validates dropped content against accepted mime types.\n//\n// Usage:\n// <aui-panel traits=\"drop-zone\">\n// <aui-panel traits=\"{ trait: 'drop-zone', accept: 'image/*,text/plain', overlay: 'true' }\">\n//\n// Events:\n// drop — fires on successful drop, detail: { files, items, text }\n//\n// Exposed state:\n// data-drop-zone-over=\"true\" (present while dragging over host)\n\nimport type { TraitDefinition } from '../types.ts'\n\nfunction matchesMime(type: string, pattern: string): boolean {\n if (pattern === '*' || pattern === '*/*') return true\n if (pattern.endsWith('/*')) {\n const prefix = pattern.slice(0, pattern.indexOf('/'))\n return type.startsWith(prefix + '/')\n }\n return type === pattern\n}\n\nfunction isAccepted(dataTransfer: DataTransfer, patterns: string[]): boolean {\n if (patterns.length === 1 && (patterns[0] === '*' || patterns[0] === '*/*')) return true\n\n for (let i = 0; i < dataTransfer.items.length; i++) {\n const item = dataTransfer.items[i]\n if (patterns.some((p) => matchesMime(item.type, p))) return true\n }\n return false\n}\n\nexport const dropZoneTrait: TraitDefinition = {\n name: 'drop-zone',\n category: 'state',\n\n defaults: {\n accept: '*',\n overlay: 'true',\n },\n\n attach(ctx) {\n const acceptRaw = ctx.config('accept') ?? '*'\n const patterns = acceptRaw.split(',').map((s) => s.trim())\n let enterCount = 0\n\n const onDragOver = (e: Event) => {\n const de = e as DragEvent\n if (!de.dataTransfer) return\n if (!isAccepted(de.dataTransfer, patterns)) return\n de.preventDefault()\n de.dataTransfer.dropEffect = 'copy'\n }\n\n const onDragEnter = (e: Event) => {\n const de = e as DragEvent\n if (!de.dataTransfer) return\n if (!isAccepted(de.dataTransfer, patterns)) return\n de.preventDefault()\n enterCount++\n if (enterCount === 1) {\n ctx.expose('over', true)\n }\n }\n\n const onDragLeave = (_e: Event) => {\n enterCount--\n if (enterCount <= 0) {\n enterCount = 0\n ctx.expose('over', false)\n }\n }\n\n const onDrop = (e: Event) => {\n const de = e as DragEvent\n de.preventDefault()\n enterCount = 0\n ctx.expose('over', false)\n\n if (!de.dataTransfer) return\n if (!isAccepted(de.dataTransfer, patterns)) return\n\n const text = de.dataTransfer.getData('text/plain')\n\n ctx.emit('drop', {\n files: de.dataTransfer.files,\n items: de.dataTransfer.items,\n text,\n })\n }\n\n ctx.host.addEventListener('dragover', onDragOver)\n ctx.host.addEventListener('dragenter', onDragEnter)\n ctx.host.addEventListener('dragleave', onDragLeave)\n ctx.host.addEventListener('drop', onDrop)\n\n return () => {\n ctx.host.removeEventListener('dragover', onDragOver)\n ctx.host.removeEventListener('dragenter', onDragEnter)\n ctx.host.removeEventListener('dragleave', onDragLeave)\n ctx.host.removeEventListener('drop', onDrop)\n }\n },\n}\n","// ── edit trait ───────────────────────────────────────────────\n//\n// Inline edit mode: makes host content-editable on activation.\n// Commits or cancels based on configured triggers.\n//\n// Usage:\n// <aui-label traits=\"edit\">\n// <aui-label traits=\"{ trait: 'edit', event: 'dblclick', commit: 'blur' }\">\n//\n// Events:\n// edit-commit — fires on commit, detail: { value, previous }\n// edit-cancel — fires on cancel (Escape)\n//\n// Exposed state:\n// data-edit-editing=\"\" (present while editing)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const editTrait: TraitDefinition = {\n name: 'edit',\n category: 'state',\n\n defaults: {\n event: 'dblclick',\n commit: 'blur',\n },\n\n attach(ctx) {\n const activationEvent = ctx.config('event') ?? 'dblclick'\n const commitOn = ctx.config('commit') ?? 'blur'\n\n let editing = false\n let previousText = ''\n\n const selectAll = () => {\n const range = document.createRange()\n range.selectNodeContents(ctx.host)\n const sel = window.getSelection()\n if (sel) {\n sel.removeAllRanges()\n sel.addRange(range)\n }\n }\n\n const startEdit = () => {\n if (editing) return\n editing = true\n previousText = ctx.host.textContent ?? ''\n ctx.host.contentEditable = 'true'\n ctx.host.focus()\n selectAll()\n ctx.expose('editing', true)\n }\n\n const commitEdit = () => {\n if (!editing) return\n editing = false\n ctx.host.contentEditable = 'false'\n ctx.unexpose('editing')\n\n const value = ctx.host.textContent ?? ''\n ctx.emit('edit-commit', { value, previous: previousText })\n }\n\n const cancelEdit = () => {\n if (!editing) return\n editing = false\n ctx.host.textContent = previousText\n ctx.host.contentEditable = 'false'\n ctx.unexpose('editing')\n ctx.emit('edit-cancel', {})\n }\n\n const onActivate = () => {\n startEdit()\n }\n\n const onBlur = () => {\n if (commitOn === 'blur') {\n commitEdit()\n }\n }\n\n const onKeyDown = (e: Event) => {\n if (!editing) return\n const ke = e as KeyboardEvent\n\n if (ke.key === 'Escape') {\n ke.preventDefault()\n cancelEdit()\n return\n }\n\n if (ke.key === 'Enter' && commitOn === 'enter') {\n ke.preventDefault()\n commitEdit()\n }\n }\n\n ctx.host.addEventListener(activationEvent, onActivate)\n ctx.host.addEventListener('blur', onBlur)\n ctx.host.addEventListener('keydown', onKeyDown)\n\n return () => {\n if (editing) {\n ctx.host.contentEditable = 'false'\n ctx.unexpose('editing')\n }\n ctx.host.removeEventListener(activationEvent, onActivate)\n ctx.host.removeEventListener('blur', onBlur)\n ctx.host.removeEventListener('keydown', onKeyDown)\n }\n },\n}\n","// ── intersect trait ──────────────────────────────────────────\n//\n// IntersectionObserver wrapper. Exposes visibility state and\n// emits events when the host enters or leaves the viewport.\n//\n// Usage:\n// <aui-card traits=\"intersect\">\n// <aui-card traits=\"{ trait: 'intersect', threshold: '0.5', once: 'true' }\">\n//\n// Exposed state:\n// data-intersect-visible (true when intersecting)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const intersectTrait: TraitDefinition = {\n name: 'intersect',\n category: 'state',\n targets: 'self',\n\n defaults: {\n threshold: '0',\n 'root-margin': '0px',\n once: 'false',\n },\n\n attach(ctx) {\n const threshold = Number(ctx.config('threshold') ?? '0')\n const rootMargin = ctx.config('root-margin') ?? '0px'\n const once = (ctx.config('once') ?? 'false') === 'true'\n\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const visible = entry.isIntersecting\n ctx.expose('visible', visible)\n ctx.emit('intersect', {\n isIntersecting: visible,\n ratio: entry.intersectionRatio,\n })\n\n if (once && visible) {\n observer.disconnect()\n }\n }\n },\n {\n threshold,\n rootMargin,\n },\n )\n\n observer.observe(ctx.host)\n\n return () => {\n observer.disconnect()\n }\n },\n}\n","// ── link-paste trait ─────────────────────────────────────────\n//\n// Detects URLs in pasted text and emits an event for embed\n// or link-preview handling.\n//\n// Usage:\n// <aui-editor traits=\"link-paste\">\n// <aui-editor traits=\"{ trait: 'link-paste', auto: 'true' }\">\n//\n// Events:\n// link-paste — fires when a URL is detected in paste, detail: { url, text }\n//\n// Exposed state:\n// data-link-paste-url=\"https://...\" (detected URL, empty when none)\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst URL_REGEX = /https?:\\/\\/[^\\s<>\"{}|\\\\^`[\\]]+/\n\nexport const linkPasteTrait: TraitDefinition = {\n name: 'link-paste',\n category: 'state',\n targets: 'self',\n\n defaults: {\n auto: 'true',\n },\n\n attach(ctx) {\n const handlePaste = (e: Event) => {\n const event = e as ClipboardEvent\n const auto = ctx.config('auto') !== 'false'\n if (!auto) return\n\n const clipboard = event.clipboardData\n if (!clipboard) return\n\n const text = clipboard.getData('text/plain')\n if (!text) return\n\n const match = URL_REGEX.exec(text.trim())\n if (!match) {\n ctx.expose('url', '')\n return\n }\n\n const url = match[0]\n ctx.expose('url', url)\n ctx.emit('link-paste', { url, text: text.trim() })\n }\n\n ctx.host.addEventListener('paste', handlePaste)\n\n return () => {\n ctx.host.removeEventListener('paste', handlePaste)\n ctx.unexpose('url')\n }\n },\n}\n","// ── linked-scroll trait ───────────────────────────────────────\n//\n// Bidirectional scroll sync between two elements.\n// Syncs scroll percentage (not absolute pixels) so it works\n// with different-sized content.\n//\n// Usage:\n// <div traits=\"{ trait: 'linked-scroll', target: '#preview' }\">\n// <div traits=\"{ trait: 'linked-scroll', target: '#preview', axis: 'y' }\">\n//\n// Config:\n// target — CSS selector for the sync partner\n// axis — 'both' | 'x' | 'y' (default: 'both')\n//\n// Exposed state:\n// data-linked-scroll-syncing (boolean, during sync)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const linkedScrollTrait: TraitDefinition = {\n name: 'linked-scroll',\n category: 'state',\n targets: 'external',\n\n defaults: {\n target: '',\n axis: 'both',\n },\n\n attach(ctx) {\n const selector = ctx.config('target')\n if (!selector) {\n console.warn('[agent-ui] linked-scroll trait: missing required \"target\" config.')\n return\n }\n\n const axis = ctx.config('axis') ?? 'both'\n let syncing = false\n\n const target = document.querySelector<HTMLElement>(selector)\n if (!target) {\n console.warn(`[agent-ui] linked-scroll trait: target \"${selector}\" not found.`)\n return\n }\n\n const syncScroll = (source: HTMLElement, dest: HTMLElement) => {\n if (syncing) return\n syncing = true\n ctx.expose('syncing', true)\n\n if (axis === 'both' || axis === 'x') {\n const maxX = source.scrollWidth - source.clientWidth\n const pct = maxX > 0 ? source.scrollLeft / maxX : 0\n const destMaxX = dest.scrollWidth - dest.clientWidth\n dest.scrollLeft = pct * destMaxX\n }\n\n if (axis === 'both' || axis === 'y') {\n const maxY = source.scrollHeight - source.clientHeight\n const pct = maxY > 0 ? source.scrollTop / maxY : 0\n const destMaxY = dest.scrollHeight - dest.clientHeight\n dest.scrollTop = pct * destMaxY\n }\n\n // Clear guard after a frame to allow the scroll event from dest to fire and be ignored\n requestAnimationFrame(() => {\n syncing = false\n ctx.expose('syncing', false)\n })\n }\n\n const onHostScroll = () => syncScroll(ctx.host, target)\n const onTargetScroll = () => syncScroll(target, ctx.host)\n\n ctx.host.addEventListener('scroll', onHostScroll, { passive: true })\n target.addEventListener('scroll', onTargetScroll, { passive: true })\n\n return () => {\n ctx.host.removeEventListener('scroll', onHostScroll)\n target.removeEventListener('scroll', onTargetScroll)\n }\n },\n}\n","// ── mention trait ────────────────────────────────────────────\n//\n// Detects @mentions in text input (contenteditable or input).\n// Emits search events as the user types after the trigger\n// character, and listens for a selection event to insert the\n// chosen mention text.\n//\n// Usage:\n// <aui-input traits=\"mention\">\n// <aui-input traits=\"{ trait: 'mention', trigger: '@', min-length: '2' }\">\n//\n// Events:\n// mention-search — fires as user types after trigger, detail: { query }\n//\n// Listens for:\n// mention-select — external event with { text } to insert mention\n//\n// Exposed state:\n// data-mention-active=\"\" (present while typing a mention)\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\nexport const mentionTrait: TraitDefinition = {\n name: 'mention',\n category: 'state',\n targets: 'self',\n\n defaults: {\n trigger: '@',\n 'min-length': '1',\n },\n actions: ['mention-select'],\n\n attach(ctx) {\n const trigger = ctx.config('trigger') ?? '@'\n const minLength = parseInt(ctx.config('min-length') ?? '1', 10)\n const active = signal(false)\n let mentionStart = -1\n\n const getValue = (): string => {\n const host = ctx.host\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n return host.value\n }\n return host.textContent ?? ''\n }\n\n const getCursorPos = (): number => {\n const host = ctx.host\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n return host.selectionStart ?? host.value.length\n }\n const sel = window.getSelection()\n if (sel && sel.rangeCount > 0 && host.contains(sel.anchorNode)) {\n return sel.anchorOffset\n }\n return (host.textContent ?? '').length\n }\n\n const handleInput = () => {\n const value = getValue()\n const cursor = getCursorPos()\n\n // Search backwards from cursor for the trigger character\n const beforeCursor = value.slice(0, cursor)\n const triggerIdx = beforeCursor.lastIndexOf(trigger)\n\n if (triggerIdx === -1) {\n if (active.value) active.value = false\n return\n }\n\n // Trigger must be at start or preceded by whitespace\n if (triggerIdx > 0 && !/\\s/.test(beforeCursor[triggerIdx - 1]!)) {\n if (active.value) active.value = false\n return\n }\n\n const query = beforeCursor.slice(triggerIdx + trigger.length)\n\n // Query must not contain whitespace (simple mention rule)\n if (/\\s/.test(query)) {\n if (active.value) active.value = false\n return\n }\n\n if (query.length >= minLength) {\n mentionStart = triggerIdx\n active.value = true\n ctx.emit('mention-search', { query })\n } else {\n if (active.value) active.value = false\n }\n }\n\n const handleSelect = (e: Event) => {\n const detail = (e as CustomEvent).detail as Record<string, unknown> | undefined\n const text = String(detail?.text ?? '')\n if (!text || mentionStart === -1) return\n\n const host = ctx.host\n const value = getValue()\n const cursor = getCursorPos()\n const before = value.slice(0, mentionStart)\n const after = value.slice(cursor)\n const inserted = `${trigger}${text} `\n\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n host.value = before + inserted + after\n const pos = before.length + inserted.length\n host.setSelectionRange(pos, pos)\n } else {\n host.textContent = before + inserted + after\n }\n\n active.value = false\n mentionStart = -1\n }\n\n ctx.host.addEventListener('input', handleInput)\n ctx.host.addEventListener('mention-select', handleSelect)\n\n ctx.addEffect(() => {\n ctx.expose('active', active.value)\n })\n\n return () => {\n ctx.host.removeEventListener('input', handleInput)\n ctx.host.removeEventListener('mention-select', handleSelect)\n }\n },\n}\n","// ── persist trait ─────────────────────────────────────────────\n//\n// Saves/restores arbitrary state to localStorage. Generic\n// primitive for any component that needs persistence.\n//\n// Usage:\n// <aui-panes traits=\"{ trait: 'persist', key: 'my-layout' }\">\n// <aui-panes traits=\"{ trait: 'persist', key: 'my-layout', debounce: '500' }\">\n//\n// Events:\n// persist-load — fires on attach with saved state (detail: { state })\n// persist-save — host dispatches this to trigger a save (detail: { state })\n//\n// Exposed state:\n// data-persist-ready (boolean, set after initial load)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const persistTrait: TraitDefinition = {\n name: 'persist',\n category: 'state',\n targets: 'self',\n\n defaults: {\n key: '',\n debounce: '300',\n },\n\n attach(ctx) {\n const key = ctx.config('key')\n if (!key) {\n console.warn('[agent-ui] persist trait: missing required \"key\" config.')\n return\n }\n\n const debounceMs = parseInt(ctx.config('debounce') ?? '300', 10)\n let timer: ReturnType<typeof setTimeout> | null = null\n\n // ── Load ──\n try {\n const raw = localStorage.getItem(key)\n if (raw !== null) {\n const state: unknown = JSON.parse(raw)\n ctx.emit('persist-load', { state })\n }\n } catch {\n // Private browsing or corrupt data — silently skip\n }\n\n ctx.expose('ready', true)\n\n // ── Save (debounced) ──\n const handleSave = (e: Event) => {\n const detail = (e as CustomEvent).detail as { state?: unknown } | undefined\n if (!detail?.state) return\n\n if (timer !== null) clearTimeout(timer)\n timer = setTimeout(() => {\n timer = null\n try {\n localStorage.setItem(key, JSON.stringify(detail.state))\n } catch {\n // Quota exceeded or private browsing — silently skip\n }\n }, debounceMs)\n }\n\n ctx.host.addEventListener('persist-save', handleSave)\n\n return () => {\n ctx.host.removeEventListener('persist-save', handleSave)\n if (timer !== null) clearTimeout(timer)\n }\n },\n}\n","// ── range-select trait ──────────────────────────────────────\n//\n// Shift/Cmd-click range and multi-selection on host's children.\n// Manages selection state via attributes on child elements.\n//\n// Usage:\n// <aui-list traits=\"range-select\">\n// <aui-list traits=\"{ trait: 'range-select', selector: '.item', attr: 'selected' }\">\n//\n// Events:\n// selection-change — fires on selection change, detail: { selected, count }\n//\n// Exposed state:\n// data-range-select-count=\"3\" (number of selected items)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const rangeSelectTrait: TraitDefinition = {\n name: 'range-select',\n category: 'state',\n\n defaults: {\n selector: '> *',\n attr: 'selected',\n },\n\n attach(ctx) {\n const selector = ctx.config('selector') ?? '> *'\n const attr = ctx.config('attr') ?? 'selected'\n\n let lastClickedIndex = -1\n\n const sel = selector.startsWith('> ') ? `:scope ${selector}` : selector\n const getItems = (): HTMLElement[] =>\n Array.from(ctx.host.querySelectorAll<HTMLElement>(sel))\n\n const getSelectedIndices = (items: HTMLElement[]): number[] =>\n items.reduce<number[]>((acc, el, i) => {\n if (el.hasAttribute(attr)) acc.push(i)\n return acc\n }, [])\n\n const emitChange = (items: HTMLElement[]) => {\n const selected = getSelectedIndices(items)\n ctx.expose('count', String(selected.length))\n ctx.emit('selection-change', { selected, count: selected.length })\n }\n\n const clearSelection = (items: HTMLElement[]) => {\n for (const el of items) {\n el.removeAttribute(attr)\n }\n }\n\n const onClick = (e: Event) => {\n const me = e as MouseEvent\n const target = me.target as HTMLElement\n const items = getItems()\n\n // Find which item was clicked\n let clickedIndex = -1\n for (let i = 0; i < items.length; i++) {\n if (items[i].contains(target)) {\n clickedIndex = i\n break\n }\n }\n\n if (clickedIndex === -1) return\n\n if (me.shiftKey && lastClickedIndex !== -1) {\n // Range select\n const start = Math.min(lastClickedIndex, clickedIndex)\n const end = Math.max(lastClickedIndex, clickedIndex)\n\n clearSelection(items)\n for (let i = start; i <= end; i++) {\n items[i].setAttribute(attr, '')\n }\n } else if (me.metaKey || me.ctrlKey) {\n // Toggle individual\n if (items[clickedIndex].hasAttribute(attr)) {\n items[clickedIndex].removeAttribute(attr)\n } else {\n items[clickedIndex].setAttribute(attr, '')\n }\n lastClickedIndex = clickedIndex\n } else {\n // Single select\n clearSelection(items)\n items[clickedIndex].setAttribute(attr, '')\n lastClickedIndex = clickedIndex\n }\n\n emitChange(items)\n }\n\n ctx.host.addEventListener('click', onClick)\n ctx.expose('count', '0')\n\n return () => {\n ctx.host.removeEventListener('click', onClick)\n }\n },\n}\n","// ── selection trait ──────────────────────────────────────────\n//\n// Multi-select state management for host's children.\n// Listens for press events on children to toggle selection.\n//\n// Usage:\n// <aui-list traits=\"selection\">\n// <aui-list traits=\"{ trait: 'selection', mode: 'multiple', selector: '.item' }\">\n//\n// Events:\n// select — fires on selection change, detail: { value, selected, all }\n//\n// Exposed state:\n// data-selection-count=\"2\" (number of selected items)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const selectionTrait: TraitDefinition = {\n name: 'selection',\n category: 'state',\n\n defaults: {\n mode: 'single',\n selector: '> *',\n },\n actions: ['press'],\n\n attach(ctx) {\n const mode = ctx.config('mode') ?? 'single'\n const selector = ctx.config('selector') ?? '> *'\n const attr = 'selected'\n\n const sel = selector.startsWith('> ') ? `:scope ${selector}` : selector\n const getItems = (): HTMLElement[] =>\n Array.from(ctx.host.querySelectorAll<HTMLElement>(sel))\n\n const getSelectedValues = (items: HTMLElement[]): string[] =>\n items\n .filter((el) => el.hasAttribute(attr))\n .map((el) => el.dataset.value ?? '')\n\n const updateCount = (items: HTMLElement[]) => {\n const count = items.filter((el) => el.hasAttribute(attr)).length\n ctx.expose('count', String(count))\n }\n\n const onPress = (e: Event) => {\n const target = e.target as HTMLElement\n const items = getItems()\n\n // Find which item received the press\n let pressedItem: HTMLElement | null = null\n for (const item of items) {\n if (item === target || item.contains(target)) {\n pressedItem = item\n break\n }\n }\n\n if (!pressedItem) return\n\n const wasSelected = pressedItem.hasAttribute(attr)\n const value = pressedItem.dataset.value ?? ''\n\n if (mode === 'single') {\n // Deselect all others\n for (const item of items) {\n item.removeAttribute(attr)\n }\n // Select clicked item (unless it was already the only selected one)\n if (!wasSelected) {\n pressedItem.setAttribute(attr, '')\n }\n } else {\n // Multiple mode: toggle\n if (wasSelected) {\n pressedItem.removeAttribute(attr)\n } else {\n pressedItem.setAttribute(attr, '')\n }\n }\n\n const all = getSelectedValues(items)\n updateCount(items)\n\n ctx.emit('select', {\n value,\n selected: !wasSelected,\n all,\n })\n }\n\n ctx.host.addEventListener('press', onPress)\n ctx.expose('count', '0')\n\n return () => {\n ctx.host.removeEventListener('press', onPress)\n }\n },\n}\n","// ── slash-command trait ──────────────────────────────────────\n//\n// Detects /commands typed in contenteditable or input elements.\n// Emits incremental input events for autocomplete and fires\n// a command event on Enter.\n//\n// Usage:\n// <aui-input traits=\"slash-command\">\n// <aui-input traits=\"{ trait: 'slash-command', trigger: '/', commands: 'search,help,clear' }\">\n//\n// Events:\n// command — fires on Enter with active command, detail: { command, args }\n// command-input — fires as user types, detail: { partial }\n//\n// Exposed state:\n// data-slash-command-active=\"\" (present while typing a command)\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\nexport const slashCommandTrait: TraitDefinition = {\n name: 'slash-command',\n category: 'state',\n targets: 'self',\n\n defaults: {\n trigger: '/',\n commands: '',\n },\n\n attach(ctx) {\n const trigger = ctx.config('trigger') ?? '/'\n const active = signal(false)\n let currentPartial = ''\n\n const getValue = (): string => {\n const host = ctx.host\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n return host.value\n }\n return host.textContent ?? ''\n }\n\n const handleInput = () => {\n const value = getValue()\n\n if (value.startsWith(trigger)) {\n const partial = value.slice(trigger.length)\n currentPartial = partial\n active.value = true\n ctx.emit('command-input', { partial })\n } else {\n if (active.value) {\n active.value = false\n currentPartial = ''\n }\n }\n }\n\n const handleKeydown = (e: Event) => {\n const event = e as KeyboardEvent\n if (event.key !== 'Enter' || !active.value) return\n\n event.preventDefault()\n\n const parts = currentPartial.split(/\\s+/)\n const command = parts[0] ?? ''\n const args = parts.slice(1).join(' ')\n\n // If commands list is configured, only emit for known commands\n const commandList = (ctx.config('commands') ?? '').split(',').map(s => s.trim()).filter(Boolean)\n if (commandList.length > 0 && !commandList.includes(command)) return\n\n ctx.emit('command', { command, args })\n\n // Reset state\n active.value = false\n currentPartial = ''\n }\n\n ctx.host.addEventListener('input', handleInput)\n ctx.host.addEventListener('keydown', handleKeydown)\n\n ctx.addEffect(() => {\n ctx.expose('active', active.value)\n })\n\n return () => {\n ctx.host.removeEventListener('input', handleInput)\n ctx.host.removeEventListener('keydown', handleKeydown)\n }\n },\n}\n","// ── store trait ──────────────────────────────────────────────\n//\n// Data-driven DOM stamping for list-like components.\n// Reads a ListStore (signal-backed) and stamps aui-option + group\n// wrapper elements into the host or a target container.\n//\n// Data source (in priority order):\n// 1. host.__listStore — programmatic (set via useStore())\n// 2. host[store] attribute — grouped JSON\n// 3. host[options] attribute — flat legacy JSON\n//\n// Config:\n// target — CSS selector for stamping container (default: host itself)\n// group-tag — tag name for group wrappers (default: 'aui-group')\n//\n// Exposed state:\n// data-store-count=\"12\" (total item count)\n\nimport type { TraitDefinition } from '../types.ts'\nimport type { ListStore, OptionData, OptionItem, OptionGroup } from '#store'\nimport { isGrouped } from '#store'\nimport { createListStore } from '#store'\nimport { parseStoreAttr, parseOptionsAttr } from '#store'\n\nconst STAMPED = 'data-stamped'\n\ninterface ListStoreHost extends HTMLElement {\n __listStore?: ListStore\n}\n\nexport const storeTrait: TraitDefinition = {\n name: 'store',\n category: 'state',\n\n defaults: {\n target: ':scope',\n 'group-tag': 'aui-group',\n },\n\n attach(ctx) {\n const host = ctx.host as ListStoreHost\n const targetSelector = ctx.config('target') ?? ':scope'\n const groupTag = ctx.config('group-tag') ?? 'aui-group'\n\n // Resolve the stamping container\n const getTarget = (): HTMLElement => {\n if (targetSelector === ':scope') return host\n return host.querySelector<HTMLElement>(targetSelector) ?? host\n }\n\n // Resolve the data source — returns a ListStore\n const resolveStore = (): ListStore => {\n // 1. Programmatic store\n if (host.__listStore) return host.__listStore\n\n // 2. store attribute (grouped JSON)\n const storeAttr = host.getAttribute('store')\n if (storeAttr) {\n const data = parseStoreAttr(storeAttr)\n if (data) return createListStore(data)\n }\n\n // 3. options attribute (flat legacy)\n const optionsAttr = host.getAttribute('options')\n if (optionsAttr) {\n const data = parseOptionsAttr(optionsAttr)\n if (data) return createListStore(data)\n }\n\n // Empty store\n return createListStore([])\n }\n\n const store = resolveStore()\n\n // Stamp a single option element\n const stampItem = (item: OptionItem): HTMLElement => {\n const el = document.createElement('aui-option')\n el.setAttribute('value', item.id)\n el.setAttribute('label', item.label)\n if (item.disabled) el.setAttribute('disabled', '')\n if (item.icon) el.setAttribute('icon', item.icon)\n if (item.prefix) el.setAttribute('prefix', item.prefix)\n if (item.suffix) el.setAttribute('suffix', item.suffix)\n if (item.keywords) el.setAttribute('keywords', item.keywords)\n el.setAttribute(STAMPED, '')\n return el\n }\n\n // Stamp a group wrapper with its items\n const stampGroup = (group: OptionGroup): HTMLElement => {\n const wrapper = document.createElement(groupTag)\n wrapper.setAttribute('heading', group.heading)\n wrapper.setAttribute(STAMPED, '')\n for (const item of group.items) {\n wrapper.appendChild(stampItem(item))\n }\n return wrapper\n }\n\n // Clear previously stamped elements\n const clearStamped = (container: HTMLElement): void => {\n const stamped = container.querySelectorAll(`[${STAMPED}]`)\n for (const el of stamped) el.remove()\n }\n\n // Stamp DOM from data\n const stamp = (data: OptionData, container: HTMLElement): void => {\n clearStamped(container)\n\n const frag = document.createDocumentFragment()\n let count = 0\n\n if (isGrouped(data)) {\n for (const group of data) {\n frag.appendChild(stampGroup(group))\n count += group.items.length\n }\n } else {\n for (const item of data) {\n frag.appendChild(stampItem(item))\n count++\n }\n }\n\n container.appendChild(frag)\n ctx.expose('count', String(count))\n }\n\n // Reactive effect: re-stamp when store data changes\n ctx.addEffect(() => {\n const data = store.data.value\n const target = getTarget()\n stamp(data, target)\n })\n\n // MutationObserver for attribute changes on host\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes') {\n const name = mutation.attributeName\n if (name === 'store' || name === 'options') {\n let data: OptionData | null = null\n if (name === 'store') {\n const val = host.getAttribute('store')\n if (val) data = parseStoreAttr(val)\n } else {\n const val = host.getAttribute('options')\n if (val) data = parseOptionsAttr(val)\n }\n if (data) store.data.value = data\n }\n }\n }\n })\n\n observer.observe(host, {\n attributes: true,\n attributeFilter: ['store', 'options'],\n })\n\n return () => {\n observer.disconnect()\n clearStamped(getTarget())\n }\n },\n}\n","// ── text-trigger trait ───────────────────────────────────────\n//\n// Generic text pattern trigger for input elements. Watches\n// the host's value and emits when a regex pattern matches.\n//\n// Usage:\n// <aui-input traits=\"{ trait: 'text-trigger', pattern: '#[a-zA-Z]+' }\">\n// <aui-input traits=\"{ trait: 'text-trigger', pattern: '\\\\d{3}-\\\\d{4}', trigger: '#' }\">\n//\n// Events:\n// text-trigger — fires when pattern matches, detail: { match, groups }\n//\n// Exposed state:\n// data-text-trigger-matched=\"\" (present when pattern matches)\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\nexport const textTriggerTrait: TraitDefinition = {\n name: 'text-trigger',\n category: 'state',\n targets: 'self',\n\n defaults: {\n pattern: '',\n trigger: '',\n },\n\n attach(ctx) {\n const patternStr = ctx.config('pattern') ?? ''\n if (!patternStr) return\n\n const triggerChar = ctx.config('trigger') ?? ''\n const matched = signal(false)\n\n let regex: RegExp\n try {\n regex = new RegExp(patternStr)\n } catch {\n return\n }\n\n const getValue = (): string => {\n const host = ctx.host\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n return host.value\n }\n return host.textContent ?? ''\n }\n\n const handleInput = () => {\n const value = getValue()\n\n // If trigger char is configured, only match when value contains it\n if (triggerChar && !value.includes(triggerChar)) {\n if (matched.value) matched.value = false\n return\n }\n\n const result = regex.exec(value)\n\n if (result) {\n matched.value = true\n ctx.emit('text-trigger', {\n match: result[0],\n groups: result.slice(1),\n })\n } else {\n if (matched.value) matched.value = false\n }\n }\n\n ctx.host.addEventListener('input', handleInput)\n\n ctx.addEffect(() => {\n ctx.expose('matched', matched.value)\n })\n\n return () => {\n ctx.host.removeEventListener('input', handleInput)\n }\n },\n}\n","// ── backtick-wrap trait ──────────────────────────────────────\n//\n// Auto-wraps selected text in backticks when the backtick key\n// is pressed. Uses triple backticks for multi-line selections.\n//\n// Usage:\n// <aui-editor traits=\"backtick-wrap\">\n//\n// Events:\n// backtick-wrap — fires after wrapping, detail: { text, wrapped }\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const backtickWrapTrait: TraitDefinition = {\n name: 'backtick-wrap',\n category: 'state',\n targets: 'self',\n\n attach(ctx) {\n const handleKeydown = (e: Event) => {\n const event = e as KeyboardEvent\n if (event.key !== '`') return\n\n const host = ctx.host\n let selectedText = ''\n let selStart = 0\n let selEnd = 0\n\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n selStart = host.selectionStart ?? 0\n selEnd = host.selectionEnd ?? 0\n selectedText = host.value.slice(selStart, selEnd)\n } else {\n const sel = window.getSelection()\n if (sel && sel.rangeCount > 0) {\n selectedText = sel.toString()\n }\n }\n\n // Only wrap if there's a selection\n if (!selectedText) return\n\n event.preventDefault()\n\n const isMultiline = selectedText.includes('\\n')\n const wrapped = isMultiline\n ? `\\`\\`\\`\\n${selectedText}\\n\\`\\`\\``\n : `\\`${selectedText}\\``\n\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n const before = host.value.slice(0, selStart)\n const after = host.value.slice(selEnd)\n host.value = before + wrapped + after\n\n const newPos = selStart + wrapped.length\n host.setSelectionRange(newPos, newPos)\n } else {\n const sel = window.getSelection()\n if (sel && sel.rangeCount > 0) {\n const range = sel.getRangeAt(0)\n range.deleteContents()\n range.insertNode(document.createTextNode(wrapped))\n sel.collapseToEnd()\n }\n }\n\n ctx.emit('backtick-wrap', { text: selectedText, wrapped })\n }\n\n ctx.host.addEventListener('keydown', handleKeydown)\n\n return () => {\n ctx.host.removeEventListener('keydown', handleKeydown)\n }\n },\n}\n","// ── validate trait ───────────────────────────────────────────\n//\n// Form validation rules applied on blur and input. Sets\n// validity via ElementInternals when available and exposes\n// validation state as data attributes.\n//\n// Usage:\n// <aui-input traits=\"{ trait: 'validate', required: 'true' }\">\n// <aui-input traits=\"{ trait: 'validate', pattern: '^[a-z]+$', message: 'Lowercase only' }\">\n// <aui-input traits=\"{ trait: 'validate', min-length: '3', max-length: '50' }\">\n//\n// Events:\n// validate — fires after validation, detail: { valid, message, value }\n//\n// Exposed state:\n// data-validate-valid=\"\" (present when valid)\n// data-validate-message=\"\" (error message text)\n\nimport { signal } from '#reactivity'\nimport type { TraitDefinition } from '../types.ts'\n\nexport const validateTrait: TraitDefinition = {\n name: 'validate',\n category: 'state',\n targets: 'self',\n\n defaults: {\n required: 'false',\n pattern: '',\n 'min-length': '',\n 'max-length': '',\n message: '',\n },\n\n attach(ctx) {\n const valid = signal(true)\n const errorMessage = signal('')\n\n const getValue = (): string => {\n const host = ctx.host\n if (host instanceof HTMLInputElement || host instanceof HTMLTextAreaElement) {\n return host.value\n }\n return host.textContent ?? ''\n }\n\n const doValidate = () => {\n const value = getValue()\n const required = ctx.config('required') === 'true'\n const patternStr = ctx.config('pattern') ?? ''\n const minLenStr = ctx.config('min-length') ?? ''\n const maxLenStr = ctx.config('max-length') ?? ''\n const customMessage = ctx.config('message') ?? ''\n\n let msg = ''\n\n // Required check\n if (required && !value.trim()) {\n msg = customMessage || 'This field is required'\n }\n\n // Min length check\n if (!msg && minLenStr) {\n const minLen = parseInt(minLenStr, 10)\n if (!isNaN(minLen) && value.length < minLen) {\n msg = customMessage || `Minimum ${minLen} characters`\n }\n }\n\n // Max length check\n if (!msg && maxLenStr) {\n const maxLen = parseInt(maxLenStr, 10)\n if (!isNaN(maxLen) && value.length > maxLen) {\n msg = customMessage || `Maximum ${maxLen} characters`\n }\n }\n\n // Pattern check\n if (!msg && patternStr) {\n try {\n const regex = new RegExp(patternStr)\n if (!regex.test(value)) {\n msg = customMessage || 'Invalid format'\n }\n } catch {\n // Invalid regex — skip\n }\n }\n\n const isValid = !msg\n valid.value = isValid\n errorMessage.value = msg\n\n // Set validity via internals if available\n const internals = (ctx.host as unknown as { internals?: ElementInternals }).internals\n if (internals?.setValidity) {\n if (isValid) {\n internals.setValidity({})\n } else {\n internals.setValidity({ customError: true }, msg)\n }\n }\n\n ctx.emit('validate', { valid: isValid, message: msg, value })\n }\n\n ctx.host.addEventListener('blur', doValidate)\n ctx.host.addEventListener('input', doValidate)\n\n ctx.addEffect(() => {\n ctx.expose('valid', valid.value)\n ctx.expose('message', errorMessage.value)\n })\n\n return () => {\n ctx.host.removeEventListener('blur', doValidate)\n ctx.host.removeEventListener('input', doValidate)\n }\n },\n}\n","// ── trap-focus trait ─────────────────────────────────────────\n//\n// Traps keyboard focus within the host element. Tab and\n// Shift+Tab cycle through focusable children without escaping.\n//\n// Usage:\n// <aui-container traits=\"trap-focus\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nexport const trapFocusTrait: TraitDefinition = {\n name: 'trap-focus',\n category: 'focus',\n targets: 'self',\n\n attach(ctx) {\n const getFocusable = (): HTMLElement[] =>\n [...ctx.host.querySelectorAll<HTMLElement>(FOCUSABLE)]\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (ke.key !== 'Tab') return\n\n const items = getFocusable()\n if (items.length === 0) return\n\n const first = items[0]!\n const last = items[items.length - 1]!\n const active = document.activeElement as HTMLElement\n\n if (ke.shiftKey && active === first) {\n ke.preventDefault()\n last.focus()\n } else if (!ke.shiftKey && active === last) {\n ke.preventDefault()\n first.focus()\n }\n }\n\n ctx.host.addEventListener('keydown', onKeydown)\n\n // Focus first focusable on attach\n queueMicrotask(() => {\n const items = getFocusable()\n if (items.length > 0) items[0]!.focus()\n })\n\n return () => {\n ctx.host.removeEventListener('keydown', onKeydown)\n }\n },\n}\n","// ── roving-focus trait ───────────────────────────────────────\n//\n// Arrow key navigation within the host's focusable children.\n// Sets all focusable children to tabindex=-1 except the active\n// one (tabindex=0), so the group acts as a single tab stop.\n//\n// Usage:\n// <aui-select mode=\"bar\" traits=\"roving-focus\">\n// <aui-select mode=\"bar\" traits=\"{ trait: 'roving-focus', orientation: 'horizontal', wrap: 'false' }\">\n//\n// Exposed state:\n// data-roving-focus-active (index of currently focused child)\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst DEFAULT_SELECTOR =\n '[tabindex], button, a, input, select, textarea, aui-button'\n\nexport const rovingFocusTrait: TraitDefinition = {\n name: 'roving-focus',\n category: 'focus',\n targets: 'self',\n\n defaults: {\n orientation: 'both',\n wrap: 'true',\n selector: DEFAULT_SELECTOR,\n },\n\n attach(ctx) {\n const orientation = ctx.config('orientation') ?? 'both'\n const wrap = (ctx.config('wrap') ?? 'true') === 'true'\n const selector = ctx.config('selector') ?? DEFAULT_SELECTOR\n\n const sel = selector.startsWith('> ') ? `:scope ${selector}` : selector\n const getFocusable = (): HTMLElement[] =>\n [...ctx.host.querySelectorAll<HTMLElement>(sel)]\n\n const setActive = (items: HTMLElement[], index: number) => {\n for (let i = 0; i < items.length; i++) {\n items[i]!.setAttribute('tabindex', i === index ? '0' : '-1')\n }\n items[index]!.focus()\n ctx.expose('active', String(index))\n }\n\n // Initialize: first child gets tabindex=0, rest get -1\n queueMicrotask(() => {\n const items = getFocusable()\n for (let i = 0; i < items.length; i++) {\n items[i]!.setAttribute('tabindex', i === 0 ? '0' : '-1')\n }\n if (items.length > 0) ctx.expose('active', '0')\n })\n\n const isForward = (key: string): boolean => {\n if (orientation === 'horizontal') return key === 'ArrowRight'\n if (orientation === 'vertical') return key === 'ArrowDown'\n return key === 'ArrowRight' || key === 'ArrowDown'\n }\n\n const isBackward = (key: string): boolean => {\n if (orientation === 'horizontal') return key === 'ArrowLeft'\n if (orientation === 'vertical') return key === 'ArrowUp'\n return key === 'ArrowLeft' || key === 'ArrowUp'\n }\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n const items = getFocusable()\n if (items.length === 0) return\n\n const current = items.indexOf(document.activeElement as HTMLElement)\n if (current === -1) return\n\n let next: number | undefined\n\n if (isForward(ke.key)) {\n next = current + 1\n if (next >= items.length) next = wrap ? 0 : current\n } else if (isBackward(ke.key)) {\n next = current - 1\n if (next < 0) next = wrap ? items.length - 1 : current\n } else if (ke.key === 'Home') {\n next = 0\n } else if (ke.key === 'End') {\n next = items.length - 1\n }\n\n if (next !== undefined) {\n ke.preventDefault()\n setActive(items, next)\n }\n }\n\n ctx.host.addEventListener('keydown', onKeydown)\n\n return () => {\n ctx.host.removeEventListener('keydown', onKeydown)\n }\n },\n}\n","// ── list-navigate trait ──────────────────────────────────────\n//\n// Arrow key navigation + type-ahead search in a list of children.\n// Moves a highlight indicator through matching children and\n// supports jumping by typed characters.\n//\n// Usage:\n// <aui-list traits=\"list-navigate\">\n// <aui-list traits=\"{ trait: 'list-navigate', selector: '> li', typeahead: 'false' }\">\n//\n// Exposed state:\n// data-list-navigate-index (current highlight index)\n// data-list-navigate-highlighted on the active child\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const listNavigateTrait: TraitDefinition = {\n name: 'list-navigate',\n category: 'focus',\n targets: 'self',\n\n defaults: {\n selector: '> *',\n typeahead: 'true',\n timeout: '500',\n },\n\n attach(ctx) {\n const selector = ctx.config('selector') ?? '> *'\n const typeahead = (ctx.config('typeahead') ?? 'true') === 'true'\n const timeout = Number(ctx.config('timeout') ?? '500')\n\n let currentIndex = -1\n let typeBuffer = ''\n let typeTimer: ReturnType<typeof setTimeout> | undefined\n\n const getItems = (): HTMLElement[] => {\n const sel = selector.startsWith('> ') ? `:scope ${selector}` : selector\n return [...ctx.host.querySelectorAll<HTMLElement>(sel)]\n }\n\n const setHighlight = (items: HTMLElement[], index: number) => {\n for (let i = 0; i < items.length; i++) {\n if (i === index) {\n items[i]!.setAttribute('data-list-navigate-highlighted', '')\n } else {\n items[i]!.removeAttribute('data-list-navigate-highlighted')\n }\n }\n currentIndex = index\n ctx.expose('index', String(index))\n items[index]?.scrollIntoView({ block: 'nearest' })\n }\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n const items = getItems()\n if (items.length === 0) return\n\n let next: number | undefined\n\n switch (ke.key) {\n case 'ArrowDown':\n next = currentIndex < items.length - 1 ? currentIndex + 1 : 0\n break\n case 'ArrowUp':\n next = currentIndex > 0 ? currentIndex - 1 : items.length - 1\n break\n case 'Home':\n next = 0\n break\n case 'End':\n next = items.length - 1\n break\n case 'Enter':\n if (currentIndex >= 0 && currentIndex < items.length) {\n ctx.emit('activate', { index: currentIndex })\n }\n ke.preventDefault()\n return\n default:\n // Type-ahead: single printable character\n if (typeahead && ke.key.length === 1 && !ke.ctrlKey && !ke.metaKey && !ke.altKey) {\n typeBuffer += ke.key.toLowerCase()\n clearTimeout(typeTimer)\n typeTimer = setTimeout(() => { typeBuffer = '' }, timeout)\n\n const match = items.findIndex((el) =>\n (el.textContent ?? '').trim().toLowerCase().startsWith(typeBuffer),\n )\n if (match !== -1) {\n next = match\n }\n }\n break\n }\n\n if (next !== undefined) {\n ke.preventDefault()\n setHighlight(items, next)\n }\n }\n\n // Initialize: highlight first item if present\n queueMicrotask(() => {\n const items = getItems()\n if (items.length > 0) {\n setHighlight(items, 0)\n }\n })\n\n ctx.host.addEventListener('keydown', onKeydown)\n\n return () => {\n ctx.host.removeEventListener('keydown', onKeydown)\n clearTimeout(typeTimer)\n }\n },\n}\n","// ── tooltip trait ────────────────────────────────────────────\n//\n// Shows a tooltip on hover/focus of the host element.\n// Uses CSS anchor positioning where supported, with a JS\n// fallback that manually positions the tooltip via fixed coords.\n//\n// Usage:\n// <aui-button traits=\"{ trait: 'tooltip', text: 'Save document' }\">\n// <aui-button traits=\"{ trait: 'tooltip', text: 'Delete', position: 'bottom', delay: '200' }\">\n//\n// Exposed state:\n// data-tooltip-open (boolean)\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst supportsAnchor = CSS.supports?.('position-anchor: --x') ?? false\n\nexport const tooltipTrait: TraitDefinition = {\n name: 'tooltip',\n category: 'present',\n targets: 'self',\n\n defaults: {\n delay: '500',\n position: 'top',\n },\n\n attach(ctx) {\n const text = ctx.config('text') ?? ''\n const delay = parseInt(ctx.config('delay') ?? '500', 10)\n const position = ctx.config('position') ?? 'top'\n\n let timer: ReturnType<typeof setTimeout> | undefined\n let tooltip: HTMLElement | undefined\n\n const GAP = 6\n\n const positionWithJS = (tip: HTMLElement) => {\n const hostRect = ctx.host.getBoundingClientRect()\n const tipRect = tip.getBoundingClientRect()\n\n let top = 0\n let left = 0\n\n switch (position) {\n case 'top':\n top = hostRect.top - tipRect.height - GAP\n left = hostRect.left + (hostRect.width - tipRect.width) / 2\n break\n case 'bottom':\n top = hostRect.bottom + GAP\n left = hostRect.left + (hostRect.width - tipRect.width) / 2\n break\n case 'left':\n top = hostRect.top + (hostRect.height - tipRect.height) / 2\n left = hostRect.left - tipRect.width - GAP\n break\n case 'right':\n top = hostRect.top + (hostRect.height - tipRect.height) / 2\n left = hostRect.right + GAP\n break\n }\n\n // Clamp to viewport\n top = Math.max(4, Math.min(top, window.innerHeight - tipRect.height - 4))\n left = Math.max(4, Math.min(left, window.innerWidth - tipRect.width - 4))\n\n tip.style.top = `${top}px`\n tip.style.left = `${left}px`\n }\n\n const show = () => {\n timer = setTimeout(() => {\n tooltip = document.createElement('div')\n tooltip.setAttribute('data-aui-tooltip', '')\n tooltip.setAttribute('popover', 'manual')\n tooltip.setAttribute('role', 'tooltip')\n tooltip.setAttribute('data-tooltip-position', position)\n tooltip.textContent = text\n\n // Append to body so it's not clipped by overflow:hidden parents\n document.body.appendChild(tooltip)\n tooltip.showPopover()\n\n // Position: CSS anchor or JS fallback\n if (!supportsAnchor) {\n positionWithJS(tooltip)\n } else {\n // CSS anchor positioning\n const anchorName = `--aui-tt-${Date.now()}`\n ctx.host.style.setProperty('anchor-name', anchorName)\n tooltip.style.setProperty('position-anchor', anchorName)\n }\n\n ctx.expose('open', true)\n }, delay)\n }\n\n const hide = () => {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n }\n if (tooltip) {\n try { tooltip.hidePopover() } catch {}\n tooltip.remove()\n tooltip = undefined\n }\n ctx.host.style.removeProperty('anchor-name')\n ctx.expose('open', false)\n }\n\n ctx.host.addEventListener('mouseenter', show)\n ctx.host.addEventListener('focusin', show)\n ctx.host.addEventListener('mouseleave', hide)\n ctx.host.addEventListener('focusout', hide)\n\n return () => {\n hide()\n ctx.host.removeEventListener('mouseenter', show)\n ctx.host.removeEventListener('focusin', show)\n ctx.host.removeEventListener('mouseleave', hide)\n ctx.host.removeEventListener('focusout', hide)\n }\n },\n}\n","// ── collapsible trait ────────────────────────────────────────\n//\n// Toggles host height between collapsed and expanded states.\n// Uses CSS transitions on max-height for smooth animation.\n//\n// Usage:\n// <aui-panel traits=\"collapsible\">\n// <aui-panel traits=\"{ trait: 'collapsible', collapsed: 'true', duration: '300' }\">\n//\n// Exposed state:\n// data-collapsible-collapsed (boolean)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const collapsibleTrait: TraitDefinition = {\n name: 'collapsible',\n category: 'present',\n targets: 'self',\n\n defaults: {\n collapsed: 'false',\n duration: '200',\n },\n actions: ['press'],\n\n attach(ctx) {\n const duration = parseInt(ctx.config('duration') ?? '200', 10)\n let collapsed = (ctx.config('collapsed') ?? 'false') === 'true'\n\n const applyCollapsed = () => {\n ctx.expose('collapsed', collapsed)\n if (collapsed) {\n ctx.host.style.overflow = 'hidden'\n ctx.host.style.maxHeight = '0px'\n } else {\n ctx.host.style.overflow = ''\n ctx.host.style.maxHeight = ''\n }\n }\n\n // Set transition and initial state\n ctx.host.style.transition = `max-height ${duration}ms ease`\n applyCollapsed()\n\n const toggle = () => {\n if (collapsed) {\n // Expanding: set max-height to scrollHeight, then clear after transition\n collapsed = false\n ctx.expose('collapsed', false)\n ctx.host.style.maxHeight = `${ctx.host.scrollHeight}px`\n ctx.host.style.overflow = 'hidden'\n\n const onEnd = () => {\n ctx.host.removeEventListener('transitionend', onEnd)\n if (!collapsed) {\n ctx.host.style.maxHeight = ''\n ctx.host.style.overflow = ''\n }\n }\n ctx.host.addEventListener('transitionend', onEnd)\n } else {\n // Collapsing: set explicit height first, then collapse to 0\n ctx.host.style.maxHeight = `${ctx.host.scrollHeight}px`\n ctx.host.style.overflow = 'hidden'\n // Force reflow so the browser registers the starting height\n void ctx.host.offsetHeight\n collapsed = true\n ctx.expose('collapsed', true)\n ctx.host.style.maxHeight = '0px'\n }\n }\n\n const onPress = () => toggle()\n ctx.host.addEventListener('press', onPress)\n\n return () => {\n ctx.host.removeEventListener('press', onPress)\n ctx.host.style.transition = ''\n ctx.host.style.maxHeight = ''\n ctx.host.style.overflow = ''\n }\n },\n}\n","// ── overlay traits (popover + modal) ────────────────────────\n//\n// Shared factory for popover and modal presentation traits\n// built on the Popover API with CSS anchor positioning.\n// Both promote the host to the top layer.\n//\n// popover — non-modal, popover=\"auto\" (light dismiss)\n// modal — modal, popover=\"manual\", backdrop, focus trap via inert\n\nimport type { TraitDefinition } from '../types.ts'\n\nlet anchorCounter = 0\n\nexport const createOverlayTrait = (name: string, modal: boolean): TraitDefinition => ({\n name,\n category: 'present',\n targets: 'self',\n\n defaults: {\n closable: 'true',\n anchor: '',\n placement: 'block-end center',\n type: modal ? 'manual' : 'auto',\n matchWidth: 'false',\n animation: 'scale',\n },\n actions: ['open', 'close', 'dismiss'],\n\n attach(ctx) {\n const closable = (ctx.config('closable') ?? 'true') === 'true'\n const anchorSelector = ctx.config('anchor') ?? ''\n const placement = ctx.config('placement') ?? 'block-end span-inline-end'\n const popoverType = ctx.config('type') ?? (modal ? 'manual' : 'auto')\n const matchWidth = (ctx.config('matchWidth') ?? 'false') === 'true'\n const animation = ctx.config('animation') ?? 'scale'\n\n let open = false\n let previouslyFocused: HTMLElement | null = null\n const inertSiblings: Array<{ el: Element; prev: boolean }> = []\n\n // ── Setup ──\n\n ctx.host.setAttribute('popover', popoverType)\n ctx.expose('open', false)\n\n if (animation !== 'none') {\n ctx.host.setAttribute('data-overlay-animation', animation)\n if (anchorSelector) {\n ctx.host.setAttribute('data-overlay-direction', placement.split(' ')[0] ?? 'block-end')\n }\n // Enable exit transitions after first frame — closed state\n // (opacity:0) is already settled, so this causes no visible change.\n requestAnimationFrame(() => {\n ctx.host.setAttribute('data-overlay-ready', '')\n })\n }\n\n // ── Anchor positioning ──\n\n let anchorName = ''\n let anchorEl: HTMLElement | null = null\n if (anchorSelector) {\n ctx.host.setAttribute('data-overlay-anchored', '')\n anchorName = `--aui-overlay-${++anchorCounter}`\n ctx.host.style.setProperty('position-anchor', anchorName)\n ctx.host.style.setProperty('position-area', placement)\n if (matchWidth) ctx.host.setAttribute('data-overlay-match-width', '')\n\n // Apply anchor-name eagerly so the popover is positioned\n // correctly on the very first frame when showPopover() is called.\n anchorEl = document.querySelector(anchorSelector) as HTMLElement | null\n if (anchorEl) anchorEl.style.setProperty('anchor-name', anchorName)\n }\n\n const clearAnchor = () => {\n if (!anchorSelector) return\n const anchor = document.querySelector(anchorSelector) as HTMLElement | null\n if (anchor) anchor.style.removeProperty('anchor-name')\n }\n\n // ── Focus trap (modal only) ──\n\n const trapFocus = () => {\n if (!modal) return\n previouslyFocused = document.activeElement as HTMLElement | null\n const parent = ctx.host.parentElement\n if (!parent) return\n for (const sibling of Array.from(parent.children)) {\n if (sibling === ctx.host) continue\n inertSiblings.push({\n el: sibling,\n prev: (sibling as HTMLElement).inert ?? false,\n })\n ;(sibling as HTMLElement).inert = true\n }\n }\n\n const releaseFocus = () => {\n for (const { el, prev } of inertSiblings) {\n ;(el as HTMLElement).inert = prev\n }\n inertSiblings.length = 0\n }\n\n const restoreFocus = () => {\n if (!modal) return\n if (previouslyFocused?.focus) previouslyFocused.focus()\n previouslyFocused = null\n }\n\n // ── Show / hide ──\n\n const markAnchor = (isOpen: boolean) => {\n if (!anchorEl) return\n if (isOpen) {\n anchorEl.setAttribute('data-overlay-anchor-open', '')\n } else {\n // Defer removal past :active lifecycle — the browser may not\n // have cleared :active by the time hidePopover() runs in the\n // click handler, so removing synchronously lets the component's\n // :active transform kick in for one frame (visible bounce).\n requestAnimationFrame(() => anchorEl?.removeAttribute('data-overlay-anchor-open'))\n }\n }\n\n const show = () => {\n if (open) return\n open = true\n ctx.host.showPopover()\n ctx.expose('open', true)\n markAnchor(true)\n trapFocus()\n ctx.emit('overlay-open')\n }\n\n const hide = () => {\n if (!open) return\n open = false\n try { ctx.host.hidePopover() } catch { /* already hidden */ }\n ctx.expose('open', false)\n markAnchor(false)\n releaseFocus()\n restoreFocus()\n ctx.emit('overlay-close')\n }\n\n // ── Event handlers ──\n\n const onOpen = () => show()\n const onClose = () => hide()\n const onDismiss = () => hide()\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (ke.key === 'Escape' && open && closable) {\n ke.preventDefault()\n hide()\n }\n }\n\n // Sync with browser-initiated or direct showPopover/hidePopover calls\n const onToggle = (e: Event) => {\n const te = e as ToggleEvent\n if (te.newState === 'open' && !open) {\n // External showPopover() call — sync trait state\n open = true\n ctx.expose('open', true)\n markAnchor(true)\n trapFocus()\n ctx.emit('overlay-open')\n } else if (te.newState === 'closed' && open) {\n open = false\n ctx.expose('open', false)\n markAnchor(false)\n releaseFocus()\n restoreFocus()\n ctx.emit('overlay-close')\n }\n }\n\n // Outside click for popover=\"manual\" (modal backdrop click)\n const onBackdropClick = (e: MouseEvent) => {\n if (!open || !closable || popoverType === 'auto') return\n const rect = ctx.host.getBoundingClientRect()\n const inside = e.clientX >= rect.left && e.clientX <= rect.right\n && e.clientY >= rect.top && e.clientY <= rect.bottom\n if (!inside) hide()\n }\n\n ctx.host.addEventListener('open', onOpen)\n ctx.host.addEventListener('close', onClose)\n ctx.host.addEventListener('dismiss', onDismiss)\n ctx.host.addEventListener('toggle', onToggle)\n document.addEventListener('keydown', onKeydown)\n if (popoverType === 'manual') {\n document.addEventListener('click', onBackdropClick)\n }\n\n // ── Cleanup ──\n\n return () => {\n ctx.host.removeEventListener('open', onOpen)\n ctx.host.removeEventListener('close', onClose)\n ctx.host.removeEventListener('dismiss', onDismiss)\n ctx.host.removeEventListener('toggle', onToggle)\n document.removeEventListener('keydown', onKeydown)\n document.removeEventListener('click', onBackdropClick)\n releaseFocus()\n restoreFocus()\n markAnchor(false)\n clearAnchor()\n if (open) {\n try { ctx.host.hidePopover() } catch { /* already hidden */ }\n }\n ctx.host.removeAttribute('popover')\n ctx.host.removeAttribute('data-overlay-anchored')\n ctx.host.removeAttribute('data-overlay-match-width')\n ctx.host.removeAttribute('data-overlay-animation')\n ctx.host.removeAttribute('data-overlay-ready')\n ctx.host.removeAttribute('data-overlay-direction')\n ctx.host.style.removeProperty('position-anchor')\n ctx.host.style.removeProperty('position-area')\n }\n },\n})\n","// ── popover trait ────────────────────────────────────────────\n//\n// Non-modal overlay built on the Popover API with CSS anchor\n// positioning. Promotes the host to the top layer with\n// popover=\"auto\" (light dismiss).\n//\n// Usage:\n// <aui-panel traits=\"popover\"> (centered)\n// <div traits=\"{ trait: 'popover', anchor: '#trigger' }\"> (anchored)\n//\n// Config:\n// closable — 'true' (default) | 'false'\n// anchor — CSS selector for anchor element (empty = centered)\n// placement — CSS position-area value (default: 'block-end span-inline-end')\n// type — popover API mode: 'auto' (default)\n// matchWidth — 'true' | 'false' (default) — match anchor inline size\n// animation — 'scale' (default) | 'fade' | 'hinge' | 'none'\n//\n// Exposed state:\n// data-popover-open (boolean)\n//\n// Emits:\n// overlay-open, overlay-close\n\nimport type { TraitDefinition } from '../types.ts'\nimport { createOverlayTrait } from './overlay.ts'\n\nexport const popoverTrait: TraitDefinition = createOverlayTrait('popover', false)\n","// ── modal trait ──────────────────────────────────────────────\n//\n// Modal overlay built on the Popover API with CSS anchor\n// positioning. Promotes the host to the top layer with\n// popover=\"manual\", backdrop, and focus trap via inert.\n//\n// Usage:\n// <aui-panel traits=\"modal\"> (modal)\n// <aui-panel traits=\"{ trait: 'modal', anchor: '#btn' }\"> (anchored modal)\n//\n// Config:\n// closable — 'true' (default) | 'false'\n// anchor — CSS selector for anchor element (empty = centered)\n// placement — CSS position-area value (default: 'block-end span-inline-end')\n// type — popover API mode: 'manual' (default)\n// matchWidth — 'true' | 'false' (default) — match anchor inline size\n// animation — 'scale' (default) | 'fade' | 'hinge' | 'none'\n//\n// Exposed state:\n// data-modal-open (boolean)\n//\n// Emits:\n// overlay-open, overlay-close\n\nimport type { TraitDefinition } from '../types.ts'\nimport { createOverlayTrait } from '../popover/overlay.ts'\n\nexport const modalTrait: TraitDefinition = createOverlayTrait('modal', true)\n","// ── dismiss trait ────────────────────────────────────────────\n//\n// Closes/hides the host on Escape key or outside click.\n// Emits a configurable event so the host can react accordingly.\n//\n// Usage:\n// <aui-popover traits=\"dismiss\">\n// <aui-popover traits=\"{ trait: 'dismiss', escape: 'true', outside: 'true', event: 'dismiss' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const dismissTrait: TraitDefinition = {\n name: 'dismiss',\n category: 'present',\n targets: 'self',\n\n defaults: {\n escape: 'true',\n outside: 'true',\n event: 'dismiss',\n },\n\n attach(ctx) {\n const escapeEnabled = (ctx.config('escape') ?? 'true') === 'true'\n const outsideEnabled = (ctx.config('outside') ?? 'true') === 'true'\n const eventName = ctx.config('event') ?? 'dismiss'\n\n const onKeydown = (e: Event) => {\n const ke = e as KeyboardEvent\n if (ke.key === 'Escape') {\n ke.preventDefault()\n ctx.emit(eventName)\n }\n }\n\n const onPointerdown = (e: Event) => {\n const pe = e as PointerEvent\n if (!ctx.host.contains(pe.target as Node)) {\n ctx.emit(eventName)\n }\n }\n\n if (escapeEnabled) {\n document.addEventListener('keydown', onKeydown)\n }\n if (outsideEnabled) {\n document.addEventListener('pointerdown', onPointerdown)\n }\n\n return () => {\n if (escapeEnabled) {\n document.removeEventListener('keydown', onKeydown)\n }\n if (outsideEnabled) {\n document.removeEventListener('pointerdown', onPointerdown)\n }\n }\n },\n}\n","// ── auto-dismiss trait ───────────────────────────────────────\n//\n// Automatically hides the host element after a configurable\n// timeout. Useful for toasts, notifications, transient alerts.\n//\n// Usage:\n// <aui-badge traits=\"auto-dismiss\">\n// <aui-badge traits=\"{ trait: 'auto-dismiss', delay: '5000' }\">\n//\n// Exposed state:\n// data-auto-dismiss-remaining (countdown in ms, updated each second)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const autoDismissTrait: TraitDefinition = {\n name: 'auto-dismiss',\n category: 'present',\n targets: 'self',\n\n defaults: {\n delay: '3000',\n },\n\n attach(ctx) {\n const delay = parseInt(ctx.config('delay') ?? '3000', 10)\n let remaining = delay\n ctx.expose('remaining', String(remaining))\n\n const tick = setInterval(() => {\n remaining = Math.max(0, remaining - 1000)\n ctx.expose('remaining', String(remaining))\n }, 1000)\n\n const timer = setTimeout(() => {\n clearInterval(tick)\n ctx.host.setAttribute('hidden', '')\n ctx.expose('dismissed', true)\n ctx.emit('dismiss')\n }, delay)\n\n // Pause on hover\n const pause = () => clearTimeout(timer)\n const resume = () => {\n // Don't restart — just let it be if hovered\n }\n ctx.host.addEventListener('pointerenter', pause)\n ctx.host.addEventListener('pointerleave', resume)\n\n return () => {\n clearTimeout(timer)\n clearInterval(tick)\n ctx.host.removeEventListener('pointerenter', pause)\n ctx.host.removeEventListener('pointerleave', resume)\n }\n },\n}\n","// ── gateway trait ────────────────────────────────────────────\n//\n// DOM portal: moves host's children to a target container\n// elsewhere in the DOM. Restores children on detach.\n//\n// Usage:\n// <aui-overlay traits=\"gateway\">\n// <aui-overlay traits=\"{ trait: 'gateway', target: '#portal-root' }\">\n//\n// Exposed state:\n// data-gateway-active (boolean)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const gatewayTrait: TraitDefinition = {\n name: 'gateway',\n category: 'present',\n targets: 'external',\n\n defaults: {\n target: 'body',\n },\n\n attach(ctx) {\n const targetSelector = ctx.config('target') ?? 'body'\n const targetEl = document.querySelector(targetSelector)\n if (!targetEl) {\n console.warn(`[gateway] target \"${targetSelector}\" not found`)\n return\n }\n\n // Create a placeholder comment to mark original position\n const placeholder = document.createComment('aui-gateway')\n ctx.host.parentNode?.insertBefore(placeholder, ctx.host.nextSibling)\n\n // Create a wrapper in the target for the transported children\n const wrapper = document.createElement('div')\n wrapper.setAttribute('data-gateway-wrapper', '')\n\n // Move all children to the wrapper\n while (ctx.host.firstChild) {\n wrapper.appendChild(ctx.host.firstChild)\n }\n\n targetEl.appendChild(wrapper)\n ctx.expose('active', true)\n\n return () => {\n // Move children back to the host\n while (wrapper.firstChild) {\n ctx.host.appendChild(wrapper.firstChild)\n }\n\n // Remove wrapper from target\n wrapper.remove()\n\n // Remove placeholder\n placeholder.remove()\n }\n },\n}\n","// ── present trait ────────────────────────────────────────────\n//\n// Show/hide the host with CSS transition states. Manages\n// entering/leaving data attributes so CSS can define the\n// actual transition effects.\n//\n// Usage:\n// <aui-toast traits=\"present\">\n// <aui-toast traits=\"{ trait: 'present', visible: 'false', transition: '300' }\">\n//\n// Exposed state:\n// data-present-visible (boolean)\n//\n// Transition attributes (for CSS hooks):\n// data-present-entering — set during show transition\n// data-present-leaving — set during hide transition\n// data-present-hidden — set when hidden (CSS: display: none)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const presentTrait: TraitDefinition = {\n name: 'present',\n category: 'present',\n targets: 'self',\n\n defaults: {\n visible: 'true',\n transition: '200',\n },\n actions: ['toggle', 'show', 'hide'],\n\n attach(ctx) {\n const transition = parseInt(ctx.config('transition') ?? '200', 10)\n let visible = (ctx.config('visible') ?? 'true') === 'true'\n let pending: ReturnType<typeof setTimeout> | null = null\n\n const clearPending = () => {\n if (pending !== null) {\n clearTimeout(pending)\n pending = null\n }\n }\n\n // Apply initial state without transition\n if (!visible) {\n ctx.host.setAttribute('data-present-hidden', '')\n }\n ctx.expose('visible', visible)\n\n const show = () => {\n if (visible) return\n clearPending()\n visible = true\n ctx.expose('visible', true)\n\n ctx.host.removeAttribute('data-present-hidden')\n ctx.host.setAttribute('data-present-entering', '')\n // Force reflow so the entering state is painted before removal\n void ctx.host.offsetHeight\n\n pending = setTimeout(() => {\n ctx.host.removeAttribute('data-present-entering')\n pending = null\n }, transition)\n }\n\n const hide = () => {\n if (!visible) return\n clearPending()\n visible = false\n ctx.expose('visible', false)\n\n ctx.host.setAttribute('data-present-leaving', '')\n\n pending = setTimeout(() => {\n ctx.host.removeAttribute('data-present-leaving')\n ctx.host.setAttribute('data-present-hidden', '')\n pending = null\n }, transition)\n }\n\n const toggle = () => {\n if (visible) hide()\n else show()\n }\n\n const onToggle = () => toggle()\n const onShow = () => show()\n const onHide = () => hide()\n\n ctx.host.addEventListener('toggle', onToggle)\n ctx.host.addEventListener('show', onShow)\n ctx.host.addEventListener('hide', onHide)\n\n return () => {\n clearPending()\n ctx.host.removeEventListener('toggle', onToggle)\n ctx.host.removeEventListener('show', onShow)\n ctx.host.removeEventListener('hide', onHide)\n ctx.host.removeAttribute('data-present-entering')\n ctx.host.removeAttribute('data-present-leaving')\n ctx.host.removeAttribute('data-present-hidden')\n }\n },\n}\n","// ── toast trait ──────────────────────────────────────────────\n//\n// Transient notification that auto-dismisses after a duration.\n// Positions itself fixed on screen and stacks with other toasts.\n// Uses CSS @starting-style for enter animation.\n//\n// Usage:\n// <aui-toast traits=\"toast\">\n// <aui-toast traits=\"{ trait: 'toast', position: 'top-center', duration: '5000' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\ntype Position = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center'\n\nconst POSITION_STYLES: Record<Position, Record<string, string>> = {\n 'top-right': { top: '1rem', right: '1rem', left: '', bottom: '' },\n 'top-left': { top: '1rem', left: '1rem', right: '', bottom: '' },\n 'bottom-right': { bottom: '1rem', right: '1rem', top: '', left: '' },\n 'bottom-left': { bottom: '1rem', left: '1rem', top: '', right: '' },\n 'top-center': { top: '1rem', left: '50%', right: '', bottom: '', translate: '-50% 0' },\n 'bottom-center': { bottom: '1rem', left: '50%', right: '', top: '', translate: '-50% 0' },\n}\n\nconst getStackOffset = (_position: Position, host: HTMLElement): number => {\n const toasts = document.querySelectorAll<HTMLElement>('[data-toast-visible]')\n let offset = 0\n\n for (const toast of toasts) {\n if (toast === host) break\n const rect = toast.getBoundingClientRect()\n offset += rect.height + 8 // 8px gap between toasts\n }\n\n return offset\n}\n\nexport const toastTrait: TraitDefinition = {\n name: 'toast',\n category: 'present',\n targets: 'self',\n\n defaults: {\n duration: '3000',\n position: 'bottom-right',\n stack: 'true',\n },\n\n attach(ctx) {\n const duration = parseInt(ctx.config('duration') ?? '3000', 10)\n const position = (ctx.config('position') ?? 'bottom-right') as Position\n const stack = ctx.config('stack') !== 'false'\n\n // Position styles (position: fixed and z-index handled by CSS via [data-toast-visible])\n const posStyles = POSITION_STYLES[position] ?? POSITION_STYLES['bottom-right']!\n for (const [prop, value] of Object.entries(posStyles)) {\n ctx.host.style.setProperty(prop, value)\n }\n\n // Stack offset\n if (stack) {\n const offset = getStackOffset(position, ctx.host)\n const isTop = position.startsWith('top')\n if (isTop) {\n const base = parseFloat(posStyles.top ?? '16')\n ctx.host.style.top = `calc(${base}rem + ${offset}px)`\n } else {\n const base = parseFloat(posStyles.bottom ?? '16')\n ctx.host.style.bottom = `calc(${base}rem + ${offset}px)`\n }\n }\n\n // Show\n ctx.expose('visible', true)\n\n // Auto-dismiss timer\n let dismissTimeout: ReturnType<typeof setTimeout> | undefined\n\n const dismiss = () => {\n ctx.host.setAttribute('data-toast-dismissing', '')\n\n const onTransitionEnd = () => {\n ctx.host.removeEventListener('transitionend', onTransitionEnd)\n ctx.expose('visible', false)\n ctx.host.removeAttribute('data-toast-dismissing')\n ctx.host.setAttribute('data-toast-hidden', '')\n ctx.emit('toast-dismiss')\n }\n\n ctx.host.addEventListener('transitionend', onTransitionEnd)\n }\n\n if (duration > 0) {\n dismissTimeout = setTimeout(dismiss, duration)\n }\n\n return () => {\n if (dismissTimeout !== undefined) clearTimeout(dismissTimeout)\n ctx.host.removeAttribute('data-toast-dismissing')\n ctx.host.removeAttribute('data-toast-hidden')\n ctx.host.style.top = ''\n ctx.host.style.right = ''\n ctx.host.style.bottom = ''\n ctx.host.style.left = ''\n ctx.host.style.translate = ''\n ctx.unexpose('visible')\n }\n },\n}\n","// ── virtual-scroll trait ─────────────────────────────────────\n//\n// Virtual scrolling: only positions visible items in a long list.\n// Uses a spacer element for total scroll height and translates\n// children into their visible positions on scroll.\n//\n// Usage:\n// <aui-list traits=\"{ trait: 'virtual-scroll', item-height: '40', total: '1000' }\">\n// <aui-list traits=\"{ trait: 'virtual-scroll', item-height: '32', overscan: '5', total: '500' }\">\n//\n// Exposed state:\n// data-virtual-scroll-start (first visible index)\n// data-virtual-scroll-end (last visible index)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const virtualScrollTrait: TraitDefinition = {\n name: 'virtual-scroll',\n category: 'present',\n targets: 'self',\n\n defaults: {\n 'item-height': '40',\n overscan: '3',\n total: '0',\n },\n\n attach(ctx) {\n const itemHeight = Number(ctx.config('item-height') ?? '40')\n const overscan = Number(ctx.config('overscan') ?? '3')\n const total = Number(ctx.config('total') ?? '0')\n\n if (itemHeight <= 0 || total <= 0) return\n\n // Structural CSS handled by virtual-scroll.css via [traits*=\"virtual-scroll\"]\n\n // Create spacer to maintain full scroll height\n const spacer = document.createElement('div')\n spacer.style.height = `${total * itemHeight}px`\n spacer.setAttribute('aria-hidden', 'true')\n spacer.setAttribute('data-virtual-spacer', '')\n ctx.host.prepend(spacer)\n\n const update = () => {\n const scrollTop = ctx.host.scrollTop\n const viewportHeight = ctx.host.clientHeight\n\n const rawStart = Math.floor(scrollTop / itemHeight)\n const rawEnd = Math.ceil((scrollTop + viewportHeight) / itemHeight)\n\n const start = Math.max(0, rawStart - overscan)\n const end = Math.min(total - 1, rawEnd + overscan)\n\n ctx.expose('start', String(start))\n ctx.expose('end', String(end))\n ctx.emit('virtual-range', { start, end })\n\n // Position visible children\n const children = [...ctx.host.children].filter(\n (el) => !el.hasAttribute('data-virtual-spacer'),\n ) as HTMLElement[]\n\n // Position & height via CSS [traits*=\"virtual-scroll\"] > *; only dynamic values need JS\n for (let i = 0; i < children.length; i++) {\n const childIndex = start + i\n if (childIndex <= end) {\n children[i]!.style.height = `${itemHeight}px`\n children[i]!.style.transform = `translateY(${childIndex * itemHeight}px)`\n }\n }\n }\n\n // Initial update\n queueMicrotask(update)\n\n ctx.host.addEventListener('scroll', update, { passive: true })\n\n return () => {\n ctx.host.removeEventListener('scroll', update)\n spacer.remove()\n }\n },\n}\n","// ── ripple trait ─────────────────────────────────────────────\n//\n// Adds a Material-style expanding ripple effect on pointer press.\n// Works on any element. Uses CSS animations, no JS animation frames.\n//\n// Usage:\n// <aui-button traits=\"ripple\">\n// <aui-button traits=\"ripple\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const rippleTrait: TraitDefinition = {\n name: 'ripple',\n category: 'effect',\n targets: 'self',\n\n attach(ctx) {\n // CSS-only ripple via ::after pseudo-element — no DOM injection.\n // Structural CSS (position: relative, overflow: hidden) handled by ripple.css\n\n const onPointerDown = (e: Event) => {\n const pe = e as PointerEvent\n const el = ctx.host\n const rect = el.getBoundingClientRect()\n const size = Math.max(rect.width, rect.height) * 2\n\n el.style.setProperty('--ripple-x', `${pe.clientX - rect.left}px`)\n el.style.setProperty('--ripple-y', `${pe.clientY - rect.top}px`)\n el.style.setProperty('--ripple-size', `${size}px`)\n\n // Remove then re-add to allow rapid re-triggering\n el.removeAttribute('data-ripple-active')\n // Force style recalc so the animation restarts\n void el.offsetWidth\n el.setAttribute('data-ripple-active', '')\n }\n\n const onAnimationEnd = (e: Event) => {\n if ((e as AnimationEvent).animationName === 'aui-ripple') {\n ctx.host.removeAttribute('data-ripple-active')\n }\n }\n\n ctx.host.addEventListener('pointerdown', onPointerDown)\n ctx.host.addEventListener('animationend', onAnimationEnd)\n\n return () => {\n ctx.host.removeEventListener('pointerdown', onPointerDown)\n ctx.host.removeEventListener('animationend', onAnimationEnd)\n ctx.host.removeAttribute('data-ripple-active')\n ctx.host.style.removeProperty('--ripple-x')\n ctx.host.style.removeProperty('--ripple-y')\n ctx.host.style.removeProperty('--ripple-size')\n }\n },\n}\n","// ── confetti trait ───────────────────────────────────────────\n//\n// Bursts confetti particles from the host on `press` event.\n// JS-animated with gravity, air resistance, rotation, and fade.\n// Particles render in a fixed overlay on document.body.\n//\n// Usage:\n// <aui-button traits=\"confetti\">\n// <aui-button traits=\"{ trait: 'confetti', count: '50', spread: '120' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst COLORS = ['#ff577f', '#ff884b', '#ffd384', '#fff9b0', '#3ec1d3', '#7c5cbf', '#ff6b6b', '#48dbfb']\n\ninterface Particle {\n el: HTMLElement\n x: number\n y: number\n vx: number\n vy: number\n rotation: number\n rotationSpeed: number\n opacity: number\n}\n\nexport const confettiTrait: TraitDefinition = {\n name: 'confetti',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n count: '30',\n spread: '90',\n velocity: '12',\n gravity: '0.5',\n duration: '2000',\n },\n actions: ['press'],\n\n attach(ctx) {\n const count = parseInt(ctx.config('count') ?? '30', 10)\n const spread = parseInt(ctx.config('spread') ?? '90', 10)\n const velocity = parseFloat(ctx.config('velocity') ?? '12')\n const gravity = parseFloat(ctx.config('gravity') ?? '0.5')\n const duration = parseInt(ctx.config('duration') ?? '2000', 10)\n\n const containers = new Set<HTMLElement>()\n\n const fire = () => {\n const rect = ctx.host.getBoundingClientRect()\n const originX = rect.left + rect.width / 2\n const originY = rect.top + rect.height / 2\n\n // Fixed overlay\n const container = document.createElement('div')\n container.style.cssText = 'position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:9999;'\n document.body.appendChild(container)\n containers.add(container)\n\n const particles: Particle[] = []\n const spreadRad = (spread / 2) * (Math.PI / 180)\n const baseAngle = -Math.PI / 2 // upward\n\n for (let i = 0; i < count; i++) {\n const el = document.createElement('div')\n const size = 6 + Math.random() * 5\n const color = COLORS[i % COLORS.length]!\n const isCircle = Math.random() > 0.5\n\n el.style.cssText = `position:absolute;width:${size}px;height:${size}px;background:${color};border-radius:${isCircle ? '50%' : '2px'};left:${originX}px;top:${originY}px;pointer-events:none;`\n container.appendChild(el)\n\n const angle = baseAngle + (Math.random() * 2 - 1) * spreadRad\n const v = velocity * (0.7 + Math.random() * 0.6)\n\n particles.push({\n el,\n x: 0,\n y: 0,\n vx: Math.cos(angle) * v,\n vy: Math.sin(angle) * v,\n rotation: Math.random() * 360,\n rotationSpeed: (Math.random() - 0.5) * 20,\n opacity: 1,\n })\n }\n\n ctx.host.setAttribute('data-confetti-active', '')\n\n const startTime = performance.now()\n const fadeStart = duration * 0.7\n\n const step = (now: number): void => {\n const elapsed = now - startTime\n\n if (elapsed >= duration) {\n container.remove()\n containers.delete(container)\n if (containers.size === 0) {\n ctx.host.removeAttribute('data-confetti-active')\n }\n return\n }\n\n for (const p of particles) {\n p.vy += gravity\n p.vx *= 0.98\n p.vy *= 0.98\n p.x += p.vx\n p.y += p.vy\n p.rotation += p.rotationSpeed\n\n if (elapsed > fadeStart) {\n p.opacity = 1 - (elapsed - fadeStart) / (duration - fadeStart)\n }\n\n p.el.style.transform = `translate(${p.x}px, ${p.y}px) rotate(${p.rotation}deg)`\n p.el.style.opacity = String(p.opacity)\n }\n\n requestAnimationFrame(step)\n }\n\n requestAnimationFrame(step)\n }\n\n ctx.host.addEventListener('press', fire)\n\n return () => {\n ctx.host.removeEventListener('press', fire)\n for (const c of containers) c.remove()\n containers.clear()\n }\n },\n}\n","// ── flip trait ───────────────────────────────────────────────\n//\n// 3D card flip animation triggered on `press`.\n// Host should contain two children: front face and back face.\n// All visual CSS (perspective, transforms, backface-visibility,\n// transitions) lives in flip.css — JS only toggles state.\n//\n// Usage:\n// <aui-card traits=\"flip\">\n// <aui-card traits=\"{ trait: 'flip', direction: 'vertical', duration: '400' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const flipTrait: TraitDefinition = {\n name: 'flip',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n duration: '600',\n direction: 'horizontal',\n },\n actions: ['press'],\n\n attach(ctx) {\n const duration = ctx.config('duration') ?? '600'\n const direction = ctx.config('direction') ?? 'horizontal'\n let flipped = false\n\n // Expose direction for CSS axis selection\n if (direction === 'vertical') {\n ctx.host.setAttribute('data-flip-direction', 'vertical')\n }\n\n // Set custom duration if non-default\n if (duration !== '600') {\n ctx.host.style.setProperty('--aui-flip-duration', `${duration}ms`)\n }\n\n const onPress = () => {\n flipped = !flipped\n ctx.expose('flipped', flipped)\n }\n\n ctx.expose('flipped', false)\n ctx.host.addEventListener('press', onPress)\n\n return () => {\n ctx.host.removeEventListener('press', onPress)\n ctx.host.removeAttribute('data-flip-direction')\n ctx.host.style.removeProperty('--aui-flip-duration')\n ctx.unexpose('flipped')\n }\n },\n}\n","// ── parallax trait ───────────────────────────────────────────\n//\n// Scroll-based parallax effect. Shifts the host element at a\n// fraction of the scroll speed using a CSS custom property.\n//\n// Usage:\n// <aui-section traits=\"parallax\">\n// <aui-section traits=\"{ trait: 'parallax', speed: '0.3', direction: 'horizontal' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const parallaxTrait: TraitDefinition = {\n name: 'parallax',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n speed: '0.5',\n direction: 'vertical',\n },\n\n attach(ctx) {\n const speed = parseFloat(ctx.config('speed') ?? '0.5')\n const direction = ctx.config('direction') ?? 'vertical'\n const isVertical = direction === 'vertical'\n const prop = '--_parallax-offset'\n\n // Apply base transform so the custom property drives the shift\n ctx.host.style.transform = isVertical\n ? `translateY(var(${prop}, 0px))`\n : `translateX(var(${prop}, 0px))`\n ctx.host.style.willChange = 'transform'\n\n let rafId = 0\n let ticking = false\n\n const update = () => {\n const rect = ctx.host.getBoundingClientRect()\n const viewportSize = isVertical ? window.innerHeight : window.innerWidth\n const hostCenter = isVertical\n ? rect.top + rect.height / 2\n : rect.left + rect.width / 2\n\n // Offset relative to viewport center — 0 when element is centered\n const delta = (hostCenter - viewportSize / 2) * speed\n ctx.host.style.setProperty(prop, `${delta}px`)\n ticking = false\n }\n\n const onScroll = () => {\n if (!ticking) {\n rafId = requestAnimationFrame(update)\n ticking = true\n }\n }\n\n // Initial position\n update()\n\n window.addEventListener('scroll', onScroll, { passive: true })\n window.addEventListener('resize', onScroll, { passive: true })\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('scroll', onScroll)\n window.removeEventListener('resize', onScroll)\n ctx.host.style.transform = ''\n ctx.host.style.willChange = ''\n ctx.host.style.removeProperty(prop)\n }\n },\n}\n","// ── toss trait ───────────────────────────────────────────────\n//\n// Physics-based throw on pointer release — host flings in the\n// direction of pointer velocity, then springs back to origin.\n//\n// Usage:\n// <aui-card traits=\"toss\">\n// <aui-card traits=\"{ trait: 'toss', friction: '0.90', bounce: '0.2' }\">\n//\n// Exposed state:\n// data-toss-active (boolean, true during animation)\n\nimport type { TraitDefinition } from '../types.ts'\n\ninterface PointerSample {\n readonly x: number\n readonly y: number\n readonly t: number\n}\n\nexport const tossTrait: TraitDefinition = {\n name: 'toss',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n friction: '0.92',\n bounce: '0.15',\n max: '200',\n },\n\n attach(ctx) {\n const friction = parseFloat(ctx.config('friction') ?? '0.92')\n const bounce = parseFloat(ctx.config('bounce') ?? '0.15')\n const max = parseFloat(ctx.config('max') ?? '200')\n\n // Initialize custom properties\n ctx.host.style.setProperty('--_toss-x', '0px')\n ctx.host.style.setProperty('--_toss-y', '0px')\n ctx.host.style.transform = 'translate(var(--_toss-x), var(--_toss-y))'\n\n let samples: PointerSample[] = []\n let frameId: number | null = null\n\n const onPointerMove = (e: Event) => {\n const pe = e as PointerEvent\n const now = performance.now()\n samples.push({ x: pe.clientX, y: pe.clientY, t: now })\n // Keep last 4 samples\n if (samples.length > 4) {\n samples = samples.slice(-4)\n }\n }\n\n const onPointerUp = () => {\n if (samples.length < 2) {\n samples = []\n return\n }\n\n const first = samples[0]!\n const last = samples[samples.length - 1]!\n const dt = (last.t - first.t) || 1\n\n let vx = ((last.x - first.x) / dt) * 16 // velocity per frame (~16ms)\n let vy = ((last.y - first.y) / dt) * 16\n\n samples = []\n\n let dx = 0\n let dy = 0\n\n // Cancel any existing animation\n if (frameId !== null) {\n cancelAnimationFrame(frameId)\n }\n\n ctx.expose('active', true)\n\n const step = () => {\n // Apply velocity\n dx += vx\n dy += vy\n\n // Clamp displacement\n const dist = Math.sqrt(dx * dx + dy * dy)\n if (dist > max) {\n const scale = max / dist\n dx *= scale\n dy *= scale\n vx *= 0.5\n vy *= 0.5\n }\n\n // Apply friction\n vx *= friction\n vy *= friction\n\n // Spring-back force toward origin\n dx -= dx * bounce\n dy -= dy * bounce\n\n ctx.host.style.setProperty('--_toss-x', `${dx}px`)\n ctx.host.style.setProperty('--_toss-y', `${dy}px`)\n\n // Check if we're done (both velocity and displacement near zero)\n const speed = Math.abs(vx) + Math.abs(vy)\n const displacement = Math.abs(dx) + Math.abs(dy)\n\n if (speed < 0.1 && displacement < 0.5) {\n ctx.host.style.setProperty('--_toss-x', '0px')\n ctx.host.style.setProperty('--_toss-y', '0px')\n ctx.unexpose('active')\n frameId = null\n return\n }\n\n frameId = requestAnimationFrame(step)\n }\n\n frameId = requestAnimationFrame(step)\n }\n\n ctx.host.addEventListener('pointermove', onPointerMove)\n ctx.host.addEventListener('pointerup', onPointerUp)\n\n return () => {\n ctx.host.removeEventListener('pointermove', onPointerMove)\n ctx.host.removeEventListener('pointerup', onPointerUp)\n if (frameId !== null) {\n cancelAnimationFrame(frameId)\n frameId = null\n }\n ctx.host.style.removeProperty('--_toss-x')\n ctx.host.style.removeProperty('--_toss-y')\n }\n },\n}\n","// ── magnet trait ─────────────────────────────────────────────\n//\n// Host subtly follows/tilts toward the cursor when hovering.\n// Uses CSS custom properties and perspective transforms.\n//\n// Usage:\n// <aui-card traits=\"magnet\">\n// <aui-card traits=\"{ trait: 'magnet', strength: '15', tilt: '8' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const magnetTrait: TraitDefinition = {\n name: 'magnet',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n strength: '10',\n tilt: '5',\n },\n\n attach(ctx) {\n const strength = parseFloat(ctx.config('strength') ?? '10')\n const tilt = parseFloat(ctx.config('tilt') ?? '5')\n\n // Initialize custom properties\n ctx.host.style.setProperty('--_magnet-x', '0px')\n ctx.host.style.setProperty('--_magnet-y', '0px')\n ctx.host.style.setProperty('--_magnet-rx', '0deg')\n ctx.host.style.setProperty('--_magnet-ry', '0deg')\n ctx.host.style.transform =\n 'perspective(800px) translate(var(--_magnet-x), var(--_magnet-y)) rotateX(var(--_magnet-rx)) rotateY(var(--_magnet-ry))'\n ctx.host.style.willChange = 'transform'\n\n const onMouseMove = (e: Event) => {\n const me = e as MouseEvent\n const rect = ctx.host.getBoundingClientRect()\n const centerX = rect.left + rect.width / 2\n const centerY = rect.top + rect.height / 2\n\n // Normalized offset: -1 to 1\n const dx = (me.clientX - centerX) / (rect.width / 2)\n const dy = (me.clientY - centerY) / (rect.height / 2)\n\n ctx.host.style.setProperty('--_magnet-x', `${dx * strength}px`)\n ctx.host.style.setProperty('--_magnet-y', `${dy * strength}px`)\n // rotateX is driven by vertical offset (inverted), rotateY by horizontal\n ctx.host.style.setProperty('--_magnet-rx', `${-dy * tilt}deg`)\n ctx.host.style.setProperty('--_magnet-ry', `${dx * tilt}deg`)\n }\n\n const onMouseEnter = () => {\n // Remove transition for instant tracking\n ctx.host.style.transition = 'none'\n }\n\n const onMouseLeave = () => {\n // Animate back to center\n ctx.host.style.transition = 'transform 0.3s ease-out'\n ctx.host.style.setProperty('--_magnet-x', '0px')\n ctx.host.style.setProperty('--_magnet-y', '0px')\n ctx.host.style.setProperty('--_magnet-rx', '0deg')\n ctx.host.style.setProperty('--_magnet-ry', '0deg')\n }\n\n ctx.host.addEventListener('mousemove', onMouseMove)\n ctx.host.addEventListener('mouseenter', onMouseEnter)\n ctx.host.addEventListener('mouseleave', onMouseLeave)\n\n return () => {\n ctx.host.removeEventListener('mousemove', onMouseMove)\n ctx.host.removeEventListener('mouseenter', onMouseEnter)\n ctx.host.removeEventListener('mouseleave', onMouseLeave)\n ctx.host.style.willChange = ''\n ctx.host.style.transition = ''\n ctx.host.style.transform = ''\n ctx.host.style.removeProperty('--_magnet-x')\n ctx.host.style.removeProperty('--_magnet-y')\n ctx.host.style.removeProperty('--_magnet-rx')\n ctx.host.style.removeProperty('--_magnet-ry')\n }\n },\n}\n","// ── noodle trait ─────────────────────────────────────────────\n//\n// Draws an SVG curved line (cubic bezier) connecting the host\n// element to a target element. Updates on scroll and resize.\n//\n// Usage:\n// <aui-node traits=\"{ trait: 'noodle', target: '#other-node' }\">\n// <aui-node traits=\"{ trait: 'noodle', target: '.peer', color: '#ff6b6b', width: '3' }\">\n\nimport type { TraitDefinition } from '../types.ts'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\nexport const noodleTrait: TraitDefinition = {\n name: 'noodle',\n category: 'effect',\n targets: 'external',\n\n defaults: {\n target: '',\n color: 'currentColor',\n width: '2',\n curvature: '0.5',\n },\n\n attach(ctx) {\n const selector = ctx.config('target') ?? ''\n const color = ctx.config('color') ?? 'currentColor'\n const width = parseFloat(ctx.config('width') ?? '2')\n const curvature = parseFloat(ctx.config('curvature') ?? '0.5')\n\n if (!selector) return\n\n // Create the fixed SVG overlay — structural CSS in noodle.css\n const svg = document.createElementNS(SVG_NS, 'svg')\n svg.setAttribute('data-noodle-svg', '')\n svg.setAttribute('aria-hidden', 'true')\n\n const path = document.createElementNS(SVG_NS, 'path')\n path.setAttribute('fill', 'none')\n path.setAttribute('stroke', color)\n path.setAttribute('stroke-width', String(width))\n path.setAttribute('stroke-linecap', 'round')\n svg.appendChild(path)\n\n document.body.appendChild(svg)\n\n let rafId = 0\n let ticking = false\n\n const updatePath = () => {\n const targetEl = document.querySelector(selector) as HTMLElement | null\n if (!targetEl) {\n ctx.expose('connected', false)\n path.setAttribute('d', '')\n ticking = false\n return\n }\n\n ctx.expose('connected', true)\n\n const hostRect = ctx.host.getBoundingClientRect()\n const targetRect = targetEl.getBoundingClientRect()\n\n const x1 = hostRect.left + hostRect.width / 2\n const y1 = hostRect.top + hostRect.height / 2\n const x2 = targetRect.left + targetRect.width / 2\n const y2 = targetRect.top + targetRect.height / 2\n\n // Control point offset based on curvature and distance\n const dx = Math.abs(x2 - x1) * curvature\n\n // Horizontal-biased bezier: control points shift along x\n const cp1x = x1 + dx\n const cp1y = y1\n const cp2x = x2 - dx\n const cp2y = y2\n\n path.setAttribute('d', `M ${x1} ${y1} C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${x2} ${y2}`)\n ticking = false\n }\n\n const requestUpdate = () => {\n if (!ticking) {\n rafId = requestAnimationFrame(updatePath)\n ticking = true\n }\n }\n\n // Initial draw\n updatePath()\n\n // Observe size changes on both host and target\n const ro = new ResizeObserver(requestUpdate)\n ro.observe(ctx.host)\n const targetEl = document.querySelector(selector)\n if (targetEl) ro.observe(targetEl)\n\n window.addEventListener('scroll', requestUpdate, { passive: true, capture: true })\n window.addEventListener('resize', requestUpdate, { passive: true })\n\n return () => {\n cancelAnimationFrame(rafId)\n ro.disconnect()\n window.removeEventListener('scroll', requestUpdate, true)\n window.removeEventListener('resize', requestUpdate)\n svg.remove()\n ctx.unexpose('connected')\n }\n },\n}\n","// ── CSSInspectController ─────────────────────────────────────\n//\n// Ported from NativeUI's CSSInspectController.\n// Explodes child layers in 3D space with interactive mouse-driven tilt.\n//\n// Two modes:\n// - Fixed host (default): click to activate, Escape to dismiss\n// - Pick mode (pick: true): Alt+hover highlights descendants,\n// Alt+click picks that element as the inspection target\n//\n// On activation, the target is deep-cloned into a popover (top layer)\n// so the 3D explosion escapes ancestor overflow clipping.\n\nexport interface CSSInspectOptions {\n depth?: number\n scale?: number\n maxTilt?: number\n tiltRadius?: number\n perspective?: number\n labels?: boolean\n recursive?: boolean\n pick?: boolean\n alwaysReady?: boolean\n dismissOnClickOutside?: boolean\n tiltElement?: HTMLElement\n disabled?: boolean\n}\n\nexport class CSSInspectController {\n readonly host: HTMLElement\n depth: number\n scale: number\n maxTilt: number\n tiltRadius: number\n perspective: number\n labels: boolean\n recursive: boolean\n pick: boolean\n alwaysReady: boolean\n dismissOnClickOutside: boolean\n tiltElement: HTMLElement | null\n disabled: boolean\n\n #attached = false\n #active = false\n #altHeld = false\n #pointerInside = false\n #pointerDownActivated = false\n #hoveredChild: HTMLElement | null = null\n #selectedChild: HTMLElement | null = null\n #explodedElements: HTMLElement[] = []\n #activationId = 0\n #depthMultiplier = 1\n #baseZ = 0\n #clone: HTMLElement | null = null\n #popover: HTMLElement | null = null\n #inspectTarget: HTMLElement | null = null\n #hlPopover: HTMLElement | null = null\n #hlReady: HTMLElement | null = null\n #hlHover: HTMLElement | null = null\n\n constructor(host: HTMLElement, options: CSSInspectOptions = {}) {\n this.host = host\n this.depth = options.depth ?? 16\n this.scale = options.scale ?? 0.85\n this.maxTilt = options.maxTilt ?? 60\n this.tiltRadius = options.tiltRadius ?? 384\n this.perspective = options.perspective ?? 1200\n this.labels = options.labels ?? true\n this.recursive = options.recursive ?? true\n this.pick = options.pick ?? false\n this.alwaysReady = options.alwaysReady ?? false\n this.dismissOnClickOutside = options.dismissOnClickOutside ?? true\n this.tiltElement = options.tiltElement ?? null\n this.disabled = options.disabled ?? false\n this.attach()\n }\n\n get active(): boolean { return this.#active }\n get inspectRoot(): HTMLElement { return this.#clone ?? this.host }\n\n attach(): void {\n if (this.#attached) return\n this.#attached = true\n this.host.addEventListener('pointerenter', this.#onPointerEnter)\n this.host.addEventListener('pointerleave', this.#onPointerLeave)\n this.host.addEventListener('pointermove', this.#onHoverMove)\n this.host.addEventListener('pointerdown', this.#onPointerDown)\n this.host.addEventListener('click', this.#onClick)\n document.addEventListener('keydown', this.#onAltDown)\n document.addEventListener('keyup', this.#onAltUp)\n }\n\n detach(): void {\n if (!this.#attached) return\n this.#attached = false\n this.host.removeEventListener('pointerenter', this.#onPointerEnter)\n this.host.removeEventListener('pointerleave', this.#onPointerLeave)\n this.host.removeEventListener('pointermove', this.#onHoverMove)\n this.host.removeEventListener('pointerdown', this.#onPointerDown)\n this.host.removeEventListener('click', this.#onClick)\n document.removeEventListener('keydown', this.#onAltDown)\n document.removeEventListener('keyup', this.#onAltUp)\n if (this.#active) this.#deactivate()\n this.#clearHover()\n this.#teardownHighlights()\n }\n\n destroy(): void { this.detach() }\n\n inspect(target?: HTMLElement): void {\n if (this.#active) return\n const el = target ?? this.host\n const rect = el.getBoundingClientRect()\n this.#activate(el, rect.left + rect.width / 2, rect.top + rect.height / 2)\n }\n\n dismiss(): void {\n if (this.#active) this.#deactivate()\n }\n\n // ── Handlers ──\n\n #onPointerEnter = (): void => {\n this.#pointerInside = true\n if (this.disabled || this.#active) return\n if (this.#altHeld || this.alwaysReady) this.#setReady(true)\n }\n\n #onPointerLeave = (): void => {\n this.#pointerInside = false\n this.#setReady(false)\n if (!this.#active) {\n this.#clearHover()\n this.#teardownHighlights()\n }\n }\n\n #onAltDown = (e: KeyboardEvent): void => {\n if (e.key !== 'Alt' || this.#altHeld) return\n this.#altHeld = true\n if (this.disabled || this.#active) return\n if (this.#pointerInside) this.#setReady(true)\n }\n\n #onAltUp = (e: KeyboardEvent): void => {\n if (e.key !== 'Alt') return\n this.#altHeld = false\n if (this.#active || this.alwaysReady) return\n this.#setReady(false)\n this.#clearHover()\n this.#teardownHighlights()\n }\n\n #onDocTilt = (e: PointerEvent): void => {\n const clone = this.#clone\n if (!clone) return\n const rect = (this.#popover ?? clone).getBoundingClientRect()\n const dx = e.clientX - (rect.left + rect.width / 2)\n const dy = e.clientY - (rect.top + rect.height / 2)\n const nx = Math.max(-1, Math.min(1, dx / this.tiltRadius))\n const ny = Math.max(-1, Math.min(1, dy / this.tiltRadius))\n const tiltX = ny * this.maxTilt\n const tiltY = nx * -this.maxTilt\n const bz = this.#baseZ * this.#depthMultiplier\n clone.style.transform = `translateZ(${bz}px) perspective(${this.perspective}px) scale(${this.scale}) rotateX(${tiltX}deg) rotateY(${tiltY}deg)`\n clone.style.setProperty('--inspect-tilt-x', `${tiltX}deg`)\n clone.style.setProperty('--inspect-tilt-y', `${tiltY}deg`)\n }\n\n #onPointerDown = (e: PointerEvent): void => {\n if (this.disabled || this.#active) return\n if (e.button !== 0) return\n if (!e.altKey && !this.alwaysReady) return\n e.preventDefault()\n this.#pointerDownActivated = true\n if (this.pick) {\n if (!this.#hoveredChild) return\n const target = this.#hoveredChild\n this.#clearHover()\n this.#activate(target, e.clientX, e.clientY)\n } else {\n this.#activate(this.host, e.clientX, e.clientY)\n }\n }\n\n #onHoverMove = (e: PointerEvent): void => {\n if (this.disabled) return\n if (!this.#active && !this.#altHeld && !this.alwaysReady) return\n const root = this.#clone ?? this.host\n const target = e.target as HTMLElement\n const hoverTarget = target === root ? null : this.#closestChildOf(target, root)\n if (hoverTarget === this.#hoveredChild) return\n this.#clearHover()\n if (hoverTarget) {\n this.#hoveredChild = hoverTarget\n if (!this.#active) {\n this.#ensureHighlights()\n this.#showBox(this.#hlHover!, hoverTarget, this.labels ? this.#labelText(hoverTarget) : undefined)\n } else {\n hoverTarget.toggleAttribute('inspect-hover', true)\n let walk: HTMLElement | null = hoverTarget.parentElement\n while (walk && walk !== root) {\n walk.toggleAttribute('inspect-hover', true)\n walk = walk.parentElement\n }\n }\n }\n }\n\n #onClick = (e: MouseEvent): void => {\n if (this.disabled) return\n if (!this.#active) {\n if (this.#pointerDownActivated) { this.#pointerDownActivated = false; e.stopPropagation(); return }\n if (this.pick) {\n if ((!this.#altHeld && !this.alwaysReady) || !this.#hoveredChild) return\n e.stopPropagation()\n const target = this.#hoveredChild\n this.#clearHover()\n this.#activate(target, e.clientX, e.clientY)\n } else {\n e.stopPropagation()\n this.#activate(this.host, e.clientX, e.clientY)\n }\n return\n }\n e.stopPropagation()\n const root = this.#clone!\n const target = e.target as HTMLElement\n const child = target === root ? null : this.#closestChildOf(target, root)\n if (child) this.#select(child)\n }\n\n #onWheel = (e: WheelEvent): void => {\n if (!this.#active) return\n e.preventDefault()\n this.#depthMultiplier = Math.max(0.1, this.#depthMultiplier + (e.deltaY > 0 ? -0.5 : 0.5))\n this.#updateDepths()\n }\n\n #onDocClick = (e: MouseEvent): void => {\n if (!this.#active) return\n if (this.#pointerDownActivated) { this.#pointerDownActivated = false; return }\n if (this.#popover && !this.#popover.contains(e.target as Node)) this.#deactivate()\n }\n\n #onDocKeydown = (e: KeyboardEvent): void => {\n if (!this.#active) return\n if (e.key === 'Escape') { e.preventDefault(); this.#deactivate() }\n }\n\n #onDocSelectStart = (e: Event): void => { e.preventDefault() }\n #onDocPointerDown = (e: PointerEvent): void => { e.preventDefault() }\n\n // ── Internals ──\n\n #setReady(on: boolean): void {\n if (on) {\n this.host.toggleAttribute('inspect-ready', true)\n this.#ensureHighlights()\n this.#showBox(this.#hlReady!, this.host, this.labels ? this.#labelText(this.host) : undefined)\n } else {\n this.host.removeAttribute('inspect-ready')\n this.#hideBox(this.#hlReady)\n }\n }\n\n #ensureHighlights(): void {\n if (this.#hlPopover) return\n const pop = document.createElement('div')\n pop.setAttribute('popover', 'manual')\n pop.style.cssText = 'position:fixed;inset:0;margin:0;padding:0;border:none;background:transparent;pointer-events:none;overflow:visible;'\n this.#hlReady = this.#makeBox('oklch(0.6 0.2 250 / 0.5)')\n this.#hlHover = this.#makeBox('oklch(0.6 0.2 250 / 0.7)')\n pop.append(this.#hlReady, this.#hlHover)\n document.body.appendChild(pop)\n if (typeof pop.showPopover === 'function') pop.showPopover()\n this.#hlPopover = pop\n }\n\n #makeBox(color: string): HTMLElement {\n const box = document.createElement('div')\n box.style.cssText = `position:fixed;pointer-events:none;display:none;box-sizing:border-box;outline:2px solid ${color};outline-offset:-1px;`\n const label = document.createElement('span')\n label.style.cssText = 'position:absolute;bottom:100%;left:0.25rem;margin-bottom:2px;font:500 0.625rem/1.4 ui-monospace,monospace;color:oklch(0.85 0.15 250);background:oklch(0.2 0.05 250/0.85);padding:0.1rem 0.35rem;border-radius:0.2rem;white-space:nowrap;display:none;'\n box.appendChild(label)\n return box\n }\n\n #showBox(box: HTMLElement, el: HTMLElement, labelText?: string): void {\n const rect = el.getBoundingClientRect()\n box.style.top = `${rect.top}px`\n box.style.left = `${rect.left}px`\n box.style.width = `${rect.width}px`\n box.style.height = `${rect.height}px`\n box.style.display = 'block'\n const label = box.firstElementChild as HTMLElement\n if (labelText) { label.textContent = labelText; label.style.display = 'block' }\n else { label.style.display = 'none' }\n }\n\n #hideBox(box: HTMLElement | null): void { if (box) box.style.display = 'none' }\n\n #teardownHighlights(): void {\n if (!this.#hlPopover) return\n try { this.#hlPopover.hidePopover() } catch {}\n this.#hlPopover.remove()\n this.#hlPopover = null; this.#hlReady = null; this.#hlHover = null\n }\n\n #updateDepths(): void {\n const root = this.#clone ?? this.host\n this.#explodedElements.forEach((child, i) => {\n const base = this.recursive ? this.#domDepthFrom(child, root) * this.depth : (i + 1) * this.depth\n child.style.transform = `translateZ(${base * this.#depthMultiplier}px)`\n })\n if (this.#clone && this.#baseZ) {\n const current = this.#clone.style.transform\n const bz = this.#baseZ * this.#depthMultiplier\n this.#clone.style.transform = current.replace(/translateZ\\([^)]+\\)/, `translateZ(${bz}px)`)\n }\n }\n\n #closestChildOf(target: HTMLElement, root: HTMLElement): HTMLElement | null {\n if (this.recursive && root.contains(target) && target !== root) return target\n let el: HTMLElement | null = target\n while (el && el !== root) {\n if (el.parentElement === root) return el\n el = el.parentElement\n }\n return null\n }\n\n #clearHover(): void {\n if (!this.#hoveredChild) return\n const root = this.#clone ?? this.host\n let walk: HTMLElement | null = this.#hoveredChild\n while (walk && walk !== root) { walk.removeAttribute('inspect-hover'); walk = walk.parentElement }\n this.#hideBox(this.#hlHover)\n this.#hoveredChild = null\n }\n\n #select(el: HTMLElement): void {\n this.#clearSelection()\n this.#selectedChild = el\n const root = this.#clone ?? this.host\n let walk: HTMLElement | null = el\n while (walk && walk !== root) { walk.toggleAttribute('inspect-selected', true); walk = walk.parentElement }\n }\n\n #clearSelection(): void {\n if (!this.#selectedChild) return\n const root = this.#clone ?? this.host\n let walk: HTMLElement | null = this.#selectedChild\n while (walk && walk !== root) { walk.removeAttribute('inspect-selected'); walk = walk.parentElement }\n this.#selectedChild = null\n }\n\n #labelText(el: HTMLElement): string {\n const tag = el.tagName.toLowerCase()\n const id = el.id ? `#${el.id}` : ''\n const cls = typeof el.className === 'string' && el.className ? `.${el.className.split(/\\s+/)[0]}` : ''\n return `${tag}${id}${cls}`\n }\n\n #createLabel(el: HTMLElement): void { el.setAttribute('data-inspect-label', this.#labelText(el)) }\n\n #domDepthFrom(el: HTMLElement, root: HTMLElement): number {\n let depth = 0; let node: HTMLElement | null = el\n while (node && node !== root) { depth++; node = node.parentElement }\n return depth\n }\n\n #collectElements(root: HTMLElement): HTMLElement[] {\n if (!this.recursive) return Array.from(root.children).filter((el): el is HTMLElement => el instanceof HTMLElement)\n const elements: HTMLElement[] = []\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: Node) => node instanceof HTMLElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP,\n })\n let node: Node | null\n while ((node = walker.nextNode())) { if (node instanceof HTMLElement) elements.push(node) }\n return elements\n }\n\n #activate(target: HTMLElement, px: number, py: number): void {\n this.#active = true\n const id = ++this.#activationId\n this.#clearHover()\n this.#setReady(false)\n this.#inspectTarget = target\n target.toggleAttribute('inspecting', true)\n\n const rect = target.getBoundingClientRect()\n const clone = target.cloneNode(true) as HTMLElement\n clone.setAttribute('data-inspect-clone', '')\n clone.querySelectorAll('*').forEach(el => { if (el.tagName.includes('-')) el.setAttribute('data-inspect-clone', '') })\n\n const popover = document.createElement('div')\n popover.setAttribute('popover', 'manual')\n popover.style.cssText = `position:fixed;inset:auto;margin:0;padding:0;border:none;background:transparent;overflow:visible;top:${rect.top}px;left:${rect.left}px;width:${rect.width}px;height:${rect.height}px;`\n popover.appendChild(clone)\n document.body.appendChild(popover)\n if (typeof popover.showPopover === 'function') popover.showPopover()\n\n this.#clone = clone\n this.#popover = popover\n target.style.visibility = 'hidden'\n this.#baseZ = this.pick ? this.depth * 2 : 0\n\n clone.toggleAttribute('inspecting', true)\n clone.style.transformStyle = 'preserve-3d'\n clone.style.transformOrigin = 'center center'\n clone.style.userSelect = 'none'\n clone.style.overflow = 'visible'\n popover.style.transformStyle = 'preserve-3d'\n popover.style.perspective = `${this.perspective}px`\n\n const dx = px - (rect.left + rect.width / 2)\n const dy = py - (rect.top + rect.height / 2)\n const nx = Math.max(-1, Math.min(1, dx / this.tiltRadius))\n const ny = Math.max(-1, Math.min(1, dy / this.tiltRadius))\n const tiltX = ny * this.maxTilt\n const tiltY = nx * -this.maxTilt\n const bz = this.#baseZ * this.#depthMultiplier\n clone.style.transform = `translateZ(${bz}px) perspective(${this.perspective}px) scale(${this.scale}) rotateX(${tiltX}deg) rotateY(${tiltY}deg)`\n clone.style.transition = 'transform 500ms cubic-bezier(0.2, 0, 0, 1)'\n\n const elements = this.#collectElements(clone)\n this.#explodedElements = elements\n elements.forEach((child, i) => {\n const z = this.recursive ? this.#domDepthFrom(child, clone) * this.depth : (i + 1) * this.depth\n child.toggleAttribute('inspect-layer', true)\n child.style.transformStyle = 'preserve-3d'\n child.style.overflow = 'visible'\n child.style.transform = `translateZ(${z}px)`\n child.style.transition = 'transform 500ms cubic-bezier(0.2, 0, 0, 1)'\n if (this.labels) this.#createLabel(child)\n })\n if (this.labels) this.#createLabel(clone)\n\n setTimeout(() => {\n if (this.#activationId === id && this.#active) clone.style.transition = 'transform 60ms ease-out'\n }, 520)\n\n clone.addEventListener('pointermove', this.#onHoverMove)\n clone.addEventListener('click', this.#onClick)\n popover.addEventListener('wheel', this.#onWheel, { passive: false })\n\n if (this.dismissOnClickOutside) document.addEventListener('click', this.#onDocClick, true)\n document.addEventListener('keydown', this.#onDocKeydown);\n (this.tiltElement ?? document).addEventListener('pointermove', this.#onDocTilt as EventListener)\n document.addEventListener('wheel', this.#onWheel, { passive: false })\n document.addEventListener('selectstart', this.#onDocSelectStart)\n document.addEventListener('pointerdown', this.#onDocPointerDown)\n\n this.host.dispatchEvent(new CustomEvent('aui:inspect', { bubbles: true, composed: true, detail: { active: true, layers: elements.length } }))\n }\n\n #deactivate(): void {\n this.#active = false\n ++this.#activationId\n this.#clearSelection()\n this.#clearHover()\n\n const count = this.#explodedElements.length\n this.#explodedElements = []\n\n if (this.#clone) { this.#clone.removeEventListener('pointermove', this.#onHoverMove); this.#clone.removeEventListener('click', this.#onClick) }\n if (this.#popover) {\n this.#popover.removeEventListener('wheel', this.#onWheel)\n try { this.#popover.hidePopover() } catch {}\n this.#popover.remove()\n }\n this.#clone = null; this.#popover = null; this.#depthMultiplier = 1; this.#baseZ = 0\n\n const target = this.#inspectTarget ?? this.host\n target.style.visibility = ''; target.removeAttribute('inspecting')\n this.#inspectTarget = null\n\n document.removeEventListener('click', this.#onDocClick, true)\n document.removeEventListener('keydown', this.#onDocKeydown);\n (this.tiltElement ?? document).removeEventListener('pointermove', this.#onDocTilt as EventListener)\n document.removeEventListener('wheel', this.#onWheel)\n document.removeEventListener('selectstart', this.#onDocSelectStart)\n document.removeEventListener('pointerdown', this.#onDocPointerDown)\n\n this.host.dispatchEvent(new CustomEvent('aui:inspect', { bubbles: true, composed: true, detail: { active: false, layers: count } }))\n }\n}\n","// ── css-inspect trait ────────────────────────────────────────\n//\n// 3D DOM inspector. Explodes child elements in z-space with\n// interactive mouse-driven tilt. Deep-clones into popover\n// top layer to escape overflow clipping.\n//\n// Usage:\n// <aui-container traits=\"css-inspect\">\n// <aui-container traits=\"{ trait: 'css-inspect', depth: '24', scale: '0.8' }\">\n// <div traits=\"{ trait: 'css-inspect', pick: 'true', alwaysReady: 'true' }\">\n//\n// Events:\n// aui:inspect — fires on activate/deactivate, detail: { active, layers }\n\nimport type { TraitDefinition } from '../types.ts'\nimport { CSSInspectController } from './css-inspect-controller.ts'\n\nexport const cssInspectTrait: TraitDefinition = {\n name: 'css-inspect',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n depth: '16',\n scale: '0.85',\n 'max-tilt': '60',\n 'tilt-radius': '384',\n perspective: '1200',\n labels: 'true',\n recursive: 'true',\n pick: 'false',\n 'always-ready': 'false',\n },\n\n attach(ctx) {\n const controller = new CSSInspectController(ctx.host, {\n depth: Number(ctx.config('depth') ?? '16'),\n scale: Number(ctx.config('scale') ?? '0.85'),\n maxTilt: Number(ctx.config('max-tilt') ?? '60'),\n tiltRadius: Number(ctx.config('tilt-radius') ?? '384'),\n perspective: Number(ctx.config('perspective') ?? '1200'),\n labels: (ctx.config('labels') ?? 'true') === 'true',\n recursive: (ctx.config('recursive') ?? 'true') === 'true',\n pick: (ctx.config('pick') ?? 'false') === 'true',\n alwaysReady: (ctx.config('always-ready') ?? 'false') === 'true',\n })\n\n ctx.host.addEventListener('aui:inspect', ((e: CustomEvent) => {\n ctx.expose('active', e.detail.active)\n }) as EventListener)\n\n return () => {\n controller.destroy()\n }\n },\n}\n","// ── snap-resize trait ─────────────────────────────────────────\n//\n// Snaps pane resize to grid increments. Designed to work with\n// aui-panes — listens for aui:panes-resize and rounds sizes.\n//\n// Usage:\n// <aui-panes traits=\"snap-resize\">\n// <aui-panes traits=\"{ trait: 'snap-resize', grid: '100' }\">\n// <aui-panes traits=\"{ trait: 'snap-resize', grid: '50', modifier: 'Shift' }\">\n//\n// Config:\n// grid — snap increment in px (default: 50)\n// modifier — when set, only snap while this key is held (e.g., 'Shift')\n// when empty, always snap (default)\n//\n// Exposed state:\n// data-snap-resize-grid (current grid value)\n\nimport type { TraitDefinition } from '../types.ts'\n\nexport const snapResizeTrait: TraitDefinition = {\n name: 'snap-resize',\n category: 'effect',\n targets: 'self',\n\n defaults: {\n grid: '50',\n modifier: '',\n },\n\n attach(ctx) {\n const grid = parseInt(ctx.config('grid') ?? '50', 10)\n const modifier = ctx.config('modifier') ?? ''\n let modifierDown = false\n\n ctx.expose('grid', grid.toString())\n\n const snapValue = (value: number): number => {\n return Math.round(value / grid) * grid\n }\n\n const onResize = (e: Event) => {\n // Only snap when modifier condition is met\n if (modifier && !modifierDown) return\n\n const detail = (e as CustomEvent).detail as { sizes?: number[] } | undefined\n if (!detail?.sizes) return\n\n const snapped = detail.sizes.map(snapValue)\n\n // Apply snapped sizes to pane children\n const children = [...ctx.host.children] as HTMLElement[]\n for (let i = 0; i < children.length && i < snapped.length; i++) {\n children[i]!.style.flexBasis = `${snapped[i]}px`\n }\n }\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (modifier && e.key === modifier) modifierDown = true\n }\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (modifier && e.key === modifier) modifierDown = false\n }\n\n ctx.host.addEventListener('aui:panes-resize', onResize)\n\n if (modifier) {\n document.addEventListener('keydown', onKeyDown)\n document.addEventListener('keyup', onKeyUp)\n }\n\n return () => {\n ctx.host.removeEventListener('aui:panes-resize', onResize)\n if (modifier) {\n document.removeEventListener('keydown', onKeyDown)\n document.removeEventListener('keyup', onKeyUp)\n }\n }\n },\n}\n","// ── Trait System ─────────────────────────────────────────────\n//\n// Infrastructure\nexport type { TraitDefinition, TraitContext, TraitEntry, TraitCategory } from './types.ts'\nexport { registerTrait, getTrait, getTraitNames, getTraitsByCategory, validateComposition } from './registry.ts'\nexport { attachTrait } from './attach.ts'\nexport { parseTraitsAttribute } from './parse.ts'\n\n// ── Built-in Traits ─────────────────────────────────────────\nimport { registerTrait } from './registry.ts'\n\n// Gesture\nimport { dragTrait } from './drag/drag.trait.ts'\nimport { pressHoldTrait } from './press-hold/press-hold.trait.ts'\nimport { swipeTrait } from './swipe/swipe.trait.ts'\nimport { sortTrait } from './sort/sort.trait.ts'\nimport { resizeTrait } from './resize/resize.trait.ts'\nimport { panZoomTrait } from './pan-zoom/pan-zoom.trait.ts'\n\n// State\nimport { hoverTrait } from './hover/hover.trait.ts'\nimport { toggleStateTrait } from './toggle-state/toggle-state.trait.ts'\nimport { toggleSchemeTrait } from './toggle-scheme/toggle-scheme.trait.ts'\nimport { copyTrait } from './copy/copy.trait.ts'\nimport { clipboardTrait } from './clipboard/clipboard.trait.ts'\nimport { shortcutTrait } from './shortcut/shortcut.trait.ts'\nimport { searchTrait } from './search/search.trait.ts'\nimport { dropZoneTrait } from './drop-zone/drop-zone.trait.ts'\nimport { editTrait } from './edit/edit.trait.ts'\nimport { intersectTrait } from './intersect/intersect.trait.ts'\nimport { linkPasteTrait } from './link-paste/link-paste.trait.ts'\nimport { linkedScrollTrait } from './linked-scroll/linked-scroll.trait.ts'\nimport { mentionTrait } from './mention/mention.trait.ts'\nimport { persistTrait } from './persist/persist.trait.ts'\nimport { rangeSelectTrait } from './range-select/range-select.trait.ts'\nimport { selectionTrait } from './selection/selection.trait.ts'\nimport { slashCommandTrait } from './slash-command/slash-command.trait.ts'\nimport { storeTrait } from './store/store.trait.ts'\nimport { textTriggerTrait } from './text-trigger/text-trigger.trait.ts'\nimport { backtickWrapTrait } from './backtick-wrap/backtick-wrap.trait.ts'\nimport { validateTrait } from './validate/validate.trait.ts'\n\n// Focus\nimport { trapFocusTrait } from './trap-focus/trap-focus.trait.ts'\nimport { rovingFocusTrait } from './roving-focus/roving-focus.trait.ts'\nimport { listNavigateTrait } from './list-navigate/list-navigate.trait.ts'\n\n// Present\nimport { tooltipTrait } from './tooltip/tooltip.trait.ts'\nimport { collapsibleTrait } from './collapsible/collapsible.trait.ts'\nimport { popoverTrait } from './popover/popover.trait.ts'\nimport { modalTrait } from './modal/modal.trait.ts'\nimport { dismissTrait } from './dismiss/dismiss.trait.ts'\nimport { autoDismissTrait } from './auto-dismiss/auto-dismiss.trait.ts'\nimport { gatewayTrait } from './gateway/gateway.trait.ts'\nimport { presentTrait } from './present/present.trait.ts'\nimport { toastTrait } from './toast/toast.trait.ts'\nimport { virtualScrollTrait } from './virtual-scroll/virtual-scroll.trait.ts'\n\n// Effect\nimport { rippleTrait } from './ripple/ripple.trait.ts'\nimport { confettiTrait } from './confetti/confetti.trait.ts'\nimport { flipTrait } from './flip/flip.trait.ts'\nimport { parallaxTrait } from './parallax/parallax.trait.ts'\nimport { tossTrait } from './toss/toss.trait.ts'\nimport { magnetTrait } from './magnet/magnet.trait.ts'\nimport { noodleTrait } from './noodle/noodle.trait.ts'\nimport { cssInspectTrait } from './css-inspect/css-inspect.trait.ts'\nimport { snapResizeTrait } from './snap-resize/snap-resize.trait.ts'\n\n/** Register all 50 built-in traits. Call once at app startup. */\nexport function registerBuiltinTraits(): void {\n // Gesture\n registerTrait(dragTrait)\n registerTrait(pressHoldTrait)\n registerTrait(swipeTrait)\n registerTrait(sortTrait)\n registerTrait(resizeTrait)\n registerTrait(panZoomTrait)\n\n // State\n registerTrait(hoverTrait)\n registerTrait(toggleStateTrait)\n registerTrait(toggleSchemeTrait)\n registerTrait(copyTrait)\n registerTrait(clipboardTrait)\n registerTrait(shortcutTrait)\n registerTrait(searchTrait)\n registerTrait(dropZoneTrait)\n registerTrait(editTrait)\n registerTrait(intersectTrait)\n registerTrait(linkPasteTrait)\n registerTrait(linkedScrollTrait)\n registerTrait(mentionTrait)\n registerTrait(persistTrait)\n registerTrait(rangeSelectTrait)\n registerTrait(selectionTrait)\n registerTrait(slashCommandTrait)\n registerTrait(storeTrait)\n registerTrait(textTriggerTrait)\n registerTrait(backtickWrapTrait)\n registerTrait(validateTrait)\n\n // Focus\n registerTrait(trapFocusTrait)\n registerTrait(rovingFocusTrait)\n registerTrait(listNavigateTrait)\n\n // Present\n registerTrait(tooltipTrait)\n registerTrait(collapsibleTrait)\n registerTrait(popoverTrait)\n registerTrait(modalTrait)\n registerTrait(dismissTrait)\n registerTrait(autoDismissTrait)\n registerTrait(gatewayTrait)\n registerTrait(presentTrait)\n registerTrait(toastTrait)\n registerTrait(virtualScrollTrait)\n\n // Effect\n registerTrait(rippleTrait)\n registerTrait(confettiTrait)\n registerTrait(flipTrait)\n registerTrait(parallaxTrait)\n registerTrait(tossTrait)\n registerTrait(magnetTrait)\n registerTrait(noodleTrait)\n registerTrait(cssInspectTrait)\n registerTrait(snapResizeTrait)\n}\n\n// ── Trait CSS + TS modules ───────────────────────────────────\nimport './auto-dismiss/auto-dismiss.ts'\nimport './auto-dismiss/auto-dismiss.css'\nimport './backtick-wrap/backtick-wrap.ts'\nimport './backtick-wrap/backtick-wrap.css'\nimport './clipboard/clipboard.ts'\nimport './clipboard/clipboard.css'\nimport './collapsible/collapsible.ts'\nimport './collapsible/collapsible.css'\nimport './confetti/confetti.ts'\nimport './confetti/confetti.css'\nimport './copy/copy.ts'\nimport './copy/copy.css'\nimport './css-inspect/css-inspect.ts'\nimport './css-inspect/css-inspect.css'\nimport './dismiss/dismiss.ts'\nimport './dismiss/dismiss.css'\nimport './drag/drag.ts'\nimport './drag/drag.css'\nimport './drop-zone/drop-zone.ts'\nimport './drop-zone/drop-zone.css'\nimport './edit/edit.ts'\nimport './edit/edit.css'\nimport './flip/flip.ts'\nimport './flip/flip.css'\nimport './gateway/gateway.ts'\nimport './gateway/gateway.css'\nimport './hover/hover.ts'\nimport './hover/hover.css'\nimport './intersect/intersect.ts'\nimport './intersect/intersect.css'\nimport './link-paste/link-paste.ts'\nimport './link-paste/link-paste.css'\nimport './linked-scroll/linked-scroll.ts'\nimport './linked-scroll/linked-scroll.css'\nimport './list-navigate/list-navigate.ts'\nimport './list-navigate/list-navigate.css'\nimport './magnet/magnet.ts'\nimport './magnet/magnet.css'\nimport './mention/mention.ts'\nimport './mention/mention.css'\nimport './modal/modal.ts'\nimport './modal/modal.css'\nimport './noodle/noodle.ts'\nimport './noodle/noodle.css'\nimport './overlay/overlay.ts'\nimport './overlay/overlay.css'\nimport './pan-zoom/pan-zoom.ts'\nimport './pan-zoom/pan-zoom.css'\nimport './parallax/parallax.ts'\nimport './parallax/parallax.css'\nimport './persist/persist.ts'\nimport './persist/persist.css'\nimport './popover/popover.ts'\nimport './popover/popover.css'\nimport './present/present.ts'\nimport './present/present.css'\nimport './press-hold/press-hold.ts'\nimport './press-hold/press-hold.css'\nimport './range-select/range-select.ts'\nimport './range-select/range-select.css'\nimport './resize/resize.ts'\nimport './resize/resize.css'\nimport './ripple/ripple.ts'\nimport './ripple/ripple.css'\nimport './roving-focus/roving-focus.ts'\nimport './roving-focus/roving-focus.css'\nimport './search/search.ts'\nimport './search/search.css'\nimport './selection/selection.ts'\nimport './selection/selection.css'\nimport './shortcut/shortcut.ts'\nimport './shortcut/shortcut.css'\nimport './slash-command/slash-command.ts'\nimport './slash-command/slash-command.css'\nimport './snap-resize/snap-resize.ts'\nimport './snap-resize/snap-resize.css'\nimport './sort/sort.ts'\nimport './sort/sort.css'\nimport './store/store.ts'\nimport './store/store.css'\nimport './swipe/swipe.ts'\nimport './swipe/swipe.css'\nimport './text-trigger/text-trigger.ts'\nimport './text-trigger/text-trigger.css'\nimport './toast/toast.ts'\nimport './toast/toast.css'\nimport './toggle-scheme/toggle-scheme.ts'\nimport './toggle-scheme/toggle-scheme.css'\nimport './toggle-state/toggle-state.ts'\nimport './toggle-state/toggle-state.css'\nimport './tooltip/tooltip.ts'\nimport './tooltip/tooltip.css'\nimport './toss/toss.ts'\nimport './toss/toss.css'\nimport './trap-focus/trap-focus.ts'\nimport './trap-focus/trap-focus.css'\nimport './validate/validate.ts'\nimport './validate/validate.css'\nimport './virtual-scroll/virtual-scroll.ts'\nimport './virtual-scroll/virtual-scroll.css'\n"],"names":["dragTrait","ctx","selector","dropZoneSelector","zoneSelector","axis","mode","animate","ignore","modifier","isDragging","startX","startY","origX","origY","onDown","e","m","onMove","dx","dy","onUp","dragItem","ghost","placeholder","grabOffsetX","grabOffsetY","dragIndex","lastSlotIndex","sourceZone","currentZone","previewOriginParent","previewOriginNext","lastPreviewIndex","pointerId","getItems","el","getDropZones","getZones","getItemsInZone","zone","findZoneAt","x","y","nearest","minDist","r","cx","cy","dist","findInsertIndex","targets","px","py","closestIdx","closestDist","i","dir","a","b","mid","createGhost","rect","g","assignTransitionNames","items","clearTransitionNames","item","restorePreview","next","parent","doRestore","clearSlotAttributes","updateSlot","insertIndex","container","liveItems","ci","insertBefore","updatePreview","gx","gy","doMove","updateDropOver","zones","overZone","overIndex","cleanup","onLostCapture","onPointerMove","onPointerUp","onPointerCancel","onKeyDown","onHoverIn","target","onHoverOut","onPointerDown","pe","index","itemRect","z","zoneItems","dropTargets","toIndex","ke","pressHoldTrait","delay","timer","clear","swipeTrait","threshold","timeout","startTime","tracking","clearTimer","elapsed","absDx","absDy","distance","direction","velocity","onCancel","sortTrait","selectorRaw","handleSelector","detectGridGeometry","firstRect","cols","stepX","stepY","ghostToGridIndex","maxIndex","col","row","maxRow","cc","cr","child","handle","order","CURSORS","touchesX","touchesY","resizeTrait","handleEdges","s","minWidth","minHeight","resizing","activeEdge","startWidth","startHeight","startLeft","startTop","setFixedW","setFixedH","resetToHugW","resetToHugH","newWidth","newHeight","newLeft","newTop","w","h","syncOverlay","label","overlay","styleObserver","edge","resetW","resetH","editorChrome","rafId","lastRect","startPolling","poll","key","stopPolling","showOverlay","hideOverlay","HIT_MARGIN","overlayVisible","modifierHeld","onProximity","inZone","panZoomTrait","minZoom","maxZoom","zoomStep","panX","panY","scale","isPanning","spaceDown","startPanX","startPanY","apply","clampScale","v","onWheel","pointerX","pointerY","prevScale","delta","ratio","tag","onKeyUp","onDblClick","hoverTrait","leaveDelay","enterTimer","leaveTimer","activate","deactivate","onMouseEnter","onMouseLeave","toggleStateTrait","active","signal","handlePress","STORAGE_KEY","SCHEME_ICONS","systemScheme","nextScheme","current","list","preferred","idx","candidate","parseScheme","value","parseSchemes","loadStored","saveStored","scheme","applyToTarget","resolved","toggleSchemeTrait","persist","schemes","targetSelector","stored","mq","mqHandler","copyTrait","feedbackMs","originalLabel","restore","text","clipboardTrait","handlePaste","event","prevent","accept","clipboard","types","html","files","isAccepted","type","pattern","file","parseCombo","combo","parts","p","matchesCombo","shortcutTrait","keyCombo","global","parsed","onKeydown","searchTrait","attr","debounceMs","debounceTimer","currentQuery","sel","getTextOf","applyFilter","query","normalized","count","scheduleFilter","onSearchEvent","onInput","matchesMime","prefix","dataTransfer","patterns","dropZoneTrait","enterCount","onDragOver","de","onDragEnter","onDragLeave","_e","onDrop","editTrait","activationEvent","commitOn","editing","previousText","selectAll","range","startEdit","commitEdit","cancelEdit","onActivate","onBlur","intersectTrait","rootMargin","once","observer","entries","entry","visible","URL_REGEX","linkPasteTrait","match","url","linkedScrollTrait","syncing","syncScroll","source","dest","maxX","pct","destMaxX","maxY","destMaxY","onHostScroll","onTargetScroll","mentionTrait","trigger","minLength","mentionStart","getValue","host","getCursorPos","handleInput","cursor","beforeCursor","triggerIdx","handleSelect","detail","before","after","inserted","pos","persistTrait","raw","state","handleSave","rangeSelectTrait","lastClickedIndex","getSelectedIndices","acc","emitChange","selected","clearSelection","onClick","me","clickedIndex","start","end","selectionTrait","getSelectedValues","updateCount","onPress","pressedItem","wasSelected","all","slashCommandTrait","currentPartial","partial","handleKeydown","command","args","commandList","STAMPED","storeTrait","groupTag","getTarget","store","storeAttr","data","parseStoreAttr","createListStore","optionsAttr","parseOptionsAttr","stampItem","stampGroup","group","wrapper","clearStamped","stamped","stamp","frag","isGrouped","mutations","mutation","name","val","textTriggerTrait","patternStr","triggerChar","matched","regex","result","backtickWrapTrait","selectedText","selStart","selEnd","wrapped","newPos","validateTrait","valid","errorMessage","doValidate","required","minLenStr","maxLenStr","customMessage","msg","minLen","maxLen","isValid","internals","FOCUSABLE","trapFocusTrait","getFocusable","first","last","DEFAULT_SELECTOR","rovingFocusTrait","orientation","wrap","setActive","isForward","isBackward","listNavigateTrait","typeahead","currentIndex","typeBuffer","typeTimer","setHighlight","supportsAnchor","tooltipTrait","position","tooltip","GAP","positionWithJS","tip","hostRect","tipRect","top","left","show","anchorName","hide","collapsibleTrait","duration","collapsed","applyCollapsed","toggle","onEnd","anchorCounter","createOverlayTrait","modal","closable","anchorSelector","placement","popoverType","matchWidth","animation","open","previouslyFocused","inertSiblings","anchorEl","clearAnchor","anchor","trapFocus","sibling","releaseFocus","prev","restoreFocus","markAnchor","isOpen","onOpen","onClose","onDismiss","onToggle","te","onBackdropClick","popoverTrait","modalTrait","dismissTrait","escapeEnabled","outsideEnabled","eventName","onPointerdown","autoDismissTrait","remaining","tick","pause","resume","gatewayTrait","targetEl","presentTrait","transition","pending","clearPending","onShow","onHide","POSITION_STYLES","getStackOffset","_position","toasts","offset","toast","toastTrait","stack","posStyles","prop","base","dismissTimeout","dismiss","onTransitionEnd","virtualScrollTrait","itemHeight","overscan","total","spacer","update","scrollTop","viewportHeight","rawStart","rawEnd","children","childIndex","rippleTrait","size","onAnimationEnd","COLORS","confettiTrait","spread","gravity","containers","fire","originX","originY","particles","spreadRad","baseAngle","color","isCircle","angle","fadeStart","step","now","c","flipTrait","flipped","parallaxTrait","speed","isVertical","ticking","viewportSize","onScroll","tossTrait","friction","bounce","max","samples","frameId","dt","vx","vy","displacement","magnetTrait","strength","tilt","onMouseMove","centerX","centerY","SVG_NS","noodleTrait","width","curvature","svg","path","updatePath","targetRect","x1","y1","x2","y2","cp1x","cp1y","cp2x","cp2y","requestUpdate","ro","CSSInspectController","#attached","#active","#altHeld","#pointerInside","#pointerDownActivated","#hoveredChild","#selectedChild","#explodedElements","#activationId","#depthMultiplier","#baseZ","#clone","#popover","#inspectTarget","#hlPopover","#hlReady","#hlHover","options","#onPointerEnter","#onPointerLeave","#onHoverMove","#onPointerDown","#onClick","#onAltDown","#onAltUp","#deactivate","#clearHover","#teardownHighlights","#activate","#setReady","#onDocTilt","clone","nx","tiltX","tiltY","bz","root","hoverTarget","#closestChildOf","#ensureHighlights","#showBox","#labelText","walk","#select","#onWheel","#updateDepths","#onDocClick","#onDocKeydown","#onDocSelectStart","#onDocPointerDown","on","#hideBox","pop","#makeBox","box","labelText","#domDepthFrom","#clearSelection","id","cls","#createLabel","depth","node","#collectElements","elements","walker","popover","cssInspectTrait","controller","snapResizeTrait","grid","modifierDown","snapValue","onResize","snapped","registerBuiltinTraits","registerTrait"],"mappings":";;;AA+BO,MAAMA,KAA6B;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EAET,UAAU;AAAA,IACR,UAA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