optikos 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -1
- package/dist/bind.js +1 -1
- package/dist/bind.js.map +4 -4
- package/dist/build.js +2 -0
- package/dist/build.js.map +7 -0
- package/dist/chunk-2CVMT3IW.js +3 -0
- package/dist/chunk-2CVMT3IW.js.map +7 -0
- package/dist/{chunk-5JEXM5S7.js → chunk-2GKIF7A6.js} +2 -2
- package/dist/{chunk-5BC72727.js → chunk-2I4Y7I7C.js} +2 -2
- package/dist/{chunk-Z2Z52GFT.js → chunk-2I7HDIOU.js} +2 -2
- package/dist/chunk-2QMI2RRB.js +2 -0
- package/dist/chunk-2QMI2RRB.js.map +7 -0
- package/dist/chunk-34KVSA2V.js +3 -0
- package/dist/chunk-34KVSA2V.js.map +7 -0
- package/dist/chunk-37PYJAA2.js +2 -0
- package/dist/{chunk-UXXJOU5J.js.map → chunk-37PYJAA2.js.map} +1 -1
- package/dist/{chunk-ZPPELYNJ.js → chunk-3BG75P7T.js} +2 -2
- package/dist/{chunk-GNU4VOOE.js → chunk-3F4MN2BU.js} +2 -2
- package/dist/{chunk-5DJTP53N.js → chunk-3FK52VQX.js} +2 -2
- package/dist/chunk-3OA3P37P.js +2 -0
- package/dist/chunk-3OA3P37P.js.map +7 -0
- package/dist/chunk-3TCITFUU.js +2 -0
- package/dist/chunk-3TCITFUU.js.map +7 -0
- package/dist/chunk-3VDLX7ET.js +2 -0
- package/dist/chunk-3VDLX7ET.js.map +7 -0
- package/dist/{chunk-REW4LR46.js → chunk-4OB2IM5L.js} +2 -2
- package/dist/chunk-5G5PHOZJ.js +2 -0
- package/dist/chunk-5G5PHOZJ.js.map +7 -0
- package/dist/{chunk-EDUMAMK4.js → chunk-5GCTM37D.js} +2 -2
- package/dist/chunk-5PYJ6FJK.js +2 -0
- package/dist/chunk-5PYJ6FJK.js.map +7 -0
- package/dist/chunk-632LUU52.js +2 -0
- package/dist/chunk-632LUU52.js.map +7 -0
- package/dist/{chunk-JOFQJGZK.js → chunk-6BOM5KZR.js} +2 -2
- package/dist/{chunk-Z2JBUHKA.js → chunk-6NP4AEV4.js} +2 -2
- package/dist/chunk-6PPRYSLN.js +2 -0
- package/dist/chunk-6PPRYSLN.js.map +7 -0
- package/dist/{chunk-NXSTUFS7.js → chunk-6TZJO2G2.js} +2 -2
- package/dist/chunk-7Y2GHQRB.js +2 -0
- package/dist/chunk-A36JFIA3.js +2 -0
- package/dist/chunk-A36JFIA3.js.map +7 -0
- package/dist/{chunk-G2KUK6AT.js → chunk-ADHKL2GM.js} +2 -2
- package/dist/{chunk-JI265XFO.js → chunk-AJN66F32.js} +2 -2
- package/dist/{chunk-YHEMA56R.js → chunk-AQ3RTHG5.js} +2 -2
- package/dist/{chunk-ZVK4L5GK.js → chunk-BCVOUMJJ.js} +2 -2
- package/dist/{chunk-HOF4JGMQ.js → chunk-BIGL3ZVD.js} +2 -2
- package/dist/{chunk-ZWNQREWS.js → chunk-BQEFLPDA.js} +2 -2
- package/dist/{chunk-ZWNQREWS.js.map → chunk-BQEFLPDA.js.map} +2 -2
- package/dist/{chunk-HXDTGP2K.js → chunk-BRGT4O6Q.js} +2 -2
- package/dist/{chunk-OGRFQTXA.js → chunk-BTGJ3MP4.js} +2 -2
- package/dist/{chunk-TOLTUOZS.js → chunk-CWIE74NX.js} +2 -2
- package/dist/{chunk-M242VYZA.js → chunk-CXZKCBQE.js} +2 -2
- package/dist/{chunk-4EZJ5FKJ.js → chunk-DIOJGTUN.js} +2 -2
- package/dist/chunk-DJUSVBD5.js +2 -0
- package/dist/chunk-DJUSVBD5.js.map +7 -0
- package/dist/chunk-DLRGB5NY.js +2 -0
- package/dist/chunk-DLRGB5NY.js.map +7 -0
- package/dist/chunk-DY3ZYMXD.js +2 -0
- package/dist/chunk-DY3ZYMXD.js.map +7 -0
- package/dist/chunk-EO777UIN.js +2 -0
- package/dist/chunk-EO777UIN.js.map +7 -0
- package/dist/chunk-ESCLDVFS.js +2 -0
- package/dist/{chunk-YBAYEU25.js.map → chunk-ESCLDVFS.js.map} +1 -1
- package/dist/{chunk-2ZUZ5HDL.js → chunk-ESRS5ZQV.js} +2 -2
- package/dist/{chunk-RNN55473.js → chunk-FNZI6MFG.js} +2 -2
- package/dist/{chunk-RNN55473.js.map → chunk-FNZI6MFG.js.map} +1 -1
- package/dist/{chunk-JK74QK3M.js → chunk-FSR6BDVO.js} +2 -2
- package/dist/{chunk-6VBK2I5B.js → chunk-G26R2F3W.js} +2 -2
- package/dist/{chunk-G2DAD3MQ.js → chunk-GEJKFE4X.js} +2 -2
- package/dist/chunk-GFJRGBQR.js +2 -0
- package/dist/chunk-GFJRGBQR.js.map +7 -0
- package/dist/chunk-GLAY4RJF.js +2 -0
- package/dist/chunk-GLAY4RJF.js.map +7 -0
- package/dist/chunk-GNKVLJ5H.js +2 -0
- package/dist/chunk-GNKVLJ5H.js.map +7 -0
- package/dist/chunk-GZIDE5K2.js +2 -0
- package/dist/chunk-GZIDE5K2.js.map +7 -0
- package/dist/{chunk-5Q76ACVI.js → chunk-H25XXQVH.js} +2 -2
- package/dist/chunk-HG7OOHGD.js +2 -0
- package/dist/chunk-HG7OOHGD.js.map +7 -0
- package/dist/chunk-HRW25TMU.js +2 -0
- package/dist/chunk-HX6TWXTX.js +2 -0
- package/dist/chunk-HX6TWXTX.js.map +7 -0
- package/dist/chunk-I5A74NMJ.js +2 -0
- package/dist/chunk-I5A74NMJ.js.map +7 -0
- package/dist/chunk-IODSL7KU.js +2 -0
- package/dist/chunk-IODSL7KU.js.map +7 -0
- package/dist/chunk-J2TCHWYD.js +2 -0
- package/dist/chunk-J2TCHWYD.js.map +7 -0
- package/dist/chunk-J5BZAKC6.js +2 -0
- package/dist/chunk-J5BZAKC6.js.map +7 -0
- package/dist/chunk-JBOKM5YA.js +2 -0
- package/dist/{chunk-KLLAY2IM.js.map → chunk-JBOKM5YA.js.map} +2 -2
- package/dist/chunk-L5SQQFO7.js +2 -0
- package/dist/chunk-L5SQQFO7.js.map +7 -0
- package/dist/chunk-L6DOWGBO.js +2 -0
- package/dist/chunk-L6DOWGBO.js.map +7 -0
- package/dist/{chunk-W3H7GTJY.js → chunk-LHWY6G6Q.js} +2 -2
- package/dist/chunk-LLHDEUIA.js +2 -0
- package/dist/chunk-LLHDEUIA.js.map +7 -0
- package/dist/chunk-LXWCTCZV.js +2 -0
- package/dist/chunk-LXWCTCZV.js.map +7 -0
- package/dist/chunk-M2ZRKHE4.js +2 -0
- package/dist/chunk-M2ZRKHE4.js.map +7 -0
- package/dist/{chunk-Q26YZYTD.js → chunk-M7HLHGQV.js} +2 -2
- package/dist/{chunk-IHE2MQ3W.js → chunk-MGSCSS7X.js} +2 -2
- package/dist/chunk-MM2OC66E.js +4 -0
- package/dist/{chunk-XX2MVWFS.js.map → chunk-MM2OC66E.js.map} +1 -1
- package/dist/{chunk-DBMWS3O5.js → chunk-MQ5BYGFY.js} +2 -2
- package/dist/chunk-MQEALOU3.js +3 -0
- package/dist/chunk-MQEALOU3.js.map +7 -0
- package/dist/chunk-NAUSRVB6.js +2 -0
- package/dist/chunk-NAUSRVB6.js.map +7 -0
- package/dist/chunk-NEVDHDJ4.js +3 -0
- package/dist/chunk-NEVDHDJ4.js.map +7 -0
- package/dist/{chunk-5QUY72FX.js → chunk-NWHH3CYH.js} +2 -2
- package/dist/chunk-OADWLPSF.js +2 -0
- package/dist/chunk-OADWLPSF.js.map +7 -0
- package/dist/{chunk-3TAW4AKH.js → chunk-OB3VIRQR.js} +2 -2
- package/dist/{chunk-MB3MU6HR.js → chunk-PGVLRMTQ.js} +2 -2
- package/dist/chunk-Q6FY4L2F.js +2 -0
- package/dist/chunk-Q6FY4L2F.js.map +7 -0
- package/dist/{chunk-TZOQWCVH.js → chunk-QOSTS5I3.js} +2 -2
- package/dist/chunk-QVBDBGS4.js +2 -0
- package/dist/chunk-QVBDBGS4.js.map +7 -0
- package/dist/{chunk-3S24ZRPK.js → chunk-RMATRKXV.js} +2 -2
- package/dist/{chunk-I4SP6JTU.js → chunk-S3ILIWSW.js} +2 -2
- package/dist/chunk-S4QD5NID.js +2 -0
- package/dist/chunk-S4QD5NID.js.map +7 -0
- package/dist/{chunk-XHOBNSBO.js → chunk-SEUIIPHS.js} +2 -2
- package/dist/{chunk-23XLG2EM.js → chunk-SEW5OCQF.js} +2 -2
- package/dist/chunk-T5OGUCY2.js +2 -0
- package/dist/chunk-T5OGUCY2.js.map +7 -0
- package/dist/chunk-TMBGEZSD.js +2 -0
- package/dist/chunk-TMBGEZSD.js.map +7 -0
- package/dist/chunk-TVO3Z2BM.js +2 -0
- package/dist/chunk-TVO3Z2BM.js.map +7 -0
- package/dist/{chunk-LQRFNQ2N.js → chunk-U25QSLAH.js} +2 -2
- package/dist/chunk-UCWICDYG.js +2 -0
- package/dist/chunk-UCWICDYG.js.map +7 -0
- package/dist/chunk-UDXO3KM3.js +2 -0
- package/dist/chunk-UDXO3KM3.js.map +7 -0
- package/dist/{chunk-FEHGU6EP.js → chunk-UL364TLO.js} +2 -2
- package/dist/chunk-UUAGMZD2.js +2 -0
- package/dist/chunk-UUAGMZD2.js.map +7 -0
- package/dist/chunk-V5G5JECN.js +2 -0
- package/dist/chunk-V5G5JECN.js.map +7 -0
- package/dist/chunk-XFDNXSU5.js +2 -0
- package/dist/chunk-XFDNXSU5.js.map +7 -0
- package/dist/{chunk-JBLRAM7Z.js → chunk-XNRZJP4E.js} +2 -2
- package/dist/chunk-YJTUFK4P.js +2 -0
- package/dist/chunk-YLFSCQL3.js +2 -0
- package/dist/chunk-YLFSCQL3.js.map +7 -0
- package/dist/chunk-Z6HZY2YG.js +2 -0
- package/dist/chunk-Z6HZY2YG.js.map +7 -0
- package/dist/chunk-ZEIE2OCQ.js +2 -0
- package/dist/chunk-ZEIE2OCQ.js.map +7 -0
- package/dist/{chunk-2YZB6XQR.js → chunk-ZLYZFHEN.js} +2 -2
- package/dist/components/avatar.js +2 -0
- package/dist/components/avatar.js.map +7 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/carousel.js +2 -0
- package/dist/components/carousel.js.map +7 -0
- package/dist/components/cellediting.js +1 -1
- package/dist/components/chart.js +2 -0
- package/dist/components/chart.js.map +7 -0
- package/dist/components/chat.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkboxgroup.js +1 -1
- package/dist/components/chip.js +1 -1
- package/dist/components/codeviewer.js +1 -1
- package/dist/components/columntotals.js +2 -0
- package/dist/components/columntotals.js.map +7 -0
- package/dist/components/combobox.js +1 -1
- package/dist/components/commandpalette.js +1 -1
- package/dist/components/container.js +1 -1
- package/dist/components/dataview.js +1 -1
- package/dist/components/datefield.js +1 -1
- package/dist/components/daterangefield.js +1 -1
- package/dist/components/datetimefield.js +2 -0
- package/dist/components/datetimefield.js.map +7 -0
- package/dist/components/dial.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/exportbar.js +2 -0
- package/dist/components/exportbar.js.map +7 -0
- package/dist/components/fieldgroup.js +1 -1
- package/dist/components/fieldlist.js +1 -1
- package/dist/components/fieldset.js +1 -1
- package/dist/components/filterbuilder.js +1 -1
- package/dist/components/form.js +1 -1
- package/dist/components/formactions.js +1 -1
- package/dist/components/formerrors.js +1 -1
- package/dist/components/formsection.js +1 -1
- package/dist/components/grid.js +1 -1
- package/dist/components/gridexport.js +2 -0
- package/dist/components/gridexport.js.map +7 -0
- package/dist/components/gridstate.js +2 -0
- package/dist/components/gridstate.js.map +7 -0
- package/dist/components/grouping.js +2 -0
- package/dist/components/grouping.js.map +7 -0
- package/dist/components/icon.js +1 -1
- package/dist/components/image.js +2 -0
- package/dist/components/image.js.map +7 -0
- package/dist/components/imagecanvas.js +2 -0
- package/dist/components/imagecanvas.js.map +7 -0
- package/dist/components/imagefield.js +2 -0
- package/dist/components/imagefield.js.map +7 -0
- package/dist/components/inputgroup.js +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/listbox.js +1 -1
- package/dist/components/lookupfield.js +1 -1
- package/dist/components/maskfield.js +2 -0
- package/dist/components/maskfield.js.map +7 -0
- package/dist/components/menu.js +1 -1
- package/dist/components/messagebox.js +1 -1
- package/dist/components/navmenu.js +1 -1
- package/dist/components/numberfield.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/panel.js +1 -1
- package/dist/components/pickerfield.js +1 -1
- package/dist/components/radiogroup.js +1 -1
- package/dist/components/rowediting.js +2 -0
- package/dist/components/rowediting.js.map +7 -0
- package/dist/components/searchgrid.js +1 -1
- package/dist/components/secretfield.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/shortcuts.js +2 -0
- package/dist/components/shortcuts.js.map +7 -0
- package/dist/components/slider.js +1 -1
- package/dist/components/spacer.js +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/stat.js +2 -0
- package/dist/components/stat.js.map +7 -0
- package/dist/components/stepform.js +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/suggestfield.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/textfield.js +1 -1
- package/dist/components/timeentry.js +2 -0
- package/dist/components/timeentry.js.map +7 -0
- package/dist/components/timefield.js +2 -0
- package/dist/components/timefield.js.map +7 -0
- package/dist/components/timeline.js +2 -0
- package/dist/components/timeline.js.map +7 -0
- package/dist/components/toast.js +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/components/toolbar.js +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/treegrid.js +2 -0
- package/dist/components/treegrid.js.map +7 -0
- package/dist/components/viewmanager.js +1 -1
- package/dist/components/viewport.js +1 -1
- package/dist/components/widget.js +1 -1
- package/dist/components/window.js +1 -1
- package/dist/core.js +1 -1
- package/dist/css/avatar.css +68 -0
- package/dist/css/base.css +9 -0
- package/dist/css/carousel.css +119 -0
- package/dist/css/chart.css +168 -0
- package/dist/css/columntotals.css +56 -0
- package/dist/css/core.css +36 -0
- package/dist/css/datetimefield.css +15 -0
- package/dist/css/exportbar.css +9 -0
- package/dist/css/grid.css +52 -0
- package/dist/css/gridexport.css +35 -0
- package/dist/css/grouping.css +56 -0
- package/dist/css/image.css +46 -0
- package/dist/css/imagecanvas.css +75 -0
- package/dist/css/imagefield.css +103 -0
- package/dist/css/rowediting.css +39 -0
- package/dist/css/shortcuts.css +34 -0
- package/dist/css/stat.css +64 -0
- package/dist/css/stepform.css +1 -0
- package/dist/css/timeentry.css +116 -0
- package/dist/css/timeline.css +185 -0
- package/dist/css/treegrid.css +35 -0
- package/dist/css/window.css +2 -2
- package/dist/data.js +1 -1
- package/dist/dev.js +2 -0
- package/dist/dev.js.map +7 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +4 -4
- package/dist/optikos.css +1480 -142
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +7 -0
- package/dist/themes/dark.css +7 -0
- package/dist/types/bind/index.d.ts +1 -1
- package/dist/types/bind/viewmodel.d.ts +33 -0
- package/dist/types/build/build.d.ts +49 -0
- package/dist/types/build/index.d.ts +1 -0
- package/dist/types/components/avatar.d.ts +1 -0
- package/dist/types/components/base/avatar/avatar.d.ts +22 -0
- package/dist/types/components/base/image/image.d.ts +25 -0
- package/dist/types/components/base/imagecanvas/imagecanvas.d.ts +39 -0
- package/dist/types/components/carousel.d.ts +1 -0
- package/dist/types/components/chart.d.ts +1 -0
- package/dist/types/components/charts/chart/chart.d.ts +64 -0
- package/dist/types/components/charts/stat/stat.d.ts +34 -0
- package/dist/types/components/columntotals.d.ts +1 -0
- package/dist/types/components/data/cellediting/cellediting.d.ts +3 -0
- package/dist/types/components/data/columntotals/columntotals.d.ts +24 -0
- package/dist/types/components/data/exportbar/exportbar.d.ts +24 -0
- package/dist/types/components/data/grid/footer.d.ts +6 -0
- package/dist/types/components/data/grid/grid.d.ts +37 -0
- package/dist/types/components/data/gridexport/gridexport.d.ts +29 -0
- package/dist/types/components/data/gridstate/gridstate.d.ts +23 -0
- package/dist/types/components/data/grouping/controls.d.ts +27 -0
- package/dist/types/components/data/grouping/grouping.d.ts +43 -0
- package/dist/types/components/data/rowediting/rowediting.d.ts +13 -0
- package/dist/types/components/data/searchgrid/searchgrid.d.ts +9 -2
- package/dist/types/components/data/timeentry/timeentry.d.ts +37 -0
- package/dist/types/components/data/timeline/timeline.d.ts +63 -0
- package/dist/types/components/data/treegrid/treegrid.d.ts +32 -0
- package/dist/types/components/datetimefield.d.ts +1 -0
- package/dist/types/components/exportbar.d.ts +1 -0
- package/dist/types/components/fields/datetimefield/datetimefield.d.ts +28 -0
- package/dist/types/components/fields/imagefield/imagefield.d.ts +48 -0
- package/dist/types/components/fields/maskfield/maskfield.d.ts +28 -0
- package/dist/types/components/fields/numberfield/numberfield.d.ts +9 -0
- package/dist/types/components/fields/pickerfield/pickerfield.d.ts +3 -0
- package/dist/types/components/fields/timefield/timefield.d.ts +24 -0
- package/dist/types/components/form/fieldlist/fieldlist.d.ts +2 -0
- package/dist/types/components/form/form/form.d.ts +5 -0
- package/dist/types/components/form/stepform/stepform.d.ts +1 -1
- package/dist/types/components/gridexport.d.ts +1 -0
- package/dist/types/components/gridstate.d.ts +1 -0
- package/dist/types/components/grouping.d.ts +1 -0
- package/dist/types/components/image.d.ts +1 -0
- package/dist/types/components/imagecanvas.d.ts +1 -0
- package/dist/types/components/imagefield.d.ts +1 -0
- package/dist/types/components/layout/carousel/carousel.d.ts +58 -0
- package/dist/types/components/maskfield.d.ts +1 -0
- package/dist/types/components/navigation/navmenu/navmenu.d.ts +2 -0
- package/dist/types/components/overlays/commandpalette/commandpalette.d.ts +2 -0
- package/dist/types/components/overlays/menu/menu.d.ts +4 -1
- package/dist/types/components/overlays/shortcuts/shortcuts.d.ts +27 -0
- package/dist/types/components/overlays/window/window.d.ts +14 -1
- package/dist/types/components/rowediting.d.ts +1 -0
- package/dist/types/components/shortcuts.d.ts +1 -0
- package/dist/types/components/stat.d.ts +1 -0
- package/dist/types/components/timeentry.d.ts +1 -0
- package/dist/types/components/timefield.d.ts +1 -0
- package/dist/types/components/timeline.d.ts +1 -0
- package/dist/types/components/treegrid.d.ts +1 -0
- package/dist/types/core/component.d.ts +7 -0
- package/dist/types/core/container.d.ts +10 -1
- package/dist/types/core/dev.d.ts +2 -0
- package/dist/types/core/field.d.ts +4 -0
- package/dist/types/core/i18n.d.ts +2 -0
- package/dist/types/core/index.d.ts +4 -1
- package/dist/types/core/path.d.ts +2 -0
- package/dist/types/core/permission.d.ts +11 -0
- package/dist/types/core/state.d.ts +9 -0
- package/dist/types/data/column.d.ts +11 -1
- package/dist/types/data/index.d.ts +1 -1
- package/dist/types/data/model.d.ts +2 -0
- package/dist/types/data/store.d.ts +21 -0
- package/dist/types/dev/index.d.ts +2 -0
- package/dist/types/dev/keys.d.ts +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/testing/index.d.ts +25 -0
- package/dist/types/themes/color.d.ts +14 -0
- package/dist/types/themes/contrast.d.ts +15 -0
- package/dist/types/themes/define.d.ts +25 -3
- package/dist/types/themes/index.d.ts +3 -1
- package/dist/types/themes/seeds.d.ts +11 -0
- package/dist/types/ui/ui.d.ts +6 -0
- package/dist/ui.js +1 -1
- package/package.json +13 -1
- package/dist/chunk-2ZRNGG2N.js +0 -2
- package/dist/chunk-2ZRNGG2N.js.map +0 -7
- package/dist/chunk-4EQEHJB3.js +0 -2
- package/dist/chunk-4EQEHJB3.js.map +0 -7
- package/dist/chunk-4LZZ244E.js +0 -2
- package/dist/chunk-4LZZ244E.js.map +0 -7
- package/dist/chunk-4SYIIX5A.js +0 -2
- package/dist/chunk-4SYIIX5A.js.map +0 -7
- package/dist/chunk-7KMIFXHZ.js +0 -2
- package/dist/chunk-7KMIFXHZ.js.map +0 -7
- package/dist/chunk-A2NKDOYN.js +0 -2
- package/dist/chunk-A2NKDOYN.js.map +0 -7
- package/dist/chunk-CKXS375P.js +0 -2
- package/dist/chunk-CKXS375P.js.map +0 -7
- package/dist/chunk-EJGWCKE4.js +0 -2
- package/dist/chunk-EJGWCKE4.js.map +0 -7
- package/dist/chunk-ELYARUCN.js +0 -2
- package/dist/chunk-EV73ADN2.js +0 -2
- package/dist/chunk-EV73ADN2.js.map +0 -7
- package/dist/chunk-GD5JGKM7.js +0 -2
- package/dist/chunk-GD5JGKM7.js.map +0 -7
- package/dist/chunk-GZ7X34QP.js +0 -2
- package/dist/chunk-KCEUD232.js +0 -2
- package/dist/chunk-KCEUD232.js.map +0 -7
- package/dist/chunk-KLLAY2IM.js +0 -2
- package/dist/chunk-LBJSMXLV.js +0 -2
- package/dist/chunk-LBJSMXLV.js.map +0 -7
- package/dist/chunk-LW2WRUVL.js +0 -2
- package/dist/chunk-LW2WRUVL.js.map +0 -7
- package/dist/chunk-MW3RWBZ7.js +0 -2
- package/dist/chunk-MW3RWBZ7.js.map +0 -7
- package/dist/chunk-OEAXCCVM.js +0 -2
- package/dist/chunk-OEAXCCVM.js.map +0 -7
- package/dist/chunk-UB5RYS7T.js +0 -2
- package/dist/chunk-UB5RYS7T.js.map +0 -7
- package/dist/chunk-UXXJOU5J.js +0 -2
- package/dist/chunk-VU3GIDZ3.js +0 -2
- package/dist/chunk-VU3GIDZ3.js.map +0 -7
- package/dist/chunk-W2BAFOCN.js +0 -3
- package/dist/chunk-W2BAFOCN.js.map +0 -7
- package/dist/chunk-WFGTQZIQ.js +0 -2
- package/dist/chunk-WFGTQZIQ.js.map +0 -7
- package/dist/chunk-XX2MVWFS.js +0 -4
- package/dist/chunk-XYZ6VZ5T.js +0 -2
- package/dist/chunk-YBAYEU25.js +0 -2
- package/dist/chunk-YF75HKL6.js +0 -2
- package/dist/chunk-YF75HKL6.js.map +0 -7
- /package/dist/{chunk-5JEXM5S7.js.map → chunk-2GKIF7A6.js.map} +0 -0
- /package/dist/{chunk-5BC72727.js.map → chunk-2I4Y7I7C.js.map} +0 -0
- /package/dist/{chunk-Z2Z52GFT.js.map → chunk-2I7HDIOU.js.map} +0 -0
- /package/dist/{chunk-ZPPELYNJ.js.map → chunk-3BG75P7T.js.map} +0 -0
- /package/dist/{chunk-GNU4VOOE.js.map → chunk-3F4MN2BU.js.map} +0 -0
- /package/dist/{chunk-5DJTP53N.js.map → chunk-3FK52VQX.js.map} +0 -0
- /package/dist/{chunk-REW4LR46.js.map → chunk-4OB2IM5L.js.map} +0 -0
- /package/dist/{chunk-EDUMAMK4.js.map → chunk-5GCTM37D.js.map} +0 -0
- /package/dist/{chunk-JOFQJGZK.js.map → chunk-6BOM5KZR.js.map} +0 -0
- /package/dist/{chunk-Z2JBUHKA.js.map → chunk-6NP4AEV4.js.map} +0 -0
- /package/dist/{chunk-NXSTUFS7.js.map → chunk-6TZJO2G2.js.map} +0 -0
- /package/dist/{chunk-GZ7X34QP.js.map → chunk-7Y2GHQRB.js.map} +0 -0
- /package/dist/{chunk-G2KUK6AT.js.map → chunk-ADHKL2GM.js.map} +0 -0
- /package/dist/{chunk-JI265XFO.js.map → chunk-AJN66F32.js.map} +0 -0
- /package/dist/{chunk-YHEMA56R.js.map → chunk-AQ3RTHG5.js.map} +0 -0
- /package/dist/{chunk-ZVK4L5GK.js.map → chunk-BCVOUMJJ.js.map} +0 -0
- /package/dist/{chunk-HOF4JGMQ.js.map → chunk-BIGL3ZVD.js.map} +0 -0
- /package/dist/{chunk-HXDTGP2K.js.map → chunk-BRGT4O6Q.js.map} +0 -0
- /package/dist/{chunk-OGRFQTXA.js.map → chunk-BTGJ3MP4.js.map} +0 -0
- /package/dist/{chunk-TOLTUOZS.js.map → chunk-CWIE74NX.js.map} +0 -0
- /package/dist/{chunk-M242VYZA.js.map → chunk-CXZKCBQE.js.map} +0 -0
- /package/dist/{chunk-4EZJ5FKJ.js.map → chunk-DIOJGTUN.js.map} +0 -0
- /package/dist/{chunk-2ZUZ5HDL.js.map → chunk-ESRS5ZQV.js.map} +0 -0
- /package/dist/{chunk-JK74QK3M.js.map → chunk-FSR6BDVO.js.map} +0 -0
- /package/dist/{chunk-6VBK2I5B.js.map → chunk-G26R2F3W.js.map} +0 -0
- /package/dist/{chunk-G2DAD3MQ.js.map → chunk-GEJKFE4X.js.map} +0 -0
- /package/dist/{chunk-5Q76ACVI.js.map → chunk-H25XXQVH.js.map} +0 -0
- /package/dist/{chunk-XYZ6VZ5T.js.map → chunk-HRW25TMU.js.map} +0 -0
- /package/dist/{chunk-W3H7GTJY.js.map → chunk-LHWY6G6Q.js.map} +0 -0
- /package/dist/{chunk-Q26YZYTD.js.map → chunk-M7HLHGQV.js.map} +0 -0
- /package/dist/{chunk-IHE2MQ3W.js.map → chunk-MGSCSS7X.js.map} +0 -0
- /package/dist/{chunk-DBMWS3O5.js.map → chunk-MQ5BYGFY.js.map} +0 -0
- /package/dist/{chunk-5QUY72FX.js.map → chunk-NWHH3CYH.js.map} +0 -0
- /package/dist/{chunk-3TAW4AKH.js.map → chunk-OB3VIRQR.js.map} +0 -0
- /package/dist/{chunk-MB3MU6HR.js.map → chunk-PGVLRMTQ.js.map} +0 -0
- /package/dist/{chunk-TZOQWCVH.js.map → chunk-QOSTS5I3.js.map} +0 -0
- /package/dist/{chunk-3S24ZRPK.js.map → chunk-RMATRKXV.js.map} +0 -0
- /package/dist/{chunk-I4SP6JTU.js.map → chunk-S3ILIWSW.js.map} +0 -0
- /package/dist/{chunk-XHOBNSBO.js.map → chunk-SEUIIPHS.js.map} +0 -0
- /package/dist/{chunk-23XLG2EM.js.map → chunk-SEW5OCQF.js.map} +0 -0
- /package/dist/{chunk-LQRFNQ2N.js.map → chunk-U25QSLAH.js.map} +0 -0
- /package/dist/{chunk-FEHGU6EP.js.map → chunk-UL364TLO.js.map} +0 -0
- /package/dist/{chunk-JBLRAM7Z.js.map → chunk-XNRZJP4E.js.map} +0 -0
- /package/dist/{chunk-ELYARUCN.js.map → chunk-YJTUFK4P.js.map} +0 -0
- /package/dist/{chunk-2YZB6XQR.js.map → chunk-ZLYZFHEN.js.map} +0 -0
|
@@ -11,6 +11,8 @@ export interface FieldConfig<V = unknown> extends ComponentConfig {
|
|
|
11
11
|
validators?: Validator<V>[];
|
|
12
12
|
/** When to validate on its own. After the first error it revalidates on every change. Default `blur`. */
|
|
13
13
|
validateOn?: 'blur' | 'change' | 'submit';
|
|
14
|
+
/** Lookups and pickers: the key of the loaded record that holds the text to show for the value (`evento` + `displayFrom: 'eventoNome'`). */
|
|
15
|
+
displayFrom?: string;
|
|
14
16
|
/** ms of quiet after the last change before `settled` fires (0 = right away). `change` itself is never delayed. */
|
|
15
17
|
debounce?: number;
|
|
16
18
|
}
|
|
@@ -44,6 +46,8 @@ export declare abstract class Field<V = unknown, C extends FieldConfig<V> = Fiel
|
|
|
44
46
|
getValue(): V;
|
|
45
47
|
/** Sets the value programmatically. `silent` skips the `change` event and validation. */
|
|
46
48
|
setValue(v: V, silent?: boolean): void;
|
|
49
|
+
/** Silently takes this field's value from a record (by `name`); does nothing when the record lacks the key. */
|
|
50
|
+
fillFrom(record: Record<string, any>): void;
|
|
47
51
|
/** For subclasses: the user edited the control and the DOM already shows `v`. */
|
|
48
52
|
protected commit(v: V): void;
|
|
49
53
|
private changed;
|
|
@@ -2,6 +2,8 @@ export type Locale = Record<string, string>;
|
|
|
2
2
|
export declare const locales: Record<string, Locale>;
|
|
3
3
|
/** Picks a registered locale by name (`'pt-BR'`, or `'pt'` as a prefix) or merges a custom object over English. */
|
|
4
4
|
export declare function setLocale(l: string | Locale): void;
|
|
5
|
+
/** The ISO 4217 code that `money` columns and currency fields use (each locale brings its own default). */
|
|
6
|
+
export declare function setCurrency(code: string): void;
|
|
5
7
|
export declare const getLocale: () => Locale;
|
|
6
8
|
/**
|
|
7
9
|
* Adds messages to a locale (created if missing). Keys already there are kept, so an app's own overrides win.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { Emitter, type Handler } from './emitter.js';
|
|
2
2
|
export { h, attr, uid, kebab, px, clamp, type Attrs, type Child } from './dom.js';
|
|
3
|
-
export { t, setLocale, getLocale, addMessages, locales, type Locale } from './i18n.js';
|
|
3
|
+
export { t, setLocale, setCurrency, getLocale, addMessages, locales, type Locale } from './i18n.js';
|
|
4
4
|
export { Component, type ComponentConfig, type Parent } from './component.js';
|
|
5
5
|
export { Container, type ContainerConfig } from './container.js';
|
|
6
6
|
export { register, create, getType, type AnyConfig, type ComponentClass } from './registry.js';
|
|
7
7
|
export { registerLayout, createLayout, type Layout, type LayoutSpec, type LayoutFactory } from '../layout/layout.js';
|
|
8
8
|
export { Field, type FieldConfig } from './field.js';
|
|
9
|
+
export { setStateStorage, loadState, saveState, type StateStorage } from './state.js';
|
|
10
|
+
export { getPath, setPath } from './path.js';
|
|
11
|
+
export { setPermissionResolver, setPermissionMode, allowed, gate, type PermissionMode } from './permission.js';
|
|
9
12
|
export * as validators from './validators.js';
|
|
10
13
|
export type { Validator } from './validators.js';
|
|
11
14
|
export { layer, toLayer, lockModal } from './layer.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type PermissionMode = 'hide' | 'disable';
|
|
2
|
+
/** The app's answer to "may the user do this?". Without one, every `permission` is granted. */
|
|
3
|
+
export declare function setPermissionResolver(fn: ((permission: string) => boolean) | undefined): void;
|
|
4
|
+
/** What a component without access does by default: `hide` (default) or `disable`. A component's `permissionMode` wins. */
|
|
5
|
+
export declare function setPermissionMode(m: PermissionMode): void;
|
|
6
|
+
export declare const allowed: (permission?: string) => boolean;
|
|
7
|
+
export declare const permissionMode: () => PermissionMode;
|
|
8
|
+
/** Applies each item's `permission` to a list: denied items are dropped (`hide`) or come back `disabled` (`disable`). Nested `items` too. */
|
|
9
|
+
export declare function gate<T extends {
|
|
10
|
+
permission?: string;
|
|
11
|
+
}>(list: T[] | undefined): T[] | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Where per-user UI state (column widths, filters, density...) is kept. Both calls may be async (a REST endpoint). */
|
|
2
|
+
export interface StateStorage {
|
|
3
|
+
get(key: string): unknown | Promise<unknown>;
|
|
4
|
+
set(key: string, value: unknown): void | Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/** Replaces the default (`localStorage`) for every `persist`: send it to your API to follow the user across devices. */
|
|
7
|
+
export declare function setStateStorage(storage: StateStorage | undefined): void;
|
|
8
|
+
export declare const loadState: <T = unknown>(key: string) => Promise<T | null>;
|
|
9
|
+
export declare const saveState: (key: string, value: unknown) => Promise<void>;
|
|
@@ -18,7 +18,15 @@ export interface Column<T extends Record<string, any> = any> {
|
|
|
18
18
|
align?: 'left' | 'center' | 'right';
|
|
19
19
|
sortable?: boolean;
|
|
20
20
|
hidden?: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/** Pinned to the start or the end while the body scrolls sideways (give it a `width`; default 140). The columns of one edge stay together. */
|
|
22
|
+
locked?: 'start' | 'end';
|
|
23
|
+
/** With `grouping()` or `columnTotals()`: what the total shows. Numbers: `sum`, `avg`, `min`, `max`, `count`; dates: `min` (earliest), `max` (latest), `count`; or your own function of the values. */
|
|
24
|
+
summary?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values: any[], recs: Model<T>[]) => unknown);
|
|
25
|
+
/** Text for the total of this column (default: the column's `format`, else the plain value). */
|
|
26
|
+
summaryRenderer?: (value: any, col: Column<T>) => string | Node;
|
|
27
|
+
/** Left out while `setPermissionResolver` denies it. */
|
|
28
|
+
permission?: string;
|
|
29
|
+
/** Name registered with `registerFormat` (`money`, `date`, `number`, `percent`, `bool`, `duration`: minutes as `7h 30m`) or a function. */
|
|
22
30
|
format?: string | Formatter;
|
|
23
31
|
/** Full control over the cell content. Text is escaped; return a Node for markup. */
|
|
24
32
|
renderer?: (value: any, rec: Model<T>, col: Column<T>) => string | Node;
|
|
@@ -30,3 +38,5 @@ export interface Column<T extends Record<string, any> = any> {
|
|
|
30
38
|
}
|
|
31
39
|
/** Cell content for a record: `renderer` first, then `format`, then the plain value. */
|
|
32
40
|
export declare function cellContent<T extends Record<string, any>>(col: Column<T>, rec: Model<T>): string | Node;
|
|
41
|
+
/** The value of a column's `summary` over some records. */
|
|
42
|
+
export declare function summarize(col: Column, recs: Model[]): unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Model, type ModelDef, type FieldDef } from './model.js';
|
|
2
|
-
export { Store, matchFilter, type StoreConfig, type StoreProxy, type FilterFn } from './store.js';
|
|
2
|
+
export { Store, matchFilter, type StoreConfig, type StoreProxy, type Patch, type LiveSource, type FilterFn } from './store.js';
|
|
3
3
|
export { MemoryProxy, RestProxy, type Proxy, type RestProxyConfig, type ReadParams, type ReadResult, type Sorter, type FilterSpec, type FilterOp, type FilterGroup, type FilterNode } from './proxy.js';
|
|
4
4
|
export { format, registerFormat, type Formatter } from './format.js';
|
|
5
5
|
export { cellContent, type Column } from './column.js';
|
|
@@ -21,6 +21,8 @@ export declare class Model<T extends Record<string, any> = Record<string, any>>
|
|
|
21
21
|
get id(): string | number;
|
|
22
22
|
get<K extends keyof T>(field: K): T[K];
|
|
23
23
|
set<K extends keyof T>(field: K, value: T[K]): void;
|
|
24
|
+
/** Applies values that came from the server. It is not an edit (nothing becomes dirty), and a field the user already changed keeps their value. */
|
|
25
|
+
patch(raw: Partial<T>): boolean;
|
|
24
26
|
isDirty(): boolean;
|
|
25
27
|
getChanges(): Partial<T>;
|
|
26
28
|
commit(): void;
|
|
@@ -3,6 +3,21 @@ import { Model, type ModelDef, type RecordOwner } from './model.js';
|
|
|
3
3
|
import type { FilterNode, Proxy, ReadParams, ReadResult, Sorter } from './proxy.js';
|
|
4
4
|
export type StoreProxy<T> = Proxy<T> | ((params: ReadParams, signal?: AbortSignal) => Promise<ReadResult<T> | T[]> | ReadResult<T> | T[]);
|
|
5
5
|
export type FilterFn<T extends Record<string, any>> = (rec: Model<T>) => boolean;
|
|
6
|
+
/** One live change: `upsert` merges `data` into the record with the same id (or adds it), `remove` drops the record with `id`. */
|
|
7
|
+
export interface Patch<T> {
|
|
8
|
+
op?: 'upsert' | 'remove';
|
|
9
|
+
data?: Partial<T>;
|
|
10
|
+
id?: string | number;
|
|
11
|
+
}
|
|
12
|
+
/** What `connect` needs from a source: an `EventSource` or a `WebSocket` both fit. */
|
|
13
|
+
export interface LiveSource {
|
|
14
|
+
addEventListener(type: 'message', fn: (e: {
|
|
15
|
+
data: any;
|
|
16
|
+
}) => void): void;
|
|
17
|
+
removeEventListener(type: 'message', fn: (e: {
|
|
18
|
+
data: any;
|
|
19
|
+
}) => void): void;
|
|
20
|
+
}
|
|
6
21
|
export interface StoreConfig<T extends Record<string, any>> {
|
|
7
22
|
data?: Partial<T>[];
|
|
8
23
|
model?: ModelDef;
|
|
@@ -57,6 +72,8 @@ export declare class Store<T extends Record<string, any> = Record<string, any>>
|
|
|
57
72
|
loadData(data: Partial<T>[]): void;
|
|
58
73
|
/** Reads through the proxy. Extra `params` are sent to it and remembered for later reloads. A newer load cancels the older one. */
|
|
59
74
|
load(params?: Record<string, unknown>): Promise<void>;
|
|
75
|
+
/** Every record that matches the current sort and filters: a local store has them; a remote one is read page by page through its proxy. */
|
|
76
|
+
fetchAll(pageSize?: number): Promise<Model<T>[]>;
|
|
60
77
|
private setRecords;
|
|
61
78
|
/** Recomputes filtered/sorted/paged rows from `all`. */
|
|
62
79
|
private refreshView;
|
|
@@ -80,6 +97,10 @@ export declare class Store<T extends Record<string, any> = Record<string, any>>
|
|
|
80
97
|
add(raw: Partial<T> | Partial<T>[]): Model<T>[];
|
|
81
98
|
insert(index: number, raw: Partial<T>): Model<T>;
|
|
82
99
|
remove(target: Model<T> | number | Array<Model<T>>): void;
|
|
100
|
+
/** Applies live changes in place, with one repaint: known ids are patched (not marked as edits), unknown ones are added, `remove` drops. */
|
|
101
|
+
applyPatches(patches: Array<Patch<T>>): void;
|
|
102
|
+
/** Applies what a source sends as it arrives (`{ op, data, id }`, or an array of them; text is parsed as JSON). Returns the function that stops it. */
|
|
103
|
+
connect(source: LiveSource, parse?: (data: any) => Patch<T> | Array<Patch<T>>): () => void;
|
|
83
104
|
clear(): void;
|
|
84
105
|
recordChanged(rec: Model, field: string): void;
|
|
85
106
|
getModified(): Model<T>[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const keys: Record<string, string>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,21 +3,36 @@ export * from './data/index.js';
|
|
|
3
3
|
export * from './themes/index.js';
|
|
4
4
|
export * from './motion/index.js';
|
|
5
5
|
export * from './ui/index.js';
|
|
6
|
+
export * from './build/index.js';
|
|
7
|
+
export * from './components/base/avatar/avatar.js';
|
|
6
8
|
export * from './components/base/badge/badge.js';
|
|
7
9
|
export * from './components/base/button/button.js';
|
|
8
10
|
export * from './components/base/chip/chip.js';
|
|
9
11
|
export * from './components/base/codeviewer/codeviewer.js';
|
|
10
12
|
export * from './components/base/icon/icon.js';
|
|
13
|
+
export * from './components/base/image/image.js';
|
|
14
|
+
export * from './components/base/imagecanvas/imagecanvas.js';
|
|
11
15
|
export * from './components/base/label/label.js';
|
|
16
|
+
export * from './components/charts/chart/chart.js';
|
|
17
|
+
export * from './components/charts/stat/stat.js';
|
|
12
18
|
export * from './components/chat/chat/chat.js';
|
|
13
19
|
export * from './components/data/cellediting/cellediting.js';
|
|
20
|
+
export * from './components/data/columntotals/columntotals.js';
|
|
14
21
|
export * from './components/data/dataview/dataview.js';
|
|
22
|
+
export * from './components/data/exportbar/exportbar.js';
|
|
15
23
|
export * from './components/data/filterbuilder/filterbuilder.js';
|
|
16
24
|
export * from './components/data/grid/grid.js';
|
|
25
|
+
export * from './components/data/gridexport/gridexport.js';
|
|
26
|
+
export * from './components/data/gridstate/gridstate.js';
|
|
27
|
+
export * from './components/data/grouping/grouping.js';
|
|
17
28
|
export * from './components/data/pagination/pagination.js';
|
|
29
|
+
export * from './components/data/rowediting/rowediting.js';
|
|
18
30
|
export * from './components/data/searchgrid/searchgrid.js';
|
|
19
31
|
export * from './components/data/table/table.js';
|
|
32
|
+
export * from './components/data/timeentry/timeentry.js';
|
|
33
|
+
export * from './components/data/timeline/timeline.js';
|
|
20
34
|
export * from './components/data/tree/tree.js';
|
|
35
|
+
export * from './components/data/treegrid/treegrid.js';
|
|
21
36
|
export * from './components/data/viewmanager/viewmanager.js';
|
|
22
37
|
export * from './components/dates/calendar/calendar.js';
|
|
23
38
|
export * from './components/feedback/spinner/spinner.js';
|
|
@@ -26,9 +41,12 @@ export * from './components/fields/checkboxgroup/checkboxgroup.js';
|
|
|
26
41
|
export * from './components/fields/combobox/combobox.js';
|
|
27
42
|
export * from './components/fields/datefield/datefield.js';
|
|
28
43
|
export * from './components/fields/daterangefield/daterangefield.js';
|
|
44
|
+
export * from './components/fields/datetimefield/datetimefield.js';
|
|
29
45
|
export * from './components/fields/dial/dial.js';
|
|
46
|
+
export * from './components/fields/imagefield/imagefield.js';
|
|
30
47
|
export * from './components/fields/listbox/listbox.js';
|
|
31
48
|
export * from './components/fields/lookupfield/lookupfield.js';
|
|
49
|
+
export * from './components/fields/maskfield/maskfield.js';
|
|
32
50
|
export * from './components/fields/numberfield/numberfield.js';
|
|
33
51
|
export * from './components/fields/pickerfield/pickerfield.js';
|
|
34
52
|
export * from './components/fields/radiogroup/radiogroup.js';
|
|
@@ -38,6 +56,7 @@ export * from './components/fields/slider/slider.js';
|
|
|
38
56
|
export * from './components/fields/suggestfield/suggestfield.js';
|
|
39
57
|
export * from './components/fields/textarea/textarea.js';
|
|
40
58
|
export * from './components/fields/textfield/textfield.js';
|
|
59
|
+
export * from './components/fields/timefield/timefield.js';
|
|
41
60
|
export * from './components/fields/toggle/toggle.js';
|
|
42
61
|
export * from './components/form/fieldgroup/fieldgroup.js';
|
|
43
62
|
export * from './components/form/fieldlist/fieldlist.js';
|
|
@@ -47,6 +66,7 @@ export * from './components/form/formerrors/formerrors.js';
|
|
|
47
66
|
export * from './components/form/formsection/formsection.js';
|
|
48
67
|
export * from './components/form/inputgroup/inputgroup.js';
|
|
49
68
|
export * from './components/form/stepform/stepform.js';
|
|
69
|
+
export * from './components/layout/carousel/carousel.js';
|
|
50
70
|
export * from './components/layout/container/container.js';
|
|
51
71
|
export * from './components/layout/fieldset/fieldset.js';
|
|
52
72
|
export * from './components/layout/panel/panel.js';
|
|
@@ -61,6 +81,7 @@ export * from './components/overlays/commandpalette/commandpalette.js';
|
|
|
61
81
|
export * from './components/overlays/dropdown/dropdown.js';
|
|
62
82
|
export * from './components/overlays/menu/menu.js';
|
|
63
83
|
export * from './components/overlays/messagebox/messagebox.js';
|
|
84
|
+
export * from './components/overlays/shortcuts/shortcuts.js';
|
|
64
85
|
export * from './components/overlays/toast/toast.js';
|
|
65
86
|
export * from './components/overlays/tooltip/tooltip.js';
|
|
66
87
|
export * from './components/overlays/widget/widget.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Form } from '../components/form/form/form.js';
|
|
2
|
+
import type { Grid } from '../components/data/grid/grid.js';
|
|
3
|
+
import type { Field } from '../core/field.js';
|
|
4
|
+
import type { Component } from '../core/component.js';
|
|
5
|
+
import type { Store } from '../data/store.js';
|
|
6
|
+
import type { Model } from '../data/model.js';
|
|
7
|
+
import type { LookupField } from '../components/fields/lookupfield/lookupfield.js';
|
|
8
|
+
/** Lets pending promises, microtasks and 0 ms timers run (after `fill`, `store.load()`, a debounce of `ms`...). */
|
|
9
|
+
export declare const flush: (ms?: number) => Promise<void>;
|
|
10
|
+
/** Types into a field the way a user does: sets the input and fires `input`, so parsing, masks and validation run. Falls back to `setValue`. */
|
|
11
|
+
export declare function type(field: Field<any> | HTMLInputElement, text: string): void;
|
|
12
|
+
/** Fills a form from an object (`{ 'address.city': 'Rio', name: 'Ada' }` or nested). Text fields are typed into; the rest get `setValue`. */
|
|
13
|
+
export declare function fill(form: Form, values: Record<string, any>): Form;
|
|
14
|
+
/** Fills and submits. Resolves with the values when the form was valid and submitted, or `null`. */
|
|
15
|
+
export declare function submit(form: Form, values?: Record<string, any>): Promise<Record<string, any> | null>;
|
|
16
|
+
/** What the form shows as errors: `{ fieldName: message }`. */
|
|
17
|
+
export declare function errors(form: Form): Record<string, string>;
|
|
18
|
+
/** Selects a grid row by index, or by the first record the predicate accepts; returns its record. */
|
|
19
|
+
export declare function clickRow<T extends Record<string, any>>(grid: Grid<T>, which: number | ((rec: Model<T>) => boolean)): Model<T>;
|
|
20
|
+
/** Waits until the store is not loading (and, if it has not started yet, until its first `load`). */
|
|
21
|
+
export declare function loaded<T extends Record<string, any>>(store: Store<T>): Promise<Store<T>>;
|
|
22
|
+
/** Opens a lookup's search window, selects the record at `row` and confirms. Resolves with what the field then holds. */
|
|
23
|
+
export declare function pickLookup(field: LookupField<any>, row?: number): Promise<unknown>;
|
|
24
|
+
/** The text a component shows, collapsed to single spaces. */
|
|
25
|
+
export declare const text: (c: Component | HTMLElement) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RGB = [number, number, number];
|
|
2
|
+
export declare function parse(css: string): RGB | undefined;
|
|
3
|
+
export declare const toHex: (c: RGB) => string;
|
|
4
|
+
/** `t` of `b` over `a` (0 = a, 1 = b), in sRGB. */
|
|
5
|
+
export declare const mix: (a: RGB, b: RGB, t: number) => RGB;
|
|
6
|
+
export declare const luminance: (c: RGB) => number;
|
|
7
|
+
/** WCAG contrast ratio, 1 to 21. */
|
|
8
|
+
export declare function contrast(a: RGB, b: RGB): number;
|
|
9
|
+
export declare const WHITE: RGB;
|
|
10
|
+
export declare const BLACK: RGB;
|
|
11
|
+
/** Moves `c` toward black or white (whichever reaches it) until it has `min` contrast against `bg`. */
|
|
12
|
+
export declare function ensure(c: RGB, bg: RGB, min: number): RGB;
|
|
13
|
+
/** Black or white, whichever reads better on `bg`. */
|
|
14
|
+
export declare const readableOn: (bg: RGB) => RGB;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RGB } from './color.js';
|
|
2
|
+
export interface ContrastIssue {
|
|
3
|
+
/** The pair, as the tokens that make it (`--op-color-fg on --op-color-surface`). */
|
|
4
|
+
pair: string;
|
|
5
|
+
ratio: number;
|
|
6
|
+
min: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Checks the theme in effect on `el` (default `<html>`) for text pairs under 4.5:1 and returns them.
|
|
10
|
+
* A pair whose token is not set is skipped. `warn` (default: in dev) also prints each to the console.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkContrast(el?: HTMLElement, o?: {
|
|
13
|
+
warn?: boolean;
|
|
14
|
+
resolve?: (token: string) => RGB | undefined;
|
|
15
|
+
}): ContrastIssue[];
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
+
import { type Seeds } from './seeds.js';
|
|
1
2
|
type Values = Record<string, string | number | undefined>;
|
|
2
3
|
type ColorToken = 'bg' | 'surface' | 'surface-2' | 'fg' | 'fg-muted' | 'border' | 'border-strong' | 'hover' | 'selected' | 'primary' | 'primary-hover' | 'primary-fg' | 'primary-soft' | 'danger' | 'danger-hover' | 'danger-fg' | 'danger-soft' | 'success' | 'success-soft' | 'warning' | 'warning-soft' | 'info' | 'info-soft' | 'focus' | 'overlay';
|
|
4
|
+
export interface FontSpec {
|
|
5
|
+
family: string;
|
|
6
|
+
/** URL of the file (woff2 is enough for every current browser). */
|
|
7
|
+
url: string;
|
|
8
|
+
/** A weight or a range (`'400 700'` for a variable font). Default `400`. */
|
|
9
|
+
weight?: string | number;
|
|
10
|
+
style?: 'normal' | 'italic';
|
|
11
|
+
/** Default `swap`. */
|
|
12
|
+
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
13
|
+
}
|
|
3
14
|
export interface ThemeDefinition {
|
|
15
|
+
/**
|
|
16
|
+
* A few brand colors in, a whole theme out: light under `name`, and dark under `name` + `dark` (`data-op-theme="name dark"`).
|
|
17
|
+
* Text pairs are kept at 4.5:1; navmenu and grid header colors come with it. Tokens you also give win.
|
|
18
|
+
*/
|
|
19
|
+
seeds?: Seeds;
|
|
20
|
+
/** `@font-face` rules, so the font ships with the theme (a white-label tenant brings its own). Set the family with `font: { family }`. */
|
|
21
|
+
fonts?: FontSpec[];
|
|
4
22
|
/** Semantic colors: `{ primary: '#06f' }` → `--op-color-primary`. camelCase keys are kebab-cased. */
|
|
5
23
|
color?: Partial<Record<ColorToken | string, string>>;
|
|
6
24
|
font?: Values;
|
|
7
25
|
space?: Values;
|
|
8
|
-
/** `radius: '0.5rem'` sets `--op-radius`; `radius: { sm, lg, pill }` sets `--op-radius-sm
|
|
26
|
+
/** `radius: '0.5rem'` sets `--op-radius`; `radius: { sm, lg, pill }` sets `--op-radius-sm`...; `radius: { base: '0.5rem', sm: '0.25rem' }` sets both. */
|
|
9
27
|
radius?: Values | string | number;
|
|
10
28
|
shadow?: Values;
|
|
11
29
|
control?: Values;
|
|
12
|
-
/** Any other key is a component scope: `{ button: { radius: 0 } }` → `--op-button-radius`. A plain value sets the group's own token (`{ radius: 0 }` → `--op-radius`). */
|
|
13
|
-
[group: string]: Values | string | number | undefined;
|
|
30
|
+
/** Any other key is a component scope: `{ button: { radius: 0 } }` → `--op-button-radius`. A plain value, or the key `base`, sets the group's own token (`{ radius: 0 }` or `{ radius: { base: 0, sm: 2 } }` → `--op-radius`). */
|
|
31
|
+
[group: string]: Values | string | number | Seeds | FontSpec[] | undefined;
|
|
14
32
|
}
|
|
15
33
|
export interface Theme {
|
|
16
34
|
name: string;
|
|
17
35
|
/** CSS text, scoped to `[data-op-theme~="name"]`, inside `@layer optikos`. */
|
|
18
36
|
css: string;
|
|
37
|
+
/** The fonts the theme declared, for `loadFonts`. */
|
|
38
|
+
fonts: FontSpec[];
|
|
19
39
|
/** Injects the CSS once without activating it (e.g. to offer it in a theme picker). */
|
|
20
40
|
inject(): void;
|
|
21
41
|
/** Injects the CSS and activates the theme on `el` (default: `<html>`), keeping other themes (`"dark custom"`). */
|
|
@@ -28,4 +48,6 @@ export interface Theme {
|
|
|
28
48
|
export declare function defineTheme(def: ThemeDefinition, name?: string): Theme;
|
|
29
49
|
/** Activates themes on an element (default `<html>`): `setTheme('dark compact')` or `setTheme(['dark', 'custom'])`. */
|
|
30
50
|
export declare function setTheme(names: string | string[], el?: HTMLElement): void;
|
|
51
|
+
/** Loads the fonts of a theme now (and resolves when they are ready), so the first paint does not flash the fallback. */
|
|
52
|
+
export declare function loadFonts(fonts: FontSpec[]): Promise<void>;
|
|
31
53
|
export {};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { defineTheme, setTheme, type Theme, type ThemeDefinition } from './define.js';
|
|
1
|
+
export { defineTheme, setTheme, loadFonts, type Theme, type ThemeDefinition, type FontSpec } from './define.js';
|
|
2
|
+
export { checkContrast, type ContrastIssue } from './contrast.js';
|
|
3
|
+
export type { Seeds } from './seeds.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Seeds {
|
|
2
|
+
/** The brand color. Used as is for fills; text uses a shade of it that keeps 4.5:1. */
|
|
3
|
+
primary: string;
|
|
4
|
+
/** Tints the grays (backgrounds, borders, text). Default: a cool gray. */
|
|
5
|
+
neutral?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Light and dark token sets from a few seeds, with the text pairs kept at 4.5:1 or better. */
|
|
8
|
+
export declare function fromSeeds(seeds: Seeds): {
|
|
9
|
+
light: Record<string, string>;
|
|
10
|
+
dark: Record<string, string>;
|
|
11
|
+
};
|
package/dist/types/ui/ui.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { TextField } from '../components/fields/textfield/textfield.js';
|
|
2
2
|
import { TextArea } from '../components/fields/textarea/textarea.js';
|
|
3
3
|
import { NumberField } from '../components/fields/numberfield/numberfield.js';
|
|
4
|
+
import { MaskField } from '../components/fields/maskfield/maskfield.js';
|
|
5
|
+
import { TimeField } from '../components/fields/timefield/timefield.js';
|
|
6
|
+
import { DateTimeField } from '../components/fields/datetimefield/datetimefield.js';
|
|
4
7
|
import { DateField } from '../components/fields/datefield/datefield.js';
|
|
5
8
|
import { DateRangeField } from '../components/fields/daterangefield/daterangefield.js';
|
|
6
9
|
import { Checkbox } from '../components/fields/checkbox/checkbox.js';
|
|
@@ -34,7 +37,10 @@ export declare const ui: {
|
|
|
34
37
|
password: (name: string, label?: string, c?: Cfg) => TextField<string, any>;
|
|
35
38
|
area: (name: string, label?: string, c?: Cfg) => TextArea;
|
|
36
39
|
number: (name: string, label?: string, c?: Cfg) => NumberField;
|
|
40
|
+
mask: (name: string, label: string | undefined, mask: string | string[], c?: Cfg) => MaskField;
|
|
41
|
+
time: (name: string, label?: string, c?: Cfg) => TimeField;
|
|
37
42
|
date: (name: string, label?: string, c?: Cfg) => DateField;
|
|
43
|
+
datetime: (name: string, label?: string, c?: Cfg) => DateTimeField;
|
|
38
44
|
dateRange: (name: string, label?: string, c?: Cfg) => DateRangeField;
|
|
39
45
|
secret: (name: string, label?: string, c?: Cfg) => SecretField;
|
|
40
46
|
slider: (name: string, label?: string, c?: Cfg) => Slider;
|
package/dist/ui.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"./chunk-LLHDEUIA.js";import{a}from"./chunk-UCWICDYG.js";import"./chunk-OADWLPSF.js";import"./chunk-ADHKL2GM.js";import"./chunk-2I7HDIOU.js";import"./chunk-SEUIIPHS.js";import"./chunk-BRGT4O6Q.js";import"./chunk-3OA3P37P.js";import"./chunk-QOSTS5I3.js";import"./chunk-TVO3Z2BM.js";import"./chunk-G26R2F3W.js";import"./chunk-6TZJO2G2.js";import"./chunk-S3ILIWSW.js";import"./chunk-BTGJ3MP4.js";import"./chunk-AJN66F32.js";import"./chunk-L6DOWGBO.js";import"./chunk-H25XXQVH.js";import"./chunk-5GCTM37D.js";import"./chunk-NAUSRVB6.js";import"./chunk-EO777UIN.js";import"./chunk-FSR6BDVO.js";import"./chunk-J5BZAKC6.js";import"./chunk-T5OGUCY2.js";import"./chunk-OB3VIRQR.js";import"./chunk-GEJKFE4X.js";import"./chunk-LXWCTCZV.js";import"./chunk-JBOKM5YA.js";import"./chunk-Z6HZY2YG.js";import"./chunk-U25QSLAH.js";import"./chunk-HRW25TMU.js";import"./chunk-3F4MN2BU.js";import"./chunk-SEW5OCQF.js";import"./chunk-LHWY6G6Q.js";import"./chunk-MQEALOU3.js";import"./chunk-6NP4AEV4.js";import"./chunk-AQ3RTHG5.js";import"./chunk-BCVOUMJJ.js";import"./chunk-ESRS5ZQV.js";import"./chunk-DIOJGTUN.js";import"./chunk-2GKIF7A6.js";import"./chunk-OWEQT2HN.js";import"./chunk-BQEFLPDA.js";import"./chunk-QVBDBGS4.js";import"./chunk-E4VNLYO2.js";import"./chunk-676AKAGF.js";import"./chunk-VV7CFMPZ.js";import"./chunk-TIPK3SCJ.js";import"./chunk-UDXO3KM3.js";import"./chunk-PZSHOSOS.js";import"./chunk-IODSL7KU.js";import"./chunk-XFDNXSU5.js";import"./chunk-L5SQQFO7.js";import"./chunk-3VDLX7ET.js";import"./chunk-S4QD5NID.js";import"./chunk-6NCXO5ZP.js";import"./chunk-4AA4FQEM.js";import"./chunk-2UPUC4RK.js";import"./chunk-V5G5JECN.js";import"./chunk-4C666HHU.js";export{d as Direction,c as LabelPos,g as LayoutKind,j as Op,e as Region,h as Selection,f as Side,k as ThemeName,i as ToastType,b as Variant,a as ui};
|
|
2
2
|
//# sourceMappingURL=ui.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "optikos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Declarative UI components in plain TypeScript: forms, grids, windows and themes. No runtime dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -51,6 +51,18 @@
|
|
|
51
51
|
"types": "./dist/types/ui/index.d.ts",
|
|
52
52
|
"import": "./dist/ui.js"
|
|
53
53
|
},
|
|
54
|
+
"./build": {
|
|
55
|
+
"types": "./dist/types/build/index.d.ts",
|
|
56
|
+
"import": "./dist/build.js"
|
|
57
|
+
},
|
|
58
|
+
"./testing": {
|
|
59
|
+
"types": "./dist/types/testing/index.d.ts",
|
|
60
|
+
"import": "./dist/testing.js"
|
|
61
|
+
},
|
|
62
|
+
"./dev": {
|
|
63
|
+
"types": "./dist/types/dev/index.d.ts",
|
|
64
|
+
"import": "./dist/dev.js"
|
|
65
|
+
},
|
|
54
66
|
"./bind": {
|
|
55
67
|
"types": "./dist/types/bind/index.d.ts",
|
|
56
68
|
"import": "./dist/bind.js"
|
package/dist/chunk-2ZRNGG2N.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as o}from"./chunk-A2NKDOYN.js";import{b as r,c as s}from"./chunk-PZSHOSOS.js";import{f as l}from"./chunk-MW3RWBZ7.js";var n=class extends o{baseCls="op-field";value;original;error="";inputEl;labelEl;helpEl;errorEl;dirty=!1;cancelSettle;constructor(e={}){super(e),this.value=this.original=e.value??this.emptyValue()}get name(){return this.config.name}emptyValue(){return""}isEmpty(e){return e==null||e===""||Array.isArray(e)&&!e.length}isEqual(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}build(){let e=this.config,t=r("div",`${this.baseCls}${e.labelPos==="left"?" op-field--label-left":""}`);this.labelEl=r("label","op-field__label");let i=r("div","op-field__control",{},this.createControl());return this.helpEl=r("div","op-field__help",{id:`${this.id}-help`}),this.errorEl=r("div","op-field__error",{id:`${this.id}-error`,role:"alert"}),t.append(this.labelEl,i,this.helpEl,this.errorEl),t}onRender(){let e=this.config,t=this.inputEl;t.id||=s("op-input"),this.labelEl.htmlFor=t.id,e.ariaLabel&&t!==this.el&&(t.setAttribute("aria-label",e.ariaLabel),this.el.removeAttribute("aria-label")),this.setLabel(e.label??""),this.setHelp(e.help??""),this.setRequired(!!e.required),this.setReadonly(!!e.readonly),this.applyValue(this.value),this.paintError(),this.listen(this.el,"focusin",()=>{this.el.classList.add("is-focused"),this.emit("focus")}),this.listen(this.el,"focusout",i=>{this.el.contains(i.relatedTarget)||(this.flushSettled(),this.el.classList.remove("is-focused"),(e.validateOn??"blur")==="blur"&&this.validate(),this.emit("blur"))})}focusEl(){return this.render(),this.inputEl}getValue(){return this.value}setValue(e,t=!1){let i=this.value;this.value=e,this.rendered&&this.applyValue(e),this.isEqual(i,e)||this.changed(i,t)}commit(e){let t=this.value;this.value=e,this.isEqual(t,e)||this.changed(t,!1)}changed(e,t){this.updateDirty(),!t&&((this.config.validateOn==="change"||this.error)&&this.validate(),this.emit("change",this.value,e),this.queueSettled())}queueSettled(){this.cancelSettle?.(),this.cancelSettle=void 0;let e=this.config.debounce;if(!e)return void this.emit("settled",this.value);this.cancelSettle=this.later(()=>{this.cancelSettle=void 0,this.emit("settled",this.value)},e)}flushSettled(){this.cancelSettle&&(this.cancelSettle(),this.cancelSettle=void 0,this.emit("settled",this.value))}updateDirty(){let e=this.isDirty();e!==this.dirty&&(this.dirty=e,this.rendered&&this.el.classList.toggle("is-dirty",e),this.emit("dirty-change",e))}getDisplayText(){let e=this.value;return this.isEmpty(e)?"":String(e)}clear(){this.setValue(this.emptyValue())}isDirty(){return!this.isEqual(this.value,this.original)}markClean(){this.original=this.value,this.updateDirty()}reset(){this.setValue(this.original,!0),this.clearError()}check(){let e=this.value;if(this.isEmpty(e))return this.config.required?l("required"):"";for(let t of this.config.validators??[]){let i=t(e,this);if(typeof i=="string")return i}return""}validate(){let e=this.check();return e?this.setError(e):this.clearError(),!e}isValid(){return!this.check()}getError(){return this.error}setError(e){let t=this.error;this.error=e,this.paintError(),e&&e!==t&&this.emit("invalid",e)}clearError(){this.error&&(this.error="",this.paintError(),this.emit("valid"))}paintError(){this.rendered&&(this.errorEl.textContent=this.error,this.el.classList.toggle("is-invalid",!!this.error),this.inputEl.setAttribute("aria-invalid",String(!!this.error)),this.describe())}describe(){let e=[this.error&&this.errorEl.id,this.config.help&&this.helpEl.id].filter(Boolean);e.length?this.inputEl.setAttribute("aria-describedby",e.join(" ")):this.inputEl.removeAttribute("aria-describedby")}setLabel(e){this.config.label=e,this.rendered&&(this.labelEl.textContent=e,this.labelEl.hidden=!e)}setHelp(e){this.config.help=e,this.rendered&&(this.helpEl.textContent=e,this.helpEl.hidden=!e,this.describe())}setRequired(e){this.config.required=e,this.rendered&&(this.el.classList.toggle("is-required",e),this.inputEl.setAttribute("aria-required",String(e)))}setReadonly(e){this.config.readonly=e,this.rendered&&(this.el.classList.toggle("is-readonly",e),this.onReadonly(e))}setValidators(e){this.config.validators=e}onReadonly(e){}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-2ZRNGG2N.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/core/field.ts"],
|
|
4
|
-
"sourcesContent": ["import { Component, type ComponentConfig } from './component';\nimport { h, uid } from './dom';\nimport { t } from './i18n';\nimport type { Validator } from './validators';\n\nexport interface FieldConfig<V = unknown> extends ComponentConfig {\n name?: string;\n label?: string;\n labelPos?: 'top' | 'left';\n value?: V;\n required?: boolean;\n readonly?: boolean;\n help?: string;\n validators?: Validator<V>[];\n /** When to validate on its own. After the first error it revalidates on every change. Default `blur`. */\n validateOn?: 'blur' | 'change' | 'submit';\n /** ms of quiet after the last change before `settled` fires (0 = right away). `change` itself is never delayed. */\n debounce?: number;\n}\n\n/**\n * Base of every field: value, validation, dirty tracking, label and messages.\n * Subclasses implement `createControl` (build the control, assign `inputEl`), `applyValue` (value \u2192 DOM)\n * and call `commit` when the user edits (DOM \u2192 value).\n */\nexport abstract class Field<V = unknown, C extends FieldConfig<V> = FieldConfig<V>> extends Component<C> {\n protected override baseCls = 'op-field';\n protected value: V;\n protected original: V;\n protected error = '';\n /** The focusable control; `label for`, `aria-invalid` and `aria-describedby` point at it. */\n protected inputEl!: HTMLElement;\n private labelEl!: HTMLElement;\n private helpEl!: HTMLElement;\n private errorEl!: HTMLElement;\n private dirty = false;\n private cancelSettle?: () => void;\n\n constructor(config: C = {} as C) {\n super(config);\n this.value = this.original = config.value ?? this.emptyValue();\n }\n\n get name(): string | undefined {\n return this.config.name;\n }\n\n protected abstract createControl(): HTMLElement;\n protected abstract applyValue(value: V): void;\n protected emptyValue(): V {\n return '' as V;\n }\n protected isEmpty(v: V): boolean {\n return v == null || (v as unknown) === '' || (Array.isArray(v) && !v.length);\n }\n protected isEqual(a: V, b: V): boolean {\n return a === b || JSON.stringify(a) === JSON.stringify(b);\n }\n\n protected override build(): HTMLElement {\n const c = this.config;\n const el = h('div', `${this.baseCls}${c.labelPos === 'left' ? ' op-field--label-left' : ''}`);\n this.labelEl = h('label', 'op-field__label');\n const control = h('div', 'op-field__control', {}, this.createControl());\n this.helpEl = h('div', 'op-field__help', { id: `${this.id}-help` });\n this.errorEl = h('div', 'op-field__error', { id: `${this.id}-error`, role: 'alert' });\n el.append(this.labelEl, control, this.helpEl, this.errorEl);\n return el;\n }\n\n protected override onRender(): void {\n const c = this.config;\n const input = this.inputEl;\n input.id ||= uid('op-input');\n (this.labelEl as HTMLLabelElement).htmlFor = input.id;\n // a field without a visible label is named by `ariaLabel` on its control (the root is just a wrapper)\n if (c.ariaLabel && input !== this.el) {\n input.setAttribute('aria-label', c.ariaLabel);\n this.el.removeAttribute('aria-label');\n }\n this.setLabel(c.label ?? '');\n this.setHelp(c.help ?? '');\n this.setRequired(!!c.required);\n this.setReadonly(!!c.readonly);\n this.applyValue(this.value);\n this.paintError();\n this.listen(this.el, 'focusin', () => {\n this.el.classList.add('is-focused');\n this.emit('focus');\n });\n this.listen(this.el, 'focusout', (e: FocusEvent) => {\n if (this.el.contains(e.relatedTarget as Node)) return;\n this.flushSettled();\n this.el.classList.remove('is-focused');\n if ((c.validateOn ?? 'blur') === 'blur') this.validate();\n this.emit('blur');\n });\n }\n\n protected override focusEl(): HTMLElement {\n this.render();\n return this.inputEl;\n }\n\n // ---- value ---------------------------------------------------------------------------------\n\n getValue(): V {\n return this.value;\n }\n\n /** Sets the value programmatically. `silent` skips the `change` event and validation. */\n setValue(v: V, silent = false): void {\n const old = this.value;\n this.value = v;\n if (this.rendered) this.applyValue(v);\n if (!this.isEqual(old, v)) this.changed(old, silent);\n }\n\n /** For subclasses: the user edited the control and the DOM already shows `v`. */\n protected commit(v: V): void {\n const old = this.value;\n this.value = v;\n if (!this.isEqual(old, v)) this.changed(old, false);\n }\n\n private changed(old: V, silent: boolean): void {\n this.updateDirty();\n if (silent) return;\n if (this.config.validateOn === 'change' || this.error) this.validate();\n this.emit('change', this.value, old);\n this.queueSettled();\n }\n\n /** `settled(value)`: the value after the user stopped changing it for `debounce` ms (immediately without `debounce`). */\n private queueSettled(): void {\n this.cancelSettle?.();\n this.cancelSettle = undefined;\n const ms = this.config.debounce;\n if (!ms) return void this.emit('settled', this.value);\n this.cancelSettle = this.later(() => {\n this.cancelSettle = undefined;\n this.emit('settled', this.value);\n }, ms);\n }\n\n /** Fires a pending `settled` now (Enter, blur, end of a drag...). No-op when nothing is waiting. */\n protected flushSettled(): void {\n if (!this.cancelSettle) return;\n this.cancelSettle();\n this.cancelSettle = undefined;\n this.emit('settled', this.value);\n }\n\n private updateDirty(): void {\n const d = this.isDirty();\n if (d === this.dirty) return;\n this.dirty = d;\n if (this.rendered) this.el.classList.toggle('is-dirty', d);\n this.emit('dirty-change', d);\n }\n\n /** What the user sees as this field's value (a select's label, a formatted date); used by summaries such as the StepForm review. */\n getDisplayText(): string {\n const v = this.value;\n return this.isEmpty(v) ? '' : String(v);\n }\n\n /** Sets the empty value (`''`, `null`, `false`...) and emits `change`. */\n clear(): void {\n this.setValue(this.emptyValue());\n }\n\n isDirty(): boolean {\n return !this.isEqual(this.value, this.original);\n }\n\n /** The current value becomes the \"original\" (as after loading or saving). */\n markClean(): void {\n this.original = this.value;\n this.updateDirty();\n }\n\n reset(): void {\n this.setValue(this.original, true);\n this.clearError();\n }\n\n // ---- validation ----------------------------------------------------------------------------\n\n /** Returns the error message for the current value, or `''`. No UI side effects. */\n protected check(): string {\n const v = this.value;\n if (this.isEmpty(v)) return this.config.required ? t('required') : '';\n for (const fn of this.config.validators ?? []) {\n const r = fn(v, this as Field<any>);\n if (typeof r === 'string') return r;\n }\n return '';\n }\n\n validate(): boolean {\n const msg = this.check();\n if (msg) this.setError(msg);\n else this.clearError();\n return !msg;\n }\n\n isValid(): boolean {\n return !this.check();\n }\n\n getError(): string {\n return this.error;\n }\n\n setError(msg: string): void {\n const was = this.error;\n this.error = msg;\n this.paintError();\n if (msg && msg !== was) this.emit('invalid', msg);\n }\n\n clearError(): void {\n if (!this.error) return;\n this.error = '';\n this.paintError();\n this.emit('valid');\n }\n\n private paintError(): void {\n if (!this.rendered) return;\n this.errorEl.textContent = this.error;\n this.el.classList.toggle('is-invalid', !!this.error);\n this.inputEl.setAttribute('aria-invalid', String(!!this.error));\n this.describe();\n }\n\n private describe(): void {\n const ids = [this.error && this.errorEl.id, this.config.help && this.helpEl.id].filter(Boolean);\n if (ids.length) this.inputEl.setAttribute('aria-describedby', ids.join(' '));\n else this.inputEl.removeAttribute('aria-describedby');\n }\n\n // ---- setters -------------------------------------------------------------------------------\n\n setLabel(label: string): void {\n this.config.label = label;\n if (!this.rendered) return;\n this.labelEl.textContent = label;\n this.labelEl.hidden = !label;\n }\n\n setHelp(help: string): void {\n this.config.help = help;\n if (!this.rendered) return;\n this.helpEl.textContent = help;\n this.helpEl.hidden = !help;\n this.describe();\n }\n\n setRequired(required: boolean): void {\n this.config.required = required;\n if (!this.rendered) return;\n this.el.classList.toggle('is-required', required);\n this.inputEl.setAttribute('aria-required', String(required));\n }\n\n setReadonly(readonly: boolean): void {\n this.config.readonly = readonly;\n if (!this.rendered) return;\n this.el.classList.toggle('is-readonly', readonly);\n this.onReadonly(readonly);\n }\n\n setValidators(validators: Validator<V>[]): void {\n this.config.validators = validators;\n }\n\n protected onReadonly(_readonly: boolean): void {}\n}\n"],
|
|
5
|
-
"mappings": "+HAyBO,IAAeA,EAAf,cAAqFC,CAAa,CACpF,QAAU,WACnB,MACA,SACA,MAAQ,GAER,QACF,QACA,OACA,QACA,MAAQ,GACR,aAER,YAAYC,EAAY,CAAC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,CAAC,CAClD",
|
|
6
|
-
"names": ["Field", "Component", "config", "v", "a", "b", "c", "el", "h", "control", "input", "uid", "e", "silent", "old", "ms", "d", "t", "fn", "r", "msg", "was", "ids", "label", "help", "required", "readonly", "validators", "_readonly"]
|
|
7
|
-
}
|
package/dist/chunk-4EQEHJB3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-HXDTGP2K.js";import{a as R}from"./chunk-VU3GIDZ3.js";import{a as u}from"./chunk-6VBK2I5B.js";import{a as k}from"./chunk-NXSTUFS7.js";import{a as C}from"./chunk-G2KUK6AT.js";import{a as S}from"./chunk-Z2Z52GFT.js";import{a}from"./chunk-XHOBNSBO.js";import{a as l}from"./chunk-I4SP6JTU.js";import{a as d}from"./chunk-OGRFQTXA.js";import{a as x}from"./chunk-JI265XFO.js";import{a as y}from"./chunk-EDUMAMK4.js";import{a as L}from"./chunk-JK74QK3M.js";import{a as w}from"./chunk-UB5RYS7T.js";import{a as b}from"./chunk-TZOQWCVH.js";import{a as h}from"./chunk-LQRFNQ2N.js";import{a as T}from"./chunk-GNU4VOOE.js";import{a as f}from"./chunk-7KMIFXHZ.js";import{a as m}from"./chunk-3TAW4AKH.js";import{a as p}from"./chunk-W3H7GTJY.js";import{c as s}from"./chunk-ZWNQREWS.js";import{a as g}from"./chunk-2ZUZ5HDL.js";var n=(t,e,o,r={})=>new t({name:e,label:o,...r}),v={text:(t,e,o)=>n(p,t,e,o),email:(t,e,o)=>n(p,t,e,{inputType:"email",...o}),password:(t,e,o)=>n(p,t,e,{inputType:"password",...o}),area:(t,e,o)=>n(a,t,e,o),number:(t,e,o)=>n(f,t,e,o),date:(t,e,o)=>n(m,t,e,o),dateRange:(t,e,o)=>n(y,t,e,o),secret:(t,e,o)=>n(k,t,e,o),slider:(t,e,o)=>n(S,t,e,o),dial:(t,e,o)=>n(L,t,e,o),check:(t,e,o)=>n(l,t,void 0,{boxLabel:e,...o}),toggle:(t,e,o)=>n(c,t,void 0,{boxLabel:e,...o}),radio:(t,e,o,r)=>n(u,t,e,{options:o,...r}),checkGroup:(t,e,o,r)=>n(d,t,e,{options:o,...r}),select:(t,e,o,r)=>n(C,t,e,{options:o,...r}),combo:(t,e,o,r)=>n(x,t,e,{options:o,...r}),suggest:(t,e,o,r)=>n(b,t,e,{query:o,...r}),lookup:(t,e,o,r)=>n(w,t,e,{lookup:o,...r}),button:(t,e,o)=>new g({text:t,handler:e,...o}),primary:(t,e,o)=>new g({text:t,handler:e,variant:"primary",...o}),danger:(t,e,o)=>new g({text:t,handler:e,variant:"danger",...o}),row:(...t)=>new s({layout:"hbox",items:t}),col:(...t)=>new s({layout:"vbox",items:t}),grid:(t,...e)=>new s({layout:{type:"grid",columns:t},items:e}),panel:(t,e,o)=>new h({title:t,items:e,...o}),toolbar:(...t)=>new T({items:t}),form:(t,e)=>new R({items:t,...e})};var i=t=>t,Y=i({Default:"default",Primary:"primary",Danger:"danger",Ghost:"ghost"}),Z=i({Top:"top",Left:"left"}),_=i({Vertical:"vertical",Horizontal:"horizontal"}),$=i({North:"north",South:"south",West:"west",East:"east",Center:"center"}),tt=i({Right:"right",Left:"left",Top:"top",Bottom:"bottom"}),et=i({Fit:"fit",HBox:"hbox",VBox:"vbox",Border:"border",Grid:"grid",Card:"card"}),ot=i({None:"none",Single:"single",Multi:"multi"}),nt=i({Info:"info",Success:"success",Warning:"warning",Error:"error"}),rt=i({Eq:"eq",Ne:"ne",Contains:"contains",NotContains:"notContains",StartsWith:"startsWith",EndsWith:"endsWith",Gt:"gt",Ge:"ge",Lt:"lt",Le:"le",Between:"between",NotBetween:"notBetween",In:"in",Nin:"nin",Empty:"empty",NotEmpty:"notEmpty"}),it=i({Light:"light",Dark:"dark"});export{v as a,Y as b,Z as c,_ as d,$ as e,tt as f,et as g,ot as h,nt as i,rt as j,it as k};
|
|
2
|
-
//# sourceMappingURL=chunk-4EQEHJB3.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/ui/ui.ts", "../src/ui/enums.ts"],
|
|
4
|
-
"sourcesContent": ["// Short constructors for the things you write most. They return real component instances (the classes), so they can be\n// used anywhere a config goes: `items: [ui.text('name', 'Name', { required: true }), ui.select('plan', 'Plan', ['Free', 'Pro'])]`.\n// The last argument is always a config object that overrides or adds anything (`{ required: true, help: '\u2026' }`).\nimport { TextField, type TextFieldConfig } from '../components/fields/textfield/textfield';\nimport { TextArea } from '../components/fields/textarea/textarea';\nimport { NumberField } from '../components/fields/numberfield/numberfield';\nimport { DateField } from '../components/fields/datefield/datefield';\nimport { DateRangeField } from '../components/fields/daterangefield/daterangefield';\nimport { Checkbox } from '../components/fields/checkbox/checkbox';\nimport { Toggle } from '../components/fields/toggle/toggle';\nimport { CheckboxGroup } from '../components/fields/checkboxgroup/checkboxgroup';\nimport { RadioGroup, type RadioOption } from '../components/fields/radiogroup/radiogroup';\nimport { Select } from '../components/fields/select/select';\nimport { ComboBox } from '../components/fields/combobox/combobox';\nimport { SuggestField } from '../components/fields/suggestfield/suggestfield';\nimport { LookupField } from '../components/fields/lookupfield/lookupfield';\nimport { SecretField } from '../components/fields/secretfield/secretfield';\nimport { Slider } from '../components/fields/slider/slider';\nimport { Dial } from '../components/fields/dial/dial';\nimport { Button } from '../components/base/button/button';\nimport { Panel } from '../components/layout/panel/panel';\nimport { Toolbar } from '../components/layout/toolbar/toolbar';\nimport { Container } from '../core/container';\nimport { Form } from '../components/form/form/form';\nimport type { Component } from '../core/component';\nimport type { AnyConfig } from '../core/registry';\nimport type { Variant } from './enums';\n\ntype Cfg = Record<string, any>;\n// anything a container takes: an instance, a declarative config ({ type: 'fieldset', ... }) or a toolbar string ('->', '-')\ntype Item = Component | AnyConfig | string;\ntype Options = (string | number | { value: unknown; label: string; disabled?: boolean })[];\n\nconst field = <T>(Cls: new (c: any) => T, name: string, label: string | undefined, c: Cfg = {}): T => new Cls({ name, label, ...c });\n\nexport const ui = {\n // ---- fields: (name, label, config?) ----\n text: (name: string, label?: string, c?: Cfg) => field(TextField, name, label, c),\n email: (name: string, label?: string, c?: Cfg) => field(TextField, name, label, { inputType: 'email', ...c } satisfies TextFieldConfig),\n password: (name: string, label?: string, c?: Cfg) => field(TextField, name, label, { inputType: 'password', ...c }),\n area: (name: string, label?: string, c?: Cfg) => field(TextArea, name, label, c),\n number: (name: string, label?: string, c?: Cfg) => field(NumberField, name, label, c),\n date: (name: string, label?: string, c?: Cfg) => field(DateField, name, label, c),\n dateRange: (name: string, label?: string, c?: Cfg) => field(DateRangeField, name, label, c),\n secret: (name: string, label?: string, c?: Cfg) => field(SecretField, name, label, c),\n slider: (name: string, label?: string, c?: Cfg) => field(Slider, name, label, c),\n dial: (name: string, label?: string, c?: Cfg) => field(Dial, name, label, c),\n /** `boxLabel` is the text beside the box. */\n check: (name: string, boxLabel?: string, c?: Cfg) => field(Checkbox, name, undefined, { boxLabel, ...c }),\n /** An on/off switch; `boxLabel` is the text beside it. */\n toggle: (name: string, boxLabel?: string, c?: Cfg) => field(Toggle, name, undefined, { boxLabel, ...c }),\n radio: (name: string, label: string, options: RadioOption[], c?: Cfg) => field(RadioGroup, name, label, { options, ...c }),\n /** Several choices; the value is the list of checked values. */\n checkGroup: (name: string, label: string, options: RadioOption[], c?: Cfg) => field(CheckboxGroup, name, label, { options, ...c }),\n select: (name: string, label: string, options: Options, c?: Cfg) => field(Select, name, label, { options, ...c }),\n combo: (name: string, label: string, options: Options, c?: Cfg) => field(ComboBox, name, label, { options, ...c }),\n suggest: (name: string, label: string, query: (text: string, o: { signal: AbortSignal }) => unknown, c?: Cfg) => field(SuggestField, name, label, { query, ...c }),\n /** `lookup` is a LookupDef or the name given to `registerLookup`. */\n lookup: (name: string, label: string, lookup: Cfg | string, c?: Cfg) => field(LookupField, name, label, { lookup, ...c }),\n\n // ---- actions ----\n button: (text: string, handler?: (b: Button, ev: MouseEvent) => unknown, c?: Cfg) => new Button({ text, handler, ...c }),\n primary: (text: string, handler?: (b: Button, ev: MouseEvent) => unknown, c?: Cfg) => new Button({ text, handler, variant: 'primary' satisfies Variant, ...c }),\n danger: (text: string, handler?: (b: Button, ev: MouseEvent) => unknown, c?: Cfg) => new Button({ text, handler, variant: 'danger' satisfies Variant, ...c }),\n\n // ---- structure ----\n row: (...items: Item[]) => new Container({ layout: 'hbox', items } as Cfg),\n col: (...items: Item[]) => new Container({ layout: 'vbox', items } as Cfg),\n /** `columns`: a number (equal columns, one column on narrow containers) or a CSS `grid-template-columns`. */\n grid: (columns: number | string, ...items: Item[]) => new Container({ layout: { type: 'grid', columns }, items } as Cfg),\n panel: (title: string, items: Item[], c?: Cfg) => new Panel({ title, items, ...c } as Cfg),\n toolbar: (...items: Item[]) => new Toolbar({ items } as Cfg),\n form: (items: Item[], c?: Cfg) => new Form({ items, ...c } as Cfg),\n};\n", "// Named values for the options that are plain strings in configs. Each is a const object plus a type of the same name,\n// so `Variant.Primary` and `'primary'` are interchangeable: use whichever you like, the editor completes both.\nconst e = <T extends Record<string, string>>(o: T) => o;\n\nexport const Variant = e({ Default: 'default', Primary: 'primary', Danger: 'danger', Ghost: 'ghost' } as const);\nexport type Variant = (typeof Variant)[keyof typeof Variant];\n\nexport const LabelPos = e({ Top: 'top', Left: 'left' } as const);\nexport type LabelPos = (typeof LabelPos)[keyof typeof LabelPos];\n\nexport const Direction = e({ Vertical: 'vertical', Horizontal: 'horizontal' } as const);\nexport type Direction = (typeof Direction)[keyof typeof Direction];\n\n/** Layout `border` regions. */\nexport const Region = e({ North: 'north', South: 'south', West: 'west', East: 'east', Center: 'center' } as const);\nexport type Region = (typeof Region)[keyof typeof Region];\n\n/** Widget sides. */\nexport const Side = e({ Right: 'right', Left: 'left', Top: 'top', Bottom: 'bottom' } as const);\nexport type Side = (typeof Side)[keyof typeof Side];\n\nexport const LayoutKind = e({ Fit: 'fit', HBox: 'hbox', VBox: 'vbox', Border: 'border', Grid: 'grid', Card: 'card' } as const);\nexport type LayoutKind = (typeof LayoutKind)[keyof typeof LayoutKind];\n\nexport const Selection = e({ None: 'none', Single: 'single', Multi: 'multi' } as const);\nexport type Selection = (typeof Selection)[keyof typeof Selection];\n\nexport const ToastType = e({ Info: 'info', Success: 'success', Warning: 'warning', Error: 'error' } as const);\nexport type ToastType = (typeof ToastType)[keyof typeof ToastType];\n\n/** Filter operators (Store.filter, FilterBuilder, lookup filters). */\nexport const Op = e({\n Eq: 'eq', Ne: 'ne', Contains: 'contains', NotContains: 'notContains', StartsWith: 'startsWith', EndsWith: 'endsWith',\n Gt: 'gt', Ge: 'ge', Lt: 'lt', Le: 'le', Between: 'between', NotBetween: 'notBetween', In: 'in', Nin: 'nin', Empty: 'empty', NotEmpty: 'notEmpty',\n} as const);\nexport type Op = (typeof Op)[keyof typeof Op];\n\n/** The shipped themes (`setTheme(ThemeName.Dark)`; add `' compact'` for the dense variant). */\nexport const ThemeName = e({ Light: 'light', Dark: 'dark' } as const);\nexport type ThemeName = (typeof ThemeName)[keyof typeof ThemeName];\n"],
|
|
5
|
-
"mappings": "m0BAiCA,IAAMA,EAAQ,CAAIC,EAAwBC,EAAcC,EAA2BC,EAAS,CAAC,IAAS,IAAIH,EAAI,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAGC,CAAE,CAAC,EAEtHC,EAAK,CAEhB,KAAM,CAACH,EAAcC,EAAgBC,IAAYJ,EAAMM,EAAWJ,EAAMC,EAAOC,CAAC,EAChF,MAAO,CAACF,EAAcC,EAAgBC,IAAYJ,EAAMM,EAAWJ,EAAMC,EAAO,CAAE,UAAW,QAAS,GAAGC,CAAE,CAA2B,EACtI,SAAU,CAACF,EAAcC,EAAgBC,IAAYJ,EAAMM,EAAWJ,EAAMC,EAAO,CAAE,UAAW,WAAY,GAAGC,CAAE,CAAC,EAClH,KAAM,CAACF,EAAcC,EAAgBC,IAAYJ,EAAMO,EAAUL,EAAMC,EAAOC,CAAC,EAC/E,OAAQ,CAACF,EAAcC,EAAgBC,IAAYJ,EAAMQ,EAAaN,E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WAAY,WAAY,YAAa,CAAU,EAIzEK,EAASL,EAAE,CAAE,MAAO,QAAS,MAAO,QAAS,KAAM,OAAQ,KAAM,OAAQ,OAAQ,QAAS,CAAU,EAIpGM,GAAON,EAAE,CAAE,MAAO,QAAS,KAAM,OAAQ,IAAK,MAAO,OAAQ,QAAS,CAAU,EAGhFO,GAAaP,EAAE,CAAE,IAAK,MAAO,KAAM,OAAQ,KAAM,OAAQ,OAAQ,SAAU,KAAM,OAAQ,KAAM,MAAO,CAAU,EAGhHQ,GAAYR,EAAE,CAAE,KAAM,OAAQ,OAAQ,SAAU,MAAO,OAAQ,CAAU,EAGzES,GAAYT,EAAE,CAAE,KAAM,OAAQ,QAAS,UAAW,QAAS,UAAW,MAAO,OAAQ,CAAU,EAI/FU,GAAKV,EAAE,CAClB,GAAI,KAAM,GAAI,KAAM,SAAU,WAAY,YAAa,cAAe,WAAY,aAAc,SAAU,WAC1G,GAAI,KAAM,GAAI,KAAM,GAAI,KAAM,GAAI,KAAM,QAAS,UAAW,WAAY,aAAc,GAAI,KAAM,IAAK,MAAO,MAAO,QAAS,SAAU,UACxI,CAAU,EAIGW,GAAYX,EAAE,CAAE,MAAO,QAAS,KAAM,MAAO,CAAU",
|
|
6
|
-
"names": ["field", "Cls", "name", "label", "c", "ui", "TextField", "TextArea", "NumberField", "DateField", "DateRangeField", "SecretField", "Slider", "Dial", "boxLabel", "Checkbox", "Toggle", "options", "RadioGroup", "CheckboxGroup", "Select", "ComboBox", "query", "SuggestField", "lookup", "LookupField", "text", "handler", "Button", "items", "Container", "columns", "title", "Panel", "Toolbar", "Form", "e", "o", "Variant", "LabelPos", "Direction", "Region", "Side", "LayoutKind", "Selection", "ToastType", "Op", "ThemeName"]
|
|
7
|
-
}
|
package/dist/chunk-4LZZ244E.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b}from"./chunk-LQRFNQ2N.js";import{b as a,c as f}from"./chunk-676AKAGF.js";import{a as l,b as m}from"./chunk-VV7CFMPZ.js";import{b as v,c as u}from"./chunk-4AA4FQEM.js";import{c as n}from"./chunk-2UPUC4RK.js";import{b as h}from"./chunk-PZSHOSOS.js";import{a as p}from"./chunk-TIPK3SCJ.js";var d=class extends b{baseCls="op-panel op-window";backdrop;visible=!1;cleanup=[];opener=null;moved=!1;leaving=0;constructor(e={}){super({closable:!0,...e})}onRender(){super.onRender();let e=this.config;this.el.setAttribute("role","dialog"),this.el.tabIndex=-1,e.modal!==!1&&this.el.setAttribute("aria-modal","true"),e.draggable!==!1&&this.initDrag()}initDrag(){this.headerEl.classList.add("op-window__handle"),this.listen(this.headerEl,"pointerdown",e=>{if(e.target.closest(".op-panel__tool")||e.button)return;let t=this.el.getBoundingClientRect(),o=e.clientX-t.left,s=e.clientY-t.top;this.el.classList.add("is-dragging");let i=c=>{this.el.style.left=`${Math.max(0,Math.min(c.clientX-o,innerWidth-40))}px`,this.el.style.top=`${Math.max(0,Math.min(c.clientY-s,innerHeight-40))}px`,this.moved=!0},r=()=>{this.el.classList.remove("is-dragging"),document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",r)};document.addEventListener("pointermove",i),document.addEventListener("pointerup",r),this.cleanup.push(r)})}setMask(e){this.config.mask=e,this.backdrop?.classList.toggle("is-clear",!e)}isVisible(){return this.visible}center(){let e=this.el;e.style.left=`${Math.max(0,(innerWidth-e.offsetWidth)/2)}px`,e.style.top=`${Math.max(0,(innerHeight-e.offsetHeight)/3)}px`}show(){if(this.visible||this.destroyed||this.emit("before-show")===!1)return;let e=this.config,t=this.el;this.opener=document.activeElement,e.modal!==!1?(this.backdrop=h("div",`op-window-backdrop${e.mask===!1?" is-clear":""}`,{},t),a(this.backdrop,this.opener),this.cleanup.push(f(this.backdrop)),this.listen(this.backdrop,"pointerdown",i=>{i.target===this.backdrop&&(e.closeOnBackdrop?this.close():t.focus())})):a(t,this.opener),this.visible=!0,this.leaving++,t.getAnimations?.().forEach(i=>i.cancel()),this.notifyMount(),this.center(),v(t,this.opener??void 0,"modal"),this.backdrop?.animate?.([{opacity:0},{opacity:1}],{duration:n.ms("modal"),easing:n.easing("enter")}),this.cleanup.push(m(t));let o=i=>{i.key==="Escape"&&e.closeOnEsc!==!1&&!i.defaultPrevented&&(i.stopPropagation(),this.close())};t.addEventListener("keydown",o);let s=()=>!this.moved&&this.center();window.addEventListener("resize",s),this.cleanup.push(()=>t.removeEventListener("keydown",o),()=>window.removeEventListener("resize",s)),e.autoFocus?this.focusFirst():t.focus(),this.emit("show")}focusFirst(){let e=l(this.bodyEl)[0],t=this.el.querySelector(".op-panel__footer .op-button--primary");(e??t??l(this.el).find(o=>!o.classList.contains("op-panel__tool"))??this.el).focus()}hide(){!this.visible||this.emit("before-hide")===!1||(this.release(),this.emit("hide"))}release(e=!0){this.visible=!1,this.cleanup.splice(0).reverse().forEach(i=>i());let t=this.backdrop;this.backdrop=void 0;let o=t??this.el,s=e?u(this.el,this.opener??void 0,"modal"):null;if(s){let i=++this.leaving;t?.animate?.([{opacity:1},{opacity:0}],{duration:n.ms("modal","exit"),easing:n.easing("exit"),fill:"forwards"}),s.then(()=>i===this.leaving&&!this.visible&&(o.remove(),t?.remove()))}else o.remove(),t?.remove();this.opener instanceof HTMLElement&&this.opener.isConnected&&this.opener.focus()}onDestroy(){this.visible?this.release(!1):this.leaving&&(this.el.closest(".op-window-backdrop")??this.el).remove(),super.onDestroy()}};p("window",d);export{d as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4LZZ244E.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/components/overlays/window/window.ts"],
|
|
4
|
-
"sourcesContent": ["import { Panel, type PanelConfig } from '../../layout/panel/panel';\nimport { register } from '../../../core/registry';\nimport { h } from '../../../core/dom';\nimport { toLayer, lockModal } from '../../../core/layer';\nimport { trapFocus, focusables } from '../../../core/focus';\nimport { popIn, popOut } from '../../../motion/core';\nimport { motion } from '../../../motion/config';\n\nexport interface WindowConfig extends PanelConfig {\n modal?: boolean;\n /** Dims the page behind a modal window. `false` keeps it modal (inert page, trapped focus) but clear. Default true. */\n mask?: boolean;\n draggable?: boolean;\n closeOnEsc?: boolean;\n closeOnBackdrop?: boolean;\n /**\n * On show the focus goes to the dialog itself (it is modal: the focus must be inside), so a phone keyboard does not\n * pop up. `true` focuses its first field instead. Default false.\n */\n autoFocus?: boolean;\n}\n\n/** Floating dialog. Modal by default: the page behind becomes inert and Tab stays inside. */\nexport class Window extends Panel<WindowConfig> {\n protected override baseCls = 'op-panel op-window';\n private backdrop?: HTMLElement;\n private visible = false;\n private cleanup: Array<() => void> = [];\n private opener: Element | null = null;\n private moved = false;\n private leaving = 0;\n\n constructor(config: WindowConfig = {}) {\n super({ closable: true, ...config });\n }\n\n protected override onRender() {\n super.onRender();\n const c = this.config;\n this.el.setAttribute('role', 'dialog');\n this.el.tabIndex = -1;\n if (c.modal !== false) this.el.setAttribute('aria-modal', 'true');\n if (c.draggable !== false) this.initDrag();\n }\n\n private initDrag() {\n this.headerEl.classList.add('op-window__handle');\n this.listen(this.headerEl, 'pointerdown', (e: PointerEvent) => {\n if ((e.target as HTMLElement).closest('.op-panel__tool') || e.button) return;\n const r = this.el.getBoundingClientRect();\n const dx = e.clientX - r.left;\n const dy = e.clientY - r.top;\n this.el.classList.add('is-dragging');\n const move = (m: PointerEvent) => {\n this.el.style.left = `${Math.max(0, Math.min(m.clientX - dx, innerWidth - 40))}px`;\n this.el.style.top = `${Math.max(0, Math.min(m.clientY - dy, innerHeight - 40))}px`;\n this.moved = true;\n };\n const up = () => {\n this.el.classList.remove('is-dragging');\n document.removeEventListener('pointermove', move);\n document.removeEventListener('pointerup', up);\n };\n document.addEventListener('pointermove', move);\n document.addEventListener('pointerup', up);\n this.cleanup.push(up);\n });\n }\n\n /** Dims (true) or not (false) the page behind the modal window. */\n setMask(mask: boolean): void {\n this.config.mask = mask;\n this.backdrop?.classList.toggle('is-clear', !mask);\n }\n\n isVisible(): boolean {\n return this.visible;\n }\n\n /** Centers in the viewport (also done on show and on resize until the user drags it). */\n center(): void {\n const el = this.el;\n el.style.left = `${Math.max(0, (innerWidth - el.offsetWidth) / 2)}px`;\n el.style.top = `${Math.max(0, (innerHeight - el.offsetHeight) / 3)}px`;\n }\n\n override show(): void {\n if (this.visible || this.destroyed || this.emit('before-show') === false) return;\n const c = this.config;\n const el = this.el;\n this.opener = document.activeElement;\n if (c.modal !== false) {\n this.backdrop = h('div', `op-window-backdrop${c.mask === false ? ' is-clear' : ''}`, {}, el);\n toLayer(this.backdrop, this.opener);\n this.cleanup.push(lockModal(this.backdrop));\n this.listen(this.backdrop, 'pointerdown', (e: Event) => {\n if (e.target !== this.backdrop) return;\n if (c.closeOnBackdrop) this.close();\n else el.focus();\n });\n } else toLayer(el, this.opener);\n this.visible = true;\n this.leaving++;\n el.getAnimations?.().forEach((a) => a.cancel());\n this.notifyMount();\n this.center();\n void popIn(el, this.opener ?? undefined, 'modal'); // grows out of the button that opened it\n this.backdrop?.animate?.([{ opacity: 0 }, { opacity: 1 }], { duration: motion.ms('modal'), easing: motion.easing('enter') });\n this.cleanup.push(trapFocus(el));\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && c.closeOnEsc !== false && !e.defaultPrevented) {\n e.stopPropagation();\n this.close();\n }\n };\n el.addEventListener('keydown', onKey);\n const onResize = () => !this.moved && this.center();\n window.addEventListener('resize', onResize);\n this.cleanup.push(() => el.removeEventListener('keydown', onKey), () => window.removeEventListener('resize', onResize));\n if (c.autoFocus) this.focusFirst();\n else el.focus();\n this.emit('show');\n }\n\n private focusFirst() {\n const inBody = focusables(this.bodyEl)[0];\n const primary = this.el.querySelector<HTMLElement>('.op-panel__footer .op-button--primary');\n (inBody ?? primary ?? focusables(this.el).find((e) => !e.classList.contains('op-panel__tool')) ?? this.el).focus();\n }\n\n override hide(): void {\n if (!this.visible || this.emit('before-hide') === false) return;\n this.release();\n this.emit('hide');\n }\n\n /** Cleans up at once (the page is usable again) and takes the window off the screen: shrinking toward its opener, 20 % faster than it came. */\n private release(animate = true) {\n this.visible = false;\n this.cleanup.splice(0).reverse().forEach((f) => f());\n const bd = this.backdrop;\n this.backdrop = undefined;\n const target = bd ?? this.el;\n const out = animate ? popOut(this.el, this.opener ?? undefined, 'modal') : null;\n if (out) {\n const id = ++this.leaving;\n bd?.animate?.([{ opacity: 1 }, { opacity: 0 }], { duration: motion.ms('modal', 'exit'), easing: motion.easing('exit'), fill: 'forwards' });\n void out.then(() => id === this.leaving && !this.visible && (target.remove(), bd?.remove()));\n } else {\n target.remove();\n bd?.remove();\n }\n if (this.opener instanceof HTMLElement && this.opener.isConnected) this.opener.focus();\n }\n\n protected override onDestroy() {\n if (this.visible) this.release(false);\n else if (this.leaving) (this.el.closest('.op-window-backdrop') ?? this.el).remove();\n super.onDestroy();\n }\n}\nregister('window', Window);\n"],
|
|
5
|
-
"mappings": "6SAuBO,IAAMA,EAAN,cAAqBC,CAAoB,CAC3B,QAAU,qBACrB,SACA,QAAU,GACV,QAA6B,CAAC,EAC9B,OAAyB,KACzB,MAAQ,GACR,QAAU,EAElB,YAAYC,EAAuB,CAAC,EAAG,CACrC,MAAM,CAAE,SAAU,GAAM,GAAGA,CAAO,CAAC,CACrC,CAEmB,UAAW,CAC5B,MAAM,SAAS,EACf,IAAMC,EAAI,KAAK,OACf,KAAK,GAAG,aAAa,OAAQ,QAAQ,EACrC,KAAK,GAAG,SAAW,GACfA,EAAE,QAAU,IAAO,KAAK,GAAG,aAAa,aAAc,MAAM,EAC5DA,EAAE,YAAc,IAAO,KAAK,SAAS,CAC3C,CAEQ,UAAW,CACjB,KAAK,SAAS,UAAU,IAAI,mBAAmB,EAC/C,KAAK,OAAO,KAAK,SAAU,cAAgB,GAAoB,CAC7D,GAAK,EAAE,OAAuB,QAAQ,iBAAiB,GAAK,EAAE,OAAQ,OACtE,IAAMC,EAAI,KAAK,GAAG,sBAAsB,EAClCC,EAAK,EAAE,QAAUD,EAAE,KACnBE,EA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CAAC,GAAK,KAAK,IAAI,MAAM,CACnH,CAES,MAAa,CAChB,CAAC,KAAK,SAAW,KAAK,KAAK,aAAa,IAAM,KAClD,KAAK,QAAQ,EACb,KAAK,KAAK,MAAM,EAClB,CAGQ,QAAQU,EAAU,GAAM,CAC9B,KAAK,QAAU,GACf,KAAK,QAAQ,OAAO,CAAC,EAAE,QAAQ,EAAE,QAASC,GAAMA,EAAE,CAAC,EACnD,IAAMC,EAAK,KAAK,SAChB,KAAK,SAAW,OAChB,IAAMC,EAASD,GAAM,KAAK,GACpBE,EAAMJ,EAAUK,EAAO,KAAK,GAAI,KAAK,QAAU,OAAW,OAAO,EAAI,KAC3E,GAAID,EAAK,CACP,IAAME,EAAK,EAAE,KAAK,QAClBJ,GAAI,UAAU,CAAC,CAAE,QAAS,CAAE,EAAG,CAAE,QAAS,CAAE,CAAC,EAAG,CAAE,SAAUT,EAAO,GAAG,QAAS,MAAM,EAAG,OAAQA,EAAO,OAAO,MAAM,EAAG,KAAM,UAAW,CAAC,EACpIW,EAAI,KAAK,IAAME,IAAO,KAAK,SAAW,CAAC,KAAK,UAAYH,EAAO,OAAO,EAAGD,GAAI,OAAO,EAAE,CAC7F,MACEC,EAAO,OAAO,EACdD,GAAI,OAAO,EAET,KAAK,kBAAkB,aAAe,KAAK,OAAO,aAAa,KAAK,OAAO,MAAM,CACvF,CAEmB,WAAY,CACzB,KAAK,QAAS,KAAK,QAAQ,EAAK,EAC3B,KAAK,UAAU,KAAK,GAAG,QAAQ,qBAAqB,GAAK,KAAK,IAAI,OAAO,EAClF,MAAM,UAAU,CAClB,CACF,EACAK,EAAS,SAAU/B,CAAM",
|
|
6
|
-
"names": ["Window", "Panel", "config", "c", "r", "dx", "dy", "move", "m", "up", "mask", "el", "toLayer", "lockModal", "e", "a", "popIn", "motion", "trapFocus", "onKey", "onResize", "inBody", "focusables", "primary", "animate", "f", "bd", "target", "out", "popOut", "id", "register"]
|
|
7
|
-
}
|