@vitus-labs/rocketstories 2.0.0-alpha.8 → 2.0.0-beta.0
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/lib/index.d.ts +7 -1
- package/lib/index.js +13 -6
- package/package.json +15 -13
package/lib/index.d.ts
CHANGED
|
@@ -135,12 +135,18 @@ interface IRocketStories<OA extends TObj = {}, RA extends TObj | unknown = unkno
|
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
137
|
//#region src/init.d.ts
|
|
138
|
+
type InitParams = Partial<Omit<Configuration, 'component' | 'attrs'>> & {
|
|
139
|
+
theme?: Record<string, unknown>;
|
|
140
|
+
};
|
|
138
141
|
/**
|
|
139
142
|
* Curried factory that accepts shared configuration options first,
|
|
140
143
|
* then a component, producing a fully configured IRocketStories builder.
|
|
141
144
|
* Useful for pre-configuring decorators or storyOptions across many stories.
|
|
145
|
+
*
|
|
146
|
+
* Pass `theme` to set the global theme at runtime (alternative to
|
|
147
|
+
* configuring it via `vl-tools.config`).
|
|
142
148
|
*/
|
|
143
|
-
type Init = <P extends
|
|
149
|
+
type Init = <P extends InitParams>(params: P) => <T extends Configuration['component']>(component: T) => T extends RocketType ? IRocketStories<ExtractProps<T>, T['$$rocketstyle'], true> : IRocketStories<ExtractProps<T>, unknown, false>;
|
|
144
150
|
/** @see {@link Init} */
|
|
145
151
|
declare const init: Init;
|
|
146
152
|
/**
|
package/lib/index.js
CHANGED
|
@@ -768,7 +768,11 @@ const generateMainJSXCode = ({ name, props, dimensions, booleanDimensions }) =>
|
|
|
768
768
|
|
|
769
769
|
//#endregion
|
|
770
770
|
//#region src/utils/theme.ts
|
|
771
|
-
|
|
771
|
+
let theme = {};
|
|
772
|
+
const getTheme = () => theme;
|
|
773
|
+
const setTheme = (value) => {
|
|
774
|
+
theme = value;
|
|
775
|
+
};
|
|
772
776
|
|
|
773
777
|
//#endregion
|
|
774
778
|
//#region src/stories/rocketstories/renderDimension/context.tsx
|
|
@@ -1092,11 +1096,14 @@ const createRocketStories = (options) => {
|
|
|
1092
1096
|
//#endregion
|
|
1093
1097
|
//#region src/init.ts
|
|
1094
1098
|
/** @see {@link Init} */
|
|
1095
|
-
const init = ({ decorators = [], storyOptions = {}, ...rest }) =>
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1099
|
+
const init = ({ decorators = [], storyOptions = {}, theme, ...rest }) => {
|
|
1100
|
+
if (theme) setTheme(theme);
|
|
1101
|
+
return (component) => rocketstories(component, {
|
|
1102
|
+
decorators,
|
|
1103
|
+
storyOptions,
|
|
1104
|
+
...rest
|
|
1105
|
+
});
|
|
1106
|
+
};
|
|
1100
1107
|
/** @see {@link Rocketstories} */
|
|
1101
1108
|
const rocketstories = (component, options = {}) => {
|
|
1102
1109
|
const { decorators = [], storyOptions = {} } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/rocketstories",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"types": "./lib/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"types": "./lib/index.d.ts",
|
|
17
|
+
"main": "./lib/index.js",
|
|
17
18
|
"files": [
|
|
18
19
|
"lib",
|
|
19
20
|
"!lib/**/*.map",
|
|
@@ -60,25 +61,26 @@
|
|
|
60
61
|
"test:coverage": "vitest run --coverage",
|
|
61
62
|
"test:watch": "vitest",
|
|
62
63
|
"cover": "coveralls < .coverage/lcov.info",
|
|
63
|
-
"typecheck": "tsc --noEmit"
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"version": "node ../../scripts/sync-peer-deps.mjs"
|
|
64
66
|
},
|
|
65
67
|
"peerDependencies": {
|
|
66
68
|
"@storybook/react": "10.2.8",
|
|
67
|
-
"@vitus-labs/core": "
|
|
68
|
-
"@vitus-labs/rocketstyle": "
|
|
69
|
-
"@vitus-labs/unistyle": "
|
|
69
|
+
"@vitus-labs/core": "2.0.0-alpha.27",
|
|
70
|
+
"@vitus-labs/rocketstyle": "2.0.0-alpha.27",
|
|
71
|
+
"@vitus-labs/unistyle": "2.0.0-alpha.27",
|
|
70
72
|
"react": ">= 19"
|
|
71
73
|
},
|
|
72
74
|
"dependencies": {
|
|
73
|
-
"@vitus-labs/elements": "2.0.0-
|
|
75
|
+
"@vitus-labs/elements": "2.0.0-beta.0"
|
|
74
76
|
},
|
|
75
77
|
"devDependencies": {
|
|
76
|
-
"@vitus-labs/core": "2.0.0-
|
|
77
|
-
"@vitus-labs/rocketstyle": "2.0.0-
|
|
78
|
-
"@vitus-labs/tools-rolldown": "
|
|
79
|
-
"@vitus-labs/tools-storybook": "
|
|
80
|
-
"@vitus-labs/tools-typescript": "
|
|
81
|
-
"@vitus-labs/unistyle": "2.0.0-
|
|
78
|
+
"@vitus-labs/core": "2.0.0-beta.0",
|
|
79
|
+
"@vitus-labs/rocketstyle": "2.0.0-beta.0",
|
|
80
|
+
"@vitus-labs/tools-rolldown": "1.10.0",
|
|
81
|
+
"@vitus-labs/tools-storybook": "1.10.0",
|
|
82
|
+
"@vitus-labs/tools-typescript": "1.10.0",
|
|
83
|
+
"@vitus-labs/unistyle": "2.0.0-beta.0"
|
|
82
84
|
},
|
|
83
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "dd8b9f356086ecd8bfb69c87fcad1e8bfa9ab1f4"
|
|
84
86
|
}
|