@solid2-aria/stately 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -2
- package/dist/LICENSES/Apache-2.0.txt +201 -0
- package/dist/LICENSES/react-spectrum-NOTICE.txt +242 -0
- package/dist/NOTICE.txt +636 -0
- package/dist/autocomplete/create-autocomplete-state.d.ts +46 -0
- package/dist/autocomplete/create-autocomplete-state.js +41 -0
- package/dist/autocomplete/create-autocomplete-state.js.map +1 -0
- package/dist/calendar/create-calendar-state.d.ts +62 -0
- package/dist/calendar/create-calendar-state.js +357 -0
- package/dist/calendar/create-calendar-state.js.map +1 -0
- package/dist/calendar/create-range-calendar-state.d.ts +63 -0
- package/dist/calendar/create-range-calendar-state.js +204 -0
- package/dist/calendar/create-range-calendar-state.js.map +1 -0
- package/dist/calendar/types.d.ts +222 -0
- package/dist/calendar/types.js +16 -0
- package/dist/calendar/utils.d.ts +27 -0
- package/dist/calendar/utils.js +81 -0
- package/dist/calendar/utils.js.map +1 -0
- package/dist/checkbox/create-checkbox-group-state.d.ts +60 -0
- package/dist/checkbox/create-checkbox-group-state.js +88 -0
- package/dist/checkbox/create-checkbox-group-state.js.map +1 -0
- package/dist/collections/collection-builder.d.ts +28 -0
- package/dist/collections/collection-builder.js +164 -0
- package/dist/collections/collection-builder.js.map +1 -0
- package/dist/collections/create-collection.d.ts +24 -0
- package/dist/collections/create-collection.js +35 -0
- package/dist/collections/create-collection.js.map +1 -0
- package/dist/collections/get-child-nodes.d.ts +25 -0
- package/dist/collections/get-child-nodes.js +67 -0
- package/dist/collections/get-child-nodes.js.map +1 -0
- package/dist/collections/get-item-count.d.ts +19 -0
- package/dist/collections/get-item-count.js +34 -0
- package/dist/collections/get-item-count.js.map +1 -0
- package/dist/collections/item.d.ts +29 -0
- package/dist/collections/item.js +68 -0
- package/dist/collections/item.js.map +1 -0
- package/dist/collections/section.d.ts +29 -0
- package/dist/collections/section.js +60 -0
- package/dist/collections/section.js.map +1 -0
- package/dist/collections/types.d.ts +46 -0
- package/dist/collections/types.js +29 -0
- package/dist/collections/types.js.map +1 -0
- package/dist/color/color/base-color.d.ts +40 -0
- package/dist/color/color/base-color.js +122 -0
- package/dist/color/color/base-color.js.map +1 -0
- package/dist/color/color/color-classes.d.ts +27 -0
- package/dist/color/color/color-classes.js +29 -0
- package/dist/color/color/color-classes.js.map +1 -0
- package/dist/color/color/color-constructors.d.ts +23 -0
- package/dist/color/color/color-constructors.js +16 -0
- package/dist/color/color/color.d.ts +3 -0
- package/dist/color/color/color.js +2 -0
- package/dist/color/color/hsb-color.d.ts +24 -0
- package/dist/color/color/hsb-color.js +183 -0
- package/dist/color/color/hsb-color.js.map +1 -0
- package/dist/color/color/hsl-color.d.ts +24 -0
- package/dist/color/color/hsl-color.js +184 -0
- package/dist/color/color/hsl-color.js.map +1 -0
- package/dist/color/color/normalize-hue.d.ts +18 -0
- package/dist/color/color/normalize-hue.js +24 -0
- package/dist/color/color/normalize-hue.js.map +1 -0
- package/dist/color/color/oklch.d.ts +19 -0
- package/dist/color/color/oklch.js +97 -0
- package/dist/color/color/oklch.js.map +1 -0
- package/dist/color/color/rgb-color.d.ts +24 -0
- package/dist/color/color/rgb-color.js +230 -0
- package/dist/color/color/rgb-color.js.map +1 -0
- package/dist/color/color.d.ts +25 -0
- package/dist/color/color.js +41 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/create-color-area-state.d.ts +105 -0
- package/dist/color/create-color-area-state.js +138 -0
- package/dist/color/create-color-area-state.js.map +1 -0
- package/dist/color/create-color-channel-field-state.d.ts +29 -0
- package/dist/color/create-color-channel-field-state.js +69 -0
- package/dist/color/create-color-channel-field-state.js.map +1 -0
- package/dist/color/create-color-field-state.d.ts +61 -0
- package/dist/color/create-color-field-state.js +113 -0
- package/dist/color/create-color-field-state.js.map +1 -0
- package/dist/color/create-color-picker-state.d.ts +16 -0
- package/dist/color/create-color-picker-state.js +26 -0
- package/dist/color/create-color-picker-state.js.map +1 -0
- package/dist/color/create-color-slider-state.d.ts +50 -0
- package/dist/color/create-color-slider-state.js +93 -0
- package/dist/color/create-color-slider-state.js.map +1 -0
- package/dist/color/create-color-wheel-state.d.ts +76 -0
- package/dist/color/create-color-wheel-state.js +130 -0
- package/dist/color/create-color-wheel-state.js.map +1 -0
- package/dist/color/create-color.d.ts +20 -0
- package/dist/color/create-color.js +33 -0
- package/dist/color/create-color.js.map +1 -0
- package/dist/color/types.d.ts +87 -0
- package/dist/color/types.js +5 -0
- package/dist/combobox/create-combo-box-state.d.ts +157 -0
- package/dist/combobox/create-combo-box-state.js +450 -0
- package/dist/combobox/create-combo-box-state.js.map +1 -0
- package/dist/data/create-async-list.d.ts +88 -0
- package/dist/data/create-async-list.js +276 -0
- package/dist/data/create-async-list.js.map +1 -0
- package/dist/data/create-list-data.d.ts +140 -0
- package/dist/data/create-list-data.js +250 -0
- package/dist/data/create-list-data.js.map +1 -0
- package/dist/data/create-tree-data.d.ts +134 -0
- package/dist/data/create-tree-data.js +364 -0
- package/dist/data/create-tree-data.js.map +1 -0
- package/dist/datepicker/create-date-field-state.d.ts +138 -0
- package/dist/datepicker/create-date-field-state.js +449 -0
- package/dist/datepicker/create-date-field-state.js.map +1 -0
- package/dist/datepicker/create-date-picker-state.d.ts +82 -0
- package/dist/datepicker/create-date-picker-state.js +191 -0
- package/dist/datepicker/create-date-picker-state.js.map +1 -0
- package/dist/datepicker/create-date-range-picker-state.d.ts +97 -0
- package/dist/datepicker/create-date-range-picker-state.js +305 -0
- package/dist/datepicker/create-date-range-picker-state.js.map +1 -0
- package/dist/datepicker/create-time-field-state.d.ts +34 -0
- package/dist/datepicker/create-time-field-state.js +128 -0
- package/dist/datepicker/create-time-field-state.js.map +1 -0
- package/dist/datepicker/incomplete-date.d.ts +71 -0
- package/dist/datepicker/incomplete-date.js +324 -0
- package/dist/datepicker/incomplete-date.js.map +1 -0
- package/dist/datepicker/placeholders.d.ts +18 -0
- package/dist/datepicker/placeholders.js +418 -0
- package/dist/datepicker/placeholders.js.map +1 -0
- package/dist/datepicker/types.d.ts +131 -0
- package/dist/datepicker/types.js +16 -0
- package/dist/datepicker/utils.d.ts +37 -0
- package/dist/datepicker/utils.js +168 -0
- package/dist/datepicker/utils.js.map +1 -0
- package/dist/disclosure/create-disclosure-group-state.d.ts +47 -0
- package/dist/disclosure/create-disclosure-group-state.js +62 -0
- package/dist/disclosure/create-disclosure-group-state.js.map +1 -0
- package/dist/disclosure/create-disclosure-state.d.ts +42 -0
- package/dist/disclosure/create-disclosure-state.js +49 -0
- package/dist/disclosure/create-disclosure-state.js.map +1 -0
- package/dist/dnd/create-draggable-collection-state.d.ts +63 -0
- package/dist/dnd/create-draggable-collection-state.js +136 -0
- package/dist/dnd/create-draggable-collection-state.js.map +1 -0
- package/dist/dnd/create-droppable-collection-state.d.ts +55 -0
- package/dist/dnd/create-droppable-collection-state.js +155 -0
- package/dist/dnd/create-droppable-collection-state.js.map +1 -0
- package/dist/flags/flags.d.ts +21 -0
- package/dist/flags/flags.js +34 -0
- package/dist/flags/flags.js.map +1 -0
- package/dist/form/create-form-validation-state.d.ts +37 -0
- package/dist/form/create-form-validation-state.js +152 -0
- package/dist/form/create-form-validation-state.js.map +1 -0
- package/dist/grid/create-grid-state.d.ts +38 -0
- package/dist/grid/create-grid-state.js +85 -0
- package/dist/grid/create-grid-state.js.map +1 -0
- package/dist/grid/grid-collection.d.ts +68 -0
- package/dist/grid/grid-collection.js +133 -0
- package/dist/grid/grid-collection.js.map +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +86 -0
- package/dist/intl/color/ar-AE.js +44 -0
- package/dist/intl/color/ar-AE.js.map +1 -0
- package/dist/intl/color/bg-BG.js +44 -0
- package/dist/intl/color/bg-BG.js.map +1 -0
- package/dist/intl/color/cs-CZ.js +44 -0
- package/dist/intl/color/cs-CZ.js.map +1 -0
- package/dist/intl/color/da-DK.js +44 -0
- package/dist/intl/color/da-DK.js.map +1 -0
- package/dist/intl/color/de-DE.js +44 -0
- package/dist/intl/color/de-DE.js.map +1 -0
- package/dist/intl/color/el-GR.js +44 -0
- package/dist/intl/color/el-GR.js.map +1 -0
- package/dist/intl/color/en-US.js +44 -0
- package/dist/intl/color/en-US.js.map +1 -0
- package/dist/intl/color/es-ES.js +44 -0
- package/dist/intl/color/es-ES.js.map +1 -0
- package/dist/intl/color/et-EE.js +44 -0
- package/dist/intl/color/et-EE.js.map +1 -0
- package/dist/intl/color/fi-FI.js +44 -0
- package/dist/intl/color/fi-FI.js.map +1 -0
- package/dist/intl/color/fr-FR.js +44 -0
- package/dist/intl/color/fr-FR.js.map +1 -0
- package/dist/intl/color/he-IL.js +44 -0
- package/dist/intl/color/he-IL.js.map +1 -0
- package/dist/intl/color/hr-HR.js +44 -0
- package/dist/intl/color/hr-HR.js.map +1 -0
- package/dist/intl/color/hu-HU.js +44 -0
- package/dist/intl/color/hu-HU.js.map +1 -0
- package/dist/intl/color/index.js +75 -0
- package/dist/intl/color/index.js.map +1 -0
- package/dist/intl/color/it-IT.js +44 -0
- package/dist/intl/color/it-IT.js.map +1 -0
- package/dist/intl/color/ja-JP.js +44 -0
- package/dist/intl/color/ja-JP.js.map +1 -0
- package/dist/intl/color/ko-KR.js +44 -0
- package/dist/intl/color/ko-KR.js.map +1 -0
- package/dist/intl/color/lt-LT.js +44 -0
- package/dist/intl/color/lt-LT.js.map +1 -0
- package/dist/intl/color/lv-LV.js +44 -0
- package/dist/intl/color/lv-LV.js.map +1 -0
- package/dist/intl/color/nb-NO.js +44 -0
- package/dist/intl/color/nb-NO.js.map +1 -0
- package/dist/intl/color/nl-NL.js +44 -0
- package/dist/intl/color/nl-NL.js.map +1 -0
- package/dist/intl/color/pl-PL.js +44 -0
- package/dist/intl/color/pl-PL.js.map +1 -0
- package/dist/intl/color/pt-BR.js +44 -0
- package/dist/intl/color/pt-BR.js.map +1 -0
- package/dist/intl/color/pt-PT.js +44 -0
- package/dist/intl/color/pt-PT.js.map +1 -0
- package/dist/intl/color/ro-RO.js +44 -0
- package/dist/intl/color/ro-RO.js.map +1 -0
- package/dist/intl/color/ru-RU.js +44 -0
- package/dist/intl/color/ru-RU.js.map +1 -0
- package/dist/intl/color/sk-SK.js +44 -0
- package/dist/intl/color/sk-SK.js.map +1 -0
- package/dist/intl/color/sl-SI.js +44 -0
- package/dist/intl/color/sl-SI.js.map +1 -0
- package/dist/intl/color/sr-SP.js +44 -0
- package/dist/intl/color/sr-SP.js.map +1 -0
- package/dist/intl/color/sv-SE.js +44 -0
- package/dist/intl/color/sv-SE.js.map +1 -0
- package/dist/intl/color/tr-TR.js +44 -0
- package/dist/intl/color/tr-TR.js.map +1 -0
- package/dist/intl/color/uk-UA.js +44 -0
- package/dist/intl/color/uk-UA.js.map +1 -0
- package/dist/intl/color/zh-CN.js +44 -0
- package/dist/intl/color/zh-CN.js.map +1 -0
- package/dist/intl/color/zh-TW.js +44 -0
- package/dist/intl/color/zh-TW.js.map +1 -0
- package/dist/intl/datepicker/ar-AE.js +11 -0
- package/dist/intl/datepicker/ar-AE.js.map +1 -0
- package/dist/intl/datepicker/bg-BG.js +11 -0
- package/dist/intl/datepicker/bg-BG.js.map +1 -0
- package/dist/intl/datepicker/cs-CZ.js +11 -0
- package/dist/intl/datepicker/cs-CZ.js.map +1 -0
- package/dist/intl/datepicker/da-DK.js +11 -0
- package/dist/intl/datepicker/da-DK.js.map +1 -0
- package/dist/intl/datepicker/de-DE.js +11 -0
- package/dist/intl/datepicker/de-DE.js.map +1 -0
- package/dist/intl/datepicker/el-GR.js +11 -0
- package/dist/intl/datepicker/el-GR.js.map +1 -0
- package/dist/intl/datepicker/en-US.js +11 -0
- package/dist/intl/datepicker/en-US.js.map +1 -0
- package/dist/intl/datepicker/es-ES.js +11 -0
- package/dist/intl/datepicker/es-ES.js.map +1 -0
- package/dist/intl/datepicker/et-EE.js +11 -0
- package/dist/intl/datepicker/et-EE.js.map +1 -0
- package/dist/intl/datepicker/fi-FI.js +11 -0
- package/dist/intl/datepicker/fi-FI.js.map +1 -0
- package/dist/intl/datepicker/fr-FR.js +11 -0
- package/dist/intl/datepicker/fr-FR.js.map +1 -0
- package/dist/intl/datepicker/he-IL.js +11 -0
- package/dist/intl/datepicker/he-IL.js.map +1 -0
- package/dist/intl/datepicker/hr-HR.js +11 -0
- package/dist/intl/datepicker/hr-HR.js.map +1 -0
- package/dist/intl/datepicker/hu-HU.js +11 -0
- package/dist/intl/datepicker/hu-HU.js.map +1 -0
- package/dist/intl/datepicker/index.js +75 -0
- package/dist/intl/datepicker/index.js.map +1 -0
- package/dist/intl/datepicker/it-IT.js +11 -0
- package/dist/intl/datepicker/it-IT.js.map +1 -0
- package/dist/intl/datepicker/ja-JP.js +11 -0
- package/dist/intl/datepicker/ja-JP.js.map +1 -0
- package/dist/intl/datepicker/ko-KR.js +11 -0
- package/dist/intl/datepicker/ko-KR.js.map +1 -0
- package/dist/intl/datepicker/lt-LT.js +11 -0
- package/dist/intl/datepicker/lt-LT.js.map +1 -0
- package/dist/intl/datepicker/lv-LV.js +11 -0
- package/dist/intl/datepicker/lv-LV.js.map +1 -0
- package/dist/intl/datepicker/nb-NO.js +11 -0
- package/dist/intl/datepicker/nb-NO.js.map +1 -0
- package/dist/intl/datepicker/nl-NL.js +11 -0
- package/dist/intl/datepicker/nl-NL.js.map +1 -0
- package/dist/intl/datepicker/pl-PL.js +11 -0
- package/dist/intl/datepicker/pl-PL.js.map +1 -0
- package/dist/intl/datepicker/pt-BR.js +11 -0
- package/dist/intl/datepicker/pt-BR.js.map +1 -0
- package/dist/intl/datepicker/pt-PT.js +11 -0
- package/dist/intl/datepicker/pt-PT.js.map +1 -0
- package/dist/intl/datepicker/ro-RO.js +11 -0
- package/dist/intl/datepicker/ro-RO.js.map +1 -0
- package/dist/intl/datepicker/ru-RU.js +11 -0
- package/dist/intl/datepicker/ru-RU.js.map +1 -0
- package/dist/intl/datepicker/sk-SK.js +11 -0
- package/dist/intl/datepicker/sk-SK.js.map +1 -0
- package/dist/intl/datepicker/sl-SI.js +11 -0
- package/dist/intl/datepicker/sl-SI.js.map +1 -0
- package/dist/intl/datepicker/sr-SP.js +11 -0
- package/dist/intl/datepicker/sr-SP.js.map +1 -0
- package/dist/intl/datepicker/sv-SE.js +11 -0
- package/dist/intl/datepicker/sv-SE.js.map +1 -0
- package/dist/intl/datepicker/tr-TR.js +11 -0
- package/dist/intl/datepicker/tr-TR.js.map +1 -0
- package/dist/intl/datepicker/uk-UA.js +11 -0
- package/dist/intl/datepicker/uk-UA.js.map +1 -0
- package/dist/intl/datepicker/zh-CN.js +11 -0
- package/dist/intl/datepicker/zh-CN.js.map +1 -0
- package/dist/intl/datepicker/zh-TW.js +11 -0
- package/dist/intl/datepicker/zh-TW.js.map +1 -0
- package/dist/layout/grid-layout.d.ts +107 -0
- package/dist/layout/grid-layout.js +253 -0
- package/dist/layout/grid-layout.js.map +1 -0
- package/dist/layout/list-layout.d.ts +187 -0
- package/dist/layout/list-layout.js +488 -0
- package/dist/layout/list-layout.js.map +1 -0
- package/dist/layout/table-layout.d.ts +98 -0
- package/dist/layout/table-layout.js +476 -0
- package/dist/layout/table-layout.js.map +1 -0
- package/dist/layout/waterfall-layout.d.ts +85 -0
- package/dist/layout/waterfall-layout.js +225 -0
- package/dist/layout/waterfall-layout.js.map +1 -0
- package/dist/list/create-list-state.d.ts +48 -0
- package/dist/list/create-list-state.js +123 -0
- package/dist/list/create-list-state.js.map +1 -0
- package/dist/list/create-single-select-list-state.d.ts +38 -0
- package/dist/list/create-single-select-list-state.js +55 -0
- package/dist/list/create-single-select-list-state.js.map +1 -0
- package/dist/list/list-collection.d.ts +36 -0
- package/dist/list/list-collection.js +91 -0
- package/dist/list/list-collection.js.map +1 -0
- package/dist/menu/create-menu-trigger-state.d.ts +55 -0
- package/dist/menu/create-menu-trigger-state.js +58 -0
- package/dist/menu/create-menu-trigger-state.js.map +1 -0
- package/dist/menu/create-submenu-trigger-state.d.ts +47 -0
- package/dist/menu/create-submenu-trigger-state.js +59 -0
- package/dist/menu/create-submenu-trigger-state.js.map +1 -0
- package/dist/numberfield/create-number-field-state.d.ts +93 -0
- package/dist/numberfield/create-number-field-state.js +139 -0
- package/dist/numberfield/create-number-field-state.js.map +1 -0
- package/dist/overlays/create-overlay-trigger-state.d.ts +51 -0
- package/dist/overlays/create-overlay-trigger-state.js +56 -0
- package/dist/overlays/create-overlay-trigger-state.js.map +1 -0
- package/dist/radio/create-radio-group-state.d.ts +61 -0
- package/dist/radio/create-radio-group-state.js +71 -0
- package/dist/radio/create-radio-group-state.js.map +1 -0
- package/dist/searchfield/create-search-field-state.d.ts +35 -0
- package/dist/searchfield/create-search-field-state.js +34 -0
- package/dist/searchfield/create-search-field-state.js.map +1 -0
- package/dist/select/create-select-state.d.ts +116 -0
- package/dist/select/create-select-state.js +151 -0
- package/dist/select/create-select-state.js.map +1 -0
- package/dist/selection/create-multiple-selection-state.d.ts +39 -0
- package/dist/selection/create-multiple-selection-state.js +114 -0
- package/dist/selection/create-multiple-selection-state.js.map +1 -0
- package/dist/selection/selection-manager.d.ts +139 -0
- package/dist/selection/selection-manager.js +334 -0
- package/dist/selection/selection-manager.js.map +1 -0
- package/dist/selection/selection.d.ts +27 -0
- package/dist/selection/selection.js +38 -0
- package/dist/selection/selection.js.map +1 -0
- package/dist/selection/types.d.ts +116 -0
- package/dist/selection/types.js +16 -0
- package/dist/slider/create-slider-state.d.ts +182 -0
- package/dist/slider/create-slider-state.js +131 -0
- package/dist/slider/create-slider-state.js.map +1 -0
- package/dist/steplist/create-step-list-state.d.ts +40 -0
- package/dist/steplist/create-step-list-state.js +132 -0
- package/dist/steplist/create-step-list-state.js.map +1 -0
- package/dist/table/cell.d.ts +37 -0
- package/dist/table/cell.js +47 -0
- package/dist/table/cell.js.map +1 -0
- package/dist/table/collection-context.d.ts +4 -0
- package/dist/table/collection-context.js +8 -0
- package/dist/table/collection-context.js.map +1 -0
- package/dist/table/column.d.ts +66 -0
- package/dist/table/column.js +71 -0
- package/dist/table/column.js.map +1 -0
- package/dist/table/create-table-column-resize-state.d.ts +65 -0
- package/dist/table/create-table-column-resize-state.js +100 -0
- package/dist/table/create-table-column-resize-state.js.map +1 -0
- package/dist/table/create-table-state.d.ts +112 -0
- package/dist/table/create-table-state.js +122 -0
- package/dist/table/create-table-state.js.map +1 -0
- package/dist/table/create-tree-grid-state.d.ts +44 -0
- package/dist/table/create-tree-grid-state.js +145 -0
- package/dist/table/create-tree-grid-state.js.map +1 -0
- package/dist/table/row.d.ts +44 -0
- package/dist/table/row.js +91 -0
- package/dist/table/row.js.map +1 -0
- package/dist/table/table-body.d.ts +36 -0
- package/dist/table/table-body.js +57 -0
- package/dist/table/table-body.js.map +1 -0
- package/dist/table/table-collection.d.ts +62 -0
- package/dist/table/table-collection.js +274 -0
- package/dist/table/table-collection.js.map +1 -0
- package/dist/table/table-column-layout.d.ts +47 -0
- package/dist/table/table-column-layout.js +94 -0
- package/dist/table/table-column-layout.js.map +1 -0
- package/dist/table/table-header.d.ts +37 -0
- package/dist/table/table-header.js +52 -0
- package/dist/table/table-header.js.map +1 -0
- package/dist/table/table-utils.d.ts +60 -0
- package/dist/table/table-utils.js +203 -0
- package/dist/table/table-utils.js.map +1 -0
- package/dist/tabs/create-tab-list-state.d.ts +42 -0
- package/dist/tabs/create-tab-list-state.js +78 -0
- package/dist/tabs/create-tab-list-state.js.map +1 -0
- package/dist/toast/create-toast-state.d.ts +97 -0
- package/dist/toast/create-toast-state.js +166 -0
- package/dist/toast/create-toast-state.js.map +1 -0
- package/dist/toggle/create-toggle-group-state.d.ts +55 -0
- package/dist/toggle/create-toggle-group-state.js +62 -0
- package/dist/toggle/create-toggle-group-state.js.map +1 -0
- package/dist/toggle/create-toggle-state.d.ts +58 -0
- package/dist/toggle/create-toggle-state.js +43 -0
- package/dist/toggle/create-toggle-state.js.map +1 -0
- package/dist/tokenfield/create-token-field-state.d.ts +39 -0
- package/dist/tokenfield/create-token-field-state.js +44 -0
- package/dist/tokenfield/create-token-field-state.js.map +1 -0
- package/dist/tokenfield/token-field-value.d.ts +111 -0
- package/dist/tokenfield/token-field-value.js +327 -0
- package/dist/tokenfield/token-field-value.js.map +1 -0
- package/dist/tooltip/create-tooltip-trigger-state.d.ts +73 -0
- package/dist/tooltip/create-tooltip-trigger-state.js +136 -0
- package/dist/tooltip/create-tooltip-trigger-state.js.map +1 -0
- package/dist/tree/create-tree-state.d.ts +42 -0
- package/dist/tree/create-tree-state.js +75 -0
- package/dist/tree/create-tree-state.js.map +1 -0
- package/dist/tree/tree-collection.d.ts +36 -0
- package/dist/tree/tree-collection.js +84 -0
- package/dist/tree/tree-collection.js.map +1 -0
- package/dist/utils/create-controlled-signal.d.ts +23 -0
- package/dist/utils/create-controlled-signal.js +54 -0
- package/dist/utils/create-controlled-signal.js.map +1 -0
- package/dist/utils/get-item-key.d.ts +5 -0
- package/dist/utils/get-item-key.js +12 -0
- package/dist/utils/get-item-key.js.map +1 -0
- package/dist/utils/get-node-props.d.ts +23 -0
- package/dist/utils/get-node-props.js +38 -0
- package/dist/utils/get-node-props.js.map +1 -0
- package/dist/utils/has-content.d.ts +5 -0
- package/dist/utils/has-content.js +7 -0
- package/dist/utils/has-content.js.map +1 -0
- package/dist/utils/legacy-props.d.ts +10 -0
- package/dist/utils/legacy-props.js +17 -0
- package/dist/utils/legacy-props.js.map +1 -0
- package/dist/utils/number.d.ts +25 -0
- package/dist/utils/number.js +59 -0
- package/dist/utils/number.js.map +1 -0
- package/dist/utils/parse-calendar-identifier.d.ts +5 -0
- package/dist/utils/parse-calendar-identifier.js +31 -0
- package/dist/utils/parse-calendar-identifier.js.map +1 -0
- package/dist/utils/require-value.d.ts +4 -0
- package/dist/utils/require-value.js +10 -0
- package/dist/utils/require-value.js.map +1 -0
- package/dist/virtualizer/create-virtualizer-state.d.ts +44 -0
- package/dist/virtualizer/create-virtualizer-state.js +92 -0
- package/dist/virtualizer/create-virtualizer-state.js.map +1 -0
- package/dist/virtualizer/layout-info.d.ts +94 -0
- package/dist/virtualizer/layout-info.js +118 -0
- package/dist/virtualizer/layout-info.js.map +1 -0
- package/dist/virtualizer/layout.d.ts +91 -0
- package/dist/virtualizer/layout.js +71 -0
- package/dist/virtualizer/layout.js.map +1 -0
- package/dist/virtualizer/overscan-manager.d.ts +25 -0
- package/dist/virtualizer/overscan-manager.js +46 -0
- package/dist/virtualizer/overscan-manager.js.map +1 -0
- package/dist/virtualizer/point.d.ts +36 -0
- package/dist/virtualizer/point.js +48 -0
- package/dist/virtualizer/point.js.map +1 -0
- package/dist/virtualizer/rect.d.ts +103 -0
- package/dist/virtualizer/rect.js +156 -0
- package/dist/virtualizer/rect.js.map +1 -0
- package/dist/virtualizer/reusable-view.d.ts +51 -0
- package/dist/virtualizer/reusable-view.js +81 -0
- package/dist/virtualizer/reusable-view.js.map +1 -0
- package/dist/virtualizer/scroll-anchor.d.ts +98 -0
- package/dist/virtualizer/scroll-anchor.js +150 -0
- package/dist/virtualizer/scroll-anchor.js.map +1 -0
- package/dist/virtualizer/size.d.ts +34 -0
- package/dist/virtualizer/size.js +46 -0
- package/dist/virtualizer/size.js.map +1 -0
- package/dist/virtualizer/types.d.ts +47 -0
- package/dist/virtualizer/types.js +16 -0
- package/dist/virtualizer/utils.d.ts +19 -0
- package/dist/virtualizer/utils.js +27 -0
- package/dist/virtualizer/utils.js.map +1 -0
- package/dist/virtualizer/virtualizer.d.ts +99 -0
- package/dist/virtualizer/virtualizer.js +314 -0
- package/dist/virtualizer/virtualizer.js.map +1 -0
- package/package.json +174 -4
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/selection/SelectionManager.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { compareNodeOrder, getChildNodes, getFirstItem } from "../collections/get-child-nodes.js";
|
|
18
|
+
import { Selection } from "./selection.js";
|
|
19
|
+
import { getNodeProps } from "../utils/get-node-props.js";
|
|
20
|
+
// src/selection/selection-manager.ts
|
|
21
|
+
/**
|
|
22
|
+
* An interface for reading and updating multiple selection state.
|
|
23
|
+
*/
|
|
24
|
+
var SelectionManager = class SelectionManager {
|
|
25
|
+
collection;
|
|
26
|
+
state;
|
|
27
|
+
allowsCellSelection;
|
|
28
|
+
_isSelectAll;
|
|
29
|
+
layoutDelegate;
|
|
30
|
+
fullCollection;
|
|
31
|
+
constructor(collection, state, options) {
|
|
32
|
+
this.collection = collection;
|
|
33
|
+
this.state = state;
|
|
34
|
+
this.allowsCellSelection = options?.allowsCellSelection ?? false;
|
|
35
|
+
this._isSelectAll = null;
|
|
36
|
+
this.layoutDelegate = options?.layoutDelegate ?? null;
|
|
37
|
+
this.fullCollection = options?.fullCollection ?? null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The type of selection that is allowed in the collection.
|
|
41
|
+
*/
|
|
42
|
+
get selectionMode() {
|
|
43
|
+
return this.state.selectionMode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether the collection allows empty selection.
|
|
47
|
+
*/
|
|
48
|
+
get disallowEmptySelection() {
|
|
49
|
+
return this.state.disallowEmptySelection;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The selection behavior for the collection.
|
|
53
|
+
*/
|
|
54
|
+
get selectionBehavior() {
|
|
55
|
+
return this.state.selectionBehavior;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the selection behavior for the collection.
|
|
59
|
+
*/
|
|
60
|
+
setSelectionBehavior(selectionBehavior) {
|
|
61
|
+
this.state.setSelectionBehavior(selectionBehavior);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether the collection is currently focused.
|
|
65
|
+
*/
|
|
66
|
+
get isFocused() {
|
|
67
|
+
return this.state.isFocused;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Sets whether the collection is focused.
|
|
71
|
+
*/
|
|
72
|
+
setFocused(isFocused) {
|
|
73
|
+
this.state.setFocused(isFocused);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The current focused key in the collection.
|
|
77
|
+
*/
|
|
78
|
+
get focusedKey() {
|
|
79
|
+
return this.state.focusedKey;
|
|
80
|
+
}
|
|
81
|
+
/** Whether the first or last child of the focused key should receive focus. */
|
|
82
|
+
get childFocusStrategy() {
|
|
83
|
+
return this.state.childFocusStrategy;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Sets the focused key.
|
|
87
|
+
*/
|
|
88
|
+
setFocusedKey(key, childFocusStrategy) {
|
|
89
|
+
if (key === null || key === void 0 || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The currently selected keys in the collection.
|
|
93
|
+
*/
|
|
94
|
+
get selectedKeys() {
|
|
95
|
+
return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The raw selection value for the collection.
|
|
99
|
+
* Either 'all' for select all, or a set of keys.
|
|
100
|
+
*/
|
|
101
|
+
get rawSelection() {
|
|
102
|
+
return this.state.selectedKeys;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Returns whether a key is selected.
|
|
106
|
+
*/
|
|
107
|
+
isSelected(key) {
|
|
108
|
+
if (this.state.selectionMode === "none") return false;
|
|
109
|
+
const mappedKey = this.getKey(key);
|
|
110
|
+
if (mappedKey === null || mappedKey === void 0) return false;
|
|
111
|
+
return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Whether the selection is empty.
|
|
115
|
+
*/
|
|
116
|
+
get isEmpty() {
|
|
117
|
+
return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether all items in the collection are selected.
|
|
121
|
+
*/
|
|
122
|
+
get isSelectAll() {
|
|
123
|
+
if (this.isEmpty) return false;
|
|
124
|
+
if (this.state.selectedKeys === "all") return true;
|
|
125
|
+
if (this._isSelectAll !== null && this._isSelectAll !== void 0) return this._isSelectAll;
|
|
126
|
+
const allKeys = this.getSelectAllKeys();
|
|
127
|
+
const { selectedKeys } = this.state;
|
|
128
|
+
this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
|
|
129
|
+
return this._isSelectAll;
|
|
130
|
+
}
|
|
131
|
+
get firstSelectedKey() {
|
|
132
|
+
let first = null;
|
|
133
|
+
for (const key of this.state.selectedKeys) {
|
|
134
|
+
const item = this.collection.getItem(key);
|
|
135
|
+
if (!first || item && compareNodeOrder(this.collection, item, first) < 0) first = item;
|
|
136
|
+
}
|
|
137
|
+
return first?.key ?? null;
|
|
138
|
+
}
|
|
139
|
+
get lastSelectedKey() {
|
|
140
|
+
let last = null;
|
|
141
|
+
for (const key of this.state.selectedKeys) {
|
|
142
|
+
const item = this.collection.getItem(key);
|
|
143
|
+
if (!last || item && compareNodeOrder(this.collection, item, last) > 0) last = item;
|
|
144
|
+
}
|
|
145
|
+
return last?.key ?? null;
|
|
146
|
+
}
|
|
147
|
+
get disabledKeys() {
|
|
148
|
+
return this.state.disabledKeys;
|
|
149
|
+
}
|
|
150
|
+
get disabledBehavior() {
|
|
151
|
+
return this.state.disabledBehavior;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Extends the selection to the given key.
|
|
155
|
+
*/
|
|
156
|
+
extendSelection(toKey) {
|
|
157
|
+
if (this.selectionMode === "none") return;
|
|
158
|
+
if (this.selectionMode === "single") {
|
|
159
|
+
this.replaceSelection(toKey);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const mappedToKey = this.getKey(toKey);
|
|
163
|
+
if (mappedToKey === null || mappedToKey === void 0) return;
|
|
164
|
+
let selection;
|
|
165
|
+
if (this.state.selectedKeys === "all") selection = new Selection([mappedToKey], mappedToKey, mappedToKey);
|
|
166
|
+
else {
|
|
167
|
+
const selectedKeys = new Selection(this.state.selectedKeys);
|
|
168
|
+
const anchorKey = selectedKeys.anchorKey ?? mappedToKey;
|
|
169
|
+
selection = new Selection(selectedKeys, anchorKey, mappedToKey);
|
|
170
|
+
for (const key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) selection.delete(key);
|
|
171
|
+
for (const key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
|
|
172
|
+
}
|
|
173
|
+
this.state.setSelectedKeys(selection);
|
|
174
|
+
}
|
|
175
|
+
getKeyRange(from, to) {
|
|
176
|
+
const fromItem = this.collection.getItem(from);
|
|
177
|
+
const toItem = this.collection.getItem(to);
|
|
178
|
+
if (fromItem && toItem) {
|
|
179
|
+
if (compareNodeOrder(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
|
|
180
|
+
return this.getKeyRangeInternal(to, from);
|
|
181
|
+
}
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
184
|
+
getKeyRangeInternal(from, to) {
|
|
185
|
+
if (this.layoutDelegate?.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
|
|
186
|
+
const keys = [];
|
|
187
|
+
let key = from;
|
|
188
|
+
while (key !== null && key !== void 0) {
|
|
189
|
+
const item = this.collection.getItem(key);
|
|
190
|
+
if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
|
|
191
|
+
if (key === to) return keys;
|
|
192
|
+
key = this.collection.getKeyAfter(key);
|
|
193
|
+
}
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
getKey(key) {
|
|
197
|
+
let item = this.collection.getItem(key);
|
|
198
|
+
if (!item) return key;
|
|
199
|
+
if (item.type === "cell" && this.allowsCellSelection) return key;
|
|
200
|
+
while (item && item.type !== "item" && item.parentKey !== null && item.parentKey !== void 0) item = this.collection.getItem(item.parentKey);
|
|
201
|
+
if (!item || item.type !== "item") return null;
|
|
202
|
+
return item.key;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Toggles whether the given key is selected.
|
|
206
|
+
*/
|
|
207
|
+
toggleSelection(key) {
|
|
208
|
+
if (this.selectionMode === "none") return;
|
|
209
|
+
if (this.selectionMode === "single" && !this.isSelected(key)) {
|
|
210
|
+
this.replaceSelection(key);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const mappedKey = this.getKey(key);
|
|
214
|
+
if (mappedKey === null || mappedKey === void 0) return;
|
|
215
|
+
const keys = new Selection(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
216
|
+
if (keys.has(mappedKey)) keys.delete(mappedKey);
|
|
217
|
+
else if (this.canSelectItem(mappedKey)) {
|
|
218
|
+
keys.add(mappedKey);
|
|
219
|
+
keys.anchorKey = mappedKey;
|
|
220
|
+
keys.currentKey = mappedKey;
|
|
221
|
+
}
|
|
222
|
+
if (this.disallowEmptySelection && keys.size === 0) return;
|
|
223
|
+
this.state.setSelectedKeys(keys);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Replaces the selection with only the given key.
|
|
227
|
+
*/
|
|
228
|
+
replaceSelection(key) {
|
|
229
|
+
if (this.selectionMode === "none") return;
|
|
230
|
+
const mappedKey = this.getKey(key);
|
|
231
|
+
if (mappedKey === null || mappedKey === void 0) return;
|
|
232
|
+
const selection = this.canSelectItem(mappedKey) ? new Selection([mappedKey], mappedKey, mappedKey) : new Selection();
|
|
233
|
+
this.state.setSelectedKeys(selection);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Replaces the selection with the given keys.
|
|
237
|
+
*/
|
|
238
|
+
setSelectedKeys(keys) {
|
|
239
|
+
if (this.selectionMode === "none") return;
|
|
240
|
+
const selection = new Selection();
|
|
241
|
+
for (const key of keys) {
|
|
242
|
+
const mappedKey = this.getKey(key);
|
|
243
|
+
if (mappedKey !== null && mappedKey !== void 0) {
|
|
244
|
+
selection.add(mappedKey);
|
|
245
|
+
if (this.selectionMode === "single") break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
this.state.setSelectedKeys(selection);
|
|
249
|
+
}
|
|
250
|
+
getSelectAllKeys() {
|
|
251
|
+
const collection = this.fullCollection ?? this.collection;
|
|
252
|
+
const keys = [];
|
|
253
|
+
const addKeys = (initialKey) => {
|
|
254
|
+
let key = initialKey;
|
|
255
|
+
while (key !== null && key !== void 0) {
|
|
256
|
+
if (this.canSelectItemIn(key, collection)) {
|
|
257
|
+
const item = collection.getItem(key);
|
|
258
|
+
if (item?.type === "item") keys.push(key);
|
|
259
|
+
if (item?.hasChildNodes === true && (this.allowsCellSelection || item.type !== "item")) addKeys(getFirstItem(getChildNodes(item, collection))?.key ?? null);
|
|
260
|
+
}
|
|
261
|
+
key = collection.getKeyAfter(key);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
addKeys(collection.getFirstKey());
|
|
265
|
+
return keys;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Selects all items in the collection.
|
|
269
|
+
*/
|
|
270
|
+
selectAll() {
|
|
271
|
+
if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Removes all keys from the selection.
|
|
275
|
+
*/
|
|
276
|
+
clearSelection() {
|
|
277
|
+
if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new Selection());
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Toggles between select all and an empty selection.
|
|
281
|
+
*/
|
|
282
|
+
toggleSelectAll() {
|
|
283
|
+
if (this.isSelectAll) this.clearSelection();
|
|
284
|
+
else this.selectAll();
|
|
285
|
+
}
|
|
286
|
+
select(key, e) {
|
|
287
|
+
if (this.selectionMode === "none") return;
|
|
288
|
+
if (this.selectionMode === "single") {
|
|
289
|
+
if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
|
|
290
|
+
else this.replaceSelection(key);
|
|
291
|
+
} else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual")) this.toggleSelection(key);
|
|
292
|
+
else this.replaceSelection(key);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns whether the current selection is equal to the given selection.
|
|
296
|
+
*/
|
|
297
|
+
isSelectionEqual(selection) {
|
|
298
|
+
if (selection === this.state.selectedKeys) return true;
|
|
299
|
+
const { selectedKeys } = this;
|
|
300
|
+
if (selection.size !== selectedKeys.size) return false;
|
|
301
|
+
for (const key of selection) if (!selectedKeys.has(key)) return false;
|
|
302
|
+
for (const key of selectedKeys) if (!selection.has(key)) return false;
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
canSelectItem(key) {
|
|
306
|
+
return this.canSelectItemIn(key, this.collection);
|
|
307
|
+
}
|
|
308
|
+
canSelectItemIn(key, collection) {
|
|
309
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
|
|
310
|
+
const item = collection.getItem(key);
|
|
311
|
+
if (!item || getNodeProps(item).isDisabled || item.type === "cell" && !this.allowsCellSelection) return false;
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
isDisabled(key) {
|
|
315
|
+
const item = this.collection.getItem(key);
|
|
316
|
+
return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || getNodeProps(item).isDisabled) && getNodeProps(item).disabledBehavior !== "selection";
|
|
317
|
+
}
|
|
318
|
+
isLink(key) {
|
|
319
|
+
return Boolean(getNodeProps(this.collection.getItem(key)).href);
|
|
320
|
+
}
|
|
321
|
+
getItemProps(key) {
|
|
322
|
+
return this.collection.getItem(key)?.props;
|
|
323
|
+
}
|
|
324
|
+
withCollection(collection) {
|
|
325
|
+
return new SelectionManager(collection, this.state, {
|
|
326
|
+
allowsCellSelection: this.allowsCellSelection,
|
|
327
|
+
fullCollection: this.fullCollection ?? this.collection,
|
|
328
|
+
layoutDelegate: this.layoutDelegate ?? void 0
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
export { SelectionManager };
|
|
333
|
+
|
|
334
|
+
//# sourceMappingURL=selection-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-manager.js","names":[],"sources":["../../src/selection/selection-manager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/selection/SelectionManager.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type {\n Collection,\n DisabledBehavior,\n FocusStrategy,\n Selection as ISelection,\n Key,\n LayoutDelegate,\n LongPressEvent,\n Node,\n PressEvent,\n SelectionBehavior,\n SelectionMode,\n} from \"@solid2-aria/types-shared\";\n\nimport {\n compareNodeOrder,\n getChildNodes,\n getFirstItem,\n} from \"../collections/get-child-nodes\";\nimport { getNodeProps } from \"../utils/get-node-props\";\nimport { Selection } from \"./selection\";\nimport type { MultipleSelectionManager, MultipleSelectionState } from \"./types\";\n\ninterface SelectionManagerOptions {\n allowsCellSelection?: boolean;\n layoutDelegate?: LayoutDelegate;\n fullCollection?: Collection<Node<unknown>>;\n}\n\n/**\n * An interface for reading and updating multiple selection state.\n */\nexport class SelectionManager implements MultipleSelectionManager {\n collection: Collection<Node<unknown>>;\n private readonly state: MultipleSelectionState;\n private readonly allowsCellSelection: boolean;\n private _isSelectAll: boolean | null;\n private readonly layoutDelegate: LayoutDelegate | null;\n private readonly fullCollection: Collection<Node<unknown>> | null;\n constructor(\n collection: Collection<Node<unknown>>,\n state: MultipleSelectionState,\n options?: SelectionManagerOptions\n ) {\n this.collection = collection;\n this.state = state;\n this.allowsCellSelection = options?.allowsCellSelection ?? false;\n this._isSelectAll = null;\n this.layoutDelegate = options?.layoutDelegate ?? null;\n this.fullCollection = options?.fullCollection ?? null;\n }\n /**\n * The type of selection that is allowed in the collection.\n */\n get selectionMode(): SelectionMode {\n return this.state.selectionMode;\n }\n /**\n * Whether the collection allows empty selection.\n */\n get disallowEmptySelection(): boolean {\n return this.state.disallowEmptySelection;\n }\n /**\n * The selection behavior for the collection.\n */\n get selectionBehavior(): SelectionBehavior {\n return this.state.selectionBehavior;\n }\n /**\n * Sets the selection behavior for the collection.\n */\n setSelectionBehavior(selectionBehavior: SelectionBehavior): void {\n this.state.setSelectionBehavior(selectionBehavior);\n }\n /**\n * Whether the collection is currently focused.\n */\n get isFocused(): boolean {\n return this.state.isFocused;\n }\n /**\n * Sets whether the collection is focused.\n */\n setFocused(isFocused: boolean): void {\n this.state.setFocused(isFocused);\n }\n /**\n * The current focused key in the collection.\n */\n get focusedKey(): Key | null {\n return this.state.focusedKey;\n }\n /** Whether the first or last child of the focused key should receive focus. */\n get childFocusStrategy(): FocusStrategy | null {\n return this.state.childFocusStrategy;\n }\n /**\n * Sets the focused key.\n */\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n if (key === null || key === undefined || this.collection.getItem(key)) {\n this.state.setFocusedKey(key, childFocusStrategy);\n }\n }\n /**\n * The currently selected keys in the collection.\n */\n get selectedKeys(): Set<Key> {\n return this.state.selectedKeys === \"all\"\n ? new Set(this.getSelectAllKeys())\n : this.state.selectedKeys;\n }\n /**\n * The raw selection value for the collection.\n * Either 'all' for select all, or a set of keys.\n */\n get rawSelection(): ISelection {\n return this.state.selectedKeys;\n }\n /**\n * Returns whether a key is selected.\n */\n isSelected(key: Key): boolean {\n if (this.state.selectionMode === \"none\") {\n return false;\n }\n\n const mappedKey = this.getKey(key);\n\n if (mappedKey === null || mappedKey === undefined) {\n return false;\n }\n\n return this.state.selectedKeys === \"all\"\n ? this.canSelectItem(mappedKey)\n : this.state.selectedKeys.has(mappedKey);\n }\n /**\n * Whether the selection is empty.\n */\n get isEmpty(): boolean {\n return (\n this.state.selectedKeys !== \"all\" && this.state.selectedKeys.size === 0\n );\n }\n /**\n * Whether all items in the collection are selected.\n */\n get isSelectAll(): boolean {\n if (this.isEmpty) {\n return false;\n }\n\n if (this.state.selectedKeys === \"all\") {\n return true;\n }\n\n if (this._isSelectAll !== null && this._isSelectAll !== undefined) {\n return this._isSelectAll;\n }\n\n const allKeys = this.getSelectAllKeys();\n const { selectedKeys } = this.state;\n this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));\n\n return this._isSelectAll;\n }\n get firstSelectedKey(): Key | null {\n let first: Node<unknown> | null = null;\n\n for (const key of this.state.selectedKeys) {\n const item = this.collection.getItem(key);\n\n if (\n !first ||\n (item && compareNodeOrder(this.collection, item, first) < 0)\n ) {\n first = item;\n }\n }\n\n return first?.key ?? null;\n }\n get lastSelectedKey(): Key | null {\n let last: Node<unknown> | null = null;\n\n for (const key of this.state.selectedKeys) {\n const item = this.collection.getItem(key);\n\n if (\n !last ||\n (item && compareNodeOrder(this.collection, item, last) > 0)\n ) {\n last = item;\n }\n }\n\n return last?.key ?? null;\n }\n get disabledKeys(): Set<Key> {\n return this.state.disabledKeys;\n }\n get disabledBehavior(): DisabledBehavior {\n return this.state.disabledBehavior;\n }\n /**\n * Extends the selection to the given key.\n */\n extendSelection(toKey: Key): void {\n if (this.selectionMode === \"none\") {\n return;\n }\n\n if (this.selectionMode === \"single\") {\n this.replaceSelection(toKey);\n\n return;\n }\n\n const mappedToKey = this.getKey(toKey);\n\n if (mappedToKey === null || mappedToKey === undefined) {\n return;\n }\n\n let selection: Selection;\n\n // Only select the one key if coming from a select all.\n if (this.state.selectedKeys === \"all\") {\n selection = new Selection([mappedToKey], mappedToKey, mappedToKey);\n } else {\n const selectedKeys = new Selection(this.state.selectedKeys);\n const anchorKey = selectedKeys.anchorKey ?? mappedToKey;\n selection = new Selection(selectedKeys, anchorKey, mappedToKey);\n\n for (const key of this.getKeyRange(\n anchorKey,\n selectedKeys.currentKey ?? mappedToKey\n )) {\n selection.delete(key);\n }\n\n for (const key of this.getKeyRange(mappedToKey, anchorKey)) {\n if (this.canSelectItem(key)) {\n selection.add(key);\n }\n }\n }\n\n this.state.setSelectedKeys(selection);\n }\n private getKeyRange(from: Key, to: Key) {\n const fromItem = this.collection.getItem(from);\n const toItem = this.collection.getItem(to);\n\n if (fromItem && toItem) {\n if (compareNodeOrder(this.collection, fromItem, toItem) <= 0) {\n return this.getKeyRangeInternal(from, to);\n }\n\n return this.getKeyRangeInternal(to, from);\n }\n\n return [];\n }\n private getKeyRangeInternal(from: Key, to: Key) {\n if (this.layoutDelegate?.getKeyRange) {\n return this.layoutDelegate.getKeyRange(from, to);\n }\n\n const keys: Key[] = [];\n let key: Key | null = from;\n\n while (key !== null && key !== undefined) {\n const item = this.collection.getItem(key);\n\n if (\n item &&\n (item.type === \"item\" ||\n (item.type === \"cell\" && this.allowsCellSelection))\n ) {\n keys.push(key);\n }\n\n if (key === to) {\n return keys;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return [];\n }\n private getKey(key: Key) {\n let item = this.collection.getItem(key);\n\n if (!item) {\n // ¯\\_(ツ)_/¯\n return key;\n }\n\n // If cell selection is allowed, just return the key.\n if (item.type === \"cell\" && this.allowsCellSelection) {\n return key;\n }\n\n // Find a parent item to select\n while (\n item &&\n item.type !== \"item\" &&\n item.parentKey !== null &&\n item.parentKey !== undefined\n ) {\n item = this.collection.getItem(item.parentKey);\n }\n\n if (!item || item.type !== \"item\") {\n return null;\n }\n\n return item.key;\n }\n /**\n * Toggles whether the given key is selected.\n */\n toggleSelection(key: Key): void {\n if (this.selectionMode === \"none\") {\n return;\n }\n\n if (this.selectionMode === \"single\" && !this.isSelected(key)) {\n this.replaceSelection(key);\n\n return;\n }\n\n const mappedKey = this.getKey(key);\n\n if (mappedKey === null || mappedKey === undefined) {\n return;\n }\n\n const keys = new Selection(\n this.state.selectedKeys === \"all\"\n ? this.getSelectAllKeys()\n : this.state.selectedKeys\n );\n\n if (keys.has(mappedKey)) {\n keys.delete(mappedKey);\n // move anchor to last selected key...\n // Does `current` need to move here too?\n } else if (this.canSelectItem(mappedKey)) {\n keys.add(mappedKey);\n keys.anchorKey = mappedKey;\n keys.currentKey = mappedKey;\n }\n\n if (this.disallowEmptySelection && keys.size === 0) {\n return;\n }\n\n this.state.setSelectedKeys(keys);\n }\n /**\n * Replaces the selection with only the given key.\n */\n replaceSelection(key: Key): void {\n if (this.selectionMode === \"none\") {\n return;\n }\n\n const mappedKey = this.getKey(key);\n\n if (mappedKey === null || mappedKey === undefined) {\n return;\n }\n\n const selection = this.canSelectItem(mappedKey)\n ? new Selection([mappedKey], mappedKey, mappedKey)\n : new Selection();\n\n this.state.setSelectedKeys(selection);\n }\n /**\n * Replaces the selection with the given keys.\n */\n setSelectedKeys(keys: Iterable<Key>): void {\n if (this.selectionMode === \"none\") {\n return;\n }\n\n const selection = new Selection();\n\n for (const key of keys) {\n const mappedKey = this.getKey(key);\n\n if (mappedKey !== null && mappedKey !== undefined) {\n selection.add(mappedKey);\n\n if (this.selectionMode === \"single\") {\n break;\n }\n }\n }\n\n this.state.setSelectedKeys(selection);\n }\n private getSelectAllKeys() {\n // Use the full (unfiltered) collection when available so that materializing\n // the 'all' selection includes items that are currently filtered out (e.g. by Autocomplete).\n const collection = this.fullCollection ?? this.collection;\n const keys: Key[] = [];\n\n const addKeys = (initialKey: Key | null) => {\n let key = initialKey;\n\n while (key !== null && key !== undefined) {\n if (this.canSelectItemIn(key, collection)) {\n const item = collection.getItem(key);\n\n if (item?.type === \"item\") {\n keys.push(key);\n }\n\n // Add child keys. If cell selection is allowed, then include item children too.\n if (\n item?.hasChildNodes === true &&\n (this.allowsCellSelection || item.type !== \"item\")\n ) {\n addKeys(getFirstItem(getChildNodes(item, collection))?.key ?? null);\n }\n }\n\n key = collection.getKeyAfter(key);\n }\n };\n\n addKeys(collection.getFirstKey());\n\n return keys;\n }\n /**\n * Selects all items in the collection.\n */\n selectAll(): void {\n if (!this.isSelectAll && this.selectionMode === \"multiple\") {\n this.state.setSelectedKeys(\"all\");\n }\n }\n /**\n * Removes all keys from the selection.\n */\n clearSelection(): void {\n if (\n !this.disallowEmptySelection &&\n (this.state.selectedKeys === \"all\" || this.state.selectedKeys.size > 0)\n ) {\n this.state.setSelectedKeys(new Selection());\n }\n }\n /**\n * Toggles between select all and an empty selection.\n */\n toggleSelectAll(): void {\n if (this.isSelectAll) {\n this.clearSelection();\n } else {\n this.selectAll();\n }\n }\n select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void {\n if (this.selectionMode === \"none\") {\n return;\n }\n\n if (this.selectionMode === \"single\") {\n if (this.isSelected(key) && !this.disallowEmptySelection) {\n this.toggleSelection(key);\n } else {\n this.replaceSelection(key);\n }\n } else if (\n this.selectionBehavior === \"toggle\" ||\n (e && (e.pointerType === \"touch\" || e.pointerType === \"virtual\"))\n ) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n this.toggleSelection(key);\n } else {\n this.replaceSelection(key);\n }\n }\n /**\n * Returns whether the current selection is equal to the given selection.\n */\n isSelectionEqual(selection: Set<Key>): boolean {\n if (selection === this.state.selectedKeys) {\n return true;\n }\n\n // Check if the set of keys match.\n const { selectedKeys } = this;\n\n if (selection.size !== selectedKeys.size) {\n return false;\n }\n\n for (const key of selection) {\n if (!selectedKeys.has(key)) {\n return false;\n }\n }\n\n for (const key of selectedKeys) {\n if (!selection.has(key)) {\n return false;\n }\n }\n\n return true;\n }\n canSelectItem(key: Key): boolean {\n return this.canSelectItemIn(key, this.collection);\n }\n private canSelectItemIn(\n key: Key,\n collection: Collection<Node<unknown>>\n ): boolean {\n if (\n this.state.selectionMode === \"none\" ||\n this.state.disabledKeys.has(key)\n ) {\n return false;\n }\n\n const item = collection.getItem(key);\n\n if (\n !item ||\n getNodeProps(item).isDisabled ||\n (item.type === \"cell\" && !this.allowsCellSelection)\n ) {\n return false;\n }\n\n return true;\n }\n isDisabled(key: Key): boolean {\n const item = this.collection.getItem(key);\n\n return (\n this.state.disabledBehavior === \"all\" &&\n (this.state.disabledKeys.has(key) || getNodeProps(item).isDisabled) &&\n getNodeProps(item).disabledBehavior !== \"selection\"\n );\n }\n isLink(key: Key): boolean {\n return Boolean(getNodeProps(this.collection.getItem(key)).href);\n }\n getItemProps(key: Key): Node<unknown>[\"props\"] {\n return this.collection.getItem(key)?.props;\n }\n withCollection(collection: Collection<Node<unknown>>): SelectionManager {\n return new SelectionManager(collection, this.state, {\n allowsCellSelection: this.allowsCellSelection,\n fullCollection: this.fullCollection ?? this.collection,\n layoutDelegate: this.layoutDelegate ?? undefined,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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I,iBAAiB,YAAY,KAAK,OAAO;GAClD,qBAAqB,KAAK;GAC1B,gBAAgB,KAAK,kBAAkB,KAAK;GAC5C,gBAAgB,KAAK,kBAAkB,KAAA;EACzC,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/selection/Selection.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { Key } from "@solid2-aria/types-shared";
|
|
18
|
+
/**
|
|
19
|
+
* A Selection is a special Set containing Keys, which also has an anchor
|
|
20
|
+
* and current selected key for use when range selecting.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Selection extends Set<Key> {
|
|
23
|
+
anchorKey: Key | null;
|
|
24
|
+
currentKey: Key | null;
|
|
25
|
+
constructor(keys?: Iterable<Key> | Selection, anchorKey?: Key | null, currentKey?: Key | null);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/selection/Selection.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
// src/selection/selection.ts
|
|
18
|
+
/**
|
|
19
|
+
* A Selection is a special Set containing Keys, which also has an anchor
|
|
20
|
+
* and current selected key for use when range selecting.
|
|
21
|
+
*/
|
|
22
|
+
var Selection = class Selection extends Set {
|
|
23
|
+
anchorKey;
|
|
24
|
+
currentKey;
|
|
25
|
+
constructor(keys, anchorKey, currentKey) {
|
|
26
|
+
super(keys);
|
|
27
|
+
if (keys instanceof Selection) {
|
|
28
|
+
this.anchorKey = anchorKey ?? keys.anchorKey;
|
|
29
|
+
this.currentKey = currentKey ?? keys.currentKey;
|
|
30
|
+
} else {
|
|
31
|
+
this.anchorKey = anchorKey ?? null;
|
|
32
|
+
this.currentKey = currentKey ?? null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export { Selection };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","names":[],"sources":["../../src/selection/selection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/selection/Selection.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { Key } from \"@solid2-aria/types-shared\";\n\n/**\n * A Selection is a special Set containing Keys, which also has an anchor\n * and current selected key for use when range selecting.\n */\nexport class Selection extends Set<Key> {\n anchorKey: Key | null;\n currentKey: Key | null;\n constructor(\n keys?: Iterable<Key> | Selection,\n anchorKey?: Key | null,\n currentKey?: Key | null\n ) {\n super(keys);\n\n if (keys instanceof Selection) {\n this.anchorKey = anchorKey ?? keys.anchorKey;\n this.currentKey = currentKey ?? keys.currentKey;\n } else {\n this.anchorKey = anchorKey ?? null;\n this.currentKey = currentKey ?? null;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,YAAb,MAAa,kBAAkB,IAAS;CACtC;CACA;CACA,YACE,MACA,WACA,YACA;EACA,MAAM,IAAI;EAEV,IAAI,gBAAgB,WAAW;GAC7B,KAAK,YAAY,aAAa,KAAK;GACnC,KAAK,aAAa,cAAc,KAAK;EACvC,OAAO;GACL,KAAK,YAAY,aAAa;GAC9B,KAAK,aAAa,cAAc;EAClC;CACF;AACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/selection/types.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { Collection, DisabledBehavior, FocusStrategy, Key, LongPressEvent, Node, PressEvent, Selection, SelectionBehavior, SelectionMode } from "@solid2-aria/types-shared";
|
|
18
|
+
export interface FocusState {
|
|
19
|
+
/** Whether the collection is currently focused. */
|
|
20
|
+
readonly isFocused: boolean;
|
|
21
|
+
/** Sets whether the collection is focused. */
|
|
22
|
+
setFocused: (isFocused: boolean) => void;
|
|
23
|
+
/** The current focused key in the collection. */
|
|
24
|
+
readonly focusedKey: Key | null;
|
|
25
|
+
/** Whether the first or last child of the focused key should receive focus. */
|
|
26
|
+
readonly childFocusStrategy: FocusStrategy | null;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the focused key, and optionally, whether the first or last child of that key should
|
|
29
|
+
* receive focus.
|
|
30
|
+
*/
|
|
31
|
+
setFocusedKey: (key: Key | null, child?: FocusStrategy) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface SingleSelectionState extends FocusState {
|
|
34
|
+
/** Whether the collection allows empty selection. */
|
|
35
|
+
readonly disallowEmptySelection?: boolean;
|
|
36
|
+
/** The currently selected key in the collection. */
|
|
37
|
+
readonly selectedKey: Key;
|
|
38
|
+
/** Sets the selected key in the collection. */
|
|
39
|
+
setSelectedKey: (key: Key | null) => void;
|
|
40
|
+
}
|
|
41
|
+
export interface MultipleSelectionState extends FocusState {
|
|
42
|
+
/** The type of selection that is allowed in the collection. */
|
|
43
|
+
readonly selectionMode: SelectionMode;
|
|
44
|
+
/** The selection behavior for the collection. */
|
|
45
|
+
readonly selectionBehavior: SelectionBehavior;
|
|
46
|
+
/** Sets the selection behavior for the collection. */
|
|
47
|
+
setSelectionBehavior: (selectionBehavior: SelectionBehavior) => void;
|
|
48
|
+
/** Whether the collection allows empty selection. */
|
|
49
|
+
readonly disallowEmptySelection: boolean;
|
|
50
|
+
/** The currently selected keys in the collection. */
|
|
51
|
+
readonly selectedKeys: Selection;
|
|
52
|
+
/** Sets the selected keys in the collection. */
|
|
53
|
+
setSelectedKeys: (keys: Selection) => void;
|
|
54
|
+
/** The currently disabled keys in the collection. */
|
|
55
|
+
readonly disabledKeys: Set<Key>;
|
|
56
|
+
/** Whether `disabledKeys` applies to selection, actions, or both. */
|
|
57
|
+
readonly disabledBehavior: DisabledBehavior;
|
|
58
|
+
}
|
|
59
|
+
export interface MultipleSelectionManager extends FocusState {
|
|
60
|
+
/** The type of selection that is allowed in the collection. */
|
|
61
|
+
readonly selectionMode: SelectionMode;
|
|
62
|
+
/** The selection behavior for the collection. */
|
|
63
|
+
readonly selectionBehavior: SelectionBehavior;
|
|
64
|
+
/** Whether the collection allows empty selection. */
|
|
65
|
+
readonly disallowEmptySelection?: boolean;
|
|
66
|
+
/** The currently selected keys in the collection. */
|
|
67
|
+
readonly selectedKeys: Set<Key>;
|
|
68
|
+
/** Whether the selection is empty. */
|
|
69
|
+
readonly isEmpty: boolean;
|
|
70
|
+
/** Whether all items in the collection are selected. */
|
|
71
|
+
readonly isSelectAll: boolean;
|
|
72
|
+
/** The first selected key in the collection. */
|
|
73
|
+
readonly firstSelectedKey: Key | null;
|
|
74
|
+
/** The last selected key in the collection. */
|
|
75
|
+
readonly lastSelectedKey: Key | null;
|
|
76
|
+
/** The currently disabled keys in the collection. */
|
|
77
|
+
readonly disabledKeys: Set<Key>;
|
|
78
|
+
/** Whether `disabledKeys` applies to selection, actions, or both. */
|
|
79
|
+
readonly disabledBehavior: DisabledBehavior;
|
|
80
|
+
/** Returns whether a key is selected. */
|
|
81
|
+
isSelected: (key: Key) => boolean;
|
|
82
|
+
/** Returns whether the current selection is equal to the given selection. */
|
|
83
|
+
isSelectionEqual: (selection: Set<Key>) => boolean;
|
|
84
|
+
/** Extends the selection to the given key. */
|
|
85
|
+
extendSelection: (toKey: Key) => void;
|
|
86
|
+
/** Toggles whether the given key is selected. */
|
|
87
|
+
toggleSelection: (key: Key) => void;
|
|
88
|
+
/** Replaces the selection with only the given key. */
|
|
89
|
+
replaceSelection: (key: Key) => void;
|
|
90
|
+
/** Replaces the selection with the given keys. */
|
|
91
|
+
setSelectedKeys: (keys: Iterable<Key>) => void;
|
|
92
|
+
/** Selects all items in the collection. */
|
|
93
|
+
selectAll: () => void;
|
|
94
|
+
/** Removes all keys from the selection. */
|
|
95
|
+
clearSelection: () => void;
|
|
96
|
+
/** Toggles between select all and an empty selection. */
|
|
97
|
+
toggleSelectAll: () => void;
|
|
98
|
+
/**
|
|
99
|
+
* Toggles, replaces, or extends selection to the given key depending
|
|
100
|
+
* on the pointer event and collection's selection mode.
|
|
101
|
+
*/
|
|
102
|
+
select: (key: Key, e?: PressEvent | LongPressEvent | PointerEvent) => void;
|
|
103
|
+
/** Returns whether the given key can be selected. */
|
|
104
|
+
canSelectItem: (key: Key) => boolean;
|
|
105
|
+
/** Returns whether the given key is non-interactive, i.e. both selection and actions are disabled. */
|
|
106
|
+
isDisabled: (key: Key) => boolean;
|
|
107
|
+
/** Sets the selection behavior for the collection. */
|
|
108
|
+
setSelectionBehavior: (selectionBehavior: SelectionBehavior) => void;
|
|
109
|
+
/** Returns whether the given key is a hyperlink. */
|
|
110
|
+
isLink: (key: Key) => boolean;
|
|
111
|
+
/** Returns the props for the given item. */
|
|
112
|
+
getItemProps: (key: Key) => Node<unknown>["props"];
|
|
113
|
+
/** The collection of nodes that the selection manager handles. */
|
|
114
|
+
collection: Collection<Node<unknown>>;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/selection/types.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|