forgebook 0.3.0 → 0.3.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/README.md +14 -4
- package/dist/bin/forgebook/agents.md +2 -1
- package/dist/src/shell/SearchPanel.js +2 -3
- package/dist/src/shell/Shell.js +14 -5
- package/dist/src/shell/Sidebar.d.ts +8 -2
- package/dist/src/shell/Sidebar.js +3 -3
- package/dist/src/shell/SidebarHandle.d.ts +14 -1
- package/dist/src/shell/SidebarHandle.js +10 -0
- package/dist/src/shell/SidebarSearch.js +7 -4
- package/dist/src/shell/Toolbar.d.ts +6 -4
- package/dist/src/shell/Toolbar.js +3 -3
- package/dist/src/shell/shell.css +28 -1
- package/dist/src/shell/useSidebarLayout.d.ts +13 -3
- package/dist/src/shell/useSidebarLayout.js +43 -5
- package/dist/src/shell/useSidebarOverlay.d.ts +34 -0
- package/dist/src/shell/useSidebarOverlay.js +51 -0
- package/dist/src/storyMocks.d.ts +53 -0
- package/dist/src/storyMocks.js +208 -0
- package/dist/src/vite/docsExtractor.d.ts +8 -1
- package/dist/src/vite/docsExtractor.js +52 -10
- package/dist/src/vite/docsWorker.js +6 -1
- package/dist/src/vite/fileAccess.d.ts +33 -9
- package/dist/src/vite/fileAccess.js +107 -17
- package/dist/src/vite/forgebookPlugin.js +10 -6
- package/dist/src/vite/pluginIds.d.ts +15 -0
- package/dist/src/vite/pluginIds.js +23 -0
- package/package.json +9 -5
|
@@ -21,6 +21,21 @@ export declare const virtualId: (source: string) => string | undefined;
|
|
|
21
21
|
* @param id - the module's id.
|
|
22
22
|
*/
|
|
23
23
|
export declare const isGroupId: (id: string) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The group a project's module names for a group's module: the story files of their "Used in", reach, search index and
|
|
26
|
+
* texts, the docs pages of their search index. Those read the same files and only their group's module imports them, so
|
|
27
|
+
* a client that already holds the group's module needs no other import to have been seen.
|
|
28
|
+
*
|
|
29
|
+
* @param id - a group's module's id.
|
|
30
|
+
*/
|
|
31
|
+
export declare const namingGroupOf: (id: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a module's text names a group. Its transform must run for the plugin to see the import, so a cache of
|
|
34
|
+
* transforms must not keep it.
|
|
35
|
+
*
|
|
36
|
+
* @param code - the module's text.
|
|
37
|
+
*/
|
|
38
|
+
export declare const namesGroup: (code: string) => boolean;
|
|
24
39
|
/** The resolved id of the configuration's data module. */
|
|
25
40
|
export declare const CONFIG_ID = "\0virtual:forgebook/config";
|
|
26
41
|
/** The resolved id of the design tokens' module. */
|
|
@@ -70,6 +70,29 @@ export const virtualId = (source) => {
|
|
|
70
70
|
* @param id - the module's id.
|
|
71
71
|
*/
|
|
72
72
|
export const isGroupId = (id) => VIRTUAL_PREFIXES.some((prefix) => id.startsWith(`\0${prefix}`));
|
|
73
|
+
/** The modules that read a group of story files' own files: named once its story files are. */
|
|
74
|
+
const STORY_FILES_READERS = [USAGE_PREFIX, REACH_PREFIX, SEARCH_PREFIX, TEXTS_PREFIX];
|
|
75
|
+
/**
|
|
76
|
+
* The group a project's module names for a group's module: the story files of their "Used in", reach, search index and
|
|
77
|
+
* texts, the docs pages of their search index. Those read the same files and only their group's module imports them, so
|
|
78
|
+
* a client that already holds the group's module needs no other import to have been seen.
|
|
79
|
+
*
|
|
80
|
+
* @param id - a group's module's id.
|
|
81
|
+
*/
|
|
82
|
+
export const namingGroupOf = (id) => {
|
|
83
|
+
const pagesSearch = `\0${PAGES_SEARCH_PREFIX}`;
|
|
84
|
+
if (id.startsWith(pagesSearch))
|
|
85
|
+
return `${DOCS_PAGES_PREFIX}${id.slice(pagesSearch.length)}`;
|
|
86
|
+
const reader = STORY_FILES_READERS.map((prefix) => `\0${prefix}`).find((mark) => id.startsWith(mark));
|
|
87
|
+
return reader === undefined ? id : `${FILES_PREFIX}${id.slice(reader.length)}`;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Whether a module's text names a group. Its transform must run for the plugin to see the import, so a cache of
|
|
91
|
+
* transforms must not keep it.
|
|
92
|
+
*
|
|
93
|
+
* @param code - the module's text.
|
|
94
|
+
*/
|
|
95
|
+
export const namesGroup = (code) => [FILES_QUERY, DOCS_PAGES_QUERY, ...VIRTUAL_PREFIXES].some((name) => code.includes(name));
|
|
73
96
|
/** The resolved id of the configuration's data module. */
|
|
74
97
|
export const CONFIG_ID = `\0${CONFIG_MODULE}`;
|
|
75
98
|
/** The resolved id of the design tokens' module. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forgebook",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "See every component in every theme, contrast, language and width: CSF stories, one frame per story, and a props table from the components' types.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -232,6 +232,10 @@
|
|
|
232
232
|
"./code-literal": {
|
|
233
233
|
"types": "./dist/src/codeLiteral.d.ts",
|
|
234
234
|
"default": "./dist/src/codeLiteral.js"
|
|
235
|
+
},
|
|
236
|
+
"./story-mocks": {
|
|
237
|
+
"types": "./dist/src/storyMocks.d.ts",
|
|
238
|
+
"default": "./dist/src/storyMocks.js"
|
|
235
239
|
}
|
|
236
240
|
},
|
|
237
241
|
"dependencies": {
|
|
@@ -240,7 +244,7 @@
|
|
|
240
244
|
"lightningcss": "1.33.0",
|
|
241
245
|
"marked": "18.1.0",
|
|
242
246
|
"typescript-6": "npm:typescript@6.0.3",
|
|
243
|
-
"@forgebook/story-format": "0.2.
|
|
247
|
+
"@forgebook/story-format": "0.2.3"
|
|
244
248
|
},
|
|
245
249
|
"peerDependencies": {
|
|
246
250
|
"@testing-library/dom": "^10.4.0",
|
|
@@ -248,7 +252,7 @@
|
|
|
248
252
|
"react": "^19.0.0",
|
|
249
253
|
"react-dom": "^19.0.0",
|
|
250
254
|
"sass-embedded": "^1.80.0",
|
|
251
|
-
"vite": "^8.
|
|
255
|
+
"vite": "^8.3.4"
|
|
252
256
|
},
|
|
253
257
|
"devDependencies": {
|
|
254
258
|
"@testing-library/dom": "10.4.2",
|
|
@@ -262,8 +266,8 @@
|
|
|
262
266
|
"sass-embedded": "1.106.1",
|
|
263
267
|
"vite": "8.3.5",
|
|
264
268
|
"vitest": "5.0.5",
|
|
265
|
-
"@forgebook/
|
|
266
|
-
"@forgebook/
|
|
269
|
+
"@forgebook/typescript-config": "0.0.0",
|
|
270
|
+
"@forgebook/tools": "0.0.0"
|
|
267
271
|
},
|
|
268
272
|
"peerDependenciesMeta": {
|
|
269
273
|
"@testing-library/dom": {
|