@asd14/vblocks 6.4.0 → 7.1.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.
@@ -0,0 +1,321 @@
1
+ # Reference - @asd14/vblocks
2
+
3
+ ## Table of contents
4
+
5
+ <!-- vim-markdown-toc GFM -->
6
+
7
+ - [Domain Vocabulary](#domain-vocabulary)
8
+ - [Commands](#commands)
9
+ - [`vblocks`](#vblocks)
10
+ - [`vblocks init`](#vblocks-init)
11
+ - [`vblocks serve`](#vblocks-serve)
12
+ - [`vblocks build`](#vblocks-build)
13
+ - [`vblocks eject`](#vblocks-eject)
14
+ - [Templates](#templates)
15
+ - [Environment variables](#environment-variables)
16
+
17
+ <!-- vim-markdown-toc -->
18
+
19
+ ## Domain Vocabulary
20
+
21
+ | Term | Means |
22
+ | :----------------- | :------------------------------------------------------------------------------------- |
23
+ | **Plumbing** | `package.json` and `.gitignore`, for the project folder |
24
+ | **App** | `src/`, `.env.example`, `tsconfig.json` and the template's configs, for the app folder |
25
+ | **Template** | A named set of files that `init` writes, eg. `plain` |
26
+ | **Project folder** | The folder with `package.json` |
27
+ | **App folder** | The folder with `src/index.tsx` and `src/index.html` |
28
+
29
+ ## Commands
30
+
31
+ ### `vblocks`
32
+
33
+ Zero-config React builds of an SPA (single-page application), as a folder or a
34
+ single HTML file
35
+
36
+ ```text
37
+ vblocks <command> [OPTIONS]
38
+ vblocks -h | --help
39
+ ```
40
+
41
+ <details>
42
+ <summary>Example, inputs, exit codes</summary>
43
+
44
+ ```sh
45
+ npx @asd14/vblocks init my-app
46
+ npx vblocks serve --help
47
+ ```
48
+
49
+ | Name | Description |
50
+ | :------------- | :----------------------------------------------- |
51
+ | `command` | `init`: Write a template into a folder |
52
+ | | `serve`: Start the development server of an app |
53
+ | | `build`: Build an app into `dist/` in its folder |
54
+ | | `eject`: Print a default config of VBlocks |
55
+ | `-h`, `--help` | Print this help |
56
+
57
+ | Exit code | Means |
58
+ | :-------- | :-------------------------------- |
59
+ | `0` | Done |
60
+ | `2` | No command, or an unknown command |
61
+
62
+ - Each command prints its own help with `--help`.
63
+
64
+ See also: [`vblocks init`](#vblocks-init), [`vblocks serve`](#vblocks-serve),
65
+ [`vblocks build`](#vblocks-build), [`vblocks eject`](#vblocks-eject)
66
+
67
+ </details>
68
+
69
+ ### `vblocks init`
70
+
71
+ Write a template into a folder
72
+
73
+ ```text
74
+ vblocks init <folder>
75
+ [--template <name>]
76
+ [--only <app|plumbing>]
77
+ vblocks init --list
78
+ ```
79
+
80
+ <details>
81
+ <summary>Example, inputs, exit codes</summary>
82
+
83
+ ```sh
84
+ npx @asd14/vblocks init my-app
85
+ npx @asd14/vblocks init --list
86
+ npx @asd14/vblocks init demos --only plumbing
87
+ npx @asd14/vblocks init demos/flow --template xyflow --only app
88
+ ```
89
+
90
+ | Name | Default | Description |
91
+ | :------------------ | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | `folder` | | The folder to write into, missing or empty |
93
+ | `--template <name>` | `plain` | The template, one of the names `--list` prints. See [Templates](#templates) |
94
+ | `--list` | | Print the templates, one per line |
95
+ | `--only <part>` | both | Write only the app or only the plumbing. With app, `init` adds the template's dependencies to the `package.json` of the project folder, the parent of `<folder>`. That `package.json` must exist |
96
+ | `-h`, `--help` | | Print this help |
97
+
98
+ | Exit code | Means |
99
+ | :-------- | :--------------------------------------------------------------------------------------------------------------------------------- |
100
+ | `0` | Done |
101
+ | `2` | Invalid usage, an unknown template, or a `<folder>` that is a file or not empty |
102
+ | `3` | Could not run: a missing tool, no `package.json` in the project folder, a folder `init` could not create, or a failed copy or hook |
103
+
104
+ A template has two parts:
105
+
106
+ | Part | Writes |
107
+ | :--------- | :------------------------------------------------------------------------------------- |
108
+ | `plumbing` | `package.json` and `.gitignore`, for the project folder |
109
+ | `app` | `src/`, `.env.example`, `tsconfig.json` and the template's configs, for the app folder |
110
+
111
+ `init` writes each part into its folder, then runs the part's post-init hooks in
112
+ `<folder>`. `template/<name>/README.md`, in the VBlocks folder, lists the files
113
+ and hooks of each template.
114
+
115
+ Print the project folder, each file `init` creates, updates or deletes, then the
116
+ next step.
117
+
118
+ See also: [`vblocks`](#vblocks), [`vblocks serve`](#vblocks-serve), `node`,
119
+ `npm`
120
+
121
+ </details>
122
+
123
+ ### `vblocks serve`
124
+
125
+ Start the development server of an app
126
+
127
+ ```text
128
+ vblocks serve
129
+ [--mode <development|production>]
130
+ [--prefix <folder>]
131
+ [--analyze]
132
+ [--log-level <error|warn|info|verbose>]
133
+ [-- <webpack option>...]
134
+ ```
135
+
136
+ <details>
137
+ <summary>Example, inputs, exit codes</summary>
138
+
139
+ ```sh
140
+ npx vblocks serve
141
+ npx vblocks serve --prefix flow -- --host 0.0.0.0
142
+ npx vblocks serve -- --port 8099 --no-open
143
+ ```
144
+
145
+ | Name | Default | Description |
146
+ | :----------------------- | :----------------- | :----------------------------------------------------------------------------------------------------------------------- |
147
+ | `--mode <mode>` | `development` | The Webpack mode, `development` or `production` |
148
+ | `--prefix <folder>` | the current folder | The app folder, which must exist |
149
+ | `--analyze` | | Run the bundle analyzer, on a free port. An ejected `webpack.config.js` runs the analyzer only if it reads `env.analyze` |
150
+ | `--log-level <level>` | `warn` | How much Webpack and its development server print: `error`, `warn`, `info` or `verbose` |
151
+ | `-- <webpack option>...` | | Pass each option to Webpack, unchanged |
152
+ | `-h`, `--help` | | Print this help |
153
+
154
+ | Exit code | Means |
155
+ | :-------- | :----------------------------------------------------------------------------------------------- |
156
+ | `0` | Done |
157
+ | `2` | Invalid usage, Webpack rejected an option or the config, or browserslist could not read a config |
158
+ | `3` | Could not run: a missing tool, or a failed Webpack run |
159
+
160
+ The app folder contains `src/index.tsx` and `src/index.html`. A config in it,
161
+ `webpack.config.js`, `postcss.config.js`, `.swcrc` or `.browserslistrc`,
162
+ replaces the VBlocks default of the same name. So do `src/public/robots.txt` and
163
+ `src/public/favicon.svg`.
164
+
165
+ Print the app folder, the VBlocks folder, the files Webpack runs with and the
166
+ source of the browsers, then start the server.
167
+
168
+ SWC, Webpack and `postcss-preset-env` compile for the browsers of the app's
169
+ browserslist config. browserslist reads `BROWSERSLIST`, `BROWSERSLIST_CONFIG`,
170
+ then a `.browserslistrc` or the `browserslist` field of `package.json`, from the
171
+ app folder up. Without any of them, browserslist reads the VBlocks default,
172
+ `defaults/.browserslistrc`.
173
+
174
+ The server runs at `http://localhost:8080`, or the next free port. It opens the
175
+ page in the browser. It listens on `localhost`, so another device cannot open
176
+ the page. Pass `-- --host 0.0.0.0` to expose it to the network.
177
+
178
+ See also: [`vblocks`](#vblocks), [`vblocks build`](#vblocks-build),
179
+ [`vblocks eject`](#vblocks-eject), `webpack`
180
+
181
+ </details>
182
+
183
+ ### `vblocks build`
184
+
185
+ Build an app into `dist/` in its folder
186
+
187
+ ```text
188
+ vblocks build
189
+ [--mode <development|production>]
190
+ [--prefix <folder>]
191
+ [--single-file|--single]
192
+ [--log-level <error|warn|info|verbose>]
193
+ [-- <webpack option>...]
194
+ ```
195
+
196
+ <details>
197
+ <summary>Example, inputs, exit codes</summary>
198
+
199
+ ```sh
200
+ npx vblocks build
201
+ cd demos && npx vblocks build --prefix flow --single-file
202
+ npx vblocks build -- --devtool source-map
203
+ ```
204
+
205
+ | Name | Default | Description |
206
+ | :-------------------------- | :----------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
207
+ | `--mode <mode>` | `production` | The Webpack mode, `development` or `production` |
208
+ | `--prefix <folder>` | the current folder | The app folder, which must exist |
209
+ | `--single-file`, `--single` | | Build one standalone `dist/index.html`, every asset inlined, with no `robots.txt`. A browser opens it from disk. There, `history.pushState` to another path throws, so keep the route in the URL hash. An ejected `webpack.config.js` builds one file only if it reads `env.single` |
210
+ | `--log-level <level>` | `warn` | How much Webpack prints: `error`, `warn`, `info` or `verbose` |
211
+ | `-- <webpack option>...` | | Pass each option to Webpack, unchanged |
212
+ | `-h`, `--help` | | Print this help |
213
+
214
+ | Exit code | Means |
215
+ | :-------- | :----------------------------------------------------------------------------------------------- |
216
+ | `0` | Done |
217
+ | `2` | Invalid usage, Webpack rejected an option or the config, or browserslist could not read a config |
218
+ | `3` | Could not run: a missing tool, or a failed Webpack run |
219
+
220
+ The app folder contains `src/index.tsx` and `src/index.html`. A config in it,
221
+ `webpack.config.js`, `postcss.config.js`, `.swcrc` or `.browserslistrc`,
222
+ replaces the VBlocks default of the same name. So do `src/public/robots.txt` and
223
+ `src/public/favicon.svg`.
224
+
225
+ Print the app folder, the VBlocks folder, the files Webpack runs with and the
226
+ source of the browsers, then build. Print each file in `dist/`, its size and the
227
+ total.
228
+
229
+ SWC, Webpack and `postcss-preset-env` compile for the browsers of the app's
230
+ browserslist config. browserslist reads `BROWSERSLIST`, `BROWSERSLIST_CONFIG`,
231
+ then a `.browserslistrc` or the `browserslist` field of `package.json`, from the
232
+ app folder up. Without any of them, browserslist reads the VBlocks default,
233
+ `defaults/.browserslistrc`.
234
+
235
+ Without `--single-file`, `dist/` contains:
236
+
237
+ ```text
238
+ index.html
239
+ favicon.svg
240
+ robots.txt
241
+ js/main.<hash>.js
242
+ js/react.<hash>.js react and react-dom
243
+ js/vendors.<hash>.js the rest of node_modules
244
+ js/*.LICENSE.txt the license comments of each chunk
245
+ css/main.<hash>.css
246
+ fonts/<name>.<ext> each font
247
+ <hash>.<ext> each image over 10 KiB
248
+ ```
249
+
250
+ Webpack inlines an image up to 10 KiB. It splits `react` and `vendors` out of
251
+ `main`, so the browser keeps them cached across builds.
252
+
253
+ See also: [`vblocks`](#vblocks), [`vblocks serve`](#vblocks-serve),
254
+ [`vblocks eject`](#vblocks-eject), `webpack`
255
+
256
+ </details>
257
+
258
+ ### `vblocks eject`
259
+
260
+ Print a default config of VBlocks
261
+
262
+ ```text
263
+ vblocks eject <config>
264
+ ```
265
+
266
+ <details>
267
+ <summary>Example, inputs, exit codes</summary>
268
+
269
+ ```sh
270
+ npx vblocks eject postcss > postcss.config.js
271
+ ```
272
+
273
+ | Name | Description |
274
+ | :------------- | :------------------------------------------- |
275
+ | `config` | `webpack`: Save it as `webpack.config.js` |
276
+ | | `postcss`: Save it as `postcss.config.js` |
277
+ | | `swc`: Save it as `.swcrc` |
278
+ | | `browserslist`: Save it as `.browserslistrc` |
279
+ | `-h`, `--help` | Print this help |
280
+
281
+ | Exit code | Means |
282
+ | :-------- | :------------ |
283
+ | `0` | Done |
284
+ | `2` | Invalid usage |
285
+
286
+ `eject` prints the config to stdout. Save it in the app folder. `serve` and
287
+ `build` then run with it in place of the VBlocks default.
288
+
289
+ An ejected config loads its plugins and loaders from the project folder, not
290
+ from VBlocks. Install them there. `serve` and `build` still run the
291
+ `webpack-cli`, `webpack` and `webpack-dev-server` of VBlocks.
292
+
293
+ See also: [`vblocks`](#vblocks), [`vblocks serve`](#vblocks-serve),
294
+ [`vblocks build`](#vblocks-build)
295
+
296
+ </details>
297
+
298
+ ## Templates
299
+
300
+ ```sh
301
+ npx @asd14/vblocks init --list
302
+ # => plain
303
+ # => xyflow
304
+ # => xyflow-tabs
305
+ ```
306
+
307
+ Each template starts from [the common files](../template/_common/README.md).
308
+
309
+ | Template | Description |
310
+ | :------------------------------------------------- | :------------------------------------------------------------- |
311
+ | [`plain`](../template/plain/README.md) | A "Hello World!" heading. |
312
+ | [`xyflow`](../template/xyflow/README.md) | One diagram, and a details panel for the selected node or edge |
313
+ | [`xyflow-tabs`](../template/xyflow-tabs/README.md) | One tab per diagram, each with its own details panel |
314
+
315
+ ## Environment variables
316
+
317
+ | Name | Values | Default | Description |
318
+ | :-------------------- | :------------------- | :------ | :----------------------------------------------------------------------------------------------------------------- |
319
+ | `NO_COLOR` | non-empty | | `init`: print without color or the header. `serve`, `build`: print without color, the icons or the header |
320
+ | `BROWSERSLIST` | a browserslist query | | `serve`, `build`: the browsers, as a browserslist query. It overrides every config file |
321
+ | `BROWSERSLIST_CONFIG` | a file path | | `serve`, `build`: the path of a browserslist config, in place of the one browserslist finds from the app folder up |
@@ -0,0 +1,43 @@
1
+ # 01. Resolve each dependency from the VBlocks folder
2
+
3
+ **Date**: 2026-11-11
4
+
5
+ **Independent facts**:
6
+
7
+ - Node resolves a package name from the folder of the file that imports it, then
8
+ from each parent folder
9
+ - npm nests or hoists each dependency a package declares, to reduce module
10
+ duplication, in a way that Node still resolves the right version from the
11
+ package's folder
12
+ - npm does not install an optional peer, one marked in `peerDependenciesMeta`.
13
+ When another package installs it, npm does not place that copy within reach of
14
+ the package that declares the peer
15
+ - Webpack resolves a loader named by a string from the folder the command runs
16
+ in, not from its own folder
17
+
18
+ **Problem**:
19
+
20
+ - `webpack-cli` declares `webpack-dev-server` only as an optional peer
21
+ - In an npm workspace, npm can nest `webpack-dev-server` under VBlocks and hoist
22
+ `webpack-cli` to the root. `vblocks serve` then fails: `webpack-cli` cannot
23
+ resolve `webpack-dev-server`, and asks to install it
24
+ - The loaders of the default Webpack config, eg. `swc-loader`, can fail the same
25
+ way
26
+
27
+ **Solution**:
28
+
29
+ - `vblocks serve` and `vblocks build` resolve `webpack-cli`, `webpack` and
30
+ `webpack-dev-server` from the VBlocks folder, so they run the versions VBlocks
31
+ declares
32
+ - The default Webpack config resolves its loaders, and the packages SWC adds to
33
+ app files, eg. `@swc/helpers`, from the VBlocks folder too
34
+ - VBlocks declares `@swc/core`, to choose the compiler that matches its
35
+ `@swc/helpers`
36
+
37
+ **Acknowledgments**:
38
+
39
+ - `swc-loader` loads `@swc/core` from its own folder, and the React Refresh
40
+ plugin loads `react-refresh` from its own. Neither takes the package as an
41
+ option, so each can load another copy than VBlocks'
42
+ - An ejected `webpack.config.js` resolves from the app folder, which declares
43
+ VBlocks, not the loaders. They resolve only when npm hoists them there
@@ -0,0 +1,36 @@
1
+ # 02. Read the browsers from the browserslist config
2
+
3
+ **Date**: 2026-11-15
4
+
5
+ **Independent facts**:
6
+
7
+ - SWC, Webpack and `postcss-preset-env` read the browsers in the same order: the
8
+ `BROWSERSLIST` variable, the `BROWSERSLIST_CONFIG` file, then the nearest
9
+ `.browserslistrc` or `browserslist` field of `package.json`, from a given
10
+ folder up
11
+ - Without any of them, SWC keeps the syntax as written, Webpack stops with an
12
+ error, and `postcss-preset-env` uses the defaults of browserslist
13
+
14
+ **Problem**:
15
+
16
+ - VBlocks gave SWC and Webpack the query of its default `.swcrc`,
17
+ `> 0.25%, not dead`
18
+ - VBlocks gave `postcss-preset-env` no query, so it compiled the CSS for the
19
+ defaults of browserslist, `> 0.5%, last 2 versions, Firefox ESR, not dead`
20
+ - An app that picked other browsers had to set them in two places: `env.targets`
21
+ of `.swcrc`, and a browserslist config for `postcss-preset-env`
22
+
23
+ **Solution**:
24
+
25
+ - The app's browserslist config sets the browsers of SWC, Webpack and
26
+ `postcss-preset-env`. Each tool reads it from the app folder up
27
+ - Without one, `serve` and `build` give the three tools the VBlocks default,
28
+ `> 0.25%, not dead`. The old default `.swcrc` set the same query
29
+ - `vblocks eject browserslist` prints the default, to copy into the app
30
+
31
+ **Acknowledgments**:
32
+
33
+ - An app's `.swcrc` that sets `env.targets` overrides the browserslist config,
34
+ for SWC only
35
+ - Run outside VBlocks, eg. by `npx webpack`, the three tools get no default
36
+ browserslist config
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@asd14/vblocks",
4
- "version": "6.4.0",
5
- "description": "Zero-config React builds, as a static site or a single HTML file",
4
+ "version": "7.1.0",
5
+ "description": "Zero-config React builds of an SPA (single-page application), as a folder or a single HTML file",
6
6
  "keywords": [
7
7
  "react",
8
8
  "webpack",
@@ -33,8 +33,10 @@
33
33
  "url": "git+https://github.com/asd-xiv/vblocks.git"
34
34
  },
35
35
  "files": [
36
+ ".sh41/skills",
36
37
  "bin",
37
38
  "defaults",
39
+ "docs",
38
40
  "template",
39
41
  "types"
40
42
  ],
@@ -57,33 +59,33 @@
57
59
  "typecheck:code": "tsc --noEmit --project ./.tsconfig/code.json",
58
60
  "typecheck:client-types": "tsc --noEmit --project ./.tsconfig/client-types.json",
59
61
  "typecheck": "npm run typecheck:code && npm run typecheck:client-types",
60
- "unit-test:template": "tools/verify-templates",
61
- "unit-test": "npm run unit-test:template"
62
+ "unit-test": "tools/verify-templates"
62
63
  },
63
64
  "dependencies": {
64
65
  "@asd14/fancy-logger": "^2.0.0",
65
66
  "@mdx-js/loader": "^3.1.1",
66
67
  "@pmmmwh/react-refresh-webpack-plugin": "^0.6.3",
68
+ "@swc/core": "^1.16.22",
67
69
  "@swc/helpers": "^0.5.24",
68
- "browserslist": "^4.29.5",
70
+ "browserslist": "^4.29.6",
69
71
  "copy-webpack-plugin": "^14.0.0",
70
72
  "css-loader": "^7.1.5",
71
73
  "cssnano": "^9.9.0",
72
74
  "dotenv-webpack": "^9.0.0",
73
75
  "html-webpack-plugin": "^5.6.8",
74
76
  "mini-css-extract-plugin": "^2.10.2",
75
- "postcss": "^8.5.32",
77
+ "postcss": "^8.5.33",
76
78
  "postcss-loader": "^8.2.1",
77
- "postcss-preset-env": "^11.6.2",
79
+ "postcss-preset-env": "^11.6.3",
78
80
  "react-refresh": "^0.19.0",
79
81
  "swc-loader": "^0.2.7",
80
82
  "webpack": "^5.112.2",
81
- "webpack-bundle-analyzer": "^5.4.2",
83
+ "webpack-bundle-analyzer": "^5.4.3",
82
84
  "webpack-cli": "^7.3.1",
83
85
  "webpack-dev-server": "^6.1.0"
84
86
  },
85
87
  "devDependencies": {
86
- "@asd14/eslint-config": "^16.3.0",
88
+ "@asd14/eslint-config": "^17.0.0",
87
89
  "@asd14/prettier-config": "^1.5.0",
88
90
  "@asd14/semantic-release-config": "^1.1.0",
89
91
  "@asd14/ts-config": "^2.0.0",
@@ -97,7 +99,7 @@
97
99
  "@xyflow/react": "^12.12.1",
98
100
  "agentation": "^3.1.2",
99
101
  "eslint": "^9.39.5",
100
- "prettier": "^3.9.10",
102
+ "prettier": "^3.10.1",
101
103
  "semantic-release": "^25.0.9",
102
104
  "tailwindcss": "^4.3.5",
103
105
  "typescript": "^6.0.3"
@@ -0,0 +1,49 @@
1
+ # _common
2
+
3
+ `vblocks init` copies these files before the template's own. A template's file
4
+ of the same path replaces the common one.
5
+
6
+ `vblocks init` runs each common hook, then the template's hook of the same name.
7
+ The template's hook does not replace the common one.
8
+
9
+ ## Plumbing
10
+
11
+ The files of the [project folder](../../docs/REFERENCE.md#domain-vocabulary):
12
+
13
+ ```text
14
+ package.json # the scripts, React and TypeScript
15
+ _gitignore # node_modules, dist and .env
16
+ ```
17
+
18
+ **Hooks**:
19
+
20
+ 1. [`post-init-plumbing.sh`](post-init-plumbing.sh) runs in the project folder,
21
+ after the copy:
22
+ - Renames `_gitignore` to `.gitignore`. npm leaves every `.gitignore` out of
23
+ the published VBlocks package
24
+ - Sets the `name` in `package.json` to the name of the project folder
25
+ - Sets `devDependencies.@asd14/vblocks` to the version that runs `init`
26
+
27
+ ## App
28
+
29
+ The files of the [app folder](../../docs/REFERENCE.md#domain-vocabulary):
30
+
31
+ ```text
32
+ src/
33
+ ├── index.tsx # mounts App, and the Agentation toolbar in development.
34
+ │ # App comes from ./index.app.tsx, which each template adds
35
+ ├── index.html # the #root element
36
+ └── index.css # the global CSS, a Webpack entry of its own
37
+ .env.example # AGENTATION_ENDPOINT, commented out
38
+ tsconfig.json # extends @asd14/ts-config, maps @self/* to src/*
39
+ ```
40
+
41
+ - Put each concern that `src/index.tsx` imports in its own
42
+ `src/index.<concern>.tsx`, eg. `index.app.tsx` defines `App`
43
+
44
+ **Hooks**:
45
+
46
+ 1. [`post-init-app.sh`](post-init-app.sh) runs in the app folder, after the
47
+ copy:
48
+ - Adds `agentation` to the `devDependencies` of the nearest `package.json`,
49
+ the one of the project folder
@@ -1,5 +1,5 @@
1
1
  # Copy this file to .env, then set the values. Never commit .env
2
2
 
3
3
  # The URL of the agentation-mcp server. If unset, the Agentation toolbar keeps
4
- # its notes only in the browser, and you copy them by hand
4
+ # its annotations only in the browser, and you copy them by hand
5
5
  # AGENTATION_ENDPOINT=http://localhost:4747
@@ -0,0 +1,19 @@
1
+ # plain
2
+
3
+ A "Hello World!" heading.
4
+
5
+ ## App
6
+
7
+ The files of the [app folder](../../docs/REFERENCE.md#domain-vocabulary), next
8
+ to [the common ones](../_common/README.md#app):
9
+
10
+ ```text
11
+ src/
12
+ └── index.app.tsx # App: a "Hello World!" heading
13
+ ```
14
+
15
+ **Hooks**:
16
+
17
+ 1. [`post-init-app.sh`](post-init-app.sh) runs in the app folder, after the
18
+ copy:
19
+ - Sets the page title in `src/index.html` to `Hello World :: VBlocks`
@@ -0,0 +1,28 @@
1
+ # xyflow
2
+
3
+ One diagram, and a details panel for the selected node or edge.
4
+
5
+ ## App
6
+
7
+ The files of the [app folder](../../docs/REFERENCE.md#domain-vocabulary), next
8
+ to [the common ones](../_common/README.md#app):
9
+
10
+ ```text
11
+ src/
12
+ ├── index.app.tsx # App: the header, diagram and details panel, and the selected id
13
+ ├── diagram.tsx # the nodes and edges, placed and sized in grid cells
14
+ ├── details.tsx # the panel for the selected node or edge
15
+ ├── utils/grid.ts # CELL_SIZE and toPixels
16
+ └── index.css # replaces the common one: Tailwind and the xyflow styles
17
+ postcss.config.js # replaces the VBlocks default: Tailwind, and cssnano in production
18
+ ```
19
+
20
+ **Hooks**:
21
+
22
+ 1. [`post-init-app.sh`](post-init-app.sh) runs in the app folder, after the
23
+ copy:
24
+ - Adds `@xyflow/react` to the `dependencies` of the nearest `package.json`,
25
+ the one of the [project folder](../../docs/REFERENCE.md#domain-vocabulary)
26
+ - Adds `tailwindcss`, `@tailwindcss/postcss` and `cssnano` to its
27
+ `devDependencies`
28
+ - Sets the page title in `src/index.html` to `xyflow :: VBlocks`
@@ -0,0 +1,33 @@
1
+ # xyflow-tabs
2
+
3
+ One tab per diagram, each with its own details panel.
4
+
5
+ ## App
6
+
7
+ The files of the [app folder](../../docs/REFERENCE.md#domain-vocabulary), next
8
+ to [the common ones](../_common/README.md#app):
9
+
10
+ ```text
11
+ src/
12
+ ├── index.app.tsx # App: the header, tab bar and details panel, and the selected id
13
+ ├── pages/
14
+ │ ├── build/
15
+ │ │ ├── diagram.tsx # the nodes and edges of one tab, placed and sized in grid cells
16
+ │ │ └── details.tsx # the panel for its selected node or edge
17
+ │ └── serve/ # the same two files
18
+ ├── ui/zoom-level.tsx # the zoom of the diagram, as a percentage, and a button
19
+ │ # that centers the diagram at 100%
20
+ ├── utils/grid.ts # CELL_SIZE and toPixels
21
+ └── index.css # replaces the common one: Tailwind and the xyflow styles
22
+ postcss.config.js # replaces the VBlocks default: Tailwind, and cssnano in production
23
+ ```
24
+
25
+ **Hooks**:
26
+
27
+ 1. [`post-init-app.sh`](post-init-app.sh) runs in the app folder, after the
28
+ copy:
29
+ - Adds `@xyflow/react` to the `dependencies` of the nearest `package.json`,
30
+ the one of the [project folder](../../docs/REFERENCE.md#domain-vocabulary)
31
+ - Adds `tailwindcss`, `@tailwindcss/postcss` and `cssnano` to its
32
+ `devDependencies`
33
+ - Sets the page title in `src/index.html` to `xyflow-tabs :: VBlocks`
package/types/client.d.ts CHANGED
@@ -8,12 +8,9 @@
8
8
 
9
9
  declare module "*.module.css" {
10
10
  /**
11
- * Class names by their camelCase key, `.my-class` is `styles.myClass`.
12
- *
13
- * Typed `any` so `styles.myClass` passes `noPropertyAccessFromIndexSignature`.
11
+ * Class names by their camelCase key, eg. `styles["myClass"]` for `.my-class`.
14
12
  */
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- const classNames: any
13
+ const classNames: { readonly [key: string]: string }
17
14
 
18
15
  export default classNames
19
16
  }
@@ -74,6 +71,25 @@ declare module "*.eot" {
74
71
  export default url
75
72
  }
76
73
 
74
+ /**
75
+ * The Markdown document as a React component. VBlocks compiles `.md` with MDX,
76
+ * so it takes the same `components` as an `.mdx` import.
77
+ *
78
+ * @example
79
+ * import Notes from "./notes.md"
80
+ *
81
+ * <Notes components={{ h1: Title }} />
82
+ */
83
+ declare module "*.md" {
84
+ import type { ComponentType } from "react"
85
+
86
+ const MDXContent: ComponentType<{
87
+ components?: Record<string, ComponentType<Record<string, unknown>>>
88
+ }>
89
+
90
+ export default MDXContent
91
+ }
92
+
77
93
  /**
78
94
  * The MDX document as a React component. `components` replaces the element
79
95
  * MDX renders for a tag, eg. `{ h1: Title }`.