@primereact/core 11.0.0-alpha.8 → 11.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE.md +45 -0
  2. package/README.md +43 -0
  3. package/base/index.d.mts +1 -1
  4. package/base/index.mjs +1 -1
  5. package/base/index.mjs.map +1 -1
  6. package/component/index.d.mts +11 -9
  7. package/component/index.mjs +1 -1
  8. package/component/index.mjs.map +1 -1
  9. package/config/index.mjs +1 -1
  10. package/config/index.mjs.map +1 -1
  11. package/dnd/index.d.mts +69 -0
  12. package/dnd/index.mjs +2 -0
  13. package/dnd/index.mjs.map +1 -0
  14. package/headless/index.d.mts +1 -1
  15. package/headless/index.mjs +1 -1
  16. package/headless/index.mjs.map +1 -1
  17. package/icon/index.d.mts +3 -3
  18. package/icon/index.mjs +1 -46
  19. package/icon/index.mjs.map +1 -1
  20. package/index.d.mts +3 -0
  21. package/index.mjs +1 -1
  22. package/index.mjs.map +1 -1
  23. package/license/index.d.mts +22 -0
  24. package/license/index.mjs +2 -0
  25. package/license/index.mjs.map +1 -0
  26. package/locale/index.mjs +1 -1
  27. package/locale/index.mjs.map +1 -1
  28. package/motion/index.d.mts +24 -10
  29. package/motion/index.mjs +1 -1
  30. package/motion/index.mjs.map +1 -1
  31. package/overlay-manager/index.d.mts +84 -0
  32. package/overlay-manager/index.mjs +2 -0
  33. package/overlay-manager/index.mjs.map +1 -0
  34. package/package.json +13 -15
  35. package/passthrough/index.mjs +1 -1
  36. package/passthrough/index.mjs.map +1 -1
  37. package/theme/index.mjs +1 -1
  38. package/theme/index.mjs.map +1 -1
  39. package/umd/index.js +7 -212
  40. package/umd/index.js.map +1 -1
  41. package/use-style/index.mjs +1 -1
  42. package/use-style/index.mjs.map +1 -1
  43. package/utils/index.d.mts +73 -4
  44. package/utils/index.mjs +1 -1
  45. package/utils/index.mjs.map +1 -1
  46. package/LICENSE +0 -21
@@ -0,0 +1,69 @@
1
+ import { Point, Rect, UniqueId, DragData, CollisionResult, CreateDndOptions, DndInstance } from '@primereact/types/primitive/dnd';
2
+ export { AutoScrollOptions, CollisionResult, CollisionStrategy, CreateDndOptions, DndAnnouncements, DndEventMap, DndInstance, DndState, DragCancelEvent, DragData, DragEndEvent, DragMoveEvent, DragOperation, DragOverEvent, DragStartEvent, DraggableRegistration, DroppableRegistration, KeyboardSensorOptions, Point, PointerSensorOptions, Rect, SortDirection, SortEvent, SortableContainerRegistration, SortableOperationState, TransferEvent, Transform, UniqueId } from '@primereact/types/primitive/dnd';
3
+
4
+ /**
5
+ * Collision detection strategies for createDnd.
6
+ */
7
+
8
+ interface CollisionInput {
9
+ position: Point;
10
+ activeRect: Rect | null;
11
+ droppables: Array<{
12
+ id: UniqueId;
13
+ rect: Rect;
14
+ data: DragData;
15
+ disabled?: boolean;
16
+ }>;
17
+ }
18
+ /**
19
+ * Returns droppables whose rect contains the pointer.
20
+ * Smallest (innermost) droppable wins for nested scenarios.
21
+ */
22
+ declare function pointerWithin(input: CollisionInput): CollisionResult[];
23
+ /**
24
+ * Returns droppables overlapping the active drag rect, sorted by overlap %.
25
+ */
26
+ declare function rectIntersection(input: CollisionInput): CollisionResult[];
27
+ /**
28
+ * Returns droppables sorted by center-to-center distance (closest first).
29
+ */
30
+ declare function closestCenter(input: CollisionInput): CollisionResult[];
31
+ /**
32
+ * Returns droppables sorted by average corner-to-corner distance (closest first).
33
+ */
34
+ declare function closestCorners(input: CollisionInput): CollisionResult[];
35
+ /** All built-in collision strategies. */
36
+ declare const collisionStrategies: {
37
+ readonly pointerWithin: typeof pointerWithin;
38
+ readonly rectIntersection: typeof rectIntersection;
39
+ readonly closestCenter: typeof closestCenter;
40
+ readonly closestCorners: typeof closestCorners;
41
+ };
42
+
43
+ /**
44
+ * Sortable collision detection and transform computation for createDnd.
45
+ */
46
+
47
+ /** Immutably moves an item within an array. Returns original array if indices are out of bounds. */
48
+ declare function arrayMove<T>(arr: readonly T[], fromIndex: number, toIndex: number): T[];
49
+ /** Immutably transfers an item between two arrays. Returns originals if indices are out of bounds. */
50
+ declare function arrayTransfer<T>(source: readonly T[], target: readonly T[], fromIndex: number, toIndex: number): {
51
+ source: T[];
52
+ target: T[];
53
+ };
54
+
55
+ /**
56
+ * createDnd — Framework-Agnostic Drag & Drop Core
57
+ *
58
+ * Pure JavaScript implementation following the createMotion pattern.
59
+ * Can be wrapped by React, Angular, Vue, Lit, Svelte, Solid etc.
60
+ *
61
+ * - SSR-safe: No DOM access at module level or during creation.
62
+ * - Zero memory leaks: destroy() cleans every listener, timer, observer.
63
+ * - Cross-browser: Uses only standard, well-supported APIs.
64
+ * - Performance: RAF-throttled pointer, zero-reflow scroll pattern, rect caching.
65
+ */
66
+
67
+ declare function createDnd(options?: CreateDndOptions): DndInstance;
68
+
69
+ export { type CollisionInput, arrayMove, arrayTransfer, collisionStrategies, createDnd };
package/dnd/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ var Qe=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var we=Object.getOwnPropertySymbols;var nt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable;var Se=(n,e,a)=>e in n?Qe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a,K=(n,e)=>{for(var a in e||(e={}))nt.call(e,a)&&Se(n,a,e[a]);if(we)for(var a of we(e))ot.call(e,a)&&Se(n,a,e[a]);return n},X=(n,e)=>et(n,tt(e));var Ee={onDragStart:n=>{var e,a;return`Picked up ${(a=(e=n.active.data)==null?void 0:e.label)!=null?a:"item"}. Use Arrow keys to move, Space or Enter to drop, Escape to cancel.`},onDragOver:n=>{var e,a;return n.over?`Over ${(a=(e=n.over.data)==null?void 0:e.label)!=null?a:"drop zone"}.`:"Not over a drop zone."},onDragEnd:n=>{var e,a;return n.cancelled?"Drag cancelled. Item returned to original position.":n.over?`Dropped on ${(a=(e=n.over.data)==null?void 0:e.label)!=null?a:"drop zone"}.`:"Dropped."},onDragCancel:()=>"Drag cancelled. Item returned to original position.",onSortOver:n=>`Moved to position ${n.index+1} of ${n.total}${n.containerId?` in ${String(n.containerId)}`:""}.`};function _(){return typeof window!="undefined"&&typeof document!="undefined"}function te(n){let e=n.getBoundingClientRect();return{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left}}function ge(n,e,a,t){return{x:n,y:e,width:a,height:t,top:e,right:n+a,bottom:e+t,left:n}}function Me(n,e){return ge(n.x-e.x,n.y-e.y,n.width,n.height)}function Z(n,e){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function N(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function se(n,e){return n.x>=e.left&&n.x<=e.right&&n.y>=e.top&&n.y<=e.bottom}function ve(n){return n.width*n.height}function Pe(n,e){let a=Math.max(n.left,e.left),t=Math.max(n.top,e.top),s=Math.min(n.right,e.right)-a,m=Math.min(n.bottom,e.bottom)-t;return s>0&&m>0?s*m:0}function Te(n){if(!_())return null;let e=n.parentElement;for(;e&&e!==document.documentElement;){let a=getComputedStyle(e),t=(a.overflowY==="auto"||a.overflowY==="scroll")&&e.scrollHeight>e.clientHeight,s=(a.overflowX==="auto"||a.overflowX==="scroll")&&e.scrollWidth>e.clientWidth;if(t||s)return e;e=e.parentElement}return document.documentElement.scrollHeight>document.documentElement.clientHeight?document.documentElement:null}function be(n){return n===document.documentElement?{x:window.scrollX,y:window.scrollY}:{x:n.scrollLeft,y:n.scrollTop}}function Ae(n,e,a){n===document.documentElement?window.scrollBy(e,a):n.scrollBy(e,a)}function Ie(n,e){let a=null;return{call(){a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,n()},e)},cancel(){a!==null&&(clearTimeout(a),a=null)}}}function it(n){let e=[];for(let a of n.droppables)if(!a.disabled&&se(n.position,a.rect)){let t=ve(a.rect);t>0&&e.push({id:a.id,data:a.data,ratio:1/t})}return e.sort((a,t)=>{var s,m;return((s=t.ratio)!=null?s:0)-((m=a.ratio)!=null?m:0)}),e}function rt(n){if(!n.activeRect)return[];let e=[];for(let a of n.droppables){if(a.disabled)continue;let t=Pe(n.activeRect,a.rect);if(t>0){let s=ve(a.rect);e.push({id:a.id,data:a.data,ratio:s>0?t/s:0})}}return e.sort((a,t)=>{var s,m;return((s=t.ratio)!=null?s:0)-((m=a.ratio)!=null?m:0)}),e}function at(n){if(!n.activeRect)return[];let e=N(n.activeRect),a=[];for(let t of n.droppables)t.disabled||a.push({id:t.id,data:t.data,distance:Z(e,N(t.rect))});return a.sort((t,s)=>{var m,C;return((m=t.distance)!=null?m:1/0)-((C=s.distance)!=null?C:1/0)}),a}function ct(n){if(!n.activeRect)return[];let e=n.activeRect,a=[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],t=[];for(let s of n.droppables){if(s.disabled)continue;let m=s.rect,C=[{x:m.left,y:m.top},{x:m.right,y:m.top},{x:m.left,y:m.bottom},{x:m.right,y:m.bottom}],g=0;for(let S=0;S<4;S++)g+=Z(a[S],C[S]);t.push({id:s.id,data:s.data,distance:g/4})}return t.sort((s,m)=>{var C,g;return((C=s.distance)!=null?C:1/0)-((g=m.distance)!=null?g:1/0)}),t}var ce={pointerWithin:it,rectIntersection:rt,closestCenter:at,closestCorners:ct};var Ue=.25;function qe(n){let{position:e,items:a,direction:t,activeId:s,allowInsideDrop:m=!1}=n,C={index:0,position:"before",targetId:null,dropPosition:"before",targetRect:null};if(a.length===0)return C;let g=a.filter(x=>x.id!==s);if(g.length===0)return C;let S=0,E=1/0;for(let x=0;x<g.length;x++){let ne=N(g[x].rect),F=t==="horizontal"?Math.abs(e.x-ne.x):t==="vertical"?Math.abs(e.y-ne.y):Z(e,ne);F<E&&(E=F,S=x)}let w=g[S],O=w.rect,v=N(O),U;t==="horizontal"?U=e.x<v.x?"before":"after":t==="vertical"?U=e.y<v.y?"before":"after":U=e.y<v.y?"before":e.y>v.y?"after":e.x<v.x?"before":"after";let z;m?z=lt(e,O,t):z=U;let y=a.findIndex(x=>x.id===w.id);return{index:U==="after"?y+1:y,position:U,targetId:w.id,dropPosition:z,targetRect:O}}function lt(n,e,a){if(a==="horizontal"){let s=e.width*Ue;return n.x<e.left+s?"before":n.x>e.right-s?"after":"inside"}let t=e.height*Ue;return n.y<e.top+t?"before":n.y>e.bottom-t?"after":"inside"}function Le(n){let{items:e,activeId:a,originalIndex:t,projectedIndex:s,activeRect:m,itemRects:C,direction:g}=n,S=new Map;if(!m||t===s)return S;let E=s>t;if(g==="grid")for(let w=0;w<e.length;w++){let O=e[w];if(O===a||!(E?w>t&&w<=s:w>=s&&w<t))continue;let U=E?w-1:w+1;e[U]===a&&(U=E?U-1:U+1);let z=e[U],y=C.get(O),x=z?C.get(z):null;y&&x&&S.set(O,{x:x.x-y.x,y:x.y-y.y,scaleX:1,scaleY:1})}else{let w=g==="horizontal"?m.width:0,O=g==="vertical"?m.height:0;for(let v=0;v<e.length;v++){let U=e[v];if(U===a)continue;let z=0,y=0;E?v>t&&v<=s&&(z=-w,y=-O):v>=s&&v<t&&(z=w,y=O),(z!==0||y!==0)&&S.set(U,{x:z,y,scaleX:1,scaleY:1})}}return S}function ke(n){let{sourceItems:e,targetItems:a,activeId:t,originalIndex:s,projectedIndex:m,activeRect:C,sourceDirection:g,targetDirection:S}=n,E=new Map,w=new Map;if(!C)return{sourceTransforms:E,targetTransforms:w};let O=g==="horizontal"?C.width:0,v=g==="vertical"||g==="grid"?C.height:0;for(let y=0;y<e.length;y++)e[y]!==t&&y>s&&E.set(e[y],{x:-O,y:-v,scaleX:1,scaleY:1});let U=S==="horizontal"?C.width:0,z=S==="vertical"||S==="grid"?C.height:0;for(let y=0;y<a.length;y++)y>=m&&w.set(a[y],{x:U,y:z,scaleX:1,scaleY:1});return{sourceTransforms:E,targetTransforms:w}}function Ke(n,e,a){if(e<0||e>=n.length||a<0||a>n.length)return n.slice();let t=n.slice(),[s]=t.splice(e,1);return t.splice(a,0,s),t}function ze(n,e,a,t){if(a<0||a>=n.length||t<0||t>e.length)return{source:n.slice(),target:e.slice()};let s=n.slice(),[m]=s.splice(a,1),C=e.slice();return C.splice(t,0,m),{source:s,target:C}}function st(n){var Re;let e=!1;function a(){if(e)throw new Error("createDnd: instance has been destroyed.")}let t={operation:null,draggables:new Map,droppables:new Map,sortableContainers:new Map,collisions:[],sortable:null},s=new Set,m=!1;function C(){if(!m){m=!0;try{for(let o of s)o()}finally{m=!1}}}function g(o){let i=o(t);i!==t&&(t=i,C())}let S=new Map;function E(o,i){let r=S.get(o);if(r)for(let c of r)c(i)}let w=(Re=n==null?void 0:n.collisionDetection)!=null?Re:"pointerWithin";function O(){var o;return(o=ce[w])!=null?o:ce.pointerWithin}let v=null,U=(n==null?void 0:n.autoScroll)!==!1,z=typeof(n==null?void 0:n.autoScroll)=="object"?n.autoScroll:{},y=null,x={x:0,y:0},ne=K(K({},Ee),n==null?void 0:n.announcements),F=new Map;function de(){if(_()){F.clear();for(let[o,i]of t.draggables)i.node&&F.set(o,te(i.node));for(let[o,i]of t.droppables)i.node&&F.set(o,te(i.node));for(let[o,i]of t.sortableContainers)i.node&&F.set(o,te(i.node))}}function Y(o,i){let r=F.get(o);return r?Me(r,i):null}function ye(){t.operation&&(de(),x={x:0,y:0},le(t.operation.current))}let oe=Ie(ye,50),ue=Ie(ye,100),W=null,J=null,ie=null,re=null;function He(){if(!(!_()||typeof ResizeObserver=="undefined")){W=new ResizeObserver(()=>oe.call());for(let[,o]of t.sortableContainers)o.node&&W.observe(o.node)}}function je(){if(!_())return;let o=()=>ue.call();window.addEventListener("resize",o,{passive:!0}),re=()=>{window.removeEventListener("resize",o),ue.cancel()}}function Oe(){if(!_())return;if(typeof MutationObserver!="undefined"){J=new MutationObserver(()=>oe.call());for(let[,r]of t.sortableContainers)r.node&&J.observe(r.node,{childList:!0})}let o=v!=null?v:window,i=()=>oe.call();o.addEventListener("scroll",i,{passive:!0}),ie=()=>o.removeEventListener("scroll",i)}function xe(){J==null||J.disconnect(),J=null,ie==null||ie(),ie=null,oe.cancel()}function Xe(o){var u;let i=[],r=t.operation;if(!r)return i;let c=t.draggables.get(r.activeId);for(let[l,f]of t.droppables){if(f.disabled)continue;let R=Y(l,o);if(!R)continue;let T=!f.accept||(c==null?void 0:c.scope)!=null&&f.accept.includes(c.scope),H=f.canDrop?f.canDrop(r.data):!0;T&&H&&i.push({id:l,rect:R,data:(u=f.data)!=null?u:{},disabled:!1})}for(let[l,f]of t.sortableContainers){if(f.disabled)continue;let R=Y(l,o);if(!R)continue;(!f.accept||(c==null?void 0:c.scope)!=null&&f.accept.includes(c.scope))&&i.push({id:l,rect:R,data:{},disabled:!1})}return i}function Ye(o,i){if(o.length!==i.length)return!1;for(let r=0;r<o.length;r++)if(o[r].id!==i[r].id)return!1;return!0}function le(o,i){var T,H;let r=t.operation;if(!r)return;let c=i!=null?i:x,u=Xe(c),l=Y(r.activeId,c),f=O()({position:o,activeRect:l,droppables:u});if(!Ye(t.collisions,f)){let q=(T=t.collisions[0])!=null?T:null,b=(H=f[0])!=null?H:null;g(I=>X(K({},I),{collisions:f})),(q==null?void 0:q.id)!==(b==null?void 0:b.id)&&E("dragOver",{active:{id:r.activeId,data:r.data},over:b?{id:b.id,data:b.data}:null})}Be(o,c)}let ae=null;function Ne(o){if(ae){let i=t.sortableContainers.get(ae.containerId);if(i){let r=i.items.indexOf(o);if(r!==-1)return{container:i,index:r}}ae=null}for(let[,i]of t.sortableContainers){let r=i.items.indexOf(o);if(r!==-1)return ae={containerId:i.id,index:r},{container:i,index:r}}return null}function Fe(o,i){if(o.size!==i.size)return!1;for(let[r,c]of o){let u=i.get(r);if(!u||c.x!==u.x||c.y!==u.y)return!1}return!0}function Be(o,i){var d,M,P,D;let r=t.operation;if(!r)return;let c=Ne(r.activeId);if(!c){t.sortable!==null&&g(p=>X(K({},p),{sortable:null}));return}let u=t.draggables.get(r.activeId),l=null;for(let[,p]of t.sortableContainers){let A=Y(p.id,i);if(!A||!se(o,A))continue;if(!p.accept||(u==null?void 0:u.scope)!=null&&p.accept.includes(u.scope)||p.id===c.container.id){l=p;break}}l||(l=c.container);let f=[];for(let p of l.items){let A=Y(p,i);A&&f.push({id:p,rect:A})}let R=qe({position:o,items:f,direction:l.direction,activeId:r.activeId,allowInsideDrop:l.allowInsideDrop}),T=R.index,H=l.id!==c.container.id,q;if(H){let{sourceTransforms:p,targetTransforms:A}=ke({sourceItems:c.container.items,targetItems:l.items,activeId:r.activeId,originalIndex:c.index,projectedIndex:T,activeRect:Y(r.activeId,i),sourceDirection:c.container.direction,targetDirection:l.direction});q=new Map([...p,...A])}else q=Le({items:c.container.items,activeId:r.activeId,originalIndex:c.index,projectedIndex:T,activeRect:Y(r.activeId,i),itemRects:F,direction:c.container.direction});let b=R.targetId!=null?{targetId:R.targetId,position:R.dropPosition,targetRect:R.targetRect}:null,I={sourceContainerId:c.container.id,currentContainerId:l.id,originalIndex:c.index,projectedIndex:T,transforms:q,dropIndicator:b},k=t.sortable;(!k||k.currentContainerId!==I.currentContainerId||k.projectedIndex!==I.projectedIndex||!Fe(k.transforms,I.transforms)||((d=k.dropIndicator)==null?void 0:d.targetId)!==((M=I.dropIndicator)==null?void 0:M.targetId)||((P=k.dropIndicator)==null?void 0:P.position)!==((D=I.dropIndicator)==null?void 0:D.position))&&g(p=>X(K({},p),{sortable:I}))}function We(){if(!(!U||!_())){if(!v){let o=t.draggables.get(t.operation.activeId);o!=null&&o.node&&(v=Te(o.node))}v&&(x={x:0,y:0},De())}}function he(){y!==null&&(cancelAnimationFrame(y),y=null),x={x:0,y:0}}function De(){var T,H,q;let o=t.operation;if(!o||!v)return;let i=(T=z.threshold)!=null?T:50,r=(H=z.speed)!=null?H:15,c=(q=z.direction)!=null?q:"both",u=o.current,l=v===document.documentElement?ge(0,0,window.innerWidth,window.innerHeight):te(v),f=0,R=0;if(c!=="horizontal"){let b=u.y-l.top,I=l.bottom-u.y;b>=0&&b<i?R=-r*(1-b/i):I>=0&&I<i&&(R=r*(1-I/i))}if(c!=="vertical"){let b=u.x-l.left,I=l.right-u.x;b>=0&&b<i?f=-r*(1-b/i):I>=0&&I<i&&(f=r*(1-I/i))}if(f!==0||R!==0){let b=be(v);Ae(v,f,R);let I=be(v),k=I.x-b.x,d=I.y-b.y;(k!==0||d!==0)&&(x={x:x.x+k,y:x.y+d},le(o.current,x))}y=requestAnimationFrame(De)}function fe(o,i){if(a(),t.operation)return;let r=t.draggables.get(i);if(!r||r.disabled)return;let c=K({},r.data),u;if("clientX"in o){let l=o;u={x:l.clientX,y:l.clientY}}else{let l=r.node?te(r.node):null;u=l?N(l):{x:0,y:0}}g(l=>X(K({},l),{operation:{activeId:i,origin:u,current:K({},u),delta:{x:0,y:0},data:c},collisions:[],sortable:null})),de(),Oe(),We(),E("dragStart",{active:{id:i,data:c,node:r.node},event:o}),le(u)}function Q(o,i){var l;a();let r=t.operation;if(!r)return;let c={x:i.x-r.origin.x,y:i.y-r.origin.y};g(f=>X(K({},f),{operation:f.operation?X(K({},f.operation),{current:i,delta:c}):null})),le(i);let u=t.draggables.get(r.activeId);E("dragMove",{active:{id:r.activeId,data:r.data,node:(l=u==null?void 0:u.node)!=null?l:null},position:i,delta:c,event:o})}function pe(o){var u;a();let i=t.operation;if(!i)return;let r=(u=t.collisions[0])!=null?u:null,c=t.sortable;c&&(c.sourceContainerId!==c.currentContainerId?E("transfer",{activeId:i.activeId,from:{containerId:c.sourceContainerId,index:c.originalIndex},to:{containerId:c.currentContainerId,index:c.projectedIndex},event:o}):c.originalIndex!==c.projectedIndex&&E("sort",{containerId:c.sourceContainerId,activeId:i.activeId,fromIndex:c.originalIndex,toIndex:c.projectedIndex,event:o})),E("dragEnd",{active:{id:i.activeId,data:i.data},over:r?{id:r.id,data:r.data}:null,cancelled:!1,event:o}),Ce()}function G(o){a();let i=t.operation;i&&(E("dragCancel",{active:{id:i.activeId,data:i.data},event:o}),E("dragEnd",{active:{id:i.activeId,data:i.data},over:null,cancelled:!0,event:o}),Ce())}function Ce(){he(),xe(),F.clear(),x={x:0,y:0},ae=null,v=null,g(o=>X(K({},o),{operation:null,collisions:[],sortable:null}))}let ee=new Set;function $e(o,i,r){var $,V;if(a(),!_())return()=>{};let c=($=r==null?void 0:r.activationDistance)!=null?$:5,u=(V=r==null?void 0:r.activationDelay)!=null?V:0,l=!1,f=!1,R=null,T=null,H=u===0,q=null,b=null,I=null;function k(){l=!1,f=!1,R=null,H=u===0,T!==null&&(clearTimeout(T),T=null),q!==null&&(cancelAnimationFrame(q),q=null),b=null,I=null,document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",D),document.removeEventListener("pointercancel",p),document.removeEventListener("keydown",A),document.removeEventListener("contextmenu",L)}function d(){b&&I&&f&&(Q(I,b),b=null,I=null),q=null}function M(h){if(h.button!==0||t.operation)return;let B=t.draggables.get(i);if(!(B!=null&&B.disabled)){l=!0,R={x:h.clientX,y:h.clientY},H=u===0;try{o.setPointerCapture(h.pointerId)}catch(me){}u>0&&(T=setTimeout(()=>{H=!0,T=null},u)),document.addEventListener("pointermove",P),document.addEventListener("pointerup",D),document.addEventListener("pointercancel",p),document.addEventListener("keydown",A),document.addEventListener("contextmenu",L)}}function P(h){if(!l&&!f||!R)return;let B={x:h.clientX,y:h.clientY};if(!f){let me=Z(R,B);if(!H){me>c&&k();return}if(me<c)return;f=!0,l=!1,fe(h,i);return}b=B,I=h,q===null&&(q=requestAnimationFrame(d))}function D(h){f&&(b&&Q(h,b),pe(h));try{o.releasePointerCapture(h.pointerId)}catch(B){}k()}function p(h){f&&G(h);try{o.releasePointerCapture(h.pointerId)}catch(B){}k()}function A(h){h.key==="Escape"&&f&&(G(h),k())}function L(h){(f||l)&&h.preventDefault()}o.addEventListener("pointerdown",M);let j=()=>{k(),o.removeEventListener("pointerdown",M),ee.delete(j)};return ee.add(j),j}function _e(o,i,r){var I,k;if(a(),!_())return()=>{};let c=(I=r==null?void 0:r.step)!=null?I:25,u=(k=r==null?void 0:r.fastStep)!=null?k:c*5,l=!1;function f(d){let M=t.draggables.get(i);if(!(M!=null&&M.disabled)){if(!l){(d.key===" "||d.key==="Enter")&&(d.preventDefault(),l=!0,fe(d,i));return}switch(d.preventDefault(),d.key){case"Escape":l=!1,G(d);break;case"Tab":l=!1,G(d);break;case" ":case"Enter":l=!1,pe(d);break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":if(!t.operation)break;if(t.sortable!==null)R(d);else{let P=d.shiftKey?u:c,D=t.operation.current,p={x:D.x,y:D.y};d.key==="ArrowUp"&&(p.y-=P),d.key==="ArrowDown"&&(p.y+=P),d.key==="ArrowLeft"&&(p.x-=P),d.key==="ArrowRight"&&(p.x+=P),Q(d,p)}break;case"Home":case"End":t.sortable&&T(d);break}}}function R(d){if(!t.operation||!t.sortable)return;let{currentContainerId:M,projectedIndex:P}=t.sortable,D=t.sortableContainers.get(M);if(!D)return;let p=D.direction==="vertical"||D.direction==="grid",A=D.direction==="horizontal"||D.direction==="grid",L=P,j=M;if(d.key==="ArrowUp"&&p||d.key==="ArrowLeft"&&A)L>0&&L--;else if(d.key==="ArrowDown"&&p||d.key==="ArrowRight"&&A){let $=D.items.filter(V=>V!==t.operation.activeId).length;L<$&&L++}else if(d.key==="ArrowLeft"||d.key==="ArrowRight"){let $=q(M,d.key==="ArrowRight"?"right":"left");$&&(j=$.id,L=0)}(L!==P||j!==M)&&H(j,L,d)}function T(d){if(!t.operation||!t.sortable)return;let M=t.sortableContainers.get(t.sortable.currentContainerId);if(!M)return;let P=M.items.filter(p=>p!==t.operation.activeId),D=d.key==="Home"?P[0]:P[P.length-1];if(D!=null){let p=Y(D,x);p&&Q(d,N(p))}}function H(d,M,P){let D=t.sortableContainers.get(d);if(!D)return;let p=D.items.filter(L=>L!==t.operation.activeId),A=p[Math.min(M,p.length-1)];if(A!=null){let L=Y(A,x);if(L){Q(P,N(L));let j=t.draggables.get(A);j!=null&&j.node&&j.node.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}}}function q(d,M){let P=Y(d,x);if(!P)return null;let D=N(P),p=null,A=1/0;for(let[L,j]of t.sortableContainers){if(L===d)continue;let $=Y(L,x);if(!$)continue;let V=N($);if(M==="right"&&V.x<=D.x||M==="left"&&V.x>=D.x)continue;let h=t.draggables.get(t.operation.activeId);if(j.accept&&(h==null?void 0:h.scope)!=null&&!j.accept.includes(h.scope))continue;let B=Z(D,V);B<A&&(A=B,p=j)}return p}o.addEventListener("keydown",f);let b=()=>{l&&(l=!1,G()),o.removeEventListener("keydown",f),ee.delete(b)};return ee.add(b),b}function Ve(o){return a(),g(i=>{let r=new Map(i.draggables);return r.set(o.id,o),X(K({},i),{draggables:r})}),()=>{var i;((i=t.operation)==null?void 0:i.activeId)===o.id&&G(),g(r=>{let c=new Map(r.draggables);return c.delete(o.id),X(K({},r),{draggables:c})})}}function Ze(o){return a(),g(i=>{let r=new Map(i.droppables);return r.set(o.id,o),X(K({},i),{droppables:r})}),()=>{g(i=>{let r=new Map(i.droppables);return r.delete(o.id),X(K({},i),{droppables:r})})}}function Ge(o){return a(),g(i=>{let r=new Map(i.sortableContainers);return r.set(o.id,o),X(K({},i),{sortableContainers:r})}),o.node&&W&&W.observe(o.node),()=>{o.node&&W&&W.unobserve(o.node),g(i=>{let r=new Map(i.sortableContainers);return r.delete(o.id),X(K({},i),{sortableContainers:r})})}}function Je(o,i){let r=ne[o];return r?r(i):""}return _()&&(He(),je()),{getState:()=>t,subscribe(o){return a(),s.add(o),()=>{s.delete(o)}},registerDraggable:Ve,registerDroppable:Ze,registerSortableContainer:Ge,startDrag:fe,updateDrag:Q,endDrag:pe,cancelDrag:G,on(o,i){a(),S.has(o)||S.set(o,new Set);let r=S.get(o),c=i;return r.add(c),()=>{r.delete(c)}},attachPointerSensor:$e,attachKeyboardSensor:_e,setScrollableElement(o){v=o},setCollisionDetection(o){w=o},measureRects:de,getAdjustedRect:Y,getAnnouncement:Je,destroy(){if(!e){e=!0,t.operation&&(E("dragCancel",{active:{id:t.operation.activeId,data:t.operation.data}}),E("dragEnd",{active:{id:t.operation.activeId,data:t.operation.data},over:null,cancelled:!0}),he(),xe());for(let o of ee)o();ee.clear(),W==null||W.disconnect(),W=null,re==null||re(),re=null,oe.cancel(),ue.cancel(),S.clear(),s.clear(),F.clear(),t={operation:null,draggables:new Map,droppables:new Map,sortableContainers:new Map,collisions:[],sortable:null}}}}}export{Ke as arrayMove,ze as arrayTransfer,ce as collisionStrategies,st as createDnd};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
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,EAAE,KAAK,OAAP,YAAAC,EAA0B,QAA1B,KAAAC,EAAmC,WAAW,IAAM,yBAE1F,UAAYF,GAAM,CAVtB,IAAAC,EAAAC,EAWQ,OAAIF,EAAE,UAAkB,sDAEpBA,EAAE,KAAa,eAAeE,GAAAD,EAAAD,EAAE,KAAK,OAAP,YAAAC,EAA0B,QAA1B,KAAAC,EAAmC,WAAW,IAEzE,UACX,EAEA,aAAc,IAAM,sDAEpB,WAAaC,GAAS,qBAAqBA,EAAK,MAAQ,CAAC,OAAOA,EAAK,KAAK,GAAGA,EAAK,YAAc,OAAO,OAAOA,EAAK,WAAW,CAAC,GAAK,EAAE,GAC1I,ECbO,SAASC,GAAoB,CAChC,OAAO,OAAO,QAAW,aAAe,OAAO,UAAa,WAChE,CAIO,SAASC,GAAeC,EAAuB,CAClD,IAAMC,EAAID,EAAG,sBAAsB,EAEnC,MAAO,CAAE,EAAGC,EAAE,EAAG,EAAGA,EAAE,EAAG,MAAOA,EAAE,MAAO,OAAQA,EAAE,OAAQ,IAAKA,EAAE,IAAK,MAAOA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E,OAAQ,CAAE,GAAIT,EAAM,UAAU,SAAU,KAAMA,EAAM,UAAU,IAAK,CAAE,CAAC,EAC3FS,EAAK,UAAW,CAAE,OAAQ,CAAE,GAAIT,EAAM,UAAU,SAAU,KAAMA,EAAM,UAAU,IAAK,EAAG,KAAM,KAAM,UAAW,EAAK,CAAC,EACrHsG,GAAe,EACftD,GAAsB,GAI1B,QAAW5C,KAAM+H,GAAgB/H,EAAG,EACpC+H,GAAe,MAAM,EAGrB5F,GAAA,MAAAA,EAAW,aACXA,EAAY,KACZG,IAAA,MAAAA,KACAA,GAAsB,KACtBN,GAAmB,OAAO,EAC1BE,GAAsB,OAAO,EAG7B9B,EAAc,MAAM,EACpBP,EAAY,MAAM,EAGlBuB,EAAU,MAAM,EAGhBxB,EAAQ,CACJ,UAAW,KACX,WAAY,IAAI,IAChB,WAAY,IAAI,IAChB,mBAAoB,IAAI,IACxB,WAAY,CAAC,EACb,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"]}
@@ -23,6 +23,6 @@ declare function useHeadless<IProps, DProps, Exposes extends Record<PropertyKey,
23
23
  * @param options.setup The setup function for the headless component.
24
24
  * @returns A function that takes in props and returns the headless instance.
25
25
  */
26
- declare function withHeadless<IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>({ name, defaultProps, setup }: withHeadlessOptions<IProps, DProps, Exposes>): (inProps?: IProps) => _primereact_types_core.HeadlessInstance<DProps, IProps, Exposes>;
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
27
 
28
28
  export { useHeadless, withHeadless };
@@ -1,2 +1,2 @@
1
- import{useBase as t}from"@primereact/core/base";function r(e="UnknownHeadless",s={}){return t(e,s)}function d({name:e,defaultProps:s,setup:o}){return p=>r(e,{inProps:p,defaultProps:s,setup:o})}export{r as useHeadless,d as withHeadless};
1
+ import{useBase as n}from"@primereact/core/base";function r(e="UnknownHeadless",s={}){return n(e,s)}function P({name:e,type:s="headless",defaultProps:o,setup:p}){return t=>r(e,{type:s,inProps:t,defaultProps:o,setup:p})}export{r as useHeadless,P as withHeadless};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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, defaultProps, setup }: withHeadlessOptions<IProps, DProps, Exposes>) {\n return (inProps?: IProps) => {\n return useHeadless(name, { 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,aAAAC,EAAc,MAAAC,CAAM,EAAiD,CACnM,OAAQC,GACGC,EAAYJ,EAAM,CAAE,QAAAG,EAAS,aAAAF,EAAc,MAAAC,CAAM,CAAC,CAEjE","names":["useBase","useHeadless","name","options","withHeadless","name","defaultProps","setup","inProps","useHeadless"]}
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 CHANGED
@@ -1,10 +1,10 @@
1
- import * as _primereact_types_shared from '@primereact/types/shared';
1
+ import * as _primereact_types_index from '@primereact/types/index';
2
2
  import * as _primereact_types_core from '@primereact/types/core';
3
3
  import { IconProps, withComponentOptions, IconExposes } from '@primereact/types/core';
4
4
  import * as React from 'react';
5
5
  import { StylesOptions } from '@primereact/types/styles';
6
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_shared.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<{}>;
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
8
 
9
9
  declare const defaultIconProps: IconProps;
10
10
 
@@ -35,6 +35,6 @@ declare const useIcon: (inProps?: unknown) => _primereact_types_core.HeadlessIns
35
35
  * @param options.render - The render function for the icon component.
36
36
  * @returns A React component wrapped with the specified options.
37
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_shared.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<{}>;
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
39
 
40
40
  export { Icon, defaultIconProps, styles, useIcon, withIcon };
package/icon/index.mjs CHANGED
@@ -1,47 +1,2 @@
1
- "use client";var h=Object.defineProperty;var c=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var f=(o,e,t)=>e in o?h(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,n=(o,e)=>{for(var t in e||(e={}))g.call(e,t)&&f(o,t,e[t]);if(c)for(var t of c(e))k.call(e,t)&&f(o,t,e[t]);return o};import{Component as C}from"@primereact/core/component";import{mergeProps as D}from"@primeuix/utils";import*as P from"react";var l={as:"i",size:void 0,rotate:void 0,flip:void 0,spin:!1};import{$dt as d}from"@primeuix/styled";var b=`
2
- .p-icon {
3
- display: inline-block;
4
- vertical-align: baseline;
5
- font-size: dt('icon.size');
6
- width: dt('icon.size');
7
- height: dt('icon.size');
8
- transform: rotate(dt('icon.rotate'));
9
- flex-shrink: 0;
10
- }
11
-
12
- .p-icon-flip-horizontal {
13
- transform: scaleX(-1);
14
- }
15
-
16
- .p-icon-flip-vertical {
17
- transform: scaleY(-1);
18
- }
19
-
20
- .p-icon-spin {
21
- -webkit-animation: p-icon-spin 2s infinite linear;
22
- animation: p-icon-spin 2s infinite linear;
23
- }
24
-
25
- @-webkit-keyframes p-icon-spin {
26
- 0% {
27
- -webkit-transform: rotate(0deg);
28
- transform: rotate(0deg);
29
- }
30
- 100% {
31
- -webkit-transform: rotate(359deg);
32
- transform: rotate(359deg);
33
- }
34
- }
35
-
36
- @keyframes p-icon-spin {
37
- 0% {
38
- -webkit-transform: rotate(0deg);
39
- transform: rotate(0deg);
40
- }
41
- 100% {
42
- -webkit-transform: rotate(359deg);
43
- transform: rotate(359deg);
44
- }
45
- }
46
- `,y={name:"icon",css:b,classes:{root:({props:o})=>["p-icon",{"p-icon-spin":o.spin,"p-icon-flip-horizontal":o.flip==="horizontal","p-icon-flip-vertical":o.flip==="vertical"}]},inlineStyles:{root:({props:o})=>n(n({},o.size?{[d("icon.size").name]:o.size}:void 0),o.rotate?{[d("icon.rotate").name]:`${o.rotate}deg`}:void 0)}};import{withComponent as S}from"@primereact/core/component";import{resolve as E}from"@primeuix/utils";import*as I from"react";import{withHeadless as z}from"@primereact/core/headless";import{isEmpty as u}from"@primeuix/utils";var x=z({name:"useIcon",setup({attrs:o}){return{pti:()=>{let t=u(o["aria-label"]);return{role:t?void 0:"img","aria-hidden":u(o.tabIndex)&&t}}}}});function w({name:o,defaultProps:e,styles:t,components:p,setup:i,render:a}){return S({name:`${o!=null?o:"Unknown"}Icon`,defaultProps:e,styles:t,components:p,setup(r){let s=x(r==null?void 0:r.inProps),m=E(i,r);return I.useMemo(()=>n(n({},s),m),[s,m])},render:a})}var J=w({name:"Icon",styles:y,defaultProps:l,render(o){let{id:e,props:t,ptmi:p,pti:i,cx:a,sx:r}=o,s=D({id:e,style:r("root"),className:a("root")},i==null?void 0:i(),p("root"));return P.createElement(C,{instance:o,attrs:s,children:t.children})}});export{J as Icon,l as defaultIconProps,y as styles,x as useIcon,w as withIcon};
1
+ "use client";var w=Object.defineProperty;var a=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var l=(o,e,t)=>e in o?w(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,p=(o,e)=>{for(var t in e||(e={}))E.call(e,t)&&l(o,t,e[t]);if(a)for(var t of a(e))C.call(e,t)&&l(o,t,e[t]);return o};import{Component as D}from"@primereact/core/component";import{mergeProps as O}from"@primeuix/utils";import*as S from"react";var f={as:"i",size:void 0,rotate:void 0,flip:void 0,spin:!1};import{$dt as d}from"@primeuix/styled";var u={name:"icon",classes:{root:({props:o})=>["p-icon",{"p-icon-spin":o.spin,"p-icon-flip-horizontal":o.flip==="horizontal","p-icon-flip-vertical":o.flip==="vertical"}]},inlineStyles:{root:({props:o})=>p(p({},o.size?{[d("icon.size").name]:o.size}:void 0),o.rotate?{[d("icon.rotate").name]:`${o.rotate}deg`}:void 0)}};import{withComponent as b}from"@primereact/core/component";import{resolve as z}from"@primeuix/utils";import*as P from"react";import{withHeadless as R}from"@primereact/core/headless";import{isEmpty as y}from"@primeuix/utils";import*as x from"react";var I=R({name:"useIcon",setup({attrs:o}){let e=o["aria-label"],t=o.tabIndex;return{pti:x.useCallback(()=>{let r=y(e);return{role:r?void 0:"img","aria-hidden":y(t)&&r}},[e,t])}}});function h({name:o,defaultProps:e,styles:t,components:n,setup:r,render:m}){return b({name:`${o!=null?o:"Unknown"}Icon`,defaultProps:e,styles:t,components:n,setup(s){let i=I(s==null?void 0:s.inProps),c=z(r,s);return P.useMemo(()=>p(p({},i),c),[i,c])},render:m})}var T=h({name:"Icon",styles:u,defaultProps:f,render(o){let{id:e,props:t,ptmi:n,pti:r,cx:m,sx:s}=o,i=O({id:e,style:s("root"),className:m("root")},r==null?void 0:r(),n("root"));return S.createElement(D,{instance:o,attrs:i,children:t.children})}});export{T as Icon,f as defaultIconProps,u as styles,I as useIcon,h as withIcon};
47
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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\nconst css = /*css*/ `\n.p-icon {\n display: inline-block;\n vertical-align: baseline;\n font-size: dt('icon.size');\n width: dt('icon.size');\n height: dt('icon.size');\n transform: rotate(dt('icon.rotate'));\n flex-shrink: 0;\n}\n\n.p-icon-flip-horizontal {\n transform: scaleX(-1);\n}\n\n.p-icon-flip-vertical {\n transform: scaleY(-1);\n}\n\n.p-icon-spin {\n -webkit-animation: p-icon-spin 2s infinite linear;\n animation: p-icon-spin 2s infinite linear;\n}\n\n@-webkit-keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n@keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n`;\n\nexport const styles = {\n name: 'icon',\n css,\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';\n\nexport const useIcon = withHeadless({\n name: 'useIcon',\n setup({ attrs }) {\n const pti = () => {\n const isAriaLabelEmpty = isEmpty(attrs['aria-label']);\n\n return {\n role: !isAria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AM,EAAG,CAUb,MAAO,CACH,IAVQ,IAAM,CACd,IAAMC,EAAmBH,EAAQE,EAAM,YAAY,CAAC,EAEpD,MAAO,CACH,KAAOC,EAA2B,OAAR,MAC1B,cAAeH,EAAQE,EAAM,QAAQ,GAAKC,CAC9C,CACJ,CAIA,CACJ,CACJ,CAAC,EDMM,SAASC,EAA+J,CAC3K,KAAAC,EACA,aAAAC,EACA,OAAAC,EACA,WAAAC,EACA,MAAAC,EACA,OAAAC,CACJ,EAA+E,CAC3E,OAAOC,EAAoE,CACvE,KAAM,GAAGN,GAAA,KAAAA,EAAQ,SAAS,OAC1B,aAAAC,EACA,OAAAC,EACA,WAAAC,EACA,MAAMI,EAAU,CACZ,IAAMC,EAAOC,EAAQF,GAAA,YAAAA,EAAU,OAAO,EAChCG,EAAgBC,EAAQP,EAA4DG,CAAQ,EAElG,OAAa,UACT,IAAOK,IAAA,GACAJ,GACAE,GAEP,CAACF,EAAME,CAAa,CACxB,CACJ,EACA,OAAAL,CACJ,CAAC,CACL,CH7CO,IAAMQ,EAAOC,EAAS,CACzB,KAAM,OACN,OAAAC,EACA,aAAcC,EACd,OAAOC,EAAU,CACb,GAAM,CAAE,GAAAC,EAAI,MAAAC,EAAO,KAAAC,EAAM,IAAAC,EAAK,GAAAC,EAAI,GAAAC,CAAG,EAAIN,EAEnCO,EAAYC,EACd,CACI,GAAAP,EACA,MAAOK,EAAG,MAAM,EAChB,UAAWD,EAAG,MAAM,CACxB,EACAD,GAAA,YAAAA,IACAD,EAAK,MAAM,CACf,EAEA,OAAO,gBAACM,EAAA,CAAU,SAAUT,EAAU,MAAOO,EAAW,SAAUL,EAAM,SAAU,CACtF,CACJ,CAAC","names":["Component","mergeProps","React","defaultIconProps","$dt","css","styles","props","__spreadValues","$dt","withComponent","resolve","React","withHeadless","isEmpty","useIcon","attrs","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"]}
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,EC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,OAAO,EAChCG,EAAgBC,EAAQP,EAA4DG,CAAQ,EAElG,OAAa,UACT,IAAOK,IAAA,GACAJ,GACAE,GAEP,CAACF,EAAME,CAAa,CACxB,CACJ,EACA,OAAAL,CACJ,CAAC,CACL,CH7CO,IAAMQ,EAAOC,EAAS,CACzB,KAAM,OACN,OAAAC,EACA,aAAcC,EACd,OAAOC,EAAU,CACb,GAAM,CAAE,GAAAC,EAAI,MAAAC,EAAO,KAAAC,EAAM,IAAAC,EAAK,GAAAC,EAAI,GAAAC,CAAG,EAAIN,EAEnCO,EAAYC,EACd,CACI,GAAAP,EACA,MAAOK,EAAG,MAAM,EAChB,UAAWD,EAAG,MAAM,CACxB,EACAD,GAAA,YAAAA,IACAD,EAAK,MAAM,CACf,EAEA,OAAO,gBAACM,EAAA,CAAU,SAAUT,EAAU,MAAOO,EAAW,SAAUL,EAAM,SAAU,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.d.mts CHANGED
@@ -2,10 +2,13 @@ export * from '@primereact/core/api';
2
2
  export * from '@primereact/core/base';
3
3
  export * from '@primereact/core/component';
4
4
  export * from '@primereact/core/config';
5
+ export * from '@primereact/core/dnd';
5
6
  export * from '@primereact/core/headless';
6
7
  export * from '@primereact/core/icon';
8
+ export * from '@primereact/core/license';
7
9
  export * from '@primereact/core/locale';
8
10
  export * from '@primereact/core/motion';
11
+ export * from '@primereact/core/overlay-manager';
9
12
  export * from '@primereact/core/passthrough';
10
13
  export * from '@primereact/core/stylesheet';
11
14
  export * from '@primereact/core/theme';
package/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export*from"@primereact/core/api";export*from"@primereact/core/base";export*from"@primereact/core/component";export*from"@primereact/core/config";export*from"@primereact/core/headless";export*from"@primereact/core/icon";export*from"@primereact/core/locale";export*from"@primereact/core/motion";export*from"@primereact/core/passthrough";export*from"@primereact/core/stylesheet";export*from"@primereact/core/theme";export*from"@primereact/core/use-style";export*from"@primereact/core/utils";
1
+ export*from"@primereact/core/api";export*from"@primereact/core/base";export*from"@primereact/core/component";export*from"@primereact/core/config";export*from"@primereact/core/dnd";export*from"@primereact/core/headless";export*from"@primereact/core/icon";export*from"@primereact/core/license";export*from"@primereact/core/locale";export*from"@primereact/core/motion";export*from"@primereact/core/overlay-manager";export*from"@primereact/core/passthrough";export*from"@primereact/core/stylesheet";export*from"@primereact/core/theme";export*from"@primereact/core/use-style";export*from"@primereact/core/utils";
2
2
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
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/headless';\nexport * from '@primereact/core/icon';\nexport * from '@primereact/core/locale';\nexport * from '@primereact/core/motion';\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,4BACd,WAAc,wBACd,WAAc,0BACd,WAAc,0BACd,WAAc,+BACd,WAAc,8BACd,WAAc,yBACd,WAAc,6BACd,WAAc","names":[]}
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":[]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Inject a fixed-positioned banner into the bottom-right of the page when the
3
+ * PrimeReact license cannot be verified.
4
+ *
5
+ * The banner content is rendered inside a closed-mode shadow root so page-level
6
+ * CSS cannot reach into it. `all:initial` on the host element blocks inherited
7
+ * styles. The host carries no semantically obvious id, slowing down trivial
8
+ * hide-by-selector attempts.
9
+ *
10
+ * Idempotent — guarded by the host id, so multiple call sites cannot produce
11
+ * more than one banner per page.
12
+ *
13
+ * SSR-safe — short-circuits when `document` is undefined.
14
+ *
15
+ * Note: client-side license enforcement is anti-honest-user signaling, not
16
+ * anti-piracy. The cryptographic signature (Ed25519) is what actually prevents
17
+ * forging valid tokens. This banner just makes the licensing problem visible
18
+ * to a legitimate customer whose key needs attention.
19
+ */
20
+ declare function showInvalidLicenseBanner(): void;
21
+
22
+ export { showInvalidLicenseBanner };
@@ -0,0 +1,2 @@
1
+ function o(){if(typeof document=="undefined"||document.getElementById("p-license-host"))return;let e=document.createElement("div");e.id="p-license-host",e.style.cssText="all:initial;position:fixed;bottom:16px;right:16px;z-index:2147483647;pointer-events:none;";let n=e.attachShadow({mode:"closed"});n.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>',document.body.appendChild(e)}export{o as showInvalidLicenseBanner};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
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"]}
package/locale/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{useProps as p}from"@primereact/hooks";import{resolve as s}from"@primeuix/utils";import*as o from"react";var c={lang:"en"};var r=o.createContext(void 0),d=(e={})=>{let{attrs:n}=p(e,c),t=void 0;return o.createElement(r.Provider,{value:t},s(n.children,t))};import*as a from"react";function L(){let e=a.useContext(r);if(e===void 0)throw new Error("Context must be used within a LocaleProvider");return e}export{r as LocaleContext,d as LocaleProvider,c as defaultLocaleProps,L as useLocale};
1
+ import{useProps as p}from"@primereact/hooks";import{resolve as i}from"@primeuix/utils";import*as e from"react";var a={lang:"en"};var t=e.createContext(void 0),u=(o={})=>{let{attrs:c}=p(a,o),r=void 0,s=e.useMemo(()=>i(c.children,r),[c.children,r]);return e.createElement(t.Provider,{value:r},s)};import*as n from"react";function P(){let o=n.useContext(t);if(o===void 0)throw new Error("Context must be used within a LocaleProvider");return o}export{t as LocaleContext,u as LocaleProvider,a as defaultLocaleProps,P as useLocale};
2
2
  //# sourceMappingURL=index.mjs.map