@lavalogic/scoria 0.36.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/dist/Components/AccordionGroup.svelte +6 -2
- package/dist/Components/AccordionGroupButton.svelte +78 -78
- package/dist/Components/AccordionGroupButtonProps.d.ts +27 -8
- package/dist/Components/AccordionGroupProps.d.ts +10 -2
- package/dist/Components/Action.svelte +31 -33
- package/dist/Components/ActionProps.d.ts +23 -3
- package/dist/Components/AlertModal.svelte +90 -39
- 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 +37 -15
- 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 +70 -62
- 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 +7 -0
- package/dist/Components/Base/Snippets.svelte.d.ts +5 -1
- package/dist/Components/BigRadioSet.svelte +18 -9
- package/dist/Components/BigRadioSetProps.d.ts +17 -1
- package/dist/Components/Bubble.svelte +67 -34
- package/dist/Components/Bubble.svelte.d.ts +23 -2
- package/dist/Components/BubbleProps.d.ts +55 -4
- package/dist/Components/Button.svelte +50 -38
- package/dist/Components/ButtonProps.d.ts +66 -1
- package/dist/Components/Checkbox.svelte +57 -29
- 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 +53 -22
- package/dist/Components/CollapsibleCardProps.d.ts +22 -1
- package/dist/Components/Contexts/ContextMenu.svelte +53 -32
- package/dist/Components/Contexts/ContextMenu.svelte.d.ts +26 -0
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -7
- package/dist/Components/Contexts/ContextMenuDivider.svelte.d.ts +9 -0
- package/dist/Components/Contexts/ContextMenuOption.svelte +27 -18
- 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 +28 -4
- package/dist/Components/Contexts/Toast.svelte.d.ts +14 -0
- package/dist/Components/Contexts/ToastContainer.svelte +30 -11
- 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 +21 -10
- package/dist/Components/Contexts/Tooltip.svelte.d.ts +10 -0
- package/dist/Components/DataMatrixIcon.svelte +82 -11
- package/dist/Components/DataMatrixIconProps.d.ts +73 -1
- package/dist/Components/DateInput.svelte +64 -29
- package/dist/Components/DateInput.svelte.d.ts +1 -1
- package/dist/Components/DateOnlyInputProps.d.ts +31 -5
- package/dist/Components/DatePicker.svelte +96 -108
- package/dist/Components/DatePickerProps.d.ts +18 -1
- package/dist/Components/DateTimeInputProps.d.ts +30 -5
- package/dist/Components/DesktopModal.svelte +14 -43
- package/dist/Components/DesktopModalProps.d.ts +5 -4
- package/dist/Components/Dial.svelte +103 -41
- package/dist/Components/DialProps.d.ts +74 -2
- package/dist/Components/DimensionInput.svelte +50 -64
- package/dist/Components/DimensionInput.svelte.d.ts +1 -1
- package/dist/Components/DimensionInputProps.d.ts +39 -4
- package/dist/Components/DragMenu/DragMenuHolder.svelte +41 -29
- package/dist/Components/DragMenu/DragMenuHolderProps.d.ts +30 -1
- package/dist/Components/DragMenu/DraggableCard.svelte +44 -8
- package/dist/Components/DragMenu/DraggableCardProps.d.ts +27 -1
- package/dist/Components/FileCard.svelte +6 -2
- package/dist/Components/FileCardProps.d.ts +17 -1
- package/dist/Components/FileUpload.svelte +82 -42
- package/dist/Components/FileUploadProps.d.ts +34 -4
- package/dist/Components/GridInput.svelte +27 -17
- package/dist/Components/GridInput.svelte.d.ts +5 -5
- package/dist/Components/GridInputProps.d.ts +4 -1
- package/dist/Components/GridInputSet.svelte +12 -5
- package/dist/Components/GridInputSet.svelte.d.ts +5 -5
- package/dist/Components/GridInputSetProps.d.ts +4 -2
- package/dist/Components/HorizontalTabGroup.svelte +13 -11
- package/dist/Components/HorizontalTabGroupButton.svelte +16 -68
- package/dist/Components/HorizontalTabGroupProps.d.ts +15 -2
- package/dist/Components/Icon.svelte +62 -21
- package/dist/Components/IconProps.d.ts +54 -6
- package/dist/Components/Icons.d.ts +8 -0
- package/dist/Components/Icons.js +234 -215
- package/dist/Components/LoadingAnimation.svelte +18 -18
- 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 +18 -20
- 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 +11 -13
- 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 +77 -82
- 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 +88 -76
- 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 +35 -30
- 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 +12 -3
- package/dist/Components/Nav/NavServiceMenuListProps.d.ts +25 -1
- package/dist/Components/Nav/NavTab.svelte +19 -48
- 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 +29 -20
- package/dist/Components/Nav/ServicesNav.svelte +60 -34
- 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 +37 -27
- package/dist/Components/NumberInputProps.d.ts +37 -0
- package/dist/Components/PageHeading.svelte +2 -13
- 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 +27 -15
- 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 +14 -3
- package/dist/Components/PortalProps.d.ts +20 -1
- package/dist/Components/ProgressBubble.svelte +98 -53
- package/dist/Components/ProgressBubbleProps.d.ts +23 -2
- package/dist/Components/QuerySelect.svelte +103 -159
- 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 +86 -108
- 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 +19 -69
- package/dist/Components/StepForm.svelte +52 -52
- package/dist/Components/StepFormProps.d.ts +16 -2
- package/dist/Components/Switch.svelte +68 -31
- 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 +106 -50
- 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 +43 -9
- 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 +15 -5
- 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 +424 -91
- 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 +43 -13
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponentProps.d.ts +12 -0
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +50 -38
- 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 +61 -26
- 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 +36 -16
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +47 -24
- 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 +54 -20
- 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 +55 -40
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte.d.ts +11 -0
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +38 -27
- 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 +22 -7
- 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 +61 -31
- 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 +123 -244
- 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 +126 -189
- 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 +31 -19
- 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 +125 -187
- 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 +119 -270
- 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 +23 -13
- 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 +200 -132
- 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 +170 -53
- 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 +5 -3
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte.d.ts +12 -11
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +5 -3
- package/dist/Components/Table/Headers/SelectAllHeader.svelte.d.ts +12 -11
- package/dist/Components/Table/Headers/TableHead.svelte +340 -200
- 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 +108 -50
- package/dist/Components/Table/Misc/ColumnPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +20 -7
- 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 +30 -41
- package/dist/Components/Table/Misc/FilterInput.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/FilterPanel.svelte +387 -29
- package/dist/Components/Table/Misc/FilterPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +4 -51
- package/dist/Components/Table/Misc/FilterPanelModal.svelte.d.ts +2 -23
- package/dist/Components/Table/Misc/SidePanel.svelte +12 -9
- 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 +44 -35
- 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 +17 -48
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/TableSidebar.svelte +28 -47
- package/dist/Components/Table/Misc/TableSidebar.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +121 -55
- package/dist/Components/Table/Misc/ToolboxPanel.svelte.d.ts +12 -11
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +31 -24
- 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 +85 -41
- 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 +347 -172
- 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/TextArea.svelte +37 -18
- package/dist/Components/TextAreaProps.d.ts +37 -0
- package/dist/Components/TextInput.svelte +41 -22
- package/dist/Components/TextInputProps.d.ts +58 -1
- package/dist/Components/ThreeStateRadio.svelte +61 -64
- package/dist/Components/ThreeStateRadioProps.d.ts +29 -1
- package/dist/Components/Touch/BoolCard.svelte +8 -15
- 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 +17 -25
- 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 +10 -3
- package/dist/Components/Touch/EditCardProps.d.ts +21 -0
- package/dist/Components/Touch/InfoCard.svelte +14 -7
- package/dist/Components/Touch/InfoCardProps.d.ts +9 -0
- package/dist/Components/Touch/InfoTextCard.svelte +9 -2
- package/dist/Components/Touch/InfoTextCardProps.d.ts +8 -0
- package/dist/Components/Touch/ModalExplanation.svelte +9 -12
- 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 +62 -105
- package/dist/Components/Touch/NumberKeyboardProps.d.ts +19 -0
- package/dist/Components/Touch/NumberModal.svelte +16 -6
- package/dist/Components/Touch/NumberModalProps.d.ts +23 -1
- package/dist/Components/Touch/PlusMinusCard.svelte +12 -16
- 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 +33 -15
- package/dist/Components/Touch/SelectModalProps.d.ts +22 -1
- package/dist/Components/Touch/SummaryCard.svelte +56 -14
- package/dist/Components/Touch/SummaryCardProps.d.ts +16 -3
- package/dist/Components/Touch/TextAreaModal.svelte +18 -9
- package/dist/Components/Touch/TextAreaModalProps.d.ts +21 -0
- package/dist/Components/Touch/TextModal.svelte +15 -32
- package/dist/Components/Touch/TextModalProps.d.ts +28 -1
- package/dist/Components/Touch/TouchCard.svelte +9 -47
- package/dist/Components/Touch/TouchCardProps.d.ts +21 -0
- package/dist/Components/Touch/TouchModal.svelte +105 -99
- package/dist/Components/Touch/TouchModalProps.d.ts +35 -1
- package/dist/Components/Touch/UtilityButton.svelte +36 -18
- package/dist/Components/Touch/UtilityButtonProps.d.ts +16 -0
- package/dist/Components/VerticalTabGroup.svelte +18 -40
- package/dist/Components/VerticalTabGroupButton.svelte +11 -50
- 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 +10 -1
- package/dist/Helpers/Datamatrix.js +290 -1
- package/dist/Helpers/Helpers.svelte.d.ts +252 -18
- package/dist/Helpers/Helpers.svelte.js +271 -75
- 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 +2 -1
- 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/_mixins.scss +451 -167
- package/dist/scss/_motion.scss +57 -0
- package/dist/scss/_sizing.scss +16 -0
- 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 +35 -31
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { dev } from '$app/environment';
|
|
2
|
+
/**
|
|
3
|
+
* Internal sentinel used by {@link readJSON} to flag every branch in
|
|
4
|
+
* which validation, parsing, or storage access fails. The caller never
|
|
5
|
+
* sees this value: each call site falls back to its `fallback` argument.
|
|
6
|
+
*/
|
|
7
|
+
const FAILED = Symbol('readJSON failed');
|
|
8
|
+
/**
|
|
9
|
+
* Attempt to load a key from `storage`, JSON-decode the slot, and pass
|
|
10
|
+
* the raw decoded value through `validator`. Returns the typed value on
|
|
11
|
+
* success or `fallback` on every failure path:
|
|
12
|
+
*
|
|
13
|
+
* - the slot is missing (`getItem` returned `null`);
|
|
14
|
+
* - the slot is not valid JSON (throws inside `JSON.parse` are caught);
|
|
15
|
+
* - the decoded value fails `validator`;
|
|
16
|
+
* - `storage` itself throws (private browsing, quota errors).
|
|
17
|
+
*
|
|
18
|
+
* All failure paths return `fallback`. When `dev` is true and a value is
|
|
19
|
+
* present but malformed, the helper emits a single `console.warn` so
|
|
20
|
+
* issues are visible during development without ever leaking into
|
|
21
|
+
* production logs.
|
|
22
|
+
*
|
|
23
|
+
* Storage is same-origin and writable by any script running in that
|
|
24
|
+
* origin, so any value retrieved here is untrusted: the validator is the
|
|
25
|
+
* only barrier between persisted data and downstream reactive state.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam T The validated shape returned on success.
|
|
28
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
29
|
+
* @param key The slot to read. Callers are responsible for namespacing.
|
|
30
|
+
* @param validator A type guard that decides whether `raw` is a `T`.
|
|
31
|
+
* @param fallback Value returned on every failure path.
|
|
32
|
+
* @returns The validated `T` on success, otherwise `fallback`.
|
|
33
|
+
*/
|
|
34
|
+
export function readJSON(storage, key, validator, fallback) {
|
|
35
|
+
const parsed = parseSlot(storage, key, validator);
|
|
36
|
+
if (parsed.ok) {
|
|
37
|
+
return parsed.value;
|
|
38
|
+
}
|
|
39
|
+
return fallback;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Persist `value` to `storage` as a JSON envelope of the shape
|
|
43
|
+
* `{ v: schemaVersion, value }`. The envelope lets readers
|
|
44
|
+
* (see {@link readVersionedJSON}) detect schema drift and drop entries
|
|
45
|
+
* written by an older or future build instead of feeding them into
|
|
46
|
+
* reactive state.
|
|
47
|
+
*
|
|
48
|
+
* Throws from `JSON.stringify` (circular references) or from `setItem`
|
|
49
|
+
* (quota errors, locked storage) are swallowed and logged via
|
|
50
|
+
* `console.warn` in `dev` only. Persistence failure is never fatal: the
|
|
51
|
+
* caller's in-memory state is the source of truth.
|
|
52
|
+
*
|
|
53
|
+
* @typeParam T The value type to persist.
|
|
54
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
55
|
+
* @param key The slot to write. Callers are responsible for namespacing.
|
|
56
|
+
* @param value The value to serialise.
|
|
57
|
+
* @param schemaVersion An integer that bumps whenever the persisted
|
|
58
|
+
* shape changes in a backwards-incompatible way.
|
|
59
|
+
*/
|
|
60
|
+
export function writeJSON(storage, key, value, schemaVersion) {
|
|
61
|
+
try {
|
|
62
|
+
const envelope = { v: schemaVersion, value };
|
|
63
|
+
storage.setItem(key, JSON.stringify(envelope));
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
if (dev) {
|
|
67
|
+
console.warn(`writeJSON failed for key "${key}":`, e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read an envelope written by {@link writeJSON} and unwrap its `value`
|
|
73
|
+
* if the recorded schema version matches `currentVersion` and the
|
|
74
|
+
* inner value satisfies `validator`.
|
|
75
|
+
*
|
|
76
|
+
* Returns `fallback` for every failure path: missing slot, malformed
|
|
77
|
+
* JSON, missing envelope shape, version mismatch, validator rejection,
|
|
78
|
+
* or storage throws. A version mismatch is treated as silent rejection
|
|
79
|
+
* so that callers can roll the schema forward without leaving stale
|
|
80
|
+
* shapes in user storage.
|
|
81
|
+
*
|
|
82
|
+
* @typeParam T The validated inner value type.
|
|
83
|
+
* @param storage `localStorage`, `sessionStorage`, or any `Storage`-shaped object.
|
|
84
|
+
* @param key The slot to read. Callers are responsible for namespacing.
|
|
85
|
+
* @param currentVersion The schema version this reader expects.
|
|
86
|
+
* @param validator A type guard applied to the unwrapped inner value.
|
|
87
|
+
* @param fallback Value returned on every failure path.
|
|
88
|
+
* @returns The validated `T` on success, otherwise `fallback`.
|
|
89
|
+
*/
|
|
90
|
+
export function readVersionedJSON(storage, key, currentVersion, validator, fallback) {
|
|
91
|
+
const envelopeGuard = (raw) => {
|
|
92
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const candidate = raw;
|
|
96
|
+
if (candidate.v !== currentVersion) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return validator(candidate.value);
|
|
100
|
+
};
|
|
101
|
+
const parsed = parseSlot(storage, key, envelopeGuard);
|
|
102
|
+
if (parsed.ok) {
|
|
103
|
+
return parsed.value.value;
|
|
104
|
+
}
|
|
105
|
+
return fallback;
|
|
106
|
+
}
|
|
107
|
+
function parseSlot(storage, key, validator) {
|
|
108
|
+
let raw;
|
|
109
|
+
try {
|
|
110
|
+
raw = storage.getItem(key);
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
if (dev) {
|
|
114
|
+
console.warn(`readJSON could not access storage for key "${key}":`, e);
|
|
115
|
+
}
|
|
116
|
+
return { ok: false, reason: FAILED };
|
|
117
|
+
}
|
|
118
|
+
if (raw === null) {
|
|
119
|
+
return { ok: false, reason: FAILED };
|
|
120
|
+
}
|
|
121
|
+
let decoded;
|
|
122
|
+
try {
|
|
123
|
+
decoded = JSON.parse(raw);
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
if (dev) {
|
|
127
|
+
console.warn(`readJSON could not parse JSON for key "${key}":`, e);
|
|
128
|
+
}
|
|
129
|
+
return { ok: false, reason: FAILED };
|
|
130
|
+
}
|
|
131
|
+
if (!validator(decoded)) {
|
|
132
|
+
if (dev) {
|
|
133
|
+
console.warn(`readJSON rejected value for key "${key}":`, decoded);
|
|
134
|
+
}
|
|
135
|
+
return { ok: false, reason: FAILED };
|
|
136
|
+
}
|
|
137
|
+
return { ok: true, value: decoded };
|
|
138
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portal helper for Svelecte-style dropdowns.
|
|
3
|
+
*
|
|
4
|
+
* Svelecte renders its `.sv_dropdown` element inline as a sibling of the
|
|
5
|
+
* `.svelecte-control` trigger. That means the dropdown is clipped by
|
|
6
|
+
* any ancestor with `overflow: hidden` / `overflow: auto`, sits below
|
|
7
|
+
* any ancestor with a higher `z-index`, and is repositioned by any
|
|
8
|
+
* `transform` / `filter` / `will-change: transform` on the way up to
|
|
9
|
+
* the body.
|
|
10
|
+
*
|
|
11
|
+
* This helper sidesteps all of that:
|
|
12
|
+
*
|
|
13
|
+
* 1. On open, it reparents the dropdown to `document.body` (saving
|
|
14
|
+
* the original parent + next-sibling so it can be restored on
|
|
15
|
+
* close).
|
|
16
|
+
* 2. It switches the dropdown to `position: fixed` and sets
|
|
17
|
+
* `top` / `left` / `width` / `bottom` from the trigger's
|
|
18
|
+
* `getBoundingClientRect()`.
|
|
19
|
+
* 3. It picks `top` vs `bottom` based on available space below vs
|
|
20
|
+
* above the trigger, so the dropdown auto-flips upwards when the
|
|
21
|
+
* trigger sits near the bottom of the viewport.
|
|
22
|
+
* 4. It listens for capture-phase `scroll` events and for viewport
|
|
23
|
+
* `resize` events so the position tracks the trigger while the
|
|
24
|
+
* dropdown is open. Repositioning is rAF-throttled to keep the
|
|
25
|
+
* cost off the scroll-event hot path.
|
|
26
|
+
* 5. On close, the dropdown is moved back to its original DOM slot
|
|
27
|
+
* and the inline positioning styles are cleared, so Svelecte's
|
|
28
|
+
* next open re-runs the same flow on a clean element.
|
|
29
|
+
*
|
|
30
|
+
* The helper deliberately does NOT add the `is-open` class or fight
|
|
31
|
+
* Svelecte's own state machine. Svelecte still owns open / closed
|
|
32
|
+
* lifecycle; the portal just intercepts the moment the class flips
|
|
33
|
+
* `is-open` on / off via a `MutationObserver`.
|
|
34
|
+
*/
|
|
35
|
+
export interface DropdownPortalOptions {
|
|
36
|
+
/** The Svelecte root wrapper `<div class="svelecte">`. Used as the
|
|
37
|
+
* anchor for positioning the teleported dropdown. */
|
|
38
|
+
getTrigger: () => HTMLElement | null | undefined;
|
|
39
|
+
/** The `<div class="sv_dropdown">` Svelecte renders. The helper
|
|
40
|
+
* watches this element's `class` attribute for `is-open` /
|
|
41
|
+
* `:not(is-open)` transitions. */
|
|
42
|
+
getDropdown: () => HTMLElement | null | undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Wire the portal behaviour onto a Svelecte instance. Returns a
|
|
46
|
+
* cleanup function that should be called on component destroy
|
|
47
|
+
* (typically from inside `onMount(() => { ... return cleanup; })`).
|
|
48
|
+
*
|
|
49
|
+
* Returns a no-op cleanup when called outside a browser (SSR) or when
|
|
50
|
+
* the trigger / dropdown nodes are not present.
|
|
51
|
+
*/
|
|
52
|
+
export declare function attachDropdownPortal(options: DropdownPortalOptions): () => void;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portal helper for Svelecte-style dropdowns.
|
|
3
|
+
*
|
|
4
|
+
* Svelecte renders its `.sv_dropdown` element inline as a sibling of the
|
|
5
|
+
* `.svelecte-control` trigger. That means the dropdown is clipped by
|
|
6
|
+
* any ancestor with `overflow: hidden` / `overflow: auto`, sits below
|
|
7
|
+
* any ancestor with a higher `z-index`, and is repositioned by any
|
|
8
|
+
* `transform` / `filter` / `will-change: transform` on the way up to
|
|
9
|
+
* the body.
|
|
10
|
+
*
|
|
11
|
+
* This helper sidesteps all of that:
|
|
12
|
+
*
|
|
13
|
+
* 1. On open, it reparents the dropdown to `document.body` (saving
|
|
14
|
+
* the original parent + next-sibling so it can be restored on
|
|
15
|
+
* close).
|
|
16
|
+
* 2. It switches the dropdown to `position: fixed` and sets
|
|
17
|
+
* `top` / `left` / `width` / `bottom` from the trigger's
|
|
18
|
+
* `getBoundingClientRect()`.
|
|
19
|
+
* 3. It picks `top` vs `bottom` based on available space below vs
|
|
20
|
+
* above the trigger, so the dropdown auto-flips upwards when the
|
|
21
|
+
* trigger sits near the bottom of the viewport.
|
|
22
|
+
* 4. It listens for capture-phase `scroll` events and for viewport
|
|
23
|
+
* `resize` events so the position tracks the trigger while the
|
|
24
|
+
* dropdown is open. Repositioning is rAF-throttled to keep the
|
|
25
|
+
* cost off the scroll-event hot path.
|
|
26
|
+
* 5. On close, the dropdown is moved back to its original DOM slot
|
|
27
|
+
* and the inline positioning styles are cleared, so Svelecte's
|
|
28
|
+
* next open re-runs the same flow on a clean element.
|
|
29
|
+
*
|
|
30
|
+
* The helper deliberately does NOT add the `is-open` class or fight
|
|
31
|
+
* Svelecte's own state machine. Svelecte still owns open / closed
|
|
32
|
+
* lifecycle; the portal just intercepts the moment the class flips
|
|
33
|
+
* `is-open` on / off via a `MutationObserver`.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Z-index applied to the teleported dropdown. Chosen so the dropdown
|
|
37
|
+
* sits above all sticky table strips (`z 5-11` in the table grid) and
|
|
38
|
+
* the side-panel chrome, but stays below modal overlays (`z 99999`
|
|
39
|
+
* in `Action`-based popovers).
|
|
40
|
+
*/
|
|
41
|
+
const PORTAL_Z_INDEX = 10000;
|
|
42
|
+
/**
|
|
43
|
+
* Minimum free vertical space below the trigger before the dropdown
|
|
44
|
+
* is flipped to open upwards. Picked to fit the default Svelecte
|
|
45
|
+
* dropdown (six rows + search input + padding) plus a little air;
|
|
46
|
+
* dropdowns with longer option lists will still scroll internally
|
|
47
|
+
* inside their fixed-height box.
|
|
48
|
+
*/
|
|
49
|
+
const FLIP_THRESHOLD_PX = 240;
|
|
50
|
+
/** Run a function on the next animation frame, coalescing repeat
|
|
51
|
+
* calls so we don't queue dozens of layout reads per scroll burst. */
|
|
52
|
+
function rafThrottle(fn) {
|
|
53
|
+
let handle = null;
|
|
54
|
+
return {
|
|
55
|
+
schedule() {
|
|
56
|
+
if (handle != null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
handle = requestAnimationFrame(() => {
|
|
60
|
+
handle = null;
|
|
61
|
+
fn();
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
cancel() {
|
|
65
|
+
if (handle != null) {
|
|
66
|
+
cancelAnimationFrame(handle);
|
|
67
|
+
handle = null;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Wire the portal behaviour onto a Svelecte instance. Returns a
|
|
74
|
+
* cleanup function that should be called on component destroy
|
|
75
|
+
* (typically from inside `onMount(() => { ... return cleanup; })`).
|
|
76
|
+
*
|
|
77
|
+
* Returns a no-op cleanup when called outside a browser (SSR) or when
|
|
78
|
+
* the trigger / dropdown nodes are not present.
|
|
79
|
+
*/
|
|
80
|
+
export function attachDropdownPortal(options) {
|
|
81
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
82
|
+
return () => {
|
|
83
|
+
/* SSR / no-op */
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const trigger = options.getTrigger();
|
|
87
|
+
const dropdown = options.getDropdown();
|
|
88
|
+
if (!trigger || !dropdown) {
|
|
89
|
+
return () => {
|
|
90
|
+
/* nothing wired up */
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
let originalParent = null;
|
|
94
|
+
let originalNextSibling = null;
|
|
95
|
+
let isPortalled = false;
|
|
96
|
+
const reposition = () => {
|
|
97
|
+
if (!isPortalled) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const tr = trigger.getBoundingClientRect();
|
|
101
|
+
// `offsetHeight` only reflects the actual rendered height once
|
|
102
|
+
// Svelecte has laid out the option list, so the first frame
|
|
103
|
+
// after open may read 0; fall back to the flip threshold so
|
|
104
|
+
// we still pick a sensible orientation in that case.
|
|
105
|
+
const dropdownHeight = dropdown.offsetHeight || FLIP_THRESHOLD_PX;
|
|
106
|
+
const viewportHeight = window.innerHeight;
|
|
107
|
+
const spaceBelow = viewportHeight - tr.bottom;
|
|
108
|
+
const spaceAbove = tr.top;
|
|
109
|
+
const openUp = spaceBelow < Math.min(dropdownHeight, FLIP_THRESHOLD_PX) && spaceAbove > spaceBelow;
|
|
110
|
+
dropdown.style.position = 'fixed';
|
|
111
|
+
dropdown.style.left = `${tr.left}px`;
|
|
112
|
+
dropdown.style.width = `${tr.width}px`;
|
|
113
|
+
// Override Svelecte's own `min-width: 100%` on `.sv_dropdown`.
|
|
114
|
+
// With `position: fixed` the percentage resolves against the
|
|
115
|
+
// initial containing block (the viewport), which would otherwise
|
|
116
|
+
// stretch the dropdown across the whole page. Pin the
|
|
117
|
+
// minimum to the trigger width so the dropdown stays the same
|
|
118
|
+
// width as the select that opened it.
|
|
119
|
+
dropdown.style.minWidth = `${tr.width}px`;
|
|
120
|
+
dropdown.style.maxWidth = `${tr.width}px`;
|
|
121
|
+
dropdown.style.zIndex = String(PORTAL_Z_INDEX);
|
|
122
|
+
// Bound the dropdown's max height to the available space so
|
|
123
|
+
// long option lists scroll internally rather than disappear
|
|
124
|
+
// past the viewport edge.
|
|
125
|
+
if (openUp) {
|
|
126
|
+
dropdown.style.top = '';
|
|
127
|
+
dropdown.style.bottom = `${viewportHeight - tr.top}px`;
|
|
128
|
+
dropdown.style.maxHeight = `${Math.max(spaceAbove - 8, 64)}px`;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
dropdown.style.top = `${tr.bottom}px`;
|
|
132
|
+
dropdown.style.bottom = '';
|
|
133
|
+
dropdown.style.maxHeight = `${Math.max(spaceBelow - 8, 64)}px`;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const throttled = rafThrottle(reposition);
|
|
137
|
+
const handleScroll = () => {
|
|
138
|
+
throttled.schedule();
|
|
139
|
+
};
|
|
140
|
+
const handleResize = () => {
|
|
141
|
+
throttled.schedule();
|
|
142
|
+
};
|
|
143
|
+
const portalOut = () => {
|
|
144
|
+
if (isPortalled) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
originalParent = dropdown.parentNode;
|
|
148
|
+
originalNextSibling = dropdown.nextSibling;
|
|
149
|
+
document.body.appendChild(dropdown);
|
|
150
|
+
// Tag the teleported dropdown so any "click outside the
|
|
151
|
+
// panel" / "click outside the trigger" handler elsewhere in
|
|
152
|
+
// the codebase can recognise the dropdown as a logical
|
|
153
|
+
// extension of its trigger and ignore clicks landing inside
|
|
154
|
+
// it. The `TableSidebar` side-panel uses this marker (along
|
|
155
|
+
// with `closest('.sv_dropdown')`) so clicking an option in a
|
|
156
|
+
// teleported filter-row dropdown does not close the
|
|
157
|
+
// side-panel under it. Components that want to ignore
|
|
158
|
+
// portal clicks should check
|
|
159
|
+
// `el.closest('[data-scoria-portal-dropdown]')`.
|
|
160
|
+
dropdown.setAttribute('data-scoria-portal-dropdown', '');
|
|
161
|
+
isPortalled = true;
|
|
162
|
+
// First-frame measurement: lay out, then reposition again on
|
|
163
|
+
// the next frame so we measure the dropdown's real
|
|
164
|
+
// `offsetHeight` once it has options rendered.
|
|
165
|
+
reposition();
|
|
166
|
+
requestAnimationFrame(reposition);
|
|
167
|
+
// `capture: true` so scroll events on any ancestor (the
|
|
168
|
+
// filter-panel side pane, the page itself, the .datatable
|
|
169
|
+
// scroll container) reach this listener; without capture the
|
|
170
|
+
// listener would only fire when the document element scrolls.
|
|
171
|
+
window.addEventListener('scroll', handleScroll, { capture: true, passive: true });
|
|
172
|
+
window.addEventListener('resize', handleResize, { passive: true });
|
|
173
|
+
};
|
|
174
|
+
const portalIn = () => {
|
|
175
|
+
if (!isPortalled) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
throttled.cancel();
|
|
179
|
+
window.removeEventListener('scroll', handleScroll, { capture: true });
|
|
180
|
+
window.removeEventListener('resize', handleResize);
|
|
181
|
+
// Strip the inline overrides so Svelecte's next open starts
|
|
182
|
+
// from a clean slate (and so a closed dropdown still occupies
|
|
183
|
+
// its Svelecte-managed `display: none` slot).
|
|
184
|
+
dropdown.style.position = '';
|
|
185
|
+
dropdown.style.top = '';
|
|
186
|
+
dropdown.style.left = '';
|
|
187
|
+
dropdown.style.bottom = '';
|
|
188
|
+
dropdown.style.width = '';
|
|
189
|
+
dropdown.style.minWidth = '';
|
|
190
|
+
dropdown.style.maxWidth = '';
|
|
191
|
+
dropdown.style.maxHeight = '';
|
|
192
|
+
dropdown.style.zIndex = '';
|
|
193
|
+
dropdown.removeAttribute('data-scoria-portal-dropdown');
|
|
194
|
+
if (originalParent != null) {
|
|
195
|
+
if (originalNextSibling != null && originalNextSibling.parentNode === originalParent) {
|
|
196
|
+
originalParent.insertBefore(dropdown, originalNextSibling);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
originalParent.appendChild(dropdown);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
originalParent = null;
|
|
203
|
+
originalNextSibling = null;
|
|
204
|
+
isPortalled = false;
|
|
205
|
+
};
|
|
206
|
+
// Apply / unapply the portal whenever Svelecte toggles the
|
|
207
|
+
// `is-open` class on the dropdown. We watch class only because
|
|
208
|
+
// Svelecte's open state is exposed purely as a class flip.
|
|
209
|
+
const observer = new MutationObserver((mutations) => {
|
|
210
|
+
for (const mutation of mutations) {
|
|
211
|
+
if (mutation.attributeName !== 'class') {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (dropdown.classList.contains('is-open')) {
|
|
215
|
+
portalOut();
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
portalIn();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
observer.observe(dropdown, { attributes: true, attributeFilter: ['class'] });
|
|
223
|
+
// Honour the dropdown's initial state in case it mounted already
|
|
224
|
+
// open (e.g. `focusOnLoad`).
|
|
225
|
+
if (dropdown.classList.contains('is-open')) {
|
|
226
|
+
portalOut();
|
|
227
|
+
}
|
|
228
|
+
return () => {
|
|
229
|
+
observer.disconnect();
|
|
230
|
+
portalIn();
|
|
231
|
+
};
|
|
232
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This module has been moved to `dropdownPortal.ts` because it does
|
|
2
|
+
// not use any Svelte 5 runes. This re-export exists only to keep
|
|
3
|
+
// older imports compiling if any consumer reached for the
|
|
4
|
+
// `.svelte.ts` path during early development.
|
|
5
|
+
export { attachDropdownPortal } from './dropdownPortal.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-keyed memoisation helpers for ColumnDef accessors.
|
|
3
|
+
*
|
|
4
|
+
* The Table renders a fresh `$derived` graph per cell per render, and a
|
|
5
|
+
* 1000-row sort/filter pass will invoke `def.getDisplayValue(row)` /
|
|
6
|
+
* `def.getColour(row, index, value)` once per row per pass. For user
|
|
7
|
+
* callbacks that do non-trivial work (string concat, date formatting,
|
|
8
|
+
* colour lookup) this adds up.
|
|
9
|
+
*
|
|
10
|
+
* Strategy: attach a `WeakMap<TRow, Result>` cache to the Def class
|
|
11
|
+
* (one map per Def instance). When the underlying user callback is
|
|
12
|
+
* reassigned (e.g. caller rebuilt `columnDefs = [...]`), the wrapper is
|
|
13
|
+
* re-derived via `$derived`, which automatically discards the stale
|
|
14
|
+
* cache. When a row reference is GC'd the WeakMap entry follows.
|
|
15
|
+
*
|
|
16
|
+
* Async values: when the user callback returns a `Promise<T>`, the
|
|
17
|
+
* Promise itself is cached. Repeated reads return the same Promise so
|
|
18
|
+
* Svelte's `{#await}` resolves once. Failure is not specially handled:
|
|
19
|
+
* a rejected Promise stays cached; reassignment of the user callback
|
|
20
|
+
* clears it.
|
|
21
|
+
*
|
|
22
|
+
* The helpers are pure functions of `(rawFn) -> wrappedFn`. They are
|
|
23
|
+
* intended to be called from a `$derived` so that reassigning the user
|
|
24
|
+
* callback automatically invalidates the cache.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Wrap a row-keyed accessor `(row, index) => V | Promise<V>` with a
|
|
28
|
+
* WeakMap cache keyed by row identity. Returns `undefined` when the
|
|
29
|
+
* input is `undefined` (passes through the optional contract).
|
|
30
|
+
*
|
|
31
|
+
* The `index` argument is intentionally NOT part of the cache key. Rows
|
|
32
|
+
* keep their identity across sort / filter passes; only their visible
|
|
33
|
+
* index changes. Caching by row identity gives the desired re-use.
|
|
34
|
+
*/
|
|
35
|
+
export declare function memoiseRowAccessor<TRow extends object, V>(rawFn: ((row: TRow, index: number) => V) | undefined): ((row: TRow, index: number) => V) | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Wrap a per-cell value-keyed accessor `(row, index, value) => V` with
|
|
38
|
+
* a WeakMap<row, Map<value, V>> cache. Used by BubbleDef where the
|
|
39
|
+
* colour depends on both the row and a per-bubble string value.
|
|
40
|
+
*
|
|
41
|
+
* The inner Map is created lazily per row. Bubble counts per row are
|
|
42
|
+
* small (typically < 10) so the inner Map cost is dominated by the
|
|
43
|
+
* outer WeakMap.
|
|
44
|
+
*/
|
|
45
|
+
export declare function memoiseRowValueAccessor<TRow extends object, TValue, VRet>(rawFn: ((row: TRow, index: number, value: TValue) => VRet) | undefined): ((row: TRow, index: number, value: TValue) => VRet) | undefined;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-keyed memoisation helpers for ColumnDef accessors.
|
|
3
|
+
*
|
|
4
|
+
* The Table renders a fresh `$derived` graph per cell per render, and a
|
|
5
|
+
* 1000-row sort/filter pass will invoke `def.getDisplayValue(row)` /
|
|
6
|
+
* `def.getColour(row, index, value)` once per row per pass. For user
|
|
7
|
+
* callbacks that do non-trivial work (string concat, date formatting,
|
|
8
|
+
* colour lookup) this adds up.
|
|
9
|
+
*
|
|
10
|
+
* Strategy: attach a `WeakMap<TRow, Result>` cache to the Def class
|
|
11
|
+
* (one map per Def instance). When the underlying user callback is
|
|
12
|
+
* reassigned (e.g. caller rebuilt `columnDefs = [...]`), the wrapper is
|
|
13
|
+
* re-derived via `$derived`, which automatically discards the stale
|
|
14
|
+
* cache. When a row reference is GC'd the WeakMap entry follows.
|
|
15
|
+
*
|
|
16
|
+
* Async values: when the user callback returns a `Promise<T>`, the
|
|
17
|
+
* Promise itself is cached. Repeated reads return the same Promise so
|
|
18
|
+
* Svelte's `{#await}` resolves once. Failure is not specially handled:
|
|
19
|
+
* a rejected Promise stays cached; reassignment of the user callback
|
|
20
|
+
* clears it.
|
|
21
|
+
*
|
|
22
|
+
* The helpers are pure functions of `(rawFn) -> wrappedFn`. They are
|
|
23
|
+
* intended to be called from a `$derived` so that reassigning the user
|
|
24
|
+
* callback automatically invalidates the cache.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Wrap a row-keyed accessor `(row, index) => V | Promise<V>` with a
|
|
28
|
+
* WeakMap cache keyed by row identity. Returns `undefined` when the
|
|
29
|
+
* input is `undefined` (passes through the optional contract).
|
|
30
|
+
*
|
|
31
|
+
* The `index` argument is intentionally NOT part of the cache key. Rows
|
|
32
|
+
* keep their identity across sort / filter passes; only their visible
|
|
33
|
+
* index changes. Caching by row identity gives the desired re-use.
|
|
34
|
+
*/
|
|
35
|
+
export function memoiseRowAccessor(rawFn) {
|
|
36
|
+
if (rawFn === undefined) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const cache = new WeakMap();
|
|
40
|
+
return (row, index) => {
|
|
41
|
+
const hit = cache.get(row);
|
|
42
|
+
if (hit !== undefined || cache.has(row)) {
|
|
43
|
+
return hit;
|
|
44
|
+
}
|
|
45
|
+
const value = rawFn(row, index);
|
|
46
|
+
cache.set(row, value);
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Wrap a per-cell value-keyed accessor `(row, index, value) => V` with
|
|
52
|
+
* a WeakMap<row, Map<value, V>> cache. Used by BubbleDef where the
|
|
53
|
+
* colour depends on both the row and a per-bubble string value.
|
|
54
|
+
*
|
|
55
|
+
* The inner Map is created lazily per row. Bubble counts per row are
|
|
56
|
+
* small (typically < 10) so the inner Map cost is dominated by the
|
|
57
|
+
* outer WeakMap.
|
|
58
|
+
*/
|
|
59
|
+
export function memoiseRowValueAccessor(rawFn) {
|
|
60
|
+
if (rawFn === undefined) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const cache = new WeakMap();
|
|
64
|
+
return (row, index, value) => {
|
|
65
|
+
let inner = cache.get(row);
|
|
66
|
+
if (inner === undefined) {
|
|
67
|
+
inner = new Map();
|
|
68
|
+
cache.set(row, inner);
|
|
69
|
+
}
|
|
70
|
+
const hit = inner.get(value);
|
|
71
|
+
if (hit !== undefined || inner.has(value)) {
|
|
72
|
+
return hit;
|
|
73
|
+
}
|
|
74
|
+
const result = rawFn(row, index, value);
|
|
75
|
+
inner.set(value, result);
|
|
76
|
+
return result;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive accessor for the `prefers-reduced-motion: reduce` user preference.
|
|
3
|
+
*
|
|
4
|
+
* Components that drive motion from JS (the `svelte/transition` family, custom
|
|
5
|
+
* `requestAnimationFrame` loops, etc.) cannot opt out via a CSS media query
|
|
6
|
+
* alone: the offending styles are inlined onto the element by the transition
|
|
7
|
+
* tween, which beats any external rule. This helper exposes the current value
|
|
8
|
+
* of `matchMedia('(prefers-reduced-motion: reduce)')` as a runed reactive flag
|
|
9
|
+
* that survives re-renders and removes its listener on teardown.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* <script>
|
|
14
|
+
* const reducedMotion = usePrefersReducedMotion();
|
|
15
|
+
* const slideDuration = $derived(reducedMotion.matches ? 0 : 200);
|
|
16
|
+
* </script>
|
|
17
|
+
* <div transition:slide={{ duration: slideDuration }}>...</div>
|
|
18
|
+
*
|
|
19
|
+
* In environments without a `matchMedia` implementation (server-side render,
|
|
20
|
+
* legacy embedded browser) the helper returns `matches: false` and never
|
|
21
|
+
* registers a listener, so callers can use the same code path on both client
|
|
22
|
+
* and server.
|
|
23
|
+
*/
|
|
24
|
+
export interface PrefersReducedMotionResult {
|
|
25
|
+
readonly matches: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function usePrefersReducedMotion(): PrefersReducedMotionResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function usePrefersReducedMotion() {
|
|
2
|
+
const state = $state({ matches: false });
|
|
3
|
+
if (typeof globalThis === 'undefined' || typeof globalThis.matchMedia !== 'function') {
|
|
4
|
+
return state;
|
|
5
|
+
}
|
|
6
|
+
const mql = globalThis.matchMedia('(prefers-reduced-motion: reduce)');
|
|
7
|
+
state.matches = mql.matches;
|
|
8
|
+
const listener = (event) => {
|
|
9
|
+
state.matches = event.matches;
|
|
10
|
+
};
|
|
11
|
+
$effect(() => {
|
|
12
|
+
mql.addEventListener('change', listener);
|
|
13
|
+
return () => {
|
|
14
|
+
mql.removeEventListener('change', listener);
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Side } from '../Types/Internal/Side.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link useTooltip}. All inputs are thunks so the helper can
|
|
4
|
+
* establish its own `$effect` / lazy-read dependency on whatever reactive
|
|
5
|
+
* state the caller wraps inside.
|
|
6
|
+
*/
|
|
7
|
+
export interface UseTooltipOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The text to show in the tooltip. Return `null` or `undefined` to
|
|
10
|
+
* suppress the tooltip entirely (e.g. for label-less icon buttons).
|
|
11
|
+
* Empty strings are also treated as "no tooltip". The non-empty text
|
|
12
|
+
* value is also used as the cleanup key passed to
|
|
13
|
+
* {@link TooltipContext.hideTooltip}.
|
|
14
|
+
*/
|
|
15
|
+
text: () => string | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Optional thunk returning the side of the anchor the tooltip arrow
|
|
18
|
+
* should point to. Defaults to {@link Side.Top}.
|
|
19
|
+
*/
|
|
20
|
+
arrow?: () => Side;
|
|
21
|
+
/**
|
|
22
|
+
* Optional thunk returning the show-delay in milliseconds. Defaults
|
|
23
|
+
* to {@link Delay.Default}.
|
|
24
|
+
*/
|
|
25
|
+
delay?: () => number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Event-handler bundle returned by {@link useTooltip}. Spread these onto
|
|
29
|
+
* the anchor element or compose them with the consumer's existing
|
|
30
|
+
* handlers using the `(e) => { tt.onmouseenter(e); custom(e); }` pattern.
|
|
31
|
+
*/
|
|
32
|
+
export interface UseTooltipHandlers {
|
|
33
|
+
onmouseenter: (e: MouseEvent) => void;
|
|
34
|
+
onmouseleave: () => void;
|
|
35
|
+
onclick: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Shared lifecycle for `TooltipContext`-driven tooltips. Centralises the
|
|
39
|
+
* `showTooltip` / `hideTooltip` calls on hover, the
|
|
40
|
+
* `hideTooltip`-on-click race-guard, and the unmount-time teardown that
|
|
41
|
+
* prevents a stuck tooltip when the anchor element churns mid-hover.
|
|
42
|
+
*
|
|
43
|
+
* Looks up `TooltipContext` once at initialisation time. When no context
|
|
44
|
+
* is mounted (or `text()` returns `undefined`), all handlers are no-ops.
|
|
45
|
+
*
|
|
46
|
+
* Must be called during component initialisation so it can register its
|
|
47
|
+
* `$effect` cleanup hook.
|
|
48
|
+
*
|
|
49
|
+
* @param options Thunks describing the tooltip text, arrow side, and delay.
|
|
50
|
+
* @returns A bundle of `onmouseenter` / `onmouseleave` / `onclick`
|
|
51
|
+
* handlers ready to wire onto the anchor element.
|
|
52
|
+
*/
|
|
53
|
+
export declare function useTooltip(options: UseTooltipOptions): UseTooltipHandlers;
|