svelte-ag 0.0.2-dev.72 → 0.0.2-dev.73

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.
@@ -76,7 +76,7 @@
76
76
  let animationComplete = $state<boolean>(true);
77
77
  let isInitialRender = $state(true);
78
78
  //svelte-ignore non_reactive_update
79
- let growHeightElement: HTMLDivElement;
79
+ let growHeightElement: HTMLDivElement | undefined;
80
80
 
81
81
  function handleAnimationEnd(e: AnimationEvent) {
82
82
  if (!visible) {
@@ -161,24 +161,23 @@
161
161
  // First set height to 0 and make visible for measurement
162
162
  growHeightElement.style.height = '0px';
163
163
  growHeightElement.style.display = 'block';
164
+ const targetHeight = growHeightElement.scrollHeight;
164
165
 
165
166
  await tick(); // Wait for render
166
167
 
167
- const targetHeight = growHeightElement.scrollHeight;
168
-
169
168
  // Start animation
170
169
  const startTime = performance.now();
171
170
  const animate = (time: number) => {
172
171
  const elapsed = time - startTime;
173
172
  const progress = Math.min(elapsed / durationMs, 1);
174
173
 
175
- growHeightElement.style.height = `${targetHeight * progress}px`;
174
+ if (growHeightElement) growHeightElement.style.height = `${targetHeight * progress}px`;
176
175
 
177
176
  if (progress < 1) {
178
177
  requestAnimationFrame(animate);
179
178
  } else {
180
179
  // Animation complete
181
- growHeightElement.style.height = 'auto';
180
+ if (growHeightElement) growHeightElement.style.height = 'auto';
182
181
  onAnimationComplete?.(true);
183
182
  }
184
183
  };
@@ -195,12 +194,12 @@
195
194
  const elapsed = time - startTime;
196
195
  const progress = Math.min(elapsed / durationMs, 1);
197
196
 
198
- growHeightElement.style.height = `${startHeight * (1 - progress)}px`;
197
+ if (growHeightElement) growHeightElement.style.height = `${startHeight * (1 - progress)}px`;
199
198
 
200
199
  if (progress < 1) {
201
200
  requestAnimationFrame(animate);
202
201
  } else {
203
- growHeightElement.style.display = 'none';
202
+ if (growHeightElement) growHeightElement.style.display = 'none';
204
203
  onAnimationComplete?.(false);
205
204
  }
206
205
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-ag",
3
3
  "description": "Useful svelte components",
4
- "version": "0.0.2-dev.72",
4
+ "version": "0.0.2-dev.73",
5
5
  "author": "Alexander Hornung",
6
6
  "bugs": "https://github.com/ageorgeh/cms/issues",
7
7
  "dependencies": {
@@ -74,6 +74,7 @@
74
74
  "components:dev": "vite --config vite.config.ts dev",
75
75
  "svelte:sync": "svelte-kit sync",
76
76
  "publish:local": "pnpm version prerelease --preid dev --no-git-tag-version && pnpm publish --registry http://localhost:4873 --tag dev --access public --no-git-checks --json > ./publishLocal.json",
77
- "publish:prerelease": "pnpm publish --tag dev --access public --no-git-checks --registry=https://registry.npmjs.org/ --json > ./publish.json"
77
+ "publish:prerelease": "pnpm publish --tag dev --access public --no-git-checks --registry=https://registry.npmjs.org/ --json > ./publish.json",
78
+ "version:prerelease": "pnpm version prerelease --preid dev --no-git-tag-version"
78
79
  }
79
80
  }
@@ -76,7 +76,7 @@
76
76
  let animationComplete = $state<boolean>(true);
77
77
  let isInitialRender = $state(true);
78
78
  //svelte-ignore non_reactive_update
79
- let growHeightElement: HTMLDivElement;
79
+ let growHeightElement: HTMLDivElement | undefined;
80
80
 
81
81
  function handleAnimationEnd(e: AnimationEvent) {
82
82
  if (!visible) {
@@ -161,24 +161,23 @@
161
161
  // First set height to 0 and make visible for measurement
162
162
  growHeightElement.style.height = '0px';
163
163
  growHeightElement.style.display = 'block';
164
+ const targetHeight = growHeightElement.scrollHeight;
164
165
 
165
166
  await tick(); // Wait for render
166
167
 
167
- const targetHeight = growHeightElement.scrollHeight;
168
-
169
168
  // Start animation
170
169
  const startTime = performance.now();
171
170
  const animate = (time: number) => {
172
171
  const elapsed = time - startTime;
173
172
  const progress = Math.min(elapsed / durationMs, 1);
174
173
 
175
- growHeightElement.style.height = `${targetHeight * progress}px`;
174
+ if (growHeightElement) growHeightElement.style.height = `${targetHeight * progress}px`;
176
175
 
177
176
  if (progress < 1) {
178
177
  requestAnimationFrame(animate);
179
178
  } else {
180
179
  // Animation complete
181
- growHeightElement.style.height = 'auto';
180
+ if (growHeightElement) growHeightElement.style.height = 'auto';
182
181
  onAnimationComplete?.(true);
183
182
  }
184
183
  };
@@ -195,12 +194,12 @@
195
194
  const elapsed = time - startTime;
196
195
  const progress = Math.min(elapsed / durationMs, 1);
197
196
 
198
- growHeightElement.style.height = `${startHeight * (1 - progress)}px`;
197
+ if (growHeightElement) growHeightElement.style.height = `${startHeight * (1 - progress)}px`;
199
198
 
200
199
  if (progress < 1) {
201
200
  requestAnimationFrame(animate);
202
201
  } else {
203
- growHeightElement.style.display = 'none';
202
+ if (growHeightElement) growHeightElement.style.display = 'none';
204
203
  onAnimationComplete?.(false);
205
204
  }
206
205
  };