@entifix/react-controls 0.1.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/i18n/catalog/en.d.ts +10 -0
- package/dist/i18n/catalog/en.d.ts.map +1 -0
- package/dist/i18n/catalog/en.js +211 -0
- package/dist/i18n/catalog/en.js.map +1 -0
- package/dist/i18n/catalog/es.d.ts +275 -0
- package/dist/i18n/catalog/es.d.ts.map +1 -0
- package/dist/i18n/catalog/es.js +261 -0
- package/dist/i18n/catalog/es.js.map +1 -0
- package/dist/i18n/catalog/index.d.ts +403 -0
- package/dist/i18n/catalog/index.d.ts.map +1 -0
- package/dist/i18n/catalog/index.js +23 -0
- package/dist/i18n/catalog/index.js.map +1 -0
- package/dist/i18n/entity-labels.d.ts +29 -0
- package/dist/i18n/entity-labels.d.ts.map +1 -0
- package/dist/i18n/entity-labels.js +49 -0
- package/dist/i18n/entity-labels.js.map +1 -0
- package/dist/i18n/fallback-catalogs.d.ts +5 -0
- package/dist/i18n/fallback-catalogs.d.ts.map +1 -0
- package/dist/i18n/fallback-catalogs.js +34 -0
- package/dist/i18n/fallback-catalogs.js.map +1 -0
- package/dist/i18n/i18n-context.d.ts +62 -0
- package/dist/i18n/i18n-context.d.ts.map +1 -0
- package/dist/i18n/i18n-context.js +128 -0
- package/dist/i18n/i18n-context.js.map +1 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/spec-support/catalogs.d.ts +2 -0
- package/dist/i18n/spec-support/catalogs.d.ts.map +1 -0
- package/dist/i18n/spec-support/catalogs.js +142 -0
- package/dist/i18n/spec-support/catalogs.js.map +1 -0
- package/dist/i18next/index.d.ts +20 -0
- package/dist/i18next/index.d.ts.map +1 -0
- package/dist/i18next/index.js +60 -0
- package/dist/i18next/index.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/preferences/index.d.ts +7 -0
- package/dist/preferences/index.d.ts.map +1 -0
- package/dist/preferences/index.js +8 -0
- package/dist/preferences/index.js.map +1 -0
- package/dist/preferences/indexeddb-ui-preferences-state.d.ts +16 -0
- package/dist/preferences/indexeddb-ui-preferences-state.d.ts.map +1 -0
- package/dist/preferences/indexeddb-ui-preferences-state.js +50 -0
- package/dist/preferences/indexeddb-ui-preferences-state.js.map +1 -0
- package/dist/preferences/local-storage-ui-preferences-state.d.ts +16 -0
- package/dist/preferences/local-storage-ui-preferences-state.d.ts.map +1 -0
- package/dist/preferences/local-storage-ui-preferences-state.js +51 -0
- package/dist/preferences/local-storage-ui-preferences-state.js.map +1 -0
- package/dist/preferences/ui-preferences-context.d.ts +16 -0
- package/dist/preferences/ui-preferences-context.d.ts.map +1 -0
- package/dist/preferences/ui-preferences-context.js +31 -0
- package/dist/preferences/ui-preferences-context.js.map +1 -0
- package/dist/preferences/ui-preferences-state.d.ts +23 -0
- package/dist/preferences/ui-preferences-state.d.ts.map +1 -0
- package/dist/preferences/ui-preferences-state.js +5 -0
- package/dist/preferences/ui-preferences-state.js.map +1 -0
- package/dist/preferences/use-ui-preference.d.ts +20 -0
- package/dist/preferences/use-ui-preference.d.ts.map +1 -0
- package/dist/preferences/use-ui-preference.js +72 -0
- package/dist/preferences/use-ui-preference.js.map +1 -0
- package/dist/preferences/use-viewport-mode.d.ts +33 -0
- package/dist/preferences/use-viewport-mode.d.ts.map +1 -0
- package/dist/preferences/use-viewport-mode.js +53 -0
- package/dist/preferences/use-viewport-mode.js.map +1 -0
- package/dist/primitives.d.ts +25 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +54 -0
- package/dist/primitives.js.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme-context.d.ts +26 -0
- package/dist/theme/theme-context.d.ts.map +1 -0
- package/dist/theme/theme-context.js +79 -0
- package/dist/theme/theme-context.js.map +1 -0
- package/dist/theme/types.d.ts +22 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +6 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/ui/actions/action-surfaces.d.ts +59 -0
- package/dist/ui/actions/action-surfaces.d.ts.map +1 -0
- package/dist/ui/actions/action-surfaces.js +109 -0
- package/dist/ui/actions/action-surfaces.js.map +1 -0
- package/dist/ui/actions/index.d.ts +2 -0
- package/dist/ui/actions/index.d.ts.map +1 -0
- package/dist/ui/actions/index.js +3 -0
- package/dist/ui/actions/index.js.map +1 -0
- package/dist/ui/atoms/button/button-link.d.ts +27 -0
- package/dist/ui/atoms/button/button-link.d.ts.map +1 -0
- package/dist/ui/atoms/button/button-link.js +23 -0
- package/dist/ui/atoms/button/button-link.js.map +1 -0
- package/dist/ui/atoms/button/button-recipe.d.ts +19 -0
- package/dist/ui/atoms/button/button-recipe.d.ts.map +1 -0
- package/dist/ui/atoms/button/button-recipe.js +42 -0
- package/dist/ui/atoms/button/button-recipe.js.map +1 -0
- package/dist/ui/atoms/button/button.d.ts +7 -0
- package/dist/ui/atoms/button/button.d.ts.map +1 -0
- package/dist/ui/atoms/button/button.js +22 -0
- package/dist/ui/atoms/button/button.js.map +1 -0
- package/dist/ui/atoms/button/index.d.ts +4 -0
- package/dist/ui/atoms/button/index.d.ts.map +1 -0
- package/dist/ui/atoms/button/index.js +5 -0
- package/dist/ui/atoms/button/index.js.map +1 -0
- package/dist/ui/atoms/cell-value/cell-value.d.ts +12 -0
- package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -0
- package/dist/ui/atoms/cell-value/cell-value.js +101 -0
- package/dist/ui/atoms/cell-value/cell-value.js.map +1 -0
- package/dist/ui/atoms/cell-value/index.d.ts +2 -0
- package/dist/ui/atoms/cell-value/index.d.ts.map +1 -0
- package/dist/ui/atoms/cell-value/index.js +3 -0
- package/dist/ui/atoms/cell-value/index.js.map +1 -0
- package/dist/ui/atoms/field/checkbox.d.ts +35 -0
- package/dist/ui/atoms/field/checkbox.d.ts.map +1 -0
- package/dist/ui/atoms/field/checkbox.js +46 -0
- package/dist/ui/atoms/field/checkbox.js.map +1 -0
- package/dist/ui/atoms/field/field.d.ts +4 -0
- package/dist/ui/atoms/field/field.d.ts.map +1 -0
- package/dist/ui/atoms/field/field.js +29 -0
- package/dist/ui/atoms/field/field.js.map +1 -0
- package/dist/ui/atoms/field/index.d.ts +3 -0
- package/dist/ui/atoms/field/index.d.ts.map +1 -0
- package/dist/ui/atoms/field/index.js +4 -0
- package/dist/ui/atoms/field/index.js.map +1 -0
- package/dist/ui/atoms/field-control/field-control.d.ts +50 -0
- package/dist/ui/atoms/field-control/field-control.d.ts.map +1 -0
- package/dist/ui/atoms/field-control/field-control.js +82 -0
- package/dist/ui/atoms/field-control/field-control.js.map +1 -0
- package/dist/ui/atoms/field-control/index.d.ts +2 -0
- package/dist/ui/atoms/field-control/index.d.ts.map +1 -0
- package/dist/ui/atoms/field-control/index.js +3 -0
- package/dist/ui/atoms/field-control/index.js.map +1 -0
- package/dist/ui/atoms/skeleton/index.d.ts +2 -0
- package/dist/ui/atoms/skeleton/index.d.ts.map +1 -0
- package/dist/ui/atoms/skeleton/index.js +3 -0
- package/dist/ui/atoms/skeleton/index.js.map +1 -0
- package/dist/ui/atoms/skeleton/skeleton.d.ts +21 -0
- package/dist/ui/atoms/skeleton/skeleton.d.ts.map +1 -0
- package/dist/ui/atoms/skeleton/skeleton.js +33 -0
- package/dist/ui/atoms/skeleton/skeleton.js.map +1 -0
- package/dist/ui/atoms/table/index.d.ts +2 -0
- package/dist/ui/atoms/table/index.d.ts.map +1 -0
- package/dist/ui/atoms/table/index.js +3 -0
- package/dist/ui/atoms/table/index.js.map +1 -0
- package/dist/ui/atoms/table/table.d.ts +30 -0
- package/dist/ui/atoms/table/table.d.ts.map +1 -0
- package/dist/ui/atoms/table/table.js +84 -0
- package/dist/ui/atoms/table/table.js.map +1 -0
- package/dist/ui/atoms/text/index.d.ts +2 -0
- package/dist/ui/atoms/text/index.d.ts.map +1 -0
- package/dist/ui/atoms/text/index.js +3 -0
- package/dist/ui/atoms/text/index.js.map +1 -0
- package/dist/ui/atoms/text/text.d.ts +86 -0
- package/dist/ui/atoms/text/text.d.ts.map +1 -0
- package/dist/ui/atoms/text/text.js +221 -0
- package/dist/ui/atoms/text/text.js.map +1 -0
- package/dist/ui/layout/_demo.d.ts +6 -0
- package/dist/ui/layout/_demo.d.ts.map +1 -0
- package/dist/ui/layout/_demo.js +11 -0
- package/dist/ui/layout/_demo.js.map +1 -0
- package/dist/ui/layout/_shared.d.ts +9 -0
- package/dist/ui/layout/_shared.d.ts.map +1 -0
- package/dist/ui/layout/_shared.js +30 -0
- package/dist/ui/layout/_shared.js.map +1 -0
- package/dist/ui/layout/box/box.d.ts +10 -0
- package/dist/ui/layout/box/box.d.ts.map +1 -0
- package/dist/ui/layout/box/box.js +28 -0
- package/dist/ui/layout/box/box.js.map +1 -0
- package/dist/ui/layout/box/index.d.ts +2 -0
- package/dist/ui/layout/box/index.d.ts.map +1 -0
- package/dist/ui/layout/box/index.js +3 -0
- package/dist/ui/layout/box/index.js.map +1 -0
- package/dist/ui/layout/center/center.d.ts +13 -0
- package/dist/ui/layout/center/center.d.ts.map +1 -0
- package/dist/ui/layout/center/center.js +22 -0
- package/dist/ui/layout/center/center.js.map +1 -0
- package/dist/ui/layout/center/index.d.ts +2 -0
- package/dist/ui/layout/center/index.d.ts.map +1 -0
- package/dist/ui/layout/center/index.js +3 -0
- package/dist/ui/layout/center/index.js.map +1 -0
- package/dist/ui/layout/cluster/cluster.d.ts +11 -0
- package/dist/ui/layout/cluster/cluster.d.ts.map +1 -0
- package/dist/ui/layout/cluster/cluster.js +19 -0
- package/dist/ui/layout/cluster/cluster.js.map +1 -0
- package/dist/ui/layout/cluster/index.d.ts +2 -0
- package/dist/ui/layout/cluster/index.d.ts.map +1 -0
- package/dist/ui/layout/cluster/index.js +3 -0
- package/dist/ui/layout/cluster/index.js.map +1 -0
- package/dist/ui/layout/cover/cover.d.ts +26 -0
- package/dist/ui/layout/cover/cover.d.ts.map +1 -0
- package/dist/ui/layout/cover/cover.js +57 -0
- package/dist/ui/layout/cover/cover.js.map +1 -0
- package/dist/ui/layout/cover/index.d.ts +2 -0
- package/dist/ui/layout/cover/index.d.ts.map +1 -0
- package/dist/ui/layout/cover/index.js +3 -0
- package/dist/ui/layout/cover/index.js.map +1 -0
- package/dist/ui/layout/grid/grid.d.ts +14 -0
- package/dist/ui/layout/grid/grid.d.ts.map +1 -0
- package/dist/ui/layout/grid/grid.js +25 -0
- package/dist/ui/layout/grid/grid.js.map +1 -0
- package/dist/ui/layout/grid/index.d.ts +2 -0
- package/dist/ui/layout/grid/index.d.ts.map +1 -0
- package/dist/ui/layout/grid/index.js +3 -0
- package/dist/ui/layout/grid/index.js.map +1 -0
- package/dist/ui/layout/sidebar/index.d.ts +2 -0
- package/dist/ui/layout/sidebar/index.d.ts.map +1 -0
- package/dist/ui/layout/sidebar/index.js +3 -0
- package/dist/ui/layout/sidebar/index.js.map +1 -0
- package/dist/ui/layout/sidebar/sidebar.d.ts +33 -0
- package/dist/ui/layout/sidebar/sidebar.d.ts.map +1 -0
- package/dist/ui/layout/sidebar/sidebar.js +54 -0
- package/dist/ui/layout/sidebar/sidebar.js.map +1 -0
- package/dist/ui/layout/switcher/index.d.ts +2 -0
- package/dist/ui/layout/switcher/index.d.ts.map +1 -0
- package/dist/ui/layout/switcher/index.js +3 -0
- package/dist/ui/layout/switcher/index.js.map +1 -0
- package/dist/ui/layout/switcher/switcher.d.ts +15 -0
- package/dist/ui/layout/switcher/switcher.d.ts.map +1 -0
- package/dist/ui/layout/switcher/switcher.js +26 -0
- package/dist/ui/layout/switcher/switcher.js.map +1 -0
- package/dist/ui/molecules/breadcrumbs/breadcrumbs.d.ts +27 -0
- package/dist/ui/molecules/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/ui/molecules/breadcrumbs/breadcrumbs.js +50 -0
- package/dist/ui/molecules/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/ui/molecules/breadcrumbs/index.d.ts +2 -0
- package/dist/ui/molecules/breadcrumbs/index.d.ts.map +1 -0
- package/dist/ui/molecules/breadcrumbs/index.js +3 -0
- package/dist/ui/molecules/breadcrumbs/index.js.map +1 -0
- package/dist/ui/molecules/bulk-action-bar/bulk-action-bar.d.ts +47 -0
- package/dist/ui/molecules/bulk-action-bar/bulk-action-bar.d.ts.map +1 -0
- package/dist/ui/molecules/bulk-action-bar/bulk-action-bar.js +63 -0
- package/dist/ui/molecules/bulk-action-bar/bulk-action-bar.js.map +1 -0
- package/dist/ui/molecules/bulk-action-bar/index.d.ts +2 -0
- package/dist/ui/molecules/bulk-action-bar/index.d.ts.map +1 -0
- package/dist/ui/molecules/bulk-action-bar/index.js +3 -0
- package/dist/ui/molecules/bulk-action-bar/index.js.map +1 -0
- package/dist/ui/molecules/bulk-result/bulk-result.d.ts +31 -0
- package/dist/ui/molecules/bulk-result/bulk-result.d.ts.map +1 -0
- package/dist/ui/molecules/bulk-result/bulk-result.js +86 -0
- package/dist/ui/molecules/bulk-result/bulk-result.js.map +1 -0
- package/dist/ui/molecules/bulk-result/index.d.ts +2 -0
- package/dist/ui/molecules/bulk-result/index.d.ts.map +1 -0
- package/dist/ui/molecules/bulk-result/index.js +3 -0
- package/dist/ui/molecules/bulk-result/index.js.map +1 -0
- package/dist/ui/molecules/card/card.d.ts +5 -0
- package/dist/ui/molecules/card/card.d.ts.map +1 -0
- package/dist/ui/molecules/card/card.js +14 -0
- package/dist/ui/molecules/card/card.js.map +1 -0
- package/dist/ui/molecules/card/index.d.ts +2 -0
- package/dist/ui/molecules/card/index.d.ts.map +1 -0
- package/dist/ui/molecules/card/index.js +3 -0
- package/dist/ui/molecules/card/index.js.map +1 -0
- package/dist/ui/molecules/column-settings/column-settings.d.ts +29 -0
- package/dist/ui/molecules/column-settings/column-settings.d.ts.map +1 -0
- package/dist/ui/molecules/column-settings/column-settings.js +117 -0
- package/dist/ui/molecules/column-settings/column-settings.js.map +1 -0
- package/dist/ui/molecules/column-settings/index.d.ts +2 -0
- package/dist/ui/molecules/column-settings/index.d.ts.map +1 -0
- package/dist/ui/molecules/column-settings/index.js +3 -0
- package/dist/ui/molecules/column-settings/index.js.map +1 -0
- package/dist/ui/molecules/confirm-dialog/confirm-dialog.d.ts +31 -0
- package/dist/ui/molecules/confirm-dialog/confirm-dialog.d.ts.map +1 -0
- package/dist/ui/molecules/confirm-dialog/confirm-dialog.js +68 -0
- package/dist/ui/molecules/confirm-dialog/confirm-dialog.js.map +1 -0
- package/dist/ui/molecules/confirm-dialog/index.d.ts +2 -0
- package/dist/ui/molecules/confirm-dialog/index.d.ts.map +1 -0
- package/dist/ui/molecules/confirm-dialog/index.js +3 -0
- package/dist/ui/molecules/confirm-dialog/index.js.map +1 -0
- package/dist/ui/molecules/drawer/drawer.d.ts +25 -0
- package/dist/ui/molecules/drawer/drawer.d.ts.map +1 -0
- package/dist/ui/molecules/drawer/drawer.js +60 -0
- package/dist/ui/molecules/drawer/drawer.js.map +1 -0
- package/dist/ui/molecules/drawer/index.d.ts +2 -0
- package/dist/ui/molecules/drawer/index.d.ts.map +1 -0
- package/dist/ui/molecules/drawer/index.js +3 -0
- package/dist/ui/molecules/drawer/index.js.map +1 -0
- package/dist/ui/molecules/entity-link-input/entity-link-input.d.ts +36 -0
- package/dist/ui/molecules/entity-link-input/entity-link-input.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-input/entity-link-input.js +191 -0
- package/dist/ui/molecules/entity-link-input/entity-link-input.js.map +1 -0
- package/dist/ui/molecules/entity-link-input/index.d.ts +2 -0
- package/dist/ui/molecules/entity-link-input/index.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-input/index.js +3 -0
- package/dist/ui/molecules/entity-link-input/index.js.map +1 -0
- package/dist/ui/molecules/entity-link-picker/entity-link-picker.d.ts +19 -0
- package/dist/ui/molecules/entity-link-picker/entity-link-picker.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-picker/entity-link-picker.js +78 -0
- package/dist/ui/molecules/entity-link-picker/entity-link-picker.js.map +1 -0
- package/dist/ui/molecules/entity-link-picker/index.d.ts +2 -0
- package/dist/ui/molecules/entity-link-picker/index.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-picker/index.js +3 -0
- package/dist/ui/molecules/entity-link-picker/index.js.map +1 -0
- package/dist/ui/molecules/entity-record-card/entity-record-card.d.ts +30 -0
- package/dist/ui/molecules/entity-record-card/entity-record-card.d.ts.map +1 -0
- package/dist/ui/molecules/entity-record-card/entity-record-card.js +39 -0
- package/dist/ui/molecules/entity-record-card/entity-record-card.js.map +1 -0
- package/dist/ui/molecules/entity-record-card/index.d.ts +2 -0
- package/dist/ui/molecules/entity-record-card/index.d.ts.map +1 -0
- package/dist/ui/molecules/entity-record-card/index.js +3 -0
- package/dist/ui/molecules/entity-record-card/index.js.map +1 -0
- package/dist/ui/molecules/filter-builder/filter-builder.d.ts +19 -0
- package/dist/ui/molecules/filter-builder/filter-builder.d.ts.map +1 -0
- package/dist/ui/molecules/filter-builder/filter-builder.js +333 -0
- package/dist/ui/molecules/filter-builder/filter-builder.js.map +1 -0
- package/dist/ui/molecules/filter-builder/filter-operators.d.ts +20 -0
- package/dist/ui/molecules/filter-builder/filter-operators.d.ts.map +1 -0
- package/dist/ui/molecules/filter-builder/filter-operators.js +56 -0
- package/dist/ui/molecules/filter-builder/filter-operators.js.map +1 -0
- package/dist/ui/molecules/filter-builder/index.d.ts +3 -0
- package/dist/ui/molecules/filter-builder/index.d.ts.map +1 -0
- package/dist/ui/molecules/filter-builder/index.js +4 -0
- package/dist/ui/molecules/filter-builder/index.js.map +1 -0
- package/dist/ui/molecules/loading-boundary/index.d.ts +2 -0
- package/dist/ui/molecules/loading-boundary/index.d.ts.map +1 -0
- package/dist/ui/molecules/loading-boundary/index.js +3 -0
- package/dist/ui/molecules/loading-boundary/index.js.map +1 -0
- package/dist/ui/molecules/loading-boundary/loading-boundary.d.ts +27 -0
- package/dist/ui/molecules/loading-boundary/loading-boundary.d.ts.map +1 -0
- package/dist/ui/molecules/loading-boundary/loading-boundary.js +42 -0
- package/dist/ui/molecules/loading-boundary/loading-boundary.js.map +1 -0
- package/dist/ui/molecules/menu/index.d.ts +2 -0
- package/dist/ui/molecules/menu/index.d.ts.map +1 -0
- package/dist/ui/molecules/menu/index.js +3 -0
- package/dist/ui/molecules/menu/index.js.map +1 -0
- package/dist/ui/molecules/menu/menu.d.ts +37 -0
- package/dist/ui/molecules/menu/menu.d.ts.map +1 -0
- package/dist/ui/molecules/menu/menu.js +71 -0
- package/dist/ui/molecules/menu/menu.js.map +1 -0
- package/dist/ui/molecules/pagination/index.d.ts +2 -0
- package/dist/ui/molecules/pagination/index.d.ts.map +1 -0
- package/dist/ui/molecules/pagination/index.js +3 -0
- package/dist/ui/molecules/pagination/index.js.map +1 -0
- package/dist/ui/molecules/pagination/pagination.d.ts +13 -0
- package/dist/ui/molecules/pagination/pagination.d.ts.map +1 -0
- package/dist/ui/molecules/pagination/pagination.js +68 -0
- package/dist/ui/molecules/pagination/pagination.js.map +1 -0
- package/dist/ui/molecules/sort-builder/index.d.ts +2 -0
- package/dist/ui/molecules/sort-builder/index.d.ts.map +1 -0
- package/dist/ui/molecules/sort-builder/index.js +3 -0
- package/dist/ui/molecules/sort-builder/index.js.map +1 -0
- package/dist/ui/molecules/sort-builder/sort-builder.d.ts +18 -0
- package/dist/ui/molecules/sort-builder/sort-builder.d.ts.map +1 -0
- package/dist/ui/molecules/sort-builder/sort-builder.js +185 -0
- package/dist/ui/molecules/sort-builder/sort-builder.js.map +1 -0
- package/dist/ui/molecules/stack/index.d.ts +2 -0
- package/dist/ui/molecules/stack/index.d.ts.map +1 -0
- package/dist/ui/molecules/stack/index.js +3 -0
- package/dist/ui/molecules/stack/index.js.map +1 -0
- package/dist/ui/molecules/stack/stack.d.ts +12 -0
- package/dist/ui/molecules/stack/stack.d.ts.map +1 -0
- package/dist/ui/molecules/stack/stack.js +36 -0
- package/dist/ui/molecules/stack/stack.js.map +1 -0
- package/dist/ui/molecules/tab-strip/index.d.ts +2 -0
- package/dist/ui/molecules/tab-strip/index.d.ts.map +1 -0
- package/dist/ui/molecules/tab-strip/index.js +3 -0
- package/dist/ui/molecules/tab-strip/index.js.map +1 -0
- package/dist/ui/molecules/tab-strip/tab-strip.d.ts +29 -0
- package/dist/ui/molecules/tab-strip/tab-strip.d.ts.map +1 -0
- package/dist/ui/molecules/tab-strip/tab-strip.js +82 -0
- package/dist/ui/molecules/tab-strip/tab-strip.js.map +1 -0
- package/dist/ui/molecules/table-toolbar/index.d.ts +2 -0
- package/dist/ui/molecules/table-toolbar/index.d.ts.map +1 -0
- package/dist/ui/molecules/table-toolbar/index.js +3 -0
- package/dist/ui/molecules/table-toolbar/index.js.map +1 -0
- package/dist/ui/molecules/table-toolbar/table-toolbar.d.ts +13 -0
- package/dist/ui/molecules/table-toolbar/table-toolbar.d.ts.map +1 -0
- package/dist/ui/molecules/table-toolbar/table-toolbar.js +28 -0
- package/dist/ui/molecules/table-toolbar/table-toolbar.js.map +1 -0
- package/dist/ui/molecules/theme-switcher/index.d.ts +2 -0
- package/dist/ui/molecules/theme-switcher/index.d.ts.map +1 -0
- package/dist/ui/molecules/theme-switcher/index.js +3 -0
- package/dist/ui/molecules/theme-switcher/index.js.map +1 -0
- package/dist/ui/molecules/theme-switcher/theme-switcher.d.ts +6 -0
- package/dist/ui/molecules/theme-switcher/theme-switcher.d.ts.map +1 -0
- package/dist/ui/molecules/theme-switcher/theme-switcher.js +24 -0
- package/dist/ui/molecules/theme-switcher/theme-switcher.js.map +1 -0
- package/dist/ui/organisms/command-palette/command-palette.d.ts +67 -0
- package/dist/ui/organisms/command-palette/command-palette.d.ts.map +1 -0
- package/dist/ui/organisms/command-palette/command-palette.js +226 -0
- package/dist/ui/organisms/command-palette/command-palette.js.map +1 -0
- package/dist/ui/organisms/command-palette/index.d.ts +2 -0
- package/dist/ui/organisms/command-palette/index.d.ts.map +1 -0
- package/dist/ui/organisms/command-palette/index.js +3 -0
- package/dist/ui/organisms/command-palette/index.js.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.d.ts +43 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.d.ts.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.js +281 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.js.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.types.d.ts +49 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.types.d.ts.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.types.js +3 -0
- package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.types.js.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/index.d.ts +3 -0
- package/dist/ui/organisms/entity-detail-grid/index.d.ts.map +1 -0
- package/dist/ui/organisms/entity-detail-grid/index.js +4 -0
- package/dist/ui/organisms/entity-detail-grid/index.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form-slots.d.ts +53 -0
- package/dist/ui/organisms/entity-form/entity-form-slots.d.ts.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form-slots.js +44 -0
- package/dist/ui/organisms/entity-form/entity-form-slots.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.d.ts +4 -0
- package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.js +494 -0
- package/dist/ui/organisms/entity-form/entity-form.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts +151 -0
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.types.js +3 -0
- package/dist/ui/organisms/entity-form/entity-form.types.js.map +1 -0
- package/dist/ui/organisms/entity-form/index.d.ts +5 -0
- package/dist/ui/organisms/entity-form/index.d.ts.map +1 -0
- package/dist/ui/organisms/entity-form/index.js +6 -0
- package/dist/ui/organisms/entity-form/index.js.map +1 -0
- package/dist/ui/organisms/entity-form/use-entity-form-fields.d.ts +13 -0
- package/dist/ui/organisms/entity-form/use-entity-form-fields.d.ts.map +1 -0
- package/dist/ui/organisms/entity-form/use-entity-form-fields.js +50 -0
- package/dist/ui/organisms/entity-form/use-entity-form-fields.js.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts +55 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.js +50 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.js.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table.d.ts +4 -0
- package/dist/ui/organisms/entity-table/entity-table.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table.js +529 -0
- package/dist/ui/organisms/entity-table/entity-table.js.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table.types.d.ts +126 -0
- package/dist/ui/organisms/entity-table/entity-table.types.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table.types.js +3 -0
- package/dist/ui/organisms/entity-table/entity-table.types.js.map +1 -0
- package/dist/ui/organisms/entity-table/index.d.ts +5 -0
- package/dist/ui/organisms/entity-table/index.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/index.js +6 -0
- package/dist/ui/organisms/entity-table/index.js.map +1 -0
- package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts +29 -0
- package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js +103 -0
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js.map +1 -0
- package/dist/ui/organisms/top-bar/index.d.ts +2 -0
- package/dist/ui/organisms/top-bar/index.d.ts.map +1 -0
- package/dist/ui/organisms/top-bar/index.js +3 -0
- package/dist/ui/organisms/top-bar/index.js.map +1 -0
- package/dist/ui/organisms/top-bar/top-bar.d.ts +20 -0
- package/dist/ui/organisms/top-bar/top-bar.d.ts.map +1 -0
- package/dist/ui/organisms/top-bar/top-bar.js +43 -0
- package/dist/ui/organisms/top-bar/top-bar.js.map +1 -0
- package/dist/ui/organisms/wizard/index.d.ts +3 -0
- package/dist/ui/organisms/wizard/index.d.ts.map +1 -0
- package/dist/ui/organisms/wizard/index.js +4 -0
- package/dist/ui/organisms/wizard/index.js.map +1 -0
- package/dist/ui/organisms/wizard/wizard.d.ts +21 -0
- package/dist/ui/organisms/wizard/wizard.d.ts.map +1 -0
- package/dist/ui/organisms/wizard/wizard.js +260 -0
- package/dist/ui/organisms/wizard/wizard.js.map +1 -0
- package/dist/ui/organisms/wizard/wizard.types.d.ts +83 -0
- package/dist/ui/organisms/wizard/wizard.types.d.ts.map +1 -0
- package/dist/ui/organisms/wizard/wizard.types.js +3 -0
- package/dist/ui/organisms/wizard/wizard.types.js.map +1 -0
- package/dist/ui/utils/cn.d.ts +4 -0
- package/dist/ui/utils/cn.d.ts.map +1 -0
- package/dist/ui/utils/cn.js +5 -0
- package/dist/ui/utils/cn.js.map +1 -0
- package/dist/ui/utils/use-hotkey.d.ts +31 -0
- package/dist/ui/utils/use-hotkey.d.ts.map +1 -0
- package/dist/ui/utils/use-hotkey.js +69 -0
- package/dist/ui/utils/use-hotkey.js.map +1 -0
- package/package.json +118 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { makeFormatters } from '@entifix/core';
|
|
4
|
+
import { createI18n, sharedFallbackI18n } from '@entifix/i18n';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { I18nextProvider, initReactI18next } from 'react-i18next';
|
|
7
|
+
import { TranslatorProvider } from '../i18n/i18n-context.js';
|
|
8
|
+
/**
|
|
9
|
+
* The i18next binding of the translator port.
|
|
10
|
+
*
|
|
11
|
+
* Behind a subpath, with `i18next`, `react-i18next` and `@entifix/i18n` as
|
|
12
|
+
* optional peers, so the controls themselves stay adoptable without any of it.
|
|
13
|
+
* Package-level dependencies are not per-subpath — the optional peers are what
|
|
14
|
+
* does the work, the same arrangement as `@entifix/mongo/transactions`.
|
|
15
|
+
*/ const translatorFor = (instance, locale)=>({
|
|
16
|
+
locale,
|
|
17
|
+
formatters: makeFormatters(locale),
|
|
18
|
+
// `Translator.t` takes a plain string, because the port has to be
|
|
19
|
+
// implementable without i18next at all. i18next's own `Namespace` is whatever
|
|
20
|
+
// union the host declared, and it is not this adapter's job to know it — the
|
|
21
|
+
// key stays checked at the `useT('shell')` call site, where the augmentation
|
|
22
|
+
// is in scope.
|
|
23
|
+
t: (ns, key, params)=>{
|
|
24
|
+
const fixed = instance.getFixedT(locale, ns != null ? ns : null);
|
|
25
|
+
return fixed(key, params);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Binds one locale to the subtree. A fresh i18next instance per locale keeps
|
|
30
|
+
* concurrent server renders from sharing mutable `lng` state; `I18nextProvider`
|
|
31
|
+
* carries it so any nested `useTranslation` resolves against the same catalogs.
|
|
32
|
+
*/ export function I18nProvider({ locale, children }) {
|
|
33
|
+
const instance = useMemo(()=>createI18n(locale, [
|
|
34
|
+
initReactI18next
|
|
35
|
+
]), [
|
|
36
|
+
locale
|
|
37
|
+
]);
|
|
38
|
+
const translator = useMemo(()=>translatorFor(instance, locale), [
|
|
39
|
+
instance,
|
|
40
|
+
locale
|
|
41
|
+
]);
|
|
42
|
+
return /*#__PURE__*/ _jsx(TranslatorProvider, {
|
|
43
|
+
translator: translator,
|
|
44
|
+
children: /*#__PURE__*/ _jsx(I18nextProvider, {
|
|
45
|
+
i18n: instance,
|
|
46
|
+
children: children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A translator over the shared fallback instance, for a caller that has
|
|
52
|
+
* catalogs installed but no provider in the tree — a spec, a Storybook
|
|
53
|
+
* decorator that renders one control.
|
|
54
|
+
*/ export function fallbackI18nextTranslator(locale) {
|
|
55
|
+
return translatorFor(sharedFallbackI18n([
|
|
56
|
+
initReactI18next
|
|
57
|
+
]), locale);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/i18next/index.tsx"],"sourcesContent":["'use client';\n\nimport { type Locale, makeFormatters } from '@entifix/core';\nimport { createI18n, sharedFallbackI18n } from '@entifix/i18n';\nimport type { i18n as I18nInstance } from 'i18next';\nimport { type PropsWithChildren, useMemo } from 'react';\nimport { I18nextProvider, initReactI18next } from 'react-i18next';\n\nimport { type Translator, TranslatorProvider } from '../i18n/i18n-context.js';\n\n/**\n * The i18next binding of the translator port.\n *\n * Behind a subpath, with `i18next`, `react-i18next` and `@entifix/i18n` as\n * optional peers, so the controls themselves stay adoptable without any of it.\n * Package-level dependencies are not per-subpath — the optional peers are what\n * does the work, the same arrangement as `@entifix/mongo/transactions`.\n */\nconst translatorFor = (instance: I18nInstance, locale: Locale): Translator => ({\n locale,\n formatters: makeFormatters(locale),\n // `Translator.t` takes a plain string, because the port has to be\n // implementable without i18next at all. i18next's own `Namespace` is whatever\n // union the host declared, and it is not this adapter's job to know it — the\n // key stays checked at the `useT('shell')` call site, where the augmentation\n // is in scope.\n t: (ns, key, params) => {\n const fixed = instance.getFixedT(\n locale,\n (ns ?? null) as Parameters<I18nInstance['getFixedT']>[1],\n ) as (key: string, params?: Record<string, unknown>) => string;\n return fixed(key, params);\n },\n});\n\nexport interface I18nProviderProps extends PropsWithChildren {\n /** Negotiated upstream — by the Next middleware in an app, by a decorator in Storybook. */\n locale: Locale;\n}\n\n/**\n * Binds one locale to the subtree. A fresh i18next instance per locale keeps\n * concurrent server renders from sharing mutable `lng` state; `I18nextProvider`\n * carries it so any nested `useTranslation` resolves against the same catalogs.\n */\nexport function I18nProvider({ locale, children }: I18nProviderProps) {\n const instance = useMemo(\n () => createI18n(locale, [initReactI18next]),\n [locale],\n );\n const translator = useMemo(\n () => translatorFor(instance, locale),\n [instance, locale],\n );\n\n return (\n <TranslatorProvider translator={translator}>\n <I18nextProvider i18n={instance}>{children}</I18nextProvider>\n </TranslatorProvider>\n );\n}\n\n/**\n * A translator over the shared fallback instance, for a caller that has\n * catalogs installed but no provider in the tree — a spec, a Storybook\n * decorator that renders one control.\n */\nexport function fallbackI18nextTranslator(locale: Locale): Translator {\n return translatorFor(sharedFallbackI18n([initReactI18next]), locale);\n}\n"],"names":["makeFormatters","createI18n","sharedFallbackI18n","useMemo","I18nextProvider","initReactI18next","TranslatorProvider","translatorFor","instance","locale","formatters","t","ns","key","params","fixed","getFixedT","I18nProvider","children","translator","i18n","fallbackI18nextTranslator"],"mappings":"AAAA;;AAEA,SAAsBA,cAAc,QAAQ,gBAAgB;AAC5D,SAASC,UAAU,EAAEC,kBAAkB,QAAQ,gBAAgB;AAE/D,SAAiCC,OAAO,QAAQ,QAAQ;AACxD,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,gBAAgB;AAElE,SAA0BC,kBAAkB,QAAQ,0BAA0B;AAE9E;;;;;;;CAOC,GACD,MAAMC,gBAAgB,CAACC,UAAwBC,SAAgC,CAAA;QAC7EA;QACAC,YAAYV,eAAeS;QAC3B,kEAAkE;QAClE,8EAA8E;QAC9E,6EAA6E;QAC7E,6EAA6E;QAC7E,eAAe;QACfE,GAAG,CAACC,IAAIC,KAAKC;YACX,MAAMC,QAAQP,SAASQ,SAAS,CAC9BP,QACCG,aAAAA,KAAM;YAET,OAAOG,MAAMF,KAAKC;QACpB;IACF,CAAA;AAOA;;;;CAIC,GACD,OAAO,SAASG,aAAa,EAAER,MAAM,EAAES,QAAQ,EAAqB;IAClE,MAAMV,WAAWL,QACf,IAAMF,WAAWQ,QAAQ;YAACJ;SAAiB,GAC3C;QAACI;KAAO;IAEV,MAAMU,aAAahB,QACjB,IAAMI,cAAcC,UAAUC,SAC9B;QAACD;QAAUC;KAAO;IAGpB,qBACE,KAACH;QAAmBa,YAAYA;kBAC9B,cAAA,KAACf;YAAgBgB,MAAMZ;sBAAWU;;;AAGxC;AAEA;;;;CAIC,GACD,OAAO,SAASG,0BAA0BZ,MAAc;IACtD,OAAOF,cAAcL,mBAAmB;QAACG;KAAiB,GAAGI;AAC/D"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export * from './i18n/index.js';
|
|
2
|
+
export * from './preferences/index.js';
|
|
3
|
+
export * from './theme/index.js';
|
|
4
|
+
export * from './ui/actions/index.js';
|
|
5
|
+
export * from './ui/atoms/button/index.js';
|
|
6
|
+
export * from './ui/atoms/cell-value/index.js';
|
|
7
|
+
export * from './ui/atoms/field/index.js';
|
|
8
|
+
export * from './ui/atoms/field-control/index.js';
|
|
9
|
+
export * from './ui/atoms/skeleton/index.js';
|
|
10
|
+
export * from './ui/atoms/table/index.js';
|
|
11
|
+
export * from './ui/atoms/text/index.js';
|
|
12
|
+
export * from './ui/layout/box/index.js';
|
|
13
|
+
export * from './ui/layout/center/index.js';
|
|
14
|
+
export * from './ui/layout/cluster/index.js';
|
|
15
|
+
export * from './ui/layout/cover/index.js';
|
|
16
|
+
export * from './ui/layout/grid/index.js';
|
|
17
|
+
export * from './ui/layout/sidebar/index.js';
|
|
18
|
+
export * from './ui/layout/switcher/index.js';
|
|
19
|
+
export * from './ui/molecules/breadcrumbs/index.js';
|
|
20
|
+
export * from './ui/molecules/bulk-action-bar/index.js';
|
|
21
|
+
export * from './ui/molecules/bulk-result/index.js';
|
|
22
|
+
export * from './ui/molecules/card/index.js';
|
|
23
|
+
export * from './ui/molecules/column-settings/index.js';
|
|
24
|
+
export * from './ui/molecules/confirm-dialog/index.js';
|
|
25
|
+
export * from './ui/molecules/drawer/index.js';
|
|
26
|
+
export * from './ui/molecules/entity-link-input/index.js';
|
|
27
|
+
export * from './ui/molecules/entity-link-picker/index.js';
|
|
28
|
+
export * from './ui/molecules/entity-record-card/index.js';
|
|
29
|
+
export * from './ui/molecules/filter-builder/index.js';
|
|
30
|
+
export * from './ui/molecules/loading-boundary/index.js';
|
|
31
|
+
export * from './ui/molecules/menu/index.js';
|
|
32
|
+
export * from './ui/molecules/pagination/index.js';
|
|
33
|
+
export * from './ui/molecules/sort-builder/index.js';
|
|
34
|
+
export * from './ui/molecules/stack/index.js';
|
|
35
|
+
export * from './ui/molecules/tab-strip/index.js';
|
|
36
|
+
export * from './ui/molecules/table-toolbar/index.js';
|
|
37
|
+
export * from './ui/molecules/theme-switcher/index.js';
|
|
38
|
+
export * from './ui/organisms/command-palette/index.js';
|
|
39
|
+
export * from './ui/organisms/entity-detail-grid/index.js';
|
|
40
|
+
export * from './ui/organisms/entity-form/index.js';
|
|
41
|
+
export * from './ui/organisms/entity-table/index.js';
|
|
42
|
+
export * from './ui/organisms/top-bar/index.js';
|
|
43
|
+
export * from './ui/organisms/wizard/index.js';
|
|
44
|
+
export * from './ui/utils/cn.js';
|
|
45
|
+
export * from './ui/utils/use-hotkey.js';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export * from './i18n/index.js';
|
|
2
|
+
export * from './preferences/index.js';
|
|
3
|
+
export * from './theme/index.js';
|
|
4
|
+
export * from './ui/actions/index.js';
|
|
5
|
+
export * from './ui/atoms/button/index.js';
|
|
6
|
+
export * from './ui/atoms/cell-value/index.js';
|
|
7
|
+
export * from './ui/atoms/field/index.js';
|
|
8
|
+
export * from './ui/atoms/field-control/index.js';
|
|
9
|
+
export * from './ui/atoms/skeleton/index.js';
|
|
10
|
+
export * from './ui/atoms/table/index.js';
|
|
11
|
+
export * from './ui/atoms/text/index.js';
|
|
12
|
+
export * from './ui/layout/box/index.js';
|
|
13
|
+
export * from './ui/layout/center/index.js';
|
|
14
|
+
export * from './ui/layout/cluster/index.js';
|
|
15
|
+
export * from './ui/layout/cover/index.js';
|
|
16
|
+
export * from './ui/layout/grid/index.js';
|
|
17
|
+
export * from './ui/layout/sidebar/index.js';
|
|
18
|
+
export * from './ui/layout/switcher/index.js';
|
|
19
|
+
export * from './ui/molecules/breadcrumbs/index.js';
|
|
20
|
+
export * from './ui/molecules/bulk-action-bar/index.js';
|
|
21
|
+
export * from './ui/molecules/bulk-result/index.js';
|
|
22
|
+
export * from './ui/molecules/card/index.js';
|
|
23
|
+
export * from './ui/molecules/column-settings/index.js';
|
|
24
|
+
export * from './ui/molecules/confirm-dialog/index.js';
|
|
25
|
+
export * from './ui/molecules/drawer/index.js';
|
|
26
|
+
export * from './ui/molecules/entity-link-input/index.js';
|
|
27
|
+
export * from './ui/molecules/entity-link-picker/index.js';
|
|
28
|
+
export * from './ui/molecules/entity-record-card/index.js';
|
|
29
|
+
export * from './ui/molecules/filter-builder/index.js';
|
|
30
|
+
export * from './ui/molecules/loading-boundary/index.js';
|
|
31
|
+
export * from './ui/molecules/menu/index.js';
|
|
32
|
+
export * from './ui/molecules/pagination/index.js';
|
|
33
|
+
export * from './ui/molecules/sort-builder/index.js';
|
|
34
|
+
export * from './ui/molecules/stack/index.js';
|
|
35
|
+
export * from './ui/molecules/tab-strip/index.js';
|
|
36
|
+
export * from './ui/molecules/table-toolbar/index.js';
|
|
37
|
+
export * from './ui/molecules/theme-switcher/index.js';
|
|
38
|
+
export * from './ui/organisms/command-palette/index.js';
|
|
39
|
+
export * from './ui/organisms/entity-detail-grid/index.js';
|
|
40
|
+
export * from './ui/organisms/entity-form/index.js';
|
|
41
|
+
export * from './ui/organisms/entity-table/index.js';
|
|
42
|
+
export * from './ui/organisms/top-bar/index.js';
|
|
43
|
+
export * from './ui/organisms/wizard/index.js';
|
|
44
|
+
export * from './ui/utils/cn.js';
|
|
45
|
+
export * from './ui/utils/use-hotkey.js';
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './i18n/index.js';\nexport * from './preferences/index.js';\nexport * from './theme/index.js';\nexport * from './ui/actions/index.js';\nexport * from './ui/atoms/button/index.js';\nexport * from './ui/atoms/cell-value/index.js';\nexport * from './ui/atoms/field/index.js';\nexport * from './ui/atoms/field-control/index.js';\nexport * from './ui/atoms/skeleton/index.js';\nexport * from './ui/atoms/table/index.js';\nexport * from './ui/atoms/text/index.js';\nexport * from './ui/layout/box/index.js';\nexport * from './ui/layout/center/index.js';\nexport * from './ui/layout/cluster/index.js';\nexport * from './ui/layout/cover/index.js';\nexport * from './ui/layout/grid/index.js';\nexport * from './ui/layout/sidebar/index.js';\nexport * from './ui/layout/switcher/index.js';\nexport * from './ui/molecules/breadcrumbs/index.js';\nexport * from './ui/molecules/bulk-action-bar/index.js';\nexport * from './ui/molecules/bulk-result/index.js';\nexport * from './ui/molecules/card/index.js';\nexport * from './ui/molecules/column-settings/index.js';\nexport * from './ui/molecules/confirm-dialog/index.js';\nexport * from './ui/molecules/drawer/index.js';\nexport * from './ui/molecules/entity-link-input/index.js';\nexport * from './ui/molecules/entity-link-picker/index.js';\nexport * from './ui/molecules/entity-record-card/index.js';\nexport * from './ui/molecules/filter-builder/index.js';\nexport * from './ui/molecules/loading-boundary/index.js';\nexport * from './ui/molecules/menu/index.js';\nexport * from './ui/molecules/pagination/index.js';\nexport * from './ui/molecules/sort-builder/index.js';\nexport * from './ui/molecules/stack/index.js';\nexport * from './ui/molecules/tab-strip/index.js';\nexport * from './ui/molecules/table-toolbar/index.js';\nexport * from './ui/molecules/theme-switcher/index.js';\nexport * from './ui/organisms/command-palette/index.js';\nexport * from './ui/organisms/entity-detail-grid/index.js';\nexport * from './ui/organisms/entity-form/index.js';\nexport * from './ui/organisms/entity-table/index.js';\nexport * from './ui/organisms/top-bar/index.js';\nexport * from './ui/organisms/wizard/index.js';\nexport * from './ui/utils/cn.js';\nexport * from './ui/utils/use-hotkey.js';\n"],"names":[],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,6BAA6B;AAC3C,cAAc,iCAAiC;AAC/C,cAAc,4BAA4B;AAC1C,cAAc,oCAAoC;AAClD,cAAc,+BAA+B;AAC7C,cAAc,4BAA4B;AAC1C,cAAc,2BAA2B;AACzC,cAAc,2BAA2B;AACzC,cAAc,8BAA8B;AAC5C,cAAc,+BAA+B;AAC7C,cAAc,6BAA6B;AAC3C,cAAc,4BAA4B;AAC1C,cAAc,+BAA+B;AAC7C,cAAc,gCAAgC;AAC9C,cAAc,sCAAsC;AACpD,cAAc,0CAA0C;AACxD,cAAc,sCAAsC;AACpD,cAAc,+BAA+B;AAC7C,cAAc,0CAA0C;AACxD,cAAc,yCAAyC;AACvD,cAAc,iCAAiC;AAC/C,cAAc,4CAA4C;AAC1D,cAAc,6CAA6C;AAC3D,cAAc,6CAA6C;AAC3D,cAAc,yCAAyC;AACvD,cAAc,2CAA2C;AACzD,cAAc,+BAA+B;AAC7C,cAAc,qCAAqC;AACnD,cAAc,uCAAuC;AACrD,cAAc,gCAAgC;AAC9C,cAAc,oCAAoC;AAClD,cAAc,wCAAwC;AACtD,cAAc,yCAAyC;AACvD,cAAc,0CAA0C;AACxD,cAAc,6CAA6C;AAC3D,cAAc,sCAAsC;AACpD,cAAc,uCAAuC;AACrD,cAAc,kCAAkC;AAChD,cAAc,iCAAiC;AAC/C,cAAc,mBAAmB;AACjC,cAAc,2BAA2B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './indexeddb-ui-preferences-state.js';
|
|
2
|
+
export * from './local-storage-ui-preferences-state.js';
|
|
3
|
+
export * from './ui-preferences-context.js';
|
|
4
|
+
export * from './ui-preferences-state.js';
|
|
5
|
+
export * from './use-ui-preference.js';
|
|
6
|
+
export * from './use-viewport-mode.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preferences/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './indexeddb-ui-preferences-state.js';
|
|
2
|
+
export * from './local-storage-ui-preferences-state.js';
|
|
3
|
+
export * from './ui-preferences-context.js';
|
|
4
|
+
export * from './ui-preferences-state.js';
|
|
5
|
+
export * from './use-ui-preference.js';
|
|
6
|
+
export * from './use-viewport-mode.js';
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/index.ts"],"sourcesContent":["export * from './indexeddb-ui-preferences-state.js';\nexport * from './local-storage-ui-preferences-state.js';\nexport * from './ui-preferences-context.js';\nexport * from './ui-preferences-state.js';\nexport * from './use-ui-preference.js';\nexport * from './use-viewport-mode.js';\n"],"names":[],"mappings":"AAAA,cAAc,sCAAsC;AACpD,cAAc,0CAA0C;AACxD,cAAc,8BAA8B;AAC5C,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,yBAAyB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import { type UiPreferencesState, UiPreferencesStateTag } from './ui-preferences-state.js';
|
|
3
|
+
/**
|
|
4
|
+
* `IndexedDB`-backed {@link UiPreferencesState} — the persistence seam for all
|
|
5
|
+
* client UI state (column layout, sidebar collapse, and now the tab workspace),
|
|
6
|
+
* unifying it with the tab/draft stores in one datastore instead of splitting
|
|
7
|
+
* between `localStorage` and IndexedDB.
|
|
8
|
+
*
|
|
9
|
+
* The port is unchanged: every method closes over the namespace, so each is
|
|
10
|
+
* `R = never`. Values are stored via structured clone (no JSON round-trip), and
|
|
11
|
+
* a failed I/O surfaces as an {@link EntifixConnError} the caller can fall back
|
|
12
|
+
* from — a stale view should degrade to defaults, not break.
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeIndexedDbUiPreferencesState(namespace?: string): UiPreferencesState;
|
|
15
|
+
export declare const IndexedDbUiPreferencesLayer: Layer.Layer<UiPreferencesStateTag, never, never>;
|
|
16
|
+
//# sourceMappingURL=indexeddb-ui-preferences-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb-ui-preferences-state.d.ts","sourceRoot":"","sources":["../../src/preferences/indexeddb-ui-preferences-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIvC,OAAO,EACL,KAAK,kBAAkB,EACvB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAUnC;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,GAAE,MAAyC,GACnD,kBAAkB,CA8CpB;AAED,eAAO,MAAM,2BAA2B,kDAGvC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EntifixConnError } from '@entifix/core';
|
|
2
|
+
import { Effect, Layer } from 'effect';
|
|
3
|
+
import { openDB } from 'idb';
|
|
4
|
+
import { DEFAULT_UI_PREFERENCES_NAMESPACE } from './local-storage-ui-preferences-state.js';
|
|
5
|
+
import { UiPreferencesStateTag } from './ui-preferences-state.js';
|
|
6
|
+
const DB_NAME = 'entifix-ui-preferences';
|
|
7
|
+
const STORE_NAME = 'preferences';
|
|
8
|
+
/** No IndexedDB during SSR — reads resolve empty and writes are dropped. */ function hasIndexedDb() {
|
|
9
|
+
return typeof indexedDB !== 'undefined';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `IndexedDB`-backed {@link UiPreferencesState} — the persistence seam for all
|
|
13
|
+
* client UI state (column layout, sidebar collapse, and now the tab workspace),
|
|
14
|
+
* unifying it with the tab/draft stores in one datastore instead of splitting
|
|
15
|
+
* between `localStorage` and IndexedDB.
|
|
16
|
+
*
|
|
17
|
+
* The port is unchanged: every method closes over the namespace, so each is
|
|
18
|
+
* `R = never`. Values are stored via structured clone (no JSON round-trip), and
|
|
19
|
+
* a failed I/O surfaces as an {@link EntifixConnError} the caller can fall back
|
|
20
|
+
* from — a stale view should degrade to defaults, not break.
|
|
21
|
+
*/ export function makeIndexedDbUiPreferencesState(namespace = DEFAULT_UI_PREFERENCES_NAMESPACE) {
|
|
22
|
+
const storageKey = (key)=>`${namespace}:${key}`;
|
|
23
|
+
let database;
|
|
24
|
+
const open = ()=>database != null ? database : database = openDB(DB_NAME, 1, {
|
|
25
|
+
upgrade (db) {
|
|
26
|
+
db.createObjectStore(STORE_NAME);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const io = (action, key, run)=>Effect.tryPromise({
|
|
30
|
+
try: run,
|
|
31
|
+
catch: (cause)=>new EntifixConnError(`Unable to ${action} UI preference "${key}"`, cause)
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
read: (key)=>io('read', key, async ()=>{
|
|
35
|
+
if (!hasIndexedDb()) return undefined;
|
|
36
|
+
return (await open()).get(STORE_NAME, storageKey(key));
|
|
37
|
+
}),
|
|
38
|
+
write: (key, value)=>io('write', key, async ()=>{
|
|
39
|
+
if (!hasIndexedDb()) return;
|
|
40
|
+
await (await open()).put(STORE_NAME, value, storageKey(key));
|
|
41
|
+
}),
|
|
42
|
+
remove: (key)=>io('remove', key, async ()=>{
|
|
43
|
+
if (!hasIndexedDb()) return;
|
|
44
|
+
await (await open()).delete(STORE_NAME, storageKey(key));
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export const IndexedDbUiPreferencesLayer = Layer.succeed(UiPreferencesStateTag, makeIndexedDbUiPreferencesState());
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=indexeddb-ui-preferences-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/indexeddb-ui-preferences-state.ts"],"sourcesContent":["import { EntifixConnError, type EntifixError } from '@entifix/core';\nimport { Effect, Layer } from 'effect';\nimport { type IDBPDatabase, openDB } from 'idb';\n\nimport { DEFAULT_UI_PREFERENCES_NAMESPACE } from './local-storage-ui-preferences-state.js';\nimport {\n type UiPreferencesState,\n UiPreferencesStateTag,\n} from './ui-preferences-state.js';\n\nconst DB_NAME = 'entifix-ui-preferences';\nconst STORE_NAME = 'preferences';\n\n/** No IndexedDB during SSR — reads resolve empty and writes are dropped. */\nfunction hasIndexedDb(): boolean {\n return typeof indexedDB !== 'undefined';\n}\n\n/**\n * `IndexedDB`-backed {@link UiPreferencesState} — the persistence seam for all\n * client UI state (column layout, sidebar collapse, and now the tab workspace),\n * unifying it with the tab/draft stores in one datastore instead of splitting\n * between `localStorage` and IndexedDB.\n *\n * The port is unchanged: every method closes over the namespace, so each is\n * `R = never`. Values are stored via structured clone (no JSON round-trip), and\n * a failed I/O surfaces as an {@link EntifixConnError} the caller can fall back\n * from — a stale view should degrade to defaults, not break.\n */\nexport function makeIndexedDbUiPreferencesState(\n namespace: string = DEFAULT_UI_PREFERENCES_NAMESPACE,\n): UiPreferencesState {\n const storageKey = (key: string) => `${namespace}:${key}`;\n\n let database: Promise<IDBPDatabase> | undefined;\n const open = () =>\n (database ??= openDB(DB_NAME, 1, {\n upgrade(db) {\n db.createObjectStore(STORE_NAME);\n },\n }));\n\n const io = <TValue>(\n action: string,\n key: string,\n run: () => Promise<TValue>,\n ): Effect.Effect<TValue, EntifixError> =>\n Effect.tryPromise({\n try: run,\n catch: cause =>\n new EntifixConnError(\n `Unable to ${action} UI preference \"${key}\"`,\n cause,\n ) as EntifixError,\n });\n\n return {\n read: <TValue>(key: string) =>\n io<TValue | undefined>('read', key, async () => {\n if (!hasIndexedDb()) return undefined;\n return (await open()).get(STORE_NAME, storageKey(key)) as Promise<\n TValue | undefined\n >;\n }),\n\n write: <TValue>(key: string, value: TValue) =>\n io<void>('write', key, async () => {\n if (!hasIndexedDb()) return;\n await (await open()).put(STORE_NAME, value, storageKey(key));\n }),\n\n remove: (key: string) =>\n io<void>('remove', key, async () => {\n if (!hasIndexedDb()) return;\n await (await open()).delete(STORE_NAME, storageKey(key));\n }),\n };\n}\n\nexport const IndexedDbUiPreferencesLayer = Layer.succeed(\n UiPreferencesStateTag,\n makeIndexedDbUiPreferencesState(),\n);\n"],"names":["EntifixConnError","Effect","Layer","openDB","DEFAULT_UI_PREFERENCES_NAMESPACE","UiPreferencesStateTag","DB_NAME","STORE_NAME","hasIndexedDb","indexedDB","makeIndexedDbUiPreferencesState","namespace","storageKey","key","database","open","upgrade","db","createObjectStore","io","action","run","tryPromise","try","catch","cause","read","undefined","get","write","value","put","remove","delete","IndexedDbUiPreferencesLayer","succeed"],"mappings":"AAAA,SAASA,gBAAgB,QAA2B,gBAAgB;AACpE,SAASC,MAAM,EAAEC,KAAK,QAAQ,SAAS;AACvC,SAA4BC,MAAM,QAAQ,MAAM;AAEhD,SAASC,gCAAgC,QAAQ,0CAA0C;AAC3F,SAEEC,qBAAqB,QAChB,4BAA4B;AAEnC,MAAMC,UAAU;AAChB,MAAMC,aAAa;AAEnB,0EAA0E,GAC1E,SAASC;IACP,OAAO,OAAOC,cAAc;AAC9B;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,gCACdC,YAAoBP,gCAAgC;IAEpD,MAAMQ,aAAa,CAACC,MAAgB,GAAGF,UAAU,CAAC,EAAEE,KAAK;IAEzD,IAAIC;IACJ,MAAMC,OAAO,IACVD,mBAAAA,WAAAA,WAAaX,OAAOG,SAAS,GAAG;YAC/BU,SAAQC,EAAE;gBACRA,GAAGC,iBAAiB,CAACX;YACvB;QACF;IAEF,MAAMY,KAAK,CACTC,QACAP,KACAQ,MAEApB,OAAOqB,UAAU,CAAC;YAChBC,KAAKF;YACLG,OAAOC,CAAAA,QACL,IAAIzB,iBACF,CAAC,UAAU,EAAEoB,OAAO,gBAAgB,EAAEP,IAAI,CAAC,CAAC,EAC5CY;QAEN;IAEF,OAAO;QACLC,MAAM,CAASb,MACbM,GAAuB,QAAQN,KAAK;gBAClC,IAAI,CAACL,gBAAgB,OAAOmB;gBAC5B,OAAO,AAAC,CAAA,MAAMZ,MAAK,EAAGa,GAAG,CAACrB,YAAYK,WAAWC;YAGnD;QAEFgB,OAAO,CAAShB,KAAaiB,QAC3BX,GAAS,SAASN,KAAK;gBACrB,IAAI,CAACL,gBAAgB;gBACrB,MAAM,AAAC,CAAA,MAAMO,MAAK,EAAGgB,GAAG,CAACxB,YAAYuB,OAAOlB,WAAWC;YACzD;QAEFmB,QAAQ,CAACnB,MACPM,GAAS,UAAUN,KAAK;gBACtB,IAAI,CAACL,gBAAgB;gBACrB,MAAM,AAAC,CAAA,MAAMO,MAAK,EAAGkB,MAAM,CAAC1B,YAAYK,WAAWC;YACrD;IACJ;AACF;AAEA,OAAO,MAAMqB,8BAA8BhC,MAAMiC,OAAO,CACtD9B,uBACAK,mCACA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import { type UiPreferencesState, UiPreferencesStateTag } from './ui-preferences-state.js';
|
|
3
|
+
export declare const DEFAULT_UI_PREFERENCES_NAMESPACE = "entifix-ui";
|
|
4
|
+
/**
|
|
5
|
+
* `localStorage`-backed {@link UiPreferencesState}. Every method closes over the
|
|
6
|
+
* namespace, so each one is `R = never` and the object satisfies the interface
|
|
7
|
+
* without leaking a requirement into callers (the same shape
|
|
8
|
+
* `makeMongoRepository` uses).
|
|
9
|
+
*
|
|
10
|
+
* Values are JSON-encoded. Unparseable entries resolve to `undefined` rather
|
|
11
|
+
* than failing: a stale or hand-edited key should fall back to defaults, not
|
|
12
|
+
* break the view.
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeLocalStorageUiPreferencesState(namespace?: string): UiPreferencesState;
|
|
15
|
+
export declare const LocalStorageUiPreferencesLayer: Layer.Layer<UiPreferencesStateTag, never, never>;
|
|
16
|
+
//# sourceMappingURL=local-storage-ui-preferences-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage-ui-preferences-state.d.ts","sourceRoot":"","sources":["../../src/preferences/local-storage-ui-preferences-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EACL,KAAK,kBAAkB,EACvB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,gCAAgC,eAAe,CAAC;AAO7D;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,GAAE,MAAyC,GACnD,kBAAkB,CAiDpB;AAED,eAAO,MAAM,8BAA8B,kDAG1C,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EntifixConnError } from '@entifix/core';
|
|
2
|
+
import { Effect, Layer } from 'effect';
|
|
3
|
+
import { UiPreferencesStateTag } from './ui-preferences-state.js';
|
|
4
|
+
export const DEFAULT_UI_PREFERENCES_NAMESPACE = 'entifix-ui';
|
|
5
|
+
/** No `window` during SSR — reads resolve empty and writes are dropped. */ function isBrowser() {
|
|
6
|
+
return typeof window !== 'undefined' && !!window.localStorage;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `localStorage`-backed {@link UiPreferencesState}. Every method closes over the
|
|
10
|
+
* namespace, so each one is `R = never` and the object satisfies the interface
|
|
11
|
+
* without leaking a requirement into callers (the same shape
|
|
12
|
+
* `makeMongoRepository` uses).
|
|
13
|
+
*
|
|
14
|
+
* Values are JSON-encoded. Unparseable entries resolve to `undefined` rather
|
|
15
|
+
* than failing: a stale or hand-edited key should fall back to defaults, not
|
|
16
|
+
* break the view.
|
|
17
|
+
*/ export function makeLocalStorageUiPreferencesState(namespace = DEFAULT_UI_PREFERENCES_NAMESPACE) {
|
|
18
|
+
const storageKey = (key)=>`${namespace}:${key}`;
|
|
19
|
+
return {
|
|
20
|
+
read: (key)=>Effect.try({
|
|
21
|
+
try: ()=>{
|
|
22
|
+
if (!isBrowser()) return undefined;
|
|
23
|
+
const raw = window.localStorage.getItem(storageKey(key));
|
|
24
|
+
if (raw === null) return undefined;
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(raw);
|
|
27
|
+
} catch (unused) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
catch: (cause)=>new EntifixConnError(`Unable to read UI preference "${key}"`, cause)
|
|
32
|
+
}),
|
|
33
|
+
write: (key, value)=>Effect.try({
|
|
34
|
+
try: ()=>{
|
|
35
|
+
if (!isBrowser()) return;
|
|
36
|
+
window.localStorage.setItem(storageKey(key), JSON.stringify(value));
|
|
37
|
+
},
|
|
38
|
+
catch: (cause)=>new EntifixConnError(`Unable to write UI preference "${key}"`, cause)
|
|
39
|
+
}),
|
|
40
|
+
remove: (key)=>Effect.try({
|
|
41
|
+
try: ()=>{
|
|
42
|
+
if (!isBrowser()) return;
|
|
43
|
+
window.localStorage.removeItem(storageKey(key));
|
|
44
|
+
},
|
|
45
|
+
catch: (cause)=>new EntifixConnError(`Unable to remove UI preference "${key}"`, cause)
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export const LocalStorageUiPreferencesLayer = Layer.succeed(UiPreferencesStateTag, makeLocalStorageUiPreferencesState());
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=local-storage-ui-preferences-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/local-storage-ui-preferences-state.ts"],"sourcesContent":["import { EntifixConnError } from '@entifix/core';\nimport { Effect, Layer } from 'effect';\n\nimport {\n type UiPreferencesState,\n UiPreferencesStateTag,\n} from './ui-preferences-state.js';\n\nexport const DEFAULT_UI_PREFERENCES_NAMESPACE = 'entifix-ui';\n\n/** No `window` during SSR — reads resolve empty and writes are dropped. */\nfunction isBrowser(): boolean {\n return typeof window !== 'undefined' && !!window.localStorage;\n}\n\n/**\n * `localStorage`-backed {@link UiPreferencesState}. Every method closes over the\n * namespace, so each one is `R = never` and the object satisfies the interface\n * without leaking a requirement into callers (the same shape\n * `makeMongoRepository` uses).\n *\n * Values are JSON-encoded. Unparseable entries resolve to `undefined` rather\n * than failing: a stale or hand-edited key should fall back to defaults, not\n * break the view.\n */\nexport function makeLocalStorageUiPreferencesState(\n namespace: string = DEFAULT_UI_PREFERENCES_NAMESPACE,\n): UiPreferencesState {\n const storageKey = (key: string) => `${namespace}:${key}`;\n\n return {\n read: <TValue>(key: string) =>\n Effect.try({\n try: () => {\n if (!isBrowser()) return undefined;\n const raw = window.localStorage.getItem(storageKey(key));\n if (raw === null) return undefined;\n try {\n return JSON.parse(raw) as TValue;\n } catch {\n return undefined;\n }\n },\n catch: cause =>\n new EntifixConnError(\n `Unable to read UI preference \"${key}\"`,\n cause,\n ) as EntifixConnError,\n }),\n\n write: <TValue>(key: string, value: TValue) =>\n Effect.try({\n try: () => {\n if (!isBrowser()) return;\n window.localStorage.setItem(storageKey(key), JSON.stringify(value));\n },\n catch: cause =>\n new EntifixConnError(\n `Unable to write UI preference \"${key}\"`,\n cause,\n ) as EntifixConnError,\n }),\n\n remove: (key: string) =>\n Effect.try({\n try: () => {\n if (!isBrowser()) return;\n window.localStorage.removeItem(storageKey(key));\n },\n catch: cause =>\n new EntifixConnError(\n `Unable to remove UI preference \"${key}\"`,\n cause,\n ) as EntifixConnError,\n }),\n };\n}\n\nexport const LocalStorageUiPreferencesLayer = Layer.succeed(\n UiPreferencesStateTag,\n makeLocalStorageUiPreferencesState(),\n);\n"],"names":["EntifixConnError","Effect","Layer","UiPreferencesStateTag","DEFAULT_UI_PREFERENCES_NAMESPACE","isBrowser","window","localStorage","makeLocalStorageUiPreferencesState","namespace","storageKey","key","read","try","undefined","raw","getItem","JSON","parse","catch","cause","write","value","setItem","stringify","remove","removeItem","LocalStorageUiPreferencesLayer","succeed"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,MAAM,EAAEC,KAAK,QAAQ,SAAS;AAEvC,SAEEC,qBAAqB,QAChB,4BAA4B;AAEnC,OAAO,MAAMC,mCAAmC,aAAa;AAE7D,yEAAyE,GACzE,SAASC;IACP,OAAO,OAAOC,WAAW,eAAe,CAAC,CAACA,OAAOC,YAAY;AAC/D;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,mCACdC,YAAoBL,gCAAgC;IAEpD,MAAMM,aAAa,CAACC,MAAgB,GAAGF,UAAU,CAAC,EAAEE,KAAK;IAEzD,OAAO;QACLC,MAAM,CAASD,MACbV,OAAOY,GAAG,CAAC;gBACTA,KAAK;oBACH,IAAI,CAACR,aAAa,OAAOS;oBACzB,MAAMC,MAAMT,OAAOC,YAAY,CAACS,OAAO,CAACN,WAAWC;oBACnD,IAAII,QAAQ,MAAM,OAAOD;oBACzB,IAAI;wBACF,OAAOG,KAAKC,KAAK,CAACH;oBACpB,EAAE,eAAM;wBACN,OAAOD;oBACT;gBACF;gBACAK,OAAOC,CAAAA,QACL,IAAIpB,iBACF,CAAC,8BAA8B,EAAEW,IAAI,CAAC,CAAC,EACvCS;YAEN;QAEFC,OAAO,CAASV,KAAaW,QAC3BrB,OAAOY,GAAG,CAAC;gBACTA,KAAK;oBACH,IAAI,CAACR,aAAa;oBAClBC,OAAOC,YAAY,CAACgB,OAAO,CAACb,WAAWC,MAAMM,KAAKO,SAAS,CAACF;gBAC9D;gBACAH,OAAOC,CAAAA,QACL,IAAIpB,iBACF,CAAC,+BAA+B,EAAEW,IAAI,CAAC,CAAC,EACxCS;YAEN;QAEFK,QAAQ,CAACd,MACPV,OAAOY,GAAG,CAAC;gBACTA,KAAK;oBACH,IAAI,CAACR,aAAa;oBAClBC,OAAOC,YAAY,CAACmB,UAAU,CAAChB,WAAWC;gBAC5C;gBACAQ,OAAOC,CAAAA,QACL,IAAIpB,iBACF,CAAC,gCAAgC,EAAEW,IAAI,CAAC,CAAC,EACzCS;YAEN;IACJ;AACF;AAEA,OAAO,MAAMO,iCAAiCzB,MAAM0B,OAAO,CACzDzB,uBACAK,sCACA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import type { UiPreferencesState } from './ui-preferences-state.js';
|
|
3
|
+
export interface UiPreferencesProviderProps extends PropsWithChildren {
|
|
4
|
+
/** Explicit store. Omit and a `localStorage` one is built from `namespace`. */
|
|
5
|
+
store?: UiPreferencesState;
|
|
6
|
+
/** Key prefix, so apps sharing an origin don't clobber each other. */
|
|
7
|
+
namespace?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Supplies the {@link UiPreferencesState} every personalizable control reads
|
|
11
|
+
* through. Mount it once per app, at the root: swapping the implementation here
|
|
12
|
+
* (say, for a server-backed store) migrates every control at once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function UiPreferencesProvider({ children, store, namespace, }: UiPreferencesProviderProps): import("react").JSX.Element;
|
|
15
|
+
export declare function useUiPreferencesState(): UiPreferencesState;
|
|
16
|
+
//# sourceMappingURL=ui-preferences-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-preferences-context.d.ts","sourceRoot":"","sources":["../../src/preferences/ui-preferences-context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,+EAA+E;IAC/E,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,SAA4C,GAC7C,EAAE,0BAA0B,+BAW5B;AAUD,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
+
import { DEFAULT_UI_PREFERENCES_NAMESPACE, makeLocalStorageUiPreferencesState } from './local-storage-ui-preferences-state.js';
|
|
5
|
+
const UiPreferencesContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* Supplies the {@link UiPreferencesState} every personalizable control reads
|
|
8
|
+
* through. Mount it once per app, at the root: swapping the implementation here
|
|
9
|
+
* (say, for a server-backed store) migrates every control at once.
|
|
10
|
+
*/ export function UiPreferencesProvider({ children, store, namespace = DEFAULT_UI_PREFERENCES_NAMESPACE }) {
|
|
11
|
+
const value = useMemo(()=>store != null ? store : makeLocalStorageUiPreferencesState(namespace), [
|
|
12
|
+
store,
|
|
13
|
+
namespace
|
|
14
|
+
]);
|
|
15
|
+
return /*#__PURE__*/ _jsx(UiPreferencesContext.Provider, {
|
|
16
|
+
value: value,
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The active store. Falls back to a default `localStorage` store when no
|
|
22
|
+
* provider is mounted, so a control stays usable in isolation (tests, an app
|
|
23
|
+
* that has not opted in yet) — the fallback is module-level so its identity is
|
|
24
|
+
* stable across renders.
|
|
25
|
+
*/ const fallbackStore = makeLocalStorageUiPreferencesState();
|
|
26
|
+
export function useUiPreferencesState() {
|
|
27
|
+
var _useContext;
|
|
28
|
+
return (_useContext = useContext(UiPreferencesContext)) != null ? _useContext : fallbackStore;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=ui-preferences-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/ui-preferences-context.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type PropsWithChildren,\n useContext,\n useMemo,\n} from 'react';\n\nimport {\n DEFAULT_UI_PREFERENCES_NAMESPACE,\n makeLocalStorageUiPreferencesState,\n} from './local-storage-ui-preferences-state.js';\nimport type { UiPreferencesState } from './ui-preferences-state.js';\n\nconst UiPreferencesContext = createContext<UiPreferencesState | null>(null);\n\nexport interface UiPreferencesProviderProps extends PropsWithChildren {\n /** Explicit store. Omit and a `localStorage` one is built from `namespace`. */\n store?: UiPreferencesState;\n /** Key prefix, so apps sharing an origin don't clobber each other. */\n namespace?: string;\n}\n\n/**\n * Supplies the {@link UiPreferencesState} every personalizable control reads\n * through. Mount it once per app, at the root: swapping the implementation here\n * (say, for a server-backed store) migrates every control at once.\n */\nexport function UiPreferencesProvider({\n children,\n store,\n namespace = DEFAULT_UI_PREFERENCES_NAMESPACE,\n}: UiPreferencesProviderProps) {\n const value = useMemo(\n () => store ?? makeLocalStorageUiPreferencesState(namespace),\n [store, namespace],\n );\n\n return (\n <UiPreferencesContext.Provider value={value}>\n {children}\n </UiPreferencesContext.Provider>\n );\n}\n\n/**\n * The active store. Falls back to a default `localStorage` store when no\n * provider is mounted, so a control stays usable in isolation (tests, an app\n * that has not opted in yet) — the fallback is module-level so its identity is\n * stable across renders.\n */\nconst fallbackStore = makeLocalStorageUiPreferencesState();\n\nexport function useUiPreferencesState(): UiPreferencesState {\n return useContext(UiPreferencesContext) ?? fallbackStore;\n}\n"],"names":["createContext","useContext","useMemo","DEFAULT_UI_PREFERENCES_NAMESPACE","makeLocalStorageUiPreferencesState","UiPreferencesContext","UiPreferencesProvider","children","store","namespace","value","Provider","fallbackStore","useUiPreferencesState"],"mappings":"AAAA;;AAEA,SACEA,aAAa,EAEbC,UAAU,EACVC,OAAO,QACF,QAAQ;AAEf,SACEC,gCAAgC,EAChCC,kCAAkC,QAC7B,0CAA0C;AAGjD,MAAMC,qCAAuBL,cAAyC;AAStE;;;;CAIC,GACD,OAAO,SAASM,sBAAsB,EACpCC,QAAQ,EACRC,KAAK,EACLC,YAAYN,gCAAgC,EACjB;IAC3B,MAAMO,QAAQR,QACZ,IAAMM,gBAAAA,QAASJ,mCAAmCK,YAClD;QAACD;QAAOC;KAAU;IAGpB,qBACE,KAACJ,qBAAqBM,QAAQ;QAACD,OAAOA;kBACnCH;;AAGP;AAEA;;;;;CAKC,GACD,MAAMK,gBAAgBR;AAEtB,OAAO,SAASS;QACPZ;IAAP,QAAOA,cAAAA,WAAWI,iCAAXJ,cAAoCW;AAC7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EntifixError } from '@entifix/core';
|
|
2
|
+
import { Context, type Effect } from 'effect';
|
|
3
|
+
/**
|
|
4
|
+
* Where a user's UI personalization lives — column order and visibility today,
|
|
5
|
+
* any other per-user view state later.
|
|
6
|
+
*
|
|
7
|
+
* The port is Effect-returning and therefore free to be asynchronous: the
|
|
8
|
+
* shipped adapter writes to `localStorage` synchronously, but a server-backed
|
|
9
|
+
* store (per-user preferences fetched over HTTP) is a drop-in replacement that
|
|
10
|
+
* no component has to be rewritten for.
|
|
11
|
+
*
|
|
12
|
+
* Values are stored and returned as-is; adapters own their own encoding.
|
|
13
|
+
*/
|
|
14
|
+
export interface UiPreferencesState {
|
|
15
|
+
read<TValue>(key: string): Effect.Effect<TValue | undefined, EntifixError>;
|
|
16
|
+
write<TValue>(key: string, value: TValue): Effect.Effect<void, EntifixError>;
|
|
17
|
+
remove(key: string): Effect.Effect<void, EntifixError>;
|
|
18
|
+
}
|
|
19
|
+
declare const UiPreferencesStateTag_base: Context.TagClass<UiPreferencesStateTag, "UiPreferencesState", UiPreferencesState>;
|
|
20
|
+
export declare class UiPreferencesStateTag extends UiPreferencesStateTag_base {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=ui-preferences-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-preferences-state.d.ts","sourceRoot":"","sources":["../../src/preferences/ui-preferences-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,YAAY,CAAC,CAAC;IAC3E,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC7E,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;CACxD;;AAED,qBAAa,qBAAsB,SAAQ,0BAGxC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/ui-preferences-state.ts"],"sourcesContent":["import type { EntifixError } from '@entifix/core';\nimport { Context, type Effect } from 'effect';\n\n/**\n * Where a user's UI personalization lives — column order and visibility today,\n * any other per-user view state later.\n *\n * The port is Effect-returning and therefore free to be asynchronous: the\n * shipped adapter writes to `localStorage` synchronously, but a server-backed\n * store (per-user preferences fetched over HTTP) is a drop-in replacement that\n * no component has to be rewritten for.\n *\n * Values are stored and returned as-is; adapters own their own encoding.\n */\nexport interface UiPreferencesState {\n read<TValue>(key: string): Effect.Effect<TValue | undefined, EntifixError>;\n write<TValue>(key: string, value: TValue): Effect.Effect<void, EntifixError>;\n remove(key: string): Effect.Effect<void, EntifixError>;\n}\n\nexport class UiPreferencesStateTag extends Context.Tag('UiPreferencesState')<\n UiPreferencesStateTag,\n UiPreferencesState\n>() {}\n"],"names":["Context","UiPreferencesStateTag","Tag"],"mappings":"AACA,SAASA,OAAO,QAAqB,SAAS;AAmB9C,OAAO,MAAMC,8BAA8BD,QAAQE,GAAG,CAAC;AAGlD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UseUiPreferenceResult<TValue> {
|
|
2
|
+
value: TValue;
|
|
3
|
+
setValue: (next: TValue) => void;
|
|
4
|
+
/** False until the stored value has been read; render defaults meanwhile. */
|
|
5
|
+
isReady: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Reads one persisted UI preference and writes it back on change.
|
|
9
|
+
*
|
|
10
|
+
* The read runs in an effect rather than during render: the store may be
|
|
11
|
+
* asynchronous and, for the `localStorage` adapter, is unavailable during SSR —
|
|
12
|
+
* so the server renders `fallback` and the client corrects after mount. Reading
|
|
13
|
+
* it while rendering would be a hydration mismatch.
|
|
14
|
+
*
|
|
15
|
+
* Writes are optimistic: local state updates immediately and the store write is
|
|
16
|
+
* fired after. A failed write only costs the persistence of that change, so it
|
|
17
|
+
* is swallowed rather than surfaced as a render error.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useUiPreference<TValue>(key: string, fallback: TValue): UseUiPreferenceResult<TValue>;
|
|
20
|
+
//# sourceMappingURL=use-ui-preference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ui-preference.d.ts","sourceRoot":"","sources":["../../src/preferences/use-ui-preference.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB,CAAC,MAAM;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,EACpC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAAC,MAAM,CAAC,CA8C/B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useUiPreferencesState } from './ui-preferences-context.js';
|
|
5
|
+
/**
|
|
6
|
+
* Reads one persisted UI preference and writes it back on change.
|
|
7
|
+
*
|
|
8
|
+
* The read runs in an effect rather than during render: the store may be
|
|
9
|
+
* asynchronous and, for the `localStorage` adapter, is unavailable during SSR —
|
|
10
|
+
* so the server renders `fallback` and the client corrects after mount. Reading
|
|
11
|
+
* it while rendering would be a hydration mismatch.
|
|
12
|
+
*
|
|
13
|
+
* Writes are optimistic: local state updates immediately and the store write is
|
|
14
|
+
* fired after. A failed write only costs the persistence of that change, so it
|
|
15
|
+
* is swallowed rather than surfaced as a render error.
|
|
16
|
+
*/ export function useUiPreference(key, fallback) {
|
|
17
|
+
const store = useUiPreferencesState();
|
|
18
|
+
// Value and the key it belongs to are one state: readiness is then derived
|
|
19
|
+
// rather than reset in the effect, so switching `key` reports "not ready"
|
|
20
|
+
// for the new key without a synchronous setState cascading a render.
|
|
21
|
+
const [state, setState] = useState({
|
|
22
|
+
value: fallback
|
|
23
|
+
});
|
|
24
|
+
// Callers build `fallback` inline, so it is a fresh object every render.
|
|
25
|
+
// Keying the read effect on it would re-read (and clobber local edits) on
|
|
26
|
+
// every render; the ref keeps the latest without entering the dependencies.
|
|
27
|
+
const fallbackRef = useRef(fallback);
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
fallbackRef.current = fallback;
|
|
30
|
+
});
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
let active = true;
|
|
33
|
+
Effect.runPromise(store.read(key)).then((stored)=>{
|
|
34
|
+
if (!active) return;
|
|
35
|
+
setState({
|
|
36
|
+
loadedKey: key,
|
|
37
|
+
value: stored != null ? stored : fallbackRef.current
|
|
38
|
+
});
|
|
39
|
+
}).catch(()=>{
|
|
40
|
+
if (!active) return;
|
|
41
|
+
setState({
|
|
42
|
+
loadedKey: key,
|
|
43
|
+
value: fallbackRef.current
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return ()=>{
|
|
47
|
+
active = false;
|
|
48
|
+
};
|
|
49
|
+
}, [
|
|
50
|
+
store,
|
|
51
|
+
key
|
|
52
|
+
]);
|
|
53
|
+
const setValue = useCallback((next)=>{
|
|
54
|
+
setState({
|
|
55
|
+
loadedKey: key,
|
|
56
|
+
value: next
|
|
57
|
+
});
|
|
58
|
+
Effect.runPromise(store.write(key, next)).catch(()=>{
|
|
59
|
+
// Persistence is best-effort; the in-memory change already applied.
|
|
60
|
+
});
|
|
61
|
+
}, [
|
|
62
|
+
store,
|
|
63
|
+
key
|
|
64
|
+
]);
|
|
65
|
+
return {
|
|
66
|
+
value: state.value,
|
|
67
|
+
setValue,
|
|
68
|
+
isReady: state.loadedKey === key
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=use-ui-preference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/preferences/use-ui-preference.ts"],"sourcesContent":["'use client';\n\nimport { Effect } from 'effect';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useUiPreferencesState } from './ui-preferences-context.js';\n\nexport interface UseUiPreferenceResult<TValue> {\n value: TValue;\n setValue: (next: TValue) => void;\n /** False until the stored value has been read; render defaults meanwhile. */\n isReady: boolean;\n}\n\n/**\n * Reads one persisted UI preference and writes it back on change.\n *\n * The read runs in an effect rather than during render: the store may be\n * asynchronous and, for the `localStorage` adapter, is unavailable during SSR —\n * so the server renders `fallback` and the client corrects after mount. Reading\n * it while rendering would be a hydration mismatch.\n *\n * Writes are optimistic: local state updates immediately and the store write is\n * fired after. A failed write only costs the persistence of that change, so it\n * is swallowed rather than surfaced as a render error.\n */\nexport function useUiPreference<TValue>(\n key: string,\n fallback: TValue,\n): UseUiPreferenceResult<TValue> {\n const store = useUiPreferencesState();\n // Value and the key it belongs to are one state: readiness is then derived\n // rather than reset in the effect, so switching `key` reports \"not ready\"\n // for the new key without a synchronous setState cascading a render.\n const [state, setState] = useState<{ loadedKey?: string; value: TValue }>({\n value: fallback,\n });\n\n // Callers build `fallback` inline, so it is a fresh object every render.\n // Keying the read effect on it would re-read (and clobber local edits) on\n // every render; the ref keeps the latest without entering the dependencies.\n const fallbackRef = useRef(fallback);\n useEffect(() => {\n fallbackRef.current = fallback;\n });\n\n useEffect(() => {\n let active = true;\n\n Effect.runPromise(store.read<TValue>(key))\n .then(stored => {\n if (!active) return;\n setState({ loadedKey: key, value: stored ?? fallbackRef.current });\n })\n .catch(() => {\n if (!active) return;\n setState({ loadedKey: key, value: fallbackRef.current });\n });\n\n return () => {\n active = false;\n };\n }, [store, key]);\n\n const setValue = useCallback(\n (next: TValue) => {\n setState({ loadedKey: key, value: next });\n Effect.runPromise(store.write(key, next)).catch(() => {\n // Persistence is best-effort; the in-memory change already applied.\n });\n },\n [store, key],\n );\n\n return { value: state.value, setValue, isReady: state.loadedKey === key };\n}\n"],"names":["Effect","useCallback","useEffect","useRef","useState","useUiPreferencesState","useUiPreference","key","fallback","store","state","setState","value","fallbackRef","current","active","runPromise","read","then","stored","loadedKey","catch","setValue","next","write","isReady"],"mappings":"AAAA;AAEA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEjE,SAASC,qBAAqB,QAAQ,8BAA8B;AASpE;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,gBACdC,GAAW,EACXC,QAAgB;IAEhB,MAAMC,QAAQJ;IACd,2EAA2E;IAC3E,0EAA0E;IAC1E,qEAAqE;IACrE,MAAM,CAACK,OAAOC,SAAS,GAAGP,SAAgD;QACxEQ,OAAOJ;IACT;IAEA,yEAAyE;IACzE,0EAA0E;IAC1E,4EAA4E;IAC5E,MAAMK,cAAcV,OAAOK;IAC3BN,UAAU;QACRW,YAAYC,OAAO,GAAGN;IACxB;IAEAN,UAAU;QACR,IAAIa,SAAS;QAEbf,OAAOgB,UAAU,CAACP,MAAMQ,IAAI,CAASV,MAClCW,IAAI,CAACC,CAAAA;YACJ,IAAI,CAACJ,QAAQ;YACbJ,SAAS;gBAAES,WAAWb;gBAAKK,KAAK,EAAEO,iBAAAA,SAAUN,YAAYC,OAAO;YAAC;QAClE,GACCO,KAAK,CAAC;YACL,IAAI,CAACN,QAAQ;YACbJ,SAAS;gBAAES,WAAWb;gBAAKK,OAAOC,YAAYC,OAAO;YAAC;QACxD;QAEF,OAAO;YACLC,SAAS;QACX;IACF,GAAG;QAACN;QAAOF;KAAI;IAEf,MAAMe,WAAWrB,YACf,CAACsB;QACCZ,SAAS;YAAES,WAAWb;YAAKK,OAAOW;QAAK;QACvCvB,OAAOgB,UAAU,CAACP,MAAMe,KAAK,CAACjB,KAAKgB,OAAOF,KAAK,CAAC;QAC9C,oEAAoE;QACtE;IACF,GACA;QAACZ;QAAOF;KAAI;IAGd,OAAO;QAAEK,OAAOF,MAAME,KAAK;QAAEU;QAAUG,SAASf,MAAMU,SAAS,KAAKb;IAAI;AAC1E"}
|