@hkdigital/lib-sveltekit 0.1.94 → 0.1.96

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,3 +1,4 @@
1
+ /** @typedef {import('../../../typedef/image.js').ImageMeta} ImageMeta */
1
2
  export default class ImageVariantsLoader {
2
3
  /**
3
4
  * @param {ImageMeta[]} imagesMeta
@@ -19,7 +20,7 @@ export default class ImageVariantsLoader {
19
20
  fit?: "cover" | "contain" | "fill";
20
21
  }): void;
21
22
  get loaded(): boolean;
22
- get variant(): import("./typedef.js").ImageMeta;
23
+ get variant(): import("../../../typedef/image.js").ImageMeta;
23
24
  /**
24
25
  * Get object URL that can be used as src parameter of an HTML image
25
26
  *
@@ -39,4 +40,4 @@ export default class ImageVariantsLoader {
39
40
  getOptimalImageMeta(containerWidth: number): ImageMeta | null;
40
41
  #private;
41
42
  }
42
- export type ImageMeta = import("./typedef.js").ImageMeta;
43
+ export type ImageMeta = import("../../../typedef/image.js").ImageMeta;
@@ -1,13 +1,9 @@
1
- /** @typedef {import('./typedef.js').ImageMeta} ImageMeta */
2
-
3
- // import * as expect from '../../../util/expect/index.js';
4
-
5
1
  import { calculateEffectiveWidth } from '../../../util/image/index.js';
6
2
 
7
- import { untrack } from 'svelte';
8
-
9
3
  import ImageLoader from './ImageLoader.svelte.js';
10
4
 
5
+ /** @typedef {import('../../../typedef/image.js').ImageMeta} ImageMeta */
6
+
11
7
  export default class ImageVariantsLoader {
12
8
  /** @type {number} */
13
9
  #devicePixelRatio;
@@ -37,6 +33,7 @@ export default class ImageVariantsLoader {
37
33
  constructor(imagesMeta, { devicePixelRatio = 1 } = {}) {
38
34
  this.#devicePixelRatio = devicePixelRatio ?? 1;
39
35
  this.#imagesMeta = [...imagesMeta].sort((a, b) => a.width - b.width);
36
+ // console.debug("imagesMeta",imagesMeta);
40
37
  }
41
38
 
42
39
  /**
@@ -60,6 +57,8 @@ export default class ImageVariantsLoader {
60
57
 
61
58
  const newVariant = this.getOptimalImageMeta(effectiveWidth);
62
59
 
60
+ // console.debug("updateOptimalImageMeta", effectiveWidth, newVariant );
61
+
63
62
  if (
64
63
  !newVariant ||
65
64
  !this.#imageVariant ||
@@ -76,6 +75,7 @@ export default class ImageVariantsLoader {
76
75
  imageMeta: newVariant
77
76
  });
78
77
 
78
+
79
79
  this.#imageLoader.load();
80
80
  }
81
81
  }
@@ -87,6 +87,7 @@ export default class NetworkLoader {
87
87
  this._url = url;
88
88
 
89
89
  const state = this._state;
90
+ const progress = this.progress;
90
91
 
91
92
  //
92
93
  // ISSUE: $effect is not triggered by this._state changes,
@@ -110,10 +111,15 @@ export default class NetworkLoader {
110
111
 
111
112
  case STATE_LOADED:
112
113
  {
113
- // console.error(
114
- // 'NetworkLoader:loaded',
115
- // $state.snapshot({ bytes: this.size })
116
- // );
114
+ // console.debug('NetworkLoader:loaded', $state.snapshot(state));
115
+
116
+ // setTimeout(() => {
117
+ // console.debug(
118
+ // 'NetworkLoader:loaded',
119
+ // $state.snapshot(state),
120
+ // progress
121
+ // );
122
+ // }, 500);
117
123
 
118
124
  // Abort function is no longer needed
119
125
  this._abortLoading = null;
@@ -140,7 +146,7 @@ export default class NetworkLoader {
140
146
  * Start loading all network data
141
147
  */
142
148
  load() {
143
- // console.log('NetworkLoader: load() called');
149
+ // console.debug('NetworkLoader: load() called');
144
150
  this._state.send(LOAD);
145
151
  }
146
152
 
@@ -301,6 +307,8 @@ export default class NetworkLoader {
301
307
 
302
308
  this._buffer = await bufferPromise;
303
309
 
310
+ // console.debug('#load', this._buffer, this._bytesLoaded);
311
+
304
312
  this._state.send(LOADED);
305
313
  } catch (e) {
306
314
  this._state.send(ERROR, e);
@@ -211,13 +211,13 @@
211
211
  >
212
212
  <GridLayers heightFrom={heightMode === 'flexible' ? 'content' : null}>
213
213
  {#if children}
214
- <div
214
+ <!-- <div
215
215
  data-layer="content"
216
216
  class:relative={heightMode === 'flexible'}
217
217
  class:w-full={heightMode === 'flexible'}
218
- >
218
+ > -->
219
219
  {@render children()}
220
- </div>
220
+ <!-- </div> -->
221
221
  {/if}
222
222
 
223
223
  {#if showPreview && dropPreviewSnippet}
@@ -231,9 +231,11 @@
231
231
  <style>
232
232
  [data-component="drop-zone"] {
233
233
  -webkit-tap-highlight-color: transparent;
234
+
235
+
234
236
  }
235
237
 
236
- [data-layer='content']:not(.relative) {
238
+ /* [data-layer='content']:not(.relative) {
237
239
  position: absolute;
238
240
  left: 0;
239
241
  right: 0;
@@ -245,7 +247,7 @@
245
247
  position: relative;
246
248
  width: 100%;
247
249
  }
248
-
250
+ */
249
251
  [data-layer='preview'] {
250
252
  position: absolute;
251
253
  left: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.94",
3
+ "version": "0.1.96",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -105,7 +105,7 @@
105
105
  "tailwindcss": "^3.4.17",
106
106
  "typescript": "^5.8.2",
107
107
  "vite": "^6.2.0",
108
- "vite-imagetools": "^7.0.5",
108
+ "vite-imagetools": "^7.1.0",
109
109
  "vitest": "^3.0.7",
110
110
  "zod": "^3.24.2"
111
111
  }