@lavalogic/scoria 0.0.20 → 0.0.22

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,6 +13,7 @@ import { CheckboxDef } from '../Columns/Definitions/Accessors/CheckboxDef.svelte
13
13
  import { DateInputDef } from '../Columns/Definitions/Accessors/DateInputDef.svelte.js';
14
14
  import { ProgressBarDef } from '../Columns/Definitions/Display/ProgressBarDef.svelte.js';
15
15
  import { DisplayDef } from '../Columns/Definitions/Display/DisplayDef.svelte.js';
16
+ import { browser } from '$app/environment';
16
17
  const SORTING_ICON_WIDTH = 24;
17
18
  const InternalSymbol = Symbol();
18
19
  export class TableContext {
@@ -63,10 +64,10 @@ export class TableContext {
63
64
  // this.tableOptions.manualSorting = dataRepo.manualSorting;
64
65
  }
65
66
  this.userId = $derived(getUserId());
66
- if (localStorage) {
67
+ if (browser) {
67
68
  this._getUserDefaults();
68
69
  const removeInvalidPresets = () => {
69
- console.warn('invalid presets');
70
+ console.warn('invalid presets. removing:', localStorage.getItem(`${this.userId}-${tableName}-presets`));
70
71
  localStorage.removeItem(`${this.userId}-${tableName}-presets`);
71
72
  localStorage.removeItem(`${this.userId}-${tableName}-selected-preset-name`);
72
73
  const visibilityState = {};
@@ -97,9 +98,13 @@ export class TableContext {
97
98
  }
98
99
  }
99
100
  }
100
- throw new Error('Invalid Presets');
101
+ return null;
101
102
  })
102
103
  .then((presets) => {
104
+ if (presets == null) {
105
+ removeInvalidPresets();
106
+ return;
107
+ }
103
108
  const savedPresetName = localStorage.getItem(`${this.userId}-${tableName}-selected-preset-name`);
104
109
  if (savedPresetName) {
105
110
  const preset = presets.find((it) => it.name === savedPresetName);
@@ -121,11 +126,7 @@ export class TableContext {
121
126
  }
122
127
  }
123
128
  this.columnPresets = presets;
124
- return;
125
129
  }
126
- })
127
- .catch(() => {
128
- removeInvalidPresets();
129
130
  });
130
131
  }
131
132
  }
@@ -1,4 +1,5 @@
1
1
  import { SvelteMap } from 'svelte/reactivity';
2
+ import { browser } from '$app/environment';
2
3
  export class TableDataRepository {
3
4
  tableName;
4
5
  getUserId;
@@ -16,7 +17,7 @@ export class TableDataRepository {
16
17
  set paginationState(v) {
17
18
  this._previouslyViewedPage = this._paginationState?.pageIndex;
18
19
  this._paginationState = v;
19
- if (localStorage) {
20
+ if (browser) {
20
21
  localStorage.setItem(`${this.getUserId()}-${this.tableName}-page-size`, v.pageSize.toString());
21
22
  }
22
23
  }
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.0.20",
4
+ "version": "0.0.22",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -23,6 +23,7 @@
23
23
  }
24
24
  },
25
25
  "peerDependencies": {
26
+ "@sveltejs/kit": "^2.0.0",
26
27
  "svelte": "^5.0.0"
27
28
  },
28
29
  "devDependencies": {