@lavalogic/scoria 0.19.4 → 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.
@@ -1,6 +1,9 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script module lang="ts">
3
+ <script
4
+ module
5
+ lang="ts"
6
+ >
4
7
  import { DATAMatrix } from '../Helpers/Datamatrix.js';
5
8
  import { devCatch, passthrough } from '../Helpers/Helpers.svelte.js';
6
9
  import { ColourSet } from '../scss/colours.js';
@@ -57,7 +60,7 @@
57
60
  explanation,
58
61
  children,
59
62
  footer,
60
- onclose
63
+ onclose,
61
64
  }: ModalProps = $props();
62
65
 
63
66
  let dialog: HTMLDialogElement | undefined;
@@ -160,7 +163,7 @@
160
163
  size={Size.DoubleXLarge}
161
164
  onclick={() => dialog?.close()}
162
165
  icon={{
163
- name: 'cross'
166
+ name: 'cross',
164
167
  }}
165
168
  onkeydown={handleEsc}
166
169
  colourSet={ColourSet.Primary}
@@ -181,11 +184,17 @@
181
184
  {#if defaultTimer}
182
185
  <!-- class:paused -->
183
186
  <div class="bar-container">
184
- <div class:paused class="bar-timer"></div>
187
+ <div
188
+ class:paused
189
+ class="bar-timer"
190
+ ></div>
185
191
  </div>
186
192
  {/if}
187
193
 
188
- <div class="modal-main" class:noscroll>
194
+ <div
195
+ class="modal-main"
196
+ class:noscroll
197
+ >
189
198
  {#if explanation}
190
199
  {@render explanation()}
191
200
  {/if}
@@ -201,7 +210,10 @@
201
210
  <div class="button-barcode-set">
202
211
  {#if button.barcodeValue}
203
212
  {@const icon = DATAMatrix(button.barcodeValue)}
204
- <DataMatrixIcon title={button.label} {icon} />
213
+ <DataMatrixIcon
214
+ title={button.label}
215
+ {icon}
216
+ />
205
217
  {/if}
206
218
  <button
207
219
  onkeydown={passthrough}
@@ -215,7 +227,10 @@
215
227
  <div class="button-barcode-set">
216
228
  {#if button.barcodeValue}
217
229
  {@const icon = DATAMatrix(button.barcodeValue)}
218
- <DataMatrixIcon title={button.label} {icon} />
230
+ <DataMatrixIcon
231
+ title={button.label}
232
+ {icon}
233
+ />
219
234
  {/if}
220
235
  <button
221
236
  onkeydown={passthrough}
@@ -486,6 +501,7 @@ form.modal-root {
486
501
  overflow: visible;
487
502
  }
488
503
 
504
+ .modal-main.noscroll,
489
505
  .noscroll {
490
506
  overflow: visible;
491
507
  }
@@ -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, 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, 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.4",
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": [