@lostgradient/cinder 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +233 -0
- package/components.json +13 -6
- package/dist/components/accordion-item/accordion-item.css +0 -10
- package/dist/components/action-row/action-row.css +0 -9
- package/dist/components/alert/alert.css +0 -1
- package/dist/components/alert-dialog/index.js +2 -2
- package/dist/components/approval-card/index.js +2 -2
- package/dist/components/area-chart/index.js +2 -2
- package/dist/components/autocomplete/index.js +2 -2
- package/dist/components/avatar-group/avatar-group.css +0 -2
- package/dist/components/avatar-group/index.js +2 -2
- package/dist/components/backdrop/index.js +2 -2
- package/dist/components/bar-chart/index.js +2 -2
- package/dist/components/button/button.css +4 -4
- package/dist/components/button/button.variables.js +2 -2
- package/dist/components/card/card.css +0 -2
- package/dist/components/carousel/carousel.css +0 -5
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/code-block/code-block.css +0 -5
- package/dist/components/code-block/index.js +2 -2
- package/dist/components/color-field/index.js +2 -2
- package/dist/components/combobox/index.js +2 -2
- package/dist/components/command-menu/index.js +2 -2
- package/dist/components/command-palette/command-palette.css +50 -46
- package/dist/components/command-palette/index.js +2 -2
- package/dist/components/confirm-dialog/index.js +2 -2
- package/dist/components/context-menu/index.js +2 -2
- package/dist/components/data-table/data-table.css +0 -2
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-range-field/index.js +2 -2
- package/dist/components/drawer/index.js +2 -2
- package/dist/components/dropdown/index.js +2 -2
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/feed-event/feed-event.css +0 -2
- package/dist/components/file-upload/file-upload.css +0 -5
- package/dist/components/find-bar/find-bar.css +9 -1
- package/dist/components/focus-trap/index.js +2 -2
- package/dist/components/form-field/index.js +2 -2
- package/dist/components/guidance-region/index.css +1 -1
- package/dist/components/hover-card/index.js +2 -2
- package/dist/components/inline-confirm/index.js +2 -2
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.css +95 -6
- package/dist/components/invocation-rule-builder/index.js +2 -2
- package/dist/components/json-editor/index.js +2 -2
- package/dist/components/json-schema-editor/index.js +4 -4
- package/dist/components/kanban-board/kanban-board.css +0 -10
- package/dist/components/key-value-editor/index.css +1 -1
- package/dist/components/line-chart/index.js +2 -2
- package/dist/components/marquee/marquee.css +0 -2
- package/dist/components/matrix-chart/index.js +2 -2
- package/dist/components/menu-bar/index.js +3 -3
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.css +0 -26
- package/dist/components/modal-region/index.css +1 -1
- package/dist/components/multi-select/index.js +2 -2
- package/dist/components/navigation-bar/index.js +2 -2
- package/dist/components/parameter-field/index.js +2 -2
- package/dist/components/permission-matrix/index.js +2 -2
- package/dist/components/policy-lock/index.js +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/radio-group/index.js +2 -2
- package/dist/components/schedule-builder/index.js +2 -2
- package/dist/components/schema-form/index.js +2 -2
- package/dist/components/scroll-area/index.js +2 -2
- package/dist/components/select/index.js +2 -2
- package/dist/components/selectable-row/selectable-row.css +0 -6
- package/dist/components/selection-popover/index.js +2 -2
- package/dist/components/share-card/index.js +2 -2
- package/dist/components/side-navigation/side-navigation.css +0 -1
- package/dist/components/sidebar/index.js +2 -2
- package/dist/components/speed-dial/index.js +2 -2
- package/dist/components/statistic/statistic.css +0 -8
- package/dist/components/statistic-group/index.js +2 -2
- package/dist/components/statistic-group/statistic-group.css +116 -69
- package/dist/components/status-dot/status-dot.css +0 -3
- package/dist/components/table/index.js +2 -2
- package/dist/components/table-of-contents/table-of-contents.css +0 -4
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/time-field/index.js +2 -2
- package/dist/components/time-field/time-field.css +9 -8
- package/dist/components/toast-region/index.js +2 -2
- package/dist/components/toggle/toggle.variables.js +2 -2
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/transfer-list/index.js +2 -2
- package/dist/components/tree/tree.css +0 -3
- package/dist/components/virtual-list/_internal/adaptive-overscan.d.ts +87 -0
- package/dist/components/virtual-list/_internal/edge-proximity.d.ts +75 -0
- package/dist/components/virtual-list/_internal/frame-scheduler.d.ts +76 -0
- package/dist/components/virtual-list/_internal/geometry.d.ts +170 -0
- package/dist/components/virtual-list/_internal/list-semantics.d.ts +93 -0
- package/dist/components/virtual-list/_internal/measurement-window.d.ts +125 -0
- package/dist/components/virtual-list/_internal/reverse-order.d.ts +87 -0
- package/dist/components/virtual-list/_internal/scroll-restoration.d.ts +98 -0
- package/dist/components/virtual-list/_internal/sticky-items.d.ts +48 -0
- package/dist/components/virtual-list/_internal/virtual-list-measurement-store.svelte.d.ts +69 -0
- package/dist/components/virtual-list/index.d.ts +1 -1
- package/dist/components/virtual-list/index.js +2 -2
- package/dist/components/virtual-list/virtual-list.css +153 -2
- package/dist/components/virtual-list/virtual-list.schema.js +69 -6
- package/dist/components/virtual-list/virtual-list.svelte.d.ts +11 -8
- package/dist/components/virtual-list/virtual-list.types.d.ts +177 -4
- package/dist/index.browser.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -18
- package/dist/server/components/alert-dialog/index.js +1 -1
- package/dist/server/components/approval-card/index.js +1 -1
- package/dist/server/components/area-chart/index.js +1 -1
- package/dist/server/components/autocomplete/index.js +1 -1
- package/dist/server/components/avatar-group/index.js +1 -1
- package/dist/server/components/backdrop/index.js +1 -1
- package/dist/server/components/bar-chart/index.js +1 -1
- package/dist/server/components/checkbox/index.js +1 -1
- package/dist/server/components/code-block/index.js +1 -1
- package/dist/server/components/color-field/index.js +1 -1
- package/dist/server/components/combobox/index.js +1 -1
- package/dist/server/components/command-menu/index.js +1 -1
- package/dist/server/components/command-palette/index.js +2 -2
- package/dist/server/components/confirm-dialog/index.js +1 -1
- package/dist/server/components/context-menu/index.js +1 -1
- package/dist/server/components/data-table/index.js +1 -1
- package/dist/server/components/date-picker/index.js +1 -1
- package/dist/server/components/date-range-field/index.js +1 -1
- package/dist/server/components/drawer/index.js +1 -1
- package/dist/server/components/dropdown/index.js +1 -1
- package/dist/server/components/dropdown-menu/index.js +2 -2
- package/dist/server/components/focus-trap/index.js +1 -1
- package/dist/server/components/form-field/index.js +1 -1
- package/dist/server/components/hover-card/index.js +1 -1
- package/dist/server/components/inline-confirm/index.js +1 -1
- package/dist/server/components/input/index.js +1 -1
- package/dist/server/components/invocation-rule-builder/index.js +1 -1
- package/dist/server/components/json-editor/index.js +1 -1
- package/dist/server/components/json-schema-editor/index.js +1 -1
- package/dist/server/components/line-chart/index.js +1 -1
- package/dist/server/components/matrix-chart/index.js +1 -1
- package/dist/server/components/menu-bar/index.js +2 -2
- package/dist/server/components/modal/index.js +1 -1
- package/dist/server/components/multi-select/index.js +1 -1
- package/dist/server/components/navigation-bar/index.js +2 -2
- package/dist/server/components/parameter-field/index.js +1 -1
- package/dist/server/components/permission-matrix/index.js +1 -1
- package/dist/server/components/policy-lock/index.js +1 -1
- package/dist/server/components/popover/index.js +1 -1
- package/dist/server/components/radio-group/index.js +1 -1
- package/dist/server/components/schedule-builder/index.js +1 -1
- package/dist/server/components/schema-form/index.js +1 -1
- package/dist/server/components/scroll-area/index.js +1 -1
- package/dist/server/components/select/index.js +1 -1
- package/dist/server/components/selection-popover/index.js +1 -1
- package/dist/server/components/share-card/index.js +1 -1
- package/dist/server/components/sidebar/index.js +1 -1
- package/dist/server/components/speed-dial/index.js +2 -2
- package/dist/server/components/statistic-group/index.js +1 -1
- package/dist/server/components/table/index.js +1 -1
- package/dist/server/components/textarea/index.js +1 -1
- package/dist/server/components/time-field/index.js +1 -1
- package/dist/server/components/toast-region/index.js +1 -1
- package/dist/server/components/tooltip/index.js +1 -1
- package/dist/server/components/transfer-list/index.js +1 -1
- package/dist/server/components/virtual-list/index.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/{index.server-skq0f5sr.js → index.server-0jw25w9w.js} +1 -1
- package/dist/server/index.server-0kk20wvp.js +4 -0
- package/dist/server/{index.server-fzsqdajc.js → index.server-2awq6q9m.js} +1 -1
- package/dist/server/{index.server-e4hmhaeh.js → index.server-3xwvw6w2.js} +3 -3
- package/dist/server/{index.server-95h7xy01.js → index.server-428dh2t9.js} +2 -2
- package/dist/server/{index.server-jd88r74m.js → index.server-5dq66aja.js} +2 -2
- package/dist/server/{index.server-dvwfhf77.js → index.server-5s94r0kk.js} +2 -2
- package/dist/server/{index.server-qv6z5ta3.js → index.server-80qgcjnm.js} +1 -1
- package/dist/server/{index.server-7k2732ky.js → index.server-81abtrsw.js} +1 -1
- package/dist/server/{index.server-csmqnx5w.js → index.server-83q1gv2c.js} +1 -1
- package/dist/server/{index.server-qw8k9rjg.js → index.server-8fyav10d.js} +1 -1
- package/dist/server/{index.server-4dgjj4k1.js → index.server-8h5caecr.js} +2 -2
- package/dist/server/{index.server-emyqytmm.js → index.server-90n8sd9e.js} +1 -1
- package/dist/server/{index.server-0xrdyzvh.js → index.server-99penx1m.js} +1 -1
- package/dist/server/{index.server-p94j3jah.js → index.server-9g9d15z1.js} +1 -1
- package/dist/server/{index.server-xp9hkc81.js → index.server-9kbdx511.js} +1 -1
- package/dist/server/index.server-a2yhk45s.js +3 -0
- package/dist/server/{index.server-g8d2m2tk.js → index.server-acq55gjs.js} +1 -1
- package/dist/server/{index.server-ewze54tv.js → index.server-afjftjmr.js} +1 -1
- package/dist/server/{index.server-ejyye4gv.js → index.server-bfed6a8a.js} +1 -1
- package/dist/server/{index.server-z5ng08q2.js → index.server-c1746s0z.js} +1 -1
- package/dist/server/{index.server-gt1tfc1w.js → index.server-dmeztywe.js} +1 -1
- package/dist/server/{index.server-kzsppq0n.js → index.server-dyj3jdx9.js} +1 -1
- package/dist/server/index.server-dz92zvx6.js +4 -0
- package/dist/server/{index.server-3md8kdcr.js → index.server-e6682k08.js} +1 -1
- package/dist/server/{index.server-t1pshh65.js → index.server-ewkv461x.js} +1 -1
- package/dist/server/{index.server-zfgwhtmp.js → index.server-fa449wd3.js} +1 -1
- package/dist/server/{index.server-1kgwayct.js → index.server-fhfypmgw.js} +1 -1
- package/dist/server/{index.server-s4z8hsby.js → index.server-ge4adxs2.js} +1 -1
- package/dist/server/{index.server-68xyfsg3.js → index.server-gggkq22y.js} +2 -2
- package/dist/server/{index.server-acgwdamx.js → index.server-j52rbk57.js} +1 -1
- package/dist/server/{index.server-z0nwftx6.js → index.server-jm89hxfb.js} +1 -1
- package/dist/server/{index.server-xa98r8p2.js → index.server-jw0v64se.js} +1 -1
- package/dist/server/index.server-m321p69g.js +3 -0
- package/dist/server/{index.server-xyervw3d.js → index.server-m7q2tc41.js} +1 -1
- package/dist/server/{index.server-tnrxy86j.js → index.server-mak7dmj2.js} +1 -1
- package/dist/server/{index.server-n5g5h5k1.js → index.server-mw5r2524.js} +1 -1
- package/dist/server/{index.server-caf7s6m7.js → index.server-nwq1cg55.js} +1 -1
- package/dist/server/{index.server-3wdvs0wr.js → index.server-p423fy4q.js} +2 -2
- package/dist/server/{index.server-ks7fvwxt.js → index.server-prk5syj2.js} +1 -1
- package/dist/server/{index.server-6w9fp018.js → index.server-q4hytsq3.js} +1 -1
- package/dist/server/{index.server-5w2qw8fm.js → index.server-q597a1ck.js} +1 -1
- package/dist/server/{index.server-fz1pkvda.js → index.server-qgne9v2w.js} +1 -1
- package/dist/server/{index.server-1f2app32.js → index.server-rvdavf92.js} +1 -1
- package/dist/server/index.server-rwq20a22.js +3 -0
- package/dist/server/{index.server-0rvmnrw2.js → index.server-s9tjs45r.js} +1 -1
- package/dist/server/{index.server-cm2prec7.js → index.server-sqgxyfsw.js} +1 -1
- package/dist/server/{index.server-v6777tgn.js → index.server-t761nwvb.js} +1 -1
- package/dist/server/index.server-tbds8nwq.js +4 -0
- package/dist/server/index.server-tyhta5n3.js +3 -0
- package/dist/server/{index.server-yw7rah51.js → index.server-v5dxham4.js} +1 -1
- package/dist/server/index.server-va98cpyf.js +3 -0
- package/dist/server/index.server-vq1k69xt.js +3 -0
- package/dist/server/{index.server-egd355s6.js → index.server-wnf9btp7.js} +2 -2
- package/dist/server/{index.server-sjcbaztf.js → index.server-y3zgdtbv.js} +1 -1
- package/dist/server/{index.server-4tjtgzf9.js → index.server-y6vtbmyj.js} +1 -1
- package/dist/server/{index.server-2p2mjzzb.js → index.server-zff2qp1v.js} +1 -1
- package/dist/server/tokens/registry.generated.js +2 -2
- package/dist/tokens/registry.generated.js +2 -2
- package/package.json +2 -2
- package/src/_internal/form-field-frame.svelte +5 -0
- package/src/_internal/overlay.ts +14 -1
- package/src/components/_internal/create-command-list-state.svelte.ts +4 -0
- package/src/components/accordion-item/accordion-item.css +0 -10
- package/src/components/action-row/action-row.css +0 -9
- package/src/components/alert/alert.css +0 -1
- package/src/components/avatar-group/avatar-group.css +0 -2
- package/src/components/button/button.css +4 -4
- package/src/components/button/button.variables.json +31 -1
- package/src/components/button/button.variables.ts +31 -1
- package/src/components/card/card.css +0 -2
- package/src/components/carousel/carousel.css +0 -5
- package/src/components/code-block/code-block.css +0 -5
- package/src/components/command-menu/command-menu.svelte +63 -7
- package/src/components/command-palette/command-palette.css +50 -46
- package/src/components/command-palette/command-palette.svelte +68 -78
- package/src/components/data-table/data-table.css +0 -2
- package/src/components/dropdown/dropdown.svelte +73 -18
- package/src/components/dropdown-menu/dropdown-menu.svelte +63 -7
- package/src/components/feed-event/feed-event.css +0 -2
- package/src/components/file-upload/file-upload.css +0 -5
- package/src/components/find-bar/find-bar.css +9 -1
- package/src/components/input/input.css +95 -6
- package/src/components/input/input.svelte +44 -81
- package/src/components/kanban-board/kanban-board.css +0 -10
- package/src/components/marquee/marquee.css +0 -2
- package/src/components/menu-bar/menu-bar.svelte +12 -1
- package/src/components/modal/modal.css +0 -26
- package/src/components/multi-select/multi-select.svelte +7 -0
- package/src/components/navigation-bar/navigation-bar.svelte +82 -6
- package/src/components/selectable-row/selectable-row.css +0 -6
- package/src/components/selection-popover/selection-popover.svelte +24 -10
- package/src/components/share-card/share-card.svelte +24 -44
- package/src/components/side-navigation/side-navigation.css +0 -1
- package/src/components/speed-dial/speed-dial.svelte +23 -5
- package/src/components/statistic/statistic.css +0 -8
- package/src/components/statistic-group/statistic-group.css +116 -69
- package/src/components/statistic-group/statistic-group.examples.json +6 -0
- package/src/components/statistic-group/statistic-group.svelte +13 -1
- package/src/components/status-dot/status-dot.css +0 -3
- package/src/components/table-of-contents/table-of-contents.css +0 -4
- package/src/components/time-field/time-field.css +9 -8
- package/src/components/toast-region/toast-region.svelte +9 -0
- package/src/components/toggle/toggle.variables.json +1 -1
- package/src/components/toggle/toggle.variables.ts +4 -1
- package/src/components/tree/tree.css +0 -3
- package/src/components/virtual-list/_internal/adaptive-overscan.ts +248 -0
- package/src/components/virtual-list/_internal/edge-proximity.ts +130 -0
- package/src/components/virtual-list/_internal/frame-scheduler.ts +136 -0
- package/src/components/virtual-list/_internal/geometry.ts +236 -0
- package/src/components/virtual-list/_internal/list-semantics.ts +151 -0
- package/src/components/virtual-list/_internal/measurement-window.ts +300 -0
- package/src/components/virtual-list/_internal/reverse-order.ts +146 -0
- package/src/components/virtual-list/_internal/scroll-restoration.ts +209 -0
- package/src/components/virtual-list/_internal/sticky-items.ts +111 -0
- package/src/components/virtual-list/_internal/virtual-list-measurement-store.svelte.ts +145 -0
- package/src/components/virtual-list/index.ts +7 -1
- package/src/components/virtual-list/virtual-list.css +153 -2
- package/src/components/virtual-list/virtual-list.examples.json +42 -0
- package/src/components/virtual-list/virtual-list.schema.json +53 -3
- package/src/components/virtual-list/virtual-list.schema.ts +64 -3
- package/src/components/virtual-list/virtual-list.svelte +1527 -36
- package/src/components/virtual-list/virtual-list.types.ts +181 -4
- package/src/index.ts +3 -0
- package/src/styles/tokens-base.css +57 -22
- package/src/tokens/cinder.resolver.json +8 -0
- package/src/tokens/index.json +1 -1
- package/src/tokens/registry.generated.json +30 -4
- package/src/tokens/registry.generated.ts +32 -4
- package/src/tokens/resolved/dark-reduced-motion.json +47 -17
- package/src/tokens/resolved/dark.json +47 -17
- package/src/tokens/resolved/light-reduced-motion.json +48 -18
- package/src/tokens/resolved/light.json +48 -18
- package/src/tokens/sets/components.tokens.json +1 -1
- package/src/tokens/sets/semantic.tokens.json +120 -30
- package/src/tokens/themes/dark.tokens.json +115 -19
- package/src/tokens/themes/light.tokens.json +51 -3
- package/dist/server/index.server-191cnacw.js +0 -3
- package/dist/server/index.server-25dqx151.js +0 -3
- package/dist/server/index.server-77jyqvbv.js +0 -4
- package/dist/server/index.server-bgjrzr70.js +0 -3
- package/dist/server/index.server-khsp90vh.js +0 -3
- package/dist/server/index.server-ryk2pgbe.js +0 -4
- package/dist/server/index.server-tajr81bm.js +0 -3
- package/dist/server/index.server-vjzcrw3d.js +0 -4
- package/dist/server/index.server-zg3fx1n1.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var __create=Object.create;var __getProtoOf=Object.getPrototypeOf;var __defProp=Object.defineProperty;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node;var __toESMCache_esm;var __toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap;var cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};const to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:true}):target;if(mod&&typeof mod==="object"||typeof mod==="function"){for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:true})}if(canCache)cache.set(mod,to);return to};var __commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true,configurable:true,set:__exportSetter.bind(all,name)})};var __esm=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res);var __require=((x)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(x,{get:(a,b)=>(typeof require!=="undefined"?require:a)[b]}):x)(function(x){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});import"@lostgradient/cinder/transfer-list/styles";import"svelte/internal/disclose-version";import*as $2 from"svelte/internal/client";import{tick}from"svelte";import{SvelteSet}from"svelte/reactivity";function classNames(...parts){return parts.filter((part)=>typeof part==="string"&&part.length>0).join(" ")}var escapeStack=[];function pushEscapeHandler(handler){escapeStack.push(handler);if(escapeStack.length===1&&typeof window!=="undefined"){window.addEventListener("keydown",onEscapeKeydown,{capture:true})}let released=false;return()=>{if(released)return;released=true;const index=escapeStack.lastIndexOf(handler);if(index!==-1)escapeStack.splice(index,1);if(escapeStack.length===0&&typeof window!=="undefined"){window.removeEventListener("keydown",onEscapeKeydown,{capture:true})}}}function onEscapeKeydown(event){if(event.key!=="Escape")return;const handler=escapeStack.at(-1);if(!handler)return;handler(event)}var scrollLockCount=0;var originalBodyOverflow=null;function lockBodyScroll(){if(typeof document==="undefined")return()=>{};if(scrollLockCount===0){originalBodyOverflow=document.body.style.overflow;document.body.style.overflow="hidden"}scrollLockCount+=1;let released=false;return()=>{if(released)return;released=true;scrollLockCount=Math.max(0,scrollLockCount-1);if(scrollLockCount===0){document.body.style.overflow=originalBodyOverflow??"";originalBodyOverflow=null}}}function captureFocus(){if(typeof document==="undefined")return null;const active=document.activeElement;if(active&&active!==document.body&&active instanceof HTMLElement){return active}return null}function createBodyScrollLock(){return()=>{const release=lockBodyScroll();return release}}function isInsideEventPath(event,element){const path=event.composedPath();return path.some((entry)=>entry instanceof Node&&element.contains(entry))}function createClickOutside(options){const{handler,enabled=true,eventType="click",capture=true,ignoreRefs}=options;return(node)=>{function handleEvent(event){const isEnabled=typeof enabled==="function"?enabled():enabled;if(!isEnabled)return;if(event.type==="touchstart"&&!event.cancelable)return;const target=event.target;if(!(target instanceof Node)){handler();return}if(isInsideEventPath(event,node))return;if(ignoreRefs){for(const ref of ignoreRefs){const element=ref();if(element&&isInsideEventPath(event,element))return}}handler()}document.addEventListener(eventType,handleEvent,capture);return()=>{document.removeEventListener(eventType,handleEvent,capture)}}}function overflowFade(){return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute("data-cinder-overflows");return}const update=()=>{const overflows=node.scrollHeight-node.clientHeight>1;const atBottom=node.scrollTop+node.clientHeight>=node.scrollHeight-1;node.toggleAttribute("data-cinder-overflows",overflows&&!atBottom)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});node.addEventListener("scroll",scheduleUpdate,{passive:true});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect();node.removeEventListener("scroll",scheduleUpdate)}}}var OVERFLOW_SHADOW_ATTRIBUTE={inline:"data-cinder-overflows-inline",block:"data-cinder-overflows-block"};function overflowShadow(axis){const attributeName=OVERFLOW_SHADOW_ATTRIBUTE[axis];return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute(attributeName);return}const update=()=>{const overflows=axis==="inline"?node.scrollWidth-node.clientWidth>1:node.scrollHeight-node.clientHeight>1;node.toggleAttribute(attributeName,overflows)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect()}}}var OVERFLOW_FADE_START_ATTRIBUTE={block:"data-cinder-overflows-start",inline:"data-cinder-overflows-inline-start"};var OVERFLOW_FADE_END_ATTRIBUTE={block:"data-cinder-overflows",inline:"data-cinder-overflows-inline-end"};function overflowFadeEdges(axis){const startAttribute=OVERFLOW_FADE_START_ATTRIBUTE[axis];const endAttribute=OVERFLOW_FADE_END_ATTRIBUTE[axis];return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute(startAttribute);node.removeAttribute(endAttribute);return}const update=()=>{const scrollPosition=axis==="block"?node.scrollTop:node.scrollLeft;const contentExtent=axis==="block"?node.scrollHeight:node.scrollWidth;const viewportExtent=axis==="block"?node.clientHeight:node.clientWidth;const overflows=contentExtent-viewportExtent>1;const atStart=scrollPosition<=1;const atEnd=scrollPosition+viewportExtent>=contentExtent-1;node.toggleAttribute(startAttribute,overflows&&!atStart);node.toggleAttribute(endAttribute,overflows&&!atEnd)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});node.addEventListener("scroll",scheduleUpdate,{passive:true});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect();node.removeEventListener("scroll",scheduleUpdate)}}}import*as $ from"svelte/internal/client";function useAnnouncer(options){const{clearDelay=1000,debounceMs=0}=options??{};let message=$.state("");let debounceTimeout=null;let setMessageTimeout=null;let autoClearTimeout=null;function setMessage(text){if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}$.set(message,"");setMessageTimeout=globalThis.setTimeout(()=>{setMessageTimeout=null;$.set(message,text,true);autoClearTimeout=globalThis.setTimeout(()=>{$.set(message,"");autoClearTimeout=null},clearDelay)},0)}function announce(text){if(debounceMs>0){if(debounceTimeout){globalThis.clearTimeout(debounceTimeout)}debounceTimeout=globalThis.setTimeout(()=>{debounceTimeout=null;setMessage(text)},debounceMs)}else{setMessage(text)}}function clear(){if(debounceTimeout){globalThis.clearTimeout(debounceTimeout);debounceTimeout=null}if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}$.set(message,"")}$.user_effect(()=>{return()=>{if(debounceTimeout){globalThis.clearTimeout(debounceTimeout);debounceTimeout=null}if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}}});function destroy(){clear()}return{get message(){return $.get(message)},announce,clear,destroy}}var rest_excludes=new Set(["$$slots","$$events","$$legacy","items","value","leftLabel","rightLabel","onValueChange","class"]);var root=$2.from_html(`<span class="cinder-transfer-list__status" aria-hidden="true">Selected</span>`);var root_1=$2.from_html(`<li class="cinder-_option-row cinder-transfer-list__option" role="option"><span> </span> <!></li>`);var root_2=$2.from_html(`<li class="cinder-transfer-list__empty" role="presentation">No items</li>`);var root_3=$2.from_html(`<div><div class="cinder-transfer-list__header"><h3 class="cinder-_label-text cinder-transfer-list__label"> </h3> <span class="cinder-_value-text cinder-transfer-list__count"> </span></div> <ul class="cinder-transfer-list__list" role="listbox" aria-multiselectable="true" tabindex="0"></ul> <div role="alert" aria-atomic="true" class="cinder-sr-only"> </div></div>`);function Transfer_list($$anchor,$$props){const baseId=$2.props_id();$2.push($$props,true);let value=$2.prop($$props,"value",31,()=>$2.proxy([])),leftLabel=$2.prop($$props,"leftLabel",3,"Available"),rightLabel=$2.prop($$props,"rightLabel",3,"Selected"),rest=$2.rest_props($$props,rest_excludes);let activeId=$2.state(null);let listElement=$2.state(undefined);const announcer=useAnnouncer({clearDelay:5000});const uniqueItems=$2.derived(()=>{const seenIds=new SvelteSet;return $$props.items.filter((item)=>{if(seenIds.has(item.id))return false;seenIds.add(item.id);return true})});const itemById=$2.derived(()=>new Map($2.get(uniqueItems).map((item)=>[item.id,item])));const knownValue=$2.derived(()=>{const seenIds=new SvelteSet;return value().filter((id)=>{if(!$2.get(itemById).has(id)||seenIds.has(id))return false;seenIds.add(id);return true})});const selectedIds=$2.derived(()=>new Set($2.get(knownValue)));const selectedCount=$2.derived(()=>$2.get(knownValue).length);const displayedRightLabel=$2.derived(()=>rightLabel()==="Selected"?"selected":rightLabel());const activeOptionId=$2.derived(()=>{if(!$2.get(activeId))return;const index=$2.get(uniqueItems).findIndex((item)=>item.id===$2.get(activeId));return index===-1?undefined:`${baseId}-option-${index}`});function optionId(index){return`${baseId}-option-${index}`}function isSelectable(item){return $2.get(selectedIds).has(item.id)||!item.disabled}function enabledItems(){return $2.get(uniqueItems).filter(isSelectable)}function resolveActiveId(currentId){const enabled=enabledItems();if(enabled.length===0)return null;if(currentId&&enabled.some((item)=>item.id===currentId))return currentId;return enabled[0]?.id??null}$2.user_effect(()=>{if($2.get(activeId)===null)return;const resolvedId=resolveActiveId($2.get(activeId));if(resolvedId!==$2.get(activeId))$2.set(activeId,resolvedId,true)});function announceSelection(item,selected){announcer.announce(`${item.label} ${selected?"added to":"removed from"} ${rightLabel()}. ${$2.get(selectedCount)} ${$2.get(selectedCount)===1?"item":"items"} selected.`)}function commitSelection(id){const item=$2.get(itemById).get(id);if(!item||!isSelectable(item))return;const selected=$2.get(selectedIds).has(id);const nextValue=selected?$2.get(knownValue).filter((valueId)=>valueId!==id):[...$2.get(knownValue),id];value(nextValue);if(selected&&item.disabled){const removedIndex=$2.get(uniqueItems).findIndex((candidate)=>candidate.id===id);const nextSelectedIds=new Set(nextValue);const selectableAfterCommit=$2.get(uniqueItems).filter((candidate)=>nextSelectedIds.has(candidate.id)||!candidate.disabled);$2.set(activeId,selectableAfterCommit.find((candidate)=>$2.get(uniqueItems).findIndex((uniqueItem)=>uniqueItem.id===candidate.id)>removedIndex)?.id??selectableAfterCommit.at(-1)?.id??null,true)}$$props.onValueChange?.(nextValue);announceSelection(item,!selected)}function handleOptionClick(item){if(!isSelectable(item))return;$2.set(activeId,item.id,true);commitSelection(item.id);$2.get(listElement)?.focus()}function handleListFocus(){$2.set(activeId,resolveActiveId($2.get(activeId)),true)}async function handleListKeydown(event2){const enabled=enabledItems();const currentId=resolveActiveId($2.get(activeId));if(enabled.length===0||!currentId)return;const currentIndex=enabled.findIndex((item)=>item.id===currentId);if(event2.key==="ArrowDown"||event2.key==="ArrowUp"){event2.preventDefault();const direction=event2.key==="ArrowDown"?1:-1;$2.set(activeId,enabled[(currentIndex+direction+enabled.length)%enabled.length]?.id??null,true);return}if(event2.key==="Home"||event2.key==="End"){event2.preventDefault();$2.set(activeId,event2.key==="Home"?enabled[0]?.id??null:enabled.at(-1)?.id??null,true);return}if(event2.key===" "||event2.key==="Enter"){event2.preventDefault();commitSelection(currentId);await tick()}}var div=root_3();$2.attribute_effect(div,($0)=>({...rest,class:$0}),[()=>classNames("cinder-transfer-list",$$props.class)]);var div_1=$2.child(div);var h3=$2.child(div_1);var text=$2.child(h3,true);$2.reset(h3);var span=$2.sibling(h3,2);var text_1=$2.child(span);$2.reset(span);$2.reset(div_1);var ul=$2.sibling(div_1,2);$2.each(ul,23,()=>$2.get(uniqueItems),(item)=>item.id,($$anchor2,item,index)=>{var li=root_1();var span_1=$2.child(li);var text_2=$2.child(span_1,true);$2.reset(span_1);var node=$2.sibling(span_1,2);{var consequent=($$anchor3)=>{var span_2=root();$2.append($$anchor3,span_2)};var d=$2.derived(()=>$2.get(selectedIds).has($2.get(item).id));$2.if(node,($$render)=>{if($2.get(d))$$render(consequent)})}$2.reset(li);$2.template_effect(($0,$1,$22)=>{$2.set_attribute(li,"id",$0);$2.set_attribute(li,"aria-selected",$1);$2.set_attribute(li,"aria-disabled",$22);$2.set_attribute(li,"data-cinder-active",$2.get(activeId)===$2.get(item).id?"true":undefined);$2.set_attribute(li,"data-cinder-transfer-list-item-id",$2.get(item).id);$2.set_text(text_2,$2.get(item).label)},[()=>optionId($2.get(index)),()=>$2.get(selectedIds).has($2.get(item).id)?"true":"false",()=>!isSelectable($2.get(item))?"true":undefined]);$2.delegated("click",li,()=>handleOptionClick($2.get(item)));$2.delegated("keydown",li,(event2)=>{event2.stopPropagation();if(event2.key===" "||event2.key==="Enter"){event2.preventDefault();handleOptionClick($2.get(item))}});$2.append($$anchor2,li)},($$anchor2)=>{var li_1=root_2();$2.append($$anchor2,li_1)});$2.reset(ul);$2.bind_this(ul,($$value)=>$2.set(listElement,$$value),()=>$2.get(listElement));$2.attach(ul,()=>overflowShadow("block"));var div_2=$2.sibling(ul,2);var text_3=$2.child(div_2,true);$2.reset(div_2);$2.reset(div);$2.template_effect(()=>{$2.set_attribute(h3,"id",`${baseId}-label`);$2.set_text(text,leftLabel());$2.set_text(text_1,`${$2.get(selectedCount)??""}
|
|
1
|
+
var __create=Object.create;var __getProtoOf=Object.getPrototypeOf;var __defProp=Object.defineProperty;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node;var __toESMCache_esm;var __toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap;var cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};const to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:true}):target;if(mod&&typeof mod==="object"||typeof mod==="function"){for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:true})}if(canCache)cache.set(mod,to);return to};var __commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true,configurable:true,set:__exportSetter.bind(all,name)})};var __esm=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res);var __require=((x)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(x,{get:(a,b)=>(typeof require!=="undefined"?require:a)[b]}):x)(function(x){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});import"@lostgradient/cinder/transfer-list/styles";import"svelte/internal/disclose-version";import*as $2 from"svelte/internal/client";import{tick}from"svelte";import{SvelteSet}from"svelte/reactivity";function classNames(...parts){return parts.filter((part)=>typeof part==="string"&&part.length>0).join(" ")}import{flushSync}from"svelte";var escapeStack=[];function pushEscapeHandler(handler){escapeStack.push(handler);if(escapeStack.length===1&&typeof window!=="undefined"){window.addEventListener("keydown",onEscapeKeydown,{capture:true})}let released=false;return()=>{if(released)return;released=true;const index=escapeStack.lastIndexOf(handler);if(index!==-1)escapeStack.splice(index,1);if(escapeStack.length===0&&typeof window!=="undefined"){window.removeEventListener("keydown",onEscapeKeydown,{capture:true})}}}function onEscapeKeydown(event){if(event.key!=="Escape")return;const handler=escapeStack.at(-1);if(!handler)return;flushSync(()=>{handler(event)})}var scrollLockCount=0;var originalBodyOverflow=null;function lockBodyScroll(){if(typeof document==="undefined")return()=>{};if(scrollLockCount===0){originalBodyOverflow=document.body.style.overflow;document.body.style.overflow="hidden"}scrollLockCount+=1;let released=false;return()=>{if(released)return;released=true;scrollLockCount=Math.max(0,scrollLockCount-1);if(scrollLockCount===0){document.body.style.overflow=originalBodyOverflow??"";originalBodyOverflow=null}}}function captureFocus(){if(typeof document==="undefined")return null;const active=document.activeElement;if(active&&active!==document.body&&active instanceof HTMLElement){return active}return null}function createBodyScrollLock(){return()=>{const release=lockBodyScroll();return release}}function isInsideEventPath(event,element){const path=event.composedPath();return path.some((entry)=>entry instanceof Node&&element.contains(entry))}function createClickOutside(options){const{handler,enabled=true,eventType="click",capture=true,ignoreRefs}=options;return(node)=>{function handleEvent(event){const isEnabled=typeof enabled==="function"?enabled():enabled;if(!isEnabled)return;if(event.type==="touchstart"&&!event.cancelable)return;const target=event.target;if(!(target instanceof Node)){handler();return}if(isInsideEventPath(event,node))return;if(ignoreRefs){for(const ref of ignoreRefs){const element=ref();if(element&&isInsideEventPath(event,element))return}}handler()}document.addEventListener(eventType,handleEvent,capture);return()=>{document.removeEventListener(eventType,handleEvent,capture)}}}function overflowFade(){return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute("data-cinder-overflows");return}const update=()=>{const overflows=node.scrollHeight-node.clientHeight>1;const atBottom=node.scrollTop+node.clientHeight>=node.scrollHeight-1;node.toggleAttribute("data-cinder-overflows",overflows&&!atBottom)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});node.addEventListener("scroll",scheduleUpdate,{passive:true});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect();node.removeEventListener("scroll",scheduleUpdate)}}}var OVERFLOW_SHADOW_ATTRIBUTE={inline:"data-cinder-overflows-inline",block:"data-cinder-overflows-block"};function overflowShadow(axis){const attributeName=OVERFLOW_SHADOW_ATTRIBUTE[axis];return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute(attributeName);return}const update=()=>{const overflows=axis==="inline"?node.scrollWidth-node.clientWidth>1:node.scrollHeight-node.clientHeight>1;node.toggleAttribute(attributeName,overflows)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect()}}}var OVERFLOW_FADE_START_ATTRIBUTE={block:"data-cinder-overflows-start",inline:"data-cinder-overflows-inline-start"};var OVERFLOW_FADE_END_ATTRIBUTE={block:"data-cinder-overflows",inline:"data-cinder-overflows-inline-end"};function overflowFadeEdges(axis){const startAttribute=OVERFLOW_FADE_START_ATTRIBUTE[axis];const endAttribute=OVERFLOW_FADE_END_ATTRIBUTE[axis];return(node)=>{if(typeof ResizeObserver==="undefined"){node.removeAttribute(startAttribute);node.removeAttribute(endAttribute);return}const update=()=>{const scrollPosition=axis==="block"?node.scrollTop:node.scrollLeft;const contentExtent=axis==="block"?node.scrollHeight:node.scrollWidth;const viewportExtent=axis==="block"?node.clientHeight:node.clientWidth;const overflows=contentExtent-viewportExtent>1;const atStart=scrollPosition<=1;const atEnd=scrollPosition+viewportExtent>=contentExtent-1;node.toggleAttribute(startAttribute,overflows&&!atStart);node.toggleAttribute(endAttribute,overflows&&!atEnd)};const requestFrame=typeof requestAnimationFrame==="function"?requestAnimationFrame:(callback)=>window.setTimeout(()=>callback(performance.now()));const cancelFrame=typeof cancelAnimationFrame==="function"?cancelAnimationFrame:(handle)=>window.clearTimeout(handle);let frame=0;const scheduleUpdate=()=>{if(frame)return;frame=requestFrame(()=>{frame=0;update()})};const resizeObserver=new ResizeObserver(scheduleUpdate);resizeObserver.observe(node);const mutationObserver=typeof MutationObserver==="undefined"?null:new MutationObserver(scheduleUpdate);mutationObserver?.observe(node,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:["hidden","class","style","aria-hidden","src"]});node.addEventListener("scroll",scheduleUpdate,{passive:true});update();return()=>{if(frame)cancelFrame(frame);resizeObserver.disconnect();mutationObserver?.disconnect();node.removeEventListener("scroll",scheduleUpdate)}}}import*as $ from"svelte/internal/client";function useAnnouncer(options){const{clearDelay=1000,debounceMs=0}=options??{};let message=$.state("");let debounceTimeout=null;let setMessageTimeout=null;let autoClearTimeout=null;function setMessage(text){if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}$.set(message,"");setMessageTimeout=globalThis.setTimeout(()=>{setMessageTimeout=null;$.set(message,text,true);autoClearTimeout=globalThis.setTimeout(()=>{$.set(message,"");autoClearTimeout=null},clearDelay)},0)}function announce(text){if(debounceMs>0){if(debounceTimeout){globalThis.clearTimeout(debounceTimeout)}debounceTimeout=globalThis.setTimeout(()=>{debounceTimeout=null;setMessage(text)},debounceMs)}else{setMessage(text)}}function clear(){if(debounceTimeout){globalThis.clearTimeout(debounceTimeout);debounceTimeout=null}if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}$.set(message,"")}$.user_effect(()=>{return()=>{if(debounceTimeout){globalThis.clearTimeout(debounceTimeout);debounceTimeout=null}if(setMessageTimeout){globalThis.clearTimeout(setMessageTimeout);setMessageTimeout=null}if(autoClearTimeout){globalThis.clearTimeout(autoClearTimeout);autoClearTimeout=null}}});function destroy(){clear()}return{get message(){return $.get(message)},announce,clear,destroy}}var rest_excludes=new Set(["$$slots","$$events","$$legacy","items","value","leftLabel","rightLabel","onValueChange","class"]);var root=$2.from_html(`<span class="cinder-transfer-list__status" aria-hidden="true">Selected</span>`);var root_1=$2.from_html(`<li class="cinder-_option-row cinder-transfer-list__option" role="option"><span> </span> <!></li>`);var root_2=$2.from_html(`<li class="cinder-transfer-list__empty" role="presentation">No items</li>`);var root_3=$2.from_html(`<div><div class="cinder-transfer-list__header"><h3 class="cinder-_label-text cinder-transfer-list__label"> </h3> <span class="cinder-_value-text cinder-transfer-list__count"> </span></div> <ul class="cinder-transfer-list__list" role="listbox" aria-multiselectable="true" tabindex="0"></ul> <div role="alert" aria-atomic="true" class="cinder-sr-only"> </div></div>`);function Transfer_list($$anchor,$$props){const baseId=$2.props_id();$2.push($$props,true);let value=$2.prop($$props,"value",31,()=>$2.proxy([])),leftLabel=$2.prop($$props,"leftLabel",3,"Available"),rightLabel=$2.prop($$props,"rightLabel",3,"Selected"),rest=$2.rest_props($$props,rest_excludes);let activeId=$2.state(null);let listElement=$2.state(undefined);const announcer=useAnnouncer({clearDelay:5000});const uniqueItems=$2.derived(()=>{const seenIds=new SvelteSet;return $$props.items.filter((item)=>{if(seenIds.has(item.id))return false;seenIds.add(item.id);return true})});const itemById=$2.derived(()=>new Map($2.get(uniqueItems).map((item)=>[item.id,item])));const knownValue=$2.derived(()=>{const seenIds=new SvelteSet;return value().filter((id)=>{if(!$2.get(itemById).has(id)||seenIds.has(id))return false;seenIds.add(id);return true})});const selectedIds=$2.derived(()=>new Set($2.get(knownValue)));const selectedCount=$2.derived(()=>$2.get(knownValue).length);const displayedRightLabel=$2.derived(()=>rightLabel()==="Selected"?"selected":rightLabel());const activeOptionId=$2.derived(()=>{if(!$2.get(activeId))return;const index=$2.get(uniqueItems).findIndex((item)=>item.id===$2.get(activeId));return index===-1?undefined:`${baseId}-option-${index}`});function optionId(index){return`${baseId}-option-${index}`}function isSelectable(item){return $2.get(selectedIds).has(item.id)||!item.disabled}function enabledItems(){return $2.get(uniqueItems).filter(isSelectable)}function resolveActiveId(currentId){const enabled=enabledItems();if(enabled.length===0)return null;if(currentId&&enabled.some((item)=>item.id===currentId))return currentId;return enabled[0]?.id??null}$2.user_effect(()=>{if($2.get(activeId)===null)return;const resolvedId=resolveActiveId($2.get(activeId));if(resolvedId!==$2.get(activeId))$2.set(activeId,resolvedId,true)});function announceSelection(item,selected){announcer.announce(`${item.label} ${selected?"added to":"removed from"} ${rightLabel()}. ${$2.get(selectedCount)} ${$2.get(selectedCount)===1?"item":"items"} selected.`)}function commitSelection(id){const item=$2.get(itemById).get(id);if(!item||!isSelectable(item))return;const selected=$2.get(selectedIds).has(id);const nextValue=selected?$2.get(knownValue).filter((valueId)=>valueId!==id):[...$2.get(knownValue),id];value(nextValue);if(selected&&item.disabled){const removedIndex=$2.get(uniqueItems).findIndex((candidate)=>candidate.id===id);const nextSelectedIds=new Set(nextValue);const selectableAfterCommit=$2.get(uniqueItems).filter((candidate)=>nextSelectedIds.has(candidate.id)||!candidate.disabled);$2.set(activeId,selectableAfterCommit.find((candidate)=>$2.get(uniqueItems).findIndex((uniqueItem)=>uniqueItem.id===candidate.id)>removedIndex)?.id??selectableAfterCommit.at(-1)?.id??null,true)}$$props.onValueChange?.(nextValue);announceSelection(item,!selected)}function handleOptionClick(item){if(!isSelectable(item))return;$2.set(activeId,item.id,true);commitSelection(item.id);$2.get(listElement)?.focus()}function handleListFocus(){$2.set(activeId,resolveActiveId($2.get(activeId)),true)}async function handleListKeydown(event2){const enabled=enabledItems();const currentId=resolveActiveId($2.get(activeId));if(enabled.length===0||!currentId)return;const currentIndex=enabled.findIndex((item)=>item.id===currentId);if(event2.key==="ArrowDown"||event2.key==="ArrowUp"){event2.preventDefault();const direction=event2.key==="ArrowDown"?1:-1;$2.set(activeId,enabled[(currentIndex+direction+enabled.length)%enabled.length]?.id??null,true);return}if(event2.key==="Home"||event2.key==="End"){event2.preventDefault();$2.set(activeId,event2.key==="Home"?enabled[0]?.id??null:enabled.at(-1)?.id??null,true);return}if(event2.key===" "||event2.key==="Enter"){event2.preventDefault();commitSelection(currentId);await tick()}}var div=root_3();$2.attribute_effect(div,($0)=>({...rest,class:$0}),[()=>classNames("cinder-transfer-list",$$props.class)]);var div_1=$2.child(div);var h3=$2.child(div_1);var text=$2.child(h3,true);$2.reset(h3);var span=$2.sibling(h3,2);var text_1=$2.child(span);$2.reset(span);$2.reset(div_1);var ul=$2.sibling(div_1,2);$2.each(ul,23,()=>$2.get(uniqueItems),(item)=>item.id,($$anchor2,item,index)=>{var li=root_1();var span_1=$2.child(li);var text_2=$2.child(span_1,true);$2.reset(span_1);var node=$2.sibling(span_1,2);{var consequent=($$anchor3)=>{var span_2=root();$2.append($$anchor3,span_2)};var d=$2.derived(()=>$2.get(selectedIds).has($2.get(item).id));$2.if(node,($$render)=>{if($2.get(d))$$render(consequent)})}$2.reset(li);$2.template_effect(($0,$1,$22)=>{$2.set_attribute(li,"id",$0);$2.set_attribute(li,"aria-selected",$1);$2.set_attribute(li,"aria-disabled",$22);$2.set_attribute(li,"data-cinder-active",$2.get(activeId)===$2.get(item).id?"true":undefined);$2.set_attribute(li,"data-cinder-transfer-list-item-id",$2.get(item).id);$2.set_text(text_2,$2.get(item).label)},[()=>optionId($2.get(index)),()=>$2.get(selectedIds).has($2.get(item).id)?"true":"false",()=>!isSelectable($2.get(item))?"true":undefined]);$2.delegated("click",li,()=>handleOptionClick($2.get(item)));$2.delegated("keydown",li,(event2)=>{event2.stopPropagation();if(event2.key===" "||event2.key==="Enter"){event2.preventDefault();handleOptionClick($2.get(item))}});$2.append($$anchor2,li)},($$anchor2)=>{var li_1=root_2();$2.append($$anchor2,li_1)});$2.reset(ul);$2.bind_this(ul,($$value)=>$2.set(listElement,$$value),()=>$2.get(listElement));$2.attach(ul,()=>overflowShadow("block"));var div_2=$2.sibling(ul,2);var text_3=$2.child(div_2,true);$2.reset(div_2);$2.reset(div);$2.template_effect(()=>{$2.set_attribute(h3,"id",`${baseId}-label`);$2.set_text(text,leftLabel());$2.set_text(text_1,`${$2.get(selectedCount)??""}
|
|
2
2
|
${$2.get(selectedCount)===1?"item":"items"}
|
|
3
3
|
${$2.get(displayedRightLabel)??""}`);$2.set_attribute(ul,"aria-labelledby",`${baseId}-label`);$2.set_attribute(ul,"aria-activedescendant",$2.get(activeOptionId));$2.set_text(text_3,announcer.message)});$2.event("focus",ul,handleListFocus);$2.delegated("keydown",ul,handleListKeydown);$2.append($$anchor,div);$2.pop()}$2.delegate(["keydown","click"]);var transfer_list_default=Transfer_list;export{Transfer_list as TransferList,transfer_list_default as default};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=76A5080F243F04AE64756E2164756E21
|
|
@@ -116,9 +116,6 @@
|
|
|
116
116
|
outline: none;
|
|
117
117
|
cursor: default;
|
|
118
118
|
border-radius: var(--cinder-radius-sm);
|
|
119
|
-
--cinder-tree-drop-line-color: var(--cinder-accent-solid);
|
|
120
|
-
--cinder-tree-drop-line-thickness: 2px;
|
|
121
|
-
--cinder-tree-item-dragging-opacity: 0.55;
|
|
122
119
|
}
|
|
123
120
|
|
|
124
121
|
/* Tree items are full-bleed rows whose first/last siblings sit flush against
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Velocity-adaptive overscan for the virtual list (CIN-203).
|
|
3
|
+
*
|
|
4
|
+
* Everything in this module is dependency-free arithmetic: no DOM, no runes,
|
|
5
|
+
* no `performance.now()`, no timers. It tracks scroll velocity from a stream
|
|
6
|
+
* of `(scrollOffset, timestamp)` samples the caller hands it — Svelte's
|
|
7
|
+
* `scroll` handler is the natural source, but nothing here reads it — and
|
|
8
|
+
* turns that velocity into extra rows of overscan so a fast fling has rows
|
|
9
|
+
* already mounted before they scroll into view. The configured `overscan`
|
|
10
|
+
* the consumer asked for is always the FLOOR: adaptation only ever adds rows
|
|
11
|
+
* on top of it, never renders fewer than the consumer's own request.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Immutable scroll-velocity state. Threaded through calls exactly like the
|
|
15
|
+
* offsets/measurement state elsewhere in `_internal`: `createVelocityTracker`
|
|
16
|
+
* produces the initial value, `trackScrollVelocity` takes one and returns a
|
|
17
|
+
* new one — the input is never mutated, so callers (an `$effect`, a test) can
|
|
18
|
+
* hold onto an old tracker and compare it against a new one safely.
|
|
19
|
+
*/
|
|
20
|
+
export type VelocityTracker = {
|
|
21
|
+
/**
|
|
22
|
+
* The scroll offset and timestamp of the last sample folded in, or `null`
|
|
23
|
+
* before the first sample — `null` is what lets `trackScrollVelocity` tell
|
|
24
|
+
* "no previous sample to diff against" apart from "a previous sample that
|
|
25
|
+
* happened to sit at offset 0", which a sentinel number couldn't.
|
|
26
|
+
*/
|
|
27
|
+
readonly lastScrollOffset: number;
|
|
28
|
+
readonly lastTimestamp: number | null;
|
|
29
|
+
/** Smoothed scroll speed, in pixels per millisecond. Always a magnitude — never negative. */
|
|
30
|
+
readonly velocityInPixelsPerMillisecond: number;
|
|
31
|
+
};
|
|
32
|
+
/** The tracker's initial state: no prior sample, so no velocity yet. */
|
|
33
|
+
export declare function createVelocityTracker(): VelocityTracker;
|
|
34
|
+
/**
|
|
35
|
+
* Folds one `(scrollOffset, timestamp)` sample into `tracker`, returning a
|
|
36
|
+
* new tracker with an updated, EMA-smoothed velocity in pixels per
|
|
37
|
+
* millisecond. `tracker` itself is never mutated.
|
|
38
|
+
*
|
|
39
|
+
* Velocity is always a magnitude: scrolling up and scrolling down at the
|
|
40
|
+
* same speed produce the same value, because pop-in risk depends on how far
|
|
41
|
+
* the viewport is about to sweep, not which direction it sweeps in.
|
|
42
|
+
*/
|
|
43
|
+
export declare function trackScrollVelocity(tracker: VelocityTracker, sample: {
|
|
44
|
+
scrollOffset: number;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
}): VelocityTracker;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves how many rows of overscan to render given the current scroll
|
|
49
|
+
* velocity. `baseOverscan` — the consumer's own configured `overscan`,
|
|
50
|
+
* default 5 — is always the floor: the result never drops below it,
|
|
51
|
+
* regardless of velocity. Extra rows are derived from velocity rather than a
|
|
52
|
+
* magic lookup table: roughly, however many whole item-heights the list will
|
|
53
|
+
* travel during one frame's worth of time at the current speed is how many
|
|
54
|
+
* additional rows need to already be mounted so they don't pop in.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveAdaptiveOverscan(options: {
|
|
57
|
+
baseOverscan: number;
|
|
58
|
+
velocityInPixelsPerMillisecond: number;
|
|
59
|
+
itemSize: number;
|
|
60
|
+
maximumOverscan?: number;
|
|
61
|
+
}): number;
|
|
62
|
+
/**
|
|
63
|
+
* The row size adaptive overscan should convert a pixel velocity with.
|
|
64
|
+
*
|
|
65
|
+
* `estimateSize` is what the consumer guessed. In fixed mode that IS the row size and
|
|
66
|
+
* there is nothing to improve on. Under `dynamicSize` it is only a starting point, and
|
|
67
|
+
* the conversion from "pixels travelled this frame" to "rows to keep mounted" is
|
|
68
|
+
* exactly where being wrong hurts: with a 100px estimate over rows measuring 10px, a
|
|
69
|
+
* frame covering 100px reads as one row rather than the ten the viewport really
|
|
70
|
+
* crossed, so the window widens by a tenth of what the reader is outrunning.
|
|
71
|
+
*
|
|
72
|
+
* Averaged over the rows actually MEASURED, not over the whole collection. The offsets
|
|
73
|
+
* table's total blends measurements with estimates for every row not yet seen, and in
|
|
74
|
+
* a long list those estimates swamp the measurements — twenty measured rows of 10px
|
|
75
|
+
* among ten thousand estimated at 100px average out to 99.8px, which is the estimate
|
|
76
|
+
* again in all but name and leaves the ruler as wrong as it started.
|
|
77
|
+
*
|
|
78
|
+
* Falls back to the estimate until something has been measured, and if the measured
|
|
79
|
+
* average is not a usable positive number — a collection whose rows have all collapsed
|
|
80
|
+
* to zero, say.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveAdaptiveItemSize(options: {
|
|
83
|
+
dynamicSize: boolean;
|
|
84
|
+
measuredTotalSize: number;
|
|
85
|
+
measuredCount: number;
|
|
86
|
+
estimateSize: number;
|
|
87
|
+
}): number;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure edge-proximity detection for bi-directional infinite scroll in a
|
|
3
|
+
* virtual list (CIN-195 `onEndReached`, CIN-196 `onStartReached`).
|
|
4
|
+
*
|
|
5
|
+
* Deciding "are we near an edge" is simple index arithmetic. The hard part —
|
|
6
|
+
* and the entire reason this module exists — is deciding WHEN to fire a
|
|
7
|
+
* callback for that proximity, so a reader who scrolls around near the same
|
|
8
|
+
* edge, or who simply triggers a re-render while still sitting there, does
|
|
9
|
+
* not retrigger a data fetch on every frame. `resolveEdgeFireDecision` is
|
|
10
|
+
* the latch that answers that question; `resolveEdgeProximity` only
|
|
11
|
+
* computes the raw boolean state the latch reacts to.
|
|
12
|
+
*
|
|
13
|
+
* Dependency-free by design, matching the rest of `_internal/`: no DOM, no
|
|
14
|
+
* runes, no timers. `virtual-list.svelte` is expected to call
|
|
15
|
+
* `resolveEdgeProximity` once per scroll/measurement update, feed the
|
|
16
|
+
* result into `resolveEdgeFireDecision` alongside the latch state carried
|
|
17
|
+
* from the previous call, and store `next` for the following call.
|
|
18
|
+
*/
|
|
19
|
+
/** Whether the current window sits close enough to either edge of the list to consider firing a load callback. */
|
|
20
|
+
export type EdgeProximity = {
|
|
21
|
+
readonly isNearStart: boolean;
|
|
22
|
+
readonly isNearEnd: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Anti-repeat latch state carried between calls to `resolveEdgeFireDecision`.
|
|
26
|
+
* A latched edge has already fired for the CURRENT approach and stays
|
|
27
|
+
* suppressed until either the reader scrolls away (proximity goes false) or
|
|
28
|
+
* `itemCount` moves away from `itemCountAtLatch` — new items arrived in
|
|
29
|
+
* response to whatever fired last time, so the next approach is treated as
|
|
30
|
+
* genuinely new.
|
|
31
|
+
*/
|
|
32
|
+
export type EdgeLatch = {
|
|
33
|
+
readonly startLatched: boolean;
|
|
34
|
+
readonly endLatched: boolean;
|
|
35
|
+
/** itemCount as of the call that produced the current startLatched/endLatched values. */
|
|
36
|
+
readonly itemCountAtLatch: number;
|
|
37
|
+
};
|
|
38
|
+
/** The initial, unlatched state — nothing has fired yet. */
|
|
39
|
+
export declare function createEdgeLatch(): EdgeLatch;
|
|
40
|
+
/**
|
|
41
|
+
* Computes raw start/end proximity from the current window and list shape.
|
|
42
|
+
* This is pure index arithmetic with no memory of prior calls — repeat-fire
|
|
43
|
+
* suppression is `resolveEdgeFireDecision`'s job, not this function's.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveEdgeProximity(options: {
|
|
46
|
+
/**
|
|
47
|
+
* Accepted for parity with the sibling window/geometry helpers' options
|
|
48
|
+
* shape — every one of them takes a scroll offset — but proximity here is
|
|
49
|
+
* decided entirely in item-index space, so this field is not read.
|
|
50
|
+
*/
|
|
51
|
+
scrollOffset: number;
|
|
52
|
+
viewportSize: number;
|
|
53
|
+
totalSize: number;
|
|
54
|
+
firstVisibleIndex: number;
|
|
55
|
+
lastVisibleIndex: number;
|
|
56
|
+
itemCount: number;
|
|
57
|
+
overscan: number;
|
|
58
|
+
}): EdgeProximity;
|
|
59
|
+
/**
|
|
60
|
+
* Turns raw proximity into a fire/no-fire decision via rising-edge
|
|
61
|
+
* detection: an edge fires only on the call where its proximity flips from
|
|
62
|
+
* not-near to near, or where `itemCount` moved since the latch was last set
|
|
63
|
+
* — which counts as a fresh approach even though proximity never dropped to
|
|
64
|
+
* false in between. Never mutates `previous`; callers store the returned
|
|
65
|
+
* `next` for the following call.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveEdgeFireDecision(options: {
|
|
68
|
+
proximity: EdgeProximity;
|
|
69
|
+
previous: EdgeLatch;
|
|
70
|
+
itemCount: number;
|
|
71
|
+
}): {
|
|
72
|
+
fireStart: boolean;
|
|
73
|
+
fireEnd: boolean;
|
|
74
|
+
next: EdgeLatch;
|
|
75
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A frame-scheduling port pair: `request` queues a callback for "the next
|
|
3
|
+
* frame" and returns an id `cancel` can later use to drop it before it
|
|
4
|
+
* fires. Shaped as data (not a class) so a test can hand `FrameBatcher` a
|
|
5
|
+
* fully deterministic fake instead of depending on real
|
|
6
|
+
* `requestAnimationFrame` timing.
|
|
7
|
+
*/
|
|
8
|
+
export type FrameScheduler = {
|
|
9
|
+
readonly request: (callback: (time: number) => void) => number;
|
|
10
|
+
readonly cancel: (id: number) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The real {@link FrameScheduler}, backed by `requestAnimationFrame` /
|
|
14
|
+
* `cancelAnimationFrame`.
|
|
15
|
+
*
|
|
16
|
+
* Both globals are looked up lazily, INSIDE `request`/`cancel`, never at
|
|
17
|
+
* module scope — referencing the bare identifier `requestAnimationFrame` at
|
|
18
|
+
* module scope throws a `ReferenceError` the instant this module is
|
|
19
|
+
* imported in a server-rendering environment, where no such global exists.
|
|
20
|
+
* CIN-205 requires the whole `virtual-list` module tree to import cleanly
|
|
21
|
+
* under SSR, so this module must not throw merely by being loaded, and
|
|
22
|
+
* `request`/`cancel` must not throw merely by being called there either —
|
|
23
|
+
* when `requestAnimationFrame` is absent, `request` reports
|
|
24
|
+
* {@link NO_ANIMATION_FRAME_ID} and never invokes the callback. Nothing on
|
|
25
|
+
* the server needs it to: Svelte does not run `$effect`s during SSR, so a
|
|
26
|
+
* `FrameBatcher` built on this scheduler never runs there either.
|
|
27
|
+
*
|
|
28
|
+
* Nothing in the component calls this today. It was written for the
|
|
29
|
+
* `windowScroll` adapter, which was split out of this work and is tracked as
|
|
30
|
+
* CIN-197; it stays here so that work does not start from nothing, but it
|
|
31
|
+
* describes a caller that does not exist yet rather than one that does.
|
|
32
|
+
*
|
|
33
|
+
* A `FrameBatcher` built on this fallback path stays permanently inert
|
|
34
|
+
* after its first `recordRead` — `request` returning without ever calling
|
|
35
|
+
* back means nothing clears the batcher's "a frame is already scheduled"
|
|
36
|
+
* flag, so later reads coalesce into a commit that never fires. This is the
|
|
37
|
+
* intended shape of "fall back safely": no throw, no leaked timer, at the
|
|
38
|
+
* cost of the batch simply never landing in an environment with no frames
|
|
39
|
+
* to schedule onto in the first place.
|
|
40
|
+
*/
|
|
41
|
+
export declare const rafFrameScheduler: FrameScheduler;
|
|
42
|
+
/**
|
|
43
|
+
* Coalesces N calls to recordRead within one frame into a single onCommit call on the
|
|
44
|
+
* NEXT scheduled frame. This is CIN-202's mechanism for reads that Svelte's own
|
|
45
|
+
* $effect.pre/$effect ordering does NOT already cover — specifically, genuinely
|
|
46
|
+
* layout-forcing reads like getBoundingClientRect — which is what the `windowScroll`
|
|
47
|
+
* adapter will need, and why this exists ahead of it (CIN-197).
|
|
48
|
+
* Plain $state-driven scroll-offset correction uses the $effect.pre/$effect split
|
|
49
|
+
* instead (see "The engine" — CIN-202 interpretation).
|
|
50
|
+
*/
|
|
51
|
+
export declare class FrameBatcher<T> {
|
|
52
|
+
#private;
|
|
53
|
+
/**
|
|
54
|
+
* @param onCommit Called with the LAST value passed to `recordRead` since
|
|
55
|
+
* the previous commit, once per scheduled frame.
|
|
56
|
+
* @param scheduler Defaults to {@link rafFrameScheduler}. Tests inject a
|
|
57
|
+
* fake to make coalescing deterministic instead of depending on real
|
|
58
|
+
* frame timing.
|
|
59
|
+
*/
|
|
60
|
+
constructor(onCommit: (value: T) => void, scheduler?: FrameScheduler);
|
|
61
|
+
/**
|
|
62
|
+
* Records `value` as the pending read for the frame currently in flight,
|
|
63
|
+
* overwriting any value already recorded for that frame. Schedules a
|
|
64
|
+
* commit frame on the first call after a batch has committed (or after
|
|
65
|
+
* construction); every subsequent call before that frame fires just
|
|
66
|
+
* updates the pending value without scheduling a second frame. A no-op
|
|
67
|
+
* after {@link dispose}.
|
|
68
|
+
*/
|
|
69
|
+
recordRead(value: T): void;
|
|
70
|
+
/**
|
|
71
|
+
* Cancels any frame currently scheduled — dropping its pending value
|
|
72
|
+
* without committing it — and makes every later `recordRead` inert.
|
|
73
|
+
* Idempotent.
|
|
74
|
+
*/
|
|
75
|
+
dispose(): void;
|
|
76
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure axis and writing-direction geometry for `horizontal` and RTL support
|
|
3
|
+
* (CIN-191, CIN-192).
|
|
4
|
+
*
|
|
5
|
+
* Everything below is dependency-free: no `ResizeObserver`, no runes, and —
|
|
6
|
+
* with the sole exception of {@link domWritingDirectionReader}'s two
|
|
7
|
+
* one-line DOM reads — no direct DOM access either. It is held to the
|
|
8
|
+
* 100%-lines/100%-functions coverage floor (see `coverage-ratchet.json`)
|
|
9
|
+
* because none of it needs live layout to exercise every branch; the reader
|
|
10
|
+
* indirection in {@link resolveWritingDirection} is exactly what makes that
|
|
11
|
+
* true for RTL detection too, despite happy-dom's `getComputedStyle` being
|
|
12
|
+
* blind to the `dir` attribute (see that function's doc comment).
|
|
13
|
+
*/
|
|
14
|
+
/** A CSS writing direction, resolved to exactly one of the two real values. */
|
|
15
|
+
export type WritingDirection = 'ltr' | 'rtl';
|
|
16
|
+
/**
|
|
17
|
+
* Reads the two direction signals {@link resolveWritingDirection} needs,
|
|
18
|
+
* behind an interface so a test can inject a fake instead of depending on a
|
|
19
|
+
* real, connected DOM tree and a browser that reflects `dir` through
|
|
20
|
+
* `getComputedStyle` — which happy-dom does not (see that function's doc
|
|
21
|
+
* comment).
|
|
22
|
+
*/
|
|
23
|
+
export type WritingDirectionReader = {
|
|
24
|
+
/** Should return the raw `getComputedStyle(element).direction` value in production. */
|
|
25
|
+
readonly getComputedDirection: (element: Element) => string;
|
|
26
|
+
/** Should return `element.closest('[dir]')?.getAttribute('dir') ?? null` in production. */
|
|
27
|
+
readonly closestDirAttribute: (element: Element) => string | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the writing direction that should govern scroll-offset reading
|
|
31
|
+
* for `element`.
|
|
32
|
+
*
|
|
33
|
+
* Reads the reader's computed-direction value FIRST — this is CIN-192's
|
|
34
|
+
* literal AC text ("RTL is detected via `getComputedStyle(element).direction`"),
|
|
35
|
+
* so computed style must genuinely be the primary source, not a fallback. If
|
|
36
|
+
* it reports `'rtl'`, that wins outright, with no further reads. If it
|
|
37
|
+
* reports `'ltr'`, this falls back to the nearest `[dir]` ancestor
|
|
38
|
+
* attribute — the seam that makes this function testable at all under
|
|
39
|
+
* happy-dom, whose `getComputedStyle` always answers `'ltr'` regardless of
|
|
40
|
+
* any `dir="rtl"` ancestor attribute.
|
|
41
|
+
*
|
|
42
|
+
* The injectable {@link WritingDirectionReader} is the whole point: it lets
|
|
43
|
+
* a test assert the PRIORITY RULE — computed style wins even over a
|
|
44
|
+
* conflicting `dir` attribute — which a hard-coded `getComputedStyle` call
|
|
45
|
+
* could never demonstrate under happy-dom, since there both signals would
|
|
46
|
+
* always agree.
|
|
47
|
+
*
|
|
48
|
+
* Accepted, documented gap: a real element with an explicit
|
|
49
|
+
* `direction: ltr` CSS override nested inside a `dir="rtl"` ancestor is
|
|
50
|
+
* misread as `rtl` by the fallback, because the fallback only looks at the
|
|
51
|
+
* attribute, never at computed style further up the tree. Narrow and
|
|
52
|
+
* disclosed, not silent — the AC's own detection mechanism is computed
|
|
53
|
+
* style on `element` itself, not on every ancestor.
|
|
54
|
+
*
|
|
55
|
+
* The attribute fallback is compared case-insensitively: HTML's `dir`
|
|
56
|
+
* attribute is defined case-insensitively (`dir="RTL"` is exactly as valid
|
|
57
|
+
* as `dir="rtl"`), matching this codebase's own `_internal/text-direction.ts`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveWritingDirection(element: Element | null | undefined, reader: WritingDirectionReader): WritingDirection;
|
|
60
|
+
/**
|
|
61
|
+
* The real {@link WritingDirectionReader}, backed by `getComputedStyle` and
|
|
62
|
+
* `Element.closest`.
|
|
63
|
+
*
|
|
64
|
+
* Both lookups live inside the method bodies below — `getComputedStyle` is
|
|
65
|
+
* never referenced at module scope — so importing this module never
|
|
66
|
+
* touches it; it is only evaluated the first time a caller actually invokes
|
|
67
|
+
* `getComputedDirection`, which in `virtual-list.svelte` happens
|
|
68
|
+
* exclusively inside a mount `$effect`. That keeps this module safely
|
|
69
|
+
* importable during server rendering (CIN-205), where `getComputedStyle`
|
|
70
|
+
* does not exist. Under happy-dom both methods return a defined value for
|
|
71
|
+
* any real `Element` — `getComputedStyle` a direction string, `closest` a
|
|
72
|
+
* matching ancestor or `null` — so every line here is exercised by a plain
|
|
73
|
+
* Bun test, with no need to stub or delete either global.
|
|
74
|
+
*/
|
|
75
|
+
export declare const domWritingDirectionReader: WritingDirectionReader;
|
|
76
|
+
/**
|
|
77
|
+
* The historical `scrollLeft` conventions browsers have used for
|
|
78
|
+
* right-to-left content. Irrelevant under `ltr`, where `scrollLeft` has
|
|
79
|
+
* always meant the same thing everywhere.
|
|
80
|
+
*/
|
|
81
|
+
export type RtlScrollType = 'default' | 'negative' | 'reverse';
|
|
82
|
+
/**
|
|
83
|
+
* Classifies which RTL `scrollLeft` convention a browser implements, from two
|
|
84
|
+
* probe readings taken on a throwaway right-to-left scroll container.
|
|
85
|
+
*
|
|
86
|
+
* Pure, so the classification is testable without a browser — the caller supplies
|
|
87
|
+
* the readings. The probe itself is a handful of DOM writes and lives in the
|
|
88
|
+
* component, because nothing in this module may touch the DOM.
|
|
89
|
+
*
|
|
90
|
+
* Detection rather than assumption is deliberate. The three conventions are told
|
|
91
|
+
* apart by observable behaviour, and picking one by name is how the sign silently
|
|
92
|
+
* inverts: `'default'` sounds safe and is in fact the legacy Edge/IE behaviour.
|
|
93
|
+
*
|
|
94
|
+
* @param startScrollLeft `scrollLeft` while scrolled to the start (right) edge.
|
|
95
|
+
* @param scrollLeftAfterWritingNegativeOne `scrollLeft` read back after writing -1.
|
|
96
|
+
*/
|
|
97
|
+
export declare function classifyRtlScrollType(startScrollLeft: number, scrollLeftAfterWritingNegativeOne: number): RtlScrollType;
|
|
98
|
+
/**
|
|
99
|
+
* Converts a raw `element.scrollLeft` into a normalized "distance from the
|
|
100
|
+
* start edge": always `>= 0`, and increasing as the user scrolls away from
|
|
101
|
+
* the start, regardless of which of the three historical RTL `scrollLeft`
|
|
102
|
+
* conventions the current browser implements.
|
|
103
|
+
*
|
|
104
|
+
* Under `ltr` the raw value passes through unchanged — `rtlScrollType` is
|
|
105
|
+
* meaningless there — regardless of which convention was passed. Under
|
|
106
|
+
* `rtl`:
|
|
107
|
+
*
|
|
108
|
+
* - `'negative'` — **what current browsers do.** `scrollLeft` is 0 at the
|
|
109
|
+
* start (right) edge and grows NEGATIVE toward the end. Chrome aligned
|
|
110
|
+
* with Firefox and Safari on this in Chrome 85; it is the CSSOM-View
|
|
111
|
+
* behaviour. The normalized value is its negation.
|
|
112
|
+
* - `'default'` — 0 at the start edge, growing POSITIVE toward the end.
|
|
113
|
+
* Legacy Edge/IE. Already the normalized shape, so it passes through.
|
|
114
|
+
* - `'reverse'` — `scrollLeft` equals `scrollWidth - clientWidth` at the
|
|
115
|
+
* start edge and decreases to 0 at the end. Pre-85 Chrome and old
|
|
116
|
+
* WebKit. The normalized value is that maximum minus the raw value.
|
|
117
|
+
*
|
|
118
|
+
* The names are this module's own and do NOT rank the conventions: `'default'`
|
|
119
|
+
* is a legacy behaviour despite its name, and callers must not treat it as a
|
|
120
|
+
* safe default. Detect the convention rather than assuming one — pinning
|
|
121
|
+
* `'default'` would invert the sign in every browser shipping today.
|
|
122
|
+
*/
|
|
123
|
+
export declare function normalizeInlineScrollOffset(rawScrollLeft: number, scrollWidth: number, clientWidth: number, direction: WritingDirection, rtlScrollType: RtlScrollType): number;
|
|
124
|
+
/** Which axis the list scrolls and lays rows out along. */
|
|
125
|
+
export type AxisMode = 'vertical' | 'horizontal';
|
|
126
|
+
/**
|
|
127
|
+
* The logical CSS property names that carry a row's size and offset along
|
|
128
|
+
* `axis`. Logical, not physical (`block-size`/`inset-block-start` rather
|
|
129
|
+
* than `height`/`top`), so RTL flips the inline axis correctly for free —
|
|
130
|
+
* no separate RTL branch is needed at the layout layer.
|
|
131
|
+
*/
|
|
132
|
+
export type RowLayoutDescriptor = {
|
|
133
|
+
readonly sizeProperty: 'block-size' | 'inline-size';
|
|
134
|
+
readonly offsetProperty: 'inset-block-start' | 'inset-inline-start';
|
|
135
|
+
};
|
|
136
|
+
/** Resolves the logical CSS property names a row on `axis` is sized and positioned with. */
|
|
137
|
+
export declare function resolveRowLayoutDescriptor(axis: AxisMode): RowLayoutDescriptor;
|
|
138
|
+
/**
|
|
139
|
+
* Returns one dynamic style string for a per-row-absolute row (Wave 4
|
|
140
|
+
* sticky mode only): the row's offset and size along `axis`, as logical CSS
|
|
141
|
+
* declarations.
|
|
142
|
+
*
|
|
143
|
+
* A single string, not per-property `style:` directives, because the CSS
|
|
144
|
+
* property NAME itself varies by axis (`inset-block-start` vs
|
|
145
|
+
* `inset-inline-start`, `block-size` vs `inline-size`) and Svelte's
|
|
146
|
+
* `style:prop={value}` directive requires a static property name — a
|
|
147
|
+
* computed string built from a function call is unambiguously dynamic
|
|
148
|
+
* instead. `position: absolute` is deliberately NOT included here: it is
|
|
149
|
+
* static across every row in this mode and lives in the CSS sidecar
|
|
150
|
+
* (`.cinder-virtual-list__row[data-cinder-absolute]`) rather than being
|
|
151
|
+
* repeated as an inline declaration on every row.
|
|
152
|
+
*/
|
|
153
|
+
export declare function resolveAbsoluteRowStyle(axis: AxisMode, start: number, size: number): string;
|
|
154
|
+
/**
|
|
155
|
+
* The main-axis size of an observed row, from a `ResizeObserver` entry's two
|
|
156
|
+
* possible size sources.
|
|
157
|
+
*
|
|
158
|
+
* `borderBoxSize` is already writing-mode relative, so its `inlineSize` is the
|
|
159
|
+
* correct main-axis size under a horizontal list in both writing directions. The
|
|
160
|
+
* `contentRect` fallback is physical, so the axis has to be chosen by hand — and
|
|
161
|
+
* an older engine that reports only `contentRect` is exactly where picking the
|
|
162
|
+
* wrong one goes unnoticed.
|
|
163
|
+
*/
|
|
164
|
+
export declare function resolveObservedMainAxisSize(borderBoxSize: {
|
|
165
|
+
readonly blockSize: number;
|
|
166
|
+
readonly inlineSize: number;
|
|
167
|
+
} | undefined, contentRect: {
|
|
168
|
+
readonly width: number;
|
|
169
|
+
readonly height: number;
|
|
170
|
+
}, axis: AxisMode): number;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure ARIA row-semantics and keyboard-navigation arithmetic for the virtual
|
|
3
|
+
* list. See CIN-201.
|
|
4
|
+
*
|
|
5
|
+
* A virtualized list only ever mounts a small window of rows, so assistive
|
|
6
|
+
* technology reading `aria-posinset`/`aria-setsize` off the mounted DOM
|
|
7
|
+
* alone would announce something like "3 of 12" for a list of 10,000 items
|
|
8
|
+
* — the window length, not the true list size. `resolveRowSemantics` exists
|
|
9
|
+
* to hand the component the FULL-list numbers to stamp onto each mounted
|
|
10
|
+
* row instead of that.
|
|
11
|
+
*
|
|
12
|
+
* `resolveKeyboardTargetIndex` is the companion arithmetic for arrow/Page/
|
|
13
|
+
* Home/End navigation: it resolves which index a keypress should move focus
|
|
14
|
+
* to, independent of which rows happen to be mounted right now, so
|
|
15
|
+
* navigation keeps working identically across mount and unmount cycles as
|
|
16
|
+
* the window scrolls past a given row.
|
|
17
|
+
*
|
|
18
|
+
* Dependency-free, matching the rest of `_internal/`: no DOM, no runes. The
|
|
19
|
+
* component owns reading the real `KeyboardEvent.key`, moving focus to the
|
|
20
|
+
* resolved index (mounting it first if it currently sits outside the
|
|
21
|
+
* window), and the actual scrolling.
|
|
22
|
+
*/
|
|
23
|
+
/** `aria-posinset`/`aria-setsize` values for one row of a virtualized list. */
|
|
24
|
+
export type RowSemantics = {
|
|
25
|
+
/** 1-based position within the FULL list — never the zero-based `index` passed in. */
|
|
26
|
+
readonly ariaPosInSet: number;
|
|
27
|
+
/** The FULL item count, not the length of the rendered window — see the module doc for why that distinction is the point. */
|
|
28
|
+
readonly ariaSetSize: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the `aria-posinset`/`aria-setsize` pair for the row at `index`.
|
|
32
|
+
*
|
|
33
|
+
* `aria-posinset` is 1-BASED: `index` is the zero-based array position, so
|
|
34
|
+
* this adds 1 rather than passing `index` straight through — passing the
|
|
35
|
+
* zero-based index through unchanged is the single most common way to get
|
|
36
|
+
* this attribute wrong.
|
|
37
|
+
*
|
|
38
|
+
* `aria-setsize` is `itemCount`, the FULL logical list size, not the number
|
|
39
|
+
* of rows currently mounted in the virtualization window. That distinction
|
|
40
|
+
* is the entire reason a virtualized list needs these attributes in the
|
|
41
|
+
* first place: without it, assistive technology would announce something
|
|
42
|
+
* like "3 of 12" for a list of 10,000 items, reading only what happens to
|
|
43
|
+
* be in the DOM right now.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveRowSemantics(index: number, itemCount: number): RowSemantics;
|
|
46
|
+
/** Which axis `resolveKeyboardTargetIndex` treats as "forward"/"backward" for the Arrow keys. */
|
|
47
|
+
export type VirtualListOrientation = 'vertical' | 'horizontal';
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the index a navigation keypress should move focus to.
|
|
50
|
+
*
|
|
51
|
+
* Returns `null` when `key` is not one of the keys this list handles, so
|
|
52
|
+
* the component can tell "not a navigation key, leave the event alone"
|
|
53
|
+
* apart from "navigation key, but the move happens to be a no-op." The
|
|
54
|
+
* latter still returns the (unchanged) index rather than `null` — the
|
|
55
|
+
* component still needs to consume the event (stopping it from scrolling
|
|
56
|
+
* the page via the browser's own default handling, for instance) even when
|
|
57
|
+
* the reader is already at the boundary they pressed toward.
|
|
58
|
+
*
|
|
59
|
+
* `Home` resolves to 0 and `End` to `itemCount - 1`. Every result is clamped
|
|
60
|
+
* to `[0, itemCount - 1]`; `itemCount <= 0` has no valid index to move to at
|
|
61
|
+
* all, so every key resolves to `null` in that case, including `Home` and
|
|
62
|
+
* `End`.
|
|
63
|
+
*
|
|
64
|
+
* `PageUp`/`PageDown` resolve to `null` here, deliberately. Paging is a PIXEL
|
|
65
|
+
* move of one uncovered viewport, which an index cannot express once rows vary
|
|
66
|
+
* in height — any row count this returned would be wrong at some boundary, in
|
|
67
|
+
* one direction or the other. The component scrolls for those keys directly.
|
|
68
|
+
*
|
|
69
|
+
* The horizontal arrow mapping DOES branch on writing direction, and has to.
|
|
70
|
+
* `KeyboardEvent.key` is derived from the physical key and the keyboard layout;
|
|
71
|
+
* it is not remapped by `dir`, so the right arrow reports `'ArrowRight'` in a
|
|
72
|
+
* right-to-left list exactly as it does in a left-to-right one. Meanwhile the
|
|
73
|
+
* component positions horizontal rows with logical properties, so under RTL a
|
|
74
|
+
* higher index sits visually to the LEFT. Mapping `'ArrowRight'` to "forward"
|
|
75
|
+
* there would walk the reader backwards from where they pressed.
|
|
76
|
+
*
|
|
77
|
+
* This is what the WAI-ARIA Authoring Practices mean by "if the direction is
|
|
78
|
+
* RTL, Right Arrow performs as Left Arrow and vice versa" — guidance that exists
|
|
79
|
+
* precisely because the reversal is not automatic. `writingDirection` is ignored
|
|
80
|
+
* for a vertical list, where the block axis does not flip.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveKeyboardTargetIndex(options: {
|
|
83
|
+
key: string;
|
|
84
|
+
currentIndex: number;
|
|
85
|
+
itemCount: number;
|
|
86
|
+
orientation: VirtualListOrientation;
|
|
87
|
+
writingDirection?: 'ltr' | 'rtl';
|
|
88
|
+
/**
|
|
89
|
+
* Indexes rendered as sticky headers. Stepping keys move between content rows
|
|
90
|
+
* and pass over these.
|
|
91
|
+
*/
|
|
92
|
+
stickyIndexes?: ReadonlySet<number>;
|
|
93
|
+
}): number | null;
|