@analogjs/storybook-angular 1.16.0-beta.7
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/README.md +158 -0
- package/package.json +101 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
- package/src/lib/build-storybook/build-storybook.d.ts +2 -0
- package/src/lib/build-storybook/build-storybook.js +6 -0
- package/src/lib/build-storybook/build-storybook.js.map +1 -0
- package/src/lib/build-storybook/schema.json +75 -0
- package/src/lib/builders.json +14 -0
- package/src/lib/start-storybook/schema.json +111 -0
- package/src/lib/start-storybook/start-storybook.d.ts +2 -0
- package/src/lib/start-storybook/start-storybook.js +6 -0
- package/src/lib/start-storybook/start-storybook.js.map +1 -0
- package/src/lib/utils/standalone-options.d.ts +9 -0
- package/src/lib/utils/standalone-options.js +3 -0
- package/src/lib/utils/standalone-options.js.map +1 -0
- package/src/preset.d.ts +5 -0
- package/src/preset.js +93 -0
- package/src/preset.js.map +1 -0
- package/src/test-setup.d.ts +1 -0
- package/src/test-setup.js +7 -0
- package/src/test-setup.js.map +1 -0
- package/src/types.d.ts +25 -0
- package/src/types.js +3 -0
- package/src/types.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# @analogjs/storybook-angular
|
|
2
|
+
|
|
3
|
+
Integration package for Storybook using Angular & Vite.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
If you don't have Storybook setup already, run the following command to initialize Storybook for your project:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx storybook@latest init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Follow the provided prompts, and commit your changes.
|
|
14
|
+
|
|
15
|
+
## Installing the Storybook package
|
|
16
|
+
|
|
17
|
+
Install the Storybook Plugin for Angular and Vite. Depending on your preferred package manager, run one of the following commands:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
npm install @analogjs/storybook-angular --save-dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuring Storybook
|
|
24
|
+
|
|
25
|
+
Add the `zone.js` import to the top of the `.storybook/preview.ts` file.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import 'zone.js';
|
|
29
|
+
import { applicationConfig, type Preview } from '@storybook/angular';
|
|
30
|
+
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
|
31
|
+
|
|
32
|
+
const preview: Preview = {
|
|
33
|
+
decorators: [
|
|
34
|
+
applicationConfig({
|
|
35
|
+
providers: [provideNoopAnimations()],
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
parameters: {
|
|
39
|
+
controls: {
|
|
40
|
+
matchers: {
|
|
41
|
+
color: /(background|color)$/i,
|
|
42
|
+
date: /Date$/i,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default preview;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Next, update the `.storybook/main.ts` file to use the `StorybookConfig`. Also update the `framework` to use the `@analogjs/storybook-angular` package.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { StorybookConfig } from '@analogjs/storybook-angular';
|
|
55
|
+
|
|
56
|
+
const config: StorybookConfig = {
|
|
57
|
+
// other config, addons, etc.
|
|
58
|
+
framework: {
|
|
59
|
+
name: '@analogjs/storybook-angular',
|
|
60
|
+
options: {},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Remove the existing `webpackFinal` config function if present.
|
|
66
|
+
|
|
67
|
+
Next, update the Storybook builders in the `angular.json` or `project.json`.
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
"storybook": {
|
|
71
|
+
"builder": "@analogjs/storybook-angular:start-storybook",
|
|
72
|
+
},
|
|
73
|
+
"build-storybook": {
|
|
74
|
+
"builder": "@analogjs/storybook-angular:build-storybook"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Remove any `webpack` specific options and remove the `browserTarget` option.
|
|
79
|
+
|
|
80
|
+
Add the `/storybook-static` folder to your `.gitignore` file.
|
|
81
|
+
|
|
82
|
+
## Running Storybook
|
|
83
|
+
|
|
84
|
+
Run the command for starting the development server.
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npm run storybook
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Building Storybook
|
|
91
|
+
|
|
92
|
+
Run the command for building the storybook.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
npm run build-storybook
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Using shared CSS paths
|
|
99
|
+
|
|
100
|
+
To load shared CSS paths, configure them using `loadPaths` css option in the `viteFinal` function.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import path from 'node:path';
|
|
104
|
+
|
|
105
|
+
async viteFinal() {
|
|
106
|
+
return {
|
|
107
|
+
css: {
|
|
108
|
+
preprocessorOptions: {
|
|
109
|
+
scss: {
|
|
110
|
+
loadPaths: `${path.resolve(__dirname, '../src/lib/styles')}`
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Using TypeScript Config Path Aliases
|
|
119
|
+
|
|
120
|
+
If you are using `paths` in your `tsconfig.json`, support for those aliases can be added to the `vite.config.ts`.
|
|
121
|
+
|
|
122
|
+
### With Angular CLI
|
|
123
|
+
|
|
124
|
+
First, install the `vite-tsconfig-paths` package.
|
|
125
|
+
|
|
126
|
+
```shell
|
|
127
|
+
npm install vite-tsconfig-paths --save-dev
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Next, add the plugin to the `plugins` array.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import viteTsConfigPaths from 'vite-tsconfig-paths';
|
|
134
|
+
|
|
135
|
+
async viteFinal() {
|
|
136
|
+
return {
|
|
137
|
+
plugins: [
|
|
138
|
+
viteTsConfigPaths()
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### With Nx
|
|
145
|
+
|
|
146
|
+
For Nx workspaces, import and use the `nxViteTsPaths` plugin from the `@nx/vite` package.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
150
|
+
|
|
151
|
+
async viteFinal(config: UserConfig) {
|
|
152
|
+
return {
|
|
153
|
+
plugins: [
|
|
154
|
+
nxViteTsPaths()
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@analogjs/storybook-angular",
|
|
3
|
+
"version": "1.16.0-beta.7",
|
|
4
|
+
"description": "Storybook Integration for Angular & Vite",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"storybook",
|
|
7
|
+
"angular",
|
|
8
|
+
"vite"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://analogjs.org",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/analogjs/analog/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/analogjs/analog.git",
|
|
17
|
+
"directory": "packages/storybook-angular"
|
|
18
|
+
},
|
|
19
|
+
"funding": {
|
|
20
|
+
"type": "github",
|
|
21
|
+
"url": "https://github.com/sponsors/brandonroberts"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./src/index.d.ts",
|
|
27
|
+
"import": "./src/index.js",
|
|
28
|
+
"require": "./src/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./preset": "./src/preset.js",
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
"./*": "./src/*"
|
|
33
|
+
},
|
|
34
|
+
"main": "src/index.js",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@storybook/angular": ">=8.6.0",
|
|
37
|
+
"@storybook/builder-vite": ">=8.6.0",
|
|
38
|
+
"@storybook/components": ">=8.6.0",
|
|
39
|
+
"@storybook/global": "^5.0.0",
|
|
40
|
+
"@storybook/manager-api": ">=8.6.0",
|
|
41
|
+
"@storybook/preview-api": ">=8.6.0",
|
|
42
|
+
"@storybook/theming": ">=8.6.0",
|
|
43
|
+
"fd-package-json": "^1.2.0",
|
|
44
|
+
"find-up": "^5.0.0",
|
|
45
|
+
"semver": "^7.3.7",
|
|
46
|
+
"telejson": "^7.2.0",
|
|
47
|
+
"ts-dedent": "^2.0.0",
|
|
48
|
+
"util-deprecate": "^1.0.2"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@analogjs/vite-plugin-angular": ">=1.12.0 < 2.0.0",
|
|
52
|
+
"@angular-devkit/architect": ">=0.1500.0 < 0.2000.0",
|
|
53
|
+
"@angular-devkit/build-angular": ">=15.0.0 < 20.0.0",
|
|
54
|
+
"@angular-devkit/core": ">=15.0.0 < 20.0.0",
|
|
55
|
+
"@angular/animations": ">=15.0.0 < 20.0.0",
|
|
56
|
+
"@angular/cli": ">=15.0.0 < 20.0.0",
|
|
57
|
+
"@angular/common": ">=15.0.0 < 20.0.0",
|
|
58
|
+
"@angular/compiler": ">=15.0.0 < 20.0.0",
|
|
59
|
+
"@angular/compiler-cli": ">=15.0.0 < 20.0.0",
|
|
60
|
+
"@angular/core": ">=15.0.0 < 20.0.0",
|
|
61
|
+
"@angular/forms": ">=15.0.0 < 20.0.0",
|
|
62
|
+
"@angular/platform-browser": ">=15.0.0 < 20.0.0",
|
|
63
|
+
"@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0",
|
|
64
|
+
"rxjs": "^6.0.0 || ^7.4.0",
|
|
65
|
+
"storybook": ">=8.6.0",
|
|
66
|
+
"typescript": "^5.0.0",
|
|
67
|
+
"vite": "*",
|
|
68
|
+
"zone.js": ">= 0.11.1 < 1.0.0"
|
|
69
|
+
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"@angular/animations": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"@angular/cli": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"zone.js": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=18.0.0"
|
|
83
|
+
},
|
|
84
|
+
"builders": "src/lib/builders.json",
|
|
85
|
+
"ng-add": {
|
|
86
|
+
"save": "devDependencies"
|
|
87
|
+
},
|
|
88
|
+
"ng-update": {
|
|
89
|
+
"packageGroup": [
|
|
90
|
+
"@analogjs/platform",
|
|
91
|
+
"@analogjs/content",
|
|
92
|
+
"@analogjs/router",
|
|
93
|
+
"@analogjs/storybook-angular",
|
|
94
|
+
"@analogjs/vite-plugin-angular",
|
|
95
|
+
"@analogjs/vite-plugin-nitro",
|
|
96
|
+
"@analogjs/vitest-angular"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"types": "./src/index.d.ts",
|
|
100
|
+
"type": "commonjs"
|
|
101
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("@storybook/angular/dist/client/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,kFAAwD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_js_1 = tslib_1.__importDefault(require("@storybook/angular/dist/builders/build-storybook/index.js"));
|
|
5
|
+
exports.default = index_js_1.default;
|
|
6
|
+
//# sourceMappingURL=build-storybook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/build-storybook/build-storybook.ts"],"names":[],"mappings":";;;AAAA,iHAA8F;AAE9F,kBAAe,kBAAqB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"title": "Build Storybook",
|
|
4
|
+
"description": "Serve up storybook in development mode.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"tsConfig": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
10
|
+
},
|
|
11
|
+
"outputDir": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Directory where to store built files.",
|
|
14
|
+
"default": "storybook-static"
|
|
15
|
+
},
|
|
16
|
+
"configDir": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Directory where to load Storybook configurations from.",
|
|
19
|
+
"default": ".storybook"
|
|
20
|
+
},
|
|
21
|
+
"loglevel": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
|
|
24
|
+
"pattern": "(silly|verbose|info|warn|silent)"
|
|
25
|
+
},
|
|
26
|
+
"enableProdMode": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Disable Angular's development mode, which turns off assertions and other checks within the framework.",
|
|
29
|
+
"default": true
|
|
30
|
+
},
|
|
31
|
+
"quiet": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "Suppress verbose build output.",
|
|
34
|
+
"default": false
|
|
35
|
+
},
|
|
36
|
+
"docs": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/writing-docs/build-documentation#preview-storybooks-documentation.",
|
|
39
|
+
"default": false
|
|
40
|
+
},
|
|
41
|
+
"test": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Build the static version of the sandbox optimized for testing purposes",
|
|
44
|
+
"default": false
|
|
45
|
+
},
|
|
46
|
+
"compodoc": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Execute compodoc before.",
|
|
49
|
+
"default": true
|
|
50
|
+
},
|
|
51
|
+
"compodocArgs": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.",
|
|
54
|
+
"default": ["-e", "json"],
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"statsJson": {
|
|
60
|
+
"type": ["boolean", "string"],
|
|
61
|
+
"description": "Write stats JSON to disk",
|
|
62
|
+
"default": false
|
|
63
|
+
},
|
|
64
|
+
"previewUrl": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Disables the default storybook preview and lets you use your own"
|
|
67
|
+
},
|
|
68
|
+
"experimentalZoneless": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"description": "Experimental: Use zoneless change detection.",
|
|
71
|
+
"default": false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": false
|
|
75
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"builders": {
|
|
3
|
+
"build-storybook": {
|
|
4
|
+
"implementation": "./build-storybook/build-storybook",
|
|
5
|
+
"schema": "./build-storybook/schema.json",
|
|
6
|
+
"description": "Build storybook"
|
|
7
|
+
},
|
|
8
|
+
"start-storybook": {
|
|
9
|
+
"implementation": "./start-storybook/start-storybook",
|
|
10
|
+
"schema": "./start-storybook/schema.json",
|
|
11
|
+
"description": "Start storybook"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"title": "Start Storybook",
|
|
4
|
+
"description": "Serve up storybook in development mode.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"tsConfig": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
10
|
+
},
|
|
11
|
+
"port": {
|
|
12
|
+
"type": "number",
|
|
13
|
+
"description": "Port to listen on.",
|
|
14
|
+
"default": 9009
|
|
15
|
+
},
|
|
16
|
+
"host": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Host to listen on.",
|
|
19
|
+
"default": "localhost"
|
|
20
|
+
},
|
|
21
|
+
"configDir": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Directory where to load Storybook configurations from.",
|
|
24
|
+
"default": ".storybook"
|
|
25
|
+
},
|
|
26
|
+
"https": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Serve Storybook over HTTPS. Note: You must provide your own certificate information.",
|
|
29
|
+
"default": false
|
|
30
|
+
},
|
|
31
|
+
"sslCa": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)."
|
|
34
|
+
},
|
|
35
|
+
"sslCert": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Provide an SSL certificate. (Required with --https)."
|
|
38
|
+
},
|
|
39
|
+
"sslKey": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "SSL key to use for serving HTTPS."
|
|
42
|
+
},
|
|
43
|
+
"smokeTest": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "Exit after successful start.",
|
|
46
|
+
"default": false
|
|
47
|
+
},
|
|
48
|
+
"ci": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"description": "CI mode (skip interactive prompts, don't open browser).",
|
|
51
|
+
"default": false
|
|
52
|
+
},
|
|
53
|
+
"open": {
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"description": "Whether to open Storybook automatically in the browser.",
|
|
56
|
+
"default": true
|
|
57
|
+
},
|
|
58
|
+
"quiet": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Suppress verbose build output.",
|
|
61
|
+
"default": false
|
|
62
|
+
},
|
|
63
|
+
"enableProdMode": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"description": "Disable Angular's development mode, which turns off assertions and other checks within the framework.",
|
|
66
|
+
"default": false
|
|
67
|
+
},
|
|
68
|
+
"docs": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/writing-docs/build-documentation#preview-storybooks-documentation.",
|
|
71
|
+
"default": false
|
|
72
|
+
},
|
|
73
|
+
"compodoc": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"description": "Execute compodoc before.",
|
|
76
|
+
"default": true
|
|
77
|
+
},
|
|
78
|
+
"compodocArgs": {
|
|
79
|
+
"type": "array",
|
|
80
|
+
"description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.",
|
|
81
|
+
"default": ["-e", "json"],
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"initialPath": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "URL path to be appended when visiting Storybook for the first time"
|
|
89
|
+
},
|
|
90
|
+
"statsJson": {
|
|
91
|
+
"type": ["boolean", "string"],
|
|
92
|
+
"description": "Write stats JSON to disk",
|
|
93
|
+
"default": false
|
|
94
|
+
},
|
|
95
|
+
"previewUrl": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Disables the default storybook preview and lets you use your own"
|
|
98
|
+
},
|
|
99
|
+
"loglevel": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
|
|
102
|
+
"pattern": "(silly|verbose|info|warn|silent)"
|
|
103
|
+
},
|
|
104
|
+
"experimentalZoneless": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"description": "Experimental: Use zoneless change detection.",
|
|
107
|
+
"default": false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_js_1 = tslib_1.__importDefault(require("@storybook/angular/dist/builders/start-storybook/index.js"));
|
|
5
|
+
exports.default = index_js_1.default;
|
|
6
|
+
//# sourceMappingURL=start-storybook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/start-storybook/start-storybook.ts"],"names":[],"mappings":";;;AAAA,iHAA8F;AAE9F,kBAAe,kBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuilderOptions, CLIOptions, LoadOptions } from 'storybook/internal/types';
|
|
2
|
+
export type StandaloneOptions = CLIOptions & LoadOptions & BuilderOptions & {
|
|
3
|
+
mode?: 'static' | 'dev';
|
|
4
|
+
enableProdMode: boolean;
|
|
5
|
+
angularBuilderOptions?: Record<string, any> & {
|
|
6
|
+
experimentalZoneless?: boolean;
|
|
7
|
+
};
|
|
8
|
+
tsConfig?: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone-options.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/utils/standalone-options.ts"],"names":[],"mappings":""}
|
package/src/preset.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PresetProperty } from 'storybook/internal/types';
|
|
2
|
+
import { StorybookConfig } from './types';
|
|
3
|
+
export declare const core: PresetProperty<'core'>;
|
|
4
|
+
export declare const viteFinal: NonNullable<StorybookConfig['viteFinal']>;
|
|
5
|
+
export { addons, previewAnnotations } from '@storybook/angular/dist/preset.js';
|
package/src/preset.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.previewAnnotations = exports.addons = exports.viteFinal = exports.core = void 0;
|
|
37
|
+
const node_path_1 = require("node:path");
|
|
38
|
+
const preset_js_1 = require("@storybook/angular/dist/preset.js");
|
|
39
|
+
const getAbsolutePath = (input) => (0, node_path_1.dirname)(require.resolve((0, node_path_1.join)(input, 'package.json')));
|
|
40
|
+
const core = async (config, options) => {
|
|
41
|
+
const presetCore = preset_js_1.core(config, options);
|
|
42
|
+
return {
|
|
43
|
+
...presetCore,
|
|
44
|
+
builder: {
|
|
45
|
+
name: getAbsolutePath('@storybook/builder-vite'),
|
|
46
|
+
options: { ...presetCore.options },
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.core = core;
|
|
51
|
+
const viteFinal = async (config, options) => {
|
|
52
|
+
// Merge custom configuration into the default config
|
|
53
|
+
const { mergeConfig } = await Promise.resolve().then(() => __importStar(require('vite')));
|
|
54
|
+
const { default: angular } = await Promise.resolve().then(() => __importStar(require('@analogjs/vite-plugin-angular')));
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
const framework = await options.presets.apply('framework');
|
|
57
|
+
return mergeConfig(config, {
|
|
58
|
+
// Add dependencies to pre-optimization
|
|
59
|
+
optimizeDeps: {
|
|
60
|
+
include: [
|
|
61
|
+
'@storybook/angular/dist/client/index.js',
|
|
62
|
+
'@angular/compiler',
|
|
63
|
+
'@angular/platform-browser/animations',
|
|
64
|
+
'@storybook/addon-docs/angular',
|
|
65
|
+
'react/jsx-dev-runtime',
|
|
66
|
+
'@storybook/blocks',
|
|
67
|
+
'tslib',
|
|
68
|
+
'zone.js',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
plugins: [
|
|
72
|
+
angular({
|
|
73
|
+
jit: typeof framework.options?.jit !== 'undefined'
|
|
74
|
+
? framework.options?.jit
|
|
75
|
+
: true,
|
|
76
|
+
liveReload: typeof framework.options?.liveReload !== 'undefined'
|
|
77
|
+
? framework.options?.liveReload
|
|
78
|
+
: false,
|
|
79
|
+
tsconfig: options?.tsConfig ?? './.storybook/tsconfig.json',
|
|
80
|
+
}),
|
|
81
|
+
],
|
|
82
|
+
define: {
|
|
83
|
+
STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
|
|
84
|
+
experimentalZoneless: !!options?.angularBuilderOptions?.experimentalZoneless,
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
exports.viteFinal = viteFinal;
|
|
90
|
+
var preset_js_2 = require("@storybook/angular/dist/preset.js");
|
|
91
|
+
Object.defineProperty(exports, "addons", { enumerable: true, get: function () { return preset_js_2.addons; } });
|
|
92
|
+
Object.defineProperty(exports, "previewAnnotations", { enumerable: true, get: function () { return preset_js_2.previewAnnotations; } });
|
|
93
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/preset.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA0C;AAG1C,iEAAuE;AAKvE,MAAM,eAAe,GAAG,CAAmB,KAAQ,EAAK,EAAE,CACxD,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,IAAA,gBAAI,EAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAQ,CAAC;AAExD,MAAM,IAAI,GAA2B,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IACpE,MAAM,UAAU,GAAI,gBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExD,OAAO;QACL,GAAG,UAAU;QACb,OAAO,EAAE;YACP,IAAI,EAAE,eAAe,CAAC,yBAAyB,CAAC;YAChD,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE;SACnC;KACF,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,IAAI,QAUf;AAEK,MAAM,SAAS,GAA8C,KAAK,EACvE,MAAM,EACN,OAAoC,EACpC,EAAE;IACF,qDAAqD;IACrD,MAAM,EAAE,WAAW,EAAE,GAAG,wDAAa,MAAM,GAAC,CAAC;IAC7C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,wDAAa,+BAA+B,GAAC,CAAC;IAE3E,aAAa;IACb,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAM,WAAW,CAAC,CAAC;IAEhE,OAAO,WAAW,CAAC,MAAM,EAAE;QACzB,uCAAuC;QACvC,YAAY,EAAE;YACZ,OAAO,EAAE;gBACP,yCAAyC;gBACzC,mBAAmB;gBACnB,sCAAsC;gBACtC,+BAA+B;gBAC/B,uBAAuB;gBACvB,mBAAmB;gBACnB,OAAO;gBACP,SAAS;aACV;SACF;QACD,OAAO,EAAE;YACP,OAAO,CAAC;gBACN,GAAG,EACD,OAAO,SAAS,CAAC,OAAO,EAAE,GAAG,KAAK,WAAW;oBAC3C,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG;oBACxB,CAAC,CAAC,IAAI;gBACV,UAAU,EACR,OAAO,SAAS,CAAC,OAAO,EAAE,UAAU,KAAK,WAAW;oBAClD,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU;oBAC/B,CAAC,CAAC,KAAK;gBACX,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,4BAA4B;aAC5D,CAAC;SACH;QACD,MAAM,EAAE;YACN,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC;gBACxC,oBAAoB,EAClB,CAAC,CAAC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB;aACzD,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA7CW,QAAA,SAAS,aA6CpB;AAEF,+DAA+E;AAAtE,mGAAA,MAAM,OAAA;AAAE,+GAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@analogjs/vite-plugin-angular/setup-vitest';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@analogjs/vite-plugin-angular/setup-vitest");
|
|
4
|
+
const testing_1 = require("@angular/core/testing");
|
|
5
|
+
const testing_2 = require("@angular/platform-browser-dynamic/testing");
|
|
6
|
+
(0, testing_1.getTestBed)().initTestEnvironment(testing_2.BrowserDynamicTestingModule, (0, testing_2.platformBrowserDynamicTesting)());
|
|
7
|
+
//# sourceMappingURL=test-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/test-setup.ts"],"names":[],"mappings":";;AAAA,sDAAoD;AACpD,mDAAmD;AACnD,uEAGmD;AAEnD,IAAA,oBAAU,GAAE,CAAC,mBAAmB,CAC9B,qCAA2B,EAC3B,IAAA,uCAA6B,GAAE,CAChC,CAAC"}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CompatibleString } from 'storybook/internal/types';
|
|
2
|
+
import { StorybookConfig as StorybookConfigBase } from '@storybook/angular';
|
|
3
|
+
import { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
|
|
4
|
+
type FrameworkName = CompatibleString<'@analogjs/storybook-angular'>;
|
|
5
|
+
type BuilderName = CompatibleString<'@storybook/builder-vite'>;
|
|
6
|
+
export type FrameworkOptions = {
|
|
7
|
+
builder?: BuilderOptions;
|
|
8
|
+
jit?: boolean;
|
|
9
|
+
liveReload?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type StorybookConfigFramework = {
|
|
12
|
+
framework: FrameworkName | {
|
|
13
|
+
name: FrameworkName;
|
|
14
|
+
options: FrameworkOptions;
|
|
15
|
+
};
|
|
16
|
+
core?: StorybookConfigBase['core'] & {
|
|
17
|
+
builder?: BuilderName | {
|
|
18
|
+
name: BuilderName;
|
|
19
|
+
options: BuilderOptions;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
24
|
+
export type StorybookConfig = Omit<StorybookConfigBase, keyof StorybookConfigVite | keyof StorybookConfigFramework> & StorybookConfigVite & StorybookConfigFramework;
|
|
25
|
+
export {};
|
package/src/types.js
ADDED
package/src/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/types.ts"],"names":[],"mappings":""}
|