@soleil-se/config-svelte 1.30.0 → 1.30.2
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 +9 -1
- package/createConfigApp/index.d.ts +19 -0
- package/createConfigApp/index.js +7 -2
- package/package.json +3 -5
- package/server/index.d.ts +3 -3
- package/server/index.js +2 -1
- package/types/createConfigApp/index.d.ts +16 -2
- package/types/server/index.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,15 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
9
9
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
10
10
|
|
|
11
|
-
## [1.30.
|
|
11
|
+
## [1.30.2] - 2026-02-26
|
|
12
|
+
|
|
13
|
+
- Change default value of props in `createConfigApp` to `Record<string, never>`.
|
|
14
|
+
|
|
15
|
+
## [1.30.1] - 2026-02-25
|
|
16
|
+
|
|
17
|
+
- Improve type definitions for `createAppProps` and `createConfigApp` to correctly infer the props.
|
|
18
|
+
|
|
19
|
+
## [1.30.0] - 2026-02-25
|
|
12
20
|
|
|
13
21
|
- Add a `res.render({})` call för `createAppProps` and `createAppContext` to correctly render the
|
|
14
22
|
size selector in widget configs.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base props type for config apps. All config apps receive a `values` object.
|
|
3
|
+
*/
|
|
4
|
+
export type ConfigAppProps = {
|
|
5
|
+
values?: Record<string, unknown>;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create a config app
|
|
11
|
+
* @template TProps - The props type for the component, can include a `values` object.
|
|
12
|
+
* @param callback - Callback function for initializing the app with target element and props
|
|
13
|
+
*/
|
|
14
|
+
export default function createConfigApp<TProps extends ConfigAppProps = Record<string, never>>(
|
|
15
|
+
callback: (config: {
|
|
16
|
+
target: HTMLElement;
|
|
17
|
+
props: TProps;
|
|
18
|
+
}) => void,
|
|
19
|
+
): void;
|
package/createConfigApp/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{ values?: Record<string, unknown>, [key: string]: unknown }} ConfigAppProps
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Create a config app
|
|
3
|
-
* @
|
|
7
|
+
* @template {ConfigAppProps} [TProps=ConfigAppProps] - The props type for the component, must include a `values` object.
|
|
8
|
+
* @param {(config: { target: HTMLElement, props: TProps }) => void} callback - Callback function for initializing the app with target element and props.
|
|
4
9
|
*/
|
|
5
10
|
export default function createConfigApp(callback) {
|
|
6
11
|
window.setValues = (values) => {
|
|
@@ -19,7 +24,7 @@ export default function createConfigApp(callback) {
|
|
|
19
24
|
|
|
20
25
|
if (callback?.toString()?.startsWith('class')) {
|
|
21
26
|
// Legacy support for class components
|
|
22
|
-
// eslint-disable-next-line
|
|
27
|
+
// eslint-disable-next-line new-cap
|
|
23
28
|
return new callback({ target, props });
|
|
24
29
|
}
|
|
25
30
|
return callback({ target, props });
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"svelte"
|
|
10
10
|
],
|
|
11
11
|
"homepage": "https://docs.soleil.se/packages/config-svelte",
|
|
12
|
-
"version": "1.30.
|
|
12
|
+
"version": "1.30.2",
|
|
13
13
|
"main": "./index.js",
|
|
14
14
|
"module": "./index.js",
|
|
15
15
|
"svelte": "./index.js",
|
|
@@ -56,8 +56,6 @@
|
|
|
56
56
|
"scripts": {
|
|
57
57
|
"create-type-definitions": "node ./createTypeDefinitions.js"
|
|
58
58
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
"gitHead": "405f8c7d65e72fb61520680b4a9815fb559f4b04"
|
|
59
|
+
"private": false,
|
|
60
|
+
"gitHead": "b59d24dee622f4b312964d7381966e2d152eb7d7"
|
|
63
61
|
}
|
package/server/index.d.ts
CHANGED
|
@@ -9,17 +9,17 @@ import type { Response } from '@sitevision/api/common/router';
|
|
|
9
9
|
*
|
|
10
10
|
* // After:
|
|
11
11
|
* createAppProps(props, res);
|
|
12
|
-
* @param {Record<string,
|
|
12
|
+
* @param {Record<string, unknown>} props Props to be passed to the app.
|
|
13
13
|
* @returns {string} HTML string to make props available to the app.
|
|
14
14
|
*/
|
|
15
|
-
export function createAppProps
|
|
15
|
+
export function createAppProps<TProps extends Record<string, unknown>>(props: TProps): string;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates app props that can be passed to the app.
|
|
19
19
|
* @param {Record<string, any>} props Props to be passed to the app.
|
|
20
20
|
* @param {Response} res Response from \@sitevision/common/router.
|
|
21
21
|
*/
|
|
22
|
-
export function createAppProps
|
|
22
|
+
export function createAppProps<TProps extends Record<string, unknown>>(props: TProps, res: Response): void;
|
|
23
23
|
/**
|
|
24
24
|
* Creates a HTML string for passing data to the app.
|
|
25
25
|
* @param {Record<string, any>} data Data to be passed to the app.
|
package/server/index.js
CHANGED
|
@@ -9,7 +9,8 @@ import ResourceLocatorUtil from '@sitevision/api/server/ResourceLocatorUtil';
|
|
|
9
9
|
let hasRendered = false;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @
|
|
12
|
+
* @template {Record<string, unknown>} [TProps=Record<string, unknown>]
|
|
13
|
+
* @param {TProps} props
|
|
13
14
|
* @param {Response} [res]
|
|
14
15
|
* @returns {string | void}
|
|
15
16
|
*/
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base props type for config apps. All config apps receive a `values` object.
|
|
3
|
+
*/
|
|
4
|
+
export type ConfigAppProps = {
|
|
5
|
+
values?: Record<string, unknown>;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Create a config app
|
|
3
|
-
* @
|
|
11
|
+
* @template TProps - The props type for the component, must include a `values` object.
|
|
12
|
+
* @param callback - Callback function for initializing the app with target element and props
|
|
4
13
|
*/
|
|
5
|
-
export default function createConfigApp
|
|
14
|
+
export default function createConfigApp<TProps extends ConfigAppProps = ConfigAppProps>(
|
|
15
|
+
callback: (config: {
|
|
16
|
+
target: HTMLElement;
|
|
17
|
+
props: TProps;
|
|
18
|
+
}) => void,
|
|
19
|
+
): void;
|
package/types/server/index.d.ts
CHANGED
|
@@ -9,17 +9,17 @@ import type { Response } from '@sitevision/api/common/router';
|
|
|
9
9
|
*
|
|
10
10
|
* // After:
|
|
11
11
|
* createAppProps(props, res);
|
|
12
|
-
* @param {Record<string,
|
|
12
|
+
* @param {Record<string, unknown>} props Props to be passed to the app.
|
|
13
13
|
* @returns {string} HTML string to make props available to the app.
|
|
14
14
|
*/
|
|
15
|
-
export function createAppProps
|
|
15
|
+
export function createAppProps<TProps extends Record<string, unknown>>(props: TProps): string;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates app props that can be passed to the app.
|
|
19
19
|
* @param {Record<string, any>} props Props to be passed to the app.
|
|
20
20
|
* @param {Response} res Response from \@sitevision/common/router.
|
|
21
21
|
*/
|
|
22
|
-
export function createAppProps
|
|
22
|
+
export function createAppProps<TProps extends Record<string, unknown>>(props: TProps, res: Response): void;
|
|
23
23
|
/**
|
|
24
24
|
* Creates a HTML string for passing data to the app.
|
|
25
25
|
* @param {Record<string, any>} data Data to be passed to the app.
|