@editora/ui-core 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +30 -29
- package/dist/color-picker.cjs.js +10 -10
- package/dist/color-picker.esm.js +190 -253
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +7 -7
- package/dist/date-time-picker.esm.js +115 -147
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +5 -5
- package/dist/multi-select.esm.js +125 -137
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +20 -28
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +22 -28
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +79 -65
- package/dist/sortable.esm.js +714 -734
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +8 -8
- package/dist/tabs.esm.js +89 -109
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +10 -10
- package/dist/textarea.esm.js +49 -52
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +31 -31
- package/dist/transfer-list.esm.js +114 -127
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/sortable.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const te=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const te=require("./ElementBase-EV6mVBUV.js");function re(l,e,t,r=56,i=18){if(!Number.isFinite(l)||!(t>e))return 0;const s=Math.min(r,(t-e)/2);return s<=0?0:l<e+s?-Math.ceil(i*Math.min(1,(e+s-l)/s)):l>t-s?Math.ceil(i*Math.min(1,(l-(t-s))/s)):0}const ie=new Set(["auto","scroll","overlay"]);function se(l){let e=l;for(;e;){if(e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode,!(e instanceof HTMLElement))continue;if(e===e.ownerDocument.body||e===e.ownerDocument.documentElement)return null;const{overflowY:t}=e.ownerDocument.defaultView?.getComputedStyle(e)??{overflowY:""};if(ie.has(t)&&e.scrollHeight>e.clientHeight)return e}return null}const oe=1,ne=44,ae=72,le=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-sortable-accent: var(--ui-color-primary, #2563eb);
|
|
4
4
|
--ui-sortable-surface: var(--ui-color-surface, #ffffff);
|
|
@@ -102,6 +102,20 @@
|
|
|
102
102
|
align-items: stretch;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/* The cards live inside one root .tree wrapper, which is a vertical grid. Without this the
|
|
106
|
+
lane was a flex row holding a single column, so a "horizontal" list rendered vertically. */
|
|
107
|
+
.list[data-orientation="horizontal"] .items > .tree {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-wrap: nowrap;
|
|
110
|
+
align-items: stretch;
|
|
111
|
+
min-inline-size: min-content;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.list[data-orientation="horizontal"] .items > .tree > .item-shell {
|
|
115
|
+
flex: 0 0 auto;
|
|
116
|
+
min-inline-size: min(220px, 70vw);
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
.list[data-disabled="true"] {
|
|
106
120
|
opacity: 0.68;
|
|
107
121
|
}
|
|
@@ -720,96 +734,96 @@
|
|
|
720
734
|
background: Highlight;
|
|
721
735
|
}
|
|
722
736
|
}
|
|
723
|
-
`;function V(u){if(!u)return[];try{const e=JSON.parse(u);return Array.isArray(e)?e:[]}catch{return[]}}function I(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function z(u,e){return`${u}::${e??"__root__"}`}function X(u){return u?[u.listId,u.parentId??"",u.beforeId??"",u.mode].join("::"):""}function B(u,e){return X(u)===X(e)}function oe(u){if(!u||u==="none")return{x:1,y:1};const e=u.match(/^matrix3d\((.+)\)$/);if(e){const t=e[1].split(",").map(i=>Number.parseFloat(i.trim()));if(t.length===16&&t.every(i=>Number.isFinite(i)))return{x:t[0]||1,y:t[5]||1}}const r=u.match(/^matrix\((.+)\)$/);if(r){const t=r[1].split(",").map(i=>Number.parseFloat(i.trim()));if(t.length===6&&t.every(i=>Number.isFinite(i))){const[i,s,o,a]=t;return{x:Math.sqrt(i*i+s*s)||1,y:Math.sqrt(o*o+a*a)||1}}}return{x:1,y:1}}function ae(u){return u==="item"?"item":"handle"}function $(u){return{...u}}function de(u,e,r,t,i,s){const o=M(u),a=E(u),l=new Set,n=[],d=h=>{const x=o.get(h);!x||l.has(h)||(l.add(h),n.push(h),(a.get(z(x.listId,h))||[]).forEach(d))};t.forEach(d);const c=u.map($),g=c.filter(h=>l.has(h.id)),m=i?c.map($):c.filter(h=>!l.has(h.id)),f=i?g.map(h=>s(h,n)):g.map($),v=new Map,b=new Map;i&&g.forEach((h,x)=>{v.set(h.id,f[x].id),b.set(f[x].id,h.id)}),f.forEach(h=>{const x=i?b.get(h.id):h.id,F=x?o.get(x):null;F&&(i&&(h.parentId=F.parentId&&v.has(F.parentId)&&v.get(F.parentId)||null),h.listId=r.listId)});const y=t.map(h=>v.get(h)||h),w=[...m,...f],k=E(m),A=z(r.listId,r.parentId),_=[...k.get(A)||[]],R=r.beforeId?_.indexOf(r.beforeId):_.length,S=R>=0?R:_.length;_.splice(S,0,...y),k.set(A,_),E(f).forEach((h,x)=>{const[,F]=x.split("::");(F||"")!=="__root__"&&k.set(x,[...h])});const T=M(w);y.forEach(h=>{const x=T.get(h);x&&(x.parentId=r.parentId,x.listId=r.listId)});const P=[],L=new Set,G=(h,x)=>{(k.get(z(h,x))||[]).forEach((O,K)=>{const p=T.get(O);!p||L.has(O)||(L.add(O),p.listId=h,p.parentId=x,p.order=K,P.push(p),G(h,O))})};return e.forEach(h=>G(h.id,null)),w.forEach(h=>{L.has(h.id)||(h.parentId=null,P.push(h))}),{items:P.map($),insertedRootIds:y}}function E(u){const e=new Map;return u.forEach(r=>{const t=z(r.listId,r.parentId),i=e.get(t);i?i.push(r.id):e.set(t,[r.id])}),e}function M(u){return new Map(u.map(e=>[e.id,e]))}function Y(u){const e=new Set,r=[];return u.forEach((t,i)=>{const s=typeof(t==null?void 0:t.id)=="string"&&t.id.trim()?t.id.trim():`list-${i+1}`;e.has(s)||(e.add(s),r.push({id:s,label:typeof(t==null?void 0:t.label)=="string"&&t.label.trim()?t.label.trim():`List ${i+1}`,description:typeof(t==null?void 0:t.description)=="string"?t.description:"",emptyLabel:typeof(t==null?void 0:t.emptyLabel)=="string"&&t.emptyLabel.trim()?t.emptyLabel.trim():"Drop items here.",orientation:(t==null?void 0:t.orientation)==="horizontal"?"horizontal":"vertical",disabled:!!(t!=null&&t.disabled),cloneOnDrag:!!(t!=null&&t.cloneOnDrag),accepts:Array.isArray(t==null?void 0:t.accepts)?t.accepts.filter(o=>typeof o=="string"&&o.trim().length>0):void 0}))}),r.length?r:[{id:"default",label:"Items",description:"",emptyLabel:"Drop items here.",orientation:"vertical",disabled:!1,cloneOnDrag:!1}]}function U(u,e){const r=new Set(u.map(n=>n.id)),t=[];e.forEach((n,d)=>{const c=typeof(n==null?void 0:n.id)=="string"&&n.id.trim()?n.id.trim():"",g=typeof(n==null?void 0:n.label)=="string"&&n.label.trim()?n.label.trim():"";if(!c||!g)return;const m=typeof(n==null?void 0:n.listId)=="string"&&r.has(n.listId)?n.listId:u[0].id;t.push({id:c,label:g,listId:m,parentId:typeof(n==null?void 0:n.parentId)=="string"&&n.parentId.trim()?n.parentId.trim():null,description:typeof(n==null?void 0:n.description)=="string"?n.description:"",order:Number.isFinite(n==null?void 0:n.order)?Number(n.order):d,disabled:!!(n!=null&&n.disabled),dragDisabled:!!(n!=null&&n.dragDisabled),cloneOnDrag:!!(n!=null&&n.cloneOnDrag),hidden:!!(n!=null&&n.hidden)})});const i=new Map(t.map(n=>[n.id,n]));t.forEach(n=>{if(!n.parentId)return;const d=i.get(n.parentId);(!d||d.id===n.id||d.listId!==n.listId)&&(n.parentId=null)});const s=new Map;t.forEach(n=>{const d=z(n.listId,n.parentId),c=s.get(d);c?c.push(n):s.set(d,[n])}),s.forEach(n=>n.sort((d,c)=>d.order-c.order||d.label.localeCompare(c.label)));const o=[],a=new Set,l=(n,d)=>{(s.get(z(n,d))||[]).forEach((g,m)=>{a.has(g.id)||(a.add(g.id),g.order=m,o.push(g),l(n,g.id))})};return u.forEach(n=>l(n.id,null)),t.forEach(n=>{a.has(n.id)||(n.parentId=null,o.push(n))}),o.map($)}function le(u){return JSON.stringify(u.map(e=>({id:e.id,label:e.label,listId:e.listId,parentId:e.parentId,description:e.description,order:e.order,disabled:e.disabled,dragDisabled:e.dragDisabled,cloneOnDrag:e.cloneOnDrag,hidden:e.hidden})))}function ce(u){return JSON.stringify(u.map(e=>({id:e.id,label:e.label,description:e.description,emptyLabel:e.emptyLabel,orientation:e.orientation,disabled:e.disabled,cloneOnDrag:e.cloneOnDrag,accepts:e.accepts})))}function j(u){return JSON.stringify(u)}function J(u){const e=new Map,r=u.map(t=>{const i=z(t.listId,t.parentId),s=e.get(i)??0;return e.set(i,s+1),{id:t.id,listId:t.listId,parentId:t.parentId,index:s}});return{version:re,records:r}}function W(u,e){return e?`${u.label} ${u.description}`.toLowerCase().includes(e.toLowerCase()):!0}function Q(u,e,r,t,i){const s=M(u),o=E(u),a=new Map,l=(c,g)=>{const m=[...o.get(z(c,g))||[]];return i==="label"&&m.sort((f,v)=>{const b=s.get(f),y=s.get(v);return!b||!y?0:b.label.localeCompare(y.label)}),m},n=(c,g,m)=>{const f=[];return l(c,g).forEach(v=>{const b=s.get(v);if(!b||b.hidden)return;const y=n(c,b.id);!W(b,t)&&y.length===0||(f.push({id:b.id,disabled:b.disabled}),y.length&&f.push(...y))}),f};return Array.from(new Set(u.map(c=>c.listId))).forEach(c=>{a.set(c,n(c,null))}),a}class Z extends te.ElementBase{constructor(){super(),this._lists=Y([]),this._items=[],this._selection=[],this._focusedId=null,this._rangeAnchorId=null,this._dragState=null,this._liveMessage="Sortable list ready.",this._lastListsAttr=null,this._lastItemsAttr=null,this._lastSelectionAttr=null,this._hydratedPersistKey=null,this._cloneSeed=1,this._dragImage=null,this._dragPreviewOverlay=null,this._pendingFocusId=null,this._pointerGesture=null,this._pendingDropTarget=null,this._suppressAttributeRender=!1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onDragStart=this._onDragStart.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDrop=this._onDrop.bind(this),this._onDragEnd=this._onDragEnd.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerCancel=this._onPointerCancel.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this)}static get observedAttributes(){return["lists","items","selection","filter-query","sort","persist-key","allow-filtered-drag","allow-nesting","drop-indicator-visibility","dropzone-style","drag-preview-size","drag-handle-mode","drag-handle-selector","custom-item-rendering","show-selection-badge","disabled"]}shouldRenderOnAttributeChange(e,r,t){return this._suppressAttributeRender?!["lists","items","selection"].includes(e):!0}attributeChangedCallback(e,r,t){if(r!==t&&this.isConnected){if(e==="selection"&&!this._suppressAttributeRender&&this._canSyncInteractiveStateInPlace()){this._syncSelectionFromAttribute(t??null),this._syncSelectionVisualState();return}if(e==="show-selection-badge"&&this._canSyncInteractiveStateInPlace()){this._syncSelectionVisualState();return}super.attributeChangedCallback(e,r,t)}}connectedCallback(){var e,r,t,i;super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("dragstart",this._onDragStart),this.root.addEventListener("dragover",this._onDragOver),this.root.addEventListener("drop",this._onDrop),this.root.addEventListener("dragend",this._onDragEnd),this.root.addEventListener("pointerdown",this._onPointerDown),this.root.addEventListener("focusin",this._onFocusIn),(e=this.ownerDocument)==null||e.addEventListener("keydown",this._onDocumentKeyDown,!0),(r=this.ownerDocument)==null||r.addEventListener("pointermove",this._onPointerMove,!0),(t=this.ownerDocument)==null||t.addEventListener("pointerup",this._onPointerUp,!0),(i=this.ownerDocument)==null||i.addEventListener("pointercancel",this._onPointerCancel,!0)}disconnectedCallback(){var e,r,t,i;this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("dragstart",this._onDragStart),this.root.removeEventListener("dragover",this._onDragOver),this.root.removeEventListener("drop",this._onDrop),this.root.removeEventListener("dragend",this._onDragEnd),this.root.removeEventListener("pointerdown",this._onPointerDown),this.root.removeEventListener("focusin",this._onFocusIn),(e=this.ownerDocument)==null||e.removeEventListener("keydown",this._onDocumentKeyDown,!0),(r=this.ownerDocument)==null||r.removeEventListener("pointermove",this._onPointerMove,!0),(t=this.ownerDocument)==null||t.removeEventListener("pointerup",this._onPointerUp,!0),(i=this.ownerDocument)==null||i.removeEventListener("pointercancel",this._onPointerCancel,!0),this._removeDragPreviewOverlay(),this._removeDragImage(),super.disconnectedCallback()}get lists(){return this._lists.map(e=>({...e}))}set lists(e){this.setAttribute("lists",JSON.stringify(e??[]))}get items(){return this._items.map(e=>({...e}))}set items(e){this.setAttribute("items",JSON.stringify(e??[]))}get selection(){return[...this._selection]}set selection(e){this.setAttribute("selection",JSON.stringify(e??[]))}get sort(){return this.getAttribute("sort")==="label"?"label":"manual"}set sort(e){!e||e==="manual"?this.removeAttribute("sort"):this.setAttribute("sort",e)}get filterQuery(){return this.getAttribute("filter-query")||""}set filterQuery(e){e?this.setAttribute("filter-query",e):this.removeAttribute("filter-query")}select(e){this._setSelection(e,"api")}clearSelection(){this._setSelection([],"api")}cancelDrag(){this._cancelDrag(!0)}focusItem(e){this._items.some(r=>r.id===e)&&(this._focusedId=e,this._pendingFocusId=e,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender())}moveSelection(e){this._syncSelectionFromAttribute(this.getAttribute("selection"));const r=this._selectedRootIds();r.length&&this._commitMove({listId:e.targetListId,parentId:e.parentId??null,beforeId:e.beforeId??null,mode:e.mode??(e.parentId?"inside":"before")},r,!!e.clone,e.source??"api")}getPersistenceSnapshot(){return J(this._items)}render(){var _,R;this._syncStateFromAttributes();const e=this._measureItemShellRects(),r=new Set(this._draggingIds()),t=new Set(this._selection),s=!!((_=this._dragState)!=null&&_.keyboard)?this._projectedMoveResult():null,o=(s==null?void 0:s.items)||this._items,a=new Set((s==null?void 0:s.insertedRootIds)||[]),l=!!this._dragState&&!this._dragState.keyboard&&!!this._dragState.dropTarget,n=Q(o,t,r,this.filterQuery,this.sort),d=this._resolvedFocusedId(n),c=this._isDragLocked(),g=this._selection.length,m=this.getAttribute("allow-nesting")!=="false",f=this.getAttribute("drop-indicator-visibility")==="always"?"always":"active",v=this._dropzoneStyle(),b=this.getAttribute("show-selection-badge")!=="false",y=this._dragHandleMode(),w=this._usesCustomHandleSelector(),k=c?this.sort==="label"?"Dragging is paused while alphabetical sorting is active.":this.filterQuery&&!this.hasAttribute("allow-filtered-drag")?"Dragging is paused while the list is filtered.":"Dragging is currently disabled.":(R=this._dragState)!=null&&R.keyboard?"Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel.":y==="item"?"Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering.":w?"Use your custom drag handle element, or press Space on a focused item to start keyboard reordering.":"Use the handle to drag, or press Space on a focused item to start keyboard reordering.",A=`
|
|
724
|
-
<style>${
|
|
737
|
+
`;function K(l){if(!l)return[];try{const e=JSON.parse(l);return Array.isArray(e)?e:[]}catch{return[]}}function y(l){return l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(l,e){return`${l}::${e??"__root__"}`}function j(l){return l?[l.listId,l.parentId??"",l.beforeId??"",l.mode].join("::"):""}function B(l,e){return j(l)===j(e)}function de(l){if(!l||l==="none")return{x:1,y:1};const e=l.match(/^matrix3d\((.+)\)$/);if(e){const r=e[1].split(",").map(i=>Number.parseFloat(i.trim()));if(r.length===16&&r.every(i=>Number.isFinite(i)))return{x:r[0]||1,y:r[5]||1}}const t=l.match(/^matrix\((.+)\)$/);if(t){const r=t[1].split(",").map(i=>Number.parseFloat(i.trim()));if(r.length===6&&r.every(i=>Number.isFinite(i))){const[i,s,n,a]=r;return{x:Math.sqrt(i*i+s*s)||1,y:Math.sqrt(n*n+a*a)||1}}}return{x:1,y:1}}function ce(l){return l==="item"?"item":"handle"}function P(l){return{...l}}function ue(l,e,t,r,i,s){const n=T(l),a=E(l),d=new Set,o=[],u=g=>{const x=n.get(g);!x||d.has(g)||(d.add(g),o.push(g),(a.get(k(x.listId,g))||[]).forEach(u))};r.forEach(u);const c=l.map(P),h=c.filter(g=>d.has(g.id)),f=i?c.map(P):c.filter(g=>!d.has(g.id)),_=i?h.map(g=>s(g,o)):h.map(P),I=new Map,m=new Map;i&&h.forEach((g,x)=>{I.set(g.id,_[x].id),m.set(_[x].id,g.id)}),_.forEach(g=>{const x=i?m.get(g.id):g.id,M=x?n.get(x):null;M&&(i&&(g.parentId=M.parentId&&I.has(M.parentId)&&I.get(M.parentId)||null),g.listId=t.listId)});const v=r.map(g=>I.get(g)||g),D=[...f,..._],A=E(f),z=k(t.listId,t.parentId),b=[...A.get(z)||[]],S=t.beforeId?b.indexOf(t.beforeId):b.length,R=S>=0?S:b.length;b.splice(R,0,...v),A.set(z,b),E(_).forEach((g,x)=>{const[,M]=x.split("::");(M||"")!=="__root__"&&A.set(x,[...g])});const O=T(D);v.forEach(g=>{const x=O.get(g);x&&(x.parentId=t.parentId,x.listId=t.listId)});const L=[],q=new Set,H=(g,x)=>{(A.get(k(g,x))||[]).forEach((C,G)=>{const p=O.get(C);!p||q.has(C)||(q.add(C),p.listId=g,p.parentId=x,p.order=G,L.push(p),H(g,C))})};return e.forEach(g=>H(g.id,null)),D.forEach(g=>{q.has(g.id)||(g.parentId=null,L.push(g))}),{items:L.map(P),insertedRootIds:v}}function E(l){const e=new Map;return l.forEach(t=>{const r=k(t.listId,t.parentId),i=e.get(r);i?i.push(t.id):e.set(r,[t.id])}),e}function T(l){return new Map(l.map(e=>[e.id,e]))}function Y(l){const e=new Set,t=[];return l.forEach((r,i)=>{const s=typeof r?.id=="string"&&r.id.trim()?r.id.trim():`list-${i+1}`;e.has(s)||(e.add(s),t.push({id:s,label:typeof r?.label=="string"&&r.label.trim()?r.label.trim():`List ${i+1}`,description:typeof r?.description=="string"?r.description:"",emptyLabel:typeof r?.emptyLabel=="string"&&r.emptyLabel.trim()?r.emptyLabel.trim():"Drop items here.",orientation:r?.orientation==="horizontal"?"horizontal":"vertical",disabled:!!r?.disabled,cloneOnDrag:!!r?.cloneOnDrag,accepts:Array.isArray(r?.accepts)?r.accepts.filter(n=>typeof n=="string"&&n.trim().length>0):void 0}))}),t.length?t:[{id:"default",label:"Items",description:"",emptyLabel:"Drop items here.",orientation:"vertical",disabled:!1,cloneOnDrag:!1}]}function U(l,e){const t=new Set(l.map(o=>o.id)),r=[];e.forEach((o,u)=>{const c=typeof o?.id=="string"&&o.id.trim()?o.id.trim():"",h=typeof o?.label=="string"&&o.label.trim()?o.label.trim():"";if(!c||!h)return;const f=typeof o?.listId=="string"&&t.has(o.listId)?o.listId:l[0].id;r.push({id:c,label:h,listId:f,parentId:typeof o?.parentId=="string"&&o.parentId.trim()?o.parentId.trim():null,description:typeof o?.description=="string"?o.description:"",order:Number.isFinite(o?.order)?Number(o.order):u,disabled:!!o?.disabled,dragDisabled:!!o?.dragDisabled,cloneOnDrag:!!o?.cloneOnDrag,hidden:!!o?.hidden})});const i=new Map(r.map(o=>[o.id,o]));r.forEach(o=>{if(!o.parentId)return;const u=i.get(o.parentId);(!u||u.id===o.id||u.listId!==o.listId)&&(o.parentId=null)});const s=new Map;r.forEach(o=>{const u=k(o.listId,o.parentId),c=s.get(u);c?c.push(o):s.set(u,[o])}),s.forEach(o=>o.sort((u,c)=>u.order-c.order||u.label.localeCompare(c.label)));const n=[],a=new Set,d=(o,u)=>{(s.get(k(o,u))||[]).forEach((h,f)=>{a.has(h.id)||(a.add(h.id),h.order=f,n.push(h),d(o,h.id))})};return l.forEach(o=>d(o.id,null)),r.forEach(o=>{a.has(o.id)||(o.parentId=null,n.push(o))}),n.map(P)}function pe(l){return JSON.stringify(l.map(e=>({id:e.id,label:e.label,listId:e.listId,parentId:e.parentId,description:e.description,order:e.order,disabled:e.disabled,dragDisabled:e.dragDisabled,cloneOnDrag:e.cloneOnDrag,hidden:e.hidden})))}function he(l){return JSON.stringify(l.map(e=>({id:e.id,label:e.label,description:e.description,emptyLabel:e.emptyLabel,orientation:e.orientation,disabled:e.disabled,cloneOnDrag:e.cloneOnDrag,accepts:e.accepts})))}function X(l){return JSON.stringify(l)}function J(l){const e=new Map,t=l.map(r=>{const i=k(r.listId,r.parentId),s=e.get(i)??0;return e.set(i,s+1),{id:r.id,listId:r.listId,parentId:r.parentId,index:s}});return{version:oe,records:t}}function W(l,e){return e?`${l.label} ${l.description}`.toLowerCase().includes(e.toLowerCase()):!0}function Q(l,e,t,r,i){const s=T(l),n=E(l),a=new Map,d=(c,h)=>{const f=[...n.get(k(c,h))||[]];return i==="label"&&f.sort((_,I)=>{const m=s.get(_),v=s.get(I);return!m||!v?0:m.label.localeCompare(v.label)}),f},o=(c,h,f)=>{const _=[];return d(c,h).forEach(I=>{const m=s.get(I);if(!m||m.hidden)return;const v=o(c,m.id);!W(m,r)&&v.length===0||(_.push({id:m.id,disabled:m.disabled}),v.length&&_.push(...v))}),_};return Array.from(new Set(l.map(c=>c.listId))).forEach(c=>{a.set(c,o(c,null))}),a}class Z extends te.ElementBase{constructor(){super(),this._lists=Y([]),this._items=[],this._selection=[],this._focusedId=null,this._rangeAnchorId=null,this._dragState=null,this._liveMessage="Sortable list ready.",this._lastListsAttr=null,this._lastItemsAttr=null,this._lastSelectionAttr=null,this._hydratedPersistKey=null,this._cloneSeed=1,this._dragImage=null,this._dragPreviewOverlay=null,this._pendingFocusId=null,this._pointerGesture=null,this._pendingDropTarget=null,this._suppressAttributeRender=!1,this._autoScrollFrame=0,this._autoScrollPoint=null,this._autoScrollTick=()=>{this._autoScrollFrame=0;const e=this._autoScrollPoint;if(!e||!this._dragState||this._dragState.keyboard)return;const t=this.ownerDocument?.defaultView,r=se(this),i=r?r.getBoundingClientRect():null,s=Math.max(0,i?i.top:0),n=Math.min(t?.innerHeight??0,i?i.bottom:1/0),a=re(e.y,s,n);if(a){if(r?r.scrollTop+=a:t?.scrollBy(0,a),!this._dragState.committed){const d=this._dropTargetFromPoint(e.x,e.y),o=d&&this._canDrop(d,this._dragState.movedRootIds)?d:null;this._queueDropTarget(o,performance.now())}this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick)}},this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onDragStart=this._onDragStart.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDrop=this._onDrop.bind(this),this._onDragEnd=this._onDragEnd.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerCancel=this._onPointerCancel.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onDocumentKeyDown=this._onDocumentKeyDown.bind(this)}static get observedAttributes(){return["lists","items","selection","filter-query","sort","persist-key","allow-filtered-drag","allow-nesting","drop-indicator-visibility","dropzone-style","drag-preview-size","drag-handle-mode","drag-handle-selector","custom-item-rendering","show-selection-badge","disabled"]}shouldRenderOnAttributeChange(e,t,r){return this._suppressAttributeRender?!["lists","items","selection"].includes(e):!0}attributeChangedCallback(e,t,r){if(t!==r&&this.isConnected){if(e==="selection"&&!this._suppressAttributeRender&&this._canSyncInteractiveStateInPlace()){this._syncSelectionFromAttribute(r??null),this._syncSelectionVisualState();return}if(e==="show-selection-badge"&&this._canSyncInteractiveStateInPlace()){this._syncSelectionVisualState();return}super.attributeChangedCallback(e,t,r)}}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("dragstart",this._onDragStart),this.root.addEventListener("dragover",this._onDragOver),this.root.addEventListener("drop",this._onDrop),this.root.addEventListener("dragend",this._onDragEnd),this.root.addEventListener("pointerdown",this._onPointerDown),this.root.addEventListener("focusin",this._onFocusIn),this.ownerDocument?.addEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.addEventListener("pointermove",this._onPointerMove,!0),this.ownerDocument?.addEventListener("pointerup",this._onPointerUp,!0),this.ownerDocument?.addEventListener("pointercancel",this._onPointerCancel,!0)}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("dragstart",this._onDragStart),this.root.removeEventListener("dragover",this._onDragOver),this.root.removeEventListener("drop",this._onDrop),this.root.removeEventListener("dragend",this._onDragEnd),this.root.removeEventListener("pointerdown",this._onPointerDown),this.root.removeEventListener("focusin",this._onFocusIn),this.ownerDocument?.removeEventListener("keydown",this._onDocumentKeyDown,!0),this.ownerDocument?.removeEventListener("pointermove",this._onPointerMove,!0),this.ownerDocument?.removeEventListener("pointerup",this._onPointerUp,!0),this.ownerDocument?.removeEventListener("pointercancel",this._onPointerCancel,!0),this._stopAutoScroll(),this._removeDragPreviewOverlay(),this._removeDragImage(),super.disconnectedCallback()}get lists(){return this._lists.map(e=>({...e}))}set lists(e){this.setAttribute("lists",JSON.stringify(e??[]))}get items(){return this._items.map(e=>({...e}))}set items(e){this.setAttribute("items",JSON.stringify(e??[]))}get selection(){return[...this._selection]}set selection(e){this.setAttribute("selection",JSON.stringify(e??[]))}get sort(){return this.getAttribute("sort")==="label"?"label":"manual"}set sort(e){!e||e==="manual"?this.removeAttribute("sort"):this.setAttribute("sort",e)}get filterQuery(){return this.getAttribute("filter-query")||""}set filterQuery(e){e?this.setAttribute("filter-query",e):this.removeAttribute("filter-query")}select(e){this._setSelection(e,"api")}clearSelection(){this._setSelection([],"api")}cancelDrag(){this._cancelDrag(!0)}focusItem(e){this._items.some(t=>t.id===e)&&(this._focusedId=e,this._pendingFocusId=e,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender())}moveSelection(e){this._syncSelectionFromAttribute(this.getAttribute("selection"));const t=this._selectedRootIds();t.length&&this._commitMove({listId:e.targetListId,parentId:e.parentId??null,beforeId:e.beforeId??null,mode:e.mode??(e.parentId?"inside":"before")},t,!!e.clone,e.source??"api")}getPersistenceSnapshot(){return J(this._items)}render(){this._syncStateFromAttributes();const e=this._measureItemShellRects(),t=new Set(this._draggingIds()),r=new Set(this._selection),s=!!this._dragState?.keyboard?this._projectedMoveResult():null,n=s?.items||this._items,a=new Set(s?.insertedRootIds||[]),d=!!this._dragState&&!this._dragState.keyboard&&!!this._dragState.dropTarget,o=Q(n,r,t,this.filterQuery,this.sort),u=this._resolvedFocusedId(o),c=this._isDragLocked(),h=this._selection.length,f=this.getAttribute("allow-nesting")!=="false",_=this.getAttribute("drop-indicator-visibility")==="always"?"always":"active",I=this._dropzoneStyle(),m=this.getAttribute("show-selection-badge")!=="false",v=this._dragHandleMode(),D=this._usesCustomHandleSelector(),A=c?this.sort==="label"?"Dragging is paused while alphabetical sorting is active.":this.filterQuery&&!this.hasAttribute("allow-filtered-drag")?"Dragging is paused while the list is filtered.":"Dragging is currently disabled.":this._dragState?.keyboard?"Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel.":v==="item"?"Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering.":D?"Use your custom drag handle element, or press Space on a focused item to start keyboard reordering.":"Use the handle to drag, or press Space on a focused item to start keyboard reordering.",z=`
|
|
738
|
+
<style>${le}</style>
|
|
725
739
|
<div
|
|
726
740
|
class="root"
|
|
727
741
|
part="root"
|
|
728
742
|
data-drag-locked="${c}"
|
|
729
|
-
data-drag-preview="${a.size||
|
|
730
|
-
data-drop-indicator-visibility="${
|
|
731
|
-
data-dropzone-style="${
|
|
743
|
+
data-drag-preview="${a.size||d?"true":"false"}"
|
|
744
|
+
data-drop-indicator-visibility="${_}"
|
|
745
|
+
data-dropzone-style="${I}"
|
|
732
746
|
>
|
|
733
747
|
<div class="toolbar" part="toolbar">
|
|
734
|
-
<div class="helper">${
|
|
748
|
+
<div class="helper">${y(A)}</div>
|
|
735
749
|
<div class="helper selection-summary">
|
|
736
|
-
<span class="selection-pill" part="selection-count">${
|
|
737
|
-
<span class="selection-text">${
|
|
750
|
+
<span class="selection-pill" part="selection-count">${h}</span>
|
|
751
|
+
<span class="selection-text">${h===1?"item selected":"items selected"}</span>
|
|
738
752
|
</div>
|
|
739
753
|
</div>
|
|
740
754
|
<div class="lists" part="lists">
|
|
741
|
-
${this._lists.map(
|
|
755
|
+
${this._lists.map(b=>{const S=o.get(b.id)||[],R=S.length?this._renderListTree(n,b,u,t,f,a,m):"",$=b.disabled?"This list is read-only.":b.cloneOnDrag?"Dragging from this list creates a copy.":b.accepts?.length?`Accepts drops from: ${b.accepts.join(", ")}`:"";return`
|
|
742
756
|
<section
|
|
743
757
|
class="list"
|
|
744
758
|
part="list"
|
|
745
|
-
data-list-id="${
|
|
746
|
-
data-orientation="${
|
|
747
|
-
data-disabled="${
|
|
748
|
-
aria-label="${
|
|
759
|
+
data-list-id="${y(b.id)}"
|
|
760
|
+
data-orientation="${b.orientation}"
|
|
761
|
+
data-disabled="${b.disabled}"
|
|
762
|
+
aria-label="${y(b.label)}"
|
|
749
763
|
>
|
|
750
764
|
<header class="list-header">
|
|
751
|
-
<div class="list-custom-header" part="list-custom-header" data-list-header-target="${
|
|
765
|
+
<div class="list-custom-header" part="list-custom-header" data-list-header-target="${y(b.id)}"></div>
|
|
752
766
|
<div class="list-default-header">
|
|
753
767
|
<div class="list-topline">
|
|
754
|
-
<div class="list-label">${
|
|
755
|
-
<span class="list-count">${
|
|
768
|
+
<div class="list-label">${y(b.label)}</div>
|
|
769
|
+
<span class="list-count">${S.length}</span>
|
|
756
770
|
</div>
|
|
757
|
-
${
|
|
758
|
-
${
|
|
771
|
+
${b.description?`<div class="list-description">${y(b.description)}</div>`:""}
|
|
772
|
+
${$?`<div class="list-helper">${y($)}</div>`:""}
|
|
759
773
|
</div>
|
|
760
774
|
</header>
|
|
761
|
-
<div class="items" role="listbox" aria-multiselectable="true">
|
|
762
|
-
${
|
|
775
|
+
<div class="items" role="listbox" aria-multiselectable="true" aria-label="${y(b.label)}">
|
|
776
|
+
${R||`<div class="list-custom-empty" part="list-custom-empty" data-list-empty-target="${y(b.id)}"></div><div class="empty">${y(b.emptyLabel)}</div>${this._renderDropzone({listId:b.id,parentId:null,beforeId:null,mode:"before"},"Drop here")}`}
|
|
763
777
|
</div>
|
|
764
778
|
</section>
|
|
765
779
|
`}).join("")}
|
|
766
780
|
</div>
|
|
767
|
-
<div class="sr-only" aria-live="polite" aria-atomic="true">${
|
|
781
|
+
<div class="sr-only" aria-live="polite" aria-atomic="true">${y(this._liveMessage)}</div>
|
|
768
782
|
</div>
|
|
769
|
-
`;this.setContent(
|
|
783
|
+
`;this.setContent(z),queueMicrotask(()=>{this._restorePendingFocus(),this._applyCurrentDropTargetVisualState(),this._applyLiveMessage(),this._updatePointerDragPreview(),this._animateItemShellReflow(e)})}_syncStateFromAttributes(){const e=this.getAttribute("lists");e!==this._lastListsAttr&&(this._lastListsAttr=e,this._lists=Y(K(e)));const t=this.getAttribute("items");if(t!==this._lastItemsAttr){this._lastItemsAttr=t,this._items=U(this._lists,K(t));const i=this.getAttribute("persist-key");i&&this._hydratedPersistKey!==i&&(this._items=this._restorePersistedItems(i,this._items),this._hydratedPersistKey=i)}const r=this.getAttribute("selection");r!==this._lastSelectionAttr&&this._syncSelectionFromAttribute(r),this._focusedId||(this._focusedId=this._items.find(i=>!i.hidden)?.id||null)}_restorePersistedItems(e,t){try{const r=window.localStorage.getItem(e);if(!r)return t;const i=JSON.parse(r);if(!i||typeof i!="object"||!Array.isArray(i.records))return t;const s=new Map(i.records.map(a=>[a.id,a])),n=t.map((a,d)=>{const o=s.get(a.id);return o?{...a,listId:this._lists.some(u=>u.id===o.listId)?o.listId:a.listId,parentId:typeof o.parentId=="string"?o.parentId:null,order:Number.isFinite(o.index)?o.index:d}:{...a,order:d}});return U(this._lists,n)}catch{return t}}_resolvedFocusedId(e){const t=new Set(Array.from(e.values()).flat().map(i=>i.id));return this._focusedId&&t.has(this._focusedId)?this._focusedId:Array.from(e.values()).flat().find(i=>!i.disabled)?.id||null}_restorePendingFocus(){const e=this._pendingFocusId||this._focusedId;if(!e)return;const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/"/g,'\\"'),r=this.root.querySelector(`.item[data-id="${t}"]`);r&&(document.activeElement!==r&&r.focus({preventScroll:!0}),this._pendingFocusId=null)}_escapeSelectorValue(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/"/g,'\\"')}_findDropzone(e){const t=this._escapeSelectorValue(e.listId),r=this._escapeSelectorValue(e.parentId??""),i=this._escapeSelectorValue(e.beforeId??""),s=this._escapeSelectorValue(e.mode);return this.root.querySelector(`.dropzone[data-list-id="${t}"][data-parent-id="${r}"][data-before-id="${i}"][data-mode="${s}"]`)}_findItemElement(e){const t=this._escapeSelectorValue(e);return this.root.querySelector(`.item[data-id="${t}"]`)}_dragHandleMode(){return ce(this.getAttribute("drag-handle-mode"))}_dropzoneStyle(){return this.getAttribute("dropzone-style")==="container"?"container":"indicator"}_usesCustomHandleSelector(){return!!this.getAttribute("drag-handle-selector")?.trim()}_dragActivatorFromPath(e){const t=e.find(n=>n instanceof HTMLElement&&!!n.getAttribute("data-drag-trigger"));if(!t)return null;const r=t.getAttribute("data-drag-trigger"),i=r==="item"?"item":r==="custom"?"custom":"handle",s=t.getAttribute("data-id")||t.closest(".item[data-id]")?.getAttribute("data-id");return s?{element:t,id:s,kind:i}:null}_setDropTargetVisualState(e,t){if(!e)return;const r=this._findDropzone(e);r&&(r.setAttribute("data-active",t?"true":"false"),t?this._syncDropzoneContainerSize(r,e):this._clearDropzoneContainerSize(r)),e.mode==="inside"&&e.parentId&&this._findItemElement(e.parentId)?.setAttribute("data-drop-inside-active",t?"true":"false")}_applyCurrentDropTargetVisualState(e){this._setDropTargetVisualState(e??null,!1),this._setDropTargetVisualState(this._dragState?.dropTarget??null,!0)}_applyLiveMessage(){const e=this.root.querySelector(".sr-only[aria-live]");e&&(e.textContent=this._liveMessage)}_canSyncInteractiveStateInPlace(){return!!this.root.querySelector(".root")&&!this._dragState}_applyInteractiveStateInPlace(e){return this._canSyncInteractiveStateInPlace()?(this._syncSelectionVisualState(),e?.restoreFocus&&this._restorePendingFocus(),this._applyLiveMessage(),!0):!1}_hasCustomItemRendering(){return this.hasAttribute("custom-item-rendering")}_syncSelectionFromAttribute(e){this._lastSelectionAttr=e;const t=new Set(this._items.map(r=>r.id));this._selection=K(e).filter(r=>t.has(r)),!this._selection.length&&this._focusedId&&!t.has(this._focusedId)&&(this._focusedId=null)}_syncSelectionVisualState(){const e=new Set(this._selection),t=this.getAttribute("show-selection-badge")!=="false";this.root.querySelectorAll(".item[data-id]").forEach(s=>{const n=s.getAttribute("data-id");if(!n)return;const a=e.has(n),d=this._focusedId===n;s.setAttribute("data-selected",a?"true":"false"),s.setAttribute("aria-selected",a?"true":"false"),s.setAttribute("data-focused",d?"true":"false"),s.setAttribute("tabindex",d?"0":"-1");const o=s.querySelector('[data-selection-badge="true"]');if(o){const u=a&&t;o.hidden=!u,o.textContent=u?"Selected":""}});const r=this.root.querySelector(".selection-pill");r&&(r.textContent=String(this._selection.length));const i=this.root.querySelector(".selection-text");i&&(i.textContent=this._selection.length===1?"item selected":"items selected")}_clearDropzoneContainerSize(e){e.style.removeProperty("--ui-sortable-dropzone-match-block-size"),e.style.removeProperty("--ui-sortable-dropzone-match-inline-size")}_dropzoneReferenceElement(e,t){if(e.mode==="inside"&&e.parentId)return this._findItemElement(e.parentId);let r=t.nextElementSibling;for(;r;){if(r instanceof HTMLElement&&r.classList.contains("item-shell"))return r.querySelector(".item[data-id]");r=r.nextElementSibling}let i=t.previousElementSibling;for(;i;){if(i instanceof HTMLElement&&i.classList.contains("item-shell"))return i.querySelector(".item[data-id]");i=i.previousElementSibling}const s=this._escapeSelectorValue(e.listId),n=this.root.querySelector(`.list[data-list-id="${s}"] .items`),a=n?.querySelector(".item[data-id]");return a||n||null}_syncDropzoneContainerSize(e,t){if(this._clearDropzoneContainerSize(e),this._dropzoneStyle()!=="container")return;const r=this._dropzoneReferenceElement(t,e);if(!r)return;const i=r.getBoundingClientRect();e.style.setProperty("--ui-sortable-dropzone-match-block-size",`${Math.max(76,Math.round(i.height))}px`),e.style.setProperty("--ui-sortable-dropzone-match-inline-size",`${Math.max(180,Math.round(i.width))}px`)}_ensureDragPreviewOverlay(){if(this._dragPreviewOverlay&&this._dragPreviewOverlay.isConnected)return this._dragPreviewOverlay;const e=document.createElement("div");return e.className="drag-preview-overlay",e.setAttribute("data-visible","false"),this.root.appendChild(e),this._dragPreviewOverlay=e,e}_clearPointerDragPreview(){this._dragPreviewOverlay?.setAttribute("data-visible","false"),this._dragPreviewOverlay?.style.setProperty("left","-9999px"),this._dragPreviewOverlay?.style.setProperty("top","-9999px");const e=this.root.querySelector(".root");e&&!this._dragState?.keyboard&&e.setAttribute("data-drag-preview","false")}_pointerPreviewContent(){if(!this._dragState||this._dragState.keyboard)return null;const e=this._dragState.movedRootIds[0],t=this._items.find(r=>r.id===e);return t?{kicker:this._dragState.clone?"Copy preview":"Drop preview",title:this._dragState.clone?`${t.label} copy`:t.label,description:this._dragState.clone?"Release to add a copy here.":this._dragState.movedRootIds.length>1?"Release to place this selection here.":"Release to place this item here."}:null}_pointerPreviewSize(){if(this.getAttribute("drag-preview-size")==="compact"||!this._dragState||this._dragState.keyboard)return null;const e=this._dragState.movedRootIds[0],t=e?this._findItemElement(e):null;if(!t)return null;const r=window.getComputedStyle(t),i=de(r.transform);return{width:t.offsetWidth*i.x,height:t.offsetHeight*i.y}}_updatePointerDragPreview(){if(!this._dragState||this._dragState.keyboard){this._clearPointerDragPreview();return}const e=this._pointerPreviewContent();if(!e){this._clearPointerDragPreview();return}const t=this.root.querySelector(".root"),i=this._dragPreviewOverlay?.getAttribute("data-visible")==="true",s=this._pointerPreviewSize();if(!this._dragState.dropTarget){i&&t&&t.setAttribute("data-drag-preview","true");return}const n=this._findDropzone(this._dragState.dropTarget);if(!n){i&&t&&t.setAttribute("data-drag-preview","true");return}const a=this._ensureDragPreviewOverlay();a.innerHTML=`
|
|
770
784
|
<div class="placeholder-content">
|
|
771
|
-
<div class="placeholder-kicker">${
|
|
772
|
-
<div class="placeholder-title">${
|
|
773
|
-
<div class="placeholder-description">${
|
|
785
|
+
<div class="placeholder-kicker">${y(e.kicker)}</div>
|
|
786
|
+
<div class="placeholder-title">${y(e.title)}</div>
|
|
787
|
+
<div class="placeholder-description">${y(e.description)}</div>
|
|
774
788
|
</div>
|
|
775
|
-
`;const
|
|
776
|
-
<div class="item-shell" data-item-shell="${
|
|
789
|
+
`;const d=n.getBoundingClientRect();t&&t.setAttribute("data-drag-preview","true"),a.style.setProperty("left","-9999px"),a.style.setProperty("top","-9999px"),s?(a.style.setProperty("inline-size",`${s.width}px`),a.style.setProperty("block-size",`${s.height}px`)):(a.style.removeProperty("inline-size"),a.style.removeProperty("block-size")),a.setAttribute("data-visible","true");const o=a.getBoundingClientRect(),u=s?.width??o.width,c=s?.height??o.height,h=Math.max(16,Math.min(d.left,window.innerWidth-u-16)),f=Math.max(16,Math.min(d.top+(d.height-c)/2,window.innerHeight-c-16));a.style.setProperty("left",`${Math.round(h)}px`),a.style.setProperty("top",`${Math.round(f)}px`)}_setDraggingVisualState(e,t){e.forEach(r=>{const i=this._findItemElement(r);i&&(i.setAttribute("data-dragging",t?"true":"false"),i.setAttribute("aria-grabbed",t?"true":"false"),t&&i.getBoundingClientRect())})}_setDropTarget(e,t){const r=this._dragState?.dropTarget??null;if(!(!this._dragState||B(r,e))){if(this._pendingDropTarget=null,this._dragState.dropTarget=e,this._applyCurrentDropTargetVisualState(r),t?.announceLabel&&this._announce(t.announceLabel),this._dragState.keyboard){this.requestRender();return}this._updatePointerDragPreview()}}_queueDropTarget(e,t,r){if(!this._dragState)return;const i=this._dragState.dropTarget??null;if(B(i,e)){this._pendingDropTarget=null;return}if(!i&&e){this._setDropTarget(e,r);return}const s=typeof t=="number"&&Number.isFinite(t)?t:performance.now(),n=this._pendingDropTarget;if(n&&B(n.target,e)){const a=e?ne:ae;s-n.startedAt>=a&&this._setDropTarget(e,n.announceLabel?{announceLabel:n.announceLabel}:r);return}this._pendingDropTarget={target:e,startedAt:s,announceLabel:r?.announceLabel}}_releaseDropTarget(e,t){if(!this._dragState)return null;if(Number.isFinite(e)&&Number.isFinite(t)){const n=this._dropTargetFromPoint(e,t);if(n&&this._canDrop(n,this._dragState.movedRootIds))return this._pendingDropTarget=null,n}const r=this._pendingDropTarget?.target??null;this._pendingDropTarget=null;const i=n=>this._pointerIsOverList(n.listId,e,t);if(r&&this._canDrop(r,this._dragState.movedRootIds)&&i(r))return r;const s=this._dragState.dropTarget??null;return s&&this._canDrop(s,this._dragState.movedRootIds)&&i(s)?s:null}_pointerIsOverList(e,t,r){if(!Number.isFinite(t)||!Number.isFinite(r))return!0;const s=Array.from(this.root.querySelectorAll(".list[data-list-id]")).find(a=>a.getAttribute("data-list-id")===e);if(!s)return!0;const n=s.getBoundingClientRect();return t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom}_pathFromPoint(e,t){const r=[],i=this.root;let s=typeof i.elementFromPoint=="function"?i.elementFromPoint(e,t):this.ownerDocument?.elementFromPoint(e,t)??null;for(;s&&(s instanceof HTMLElement&&r.push(s),s!==this);){if(s instanceof ShadowRoot){s=s.host;continue}s=s.parentNode,!s&&r[r.length-1]?.getRootNode()instanceof ShadowRoot&&(s=r[r.length-1].getRootNode().host)}return r}_measureItemShellRects(){const e=new Map;return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(t=>{const r=t.getAttribute("data-item-shell");if(!r)return;const i=t.getBoundingClientRect();e.set(r,{top:i.top,left:i.left})}),e}_animateItemShellReflow(e){if(!e.size)return;const t=new Set(this._draggingIds());this.root.querySelectorAll(".item-shell[data-item-shell]").forEach(r=>{const i=r.getAttribute("data-item-shell");if(!i||t.has(i))return;const s=e.get(i);if(!s)return;const n=r.getBoundingClientRect(),a=s.left-n.left,d=s.top-n.top;Math.abs(a)<.5&&Math.abs(d)<.5||(r.style.transition="none",r.style.transform=`translate(${a}px, ${d}px)`,r.style.willChange="transform",r.getBoundingClientRect(),requestAnimationFrame(()=>{r.style.transition="transform 180ms ease",r.style.transform="";const o=()=>{r.style.transition="",r.style.willChange="",r.removeEventListener("transitionend",o)};r.addEventListener("transitionend",o),window.setTimeout(o,220)}))})}_previewCloneSubtreeItem(e,t){const r=e.id.includes("--copy-")?e.id.split("--copy-")[0]:e.id;return{...e,id:`${r}--preview`,label:t[0]===e.id?`${e.label} copy`:e.label}}_projectedMoveResult(){return!this._dragState?.dropTarget||!this._canDrop(this._dragState.dropTarget,this._dragState.movedRootIds)?null:ue(this._items,this._lists,this._dragState.dropTarget,this._dragState.movedRootIds,this._dragState.clone,(e,t)=>this._previewCloneSubtreeItem(e,t))}_renderListTree(e,t,r,i,s,n,a){const d=T(e),o=E(e),u=c=>{const h=o.get(k(t.id,c))||[],f=this.sort==="label"?[...h].sort((I,m)=>{const v=d.get(I),D=d.get(m);return!v||!D?0:v.label.localeCompare(D.label)}):h;let _="";return f.forEach(I=>{const m=d.get(I);if(!m||m.hidden)return;const v=this._renderChildBranch(m,r,i,u,s,n,a);!W(m,this.filterQuery)&&!v.includes('class="item"')||(_+=this._renderDropzone({listId:t.id,parentId:c,beforeId:I,mode:"before"},"Drop here"),_+=v)}),_+=this._renderDropzone({listId:t.id,parentId:c,beforeId:null,mode:"before"},"Drop here"),_};return`<div class="tree">${u(null)}</div>`}_renderChildBranch(e,t,r,i,s,n,a){const d=y(e.id),o=n.has(e.id),u=o?"":i(e.id),c=u.includes('class="item"'),h=o?!1:this._selection.includes(e.id),f=o?!1:r.has(e.id),_=e.disabled,I=_||e.dragDisabled||this._isDragLocked(),m=this._dragState?.dropTarget?.mode==="inside"&&this._dragState.dropTarget.parentId===e.id,v=this._dragState?.clone?"Copy preview":"Drop preview",D=this._dragState?.clone?"Release to add a copy here.":this._dragState&&this._dragState.movedRootIds.length>1?"Release to place this selection here.":"Release to place this item here.",A=this._dragHandleMode(),z=this._usesCustomHandleSelector(),b=z?"custom":A,S=!z&&A==="handle";return`
|
|
790
|
+
<div class="item-shell" data-item-shell="${d}">
|
|
777
791
|
<article
|
|
778
|
-
class="item${
|
|
792
|
+
class="item${o?" item-placeholder":""}"
|
|
779
793
|
part="item"
|
|
780
|
-
data-id="${
|
|
781
|
-
data-drag-handle-mode="${
|
|
782
|
-
${!
|
|
783
|
-
data-selected="${
|
|
784
|
-
data-focused="${
|
|
785
|
-
data-dragging="${
|
|
786
|
-
data-disabled="${
|
|
787
|
-
data-drop-inside-active="${
|
|
788
|
-
role="${
|
|
789
|
-
aria-selected="${
|
|
790
|
-
aria-disabled="${
|
|
791
|
-
aria-grabbed="${
|
|
792
|
-
aria-hidden="${
|
|
793
|
-
tabindex="${
|
|
794
|
+
data-id="${d}"
|
|
795
|
+
data-drag-handle-mode="${b}"
|
|
796
|
+
${!o&&b==="item"?'data-drag-trigger="item"':""}
|
|
797
|
+
data-selected="${h}"
|
|
798
|
+
data-focused="${o?"false":t===e.id}"
|
|
799
|
+
data-dragging="${f}"
|
|
800
|
+
data-disabled="${_}"
|
|
801
|
+
data-drop-inside-active="${m?"true":"false"}"
|
|
802
|
+
role="${o?"presentation":"option"}"
|
|
803
|
+
aria-selected="${o?"false":h}"
|
|
804
|
+
aria-disabled="${_}"
|
|
805
|
+
aria-grabbed="${o?"false":f}"
|
|
806
|
+
aria-hidden="${o?"true":"false"}"
|
|
807
|
+
tabindex="${o?"-1":t===e.id?"0":"-1"}"
|
|
794
808
|
>
|
|
795
|
-
${
|
|
809
|
+
${o?`
|
|
796
810
|
<div class="placeholder-content">
|
|
797
|
-
<div class="placeholder-kicker">${
|
|
798
|
-
<div class="placeholder-title">${
|
|
799
|
-
<div class="placeholder-description">${
|
|
811
|
+
<div class="placeholder-kicker">${y(v)}</div>
|
|
812
|
+
<div class="placeholder-title">${y(e.label)}</div>
|
|
813
|
+
<div class="placeholder-description">${y(D)}</div>
|
|
800
814
|
</div>
|
|
801
815
|
`:`
|
|
802
|
-
${
|
|
816
|
+
${S?`
|
|
803
817
|
<button
|
|
804
818
|
class="handle"
|
|
805
819
|
part="handle"
|
|
806
820
|
type="button"
|
|
807
821
|
data-action="handle"
|
|
808
822
|
data-drag-trigger="handle"
|
|
809
|
-
data-id="${
|
|
823
|
+
data-id="${d}"
|
|
810
824
|
draggable="false"
|
|
811
|
-
${
|
|
812
|
-
aria-label="Drag ${
|
|
825
|
+
${I?"disabled":""}
|
|
826
|
+
aria-label="Drag ${y(e.label)}"
|
|
813
827
|
>
|
|
814
828
|
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
815
829
|
<circle cx="5" cy="4" r="1.25"></circle>
|
|
@@ -821,13 +835,13 @@
|
|
|
821
835
|
</svg>
|
|
822
836
|
</button>
|
|
823
837
|
`:""}
|
|
824
|
-
<div class="item-content" data-action="select" data-id="${
|
|
825
|
-
<div class="item-custom-content" part="item-custom-content" data-item-content-target="${
|
|
838
|
+
<div class="item-content" data-action="select" data-id="${d}">
|
|
839
|
+
<div class="item-custom-content" part="item-custom-content" data-item-content-target="${d}"></div>
|
|
826
840
|
<div class="item-default-content">
|
|
827
|
-
<div class="item-title">${
|
|
828
|
-
${e.description?`<div class="item-description">${
|
|
841
|
+
<div class="item-title">${y(e.label)}</div>
|
|
842
|
+
${e.description?`<div class="item-description">${y(e.description)}</div>`:""}
|
|
829
843
|
<div class="item-meta">
|
|
830
|
-
<span class="item-badge selection-badge" data-selection-badge="true" ${
|
|
844
|
+
<span class="item-badge selection-badge" data-selection-badge="true" ${h&&a?"":"hidden"}>${h&&a?"Selected":""}</span>
|
|
831
845
|
${e.cloneOnDrag?'<span class="item-badge">Clone on drag</span>':""}
|
|
832
846
|
${e.dragDisabled?'<span class="item-badge">Pinned</span>':""}
|
|
833
847
|
${s?'<span class="item-badge drop-badge">Nest here</span>':""}
|
|
@@ -836,20 +850,20 @@
|
|
|
836
850
|
</div>
|
|
837
851
|
`}
|
|
838
852
|
</article>
|
|
839
|
-
${s&&!
|
|
840
|
-
${c?`<div class="children">${
|
|
853
|
+
${s&&!o?this._renderDropzone({listId:e.listId,parentId:e.id,beforeId:null,mode:"inside"},"Nest here"):""}
|
|
854
|
+
${c?`<div class="children">${u}</div>`:""}
|
|
841
855
|
</div>
|
|
842
|
-
`}_renderDropzone(e,
|
|
856
|
+
`}_renderDropzone(e,t){const r=this._dragState?.dropTarget&&this._dragState.dropTarget.listId===e.listId&&this._dragState.dropTarget.parentId===e.parentId&&this._dragState.dropTarget.beforeId===e.beforeId&&this._dragState.dropTarget.mode===e.mode;return`
|
|
843
857
|
<div
|
|
844
858
|
class="dropzone"
|
|
845
859
|
part="dropzone"
|
|
846
|
-
data-list-id="${
|
|
847
|
-
data-parent-id="${
|
|
848
|
-
data-before-id="${
|
|
860
|
+
data-list-id="${y(e.listId)}"
|
|
861
|
+
data-parent-id="${y(e.parentId??"")}"
|
|
862
|
+
data-before-id="${y(e.beforeId??"")}"
|
|
849
863
|
data-mode="${e.mode}"
|
|
850
|
-
data-active="${
|
|
864
|
+
data-active="${r?"true":"false"}"
|
|
851
865
|
aria-hidden="true"
|
|
852
866
|
>
|
|
853
|
-
<span class="dropzone-label">${
|
|
867
|
+
<span class="dropzone-label">${y(t)}</span>
|
|
854
868
|
</div>
|
|
855
|
-
`}_onClick(e){const r=e.composedPath(),t=r.find(n=>{var d;return n instanceof HTMLElement&&((d=n.classList)==null?void 0:d.contains("toolbar"))}),i=this._dragActivatorFromPath(r),s=r.find(n=>n instanceof HTMLElement&&n.classList.contains("item"));if(i&&i.kind!=="item")return;if(!s)return t&&!(e.target instanceof HTMLButtonElement),void 0;const o=s.getAttribute("data-id");if(!o)return;const a=this._items.find(n=>n.id===o);if(!a||a.disabled)return;const l=e;if(l.shiftKey?this._selectRangeTo(o):l.metaKey||l.ctrlKey?this._toggleSelection(o):this._setSelection([o],"pointer"),this._focusedId=o,this._rangeAnchorId=o,this._pendingFocusId=o,this._hasCustomItemRendering()){this._syncSelectionVisualState(),this._restorePendingFocus();return}this.requestRender()}_onFocusIn(e){const r=e.composedPath().find(i=>i instanceof HTMLElement&&i.classList.contains("item")),t=r==null?void 0:r.getAttribute("data-id");t&&(this._focusedId=t,this._syncSelectionVisualState())}_onKeyDown(e){var l;const r=this._visibleItemIds();if(!r.length)return;const t=this._focusedId&&r.includes(this._focusedId)?this._focusedId:r[0],i=r.indexOf(t),s=this._items.find(n=>n.id===t),o=s?this._lists.find(n=>n.id===s.listId):null,a=(o==null?void 0:o.orientation)==="horizontal";if(!((l=this._dragState)!=null&&l.keyboard)){if(e.key==="ArrowDown"&&!a||e.key==="ArrowRight"&&a){e.preventDefault(),this._moveFocusBy(r,i,1);return}if(e.key==="ArrowUp"&&!a||e.key==="ArrowLeft"&&a){e.preventDefault(),this._moveFocusBy(r,i,-1);return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="a"){e.preventDefault(),this._setSelection(r,"keyboard"),this._announce(`${r.length} items selected.`);return}if(e.key==="Enter"){e.preventDefault(),this._setSelection([t],"keyboard");return}if(e.key===" "||e.code==="Space"){if(e.preventDefault(),this._isDragLocked()){this._announce("Dragging is disabled right now.");return}const n=this._selectedRootIds(t);if(!n.length)return;const d=this._itemClonesOnDrag(t);this._dragState={snapshot:this._items.map($),movedRootIds:n,originId:t,clone:d,keyboard:!0,dropTarget:this._initialKeyboardDropTarget(t),committed:!1};const c=n.length===1?`Lifted ${(s==null?void 0:s.label)||"item"}.`:`Lifted ${n.length} items.`;this._announce(`${c} Use arrow keys to choose a destination.`),this.requestRender();return}if(e.key==="Escape"){this._setSelection([],"keyboard");return}return}if(e.key==="Escape"){e.preventDefault(),this._cancelDrag(!0);return}if(e.key==="Enter"||e.key===" "||e.code==="Space"){e.preventDefault();const n=this._dragState.dropTarget;if(!n)return;this._commitMove(n,this._dragState.movedRootIds,this._dragState.clone,"keyboard");return}if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(e.key)){e.preventDefault();const n=e.key==="ArrowDown"||e.key==="ArrowRight"?1:-1;this._moveKeyboardDropTarget(n)}}_moveFocusBy(e,r,t){const i=Math.max(0,Math.min(e.length-1,r+t)),s=e[i];this._focusedId=s,this._pendingFocusId=s,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender()}_onDragStart(e){const r=this._dragActivatorFromPath(e.composedPath()),t=r==null?void 0:r.id;if(!r||!t){e.preventDefault();return}if(this._isDragLocked()){e.preventDefault(),this._announce("Dragging is disabled right now.");return}const i=this._items.find(a=>a.id===t);if(!i||i.disabled||i.dragDisabled){e.preventDefault();return}const s=this._selection.includes(t)?this._selectedRootIds(t):[t];this._selection.includes(t)||this._setSelection([t],"pointer");const o=this._itemClonesOnDrag(t);this._dragState={snapshot:this._items.map($),movedRootIds:s,originId:t,clone:o,keyboard:!1,dropTarget:null,committed:!1},e.dataTransfer&&(e.dataTransfer.effectAllowed=o?"copyMove":"move",e.dataTransfer.setData("text/plain",s.join(",")),this._applyDragImage(e.dataTransfer,s.length)),this._announce(o?`Dragging ${s.length===1?i.label:`${s.length} items`} as a copy.`:`Dragging ${s.length===1?i.label:`${s.length} items`}.`),this.requestRender()}_onDragOver(e){if(!this._dragState||this._dragState.keyboard)return;const r=this._dropTargetFromEvent(e);if(!r||!this._canDrop(r,this._dragState.movedRootIds)){this._queueDropTarget(null,e.timeStamp);return}e.preventDefault(),this._queueDropTarget(r,e.timeStamp),e.dataTransfer&&(e.dataTransfer.dropEffect=this._dragState.clone?"copy":"move")}_onDrop(e){if(!this._dragState||this._dragState.keyboard)return;const r=this._dropTargetFromEvent(e);!r||!this._canDrop(r,this._dragState.movedRootIds)||(e.preventDefault(),this._commitMove(r,this._dragState.movedRootIds,this._dragState.clone,"pointer"))}_onDocumentKeyDown(e){e.key==="Escape"&&(!this._dragState||this._dragState.keyboard||(e.preventDefault(),this._cancelDrag(!0)))}_onDragEnd(){!this._dragState||this._dragState.keyboard||this._dragState.committed||(this._pendingDropTarget=null,this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this._announce("Drag cancelled."),this.requestRender())}_dropTargetFromEvent(e){return this._dropTargetFromPath(e.composedPath(),e.clientX,e.clientY)}_dropTargetFromPath(e,r,t){const i=e.find(_=>_ instanceof HTMLElement&&_.classList.contains("dropzone"));if(i){const _={listId:i.getAttribute("data-list-id")||"",parentId:i.getAttribute("data-parent-id")||null,beforeId:i.getAttribute("data-before-id")||null,mode:i.getAttribute("data-mode")==="inside"?"inside":"before"};if(_.listId)return _}const s=e.find(_=>_ instanceof HTMLElement&&_.classList.contains("item"));if(!s)return null;const o=s.getAttribute("data-id");if(!o)return null;const a=this._items.find(_=>_.id===o);if(!a)return null;const l=this._lists.find(_=>_.id===a.listId),n=s.getBoundingClientRect(),d=(l==null?void 0:l.orientation)==="horizontal",c=d?n.left:n.top,g=d?n.right:n.bottom,m=d?r:t,f=Math.max(1,g-c),v=(m-c)/f,b=this.getAttribute("allow-nesting")!=="false"&&!a.disabled;if(v<=.34)return{listId:a.listId,parentId:a.parentId,beforeId:a.id,mode:"before"};if(b&&v>=.34&&v<=.74)return{listId:a.listId,parentId:a.id,beforeId:null,mode:"inside"};const w=E(this._items).get(z(a.listId,a.parentId))||[],k=w.indexOf(a.id),A=k>=0&&w[k+1]||null;return{listId:a.listId,parentId:a.parentId,beforeId:A,mode:"before"}}_dropTargetFromPoint(e,r){return this._dropTargetFromPath(this._pathFromPoint(e,r),e,r)}_beginPointerDrag(e,r){if(!this._pointerGesture||this._dragState)return;const t=this._items.find(i=>{var s;return i.id===((s=this._pointerGesture)==null?void 0:s.originId)});t&&(this._dragState={snapshot:this._items.map($),movedRootIds:[...this._pointerGesture.movedRootIds],originId:this._pointerGesture.originId,clone:this._pointerGesture.clone,keyboard:!1,dropTarget:null,committed:!1},this._pendingDropTarget=null,this._applyPointerPreview(e,r,this._dragState.movedRootIds.length,this._dragState.clone),this._setDraggingVisualState(this._draggingIds(),!0),this._announce(this._dragState.clone?`Dragging ${this._dragState.movedRootIds.length===1?t.label:`${this._dragState.movedRootIds.length} items`} as a copy.`:`Dragging ${this._dragState.movedRootIds.length===1?t.label:`${this._dragState.movedRootIds.length} items`}.`))}_onPointerDown(e){var o,a;const r=this._dragActivatorFromPath(e.composedPath()),t=r==null?void 0:r.id;if(!r||!t)return;if(this._isDragLocked()){e.preventDefault(),this._announce("Dragging is disabled right now.");return}const i=this._items.find(l=>l.id===t);if(!i||i.disabled||i.dragDisabled){e.preventDefault();return}e.preventDefault();try{(a=(o=r.element).setPointerCapture)==null||a.call(o,e.pointerId)}catch{}const s=this._selection.includes(t)?this._selectedRootIds(t):[t];this._pointerGesture={pointerId:e.pointerId,pointerType:e.pointerType,originId:t,movedRootIds:s,clone:this._itemClonesOnDrag(t),startX:e.clientX,startY:e.clientY,moved:!1,captureTarget:r.element}}_onPointerMove(e){if(!(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)){if(e.preventDefault(),!this._pointerGesture.moved){if(Math.hypot(e.clientX-this._pointerGesture.startX,e.clientY-this._pointerGesture.startY)<6)return;this._pointerGesture.moved=!0,this._beginPointerDrag(e.clientX,e.clientY)}if(!(!this._dragState||this._dragState.keyboard)&&(this._movePointerPreview(e.clientX,e.clientY),!this._dragState.committed)){const r=this._dropTargetFromPoint(e.clientX,e.clientY);if(!r||!this._canDrop(r,this._dragState.movedRootIds)){this._queueDropTarget(null,e.timeStamp);return}this._queueDropTarget(r,e.timeStamp)}}}_onPointerUp(e){var i,s;if(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)return;e.preventDefault();try{(s=(i=this._pointerGesture.captureTarget)==null?void 0:i.releasePointerCapture)==null||s.call(i,e.pointerId)}catch{}const r=this._pointerGesture;if(this._pointerGesture=null,!this._dragState||this._dragState.keyboard)return;const t=r.moved?this._releaseDropTarget(e.clientX,e.clientY):null;if(r.moved&&t){this._commitMove(t,this._dragState.movedRootIds,this._dragState.clone,"pointer");return}r.moved?this._cancelDrag(!0):(this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender())}_onPointerCancel(e){!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId||(this._pointerGesture=null,this._dragState&&this._cancelDrag(!0))}_setSelection(e,r){const t=new Set(this._items.map(a=>a.id)),i=Array.from(new Set(e.filter(a=>t.has(a)))),s=[...this._selection];this._selection=i,this._rangeAnchorId=i[i.length-1]||null,this._focusedId=i[i.length-1]||this._focusedId;const o=j(i);if(this.getAttribute("selection")!==o){this._lastSelectionAttr=o,this._suppressAttributeRender=!0;try{i.length?this.setAttribute("selection",o):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:[...i],previousSelection:s},bubbles:!0,composed:!0})),r!=="restore"){if(this._applyInteractiveStateInPlace({restoreFocus:!0}))return;this.requestRender()}}_toggleSelection(e){const r=this._selection.includes(e)?this._selection.filter(t=>t!==e):[...this._selection,e];this._setSelection(r,"pointer"),this._announce(`${r.length} items selected.`)}_selectRangeTo(e){const r=this._visibleItemIds(),t=this._rangeAnchorId||this._focusedId||e,i=r.indexOf(t),s=r.indexOf(e);if(i<0||s<0){this._setSelection([e],"pointer");return}const[o,a]=i<=s?[i,s]:[s,i];this._setSelection(r.slice(o,a+1),"pointer"),this._announce(`${a-o+1} items selected.`)}_visibleItemIds(){const e=Q(this._items,new Set(this._selection),new Set(this._draggingIds()),this.filterQuery,this.sort);return Array.from(e.values()).flat().filter(r=>!r.disabled).map(r=>r.id)}_selectedRootIds(e){const r=this._selection.length?[...this._selection]:e?[e]:[],t=M(this._items),i=new Set(r);return r.filter(s=>{var l;const o=t.get(s);if(!o)return!1;let a=o.parentId;for(;a;){if(i.has(a))return!1;a=((l=t.get(a))==null?void 0:l.parentId)??null}return!o.disabled})}_draggingIds(){if(!this._dragState)return[];const e=M(this._items),r=E(this._items),t=[],i=s=>{t.push(s);const o=e.get(s);if(!o)return;(r.get(z(o.listId,s))||[]).forEach(i)};return this._dragState.movedRootIds.forEach(i),t}_itemClonesOnDrag(e){const r=this._items.find(i=>i.id===e);if(!r)return!1;if(r.cloneOnDrag)return!0;const t=this._lists.find(i=>i.id===r.listId);return!!(t!=null&&t.cloneOnDrag)}_isDragLocked(){return!!(this.hasAttribute("disabled")||this.sort!=="manual"||this.filterQuery&&!this.hasAttribute("allow-filtered-drag"))}_canDrop(e,r){var n;if(this._isDragLocked())return!1;const t=this._lists.find(d=>d.id===e.listId);if(!t||t.disabled)return!1;const i=M(this._items),s=new Set,o=E(this._items),a=d=>{s.add(d);const c=i.get(d);c&&(o.get(z(c.listId,d))||[]).forEach(a)};if(r.forEach(a),e.parentId&&s.has(e.parentId)||e.beforeId&&s.has(e.beforeId))return!1;const l=Array.from(new Set(r.map(d=>{var c;return(c=i.get(d))==null?void 0:c.listId}).filter(Boolean)));return!((n=t.accepts)!=null&&n.length&&l.some(d=>{var c;return!((c=t.accepts)!=null&&c.includes(d))})||e.mode==="inside"&&this.getAttribute("allow-nesting")==="false")}_commitMove(e,r,t,i){if(!this._canDrop(e,r))return;const s=M(this._items),o=E(this._items),a=new Set,l=[],n=p=>{const D=s.get(p);!D||a.has(p)||(a.add(p),l.push(p),(o.get(z(D.listId,p))||[]).forEach(n))};r.forEach(n);const d=this._items.map($),c=d.filter(p=>a.has(p.id)),g=t?d.map($):d.filter(p=>!a.has(p.id)),m=t?c.map(p=>this._cloneSubtreeItem(p,l)):c.map($),f=new Map,v=new Map;t&&c.forEach((p,D)=>{f.set(p.id,m[D].id),v.set(m[D].id,p.id)}),m.forEach(p=>{const D=t?v.get(p.id):p.id,q=D?s.get(D):null;q&&(t&&(p.parentId=q.parentId&&f.has(q.parentId)&&f.get(q.parentId)||null),p.listId=e.listId)});const b=r.map(p=>f.get(p)||p),y=[...g,...m],w=E(g),k=z(e.listId,e.parentId),A=[...w.get(k)||[]],_=e.beforeId?A.indexOf(e.beforeId):A.length,R=_>=0?_:A.length;A.splice(R,0,...b),w.set(k,A),E(m).forEach((p,D)=>{const[,q]=D.split("::");(q||"")!=="__root__"&&w.set(D,[...p])});const C=M(y);b.forEach(p=>{const D=C.get(p);D&&(D.parentId=e.parentId,D.listId=e.listId)});const T=[],P=new Set,L=(p,D)=>{(w.get(z(p,D))||[]).forEach((N,ee)=>{const H=C.get(N);!H||P.has(N)||(P.add(N),H.listId=p,H.parentId=D,H.order=ee,T.push(H),L(p,N))})};this._lists.forEach(p=>L(p.id,null)),y.forEach(p=>{P.has(p.id)||(p.parentId=null,T.push(p))}),this._dragState&&(this._dragState.committed=!0),this._items=T.map($),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage();const G=[...b],h=[...this._selection];this._selection=G,this._focusedId=G[0]||null,this._pendingFocusId=this._focusedId,this._syncAttributesFromState();const x=J(this._items);this._persistSnapshot(x);const F=r.map(p=>s.get(p)).filter(p=>!!p),O=t?"clone":e.mode==="inside"?"nest":F.some(p=>p.listId!==e.listId)?"transfer":"reorder",K={items:this.items,lists:this.lists,selection:[...G],previousSelection:h,movedIds:[...b],source:i,operation:O,persistence:x};this.dispatchEvent(new CustomEvent("change",{detail:K,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("persist-request",{detail:K,bubbles:!0,composed:!0})),this._announce(this._messageForMove(O,b.length,e)),this.requestRender()}_syncAttributesFromState(){const e=ce(this._lists),r=le(this._items),t=j(this._selection);this._lastListsAttr=e,this._lastItemsAttr=r,this._lastSelectionAttr=t,this._suppressAttributeRender=!0;try{this.setAttribute("lists",e),this.setAttribute("items",r),this._selection.length?this.setAttribute("selection",t):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}_cloneSubtreeItem(e,r){const i=`copy-${this._cloneSeed++}`,o=`${e.id.includes("--copy-")?e.id.split("--copy-")[0]:e.id}--${i}`;return{...e,id:o,label:r[0]===e.id?`${e.label} copy`:e.label}}_messageForMove(e,r,t){const i=this._lists.find(o=>o.id===t.listId),s=(i==null?void 0:i.label)||t.listId;return e==="clone"?`${r===1?"Item copied":`${r} items copied`} into ${s}.`:e==="nest"?`${r===1?"Item nested":`${r} items nested`} in ${s}.`:e==="transfer"?`${r===1?"Item moved":`${r} items moved`} to ${s}.`:`${r===1?"Item reordered":`${r} items reordered`} in ${s}.`}_persistSnapshot(e){const r=this.getAttribute("persist-key");if(r)try{window.localStorage.setItem(r,JSON.stringify(e))}catch{}}_announce(e){this._liveMessage=e,this._applyLiveMessage()}_cancelDrag(e){this._dragState&&(this._pendingDropTarget=null,this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._items=this._dragState.snapshot.map($),this._dragState=null,this._pointerGesture=null,this._removeDragImage(),e&&this._announce("Drag cancelled."),this._syncAttributesFromState(),this.requestRender())}_applyDragImage(e,r){this._removeDragImage();const t=document.createElement("div");t.textContent=r===1?"Dragging item":`Dragging ${r} items`,t.style.position="fixed",t.style.top="-999px",t.style.left="-999px",t.style.padding="8px 12px",t.style.borderRadius="999px",t.style.background="rgba(15, 23, 42, 0.92)",t.style.color="#f8fafc",t.style.font="600 12px/1 Inter, sans-serif",t.style.pointerEvents="none",document.body.appendChild(t),e.setDragImage(t,12,12),this._dragImage=t}_removeDragImage(){var e;(e=this._dragImage)==null||e.remove(),this._dragImage=null}_removeDragPreviewOverlay(){var e;(e=this._dragPreviewOverlay)==null||e.remove(),this._dragPreviewOverlay=null}_applyPointerPreview(e,r,t,i){this._removeDragImage();const s=document.createElement("div");s.textContent=i?t===1?"Copying item":`Copying ${t} items`:t===1?"Moving item":`Moving ${t} items`,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.zIndex="2147483647",s.style.padding="8px 12px",s.style.borderRadius="999px",s.style.background="rgba(15, 23, 42, 0.92)",s.style.color="#f8fafc",s.style.font="600 12px/1 Inter, sans-serif",s.style.pointerEvents="none",s.style.boxShadow="0 12px 28px rgba(15, 23, 42, 0.22)",document.body.appendChild(s),this._dragImage=s,this._movePointerPreview(e,r)}_movePointerPreview(e,r){this._dragImage&&(this._dragImage.style.transform=`translate(${Math.round(e+14)}px, ${Math.round(r+14)}px)`)}_keyboardDropTargets(){const e=M(this._items),r=E(this._items),t=[],i=(s,o)=>{var l;(r.get(z(s,o))||[]).forEach(n=>{const d=e.get(n);!d||d.hidden||(t.push({listId:s,parentId:o,beforeId:n,mode:"before",label:`Before ${d.label}`}),this.getAttribute("allow-nesting")!=="false"&&t.push({listId:s,parentId:n,beforeId:null,mode:"inside",label:`Nest inside ${d.label}`}),i(s,n))}),t.push({listId:s,parentId:o,beforeId:null,mode:"before",label:o?"After children":`End of ${((l=this._lists.find(n=>n.id===s))==null?void 0:l.label)||s}`})};return this._lists.forEach(s=>i(s.id,null)),t.filter(s=>{var o;return this._canDrop(s,((o=this._dragState)==null?void 0:o.movedRootIds)||[])})}_initialKeyboardDropTarget(e){const r=this._items.find(t=>t.id===e);return r?{listId:r.listId,parentId:r.parentId,beforeId:e,mode:"before"}:null}_moveKeyboardDropTarget(e){if(!this._dragState)return;const r=this._keyboardDropTargets();if(!r.length)return;const t=Math.max(0,r.findIndex(s=>{var o,a,l,n,d,c,g,m;return s.listId===((a=(o=this._dragState)==null?void 0:o.dropTarget)==null?void 0:a.listId)&&s.parentId===((n=(l=this._dragState)==null?void 0:l.dropTarget)==null?void 0:n.parentId)&&s.beforeId===((c=(d=this._dragState)==null?void 0:d.dropTarget)==null?void 0:c.beforeId)&&s.mode===((m=(g=this._dragState)==null?void 0:g.dropTarget)==null?void 0:m.mode)})),i=Math.max(0,Math.min(r.length-1,t+e));this._setDropTarget(r[i],{announceLabel:r[i].label})}}typeof customElements<"u"&&!customElements.get("ui-sortable")&&customElements.define("ui-sortable",Z);exports.UISortable=Z;
|
|
869
|
+
`}_onClick(e){const t=e.composedPath(),r=t.find(o=>o instanceof HTMLElement&&o.classList?.contains("toolbar")),i=this._dragActivatorFromPath(t),s=t.find(o=>o instanceof HTMLElement&&o.classList.contains("item"));if(i&&i.kind!=="item")return;if(!s)return r&&!(e.target instanceof HTMLButtonElement),void 0;const n=s.getAttribute("data-id");if(!n)return;const a=this._items.find(o=>o.id===n);if(!a||a.disabled)return;const d=e;if(d.shiftKey?this._selectRangeTo(n):d.metaKey||d.ctrlKey?this._toggleSelection(n):this._setSelection([n],"pointer"),this._focusedId=n,this._rangeAnchorId=n,this._pendingFocusId=n,this._hasCustomItemRendering()){this._syncSelectionVisualState(),this._restorePendingFocus();return}this.requestRender()}_onFocusIn(e){const r=e.composedPath().find(i=>i instanceof HTMLElement&&i.classList.contains("item"))?.getAttribute("data-id");r&&(this._focusedId=r,this._syncSelectionVisualState())}_isForeignControl(e){const t=e.composedPath()[0];return!(t instanceof HTMLElement)||t.classList.contains("handle")||t.classList.contains("item")?!1:t.isContentEditable||t.matches('input, textarea, select, button, summary, a[href], [role="button"], [role="textbox"], [role="combobox"]')}_onKeyDown(e){if(this._isForeignControl(e))return;const t=this._visibleItemIds();if(!t.length)return;const r=this._focusedId&&t.includes(this._focusedId)?this._focusedId:t[0],i=t.indexOf(r),s=this._items.find(c=>c.id===r),a=(s?this._lists.find(c=>c.id===s.listId):null)?.orientation==="horizontal",d=this._isRtl(),o=a?d?"ArrowLeft":"ArrowRight":"ArrowDown",u=a?d?"ArrowRight":"ArrowLeft":"ArrowUp";if(!this._dragState?.keyboard){if(e.key===o){e.preventDefault(),this._moveFocusBy(t,i,1);return}if(e.key===u){e.preventDefault(),this._moveFocusBy(t,i,-1);return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="a"){e.preventDefault(),this._setSelection(t,"keyboard"),this._announce(`${t.length} items selected.`);return}if(e.key==="Enter"){e.preventDefault(),this._setSelection([r],"keyboard");return}if(e.key===" "||e.code==="Space"){if(e.preventDefault(),this._isDragLocked()){this._announce("Dragging is disabled right now.");return}const c=this._selectedRootIds(r);if(!c.length)return;const h=this._itemClonesOnDrag(r);this._dragState={snapshot:this._items.map(P),movedRootIds:c,originId:r,clone:h,keyboard:!0,dropTarget:this._initialKeyboardDropTarget(r),committed:!1};const f=c.length===1?`Lifted ${s?.label||"item"}.`:`Lifted ${c.length} items.`;this._announce(`${f} Use arrow keys to choose a destination.`),this.requestRender();return}if(e.key==="Escape"){this._setSelection([],"keyboard");return}return}if(e.key==="Escape"){e.preventDefault(),this._cancelDrag(!0);return}if(e.key==="Enter"||e.key===" "||e.code==="Space"){e.preventDefault();const c=this._dragState.dropTarget;if(!c)return;this._commitMove(c,this._dragState.movedRootIds,this._dragState.clone,"keyboard");return}if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(e.key)){e.preventDefault();const c=d?"ArrowLeft":"ArrowRight",h=e.key==="ArrowDown"||e.key===c?1:-1;this._moveKeyboardDropTarget(h)}}_isRtl(){const e=this.ownerDocument?.defaultView?.getComputedStyle(this).direction;return e?e==="rtl":this.closest("[dir]")?.getAttribute("dir")==="rtl"}_moveFocusBy(e,t,r){const i=Math.max(0,Math.min(e.length-1,t+r)),s=e[i];this._focusedId=s,this._pendingFocusId=s,!this._applyInteractiveStateInPlace({restoreFocus:!0})&&this.requestRender()}_onDragStart(e){const t=this._dragActivatorFromPath(e.composedPath()),r=t?.id;if(!t||!r){e.preventDefault();return}if(this._isDragLocked()){e.preventDefault(),this._announce("Dragging is disabled right now.");return}const i=this._items.find(a=>a.id===r);if(!i||i.disabled||i.dragDisabled){e.preventDefault();return}const s=this._selection.includes(r)?this._selectedRootIds(r):[r];this._selection.includes(r)||this._setSelection([r],"pointer");const n=this._itemClonesOnDrag(r);this._dragState={snapshot:this._items.map(P),movedRootIds:s,originId:r,clone:n,keyboard:!1,dropTarget:null,committed:!1},e.dataTransfer&&(e.dataTransfer.effectAllowed=n?"copyMove":"move",e.dataTransfer.setData("text/plain",s.join(",")),this._applyDragImage(e.dataTransfer,s.length)),this._announce(n?`Dragging ${s.length===1?i.label:`${s.length} items`} as a copy.`:`Dragging ${s.length===1?i.label:`${s.length} items`}.`),this.requestRender()}_onDragOver(e){if(!this._dragState||this._dragState.keyboard)return;const t=this._dropTargetFromEvent(e);if(!t||!this._canDrop(t,this._dragState.movedRootIds)){this._queueDropTarget(null,e.timeStamp);return}e.preventDefault(),this._queueDropTarget(t,e.timeStamp),e.dataTransfer&&(e.dataTransfer.dropEffect=this._dragState.clone?"copy":"move")}_onDrop(e){if(!this._dragState||this._dragState.keyboard)return;const t=this._dropTargetFromEvent(e);!t||!this._canDrop(t,this._dragState.movedRootIds)||(e.preventDefault(),this._commitMove(t,this._dragState.movedRootIds,this._dragState.clone,"pointer"))}_onDocumentKeyDown(e){e.key==="Escape"&&(!this._dragState||this._dragState.keyboard||(e.preventDefault(),this._cancelDrag(!0)))}_onDragEnd(){!this._dragState||this._dragState.keyboard||this._dragState.committed||(this._setDraggingVisualState(this._draggingIds(),!1),this._pendingDropTarget=null,this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this._announce("Drag cancelled."),this.requestRender())}_dropTargetFromEvent(e){return this._dropTargetFromPath(e.composedPath(),e.clientX,e.clientY)}_dropTargetFromPath(e,t,r){const i=e.find(S=>S instanceof HTMLElement&&S.classList.contains("dropzone"));if(i){const S={listId:i.getAttribute("data-list-id")||"",parentId:i.getAttribute("data-parent-id")||null,beforeId:i.getAttribute("data-before-id")||null,mode:i.getAttribute("data-mode")==="inside"?"inside":"before"};if(S.listId)return S}const s=e.find(S=>S instanceof HTMLElement&&S.classList.contains("item"));if(!s){const R=e.find($=>$ instanceof HTMLElement&&$.classList.contains("list")&&$.hasAttribute("data-list-id"))?.getAttribute("data-list-id");return R?{listId:R,parentId:null,beforeId:null,mode:"before"}:null}const n=s.getAttribute("data-id");if(!n)return null;const a=this._items.find(S=>S.id===n);if(!a)return null;const d=this._lists.find(S=>S.id===a.listId),o=s.getBoundingClientRect(),u=d?.orientation==="horizontal",c=u?o.left:o.top,h=u?o.right:o.bottom,f=u?t:r,_=Math.max(1,h-c),I=(f-c)/_,m=u&&this._isRtl()?1-I:I,v=this.getAttribute("allow-nesting")!=="false"&&!a.disabled;if(m<=.34)return{listId:a.listId,parentId:a.parentId,beforeId:a.id,mode:"before"};if(v&&m>=.34&&m<=.74)return{listId:a.listId,parentId:a.id,beforeId:null,mode:"inside"};const A=E(this._items).get(k(a.listId,a.parentId))||[],z=A.indexOf(a.id),b=z>=0&&A[z+1]||null;return{listId:a.listId,parentId:a.parentId,beforeId:b,mode:"before"}}_dropTargetFromPoint(e,t){return this._dropTargetFromPath(this._pathFromPoint(e,t),e,t)}_beginPointerDrag(e,t){if(!this._pointerGesture||this._dragState)return;const r=this._items.find(i=>i.id===this._pointerGesture?.originId);r&&(this._dragState={snapshot:this._items.map(P),movedRootIds:[...this._pointerGesture.movedRootIds],originId:this._pointerGesture.originId,clone:this._pointerGesture.clone,keyboard:!1,dropTarget:null,committed:!1},this._pendingDropTarget=null,this._applyPointerPreview(e,t,this._dragState.movedRootIds.length,this._dragState.clone),this._setDraggingVisualState(this._draggingIds(),!0),this._announce(this._dragState.clone?`Dragging ${this._dragState.movedRootIds.length===1?r.label:`${this._dragState.movedRootIds.length} items`} as a copy.`:`Dragging ${this._dragState.movedRootIds.length===1?r.label:`${this._dragState.movedRootIds.length} items`}.`))}_onPointerDown(e){const t=this._dragActivatorFromPath(e.composedPath()),r=t?.id;if(!t||!r)return;if(this._isDragLocked()){e.preventDefault(),this._announce("Dragging is disabled right now.");return}const i=this._items.find(n=>n.id===r);if(!i||i.disabled||i.dragDisabled){e.preventDefault();return}e.preventDefault();try{t.element.setPointerCapture?.(e.pointerId)}catch{}const s=this._selection.includes(r)?this._selectedRootIds(r):[r];this._pointerGesture={pointerId:e.pointerId,pointerType:e.pointerType,originId:r,movedRootIds:s,clone:this._itemClonesOnDrag(r),startX:e.clientX,startY:e.clientY,moved:!1,captureTarget:t.element}}_onPointerMove(e){if(!(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)){if(e.preventDefault(),!this._pointerGesture.moved){if(Math.hypot(e.clientX-this._pointerGesture.startX,e.clientY-this._pointerGesture.startY)<6)return;this._pointerGesture.moved=!0,this._beginPointerDrag(e.clientX,e.clientY)}if(!(!this._dragState||this._dragState.keyboard)&&(this._movePointerPreview(e.clientX,e.clientY),this._updateAutoScroll(e.clientX,e.clientY),!this._dragState.committed)){const t=this._dropTargetFromPoint(e.clientX,e.clientY);if(!t||!this._canDrop(t,this._dragState.movedRootIds)){this._queueDropTarget(null,e.timeStamp);return}this._queueDropTarget(t,e.timeStamp)}}}_updateAutoScroll(e,t){this._autoScrollPoint={x:e,y:t},!this._autoScrollFrame&&typeof requestAnimationFrame=="function"&&(this._autoScrollFrame=requestAnimationFrame(this._autoScrollTick))}_stopAutoScroll(){this._autoScrollFrame&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._autoScrollFrame),this._autoScrollFrame=0,this._autoScrollPoint=null}_onPointerUp(e){if(!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId)return;e.preventDefault();try{this._pointerGesture.captureTarget?.releasePointerCapture?.(e.pointerId)}catch{}const t=this._pointerGesture;if(this._pointerGesture=null,this._stopAutoScroll(),!this._dragState||this._dragState.keyboard)return;const r=t.moved?this._releaseDropTarget(e.clientX,e.clientY):null;if(t.moved&&r){this._commitMove(r,this._dragState.movedRootIds,this._dragState.clone,"pointer");return}t.moved?this._cancelDrag(!0):(this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage(),this.requestRender())}_onPointerCancel(e){!this._pointerGesture||e.pointerId!==this._pointerGesture.pointerId||(this._pointerGesture=null,this._stopAutoScroll(),this._dragState&&this._cancelDrag(!0))}_setSelection(e,t){const r=new Set(this._items.map(a=>a.id)),i=Array.from(new Set(e.filter(a=>r.has(a)))),s=[...this._selection];this._selection=i,this._rangeAnchorId=i[i.length-1]||null,this._focusedId=i[i.length-1]||this._focusedId;const n=X(i);if(this.getAttribute("selection")!==n){this._lastSelectionAttr=n,this._suppressAttributeRender=!0;try{i.length?this.setAttribute("selection",n):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:[...i],previousSelection:s},bubbles:!0,composed:!0})),t!=="restore"){if(this._applyInteractiveStateInPlace({restoreFocus:!0}))return;this.requestRender()}}_toggleSelection(e){const t=this._selection.includes(e)?this._selection.filter(r=>r!==e):[...this._selection,e];this._setSelection(t,"pointer"),this._announce(`${t.length} items selected.`)}_selectRangeTo(e){const t=this._visibleItemIds(),r=this._rangeAnchorId||this._focusedId||e,i=t.indexOf(r),s=t.indexOf(e);if(i<0||s<0){this._setSelection([e],"pointer");return}const[n,a]=i<=s?[i,s]:[s,i];this._setSelection(t.slice(n,a+1),"pointer"),this._announce(`${a-n+1} items selected.`)}_visibleItemIds(){const e=Q(this._items,new Set(this._selection),new Set(this._draggingIds()),this.filterQuery,this.sort);return Array.from(e.values()).flat().filter(t=>!t.disabled).map(t=>t.id)}_selectedRootIds(e){const t=this._selection.length?[...this._selection]:e?[e]:[],r=T(this._items),i=new Set(t);return t.filter(s=>{const n=r.get(s);if(!n)return!1;let a=n.parentId;for(;a;){if(i.has(a))return!1;a=r.get(a)?.parentId??null}return!n.disabled})}_draggingIds(){if(!this._dragState)return[];const e=T(this._items),t=E(this._items),r=[],i=s=>{r.push(s);const n=e.get(s);if(!n)return;(t.get(k(n.listId,s))||[]).forEach(i)};return this._dragState.movedRootIds.forEach(i),r}_itemClonesOnDrag(e){const t=this._items.find(i=>i.id===e);return t?t.cloneOnDrag?!0:!!this._lists.find(i=>i.id===t.listId)?.cloneOnDrag:!1}_isDragLocked(){return!!(this.hasAttribute("disabled")||this.sort!=="manual"||this.filterQuery&&!this.hasAttribute("allow-filtered-drag"))}_canDrop(e,t){if(this._isDragLocked())return!1;const r=this._lists.find(o=>o.id===e.listId);if(!r||r.disabled)return!1;const i=T(this._items),s=new Set,n=E(this._items),a=o=>{s.add(o);const u=i.get(o);u&&(n.get(k(u.listId,o))||[]).forEach(a)};if(t.forEach(a),e.parentId&&s.has(e.parentId)||e.beforeId&&s.has(e.beforeId))return!1;const d=Array.from(new Set(t.map(o=>i.get(o)?.listId).filter(Boolean)));return!(r.accepts?.length&&d.some(o=>!r.accepts?.includes(o))||e.mode==="inside"&&this.getAttribute("allow-nesting")==="false")}_commitMove(e,t,r,i){if(!this._canDrop(e,t))return;const s=T(this._items),n=E(this._items),a=new Set,d=[],o=p=>{const w=s.get(p);!w||a.has(p)||(a.add(p),d.push(p),(n.get(k(w.listId,p))||[]).forEach(o))};t.forEach(o);const u=this._items.map(P),c=u.filter(p=>a.has(p.id)),h=r?u.map(P):u.filter(p=>!a.has(p.id)),f=r?c.map(p=>this._cloneSubtreeItem(p,d)):c.map(P),_=new Map,I=new Map;r&&c.forEach((p,w)=>{_.set(p.id,f[w].id),I.set(f[w].id,p.id)}),f.forEach(p=>{const w=r?I.get(p.id):p.id,F=w?s.get(w):null;F&&(r&&(p.parentId=F.parentId&&_.has(F.parentId)&&_.get(F.parentId)||null),p.listId=e.listId)});const m=t.map(p=>_.get(p)||p),v=[...h,...f],D=E(h),A=k(e.listId,e.parentId),z=[...D.get(A)||[]],b=e.beforeId?z.indexOf(e.beforeId):z.length,S=b>=0?b:z.length;z.splice(S,0,...m),D.set(A,z),E(f).forEach((p,w)=>{const[,F]=w.split("::");(F||"")!=="__root__"&&D.set(w,[...p])});const $=T(v);m.forEach(p=>{const w=$.get(p);w&&(w.parentId=e.parentId,w.listId=e.listId)});const O=[],L=new Set,q=(p,w)=>{(D.get(k(p,w))||[]).forEach((V,ee)=>{const N=$.get(V);!N||L.has(V)||(L.add(V),N.listId=p,N.parentId=w,N.order=ee,O.push(N),q(p,V))})};this._lists.forEach(p=>q(p.id,null)),v.forEach(p=>{L.has(p.id)||(p.parentId=null,O.push(p))}),this._dragState&&(this._dragState.committed=!0),this._items=O.map(P),this._clearPointerDragPreview(),this._dragState=null,this._removeDragImage();const H=[...m],g=[...this._selection];this._selection=H,this._focusedId=H[0]||null,this._pendingFocusId=this._focusedId,this._syncAttributesFromState();const x=J(this._items);this._persistSnapshot(x);const M=t.map(p=>s.get(p)).filter(p=>!!p),C=r?"clone":e.mode==="inside"?"nest":M.some(p=>p.listId!==e.listId)?"transfer":"reorder",G={items:this.items,lists:this.lists,selection:[...H],previousSelection:g,movedIds:[...m],source:i,operation:C,persistence:x};this.dispatchEvent(new CustomEvent("change",{detail:G,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("persist-request",{detail:G,bubbles:!0,composed:!0})),this._announce(this._messageForMove(C,m.length,e)),this.requestRender()}_syncAttributesFromState(){const e=he(this._lists),t=pe(this._items),r=X(this._selection);this._lastListsAttr=e,this._lastItemsAttr=t,this._lastSelectionAttr=r,this._suppressAttributeRender=!0;try{this.setAttribute("lists",e),this.setAttribute("items",t),this._selection.length?this.setAttribute("selection",r):this.removeAttribute("selection")}finally{this._suppressAttributeRender=!1}}_cloneSubtreeItem(e,t){const i=`copy-${this._cloneSeed++}`,n=`${e.id.includes("--copy-")?e.id.split("--copy-")[0]:e.id}--${i}`;return{...e,id:n,label:t[0]===e.id?`${e.label} copy`:e.label}}_messageForMove(e,t,r){const s=this._lists.find(n=>n.id===r.listId)?.label||r.listId;return e==="clone"?`${t===1?"Item copied":`${t} items copied`} into ${s}.`:e==="nest"?`${t===1?"Item nested":`${t} items nested`} in ${s}.`:e==="transfer"?`${t===1?"Item moved":`${t} items moved`} to ${s}.`:`${t===1?"Item reordered":`${t} items reordered`} in ${s}.`}_persistSnapshot(e){const t=this.getAttribute("persist-key");if(t)try{window.localStorage.setItem(t,JSON.stringify(e))}catch{}}_announce(e){this._liveMessage=e,this._applyLiveMessage()}_cancelDrag(e){this._stopAutoScroll(),this._dragState&&(this._setDraggingVisualState(this._draggingIds(),!1),this._pendingDropTarget=null,this._setDropTargetVisualState(this._dragState.dropTarget,!1),this._clearPointerDragPreview(),this._items=this._dragState.snapshot.map(P),this._dragState=null,this._pointerGesture=null,this._removeDragImage(),e&&this._announce("Drag cancelled."),this._syncAttributesFromState(),this.requestRender())}_applyDragImage(e,t){this._removeDragImage();const r=document.createElement("div");r.textContent=t===1?"Dragging item":`Dragging ${t} items`,r.style.position="fixed",r.style.top="-999px",r.style.left="-999px",r.style.padding="8px 12px",r.style.borderRadius="999px",r.style.background="rgba(15, 23, 42, 0.92)",r.style.color="#f8fafc",r.style.font="600 12px/1 Inter, sans-serif",r.style.pointerEvents="none",document.body.appendChild(r),e.setDragImage(r,12,12),this._dragImage=r}_removeDragImage(){this._dragImage?.remove(),this._dragImage=null}_removeDragPreviewOverlay(){this._dragPreviewOverlay?.remove(),this._dragPreviewOverlay=null}_applyPointerPreview(e,t,r,i){this._removeDragImage();const s=document.createElement("div");s.textContent=i?r===1?"Copying item":`Copying ${r} items`:r===1?"Moving item":`Moving ${r} items`,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.zIndex="2147483647",s.style.padding="8px 12px",s.style.borderRadius="999px",s.style.background="rgba(15, 23, 42, 0.92)",s.style.color="#f8fafc",s.style.font="600 12px/1 Inter, sans-serif",s.style.pointerEvents="none",s.style.boxShadow="0 12px 28px rgba(15, 23, 42, 0.22)",document.body.appendChild(s),this._dragImage=s,this._movePointerPreview(e,t)}_movePointerPreview(e,t){this._dragImage&&(this._dragImage.style.transform=`translate(${Math.round(e+14)}px, ${Math.round(t+14)}px)`)}_keyboardDropTargets(){const e=T(this._items),t=E(this._items),r=[],i=this.getAttribute("allow-nesting")!=="false",s=(n,a)=>{const d=t.get(k(n,a))||[];d.forEach(o=>{const u=e.get(o);!u||u.hidden||(r.push({listId:n,parentId:a,beforeId:o,mode:"before",label:`Before ${u.label}`}),i&&r.push({listId:n,parentId:o,beforeId:null,mode:"inside",label:`Nest inside ${u.label}`}),s(n,o))}),a?i&&d.length>0&&r.push({listId:n,parentId:a,beforeId:null,mode:"before",label:"After children"}):r.push({listId:n,parentId:a,beforeId:null,mode:"before",label:`End of ${this._lists.find(o=>o.id===n)?.label||n}`})};return this._lists.forEach(n=>s(n.id,null)),r.filter(n=>this._canDrop(n,this._dragState?.movedRootIds||[]))}_initialKeyboardDropTarget(e){const t=this._items.find(r=>r.id===e);return t?{listId:t.listId,parentId:t.parentId,beforeId:e,mode:"before"}:null}_moveKeyboardDropTarget(e){if(!this._dragState)return;const t=this._keyboardDropTargets();if(!t.length)return;const r=Math.max(0,t.findIndex(s=>s.listId===this._dragState?.dropTarget?.listId&&s.parentId===this._dragState?.dropTarget?.parentId&&s.beforeId===this._dragState?.dropTarget?.beforeId&&s.mode===this._dragState?.dropTarget?.mode)),i=Math.max(0,Math.min(t.length-1,r+e));this._setDropTarget(t[i],{announceLabel:t[i].label})}}typeof customElements<"u"&&!customElements.get("ui-sortable")&&customElements.define("ui-sortable",Z);exports.UISortable=Z;
|