@lavalogic/scoria 0.19.5 → 0.20.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.
@@ -13,7 +13,7 @@
13
13
  import TextInput from '../../TextInput.svelte';
14
14
  import ThreeStateRadio from '../../ThreeStateRadio.svelte';
15
15
  import DateModal from '../../Touch/DateModal.svelte';
16
- import { devCatch, hasQuery, isDateTuple, isNumberTuple } from '../../../Helpers/Helpers.svelte.js';
16
+ import { devCatch, hasQuery, isDateTuple, isNumericArray } from '../../../Helpers/Helpers.svelte.js';
17
17
  import { Colour, ColourSet } from '../../../scss/colours.js';
18
18
  import { InputVariant } from '../../../Types/Internal/InputVariant.js';
19
19
  import type { SelectOption } from '../../../Types/Internal/SelectOption.js';
@@ -247,7 +247,7 @@
247
247
  tableContext.paginationRepo.filtering.find((it) => it.id === def.id);
248
248
 
249
249
  if (filterOption) {
250
- if (isNumberTuple(filterOption.value)) {
250
+ if (isNumericArray(filterOption.value)) {
251
251
  [valueMin, valueMax] = filterOption.value;
252
252
  if (valueMax == undefined) {
253
253
  valueMax = valueMin;
@@ -12,7 +12,7 @@
12
12
  import SingleSelect from '../../SingleSelect.svelte';
13
13
  import TextInput from '../../TextInput.svelte';
14
14
  import DateModal from '../../Touch/DateModal.svelte';
15
- import { devCatch, hasQuery, isDateTuple, isNumberTuple } from '../../../Helpers/Helpers.svelte.js';
15
+ import { devCatch, hasQuery, isDateTuple, isNumericArray } from '../../../Helpers/Helpers.svelte.js';
16
16
  import type { SelectOption } from '../../../Types/Internal/SelectOption.js';
17
17
  import { getContext, onMount, untrack } from 'svelte';
18
18
  import { CheckboxDef } from '../Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js';
@@ -192,7 +192,7 @@
192
192
  tableContext.paginationRepo.filtering.find((it) => it.id === def.id);
193
193
 
194
194
  if (filterOption) {
195
- if (isNumberTuple(filterOption.value)) {
195
+ if (isNumericArray(filterOption.value)) {
196
196
  [valueMin, valueMax] = filterOption.value;
197
197
  if (valueMax == undefined) {
198
198
  valueMax = valueMin;
@@ -1,6 +1,15 @@
1
1
  import { getErrorMessage } from '../Helpers/Helpers.svelte.js';
2
2
  import { Validity } from '../Types/Internal/Validity.js';
3
3
  let idIncrement = 0;
4
+ function isWrappedResponse(message) {
5
+ return (message != null &&
6
+ typeof message == 'object' &&
7
+ 'payload' in message &&
8
+ message.payload != null &&
9
+ typeof message.payload == 'object' &&
10
+ 'data' in message.payload &&
11
+ typeof message.payload.data == 'string');
12
+ }
4
13
  export class ToastContext {
5
14
  static identifier = Symbol();
6
15
  _toasts = $state([]);
@@ -27,7 +36,7 @@ export class ToastContext {
27
36
  id,
28
37
  close: () => {
29
38
  this.dismiss(id);
30
- }
39
+ },
31
40
  };
32
41
  }
33
42
  if (typeof message === 'string') {
@@ -39,7 +48,7 @@ export class ToastContext {
39
48
  id,
40
49
  close: () => {
41
50
  this.dismiss(id);
42
- }
51
+ },
43
52
  };
44
53
  }
45
54
  if (typeof message == 'object') {
@@ -51,7 +60,7 @@ export class ToastContext {
51
60
  message: getErrorMessage(message, {
52
61
  includeUUID: false,
53
62
  includeCause: false,
54
- includeStack: false
63
+ includeStack: false,
55
64
  }),
56
65
  id,
57
66
  close: () => {
@@ -60,8 +69,8 @@ export class ToastContext {
60
69
  getVerbose: () => getErrorMessage(message, {
61
70
  includeUUID: true,
62
71
  includeCause: true,
63
- includeStack: true
64
- })
72
+ includeStack: true,
73
+ }),
65
74
  };
66
75
  }
67
76
  if (isToastMessage(message)) {
@@ -74,10 +83,22 @@ export class ToastContext {
74
83
  if (message.closeable ?? true) {
75
84
  this.dismiss(id);
76
85
  }
77
- }
86
+ },
78
87
  };
79
88
  }
80
89
  }
90
+ if (isWrappedResponse(message)) {
91
+ return {
92
+ result: Validity.Info,
93
+ closeable,
94
+ timeout,
95
+ message: message.payload.data,
96
+ id,
97
+ close: () => {
98
+ this.dismiss(id);
99
+ },
100
+ };
101
+ }
81
102
  return {
82
103
  result: Validity.Invalid,
83
104
  closeable,
@@ -87,7 +108,7 @@ export class ToastContext {
87
108
  close: () => {
88
109
  this.dismiss(id);
89
110
  },
90
- getVerbose: () => getErrorMessage(message)
111
+ getVerbose: () => getErrorMessage(message),
91
112
  };
92
113
  })();
93
114
  this.toasts.push(newMessage);
@@ -49,6 +49,6 @@ export declare function asyncFilter<T>(array: Array<T>, asyncCallback: (item: T,
49
49
  export declare function devCatch(e: unknown): void;
50
50
  export declare function hasQuery<FilterValueType>(customFilter: CustomFilter<FilterValueType> | undefined): customFilter is CustomFilter<FilterValueType> & Required<Pick<CustomFilter<FilterValueType>, 'query'>>;
51
51
  export declare function isDateTuple(value: unknown): value is [Date | null, Date | null];
52
- export declare function isNumberTuple(value: unknown): value is [number | null, number | null];
52
+ export declare function isNumericArray(value: unknown): value is Array<number | null>;
53
53
  export declare function isValidityTuple(v: Validity | ValidityWrapper | undefined): v is ValidityWrapper;
54
54
  export declare const loadingText = "loading\u2026";
@@ -259,11 +259,8 @@ export function isDateTuple(value) {
259
259
  (value[0] === null || (typeof value[0] == 'object' && value[0] instanceof Date)) &&
260
260
  (value[1] === null || (typeof value[1] == 'object' && value[1] instanceof Date)));
261
261
  }
262
- export function isNumberTuple(value) {
263
- return (Array.isArray(value) &&
264
- value.length < 3 &&
265
- (value[0] === null || typeof value[0] == 'number') &&
266
- (value[1] === null || typeof value[1] == 'number'));
262
+ export function isNumericArray(value) {
263
+ return Array.isArray(value) && (value[0] === null || typeof value[0] == 'number');
267
264
  }
268
265
  export function isValidityTuple(v) {
269
266
  return v != null && typeof v == 'object';
package/dist/index.d.ts CHANGED
@@ -132,7 +132,7 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
132
132
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
133
133
  export { Delay } from './Delay/Delay.js';
134
134
  export { DATAMatrix } from './Helpers/Datamatrix.js';
135
- export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, devCatch, generateShortUUID, generateUUID, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumberTuple, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
135
+ export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, devCatch, generateShortUUID, generateUUID, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
136
136
  export { type INamed } from './Helpers/INamed.js';
137
137
  export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
138
138
  export { type BigRadioOption } from './Types/Internal/BigRadioOption.js';
package/dist/index.js CHANGED
@@ -132,7 +132,7 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
132
132
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
133
133
  export { Delay } from './Delay/Delay.js';
134
134
  export { DATAMatrix } from './Helpers/Datamatrix.js';
135
- export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, devCatch, generateShortUUID, generateUUID, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumberTuple, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
135
+ export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, devCatch, generateShortUUID, generateUUID, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
136
136
  export {} from './Helpers/INamed.js';
137
137
  export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
138
138
  export {} from './Types/Internal/BigRadioOption.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.19.5",
4
+ "version": "0.20.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -33,41 +33,41 @@
33
33
  "@eslint/compat": "^2.0.3",
34
34
  "@eslint/js": "^10.0.1",
35
35
  "@playwright/test": "^1.58.2",
36
- "@storybook/addon-a11y": "^10.2.16",
37
- "@storybook/addon-docs": "^10.2.16",
36
+ "@storybook/addon-a11y": "^10.2.17",
37
+ "@storybook/addon-docs": "^10.2.17",
38
38
  "@storybook/addon-svelte-csf": "^5.0.11",
39
- "@storybook/addon-vitest": "^10.2.16",
40
- "@storybook/sveltekit": "^10.2.16",
39
+ "@storybook/addon-vitest": "^10.2.17",
40
+ "@storybook/sveltekit": "^10.2.17",
41
41
  "@sveltejs/adapter-node": "^5.5.4",
42
- "@sveltejs/kit": "^2.53.4",
42
+ "@sveltejs/kit": "^2.54.0",
43
43
  "@sveltejs/package": "^2.5.7",
44
44
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
45
45
  "@types/eslint": "^9.6.1",
46
- "@types/node": "^25.3.5",
47
- "@typescript-eslint/eslint-plugin": "^8.56.1",
48
- "@typescript-eslint/parser": "^8.56.1",
49
- "@vitest/browser": "^4.0.18",
50
- "@vitest/browser-playwright": "^4.0.18",
46
+ "@types/node": "^25.4.0",
47
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
48
+ "@typescript-eslint/parser": "^8.57.0",
49
+ "@vitest/browser": "^4.1.0",
50
+ "@vitest/browser-playwright": "^4.1.0",
51
51
  "eslint": "^10.0.3",
52
52
  "eslint-config-prettier": "^10.1.8",
53
- "eslint-plugin-storybook": "^10.2.16",
54
- "eslint-plugin-svelte": "^3.15.1",
53
+ "eslint-plugin-storybook": "^10.2.17",
54
+ "eslint-plugin-svelte": "^3.15.2",
55
55
  "globals": "^17.4.0",
56
56
  "mdsvex": "^0.12.7",
57
57
  "playwright": "^1.58.2",
58
58
  "prettier": "^3.8.1",
59
59
  "prettier-plugin-svelte": "^3.5.1",
60
60
  "publint": "^0.3.18",
61
- "sass-embedded": "^1.97.3",
62
- "storybook": "^10.2.16",
63
- "svelte": "^5.53.8",
61
+ "sass-embedded": "^1.98.0",
62
+ "storybook": "^10.2.17",
63
+ "svelte": "^5.53.11",
64
64
  "svelte-check": "^4.4.5",
65
65
  "svelte-render-scan": "^1.1.0",
66
66
  "typescript": "^5.9.3",
67
- "typescript-eslint": "^8.56.1",
67
+ "typescript-eslint": "^8.57.0",
68
68
  "vite": "^7.3.1",
69
69
  "vite-plugin-devtools-json": "^1.0.0",
70
- "vitest": "^4.0.18",
70
+ "vitest": "^4.1.0",
71
71
  "vitest-browser-svelte": "^2.0.2"
72
72
  },
73
73
  "keywords": [