@primereact/core 11.0.0-rc.1 → 11.0.0-rc.3

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.
Files changed (121) hide show
  1. package/api/{index.d.mts → FilterMatchMode.d.ts} +2 -10
  2. package/api/FilterOperator.d.ts +5 -0
  3. package/api/index.d.ts +2 -0
  4. package/api/index.mjs +0 -1
  5. package/base/index.d.ts +1 -0
  6. package/base/index.mjs +1 -2
  7. package/base/{index.d.mts → useBase.d.ts} +2 -5
  8. package/component/Component.d.ts +11 -0
  9. package/component/Component.props.d.ts +3 -0
  10. package/component/Component.utils.d.ts +12 -0
  11. package/component/index.d.ts +4 -0
  12. package/component/index.mjs +1 -2
  13. package/component/useComponent.d.ts +30 -0
  14. package/component/useComponentPT.d.ts +9 -0
  15. package/component/useComponentStyle.d.ts +10 -0
  16. package/component/useComponentStyleHandler.d.ts +51 -0
  17. package/component/withComponent.d.ts +24 -0
  18. package/config/PrimeReact.context.d.ts +4 -0
  19. package/config/PrimeReact.props.d.ts +2 -0
  20. package/config/index.d.ts +3 -0
  21. package/config/index.mjs +3 -2
  22. package/config/usePrimeReact.d.ts +6 -0
  23. package/dnd/announcements.d.ts +5 -0
  24. package/dnd/collision.d.ts +39 -0
  25. package/dnd/createDnd.d.ts +15 -0
  26. package/dnd/index.d.ts +3 -0
  27. package/dnd/index.mjs +1 -2
  28. package/dnd/sortable.d.ts +56 -0
  29. package/dnd/utils.d.ts +21 -0
  30. package/headless/index.d.ts +2 -0
  31. package/headless/index.mjs +0 -1
  32. package/headless/useHeadless.d.ts +9 -0
  33. package/headless/withHeadless.d.ts +15 -0
  34. package/icon/Icon.d.ts +4 -0
  35. package/icon/Icon.props.d.ts +2 -0
  36. package/icon/Icon.style.d.ts +2 -0
  37. package/icon/index.d.ts +5 -0
  38. package/icon/index.mjs +3 -2
  39. package/icon/useIcon.d.ts +6 -0
  40. package/icon/withIcon.d.ts +24 -0
  41. package/{index.d.mts → index.d.ts} +1 -0
  42. package/index.mjs +0 -1
  43. package/license/index.d.ts +1 -0
  44. package/license/index.mjs +1 -2
  45. package/license/{index.d.mts → licensebanner.d.ts} +1 -3
  46. package/locale/Locale.context.d.ts +4 -0
  47. package/locale/Locale.props.d.ts +2 -0
  48. package/locale/defaultLocale.d.ts +125 -0
  49. package/locale/index.d.ts +5 -0
  50. package/locale/index.mjs +3 -2
  51. package/locale/useLocale.d.ts +6 -0
  52. package/motion/Motion.context.d.ts +5 -0
  53. package/motion/Motion.d.ts +4 -0
  54. package/motion/Motion.props.d.ts +2 -0
  55. package/motion/Motion.utils.d.ts +4 -0
  56. package/motion/index.d.ts +5 -0
  57. package/motion/index.mjs +3 -2
  58. package/motion/useMotion.d.ts +23 -0
  59. package/motion/useMotion.props.d.ts +2 -0
  60. package/overlay-manager/{index.d.mts → OverlayManager.d.ts} +7 -10
  61. package/overlay-manager/index.d.ts +1 -0
  62. package/overlay-manager/index.mjs +1 -2
  63. package/package.json +14 -11
  64. package/passthrough/PassThrough.context.d.ts +4 -0
  65. package/passthrough/PassThrough.props.d.ts +2 -0
  66. package/passthrough/index.d.ts +3 -0
  67. package/passthrough/index.mjs +2 -1
  68. package/passthrough/usePassThrough.d.ts +1 -0
  69. package/stylesheet/PrimeReactStyleSheet.d.ts +7 -0
  70. package/stylesheet/index.d.ts +1 -0
  71. package/stylesheet/index.mjs +1 -2
  72. package/theme/Theme.context.d.ts +4 -0
  73. package/theme/Theme.props.d.ts +2 -0
  74. package/theme/index.d.ts +3 -0
  75. package/theme/index.mjs +3 -2
  76. package/theme/useTheme.d.ts +1 -0
  77. package/umd/index.js +5 -4
  78. package/use-style/index.d.ts +2 -0
  79. package/use-style/index.mjs +1 -2
  80. package/use-style/useStyle.d.ts +2 -0
  81. package/use-style/useStyle.props.d.ts +1 -0
  82. package/utils/ConnectedOverlayScrollHandler.d.ts +10 -0
  83. package/utils/combinedRefs.d.ts +2 -0
  84. package/utils/createContext.d.ts +9 -0
  85. package/utils/env.d.ts +1 -0
  86. package/utils/index.d.ts +10 -0
  87. package/utils/index.mjs +3 -2
  88. package/utils/mergeRefs.d.ts +11 -0
  89. package/utils/overlayEventBus.d.ts +9 -0
  90. package/utils/stylePreloadRegistry.d.ts +33 -0
  91. package/utils/styleRegistry.d.ts +19 -0
  92. package/api/index.mjs.map +0 -1
  93. package/base/index.mjs.map +0 -1
  94. package/component/index.d.mts +0 -71
  95. package/component/index.mjs.map +0 -1
  96. package/config/index.d.mts +0 -17
  97. package/config/index.mjs.map +0 -1
  98. package/dnd/index.d.mts +0 -69
  99. package/dnd/index.mjs.map +0 -1
  100. package/headless/index.d.mts +0 -28
  101. package/headless/index.mjs.map +0 -1
  102. package/icon/index.d.mts +0 -40
  103. package/icon/index.mjs.map +0 -1
  104. package/index.mjs.map +0 -1
  105. package/license/index.mjs.map +0 -1
  106. package/locale/index.d.mts +0 -12
  107. package/locale/index.mjs.map +0 -1
  108. package/motion/index.d.mts +0 -42
  109. package/motion/index.mjs.map +0 -1
  110. package/overlay-manager/index.mjs.map +0 -1
  111. package/passthrough/index.d.mts +0 -12
  112. package/passthrough/index.mjs.map +0 -1
  113. package/stylesheet/index.d.mts +0 -10
  114. package/stylesheet/index.mjs.map +0 -1
  115. package/theme/index.d.mts +0 -12
  116. package/theme/index.mjs.map +0 -1
  117. package/umd/index.js.map +0 -1
  118. package/use-style/index.d.mts +0 -7
  119. package/use-style/index.mjs.map +0 -1
  120. package/utils/index.d.mts +0 -104
  121. package/utils/index.mjs.map +0 -1
package/dnd/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/dnd/announcements.ts","../../src/dnd/utils.ts","../../src/dnd/collision.ts","../../src/dnd/sortable.ts","../../src/dnd/createDnd.ts"],"sourcesContent":["/**\n * Default screen reader announcements for DnD operations.\n */\nimport type { DndAnnouncements, DragData } from '@primereact/types/primitive/dnd';\n\nexport const DEFAULT_ANNOUNCEMENTS: DndAnnouncements = {\n onDragStart: (e) => `Picked up ${(e.active.data as DragData)?.label ?? 'item'}. Use Arrow keys to move, Space or Enter to drop, Escape to cancel.`,\n\n onDragOver: (e) => (e.over ? `Over ${(e.over.data as DragData)?.label ?? 'drop zone'}.` : 'Not over a drop zone.'),\n\n onDragEnd: (e) => {\n if (e.cancelled) return `Drag cancelled. Item returned to original position.`;\n\n if (e.over) return `Dropped on ${(e.over.data as DragData)?.label ?? 'drop zone'}.`;\n\n return 'Dropped.';\n },\n\n onDragCancel: () => 'Drag cancelled. Item returned to original position.',\n\n onSortOver: (info) => `Moved to position ${info.index + 1} of ${info.total}${info.containerId ? ` in ${String(info.containerId)}` : ''}.`\n};\n","/**\n * SSR & DOM utility functions for createDnd.\n * Pure, stateless helpers — no side effects at module level.\n */\nimport type { Point, Rect } from '@primereact/types/primitive/dnd';\n\n// ── SSR Guard ───────────────────────────────────────────────────\n\nexport function isClient(): boolean {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n// ── Rect Helpers ────────────────────────────────────────────────\n\nexport function getElementRect(el: HTMLElement): Rect {\n const r = el.getBoundingClientRect();\n\n return { x: r.x, y: r.y, width: r.width, height: r.height, top: r.top, right: r.right, bottom: r.bottom, left: r.left };\n}\n\nexport function createRect(x: number, y: number, width: number, height: number): Rect {\n return { x, y, width, height, top: y, right: x + width, bottom: y + height, left: x };\n}\n\nexport function adjustRect(rect: Rect, scrollDelta: Point): Rect {\n return createRect(rect.x - scrollDelta.x, rect.y - scrollDelta.y, rect.width, rect.height);\n}\n\n// ── Geometry ────────────────────────────────────────────────────\n\nexport function distanceBetween(a: Point, b: Point): number {\n return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);\n}\n\nexport function rectCenter(rect: Rect): Point {\n return { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 };\n}\n\nexport function isPointInRect(point: Point, rect: Rect): boolean {\n return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;\n}\n\nexport function rectArea(rect: Rect): number {\n return rect.width * rect.height;\n}\n\nexport function intersectionArea(a: Rect, b: Rect): number {\n const x = Math.max(a.left, b.left);\n const y = Math.max(a.top, b.top);\n const w = Math.min(a.right, b.right) - x;\n const h = Math.min(a.bottom, b.bottom) - y;\n\n return w > 0 && h > 0 ? w * h : 0;\n}\n\n// ── Scroll Helpers ──────────────────────────────────────────────\n\nexport function findScrollableAncestor(element: HTMLElement): HTMLElement | null {\n if (!isClient()) return null;\n\n let current = element.parentElement;\n\n while (current && current !== document.documentElement) {\n const style = getComputedStyle(current);\n const scrollableY = (style.overflowY === 'auto' || style.overflowY === 'scroll') && current.scrollHeight > current.clientHeight;\n const scrollableX = (style.overflowX === 'auto' || style.overflowX === 'scroll') && current.scrollWidth > current.clientWidth;\n\n if (scrollableY || scrollableX) return current;\n\n current = current.parentElement;\n }\n\n if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {\n return document.documentElement;\n }\n\n return null;\n}\n\nexport function getScrollPosition(el: HTMLElement): Point {\n if (el === document.documentElement) {\n return { x: window.scrollX, y: window.scrollY };\n }\n\n return { x: el.scrollLeft, y: el.scrollTop };\n}\n\nexport function scrollElement(el: HTMLElement, left: number, top: number): void {\n if (el === document.documentElement) {\n window.scrollBy(left, top);\n } else {\n el.scrollBy(left, top);\n }\n}\n\n// ── Timing ──────────────────────────────────────────────────────\n\nexport function debounce(fn: () => void, ms: number): { call: () => void; cancel: () => void } {\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n return {\n call() {\n if (timer !== null) clearTimeout(timer);\n\n timer = setTimeout(() => {\n timer = null;\n fn();\n }, ms);\n },\n cancel() {\n if (timer !== null) {\n clearTimeout(timer);\n timer = null;\n }\n }\n };\n}\n","/**\n * Collision detection strategies for createDnd.\n */\nimport type { CollisionResult, DragData, Point, Rect, UniqueId } from '@primereact/types/primitive/dnd';\nimport { distanceBetween, intersectionArea, isPointInRect, rectArea, rectCenter } from './utils';\n\n// ── Collision Input ─────────────────────────────────────────────\n\nexport interface CollisionInput {\n position: Point;\n activeRect: Rect | null;\n droppables: Array<{ id: UniqueId; rect: Rect; data: DragData; disabled?: boolean }>;\n}\n\n// ── Strategies ──────────────────────────────────────────────────\n\n/**\n * Returns droppables whose rect contains the pointer.\n * Smallest (innermost) droppable wins for nested scenarios.\n */\nfunction pointerWithin(input: CollisionInput): CollisionResult[] {\n const results: CollisionResult[] = [];\n\n for (const d of input.droppables) {\n if (d.disabled) continue;\n\n if (isPointInRect(input.position, d.rect)) {\n const area = rectArea(d.rect);\n\n // Skip zero-area droppables; use inverted area so smallest (innermost) wins\n if (area > 0) {\n results.push({ id: d.id, data: d.data, ratio: 1 / area });\n }\n }\n }\n\n results.sort((a, b) => (b.ratio ?? 0) - (a.ratio ?? 0));\n\n return results;\n}\n\n/**\n * Returns droppables overlapping the active drag rect, sorted by overlap %.\n */\nfunction rectIntersection(input: CollisionInput): CollisionResult[] {\n if (!input.activeRect) return [];\n\n const results: CollisionResult[] = [];\n\n for (const d of input.droppables) {\n if (d.disabled) continue;\n\n const area = intersectionArea(input.activeRect, d.rect);\n\n if (area > 0) {\n const dropArea = rectArea(d.rect);\n\n results.push({ id: d.id, data: d.data, ratio: dropArea > 0 ? area / dropArea : 0 });\n }\n }\n\n results.sort((a, b) => (b.ratio ?? 0) - (a.ratio ?? 0));\n\n return results;\n}\n\n/**\n * Returns droppables sorted by center-to-center distance (closest first).\n */\nfunction closestCenter(input: CollisionInput): CollisionResult[] {\n if (!input.activeRect) return [];\n\n const ac = rectCenter(input.activeRect);\n const results: CollisionResult[] = [];\n\n for (const d of input.droppables) {\n if (d.disabled) continue;\n\n results.push({ id: d.id, data: d.data, distance: distanceBetween(ac, rectCenter(d.rect)) });\n }\n\n results.sort((a, b) => (a.distance ?? Infinity) - (b.distance ?? Infinity));\n\n return results;\n}\n\n/**\n * Returns droppables sorted by average corner-to-corner distance (closest first).\n */\nfunction closestCorners(input: CollisionInput): CollisionResult[] {\n if (!input.activeRect) return [];\n\n const ar = input.activeRect;\n const aCorners: Point[] = [\n { x: ar.left, y: ar.top },\n { x: ar.right, y: ar.top },\n { x: ar.left, y: ar.bottom },\n { x: ar.right, y: ar.bottom }\n ];\n const results: CollisionResult[] = [];\n\n for (const d of input.droppables) {\n if (d.disabled) continue;\n\n const dr = d.rect;\n const dCorners: Point[] = [\n { x: dr.left, y: dr.top },\n { x: dr.right, y: dr.top },\n { x: dr.left, y: dr.bottom },\n { x: dr.right, y: dr.bottom }\n ];\n\n let total = 0;\n\n for (let i = 0; i < 4; i++) total += distanceBetween(aCorners[i], dCorners[i]);\n\n results.push({ id: d.id, data: d.data, distance: total / 4 });\n }\n\n results.sort((a, b) => (a.distance ?? Infinity) - (b.distance ?? Infinity));\n\n return results;\n}\n\n/** All built-in collision strategies. */\nexport const collisionStrategies = { pointerWithin, rectIntersection, closestCenter, closestCorners } as const;\n","/**\n * Sortable collision detection and transform computation for createDnd.\n */\nimport type { DropPosition, Point, Rect, SortDirection, Transform, UniqueId } from '@primereact/types/primitive/dnd';\nimport { distanceBetween, rectCenter } from './utils';\n\n// ── Constants ───────────────────────────────────────────────────\n\n/** Fraction of item height/width for the 'before'/'after' edge zones. Middle = 'inside'. */\nconst EDGE_ZONE_RATIO = 0.25;\n\n// ── Sortable Item-Level Collision ───────────────────────────────\n\nexport interface SortableCollisionInput {\n position: Point;\n items: Array<{ id: UniqueId; rect: Rect }>;\n direction: SortDirection;\n activeId: UniqueId;\n /** When true, the middle zone returns 'inside' (for Tree-like nested drops). */\n allowInsideDrop?: boolean;\n}\n\nexport interface SortableCollisionResult {\n index: number;\n position: 'before' | 'after';\n /** Drop indicator info for visual feedback. */\n targetId: UniqueId | null;\n /** Three-zone position: 'before' | 'after' | 'inside'. Only 'inside' when allowInsideDrop is true. */\n dropPosition: DropPosition;\n /** Rect of the closest target item. */\n targetRect: Rect | null;\n}\n\nexport function sortableCollision(input: SortableCollisionInput): SortableCollisionResult {\n const { position, items, direction, activeId, allowInsideDrop = false } = input;\n const emptyResult: SortableCollisionResult = { index: 0, position: 'before', targetId: null, dropPosition: 'before', targetRect: null };\n\n if (items.length === 0) return emptyResult;\n\n const candidates = items.filter((item) => item.id !== activeId);\n\n if (candidates.length === 0) return emptyResult;\n\n let closestIdx = 0;\n let closestDist = Infinity;\n\n for (let i = 0; i < candidates.length; i++) {\n const center = rectCenter(candidates[i].rect);\n const dist = direction === 'horizontal' ? Math.abs(position.x - center.x) : direction === 'vertical' ? Math.abs(position.y - center.y) : distanceBetween(position, center);\n\n if (dist < closestDist) {\n closestDist = dist;\n closestIdx = i;\n }\n }\n\n const closest = candidates[closestIdx];\n const closestRect = closest.rect;\n const cc = rectCenter(closestRect);\n\n // ── Two-zone position (for sortable index computation) ──────\n let pos: 'before' | 'after';\n\n if (direction === 'horizontal') {\n pos = position.x < cc.x ? 'before' : 'after';\n } else if (direction === 'vertical') {\n pos = position.y < cc.y ? 'before' : 'after';\n } else {\n pos = position.y < cc.y ? 'before' : position.y > cc.y ? 'after' : position.x < cc.x ? 'before' : 'after';\n }\n\n // ── Three-zone drop position (for drop indicator rendering) ─\n let dropPosition: DropPosition;\n\n if (allowInsideDrop) {\n dropPosition = computeDropZone(position, closestRect, direction);\n } else {\n dropPosition = pos;\n }\n\n const originalIdx = items.findIndex((item) => item.id === closest.id);\n\n return {\n index: pos === 'after' ? originalIdx + 1 : originalIdx,\n position: pos,\n targetId: closest.id,\n dropPosition,\n targetRect: closestRect\n };\n}\n\n/**\n * Splits a rect into 3 zones: top/left edge → 'before', middle → 'inside', bottom/right edge → 'after'.\n */\nfunction computeDropZone(pointer: Point, rect: Rect, direction: SortDirection): DropPosition {\n if (direction === 'horizontal') {\n const edgeSize = rect.width * EDGE_ZONE_RATIO;\n\n if (pointer.x < rect.left + edgeSize) return 'before';\n\n if (pointer.x > rect.right - edgeSize) return 'after';\n\n return 'inside';\n }\n\n // Vertical and grid both use Y axis for zone detection\n const edgeSize = rect.height * EDGE_ZONE_RATIO;\n\n if (pointer.y < rect.top + edgeSize) return 'before';\n\n if (pointer.y > rect.bottom - edgeSize) return 'after';\n\n return 'inside';\n}\n\n// ── Transform Engine ────────────────────────────────────────────\n\nexport interface ComputeTransformsInput {\n items: UniqueId[];\n activeId: UniqueId;\n originalIndex: number;\n projectedIndex: number;\n activeRect: Rect | null;\n itemRects: Map<UniqueId, Rect>;\n direction: SortDirection;\n}\n\nexport function computeShiftTransforms(input: ComputeTransformsInput): Map<UniqueId, Transform> {\n const { items, activeId, originalIndex, projectedIndex, activeRect, itemRects, direction } = input;\n const transforms = new Map<UniqueId, Transform>();\n\n if (!activeRect || originalIndex === projectedIndex) return transforms;\n\n const movingForward = projectedIndex > originalIndex;\n\n if (direction === 'grid') {\n // Grid: per-item rect-based shifts for accurate row wrapping\n for (let i = 0; i < items.length; i++) {\n const itemId = items[i];\n\n if (itemId === activeId) continue;\n\n const inRange = movingForward ? i > originalIndex && i <= projectedIndex : i >= projectedIndex && i < originalIndex;\n\n if (!inRange) continue;\n\n let neighborIdx = movingForward ? i - 1 : i + 1;\n\n // Skip over the active item when finding the neighbor\n if (items[neighborIdx] === activeId) {\n neighborIdx = movingForward ? neighborIdx - 1 : neighborIdx + 1;\n }\n\n const neighborId = items[neighborIdx];\n const currentRect = itemRects.get(itemId);\n const neighborRect = neighborId ? itemRects.get(neighborId) : null;\n\n if (currentRect && neighborRect) {\n transforms.set(itemId, {\n x: neighborRect.x - currentRect.x,\n y: neighborRect.y - currentRect.y,\n scaleX: 1,\n scaleY: 1\n });\n }\n }\n } else {\n // Vertical / Horizontal: uniform shift by active item dimensions\n const shiftX = direction === 'horizontal' ? activeRect.width : 0;\n const shiftY = direction === 'vertical' ? activeRect.height : 0;\n\n for (let i = 0; i < items.length; i++) {\n const itemId = items[i];\n\n if (itemId === activeId) continue;\n\n let tx = 0;\n let ty = 0;\n\n if (movingForward) {\n if (i > originalIndex && i <= projectedIndex) {\n tx = -shiftX;\n ty = -shiftY;\n }\n } else {\n if (i >= projectedIndex && i < originalIndex) {\n tx = shiftX;\n ty = shiftY;\n }\n }\n\n if (tx !== 0 || ty !== 0) {\n transforms.set(itemId, { x: tx, y: ty, scaleX: 1, scaleY: 1 });\n }\n }\n }\n\n return transforms;\n}\n\nexport function computeCrossContainerTransforms(input: {\n sourceItems: UniqueId[];\n targetItems: UniqueId[];\n activeId: UniqueId;\n originalIndex: number;\n projectedIndex: number;\n activeRect: Rect | null;\n sourceDirection: SortDirection;\n targetDirection: SortDirection;\n}): { sourceTransforms: Map<UniqueId, Transform>; targetTransforms: Map<UniqueId, Transform> } {\n const { sourceItems, targetItems, activeId, originalIndex, projectedIndex, activeRect, sourceDirection, targetDirection } = input;\n const sourceTransforms = new Map<UniqueId, Transform>();\n const targetTransforms = new Map<UniqueId, Transform>();\n\n if (!activeRect) return { sourceTransforms, targetTransforms };\n\n // Source: items after originalIndex shift backward (filling gap)\n // For grid layouts, uniform shift is insufficient (items reflow), so default to vertical shift\n const srcShiftX = sourceDirection === 'horizontal' ? activeRect.width : 0;\n const srcShiftY = sourceDirection === 'vertical' || sourceDirection === 'grid' ? activeRect.height : 0;\n\n for (let i = 0; i < sourceItems.length; i++) {\n if (sourceItems[i] === activeId) continue;\n\n if (i > originalIndex) {\n sourceTransforms.set(sourceItems[i], { x: -srcShiftX, y: -srcShiftY, scaleX: 1, scaleY: 1 });\n }\n }\n\n // Target: items at and after projectedIndex shift forward (making space)\n const tgtShiftX = targetDirection === 'horizontal' ? activeRect.width : 0;\n const tgtShiftY = targetDirection === 'vertical' || targetDirection === 'grid' ? activeRect.height : 0;\n\n for (let i = 0; i < targetItems.length; i++) {\n if (i >= projectedIndex) {\n targetTransforms.set(targetItems[i], { x: tgtShiftX, y: tgtShiftY, scaleX: 1, scaleY: 1 });\n }\n }\n\n return { sourceTransforms, targetTransforms };\n}\n\n// ── Array Utilities ─────────────────────────────────────────────\n\n/** Immutably moves an item within an array. Returns original array if indices are out of bounds. */\nexport function arrayMove<T>(arr: readonly T[], fromIndex: number, toIndex: number): T[] {\n if (fromIndex < 0 || fromIndex >= arr.length || toIndex < 0 || toIndex > arr.length) {\n return arr.slice();\n }\n\n const result = arr.slice();\n const [item] = result.splice(fromIndex, 1);\n\n result.splice(toIndex, 0, item);\n\n return result;\n}\n\n/** Immutably transfers an item between two arrays. Returns originals if indices are out of bounds. */\nexport function arrayTransfer<T>(source: readonly T[], target: readonly T[], fromIndex: number, toIndex: number): { source: T[]; target: T[] } {\n if (fromIndex < 0 || fromIndex >= source.length || toIndex < 0 || toIndex > target.length) {\n return { source: source.slice(), target: target.slice() };\n }\n\n const newSource = source.slice();\n const [item] = newSource.splice(fromIndex, 1);\n const newTarget = target.slice();\n\n newTarget.splice(toIndex, 0, item);\n\n return { source: newSource, target: newTarget };\n}\n","/**\n * createDnd — Framework-Agnostic Drag & Drop Core\n *\n * Pure JavaScript implementation following the createMotion pattern.\n * Can be wrapped by React, Angular, Vue, Lit, Svelte, Solid etc.\n *\n * - SSR-safe: No DOM access at module level or during creation.\n * - Zero memory leaks: destroy() cleans every listener, timer, observer.\n * - Cross-browser: Uses only standard, well-supported APIs.\n * - Performance: RAF-throttled pointer, zero-reflow scroll pattern, rect caching.\n */\nimport type {\n AutoScrollOptions,\n CollisionResult,\n CollisionStrategy,\n CreateDndOptions,\n DndAnnouncements,\n DndEventMap,\n DndInstance,\n DndState,\n DragData,\n DraggableRegistration,\n DroppableRegistration,\n KeyboardSensorOptions,\n Point,\n PointerSensorOptions,\n Rect,\n SortableContainerRegistration,\n SortableOperationState,\n Transform,\n UniqueId\n} from '@primereact/types/primitive/dnd';\nimport { DEFAULT_ANNOUNCEMENTS } from './announcements';\nimport { type CollisionInput, collisionStrategies } from './collision';\nimport { computeCrossContainerTransforms, computeShiftTransforms, sortableCollision } from './sortable';\nimport { adjustRect, createRect, debounce, distanceBetween, findScrollableAncestor, getElementRect, getScrollPosition, isClient, isPointInRect, rectCenter, scrollElement } from './utils';\n\n// Re-export public utilities\nexport { collisionStrategies } from './collision';\nexport { arrayMove, arrayTransfer } from './sortable';\n\n// ────────────────────────────────────────────────────────────────\n// INTERNAL TYPE\n// ────────────────────────────────────────────────────────────────\n\ntype DndEventHandler<K extends keyof DndEventMap> = (event: DndEventMap[K]) => void;\n\n// ────────────────────────────────────────────────────────────────\n// CREATE DND — MAIN FACTORY\n// ────────────────────────────────────────────────────────────────\n\nexport function createDnd(options?: CreateDndOptions): DndInstance {\n // ── Destroyed Guard ────────────────────────────────────────\n\n let destroyed = false;\n\n function assertAlive(): void {\n if (destroyed) {\n throw new Error('createDnd: instance has been destroyed.');\n }\n }\n\n // ── State ──────────────────────────────────────────────────\n\n let state: DndState = {\n operation: null,\n draggables: new Map(),\n droppables: new Map(),\n sortableContainers: new Map(),\n collisions: [],\n sortable: null\n };\n\n // ── Subscribers (for useSyncExternalStore) ─────────────────\n\n const subscribers = new Set<() => void>();\n let isNotifying = false;\n\n function notify(): void {\n if (isNotifying) return;\n\n isNotifying = true;\n\n try {\n for (const fn of subscribers) fn();\n } finally {\n isNotifying = false;\n }\n }\n\n /**\n * Immutable state update. Creates a new state reference so that\n * useSyncExternalStore detects the change.\n */\n function setState(updater: (prev: DndState) => DndState): void {\n const next = updater(state);\n\n if (next !== state) {\n state = next;\n notify();\n }\n }\n\n // ── Event Emitters (lifecycle events) ──────────────────────\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const eventHandlers = new Map<string, Set<(event: any) => void>>();\n\n function emit<K extends keyof DndEventMap>(name: K, data: DndEventMap[K]): void {\n const handlers = eventHandlers.get(name);\n\n if (handlers) {\n for (const fn of handlers) fn(data);\n }\n }\n\n // ── Collision Strategy ─────────────────────────────────────\n\n let activeStrategy: CollisionStrategy = options?.collisionDetection ?? 'pointerWithin';\n\n function getCollisionFn(): (input: CollisionInput) => CollisionResult[] {\n return collisionStrategies[activeStrategy] ?? collisionStrategies.pointerWithin;\n }\n\n // ── Auto-Scroll Config ─────────────────────────────────────\n\n let scrollableEl: HTMLElement | null = null;\n const autoScrollEnabled = options?.autoScroll !== false;\n const autoScrollOpts: AutoScrollOptions = typeof options?.autoScroll === 'object' ? options.autoScroll : {};\n let autoScrollRAF: number | null = null;\n let accumulatedScrollDelta: Point = { x: 0, y: 0 };\n\n // ── Announcements ──────────────────────────────────────────\n\n const announcements: DndAnnouncements = { ...DEFAULT_ANNOUNCEMENTS, ...options?.announcements };\n\n // ── Rect Cache ─────────────────────────────────────────────\n\n const baseRects = new Map<UniqueId, Rect>();\n\n function measureAllRects(): void {\n if (!isClient()) return;\n\n baseRects.clear();\n\n for (const [id, reg] of state.draggables) {\n if (reg.node) baseRects.set(id, getElementRect(reg.node));\n }\n\n for (const [id, reg] of state.droppables) {\n if (reg.node) baseRects.set(id, getElementRect(reg.node));\n }\n\n for (const [id, reg] of state.sortableContainers) {\n if (reg.node) baseRects.set(id, getElementRect(reg.node));\n }\n }\n\n function getAdjustedRectImpl(id: UniqueId, scrollDelta: Point): Rect | null {\n const base = baseRects.get(id);\n\n return base ? adjustRect(base, scrollDelta) : null;\n }\n\n function remeasureRects(): void {\n if (!state.operation) return;\n\n measureAllRects();\n accumulatedScrollDelta = { x: 0, y: 0 };\n runCollisionDetection(state.operation.current);\n }\n\n const debouncedRemeasure = debounce(remeasureRects, 50);\n const debouncedWindowResize = debounce(remeasureRects, 100);\n\n // ── Observers ──────────────────────────────────────────────\n\n let resizeObs: ResizeObserver | null = null;\n let mutationObs: MutationObserver | null = null;\n let scrollCleanup: (() => void) | null = null;\n let windowResizeCleanup: (() => void) | null = null;\n\n function setupResizeObserver(): void {\n if (!isClient() || typeof ResizeObserver === 'undefined') return;\n\n resizeObs = new ResizeObserver(() => debouncedRemeasure.call());\n\n for (const [, reg] of state.sortableContainers) {\n if (reg.node) resizeObs.observe(reg.node);\n }\n }\n\n function setupWindowResize(): void {\n if (!isClient()) return;\n\n const handler = () => debouncedWindowResize.call();\n\n window.addEventListener('resize', handler, { passive: true });\n\n windowResizeCleanup = () => {\n window.removeEventListener('resize', handler);\n debouncedWindowResize.cancel();\n };\n }\n\n /** Observers that live only during an active drag. */\n function setupDragObservers(): void {\n if (!isClient()) return;\n\n // MutationObserver on active containers (childList changes)\n if (typeof MutationObserver !== 'undefined') {\n mutationObs = new MutationObserver(() => debouncedRemeasure.call());\n\n for (const [, reg] of state.sortableContainers) {\n if (reg.node) mutationObs.observe(reg.node, { childList: true });\n }\n }\n\n // Scroll listener (manual scroll detection, separate from auto-scroll)\n const target = scrollableEl ?? window;\n const handler = () => debouncedRemeasure.call();\n\n target.addEventListener('scroll', handler, { passive: true });\n scrollCleanup = () => target.removeEventListener('scroll', handler);\n }\n\n function teardownDragObservers(): void {\n mutationObs?.disconnect();\n mutationObs = null;\n scrollCleanup?.();\n scrollCleanup = null;\n debouncedRemeasure.cancel();\n }\n\n // ── Collision Detection ────────────────────────────────────\n\n function buildDroppableList(scrollDelta: Point): CollisionInput['droppables'] {\n const list: CollisionInput['droppables'] = [];\n const op = state.operation;\n\n if (!op) return list;\n\n const activeReg = state.draggables.get(op.activeId);\n\n // Regular droppables\n for (const [id, reg] of state.droppables) {\n if (reg.disabled) continue;\n\n const rect = getAdjustedRectImpl(id, scrollDelta);\n\n if (!rect) continue;\n\n const scopeMatch = !reg.accept || (activeReg?.scope != null && reg.accept.includes(activeReg.scope));\n const canDrop = reg.canDrop ? reg.canDrop(op.data) : true;\n\n if (scopeMatch && canDrop) {\n list.push({ id, rect, data: reg.data ?? {}, disabled: false });\n }\n }\n\n // Sortable containers also act as droppables\n for (const [id, reg] of state.sortableContainers) {\n if (reg.disabled) continue;\n\n const rect = getAdjustedRectImpl(id, scrollDelta);\n\n if (!rect) continue;\n\n const scopeMatch = !reg.accept || (activeReg?.scope != null && reg.accept.includes(activeReg.scope));\n\n if (scopeMatch) {\n list.push({ id, rect, data: {}, disabled: false });\n }\n }\n\n return list;\n }\n\n function shallowEqualCollisions(a: CollisionResult[], b: CollisionResult[]): boolean {\n if (a.length !== b.length) return false;\n\n for (let i = 0; i < a.length; i++) {\n if (a[i].id !== b[i].id) return false;\n }\n\n return true;\n }\n\n function runCollisionDetection(position: Point, scrollDelta?: Point): void {\n const op = state.operation;\n\n if (!op) return;\n\n const delta = scrollDelta ?? accumulatedScrollDelta;\n const droppableList = buildDroppableList(delta);\n const activeRect = getAdjustedRectImpl(op.activeId, delta);\n const newCollisions = getCollisionFn()({ position, activeRect, droppables: droppableList });\n const changed = !shallowEqualCollisions(state.collisions, newCollisions);\n\n if (changed) {\n const prevOver = state.collisions[0] ?? null;\n const newOver = newCollisions[0] ?? null;\n\n setState((prev) => ({ ...prev, collisions: newCollisions }));\n\n if (prevOver?.id !== newOver?.id) {\n emit('dragOver', {\n active: { id: op.activeId, data: op.data },\n over: newOver ? { id: newOver.id, data: newOver.data } : null\n });\n }\n }\n\n runSortableCollision(position, delta);\n }\n\n // ── Sortable Collision ─────────────────────────────────────\n\n /** Cached source container for the current drag — avoids O(n*m) scan on every move. */\n let cachedSourceContainer: { containerId: UniqueId; index: number } | null = null;\n\n function findSourceContainer(activeId: UniqueId): { container: SortableContainerRegistration; index: number } | null {\n // Use cached source if available and still valid\n if (cachedSourceContainer) {\n const reg = state.sortableContainers.get(cachedSourceContainer.containerId);\n\n if (reg) {\n const idx = reg.items.indexOf(activeId);\n\n if (idx !== -1) return { container: reg, index: idx };\n }\n\n // Cache is stale (container removed or item moved)\n cachedSourceContainer = null;\n }\n\n for (const [, reg] of state.sortableContainers) {\n const idx = reg.items.indexOf(activeId);\n\n if (idx !== -1) {\n cachedSourceContainer = { containerId: reg.id, index: idx };\n\n return { container: reg, index: idx };\n }\n }\n\n return null;\n }\n\n function transformMapsEqual(a: Map<UniqueId, Transform>, b: Map<UniqueId, Transform>): boolean {\n if (a.size !== b.size) return false;\n\n for (const [key, val] of a) {\n const other = b.get(key);\n\n if (!other || val.x !== other.x || val.y !== other.y) return false;\n }\n\n return true;\n }\n\n function runSortableCollision(position: Point, scrollDelta: Point): void {\n const op = state.operation;\n\n if (!op) return;\n\n const source = findSourceContainer(op.activeId);\n\n if (!source) {\n if (state.sortable !== null) {\n setState((prev) => ({ ...prev, sortable: null }));\n }\n\n return;\n }\n\n const activeReg = state.draggables.get(op.activeId);\n\n // Phase 1: Container-level — which container is pointer over?\n let targetContainer: SortableContainerRegistration | null = null;\n\n for (const [, reg] of state.sortableContainers) {\n const containerRect = getAdjustedRectImpl(reg.id, scrollDelta);\n\n if (!containerRect || !isPointInRect(position, containerRect)) continue;\n\n const scopeMatch = !reg.accept || (activeReg?.scope != null && reg.accept.includes(activeReg.scope));\n\n if (scopeMatch || reg.id === source.container.id) {\n targetContainer = reg;\n break;\n }\n }\n\n if (!targetContainer) targetContainer = source.container;\n\n // Phase 2: Item-level collision within target container\n const itemRects: Array<{ id: UniqueId; rect: Rect }> = [];\n\n for (const itemId of targetContainer.items) {\n const rect = getAdjustedRectImpl(itemId, scrollDelta);\n\n if (rect) itemRects.push({ id: itemId, rect });\n }\n\n const sortResult = sortableCollision({\n position,\n items: itemRects,\n direction: targetContainer.direction,\n activeId: op.activeId,\n allowInsideDrop: targetContainer.allowInsideDrop\n });\n\n const projectedIndex = sortResult.index;\n const isCross = targetContainer.id !== source.container.id;\n\n // Compute transforms\n let allTransforms: Map<UniqueId, Transform>;\n\n if (isCross) {\n const { sourceTransforms, targetTransforms } = computeCrossContainerTransforms({\n sourceItems: source.container.items,\n targetItems: targetContainer.items,\n activeId: op.activeId,\n originalIndex: source.index,\n projectedIndex,\n activeRect: getAdjustedRectImpl(op.activeId, scrollDelta),\n sourceDirection: source.container.direction,\n targetDirection: targetContainer.direction\n });\n\n allTransforms = new Map([...sourceTransforms, ...targetTransforms]);\n } else {\n allTransforms = computeShiftTransforms({\n items: source.container.items,\n activeId: op.activeId,\n originalIndex: source.index,\n projectedIndex,\n activeRect: getAdjustedRectImpl(op.activeId, scrollDelta),\n itemRects: baseRects,\n direction: source.container.direction\n });\n }\n\n // Build drop indicator from sortable collision result\n const dropIndicator = sortResult.targetId != null ? { targetId: sortResult.targetId, position: sortResult.dropPosition, targetRect: sortResult.targetRect } : null;\n\n const newSortable: SortableOperationState = {\n sourceContainerId: source.container.id,\n currentContainerId: targetContainer.id,\n originalIndex: source.index,\n projectedIndex,\n transforms: allTransforms,\n dropIndicator\n };\n\n const prev = state.sortable;\n\n if (\n !prev ||\n prev.currentContainerId !== newSortable.currentContainerId ||\n prev.projectedIndex !== newSortable.projectedIndex ||\n !transformMapsEqual(prev.transforms, newSortable.transforms) ||\n prev.dropIndicator?.targetId !== newSortable.dropIndicator?.targetId ||\n prev.dropIndicator?.position !== newSortable.dropIndicator?.position\n ) {\n setState((prevState) => ({ ...prevState, sortable: newSortable }));\n }\n }\n\n // ── Auto-Scroll Engine ─────────────────────────────────────\n\n function startAutoScroll(): void {\n if (!autoScrollEnabled || !isClient()) return;\n\n if (!scrollableEl) {\n const activeReg = state.draggables.get(state.operation!.activeId);\n\n if (activeReg?.node) scrollableEl = findScrollableAncestor(activeReg.node);\n }\n\n if (!scrollableEl) return;\n\n accumulatedScrollDelta = { x: 0, y: 0 };\n tickAutoScroll();\n }\n\n function stopAutoScroll(): void {\n if (autoScrollRAF !== null) {\n cancelAnimationFrame(autoScrollRAF);\n autoScrollRAF = null;\n }\n\n accumulatedScrollDelta = { x: 0, y: 0 };\n }\n\n function tickAutoScroll(): void {\n const op = state.operation;\n\n if (!op || !scrollableEl) return;\n\n const threshold = autoScrollOpts.threshold ?? 50;\n const speed = autoScrollOpts.speed ?? 15;\n const dir = autoScrollOpts.direction ?? 'both';\n\n const pointer = op.current;\n const containerRect = scrollableEl === document.documentElement ? createRect(0, 0, window.innerWidth, window.innerHeight) : getElementRect(scrollableEl);\n\n let sx = 0;\n let sy = 0;\n\n // Vertical\n if (dir !== 'horizontal') {\n const distTop = pointer.y - containerRect.top;\n const distBottom = containerRect.bottom - pointer.y;\n\n if (distTop >= 0 && distTop < threshold) {\n sy = -speed * (1 - distTop / threshold);\n } else if (distBottom >= 0 && distBottom < threshold) {\n sy = speed * (1 - distBottom / threshold);\n }\n }\n\n // Horizontal\n if (dir !== 'vertical') {\n const distLeft = pointer.x - containerRect.left;\n const distRight = containerRect.right - pointer.x;\n\n if (distLeft >= 0 && distLeft < threshold) {\n sx = -speed * (1 - distLeft / threshold);\n } else if (distRight >= 0 && distRight < threshold) {\n sx = speed * (1 - distRight / threshold);\n }\n }\n\n if (sx !== 0 || sy !== 0) {\n const prevPos = getScrollPosition(scrollableEl);\n\n scrollElement(scrollableEl, sx, sy);\n\n const newPos = getScrollPosition(scrollableEl);\n const actualDx = newPos.x - prevPos.x;\n const actualDy = newPos.y - prevPos.y;\n\n if (actualDx !== 0 || actualDy !== 0) {\n accumulatedScrollDelta = {\n x: accumulatedScrollDelta.x + actualDx,\n y: accumulatedScrollDelta.y + actualDy\n };\n\n // Re-run collision with zero-reflow adjusted rects\n runCollisionDetection(op.current, accumulatedScrollDelta);\n }\n }\n\n autoScrollRAF = requestAnimationFrame(tickAutoScroll);\n }\n\n // ── Drag Lifecycle ─────────────────────────────────────────\n\n function startDrag(event: Event, activeId: UniqueId): void {\n assertAlive();\n\n if (state.operation) return;\n\n const reg = state.draggables.get(activeId);\n\n if (!reg || reg.disabled) return;\n\n const data: DragData = { ...reg.data };\n\n let origin: Point;\n\n if ('clientX' in event) {\n const e = event as PointerEvent;\n\n origin = { x: e.clientX, y: e.clientY };\n } else {\n const rect = reg.node ? getElementRect(reg.node) : null;\n\n origin = rect ? rectCenter(rect) : { x: 0, y: 0 };\n }\n\n setState((prev) => ({\n ...prev,\n operation: { activeId, origin, current: { ...origin }, delta: { x: 0, y: 0 }, data },\n collisions: [],\n sortable: null\n }));\n\n measureAllRects();\n setupDragObservers();\n startAutoScroll();\n\n emit('dragStart', { active: { id: activeId, data, node: reg.node }, event });\n\n runCollisionDetection(origin);\n }\n\n function updateDrag(event: Event, position: Point): void {\n assertAlive();\n\n const op = state.operation;\n\n if (!op) return;\n\n const delta: Point = { x: position.x - op.origin.x, y: position.y - op.origin.y };\n\n setState((prev) => ({\n ...prev,\n operation: prev.operation ? { ...prev.operation, current: position, delta } : null\n }));\n\n runCollisionDetection(position);\n\n const reg = state.draggables.get(op.activeId);\n\n emit('dragMove', {\n active: { id: op.activeId, data: op.data, node: reg?.node ?? null },\n position,\n delta,\n event\n });\n }\n\n function endDrag(event?: Event): void {\n assertAlive();\n\n const op = state.operation;\n\n if (!op) return;\n\n const overCollision = state.collisions[0] ?? null;\n const sortableState = state.sortable;\n\n if (sortableState) {\n const isCross = sortableState.sourceContainerId !== sortableState.currentContainerId;\n\n if (isCross) {\n emit('transfer', {\n activeId: op.activeId,\n from: { containerId: sortableState.sourceContainerId, index: sortableState.originalIndex },\n to: { containerId: sortableState.currentContainerId, index: sortableState.projectedIndex },\n event\n });\n } else if (sortableState.originalIndex !== sortableState.projectedIndex) {\n emit('sort', {\n containerId: sortableState.sourceContainerId,\n activeId: op.activeId,\n fromIndex: sortableState.originalIndex,\n toIndex: sortableState.projectedIndex,\n event\n });\n }\n }\n\n emit('dragEnd', {\n active: { id: op.activeId, data: op.data },\n over: overCollision ? { id: overCollision.id, data: overCollision.data } : null,\n cancelled: false,\n event\n });\n\n cleanupDragState();\n }\n\n function cancelDrag(event?: Event): void {\n assertAlive();\n\n const op = state.operation;\n\n if (!op) return;\n\n emit('dragCancel', { active: { id: op.activeId, data: op.data }, event });\n emit('dragEnd', { active: { id: op.activeId, data: op.data }, over: null, cancelled: true, event });\n\n cleanupDragState();\n }\n\n function cleanupDragState(): void {\n stopAutoScroll();\n teardownDragObservers();\n baseRects.clear();\n accumulatedScrollDelta = { x: 0, y: 0 };\n cachedSourceContainer = null;\n // Clear auto-discovered scrollable element to avoid stale DOM references\n scrollableEl = null;\n\n setState((prev) => ({ ...prev, operation: null, collisions: [], sortable: null }));\n }\n\n // ── Pointer Sensor ─────────────────────────────────────────\n\n const sensorCleanups = new Set<() => void>();\n\n function attachPointerSensor(element: HTMLElement, id: UniqueId, sensorOpts?: PointerSensorOptions): () => void {\n assertAlive();\n\n if (!isClient()) return () => {};\n\n const activationDist = sensorOpts?.activationDistance ?? 5;\n const activationDelay = sensorOpts?.activationDelay ?? 0;\n\n let pending = false;\n let active = false;\n let startPt: Point | null = null;\n let delayTimer: ReturnType<typeof setTimeout> | null = null;\n let delayMet = activationDelay === 0;\n let rafId: number | null = null;\n let pendingPos: Point | null = null;\n let pendingEvent: PointerEvent | null = null;\n\n function cleanup(): void {\n pending = false;\n active = false;\n startPt = null;\n delayMet = activationDelay === 0;\n\n if (delayTimer !== null) {\n clearTimeout(delayTimer);\n delayTimer = null;\n }\n\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n rafId = null;\n }\n\n pendingPos = null;\n pendingEvent = null;\n\n document.removeEventListener('pointermove', onPointerMove);\n document.removeEventListener('pointerup', onPointerUp);\n document.removeEventListener('pointercancel', onPointerCancel);\n document.removeEventListener('keydown', onEscapeKey);\n document.removeEventListener('contextmenu', onContextMenu);\n }\n\n function processMove(): void {\n if (pendingPos && pendingEvent && active) {\n updateDrag(pendingEvent, pendingPos);\n pendingPos = null;\n pendingEvent = null;\n }\n\n rafId = null;\n }\n\n function onPointerDown(e: PointerEvent): void {\n if (e.button !== 0) return;\n\n if (state.operation) return;\n\n const reg = state.draggables.get(id);\n\n if (reg?.disabled) return;\n\n pending = true;\n startPt = { x: e.clientX, y: e.clientY };\n delayMet = activationDelay === 0;\n\n try {\n element.setPointerCapture(e.pointerId);\n } catch {\n /* noop */\n }\n\n if (activationDelay > 0) {\n delayTimer = setTimeout(() => {\n delayMet = true;\n delayTimer = null;\n }, activationDelay);\n }\n\n document.addEventListener('pointermove', onPointerMove);\n document.addEventListener('pointerup', onPointerUp);\n document.addEventListener('pointercancel', onPointerCancel);\n document.addEventListener('keydown', onEscapeKey);\n document.addEventListener('contextmenu', onContextMenu);\n }\n\n function onPointerMove(e: PointerEvent): void {\n if (!pending && !active) return;\n\n if (!startPt) return;\n\n const pos: Point = { x: e.clientX, y: e.clientY };\n\n if (!active) {\n const dist = distanceBetween(startPt, pos);\n\n if (!delayMet) {\n if (dist > activationDist) {\n cleanup();\n }\n\n return;\n }\n\n if (dist < activationDist) return;\n\n active = true;\n pending = false;\n startDrag(e, id);\n\n return;\n }\n\n // RAF-throttled update — store real event for forwarding\n pendingPos = pos;\n pendingEvent = e;\n\n if (rafId === null) {\n rafId = requestAnimationFrame(processMove);\n }\n }\n\n function onPointerUp(e: PointerEvent): void {\n if (active) {\n if (pendingPos) updateDrag(e, pendingPos);\n\n endDrag(e);\n }\n\n try {\n element.releasePointerCapture(e.pointerId);\n } catch {\n /* noop */\n }\n\n cleanup();\n }\n\n function onPointerCancel(e: PointerEvent): void {\n if (active) cancelDrag(e);\n\n try {\n element.releasePointerCapture(e.pointerId);\n } catch {\n /* noop */\n }\n\n cleanup();\n }\n\n function onEscapeKey(e: KeyboardEvent): void {\n if (e.key === 'Escape' && active) {\n cancelDrag(e);\n cleanup();\n }\n }\n\n function onContextMenu(e: Event): void {\n if (active || pending) e.preventDefault();\n }\n\n element.addEventListener('pointerdown', onPointerDown);\n\n const detach = (): void => {\n cleanup();\n element.removeEventListener('pointerdown', onPointerDown);\n sensorCleanups.delete(detach);\n };\n\n sensorCleanups.add(detach);\n\n return detach;\n }\n\n // ── Keyboard Sensor ────────────────────────────────────────\n\n function attachKeyboardSensor(element: HTMLElement, id: UniqueId, sensorOpts?: KeyboardSensorOptions): () => void {\n assertAlive();\n\n if (!isClient()) return () => {};\n\n const step = sensorOpts?.step ?? 25;\n const fastStep = sensorOpts?.fastStep ?? step * 5;\n\n let kbDragging = false;\n\n function onKeyDown(e: KeyboardEvent): void {\n const reg = state.draggables.get(id);\n\n if (reg?.disabled) return;\n\n if (!kbDragging) {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n kbDragging = true;\n startDrag(e, id);\n }\n\n return;\n }\n\n e.preventDefault();\n\n switch (e.key) {\n case 'Escape':\n kbDragging = false;\n cancelDrag(e);\n break;\n\n case 'Tab':\n kbDragging = false;\n cancelDrag(e);\n break;\n\n case ' ':\n case 'Enter':\n kbDragging = false;\n endDrag(e);\n break;\n\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowLeft':\n case 'ArrowRight':\n if (!state.operation) break;\n\n if (state.sortable !== null) {\n handleSortMove(e);\n } else {\n const amount = e.shiftKey ? fastStep : step;\n const cur = state.operation.current;\n const newPos: Point = { x: cur.x, y: cur.y };\n\n if (e.key === 'ArrowUp') newPos.y -= amount;\n\n if (e.key === 'ArrowDown') newPos.y += amount;\n\n if (e.key === 'ArrowLeft') newPos.x -= amount;\n\n if (e.key === 'ArrowRight') newPos.x += amount;\n\n updateDrag(e, newPos);\n }\n\n break;\n\n case 'Home':\n case 'End':\n if (state.sortable) handleSortHomeEnd(e);\n\n break;\n }\n }\n\n function handleSortMove(e: KeyboardEvent): void {\n if (!state.operation || !state.sortable) return;\n\n const { currentContainerId, projectedIndex } = state.sortable;\n const container = state.sortableContainers.get(currentContainerId);\n\n if (!container) return;\n\n const isVert = container.direction === 'vertical' || container.direction === 'grid';\n const isHoriz = container.direction === 'horizontal' || container.direction === 'grid';\n\n let newIndex = projectedIndex;\n let newContainerId = currentContainerId;\n\n if ((e.key === 'ArrowUp' && isVert) || (e.key === 'ArrowLeft' && isHoriz)) {\n if (newIndex > 0) newIndex--;\n } else if ((e.key === 'ArrowDown' && isVert) || (e.key === 'ArrowRight' && isHoriz)) {\n const max = container.items.filter((itemId) => itemId !== state.operation!.activeId).length;\n\n if (newIndex < max) newIndex++;\n } else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n const adjacent = findAdjacentContainer(currentContainerId, e.key === 'ArrowRight' ? 'right' : 'left');\n\n if (adjacent) {\n newContainerId = adjacent.id;\n newIndex = 0;\n }\n }\n\n if (newIndex !== projectedIndex || newContainerId !== currentContainerId) {\n moveToSortIndex(newContainerId, newIndex, e);\n }\n }\n\n function handleSortHomeEnd(e: KeyboardEvent): void {\n if (!state.operation || !state.sortable) return;\n\n const container = state.sortableContainers.get(state.sortable.currentContainerId);\n\n if (!container) return;\n\n const items = container.items.filter((itemId) => itemId !== state.operation!.activeId);\n const targetId = e.key === 'Home' ? items[0] : items[items.length - 1];\n\n if (targetId != null) {\n const rect = getAdjustedRectImpl(targetId, accumulatedScrollDelta);\n\n if (rect) updateDrag(e, rectCenter(rect));\n }\n }\n\n function moveToSortIndex(containerId: UniqueId, index: number, e: Event): void {\n const container = state.sortableContainers.get(containerId);\n\n if (!container) return;\n\n const items = container.items.filter((itemId) => itemId !== state.operation!.activeId);\n const targetId = items[Math.min(index, items.length - 1)];\n\n if (targetId != null) {\n const rect = getAdjustedRectImpl(targetId, accumulatedScrollDelta);\n\n if (rect) {\n updateDrag(e, rectCenter(rect));\n\n // Scroll target into view\n const targetReg = state.draggables.get(targetId);\n\n if (targetReg?.node) {\n targetReg.node.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });\n }\n }\n }\n }\n\n function findAdjacentContainer(currentId: UniqueId, direction: 'left' | 'right'): SortableContainerRegistration | null {\n const currentRect = getAdjustedRectImpl(currentId, accumulatedScrollDelta);\n\n if (!currentRect) return null;\n\n const currentCenter = rectCenter(currentRect);\n let closest: SortableContainerRegistration | null = null;\n let closestDist = Infinity;\n\n for (const [cId, reg] of state.sortableContainers) {\n if (cId === currentId) continue;\n\n const rect = getAdjustedRectImpl(cId, accumulatedScrollDelta);\n\n if (!rect) continue;\n\n const center = rectCenter(rect);\n\n if (direction === 'right' && center.x <= currentCenter.x) continue;\n\n if (direction === 'left' && center.x >= currentCenter.x) continue;\n\n const activeReg = state.draggables.get(state.operation!.activeId);\n\n if (reg.accept && activeReg?.scope != null && !reg.accept.includes(activeReg.scope)) continue;\n\n const dist = distanceBetween(currentCenter, center);\n\n if (dist < closestDist) {\n closestDist = dist;\n closest = reg;\n }\n }\n\n return closest;\n }\n\n element.addEventListener('keydown', onKeyDown);\n\n const detach = (): void => {\n if (kbDragging) {\n kbDragging = false;\n cancelDrag();\n }\n\n element.removeEventListener('keydown', onKeyDown);\n sensorCleanups.delete(detach);\n };\n\n sensorCleanups.add(detach);\n\n return detach;\n }\n\n // ── Registration ───────────────────────────────────────────\n\n function registerDraggable(reg: DraggableRegistration): () => void {\n assertAlive();\n\n setState((prev) => {\n const m = new Map(prev.draggables);\n\n m.set(reg.id, reg);\n\n return { ...prev, draggables: m };\n });\n\n return () => {\n if (state.operation?.activeId === reg.id) cancelDrag();\n\n setState((prev) => {\n const m = new Map(prev.draggables);\n\n m.delete(reg.id);\n\n return { ...prev, draggables: m };\n });\n };\n }\n\n function registerDroppable(reg: DroppableRegistration): () => void {\n assertAlive();\n\n setState((prev) => {\n const m = new Map(prev.droppables);\n\n m.set(reg.id, reg);\n\n return { ...prev, droppables: m };\n });\n\n return () => {\n setState((prev) => {\n const m = new Map(prev.droppables);\n\n m.delete(reg.id);\n\n return { ...prev, droppables: m };\n });\n };\n }\n\n function registerSortableContainer(reg: SortableContainerRegistration): () => void {\n assertAlive();\n\n setState((prev) => {\n const m = new Map(prev.sortableContainers);\n\n m.set(reg.id, reg);\n\n return { ...prev, sortableContainers: m };\n });\n\n if (reg.node && resizeObs) resizeObs.observe(reg.node);\n\n return () => {\n if (reg.node && resizeObs) resizeObs.unobserve(reg.node);\n\n setState((prev) => {\n const m = new Map(prev.sortableContainers);\n\n m.delete(reg.id);\n\n return { ...prev, sortableContainers: m };\n });\n };\n }\n\n // ── Announcement Helper ────────────────────────────────────\n\n function getAnnouncement<K extends keyof DndAnnouncements>(type: K, event: Parameters<DndAnnouncements[K]>[0]): string {\n const fn = announcements[type] as ((event: Parameters<DndAnnouncements[K]>[0]) => string) | undefined;\n\n return fn ? fn(event) : '';\n }\n\n // ── Initialize (SSR-guarded) ───────────────────────────────\n\n if (isClient()) {\n setupResizeObserver();\n setupWindowResize();\n }\n\n // ── Public Instance ────────────────────────────────────────\n\n return {\n getState: () => state,\n\n subscribe(listener: () => void): () => void {\n assertAlive();\n subscribers.add(listener);\n\n return () => {\n subscribers.delete(listener);\n };\n },\n\n registerDraggable,\n registerDroppable,\n registerSortableContainer,\n\n startDrag,\n updateDrag,\n endDrag,\n cancelDrag,\n\n on<K extends keyof DndEventMap>(name: K, handler: DndEventHandler<K>): () => void {\n assertAlive();\n\n if (!eventHandlers.has(name)) eventHandlers.set(name, new Set());\n\n const handlers = eventHandlers.get(name)!;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn = handler as (event: any) => void;\n\n handlers.add(fn);\n\n return () => {\n handlers.delete(fn);\n };\n },\n\n attachPointerSensor,\n attachKeyboardSensor,\n\n setScrollableElement(el: HTMLElement | null): void {\n scrollableEl = el;\n },\n\n setCollisionDetection(strategy: CollisionStrategy): void {\n activeStrategy = strategy;\n },\n\n measureRects: measureAllRects,\n\n getAdjustedRect: getAdjustedRectImpl,\n\n getAnnouncement,\n\n destroy(): void {\n if (destroyed) return;\n\n destroyed = true;\n\n // Cancel active drag — emit events before clearing handlers\n if (state.operation) {\n emit('dragCancel', { active: { id: state.operation.activeId, data: state.operation.data } });\n emit('dragEnd', { active: { id: state.operation.activeId, data: state.operation.data }, over: null, cancelled: true });\n stopAutoScroll();\n teardownDragObservers();\n }\n\n // Cleanup sensors\n for (const fn of sensorCleanups) fn();\n sensorCleanups.clear();\n\n // Cleanup observers\n resizeObs?.disconnect();\n resizeObs = null;\n windowResizeCleanup?.();\n windowResizeCleanup = null;\n debouncedRemeasure.cancel();\n debouncedWindowResize.cancel();\n\n // Clear subscriptions\n eventHandlers.clear();\n subscribers.clear();\n\n // Clear cache\n baseRects.clear();\n\n // Reset state\n state = {\n operation: null,\n draggables: new Map(),\n droppables: new Map(),\n sortableContainers: new Map(),\n collisions: [],\n sortable: null\n };\n }\n };\n}\n"],"mappings":"6bAKO,IAAMA,GAA0C,CACnD,YAAcC,GAAG,CANrB,IAAAC,EAAAC,EAMwB,oBAAcA,GAAAD,EAAAD,EAAE,OAAO,OAAT,YAAAC,EAA4B,QAA5B,KAAAC,EAAqC,MAAM,uEAE7E,WAAaF,GAAG,CARpB,IAAAC,EAAAC,EAQwB,OAAAF,EAAE,KAAO,SAASE,GAAAD,EAAAD,EA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ACb,SAAU,IACd,EACJ,CACJ,CACJ","names":["DEFAULT_ANNOUNCEMENTS","e","_a","_b","info","isClient","getElementRect","el","r","createRect","x","y","width","height","adjustRect","rect","scrollDelta","distanceBetween","a","b","rectCenter","isPointInRect","point","rectArea","intersectionArea","w","h","findScrollableAncestor","element","current","style","scrollableY","scrollableX","getScrollPosition","scrollElement","left","top","debounce","fn","ms","timer","pointerWithin","input","results","d","isPointInRect","area","rectArea","b","_a","_b","rectIntersection","intersectionArea","dropArea","closestCenter","ac","rectCenter","distanceBetween","a","closestCorners","ar","aCorners","dr","dCorners","total","i","collisionStrategies","EDGE_ZONE_RATIO","sortableCollision","input","position","items","direction","activeId","allowInsideDrop","emptyResult","candidates","item","closestIdx","closestDist","i","center","rectCenter","dist","distanceBetween","closest","closestRect","cc","pos","dropPosition","computeDropZone","originalIdx","pointer","rect","edgeSize","computeShiftTransforms","originalIndex","projectedIndex","activeRect","itemRects","transforms","movingForward","itemId","neighborIdx","neighborId","currentRect","neighborRect","shiftX","shiftY","tx","ty","computeCrossContainerTransforms","sourceItems","targetItems","sourceDirection","targetDirection","sourceTransforms","targetTransforms","srcShiftX","srcShiftY","tgtShiftX","tgtShiftY","arrayMove","arr","fromIndex","toIndex","result","arrayTransfer","source","target","newSource","newTarget","createDnd","options","_a","destroyed","assertAlive","state","subscribers","isNotifying","notify","fn","setState","updater","next","eventHandlers","emit","name","data","handlers","activeStrategy","getCollisionFn","collisionStrategies","scrollableEl","autoScrollEnabled","autoScrollOpts","autoScrollRAF","accumulatedScrollDelta","announcements","__spreadValues","DEFAULT_ANNOUNCEMENTS","baseRects","measureAllRects","isClient","id","reg","getElementRect","getAdjustedRectImpl","scrollDelta","base","adjustRect","remeasureRects","runCollisionDetection","debouncedRemeasure","debounce","debouncedWindowResize","resizeObs","mutationObs","scrollCleanup","windowResizeCleanup","setupResizeObserver","setupWindowResize","handler","setupDragObservers","target","teardownDragObservers","buildDroppableList","list","op","activeReg","rect","scopeMatch","canDrop","shallowEqualCollisions","a","b","i","position","_b","delta","droppableList","activeRect","newCollisions","prevOver","newOver","prev","__spreadProps","runSortableCollision","cachedSourceContainer","findSourceContainer","activeId","idx","transformMapsEqual","key","val","other","_c","_d","source","targetContainer","containerRect","isPointInRect","itemRects","itemId","sortResult","sortableCollision","projectedIndex","isCross","allTransforms","sourceTransforms","targetTransforms","computeCrossContainerTransforms","computeShiftTransforms","dropIndicator","newSortable","prevState","startAutoScroll","findScrollableAncestor","tickAutoScroll","stopAutoScroll","threshold","speed","dir","pointer","createRect","sx","sy","distTop","distBottom","distLeft","distRight","prevPos","getScrollPosition","scrollElement","newPos","actualDx","actualDy","startDrag","event","origin","e","rectCenter","updateDrag","endDrag","overCollision","sortableState","cleanupDragState","cancelDrag","sensorCleanups","attachPointerSensor","element","sensorOpts","activationDist","activationDelay","pending","active","startPt","delayTimer","delayMet","rafId","pendingPos","pendingEvent","cleanup","onPointerMove","onPointerUp","onPointerCancel","onEscapeKey","onContextMenu","processMove","onPointerDown","pos","dist","distanceBetween","detach","attachKeyboardSensor","step","fastStep","kbDragging","onKeyDown","handleSortMove","amount","cur","handleSortHomeEnd","currentContainerId","container","isVert","isHoriz","newIndex","newContainerId","max","adjacent","findAdjacentContainer","moveToSortIndex","items","targetId","containerId","index","targetReg","currentId","direction","currentRect","currentCenter","closest","closestDist","cId","center","registerDraggable","m","registerDroppable","registerSortableContainer","getAnnouncement","type","listener","el","strategy"]}
@@ -1,28 +0,0 @@
1
- import * as _primereact_types_core from '@primereact/types/core';
2
- import { useHeadlessOptions, HeadlessInstance, withHeadlessOptions } from '@primereact/types/core';
3
-
4
- /**
5
- * A custom hook for using headless components.
6
- *
7
- * @param name The name of the headless component.
8
- * @param options Options for the headless component.
9
- * @returns The headless instance.
10
- */
11
- declare function useHeadless<IProps, DProps, Exposes extends Record<PropertyKey, unknown>>(name?: string, options?: useHeadlessOptions<IProps, DProps, Exposes>): HeadlessInstance<DProps, IProps, Exposes>;
12
-
13
- /**
14
- * Higher-order component for using headless components.
15
- *
16
- * @template IProps The input properties type for the headless component.
17
- * @template DProps The default properties type for the headless component.
18
- * @template Exposes The properties that the headless component exposes.
19
- *
20
- * @param options The options for the headless component.
21
- * @param options.name The name of the headless component.
22
- * @param options.defaultProps The default properties for the headless component.
23
- * @param options.setup The setup function for the headless component.
24
- * @returns A function that takes in props and returns the headless instance.
25
- */
26
- declare function withHeadless<IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>({ name, type, defaultProps, setup }: withHeadlessOptions<IProps, DProps, Exposes>): (inProps?: IProps) => _primereact_types_core.HeadlessInstance<DProps, IProps, Exposes>;
27
-
28
- export { useHeadless, withHeadless };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/headless/useHeadless.ts","../../src/headless/withHeadless.ts"],"sourcesContent":["import { useBase } from '@primereact/core/base';\nimport type { HeadlessInstance, useHeadlessOptions } from '@primereact/types/core';\n\n/**\n * A custom hook for using headless components.\n *\n * @param name The name of the headless component.\n * @param options Options for the headless component.\n * @returns The headless instance.\n */\nexport function useHeadless<IProps, DProps, Exposes extends Record<PropertyKey, unknown>>(name: string = 'UnknownHeadless', options: useHeadlessOptions<IProps, DProps, Exposes> = {}) {\n const baseInstance = useBase(name, options as useHeadlessOptions<IProps & { id?: string; ref?: React.Ref<unknown> }, typeof options.defaultProps & DProps, Exposes>);\n\n return baseInstance as HeadlessInstance<DProps, IProps, Exposes>;\n}\n","import type { withHeadlessOptions } from '@primereact/types/core';\nimport { useHeadless } from './useHeadless';\n\n/**\n * Higher-order component for using headless components.\n *\n * @template IProps The input properties type for the headless component.\n * @template DProps The default properties type for the headless component.\n * @template Exposes The properties that the headless component exposes.\n *\n * @param options The options for the headless component.\n * @param options.name The name of the headless component.\n * @param options.defaultProps The default properties for the headless component.\n * @param options.setup The setup function for the headless component.\n * @returns A function that takes in props and returns the headless instance.\n */\nexport function withHeadless<IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>({ name, type = 'headless', defaultProps, setup }: withHeadlessOptions<IProps, DProps, Exposes>) {\n return (inProps?: IProps) => {\n return useHeadless(name, { type, inProps, defaultProps, setup });\n };\n}\n"],"mappings":"AAAA,OAAS,WAAAA,MAAe,wBAUjB,SAASC,EAA0EC,EAAe,kBAAmBC,EAAuD,CAAC,EAAG,CAGnL,OAFqBH,EAAQE,EAAMC,CAAgI,CAGvK,CCEO,SAASC,EAA0G,CAAE,KAAAC,EAAM,KAAAC,EAAO,WAAY,aAAAC,EAAc,MAAAC,CAAM,EAAiD,CACtN,OAAQC,GACGC,EAAYL,EAAM,CAAE,KAAAC,EAAM,QAAAG,EAAS,aAAAF,EAAc,MAAAC,CAAM,CAAC,CAEvE","names":["useBase","useHeadless","name","options","withHeadless","name","type","defaultProps","setup","inProps","useHeadless"]}
package/icon/index.d.mts DELETED
@@ -1,40 +0,0 @@
1
- import * as _primereact_types_index from '@primereact/types/index';
2
- import * as _primereact_types_core from '@primereact/types/core';
3
- import { IconProps, withComponentOptions, IconExposes } from '@primereact/types/core';
4
- import * as React from 'react';
5
- import { StylesOptions } from '@primereact/types/styles';
6
-
7
- declare const Icon: (<I extends _primereact_types_core.ComponentInstance, T extends React.ElementType>(inProps?: (_primereact_types_core.GlobalComponentProps<I, unknown, T, unknown, unknown> & {} & {} & Omit<_primereact_types_index.ExtractProps<T>, keyof _primereact_types_core.GlobalComponentProps<I_1, P, T_1, unknown, unknown>> & _primereact_types_core.IconProps) | undefined) => React.JSX.Element | null) & Record<string, unknown> & React.FC<{}>;
8
-
9
- declare const defaultIconProps: IconProps;
10
-
11
- declare const styles: StylesOptions;
12
-
13
- declare const useIcon: (inProps?: unknown) => _primereact_types_core.HeadlessInstance<unknown, unknown, {
14
- pti: () => {
15
- role: string | undefined;
16
- 'aria-hidden': boolean;
17
- };
18
- }>;
19
-
20
- /**
21
- * Higher-order component for enhancing icon components.
22
- *
23
- * @template IProps - The interface for the icon component's props.
24
- * @template DProps - The interface for the default properties of the icon component.
25
- * @template Exposes - The interface for the properties exposed by the icon component.
26
- * @template Styles - The styles options for the icon component.
27
- * @template CData - The context data for the icon component.
28
- *
29
- * @param options - The options for the icon component.
30
- * @param options.name - The name of the icon component.
31
- * @param options.defaultProps - The default properties for the icon component.
32
- * @param options.styles - The styles options for the icon component.
33
- * @param options.components - The components to be used within the icon component.
34
- * @param options.setup - The setup function for the icon component.
35
- * @param options.render - The render function for the icon component.
36
- * @returns A React component wrapped with the specified options.
37
- */
38
- declare function withIcon<IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>, Styles = StylesOptions, CData = Record<string, unknown>>({ name, defaultProps, styles, components, setup, render }: withComponentOptions<IProps, DProps, Exposes & IconExposes, Styles, CData>): (<I extends _primereact_types_core.ComponentInstance, T extends React.ElementType>(inProps?: (IProps & _primereact_types_core.GlobalComponentProps<I, unknown, T, unknown, unknown> & {} & {} & Omit<_primereact_types_index.ExtractProps<T>, keyof _primereact_types_core.GlobalComponentProps<I_1, P, T_1, unknown, unknown> | keyof IProps> & DProps) | undefined) => React.JSX.Element | null) & CData & React.FC<{}>;
39
-
40
- export { Icon, defaultIconProps, styles, useIcon, withIcon };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/icon/Icon.tsx","../../src/icon/Icon.props.ts","../../src/icon/Icon.style.ts","../../src/icon/withIcon.tsx","../../src/icon/useIcon.ts"],"sourcesContent":["import { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultIconProps } from './Icon.props';\nimport { styles } from './Icon.style';\nimport { withIcon } from './withIcon';\n\nexport const Icon = withIcon({\n name: 'Icon',\n styles,\n defaultProps: defaultIconProps,\n render(instance) {\n const { id, props, ptmi, pti, cx, sx } = instance;\n\n const rootProps = mergeProps(\n {\n id,\n style: sx('root'),\n className: cx('root')\n },\n pti?.(),\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import type { IconProps } from '@primereact/types/core';\n\nexport const defaultIconProps: IconProps = {\n as: 'i',\n size: undefined,\n rotate: undefined,\n flip: undefined,\n spin: false\n};\n","import type { StylesOptions } from '@primereact/types/styles';\nimport { $dt } from '@primeuix/styled';\n\nexport const styles = {\n name: 'icon',\n classes: {\n root: ({ props }) => [\n 'p-icon',\n {\n 'p-icon-spin': props.spin,\n 'p-icon-flip-horizontal': props.flip === 'horizontal',\n 'p-icon-flip-vertical': props.flip === 'vertical'\n }\n ]\n },\n inlineStyles: {\n root: ({ props }) => ({\n ...(props.size ? { [$dt('icon.size').name]: props.size } : undefined),\n ...(props.rotate ? { [$dt('icon.rotate').name]: `${props.rotate}deg` } : undefined)\n })\n }\n} as StylesOptions;\n","import { withComponent } from '@primereact/core/component';\nimport type { BaseSetup, IconExposes, withComponentOptions } from '@primereact/types/core';\nimport type { StylesOptions } from '@primereact/types/styles';\nimport { resolve } from '@primeuix/utils';\nimport * as React from 'react';\nimport { useIcon } from './useIcon';\n\n/**\n * Higher-order component for enhancing icon components.\n *\n * @template IProps - The interface for the icon component's props.\n * @template DProps - The interface for the default properties of the icon component.\n * @template Exposes - The interface for the properties exposed by the icon component.\n * @template Styles - The styles options for the icon component.\n * @template CData - The context data for the icon component.\n *\n * @param options - The options for the icon component.\n * @param options.name - The name of the icon component.\n * @param options.defaultProps - The default properties for the icon component.\n * @param options.styles - The styles options for the icon component.\n * @param options.components - The components to be used within the icon component.\n * @param options.setup - The setup function for the icon component.\n * @param options.render - The render function for the icon component.\n * @returns A React component wrapped with the specified options.\n */\nexport function withIcon<IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>, Styles = StylesOptions, CData = Record<string, unknown>>({\n name,\n defaultProps,\n styles,\n components,\n setup,\n render\n}: withComponentOptions<IProps, DProps, Exposes & IconExposes, Styles, CData>) {\n return withComponent<IProps, DProps, Exposes & IconExposes, Styles, CData>({\n name: `${name ?? 'Unknown'}Icon`,\n defaultProps,\n styles,\n components,\n setup(instance) {\n const icon = useIcon(instance?.inProps);\n const computedSetup = resolve(setup as BaseSetup<typeof instance.props, IProps, Exposes>, instance) as Exposes;\n\n return React.useMemo(\n () => ({\n ...icon,\n ...computedSetup\n }),\n [icon, computedSetup]\n );\n },\n render\n });\n}\n","import { withHeadless } from '@primereact/core/headless';\nimport { isEmpty } from '@primeuix/utils';\nimport * as React from 'react';\n\nexport const useIcon = withHeadless({\n name: 'useIcon',\n setup({ attrs }) {\n const ariaLabel = attrs['aria-label'];\n const tabIndex = attrs.tabIndex;\n\n const pti = React.useCallback(() => {\n const isAriaLabelEmpty = isEmpty(ariaLabel);\n\n return {\n role: !isAriaLabelEmpty ? 'img' : undefined,\n 'aria-hidden': isEmpty(tabIndex) && isAriaLabelEmpty\n };\n }, [ariaLabel, tabIndex]);\n\n return {\n pti\n };\n }\n});\n"],"mappings":"sWAAA,OAAS,aAAAA,MAAiB,6BAC1B,OAAS,cAAAC,MAAkB,kBAC3B,UAAYC,MAAW,QCAhB,IAAMC,EAA8B,CACvC,GAAI,IACJ,KAAM,OACN,OAAQ,OACR,KAAM,OACN,KAAM,EACV,ECPA,OAAS,OAAAC,MAAW,mBAEb,IAAMC,EAAS,CAClB,KAAM,OACN,QAAS,CACL,KAAM,CAAC,CAAE,MAAAC,CAAM,IAAM,CACjB,SACA,CACI,cAAeA,EAAM,KACrB,yBAA0BA,EAAM,OAAS,aACzC,uBAAwBA,EAAM,OAAS,UAC3C,CACJ,CACJ,EACA,aAAc,CACV,KAAM,CAAC,CAAE,MAAAA,CAAM,IAAOC,IAAA,GACdD,EAAM,KAAO,CAAE,CAACE,EAAI,WAAW,EAAE,IAAI,EAAGF,EAAM,IAAK,EAAI,QACvDA,EAAM,OAAS,CAAE,CAACE,EAAI,aAAa,EAAE,IAAI,EAAG,GAAGF,EAAM,MAAM,KAAM,EAAI,OAEjF,CACJ,ECrBA,OAAS,iBAAAG,MAAqB,6BAG9B,OAAS,WAAAC,MAAe,kBACxB,UAAYC,MAAW,QCJvB,OAA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U,CACtF,CACJ,CAAC","names":["Component","mergeProps","React","defaultIconProps","$dt","styles","props","__spreadValues","$dt","withComponent","resolve","React","withHeadless","isEmpty","React","useIcon","attrs","ariaLabel","tabIndex","isAriaLabelEmpty","withIcon","name","defaultProps","styles","components","setup","render","withComponent","instance","icon","useIcon","computedSetup","resolve","__spreadValues","Icon","withIcon","styles","defaultIconProps","instance","id","props","ptmi","pti","cx","sx","rootProps","mergeProps","Component"]}
package/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/***************** PrimeReact Core (Auto-Generated) *****************/\n\nexport * from '@primereact/core/api';\nexport * from '@primereact/core/base';\nexport * from '@primereact/core/component';\nexport * from '@primereact/core/config';\nexport * from '@primereact/core/dnd';\nexport * from '@primereact/core/headless';\nexport * from '@primereact/core/icon';\nexport * from '@primereact/core/license';\nexport * from '@primereact/core/locale';\nexport * from '@primereact/core/motion';\nexport * from '@primereact/core/overlay-manager';\nexport * from '@primereact/core/passthrough';\nexport * from '@primereact/core/stylesheet';\nexport * from '@primereact/core/theme';\nexport * from '@primereact/core/use-style';\nexport * from '@primereact/core/utils';\n"],"mappings":"AAEA,WAAc,uBACd,WAAc,wBACd,WAAc,6BACd,WAAc,0BACd,WAAc,uBACd,WAAc,4BACd,WAAc,wBACd,WAAc,2BACd,WAAc,0BACd,WAAc,0BACd,WAAc,mCACd,WAAc,+BACd,WAAc,8BACd,WAAc,yBACd,WAAc,6BACd,WAAc","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/license/licensebanner.ts"],"sourcesContent":["/**\n * Inject a fixed-positioned banner into the bottom-right of the page when the\n * PrimeReact license cannot be verified.\n *\n * The banner content is rendered inside a closed-mode shadow root so page-level\n * CSS cannot reach into it. `all:initial` on the host element blocks inherited\n * styles. The host carries no semantically obvious id, slowing down trivial\n * hide-by-selector attempts.\n *\n * Idempotent — guarded by the host id, so multiple call sites cannot produce\n * more than one banner per page.\n *\n * SSR-safe — short-circuits when `document` is undefined.\n *\n * Note: client-side license enforcement is anti-honest-user signaling, not\n * anti-piracy. The cryptographic signature (Ed25519) is what actually prevents\n * forging valid tokens. This banner just makes the licensing problem visible\n * to a legitimate customer whose key needs attention.\n */\nexport function showInvalidLicenseBanner(): void {\n if (typeof document === 'undefined') return;\n if (document.getElementById('p-license-host')) return;\n\n const host = document.createElement('div');\n\n host.id = 'p-license-host';\n host.style.cssText = 'all:initial;position:fixed;bottom:16px;right:16px;z-index:2147483647;pointer-events:none;';\n\n const shadow = host.attachShadow({ mode: 'closed' });\n\n shadow.innerHTML = '<div role=\"alert\" style=\"padding:10px 14px;background:#991b1b;color:#fff;font:600 13px/1.2 system-ui,-apple-system,sans-serif;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,0.2);\">' + 'Invalid PrimeUI License' + '</div>';\n\n document.body.appendChild(host);\n}\n"],"mappings":"AAmBO,SAASA,GAAiC,CAE7C,GADI,OAAO,UAAa,aACpB,SAAS,eAAe,gBAAgB,EAAG,OAE/C,IAAMC,EAAO,SAAS,cAAc,KAAK,EAEzCA,EAAK,GAAK,iBACVA,EAAK,MAAM,QAAU,4FAErB,IAAMC,EAASD,EAAK,aAAa,CAAE,KAAM,QAAS,CAAC,EAEnDC,EAAO,UAAY,wNAEnB,SAAS,KAAK,YAAYD,CAAI,CAClC","names":["showInvalidLicenseBanner","host","shadow"]}
@@ -1,12 +0,0 @@
1
- import * as _primereact_types_core from '@primereact/types/core';
2
- import { LocaleProps } from '@primereact/types/core';
3
- import * as React from 'react';
4
-
5
- declare const LocaleContext: React.Context<LocaleProps | undefined>;
6
- declare const LocaleProvider: (inProps?: React.PropsWithChildren<LocaleProps>) => React.JSX.Element;
7
-
8
- declare const defaultLocaleProps: LocaleProps;
9
-
10
- declare function useLocale(): _primereact_types_core.LocaleProps;
11
-
12
- export { LocaleContext, LocaleProvider, defaultLocaleProps, useLocale };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/locale/Locale.context.tsx","../../src/locale/Locale.props.ts","../../src/locale/useLocale.ts"],"sourcesContent":["'use client';\nimport { useProps } from '@primereact/hooks';\nimport type { LocaleProps } from '@primereact/types/core';\nimport { resolve } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultLocaleProps } from './Locale.props';\n\nexport const LocaleContext = React.createContext<LocaleProps | undefined>(undefined);\n\nexport const LocaleProvider = (inProps: React.PropsWithChildren<LocaleProps> = {}) => {\n const { attrs } = useProps(defaultLocaleProps as LocaleProps, inProps);\n const value = undefined;\n const resolvedChildren = React.useMemo(() => resolve(attrs.children, value) as React.ReactNode, [attrs.children, value]);\n\n return <LocaleContext.Provider value={value}>{resolvedChildren}</LocaleContext.Provider>;\n};\n","import type { LocaleProps } from '@primereact/types/core';\n\nexport const defaultLocaleProps: LocaleProps = {\n lang: 'en'\n};\n","import * as React from 'react';\nimport { LocaleContext } from './Locale.context';\n\nexport function useLocale() {\n const context = React.useContext(LocaleContext);\n\n if (context === undefined) {\n throw new Error('Context must be used within a LocaleProvider');\n }\n\n return context;\n}\n"],"mappings":"AACA,OAAS,YAAAA,MAAgB,oBAEzB,OAAS,WAAAC,MAAe,kBACxB,UAAYC,MAAW,QCFhB,IAAMC,EAAkC,CAC3C,KAAM,IACV,EDGO,IAAMC,EAAsB,gBAAuC,MAAS,EAEtEC,EAAiB,CAACC,EAAgD,CAAC,IAAM,CAClF,GAAM,CAAE,MAAAC,CAAM,EAAIC,EAASC,EAAmCH,CAAO,EAC/DI,EAAQ,OACRC,EAAyB,UAAQ,IAAMC,EAAQL,EAAM,SAAUG,CAAK,EAAsB,CAACH,EAAM,SAAUG,CAAK,CAAC,EAEvH,OAAO,gBAACN,EAAc,SAAd,CAAuB,MAAOM,GAAQC,CAAiB,CACnE,EEfA,UAAYE,MAAW,QAGhB,SAASC,GAAY,CACxB,IAAMC,EAAgB,aAAWC,CAAa,EAE9C,GAAID,IAAY,OACZ,MAAM,IAAI,MAAM,8CAA8C,EAGlE,OAAOA,CACX","names":["useProps","resolve","React","defaultLocaleProps","LocaleContext","LocaleProvider","inProps","attrs","useProps","defaultLocaleProps","value","resolvedChildren","resolve","React","useLocale","context","LocaleContext"]}
@@ -1,42 +0,0 @@
1
- import * as _primereact_types_primitive_motion from '@primereact/types/primitive/motion';
2
- import { MotionInstance, MotionProps } from '@primereact/types/primitive/motion';
3
- import * as _primereact_types_index from '@primereact/types/index';
4
- import * as _primereact_types_core from '@primereact/types/core';
5
- import * as React$1 from 'react';
6
- import { UseMotionProps } from '@primereact/types/headless/motion';
7
- import { MotionOptions, MotionInstance as MotionInstance$1 } from '@primeuix/motion';
8
-
9
- declare const Motion: (<I extends _primereact_types_core.ComponentInstance, T extends React$1.ElementType>(inProps?: (_primereact_types_core.GlobalComponentProps<I, unknown, T, unknown, unknown> & {} & {} & Omit<_primereact_types_index.ExtractProps<T>, keyof _primereact_types_core.GlobalComponentProps<I_1, P, T_1, unknown, unknown>> & _primereact_types_primitive_motion.MotionProps) | undefined) => React$1.JSX.Element | null) & Record<string, unknown> & React$1.FC<{}>;
10
-
11
- declare const MotionProvider: ({ value, children }: {
12
- value: MotionInstance;
13
- children: React.ReactNode;
14
- }) => React$1.JSX.Element;
15
- declare const useMotionContext: () => MotionInstance | undefined;
16
-
17
- declare const defaultMotionProps: MotionProps;
18
-
19
- declare const DEFAULT_MOTION_OPTIONS: MotionOptions;
20
- /**
21
- * Creates a MotionInstance for the given element with the specified options.
22
- * @param element - The target element for motion effects.
23
- * @param options - Configuration options for the motion instance.
24
- * @returns A MotionInstance that can be used to control the motion.
25
- */
26
- declare function createMotion2(element: Element, options?: MotionOptions): MotionInstance$1;
27
- declare const useMotion: (inProps?: unknown) => _primereact_types_core.HeadlessInstance<UseMotionProps, unknown, {
28
- state: {
29
- rendered: boolean;
30
- };
31
- enter: () => Promise<void | (() => void)> | undefined;
32
- leave: () => Promise<void | (() => void)> | undefined;
33
- cancel: () => void | undefined;
34
- update: (element?: Element, motionProps?: UseMotionProps) => void;
35
- rootProps: {
36
- style?: React$1.CSSProperties;
37
- };
38
- }>;
39
-
40
- declare const defaultUseMotionProps: UseMotionProps;
41
-
42
- export { DEFAULT_MOTION_OPTIONS, Motion, MotionProvider, createMotion2, defaultMotionProps, defaultUseMotionProps, useMotion, useMotionContext };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/motion/Motion.tsx","../../src/motion/Motion.context.ts","../../src/motion/useMotion.props.ts","../../src/motion/Motion.props.ts","../../src/motion/useMotion.ts","../../src/motion/Motion.utils.ts"],"sourcesContent":["'use client';\nimport { Component, withComponent } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport * as React from 'react';\nimport { MotionProvider } from './Motion.context';\nimport { defaultMotionProps } from './Motion.props';\nimport { useMotion } from './useMotion';\n\nexport const Motion = withComponent({\n name: 'Motion',\n defaultProps: defaultMotionProps,\n setup(instance) {\n const motion = useMotion(instance.inProps);\n\n return motion;\n },\n render(instance) {\n const { id, props, state, ptmi, rootProps: headlessRootProps } = instance;\n\n const rootProps = mergeProps(\n {\n id\n },\n ptmi('root'),\n headlessRootProps\n );\n\n return (\n <MotionProvider value={instance}>\n <Component pIf={state.rendered} instance={instance} attrs={rootProps} children={props.children} />\n </MotionProvider>\n );\n }\n});\n","'use client';\nimport { createOptionalContext } from '@primereact/core/utils';\nimport type { MotionInstance } from '@primereact/types/primitive/motion';\n\nexport const [MotionProvider, useMotionContext] = createOptionalContext<MotionInstance>();\n","import type { UseMotionProps } from '@primereact/types/headless/motion';\n\nexport const defaultUseMotionProps: UseMotionProps = {\n elementRef: undefined,\n visible: false,\n mountOnEnter: true,\n unmountOnLeave: true,\n name: undefined,\n type: undefined,\n safe: false,\n disabled: false,\n appear: false,\n enter: true,\n leave: true,\n duration: undefined,\n hideStrategy: 'display',\n cssVarPrefix: undefined,\n enterFromClassName: undefined,\n enterToClassName: undefined,\n enterActiveClassName: undefined,\n leaveFromClassName: undefined,\n leaveToClassName: undefined,\n leaveActiveClassName: undefined,\n onBeforeEnter: undefined,\n onEnter: undefined,\n onAfterEnter: undefined,\n onEnterCancelled: undefined,\n onBeforeLeave: undefined,\n onLeave: undefined,\n onAfterLeave: undefined,\n onLeaveCancelled: undefined\n};\n","import type { MotionProps } from '@primereact/types/primitive/motion';\nimport * as HeadlessMotion from './useMotion.props';\n\nexport const defaultMotionProps: MotionProps = {\n ...HeadlessMotion.defaultUseMotionProps,\n as: 'div'\n};\n","import { withHeadless } from '@primereact/core/headless';\nimport { UseMotionProps } from '@primereact/types/headless/motion';\nimport { nextFrame, toElement } from '@primeuix/utils';\nimport * as React from 'react';\nimport { applyHiddenStyles, getHiddenStyle, resetStyles } from './Motion.utils';\nimport { defaultUseMotionProps } from './useMotion.props';\n\nconst EMPTY_ROOT_PROPS: { style?: React.CSSProperties } = Object.freeze({});\n\nimport type { MotionClassNamesWithPhase, MotionHooksWithPhase, MotionInstance, MotionOptions, MotionPhase, MotionType } from '@primeuix/motion';\nimport {\n getMotionHooks,\n getMotionMetadata,\n mergeOptions,\n removeMotionPhase,\n removeMotionState,\n resolveClassNames,\n resolveCSSVarName,\n resolveDuration,\n setAutoDimensionVariables,\n setDimensionVariables,\n setMotionPhase,\n setMotionState,\n shouldSkipMotion\n} from '@primeuix/motion';\nimport { addClass, removeClass } from '@primeuix/utils';\n\nexport const DEFAULT_MOTION_OPTIONS: MotionOptions = {\n name: 'p',\n safe: true,\n disabled: false,\n enter: true,\n leave: true,\n autoHeight: true,\n autoWidth: false\n};\n\n/**\n * Creates a MotionInstance for the given element with the specified options.\n * @param element - The target element for motion effects.\n * @param options - Configuration options for the motion instance.\n * @returns A MotionInstance that can be used to control the motion.\n */\nexport function createMotion2(element: Element, options?: MotionOptions): MotionInstance {\n if (!element) throw new Error('Element is required.');\n\n const opts: MotionOptions = {};\n let skipMotion = false;\n let classNames: MotionClassNamesWithPhase = {} as MotionClassNamesWithPhase;\n let cancelCurrent: (() => void) | null = null;\n let hooks: MotionHooksWithPhase = {};\n\n const init = (newOpts?: MotionOptions) => {\n Object.assign(opts, mergeOptions(newOpts, DEFAULT_MOTION_OPTIONS));\n if (!opts.enter && !opts.leave) throw new Error('Enter or leave must be true.');\n\n hooks = getMotionHooks(opts);\n skipMotion = shouldSkipMotion(opts);\n classNames = resolveClassNames(opts);\n cancelCurrent = null;\n };\n\n const run = async (phase: MotionPhase): Promise<void> => {\n cancelCurrent?.();\n\n const { onBefore, onStart, onAfter, onCancelled } = hooks[phase] || {};\n const event = { element };\n\n setMotionPhase(element as HTMLElement, phase);\n\n if (skipMotion) {\n onBefore?.(event);\n onStart?.(event);\n onAfter?.(event);\n\n removeMotionPhase(element as HTMLElement);\n\n return;\n }\n\n const { from: fromClass, active: activeClass, to: toClass } = classNames[phase] || {};\n\n onBefore?.(event);\n\n // Set initial dimension variables: enter starts at 0, leave starts at current size\n if (phase === 'enter') {\n setDimensionVariables(element as HTMLElement, opts, '0px');\n } else {\n setAutoDimensionVariables(element as HTMLElement, opts);\n }\n\n addClass(element, fromClass);\n addClass(element, activeClass);\n setMotionState(element as HTMLElement, phase, 'from');\n\n await nextFrame();\n\n // Set target dimension variables: enter goes to auto, leave goes to 0\n if (phase === 'enter') {\n setAutoDimensionVariables(element as HTMLElement, opts);\n } else {\n setDimensionVariables(element as HTMLElement, opts, '0px');\n }\n\n removeClass(element, fromClass);\n addClass(element, toClass);\n setMotionState(element as HTMLElement, phase, 'to');\n onStart?.(event);\n\n return new Promise((resolve) => {\n const duration = resolveDuration(opts.duration, phase);\n\n const cleanup = () => {\n removeClass(element, [toClass, activeClass]);\n cancelCurrent = null;\n removeMotionState(element as HTMLElement);\n removeMotionPhase(element as HTMLElement);\n };\n\n const onDone = () => {\n cleanup();\n onAfter?.(event);\n resolve();\n\n // After enter: set to auto so content can resize naturally\n if (phase === 'enter') {\n setDimensionVariables(element as HTMLElement, opts, 'auto');\n }\n };\n\n cancelCurrent = () => {\n cleanup();\n onCancelled?.(event);\n resolve();\n };\n\n whenEnd(element, opts.type, duration, onDone);\n });\n };\n\n init(options);\n\n const instance: MotionInstance = {\n enter: () => {\n if (!opts.enter) return Promise.resolve();\n\n return run('enter');\n },\n leave: () => {\n if (!opts.leave) return Promise.resolve();\n\n return run('leave');\n },\n cancel: () => {\n cancelCurrent?.();\n cancelCurrent = null;\n },\n update: (newElement?: Element, newOptions?: MotionOptions) => {\n if (!newElement) throw new Error('Element is required.');\n\n element = newElement as HTMLElement;\n instance.cancel();\n init(newOptions);\n }\n };\n\n if (opts.appear) instance.enter();\n\n return instance;\n}\n\nlet endId = 0;\n\n/**\n * Ported from Vue.js Transition Component;\n * @see https://github.com/vuejs/core/blob/main/packages/runtime-dom/src/components/Transition.ts#L348\n *\n * When the transition is triggered, it waits for the end of the motion (transition or animation)\n * @param element - The element to wait for the motion end.\n * @param expectedType - The expected type of motion (transition or animation).\n * @param explicitTimeout - An optional explicit timeout in milliseconds.\n * @param resolve - A function to call when the motion ends.\n * @returns A timeout ID if an explicit timeout is provided, otherwise undefined.\n */\nfunction whenEnd(element: Element & { _motionEndId?: number }, expectedType: MotionType | undefined, explicitTimeout: number | null, resolve: () => void) {\n const id = (element._motionEndId = ++endId);\n\n const resolveIfNotStale = () => {\n if (id === element._motionEndId) {\n resolve();\n }\n };\n\n if (explicitTimeout != null) {\n return setTimeout(resolveIfNotStale, explicitTimeout);\n }\n\n const { type, timeout, count } = getMotionMetadata(element, expectedType);\n\n if (!type) {\n resolve();\n\n return;\n }\n\n const endEvent = type + 'end';\n let ended = 0;\n\n const end = () => {\n element.removeEventListener(endEvent, onEnd, true);\n resolveIfNotStale();\n };\n\n const onEnd = (event: Event) => {\n if (event.target === element && ++ended >= count) {\n end();\n }\n };\n\n element.addEventListener(endEvent, onEnd, { capture: true, once: true });\n setTimeout(() => {\n if (ended < count) {\n end();\n }\n }, timeout + 1);\n}\n\nexport const useMotion = withHeadless({\n name: 'useMotion',\n defaultProps: defaultUseMotionProps,\n setup({ props, elementRef }) {\n const [renderedState, setRenderedState] = React.useState(() => (props.visible && props.mountOnEnter) || !props.mountOnEnter);\n\n const state = {\n rendered: renderedState\n };\n\n // refs\n const motionRef = React.useRef<MotionInstance | undefined>(undefined);\n const isInitialMount = React.useRef(true);\n\n // helpers\n const getElement = React.useCallback(() => toElement(props.elementRef) ?? elementRef?.current, [props.elementRef, elementRef]);\n\n // methods\n const enter = React.useCallback(() => motionRef.current?.enter(), []);\n const leave = React.useCallback(() => motionRef.current?.leave(), []);\n const cancel = React.useCallback(() => motionRef.current?.cancel(), []);\n const update = React.useCallback((element?: Element, motionProps: UseMotionProps = {}) => {\n if (!element) {\n return;\n }\n\n const options: MotionOptions = {\n ...motionProps,\n enterClass: {\n from: motionProps.enterFromClassName,\n to: motionProps.enterToClassName,\n active: motionProps.enterActiveClassName\n },\n leaveClass: {\n from: motionProps.leaveFromClassName,\n to: motionProps.leaveToClassName,\n active: motionProps.leaveActiveClassName\n }\n };\n\n if (!motionRef.current) {\n motionRef.current = createMotion2(element, options);\n } else {\n motionRef.current?.update(element, options);\n }\n }, []);\n\n // effects\n React.useLayoutEffect(() => {\n return () => {\n const element = getElement();\n\n resetStyles(element, props.hideStrategy);\n\n isInitialMount.current = true;\n };\n }, []);\n\n React.useLayoutEffect(() => {\n if (props.visible && !renderedState) {\n setRenderedState(true);\n }\n }, [props.visible]);\n\n React.useLayoutEffect(() => {\n const element = getElement();\n\n update?.(element, props);\n }, []);\n\n React.useLayoutEffect(() => {\n const element = getElement();\n\n if (!element || !renderedState) {\n if (element && !props.visible) {\n applyHiddenStyles(element, props.hideStrategy);\n }\n\n isInitialMount.current = false;\n\n return;\n }\n\n let cancelled = false;\n const shouldAppear = isInitialMount.current && props.visible && props.appear;\n\n resetStyles(element, props.hideStrategy);\n update?.(element, props);\n\n if (props.visible) {\n if (shouldAppear || !isInitialMount.current) {\n enter?.();\n } else if (props.cssVarPrefix) {\n // Initial mount with visible=true and no appear animation.\n // createMotion sets CSS vars to 0px, so we need to override them to auto\n // to ensure the content is visible immediately.\n const widthVar = resolveCSSVarName(props.cssVarPrefix, 'width');\n const heightVar = resolveCSSVarName(props.cssVarPrefix, 'height');\n\n element.style.setProperty(widthVar, 'auto');\n element.style.setProperty(heightVar, 'auto');\n }\n } else {\n leave?.()?.then(() => {\n if (!element || cancelled || props.visible) return;\n\n if (props.unmountOnLeave) {\n applyHiddenStyles(element, props.hideStrategy);\n nextFrame().then(() => {\n if (!cancelled) setRenderedState(false);\n });\n } else {\n applyHiddenStyles(element, props.hideStrategy);\n }\n });\n }\n\n isInitialMount.current = false;\n\n return () => {\n cancelled = true;\n cancel?.();\n };\n }, [props.visible, renderedState, props.unmountOnLeave, props.appear, getElement]);\n\n const rootProps = React.useMemo<{ style?: React.CSSProperties }>(() => {\n if (!props.visible && !renderedState) {\n const widthVar = resolveCSSVarName(props.cssVarPrefix, 'width');\n const heightVar = resolveCSSVarName(props.cssVarPrefix, 'height');\n\n return {\n style: {\n ...getHiddenStyle(props.hideStrategy),\n [widthVar]: '0px',\n [heightVar]: '0px'\n } as React.CSSProperties\n };\n }\n\n return EMPTY_ROOT_PROPS;\n }, [props.visible, renderedState, props.hideStrategy, props.cssVarPrefix]);\n\n return {\n state,\n // methods\n enter,\n leave,\n cancel,\n update,\n // props getters\n rootProps\n };\n }\n});\n","import type * as React from 'react';\n\nconst originalStyles = new WeakMap<HTMLElement, { display?: string; visibility?: string; maxHeight?: string }>();\n\nconst HIDDEN_STYLE_DISPLAY: React.CSSProperties = Object.freeze({ display: 'none' });\nconst HIDDEN_STYLE_VISIBILITY: React.CSSProperties = Object.freeze({ visibility: 'hidden', maxHeight: '0' });\n\nexport function getHiddenStyle(strategy?: 'display' | 'visibility' | 'none'): React.CSSProperties | undefined {\n switch (strategy) {\n case 'display':\n return HIDDEN_STYLE_DISPLAY;\n case 'visibility':\n return HIDDEN_STYLE_VISIBILITY;\n default:\n return undefined;\n }\n}\n\nexport function applyHiddenStyles(element?: HTMLElement, strategy?: 'display' | 'visibility' | 'none') {\n if (!element) return;\n\n if (!originalStyles.has(element)) {\n originalStyles.set(element, {\n display: element.style.display === 'none' ? '' : element.style.display,\n visibility: element.style.visibility === 'hidden' ? '' : element.style.visibility,\n maxHeight: element.style.maxHeight === '0' ? '' : element.style.maxHeight\n });\n }\n\n const hiddenStyle = getHiddenStyle(strategy);\n\n if (hiddenStyle) {\n Object.assign(element.style, hiddenStyle);\n }\n}\n\nexport function resetStyles(element?: HTMLElement, strategy?: 'display' | 'visibility' | 'none') {\n if (!element) return;\n\n const original = originalStyles.get(element);\n\n switch (strategy) {\n case 'display':\n element.style.display = original?.display ?? '';\n break;\n case 'visibility':\n element.style.visibility = original?.visibility ?? '';\n element.style.maxHeight = original?.maxHeight ?? '';\n break;\n }\n\n originalStyles.delete(element);\n}\n"],"mappings":"0nBACA,OAAS,aAAAA,GAAW,iBAAAC,OAAqB,6BACzC,OAAS,cAAAC,OAAkB,kBAC3B,UAAYC,MAAW,QCFvB,OAAS,yBAAAC,MAA6B,yBAG/B,GAAM,CAACC,EAAgBC,EAAgB,EAAIF,EAAsC,ECFjF,IAAMG,EAAwC,CACjD,WAAY,OACZ,QAAS,GACT,aAAc,GACd,eAAgB,GAChB,KAAM,OACN,KAAM,OACN,KAAM,GACN,SAAU,GACV,OAAQ,GACR,MAAO,GACP,MAAO,GACP,SAAU,OACV,aAAc,UACd,aAAc,OACd,mBAAoB,OACpB,iBAAkB,OAClB,qBAAsB,OACtB,mBAAoB,OACpB,iBAAkB,OAClB,qBAAsB,OACtB,cAAe,OACf,QAAS,OACT,aAAc,OACd,iBAAkB,OAClB,cAAe,OACf,QAAS,OACT,aAAc,OACd,iBAAkB,MACtB,EC5BO,IAAMC,EAAkCC,EAAAC,EAAA,GACzBC,GADyB,CAE3C,GAAI,KACR,GCNA,OAAS,gBAAAC,OAAoB,4BAE7B,OAAS,aAAAC,EAAW,aAAAC,OAAiB,kBACrC,UAAYC,MAAW,QCDvB,IAAMC,EAAiB,IAAI,QAErBC,EAA4C,OAAO,OAAO,CAAE,QAAS,MAAO,CAAC,EAC7EC,GAA+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,aAAcA,EAAM,YAAY,CAAC,EAEzE,MAAO,CACH,MAAAI,EAEA,MAAAM,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EAEA,UAAAW,CACJ,CACJ,CACJ,CAAC,EJpXM,IAAME,GAASC,GAAc,CAChC,KAAM,SACN,aAAcC,EACd,MAAMC,EAAU,CAGZ,OAFeC,EAAUD,EAAS,OAAO,CAG7C,EACA,OAAOA,EAAU,CACb,GAAM,CAAE,GAAAE,EAAI,MAAAC,EAAO,MAAAC,EAAO,KAAAC,EAAM,UAAWC,CAAkB,EAAIN,EAE3DO,EAAYC,GACd,CACI,GAAAN,CACJ,EACAG,EAAK,MAAM,EACXC,CACJ,EAEA,OACI,gBAACG,EAAA,CAAe,MAAOT,GACnB,gBAACU,GAAA,CAAU,IAAKN,EAAM,SAAU,SAAUJ,EAAU,MAAOO,EAAW,SAAUJ,EAAM,SAAU,CACpG,CAER,CACJ,CAAC","names":["Component","withComponent","mergeProps","React","createOptionalContext","MotionProvider","useMotionContext","defaultUseMotionProps","defaultMotionProps","__spreadProps","__spreadValues","defaultUseMotionProps","withHeadless","nextFrame","toElement","React","originalStyles","HIDDEN_STYLE_DISPLAY","HIDDEN_STYLE_VISIBILITY","getHiddenStyle","strategy","applyHiddenStyles","element","hiddenStyle","resetStyles","_a","_b","_c","original","getMotionHooks","getMotionMetadata","mergeOptions","removeMotionPhase","removeMotionState","resolveClassNames","resolveCSSVarName","resolveDuration","setAutoDimensionVariables","setDimensionVariables","setMotionPhase","setMotionState","shouldSkipMotion","addClass","removeClass","EMPTY_ROOT_PROPS","DEFAULT_MOTION_OPTIONS","createMotion2","element","options","opts","skipMotion","classNames","cancelCurrent","hooks","init","newOpts","mergeOptions","getMotionHooks","shouldSkipMotion","resolveClassNames","run","phase","__async","onBefore","onStart","onAfter","onCancelled","event","setMotionPhase","removeMotionPhase","fromClass","activeClass","toClass","setDimensionVariables","setAutoDimensionVariables","addClass","setMotionState","nextFrame","removeClass","resolve","duration","resolveDuration","cleanup","removeMotionState","onDone","whenEnd","instance","newElement","newOptions","endId","expectedType","explicitTimeout","id","resolveIfNotStale","type","timeout","count","getMotionMetadata","endEvent","ended","end","onEnd","useMotion","withHeadless","defaultUseMotionProps","props","elementRef","renderedState","setRenderedState","state","motionRef","isInitialMount","getElement","_a","toElement","enter","leave","cancel","update","motionProps","__spreadProps","__spreadValues","resetStyles","applyHiddenStyles","cancelled","shouldAppear","widthVar","resolveCSSVarName","heightVar","rootProps","getHiddenStyle","Motion","withComponent","defaultMotionProps","instance","useMotion","id","props","state","ptmi","headlessRootProps","rootProps","mergeProps","MotionProvider","Component"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/overlay-manager/OverlayManager.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport interface OverlayOpenChangeEvent {\n value: boolean | undefined;\n}\n\nexport interface OverlayEntry<P> {\n id: string;\n props: P;\n open: boolean;\n}\n\ntype OverlayItem<P> = OverlayEntry<P>;\n\ninterface OverlaySnapshotEntry {\n id: string;\n open: boolean;\n}\n\ninterface OverlayStore<P> {\n subscribe(listener: () => void): () => void;\n getSnapshot(): OverlayItem<P>[];\n open(id: string, props: P): void;\n close(id?: string): void;\n remove(id: string): void;\n removeAll(): void;\n update(id: string, props: Partial<P>): void;\n getItem(id: string): OverlayItem<P> | undefined;\n isOpen(id: string): boolean;\n isAnyOpen(): boolean;\n}\n\nconst isShallowEqualEntries = (prev: OverlaySnapshotEntry[], next: OverlaySnapshotEntry[]): boolean => {\n if (prev.length !== next.length) return false;\n\n for (let i = 0; i < prev.length; i++) {\n if (prev[i].id !== next[i].id || prev[i].open !== next[i].open) return false;\n }\n\n return true;\n};\n\nfunction createOverlayStore<P>(): OverlayStore<P> {\n const items = new Map<string, OverlayItem<P>>();\n const listeners = new Set<() => void>();\n let snapshot: OverlayItem<P>[] = [];\n let lastEntries: OverlaySnapshotEntry[] = [];\n\n const buildSnapshot = (): boolean => {\n const next = Array.from(items.values());\n const entries = next.map((item) => ({ id: item.id, open: item.open }));\n\n if (isShallowEqualEntries(lastEntries, entries) && next.length === snapshot.length) {\n // Items array updated but identity-stable (same ids + open states + props refs).\n // Still update props references so renders see latest props.\n const propsChanged = next.some((item, i) => item.props !== snapshot[i]?.props);\n\n if (!propsChanged) return false;\n }\n\n snapshot = next;\n lastEntries = entries;\n\n return true;\n };\n\n const emit = () => {\n if (buildSnapshot()) {\n listeners.forEach((l) => l());\n }\n };\n\n return {\n subscribe(listener) {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n },\n getSnapshot() {\n return snapshot;\n },\n open(id, props) {\n items.set(id, { id, props, open: true });\n emit();\n },\n close(id) {\n if (id === undefined) {\n let changed = false;\n\n items.forEach((item, key) => {\n if (item.open) {\n items.set(key, { ...item, open: false });\n changed = true;\n }\n });\n\n if (changed) emit();\n\n return;\n }\n\n const item = items.get(id);\n\n if (!item?.open) return;\n\n items.set(id, { ...item, open: false });\n emit();\n },\n remove(id) {\n if (items.delete(id)) emit();\n },\n removeAll() {\n if (items.size === 0) return;\n\n items.clear();\n emit();\n },\n update(id, props) {\n const item = items.get(id);\n\n if (!item) return;\n\n items.set(id, { ...item, props: { ...item.props, ...props } });\n emit();\n },\n getItem(id) {\n return items.get(id);\n },\n isOpen(id) {\n return items.get(id)?.open ?? false;\n },\n isAnyOpen() {\n for (const item of items.values()) if (item.open) return true;\n\n return false;\n }\n };\n}\n\n/**\n * Props the manager injects into every overlay's prop bag. Spread these onto the overlay's\n * root component (e.g. `<Dialog.Root {...rest}>`) — the manager owns open state and lifecycle,\n * so the render function should not wire any of these manually.\n */\nexport interface OverlayInjectedProps {\n /** Stable id of the overlay entry. */\n overlayId: string;\n /** Whether the overlay should currently be open. The manager owns this value. */\n open: boolean;\n /** Fired by the overlay when its open state changes. The manager listens for `value: false` to begin closing the entry. */\n onOpenChange: (event: OverlayOpenChangeEvent) => void;\n /** Fired by the overlay once its leave transition completes. The manager removes the entry from the store. */\n onExitComplete: () => void;\n}\n\n/** Render function passed to `createOverlayManager`. */\nexport type OverlayRenderFn<P> = (props: P & OverlayInjectedProps) => React.ReactNode;\n\n/** Options for `createOverlayManager`. */\nexport interface OverlayManagerOptions<P> {\n /** Default props merged under every entry's caller-supplied props. */\n props?: Partial<P>;\n}\n\n/** Public instance returned from `createOverlayManager`. */\nexport interface OverlayManagerInstance<P> {\n /** Opens (or replaces) the overlay entry under `id`. */\n open: (id: string, props: P) => void;\n /**\n * Begins closing the entry (sets injected `open` to false). The entry is not removed until\n * the overlay's exit transition completes — this lets exit animations finish. Pass no `id`\n * to close every open entry.\n */\n close: (id?: string) => void;\n /**\n * Updates the props of an existing overlay entry. Manager-owned keys (`open`, `onOpenChange`,\n * `onExitComplete`, `overlayId`) are stripped to prevent accidental clobbering.\n */\n update: (id: string, props: Partial<P>) => void;\n /** Removes an entry immediately, skipping the exit animation. */\n remove: (id: string) => void;\n /** Removes every entry immediately. */\n removeAll: () => void;\n /** Whether the entry under `id` is currently open. */\n isOpen: (id: string) => boolean;\n /** Whether any entry is currently open. */\n isAnyOpen: () => boolean;\n /** Returns the user-supplied props for the entry under `id`, or undefined if not found. */\n get: (id: string) => P | undefined;\n /** Returns a snapshot of all current entries (id, open, props). */\n getSnapshot: () => readonly OverlayEntry<P>[];\n /** Replaces the render function. Useful for HMR or per-route render swaps. */\n setRender: (render: OverlayRenderFn<P>) => void;\n /** Renderer component. Mount as `<instance.Viewport />` once in the layout. */\n Viewport: React.ComponentType;\n}\n\ninterface OverlayItemRendererProps<P> {\n item: OverlayItem<P>;\n store: OverlayStore<P>;\n render: { current: OverlayRenderFn<P> };\n defaults: { current: Partial<P> | undefined };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction OverlayItemRenderer<P extends Record<string, any>>({ item, store, render, defaults }: OverlayItemRendererProps<P>) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n const onOpenChange = React.useCallback(\n (event: OverlayOpenChangeEvent) => {\n if (!event.value) store.close(item.id);\n },\n [item.id, store]\n );\n\n const onExitComplete = React.useCallback(() => {\n store.remove(item.id);\n }, [item.id, store]);\n\n return (\n <>\n {render.current({\n ...(defaults.current as P | undefined),\n ...item.props,\n overlayId: item.id,\n open: mounted ? item.open : false,\n onOpenChange,\n onExitComplete\n } as P & OverlayInjectedProps)}\n </>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst buildRenderComponent = <P extends Record<string, any>>(store: OverlayStore<P>, renderHolder: { current: OverlayRenderFn<P> }, defaultsHolder: { current: Partial<P> | undefined }): React.ComponentType => {\n const OverlayManagerRender: React.FC = () => {\n const items = React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);\n\n return (\n <>\n {items.map((item) => (\n <OverlayItemRenderer key={item.id} item={item} store={store} render={renderHolder} defaults={defaultsHolder} />\n ))}\n </>\n );\n };\n\n OverlayManagerRender.displayName = 'OverlayManagerRender';\n\n return OverlayManagerRender;\n};\n\nconst RESERVED_KEYS = ['open', 'onOpenChange', 'onExitComplete', 'overlayId'] as const;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyProps = Record<string, any>;\n\nfunction stripReservedKeys<P extends AnyProps>(props: Partial<P>): Partial<P> {\n const next = { ...props } as AnyProps;\n\n for (const key of RESERVED_KEYS) delete next[key];\n\n return next as Partial<P>;\n}\n\n/**\n * Creates an overlay manager. Mount `<instance.Viewport />` once in the layout, then call\n * `instance.open(id, props)` from anywhere to drive overlays imperatively.\n *\n * @example\n * ```tsx\n * const dialog = createOverlayManager<{ title: string }>(\n * ({ title, ...rest }) => <Dialog.Root {...rest}>{title}</Dialog.Root>\n * );\n *\n * // Layout\n * <dialog.Viewport />\n *\n * // Anywhere\n * dialog.open('greeting', { title: 'Hi' });\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createOverlayManager<P extends Record<string, any> = Record<string, never>>(render: OverlayRenderFn<P>, options: OverlayManagerOptions<P> = {}): OverlayManagerInstance<P> {\n const store = createOverlayStore<P>();\n const renderHolder = { current: render };\n const defaultsHolder = { current: options.props };\n const Viewport = buildRenderComponent(store, renderHolder, defaultsHolder);\n\n return {\n open: store.open,\n close: store.close,\n remove: store.remove,\n removeAll: store.removeAll,\n update: (id, props) => store.update(id, stripReservedKeys(props)),\n isOpen: store.isOpen,\n isAnyOpen: store.isAnyOpen,\n get: (id) => store.getItem(id)?.props,\n getSnapshot: store.getSnapshot,\n setRender: (next) => {\n renderHolder.current = next;\n },\n Viewport\n };\n}\n"],"mappings":"6aAAA,UAAYA,MAAW,QAgCvB,IAAMC,EAAwB,CAACC,EAA8BC,IAA0C,CACnG,GAAID,EAAK,SAAWC,EAAK,OAAQ,MAAO,GAExC,QAASC,EAAI,EAAGA,EAAIF,EAAK,OAAQE,IAC7B,GAAIF,EAAKE,CAAC,EAAE,KAAOD,EAAKC,CAAC,EAAE,IAAMF,EAAKE,CAAC,EAAE,OAASD,EAAKC,CAAC,EAAE,KAAM,MAAO,GAG3E,MAAO,EACX,EAEA,SAASC,GAAyC,CAC9C,IAAMC,EAAQ,IAAI,IACZC,EAAY,IAAI,IAClBC,EAA6B,CAAC,EAC9BC,EAAsC,CAAC,EAErCC,EAAgB,IAAe,CACjC,IAAMP,EAAO,MAAM,KAAKG,EAAM,OAAO,CAAC,EAChCK,EAAUR,EAAK,IAAKS,IAAU,CAAE,GAAIA,EAAK,GAAI,KAAMA,EAAK,IAAK,EAAE,EAErE,OAAIX,EAAsBQ,EAAaE,CAAO,GAAKR,EAAK,SAAWK,EAAS,QAKpE,CAFiBL,EAAK,KAAK,CAACS,EAAMR,IAAG,CAvDrD,IAAAS,EAuDwD,OAAAD,EAAK,UAAUC,EAAAL,EAASJ,CAAC,IAAV,YAAAS,EAAa,OAAK,EAEnD,IAG9BL,EAAWL,EACXM,EAAcE,EAEP,GACX,EAEMG,EAAO,IAAM,CACXJ,EAAc,GACdH,EAAU,QAASQ,GAAMA,EAAE,CAAC,CAEpC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A4Bc,EAAoC,CAAC,EAA8B,CACvL,IAAMf,EAAQpB,EAAsB,EAC9B6B,EAAe,CAAE,QAASR,CAAO,EACjCS,EAAiB,CAAE,QAASK,EAAQ,KAAM,EAC1CC,EAAWR,EAAqBR,EAAOS,EAAcC,CAAc,EAEzE,MAAO,CACH,KAAMV,EAAM,KACZ,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,UAAWA,EAAM,UACjB,OAAQ,CAACR,EAAIC,IAAUO,EAAM,OAAOR,EAAIqB,EAAkBpB,CAAK,CAAC,EAChE,OAAQO,EAAM,OACd,UAAWA,EAAM,UACjB,IAAMR,GAAI,CA/SlB,IAAAJ,EA+SqB,OAAAA,EAAAY,EAAM,QAAQR,CAAE,IAAhB,YAAAJ,EAAmB,OAChC,YAAaY,EAAM,YACnB,UAAYtB,GAAS,CACjB+B,EAAa,QAAU/B,CAC3B,EACA,SAAAsC,CACJ,CACJ","names":["React","isShallowEqualEntries","prev","next","i","createOverlayStore","items","listeners","snapshot","lastEntries","buildSnapshot","entries","item","_a","emit","l","listener","id","props","changed","key","__spreadProps","__spreadValues","_b","OverlayItemRenderer","store","render","defaults","mounted","setMounted","onOpenChange","event","onExitComplete","buildRenderComponent","renderHolder","defaultsHolder","OverlayManagerRender","RESERVED_KEYS","stripReservedKeys","createOverlayManager","options","Viewport"]}
@@ -1,12 +0,0 @@
1
- import * as _primereact_types_core from '@primereact/types/core';
2
- import { PassThroughProps } from '@primereact/types/core';
3
- import * as React from 'react';
4
-
5
- declare const PassThroughContext: React.Context<PassThroughProps | undefined>;
6
- declare const PassThroughProvider: (inProps?: React.PropsWithChildren<PassThroughProps>) => React.JSX.Element;
7
-
8
- declare const defaultPTProps: PassThroughProps;
9
-
10
- declare function usePassThrough(): _primereact_types_core.PassThroughProps;
11
-
12
- export { PassThroughContext, PassThroughProvider, defaultPTProps, usePassThrough };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/passthrough/PassThrough.context.tsx","../../src/passthrough/PassThrough.props.ts","../../src/passthrough/usePassThrough.ts"],"sourcesContent":["'use client';\nimport { useProps } from '@primereact/hooks';\nimport type { PassThroughProps } from '@primereact/types/core';\nimport { resolve } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultPTProps } from './PassThrough.props';\n\nexport const PassThroughContext = React.createContext<PassThroughProps | undefined>(undefined);\n\nexport const PassThroughProvider = (inProps: React.PropsWithChildren<PassThroughProps> = {}) => {\n const { props, attrs } = useProps(defaultPTProps as PassThroughProps, inProps);\n const { value, mergeProps, mergeSections } = props;\n\n const pt = React.useMemo(\n () => ({\n value,\n options: {\n mergeProps,\n mergeSections\n }\n }),\n [value, mergeProps, mergeSections]\n );\n\n const resolvedChildren = React.useMemo(() => resolve(attrs.children, pt) as React.ReactNode, [attrs.children, pt]);\n\n return <PassThroughContext.Provider value={pt}>{resolvedChildren}</PassThroughContext.Provider>;\n};\n","import type { PassThroughProps } from '@primereact/types/core';\n\nexport const defaultPTProps: PassThroughProps = {\n value: undefined,\n mergeProps: false,\n mergeSections: true\n};\n","import * as React from 'react';\nimport { PassThroughContext } from './PassThrough.context';\n\nexport function usePassThrough() {\n const context = React.useContext(PassThroughContext);\n\n if (context === undefined) {\n throw new Error('Context must be used within a PassThroughProvider');\n }\n\n return context;\n}\n"],"mappings":"AACA,OAAS,YAAAA,MAAgB,oBAEzB,OAAS,WAAAC,MAAe,kBACxB,UAAYC,MAAW,QCFhB,IAAMC,EAAmC,CAC5C,MAAO,OACP,WAAY,GACZ,cAAe,EACnB,EDCO,IAAMC,EAA2B,gBAA4C,MAAS,EAEhFC,EAAsB,CAACC,EAAqD,CAAC,IAAM,CAC5F,GAAM,CAAE,MAAAC,EAAO,MAAAC,CAAM,EAAIC,EAASC,EAAoCJ,CAAO,EACvE,CAAE,MAAAK,EAAO,WAAAC,EAAY,cAAAC,CAAc,EAAIN,EAEvCO,EAAW,UACb,KAAO,CACH,MAAAH,EACA,QAAS,CACL,WAAAC,EACA,cAAAC,CACJ,CACJ,GACA,CAACF,EAAOC,EAAYC,CAAa,CACrC,EAEME,EAAyB,UAAQ,IAAMC,EAAQR,EAAM,SAAUM,CAAE,EAAsB,CAACN,EAAM,SAAUM,CAAE,CAAC,EAEjH,OAAO,gBAACV,EAAmB,SAAnB,CAA4B,MAAOU,GAAKC,CAAiB,CACrE,EE3BA,UAAYE,MAAW,QAGhB,SAASC,GAAiB,CAC7B,IAAMC,EAAgB,aAAWC,CAAkB,EAEnD,GAAID,IAAY,OACZ,MAAM,IAAI,MAAM,mDAAmD,EAGvE,OAAOA,CACX","names":["useProps","resolve","React","defaultPTProps","PassThroughContext","PassThroughProvider","inProps","props","attrs","useProps","defaultPTProps","value","mergeProps","mergeSections","pt","resolvedChildren","resolve","React","usePassThrough","context","PassThroughContext"]}
@@ -1,10 +0,0 @@
1
- import { StyleSheet, StyleSheetProps, StyleMeta } from '@primeuix/styled';
2
- import * as React from 'react';
3
-
4
- declare class PrimeReactStyleSheet extends StyleSheet<React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>> {
5
- constructor({ attrs }?: StyleSheetProps);
6
- has(key: string): boolean;
7
- createStyleElement(meta?: StyleMeta): React.JSX.Element | undefined;
8
- }
9
-
10
- export { PrimeReactStyleSheet };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/stylesheet/PrimeReactStyleSheet.tsx"],"sourcesContent":["import { StyleSheet, type StyleMeta, type StyleSheetProps } from '@primeuix/styled';\nimport { isEmpty } from '@primeuix/utils';\nimport * as React from 'react';\n\nexport class PrimeReactStyleSheet extends StyleSheet<React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>> {\n constructor({ attrs }: StyleSheetProps = {}) {\n super({ attrs });\n this._styles.set('layer-order', {});\n }\n has(key: string) {\n if (key === 'layer-order') {\n return this._styles.get(key)?.css !== undefined;\n }\n\n return this._styles.has(key);\n }\n createStyleElement(meta: StyleMeta = {}) {\n const { css, attrs, name } = meta;\n\n if (isEmpty(name)) return undefined;\n\n return (\n <style {...attrs} data-primereact-style-id={name} key={name}>\n {css}\n </style>\n );\n }\n}\n"],"mappings":"6aAAA,OAAS,cAAAA,MAAwD,mBACjE,OAAS,WAAAC,MAAe,kBACxB,UAAYC,MAAW,QAEhB,IAAMC,EAAN,cAAmCC,CAAmG,CACzI,YAAY,CAAE,MAAAC,CAAM,EAAqB,CAAC,EAAG,CACzC,MAAM,CAAE,MAAAA,CAAM,CAAC,EACf,KAAK,QAAQ,IAAI,cAAe,CAAC,CAAC,CACtC,CACA,IAAIC,EAAa,CATrB,IAAAC,EAUQ,OAAID,IAAQ,gBACDC,EAAA,KAAK,QAAQ,IAAID,CAAG,IAApB,YAAAC,EAAuB,OAAQ,OAGnC,KAAK,QAAQ,IAAID,CAAG,CAC/B,CACA,mBAAmBE,EAAkB,CAAC,EAAG,CACrC,GAAM,CAAE,IAAAC,EAAK,MAAAJ,EAAO,KAAAK,CAAK,EAAIF,EAE7B,GAAI,CAAAG,EAAQD,CAAI,EAEhB,OACI,gBAAC,QAAAE,EAAAC,EAAA,GAAUR,GAAV,CAAiB,2BAA0BK,EAAM,IAAKA,IAClDD,CACL,CAER,CACJ","names":["StyleSheet","isEmpty","React","PrimeReactStyleSheet","StyleSheet","attrs","key","_a","meta","css","name","isEmpty","__spreadProps","__spreadValues"]}
package/theme/index.d.mts DELETED
@@ -1,12 +0,0 @@
1
- import * as _primereact_types_core from '@primereact/types/core';
2
- import { ThemeProps } from '@primereact/types/core';
3
- import * as React from 'react';
4
-
5
- declare const ThemeContext: React.Context<ThemeProps | null>;
6
- declare const ThemeProvider: (inProps?: ThemeProps) => React.JSX.Element;
7
-
8
- declare const defaultThemeProps: ThemeProps;
9
-
10
- declare function useTheme(): _primereact_types_core.ThemeProps | null;
11
-
12
- export { ThemeContext, ThemeProvider, defaultThemeProps, useTheme };