@soleil-se/app-util 5.12.2 → 5.12.3

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
+ ## [5.12.3] - 2025-12-03
11
+
12
+ - Even better type definitions for Svelte render functions.
13
+
10
14
  ## [5.12.2] - 2025-12-03
11
15
 
12
16
  - Better type definitions for Svelte render functions.
@@ -1,9 +1,9 @@
1
1
  /// <reference types="svelte" />
2
2
  /**
3
- * @template {Record<string, unknown>} TProps
3
+ * @template {import('svelte').Component<any, any>} TComponent
4
4
  * @typedef {object} RenderSettings
5
5
  * @property {HTMLElement} [target] Target where app should be mounted.
6
- * @property {TProps} [props] Root component props.
6
+ * @property {import('svelte').ComponentProps<TComponent>} [props] Root component props.
7
7
  * @property {boolean} [hydrate=target.hasChildNodes()] Instructs Svelte to upgrade existing DOM
8
8
  * (usually from server-side rendering) rather than creating new elements. By default the app will
9
9
  * hydrate when the target has any child nodes.
@@ -12,12 +12,12 @@
12
12
  */
13
13
  /**
14
14
  * Renders a client side Svelte application.
15
- * @template {Record<string, unknown>} [TProps=Record<string, unknown>]
16
- * @param {import('svelte').Component<TProps>} App Svelte app root component.
17
- * @param {RenderSettings<TProps>} [settings={}] Settings object.
15
+ * @template {import('svelte').Component<any, any>} TComponent
16
+ * @param {TComponent} App Svelte app root component.
17
+ * @param {RenderSettings<TComponent>} [settings={}] Settings object.
18
18
  */
19
- export function render<TProps extends Record<string, unknown> = Record<string, unknown>>(App: import("svelte").Component<TProps, any, string>, { target, props, hydrate, intro, }?: RenderSettings<TProps>): void;
20
- export type RenderSettings<TProps extends Record<string, unknown>> = {
19
+ export function render<TComponent extends import("svelte").Component<any, any, string>>(App: TComponent, { target, props, hydrate, intro, }?: RenderSettings<TComponent>): void;
20
+ export type RenderSettings<TComponent extends import("svelte").Component<any, any, string>> = {
21
21
  /**
22
22
  * Target where app should be mounted.
23
23
  */
@@ -25,7 +25,7 @@ export type RenderSettings<TProps extends Record<string, unknown>> = {
25
25
  /**
26
26
  * Root component props.
27
27
  */
28
- props?: TProps;
28
+ props?: import('svelte').ComponentProps<TComponent>;
29
29
  /**
30
30
  * Instructs Svelte to upgrade existing DOM
31
31
  * (usually from server-side rendering) rather than creating new elements. By default the app will
@@ -4,10 +4,10 @@ import { mount as svelteMount, hydrate as svelteHydrate } from 'svelte';
4
4
  import { setAppProps } from '../../../common';
5
5
 
6
6
  /**
7
- * @template {Record<string, unknown>} TProps
7
+ * @template {import('svelte').Component<any, any>} TComponent
8
8
  * @typedef {object} RenderSettings
9
9
  * @property {HTMLElement} [target] Target where app should be mounted.
10
- * @property {TProps} [props] Root component props.
10
+ * @property {import('svelte').ComponentProps<TComponent>} [props] Root component props.
11
11
  * @property {boolean} [hydrate=target.hasChildNodes()] Instructs Svelte to upgrade existing DOM
12
12
  * (usually from server-side rendering) rather than creating new elements. By default the app will
13
13
  * hydrate when the target has any child nodes.
@@ -17,9 +17,9 @@ import { setAppProps } from '../../../common';
17
17
 
18
18
  /**
19
19
  * Renders a client side Svelte application.
20
- * @template {Record<string, unknown>} [TProps=Record<string, unknown>]
21
- * @param {import('svelte').Component<TProps>} App Svelte app root component.
22
- * @param {RenderSettings<TProps>} [settings={}] Settings object.
20
+ * @template {import('svelte').Component<any, any>} TComponent
21
+ * @param {TComponent} App Svelte app root component.
22
+ * @param {RenderSettings<TComponent>} [settings={}] Settings object.
23
23
  */
24
24
  export function render(App, {
25
25
  target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/app-util",
3
- "version": "5.12.2",
3
+ "version": "5.12.3",
4
4
  "description": "Utility functions for WebApps, RESTApps and Widgets in Sitevision.",
5
5
  "main": "./common/index.js",
6
6
  "author": "Soleil AB",
@@ -25,5 +25,5 @@
25
25
  "scripts": {
26
26
  "create-type-definitions": "node ../../utils/createTypeDefinitions.js ./common/index.js ./client/index.js ./client/svelte/index.js ./client/svelte/3/index.js ./client/svelte/4/index.js ./client/svelte/5/index.js ./server/index.js ./server/svelte/index.js ./server/svelte/3/index.js ./server/svelte/4/index.js ./server/svelte/5/index.js ./server/app-data/index.js ./server/global-app-data/index.js"
27
27
  },
28
- "gitHead": "090c22c4eee4dc2f68096f8f50cca8015a91acf7"
28
+ "gitHead": "9b1f44728b2ba84db68acdad31699822067ced13"
29
29
  }
@@ -1,9 +1,9 @@
1
1
  /// <reference types="svelte" />
2
2
  /**
3
3
  * Returns HTML for a server rendered Svelte app.
4
- * @template {Record<string, unknown>} [TProps=Record<string, unknown>]
5
- * @param {import('svelte').Component<TProps>} App Svelte component that is root of app.
6
- * @param {TProps} props Props passed to root component.
4
+ * @template {import('svelte').Component<any, any>} TComponent
5
+ * @param {TComponent} App Svelte component that is root of app.
6
+ * @param {import('svelte').ComponentProps<TComponent>} props Props passed to root component.
7
7
  * @return {string} HTML for the server rendered app.
8
8
  */
9
- export function render<TProps extends Record<string, unknown> = Record<string, unknown>>(App: import("svelte").Component<TProps, any, string>, props: TProps): string;
9
+ export function render<TComponent extends import("svelte").Component<any, any, string>>(App: TComponent, props: import("svelte").ComponentProps<TComponent>): string;
@@ -3,9 +3,9 @@ import { appId, setAppProps } from '../../../common';
3
3
 
4
4
  /**
5
5
  * Returns HTML for a server rendered Svelte app.
6
- * @template {Record<string, unknown>} [TProps=Record<string, unknown>]
7
- * @param {import('svelte').Component<TProps>} App Svelte component that is root of app.
8
- * @param {TProps} props Props passed to root component.
6
+ * @template {import('svelte').Component<any, any>} TComponent
7
+ * @param {TComponent} App Svelte component that is root of app.
8
+ * @param {import('svelte').ComponentProps<TComponent>} props Props passed to root component.
9
9
  * @return {string} HTML for the server rendered app.
10
10
  */
11
11
  export function render(App, props) {