@lavalogic/scoria 0.35.0 → 0.37.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/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +46 -42
- package/dist/Components/AccordionGroupButton.svelte +106 -106
- package/dist/Components/AccordionGroupButtonProps.d.ts +27 -8
- package/dist/Components/AccordionGroupProps.d.ts +10 -2
- package/dist/Components/Action.svelte +137 -139
- package/dist/Components/ActionProps.d.ts +23 -3
- package/dist/Components/AlertModal.svelte +176 -125
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +1126 -0
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte.d.ts +4 -0
- package/dist/Components/AppointmentCalendar/AppointmentCalendarProps.d.ts +92 -0
- package/dist/Components/AppointmentCalendar/AppointmentCalendarProps.js +12 -0
- package/dist/Components/Base/BaseModal.svelte +172 -0
- package/dist/Components/Base/BaseModal.svelte.d.ts +4 -0
- package/dist/Components/Base/BaseModalProps.d.ts +73 -0
- package/dist/Components/Base/BaseModalProps.js +1 -0
- package/dist/Components/Base/ContextWrapper.svelte +72 -50
- package/dist/Components/Base/ContextWrapper.svelte.d.ts +24 -5
- package/dist/Components/Base/ContextWrapperProps.d.ts +22 -0
- package/dist/Components/Base/Pagination.svelte +198 -190
- package/dist/Components/Base/Pagination.svelte.d.ts +12 -2
- package/dist/Components/Base/PaginationProps.d.ts +60 -3
- package/dist/Components/Base/Snippets.svelte +36 -29
- package/dist/Components/Base/Snippets.svelte.d.ts +5 -1
- package/dist/Components/BigRadioSet.svelte +39 -30
- package/dist/Components/BigRadioSetProps.d.ts +17 -1
- package/dist/Components/Bubble.svelte +110 -77
- package/dist/Components/Bubble.svelte.d.ts +23 -2
- package/dist/Components/BubbleProps.d.ts +55 -4
- package/dist/Components/Button.svelte +209 -197
- package/dist/Components/ButtonProps.d.ts +66 -1
- package/dist/Components/Checkbox.svelte +100 -72
- package/dist/Components/Checkbox.svelte.d.ts +1 -12
- package/dist/Components/CheckboxProps.d.ts +27 -0
- package/dist/Components/CheckboxProps.js +1 -0
- package/dist/Components/CollapsibleCard.svelte +114 -83
- package/dist/Components/CollapsibleCardProps.d.ts +22 -1
- package/dist/Components/Contexts/ContextMenu.svelte +178 -157
- package/dist/Components/Contexts/ContextMenu.svelte.d.ts +26 -0
- package/dist/Components/Contexts/ContextMenuDivider.svelte +19 -11
- package/dist/Components/Contexts/ContextMenuDivider.svelte.d.ts +9 -0
- package/dist/Components/Contexts/ContextMenuOption.svelte +66 -57
- package/dist/Components/Contexts/ContextMenuOption.svelte.d.ts +12 -1
- package/dist/Components/Contexts/ContextMenuOptionProps.d.ts +34 -2
- package/dist/Components/Contexts/Toast.svelte +88 -64
- package/dist/Components/Contexts/Toast.svelte.d.ts +14 -0
- package/dist/Components/Contexts/ToastContainer.svelte +68 -49
- package/dist/Components/Contexts/ToastContainer.svelte.d.ts +14 -0
- package/dist/Components/Contexts/ToastProps.d.ts +14 -1
- package/dist/Components/Contexts/Tooltip.svelte +47 -36
- package/dist/Components/Contexts/Tooltip.svelte.d.ts +10 -0
- package/dist/Components/DataMatrixIcon.svelte +113 -42
- package/dist/Components/DataMatrixIconProps.d.ts +73 -1
- package/dist/Components/DateInput.svelte +144 -109
- package/dist/Components/DateInput.svelte.d.ts +1 -1
- package/dist/Components/DateOnlyInputProps.d.ts +31 -5
- package/dist/Components/DatePicker.svelte +301 -313
- package/dist/Components/DatePickerProps.d.ts +18 -1
- package/dist/Components/DateTimeInputProps.d.ts +30 -5
- package/dist/Components/DesktopModal.svelte +90 -119
- package/dist/Components/DesktopModalProps.d.ts +5 -4
- package/dist/Components/Dial.svelte +213 -151
- package/dist/Components/DialProps.d.ts +74 -2
- package/dist/Components/DimensionInput.svelte +171 -185
- package/dist/Components/DimensionInput.svelte.d.ts +1 -1
- package/dist/Components/DimensionInputProps.d.ts +39 -4
- package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -107
- package/dist/Components/DragMenu/DragMenuHolderProps.d.ts +30 -1
- package/dist/Components/DragMenu/DraggableCard.svelte +77 -41
- package/dist/Components/DragMenu/DraggableCardProps.d.ts +27 -1
- package/dist/Components/FileCard.svelte +24 -20
- package/dist/Components/FileCardProps.d.ts +17 -1
- package/dist/Components/FileUpload.svelte +236 -196
- package/dist/Components/FileUploadProps.d.ts +34 -4
- package/dist/Components/GridInput.svelte +201 -191
- package/dist/Components/GridInput.svelte.d.ts +5 -5
- package/dist/Components/GridInputProps.d.ts +4 -1
- package/dist/Components/GridInputSet.svelte +31 -24
- package/dist/Components/GridInputSet.svelte.d.ts +5 -5
- package/dist/Components/GridInputSetProps.d.ts +4 -2
- package/dist/Components/HorizontalTabGroup.svelte +81 -79
- package/dist/Components/HorizontalTabGroupButton.svelte +51 -103
- package/dist/Components/HorizontalTabGroupProps.d.ts +15 -2
- package/dist/Components/Icon.svelte +144 -103
- package/dist/Components/IconProps.d.ts +54 -6
- package/dist/Components/Icons.d.ts +8 -0
- package/dist/Components/Icons.js +591 -572
- package/dist/Components/LoadingAnimation.svelte +39 -39
- package/dist/Components/LoadingAnimation.svelte.d.ts +1 -3
- package/dist/Components/LoadingAnimationProps.d.ts +16 -0
- package/dist/Components/LoadingAnimationProps.js +1 -0
- package/dist/Components/LoadingModal.svelte +48 -50
- package/dist/Components/LoadingModal.svelte.d.ts +1 -4
- package/dist/Components/LoadingModalProps.d.ts +17 -0
- package/dist/Components/LoadingModalProps.js +1 -0
- package/dist/Components/LoadingOverlay.svelte +28 -30
- package/dist/Components/LoadingOverlay.svelte.d.ts +1 -5
- package/dist/Components/LoadingOverlayProps.d.ts +28 -0
- package/dist/Components/LoadingOverlayProps.js +1 -0
- package/dist/Components/Modal.svelte +250 -255
- package/dist/Components/Modal.svelte.d.ts +1 -25
- package/dist/Components/ModalProps.d.ts +65 -0
- package/dist/Components/ModalProps.js +1 -0
- package/dist/Components/MultiSelect.svelte +238 -226
- package/dist/Components/MultiSelectCommonProps.d.ts +33 -4
- package/dist/Components/MultiSelectPropsAsObject.d.ts +5 -0
- package/dist/Components/MultiSelectPropsAsPrimitive.d.ts +6 -0
- package/dist/Components/Nav/CallbackButtonWithIcon.d.ts +22 -1
- package/dist/Components/Nav/Nav.svelte +115 -110
- package/dist/Components/Nav/Nav.svelte.d.ts +23 -2
- package/dist/Components/Nav/NavProps.d.ts +50 -3
- package/dist/Components/Nav/NavServiceMenuList.svelte +44 -35
- package/dist/Components/Nav/NavServiceMenuListProps.d.ts +25 -1
- package/dist/Components/Nav/NavTab.svelte +62 -91
- package/dist/Components/Nav/NavTab.svelte.d.ts +23 -2
- package/dist/Components/Nav/NavTabProps.d.ts +16 -2
- package/dist/Components/Nav/ServiceMenuItem.svelte +101 -92
- package/dist/Components/Nav/ServicesNav.svelte +96 -70
- package/dist/Components/Nav/ServicesNav.svelte.d.ts +23 -2
- package/dist/Components/Nav/ServicesNavProps.d.ts +20 -4
- package/dist/Components/Nav/SideMenuItemProps.d.ts +16 -0
- package/dist/Components/NumberInput.svelte +155 -145
- package/dist/Components/NumberInputProps.d.ts +37 -0
- package/dist/Components/PageHeading.svelte +25 -36
- package/dist/Components/PageHeading.svelte.d.ts +1 -6
- package/dist/Components/PageHeadingProps.d.ts +23 -0
- package/dist/Components/PageHeadingProps.js +1 -0
- package/dist/Components/PasswordInput.svelte +85 -73
- package/dist/Components/PasswordInput.svelte.d.ts +2 -2
- package/dist/Components/PasswordInputProps.d.ts +21 -0
- package/dist/Components/PasswordInputProps.js +1 -0
- package/dist/Components/Portal.svelte +36 -25
- package/dist/Components/PortalProps.d.ts +20 -1
- package/dist/Components/ProgressBubble.svelte +129 -84
- package/dist/Components/ProgressBubbleProps.d.ts +23 -2
- package/dist/Components/QuerySelect.svelte +384 -440
- package/dist/Components/QuerySelect.svelte.d.ts +2 -29
- package/dist/Components/QuerySelectProps.d.ts +66 -0
- package/dist/Components/QuerySelectProps.js +1 -0
- package/dist/Components/SingleSelect.svelte +268 -290
- package/dist/Components/SingleSelectCommonProps.d.ts +43 -5
- package/dist/Components/SingleSelectPropsAsObject.d.ts +7 -0
- package/dist/Components/SingleSelectPropsAsPrimitive.d.ts +8 -0
- package/dist/Components/StepButton.svelte +70 -120
- package/dist/Components/StepForm.svelte +147 -147
- package/dist/Components/StepFormProps.d.ts +16 -2
- package/dist/Components/Switch.svelte +84 -47
- package/dist/Components/Switch.svelte.d.ts +1 -1
- package/dist/Components/SwitchProps.d.ts +46 -0
- package/dist/Components/Table/Body/HeightData.d.ts +1 -6
- package/dist/Components/Table/Body/HeightData.js +8 -0
- package/dist/Components/Table/Body/QuickSearchCell.svelte +697 -641
- package/dist/Components/Table/Body/QuickSearchCell.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/QuickSearchCellProps.d.ts +6 -0
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +68 -34
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte.d.ts +24 -2
- package/dist/Components/Table/Body/Rows/ColumnHighlightProps.d.ts +3 -0
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +66 -56
- package/dist/Components/Table/Body/Rows/ColumnList.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/ColumnListProps.d.ts +1 -0
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +515 -182
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/ColumnListRowProps.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -49
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponentProps.d.ts +12 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +203 -191
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte.d.ts +12 -12
- package/dist/Components/Table/Body/Rows/Columns/ActionsColumn.d.ts +9 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsTableCell.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +150 -115
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte.d.ts +14 -13
- package/dist/Components/Table/Body/Rows/Columns/BubbleCellProps.d.ts +12 -0
- package/dist/Components/Table/Body/Rows/Columns/BubbleCellProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +149 -129
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +149 -126
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCellProps.d.ts +7 -0
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +142 -108
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte.d.ts +17 -11
- package/dist/Components/Table/Body/Rows/Columns/RowSelectionColumn.d.ts +8 -0
- package/dist/Components/Table/Body/Rows/Columns/RowSelectionTableCell.d.ts +5 -0
- package/dist/Components/Table/Body/Rows/Columns/SelectColumn.d.ts +11 -0
- package/dist/Components/Table/Body/Rows/Columns/SelectTableCell.d.ts +11 -0
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -72
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte.d.ts +11 -0
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +148 -137
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte.d.ts +13 -18
- package/dist/Components/Table/Body/Rows/Columns/TableCheckboxProps.d.ts +17 -0
- package/dist/Components/Table/Body/Rows/Columns/TableCheckboxProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -144
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte.d.ts +1 -7
- package/dist/Components/Table/Body/Rows/Columns/TableColumnProps.d.ts +16 -0
- package/dist/Components/Table/Body/Rows/Columns/TableColumnProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +279 -249
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/Columns/TableDatePickerProps.d.ts +9 -0
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +249 -370
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte.d.ts +20 -12
- package/dist/Components/Table/Body/Rows/Columns/TableQueryCell.d.ts +8 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQueryColumn.d.ts +9 -0
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +291 -354
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelectProps.d.ts +8 -0
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +201 -189
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte.d.ts +2 -5
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckboxProps.d.ts +14 -0
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckboxProps.js +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +263 -325
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte.d.ts +13 -12
- package/dist/Components/Table/Body/Rows/Columns/TableSelectProps.d.ts +6 -0
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +230 -381
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte.d.ts +12 -11
- package/dist/Components/Table/Body/Rows/Columns/TableTextInputProps.d.ts +6 -0
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +187 -177
- package/dist/Components/Table/Body/Rows/Columns/_helpers/useAsyncEditable.svelte.d.ts +104 -0
- package/dist/Components/Table/Body/Rows/Columns/_helpers/useAsyncEditable.svelte.js +215 -0
- package/dist/Components/Table/Body/Rows/TableRow.svelte +331 -263
- package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +2 -10
- package/dist/Components/Table/Body/Rows/TableRowProps.d.ts +11 -2
- package/dist/Components/Table/Body/TableBody.svelte +198 -81
- package/dist/Components/Table/Body/TableBody.svelte.d.ts +15 -22
- package/dist/Components/Table/Body/TableBodyProps.d.ts +9 -7
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +18 -12
- package/dist/Components/Table/ColumnFactory.svelte.d.ts +43 -0
- package/dist/Components/Table/ColumnFactory.svelte.js +339 -0
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -39
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte.d.ts +12 -11
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -28
- package/dist/Components/Table/Headers/SelectAllHeader.svelte.d.ts +12 -11
- package/dist/Components/Table/Headers/TableHead.svelte +434 -294
- package/dist/Components/Table/Headers/TableHead.svelte.d.ts +13 -16
- package/dist/Components/Table/Headers/TableHeadProps.d.ts +10 -0
- package/dist/Components/Table/Headers/TableHeadProps.js +1 -0
- package/dist/Components/Table/Misc/ColumnPanel.svelte +154 -96
- package/dist/Components/Table/Misc/ColumnPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +112 -99
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ColumnPanelModalProps.d.ts +5 -0
- package/dist/Components/Table/Misc/FilterInput.svelte +545 -556
- package/dist/Components/Table/Misc/FilterInput.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/FilterPanel.svelte +409 -51
- package/dist/Components/Table/Misc/FilterPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +30 -77
- package/dist/Components/Table/Misc/FilterPanelModal.svelte.d.ts +2 -23
- package/dist/Components/Table/Misc/SidePanel.svelte +35 -32
- package/dist/Components/Table/Misc/SidePanel.svelte.d.ts +1 -7
- package/dist/Components/Table/Misc/SidePanelProps.d.ts +17 -0
- package/dist/Components/Table/Misc/SidePanelProps.js +1 -0
- package/dist/Components/Table/Misc/TableFooter.svelte +315 -306
- package/dist/Components/Table/Misc/TableFooter.svelte.d.ts +13 -14
- package/dist/Components/Table/Misc/TableFooterProps.d.ts +8 -0
- package/dist/Components/Table/Misc/TableFooterProps.js +1 -0
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +126 -157
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/TableSidebar.svelte +158 -177
- package/dist/Components/Table/Misc/TableSidebar.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +147 -81
- package/dist/Components/Table/Misc/ToolboxPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ToolboxPanelModalProps.d.ts +5 -0
- package/dist/Components/Table/Misc/numberDateFilterTypes.d.ts +7 -4
- package/dist/Components/Table/Misc/numberDateFilterTypes.js +8 -3
- package/dist/Components/Table/Misc/stringFilterTypes.d.ts +6 -4
- package/dist/Components/Table/Misc/stringFilterTypes.js +7 -3
- package/dist/Components/Table/NestedTable.svelte +132 -88
- package/dist/Components/Table/NestedTable.svelte.d.ts +2 -10
- package/dist/Components/Table/NestedTableProps.d.ts +25 -0
- package/dist/Components/Table/NestedTableProps.js +1 -0
- package/dist/Components/Table/SubApis.svelte.d.ts +23 -0
- package/dist/Components/Table/SubApis.svelte.js +359 -0
- package/dist/Components/Table/Table.svelte +694 -519
- package/dist/Components/Table/Table.svelte.d.ts +24 -1
- package/dist/Components/Table/TableHelpers.svelte.d.ts +58 -0
- package/dist/Components/Table/TableHelpers.svelte.js +88 -0
- package/dist/Components/Table/Types/Columns/Column.d.ts +10 -0
- package/dist/Components/Table/Types/Columns/ColumnPinningState.d.ts +12 -0
- package/dist/Components/Table/Types/Columns/ColumnSizingState.d.ts +8 -0
- package/dist/Components/Table/Types/Columns/ColumnType.d.ts +17 -0
- package/dist/Components/Table/Types/Columns/ColumnType.js +18 -1
- package/dist/Components/Table/Types/Columns/DateColumn.d.ts +6 -0
- package/dist/Components/Table/Types/Columns/DateTableCell.d.ts +7 -0
- package/dist/Components/Table/Types/Columns/Definitions/AccessorFn.d.ts +13 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.d.ts +28 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.js +15 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorType.d.ts +10 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorType.js +11 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.d.ts +23 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js +9 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.d.ts +21 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.d.ts +29 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.js +11 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +23 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +31 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +17 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.d.ts +21 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.js +7 -0
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.d.ts +29 -1
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +17 -3
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +122 -11
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +77 -11
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDefSet.d.ts +9 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.d.ts +41 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.js +16 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.d.ts +19 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.js +12 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.d.ts +11 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.js +6 -3
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.d.ts +19 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.js +25 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.d.ts +26 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +20 -5
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +43 -7
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +18 -3
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.d.ts +19 -5
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.js +16 -5
- package/dist/Components/Table/Types/Columns/Definitions/JSONColumnDefSet.d.ts +14 -0
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.d.ts +34 -2
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +30 -7
- package/dist/Components/Table/Types/Columns/Definitions/ValidationFn.d.ts +17 -0
- package/dist/Components/Table/Types/Columns/DefsWrapper.d.ts +10 -0
- package/dist/Components/Table/Types/Columns/DisplayType.d.ts +13 -0
- package/dist/Components/Table/Types/Columns/DisplayType.js +14 -1
- package/dist/Components/Table/Types/Columns/ExpandColumn.d.ts +5 -0
- package/dist/Components/Table/Types/Columns/ExpandTableCell.d.ts +7 -0
- package/dist/Components/Table/Types/Columns/JSONColumnPinningState.d.ts +6 -0
- package/dist/Components/Table/Types/Columns/ProgressBarColumn.d.ts +5 -0
- package/dist/Components/Table/Types/Columns/ProgressBarTableCell.d.ts +9 -0
- package/dist/Components/Table/Types/Columns/TableActionButton.d.ts +12 -0
- package/dist/Components/Table/Types/Columns/TableCell.d.ts +16 -2
- package/dist/Components/Table/Types/Columns/VisibilityState.d.ts +12 -0
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.d.ts +173 -0
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.js +241 -0
- package/dist/Components/Table/Types/Context/FilteringState.svelte.d.ts +166 -0
- package/dist/Components/Table/Types/Context/FilteringState.svelte.js +180 -0
- package/dist/Components/Table/Types/Context/FocusState.svelte.d.ts +316 -0
- package/dist/Components/Table/Types/Context/FocusState.svelte.js +751 -0
- package/dist/Components/Table/Types/Context/ITable.d.ts +10 -0
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.d.ts +242 -0
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.js +317 -0
- package/dist/Components/Table/Types/Context/ReadonlyRowModel.d.ts +14 -3
- package/dist/Components/Table/Types/Context/Row.d.ts +18 -0
- package/dist/Components/Table/Types/Context/RowModel.d.ts +11 -0
- package/dist/Components/Table/Types/Context/SelectionState.svelte.d.ts +260 -0
- package/dist/Components/Table/Types/Context/SelectionState.svelte.js +613 -0
- package/dist/Components/Table/Types/Context/SortingState.svelte.d.ts +112 -0
- package/dist/Components/Table/Types/Context/SortingState.svelte.js +272 -0
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +547 -53
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +959 -1259
- package/dist/Components/Table/Types/Context/TableInitOptions.d.ts +16 -0
- package/dist/Components/Table/Types/Context/TableSettings.d.ts +20 -0
- package/dist/Components/Table/Types/Context/VirtualisationState.svelte.d.ts +167 -0
- package/dist/Components/Table/Types/Context/VirtualisationState.svelte.js +226 -0
- package/dist/Components/Table/Types/Coordinates/CellCoordinates.d.ts +12 -0
- package/dist/Components/Table/Types/Coordinates/CellCoordinatesWithoutColumn.d.ts +5 -0
- package/dist/Components/Table/Types/Coordinates/ColumnIndices.d.ts +16 -2
- package/dist/Components/Table/Types/DataRepository/BuiltInRemoteRepository.svelte.d.ts +143 -0
- package/dist/Components/Table/Types/DataRepository/BuiltInRemoteRepository.svelte.js +454 -0
- package/dist/Components/Table/Types/DataRepository/IDataRepository.d.ts +21 -0
- package/dist/Components/Table/Types/DataRepository/ILocalDataRepository.d.ts +10 -0
- package/dist/Components/Table/Types/DataRepository/IRemoteDataRepository.d.ts +16 -0
- package/dist/Components/Table/Types/DataRepository/LocalTableDataRepository.svelte.d.ts +87 -3
- package/dist/Components/Table/Types/DataRepository/LocalTableDataRepository.svelte.js +112 -7
- package/dist/Components/Table/Types/DataRepository/SortingState.d.ts +12 -0
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.d.ts +87 -2
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.js +74 -1
- package/dist/Components/Table/Types/ExpandedPanel.d.ts +9 -0
- package/dist/Components/Table/Types/ExpandedPanel.js +10 -1
- package/dist/Components/Table/Types/Filtering/ColumnFiltersState.d.ts +17 -0
- package/dist/Components/Table/Types/Filtering/CustomFilter.d.ts +21 -0
- package/dist/Components/Table/Types/Filtering/CustomFilterType.d.ts +5 -0
- package/dist/Components/Table/Types/Filtering/CustomFilterType.js +6 -1
- package/dist/Components/Table/Types/Filtering/CustomRemoteFilters.d.ts +6 -0
- package/dist/Components/Table/Types/Filtering/FilterFn.d.ts +28 -0
- package/dist/Components/Table/Types/Filtering/FilterMode.d.ts +7 -0
- package/dist/Components/Table/Types/Filtering/FilterType.d.ts +8 -0
- package/dist/Components/Table/Types/Filtering/FilterType.js +9 -1
- package/dist/Components/Table/Types/Filtering/FilterValueType.d.ts +11 -0
- package/dist/Components/Table/Types/Filtering/FilterValueType.js +12 -1
- package/dist/Components/Table/Types/Filtering/HasCustomFilterFunction.d.ts +23 -2
- package/dist/Components/Table/Types/Filtering/NumberDateFilterMode.d.ts +19 -12
- package/dist/Components/Table/Types/Filtering/NumberDateFilterMode.js +18 -14
- package/dist/Components/Table/Types/Filtering/StringFilterMode.d.ts +22 -15
- package/dist/Components/Table/Types/Filtering/StringFilterMode.js +22 -16
- package/dist/Components/Table/Types/Focus/MultiFocusEdge.d.ts +8 -0
- package/dist/Components/Table/Types/Focus/MultiFocusEdge.js +9 -1
- package/dist/Components/Table/Types/Focus/TableFocusDetails.svelte.d.ts +22 -0
- package/dist/Components/Table/Types/Focus/TableFocusDetails.svelte.js +22 -0
- package/dist/Components/Table/Types/Header.d.ts +8 -0
- package/dist/Components/Table/Types/HeaderGroup.d.ts +7 -0
- package/dist/Components/Table/Types/Layout/CellPinning.d.ts +1 -0
- package/dist/Components/Table/Types/Layout/CellPinning.js +8 -0
- package/dist/Components/Table/Types/OnChangeFn.d.ts +11 -0
- package/dist/Components/Table/Types/Pagination/PaginationState.d.ts +9 -0
- package/dist/Components/Table/Types/Pagination/PaginationType.d.ts +10 -0
- package/dist/Components/Table/Types/Pagination/PaginationType.js +11 -1
- package/dist/Components/Table/Types/Public/AnyEditEvent.d.ts +30 -0
- package/dist/Components/Table/Types/Public/AnyEditEvent.js +1 -0
- package/dist/Components/Table/Types/Public/BaseColumnOptions.d.ts +44 -0
- package/dist/Components/Table/Types/Public/BaseColumnOptions.js +1 -0
- package/dist/Components/Table/Types/Public/ColumnFactory.d.ts +35 -0
- package/dist/Components/Table/Types/Public/ColumnFactory.js +1 -0
- package/dist/Components/Table/Types/Public/ColumnOptions.d.ts +238 -0
- package/dist/Components/Table/Types/Public/ColumnOptions.js +1 -0
- package/dist/Components/Table/Types/Public/ColumnSpec.d.ts +39 -0
- package/dist/Components/Table/Types/Public/ColumnSpec.js +1 -0
- package/dist/Components/Table/Types/Public/CreateTableOptions.d.ts +87 -0
- package/dist/Components/Table/Types/Public/CreateTableOptions.js +1 -0
- package/dist/Components/Table/Types/Public/KeyConstraints.d.ts +42 -0
- package/dist/Components/Table/Types/Public/KeyConstraints.js +22 -0
- package/dist/Components/Table/Types/Public/RowSource.d.ts +87 -0
- package/dist/Components/Table/Types/Public/RowSource.js +1 -0
- package/dist/Components/Table/Types/Public/SelectionOptions.d.ts +26 -0
- package/dist/Components/Table/Types/Public/SelectionOptions.js +1 -0
- package/dist/Components/Table/Types/Public/Table.d.ts +39 -0
- package/dist/Components/Table/Types/Public/Table.js +1 -0
- package/dist/Components/Table/Types/Public/TableInitialState.d.ts +26 -0
- package/dist/Components/Table/Types/Public/TableInitialState.js +1 -0
- package/dist/Components/Table/Types/Public/TablePersistence.d.ts +38 -0
- package/dist/Components/Table/Types/Public/TablePersistence.js +1 -0
- package/dist/Components/Table/Types/Public/TableSubApis.d.ts +157 -0
- package/dist/Components/Table/Types/Public/TableSubApis.js +1 -0
- package/dist/Components/Table/Types/Public/index.d.ts +20 -0
- package/dist/Components/Table/Types/Public/index.js +8 -0
- package/dist/Components/Table/Types/Toolbar/ToolbarPosition.d.ts +4 -0
- package/dist/Components/Table/Types/Toolbar/ToolbarPosition.js +5 -1
- package/dist/Components/Table/createTable.svelte.d.ts +53 -0
- package/dist/Components/Table/createTable.svelte.js +269 -0
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +127 -108
- package/dist/Components/TextAreaProps.d.ts +37 -0
- package/dist/Components/TextInput.svelte +166 -147
- package/dist/Components/TextInputProps.d.ts +58 -1
- package/dist/Components/ThreeStateRadio.svelte +140 -143
- package/dist/Components/ThreeStateRadioProps.d.ts +29 -1
- package/dist/Components/Touch/BoolCard.svelte +45 -52
- package/dist/Components/Touch/BoolCard.svelte.d.ts +1 -10
- package/dist/Components/Touch/BoolCardProps.d.ts +21 -0
- package/dist/Components/Touch/BoolCardProps.js +1 -0
- package/dist/Components/Touch/DateModal.svelte +209 -217
- package/dist/Components/Touch/DateModal.svelte.d.ts +1 -17
- package/dist/Components/Touch/DateModalProps.d.ts +36 -0
- package/dist/Components/Touch/DateModalProps.js +1 -0
- package/dist/Components/Touch/EditCard.svelte +59 -52
- package/dist/Components/Touch/EditCardProps.d.ts +21 -0
- package/dist/Components/Touch/InfoCard.svelte +35 -28
- package/dist/Components/Touch/InfoCardProps.d.ts +9 -0
- package/dist/Components/Touch/InfoTextCard.svelte +28 -21
- package/dist/Components/Touch/InfoTextCardProps.d.ts +8 -0
- package/dist/Components/Touch/ModalExplanation.svelte +17 -20
- package/dist/Components/Touch/ModalExplanation.svelte.d.ts +1 -6
- package/dist/Components/Touch/ModalExplanationProps.d.ts +22 -0
- package/dist/Components/Touch/ModalExplanationProps.js +1 -0
- package/dist/Components/Touch/NumberKeyboard.svelte +225 -268
- package/dist/Components/Touch/NumberKeyboardProps.d.ts +19 -0
- package/dist/Components/Touch/NumberModal.svelte +79 -69
- package/dist/Components/Touch/NumberModalProps.d.ts +23 -1
- package/dist/Components/Touch/PlusMinusCard.svelte +48 -52
- package/dist/Components/Touch/PlusMinusCard.svelte.d.ts +1 -6
- package/dist/Components/Touch/PlusMinusCardProps.d.ts +18 -0
- package/dist/Components/Touch/PlusMinusCardProps.js +1 -0
- package/dist/Components/Touch/SelectModal.svelte +123 -105
- package/dist/Components/Touch/SelectModalProps.d.ts +22 -1
- package/dist/Components/Touch/SummaryCard.svelte +107 -65
- package/dist/Components/Touch/SummaryCardProps.d.ts +16 -3
- package/dist/Components/Touch/TextAreaModal.svelte +95 -86
- package/dist/Components/Touch/TextAreaModalProps.d.ts +21 -0
- package/dist/Components/Touch/TextModal.svelte +106 -123
- package/dist/Components/Touch/TextModalProps.d.ts +28 -1
- package/dist/Components/Touch/TouchCard.svelte +34 -72
- package/dist/Components/Touch/TouchCardProps.d.ts +21 -0
- package/dist/Components/Touch/TouchModal.svelte +265 -259
- package/dist/Components/Touch/TouchModalProps.d.ts +35 -1
- package/dist/Components/Touch/UtilityButton.svelte +116 -98
- package/dist/Components/Touch/UtilityButtonProps.d.ts +16 -0
- package/dist/Components/VerticalTabGroup.svelte +80 -102
- package/dist/Components/VerticalTabGroupButton.svelte +59 -98
- package/dist/Components/VerticalTabGroupProps.d.ts +15 -2
- package/dist/Contexts/AlertContext.svelte.d.ts +92 -8
- package/dist/Contexts/AlertContext.svelte.js +69 -6
- package/dist/Contexts/ContextMenuContext.svelte.d.ts +54 -8
- package/dist/Contexts/ContextMenuContext.svelte.js +48 -2
- package/dist/Contexts/TestContext.svelte.d.ts +27 -1
- package/dist/Contexts/TestContext.svelte.js +29 -1
- package/dist/Contexts/ToastContext.svelte.d.ts +29 -1
- package/dist/Contexts/ToastContext.svelte.js +93 -24
- package/dist/Contexts/TooltipContext.svelte.d.ts +68 -1
- package/dist/Contexts/TooltipContext.svelte.js +70 -7
- package/dist/Contexts/UntypedInputContext.svelte.d.ts +54 -5
- package/dist/Contexts/UntypedInputContext.svelte.js +87 -34
- package/dist/Delay/Delay.js +1 -1
- package/dist/Helpers/AsyncFlag.svelte.d.ts +39 -0
- package/dist/Helpers/AsyncFlag.svelte.js +72 -0
- package/dist/Helpers/Datamatrix.d.ts +19 -10
- package/dist/Helpers/Datamatrix.js +291 -2
- package/dist/Helpers/Helpers.svelte.d.ts +252 -17
- package/dist/Helpers/Helpers.svelte.js +271 -60
- package/dist/Helpers/INamed.d.ts +6 -0
- package/dist/Helpers/Storage.d.ts +67 -0
- package/dist/Helpers/Storage.js +138 -0
- package/dist/Helpers/dropdownPortal.d.ts +52 -0
- package/dist/Helpers/dropdownPortal.js +232 -0
- package/dist/Helpers/dropdownPortal.svelte.d.ts +2 -0
- package/dist/Helpers/dropdownPortal.svelte.js +5 -0
- package/dist/Helpers/memoiseByRow.d.ts +45 -0
- package/dist/Helpers/memoiseByRow.js +78 -0
- package/dist/Helpers/prefersReducedMotion.svelte.d.ts +27 -0
- package/dist/Helpers/prefersReducedMotion.svelte.js +18 -0
- package/dist/Helpers/useTooltip.svelte.d.ts +53 -0
- package/dist/Helpers/useTooltip.svelte.js +62 -0
- package/dist/Types/Examples/ExampleModal.svelte +35 -34
- package/dist/Types/Examples/ExampleSelectEnum.js +1 -1
- package/dist/Types/Internal/AsyncFlag.d.ts +7 -0
- package/dist/Types/Internal/AsyncFlag.js +1 -0
- package/dist/Types/Internal/BigRadioOption.d.ts +8 -0
- package/dist/Types/Internal/ButtonProp.d.ts +24 -2
- package/dist/Types/Internal/CallbackButton.d.ts +12 -0
- package/dist/Types/Internal/DateChange.d.ts +8 -0
- package/dist/Types/Internal/DatePickerType.d.ts +5 -0
- package/dist/Types/Internal/DatePickerType.js +6 -1
- package/dist/Types/Internal/IdentifiableToastMessage.d.ts +8 -0
- package/dist/Types/Internal/InputVariant.d.ts +5 -0
- package/dist/Types/Internal/InputVariant.js +6 -1
- package/dist/Types/Internal/Misc.d.ts +91 -0
- package/dist/Types/Internal/RefWrapper.d.ts +6 -0
- package/dist/Types/Internal/SelectOption.d.ts +8 -0
- package/dist/Types/Internal/Shape.d.ts +1 -0
- package/dist/Types/Internal/Shape.js +2 -1
- package/dist/Types/Internal/Side.d.ts +1 -0
- package/dist/Types/Internal/Side.js +2 -1
- package/dist/Types/Internal/Size.d.ts +5 -0
- package/dist/Types/Internal/Size.js +6 -1
- package/dist/Types/Internal/TabOption.d.ts +15 -5
- package/dist/Types/Internal/Ternary.d.ts +6 -0
- package/dist/Types/Internal/Ternary.js +7 -1
- package/dist/Types/Internal/ToastMessage.d.ts +28 -0
- package/dist/Types/Internal/Validity.d.ts +6 -0
- package/dist/Types/Internal/Validity.js +7 -1
- package/dist/Types/Internal/ValidityWrapper.d.ts +8 -0
- package/dist/Types/Internal/Variant.d.ts +5 -0
- package/dist/Types/Internal/Variant.js +6 -1
- package/dist/index.d.ts +27 -82
- package/dist/index.js +24 -62
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3300 -3016
- package/dist/scss/_motion.scss +57 -0
- package/dist/scss/_sizing.scss +85 -69
- package/dist/scss/_transitions.scss +8 -8
- package/dist/scss/colours.js +2 -2
- package/dist/scss/sizing.d.ts +9 -0
- package/dist/scss/sizing.js +10 -1
- package/package.json +6 -2
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { dev } from '$app/environment';
|
|
2
|
-
import { TableContext } from '../Components/Table/Types/Context/TableContext.svelte.js';
|
|
3
|
-
import { LocalTableDataRepository } from '../Components/Table/Types/DataRepository/LocalTableDataRepository.svelte.js';
|
|
4
|
-
import { CustomFilterType } from '../Components/Table/Types/Filtering/CustomFilterType.js';
|
|
5
2
|
import { Sizing } from '../scss/sizing.js';
|
|
6
3
|
import { untrack } from 'svelte';
|
|
7
4
|
import { SvelteDate, SvelteSet } from 'svelte/reactivity';
|
|
5
|
+
/**
|
|
6
|
+
* Returns the singular or plural form of `text` based on `quantity`.
|
|
7
|
+
* Handles common English suffix rules (`-s`, `-x`, `-z`, `-ch`,
|
|
8
|
+
* `-sh` -> `-es`; everything else -> `-s`). Set `capitalise` when
|
|
9
|
+
* the surrounding copy is upper-case (e.g. table headers).
|
|
10
|
+
*
|
|
11
|
+
* @param text - The singular form.
|
|
12
|
+
* @param quantity - When equal to `1`, the singular form is returned unchanged. Defaults to `2`.
|
|
13
|
+
* @param options.capitalise - When `true`, the appended suffix is upper-case.
|
|
14
|
+
*/
|
|
8
15
|
export function autoPluralise(text, quantity = 2, { capitalise = false } = {}) {
|
|
9
16
|
if (quantity === 1) {
|
|
10
17
|
return text;
|
|
@@ -32,13 +39,93 @@ export function autoPluralise(text, quantity = 2, { capitalise = false } = {}) {
|
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
}
|
|
42
|
+
/** Reactive set of lower-case English vowels; useful for "a" vs "an" decisions. */
|
|
35
43
|
export const vowels = new SvelteSet(['a', 'e', 'i', 'o', 'u']);
|
|
36
44
|
// generic is present to bypass floatAlias type requirements and the like
|
|
37
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Returns the first 13 characters of a freshly generated v4 UUID.
|
|
47
|
+
*
|
|
48
|
+
* Inherits the entropy source of `generateUUID` (cryptographic when
|
|
49
|
+
* available, see that function's docstring), so the underlying random
|
|
50
|
+
* draw is strong. However, truncating a 128-bit UUID to 13 hex
|
|
51
|
+
* characters reduces it to roughly 52 bits of entropy, which makes
|
|
52
|
+
* collisions plausible at scale and renders the value vulnerable to
|
|
53
|
+
* brute-force guessing.
|
|
54
|
+
*
|
|
55
|
+
* WARNING: do NOT use `generateWeakId` for security-sensitive
|
|
56
|
+
* identifiers (CSRF tokens, session keys, password-reset codes,
|
|
57
|
+
* idempotency tokens). It is intended for short DOM `id` attributes
|
|
58
|
+
* and similar low-collision, non-secret labels only. For any
|
|
59
|
+
* security-sensitive identifier use `generateUUID` (or, in new code,
|
|
60
|
+
* `globalThis.crypto.randomUUID()` directly).
|
|
61
|
+
*
|
|
62
|
+
* The `<T extends string>` generic preserves the `BrandedString`
|
|
63
|
+
* ergonomics used by the rest of the helpers. Unlike `generateUUID`
|
|
64
|
+
* the brand parameter has no default - callers must opt in to a brand
|
|
65
|
+
* explicitly because the value is NOT a full UUID.
|
|
66
|
+
*/
|
|
67
|
+
export function generateWeakId() {
|
|
38
68
|
return generateUUID().substring(0, 13);
|
|
39
69
|
}
|
|
40
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated - use `generateWeakId`; the short form trades collision
|
|
72
|
+
* resistance for brevity and is NOT suitable for security tokens. The
|
|
73
|
+
* rename is part of the SecureUUIDs follow-up; this alias is preserved
|
|
74
|
+
* to avoid breaking existing consumers in the same release.
|
|
75
|
+
*/
|
|
76
|
+
export function generateShortUUID() {
|
|
77
|
+
return generateWeakId();
|
|
78
|
+
}
|
|
79
|
+
let __weakUUIDWarned = false;
|
|
80
|
+
/**
|
|
81
|
+
* Generates an RFC 4122 version 4 UUID.
|
|
82
|
+
*
|
|
83
|
+
* Entropy source cascade (in order of preference):
|
|
84
|
+
* 1. `globalThis.crypto.randomUUID()` - native v4 UUID with
|
|
85
|
+
* cryptographically secure randomness. Available in all modern
|
|
86
|
+
* evergreen browsers (since 2022) and Node 19+.
|
|
87
|
+
* 2. `globalThis.crypto.getRandomValues(new Uint8Array(16))` - fills
|
|
88
|
+
* 16 random bytes from the platform CSPRNG, then sets the
|
|
89
|
+
* version (0x40) and variant (0x80) nibbles to produce a v4 UUID.
|
|
90
|
+
* Used when `randomUUID` is missing (older Safari, some embedded
|
|
91
|
+
* runtimes) but the Web Crypto API is otherwise present.
|
|
92
|
+
* 3. A `Math.random()`-based fallback that mixes in `Date.now()` and
|
|
93
|
+
* `performance.now()`. Emits a one-time `console.warn` to signal
|
|
94
|
+
* that the entropy is NOT cryptographically secure. Only reached
|
|
95
|
+
* on very old environments where `globalThis.crypto` itself is
|
|
96
|
+
* unavailable.
|
|
97
|
+
*
|
|
98
|
+
* The `<T extends string>` generic preserves the `BrandedString`
|
|
99
|
+
* ergonomics used by the rest of the helpers: callers may stamp the
|
|
100
|
+
* returned value with a brand without an explicit cast.
|
|
101
|
+
*
|
|
102
|
+
* @returns A v4 UUID string of the form
|
|
103
|
+
* `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` where `y` is one of
|
|
104
|
+
* `8`, `9`, `a`, `b`.
|
|
105
|
+
*/
|
|
41
106
|
export function generateUUID() {
|
|
107
|
+
const cryptoRef = typeof globalThis !== 'undefined' ? globalThis.crypto : undefined;
|
|
108
|
+
if (cryptoRef?.randomUUID) {
|
|
109
|
+
return cryptoRef.randomUUID();
|
|
110
|
+
}
|
|
111
|
+
if (cryptoRef?.getRandomValues) {
|
|
112
|
+
const bytes = new Uint8Array(16);
|
|
113
|
+
cryptoRef.getRandomValues(bytes);
|
|
114
|
+
// Set version (v4) and variant (RFC 4122) bits.
|
|
115
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
116
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
117
|
+
const hex = [];
|
|
118
|
+
for (let i = 0; i < 16; i++) {
|
|
119
|
+
hex.push(bytes[i].toString(16).padStart(2, '0'));
|
|
120
|
+
}
|
|
121
|
+
return `${hex[0]}${hex[1]}${hex[2]}${hex[3]}-${hex[4]}${hex[5]}-${hex[6]}${hex[7]}-${hex[8]}${hex[9]}-${hex[10]}${hex[11]}${hex[12]}${hex[13]}${hex[14]}${hex[15]}`;
|
|
122
|
+
}
|
|
123
|
+
// Last-resort fallback for environments without Web Crypto at all.
|
|
124
|
+
// Taken from https://stackoverflow.com/a/8809472/18712055.
|
|
125
|
+
if (!__weakUUIDWarned) {
|
|
126
|
+
__weakUUIDWarned = true;
|
|
127
|
+
console.warn('scoria generateUUID: Web Crypto API is unavailable; falling back to Math.random for UUID generation. The resulting identifiers are NOT cryptographically secure and must not be used for security tokens.');
|
|
128
|
+
}
|
|
42
129
|
let d = new SvelteDate().getTime(),
|
|
43
130
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
44
131
|
d2 = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0;
|
|
@@ -55,6 +142,11 @@ export function generateUUID() {
|
|
|
55
142
|
return (c == 'x' ? r : (r & 0x7) | 0x8).toString(16);
|
|
56
143
|
});
|
|
57
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates a `RefWrapper<T>` whose `value` is `$state`-backed.
|
|
147
|
+
* Used to pass mutable reactive references into contexts and
|
|
148
|
+
* across module boundaries without exposing the underlying rune.
|
|
149
|
+
*/
|
|
58
150
|
export function refWrapper(initial) {
|
|
59
151
|
let value = $state(initial);
|
|
60
152
|
return {
|
|
@@ -66,6 +158,52 @@ export function refWrapper(initial) {
|
|
|
66
158
|
},
|
|
67
159
|
};
|
|
68
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Ergonomic constructor for the {@link CssLength} brand. The runtime
|
|
163
|
+
* value is the raw string the caller supplied; the cast is purely a
|
|
164
|
+
* compile-time tag. There is intentionally no validation - the
|
|
165
|
+
* browser is the authoritative parser for CSS length tokens. Use
|
|
166
|
+
* this at the call-site so the brand is obvious in the diff.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* <Icon name="cog" float left={cssLength('10px')} />
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export function cssLength(value) {
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Ergonomic constructor for the {@link ScoriaStorageKey} brand. Use
|
|
178
|
+
* at the call-site of components that persist state to
|
|
179
|
+
* `sessionStorage` / `localStorage` (e.g. `StepForm`,
|
|
180
|
+
* `VerticalTabGroup`) so the brand is obvious in the diff.
|
|
181
|
+
*/
|
|
182
|
+
export function scoriaStorageKey(value) {
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Ergonomic constructor for the {@link SyntheticColumnId} brand.
|
|
187
|
+
* Use at the call-site of `ColumnDef` constructors whose `id` is not
|
|
188
|
+
* a key on the row type (e.g. `RowSelectionDef`, `ExpandDef`,
|
|
189
|
+
* `ActionsDef`, `FilterOnlyDef`) so the brand is obvious in the diff.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* super({
|
|
194
|
+
* id: syntheticColumnId(`is-selectable-${generateUUID()}`),
|
|
195
|
+
* ...
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
export function syntheticColumnId(value) {
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Formats a date into the `YYYY-MM-DD 00:00:00` shape expected by
|
|
204
|
+
* the FloWMS SQL backend. Accepts bare `Date` objects or any
|
|
205
|
+
* branded date string scoria models elsewhere.
|
|
206
|
+
*/
|
|
69
207
|
export function SQLFriendly(date) {
|
|
70
208
|
if (typeof date === 'string') {
|
|
71
209
|
date = new SvelteDate(date);
|
|
@@ -75,6 +213,12 @@ export function SQLFriendly(date) {
|
|
|
75
213
|
.toString()
|
|
76
214
|
.padStart(2, '0')} 00:00:00`;
|
|
77
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Like {@link SQLFriendly} but keeps the local time component
|
|
218
|
+
* (`YYYY-MM-DDTHH:MM:SS±HH:MM`). Accepts an optional separate
|
|
219
|
+
* `timeDate` argument when the date and time-of-day need to come
|
|
220
|
+
* from different sources.
|
|
221
|
+
*/
|
|
78
222
|
export function SQLFriendlyWithLocalTime(date, timeDate) {
|
|
79
223
|
if (typeof date === 'string') {
|
|
80
224
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
@@ -85,12 +229,17 @@ export function SQLFriendlyWithLocalTime(date, timeDate) {
|
|
|
85
229
|
timeDate = new Date(timeDate);
|
|
86
230
|
}
|
|
87
231
|
const d = date;
|
|
88
|
-
const t =
|
|
232
|
+
const t = timeDate ?? date;
|
|
89
233
|
const pad = (n) => String(n).padStart(2, '0');
|
|
90
234
|
const off = -t.getTimezoneOffset();
|
|
91
235
|
const sign = off >= 0 ? '+' : '-';
|
|
92
236
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}${sign}${pad(Math.floor(Math.abs(off) / 60))}:${pad(Math.abs(off) % 60)}`;
|
|
93
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Shared `Intl.DateTimeFormat` configured for UK locale, 24-hour
|
|
240
|
+
* clock, and the browser-resolved timezone. Useful for rendering
|
|
241
|
+
* timestamps consistently across scoria.
|
|
242
|
+
*/
|
|
94
243
|
export const localTimeFormat = new Intl.DateTimeFormat('en-GB', {
|
|
95
244
|
hour: '2-digit',
|
|
96
245
|
hourCycle: 'h23',
|
|
@@ -98,6 +247,13 @@ export const localTimeFormat = new Intl.DateTimeFormat('en-GB', {
|
|
|
98
247
|
second: '2-digit',
|
|
99
248
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
100
249
|
});
|
|
250
|
+
/**
|
|
251
|
+
* Default `onkeydown` handler that blurs the focused element when
|
|
252
|
+
* the user presses an alphanumeric key. Used on input wrappers
|
|
253
|
+
* and buttons so that scanner-driven barcode characters do not
|
|
254
|
+
* accumulate inside the focused field; instead the buffer goes
|
|
255
|
+
* to `UntypedInputContext`.
|
|
256
|
+
*/
|
|
101
257
|
export function passthrough(e) {
|
|
102
258
|
if (!e.key.match(/^[a-zA-Z0-9[\]]$/gm)) {
|
|
103
259
|
return;
|
|
@@ -105,6 +261,11 @@ export function passthrough(e) {
|
|
|
105
261
|
e.target.blur();
|
|
106
262
|
}
|
|
107
263
|
let __canvas;
|
|
264
|
+
/**
|
|
265
|
+
* Returns a shared, memoised 2D canvas context used for offscreen
|
|
266
|
+
* text measurement (column auto-sizing, ellipsis truncation, etc).
|
|
267
|
+
* Returns `null` when the environment cannot create a `<canvas>`.
|
|
268
|
+
*/
|
|
108
269
|
export function getCanvasContext() {
|
|
109
270
|
if (!__canvas) {
|
|
110
271
|
const _canvas = document.createElement('canvas');
|
|
@@ -118,6 +279,7 @@ export function getCanvasContext() {
|
|
|
118
279
|
}
|
|
119
280
|
return __canvas.getContext('2d');
|
|
120
281
|
}
|
|
282
|
+
/** Type guard for {@link IErrorResponse}. */
|
|
121
283
|
export function isErrorResponse(error) {
|
|
122
284
|
return (error != null &&
|
|
123
285
|
typeof error === 'object' &&
|
|
@@ -125,9 +287,25 @@ export function isErrorResponse(error) {
|
|
|
125
287
|
(Array.isArray(error.errors) || typeof error.errors === 'string') &&
|
|
126
288
|
!!error.errors.length);
|
|
127
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Type guard for the structural-`Error` shape. Returns `true` for
|
|
292
|
+
* any object with a `string` `message` property, which covers both
|
|
293
|
+
* native `Error` and cross-realm error-like objects.
|
|
294
|
+
*/
|
|
128
295
|
export function isJSError(error) {
|
|
129
296
|
return 'message' in error && typeof error.message == 'string';
|
|
130
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Best-effort extraction of a user-displayable error message from
|
|
300
|
+
* an unknown error value. Handles {@link IErrorResponse}, plain JS
|
|
301
|
+
* `Error`, and arbitrary strings; falls back to the literal
|
|
302
|
+
* `'Unknown Error'` when no recognisable shape is found.
|
|
303
|
+
*
|
|
304
|
+
* Callers that surface the output to the clipboard (e.g.
|
|
305
|
+
* `ToastContext.toast`) must gate `includeStack` and `includeCause`
|
|
306
|
+
* on `dev` so production users cannot accidentally exfiltrate
|
|
307
|
+
* backend internals.
|
|
308
|
+
*/
|
|
131
309
|
export function getErrorMessage(error, { includeUUID = true, includeStack = false, includeCause = false } = {}) {
|
|
132
310
|
if (!error) {
|
|
133
311
|
return 'Unknown Error';
|
|
@@ -165,11 +343,31 @@ export function getErrorMessage(error, { includeUUID = true, includeStack = fals
|
|
|
165
343
|
}
|
|
166
344
|
return errorList || 'Unknown Error';
|
|
167
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Pragmatic email-address validation regex. Module-lifted so the
|
|
348
|
+
* pattern object is reused across calls instead of recompiled on
|
|
349
|
+
* each invocation.
|
|
350
|
+
*/
|
|
351
|
+
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
352
|
+
/**
|
|
353
|
+
* Returns `true` when the supplied string parses as a plausible
|
|
354
|
+
* email address. Lower-cases first so address-portion comparisons
|
|
355
|
+
* are case-insensitive. Not RFC-5322 exhaustive; intended for
|
|
356
|
+
* UI-level pre-submission validation only.
|
|
357
|
+
*/
|
|
168
358
|
export function isValidEmailAddress(emailAddress) {
|
|
169
|
-
return emailAddress
|
|
170
|
-
.toLowerCase()
|
|
171
|
-
.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
|
|
359
|
+
return EMAIL_REGEX.test(emailAddress.toLowerCase());
|
|
172
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Svelte action that resizes a CSS grid item to span the row count
|
|
363
|
+
* required by its first child's height. Useful for masonry-style
|
|
364
|
+
* layouts where rows are uniform but content height is dynamic.
|
|
365
|
+
*
|
|
366
|
+
* Returns a teardown that disconnects the underlying
|
|
367
|
+
* `ResizeObserver` entirely; the previous implementation only
|
|
368
|
+
* unobserved the child, which left the observer registered with
|
|
369
|
+
* the browser and leaked the reference.
|
|
370
|
+
*/
|
|
173
371
|
export function gridItem(element) {
|
|
174
372
|
const firstChild = element.firstElementChild;
|
|
175
373
|
if (!firstChild) {
|
|
@@ -187,9 +385,14 @@ export function gridItem(element) {
|
|
|
187
385
|
});
|
|
188
386
|
observer.observe(firstChild);
|
|
189
387
|
return () => {
|
|
190
|
-
observer.
|
|
388
|
+
observer.disconnect();
|
|
191
389
|
};
|
|
192
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Resolves after `delay` milliseconds. The internal `setTimeout`
|
|
393
|
+
* call is wrapped in `untrack` so reactive scopes that `await`
|
|
394
|
+
* `asyncSleep` do not register the sleep as a dependency.
|
|
395
|
+
*/
|
|
193
396
|
export async function asyncSleep(delay) {
|
|
194
397
|
await untrack(() => new Promise((r) => {
|
|
195
398
|
void setTimeout(() => {
|
|
@@ -197,6 +400,15 @@ export async function asyncSleep(delay) {
|
|
|
197
400
|
}, delay);
|
|
198
401
|
}));
|
|
199
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Maps each element of `array` through `callback`, returning the
|
|
405
|
+
* result synchronously when every callback returns a non-Promise
|
|
406
|
+
* value and otherwise returning a `Promise<Array<R>>`.
|
|
407
|
+
*
|
|
408
|
+
* Tightening the return to `Promise<Array<R>>` unconditionally is
|
|
409
|
+
* tracked in the Helpers workorder; the union is preserved here to
|
|
410
|
+
* avoid microtask scheduling for purely-synchronous call sites.
|
|
411
|
+
*/
|
|
200
412
|
export function asyncMap(array, callback) {
|
|
201
413
|
const results = new Array(array.length);
|
|
202
414
|
const pending = [];
|
|
@@ -227,6 +439,12 @@ export function asyncMap(array, callback) {
|
|
|
227
439
|
}
|
|
228
440
|
return Promise.all(pending).then(() => results);
|
|
229
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Calls `callback` on every element of `array`. Returns `void`
|
|
444
|
+
* when no callback returned a Promise; otherwise returns a
|
|
445
|
+
* `Promise<void>` that resolves once every pending callback has
|
|
446
|
+
* settled.
|
|
447
|
+
*/
|
|
230
448
|
export function asyncForEach(array, callback) {
|
|
231
449
|
const pending = [];
|
|
232
450
|
try {
|
|
@@ -250,6 +468,10 @@ export function asyncForEach(array, callback) {
|
|
|
250
468
|
}
|
|
251
469
|
return Promise.all(pending).then(() => { });
|
|
252
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Maps each element to an array of `R` and concatenates the
|
|
473
|
+
* results. Sync fast-path matches {@link asyncMap}.
|
|
474
|
+
*/
|
|
253
475
|
export function asyncFlatMap(array, callback) {
|
|
254
476
|
const results = new Array(array.length);
|
|
255
477
|
const pending = [];
|
|
@@ -280,6 +502,10 @@ export function asyncFlatMap(array, callback) {
|
|
|
280
502
|
}
|
|
281
503
|
return Promise.all(pending).then(() => results.flat());
|
|
282
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Returns `true` as soon as any callback returns truthy.
|
|
507
|
+
* Short-circuits on synchronous truthy returns.
|
|
508
|
+
*/
|
|
283
509
|
export function asyncSome(array, callback) {
|
|
284
510
|
const asyncItems = [];
|
|
285
511
|
try {
|
|
@@ -312,6 +538,10 @@ export function asyncSome(array, callback) {
|
|
|
312
538
|
Promise.all(promises).then((r) => r.some(Boolean)),
|
|
313
539
|
]);
|
|
314
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* Returns `true` when every callback returns truthy.
|
|
543
|
+
* Short-circuits on the first synchronous falsy return.
|
|
544
|
+
*/
|
|
315
545
|
export function asyncAll(array, callback) {
|
|
316
546
|
if (array.length === 0) {
|
|
317
547
|
return true;
|
|
@@ -349,7 +579,12 @@ export function asyncAll(array, callback) {
|
|
|
349
579
|
Promise.all(promises).then((r) => r.every(Boolean)),
|
|
350
580
|
]);
|
|
351
581
|
}
|
|
582
|
+
/** Alias of {@link asyncAll}. */
|
|
352
583
|
export const asyncEvery = asyncAll;
|
|
584
|
+
/**
|
|
585
|
+
* Filters the array by the result of `callback`, returning the
|
|
586
|
+
* indices of matching elements (sorted ascending).
|
|
587
|
+
*/
|
|
353
588
|
export function asyncFilterIndices(array, callback) {
|
|
354
589
|
const filtered = [];
|
|
355
590
|
const pending = [];
|
|
@@ -382,6 +617,10 @@ export function asyncFilterIndices(array, callback) {
|
|
|
382
617
|
}
|
|
383
618
|
return Promise.all(pending).then(() => filtered.sort((a, b) => a - b));
|
|
384
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* Filters the array by the result of `callback`, returning the
|
|
622
|
+
* matching elements (sorted by their original index).
|
|
623
|
+
*/
|
|
385
624
|
export function asyncFilter(array, callback) {
|
|
386
625
|
const filtered = asyncFilterIndices(array, callback);
|
|
387
626
|
if (Array.isArray(filtered)) {
|
|
@@ -389,75 +628,47 @@ export function asyncFilter(array, callback) {
|
|
|
389
628
|
}
|
|
390
629
|
return filtered.then((f) => f.sort((a, b) => a - b).map((i) => array[i]));
|
|
391
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Promise-catch handler that logs in development and silently
|
|
633
|
+
* swallows in production. Intended for fire-and-forget tasks
|
|
634
|
+
* where the user-visible error path is already covered (e.g.
|
|
635
|
+
* `ToastContext.toast`).
|
|
636
|
+
*/
|
|
392
637
|
export function devCatch(e) {
|
|
393
638
|
if (dev) {
|
|
394
639
|
console.log(e);
|
|
395
640
|
}
|
|
396
641
|
}
|
|
397
|
-
|
|
398
|
-
return (!!customFilter &&
|
|
399
|
-
customFilter.type == CustomFilterType.Select &&
|
|
400
|
-
!!customFilter.query &&
|
|
401
|
-
typeof customFilter.query == 'function');
|
|
402
|
-
}
|
|
642
|
+
/** Type guard for the date-range tuple shape used by the date filter. */
|
|
403
643
|
export function isDateTuple(value) {
|
|
404
644
|
return (Array.isArray(value) &&
|
|
405
645
|
value.length < 3 &&
|
|
406
646
|
(value[0] === null || (typeof value[0] == 'object' && value[0] instanceof Date)) &&
|
|
407
647
|
(value[1] === null || (typeof value[1] == 'object' && value[1] instanceof Date)));
|
|
408
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Type guard for the numeric-range array shape used by the number
|
|
651
|
+
* filter (single number, single null, or [min, max] tuple).
|
|
652
|
+
*/
|
|
409
653
|
export function isNumericArray(value) {
|
|
410
654
|
return Array.isArray(value) && (value[0] === null || typeof value[0] == 'number');
|
|
411
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Type guard distinguishing a bare {@link Validity} value from a
|
|
658
|
+
* {@link ValidityWrapper} object carrying both `value` and `reason`.
|
|
659
|
+
*/
|
|
412
660
|
export function isValidityTuple(v) {
|
|
413
661
|
return v != null && typeof v == 'object';
|
|
414
662
|
}
|
|
663
|
+
/** Unicode horizontal ellipsis (U+2026). */
|
|
415
664
|
export const ellipses = '…';
|
|
665
|
+
/** Standard "loading..." placeholder text with U+2026 ellipsis. */
|
|
416
666
|
export const loadingText = 'loading…';
|
|
667
|
+
/**
|
|
668
|
+
* Type-safe `in` check: narrows `key` to a known key of `obj`.
|
|
669
|
+
* Useful for indexing into objects when the index variable is
|
|
670
|
+
* typed as plain `string`.
|
|
671
|
+
*/
|
|
417
672
|
export function isKeyOf(key, obj) {
|
|
418
673
|
return key in obj;
|
|
419
674
|
}
|
|
420
|
-
export function createLocalTable(args) {
|
|
421
|
-
const localRepo = new LocalTableDataRepository(args.name, args.data, args.getUserId);
|
|
422
|
-
return TableContext.init(args.defs, args.name, localRepo, {
|
|
423
|
-
selectionExtractor: args.selectionExtractor,
|
|
424
|
-
getUserId: args.getUserId,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
export function getAccessorSortingFn(accessorFn, desc) {
|
|
428
|
-
return desc
|
|
429
|
-
? (_a, _b) => {
|
|
430
|
-
const a = accessorFn(_a);
|
|
431
|
-
const b = accessorFn(_b);
|
|
432
|
-
if (a == undefined && b != undefined) {
|
|
433
|
-
return 1;
|
|
434
|
-
}
|
|
435
|
-
if (b == undefined && a != undefined) {
|
|
436
|
-
return -1;
|
|
437
|
-
}
|
|
438
|
-
if (a < b) {
|
|
439
|
-
return 1;
|
|
440
|
-
}
|
|
441
|
-
if (a > b) {
|
|
442
|
-
return -1;
|
|
443
|
-
}
|
|
444
|
-
return 0;
|
|
445
|
-
}
|
|
446
|
-
: (_a, _b) => {
|
|
447
|
-
const a = accessorFn(_a);
|
|
448
|
-
const b = accessorFn(_b);
|
|
449
|
-
if (a == undefined && b != undefined) {
|
|
450
|
-
return 1;
|
|
451
|
-
}
|
|
452
|
-
if (b == undefined && a != undefined) {
|
|
453
|
-
return -1;
|
|
454
|
-
}
|
|
455
|
-
if (a < b) {
|
|
456
|
-
return -1;
|
|
457
|
-
}
|
|
458
|
-
if (a > b) {
|
|
459
|
-
return 1;
|
|
460
|
-
}
|
|
461
|
-
return 0;
|
|
462
|
-
};
|
|
463
|
-
}
|
package/dist/Helpers/INamed.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal "thing with a name" interface used by storybook fixtures
|
|
3
|
+
* and a handful of internal types. Prefer a more specific
|
|
4
|
+
* interface in new code; this is retained for backwards
|
|
5
|
+
* compatibility with existing consumers.
|
|
6
|
+
*/
|
|
1
7
|
export interface INamed {
|
|
2
8
|
name: string;
|
|
3
9
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempt to load a key from `storage`, JSON-decode the slot, and pass
|
|
3
|
+
* the raw decoded value through `validator`. Returns the typed value on
|
|
4
|
+
* success or `fallback` on every failure path:
|
|
5
|
+
*
|
|
6
|
+
* - the slot is missing (`getItem` returned `null`);
|
|
7
|
+
* - the slot is not valid JSON (throws inside `JSON.parse` are caught);
|
|
8
|
+
* - the decoded value fails `validator`;
|
|
9
|
+
* - `storage` itself throws (private browsing, quota errors).
|
|
10
|
+
*
|
|
11
|
+
* All failure paths return `fallback`. When `dev` is true and a value is
|
|
12
|
+
* present but malformed, the helper emits a single `console.warn` so
|
|
13
|
+
* issues are visible during development without ever leaking into
|
|
14
|
+
* production logs.
|
|
15
|
+
*
|
|
16
|
+
* Storage is same-origin and writable by any script running in that
|
|
17
|
+
* origin, so any value retrieved here is untrusted: the validator is the
|
|
18
|
+
* only barrier between persisted data and downstream reactive state.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam T The validated shape returned on success.
|
|
21
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
22
|
+
* @param key The slot to read. Callers are responsible for namespacing.
|
|
23
|
+
* @param validator A type guard that decides whether `raw` is a `T`.
|
|
24
|
+
* @param fallback Value returned on every failure path.
|
|
25
|
+
* @returns The validated `T` on success, otherwise `fallback`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readJSON<T>(storage: Storage, key: string, validator: (raw: unknown) => raw is T, fallback: T): T;
|
|
28
|
+
/**
|
|
29
|
+
* Persist `value` to `storage` as a JSON envelope of the shape
|
|
30
|
+
* `{ v: schemaVersion, value }`. The envelope lets readers
|
|
31
|
+
* (see {@link readVersionedJSON}) detect schema drift and drop entries
|
|
32
|
+
* written by an older or future build instead of feeding them into
|
|
33
|
+
* reactive state.
|
|
34
|
+
*
|
|
35
|
+
* Throws from `JSON.stringify` (circular references) or from `setItem`
|
|
36
|
+
* (quota errors, locked storage) are swallowed and logged via
|
|
37
|
+
* `console.warn` in `dev` only. Persistence failure is never fatal: the
|
|
38
|
+
* caller's in-memory state is the source of truth.
|
|
39
|
+
*
|
|
40
|
+
* @typeParam T The value type to persist.
|
|
41
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
42
|
+
* @param key The slot to write. Callers are responsible for namespacing.
|
|
43
|
+
* @param value The value to serialise.
|
|
44
|
+
* @param schemaVersion An integer that bumps whenever the persisted
|
|
45
|
+
* shape changes in a backwards-incompatible way.
|
|
46
|
+
*/
|
|
47
|
+
export declare function writeJSON<T>(storage: Storage, key: string, value: T, schemaVersion: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Read an envelope written by {@link writeJSON} and unwrap its `value`
|
|
50
|
+
* if the recorded schema version matches `currentVersion` and the
|
|
51
|
+
* inner value satisfies `validator`.
|
|
52
|
+
*
|
|
53
|
+
* Returns `fallback` for every failure path: missing slot, malformed
|
|
54
|
+
* JSON, missing envelope shape, version mismatch, validator rejection,
|
|
55
|
+
* or storage throws. A version mismatch is treated as silent rejection
|
|
56
|
+
* so that callers can roll the schema forward without leaving stale
|
|
57
|
+
* shapes in user storage.
|
|
58
|
+
*
|
|
59
|
+
* @typeParam T The validated inner value type.
|
|
60
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
61
|
+
* @param key The slot to read. Callers are responsible for namespacing.
|
|
62
|
+
* @param currentVersion The schema version this reader expects.
|
|
63
|
+
* @param validator A type guard applied to the unwrapped inner value.
|
|
64
|
+
* @param fallback Value returned on every failure path.
|
|
65
|
+
* @returns The validated `T` on success, otherwise `fallback`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function readVersionedJSON<T>(storage: Storage, key: string, currentVersion: number, validator: (raw: unknown) => raw is T, fallback: T): T;
|