accomadesc 0.4.28 → 0.4.30

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.
@@ -3,9 +3,10 @@
3
3
  import PhotoComponent from './Photo.svelte';
4
4
  import type { I18nFacade, Photo, PhotoGalleryContent } from './types.js';
5
5
  import { browser } from '$app/environment';
6
+ import { untrack } from 'svelte';
6
7
  import { slide } from 'svelte/transition';
7
8
 
8
- let { photos, gridPhotoWidth = 300, translateFunc }: PhotoGalleryContent & I18nFacade = $props();
9
+ let { photos, gridPhotoWidth = 300, minimizedAtLoad = true, translateFunc }: PhotoGalleryContent & I18nFacade = $props();
9
10
 
10
11
  let landscape = $state(true);
11
12
  if (browser) {
@@ -22,7 +23,8 @@
22
23
  Math.floor(width / (gridPhotoWidth && Number.isInteger(gridPhotoWidth) ? gridPhotoWidth : 300)),
23
24
  );
24
25
 
25
- let zoomed: number | null = $state(0);
26
+ // Initial zoom only: later prop changes must not yank the viewer.
27
+ let zoomed: number | null = $state(untrack(() => minimizedAtLoad) ? null : 0);
26
28
  let zoomedPhoto: Photo | null = $derived.by(() => {
27
29
  if (zoomed === null) return null;
28
30
  const photo = photos[zoomed];
@@ -73,8 +73,12 @@
73
73
  }
74
74
  });
75
75
 
76
+ // max-width caps the section; padding always applies as side gutters
77
+ // (box-sizing is border-box, so padding stays inside the cap). Either/or
78
+ // dropped padding whenever maxWidth was set — and the editor defaults
79
+ // maxWidth to '100%', so configured gutters never rendered.
76
80
  let widthStyle = $derived(
77
- maxWidth ? `max-width: ${maxWidth};` : `padding-left: ${padding}; padding-right: ${padding};`,
81
+ `${maxWidth ? `max-width: ${maxWidth};` : ''}padding-left: ${padding}; padding-right: ${padding};`,
78
82
  );
79
83
  </script>
80
84
 
package/dist/types.d.ts CHANGED
@@ -138,6 +138,11 @@ export interface PhotoGallery {
138
138
  export interface PhotoGalleryContent {
139
139
  gridPhotoWidth?: number;
140
140
  photos: Photo[];
141
+ /**
142
+ * Start with all photos minimized (old behaviour). Absent means true.
143
+ * Set false to maximize the first photo on load.
144
+ */
145
+ minimizedAtLoad?: boolean;
141
146
  }
142
147
  export interface Pricing extends AccoBlock {
143
148
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.4.28",
3
+ "version": "0.4.30",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",