@lavalogic/scoria 0.21.5 → 0.22.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.
@@ -34,11 +34,10 @@
34
34
  oninput,
35
35
 
36
36
  inputRef = $bindable(),
37
- 'data-type': dataType
37
+ 'data-type': dataType,
38
38
  }: DimensionInputProps = $props();
39
39
 
40
- // HACK unable to edit signature
41
- /* eslint-disable @typescript-eslint/no-unused-vars */
40
+ // NOTE unable to edit signature
42
41
  function xNumberValidator(_node: HTMLInputElement, _newValue: number | null | undefined) {
43
42
  // function xNumberValidator() {
44
43
  return {
@@ -49,7 +48,7 @@
49
48
  x = (
50
49
  isNaN(newValue) ? 0 : underMinimum ? min : overMaximum ? max : newValue
51
50
  ) as Centimetres;
52
- }
51
+ },
53
52
  };
54
53
  }
55
54
  function yNumberValidator(_node: HTMLInputElement, _newValue: number | null | undefined) {
@@ -61,7 +60,7 @@
61
60
  y = (
62
61
  isNaN(newValue) ? 0 : underMinimum ? min : overMaximum ? max : newValue
63
62
  ) as Centimetres;
64
- }
63
+ },
65
64
  };
66
65
  }
67
66
 
@@ -75,10 +74,9 @@
75
74
  z = (
76
75
  isNaN(newValue) ? 0 : underMinimum ? min : overMaximum ? max : newValue
77
76
  ) as Centimetres;
78
- }
77
+ },
79
78
  };
80
79
  }
81
- /* eslint-enable @typescript-eslint/no-unused-vars */
82
80
  // ^
83
81
 
84
82
  let isInvalid = $derived(
@@ -108,7 +106,10 @@
108
106
  <span class="border">Dimensions - <span class="optional">optional</span></span>
109
107
  {/if}
110
108
  <!-- style="--background-colour: {leftIcon?.backgroundColour ?? rightIcon?.backgroundColour};" -->
111
- <div class="icon-container" class:for-modal={variant == InputVariant.Modal}>
109
+ <div
110
+ class="icon-container"
111
+ class:for-modal={variant == InputVariant.Modal}
112
+ >
112
113
  <input
113
114
  {id}
114
115
  class:for-default={variant === InputVariant.Default}
@@ -173,7 +174,10 @@
173
174
  step={decimal ? 0.01 : 1}
174
175
  />
175
176
  <div class="spacer"></div>
176
- <span class="right-label inset" class:for-modal={variant == InputVariant.Modal}>cm</span>
177
+ <span
178
+ class="right-label inset"
179
+ class:for-modal={variant == InputVariant.Modal}>cm</span
180
+ >
177
181
  </div>
178
182
  </div>
179
183
 
@@ -1,19 +1,26 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script lang="ts" generics="CommonDenominator">
3
+ <script
4
+ lang="ts"
5
+ generics="CommonDenominator"
6
+ >
4
7
  import HorizontalTabGroupButton from './HorizontalTabGroupButton.svelte';
5
8
  import type { HorizontalTabGroupProps } from './HorizontalTabGroupProps.js';
6
9
  let {
7
- name: _name,
10
+ // name: _name, //FIXME why is this not implemented?
8
11
  tabComponent,
9
12
  options,
10
13
  selected,
11
14
  noRadius = false,
12
- grow = false
15
+ grow = false,
13
16
  }: HorizontalTabGroupProps<CommonDenominator> = $props();
14
17
  </script>
15
18
 
16
- <div class="wrapper" class:no-radius={noRadius} class:grow>
19
+ <div
20
+ class="wrapper"
21
+ class:no-radius={noRadius}
22
+ class:grow
23
+ >
17
24
  <div class="tabs">
18
25
  {#if tabComponent}
19
26
  {#each options as option (option)}
@@ -21,7 +28,10 @@
21
28
  {/each}
22
29
  {:else}
23
30
  {#each options as option (option)}
24
- <HorizontalTabGroupButton {option} selected={selected === option} />
31
+ <HorizontalTabGroupButton
32
+ {option}
33
+ selected={selected === option}
34
+ />
25
35
  {/each}
26
36
  {/if}
27
37
  </div>
@@ -22,7 +22,7 @@ export function generateExampleItemColumnDefs(modal) {
22
22
  if (!$effect.tracking()) {
23
23
  throw new Error(`NOT in tracking context`);
24
24
  }
25
- return isSelected.then((isSelected) => {
25
+ const compareValidity = (isSelected) => {
26
26
  if (isSelected) {
27
27
  if (!item.name.trim()) {
28
28
  return { value: Validity.Invalid, reason: 'Missing name' };
@@ -36,7 +36,10 @@ export function generateExampleItemColumnDefs(modal) {
36
36
  };
37
37
  }
38
38
  return { value: Validity.Neutral, reason: 'row not selected' };
39
- });
39
+ };
40
+ return isSelected instanceof Promise
41
+ ? isSelected.then(compareValidity)
42
+ : compareValidity(isSelected);
40
43
  };
41
44
  const expandDef = $state(new ExpandDef({
42
45
  accessorFn: (it) => [it],
@@ -1,3 +1,3 @@
1
1
  import type { Validity } from '../../../../../Types/Internal/Validity.js';
2
2
  import type { ValidityWrapper } from '../../../../../Types/Internal/ValidityWrapper.js';
3
- export type ValidationFn<T> = (item: T, isSelected: Promise<boolean>) => Validity | Promise<Validity | ValidityWrapper> | ValidityWrapper;
3
+ export type ValidationFn<T> = (item: T, isSelected: boolean | Promise<boolean>) => Validity | Promise<Validity | ValidityWrapper> | ValidityWrapper;
@@ -161,7 +161,7 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
161
161
  private _flushScheduled;
162
162
  private _flushPendingSelectionChanges;
163
163
  private _schedulePendingFlush;
164
- readonly selectionContains: (item: T) => Promise<boolean>;
164
+ readonly selectionContains: (item: T) => boolean | Promise<boolean>;
165
165
  readonly addInvalidValue: (item: T) => void | Promise<void>;
166
166
  readonly removeInvalidValue: (item: T) => void | Promise<void>;
167
167
  readonly setOpenModalCoordinates: (coordinates: CellCoordinatesWithoutColumn | null) => void;
@@ -1054,7 +1054,7 @@ export class TableContext {
1054
1054
  })
1055
1055
  .catch(devCatch);
1056
1056
  }
1057
- selectionContains = async (item) => {
1057
+ selectionContains = (item) => {
1058
1058
  void item;
1059
1059
  void this.isSelectable;
1060
1060
  void this.selectedItems.size;
@@ -1065,9 +1065,9 @@ export class TableContext {
1065
1065
  return true;
1066
1066
  }
1067
1067
  const rawIdentity = this._cachedKey(item);
1068
- const identity = rawIdentity instanceof Promise ? await rawIdentity : rawIdentity;
1069
- const has = this.selectedItems.has(identity);
1070
- return has;
1068
+ return rawIdentity instanceof Promise
1069
+ ? rawIdentity.then((identity) => this.selectedItems.has(identity))
1070
+ : this.selectedItems.has(rawIdentity);
1071
1071
  };
1072
1072
  addInvalidValue = (item) => {
1073
1073
  const raw = this._cachedKey(item);
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.21.5",
4
+ "version": "0.22.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },