@fuzdev/fuz_ui 0.206.6 → 0.206.8
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 +3 -3
- package/dist/Alert.svelte +21 -25
- package/dist/Alert.svelte.d.ts.map +1 -1
- package/dist/ApiDeclarationList.svelte +2 -2
- package/dist/ApiDeclarationList.svelte.d.ts.map +1 -1
- package/dist/ApiIndex.svelte +4 -4
- package/dist/ApiIndex.svelte.d.ts.map +1 -1
- package/dist/ApiModule.svelte +13 -10
- package/dist/ApiModule.svelte.d.ts.map +1 -1
- package/dist/ApiModulesList.svelte +2 -2
- package/dist/ApiModulesList.svelte.d.ts.map +1 -1
- package/dist/Breadcrumb.svelte +31 -19
- package/dist/Breadcrumb.svelte.d.ts.map +1 -1
- package/dist/Card.svelte +17 -17
- package/dist/Card.svelte.d.ts.map +1 -1
- package/dist/ColorSchemeInput.svelte +6 -6
- package/dist/ColorSchemeInput.svelte.d.ts.map +1 -1
- package/dist/Contextmenu.svelte +6 -4
- package/dist/Contextmenu.svelte.d.ts.map +1 -1
- package/dist/ContextmenuEntry.svelte +8 -8
- package/dist/ContextmenuEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuIcon.svelte +3 -3
- package/dist/ContextmenuIcon.svelte.d.ts.map +1 -1
- package/dist/ContextmenuLinkEntry.svelte +14 -14
- package/dist/ContextmenuLinkEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuMenu.svelte +10 -10
- package/dist/ContextmenuMenu.svelte.d.ts.map +1 -1
- package/dist/ContextmenuRoot.svelte +7 -7
- package/dist/ContextmenuRootForSafariCompatibility.svelte +15 -15
- package/dist/ContextmenuSeparator.svelte +2 -2
- package/dist/ContextmenuSubmenu.svelte +15 -12
- package/dist/ContextmenuSubmenu.svelte.d.ts.map +1 -1
- package/dist/ContextmenuTextEntry.svelte +4 -4
- package/dist/ContextmenuTextEntry.svelte.d.ts.map +1 -1
- package/dist/CopyToClipboard.svelte +7 -7
- package/dist/CopyToClipboard.svelte.d.ts.map +1 -1
- package/dist/DeclarationDetail.svelte +35 -28
- package/dist/DeclarationDetail.svelte.d.ts.map +1 -1
- package/dist/DeclarationLink.svelte +7 -7
- package/dist/DeclarationLink.svelte.d.ts.map +1 -1
- package/dist/Details.svelte +3 -3
- package/dist/Details.svelte.d.ts.map +1 -1
- package/dist/Dialog.svelte +7 -7
- package/dist/Dialog.svelte.d.ts.map +1 -1
- package/dist/DialogContent.svelte +6 -6
- package/dist/DialogContent.svelte.d.ts.map +1 -1
- package/dist/Docs.svelte +14 -12
- package/dist/Docs.svelte.d.ts.map +1 -1
- package/dist/DocsContent.svelte +4 -4
- package/dist/DocsContent.svelte.d.ts.map +1 -1
- package/dist/DocsFooter.svelte +7 -8
- package/dist/DocsFooter.svelte.d.ts.map +1 -1
- package/dist/DocsLink.svelte +24 -21
- package/dist/DocsLink.svelte.d.ts.map +1 -1
- package/dist/DocsList.svelte +3 -3
- package/dist/DocsList.svelte.d.ts.map +1 -1
- package/dist/DocsMenu.svelte +13 -10
- package/dist/DocsMenu.svelte.d.ts.map +1 -1
- package/dist/DocsMenuHeader.svelte +2 -2
- package/dist/DocsMenuHeader.svelte.d.ts.map +1 -1
- package/dist/DocsPageLinks.svelte +9 -7
- package/dist/DocsPageLinks.svelte.d.ts.map +1 -1
- package/dist/DocsPrimaryNav.svelte +5 -5
- package/dist/DocsPrimaryNav.svelte.d.ts.map +1 -1
- package/dist/DocsSearch.svelte +3 -3
- package/dist/DocsSearch.svelte.d.ts.map +1 -1
- package/dist/DocsSecondaryNav.svelte +3 -3
- package/dist/DocsSecondaryNav.svelte.d.ts.map +1 -1
- package/dist/DocsTertiaryNav.svelte +8 -8
- package/dist/DocsTertiaryNav.svelte.d.ts.map +1 -1
- package/dist/EcosystemLinks.svelte +3 -3
- package/dist/EcosystemLinks.svelte.d.ts.map +1 -1
- package/dist/EcosystemLinksPanel.svelte +2 -2
- package/dist/EcosystemLinksPanel.svelte.d.ts.map +1 -1
- package/dist/GithubLink.svelte +10 -10
- package/dist/GithubLink.svelte.d.ts.map +1 -1
- package/dist/Glyph.svelte +4 -2
- package/dist/Glyph.svelte.d.ts.map +1 -1
- package/dist/Hashlink.svelte +5 -5
- package/dist/Hashlink.svelte.d.ts.map +1 -1
- package/dist/HueInput.svelte +11 -11
- package/dist/HueInput.svelte.d.ts.map +1 -1
- package/dist/ImgOrSvg.svelte +20 -20
- package/dist/ImgOrSvg.svelte.d.ts.map +1 -1
- package/dist/LibraryDetail.svelte +16 -16
- package/dist/LibraryDetail.svelte.d.ts.map +1 -1
- package/dist/LibrarySummary.svelte +10 -8
- package/dist/LibrarySummary.svelte.d.ts.map +1 -1
- package/dist/MdnLink.svelte +8 -8
- package/dist/MdnLink.svelte.d.ts.map +1 -1
- package/dist/ModuleLink.svelte +5 -5
- package/dist/ModuleLink.svelte.d.ts.map +1 -1
- package/dist/PasteFromClipboard.svelte +1 -1
- package/dist/PasteFromClipboard.svelte.d.ts.map +1 -1
- package/dist/PendingAnimation.svelte +12 -11
- package/dist/PendingAnimation.svelte.d.ts.map +1 -1
- package/dist/PendingButton.svelte +3 -3
- package/dist/PendingButton.svelte.d.ts.map +1 -1
- package/dist/ProjectLinks.svelte +7 -7
- package/dist/ProjectLinks.svelte.d.ts.map +1 -1
- package/dist/Redirect.svelte +12 -8
- package/dist/Redirect.svelte.d.ts.map +1 -1
- package/dist/Spiders.svelte +5 -5
- package/dist/Spiders.svelte.d.ts.map +1 -1
- package/dist/StyleVariableButton.svelte +6 -6
- package/dist/StyleVariableButton.svelte.d.ts.map +1 -1
- package/dist/Svg.svelte +5 -5
- package/dist/Svg.svelte.d.ts.map +1 -1
- package/dist/Teleport.svelte +2 -2
- package/dist/Teleport.svelte.d.ts.map +1 -1
- package/dist/ThemeInput.svelte +10 -8
- package/dist/ThemeInput.svelte.d.ts.map +1 -1
- package/dist/ThemeRoot.svelte +10 -11
- package/dist/ThemeRoot.svelte.d.ts.map +1 -1
- package/dist/TomeContent.svelte +11 -11
- package/dist/TomeContent.svelte.d.ts.map +1 -1
- package/dist/TomeHeader.svelte +6 -6
- package/dist/TomeLink.svelte +7 -7
- package/dist/TomeLink.svelte.d.ts.map +1 -1
- package/dist/TomeSection.svelte +8 -8
- package/dist/TomeSection.svelte.d.ts.map +1 -1
- package/dist/TomeSectionHeader.svelte +12 -12
- package/dist/TomeSectionHeader.svelte.d.ts.map +1 -1
- package/dist/TypeLink.svelte +11 -11
- package/dist/TypeLink.svelte.d.ts.map +1 -1
- package/dist/alert.js +1 -1
- package/dist/api_search.svelte.d.ts.map +1 -1
- package/dist/api_search.svelte.js +5 -7
- package/dist/autofocus.svelte.d.ts.map +1 -1
- package/dist/context_helpers.js +1 -1
- package/dist/contextmenu_helpers.d.ts.map +1 -1
- package/dist/contextmenu_helpers.js +3 -3
- package/dist/contextmenu_state.svelte.d.ts.map +1 -1
- package/dist/contextmenu_state.svelte.js +4 -4
- package/dist/csp.d.ts.map +1 -1
- package/dist/csp.js +27 -27
- package/dist/csp_of_fuzdev.d.ts.map +1 -1
- package/dist/csp_of_fuzdev.js +1 -1
- package/dist/declaration.svelte.d.ts +44 -256
- package/dist/declaration.svelte.d.ts.map +1 -1
- package/dist/declaration.svelte.js +132 -52
- package/dist/declaration_contextmenu.d.ts.map +1 -1
- package/dist/declaration_contextmenu.js +2 -2
- package/dist/docs_helpers.svelte.d.ts.map +1 -1
- package/dist/icons.js +200 -200
- package/dist/intersect.svelte.d.ts.map +1 -1
- package/dist/library.svelte.d.ts +31 -18
- package/dist/library.svelte.d.ts.map +1 -1
- package/dist/library.svelte.js +76 -21
- package/dist/logos.js +42 -42
- package/dist/module.svelte.d.ts +30 -37
- package/dist/module.svelte.d.ts.map +1 -1
- package/dist/module.svelte.js +88 -35
- package/dist/module_contextmenu.d.ts.map +1 -1
- package/dist/module_contextmenu.js +2 -2
- package/dist/site.svelte.d.ts.map +1 -1
- package/dist/style_variable_helpers.svelte.d.ts.map +1 -1
- package/dist/svg.d.ts.map +1 -1
- package/dist/theme_state.svelte.d.ts.map +1 -1
- package/dist/theme_state.svelte.js +1 -1
- package/dist/tome.d.ts.map +1 -1
- package/dist/tome.js +1 -1
- package/dist/vite_plugin_pkg_json.d.ts.map +1 -1
- package/dist/vite_plugin_pkg_json.js +1 -1
- package/package.json +4 -23
- package/src/lib/alert.ts +3 -3
- package/src/lib/api_search.svelte.ts +9 -11
- package/src/lib/autofocus.svelte.ts +2 -2
- package/src/lib/context_helpers.ts +2 -2
- package/src/lib/contextmenu_helpers.ts +21 -21
- package/src/lib/contextmenu_state.svelte.ts +32 -34
- package/src/lib/csp.ts +42 -54
- package/src/lib/csp_of_fuzdev.ts +2 -2
- package/src/lib/declaration.svelte.ts +157 -62
- package/src/lib/declaration_contextmenu.ts +5 -5
- package/src/lib/dialog.ts +1 -1
- package/src/lib/docs_helpers.svelte.ts +9 -9
- package/src/lib/icons.ts +205 -205
- package/src/lib/intersect.svelte.ts +5 -5
- package/src/lib/library.svelte.ts +103 -36
- package/src/lib/library_helpers.ts +2 -2
- package/src/lib/logos.ts +43 -43
- package/src/lib/module.svelte.ts +98 -49
- package/src/lib/module_contextmenu.ts +4 -4
- package/src/lib/site.svelte.ts +5 -5
- package/src/lib/storage.ts +2 -2
- package/src/lib/style_variable_helpers.svelte.ts +2 -2
- package/src/lib/svg.ts +2 -2
- package/src/lib/theme_state.svelte.ts +8 -8
- package/src/lib/tome.ts +8 -8
- package/src/lib/vite_plugin_pkg_json.ts +8 -8
package/src/lib/module.svelte.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ModuleJsonInput,
|
|
3
3
|
ReExportJsonInput,
|
|
4
|
-
ExternalReExportJsonInput
|
|
4
|
+
ExternalReExportJsonInput
|
|
5
5
|
} from 'svelte-docinfo/types.js';
|
|
6
|
+
import { EMPTY_ARRAY } from '@fuzdev/fuz_util/array.ts';
|
|
6
7
|
|
|
7
|
-
import {Declaration} from './declaration.svelte.ts';
|
|
8
|
-
import type {Library} from './library.svelte.ts';
|
|
9
|
-
import {url_github_file} from '@fuzdev/fuz_util/package_helpers.ts';
|
|
8
|
+
import { Declaration } from './declaration.svelte.ts';
|
|
9
|
+
import type { Library } from './library.svelte.ts';
|
|
10
|
+
import { url_github_file } from '@fuzdev/fuz_util/package_helpers.ts';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Groups entries by a string key, with groups sorted by key. Entries within
|
|
@@ -14,7 +15,7 @@ import {url_github_file} from '@fuzdev/fuz_util/package_helpers.ts';
|
|
|
14
15
|
*/
|
|
15
16
|
const group_sorted = <T>(
|
|
16
17
|
entries: Array<T>,
|
|
17
|
-
get_key: (entry: T) => string
|
|
18
|
+
get_key: (entry: T) => string
|
|
18
19
|
): Map<string, Array<T>> => {
|
|
19
20
|
const by_key: Map<string, Array<T>> = new Map();
|
|
20
21
|
for (const entry of entries) {
|
|
@@ -32,8 +33,11 @@ const group_sorted = <T>(
|
|
|
32
33
|
/**
|
|
33
34
|
* Rich runtime representation of a module with computed properties.
|
|
34
35
|
*
|
|
35
|
-
* Wraps svelte-docinfo's `ModuleJson` with
|
|
36
|
-
*
|
|
36
|
+
* Wraps svelte-docinfo's `ModuleJson` with computed properties, URL
|
|
37
|
+
* generation, and `Declaration` instances.
|
|
38
|
+
*
|
|
39
|
+
* Computed properties are plain getters rather than `$derived` — see
|
|
40
|
+
* `Library` for why.
|
|
37
41
|
*
|
|
38
42
|
* @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
|
|
39
43
|
* @see `declaration.svelte.ts` for the `Declaration` wrapper class
|
|
@@ -57,28 +61,38 @@ export class Module {
|
|
|
57
61
|
* A leading `./` or a `.js` runtime extension will not match. Top-level
|
|
58
62
|
* files match by bare filename; nested files require the full sub-path.
|
|
59
63
|
*/
|
|
60
|
-
path
|
|
64
|
+
get path(): string {
|
|
65
|
+
return this.module_json.path;
|
|
66
|
+
}
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* Import-style path with ./ prefix.
|
|
64
70
|
*/
|
|
65
|
-
path_import
|
|
71
|
+
get path_import(): string {
|
|
72
|
+
return './' + this.path;
|
|
73
|
+
}
|
|
66
74
|
|
|
67
|
-
module_comment
|
|
75
|
+
get module_comment(): string | undefined {
|
|
76
|
+
return this.module_json.moduleComment;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#declarations: Array<Declaration> | undefined;
|
|
68
80
|
|
|
69
81
|
/**
|
|
70
82
|
* Array of `Declaration` instances. Filters out default exports.
|
|
71
83
|
*/
|
|
72
|
-
declarations
|
|
73
|
-
(this.module_json.declarations ?? [])
|
|
84
|
+
get declarations(): Array<Declaration> {
|
|
85
|
+
return (this.#declarations ??= (this.module_json.declarations ?? [])
|
|
74
86
|
.filter((declaration_json) => declaration_json.name !== 'default')
|
|
75
|
-
.map((declaration_json) => new Declaration(this, declaration_json))
|
|
76
|
-
|
|
87
|
+
.map((declaration_json) => new Declaration(this, declaration_json)));
|
|
88
|
+
}
|
|
77
89
|
|
|
78
90
|
/**
|
|
79
91
|
* API documentation URL for this module.
|
|
80
92
|
*/
|
|
81
|
-
url_api
|
|
93
|
+
get url_api(): string {
|
|
94
|
+
return `/docs/api${this.library.url_prefix}/${this.path}`;
|
|
95
|
+
}
|
|
82
96
|
|
|
83
97
|
/**
|
|
84
98
|
* Public documentation link (if `homepage_url` is available).
|
|
@@ -86,42 +100,52 @@ export class Module {
|
|
|
86
100
|
* Absolute URL into the library's own deployed docs, for rendering a
|
|
87
101
|
* foreign library's modules on a different site (e.g. an aggregator).
|
|
88
102
|
*/
|
|
89
|
-
url_api_full
|
|
90
|
-
this.library
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
103
|
+
get url_api_full(): string | undefined {
|
|
104
|
+
const { homepage_url } = this.library;
|
|
105
|
+
return homepage_url ? `${homepage_url.replace(/\/$/, '')}/docs/api/${this.path}` : undefined;
|
|
106
|
+
}
|
|
94
107
|
|
|
95
108
|
/**
|
|
96
109
|
* GitHub source URL.
|
|
97
110
|
*/
|
|
98
|
-
url_github
|
|
99
|
-
this.library
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
111
|
+
get url_github(): string | undefined {
|
|
112
|
+
const { repo_url } = this.library;
|
|
113
|
+
return repo_url ? url_github_file(repo_url, `src/lib/${this.path}`) : undefined;
|
|
114
|
+
}
|
|
103
115
|
|
|
104
116
|
/**
|
|
105
117
|
* Whether the module has renderable declarations (after the default-export
|
|
106
118
|
* filter in `declarations`).
|
|
107
119
|
*/
|
|
108
|
-
has_declarations: boolean
|
|
120
|
+
get has_declarations(): boolean {
|
|
121
|
+
return this.declarations.length > 0;
|
|
122
|
+
}
|
|
109
123
|
|
|
110
|
-
has_module_comment: boolean
|
|
124
|
+
get has_module_comment(): boolean {
|
|
125
|
+
return !!this.module_comment;
|
|
126
|
+
}
|
|
111
127
|
|
|
112
128
|
/**
|
|
113
129
|
* Modules this imports (paths relative to src/lib).
|
|
114
130
|
*/
|
|
115
|
-
dependencies
|
|
131
|
+
get dependencies(): NonNullable<ModuleJsonInput['dependencies']> {
|
|
132
|
+
return this.module_json.dependencies ?? EMPTY_ARRAY;
|
|
133
|
+
}
|
|
116
134
|
|
|
117
135
|
/**
|
|
118
136
|
* Modules that import this (paths relative to src/lib).
|
|
119
137
|
*/
|
|
120
|
-
dependents
|
|
138
|
+
get dependents(): NonNullable<ModuleJsonInput['dependents']> {
|
|
139
|
+
return this.module_json.dependents ?? EMPTY_ARRAY;
|
|
140
|
+
}
|
|
121
141
|
|
|
122
|
-
has_dependencies: boolean
|
|
142
|
+
get has_dependencies(): boolean {
|
|
143
|
+
return this.dependencies.length > 0;
|
|
144
|
+
}
|
|
123
145
|
|
|
124
|
-
has_dependents: boolean
|
|
146
|
+
get has_dependents(): boolean {
|
|
147
|
+
return this.dependents.length > 0;
|
|
148
|
+
}
|
|
125
149
|
|
|
126
150
|
/**
|
|
127
151
|
* Same-name re-export edges in this module's source (`ModuleJson.reExports`)
|
|
@@ -129,9 +153,13 @@ export class Module {
|
|
|
129
153
|
* then module. Renamed re-exports appear as declarations with `aliasOf`
|
|
130
154
|
* instead, and star exports in `star_exports`.
|
|
131
155
|
*/
|
|
132
|
-
re_exports
|
|
156
|
+
get re_exports(): NonNullable<ModuleJsonInput['reExports']> {
|
|
157
|
+
return this.module_json.reExports ?? EMPTY_ARRAY;
|
|
158
|
+
}
|
|
133
159
|
|
|
134
|
-
has_re_exports: boolean
|
|
160
|
+
get has_re_exports(): boolean {
|
|
161
|
+
return this.re_exports.length > 0;
|
|
162
|
+
}
|
|
135
163
|
|
|
136
164
|
/**
|
|
137
165
|
* Modules fully re-exported via `export * from './module'`
|
|
@@ -139,55 +167,76 @@ export class Module {
|
|
|
139
167
|
* not materialized as declarations or `re_exports` edges — this is their
|
|
140
168
|
* sole encoding.
|
|
141
169
|
*/
|
|
142
|
-
star_exports
|
|
170
|
+
get star_exports(): NonNullable<ModuleJsonInput['starExports']> {
|
|
171
|
+
return this.module_json.starExports ?? EMPTY_ARRAY;
|
|
172
|
+
}
|
|
143
173
|
|
|
144
|
-
has_star_exports: boolean
|
|
174
|
+
get has_star_exports(): boolean {
|
|
175
|
+
return this.star_exports.length > 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#re_exports_by_module: Map<string, Array<ReExportJsonInput>> | undefined;
|
|
145
179
|
|
|
146
180
|
/**
|
|
147
181
|
* Re-export edges grouped by canonical module path, groups sorted by path.
|
|
148
182
|
* Entries within each group keep their name-sorted serialized order.
|
|
149
183
|
*/
|
|
150
|
-
re_exports_by_module: Map<string, Array<ReExportJsonInput>>
|
|
151
|
-
group_sorted(this.re_exports, (entry) => entry.module)
|
|
152
|
-
|
|
184
|
+
get re_exports_by_module(): Map<string, Array<ReExportJsonInput>> {
|
|
185
|
+
return (this.#re_exports_by_module ??= group_sorted(this.re_exports, (entry) => entry.module));
|
|
186
|
+
}
|
|
153
187
|
|
|
154
188
|
/**
|
|
155
189
|
* Re-exports whose immediate target is an external package
|
|
156
190
|
* (`ModuleJson.externalReExports`) — `export {x} from 'pkg'` and
|
|
157
191
|
* `export * as ns from 'pkg'` forms, sorted by name then specifier.
|
|
158
192
|
*/
|
|
159
|
-
external_re_exports
|
|
193
|
+
get external_re_exports(): NonNullable<ModuleJsonInput['externalReExports']> {
|
|
194
|
+
return this.module_json.externalReExports ?? EMPTY_ARRAY;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
get has_external_re_exports(): boolean {
|
|
198
|
+
return this.external_re_exports.length > 0;
|
|
199
|
+
}
|
|
160
200
|
|
|
161
|
-
|
|
201
|
+
#external_re_exports_by_specifier: Map<string, Array<ExternalReExportJsonInput>> | undefined;
|
|
162
202
|
|
|
163
203
|
/**
|
|
164
204
|
* External re-exports grouped by package specifier, groups sorted by
|
|
165
205
|
* specifier. Entries within each group keep their name-sorted serialized
|
|
166
206
|
* order.
|
|
167
207
|
*/
|
|
168
|
-
external_re_exports_by_specifier: Map<string, Array<ExternalReExportJsonInput>>
|
|
169
|
-
|
|
170
|
-
|
|
208
|
+
get external_re_exports_by_specifier(): Map<string, Array<ExternalReExportJsonInput>> {
|
|
209
|
+
return (this.#external_re_exports_by_specifier ??= group_sorted(
|
|
210
|
+
this.external_re_exports,
|
|
211
|
+
(entry) => entry.specifier
|
|
212
|
+
));
|
|
213
|
+
}
|
|
171
214
|
|
|
172
215
|
/**
|
|
173
216
|
* External packages fully re-exported via `export * from 'pkg'`
|
|
174
217
|
* (`ModuleJson.externalStarExports`), in source order. The projected
|
|
175
218
|
* names are unknown — the package isn't analyzed.
|
|
176
219
|
*/
|
|
177
|
-
external_star_exports
|
|
220
|
+
get external_star_exports(): NonNullable<ModuleJsonInput['externalStarExports']> {
|
|
221
|
+
return this.module_json.externalStarExports ?? EMPTY_ARRAY;
|
|
222
|
+
}
|
|
178
223
|
|
|
179
|
-
has_external_star_exports: boolean
|
|
224
|
+
get has_external_star_exports(): boolean {
|
|
225
|
+
return this.external_star_exports.length > 0;
|
|
226
|
+
}
|
|
180
227
|
|
|
181
228
|
/**
|
|
182
229
|
* Whether the module re-exports anything in any form — same-name edges,
|
|
183
230
|
* star exports, or the external variants of both.
|
|
184
231
|
*/
|
|
185
|
-
has_any_re_exports: boolean
|
|
186
|
-
|
|
232
|
+
get has_any_re_exports(): boolean {
|
|
233
|
+
return (
|
|
234
|
+
this.has_re_exports ||
|
|
187
235
|
this.has_star_exports ||
|
|
188
236
|
this.has_external_re_exports ||
|
|
189
|
-
this.has_external_star_exports
|
|
190
|
-
|
|
237
|
+
this.has_external_star_exports
|
|
238
|
+
);
|
|
239
|
+
}
|
|
191
240
|
|
|
192
241
|
constructor(library: Library, module_json: ModuleJsonInput) {
|
|
193
242
|
this.library = library;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {Module} from './module.svelte.ts';
|
|
2
|
-
import type {ContextmenuParams} from './contextmenu_state.svelte.ts';
|
|
1
|
+
import type { Module } from './module.svelte.ts';
|
|
2
|
+
import type { ContextmenuParams } from './contextmenu_state.svelte.ts';
|
|
3
3
|
|
|
4
4
|
// TODO @many expand contextmenus for docs
|
|
5
5
|
|
|
@@ -11,8 +11,8 @@ export const create_module_contextmenu = (module: Module): Array<ContextmenuPara
|
|
|
11
11
|
entries.push({
|
|
12
12
|
snippet: 'link',
|
|
13
13
|
props: {
|
|
14
|
-
href: module.url_github
|
|
15
|
-
}
|
|
14
|
+
href: module.url_github
|
|
15
|
+
}
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
package/src/lib/site.svelte.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {Url} from '@fuzdev/fuz_util/url.ts';
|
|
2
|
-
import type {PkgJson} from '@fuzdev/fuz_util/pkg_json.ts';
|
|
1
|
+
import type { Url } from '@fuzdev/fuz_util/url.ts';
|
|
2
|
+
import type { PkgJson } from '@fuzdev/fuz_util/pkg_json.ts';
|
|
3
3
|
|
|
4
|
-
import {create_context} from './context_helpers.ts';
|
|
5
|
-
import {repo_url_parse} from '@fuzdev/fuz_util/package_helpers.ts';
|
|
6
|
-
import type {SvgData} from './svg.ts';
|
|
4
|
+
import { create_context } from './context_helpers.ts';
|
|
5
|
+
import { repo_url_parse } from '@fuzdev/fuz_util/package_helpers.ts';
|
|
6
|
+
import type { SvgData } from './svg.ts';
|
|
7
7
|
|
|
8
8
|
export interface SiteStateOptions {
|
|
9
9
|
/**
|
package/src/lib/storage.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BROWSER} from 'esm-env';
|
|
1
|
+
import { BROWSER } from 'esm-env';
|
|
2
2
|
|
|
3
3
|
// TODO more than just localStorage, maybe rework the module
|
|
4
4
|
|
|
@@ -26,7 +26,7 @@ export const save_to_storage = (key: string, value: any, is_json = false): void
|
|
|
26
26
|
export const load_from_storage = <T>(
|
|
27
27
|
key: string,
|
|
28
28
|
is_json = false,
|
|
29
|
-
parse_fn?: (value: unknown) => T | null
|
|
29
|
+
parse_fn?: (value: unknown) => T | null
|
|
30
30
|
): T | null => {
|
|
31
31
|
if (!BROWSER) return null;
|
|
32
32
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {StyleVariable} from '@fuzdev/fuz_css/variable.ts';
|
|
1
|
+
import type { StyleVariable } from '@fuzdev/fuz_css/variable.ts';
|
|
2
2
|
|
|
3
|
-
import {create_context} from './context_helpers.ts';
|
|
3
|
+
import { create_context } from './context_helpers.ts';
|
|
4
4
|
|
|
5
5
|
export const selected_variable_context = create_context(() => new SelectedStyleVariable(null));
|
|
6
6
|
|
package/src/lib/svg.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {SvelteHTMLElements} from 'svelte/elements';
|
|
1
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A structured icon definition rendered by `Svg.svelte`. Rendering is purely
|
|
@@ -11,7 +11,7 @@ export interface SvgData {
|
|
|
11
11
|
* List of svg `path` attribute objects, spread onto each `path` element. The
|
|
12
12
|
* `d` attribute is required; a per-path `fill` overrides the resolved `fill`.
|
|
13
13
|
*/
|
|
14
|
-
paths?: Array<{d: string} & SvelteHTMLElements['path']> | null;
|
|
14
|
+
paths?: Array<{ d: string } & SvelteHTMLElements['path']> | null;
|
|
15
15
|
/**
|
|
16
16
|
* Inline `style` applied to the root `svg` element, merged with any `style`
|
|
17
17
|
* passed as a component prop. Travels with the icon definition - per-instance
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {color_schemes, type ColorScheme, type Theme} from '@fuzdev/fuz_css/theme.ts';
|
|
2
|
-
import {default_themes} from '@fuzdev/fuz_css/themes.ts';
|
|
3
|
-
import {BROWSER} from 'esm-env';
|
|
1
|
+
import { color_schemes, type ColorScheme, type Theme } from '@fuzdev/fuz_css/theme.ts';
|
|
2
|
+
import { default_themes } from '@fuzdev/fuz_css/themes.ts';
|
|
3
|
+
import { BROWSER } from 'esm-env';
|
|
4
4
|
|
|
5
|
-
import {create_context} from './context_helpers.ts';
|
|
6
|
-
import {load_from_storage, save_to_storage} from './storage.ts';
|
|
5
|
+
import { create_context } from './context_helpers.ts';
|
|
6
|
+
import { load_from_storage, save_to_storage } from './storage.ts';
|
|
7
7
|
|
|
8
8
|
export interface ThemeStateJson {
|
|
9
9
|
theme: Theme;
|
|
@@ -29,7 +29,7 @@ export class ThemeState {
|
|
|
29
29
|
toJSON(): ThemeStateJson {
|
|
30
30
|
return {
|
|
31
31
|
theme: this.theme,
|
|
32
|
-
color_scheme: this.color_scheme
|
|
32
|
+
color_scheme: this.color_scheme
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -49,14 +49,14 @@ export const THEME_STORAGE_KEY = 'fuz:theme';
|
|
|
49
49
|
|
|
50
50
|
export const save_color_scheme = (
|
|
51
51
|
color_scheme: ColorScheme | null,
|
|
52
|
-
key = COLOR_SCHEME_STORAGE_KEY
|
|
52
|
+
key = COLOR_SCHEME_STORAGE_KEY
|
|
53
53
|
): void => {
|
|
54
54
|
save_to_storage(key, color_scheme);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
export const load_color_scheme = (
|
|
58
58
|
fallback: ColorScheme = 'auto',
|
|
59
|
-
key = COLOR_SCHEME_STORAGE_KEY
|
|
59
|
+
key = COLOR_SCHEME_STORAGE_KEY
|
|
60
60
|
): ColorScheme => load_from_storage(key, false, parse_color_scheme) ?? fallback;
|
|
61
61
|
|
|
62
62
|
export const save_theme = (theme: Theme | null, key = THEME_STORAGE_KEY): void => {
|
package/src/lib/tome.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {resolve} from '$app/paths';
|
|
2
|
-
import type {Component} from 'svelte';
|
|
3
|
-
import {z} from 'zod';
|
|
4
|
-
import {ensure_start} from '@fuzdev/fuz_util/string.ts';
|
|
1
|
+
import { resolve } from '$app/paths';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { ensure_start } from '@fuzdev/fuz_util/string.ts';
|
|
5
5
|
|
|
6
|
-
import {create_context} from './context_helpers.ts';
|
|
7
|
-
import {DOCS_PATH_DEFAULT} from './docs_helpers.svelte.ts';
|
|
6
|
+
import { create_context } from './context_helpers.ts';
|
|
7
|
+
import { DOCS_PATH_DEFAULT } from './docs_helpers.svelte.ts';
|
|
8
8
|
|
|
9
9
|
export const tomes_context = create_context<() => Map<string, Tome>>();
|
|
10
10
|
|
|
@@ -29,7 +29,7 @@ export const Tome = z.object({
|
|
|
29
29
|
Component: z.custom<Component<any, any>>(),
|
|
30
30
|
related_tomes: z.array(z.string()),
|
|
31
31
|
related_modules: z.array(z.string()),
|
|
32
|
-
related_declarations: z.array(z.string())
|
|
32
|
+
related_declarations: z.array(z.string())
|
|
33
33
|
});
|
|
34
34
|
export type Tome = z.infer<typeof Tome>;
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ export type Tome = z.infer<typeof Tome>;
|
|
|
39
39
|
export const tome_to_pathname = (
|
|
40
40
|
item: Tome | string,
|
|
41
41
|
docs_path = DOCS_PATH_DEFAULT,
|
|
42
|
-
hash?: string
|
|
42
|
+
hash?: string
|
|
43
43
|
): string => {
|
|
44
44
|
const slug = typeof item === 'string' ? item : item.slug;
|
|
45
45
|
const path = docs_path + '/' + slug;
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
* @module
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
import {readFileSync} from 'node:fs';
|
|
48
|
-
import {join} from 'node:path';
|
|
49
|
-
import type {Plugin, Rollup} from 'vite';
|
|
50
|
-
import type {PackageJson} from '@fuzdev/fuz_util/package_json.ts';
|
|
51
|
-
import {pkg_json_from_package_json, pkg_json_keys} from '@fuzdev/fuz_util/pkg_json.ts';
|
|
47
|
+
import { readFileSync } from 'node:fs';
|
|
48
|
+
import { join } from 'node:path';
|
|
49
|
+
import type { Plugin, Rollup } from 'vite';
|
|
50
|
+
import type { PackageJson } from '@fuzdev/fuz_util/package_json.ts';
|
|
51
|
+
import { pkg_json_from_package_json, pkg_json_keys } from '@fuzdev/fuz_util/pkg_json.ts';
|
|
52
52
|
|
|
53
53
|
const VIRTUAL_ID = 'virtual:pkg.json';
|
|
54
54
|
/**
|
|
@@ -81,7 +81,7 @@ export interface VitePluginPkgJsonOptions {
|
|
|
81
81
|
* the publish-safe field set defaults to `pkg_json_keys`; widen it via `keys`.
|
|
82
82
|
*/
|
|
83
83
|
export const vite_plugin_pkg_json = (options: VitePluginPkgJsonOptions = {}): Plugin => {
|
|
84
|
-
const {keys = pkg_json_keys} = options;
|
|
84
|
+
const { keys = pkg_json_keys } = options;
|
|
85
85
|
let root = '';
|
|
86
86
|
let is_dev = false;
|
|
87
87
|
/** Curated JSON cached for build; left `null` in dev so `load` re-reads. */
|
|
@@ -106,7 +106,7 @@ export const vite_plugin_pkg_json = (options: VitePluginPkgJsonOptions = {}): Pl
|
|
|
106
106
|
return ctx.error(
|
|
107
107
|
`vite_plugin_pkg_json: failed to read or parse ${package_json_path}: ${
|
|
108
108
|
(err as Error).message
|
|
109
|
-
}
|
|
109
|
+
}`
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
if (raw.name === undefined) {
|
|
@@ -139,6 +139,6 @@ export const vite_plugin_pkg_json = (options: VitePluginPkgJsonOptions = {}): Pl
|
|
|
139
139
|
load(id) {
|
|
140
140
|
if (id !== RESOLVED_VIRTUAL_ID) return undefined;
|
|
141
141
|
return cached ?? read_curated(this);
|
|
142
|
-
}
|
|
142
|
+
}
|
|
143
143
|
};
|
|
144
144
|
};
|