@lavalogic/scoria 0.4.5 → 0.5.1

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.
@@ -79,7 +79,6 @@
79
79
  {:then value}
80
80
  {@render ValueFallback(value)}
81
81
  {:catch e}
82
- {@debug e}
83
82
  <FocusableImmutableCell value={e?.toString()} {cell} />
84
83
  {/await}
85
84
  {/if}
@@ -146,9 +146,16 @@
146
146
  if (isRemoteSelect && !tableContext.paginationRepo?.filtering) {
147
147
  return;
148
148
  }
149
+ if (def.debug) {
150
+ console.log('filtering state value:', $state.snapshot(filteringStateValue));
151
+ }
149
152
  void filteringStateValue;
150
153
 
151
154
  if (hasQuery) {
155
+ if (def.debug) {
156
+ console.log('has query');
157
+ }
158
+
152
159
  untrack(async () => {
153
160
  try {
154
161
  // as unknown as string | number | undefined;
@@ -157,7 +164,16 @@
157
164
  const x = tableContext.__queryValues.get(
158
165
  customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey ?? _uuid
159
166
  );
167
+
168
+ if (def.debug) {
169
+ console.log('value:', $state.snapshot(x));
170
+ }
160
171
  value = (x ?? null) as SelectOption<unknown> | null;
172
+ } else if (def.debug) {
173
+ console.log(
174
+ 'filtering state value was undefined',
175
+ $state.snapshot(tableContext.paginationRepo?.filtering)
176
+ );
161
177
  }
162
178
  } catch (e) {
163
179
  console.warn(e);
@@ -165,9 +181,16 @@
165
181
  }
166
182
  });
167
183
  } else if (isSelect) {
184
+ if (def.debug) {
185
+ console.log('is select (not query)');
186
+ }
168
187
  untrack(async () => {
169
188
  try {
170
- const x = (await options).filter((it) => {
189
+ const opts = await options;
190
+ if (def.debug) {
191
+ console.log('possible options:', $state.snapshot(options));
192
+ }
193
+ const x = opts.filter((it) => {
171
194
  if (it.value != null && (typeof it.value == 'string' || typeof it.value == 'number')) {
172
195
  return (
173
196
  filteringStateValue as unknown as Array<string | number> | undefined
@@ -175,6 +198,9 @@
175
198
  }
176
199
  return false;
177
200
  });
201
+ if (def.debug) {
202
+ console.log('selected options:', x);
203
+ }
178
204
  selectedOptions = x;
179
205
  } catch (e) {
180
206
  console.warn(e);
@@ -211,7 +237,7 @@
211
237
  ) {
212
238
  value = filteringStateValue;
213
239
  } else {
214
- console.log('unknown value type:', filteringStateValue);
240
+ console.warn('unknown value type:', $state.snapshot(filteringStateValue));
215
241
  value = filteringStateValue as string; // HACK attempt to keep production running
216
242
  }
217
243
  }
@@ -354,7 +380,7 @@
354
380
  <!-- TODO: multiselect -->
355
381
 
356
382
  <QuerySelect
357
- valueAsObject
383
+ valueAsObject={customFilter!.valueAsObject ?? true}
358
384
  {label}
359
385
  clearable
360
386
  name={customFilter?.objectName ?? 'Item'}
@@ -366,7 +392,8 @@
366
392
  onchange={(newValue) => {
367
393
  tableContext.paginationRepo?.filterBy(def.id, newValue?.value ?? null);
368
394
  tableContext.__queryValues.set(label ?? _uuid, newValue);
369
- value = newValue as SelectOption<unknown> | null;
395
+ // FIXME <T> is lost when autoformatting. why?
396
+ value = newValue as SelectOption | null;
370
397
  }}
371
398
  />
372
399
  {:else}
@@ -9,6 +9,7 @@ import type { FilterValueType } from '../../Filtering/FilterValueType.js';
9
9
  export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
10
10
  id: string;
11
11
  header: string | Snippet;
12
+ debug?: boolean;
12
13
  index?: number;
13
14
  allowFiltering?: boolean;
14
15
  allowSorting?: boolean;
@@ -26,6 +27,7 @@ export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
26
27
  export declare abstract class ColumnDef<T extends object, FilterFnType = undefined> {
27
28
  protected constructor(props: ColumnDefProps<T, FilterFnType>);
28
29
  readonly id: string;
30
+ debug: boolean;
29
31
  private _index;
30
32
  get index(): number;
31
33
  set index(v: number);
@@ -15,8 +15,10 @@ export class ColumnDef {
15
15
  this.header = $derived(props.header);
16
16
  this._filterValueType = $derived(props.filterValueType);
17
17
  this._getDisplayValue = $derived(props.getDisplayValue);
18
+ this.debug = $derived(props.debug ?? false);
18
19
  }
19
20
  id;
21
+ debug;
20
22
  _index;
21
23
  get index() {
22
24
  return this._index;
@@ -1,2 +1,3 @@
1
+ import type { SvelteMap } from 'svelte/reactivity';
1
2
  import type { CustomFilter } from './CustomFilter.js';
2
- export type CustomRemoteFilters = Map<string, CustomFilter>;
3
+ export type CustomRemoteFilters = SvelteMap<string, CustomFilter>;
@@ -153,8 +153,7 @@ export function gridItem(element) {
153
153
  return;
154
154
  }
155
155
  let height = $state(0);
156
- let spanHeight = $derived.by(() => {
157
- element.classList.values().filter((it) => it.startsWith('col-'));
156
+ const spanHeight = $derived.by(() => {
158
157
  return Math.ceil((height + Sizing['$regular-gap']) / 4);
159
158
  });
160
159
  $effect(() => {
package/dist/index.d.ts CHANGED
@@ -123,7 +123,7 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
123
123
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
124
124
  export { Delay } from './Delay/Delay.js';
125
125
  export { DATAMatrix } from './Helpers/Datamatrix.js';
126
- export { autoPluralise, generateUUID, generateShortUUID, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, passthrough, getCanvasContext, getErrorMessage, isValidEmailAddress, localTimeFormat, vowels } from './Helpers/Helpers.svelte.js';
126
+ export { gridItem, autoPluralise, generateUUID, generateShortUUID, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, passthrough, getCanvasContext, getErrorMessage, isValidEmailAddress, localTimeFormat, vowels } from './Helpers/Helpers.svelte.js';
127
127
  export { type INamed } from './Helpers/INamed.js';
128
128
  export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
129
129
  export { type BigRadioOption } from './Types/Internal/BigRadioOption.js';
@@ -153,5 +153,6 @@ export { Validity } from './Types/Internal/Validity.js';
153
153
  export { type ValidityWrapper } from './Types/Internal/ValidityWrapper.js';
154
154
  export { Variant } from './Types/Internal/Variant.js';
155
155
  export { Colour, ColourSet } from './scss/colours.js';
156
+ export { Sizing } from './scss/sizing.js';
156
157
  export { FilterValueType } from './Components/Table/Types/Filtering/FilterValueType.js';
157
158
  export { default as Pagination, type PaginationProps } from './Components/Base/Pagination.svelte';
package/dist/index.js CHANGED
@@ -130,7 +130,7 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
130
130
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
131
131
  export { Delay } from './Delay/Delay.js';
132
132
  export { DATAMatrix } from './Helpers/Datamatrix.js';
133
- export { autoPluralise, generateUUID, generateShortUUID, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, passthrough, getCanvasContext, getErrorMessage, isValidEmailAddress, localTimeFormat, vowels } from './Helpers/Helpers.svelte.js';
133
+ export { gridItem, autoPluralise, generateUUID, generateShortUUID, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, passthrough, getCanvasContext, getErrorMessage, isValidEmailAddress, localTimeFormat, vowels } from './Helpers/Helpers.svelte.js';
134
134
  export {} from './Helpers/INamed.js';
135
135
  export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
136
136
  export {} from './Types/Internal/BigRadioOption.js';
@@ -158,5 +158,6 @@ export { Validity } from './Types/Internal/Validity.js';
158
158
  export {} from './Types/Internal/ValidityWrapper.js';
159
159
  export { Variant } from './Types/Internal/Variant.js';
160
160
  export { Colour, ColourSet } from './scss/colours.js';
161
+ export { Sizing } from './scss/sizing.js';
161
162
  export { FilterValueType } from './Components/Table/Types/Filtering/FilterValueType.js';
162
163
  export { default as Pagination } from './Components/Base/Pagination.svelte';
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.4.5",
4
+ "version": "0.5.1",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -33,38 +33,38 @@
33
33
  "@eslint/compat": "^2.0.0",
34
34
  "@eslint/js": "^9.39.1",
35
35
  "@playwright/test": "^1.57.0",
36
- "@storybook/addon-a11y": "^10.1.4",
37
- "@storybook/addon-docs": "^10.1.4",
36
+ "@storybook/addon-a11y": "^10.1.7",
37
+ "@storybook/addon-docs": "^10.1.7",
38
38
  "@storybook/addon-svelte-csf": "^5.0.10",
39
- "@storybook/addon-vitest": "^10.1.4",
40
- "@storybook/sveltekit": "^10.1.4",
39
+ "@storybook/addon-vitest": "^10.1.7",
40
+ "@storybook/sveltekit": "^10.1.7",
41
41
  "@sveltejs/adapter-node": "^5.4.0",
42
- "@sveltejs/kit": "^2.49.1",
42
+ "@sveltejs/kit": "^2.49.2",
43
43
  "@sveltejs/package": "^2.5.7",
44
44
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
45
45
  "@types/eslint": "^9.6.1",
46
- "@types/node": "^24.10.1",
47
- "@typescript-eslint/eslint-plugin": "^8.48.1",
48
- "@typescript-eslint/parser": "^8.48.1",
46
+ "@types/node": "^24.10.3",
47
+ "@typescript-eslint/eslint-plugin": "^8.49.0",
48
+ "@typescript-eslint/parser": "^8.49.0",
49
49
  "@vitest/browser": "^4.0.15",
50
50
  "eslint": "^9.39.1",
51
51
  "eslint-config-prettier": "^10.1.8",
52
52
  "eslint-plugin-storybook": "10.1.4",
53
- "eslint-plugin-svelte": "^3.13.0",
53
+ "eslint-plugin-svelte": "^3.13.1",
54
54
  "globals": "^16.5.0",
55
55
  "mdsvex": "^0.12.6",
56
56
  "playwright": "^1.57.0",
57
57
  "prettier": "^3.7.4",
58
58
  "prettier-plugin-svelte": "^3.4.0",
59
- "publint": "^0.3.15",
60
- "sass-embedded": "^1.93.3",
61
- "storybook": "^10.1.4",
62
- "svelte": "^5.45.5",
59
+ "publint": "^0.3.16",
60
+ "sass-embedded": "^1.96.0",
61
+ "storybook": "^10.1.7",
62
+ "svelte": "^5.45.10",
63
63
  "svelte-check": "^4.3.4",
64
64
  "svelte-render-scan": "^1.1.0",
65
65
  "typescript": "^5.9.3",
66
- "typescript-eslint": "^8.48.1",
67
- "vite": "^7.2.6",
66
+ "typescript-eslint": "^8.49.0",
67
+ "vite": "^7.2.7",
68
68
  "vite-plugin-devtools-json": "^1.0.0",
69
69
  "vitest": "^4.0.15",
70
70
  "vitest-browser-svelte": "^2.0.1"