@elaraai/east-ui 0.0.1-beta.5 → 0.0.1-beta.7
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/README.md +2 -2
- package/dist/src/buttons/button/index.d.ts +7 -5
- package/dist/src/buttons/button/index.d.ts.map +1 -1
- package/dist/src/buttons/button/index.js +9 -13
- package/dist/src/buttons/button/index.js.map +1 -1
- package/dist/src/buttons/button/types.d.ts +7 -1
- package/dist/src/buttons/button/types.d.ts.map +1 -1
- package/dist/src/buttons/button/types.js +3 -1
- package/dist/src/buttons/button/types.js.map +1 -1
- package/dist/src/buttons/icon-button/index.d.ts +13 -32
- package/dist/src/buttons/icon-button/index.d.ts.map +1 -1
- package/dist/src/buttons/icon-button/index.js +13 -33
- package/dist/src/buttons/icon-button/index.js.map +1 -1
- package/dist/src/buttons/icon-button/types.d.ts +45 -38
- package/dist/src/buttons/icon-button/types.d.ts.map +1 -1
- package/dist/src/buttons/icon-button/types.js +5 -2
- package/dist/src/buttons/icon-button/types.js.map +1 -1
- package/dist/src/charts/area/index.d.ts +16 -31
- package/dist/src/charts/area/index.d.ts.map +1 -1
- package/dist/src/charts/area/index.js +16 -31
- package/dist/src/charts/area/index.js.map +1 -1
- package/dist/src/charts/area/types.d.ts +22 -1
- package/dist/src/charts/area/types.d.ts.map +1 -1
- package/dist/src/charts/bar/index.d.ts +12 -39
- package/dist/src/charts/bar/index.d.ts.map +1 -1
- package/dist/src/charts/bar/index.js +12 -39
- package/dist/src/charts/bar/index.js.map +1 -1
- package/dist/src/charts/bar/types.d.ts +23 -1
- package/dist/src/charts/bar/types.d.ts.map +1 -1
- package/dist/src/charts/bar-list/index.d.ts +11 -14
- package/dist/src/charts/bar-list/index.d.ts.map +1 -1
- package/dist/src/charts/bar-list/index.js +11 -14
- package/dist/src/charts/bar-list/index.js.map +1 -1
- package/dist/src/charts/bar-list/types.d.ts +9 -0
- package/dist/src/charts/bar-list/types.d.ts.map +1 -1
- package/dist/src/charts/bar-segment/index.d.ts +10 -13
- package/dist/src/charts/bar-segment/index.d.ts.map +1 -1
- package/dist/src/charts/bar-segment/index.js +10 -13
- package/dist/src/charts/bar-segment/index.js.map +1 -1
- package/dist/src/charts/bar-segment/types.d.ts +7 -0
- package/dist/src/charts/bar-segment/types.d.ts.map +1 -1
- package/dist/src/charts/line/index.d.ts +18 -17
- package/dist/src/charts/line/index.d.ts.map +1 -1
- package/dist/src/charts/line/index.js +18 -17
- package/dist/src/charts/line/index.js.map +1 -1
- package/dist/src/charts/line/types.d.ts +18 -1
- package/dist/src/charts/line/types.d.ts.map +1 -1
- package/dist/src/charts/pie/index.d.ts +11 -18
- package/dist/src/charts/pie/index.d.ts.map +1 -1
- package/dist/src/charts/pie/index.js +11 -18
- package/dist/src/charts/pie/index.js.map +1 -1
- package/dist/src/charts/pie/types.d.ts +10 -0
- package/dist/src/charts/pie/types.d.ts.map +1 -1
- package/dist/src/charts/radar/index.d.ts +15 -16
- package/dist/src/charts/radar/index.d.ts.map +1 -1
- package/dist/src/charts/radar/index.js +15 -16
- package/dist/src/charts/radar/index.js.map +1 -1
- package/dist/src/charts/radar/types.d.ts +15 -1
- package/dist/src/charts/radar/types.d.ts.map +1 -1
- package/dist/src/charts/scatter/index.d.ts +12 -13
- package/dist/src/charts/scatter/index.d.ts.map +1 -1
- package/dist/src/charts/scatter/index.js +12 -13
- package/dist/src/charts/scatter/index.js.map +1 -1
- package/dist/src/charts/scatter/types.d.ts +14 -1
- package/dist/src/charts/scatter/types.d.ts.map +1 -1
- package/dist/src/collections/data-list/index.d.ts +19 -40
- package/dist/src/collections/data-list/index.d.ts.map +1 -1
- package/dist/src/collections/data-list/index.js +19 -40
- package/dist/src/collections/data-list/index.js.map +1 -1
- package/dist/src/collections/data-list/types.d.ts +10 -6
- package/dist/src/collections/data-list/types.d.ts.map +1 -1
- package/dist/src/collections/data-list/types.js +10 -6
- package/dist/src/collections/data-list/types.js.map +1 -1
- package/dist/src/collections/gantt/index.d.ts +4668 -968
- package/dist/src/collections/gantt/index.d.ts.map +1 -1
- package/dist/src/collections/gantt/index.js +133 -81
- package/dist/src/collections/gantt/index.js.map +1 -1
- package/dist/src/collections/gantt/types.d.ts +336 -56
- package/dist/src/collections/gantt/types.d.ts.map +1 -1
- package/dist/src/collections/gantt/types.js +142 -2
- package/dist/src/collections/gantt/types.js.map +1 -1
- package/dist/src/collections/table/index.d.ts +11350 -8517
- package/dist/src/collections/table/index.d.ts.map +1 -1
- package/dist/src/collections/table/index.js +64 -53
- package/dist/src/collections/table/index.js.map +1 -1
- package/dist/src/collections/table/types.d.ts +155 -17
- package/dist/src/collections/table/types.d.ts.map +1 -1
- package/dist/src/collections/table/types.js +78 -14
- package/dist/src/collections/table/types.js.map +1 -1
- package/dist/src/collections/tree-view/index.d.ts +42 -70
- package/dist/src/collections/tree-view/index.d.ts.map +1 -1
- package/dist/src/collections/tree-view/index.js +40 -71
- package/dist/src/collections/tree-view/index.js.map +1 -1
- package/dist/src/collections/tree-view/types.d.ts +24 -1
- package/dist/src/collections/tree-view/types.d.ts.map +1 -1
- package/dist/src/collections/tree-view/types.js +7 -1
- package/dist/src/collections/tree-view/types.js.map +1 -1
- package/dist/src/component.d.ts +688 -21
- package/dist/src/component.d.ts.map +1 -1
- package/dist/src/component.js +15 -23
- package/dist/src/component.js.map +1 -1
- package/dist/src/container/card/index.d.ts +1387 -64
- package/dist/src/container/card/index.d.ts.map +1 -1
- package/dist/src/container/card/index.js +11 -20
- package/dist/src/container/card/index.js.map +1 -1
- package/dist/src/container/card/types.d.ts +3 -4
- package/dist/src/container/card/types.d.ts.map +1 -1
- package/dist/src/container/card/types.js +3 -4
- package/dist/src/container/card/types.js.map +1 -1
- package/dist/src/disclosure/accordion/index.d.ts +2923 -277
- package/dist/src/disclosure/accordion/index.d.ts.map +1 -1
- package/dist/src/disclosure/accordion/index.js +35 -65
- package/dist/src/disclosure/accordion/index.js.map +1 -1
- package/dist/src/disclosure/accordion/types.d.ts +6 -1
- package/dist/src/disclosure/accordion/types.d.ts.map +1 -1
- package/dist/src/disclosure/accordion/types.js +3 -1
- package/dist/src/disclosure/accordion/types.js.map +1 -1
- package/dist/src/disclosure/carousel/index.d.ts +1391 -89
- package/dist/src/disclosure/carousel/index.d.ts.map +1 -1
- package/dist/src/disclosure/carousel/index.js +15 -46
- package/dist/src/disclosure/carousel/index.js.map +1 -1
- package/dist/src/disclosure/carousel/types.d.ts +9 -3
- package/dist/src/disclosure/carousel/types.d.ts.map +1 -1
- package/dist/src/disclosure/carousel/types.js +4 -1
- package/dist/src/disclosure/carousel/types.js.map +1 -1
- package/dist/src/disclosure/tabs/index.d.ts +2911 -283
- package/dist/src/disclosure/tabs/index.d.ts.map +1 -1
- package/dist/src/disclosure/tabs/index.js +18 -56
- package/dist/src/disclosure/tabs/index.js.map +1 -1
- package/dist/src/disclosure/tabs/types.d.ts +6 -1
- package/dist/src/disclosure/tabs/types.d.ts.map +1 -1
- package/dist/src/disclosure/tabs/types.js +3 -1
- package/dist/src/disclosure/tabs/types.js.map +1 -1
- package/dist/src/display/avatar/index.d.ts +8 -33
- package/dist/src/display/avatar/index.d.ts.map +1 -1
- package/dist/src/display/avatar/index.js +8 -33
- package/dist/src/display/avatar/index.js.map +1 -1
- package/dist/src/display/badge/index.d.ts +7 -22
- package/dist/src/display/badge/index.d.ts.map +1 -1
- package/dist/src/display/badge/index.js +7 -22
- package/dist/src/display/badge/index.js.map +1 -1
- package/dist/src/display/icon/index.d.ts +4 -36
- package/dist/src/display/icon/index.d.ts.map +1 -1
- package/dist/src/display/icon/index.js +4 -36
- package/dist/src/display/icon/index.js.map +1 -1
- package/dist/src/display/icon/types.d.ts +1 -0
- package/dist/src/display/icon/types.d.ts.map +1 -1
- package/dist/src/display/icon/types.js +1 -0
- package/dist/src/display/icon/types.js.map +1 -1
- package/dist/src/display/stat/index.d.ts +18 -40
- package/dist/src/display/stat/index.d.ts.map +1 -1
- package/dist/src/display/stat/index.js +18 -40
- package/dist/src/display/stat/index.js.map +1 -1
- package/dist/src/display/stat/types.d.ts +10 -6
- package/dist/src/display/stat/types.d.ts.map +1 -1
- package/dist/src/display/stat/types.js +10 -6
- package/dist/src/display/stat/types.js.map +1 -1
- package/dist/src/display/tag/index.d.ts +10 -30
- package/dist/src/display/tag/index.d.ts.map +1 -1
- package/dist/src/display/tag/index.js +13 -38
- package/dist/src/display/tag/index.js.map +1 -1
- package/dist/src/display/tag/types.d.ts +6 -1
- package/dist/src/display/tag/types.d.ts.map +1 -1
- package/dist/src/display/tag/types.js +3 -1
- package/dist/src/display/tag/types.js.map +1 -1
- package/dist/src/feedback/alert/index.d.ts +7 -39
- package/dist/src/feedback/alert/index.d.ts.map +1 -1
- package/dist/src/feedback/alert/index.js +7 -39
- package/dist/src/feedback/alert/index.js.map +1 -1
- package/dist/src/feedback/alert/types.d.ts +24 -13
- package/dist/src/feedback/alert/types.d.ts.map +1 -1
- package/dist/src/feedback/alert/types.js +24 -13
- package/dist/src/feedback/alert/types.js.map +1 -1
- package/dist/src/feedback/progress/index.d.ts +8 -42
- package/dist/src/feedback/progress/index.d.ts.map +1 -1
- package/dist/src/feedback/progress/index.js +8 -42
- package/dist/src/feedback/progress/index.js.map +1 -1
- package/dist/src/feedback/progress/types.d.ts +10 -5
- package/dist/src/feedback/progress/types.d.ts.map +1 -1
- package/dist/src/feedback/progress/types.js +10 -5
- package/dist/src/feedback/progress/types.js.map +1 -1
- package/dist/src/forms/checkbox/index.d.ts +13 -23
- package/dist/src/forms/checkbox/index.d.ts.map +1 -1
- package/dist/src/forms/checkbox/index.js +21 -39
- package/dist/src/forms/checkbox/index.js.map +1 -1
- package/dist/src/forms/checkbox/types.d.ts +20 -15
- package/dist/src/forms/checkbox/types.d.ts.map +1 -1
- package/dist/src/forms/checkbox/types.js +3 -1
- package/dist/src/forms/checkbox/types.js.map +1 -1
- package/dist/src/forms/field/index.d.ts +688 -7140
- package/dist/src/forms/field/index.d.ts.map +1 -1
- package/dist/src/forms/field/index.js +531 -90
- package/dist/src/forms/field/index.js.map +1 -1
- package/dist/src/forms/field/types.d.ts +730 -4
- package/dist/src/forms/field/types.d.ts.map +1 -1
- package/dist/src/forms/field/types.js +83 -1
- package/dist/src/forms/field/types.js.map +1 -1
- package/dist/src/forms/file-upload/index.d.ts +22 -52
- package/dist/src/forms/file-upload/index.d.ts.map +1 -1
- package/dist/src/forms/file-upload/index.js +15 -54
- package/dist/src/forms/file-upload/index.js.map +1 -1
- package/dist/src/forms/file-upload/types.d.ts +52 -1
- package/dist/src/forms/file-upload/types.d.ts.map +1 -1
- package/dist/src/forms/file-upload/types.js +32 -1
- package/dist/src/forms/file-upload/types.js.map +1 -1
- package/dist/src/forms/index.d.ts +1 -2
- package/dist/src/forms/index.d.ts.map +1 -1
- package/dist/src/forms/index.js +1 -2
- package/dist/src/forms/index.js.map +1 -1
- package/dist/src/forms/input/index.d.ts +70 -8
- package/dist/src/forms/input/index.d.ts.map +1 -1
- package/dist/src/forms/input/index.js +94 -93
- package/dist/src/forms/input/index.js.map +1 -1
- package/dist/src/forms/input/types.d.ts +203 -99
- package/dist/src/forms/input/types.d.ts.map +1 -1
- package/dist/src/forms/input/types.js +49 -26
- package/dist/src/forms/input/types.js.map +1 -1
- package/dist/src/forms/select/index.d.ts +22 -15
- package/dist/src/forms/select/index.d.ts.map +1 -1
- package/dist/src/forms/select/index.js +33 -34
- package/dist/src/forms/select/index.js.map +1 -1
- package/dist/src/forms/select/types.d.ts +44 -5
- package/dist/src/forms/select/types.d.ts.map +1 -1
- package/dist/src/forms/select/types.js +7 -1
- package/dist/src/forms/select/types.js.map +1 -1
- package/dist/src/forms/slider/index.d.ts +15 -31
- package/dist/src/forms/slider/index.d.ts.map +1 -1
- package/dist/src/forms/slider/index.js +26 -50
- package/dist/src/forms/slider/index.js.map +1 -1
- package/dist/src/forms/slider/types.d.ts +19 -7
- package/dist/src/forms/slider/types.d.ts.map +1 -1
- package/dist/src/forms/slider/types.js +13 -7
- package/dist/src/forms/slider/types.js.map +1 -1
- package/dist/src/forms/switch/index.d.ts +26 -23
- package/dist/src/forms/switch/index.d.ts.map +1 -1
- package/dist/src/forms/switch/index.js +33 -38
- package/dist/src/forms/switch/index.js.map +1 -1
- package/dist/src/forms/switch/types.d.ts +20 -15
- package/dist/src/forms/switch/types.d.ts.map +1 -1
- package/dist/src/forms/switch/types.js +3 -1
- package/dist/src/forms/switch/types.js.map +1 -1
- package/dist/src/forms/tags-input/index.d.ts +20 -50
- package/dist/src/forms/tags-input/index.d.ts.map +1 -1
- package/dist/src/forms/tags-input/index.js +24 -52
- package/dist/src/forms/tags-input/index.js.map +1 -1
- package/dist/src/forms/tags-input/types.d.ts +19 -1
- package/dist/src/forms/tags-input/types.d.ts.map +1 -1
- package/dist/src/forms/tags-input/types.js +10 -1
- package/dist/src/forms/tags-input/types.js.map +1 -1
- package/dist/src/forms/textarea/index.d.ts +20 -47
- package/dist/src/forms/textarea/index.d.ts.map +1 -1
- package/dist/src/forms/textarea/index.js +24 -49
- package/dist/src/forms/textarea/index.js.map +1 -1
- package/dist/src/forms/textarea/types.d.ts +25 -4
- package/dist/src/forms/textarea/types.d.ts.map +1 -1
- package/dist/src/forms/textarea/types.js +13 -4
- package/dist/src/forms/textarea/types.js.map +1 -1
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +0 -1
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +0 -1
- package/dist/src/internal.js.map +1 -1
- package/dist/src/layout/box/index.d.ts +1463 -71
- package/dist/src/layout/box/index.d.ts.map +1 -1
- package/dist/src/layout/box/index.js +48 -32
- package/dist/src/layout/box/index.js.map +1 -1
- package/dist/src/layout/box/types.d.ts +52 -2
- package/dist/src/layout/box/types.d.ts.map +1 -1
- package/dist/src/layout/box/types.js +15 -1
- package/dist/src/layout/box/types.js.map +1 -1
- package/dist/src/layout/flex/index.d.ts +8915 -0
- package/dist/src/layout/flex/index.d.ts.map +1 -0
- package/dist/src/layout/flex/index.js +291 -0
- package/dist/src/layout/flex/index.js.map +1 -0
- package/dist/src/layout/flex/types.d.ts +176 -0
- package/dist/src/layout/flex/types.d.ts.map +1 -0
- package/dist/src/layout/flex/types.js +56 -0
- package/dist/src/layout/flex/types.js.map +1 -0
- package/dist/src/layout/grid/index.d.ts +2907 -268
- package/dist/src/layout/grid/index.d.ts.map +1 -1
- package/dist/src/layout/grid/index.js +12 -37
- package/dist/src/layout/grid/index.js.map +1 -1
- package/dist/src/layout/grid/types.d.ts +11 -3
- package/dist/src/layout/grid/types.d.ts.map +1 -1
- package/dist/src/layout/grid/types.js +11 -3
- package/dist/src/layout/grid/types.js.map +1 -1
- package/dist/src/layout/index.d.ts +1 -0
- package/dist/src/layout/index.d.ts.map +1 -1
- package/dist/src/layout/index.js +1 -0
- package/dist/src/layout/index.js.map +1 -1
- package/dist/src/layout/separator/index.d.ts +7 -19
- package/dist/src/layout/separator/index.d.ts.map +1 -1
- package/dist/src/layout/separator/index.js +7 -19
- package/dist/src/layout/separator/index.js.map +1 -1
- package/dist/src/layout/splitter/index.d.ts +2948 -298
- package/dist/src/layout/splitter/index.d.ts.map +1 -1
- package/dist/src/layout/splitter/index.js +41 -74
- package/dist/src/layout/splitter/index.js.map +1 -1
- package/dist/src/layout/splitter/types.d.ts +31 -3
- package/dist/src/layout/splitter/types.d.ts.map +1 -1
- package/dist/src/layout/splitter/types.js +15 -1
- package/dist/src/layout/splitter/types.js.map +1 -1
- package/dist/src/layout/stack/index.d.ts +1469 -61
- package/dist/src/layout/stack/index.d.ts.map +1 -1
- package/dist/src/layout/stack/index.js +54 -22
- package/dist/src/layout/stack/index.js.map +1 -1
- package/dist/src/layout/stack/types.d.ts +52 -2
- package/dist/src/layout/stack/types.d.ts.map +1 -1
- package/dist/src/layout/stack/types.js +15 -1
- package/dist/src/layout/stack/types.js.map +1 -1
- package/dist/src/overlays/action-bar/index.d.ts +24 -43
- package/dist/src/overlays/action-bar/index.d.ts.map +1 -1
- package/dist/src/overlays/action-bar/index.js +19 -41
- package/dist/src/overlays/action-bar/index.js.map +1 -1
- package/dist/src/overlays/action-bar/types.d.ts +23 -2
- package/dist/src/overlays/action-bar/types.d.ts.map +1 -1
- package/dist/src/overlays/action-bar/types.js +8 -2
- package/dist/src/overlays/action-bar/types.js.map +1 -1
- package/dist/src/overlays/dialog/index.d.ts +2769 -118
- package/dist/src/overlays/dialog/index.d.ts.map +1 -1
- package/dist/src/overlays/dialog/index.js +17 -35
- package/dist/src/overlays/dialog/index.js.map +1 -1
- package/dist/src/overlays/dialog/types.d.ts +42 -1
- package/dist/src/overlays/dialog/types.d.ts.map +1 -1
- package/dist/src/overlays/dialog/types.js +13 -1
- package/dist/src/overlays/dialog/types.js.map +1 -1
- package/dist/src/overlays/drawer/index.d.ts +2763 -117
- package/dist/src/overlays/drawer/index.d.ts.map +1 -1
- package/dist/src/overlays/drawer/index.js +14 -34
- package/dist/src/overlays/drawer/index.js.map +1 -1
- package/dist/src/overlays/drawer/types.d.ts +25 -1
- package/dist/src/overlays/drawer/types.d.ts.map +1 -1
- package/dist/src/overlays/drawer/types.js +7 -1
- package/dist/src/overlays/drawer/types.js.map +1 -1
- package/dist/src/overlays/hover-card/index.d.ts +2763 -122
- package/dist/src/overlays/hover-card/index.d.ts.map +1 -1
- package/dist/src/overlays/hover-card/index.js +16 -39
- package/dist/src/overlays/hover-card/index.js.map +1 -1
- package/dist/src/overlays/hover-card/types.d.ts +17 -1
- package/dist/src/overlays/hover-card/types.d.ts.map +1 -1
- package/dist/src/overlays/hover-card/types.js +4 -1
- package/dist/src/overlays/hover-card/types.js.map +1 -1
- package/dist/src/overlays/menu/index.d.ts +1415 -86
- package/dist/src/overlays/menu/index.d.ts.map +1 -1
- package/dist/src/overlays/menu/index.js +39 -42
- package/dist/src/overlays/menu/index.js.map +1 -1
- package/dist/src/overlays/menu/types.d.ts +13 -1
- package/dist/src/overlays/menu/types.d.ts.map +1 -1
- package/dist/src/overlays/menu/types.js +7 -3
- package/dist/src/overlays/menu/types.js.map +1 -1
- package/dist/src/overlays/popover/index.d.ts +2760 -120
- package/dist/src/overlays/popover/index.d.ts.map +1 -1
- package/dist/src/overlays/popover/index.js +13 -37
- package/dist/src/overlays/popover/index.js.map +1 -1
- package/dist/src/overlays/popover/types.d.ts +22 -1
- package/dist/src/overlays/popover/types.d.ts.map +1 -1
- package/dist/src/overlays/popover/types.js +4 -1
- package/dist/src/overlays/popover/types.js.map +1 -1
- package/dist/src/overlays/toggle-tip/index.d.ts +1387 -72
- package/dist/src/overlays/toggle-tip/index.d.ts.map +1 -1
- package/dist/src/overlays/toggle-tip/index.js +11 -29
- package/dist/src/overlays/toggle-tip/index.js.map +1 -1
- package/dist/src/overlays/toggle-tip/types.d.ts +26 -13
- package/dist/src/overlays/toggle-tip/types.d.ts.map +1 -1
- package/dist/src/overlays/toggle-tip/types.js +4 -1
- package/dist/src/overlays/toggle-tip/types.js.map +1 -1
- package/dist/src/overlays/tooltip/index.d.ts +1384 -78
- package/dist/src/overlays/tooltip/index.d.ts.map +1 -1
- package/dist/src/overlays/tooltip/index.js +8 -34
- package/dist/src/overlays/tooltip/index.js.map +1 -1
- package/dist/src/overlays/tooltip/types.d.ts +12 -3
- package/dist/src/overlays/tooltip/types.d.ts.map +1 -1
- package/dist/src/overlays/tooltip/types.js +12 -3
- package/dist/src/overlays/tooltip/types.js.map +1 -1
- package/dist/src/platform/index.d.ts +217 -1
- package/dist/src/platform/index.d.ts.map +1 -1
- package/dist/src/platform/index.js +222 -1
- package/dist/src/platform/index.js.map +1 -1
- package/dist/src/platform/state.d.ts +170 -69
- package/dist/src/platform/state.d.ts.map +1 -1
- package/dist/src/platform/state.js +252 -67
- package/dist/src/platform/state.js.map +1 -1
- package/dist/src/platform/store.d.ts +172 -0
- package/dist/src/platform/store.d.ts.map +1 -0
- package/dist/src/platform/store.js +246 -0
- package/dist/src/platform/store.js.map +1 -0
- package/dist/src/reactive/index.d.ts +69 -0
- package/dist/src/reactive/index.d.ts.map +1 -0
- package/dist/src/reactive/index.js +93 -0
- package/dist/src/reactive/index.js.map +1 -0
- package/dist/src/typography/code-block/index.d.ts +2 -1
- package/dist/src/typography/code-block/index.d.ts.map +1 -1
- package/dist/src/typography/code-block/index.js +2 -1
- package/dist/src/typography/code-block/index.js.map +1 -1
- package/dist/src/typography/code-block/types.d.ts +4 -0
- package/dist/src/typography/code-block/types.d.ts.map +1 -1
- package/dist/src/typography/code-block/types.js +2 -0
- package/dist/src/typography/code-block/types.js.map +1 -1
- package/dist/src/typography/list/index.d.ts +2 -3
- package/dist/src/typography/list/index.d.ts.map +1 -1
- package/dist/src/typography/list/index.js +2 -3
- package/dist/src/typography/list/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/forms/fieldset/index.d.ts +0 -112
- package/dist/src/forms/fieldset/index.d.ts.map +0 -1
- package/dist/src/forms/fieldset/index.js +0 -131
- package/dist/src/forms/fieldset/index.js.map +0 -1
- package/dist/src/forms/fieldset/types.d.ts +0 -53
- package/dist/src/forms/fieldset/types.d.ts.map +0 -1
- package/dist/src/forms/fieldset/types.js +0 -22
- package/dist/src/forms/fieldset/types.js.map +0 -1
|
@@ -2,101 +2,202 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* State management platform functions for East UI.
|
|
7
|
+
*
|
|
8
|
+
* Provides reactive state operations for East UI programs.
|
|
9
|
+
* State is stored as Beast2-encoded blobs, allowing any East type to be stored.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { StringType, BlobType, NullType, type SubtypeExprOrValue, type EastType, type CallableFunctionExpr, BooleanType } from "@elaraai/east";
|
|
14
|
+
import { type PlatformFunction, OptionType } from "@elaraai/east/internal";
|
|
15
|
+
import { UIStore } from "./store.js";
|
|
16
|
+
/**
|
|
17
|
+
* Enable dependency tracking for reactive components.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Call this before executing a reactive component's render function.
|
|
21
|
+
* All subsequent `state_read` calls will record their keys to the tracking set.
|
|
22
|
+
* Call {@link disableTracking} when done to get the collected keys.
|
|
23
|
+
*
|
|
24
|
+
* @returns The Set that will collect accessed keys
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* enableTracking();
|
|
29
|
+
* try {
|
|
30
|
+
* const result = renderFn();
|
|
31
|
+
* const deps = disableTracking();
|
|
32
|
+
* // deps contains all state keys read during renderFn()
|
|
33
|
+
* } catch (e) {
|
|
34
|
+
* disableTracking();
|
|
35
|
+
* throw e;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function enableTracking(): Set<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Disable dependency tracking and return collected keys.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Call this after executing a reactive component's render function.
|
|
45
|
+
* Returns all keys that were accessed via `state_read` since {@link enableTracking} was called.
|
|
46
|
+
*
|
|
47
|
+
* @returns Array of state keys that were read during tracking
|
|
48
|
+
*/
|
|
49
|
+
export declare function disableTracking(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Check if dependency tracking is currently enabled.
|
|
52
|
+
*
|
|
53
|
+
* @returns True if tracking is active
|
|
54
|
+
*/
|
|
55
|
+
export declare function isTracking(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Record a key access during dependency tracking.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Called internally by the `state_read` implementation.
|
|
61
|
+
* Only records if tracking is enabled via {@link enableTracking}.
|
|
62
|
+
*
|
|
63
|
+
* @param key - The state key being accessed
|
|
64
|
+
*/
|
|
65
|
+
export declare function trackKey(key: string): void;
|
|
7
66
|
/**
|
|
8
67
|
* Platform function to write a Beast2-encoded value to the state store.
|
|
9
68
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* in
|
|
69
|
+
* @remarks
|
|
70
|
+
* Writes a blob to state, or deletes the key if `none` is passed.
|
|
71
|
+
* Triggers re-render in reactive contexts.
|
|
13
72
|
*
|
|
14
73
|
* @param key - The string key to write to
|
|
15
|
-
* @param value - The Beast2-encoded blob value
|
|
74
|
+
* @param value - The Beast2-encoded blob value (some to write, none to delete)
|
|
16
75
|
* @returns Null
|
|
76
|
+
*/
|
|
77
|
+
export declare const state_write: import("@elaraai/east").PlatformDefinition<[StringType, OptionType<BlobType>], NullType>;
|
|
78
|
+
/**
|
|
79
|
+
* Platform function to read a Beast2-encoded value from the state store.
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* Returns `some(blob)` if the key exists, `none` if not.
|
|
83
|
+
* Use `.match()` to handle both cases.
|
|
84
|
+
*
|
|
85
|
+
* @param key - The string key to read from
|
|
86
|
+
* @returns Option of Beast2-encoded blob (some if exists, none if not)
|
|
87
|
+
*/
|
|
88
|
+
export declare const state_read: import("@elaraai/east").PlatformDefinition<[StringType], OptionType<BlobType>>;
|
|
89
|
+
/**
|
|
90
|
+
* Platform function to check if a key exists in the state store.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Returns true if the key exists, false otherwise.
|
|
94
|
+
*
|
|
95
|
+
* @param key - The string key to check
|
|
96
|
+
* @returns Boolean indicating existence of the key
|
|
97
|
+
*/
|
|
98
|
+
export declare const state_has: import("@elaraai/east").PlatformDefinition<[StringType], BooleanType>;
|
|
99
|
+
/**
|
|
100
|
+
* Singleton UI store instance for state management.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* This is the global store used by {@link StateImpl}. Access directly
|
|
104
|
+
* for React integration, subscriptions, or debugging.
|
|
105
|
+
*/
|
|
106
|
+
export declare const store: UIStore;
|
|
107
|
+
/**
|
|
108
|
+
* Platform implementation for state management operations.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* Provides the runtime implementations for state read/write operations
|
|
112
|
+
* bound to the singleton {@link store}. Pass this to `ir.compile()` to enable
|
|
113
|
+
* state functionality.
|
|
114
|
+
*/
|
|
115
|
+
export declare const StateImpl: PlatformFunction[];
|
|
116
|
+
/**
|
|
117
|
+
* Creates a typed state write function for a given key and type.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Returns an East function that writes a typed value to state. The value is
|
|
121
|
+
* automatically Beast2-encoded before storage. Pass `some(value)` to write
|
|
122
|
+
* or `none` to delete the key.
|
|
123
|
+
*
|
|
124
|
+
* @typeParam T - The East type of the value to write
|
|
125
|
+
* @param key - The string key to write to
|
|
126
|
+
* @param value - The value wrapped in an option (some to write, none to delete)
|
|
127
|
+
* @param type - The East type descriptor for the value
|
|
128
|
+
* @returns A callable East function that performs the write
|
|
17
129
|
*
|
|
18
130
|
* @example
|
|
19
131
|
* ```ts
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* );
|
|
132
|
+
* import { East, IntegerType, NullType, some } from "@elaraai/east";
|
|
133
|
+
* import { State, UIComponentType } from "@elaraai/east-ui";
|
|
134
|
+
*
|
|
135
|
+
* const counter = East.function([], UIComponentType, $ => {
|
|
136
|
+
* // Write 42 to "counter" key
|
|
137
|
+
* $(State.writeTyped("counter", some(42n), IntegerType)());
|
|
138
|
+
*
|
|
139
|
+
* // Delete the key
|
|
140
|
+
* $(State.writeTyped("counter", none, IntegerType)());
|
|
141
|
+
* });
|
|
29
142
|
* ```
|
|
30
143
|
*/
|
|
31
|
-
export declare const
|
|
144
|
+
export declare const state_write_typed: <T extends EastType>(key: SubtypeExprOrValue<StringType>, value: SubtypeExprOrValue<OptionType<T>>, type: T) => CallableFunctionExpr<[], NullType>;
|
|
32
145
|
/**
|
|
33
|
-
*
|
|
34
|
-
* Returns an empty blob if the key doesn't exist.
|
|
146
|
+
* Creates a typed state read function for a given key and type.
|
|
35
147
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
148
|
+
* @remarks
|
|
149
|
+
* Returns an East function that reads a typed value from state. The value is
|
|
150
|
+
* automatically Beast2-decoded after retrieval. Returns `some(value)` if the
|
|
151
|
+
* key exists, `none` if not.
|
|
39
152
|
*
|
|
153
|
+
* @typeParam T - The East type of the value to read
|
|
40
154
|
* @param key - The string key to read from
|
|
41
|
-
* @
|
|
155
|
+
* @param type - The East type descriptor for the value
|
|
156
|
+
* @returns A callable East function that returns an option of the typed value
|
|
42
157
|
*
|
|
43
158
|
* @example
|
|
44
159
|
* ```ts
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
160
|
+
* import { East, IntegerType, NullType } from "@elaraai/east";
|
|
161
|
+
* import { State, UIComponentType, Text } from "@elaraai/east-ui";
|
|
162
|
+
*
|
|
163
|
+
* const display = East.function([], UIComponentType, $ => {
|
|
164
|
+
* // Read typed value from state
|
|
165
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
166
|
+
*
|
|
167
|
+
* // Use the value (unwrap if you know it exists)
|
|
168
|
+
* return Text.Root(East.str`Count: ${count.unwrap("some")}`);
|
|
48
169
|
* });
|
|
49
170
|
* ```
|
|
50
171
|
*/
|
|
51
|
-
export declare const
|
|
172
|
+
export declare const state_read_typed: <T extends EastType>(key: SubtypeExprOrValue<StringType>, type: T) => CallableFunctionExpr<[], OptionType<T>>;
|
|
52
173
|
/**
|
|
53
|
-
*
|
|
174
|
+
* Creates a typed state initialization function that only writes if the key doesn't exist.
|
|
54
175
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* Returns an East function that initializes a state key with a default value.
|
|
178
|
+
* The write only occurs if the key is not already set, preventing overwrites
|
|
179
|
+
* on re-renders. Use this for setting up initial state in components.
|
|
180
|
+
*
|
|
181
|
+
* @typeParam T - The East type of the value to initialize
|
|
182
|
+
* @param key - The string key to initialize
|
|
183
|
+
* @param value - The default value to write (not wrapped in option)
|
|
184
|
+
* @param type - The East type descriptor for the value
|
|
185
|
+
* @returns A callable East function that performs the conditional initialization
|
|
57
186
|
*
|
|
58
187
|
* @example
|
|
59
188
|
* ```ts
|
|
60
|
-
* import { East,
|
|
61
|
-
* import { State } from "@elaraai/east-ui";
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* // Write incremented count
|
|
73
|
-
* $(State.write("count", East.Blob.encodeBeast(count.add(1n))));
|
|
74
|
-
*
|
|
75
|
-
* return Text.Root(East.str`Count: ${count}`);
|
|
76
|
-
* }
|
|
77
|
-
* );
|
|
78
|
-
*
|
|
79
|
-
* // Create store and register function
|
|
80
|
-
* const store = createEastStore();
|
|
81
|
-
* store.register("counter", counter.toIR());
|
|
189
|
+
* import { East, IntegerType } from "@elaraai/east";
|
|
190
|
+
* import { State, UIComponentType, Button } from "@elaraai/east-ui";
|
|
191
|
+
*
|
|
192
|
+
* const counter = East.function([], UIComponentType, $ => {
|
|
193
|
+
* // Initialize to 0 only if not already set
|
|
194
|
+
* $(State.initTyped("counter", 0n, IntegerType)());
|
|
195
|
+
*
|
|
196
|
+
* // Read and display
|
|
197
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
198
|
+
* // ...
|
|
199
|
+
* });
|
|
82
200
|
* ```
|
|
83
201
|
*/
|
|
84
|
-
export declare const
|
|
85
|
-
/**
|
|
86
|
-
* Writes a Beast2-encoded value to the state store.
|
|
87
|
-
*
|
|
88
|
-
* @param key - The string key to write to
|
|
89
|
-
* @param value - The Beast2-encoded blob value
|
|
90
|
-
* @returns Null
|
|
91
|
-
*/
|
|
92
|
-
readonly write: PlatformFunctionDef<[StringType, BlobType], NullType>;
|
|
93
|
-
/**
|
|
94
|
-
* Reads a Beast2-encoded value from the state store.
|
|
95
|
-
* Returns an empty blob if the key doesn't exist.
|
|
96
|
-
*
|
|
97
|
-
* @param key - The string key to read from
|
|
98
|
-
* @returns The Beast2-encoded blob value
|
|
99
|
-
*/
|
|
100
|
-
readonly read: PlatformFunctionDef<[StringType], BlobType>;
|
|
101
|
-
};
|
|
202
|
+
export declare const state_init_typed: <T extends EastType>(key: SubtypeExprOrValue<StringType>, value: SubtypeExprOrValue<T>, type: T) => CallableFunctionExpr<[], NullType>;
|
|
102
203
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/platform/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/platform/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAEH,UAAU,EACV,QAAQ,EACR,QAAQ,EAGR,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,WAAW,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAYrC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC,CAG5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAI1C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,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
/**
|
|
6
|
+
* State management platform functions for East UI.
|
|
7
|
+
*
|
|
8
|
+
* Provides reactive state operations for East UI programs.
|
|
9
|
+
* State is stored as Beast2-encoded blobs, allowing any East type to be stored.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { East, StringType, BlobType, NullType, none, some, BooleanType, } from "@elaraai/east";
|
|
14
|
+
import { OptionType } from "@elaraai/east/internal";
|
|
15
|
+
import { UIStore } from "./store.js";
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Reactive Dependency Tracking
|
|
18
|
+
// =============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Tracking context for reactive dependency collection.
|
|
21
|
+
* When set, state_read calls will record their keys here.
|
|
22
|
+
*/
|
|
23
|
+
let trackingContext = null;
|
|
24
|
+
/**
|
|
25
|
+
* Enable dependency tracking for reactive components.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Call this before executing a reactive component's render function.
|
|
29
|
+
* All subsequent `state_read` calls will record their keys to the tracking set.
|
|
30
|
+
* Call {@link disableTracking} when done to get the collected keys.
|
|
31
|
+
*
|
|
32
|
+
* @returns The Set that will collect accessed keys
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* enableTracking();
|
|
37
|
+
* try {
|
|
38
|
+
* const result = renderFn();
|
|
39
|
+
* const deps = disableTracking();
|
|
40
|
+
* // deps contains all state keys read during renderFn()
|
|
41
|
+
* } catch (e) {
|
|
42
|
+
* disableTracking();
|
|
43
|
+
* throw e;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function enableTracking() {
|
|
48
|
+
trackingContext = new Set();
|
|
49
|
+
return trackingContext;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Disable dependency tracking and return collected keys.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Call this after executing a reactive component's render function.
|
|
56
|
+
* Returns all keys that were accessed via `state_read` since {@link enableTracking} was called.
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of state keys that were read during tracking
|
|
59
|
+
*/
|
|
60
|
+
export function disableTracking() {
|
|
61
|
+
const keys = trackingContext ? [...trackingContext] : [];
|
|
62
|
+
trackingContext = null;
|
|
63
|
+
return keys;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if dependency tracking is currently enabled.
|
|
67
|
+
*
|
|
68
|
+
* @returns True if tracking is active
|
|
69
|
+
*/
|
|
70
|
+
export function isTracking() {
|
|
71
|
+
return trackingContext !== null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Record a key access during dependency tracking.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Called internally by the `state_read` implementation.
|
|
78
|
+
* Only records if tracking is enabled via {@link enableTracking}.
|
|
79
|
+
*
|
|
80
|
+
* @param key - The state key being accessed
|
|
81
|
+
*/
|
|
82
|
+
export function trackKey(key) {
|
|
83
|
+
if (trackingContext) {
|
|
84
|
+
trackingContext.add(key);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// =============================================================================
|
|
88
|
+
// Platform Functions
|
|
89
|
+
// =============================================================================
|
|
6
90
|
/**
|
|
7
91
|
* Platform function to write a Beast2-encoded value to the state store.
|
|
8
92
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* in
|
|
93
|
+
* @remarks
|
|
94
|
+
* Writes a blob to state, or deletes the key if `none` is passed.
|
|
95
|
+
* Triggers re-render in reactive contexts.
|
|
12
96
|
*
|
|
13
97
|
* @param key - The string key to write to
|
|
14
|
-
* @param value - The Beast2-encoded blob value
|
|
98
|
+
* @param value - The Beast2-encoded blob value (some to write, none to delete)
|
|
15
99
|
* @returns Null
|
|
100
|
+
*/
|
|
101
|
+
export const state_write = East.platform("state_write", [StringType, OptionType(BlobType)], NullType);
|
|
102
|
+
/**
|
|
103
|
+
* Platform function to read a Beast2-encoded value from the state store.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* Returns `some(blob)` if the key exists, `none` if not.
|
|
107
|
+
* Use `.match()` to handle both cases.
|
|
108
|
+
*
|
|
109
|
+
* @param key - The string key to read from
|
|
110
|
+
* @returns Option of Beast2-encoded blob (some if exists, none if not)
|
|
111
|
+
*/
|
|
112
|
+
export const state_read = East.platform("state_read", [StringType], OptionType(BlobType));
|
|
113
|
+
/**
|
|
114
|
+
* Platform function to check if a key exists in the state store.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* Returns true if the key exists, false otherwise.
|
|
118
|
+
*
|
|
119
|
+
* @param key - The string key to check
|
|
120
|
+
* @returns Boolean indicating existence of the key
|
|
121
|
+
*/
|
|
122
|
+
export const state_has = East.platform("state_has", [StringType], BooleanType);
|
|
123
|
+
/**
|
|
124
|
+
* Singleton UI store instance for state management.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* This is the global store used by {@link StateImpl}. Access directly
|
|
128
|
+
* for React integration, subscriptions, or debugging.
|
|
129
|
+
*/
|
|
130
|
+
export const store = new UIStore();
|
|
131
|
+
/**
|
|
132
|
+
* Platform implementation for state management operations.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* Provides the runtime implementations for state read/write operations
|
|
136
|
+
* bound to the singleton {@link store}. Pass this to `ir.compile()` to enable
|
|
137
|
+
* state functionality.
|
|
138
|
+
*/
|
|
139
|
+
export const StateImpl = [
|
|
140
|
+
state_write.implement((key, value) => {
|
|
141
|
+
if (value.type === 'none') {
|
|
142
|
+
store.write(key, undefined);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
store.write(key, value.value);
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
state_read.implement((key) => {
|
|
149
|
+
// Track the key if in tracking mode (for reactive dependency collection)
|
|
150
|
+
trackKey(key);
|
|
151
|
+
const ret = store.read(key);
|
|
152
|
+
if (ret === undefined) {
|
|
153
|
+
return none;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return some(ret);
|
|
157
|
+
}
|
|
158
|
+
}),
|
|
159
|
+
state_has.implement((key) => {
|
|
160
|
+
return store.has(key);
|
|
161
|
+
}),
|
|
162
|
+
];
|
|
163
|
+
/**
|
|
164
|
+
* Creates a typed state write function for a given key and type.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* Returns an East function that writes a typed value to state. The value is
|
|
168
|
+
* automatically Beast2-encoded before storage. Pass `some(value)` to write
|
|
169
|
+
* or `none` to delete the key.
|
|
170
|
+
*
|
|
171
|
+
* @typeParam T - The East type of the value to write
|
|
172
|
+
* @param key - The string key to write to
|
|
173
|
+
* @param value - The value wrapped in an option (some to write, none to delete)
|
|
174
|
+
* @param type - The East type descriptor for the value
|
|
175
|
+
* @returns A callable East function that performs the write
|
|
16
176
|
*
|
|
17
177
|
* @example
|
|
18
178
|
* ```ts
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* );
|
|
179
|
+
* import { East, IntegerType, NullType, some } from "@elaraai/east";
|
|
180
|
+
* import { State, UIComponentType } from "@elaraai/east-ui";
|
|
181
|
+
*
|
|
182
|
+
* const counter = East.function([], UIComponentType, $ => {
|
|
183
|
+
* // Write 42 to "counter" key
|
|
184
|
+
* $(State.writeTyped("counter", some(42n), IntegerType)());
|
|
185
|
+
*
|
|
186
|
+
* // Delete the key
|
|
187
|
+
* $(State.writeTyped("counter", none, IntegerType)());
|
|
188
|
+
* });
|
|
28
189
|
* ```
|
|
29
190
|
*/
|
|
30
|
-
export const
|
|
191
|
+
export const state_write_typed = (key, value, type) => {
|
|
192
|
+
return East.function([], NullType, $ => {
|
|
193
|
+
const key_expr = East.value(key);
|
|
194
|
+
const value_expr = East.value(value, OptionType(type));
|
|
195
|
+
$.match(value_expr, {
|
|
196
|
+
some: ($, v) => {
|
|
197
|
+
$(state_write(key_expr, some(East.Blob.encodeBeast(v, "v2"))));
|
|
198
|
+
},
|
|
199
|
+
none: ($) => {
|
|
200
|
+
$(state_write(key_expr, none));
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return null;
|
|
204
|
+
});
|
|
205
|
+
};
|
|
31
206
|
/**
|
|
32
|
-
*
|
|
33
|
-
* Returns an empty blob if the key doesn't exist.
|
|
207
|
+
* Creates a typed state read function for a given key and type.
|
|
34
208
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* Returns an East function that reads a typed value from state. The value is
|
|
211
|
+
* automatically Beast2-decoded after retrieval. Returns `some(value)` if the
|
|
212
|
+
* key exists, `none` if not.
|
|
38
213
|
*
|
|
214
|
+
* @typeParam T - The East type of the value to read
|
|
39
215
|
* @param key - The string key to read from
|
|
40
|
-
* @
|
|
216
|
+
* @param type - The East type descriptor for the value
|
|
217
|
+
* @returns A callable East function that returns an option of the typed value
|
|
41
218
|
*
|
|
42
219
|
* @example
|
|
43
220
|
* ```ts
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
221
|
+
* import { East, IntegerType, NullType } from "@elaraai/east";
|
|
222
|
+
* import { State, UIComponentType, Text } from "@elaraai/east-ui";
|
|
223
|
+
*
|
|
224
|
+
* const display = East.function([], UIComponentType, $ => {
|
|
225
|
+
* // Read typed value from state
|
|
226
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
227
|
+
*
|
|
228
|
+
* // Use the value (unwrap if you know it exists)
|
|
229
|
+
* return Text.Root(East.str`Count: ${count.unwrap("some")}`);
|
|
47
230
|
* });
|
|
48
231
|
* ```
|
|
49
232
|
*/
|
|
50
|
-
export const
|
|
233
|
+
export const state_read_typed = (key, type) => {
|
|
234
|
+
return East.function([], OptionType(type), $ => {
|
|
235
|
+
const key_expr = East.value(key);
|
|
236
|
+
const ret = $.let(none, OptionType(type));
|
|
237
|
+
$.match(state_read(key_expr), {
|
|
238
|
+
some: ($, v) => {
|
|
239
|
+
$.assign(ret, East.value(some(v.decodeBeast(type, "v2")), OptionType(type)));
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
return ret;
|
|
243
|
+
});
|
|
244
|
+
};
|
|
51
245
|
/**
|
|
52
|
-
*
|
|
246
|
+
* Creates a typed state initialization function that only writes if the key doesn't exist.
|
|
53
247
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* Returns an East function that initializes a state key with a default value.
|
|
250
|
+
* The write only occurs if the key is not already set, preventing overwrites
|
|
251
|
+
* on re-renders. Use this for setting up initial state in components.
|
|
252
|
+
*
|
|
253
|
+
* @typeParam T - The East type of the value to initialize
|
|
254
|
+
* @param key - The string key to initialize
|
|
255
|
+
* @param value - The default value to write (not wrapped in option)
|
|
256
|
+
* @param type - The East type descriptor for the value
|
|
257
|
+
* @returns A callable East function that performs the conditional initialization
|
|
56
258
|
*
|
|
57
259
|
* @example
|
|
58
260
|
* ```ts
|
|
59
|
-
* import { East,
|
|
60
|
-
* import { State } from "@elaraai/east-ui";
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* // Write incremented count
|
|
72
|
-
* $(State.write("count", East.Blob.encodeBeast(count.add(1n))));
|
|
73
|
-
*
|
|
74
|
-
* return Text.Root(East.str`Count: ${count}`);
|
|
75
|
-
* }
|
|
76
|
-
* );
|
|
77
|
-
*
|
|
78
|
-
* // Create store and register function
|
|
79
|
-
* const store = createEastStore();
|
|
80
|
-
* store.register("counter", counter.toIR());
|
|
261
|
+
* import { East, IntegerType } from "@elaraai/east";
|
|
262
|
+
* import { State, UIComponentType, Button } from "@elaraai/east-ui";
|
|
263
|
+
*
|
|
264
|
+
* const counter = East.function([], UIComponentType, $ => {
|
|
265
|
+
* // Initialize to 0 only if not already set
|
|
266
|
+
* $(State.initTyped("counter", 0n, IntegerType)());
|
|
267
|
+
*
|
|
268
|
+
* // Read and display
|
|
269
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
270
|
+
* // ...
|
|
271
|
+
* });
|
|
81
272
|
* ```
|
|
82
273
|
*/
|
|
83
|
-
export const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* Returns an empty blob if the key doesn't exist.
|
|
95
|
-
*
|
|
96
|
-
* @param key - The string key to read from
|
|
97
|
-
* @returns The Beast2-encoded blob value
|
|
98
|
-
*/
|
|
99
|
-
read: state_read,
|
|
274
|
+
export const state_init_typed = (key, value, type) => {
|
|
275
|
+
return East.function([], NullType, $ => {
|
|
276
|
+
const key_expr = East.value(key);
|
|
277
|
+
const value_expr = East.value(value, type);
|
|
278
|
+
$.match(state_read(key_expr), {
|
|
279
|
+
none: ($) => {
|
|
280
|
+
$(state_write(key_expr, some(East.Blob.encodeBeast(value_expr, "v2"))));
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
return null;
|
|
284
|
+
});
|
|
100
285
|
};
|
|
101
286
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/platform/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/platform/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,IAAI,EAIJ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