@vitus-labs/rocketstories 2.0.0-alpha.9 → 2.0.0-beta.1

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { RocketComponentType } from "@vitus-labs/rocketstyle";
2
1
  import { ListProps } from "@vitus-labs/elements";
2
+ import { RocketComponentType } from "@vitus-labs/rocketstyle";
3
3
  import { ComponentType, FC, ForwardRefExoticComponent, ReactNode } from "react";
4
4
 
5
5
  //#region src/constants/controls.d.ts
@@ -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 Partial<Omit<Configuration, 'component' | 'attrs'>>>(params: P) => <T extends Configuration['component']>(component: T) => T extends RocketType ? IRocketStories<ExtractProps<T>, T['$$rocketstyle'], true> : IRocketStories<ExtractProps<T>, unknown, false>;
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
- const getTheme = () => window.__VITUS_LABS_STORIES__.decorators.theme;
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 }) => (component) => rocketstories(component, {
1096
- decorators,
1097
- storyOptions,
1098
- ...rest
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-alpha.9+f2f47db",
3
+ "version": "2.0.0-beta.1",
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,25 @@
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": "^1.4.0",
68
- "@vitus-labs/rocketstyle": "^1.4.0",
69
- "@vitus-labs/unistyle": "^1.4.0",
69
+ "@vitus-labs/core": "2.0.0-beta.1",
70
+ "@vitus-labs/rocketstyle": "2.0.0-beta.1",
71
+ "@vitus-labs/unistyle": "2.0.0-beta.1",
70
72
  "react": ">= 19"
71
73
  },
72
74
  "dependencies": {
73
- "@vitus-labs/elements": "2.0.0-alpha.9+f2f47db"
75
+ "@vitus-labs/elements": "workspace:*"
74
76
  },
75
77
  "devDependencies": {
76
- "@vitus-labs/core": "2.0.0-alpha.9+f2f47db",
77
- "@vitus-labs/rocketstyle": "2.0.0-alpha.9+f2f47db",
78
- "@vitus-labs/tools-rolldown": "^1.6.0",
79
- "@vitus-labs/tools-storybook": "^1.6.0",
80
- "@vitus-labs/tools-typescript": "^1.6.0",
81
- "@vitus-labs/unistyle": "2.0.0-alpha.9+f2f47db"
82
- },
83
- "gitHead": "f2f47db887d6a846ee5f9e96f290c59cdde4772a"
78
+ "@vitus-labs/core": "workspace:*",
79
+ "@vitus-labs/rocketstyle": "workspace:*",
80
+ "@vitus-labs/tools-rolldown": "2.2.0",
81
+ "@vitus-labs/tools-storybook": "2.2.0",
82
+ "@vitus-labs/tools-typescript": "2.1.0",
83
+ "@vitus-labs/unistyle": "workspace:*"
84
+ }
84
85
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023-present Vit Bokisch
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.