@mcp-b/web-components 0.2.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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/accordion-B1Q3kuP_.d.ts +373 -0
- package/dist/accordion-item-DvPfhpm8.js +307 -0
- package/dist/accordion-item-bPRIahNn.d.ts +63 -0
- package/dist/accordion-zDr-Br4V.js +483 -0
- package/dist/action-bar-CYsjmhwP.d.ts +29 -0
- package/dist/action-bar-CjN_UcnP.js +56 -0
- package/dist/alert-dialog-4CnO3Nb5.d.ts +60 -0
- package/dist/alert-dialog-D25Oi_TS.js +126 -0
- package/dist/avatar-Bje_KpZo.d.ts +141 -0
- package/dist/avatar-CRP0kW3x.js +224 -0
- package/dist/badge-Ct95U4UO.js +301 -0
- package/dist/badge-D1DNQrWn.d.ts +106 -0
- package/dist/breadcrumb-BxZ-nQE5.d.ts +365 -0
- package/dist/breadcrumb-item-BC454oQe.d.ts +59 -0
- package/dist/breadcrumb-item-P5pdq_gE.js +151 -0
- package/dist/breadcrumb-uURhiqWJ.js +384 -0
- package/dist/button-5k_aL_gD.js +802 -0
- package/dist/button-BQofnUt4.d.ts +354 -0
- package/dist/button-group-BydvJTQy.js +197 -0
- package/dist/button-group-COodHeuB.d.ts +155 -0
- package/dist/callout-B8zTf8Go.js +188 -0
- package/dist/callout-DFwPao36.d.ts +103 -0
- package/dist/card-BYDzdMAU.d.ts +177 -0
- package/dist/card-DIg1-X2G.js +332 -0
- package/dist/carousel-Bktu7wrD.js +843 -0
- package/dist/carousel-DQITCtEY.d.ts +423 -0
- package/dist/carousel-item-B5-X31Ha.js +79 -0
- package/dist/carousel-item-BB3jL2tk.d.ts +34 -0
- package/dist/cdn/loader.js +530 -0
- package/dist/checkbox-D6r7PVPj.js +641 -0
- package/dist/checkbox-DoFcDEKB.d.ts +354 -0
- package/dist/checkbox-group-CLvNAO_F.js +201 -0
- package/dist/checkbox-group-Cnh8rAn4.d.ts +152 -0
- package/dist/color-input-Bky89xg_.d.ts +470 -0
- package/dist/color-input-DPIxi9wR.js +894 -0
- package/dist/color-picker-adwOmtRl.js +1240 -0
- package/dist/color-picker-wQw8bPsq.d.ts +360 -0
- package/dist/combobox-B6al50UG.js +1693 -0
- package/dist/combobox-item-D2H1CMxC.d.ts +714 -0
- package/dist/combobox-item-yM6tDrGG.js +225 -0
- package/dist/comparison-B1-nMwmp.d.ts +134 -0
- package/dist/comparison-CyqKrCN-.js +435 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordion.js +2 -0
- package/dist/components/accordion-item/accordion-item.d.ts +2 -0
- package/dist/components/accordion-item/accordion-item.js +2 -0
- package/dist/components/action-bar/action-bar.d.ts +2 -0
- package/dist/components/action-bar/action-bar.js +2 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +2 -0
- package/dist/components/alert-dialog/alert-dialog.js +2 -0
- package/dist/components/avatar/avatar.d.ts +2 -0
- package/dist/components/avatar/avatar.js +2 -0
- package/dist/components/badge/badge.d.ts +2 -0
- package/dist/components/badge/badge.js +2 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/components/breadcrumb/breadcrumb.js +2 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +2 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.js +2 -0
- package/dist/components/button/button.d.ts +2 -0
- package/dist/components/button/button.js +2 -0
- package/dist/components/button-group/button-group.d.ts +2 -0
- package/dist/components/button-group/button-group.js +2 -0
- package/dist/components/callout/callout.d.ts +2 -0
- package/dist/components/callout/callout.js +2 -0
- package/dist/components/card/card.d.ts +2 -0
- package/dist/components/card/card.js +2 -0
- package/dist/components/carousel/carousel.d.ts +2 -0
- package/dist/components/carousel/carousel.js +2 -0
- package/dist/components/carousel-item/carousel-item.d.ts +2 -0
- package/dist/components/carousel-item/carousel-item.js +2 -0
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +2 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +2 -0
- package/dist/components/checkbox-group/checkbox-group.js +2 -0
- package/dist/components/color-input/color-input.d.ts +2 -0
- package/dist/components/color-input/color-input.js +2 -0
- package/dist/components/color-picker/color-picker.d.ts +2 -0
- package/dist/components/color-picker/color-picker.js +2 -0
- package/dist/components/combobox/combobox.d.ts +2 -0
- package/dist/components/combobox/combobox.js +2 -0
- package/dist/components/combobox-item/combobox-item.d.ts +2 -0
- package/dist/components/combobox-item/combobox-item.js +2 -0
- package/dist/components/comparison/comparison.d.ts +2 -0
- package/dist/components/comparison/comparison.js +2 -0
- package/dist/components/copy/copy.d.ts +2 -0
- package/dist/components/copy/copy.js +291 -0
- package/dist/components/data-table/data-table.d.ts +2 -0
- package/dist/components/data-table/data-table.js +2 -0
- package/dist/components/date/date.d.ts +2 -0
- package/dist/components/date/date.js +2 -0
- package/dist/components/dialog/dialog.d.ts +2 -0
- package/dist/components/dialog/dialog.js +2 -0
- package/dist/components/divider/divider.d.ts +2 -0
- package/dist/components/divider/divider.js +2 -0
- package/dist/components/dropdown/dropdown.d.ts +2 -0
- package/dist/components/dropdown/dropdown.js +2 -0
- package/dist/components/dropdown-item/dropdown-item.d.ts +2 -0
- package/dist/components/dropdown-item/dropdown-item.js +2 -0
- package/dist/components/empty-result/empty-result.d.ts +2 -0
- package/dist/components/empty-result/empty-result.js +2 -0
- package/dist/components/empty-state/empty-state.d.ts +2 -0
- package/dist/components/empty-state/empty-state.js +2 -0
- package/dist/components/expander/expander.d.ts +2 -0
- package/dist/components/expander/expander.js +2 -0
- package/dist/components/field/field.d.ts +2 -0
- package/dist/components/field/field.js +2 -0
- package/dist/components/file-input/file-input.d.ts +2 -0
- package/dist/components/file-input/file-input.js +2 -0
- package/dist/components/filter-bar/filter-bar.d.ts +2 -0
- package/dist/components/filter-bar/filter-bar.js +2 -0
- package/dist/components/form-section/form-section.d.ts +2 -0
- package/dist/components/form-section/form-section.js +2 -0
- package/dist/components/icon/icon.d.ts +2 -0
- package/dist/components/icon/icon.js +2 -0
- package/dist/components/include/include.d.ts +2 -0
- package/dist/components/include/include.js +2 -0
- package/dist/components/index.d.ts +85 -0
- package/dist/components/index.js +86 -0
- package/dist/components/infinite-scroller/infinite-scroller.d.ts +2 -0
- package/dist/components/infinite-scroller/infinite-scroller.js +2 -0
- package/dist/components/intersection-observer/intersection-observer.d.ts +2 -0
- package/dist/components/intersection-observer/intersection-observer.js +2 -0
- package/dist/components/listbox/listbox.d.ts +2 -0
- package/dist/components/listbox/listbox.js +2 -0
- package/dist/components/listbox-item/listbox-item.d.ts +2 -0
- package/dist/components/listbox-item/listbox-item.js +2 -0
- package/dist/components/lorem-ipsum/lorem-ipsum.d.ts +2 -0
- package/dist/components/lorem-ipsum/lorem-ipsum.js +2 -0
- package/dist/components/meter/meter.d.ts +2 -0
- package/dist/components/meter/meter.js +2 -0
- package/dist/components/metric/metric.d.ts +2 -0
- package/dist/components/metric/metric.js +2 -0
- package/dist/components/metric-grid/metric-grid.d.ts +2 -0
- package/dist/components/metric-grid/metric-grid.js +2 -0
- package/dist/components/mutation-observer/mutation-observer.d.ts +2 -0
- package/dist/components/mutation-observer/mutation-observer.js +2 -0
- package/dist/components/navicon/navicon.d.ts +2 -0
- package/dist/components/navicon/navicon.js +2 -0
- package/dist/components/number/number.d.ts +2 -0
- package/dist/components/number/number.js +2 -0
- package/dist/components/number-field/number-field.d.ts +2 -0
- package/dist/components/number-field/number-field.js +2 -0
- package/dist/components/pagination/pagination.d.ts +2 -0
- package/dist/components/pagination/pagination.js +2 -0
- package/dist/components/popover/popover.d.ts +2 -0
- package/dist/components/popover/popover.js +2 -0
- package/dist/components/preview-card/preview-card.d.ts +2 -0
- package/dist/components/preview-card/preview-card.js +2 -0
- package/dist/components/progress/progress.d.ts +2 -0
- package/dist/components/progress/progress.js +2 -0
- package/dist/components/radio/radio.d.ts +2 -0
- package/dist/components/radio/radio.js +2 -0
- package/dist/components/radio-item/radio-item.d.ts +2 -0
- package/dist/components/radio-item/radio-item.js +2 -0
- package/dist/components/random-content/random-content.d.ts +2 -0
- package/dist/components/random-content/random-content.js +2 -0
- package/dist/components/rating/rating.d.ts +2 -0
- package/dist/components/rating/rating.js +2 -0
- package/dist/components/resize-observer/resize-observer.d.ts +2 -0
- package/dist/components/resize-observer/resize-observer.js +2 -0
- package/dist/components/scroll-area/scroll-area.d.ts +2 -0
- package/dist/components/scroll-area/scroll-area.js +2 -0
- package/dist/components/scroller/scroller.d.ts +2 -0
- package/dist/components/scroller/scroller.js +2 -0
- package/dist/components/search-list/search-list.d.ts +2 -0
- package/dist/components/search-list/search-list.js +2 -0
- package/dist/components/select/select.d.ts +2 -0
- package/dist/components/select/select.js +2 -0
- package/dist/components/selection-summary/selection-summary.d.ts +2 -0
- package/dist/components/selection-summary/selection-summary.js +2 -0
- package/dist/components/share/share.d.ts +2 -0
- package/dist/components/share/share.js +2 -0
- package/dist/components/slide-activator/slide-activator.d.ts +2 -0
- package/dist/components/slide-activator/slide-activator.js +2 -0
- package/dist/components/slider/slider.d.ts +2 -0
- package/dist/components/slider/slider.js +2 -0
- package/dist/components/sparkline/sparkline.d.ts +2 -0
- package/dist/components/sparkline/sparkline.js +2 -0
- package/dist/components/spinner/spinner.d.ts +2 -0
- package/dist/components/spinner/spinner.js +2 -0
- package/dist/components/splitter/splitter.d.ts +2 -0
- package/dist/components/splitter/splitter.js +2 -0
- package/dist/components/switch/switch.d.ts +2 -0
- package/dist/components/switch/switch.js +2 -0
- package/dist/components/tab/tab.d.ts +2 -0
- package/dist/components/tab/tab.js +2 -0
- package/dist/components/tab-list/tab-list.d.ts +2 -0
- package/dist/components/tab-list/tab-list.js +2 -0
- package/dist/components/tab-panel/tab-panel.d.ts +2 -0
- package/dist/components/tab-panel/tab-panel.js +2 -0
- package/dist/components/text-area/text-area.d.ts +2 -0
- package/dist/components/text-area/text-area.js +2 -0
- package/dist/components/text-field/text-field.d.ts +2 -0
- package/dist/components/text-field/text-field.js +2 -0
- package/dist/components/text-mask/text-mask.d.ts +2 -0
- package/dist/components/text-mask/text-mask.js +2 -0
- package/dist/components/timed-content/timed-content.d.ts +2 -0
- package/dist/components/timed-content/timed-content.js +2 -0
- package/dist/components/toast/toast.d.ts +2 -0
- package/dist/components/toast/toast.js +2 -0
- package/dist/components/toast-item/toast-item.d.ts +2 -0
- package/dist/components/toast-item/toast-item.js +2 -0
- package/dist/components/toggle-icon/toggle-icon.d.ts +2 -0
- package/dist/components/toggle-icon/toggle-icon.js +2 -0
- package/dist/components/toggle-tag/toggle-tag.d.ts +2 -0
- package/dist/components/toggle-tag/toggle-tag.js +2 -0
- package/dist/components/toolbar/toolbar.d.ts +2 -0
- package/dist/components/toolbar/toolbar.js +2 -0
- package/dist/components/tooltip/tooltip.d.ts +2 -0
- package/dist/components/tooltip/tooltip.js +2 -0
- package/dist/components/transition-group/transition-group.d.ts +2 -0
- package/dist/components/transition-group/transition-group.js +2 -0
- package/dist/components/zoomable-frame/zoomable-frame.d.ts +2 -0
- package/dist/components/zoomable-frame/zoomable-frame.js +2 -0
- package/dist/copy-CvC9vaGw.d.ts +206 -0
- package/dist/copy.styles-DWGvGNTP.js +100 -0
- package/dist/data-table-CITa8DSn.js +247 -0
- package/dist/data-table-DL5RhE0d.d.ts +89 -0
- package/dist/date-CJPmOdi9.js +146 -0
- package/dist/date-DtaTBM71.d.ts +142 -0
- package/dist/decorate-DcF3lt7P.js +9 -0
- package/dist/dialog-Cx46HMaZ.js +983 -0
- package/dist/dialog-N-v0woIy.d.ts +414 -0
- package/dist/divider-9vNsfHW8.js +169 -0
- package/dist/divider-DWuAxcXv.d.ts +79 -0
- package/dist/docs/custom-elements.json +29301 -0
- package/dist/dropdown-BXSKpVX9.js +1123 -0
- package/dist/dropdown-Bo00Vlr5.d.ts +537 -0
- package/dist/dropdown-item-_lIs-Tfd.d.ts +111 -0
- package/dist/dropdown-item-i77cRuN6.js +504 -0
- package/dist/empty-result-B2ln1yFL.js +65 -0
- package/dist/empty-result-B54x_Ab2.d.ts +31 -0
- package/dist/empty-state-BLWjtKUo.js +186 -0
- package/dist/empty-state-SGKjpwp3.d.ts +117 -0
- package/dist/expander-BUev0BmM.d.ts +174 -0
- package/dist/expander-Bwvxj6Oa.js +342 -0
- package/dist/field-BEyS909F.js +163 -0
- package/dist/field-ITx0jVw-.d.ts +69 -0
- package/dist/file-input-BEumLJjg.js +841 -0
- package/dist/file-input-D2D6YC0B.d.ts +378 -0
- package/dist/filter-bar-Bj2QzEn9.d.ts +35 -0
- package/dist/filter-bar-Dcs67aXo.js +66 -0
- package/dist/form-section-BchPetkj.js +83 -0
- package/dist/form-section-xFBTBULQ.d.ts +34 -0
- package/dist/icon-BPVkNsY4.js +165 -0
- package/dist/icon-Ci9CPZJV.d.ts +72 -0
- package/dist/icon-library-D_if7p2h.d.ts +2 -0
- package/dist/include-CQHVVtNs.d.ts +103 -0
- package/dist/include-qNUh_6kT.js +155 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +92 -0
- package/dist/infinite-scroller-BmmtnWNt.js +285 -0
- package/dist/infinite-scroller-CuUEAlB9.d.ts +174 -0
- package/dist/intersection-observer-B6TciOAQ.js +503 -0
- package/dist/intersection-observer-B7nmP7Zz.d.ts +418 -0
- package/dist/listbox-C3XXRWGX.js +1257 -0
- package/dist/listbox-DD4ujIJe.d.ts +682 -0
- package/dist/listbox-item-CwD9s3VY.js +135 -0
- package/dist/listbox-item-DQEJWp4Z.d.ts +53 -0
- package/dist/localize-322EtXNX.d.ts +66 -0
- package/dist/lorem-ipsum-B2x3V-v8.js +198 -0
- package/dist/lorem-ipsum-CR82CSuJ.d.ts +130 -0
- package/dist/meter-BC7uaJWf.d.ts +73 -0
- package/dist/meter-BIDyjwFp.js +155 -0
- package/dist/metric-CjlLq_VA.d.ts +36 -0
- package/dist/metric-DbuOcDp_.js +86 -0
- package/dist/metric-grid-C2Pb0Zl3.js +37 -0
- package/dist/metric-grid-C5Xbb1_0.d.ts +27 -0
- package/dist/mutation-observer-BmrZ-GER.d.ts +326 -0
- package/dist/mutation-observer-DS8EBuOp.js +388 -0
- package/dist/navicon-Dic5Qjzb.d.ts +159 -0
- package/dist/navicon-_yMHY27-.js +486 -0
- package/dist/number-BNtNXNF3.js +162 -0
- package/dist/number-BwbnErlB.d.ts +143 -0
- package/dist/number-field-BQHB7UYo.js +726 -0
- package/dist/number-field-odk4lKXM.d.ts +422 -0
- package/dist/pagination-6z2qcf3U.d.ts +322 -0
- package/dist/pagination-DuKPuzdb.js +679 -0
- package/dist/popover-D0sxTU6o.d.ts +259 -0
- package/dist/popover-DJBrJ0za.js +556 -0
- package/dist/preview-card-C7H1FPfd.js +287 -0
- package/dist/preview-card-DitOCZTD.d.ts +86 -0
- package/dist/progress-Db0_axHQ.d.ts +181 -0
- package/dist/progress-DzVk260j.js +494 -0
- package/dist/radio-BtDG9xJM.js +658 -0
- package/dist/radio-CieMa4zU.d.ts +460 -0
- package/dist/radio-item-DIrUStAX.js +264 -0
- package/dist/radio-item-Xq2U3cMu.d.ts +69 -0
- package/dist/random-content-BhSeJFKz.d.ts +380 -0
- package/dist/random-content-BwiirXdG.js +450 -0
- package/dist/rating-4xNsWumY.d.ts +369 -0
- package/dist/rating-C1BcJDIO.js +722 -0
- package/dist/resize-observer-BseSbVWP.d.ts +187 -0
- package/dist/resize-observer-DcrLhddo.js +236 -0
- package/dist/scroll-area-COc1857S.js +127 -0
- package/dist/scroll-area-CVYDf5qY.d.ts +61 -0
- package/dist/scroller-LYgBVyfY.js +590 -0
- package/dist/scroller-bB2rGs7b.d.ts +374 -0
- package/dist/search-list-Clmrg8EV.js +884 -0
- package/dist/search-list-n0GYO7rh.d.ts +777 -0
- package/dist/select-CkZK2jJn.d.ts +506 -0
- package/dist/select-DLIaRnA4.js +690 -0
- package/dist/selection-summary-BVnNJ8Lw.js +48 -0
- package/dist/selection-summary-DmFkGyZI.d.ts +34 -0
- package/dist/share-DPlqP2dc.d.ts +162 -0
- package/dist/share-bsgXZCl7.js +250 -0
- package/dist/sigvelo.d.ts +5 -0
- package/dist/sigvelo.js +5 -0
- package/dist/sigvelo.loader.d.ts +3 -0
- package/dist/sigvelo.loader.js +102 -0
- package/dist/slide-activator-D7bBz69E.d.ts +429 -0
- package/dist/slide-activator-DlxQt9R9.js +798 -0
- package/dist/slider-B0FVsV1o.d.ts +921 -0
- package/dist/slider-B90Il7x3.js +1744 -0
- package/dist/sparkline-CcpTaJ_Z.js +358 -0
- package/dist/sparkline-DlCIt81-.d.ts +235 -0
- package/dist/spinner-C04Dmc0H.js +188 -0
- package/dist/spinner-CZ19x_dC.d.ts +99 -0
- package/dist/splitter-DBDJAzsp.d.ts +325 -0
- package/dist/splitter-MnD4In9H.js +638 -0
- package/dist/switch-CPaEKbog.js +581 -0
- package/dist/switch-Cief9M59.d.ts +248 -0
- package/dist/tab-BcqYGsuW.d.ts +44 -0
- package/dist/tab-C-FtuNmh.js +102 -0
- package/dist/tab-list-B_Ye_Oj9.js +691 -0
- package/dist/tab-list-DDvS8qHr.d.ts +450 -0
- package/dist/tab-panel-BaBl6eep.js +60 -0
- package/dist/tab-panel-BzSJlSfd.d.ts +38 -0
- package/dist/text-area-B_mjCE9W.d.ts +327 -0
- package/dist/text-area-Czixaz-_.js +556 -0
- package/dist/text-field-BClWMp6q.d.ts +424 -0
- package/dist/text-field-inpJfp0A.js +687 -0
- package/dist/text-mask-CNKVKSFp.d.ts +336 -0
- package/dist/text-mask-DDEurj90.js +370 -0
- package/dist/themes/sigvelo.css +10 -0
- package/dist/themes/utilities.css +9 -0
- package/dist/timed-content-D2mGFamc.d.ts +181 -0
- package/dist/timed-content-pvEP4l5V.js +226 -0
- package/dist/toast-BnZaIg6Z.js +636 -0
- package/dist/toast-cEBVK9NQ.d.ts +487 -0
- package/dist/toast-item-BPpJT6vD.d.ts +159 -0
- package/dist/toast-item-IS8IFUEg.js +372 -0
- package/dist/toggle-icon-4oLDeEt4.js +752 -0
- package/dist/toggle-icon-DlwMMWZL.d.ts +359 -0
- package/dist/toggle-tag-1sfTFJtg.js +434 -0
- package/dist/toggle-tag-IVvMGT4R.d.ts +245 -0
- package/dist/toolbar-CABq0ZL1.d.ts +122 -0
- package/dist/toolbar-CEZ0-F-X.js +196 -0
- package/dist/tooltip-DbyoPFNe.js +521 -0
- package/dist/tooltip-ahFthek8.d.ts +192 -0
- package/dist/transition-group-3hnAnwSd.js +801 -0
- package/dist/transition-group-DD_CjSNC.d.ts +608 -0
- package/dist/translations/en.d.ts +6 -0
- package/dist/translations/en.js +75 -0
- package/dist/translations/es.d.ts +6 -0
- package/dist/translations/es.js +75 -0
- package/dist/types/custom-element-jsx.d.ts +13723 -0
- package/dist/utilities/icon-library.d.ts +3 -0
- package/dist/utilities/icon-library.js +93 -0
- package/dist/utilities/localize.d.ts +2 -0
- package/dist/utilities/localize.js +6 -0
- package/dist/zoomable-frame-Cldvj5sE.js +398 -0
- package/dist/zoomable-frame-r6S6587z.d.ts +162 -0
- package/package.json +83 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { Localize } from "./utilities/localize.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { property, query, state } from "lit/decorators.js";
|
|
5
|
+
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
6
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
7
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
8
|
+
import { DraggableElement } from "@mcp-b/wc-support/utilities/drag";
|
|
9
|
+
import { SigveloResizeEvent } from "@mcp-b/wc-support/events/resize";
|
|
10
|
+
//#region src/components/splitter/splitter.styles.ts
|
|
11
|
+
var splitter_styles_default = css`
|
|
12
|
+
:host {
|
|
13
|
+
--divider-min-position: 0%;
|
|
14
|
+
--divider-max-position: 100%;
|
|
15
|
+
--divider-draggable-area: 1rem;
|
|
16
|
+
--divider-width: 0.1875rem;
|
|
17
|
+
|
|
18
|
+
display: grid;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
23
|
+
var(--sigvelo-color-neutral-border-subtle);
|
|
24
|
+
border-radius: var(--sigvelo-radius-md);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#start,
|
|
28
|
+
#end {
|
|
29
|
+
overflow: auto;
|
|
30
|
+
scrollbar-color: var(--sigvelo-color-neutral-bg) transparent;
|
|
31
|
+
scrollbar-width: thin;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#divider {
|
|
35
|
+
display: flex; /* Center slotted content */
|
|
36
|
+
z-index: 1; /* Ensure divider stays above content */
|
|
37
|
+
position: relative;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
width: var(--divider-width);
|
|
41
|
+
height: var(--divider-width);
|
|
42
|
+
outline: none; /* Remove default focus outline */
|
|
43
|
+
background-color: var(--divider-color, var(--sigvelo-color-neutral-border-subtle));
|
|
44
|
+
cursor: ew-resize;
|
|
45
|
+
touch-action: none;
|
|
46
|
+
transition:
|
|
47
|
+
var(--sigvelo-motion-duration-interaction) background-color ease,
|
|
48
|
+
var(--sigvelo-motion-duration-interaction) color ease;
|
|
49
|
+
user-select: none;
|
|
50
|
+
-webkit-user-select: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#divider::before {
|
|
54
|
+
z-index: 2; /* Above divider for dragging */
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 50%;
|
|
58
|
+
width: var(--divider-draggable-area);
|
|
59
|
+
height: 100%;
|
|
60
|
+
transform: translateX(-50%);
|
|
61
|
+
content: "";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#handle {
|
|
65
|
+
z-index: 3; /* Above both divider and drag area */
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 50%;
|
|
68
|
+
left: 50%;
|
|
69
|
+
width: var(--divider-width);
|
|
70
|
+
height: 1.5rem;
|
|
71
|
+
transform: translate(-50%, -50%);
|
|
72
|
+
border-radius: var(--sigvelo-radius-xs);
|
|
73
|
+
background-color: var(--sigvelo-color-neutral-bg);
|
|
74
|
+
color: var(--sigvelo-color-neutral-text-on-bg);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
::slotted(sigvelo-icon) {
|
|
78
|
+
font-size: 1.25rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#divider:focus {
|
|
82
|
+
outline: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#divider.dragging,
|
|
86
|
+
#divider:focus-visible,
|
|
87
|
+
#divider.dragging #handle,
|
|
88
|
+
#divider:focus-visible #handle {
|
|
89
|
+
outline: none;
|
|
90
|
+
background-color: var(--sigvelo-color-primary-bg);
|
|
91
|
+
color: var(--sigvelo-color-primary-text-on-bg);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Disabled */
|
|
95
|
+
:host(:state(disabled)) #divider {
|
|
96
|
+
cursor: default;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host(:state(disabled)) #handle {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Orientation */
|
|
104
|
+
:host([orientation="horizontal"]) {
|
|
105
|
+
grid-template-areas: "start divider end";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:host([orientation="vertical"]) {
|
|
109
|
+
grid-template-areas: "start" "divider" "end";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([orientation="vertical"]) #divider {
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: var(--divider-width);
|
|
115
|
+
cursor: ns-resize;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([orientation="vertical"]) #divider::before {
|
|
119
|
+
top: 50%;
|
|
120
|
+
left: 0;
|
|
121
|
+
width: 100%;
|
|
122
|
+
height: var(--divider-draggable-area);
|
|
123
|
+
transform: translateY(-50%);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host([orientation="vertical"]) #handle {
|
|
127
|
+
top: 50%;
|
|
128
|
+
left: 50%;
|
|
129
|
+
width: 1.5rem;
|
|
130
|
+
height: var(--divider-width);
|
|
131
|
+
transform: translate(-50%, -50%);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([orientation="horizontal"]) #divider {
|
|
135
|
+
height: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#start {
|
|
139
|
+
grid-area: start;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#divider {
|
|
143
|
+
grid-area: divider;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#end {
|
|
147
|
+
grid-area: end;
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/components/splitter/splitter.ts
|
|
152
|
+
/**
|
|
153
|
+
* <sigvelo-splitter>
|
|
154
|
+
*
|
|
155
|
+
* @summary A draggable splitter that separates two panels, allowing users to resize them.
|
|
156
|
+
* @tag sigvelo-splitter
|
|
157
|
+
* @documentation https://design-system.sigvelo.com/docs/components/splitter
|
|
158
|
+
* @status stable
|
|
159
|
+
* @since 1.0
|
|
160
|
+
*
|
|
161
|
+
* @slot start - The content for the primary (start) panel.
|
|
162
|
+
* @slot end - The content for the secondary (end) panel.
|
|
163
|
+
* @slot handle - The draggable handle that separates the panels.
|
|
164
|
+
*
|
|
165
|
+
* @event sigvelo-resize - Dispatched when the splitter's handle is moved.
|
|
166
|
+
*
|
|
167
|
+
* @csspart start - The content to show in the first (start) panel.
|
|
168
|
+
* @csspart end - The content to show in the second (end) panel.
|
|
169
|
+
* @csspart divider - The draggable divider that separates the panels.
|
|
170
|
+
* @csspart handle - The visual handle within the divider (only present when not using the `handle` slot).
|
|
171
|
+
*
|
|
172
|
+
* @cssstate disabled - Applied when the splitter is disabled.
|
|
173
|
+
* @cssstate dragging - Applied when the splitter is being dragged.
|
|
174
|
+
* @cssstate focused - Applied when the splitter has focus.
|
|
175
|
+
*
|
|
176
|
+
* @cssproperty [--divider-min-position=0%] - Minimum position of the divider (as a percentage or pixel value).
|
|
177
|
+
* @cssproperty [--divider-max-position=100%] - Maximum position of the divider (as a percentage or pixel value).
|
|
178
|
+
* @cssproperty [--divider-draggable-area=1rem] - The size of the divider's draggable area (can be larger than the
|
|
179
|
+
* visible area).
|
|
180
|
+
* @cssproperty [--divider-width=0.125rem] - The width of the visual divider.
|
|
181
|
+
*
|
|
182
|
+
* @example Default
|
|
183
|
+
* Splitters follow the ARIA APG window splitter pattern for accessibility. They consist of a draggable separator positioned between two resizable panels.
|
|
184
|
+
*
|
|
185
|
+
* ```html
|
|
186
|
+
* <sigvelo-splitter id="splitter__overview">
|
|
187
|
+
* <div slot="start">Start panel</div>
|
|
188
|
+
* <div slot="end">End panel</div>
|
|
189
|
+
* </sigvelo-splitter>
|
|
190
|
+
*
|
|
191
|
+
* <style>
|
|
192
|
+
* #splitter__overview {
|
|
193
|
+
* height: 200px;
|
|
194
|
+
*
|
|
195
|
+
* <!-- Center the text for the demo -->
|
|
196
|
+
* [slot="start"],
|
|
197
|
+
* [slot="end"] {
|
|
198
|
+
* display: flex;
|
|
199
|
+
* align-items: center;
|
|
200
|
+
* justify-content: center;
|
|
201
|
+
* height: 100%;
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* </style>
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
*
|
|
208
|
+
*
|
|
209
|
+
* You can set the initial position of the divider using the `position` attribute or update it programmatically via JavaScript. The value is a number from 0 to 1 representing the divider's position as a percentage.
|
|
210
|
+
*
|
|
211
|
+
* ```html
|
|
212
|
+
* <sigvelo-splitter position=".75" id="splitter__position">
|
|
213
|
+
* <div slot="start">Start panel</div>
|
|
214
|
+
* <div slot="end">End panel</div>
|
|
215
|
+
* </sigvelo-splitter>
|
|
216
|
+
*
|
|
217
|
+
* <style>
|
|
218
|
+
* #splitter__position {
|
|
219
|
+
* height: 200px;
|
|
220
|
+
*
|
|
221
|
+
* <!-- Center the text for the demo -->
|
|
222
|
+
* [slot="start"],
|
|
223
|
+
* [slot="end"] {
|
|
224
|
+
* display: flex;
|
|
225
|
+
* align-items: center;
|
|
226
|
+
* justify-content: center;
|
|
227
|
+
* height: 100%;
|
|
228
|
+
* }
|
|
229
|
+
* }
|
|
230
|
+
* </style>
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @example Constraining the divider
|
|
234
|
+
* Set the `--divider-min-position` and `--divider-max-position` custom properties to limit the range of the divider's movement. In this example, the divider is constrained between 25% and 75% of the splitter's size.
|
|
235
|
+
*
|
|
236
|
+
* ```html
|
|
237
|
+
* <sigvelo-splitter style="--divider-min-position: 25%; --divider-max-position: 75%;" id="splitter__constraints">
|
|
238
|
+
* <div slot="start">Start panel</div>
|
|
239
|
+
* <div slot="end">End panel</div>
|
|
240
|
+
* </sigvelo-splitter>
|
|
241
|
+
*
|
|
242
|
+
* <style>
|
|
243
|
+
* #splitter__constraints {
|
|
244
|
+
* height: 200px;
|
|
245
|
+
*
|
|
246
|
+
* <!-- Center the text for the demo -->
|
|
247
|
+
* [slot="start"],
|
|
248
|
+
* [slot="end"] {
|
|
249
|
+
* display: flex;
|
|
250
|
+
* align-items: center;
|
|
251
|
+
* justify-content: center;
|
|
252
|
+
* height: 100%;
|
|
253
|
+
* }
|
|
254
|
+
* }
|
|
255
|
+
* </style>
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* @example Changing the orientation
|
|
259
|
+
* Set the `orientation` attribute to `vertical` to change the splitter's orientation.
|
|
260
|
+
*
|
|
261
|
+
* ```html
|
|
262
|
+
* <sigvelo-splitter orientation="vertical" id="splitter__orientation">
|
|
263
|
+
* <div slot="start">Start panel</div>
|
|
264
|
+
* <div slot="end">End panel</div>
|
|
265
|
+
* </sigvelo-splitter>
|
|
266
|
+
*
|
|
267
|
+
* <style>
|
|
268
|
+
* #splitter__orientation {
|
|
269
|
+
* height: 400px;
|
|
270
|
+
*
|
|
271
|
+
* <!-- Center the text for the demo -->
|
|
272
|
+
* [slot="start"],
|
|
273
|
+
* [slot="end"] {
|
|
274
|
+
* display: flex;
|
|
275
|
+
* align-items: center;
|
|
276
|
+
* justify-content: center;
|
|
277
|
+
* height: 100%;
|
|
278
|
+
* }
|
|
279
|
+
* }
|
|
280
|
+
* </style>
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* @example Snapping
|
|
284
|
+
* Set the `snap` attribute to a space-separated list of positions at which to snap. Only percentages are supported, e.g. `snap="25% 50% 75%"`. Use the `snap-threshold` attribute to change the proximity at which snapping occurs.
|
|
285
|
+
*
|
|
286
|
+
* ```html
|
|
287
|
+
* <div id="splitter__snap">
|
|
288
|
+
* <sigvelo-splitter snap="25% 50% 75%">
|
|
289
|
+
* <div slot="start">Start panel</div>
|
|
290
|
+
* <div slot="end">End panel</div>
|
|
291
|
+
* </sigvelo-splitter>
|
|
292
|
+
*
|
|
293
|
+
* <div class="snap-dots">
|
|
294
|
+
* <span class="snap-dot" style="left: 25%;"></span>
|
|
295
|
+
* <span class="snap-dot" style="left: 50%;"></span>
|
|
296
|
+
* <span class="snap-dot" style="left: 75%;"></span>
|
|
297
|
+
* </div>
|
|
298
|
+
* </div>
|
|
299
|
+
*
|
|
300
|
+
* <style>
|
|
301
|
+
* #splitter__snap {
|
|
302
|
+
* sigvelo-splitter {
|
|
303
|
+
* height: 200px;
|
|
304
|
+
* }
|
|
305
|
+
*
|
|
306
|
+
* <!-- Center the text for the demo -->
|
|
307
|
+
* [slot="start"],
|
|
308
|
+
* [slot="end"] {
|
|
309
|
+
* display: flex;
|
|
310
|
+
* align-items: center;
|
|
311
|
+
* justify-content: center;
|
|
312
|
+
* height: 100%;
|
|
313
|
+
* }
|
|
314
|
+
*
|
|
315
|
+
* .snap-dots {
|
|
316
|
+
* position: relative;
|
|
317
|
+
* width: 100%;
|
|
318
|
+
* margin-top: .5rem;
|
|
319
|
+
* }
|
|
320
|
+
*
|
|
321
|
+
* .snap-dot {
|
|
322
|
+
* position: absolute;
|
|
323
|
+
* width: 4px;
|
|
324
|
+
* height: 4px;
|
|
325
|
+
* background-color: gray;
|
|
326
|
+
* border-radius: var(--sigvelo-radius-circle);
|
|
327
|
+
* transform: translateX(-50%);
|
|
328
|
+
* }
|
|
329
|
+
* }
|
|
330
|
+
* </style>
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* @example Disabling
|
|
334
|
+
* When the `disabled` attribute is set, the divider cannot be dragged or focused and the handle is hidden, though the divider line remains visible.
|
|
335
|
+
*
|
|
336
|
+
* ```html
|
|
337
|
+
* <sigvelo-splitter disabled id="splitter__disabled">
|
|
338
|
+
* <div slot="start">Start panel</div>
|
|
339
|
+
* <div slot="end">End panel</div>
|
|
340
|
+
* </sigvelo-splitter>
|
|
341
|
+
*
|
|
342
|
+
* <style>
|
|
343
|
+
* #splitter__disabled {
|
|
344
|
+
* height: 200px;
|
|
345
|
+
*
|
|
346
|
+
* <!-- Center the text for the demo -->
|
|
347
|
+
* [slot="start"],
|
|
348
|
+
* [slot="end"] {
|
|
349
|
+
* display: flex;
|
|
350
|
+
* align-items: center;
|
|
351
|
+
* justify-content: center;
|
|
352
|
+
* height: 100%;
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* </style>
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @example Nested splitters
|
|
359
|
+
* Splitters can be nested to create advanced layouts.
|
|
360
|
+
*
|
|
361
|
+
* ```html
|
|
362
|
+
* <sigvelo-splitter id="splitter__nested">
|
|
363
|
+
* <div slot="start">
|
|
364
|
+
* Panel 1
|
|
365
|
+
* </div>
|
|
366
|
+
* <div slot="end">
|
|
367
|
+
* <sigvelo-splitter orientation="vertical">
|
|
368
|
+
* <div slot="start">
|
|
369
|
+
* Panel 2
|
|
370
|
+
* </div>
|
|
371
|
+
* <div slot="end">
|
|
372
|
+
* Panel 3
|
|
373
|
+
* </div>
|
|
374
|
+
* </sigvelo-splitter>
|
|
375
|
+
* </div>
|
|
376
|
+
* </sigvelo-splitter>
|
|
377
|
+
*
|
|
378
|
+
* <style>
|
|
379
|
+
* #splitter__nested {
|
|
380
|
+
* height: 300px;
|
|
381
|
+
*
|
|
382
|
+
* sigvelo-splitter {
|
|
383
|
+
* height: 100%;
|
|
384
|
+
* border-radius: 0;
|
|
385
|
+
* border: none;
|
|
386
|
+
*
|
|
387
|
+
* > div {
|
|
388
|
+
* height: 100%;
|
|
389
|
+
* }
|
|
390
|
+
* }
|
|
391
|
+
*
|
|
392
|
+
* <!-- Center the text for the demo -->
|
|
393
|
+
* [slot="start"],
|
|
394
|
+
* [slot="end"] {
|
|
395
|
+
* display: flex;
|
|
396
|
+
* align-items: center;
|
|
397
|
+
* justify-content: center;
|
|
398
|
+
* height: 100%;
|
|
399
|
+
* }
|
|
400
|
+
* }
|
|
401
|
+
* </style>
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @example Styling the divider
|
|
405
|
+
* You can customize the divider by slotting content such as an icon into the `handle` slot. To change the divider's width, set the `--divider-width` custom property.
|
|
406
|
+
*
|
|
407
|
+
* ```html
|
|
408
|
+
* <sigvelo-splitter style="height: 200px;" id="splitter__custom-divider">
|
|
409
|
+
* <div slot="start">Start panel</div>
|
|
410
|
+
* <sigvelo-icon slot="handle" name="grip-vertical"></sigvelo-icon>
|
|
411
|
+
* <div slot="end">End panel</div>
|
|
412
|
+
* </sigvelo-splitter>
|
|
413
|
+
*
|
|
414
|
+
* <style>
|
|
415
|
+
* #splitter__custom-divider {
|
|
416
|
+
* --divider-width: 1rem;
|
|
417
|
+
*
|
|
418
|
+
* <!-- Center the text for the demo -->
|
|
419
|
+
* [slot="start"],
|
|
420
|
+
* [slot="end"] {
|
|
421
|
+
* display: flex;
|
|
422
|
+
* align-items: center;
|
|
423
|
+
* justify-content: center;
|
|
424
|
+
* height: 100%;
|
|
425
|
+
* }
|
|
426
|
+
* }
|
|
427
|
+
* </style>
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
var SigveloSplitter = class extends SigveloElement {
|
|
431
|
+
constructor(..._args) {
|
|
432
|
+
super(..._args);
|
|
433
|
+
this.localize = new Localize(this);
|
|
434
|
+
this.previousPosition = .5;
|
|
435
|
+
this.dragStartPosition = 0;
|
|
436
|
+
this.dragStartClientX = 0;
|
|
437
|
+
this.dragStartClientY = 0;
|
|
438
|
+
this.isCollapsed = false;
|
|
439
|
+
this.isDragging = false;
|
|
440
|
+
this.position = .5;
|
|
441
|
+
this.orientation = "horizontal";
|
|
442
|
+
this.disabled = false;
|
|
443
|
+
this.snap = "";
|
|
444
|
+
this.snapThreshold = 10;
|
|
445
|
+
}
|
|
446
|
+
static {
|
|
447
|
+
this.styles = [hostStyles, splitter_styles_default];
|
|
448
|
+
}
|
|
449
|
+
firstUpdated() {
|
|
450
|
+
this.setupDragging();
|
|
451
|
+
this.updateGridTemplate();
|
|
452
|
+
this.updateAriaValue();
|
|
453
|
+
}
|
|
454
|
+
updated(changedProperties) {
|
|
455
|
+
if (changedProperties.has("orientation") || changedProperties.has("snap")) {
|
|
456
|
+
this.updateGridTemplate();
|
|
457
|
+
this.setupDragging();
|
|
458
|
+
}
|
|
459
|
+
if (changedProperties.has("position")) {
|
|
460
|
+
this.updateGridTemplate();
|
|
461
|
+
this.updateAriaValue();
|
|
462
|
+
}
|
|
463
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.disabled);
|
|
464
|
+
if (changedProperties.has("isDragging")) this.customStates.set("dragging", this.isDragging);
|
|
465
|
+
}
|
|
466
|
+
disconnectedCallback() {
|
|
467
|
+
this.dragHandler?.stop();
|
|
468
|
+
super.disconnectedCallback();
|
|
469
|
+
}
|
|
470
|
+
handleFocus() {
|
|
471
|
+
this.customStates.set("focused", true);
|
|
472
|
+
}
|
|
473
|
+
handleBlur() {
|
|
474
|
+
this.customStates.set("focused", false);
|
|
475
|
+
}
|
|
476
|
+
getSnapPoints() {
|
|
477
|
+
if (!this.snap) return [];
|
|
478
|
+
return this.snap.split(" ").map((point) => parseFloat(point.replace("%", ""))).filter((point) => !isNaN(point) && point >= 0 && point <= 100);
|
|
479
|
+
}
|
|
480
|
+
snapToNearest(position) {
|
|
481
|
+
const snapPoints = this.getSnapPoints();
|
|
482
|
+
if (snapPoints.length === 0) return position;
|
|
483
|
+
const rect = this.getBoundingClientRect();
|
|
484
|
+
const totalSize = this.orientation === "horizontal" ? rect.width : rect.height;
|
|
485
|
+
const positionInPixels = position * 100 / 100 * totalSize;
|
|
486
|
+
for (const snapPoint of snapPoints) {
|
|
487
|
+
const snapPointInPixels = snapPoint / 100 * totalSize;
|
|
488
|
+
if (Math.abs(positionInPixels - snapPointInPixels) <= this.snapThreshold) return snapPoint / 100;
|
|
489
|
+
}
|
|
490
|
+
return position;
|
|
491
|
+
}
|
|
492
|
+
getDividerConstraint(value, totalSize, isMin) {
|
|
493
|
+
if (!value) return isMin ? 0 : 1;
|
|
494
|
+
if (value.endsWith("%")) return parseFloat(value.replace("%", "")) / 100;
|
|
495
|
+
else if (value.endsWith("px")) return parseFloat(value.replace("px", "")) / totalSize;
|
|
496
|
+
return isMin ? 0 : 1;
|
|
497
|
+
}
|
|
498
|
+
clampPosition(position) {
|
|
499
|
+
const rect = this.getBoundingClientRect();
|
|
500
|
+
const totalSize = this.orientation === "horizontal" ? rect.width : rect.height;
|
|
501
|
+
const minPosition = this.getDividerConstraint(getComputedStyle(this).getPropertyValue("--divider-min-position"), totalSize, true);
|
|
502
|
+
const maxPosition = this.getDividerConstraint(getComputedStyle(this).getPropertyValue("--divider-max-position"), totalSize, false);
|
|
503
|
+
return Math.max(minPosition, Math.min(maxPosition, position));
|
|
504
|
+
}
|
|
505
|
+
setupDragging() {
|
|
506
|
+
this.dragHandler?.stop();
|
|
507
|
+
if (this.disabled) return;
|
|
508
|
+
this.dragHandler = new DraggableElement(this.divider, {
|
|
509
|
+
start: (clientX, clientY) => {
|
|
510
|
+
this.isDragging = true;
|
|
511
|
+
this.dragStartPosition = this.position;
|
|
512
|
+
this.dragStartClientX = clientX;
|
|
513
|
+
this.dragStartClientY = clientY;
|
|
514
|
+
this.customStates.set("dragging", true);
|
|
515
|
+
},
|
|
516
|
+
move: (clientX, clientY) => {
|
|
517
|
+
const isRtl = this.localize.dir() === "rtl";
|
|
518
|
+
const rect = this.getBoundingClientRect();
|
|
519
|
+
let deltaPercentage;
|
|
520
|
+
if (this.orientation === "horizontal") deltaPercentage = (clientX - this.dragStartClientX) / rect.width * (isRtl ? -1 : 1);
|
|
521
|
+
else deltaPercentage = (clientY - this.dragStartClientY) / rect.height;
|
|
522
|
+
const newPositionRaw = this.dragStartPosition + deltaPercentage;
|
|
523
|
+
const newPosition = this.snapToNearest(this.clampPosition(newPositionRaw));
|
|
524
|
+
if (this.position !== newPosition) {
|
|
525
|
+
this.position = newPosition;
|
|
526
|
+
this.updateGridTemplate();
|
|
527
|
+
this.updateAriaValue();
|
|
528
|
+
this.dispatchEvent(new SigveloResizeEvent());
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
stop: () => {
|
|
532
|
+
this.isDragging = false;
|
|
533
|
+
this.customStates.set("dragging", false);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
updateGridTemplate() {
|
|
538
|
+
const positionPercent = this.position * 100;
|
|
539
|
+
if (this.orientation === "horizontal") {
|
|
540
|
+
this.style.gridTemplateColumns = `minmax(0, ${positionPercent}%) var(--divider-width, 0.125rem) minmax(0, ${100 - positionPercent}%)`;
|
|
541
|
+
this.style.gridTemplateRows = "1fr";
|
|
542
|
+
} else {
|
|
543
|
+
this.style.gridTemplateRows = `minmax(0, ${positionPercent}%) var(--divider-width, 0.125rem) minmax(0, ${100 - positionPercent}%)`;
|
|
544
|
+
this.style.gridTemplateColumns = "1fr";
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
updateAriaValue() {
|
|
548
|
+
this.divider.setAttribute("aria-valuenow", (this.position * 100).toString());
|
|
549
|
+
}
|
|
550
|
+
handleKeydown(event) {
|
|
551
|
+
if (this.disabled) return;
|
|
552
|
+
const isRtl = this.localize.dir() === "rtl";
|
|
553
|
+
const step = .05;
|
|
554
|
+
let newPosition = this.position;
|
|
555
|
+
switch (event.key) {
|
|
556
|
+
case "ArrowLeft":
|
|
557
|
+
case "ArrowUp":
|
|
558
|
+
newPosition = isRtl ? this.position + step : this.position - step;
|
|
559
|
+
break;
|
|
560
|
+
case "ArrowRight":
|
|
561
|
+
case "ArrowDown":
|
|
562
|
+
newPosition = isRtl ? this.position - step : this.position + step;
|
|
563
|
+
break;
|
|
564
|
+
case "Home":
|
|
565
|
+
newPosition = isRtl ? 1 : 0;
|
|
566
|
+
break;
|
|
567
|
+
case "End":
|
|
568
|
+
newPosition = isRtl ? 0 : 1;
|
|
569
|
+
break;
|
|
570
|
+
case "Enter":
|
|
571
|
+
if (!this.isCollapsed) {
|
|
572
|
+
this.previousPosition = this.position;
|
|
573
|
+
newPosition = 0;
|
|
574
|
+
this.isCollapsed = true;
|
|
575
|
+
} else {
|
|
576
|
+
newPosition = this.previousPosition;
|
|
577
|
+
this.isCollapsed = false;
|
|
578
|
+
}
|
|
579
|
+
break;
|
|
580
|
+
default: return;
|
|
581
|
+
}
|
|
582
|
+
newPosition = this.clampPosition(newPosition);
|
|
583
|
+
if (newPosition !== this.position) {
|
|
584
|
+
event.preventDefault();
|
|
585
|
+
this.position = newPosition;
|
|
586
|
+
this.updateGridTemplate();
|
|
587
|
+
this.updateAriaValue();
|
|
588
|
+
this.dispatchEvent(new SigveloResizeEvent());
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
render() {
|
|
592
|
+
return html`
|
|
593
|
+
<div id="start" part="start">
|
|
594
|
+
<slot name="start"></slot>
|
|
595
|
+
</div>
|
|
596
|
+
|
|
597
|
+
<div
|
|
598
|
+
id="divider"
|
|
599
|
+
part="divider"
|
|
600
|
+
class=${classMap({ dragging: this.isDragging })}
|
|
601
|
+
role="separator"
|
|
602
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
603
|
+
aria-label=${this.localize.term("resize")}
|
|
604
|
+
aria-valuemin="0"
|
|
605
|
+
aria-valuemax="100"
|
|
606
|
+
aria-valuenow="50"
|
|
607
|
+
@keydown=${this.handleKeydown}
|
|
608
|
+
@focus=${this.handleFocus}
|
|
609
|
+
@blur=${this.handleBlur}
|
|
610
|
+
>
|
|
611
|
+
<slot name="handle">
|
|
612
|
+
<div id="handle" part="handle"></div>
|
|
613
|
+
</slot>
|
|
614
|
+
</div>
|
|
615
|
+
|
|
616
|
+
<div id="end" part="end">
|
|
617
|
+
<slot name="end"></slot>
|
|
618
|
+
</div>
|
|
619
|
+
`;
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
__decorate([query("#divider")], SigveloSplitter.prototype, "divider", void 0);
|
|
623
|
+
__decorate([state()], SigveloSplitter.prototype, "isCollapsed", void 0);
|
|
624
|
+
__decorate([state()], SigveloSplitter.prototype, "isDragging", void 0);
|
|
625
|
+
__decorate([property({ type: Number })], SigveloSplitter.prototype, "position", void 0);
|
|
626
|
+
__decorate([property({ reflect: true })], SigveloSplitter.prototype, "orientation", void 0);
|
|
627
|
+
__decorate([property({
|
|
628
|
+
type: Boolean,
|
|
629
|
+
reflect: true
|
|
630
|
+
})], SigveloSplitter.prototype, "disabled", void 0);
|
|
631
|
+
__decorate([property({ reflect: true })], SigveloSplitter.prototype, "snap", void 0);
|
|
632
|
+
__decorate([property({
|
|
633
|
+
attribute: "snap-threshold",
|
|
634
|
+
type: Number
|
|
635
|
+
})], SigveloSplitter.prototype, "snapThreshold", void 0);
|
|
636
|
+
customElements.define("sigvelo-splitter", SigveloSplitter);
|
|
637
|
+
//#endregion
|
|
638
|
+
export { SigveloSplitter as t };
|