@fuzdev/fuz_ui 0.199.0 โ†’ 0.201.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { type DialogContext, type DialogCloseButtonAttrs } from './dialog.js';
4
+ type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
5
+ /**
6
+ * The content surface's padding, set as an inline style. Defaults to
7
+ * `var(--space_xl)` for a comfortable gutter between the card edge and its
8
+ * content. Set to `''` or `'0'` for no padding (e.g. a flush image or a
9
+ * surface that manages its own spacing).
10
+ * @default 'var(--space_xl)'
11
+ */
12
+ padding?: string;
13
+ /**
14
+ * Whether to apply the fuz_css `.pane` card class to the content surface --
15
+ * its opaque background, shadow, and rounded corners. `true` (the default) is
16
+ * the standard dialog card; `false` gives a chromeless surface. Either way the
17
+ * surface registers with `Dialog`, so click-outside-to-close keeps working.
18
+ * @default true
19
+ */
20
+ pane?: boolean;
21
+ /**
22
+ * The gutter around the `.pane` card -- its outer margin, and so the area
23
+ * outside the card where a press dismisses the dialog. Set to `''` or `'0'` to remove.
24
+ * @default 'var(--space_xl3)'
25
+ */
26
+ gutter?: string;
27
+ /**
28
+ * The card's max width. The card shrinks to its content and is capped here,
29
+ * so narrow content stays narrow while wide content doesn't sprawl. Set to
30
+ * `''` for no cap (pure shrink-to-content).
31
+ * @default 'var(--distance_md)'
32
+ */
33
+ max_width?: string;
34
+ /**
35
+ * The close button floating just outside the content surface's top-right
36
+ * corner. `true` (the default) renders an absolutely-positioned `.sm.plain.icon_button`
37
+ * that closes the dialog; `false` removes it. It renders after
38
+ * `children`, so a content control (or an `autofocus` element) takes initial
39
+ * focus on open rather than the close button.
40
+ *
41
+ * Pass a `Snippet` to render your own. It receives `attrs`
42
+ * (`DialogCloseButtonAttrs`) carrying the default's placement, styling, a11y,
43
+ * and `onclick` (closes the dialog), plus the `DialogContext` (e.g. `{close}`).
44
+ * Spread `attrs` onto a `<button>` to inherit the corner anchoring and override
45
+ * only what differs (e.g. the glyph), or drop it to place the button freely. The
46
+ * surface is a containing block (`position: relative`), so an absolutely-positioned
47
+ * custom button anchors to it.
48
+ * @default true
49
+ */
50
+ close_button?: boolean | Snippet<[attrs: DialogCloseButtonAttrs, dialog: DialogContext]>;
51
+ /**
52
+ * Rendered inside the content surface. Receives the `DialogContext` (e.g.
53
+ * `{close}`) so content can close the dialog without reaching into `Dialog`'s
54
+ * `children` snippet.
55
+ *
56
+ * The default `close_button` renders as the surface's last child (so a content
57
+ * control or `autofocus` element wins initial focus over it). Because it's a
58
+ * real child, it throws off universal child-spacing selectors: your content's
59
+ * last element is no longer `:last-child` (so `> :not(:last-child)` matches it
60
+ * and `> :last-child` skips it), and `> * + *` matches the button itself. Either
61
+ * scope spacing to your own elements or a class, or wrap your content in a single
62
+ * element so its child selectors no longer see the button.
63
+ */
64
+ children: Snippet<[dialog: DialogContext]>;
65
+ };
66
+ declare const DialogContent: import("svelte").Component<$$ComponentProps, {}, "">;
67
+ type DialogContent = ReturnType<typeof DialogContent>;
68
+ export default DialogContent;
69
+ //# sourceMappingURL=DialogContent.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContent.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/DialogContent.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAC,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAiB,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAE3F,KAAK,gBAAgB,GAAI,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IAC3E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACzF;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CAC3C,CAAC;AAoEH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -35,8 +35,8 @@
35
35
  {name: 'fuz_css', url: 'https://css.fuz.dev/', logo: logo_fuz_css, description: 'CSS framework and design system', glyph: '๐ŸŒฟ', color_class: 'color_b_50'},
36
36
  {name: 'fuz_ui', url: 'https://ui.fuz.dev/', logo: logo_fuz_ui, description: 'Svelte UI library', glyph: '๐Ÿงถ', color_class: 'color_c_50'},
37
37
  {name: 'fuz_template', url: 'https://template.fuz.dev/', logo: logo_fuz_template, description: 'a static web app and Node library template with TypeScript, Svelte, SvelteKit, Vite, esbuild, Fuz, and Gro', glyph: 'โ„', color_class: 'color_h_50'},
38
- {name: 'fuz_code', url: 'https://code.fuz.dev/', logo: logo_fuz_code, description: 'syntax styling utilities and components for TypeScript, Svelte, SvelteKit', glyph: '๐ŸŽจ', color_class: 'color_g_50'},
39
38
  {name: 'fuz_blog', url: 'https://blog.fuz.dev/', logo: logo_fuz_blog, description: 'blog software from scratch with SvelteKit', glyph: '๐Ÿ–Š๏ธ', color_class: 'color_e_50'},
39
+ {name: 'fuz_code', url: 'https://code.fuz.dev/', logo: logo_fuz_code, description: 'syntax styling utilities and components for TypeScript, Svelte, SvelteKit', glyph: '๐ŸŽจ', color_class: 'color_g_50'},
40
40
  {name: 'fuz_mastodon', url: 'https://mastodon.fuz.dev/', logo: logo_fuz_mastodon, description: 'Mastodon components and helpers for Svelte, SvelteKit, and Fuz', glyph: '๐Ÿฆฃ', color_class: 'color_d_50'},
41
41
  {name: 'fuz_gitops', url: 'https://gitops.fuz.dev/', logo: logo_fuz_gitops, description: 'a tool for managing many repos', glyph: '๐Ÿช„', color_class: 'color_a_50'},
42
42
  {name: 'fuz_docs', url: 'https://docs.fuz.dev/', logo: logo_fuz_docs, description: 'AI-generated documentation and skills for the Fuz stack', glyph: '๐Ÿ“œ', color_class: 'color_i_50'},
@@ -1 +1 @@
1
- {"version":3,"file":"api_search.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/api_search.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QACR,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACxB,CAAC;IACF,YAAY,EAAE;QACb,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;KAC7B,CAAC;CACF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,KAAG,cA8CpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,GAC5C,cAAc,KAAK,CAAC,WAAW,CAAC,KAC9B,sBAyCF,CAAC"}
1
+ {"version":3,"file":"api_search.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/api_search.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QACR,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACxB,CAAC;IACF,YAAY,EAAE;QACb,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;KAC7B,CAAC;CACF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,KAAG,cA+CpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,GAC5C,cAAc,KAAK,CAAC,WAAW,CAAC,KAC9B,sBA0CF,CAAC"}
@@ -19,7 +19,8 @@ export const create_api_search = (library) => {
19
19
  const all_declarations = $derived(library.declarations);
20
20
  const filtered_declarations = $derived.by(() => {
21
21
  const items = query.trim() ? library.search_declarations(query) : all_declarations;
22
- return items.sort((a, b) => a.name.localeCompare(b.name));
22
+ // spread before sort โ€” `items` may be the shared source array
23
+ return [...items].sort((a, b) => a.name.localeCompare(b.name));
23
24
  });
24
25
  return {
25
26
  get query() {
@@ -54,8 +55,9 @@ export const create_module_declaration_search = (declarations) => {
54
55
  const all = $derived(declarations);
55
56
  const filtered = $derived.by(() => {
56
57
  const trimmed_query = query.trim();
58
+ // spread before sort โ€” `all` is the shared source array
57
59
  if (!trimmed_query)
58
- return all.sort((a, b) => a.name.localeCompare(b.name));
60
+ return [...all].sort((a, b) => a.name.localeCompare(b.name));
59
61
  const terms = trimmed_query.toLowerCase().split(/\s+/);
60
62
  const items = all.filter((d) => {
61
63
  const name_lower = d.name.toLowerCase();
@@ -293,10 +293,21 @@ export declare class Declaration {
293
293
  module: string;
294
294
  name: string;
295
295
  } | undefined;
296
+ /**
297
+ * Other modules that also export this declaration (re-export paths
298
+ * relative to src/lib). Absent when only exported from its defining module.
299
+ */
300
+ also_exported_from: string[] | undefined;
296
301
  /**
297
302
  * Mutation documentation from `@mutates` tags, mapping parameter names to descriptions.
298
303
  */
299
304
  mutates: Record<string, string> | undefined;
305
+ /**
306
+ * Svelte reactivity flavor (`$state`, `$state.raw`, `$derived`, `$derived.by`)
307
+ * when this variable is initialized with a value-producing rune.
308
+ * Present on `variable` kind only.
309
+ */
310
+ reactivity: "$state" | "$state.raw" | "$derived" | "$derived.by" | undefined;
300
311
  has_examples: boolean;
301
312
  is_deprecated: boolean;
302
313
  has_documentation: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,oBAAoB,EAKpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAc/C;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAiB;IACxC,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAiB;IAEhE,OAAO,wCAAiC;IAExC;;OAE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;;;;;;;;;;kBAA2C;IAEnD;;;OAGG;IACH,kBAAkB,uBAA6E;IAE/F;;OAEG;IACH,OAAO,qCAA2C;IAElD;;;;OAIG;IACH,UAAU,mEAAoE;IAE9E,YAAY,UAAsC;IAElD,aAAa,UAAmD;IAChE,iBAAiB,UAAgC;IACjD,cAAc,UAA+D;IAC7E,SAAS,UAAqD;IAC9D,YAAY,UAA4C;gBAE5C,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,oBAAoB;CAIlE"}
@@ -99,12 +99,24 @@ export class Declaration {
99
99
  * Re-export alias info when this declaration is a renamed re-export.
100
100
  */
101
101
  alias_of = $derived(this.declaration_json.aliasOf);
102
+ /**
103
+ * Other modules that also export this declaration (re-export paths
104
+ * relative to src/lib). Absent when only exported from its defining module.
105
+ */
106
+ also_exported_from = $derived(field(this.declaration_json, 'alsoExportedFrom'));
102
107
  /**
103
108
  * Mutation documentation from `@mutates` tags, mapping parameter names to descriptions.
104
109
  */
105
110
  mutates = $derived(this.declaration_json.mutates);
111
+ /**
112
+ * Svelte reactivity flavor (`$state`, `$state.raw`, `$derived`, `$derived.by`)
113
+ * when this variable is initialized with a value-producing rune.
114
+ * Present on `variable` kind only.
115
+ */
116
+ reactivity = $derived(field(this.declaration_json, 'reactivity'));
106
117
  has_examples = $derived(this.examples.length > 0);
107
- is_deprecated = $derived(!!this.deprecated_message);
118
+ // presence, not truthiness โ€” a bare `@deprecated` (no message text) arrives as `''`
119
+ is_deprecated = $derived(this.deprecated_message !== undefined);
108
120
  has_documentation = $derived(!!this.doc_comment);
109
121
  has_parameters = $derived(!!(this.parameters && this.parameters.length > 0));
110
122
  has_props = $derived(!!(this.props && this.props.length > 0));
package/dist/dialog.d.ts CHANGED
@@ -1,24 +1,38 @@
1
- import type { ComponentProps, Component } from 'svelte';
2
- import type Dialog from './Dialog.svelte';
1
+ export type DialogAlign = 'center' | 'top';
2
+ export declare const dialog_aligns: Array<DialogAlign>;
3
3
  /**
4
- * This helper function is needed to construct `DialogParams` with type safety.
5
- * It uses TypeScript's inferred generics for functions,
6
- * which do not work for plain objects as of v5.0.4.
7
- * * `ContextmenuParams` uses a similar strategy.
4
+ * Set by `Dialog`, read by `DialogContent`. Lets the content surface close the
5
+ * dialog without the consumer threading `close` through the `children` snippet.
8
6
  */
9
- export declare const to_dialog_params: <T extends Component<any>>(Component: T, props: ComponentProps<T>, dialog_props?: Partial<ComponentProps<typeof Dialog>>) => DialogParams<T>;
7
+ export interface DialogContext {
8
+ /**
9
+ * Closes the dialog. When passed an event it's swallowed (default-prevented
10
+ * and propagation-stopped) before closing.
11
+ */
12
+ close: (e?: Event) => void;
13
+ /**
14
+ * Registers a content-surface element so a press inside it isn't treated as an
15
+ * outside-dismiss. The surface is known by node identity, independent of any
16
+ * class. Use as an attachment on the surface: `{@attach register_surface}`.
17
+ * Returns a cleanup that unregisters on unmount.
18
+ */
19
+ register_surface: (element: Element) => () => void;
20
+ }
21
+ export declare const dialog_context: {
22
+ get: (error_message?: string) => DialogContext;
23
+ get_maybe: () => DialogContext | undefined;
24
+ set: (value: DialogContext) => DialogContext;
25
+ };
10
26
  /**
11
- * This pattern is based on:
12
- * https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/main/src/01-props/09-svelte-component/Component.svelte
13
- * The main limitation is that the generic cannot be inferred automatically,
14
- * so we use `to_dialog_params` to construct instances in most cases.
15
- * Definining `DialogParams` with no concrete `T` lacks typechecking for `props`.
27
+ * The `attrs` a custom `DialogContent` `close_button` snippet receives.
28
+ * Spread onto a `<button>` to inherit the corner-anchored close button.
16
29
  */
17
- export interface DialogParams<T extends Component<any> = Component<any>> {
18
- Component: T;
19
- props: ComponentProps<T>;
20
- dialog_props?: Partial<ComponentProps<typeof Dialog>> | undefined;
30
+ export interface DialogCloseButtonAttrs {
31
+ type: 'button';
32
+ class: string;
33
+ style: string;
34
+ onclick: DialogContext['close'];
35
+ title: string;
36
+ 'aria-label': string;
21
37
  }
22
- export type DialogLayout = 'centered' | 'page';
23
- export declare const dialog_layouts: Array<DialogLayout>;
24
38
  //# sourceMappingURL=dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,EACxD,WAAW,CAAC,EACZ,OAAO,cAAc,CAAC,CAAC,CAAC,EACxB,eAAe,OAAO,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,KACnD,YAAY,CAAC,CAAC,CAIf,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC;IACtE,SAAS,EAAE,CAAC,CAAC;IACb,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CAClE;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;AAC/C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,YAAY,CAAwB,CAAC"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dialog.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC3C,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,WAAW,CAAqB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,cAAc;;;;CAAkC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACrB"}
package/dist/dialog.js CHANGED
@@ -1,12 +1,3 @@
1
- /**
2
- * This helper function is needed to construct `DialogParams` with type safety.
3
- * It uses TypeScript's inferred generics for functions,
4
- * which do not work for plain objects as of v5.0.4.
5
- * * `ContextmenuParams` uses a similar strategy.
6
- */
7
- export const to_dialog_params = (Component, props, dialog_props) => ({
8
- Component,
9
- props,
10
- dialog_props,
11
- });
12
- export const dialog_layouts = ['centered', 'page'];
1
+ import { create_context } from './context_helpers.js';
2
+ export const dialog_aligns = ['center', 'top'];
3
+ export const dialog_context = create_context();
@@ -59,6 +59,8 @@ export declare class Module {
59
59
  * Modules that import this (paths relative to src/lib).
60
60
  */
61
61
  dependents: string[];
62
+ has_dependencies: boolean;
63
+ has_dependents: boolean;
62
64
  constructor(library: Library, module_json: ModuleJsonInput);
63
65
  /**
64
66
  * Look up a declaration by name within this module.
@@ -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,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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;IAE9D;;OAEG;IACH,YAAY,WAAiD;IAE7D;;OAEG;IACH,UAAU,WAA+C;IAEzD,gBAAgB,EAAE,OAAO,CAA0C;IAEnE,cAAc,EAAE,OAAO,CAAwC;gBAEnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe;IAK1D;;OAEG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;CAG9D"}
@@ -68,6 +68,8 @@ export class Module {
68
68
  * Modules that import this (paths relative to src/lib).
69
69
  */
70
70
  dependents = $derived(this.module_json.dependents ?? []);
71
+ has_dependencies = $derived(this.dependencies.length > 0);
72
+ has_dependents = $derived(this.dependents.length > 0);
71
73
  constructor(library, module_json) {
72
74
  this.library = library;
73
75
  this.module_json = module_json;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_ui",
3
- "version": "0.199.0",
3
+ "version": "0.201.0",
4
4
  "description": "Svelte UI library",
5
5
  "tagline": "friendly user zystem",
6
6
  "glyph": "๐Ÿงถ",
@@ -82,10 +82,10 @@
82
82
  "devDependencies": {
83
83
  "@changesets/changelog-git": "^0.2.1",
84
84
  "@fuzdev/blake3_wasm": "^0.1.1",
85
- "@fuzdev/fuz_code": "^0.45.1",
86
- "@fuzdev/fuz_css": "^0.61.1",
85
+ "@fuzdev/fuz_code": "^0.46.0",
86
+ "@fuzdev/fuz_css": "^0.62.0",
87
87
  "@fuzdev/fuz_util": "^0.65.1",
88
- "@fuzdev/gro": "^0.203.0",
88
+ "@fuzdev/gro": "^0.204.0",
89
89
  "@jridgewell/trace-mapping": "^0.3.31",
90
90
  "@ryanatkn/eslint-config": "^0.12.1",
91
91
  "@sveltejs/acorn-typescript": "^1.0.9",
@@ -99,13 +99,13 @@
99
99
  "eslint": "^9.39.4",
100
100
  "eslint-plugin-svelte": "^3.19.0",
101
101
  "esm-env": "^1.2.2",
102
- "jsdom": "^27.2.0",
102
+ "jsdom": "^29.1.1",
103
103
  "magic-string": "^0.30.21",
104
104
  "prettier": "^3.7.4",
105
105
  "prettier-plugin-svelte": "^3.5.1",
106
106
  "svelte": "^5.56.0",
107
107
  "svelte-check": "^4.4.8",
108
- "svelte-docinfo": "^0.4.0",
108
+ "svelte-docinfo": "^0.4.1",
109
109
  "svelte2tsx": "^0.7.55",
110
110
  "tslib": "^2.8.1",
111
111
  "typescript": "^5.9.3",
@@ -42,7 +42,8 @@ export const create_api_search = (library: Library): ApiSearchState => {
42
42
  const all_declarations = $derived(library.declarations);
43
43
  const filtered_declarations = $derived.by(() => {
44
44
  const items = query.trim() ? library.search_declarations(query) : all_declarations;
45
- return items.sort((a, b) => a.name.localeCompare(b.name));
45
+ // spread before sort โ€” `items` may be the shared source array
46
+ return [...items].sort((a, b) => a.name.localeCompare(b.name));
46
47
  });
47
48
 
48
49
  return {
@@ -83,7 +84,8 @@ export const create_module_declaration_search = (
83
84
 
84
85
  const filtered = $derived.by(() => {
85
86
  const trimmed_query = query.trim();
86
- if (!trimmed_query) return all.sort((a, b) => a.name.localeCompare(b.name));
87
+ // spread before sort โ€” `all` is the shared source array
88
+ if (!trimmed_query) return [...all].sort((a, b) => a.name.localeCompare(b.name));
87
89
 
88
90
  const terms = trimmed_query.toLowerCase().split(/\s+/);
89
91
 
@@ -5,6 +5,7 @@ import type {
5
5
  ParameterJsonInput,
6
6
  ComponentPropJsonInput,
7
7
  OverloadJsonInput,
8
+ Reactivity,
8
9
  } from 'svelte-docinfo/types.js';
9
10
  import {generateImport, getDisplayName} from 'svelte-docinfo/declaration-helpers.js';
10
11
 
@@ -141,13 +142,27 @@ export class Declaration {
141
142
  */
142
143
  alias_of = $derived(this.declaration_json.aliasOf);
143
144
 
145
+ /**
146
+ * Other modules that also export this declaration (re-export paths
147
+ * relative to src/lib). Absent when only exported from its defining module.
148
+ */
149
+ also_exported_from = $derived(field<Array<string>>(this.declaration_json, 'alsoExportedFrom'));
150
+
144
151
  /**
145
152
  * Mutation documentation from `@mutates` tags, mapping parameter names to descriptions.
146
153
  */
147
154
  mutates = $derived(this.declaration_json.mutates);
148
155
 
156
+ /**
157
+ * Svelte reactivity flavor (`$state`, `$state.raw`, `$derived`, `$derived.by`)
158
+ * when this variable is initialized with a value-producing rune.
159
+ * Present on `variable` kind only.
160
+ */
161
+ reactivity = $derived(field<Reactivity>(this.declaration_json, 'reactivity'));
162
+
149
163
  has_examples = $derived(this.examples.length > 0);
150
- is_deprecated = $derived(!!this.deprecated_message);
164
+ // presence, not truthiness โ€” a bare `@deprecated` (no message text) arrives as `''`
165
+ is_deprecated = $derived(this.deprecated_message !== undefined);
151
166
  has_documentation = $derived(!!this.doc_comment);
152
167
  has_parameters = $derived(!!(this.parameters && this.parameters.length > 0));
153
168
  has_props = $derived(!!(this.props && this.props.length > 0));
package/src/lib/dialog.ts CHANGED
@@ -1,35 +1,38 @@
1
- import type {ComponentProps, Component} from 'svelte';
1
+ import {create_context} from './context_helpers.js';
2
2
 
3
- import type Dialog from './Dialog.svelte';
3
+ export type DialogAlign = 'center' | 'top';
4
+ export const dialog_aligns: Array<DialogAlign> = ['center', 'top'];
4
5
 
5
6
  /**
6
- * This helper function is needed to construct `DialogParams` with type safety.
7
- * It uses TypeScript's inferred generics for functions,
8
- * which do not work for plain objects as of v5.0.4.
9
- * * `ContextmenuParams` uses a similar strategy.
7
+ * Set by `Dialog`, read by `DialogContent`. Lets the content surface close the
8
+ * dialog without the consumer threading `close` through the `children` snippet.
10
9
  */
11
- export const to_dialog_params = <T extends Component<any>>(
12
- Component: T,
13
- props: ComponentProps<T>,
14
- dialog_props?: Partial<ComponentProps<typeof Dialog>>,
15
- ): DialogParams<T> => ({
16
- Component,
17
- props,
18
- dialog_props,
19
- });
10
+ export interface DialogContext {
11
+ /**
12
+ * Closes the dialog. When passed an event it's swallowed (default-prevented
13
+ * and propagation-stopped) before closing.
14
+ */
15
+ close: (e?: Event) => void;
16
+ /**
17
+ * Registers a content-surface element so a press inside it isn't treated as an
18
+ * outside-dismiss. The surface is known by node identity, independent of any
19
+ * class. Use as an attachment on the surface: `{@attach register_surface}`.
20
+ * Returns a cleanup that unregisters on unmount.
21
+ */
22
+ register_surface: (element: Element) => () => void;
23
+ }
24
+
25
+ export const dialog_context = create_context<DialogContext>();
20
26
 
21
27
  /**
22
- * This pattern is based on:
23
- * https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/main/src/01-props/09-svelte-component/Component.svelte
24
- * The main limitation is that the generic cannot be inferred automatically,
25
- * so we use `to_dialog_params` to construct instances in most cases.
26
- * Definining `DialogParams` with no concrete `T` lacks typechecking for `props`.
28
+ * The `attrs` a custom `DialogContent` `close_button` snippet receives.
29
+ * Spread onto a `<button>` to inherit the corner-anchored close button.
27
30
  */
28
- export interface DialogParams<T extends Component<any> = Component<any>> {
29
- Component: T;
30
- props: ComponentProps<T>;
31
- dialog_props?: Partial<ComponentProps<typeof Dialog>> | undefined;
31
+ export interface DialogCloseButtonAttrs {
32
+ type: 'button';
33
+ class: string;
34
+ style: string;
35
+ onclick: DialogContext['close'];
36
+ title: string;
37
+ 'aria-label': string;
32
38
  }
33
-
34
- export type DialogLayout = 'centered' | 'page';
35
- export const dialog_layouts: Array<DialogLayout> = ['centered', 'page'];
@@ -90,6 +90,10 @@ export class Module {
90
90
  */
91
91
  dependents = $derived(this.module_json.dependents ?? []);
92
92
 
93
+ has_dependencies: boolean = $derived(this.dependencies.length > 0);
94
+
95
+ has_dependents: boolean = $derived(this.dependents.length > 0);
96
+
93
97
  constructor(library: Library, module_json: ModuleJsonInput) {
94
98
  this.library = library;
95
99
  this.module_json = module_json;
@@ -1,28 +0,0 @@
1
- <script lang="ts">
2
- import type {Snippet} from 'svelte';
3
-
4
- import type {DialogParams} from './dialog.js';
5
- import Dialog from './Dialog.svelte';
6
-
7
- // TODO this is experimental
8
-
9
- const {
10
- dialogs,
11
- onclose,
12
- children,
13
- }: {
14
- dialogs: Array<DialogParams>;
15
- onclose?: () => void;
16
- children?: Snippet<[dialog: DialogParams]>;
17
- } = $props();
18
- </script>
19
-
20
- {#each dialogs as dialog, index (dialog)}<Dialog
21
- {onclose}
22
- {...dialog.dialog_props}
23
- {index}
24
- active={index === dialogs.length - 1}
25
- >{#if children}{@render children(dialog)}{:else}<dialog.Component
26
- {...dialog.props}
27
- />{/if}</Dialog
28
- >{/each}
@@ -1,11 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { DialogParams } from './dialog.js';
3
- type $$ComponentProps = {
4
- dialogs: Array<DialogParams>;
5
- onclose?: () => void;
6
- children?: Snippet<[dialog: DialogParams]>;
7
- };
8
- declare const Dialogs: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type Dialogs = ReturnType<typeof Dialogs>;
10
- export default Dialogs;
11
- //# sourceMappingURL=Dialogs.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dialogs.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/Dialogs.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAG7C,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CAC3C,CAAC;AAoBH,QAAA,MAAM,OAAO,sDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}