@fuzdev/fuz_ui 0.191.1 → 0.191.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.
Files changed (66) hide show
  1. package/dist/Alert.svelte +1 -1
  2. package/dist/ProjectLinks.svelte +3 -1
  3. package/dist/ProjectLinks.svelte.d.ts.map +1 -1
  4. package/dist/analysis_context.d.ts +7 -3
  5. package/dist/analysis_context.d.ts.map +1 -1
  6. package/dist/analysis_context.js +7 -3
  7. package/dist/contextmenu_state.svelte.d.ts +3 -3
  8. package/dist/contextmenu_state.svelte.js +3 -3
  9. package/dist/csp.d.ts +4 -4
  10. package/dist/csp.js +4 -4
  11. package/dist/docs_helpers.svelte.d.ts +1 -1
  12. package/dist/docs_helpers.svelte.js +1 -1
  13. package/dist/library.svelte.d.ts +4 -4
  14. package/dist/library.svelte.js +4 -4
  15. package/dist/library_analysis.d.ts +4 -4
  16. package/dist/library_analysis.d.ts.map +1 -1
  17. package/dist/library_analysis.js +3 -3
  18. package/dist/library_gen.d.ts +10 -8
  19. package/dist/library_gen.d.ts.map +1 -1
  20. package/dist/library_gen.js +8 -8
  21. package/dist/library_generate.d.ts +2 -2
  22. package/dist/library_generate.js +2 -2
  23. package/dist/library_helpers.d.ts +2 -0
  24. package/dist/library_helpers.d.ts.map +1 -1
  25. package/dist/library_helpers.js +2 -0
  26. package/dist/library_output.d.ts +7 -7
  27. package/dist/library_output.d.ts.map +1 -1
  28. package/dist/library_output.js +5 -5
  29. package/dist/library_pipeline.d.ts +9 -5
  30. package/dist/library_pipeline.d.ts.map +1 -1
  31. package/dist/library_pipeline.js +9 -5
  32. package/dist/logos.d.ts +8 -1
  33. package/dist/logos.d.ts.map +1 -1
  34. package/dist/logos.js +8 -3
  35. package/dist/module.svelte.d.ts +1 -1
  36. package/dist/module.svelte.js +1 -1
  37. package/dist/module_helpers.d.ts +2 -2
  38. package/dist/module_helpers.js +1 -1
  39. package/dist/package_helpers.d.ts +4 -4
  40. package/dist/package_helpers.js +4 -4
  41. package/dist/svelte_preprocess_mdz.d.ts +4 -4
  42. package/dist/svelte_preprocess_mdz.js +6 -6
  43. package/dist/ts_helpers.d.ts +4 -4
  44. package/dist/ts_helpers.d.ts.map +1 -1
  45. package/dist/ts_helpers.js +2 -2
  46. package/dist/vite_plugin_library_well_known.d.ts +2 -2
  47. package/dist/vite_plugin_library_well_known.js +1 -1
  48. package/package.json +4 -4
  49. package/src/lib/analysis_context.ts +7 -3
  50. package/src/lib/contextmenu_state.svelte.ts +3 -3
  51. package/src/lib/csp.ts +4 -4
  52. package/src/lib/docs_helpers.svelte.ts +1 -1
  53. package/src/lib/library.svelte.ts +4 -4
  54. package/src/lib/library_analysis.ts +4 -4
  55. package/src/lib/library_gen.ts +10 -8
  56. package/src/lib/library_generate.ts +2 -2
  57. package/src/lib/library_helpers.ts +2 -0
  58. package/src/lib/library_output.ts +7 -7
  59. package/src/lib/library_pipeline.ts +9 -5
  60. package/src/lib/logos.ts +9 -3
  61. package/src/lib/module.svelte.ts +1 -1
  62. package/src/lib/module_helpers.ts +2 -2
  63. package/src/lib/package_helpers.ts +4 -4
  64. package/src/lib/svelte_preprocess_mdz.ts +14 -14
  65. package/src/lib/ts_helpers.ts +4 -4
  66. package/src/lib/vite_plugin_library_well_known.ts +2 -2
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * For build-tool agnostic usage, see `library_generate.ts`.
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 `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
13
13
  *
14
14
  * @module
15
15
  */
@@ -46,6 +46,7 @@ export interface LibraryGenOptions {
46
46
  * Use `library_throw_on_duplicates` for strict flat namespace enforcement.
47
47
  *
48
48
  * @example
49
+ * ```ts
49
50
  * // Throw on duplicates (strict flat namespace)
50
51
  * library_gen({ on_duplicates: library_throw_on_duplicates });
51
52
  *
@@ -57,12 +58,13 @@ export interface LibraryGenOptions {
57
58
  * }
58
59
  * }
59
60
  * });
61
+ * ```
60
62
  */
61
63
  on_duplicates?: OnDuplicatesCallback;
62
64
  }
63
65
 
64
66
  /**
65
- * Convert Gro's Disknode to the build-tool agnostic SourceFileInfo interface.
67
+ * Convert Gro's `Disknode` to the build-tool agnostic `SourceFileInfo` interface.
66
68
  *
67
69
  * Use this when you want to analyze files using Gro's filer directly.
68
70
  *
@@ -83,7 +85,7 @@ export const source_file_from_disknode = (disknode: Disknode): SourceFileInfo =>
83
85
  };
84
86
 
85
87
  /**
86
- * Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.
88
+ * Collect source files from Gro disknodes, filtering BEFORE conversion to `SourceFileInfo`.
87
89
  *
88
90
  * This avoids errors from files outside source directories (like test fixtures that may
89
91
  * have malformed paths or missing content). The filtering uses `module_is_source` which
@@ -129,12 +131,12 @@ export const library_collect_source_files_from_disknodes = (
129
131
  };
130
132
 
131
133
  /**
132
- * Creates a Gen object for generating library metadata with full TypeScript analysis.
134
+ * Creates a `Gen` object for generating library metadata with full TypeScript analysis.
133
135
  *
134
136
  * This is the Gro-specific entry point. It handles:
135
137
  * - Reading files from Gro's filer
136
- * - Loading package.json via Gro utilities
137
- * - Returning output in Gro's Gen format
138
+ * - Loading `package.json` via Gro utilities
139
+ * - Returning output in Gro's `Gen` format
138
140
  *
139
141
  * For build-tool agnostic usage, use `library_generate` directly.
140
142
  *
@@ -12,9 +12,9 @@
12
12
  * - Dependency graphs
13
13
  * - Svelte component props
14
14
  *
15
- * For Gro integration, see `library_gen.ts` which wraps this with Gro's Gen interface.
15
+ * For Gro integration, see `library_gen.ts` which wraps this with Gro's `Gen` interface.
16
16
  *
17
- * @see @fuzdev/fuz_util/source_json.js for type definitions
17
+ * @see `@fuzdev/fuz_util/source_json.js` for type definitions
18
18
  * @see `library_analysis.ts` for the unified analysis entry point
19
19
  * @see `library_pipeline.ts` for pipeline helpers
20
20
  * @see `library_output.ts` for JSON/TS file generation
@@ -67,9 +67,11 @@ export const url_package_logo = (
67
67
  * @returns root-relative URL starting with '/'
68
68
  *
69
69
  * @example
70
+ * ```ts
70
71
  * // Assuming page.url.origin is 'https://example.com'
71
72
  * url_to_root_relative('https://example.com/docs/api')
72
73
  * // => '/docs/api'
74
+ * ```
73
75
  */
74
76
  export const url_to_root_relative = (url: string, origin: string = page.url.origin): string => {
75
77
  const origin_with_slash = ensure_end(origin, '/');
@@ -1,11 +1,11 @@
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
5
  *
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
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
9
9
  *
10
10
  * @module
11
11
  */
@@ -19,14 +19,14 @@ import {library_json_parse, type LibraryJson} from '@fuzdev/fuz_util/library_jso
19
19
  * Contains both the JSON data and the TypeScript wrapper file.
20
20
  */
21
21
  export interface LibraryOutputResult {
22
- /** JSON content for library.json */
22
+ /** JSON content for `library.json`. */
23
23
  json_content: string;
24
- /** TypeScript wrapper content for library.ts */
24
+ /** TypeScript wrapper content for `library.ts`. */
25
25
  ts_content: string;
26
26
  }
27
27
 
28
28
  /**
29
- * Generate the library.json and library.ts file contents.
29
+ * Generate the `library.json` and `library.ts` file contents.
30
30
  * Parses at generation time so runtime only needs the pre-computed result.
31
31
  *
32
32
  * Returns JSON + .ts wrapper because:
@@ -6,15 +6,15 @@
6
6
  *
7
7
  * Pipeline stages:
8
8
  * 1. **Collection** - `library_collect_source_files` gathers and filters source files
9
- * 2. **Analysis** - `library_analyze_module` (in library_analysis.ts) extracts metadata
9
+ * 2. **Analysis** - `library_analyze_module` (in `library_analysis.ts`) extracts metadata
10
10
  * 3. **Validation** - `library_find_duplicates` checks flat namespace constraints
11
11
  * 4. **Transformation** - `library_merge_re_exports` resolves re-export relationships
12
12
  * 5. **Output** - `library_sort_modules` prepares deterministic output
13
13
  *
14
- * @see library_generate.ts for the main generation entry point
15
- * @see library_analysis.ts for module-level analysis
16
- * @see library_output.ts for output file generation (JSON/TS wrapper)
17
- * @see library_gen.ts for Gro-specific integration
14
+ * @see `library_generate.ts` for the main generation entry point
15
+ * @see `library_analysis.ts` for module-level analysis
16
+ * @see `library_output.ts` for output file generation (JSON/TS wrapper)
17
+ * @see `library_gen.ts` for Gro-specific integration
18
18
  *
19
19
  * @module
20
20
  */
@@ -48,6 +48,7 @@ export interface DuplicateInfo {
48
48
  * Callers can decide how to handle duplicates (throw, warn, ignore).
49
49
  *
50
50
  * @example
51
+ * ```ts
51
52
  * const duplicates = library_find_duplicates(source_json);
52
53
  * if (duplicates.size > 0) {
53
54
  * for (const [name, occurrences] of duplicates) {
@@ -58,6 +59,7 @@ export interface DuplicateInfo {
58
59
  * }
59
60
  * throw new Error(`Found ${duplicates.size} duplicate declaration names`);
60
61
  * }
62
+ * ```
61
63
  */
62
64
  export const library_find_duplicates = (
63
65
  source_json: SourceJson,
@@ -123,12 +125,14 @@ export interface CollectedReExport {
123
125
  * after all modules are analyzed.
124
126
  *
125
127
  * @example
128
+ * ```ts
126
129
  * // helpers.ts exports: foo, bar
127
130
  * // index.ts does: export {foo, bar} from './helpers.js'
128
131
  * //
129
132
  * // After processing:
130
133
  * // - helpers.ts foo declaration gets: also_exported_from: ['index.ts']
131
134
  * // - helpers.ts bar declaration gets: also_exported_from: ['index.ts']
135
+ * ```
132
136
  *
133
137
  * @param source_json - the source JSON with all modules (will be mutated)
134
138
  * @param collected_re_exports - array of re-exports collected during phase 1
package/src/lib/logos.ts CHANGED
@@ -63,9 +63,9 @@ export const logo_fuz = {
63
63
  ],
64
64
  } satisfies SvgData;
65
65
 
66
- export const logo_fuz_ui = {
67
- label: 'a friendly red spider facing you',
68
- fill: '#d93636',
66
+ export const logo_fuz_app = {
67
+ label: 'a friendly teal spider facing you',
68
+ fill: '#2e9e6f',
69
69
  paths: logo_fuz.paths,
70
70
  } satisfies SvgData;
71
71
 
@@ -76,6 +76,12 @@ export const logo_fuz_css = {
76
76
  attrs: {style: 'transform: scaleX(-1) rotate(180deg)'},
77
77
  } satisfies SvgData;
78
78
 
79
+ export const logo_fuz_ui = {
80
+ label: 'a friendly red spider facing you',
81
+ fill: '#d93636',
82
+ paths: logo_fuz.paths,
83
+ } satisfies SvgData;
84
+
79
85
  export const logo_fuz_code = {
80
86
  label: 'a friendly pink spider facing you',
81
87
  fill: '#e55d95',
@@ -24,7 +24,7 @@ export class Module {
24
24
  module_comment = $derived(this.module_json.module_comment);
25
25
 
26
26
  /**
27
- * Array of Declaration instances. Filters out default exports.
27
+ * Array of `Declaration` instances. Filters out default exports.
28
28
  */
29
29
  declarations = $derived(
30
30
  this.module_json.declarations
@@ -20,7 +20,7 @@ export type AnalyzerType = 'typescript' | 'svelte';
20
20
  /**
21
21
  * File information for source analysis.
22
22
  *
23
- * Can be constructed from Gro's Disknode or from plain file system access.
23
+ * Can be constructed from Gro's `Disknode` or from plain file system access.
24
24
  * This abstraction enables non-Gro usage while keeping Gro support via adapter.
25
25
  *
26
26
  * Note: `content` is required to keep analysis functions pure (no hidden I/O).
@@ -328,7 +328,7 @@ export const module_validate_source_options = (options: ModuleSourceOptions): vo
328
328
  *
329
329
  * Returns `source_root` if provided, otherwise returns `source_paths[0]` for single-path configs.
330
330
  *
331
- * @throws Error if source_root is required but not provided (multiple source_paths)
331
+ * @throws Error if `source_root` is required but not provided (multiple `source_paths`)
332
332
  */
333
333
  export const module_get_source_root = (options: ModuleSourceOptions): string => {
334
334
  if (options.source_root !== undefined) {
@@ -11,7 +11,7 @@
11
11
  * - `url_well_known` - .well-known metadata file
12
12
  *
13
13
  * Parsers:
14
- * - `repo_url_parse` - extract repo URL from package.json repository field
14
+ * - `repo_url_parse` - extract repo URL from `package.json` repository field
15
15
  * - `repo_name_parse` - extract repo name from scoped package name
16
16
  * - `repo_url_github_owner` - extract GitHub owner from repo URL
17
17
  *
@@ -115,7 +115,7 @@ export const url_npm_package = (package_name: string): string =>
115
115
  * - It has exports defined
116
116
  * - Its version is not the initial '0.0.1'
117
117
  *
118
- * @param package_json - the package.json object to check
118
+ * @param package_json - the `package.json` object to check
119
119
  * @returns `true` if the package appears to be published
120
120
  */
121
121
  export const package_is_published = (package_json: PackageJson): boolean => {
@@ -153,12 +153,12 @@ export const repo_name_parse = (name: string): string => {
153
153
  };
154
154
 
155
155
  /**
156
- * Parse repository URL from package.json format.
156
+ * Parse repository URL from `package.json` format.
157
157
  *
158
158
  * Handles both string format and object format with `url` property.
159
159
  * Strips common prefixes ('git+') and suffixes ('.git', '/').
160
160
  *
161
- * @param repository - the repository field from package.json
161
+ * @param repository - the repository field from `package.json`
162
162
  * @returns clean repository URL, or null if not provided
163
163
  *
164
164
  * @example
@@ -59,20 +59,20 @@ export interface SveltePreprocessMdzOptions {
59
59
  * Value: import path (e.g., '$lib/Alert.svelte').
60
60
  *
61
61
  * If mdz content references a component not in this map,
62
- * that Mdz usage is skipped (left as runtime).
62
+ * that `Mdz` usage is skipped (left as runtime).
63
63
  */
64
64
  components?: Record<string, string>;
65
65
 
66
66
  /**
67
67
  * Allowed HTML elements in mdz content.
68
68
  * If mdz content references an element not in this list,
69
- * that Mdz usage is skipped (left as runtime).
69
+ * that `Mdz` usage is skipped (left as runtime).
70
70
  */
71
71
  elements?: Array<string>;
72
72
 
73
73
  /**
74
- * Import sources that resolve to the Mdz component.
75
- * Used to verify that `Mdz` in templates refers to fuz_ui's Mdz.svelte.
74
+ * Import sources that resolve to the `Mdz` component.
75
+ * Used to verify that `Mdz` in templates refers to fuz_ui's `Mdz.svelte`.
76
76
  *
77
77
  * @default ['@fuzdev/fuz_ui/Mdz.svelte']
78
78
  */
@@ -204,9 +204,9 @@ interface MdzTransformation {
204
204
 
205
205
  interface FindMdzUsagesResult {
206
206
  transformations: Array<MdzTransformation>;
207
- /** Total template usages per Mdz local name. */
207
+ /** Total template usages per `Mdz` local name. */
208
208
  total_usages: Map<string, number>;
209
- /** Successfully transformed usages per Mdz local name. */
209
+ /** Successfully transformed usages per `Mdz` local name. */
210
210
  transformed_usages: Map<string, number>;
211
211
  }
212
212
 
@@ -487,7 +487,7 @@ const remove_dead_const_bindings = (
487
487
  };
488
488
 
489
489
  /**
490
- * Builds the replacement string for a transformed Mdz component.
490
+ * Builds the replacement string for a transformed `Mdz` component.
491
491
  *
492
492
  * Reconstructs the opening tag as `<MdzPrecompiled` with all attributes except `content`,
493
493
  * using source text slicing to preserve exact formatting and dynamic expressions.
@@ -515,24 +515,24 @@ const build_replacement = (
515
515
  return `${opening}${children_markup}</${PRECOMPILED_NAME}>`;
516
516
  };
517
517
 
518
- /** Result of import removability analysis for a single Mdz name. */
518
+ /** Result of import removability analysis for a single `Mdz` name. */
519
519
  interface ImportRemovalAction {
520
520
  /** The import declaration node. */
521
521
  node: PositionedImportDeclaration;
522
- /** 'full' removes the entire declaration; 'partial' removes only the Mdz specifier. */
522
+ /** 'full' removes the entire declaration; 'partial' removes only the `Mdz` specifier. */
523
523
  kind: 'full' | 'partial';
524
524
  /** For partial removal: the specifier to remove. */
525
525
  specifier_to_remove?: ImportDeclaration['specifiers'][number];
526
526
  }
527
527
 
528
528
  /**
529
- * Determines which Mdz import declarations can be safely removed or trimmed.
529
+ * Determines which `Mdz` import declarations can be safely removed or trimmed.
530
530
  *
531
531
  * An import is removable when:
532
532
  * 1. All template usages of that name were successfully transformed.
533
533
  * 2. The identifier is not referenced elsewhere in script or template expressions.
534
534
  *
535
- * For multi-specifier imports, only the Mdz specifier is removed (partial removal).
535
+ * For multi-specifier imports, only the `Mdz` specifier is removed (partial removal).
536
536
  * For single-specifier imports, the entire declaration is removed.
537
537
  */
538
538
  const find_removable_mdz_imports = (
@@ -587,13 +587,13 @@ const find_removable_mdz_imports = (
587
587
  * Manages import additions and removals.
588
588
  *
589
589
  * Adds the `MdzPrecompiled` import and other required imports (DocsLink, Code, resolve).
590
- * Removes Mdz import declarations that are no longer referenced.
590
+ * Removes `Mdz` import declarations that are no longer referenced.
591
591
  *
592
592
  * Handles both full removal (single-specifier imports) and partial removal
593
- * (multi-specifier imports where only the Mdz specifier is removed).
593
+ * (multi-specifier imports where only the `Mdz` specifier is removed).
594
594
  *
595
595
  * To avoid MagicString boundary conflicts when the insertion position falls inside
596
- * a removal range, one removable Mdz import is overwritten with the MdzPrecompiled
596
+ * a removal range, one removable `Mdz` import is overwritten with the `MdzPrecompiled`
597
597
  * import line instead of using separate remove + appendLeft.
598
598
  */
599
599
  const manage_imports = (
@@ -32,7 +32,7 @@ import type {DeclarationAnalysis, ReExportInfo, ModuleAnalysis} from './library_
32
32
  export interface TsProgramOptions {
33
33
  /** Project root directory. @default './' */
34
34
  root?: string;
35
- /** Path to tsconfig.json (relative to root). @default 'tsconfig.json' */
35
+ /** Path to `tsconfig.json` (relative to root). @default 'tsconfig.json' */
36
36
  tsconfig?: string;
37
37
  /** Override compiler options. */
38
38
  compiler_options?: ts.CompilerOptions;
@@ -54,7 +54,7 @@ export interface ModuleExportsAnalysis {
54
54
  module_comment?: string;
55
55
  /** All exported declarations with nodocs flags - consumer filters based on policy. */
56
56
  declarations: Array<DeclarationAnalysis>;
57
- /** Same-name re-exports (for building also_exported_from in post-processing). */
57
+ /** Same-name re-exports (for building `also_exported_from` in post-processing). */
58
58
  re_exports: Array<ReExportInfo>;
59
59
  /** Star exports (`export * from './module'`) - module paths that are fully re-exported. */
60
60
  star_exports: Array<string>;
@@ -66,7 +66,7 @@ export interface ModuleExportsAnalysis {
66
66
  * @param options - configuration options for program creation
67
67
  * @param log - optional logger for info messages
68
68
  * @returns the program and type checker
69
- * @throws Error if tsconfig.json is not found
69
+ * @throws Error if `tsconfig.json` is not found
70
70
  */
71
71
  export const ts_create_program = (options?: TsProgramOptions, log?: Logger): TsProgram => {
72
72
  const root = options?.root ?? './';
@@ -332,7 +332,7 @@ export const ts_analyze_declaration = (
332
332
  * Requires `@module` tag to identify module comments. The tag line is stripped
333
333
  * from the output. Supports optional module renaming: `@module custom-name`.
334
334
  *
335
- * @see https://typedoc.org/documents/Tags._module.html
335
+ * @see {@link https://typedoc.org/documents/Tags._module.html}
336
336
  */
337
337
  export const ts_extract_module_comment = (source_file: ts.SourceFile): string | undefined => {
338
338
  const full_text = source_file.getFullText();
@@ -6,7 +6,7 @@ import type {LibraryJson} from '@fuzdev/fuz_util/library_json.js';
6
6
 
7
7
  export interface VitePluginLibraryWellKnownOptions {
8
8
  /**
9
- * Path to the library.json file (relative to vite.config.ts).
9
+ * Path to the `library.json` file (relative to `vite.config.ts`).
10
10
  * @default './src/routes/library.json'
11
11
  */
12
12
  library_path?: string;
@@ -27,7 +27,7 @@ const respond_json = (res: ServerResponse, body: string): void => {
27
27
  /**
28
28
  * Vite plugin that publishes `package.json` and `library.json` to `.well-known/`.
29
29
  *
30
- * Requires a generated library.json file (created by `library_gen` from `gro gen`).
30
+ * Requires a generated `library.json` file (created by `library_gen` from `gro gen`).
31
31
  * The plugin reads this JSON file and publishes its metadata to `.well-known/` for
32
32
  * both dev and production builds.
33
33
  *