@elaraai/east-ui 0.0.1-beta.6 → 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
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { PlatformFunction, EastIR } from "@elaraai/east/internal";
|
|
6
|
+
/**
|
|
7
|
+
* Store interface for UI state management.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* State is stored as Beast2-encoded Uint8Array values, allowing any East type to be stored.
|
|
11
|
+
* Provides reactive subscriptions, batching, and garbage collection.
|
|
12
|
+
*/
|
|
13
|
+
export interface UIStoreInterface {
|
|
14
|
+
/** Read a Beast2-encoded value from the store */
|
|
15
|
+
read(key: string): Uint8Array | undefined;
|
|
16
|
+
/** Write a Beast2-encoded value to the store */
|
|
17
|
+
write(key: string, value: Uint8Array | undefined): void;
|
|
18
|
+
/** Check if a key exists in the store */
|
|
19
|
+
has(key: string): boolean;
|
|
20
|
+
/** Subscribe to all state changes, returns unsubscribe function */
|
|
21
|
+
subscribe(callback: () => void): () => void;
|
|
22
|
+
/** Subscribe to a specific key, returns unsubscribe function */
|
|
23
|
+
subscribe(key: string, callback: () => void): () => void;
|
|
24
|
+
/** Batch multiple writes together for single notification */
|
|
25
|
+
batch<T>(fn: () => T): T;
|
|
26
|
+
/** Mark a key as active during render (for garbage collection) */
|
|
27
|
+
markActive(key: string): void;
|
|
28
|
+
/** Called at start of render cycle */
|
|
29
|
+
beginRender(): void;
|
|
30
|
+
/** Called at end of render cycle - removes orphaned keys */
|
|
31
|
+
endRender(): void;
|
|
32
|
+
/** Get snapshot version for React's useSyncExternalStore */
|
|
33
|
+
getSnapshot(): number;
|
|
34
|
+
/** Get current state for debugging */
|
|
35
|
+
getState(): Map<string, Uint8Array>;
|
|
36
|
+
/** Set the notification scheduler (for deferred notifications in React) */
|
|
37
|
+
setScheduler(scheduler: ((notify: () => void) => void) | undefined): void;
|
|
38
|
+
/** Get version number for a specific key (for reactive component subscriptions) */
|
|
39
|
+
getKeyVersion(key: string): number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Options for creating a UIStore.
|
|
43
|
+
*/
|
|
44
|
+
export interface UIStoreOptions {
|
|
45
|
+
/** Initial state as a Map of string keys to Beast2-encoded blobs */
|
|
46
|
+
initialState?: Map<string, Uint8Array> | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Optional scheduler for deferred notifications.
|
|
49
|
+
* If provided, flush notifications will be deferred using this function.
|
|
50
|
+
* If not provided, notifications happen synchronously.
|
|
51
|
+
*
|
|
52
|
+
* For React, use queueMicrotask to avoid "setState during render" errors:
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const store = new UIStore({
|
|
56
|
+
* scheduleNotify: (fn) => queueMicrotask(fn)
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
scheduleNotify?: (notify: () => void) => void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Reactive state store for East UI applications.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Combines state management, function registration, and React integration:
|
|
67
|
+
* - State stored as Beast2-encoded blobs
|
|
68
|
+
* - Batched writes for performance
|
|
69
|
+
* - Key-specific and global subscriptions
|
|
70
|
+
* - Garbage collection for orphaned keys
|
|
71
|
+
* - Function registration with automatic re-execution
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { UIStore, State } from "@elaraai/east-ui";
|
|
76
|
+
*
|
|
77
|
+
* // Use the singleton store via State.Implementation
|
|
78
|
+
* const compiled = counterFn.toIR().compile(State.Implementation);
|
|
79
|
+
*
|
|
80
|
+
* // Or create a custom store for isolation
|
|
81
|
+
* const store = new UIStore();
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare class UIStore implements UIStoreInterface {
|
|
85
|
+
private state;
|
|
86
|
+
private registrations;
|
|
87
|
+
private keySubscribers;
|
|
88
|
+
private globalSubscribers;
|
|
89
|
+
private activeKeys;
|
|
90
|
+
private previousActiveKeys;
|
|
91
|
+
private version;
|
|
92
|
+
private batchDepth;
|
|
93
|
+
private changedKeys;
|
|
94
|
+
private scheduleNotify?;
|
|
95
|
+
private keyVersions;
|
|
96
|
+
constructor(options?: UIStoreOptions);
|
|
97
|
+
read(key: string): Uint8Array | undefined;
|
|
98
|
+
write(key: string, value: Uint8Array | undefined): void;
|
|
99
|
+
has(key: string): boolean;
|
|
100
|
+
subscribe(callback: () => void): () => void;
|
|
101
|
+
subscribe(key: string, callback: () => void): () => void;
|
|
102
|
+
batch<T>(fn: () => T): T;
|
|
103
|
+
markActive(key: string): void;
|
|
104
|
+
beginRender(): void;
|
|
105
|
+
endRender(): void;
|
|
106
|
+
getSnapshot(): number;
|
|
107
|
+
getState(): Map<string, Uint8Array>;
|
|
108
|
+
/**
|
|
109
|
+
* Register an East function for reactive execution.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* The function will be compiled and executed immediately with current state.
|
|
113
|
+
* When state changes, it will be re-executed automatically.
|
|
114
|
+
*
|
|
115
|
+
* @param id - Unique identifier for this registration
|
|
116
|
+
* @param ir - The East IR to compile and register
|
|
117
|
+
* @param platform - Platform functions to use for compilation
|
|
118
|
+
*/
|
|
119
|
+
register(id: string, ir: EastIR<[Map<string, Uint8Array>], unknown>, platform: PlatformFunction[]): void;
|
|
120
|
+
/**
|
|
121
|
+
* Get the last result of a registered function.
|
|
122
|
+
*
|
|
123
|
+
* @param id - The registration identifier
|
|
124
|
+
* @returns The last computed result, or undefined if not registered
|
|
125
|
+
*/
|
|
126
|
+
getResult(id: string): unknown;
|
|
127
|
+
/**
|
|
128
|
+
* Get all active keys (for debugging).
|
|
129
|
+
*/
|
|
130
|
+
getActiveKeys(): Set<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Set the notification scheduler.
|
|
133
|
+
* Call this to enable deferred notifications (e.g., for React integration).
|
|
134
|
+
*
|
|
135
|
+
* @param scheduler - Function to schedule deferred notifications, or undefined for synchronous
|
|
136
|
+
*/
|
|
137
|
+
setScheduler(scheduler: ((notify: () => void) => void) | undefined): void;
|
|
138
|
+
/**
|
|
139
|
+
* Get version number for a specific key.
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* Used by reactive components to create a snapshot that only changes
|
|
143
|
+
* when their specific dependencies change, enabling selective re-rendering.
|
|
144
|
+
*
|
|
145
|
+
* @param key - The state key to get the version for
|
|
146
|
+
* @returns The version number (increments on each write), or 0 if never written
|
|
147
|
+
*/
|
|
148
|
+
getKeyVersion(key: string): number;
|
|
149
|
+
private flushScheduled;
|
|
150
|
+
private flush;
|
|
151
|
+
private doFlush;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a new UIStore with optional initial state.
|
|
155
|
+
*
|
|
156
|
+
* @param initialState - Optional initial state as a plain object
|
|
157
|
+
* @returns A new UIStore instance
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { createUIStore } from "@elaraai/east-ui";
|
|
162
|
+
* import { encodeBeast2For } from "@elaraai/east/internal";
|
|
163
|
+
* import { IntegerType, StringType } from "@elaraai/east";
|
|
164
|
+
*
|
|
165
|
+
* const store = createUIStore({
|
|
166
|
+
* count: encodeBeast2For(IntegerType)(0n),
|
|
167
|
+
* name: encodeBeast2For(StringType)("Alice"),
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function createUIStore(initialState?: Record<string, Uint8Array>): UIStore;
|
|
172
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/platform/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC7B,iDAAiD;IACjD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;IACxD,yCAAyC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,mEAAmE;IACnE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,gEAAgE;IAChE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,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eb,OAAO,CAAC,OAAO;CAyBlB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,OAAO,CAIhF"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { BlobType, equalFor } from "@elaraai/east";
|
|
6
|
+
const blobEqual = equalFor(BlobType);
|
|
7
|
+
/**
|
|
8
|
+
* Reactive state store for East UI applications.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Combines state management, function registration, and React integration:
|
|
12
|
+
* - State stored as Beast2-encoded blobs
|
|
13
|
+
* - Batched writes for performance
|
|
14
|
+
* - Key-specific and global subscriptions
|
|
15
|
+
* - Garbage collection for orphaned keys
|
|
16
|
+
* - Function registration with automatic re-execution
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { UIStore, State } from "@elaraai/east-ui";
|
|
21
|
+
*
|
|
22
|
+
* // Use the singleton store via State.Implementation
|
|
23
|
+
* const compiled = counterFn.toIR().compile(State.Implementation);
|
|
24
|
+
*
|
|
25
|
+
* // Or create a custom store for isolation
|
|
26
|
+
* const store = new UIStore();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export class UIStore {
|
|
30
|
+
state;
|
|
31
|
+
registrations = new Map();
|
|
32
|
+
keySubscribers = new Map();
|
|
33
|
+
globalSubscribers = new Set();
|
|
34
|
+
activeKeys = new Set();
|
|
35
|
+
previousActiveKeys = new Set();
|
|
36
|
+
version = 0;
|
|
37
|
+
batchDepth = 0;
|
|
38
|
+
changedKeys = new Set();
|
|
39
|
+
scheduleNotify;
|
|
40
|
+
keyVersions = new Map();
|
|
41
|
+
constructor(options) {
|
|
42
|
+
this.state = options?.initialState ?? new Map();
|
|
43
|
+
this.scheduleNotify = options?.scheduleNotify;
|
|
44
|
+
}
|
|
45
|
+
read(key) {
|
|
46
|
+
this.markActive(key);
|
|
47
|
+
return this.state.get(key);
|
|
48
|
+
}
|
|
49
|
+
write(key, value) {
|
|
50
|
+
// Check if value actually changed to avoid infinite loops
|
|
51
|
+
const existing = this.state.get(key);
|
|
52
|
+
const isEqual = value === undefined
|
|
53
|
+
? existing === undefined
|
|
54
|
+
: existing !== undefined && blobEqual(existing, value);
|
|
55
|
+
if (isEqual)
|
|
56
|
+
return; // No change, skip update
|
|
57
|
+
if (value === undefined) {
|
|
58
|
+
this.state.delete(key);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.state.set(key, value);
|
|
62
|
+
}
|
|
63
|
+
this.changedKeys.add(key);
|
|
64
|
+
// Increment key version for reactive subscriptions
|
|
65
|
+
const currentVersion = this.keyVersions.get(key) ?? 0;
|
|
66
|
+
this.keyVersions.set(key, currentVersion + 1);
|
|
67
|
+
if (this.batchDepth === 0) {
|
|
68
|
+
this.flush();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
has(key) {
|
|
72
|
+
return this.state.has(key);
|
|
73
|
+
}
|
|
74
|
+
subscribe(keyOrCallback, callback) {
|
|
75
|
+
if (typeof keyOrCallback === "function") {
|
|
76
|
+
// Global subscription
|
|
77
|
+
this.globalSubscribers.add(keyOrCallback);
|
|
78
|
+
return () => this.globalSubscribers.delete(keyOrCallback);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Key-specific subscription
|
|
82
|
+
const key = keyOrCallback;
|
|
83
|
+
const cb = callback;
|
|
84
|
+
let subs = this.keySubscribers.get(key);
|
|
85
|
+
if (!subs) {
|
|
86
|
+
subs = new Set();
|
|
87
|
+
this.keySubscribers.set(key, subs);
|
|
88
|
+
}
|
|
89
|
+
subs.add(cb);
|
|
90
|
+
return () => {
|
|
91
|
+
subs.delete(cb);
|
|
92
|
+
if (subs.size === 0) {
|
|
93
|
+
this.keySubscribers.delete(key);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
batch(fn) {
|
|
99
|
+
this.batchDepth++;
|
|
100
|
+
try {
|
|
101
|
+
return fn();
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
this.batchDepth--;
|
|
105
|
+
if (this.batchDepth === 0) {
|
|
106
|
+
this.flush();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
markActive(key) {
|
|
111
|
+
this.activeKeys.add(key);
|
|
112
|
+
}
|
|
113
|
+
beginRender() {
|
|
114
|
+
this.previousActiveKeys = this.activeKeys;
|
|
115
|
+
this.activeKeys = new Set();
|
|
116
|
+
}
|
|
117
|
+
endRender() {
|
|
118
|
+
for (const key of this.previousActiveKeys) {
|
|
119
|
+
if (!this.activeKeys.has(key)) {
|
|
120
|
+
this.state.delete(key);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
getSnapshot() {
|
|
125
|
+
return this.version;
|
|
126
|
+
}
|
|
127
|
+
getState() {
|
|
128
|
+
return new Map(this.state);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Register an East function for reactive execution.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* The function will be compiled and executed immediately with current state.
|
|
135
|
+
* When state changes, it will be re-executed automatically.
|
|
136
|
+
*
|
|
137
|
+
* @param id - Unique identifier for this registration
|
|
138
|
+
* @param ir - The East IR to compile and register
|
|
139
|
+
* @param platform - Platform functions to use for compilation
|
|
140
|
+
*/
|
|
141
|
+
register(id, ir, platform) {
|
|
142
|
+
const compiled = ir.compile(platform);
|
|
143
|
+
const result = compiled(this.state);
|
|
144
|
+
this.registrations.set(id, { compiled, lastResult: result });
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the last result of a registered function.
|
|
148
|
+
*
|
|
149
|
+
* @param id - The registration identifier
|
|
150
|
+
* @returns The last computed result, or undefined if not registered
|
|
151
|
+
*/
|
|
152
|
+
getResult(id) {
|
|
153
|
+
return this.registrations.get(id)?.lastResult;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get all active keys (for debugging).
|
|
157
|
+
*/
|
|
158
|
+
getActiveKeys() {
|
|
159
|
+
return new Set(this.activeKeys);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Set the notification scheduler.
|
|
163
|
+
* Call this to enable deferred notifications (e.g., for React integration).
|
|
164
|
+
*
|
|
165
|
+
* @param scheduler - Function to schedule deferred notifications, or undefined for synchronous
|
|
166
|
+
*/
|
|
167
|
+
setScheduler(scheduler) {
|
|
168
|
+
this.scheduleNotify = scheduler;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get version number for a specific key.
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* Used by reactive components to create a snapshot that only changes
|
|
175
|
+
* when their specific dependencies change, enabling selective re-rendering.
|
|
176
|
+
*
|
|
177
|
+
* @param key - The state key to get the version for
|
|
178
|
+
* @returns The version number (increments on each write), or 0 if never written
|
|
179
|
+
*/
|
|
180
|
+
getKeyVersion(key) {
|
|
181
|
+
return this.keyVersions.get(key) ?? 0;
|
|
182
|
+
}
|
|
183
|
+
flushScheduled = false;
|
|
184
|
+
flush() {
|
|
185
|
+
if (this.changedKeys.size === 0)
|
|
186
|
+
return;
|
|
187
|
+
if (this.scheduleNotify) {
|
|
188
|
+
// Defer notifications to avoid "setState during render" errors
|
|
189
|
+
if (!this.flushScheduled) {
|
|
190
|
+
this.flushScheduled = true;
|
|
191
|
+
this.scheduleNotify(() => this.doFlush());
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Synchronous flush (no scheduler provided)
|
|
196
|
+
this.doFlush();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
doFlush() {
|
|
200
|
+
this.flushScheduled = false;
|
|
201
|
+
if (this.changedKeys.size === 0)
|
|
202
|
+
return;
|
|
203
|
+
// Increment version so useSyncExternalStore triggers re-render
|
|
204
|
+
this.version++;
|
|
205
|
+
// Re-execute all registered functions
|
|
206
|
+
for (const [, reg] of this.registrations) {
|
|
207
|
+
reg.lastResult = reg.compiled(this.state);
|
|
208
|
+
}
|
|
209
|
+
// Notify key-specific subscribers
|
|
210
|
+
for (const key of this.changedKeys) {
|
|
211
|
+
const subs = this.keySubscribers.get(key);
|
|
212
|
+
if (subs) {
|
|
213
|
+
for (const cb of subs)
|
|
214
|
+
cb();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Notify global subscribers
|
|
218
|
+
for (const cb of this.globalSubscribers)
|
|
219
|
+
cb();
|
|
220
|
+
this.changedKeys.clear();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Create a new UIStore with optional initial state.
|
|
225
|
+
*
|
|
226
|
+
* @param initialState - Optional initial state as a plain object
|
|
227
|
+
* @returns A new UIStore instance
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* import { createUIStore } from "@elaraai/east-ui";
|
|
232
|
+
* import { encodeBeast2For } from "@elaraai/east/internal";
|
|
233
|
+
* import { IntegerType, StringType } from "@elaraai/east";
|
|
234
|
+
*
|
|
235
|
+
* const store = createUIStore({
|
|
236
|
+
* count: encodeBeast2For(IntegerType)(0n),
|
|
237
|
+
* name: encodeBeast2For(StringType)("Alice"),
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export function createUIStore(initialState) {
|
|
242
|
+
return new UIStore({
|
|
243
|
+
initialState: initialState ? new Map(Object.entries(initialState)) : undefined,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type ExprType, type BlockBuilder } from "@elaraai/east";
|
|
6
|
+
import { UIComponentType } from "../component.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a reactive component that re-renders independently when its dependencies change.
|
|
9
|
+
*
|
|
10
|
+
* @param body - Function body that returns UIComponentType. Must be a free function with no captures.
|
|
11
|
+
* @returns A ReactiveComponent variant of UIComponentType
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* The body function MUST be a free function - no captures from parent East scope.
|
|
15
|
+
* This is validated at IR creation time. Dependencies are automatically detected
|
|
16
|
+
* at runtime by tracking which state keys are read during execution.
|
|
17
|
+
*
|
|
18
|
+
* **What IS allowed:**
|
|
19
|
+
* - Platform functions (State.readTyped, State.writeTyped, etc.)
|
|
20
|
+
* - Module-level constants and functions (not captures)
|
|
21
|
+
* - Callbacks defined inside the body (East.function)
|
|
22
|
+
*
|
|
23
|
+
* **What is NOT allowed:**
|
|
24
|
+
* - Parent East function scope variables ($.let, parameters, state reads)
|
|
25
|
+
* - Any variable captured from enclosing East function scope
|
|
26
|
+
*
|
|
27
|
+
* @throws Error if the body captures variables from parent scope
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { East, IntegerType } from "@elaraai/east";
|
|
32
|
+
* import { Reactive, State, Text, UIComponentType } from "@elaraai/east-ui";
|
|
33
|
+
*
|
|
34
|
+
* const app = East.function([], UIComponentType, $ => {
|
|
35
|
+
* // This component re-renders only when "counter" changes
|
|
36
|
+
* return Reactive.Root($ => {
|
|
37
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
38
|
+
* const value = $.let(0n);
|
|
39
|
+
* $.match(count, {
|
|
40
|
+
* some: ($, v) => $.assign(value, v),
|
|
41
|
+
* });
|
|
42
|
+
* return Text.Root(East.str`Count: ${value}`);
|
|
43
|
+
* });
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createReactive(body: ($: BlockBuilder<typeof UIComponentType>) => ExprType<typeof UIComponentType> | void): ExprType<typeof UIComponentType>;
|
|
48
|
+
/**
|
|
49
|
+
* Reactive component for selective re-rendering.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* Use `Reactive.Root(body)` to create a reactive component that re-renders
|
|
53
|
+
* independently when its state dependencies change. Dependencies are automatically
|
|
54
|
+
* detected at runtime. The body function must be a free function with no captures
|
|
55
|
+
* from parent East scope.
|
|
56
|
+
*/
|
|
57
|
+
export declare const Reactive: {
|
|
58
|
+
/**
|
|
59
|
+
* Creates a reactive component that re-renders independently.
|
|
60
|
+
*
|
|
61
|
+
* @param body - Function body returning UIComponentType. Must be a free function.
|
|
62
|
+
* @returns A ReactiveComponent variant
|
|
63
|
+
*
|
|
64
|
+
* @see {@link createReactive} for full documentation and examples
|
|
65
|
+
*/
|
|
66
|
+
readonly Root: typeof createReactive;
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reactive/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,KAAK,QAAQ,EACb,KAAK,YAAY,EAEpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,iBAAS,cAAc,CACnB,IAAI,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,KAAK,QAAQ,CAAC,OAAO,eAAe,CAAC,GAAG,IAAI,GAC3F,QAAQ,CAAC,OAAO,eAAe,CAAC,CAuBlC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ;IACjB;;;;;;;OAOG;;CAEG,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { East, variant, printLocation } from "@elaraai/east";
|
|
6
|
+
import { UIComponentType } from "../component.js";
|
|
7
|
+
import { OutOfScopeException } from "@elaraai/east/internal";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Reactive Component Builder
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Creates a reactive component that re-renders independently when its dependencies change.
|
|
13
|
+
*
|
|
14
|
+
* @param body - Function body that returns UIComponentType. Must be a free function with no captures.
|
|
15
|
+
* @returns A ReactiveComponent variant of UIComponentType
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* The body function MUST be a free function - no captures from parent East scope.
|
|
19
|
+
* This is validated at IR creation time. Dependencies are automatically detected
|
|
20
|
+
* at runtime by tracking which state keys are read during execution.
|
|
21
|
+
*
|
|
22
|
+
* **What IS allowed:**
|
|
23
|
+
* - Platform functions (State.readTyped, State.writeTyped, etc.)
|
|
24
|
+
* - Module-level constants and functions (not captures)
|
|
25
|
+
* - Callbacks defined inside the body (East.function)
|
|
26
|
+
*
|
|
27
|
+
* **What is NOT allowed:**
|
|
28
|
+
* - Parent East function scope variables ($.let, parameters, state reads)
|
|
29
|
+
* - Any variable captured from enclosing East function scope
|
|
30
|
+
*
|
|
31
|
+
* @throws Error if the body captures variables from parent scope
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { East, IntegerType } from "@elaraai/east";
|
|
36
|
+
* import { Reactive, State, Text, UIComponentType } from "@elaraai/east-ui";
|
|
37
|
+
*
|
|
38
|
+
* const app = East.function([], UIComponentType, $ => {
|
|
39
|
+
* // This component re-renders only when "counter" changes
|
|
40
|
+
* return Reactive.Root($ => {
|
|
41
|
+
* const count = $.let(State.readTyped("counter", IntegerType)());
|
|
42
|
+
* const value = $.let(0n);
|
|
43
|
+
* $.match(count, {
|
|
44
|
+
* some: ($, v) => $.assign(value, v),
|
|
45
|
+
* });
|
|
46
|
+
* return Text.Root(East.str`Count: ${value}`);
|
|
47
|
+
* });
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function createReactive(body) {
|
|
52
|
+
// Create the inner render function
|
|
53
|
+
const renderFn = East.function([], UIComponentType, body);
|
|
54
|
+
// Get the IR and validate no captures from parent scope
|
|
55
|
+
try {
|
|
56
|
+
renderFn.toIR();
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (e instanceof OutOfScopeException) {
|
|
60
|
+
throw new Error(`Reactive.Root body must be a free function with no captures from parent scope. ` +
|
|
61
|
+
`Found capture from variable defined at ${printLocation(e.definedLocation)}. ` +
|
|
62
|
+
`Move state reads inside the Reactive body or use State for shared data.`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Return the ReactiveComponent variant
|
|
69
|
+
return East.value(variant("ReactiveComponent", {
|
|
70
|
+
render: renderFn
|
|
71
|
+
}), UIComponentType);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Reactive component for selective re-rendering.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Use `Reactive.Root(body)` to create a reactive component that re-renders
|
|
78
|
+
* independently when its state dependencies change. Dependencies are automatically
|
|
79
|
+
* detected at runtime. The body function must be a free function with no captures
|
|
80
|
+
* from parent East scope.
|
|
81
|
+
*/
|
|
82
|
+
export const Reactive = {
|
|
83
|
+
/**
|
|
84
|
+
* Creates a reactive component that re-renders independently.
|
|
85
|
+
*
|
|
86
|
+
* @param body - Function body returning UIComponentType. Must be a free function.
|
|
87
|
+
* @returns A ReactiveComponent variant
|
|
88
|
+
*
|
|
89
|
+
* @see {@link createReactive} for full documentation and examples
|
|
90
|
+
*/
|
|
91
|
+
Root: createReactive,
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reactive/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,IAAI,EAGJ,OAAO,EAAE,aAAa,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,SAAS,cAAc,CACnB,IAA0F;IAE1F,mCAAmC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;IAE1D,wDAAwD;IACxD,IAAI,CAAC;QACD,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,YAAY,mBAAmB,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACX,iFAAiF;gBACjF,0CAA0C,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI;gBAC9E,yEAAyE,CAC5E,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAED,uCAAuC;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE;QAC3C,MAAM,EAAE,QAAQ;KACnB,CAAC,EAAE,eAAe,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB;;;;;;;OAOG;IACH,IAAI,EAAE,cAAc;CACd,CAAC"}
|
|
@@ -32,7 +32,7 @@ declare function createCodeBlock(code: SubtypeExprOrValue<StringType>, style?: C
|
|
|
32
32
|
* {
|
|
33
33
|
* language: "typescript",
|
|
34
34
|
* showLineNumbers: true,
|
|
35
|
-
* highlightLines: [
|
|
35
|
+
* highlightLines: [2n],
|
|
36
36
|
* }
|
|
37
37
|
* );
|
|
38
38
|
* });
|
|
@@ -63,6 +63,7 @@ export declare const CodeBlock: {
|
|
|
63
63
|
highlightLines: import("@elaraai/east").OptionType<import("@elaraai/east").ArrayType<import("@elaraai/east").IntegerType>>;
|
|
64
64
|
maxHeight: import("@elaraai/east").OptionType<StringType>;
|
|
65
65
|
showCopyButton: import("@elaraai/east").OptionType<import("@elaraai/east").BooleanType>;
|
|
66
|
+
wordWrap: import("@elaraai/east").OptionType<import("@elaraai/east").BooleanType>;
|
|
66
67
|
title: import("@elaraai/east").OptionType<StringType>;
|
|
67
68
|
}>;
|
|
68
69
|
readonly Language: import("@elaraai/east").VariantType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/typography/code-block/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAEb,UAAU,EAEb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmC,KAAK,cAAc,EAAqB,MAAM,YAAY,CAAC;AAGrG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAMrG;;;;;;GAMG;AACH,iBAAS,eAAe,CACpB,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,EACpC,KAAK,CAAC,EAAE,cAAc,GACvB,QAAQ,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/typography/code-block/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAEb,UAAU,EAEb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmC,KAAK,cAAc,EAAqB,MAAM,YAAY,CAAC;AAGrG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAMrG;;;;;;GAMG;AACH,iBAAS,eAAe,CACpB,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,EACpC,KAAK,CAAC,EAAE,cAAc,GACvB,QAAQ,CAAC,eAAe,CAAC,CA8B3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMZ,CAAC"}
|
|
@@ -41,6 +41,7 @@ function createCodeBlock(code, style) {
|
|
|
41
41
|
highlightLines: style?.highlightLines ? variant("some", style.highlightLines) : variant("none", null),
|
|
42
42
|
maxHeight: style?.maxHeight ? variant("some", style.maxHeight) : variant("none", null),
|
|
43
43
|
showCopyButton: showCopyButtonValue !== undefined ? variant("some", showCopyButtonValue) : variant("none", null),
|
|
44
|
+
wordWrap: style?.wordWrap !== undefined ? variant("some", style.wordWrap) : variant("none", null),
|
|
44
45
|
title: style?.title ? variant("some", style.title) : variant("none", null),
|
|
45
46
|
}), UIComponentType);
|
|
46
47
|
}
|
|
@@ -62,7 +63,7 @@ function createCodeBlock(code, style) {
|
|
|
62
63
|
* {
|
|
63
64
|
* language: "typescript",
|
|
64
65
|
* showLineNumbers: true,
|
|
65
|
-
* highlightLines: [
|
|
66
|
+
* highlightLines: [2n],
|
|
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