@fuzdev/fuz_ui 0.193.1 → 0.195.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.
Files changed (86) hide show
  1. package/dist/DeclarationDetail.svelte +139 -64
  2. package/dist/DeclarationDetail.svelte.d.ts +9 -0
  3. package/dist/DeclarationDetail.svelte.d.ts.map +1 -1
  4. package/dist/LibraryDetail.svelte +14 -10
  5. package/dist/LibraryDetail.svelte.d.ts +7 -0
  6. package/dist/LibraryDetail.svelte.d.ts.map +1 -1
  7. package/dist/Spiders.svelte +4 -2
  8. package/dist/Spiders.svelte.d.ts +2 -1
  9. package/dist/Spiders.svelte.d.ts.map +1 -1
  10. package/dist/StyleVariableButton.svelte +1 -1
  11. package/dist/contextmenu_state.svelte.d.ts +14 -14
  12. package/dist/contextmenu_state.svelte.d.ts.map +1 -1
  13. package/dist/contextmenu_state.svelte.js +3 -3
  14. package/dist/declaration.svelte.d.ts +233 -25
  15. package/dist/declaration.svelte.d.ts.map +1 -1
  16. package/dist/declaration.svelte.js +71 -23
  17. package/dist/docs_helpers.svelte.d.ts +5 -5
  18. package/dist/docs_helpers.svelte.d.ts.map +1 -1
  19. package/dist/docs_helpers.svelte.js +1 -1
  20. package/dist/library.svelte.d.ts +5 -5
  21. package/dist/library.svelte.d.ts.map +1 -1
  22. package/dist/library.svelte.js +2 -2
  23. package/dist/library_gen.d.ts +24 -17
  24. package/dist/library_gen.d.ts.map +1 -1
  25. package/dist/library_gen.js +52 -32
  26. package/dist/library_output.d.ts +5 -4
  27. package/dist/library_output.d.ts.map +1 -1
  28. package/dist/library_output.js +11 -8
  29. package/dist/mdz_components.d.ts +16 -16
  30. package/dist/mdz_components.d.ts.map +1 -1
  31. package/dist/module.svelte.d.ts +21 -7
  32. package/dist/module.svelte.d.ts.map +1 -1
  33. package/dist/module.svelte.js +26 -11
  34. package/dist/style_variable_helpers.svelte.d.ts +4 -4
  35. package/dist/style_variable_helpers.svelte.d.ts.map +1 -1
  36. package/dist/style_variable_helpers.svelte.js +1 -1
  37. package/dist/tome.d.ts +10 -10
  38. package/dist/tome.d.ts.map +1 -1
  39. package/dist/tome.js +2 -2
  40. package/dist/tsdoc_mdz.d.ts +6 -1
  41. package/dist/tsdoc_mdz.d.ts.map +1 -1
  42. package/dist/tsdoc_mdz.js +23 -2
  43. package/package.json +11 -9
  44. package/src/lib/contextmenu_state.svelte.ts +6 -6
  45. package/src/lib/declaration.svelte.ts +90 -35
  46. package/src/lib/docs_helpers.svelte.ts +2 -2
  47. package/src/lib/library.svelte.ts +3 -3
  48. package/src/lib/library_gen.ts +65 -42
  49. package/src/lib/library_output.ts +11 -8
  50. package/src/lib/mdz_components.ts +18 -18
  51. package/src/lib/module.svelte.ts +29 -16
  52. package/src/lib/style_variable_helpers.svelte.ts +2 -2
  53. package/src/lib/tome.ts +4 -4
  54. package/src/lib/tsdoc_mdz.ts +25 -2
  55. package/dist/analysis_context.d.ts +0 -199
  56. package/dist/analysis_context.d.ts.map +0 -1
  57. package/dist/analysis_context.js +0 -138
  58. package/dist/library_analysis.d.ts +0 -112
  59. package/dist/library_analysis.d.ts.map +0 -1
  60. package/dist/library_analysis.js +0 -106
  61. package/dist/library_generate.d.ts +0 -94
  62. package/dist/library_generate.d.ts.map +0 -1
  63. package/dist/library_generate.js +0 -147
  64. package/dist/library_pipeline.d.ts +0 -113
  65. package/dist/library_pipeline.d.ts.map +0 -1
  66. package/dist/library_pipeline.js +0 -160
  67. package/dist/module_helpers.d.ts +0 -334
  68. package/dist/module_helpers.d.ts.map +0 -1
  69. package/dist/module_helpers.js +0 -317
  70. package/dist/svelte_helpers.d.ts +0 -92
  71. package/dist/svelte_helpers.d.ts.map +0 -1
  72. package/dist/svelte_helpers.js +0 -367
  73. package/dist/ts_helpers.d.ts +0 -181
  74. package/dist/ts_helpers.d.ts.map +0 -1
  75. package/dist/ts_helpers.js +0 -674
  76. package/dist/tsdoc_helpers.d.ts +0 -119
  77. package/dist/tsdoc_helpers.d.ts.map +0 -1
  78. package/dist/tsdoc_helpers.js +0 -207
  79. package/src/lib/analysis_context.ts +0 -254
  80. package/src/lib/library_analysis.ts +0 -168
  81. package/src/lib/library_generate.ts +0 -215
  82. package/src/lib/library_pipeline.ts +0 -221
  83. package/src/lib/module_helpers.ts +0 -501
  84. package/src/lib/svelte_helpers.ts +0 -539
  85. package/src/lib/ts_helpers.ts +0 -862
  86. package/src/lib/tsdoc_helpers.ts +0 -246
@@ -1,25 +1,32 @@
1
1
  /**
2
2
  * Gro-specific library metadata generation.
3
3
  *
4
- * This module provides Gro integration for library generation. It wraps the generic
5
- * `library_generate` function with Gro's `Gen` interface and provides adapters for
6
- * converting Gro's `Disknode` to the build-tool agnostic `SourceFileInfo`.
4
+ * This module provides Gro integration for library generation. It uses svelte-docinfo's
5
+ * pure analysis (`analyze`) and wraps the results with fuz_ui's opinionated
6
+ * LibraryJson format (GitHub/npm metadata).
7
7
  *
8
- * For build-tool agnostic usage, see `library_generate.ts`.
8
+ * For build-tool agnostic usage, see `svelte-docinfo`.
9
9
  *
10
- * @see `library_generate.ts` for the generic generation entry point
11
- * @see `library_pipeline.ts` for pipeline helpers
12
- * @see `library_output.ts` for output file generation
10
+ * @see svelte-docinfo/analyze.js for the generic analysis entry point
11
+ * @see svelte-docinfo/postprocess.js for post-processing helpers
12
+ * @see library_output.js for output file generation
13
13
  *
14
14
  * @module
15
15
  */
16
16
  import { package_json_load } from '@fuzdev/gro/package_json.js';
17
- import { module_create_source_options, module_validate_source_options, module_is_source, module_get_source_root, } from './module_helpers.js';
18
- import { library_generate } from './library_generate.js';
17
+ import { analyze, createSourceOptions, } from 'svelte-docinfo';
18
+ import { normalizeSourceOptions, isSource, getSourceRoot } from 'svelte-docinfo/source-config.js';
19
+ import { library_generate_output } from './library_output.js';
19
20
  /**
20
21
  * Convert Gro's `Disknode` to the build-tool agnostic `SourceFileInfo` interface.
21
22
  *
22
- * Use this when you want to analyze files using Gro's filer directly.
23
+ * Use this when you want to analyze files using Gro's filer directly. The
24
+ * `dependencies` field is populated from the filer's forward-edge graph — the
25
+ * svelte-docinfo session honors it as pre-resolved input and skips its own
26
+ * lex+resolve pass for these files, avoiding duplicate work the filer already did.
27
+ *
28
+ * Reverse edges (`dependents`) are not threaded through — svelte-docinfo
29
+ * computes them internally from the forward edges of the owned set.
23
30
  *
24
31
  * @throws Error if disknode has no content (should be loaded by Gro filer)
25
32
  */
@@ -31,14 +38,13 @@ export const source_file_from_disknode = (disknode) => {
31
38
  id: disknode.id,
32
39
  content: disknode.contents,
33
40
  dependencies: [...disknode.dependencies.keys()],
34
- dependents: [...disknode.dependents.keys()],
35
41
  };
36
42
  };
37
43
  /**
38
44
  * Collect source files from Gro disknodes, filtering BEFORE conversion to `SourceFileInfo`.
39
45
  *
40
46
  * This avoids errors from files outside source directories (like test fixtures that may
41
- * have malformed paths or missing content). The filtering uses `module_is_source` which
47
+ * have malformed paths or missing content). The filtering uses `isSource` which
42
48
  * checks `source_paths` to only include files in configured source directories.
43
49
  *
44
50
  * @param disknodes - iterator of Gro disknodes from filer
@@ -46,22 +52,24 @@ export const source_file_from_disknode = (disknode) => {
46
52
  * @param log - optional logger for status messages
47
53
  */
48
54
  export const library_collect_source_files_from_disknodes = (disknodes, options, log) => {
49
- // Validate options early to fail fast on misconfiguration
50
- module_validate_source_options(options);
55
+ // Normalize options (throws on invalid config) and use the normalized form
56
+ // for downstream `isSource` / `getSourceRoot` calls, so callers that pass
57
+ // raw options (not via `createSourceOptions`) get consistent path handling.
58
+ const normalized_options = normalizeSourceOptions(options);
51
59
  const all_disknodes = Array.from(disknodes);
52
60
  log?.info(`received ${all_disknodes.length} files total from filer`);
53
61
  const source_files = [];
54
62
  for (const disknode of all_disknodes) {
55
63
  // Filter by source_paths BEFORE trying to convert
56
64
  // This avoids errors from test fixtures or other non-source files
57
- if (!module_is_source(disknode.id, options)) {
65
+ if (!isSource(disknode.id, normalized_options)) {
58
66
  continue;
59
67
  }
60
68
  source_files.push(source_file_from_disknode(disknode));
61
69
  }
62
70
  log?.info(`found ${source_files.length} source files to analyze`);
63
71
  if (source_files.length === 0) {
64
- const effective_root = module_get_source_root(options);
72
+ const effective_root = getSourceRoot(normalized_options);
65
73
  log?.warn(`No source files found in ${effective_root} - generating empty library metadata`);
66
74
  return [];
67
75
  }
@@ -74,10 +82,12 @@ export const library_collect_source_files_from_disknodes = (disknodes, options,
74
82
  *
75
83
  * This is the Gro-specific entry point. It handles:
76
84
  * - Reading files from Gro's filer
77
- * - Loading `package.json` via Gro utilities
78
- * - Returning output in Gro's `Gen` format
85
+ * - Loading package.json via Gro utilities
86
+ * - Analyzing source with svelte-docinfo (pure analysis)
87
+ * - Wrapping with LibraryJson (GitHub/npm metadata)
88
+ * - Returning output in Gro's Gen format
79
89
  *
80
- * For build-tool agnostic usage, use `library_generate` directly.
90
+ * For build-tool agnostic usage, use `analyze` directly.
81
91
  *
82
92
  * Usage in a `.gen.ts` file:
83
93
  *
@@ -95,29 +105,39 @@ export const library_gen = (options) => {
95
105
  generate: async ({ log, filer }) => {
96
106
  log.info('generating library metadata with full TypeScript analysis...');
97
107
  // Build source options with project_root from cwd
98
- const source_options = options?.source && 'project_root' in options.source
108
+ const source_options = options?.source && 'projectRoot' in options.source
99
109
  ? options.source
100
- : module_create_source_options(process.cwd(), options?.source);
110
+ : createSourceOptions(process.cwd(), options?.source);
101
111
  // Ensure filer is initialized
102
112
  await filer.init();
103
113
  // Read package.json
104
114
  const package_json = await package_json_load();
105
115
  // Collect source files from Gro filer
106
116
  const source_files = library_collect_source_files_from_disknodes(filer.files.values(), source_options, log);
107
- // Use generic library_generate for the actual work
108
- const result = library_generate({
109
- source_files,
110
- package_json,
111
- source_options,
112
- on_duplicates: options?.on_duplicates,
113
- log,
117
+ // Get pure analysis from svelte-docinfo (no package metadata).
118
+ const { modules } = await analyze({
119
+ sourceFiles: source_files,
120
+ sourceOptions: source_options,
121
+ onDuplicates: options?.on_duplicates,
122
+ log: log, // Type cast needed due to workspace dependency duplication
114
123
  });
124
+ if (!package_json.version) {
125
+ throw new Error('package.json is missing required "version" field');
126
+ }
127
+ // Wrap modules with package metadata (fuz_ui's own SourceJson type)
128
+ const source_json = {
129
+ name: package_json.name,
130
+ version: package_json.version,
131
+ repository: typeof package_json.repository === 'string'
132
+ ? package_json.repository
133
+ : package_json.repository?.url,
134
+ modules: modules, // TODO: remove cast when fuz_util SourceJson uses svelte-docinfo types
135
+ };
136
+ // Generate output files with fuz_ui's LibraryJson wrapper
137
+ const { json_content, ts_content } = library_generate_output(package_json, source_json);
115
138
  log.info('library metadata generation complete');
116
139
  // Return array of files in Gro's expected format
117
- return [
118
- { content: result.ts_content },
119
- { content: result.json_content, filename: 'library.json' },
120
- ];
140
+ return [{ content: ts_content }, { content: json_content, filename: 'library.json' }];
121
141
  },
122
142
  };
123
143
  };
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Library output generation.
3
3
  *
4
- * Generates the `library.json` and `library.ts` files from analyzed metadata.
4
+ * Generates the library.json and library.ts files from analyzed metadata.
5
+ * Uses svelte-docinfo's `compactReplacer` to strip Zod default values
6
+ * (empty arrays, false booleans) for compact JSON output.
5
7
  *
6
- * @see `library_generate.ts` for the main generation entry point
7
- * @see `library_pipeline.ts` for pipeline orchestration functions
8
- * @see `library_gen.ts` for Gro-specific integration
8
+ * @see `library_gen.ts` for the main generation entry point
9
+ * @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
9
10
  *
10
11
  * @module
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"library_output.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAGhE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,WAAW,EACzB,aAAa,UAAU,KACrB,mBAuBF,CAAC"}
1
+ {"version":3,"file":"library_output.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAIhE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,WAAW,EACzB,aAAa,UAAU,KACrB,mBAwBF,CAAC"}
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * Library output generation.
3
3
  *
4
- * Generates the `library.json` and `library.ts` files from analyzed metadata.
4
+ * Generates the library.json and library.ts files from analyzed metadata.
5
+ * Uses svelte-docinfo's `compactReplacer` to strip Zod default values
6
+ * (empty arrays, false booleans) for compact JSON output.
5
7
  *
6
- * @see `library_generate.ts` for the main generation entry point
7
- * @see `library_pipeline.ts` for pipeline orchestration functions
8
- * @see `library_gen.ts` for Gro-specific integration
8
+ * @see `library_gen.ts` for the main generation entry point
9
+ * @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
9
10
  *
10
11
  * @module
11
12
  */
12
13
  import { library_json_parse } from '@fuzdev/fuz_util/library_json.js';
14
+ import { compactReplacer } from 'svelte-docinfo';
13
15
  /**
14
16
  * Generate the `library.json` and `library.ts` file contents.
15
17
  * Parses at generation time so runtime only needs the pre-computed result.
@@ -21,15 +23,16 @@ import { library_json_parse } from '@fuzdev/fuz_util/library_json.js';
21
23
  * (JSON imports get widened types like `string` instead of literal unions)
22
24
  */
23
25
  export const library_generate_output = (package_json, source_json) => {
24
- const is_this_fuz_util = package_json.name === '@fuzdev/fuz_util';
25
- const fuz_util_prefix = is_this_fuz_util ? './' : '@fuzdev/fuz_util/';
26
+ // Compact source_json (strips Zod default values like empty arrays and false booleans)
27
+ // Only applied to source_json, not the outer library_json package metadata
28
+ const compacted_source_json = JSON.parse(JSON.stringify(source_json, compactReplacer));
26
29
  // Parse at generation time, not runtime
27
- const library_json = library_json_parse(package_json, source_json);
30
+ const library_json = library_json_parse(package_json, compacted_source_json);
28
31
  const json_content = JSON.stringify(library_json, null, '\t') + '\n';
29
32
  const banner = '// generated by library.gen.ts - do not edit';
30
33
  const ts_content = `${banner}
31
34
 
32
- import type {LibraryJson} from '${fuz_util_prefix}library_json.js';
35
+ import type {LibraryJson} from '@fuzdev/fuz_util/library_json.js';
33
36
 
34
37
  import json from './library.json' with {type: 'json'};
35
38
 
@@ -1,20 +1,4 @@
1
1
  import type { Component } from 'svelte';
2
- /**
3
- * Component registry for custom Svelte components that can be used in mdz content.
4
- *
5
- * For example, registering 'Alert' allows using `<Alert>...</Alert>` in mdz content.
6
- *
7
- * The Map values are the Svelte component constructors.
8
- */
9
- export type MdzComponents = Map<string, Component<any, any>>;
10
- /**
11
- * Element registry for HTML elements that can be used in mdz content.
12
- *
13
- * For example, registering 'div' allows using `<div>...</div>` in mdz content.
14
- *
15
- * The Map values are boolean placeholders for future configuration options.
16
- */
17
- export type MdzElements = Map<string, boolean>;
18
2
  /**
19
3
  * Context for providing custom mdz components.
20
4
  * Must be set by the application using mdz.
@@ -46,4 +30,20 @@ export declare const mdz_base_context: {
46
30
  get_maybe: () => (() => string | undefined) | undefined;
47
31
  set: (value: () => string | undefined) => () => string | undefined;
48
32
  };
33
+ /**
34
+ * Component registry for custom Svelte components that can be used in mdz content.
35
+ *
36
+ * For example, registering 'Alert' allows using `<Alert>...</Alert>` in mdz content.
37
+ *
38
+ * The Map values are the Svelte component constructors.
39
+ */
40
+ export type MdzComponents = Map<string, Component<any, any>>;
41
+ /**
42
+ * Element registry for HTML elements that can be used in mdz content.
43
+ *
44
+ * For example, registering 'div' allows using `<div>...</div>` in mdz content.
45
+ *
46
+ * The Map values are boolean placeholders for future configuration options.
47
+ */
48
+ export type MdzElements = Map<string, boolean>;
49
49
  //# sourceMappingURL=mdz_components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mdz_components.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAItC;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;CAAkC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;CAAgC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;2CAAwB,MAAM,GAAG,SAAS;4BAAlB,MAAM,GAAG,SAAS;uBAAlB,MAAM,GAAG,SAAS,WAAlB,MAAM,GAAG,SAAS;CAAG,CAAC"}
1
+ {"version":3,"file":"mdz_components.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;CAAkC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;CAAgC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;2CAAwB,MAAM,GAAG,SAAS;4BAAlB,MAAM,GAAG,SAAS;uBAAlB,MAAM,GAAG,SAAS,WAAlB,MAAM,GAAG,SAAS;CAAG,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -1,14 +1,28 @@
1
- import type { ModuleJson } from '@fuzdev/fuz_util/source_json.js';
1
+ import type { ModuleJsonInput } from 'svelte-docinfo/types.js';
2
2
  import { Declaration } from './declaration.svelte.js';
3
3
  import type { Library } from './library.svelte.js';
4
4
  /**
5
5
  * Rich runtime representation of a module with computed properties.
6
+ *
7
+ * Wraps svelte-docinfo's `ModuleJson` with reactive derivations,
8
+ * URL generation, and `Declaration` instances.
9
+ *
10
+ * @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
11
+ * @see `declaration.svelte.ts` for the `Declaration` wrapper class
6
12
  */
7
13
  export declare class Module {
8
14
  readonly library: Library;
9
- readonly module_json: ModuleJson;
10
- /**
11
- * Canonical module path (e.g., 'Alert.ts', 'helpers/foo.ts').
15
+ readonly module_json: ModuleJsonInput;
16
+ /**
17
+ * Canonical module path — `src/lib/`-relative, with source extension
18
+ * (`.ts`, `.svelte`, etc.). Examples: `'Alert.ts'`, `'helpers/foo.ts'`,
19
+ * `'actions/composables.ts'`.
20
+ *
21
+ * This is the key `Library.module_by_path` indexes, so it's also the
22
+ * exact string TSDoc backtick references must use to auto-link to a
23
+ * module via `DocsLink.svelte` (e.g., `` `actions/composables.ts` ``).
24
+ * A leading `./` or a `.js` runtime extension will not match. Top-level
25
+ * files match by bare filename; nested files require the full sub-path.
12
26
  */
13
27
  path: string;
14
28
  /**
@@ -33,12 +47,12 @@ export declare class Module {
33
47
  /**
34
48
  * Modules this imports (paths relative to src/lib).
35
49
  */
36
- dependencies: string[] | undefined;
50
+ dependencies: string[];
37
51
  /**
38
52
  * Modules that import this (paths relative to src/lib).
39
53
  */
40
- dependents: string[] | undefined;
41
- constructor(library: Library, module_json: ModuleJson);
54
+ dependents: string[];
55
+ constructor(library: Library, module_json: ModuleJsonInput);
42
56
  /**
43
57
  * Look up a declaration by name within this module.
44
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"module.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/module.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAGjD;;GAEG;AACH,qBAAa,MAAM;IAClB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAiB;IAC1C,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAiB;IAEjD;;OAEG;IACH,IAAI,SAAmC;IAEvC;;OAEG;IACH,WAAW,SAA8B;IAEzC,cAAc,qBAA6C;IAE3D;;OAEG;IACH,YAAY,gBAMV;IAEF;;OAEG;IACH,OAAO,SAAgE;IAEvE;;OAEG;IACH,UAAU,qBAIR;IAEF,gBAAgB,EAAE,OAAO,CAEvB;IAEF,kBAAkB,EAAE,OAAO,CAA+C;IAE1E;;OAEG;IACH,YAAY,uBAA2C;IAEvD;;OAEG;IACH,UAAU,uBAAyC;gBAEvC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU;IAKrD;;OAEG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;CAG9D"}
1
+ {"version":3,"file":"module.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/module.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAGjD;;;;;;;;GAQG;AACH,qBAAa,MAAM;IAClB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAiB;IAI1C,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAiB;IAEtD;;;;;;;;;;OAUG;IACH,IAAI,SAAmC;IAEvC;;OAEG;IACH,WAAW,SAA8B;IAEzC,cAAc,qBAA4C;IAE1D;;OAEG;IACH,YAAY,gBAIV;IAEF;;OAEG;IACH,OAAO,SAAgE;IAEvE;;OAEG;IACH,UAAU,qBAIR;IAEF,gBAAgB,EAAE,OAAO,CAA8D;IAEvF,kBAAkB,EAAE,OAAO,CAAmC;IAE9D;;OAEG;IACH,YAAY,WAAiD;IAE7D;;OAEG;IACH,UAAU,WAA+C;gBAE7C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe;IAK1D;;OAEG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;CAG9D"}
@@ -2,27 +2,42 @@ import { Declaration } from './declaration.svelte.js';
2
2
  import { url_github_file } from './package_helpers.js';
3
3
  /**
4
4
  * Rich runtime representation of a module with computed properties.
5
+ *
6
+ * Wraps svelte-docinfo's `ModuleJson` with reactive derivations,
7
+ * URL generation, and `Declaration` instances.
8
+ *
9
+ * @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
10
+ * @see `declaration.svelte.ts` for the `Declaration` wrapper class
5
11
  */
6
12
  export class Module {
7
13
  library = $state.raw();
14
+ // `library.json` is compacted (svelte-docinfo's `compactReplacer` strips empty
15
+ // default arrays), so the on-disk data is the `*Input` shape. Typing it as
16
+ // input makes TypeScript force guards on defaulted-array reads.
8
17
  module_json = $state.raw();
9
18
  /**
10
- * Canonical module path (e.g., 'Alert.ts', 'helpers/foo.ts').
19
+ * Canonical module path — `src/lib/`-relative, with source extension
20
+ * (`.ts`, `.svelte`, etc.). Examples: `'Alert.ts'`, `'helpers/foo.ts'`,
21
+ * `'actions/composables.ts'`.
22
+ *
23
+ * This is the key `Library.module_by_path` indexes, so it's also the
24
+ * exact string TSDoc backtick references must use to auto-link to a
25
+ * module via `DocsLink.svelte` (e.g., `` `actions/composables.ts` ``).
26
+ * A leading `./` or a `.js` runtime extension will not match. Top-level
27
+ * files match by bare filename; nested files require the full sub-path.
11
28
  */
12
29
  path = $derived(this.module_json.path);
13
30
  /**
14
31
  * Import-style path with ./ prefix.
15
32
  */
16
33
  path_import = $derived('./' + this.path);
17
- module_comment = $derived(this.module_json.module_comment);
34
+ module_comment = $derived(this.module_json.moduleComment);
18
35
  /**
19
36
  * Array of `Declaration` instances. Filters out default exports.
20
37
  */
21
- declarations = $derived(this.module_json.declarations
22
- ? this.module_json.declarations
23
- .filter((declaration_json) => declaration_json.name !== 'default')
24
- .map((declaration_json) => new Declaration(this, declaration_json))
25
- : []);
38
+ declarations = $derived((this.module_json.declarations ?? [])
39
+ .filter((declaration_json) => declaration_json.name !== 'default')
40
+ .map((declaration_json) => new Declaration(this, declaration_json)));
26
41
  /**
27
42
  * API documentation URL for this module.
28
43
  */
@@ -33,16 +48,16 @@ export class Module {
33
48
  url_github = $derived(this.library.repo_url
34
49
  ? url_github_file(this.library.repo_url, `src/lib/${this.path}`)
35
50
  : undefined);
36
- has_declarations = $derived(!!(this.module_json.declarations && this.module_json.declarations.length > 0));
37
- has_module_comment = $derived(!!this.module_json.module_comment);
51
+ has_declarations = $derived((this.module_json.declarations?.length ?? 0) > 0);
52
+ has_module_comment = $derived(!!this.module_comment);
38
53
  /**
39
54
  * Modules this imports (paths relative to src/lib).
40
55
  */
41
- dependencies = $derived(this.module_json.dependencies);
56
+ dependencies = $derived(this.module_json.dependencies ?? []);
42
57
  /**
43
58
  * Modules that import this (paths relative to src/lib).
44
59
  */
45
- dependents = $derived(this.module_json.dependents);
60
+ dependents = $derived(this.module_json.dependents ?? []);
46
61
  constructor(library, module_json) {
47
62
  this.library = library;
48
63
  this.module_json = module_json;
@@ -1,10 +1,10 @@
1
1
  import type { StyleVariable } from '@fuzdev/fuz_css/variable.js';
2
- export declare class SelectedStyleVariable {
3
- value: StyleVariable | null;
4
- constructor(initial?: StyleVariable | null);
5
- }
6
2
  export declare const selected_variable_context: {
7
3
  get: () => SelectedStyleVariable;
8
4
  set: (value?: SelectedStyleVariable | undefined) => SelectedStyleVariable;
9
5
  };
6
+ export declare class SelectedStyleVariable {
7
+ value: StyleVariable | null;
8
+ constructor(initial?: StyleVariable | null);
9
+ }
10
10
  //# sourceMappingURL=style_variable_helpers.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style_variable_helpers.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/style_variable_helpers.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAK/D,qBAAa,qBAAqB;IACjC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAiB;gBAEhC,OAAO,GAAE,aAAa,GAAG,IAAW;CAGhD;AAED,eAAO,MAAM,yBAAyB;;;CAAwD,CAAC"}
1
+ {"version":3,"file":"style_variable_helpers.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/style_variable_helpers.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAI/D,eAAO,MAAM,yBAAyB;;;CAAwD,CAAC;AAG/F,qBAAa,qBAAqB;IACjC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAiB;gBAEhC,OAAO,GAAE,aAAa,GAAG,IAAW;CAGhD"}
@@ -1,4 +1,5 @@
1
1
  import { create_context } from './context_helpers.js';
2
+ export const selected_variable_context = create_context(() => new SelectedStyleVariable(null));
2
3
  // TODO maybe change this to a generic wrapper class for any value?
3
4
  export class SelectedStyleVariable {
4
5
  value = $state.raw();
@@ -6,4 +7,3 @@ export class SelectedStyleVariable {
6
7
  this.value = initial;
7
8
  }
8
9
  }
9
- export const selected_variable_context = create_context(() => new SelectedStyleVariable(null));
package/dist/tome.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  import type { Component } from 'svelte';
2
2
  import { z } from 'zod';
3
+ export declare const tomes_context: {
4
+ get: (error_message?: string) => () => Map<string, Tome>;
5
+ get_maybe: () => (() => Map<string, Tome>) | undefined;
6
+ set: (value: () => Map<string, Tome>) => () => Map<string, Tome>;
7
+ };
8
+ export declare const tome_context: {
9
+ get: (error_message?: string) => () => Tome;
10
+ get_maybe: () => (() => Tome) | undefined;
11
+ set: (value: () => Tome) => () => Tome;
12
+ };
3
13
  export declare const Tome: z.ZodObject<{
4
14
  slug: z.ZodString;
5
15
  title: z.ZodOptional<z.ZodString>;
@@ -18,15 +28,5 @@ export declare const tome_to_pathname: (item: Tome | string, docs_path?: string,
18
28
  * The display label for a tome — its `title` if set, else its `slug`.
19
29
  */
20
30
  export declare const tome_to_title: (tome: Tome) => string;
21
- export declare const tomes_context: {
22
- get: (error_message?: string) => () => Map<string, Tome>;
23
- get_maybe: () => (() => Map<string, Tome>) | undefined;
24
- set: (value: () => Map<string, Tome>) => () => Map<string, Tome>;
25
- };
26
31
  export declare const tome_get_by_slug: (slug: string) => Tome;
27
- export declare const tome_context: {
28
- get: (error_message?: string) => () => Tome;
29
- get_maybe: () => (() => Tome) | undefined;
30
- set: (value: () => Tome) => () => Tome;
31
- };
32
32
  //# sourceMappingURL=tome.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tome.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAMtB,eAAO,MAAM,IAAI;;;;;;;;iBAoBf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,IAAI,GAAG,MAAM,EACnB,kBAA6B,EAC7B,OAAO,MAAM,KACX,MAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,MAAiC,CAAC;AAE7E,eAAO,MAAM,aAAa;2CAAwB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;4BAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;uBAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,WAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;CAAG,CAAC;AAEvE,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAK/C,CAAC;AAEF,eAAO,MAAM,YAAY;2CAAwB,IAAI;4BAAJ,IAAI;uBAAJ,IAAI,WAAJ,IAAI;CAAG,CAAC"}
1
+ {"version":3,"file":"tome.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAMtB,eAAO,MAAM,aAAa;2CAAwB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;4BAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;uBAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,WAAjB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;CAAG,CAAC;AAEvE,eAAO,MAAM,YAAY;2CAAwB,IAAI;4BAAJ,IAAI;uBAAJ,IAAI,WAAJ,IAAI;CAAG,CAAC;AAEzD,eAAO,MAAM,IAAI;;;;;;;;iBAoBf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,IAAI,GAAG,MAAM,EACnB,kBAA6B,EAC7B,OAAO,MAAM,KACX,MAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,MAAiC,CAAC;AAE7E,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAK/C,CAAC"}
package/dist/tome.js CHANGED
@@ -3,6 +3,8 @@ import { z } from 'zod';
3
3
  import { ensure_start } from '@fuzdev/fuz_util/string.js';
4
4
  import { create_context } from './context_helpers.js';
5
5
  import { DOCS_PATH_DEFAULT } from './docs_helpers.svelte.js';
6
+ export const tomes_context = create_context();
7
+ export const tome_context = create_context();
6
8
  export const Tome = z.object({
7
9
  /**
8
10
  * Stable identifier and URL path segment — must be a URL-safe slug
@@ -36,7 +38,6 @@ export const tome_to_pathname = (item, docs_path = DOCS_PATH_DEFAULT, hash) => {
36
38
  * The display label for a tome — its `title` if set, else its `slug`.
37
39
  */
38
40
  export const tome_to_title = (tome) => tome.title ?? tome.slug;
39
- export const tomes_context = create_context();
40
41
  export const tome_get_by_slug = (slug) => {
41
42
  const get_tomes = tomes_context.get();
42
43
  const tome = get_tomes().get(slug);
@@ -44,4 +45,3 @@ export const tome_get_by_slug = (slug) => {
44
45
  throw Error(`unable to find tome "${slug}"`);
45
46
  return tome;
46
47
  };
47
- export const tome_context = create_context();
@@ -11,10 +11,12 @@
11
11
  * Convert raw TSDoc `@see` content to mdz format for rendering.
12
12
  *
13
13
  * Handles TSDoc link syntax:
14
- * - `{@link url|text}` → `[text](url)` (markdown link)
14
+ * - `{@link url|text}` → `[text](url)` (markdown link, TSDoc canonical form)
15
+ * - `{@link url text}` → `[text](url)` (TS-lenient space-separated form)
15
16
  * - `{@link https://...}` → `https://...` (bare URL, auto-linked by mdz)
16
17
  * - `{@link identifier}` → `` `identifier` `` (code formatting)
17
18
  * - Bare URLs → returned as-is
19
+ * - Bare markdown links (`[text](url)` ...) → returned as-is
18
20
  * - Bare identifiers → wrapped in backticks
19
21
  * - `identifier description text` → `` `identifier` description text `` (first token is the reference)
20
22
  *
@@ -32,6 +34,9 @@
32
34
  * tsdoc_see_to_mdz('https://example.com')
33
35
  * // → 'https://example.com'
34
36
  *
37
+ * tsdoc_see_to_mdz('[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library')
38
+ * // → '[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library'
39
+ *
35
40
  * tsdoc_see_to_mdz('library_gen.ts for Gro-specific integration')
36
41
  * // → '`library_gen.ts` for Gro-specific integration'
37
42
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc_mdz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tsdoc_mdz.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MA6BlD,CAAC"}
1
+ {"version":3,"file":"tsdoc_mdz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tsdoc_mdz.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MA+ClD,CAAC"}
package/dist/tsdoc_mdz.js CHANGED
@@ -14,10 +14,12 @@ const format_reference = (ref) => (mdz_is_url(ref) ? ref : `\`${ref}\``);
14
14
  * Convert raw TSDoc `@see` content to mdz format for rendering.
15
15
  *
16
16
  * Handles TSDoc link syntax:
17
- * - `{@link url|text}` → `[text](url)` (markdown link)
17
+ * - `{@link url|text}` → `[text](url)` (markdown link, TSDoc canonical form)
18
+ * - `{@link url text}` → `[text](url)` (TS-lenient space-separated form)
18
19
  * - `{@link https://...}` → `https://...` (bare URL, auto-linked by mdz)
19
20
  * - `{@link identifier}` → `` `identifier` `` (code formatting)
20
21
  * - Bare URLs → returned as-is
22
+ * - Bare markdown links (`[text](url)` ...) → returned as-is
21
23
  * - Bare identifiers → wrapped in backticks
22
24
  * - `identifier description text` → `` `identifier` description text `` (first token is the reference)
23
25
  *
@@ -35,6 +37,9 @@ const format_reference = (ref) => (mdz_is_url(ref) ? ref : `\`${ref}\``);
35
37
  * tsdoc_see_to_mdz('https://example.com')
36
38
  * // → 'https://example.com'
37
39
  *
40
+ * tsdoc_see_to_mdz('[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library')
41
+ * // → '[svelte-docinfo](https://github.com/ryanatkn/svelte-docinfo) for the analysis library'
42
+ *
38
43
  * tsdoc_see_to_mdz('library_gen.ts for Gro-specific integration')
39
44
  * // → '`library_gen.ts` for Gro-specific integration'
40
45
  * ```
@@ -47,15 +52,31 @@ export const tsdoc_see_to_mdz = (content) => {
47
52
  const link_match = /^\{@(?:link|see)\s+([^}]+)\}$/.exec(trimmed);
48
53
  if (link_match) {
49
54
  const inner = link_match[1].trim();
50
- // Check for pipe separator (custom display text)
55
+ // Pipe separator takes precedence (TSDoc canonical form)
51
56
  const pipe_index = inner.indexOf('|');
52
57
  if (pipe_index !== -1) {
53
58
  const reference = inner.slice(0, pipe_index).trim();
54
59
  const display_text = inner.slice(pipe_index + 1).trim();
55
60
  return `[${display_text}](${reference})`;
56
61
  }
62
+ // Space-separated form: TS accepts `{@link url text}` as equivalent to `{@link url|text}`.
63
+ // Only treat space as a separator when the first token looks like a link target (URL),
64
+ // so identifier-style references like `module.function` aren't split.
65
+ const space_index = inner.indexOf(' ');
66
+ if (space_index !== -1) {
67
+ const reference = inner.slice(0, space_index);
68
+ if (mdz_is_url(reference)) {
69
+ const display_text = inner.slice(space_index + 1).trim();
70
+ return `[${display_text}](${reference})`;
71
+ }
72
+ }
57
73
  return format_reference(inner);
58
74
  }
75
+ // Pass through bare markdown links (`[text](url)` optionally followed by description)
76
+ // so authors can write `@see [text](url) for context` directly.
77
+ if (trimmed.charCodeAt(0) === 91 /* [ */ && /^\[[^\]]+\]\([^)\s]+\)/.test(trimmed)) {
78
+ return trimmed;
79
+ }
59
80
  // Split at first whitespace: first token is the reference, rest is description
60
81
  const space_index = trimmed.indexOf(' ');
61
82
  if (space_index === -1) {