@fuzdev/fuz_ui 0.187.1 → 0.189.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.
- package/README.md +2 -2
- package/dist/ColorSchemeInput.svelte +4 -2
- package/dist/ColorSchemeInput.svelte.d.ts.map +1 -1
- package/dist/ContextmenuEntry.svelte +4 -2
- package/dist/ContextmenuEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuLinkEntry.svelte +4 -2
- package/dist/ContextmenuLinkEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuRoot.svelte +1 -9
- package/dist/ContextmenuRoot.svelte.d.ts +0 -8
- package/dist/ContextmenuRoot.svelte.d.ts.map +1 -1
- package/dist/ContextmenuRootForSafariCompatibility.svelte +1 -9
- package/dist/ContextmenuRootForSafariCompatibility.svelte.d.ts +0 -8
- package/dist/ContextmenuRootForSafariCompatibility.svelte.d.ts.map +1 -1
- package/dist/ContextmenuSubmenu.svelte +6 -4
- package/dist/ContextmenuSubmenu.svelte.d.ts.map +1 -1
- package/dist/Docs.svelte +2 -2
- package/dist/LibraryDetail.svelte +7 -7
- package/dist/LibraryDetail.svelte.d.ts +1 -1
- package/dist/LibraryDetail.svelte.d.ts.map +1 -1
- package/dist/LibrarySummary.svelte +7 -7
- package/dist/LibrarySummary.svelte.d.ts +1 -1
- package/dist/LibrarySummary.svelte.d.ts.map +1 -1
- package/dist/Redirect.svelte +6 -8
- package/dist/Redirect.svelte.d.ts +2 -5
- package/dist/Redirect.svelte.d.ts.map +1 -1
- package/dist/ThemeInput.svelte +4 -2
- package/dist/ThemeInput.svelte.d.ts.map +1 -1
- package/dist/{Themed.svelte → ThemeRoot.svelte} +22 -21
- package/dist/{Themed.svelte.d.ts → ThemeRoot.svelte.d.ts} +11 -10
- package/dist/ThemeRoot.svelte.d.ts.map +1 -0
- package/dist/TomeContent.svelte +1 -1
- package/dist/TomeHeader.svelte +8 -9
- package/dist/TomeHeader.svelte.d.ts.map +1 -1
- package/dist/TomeSection.svelte +7 -6
- package/dist/TomeSection.svelte.d.ts +1 -1
- package/dist/TomeSection.svelte.d.ts.map +1 -1
- package/dist/TomeSectionHeader.svelte +7 -11
- package/dist/TomeSectionHeader.svelte.d.ts +1 -1
- package/dist/TomeSectionHeader.svelte.d.ts.map +1 -1
- package/dist/contextmenu_state.svelte.d.ts +3 -3
- package/dist/contextmenu_state.svelte.d.ts.map +1 -1
- package/dist/csp_of_fuzdev.d.ts +6 -0
- package/dist/csp_of_fuzdev.d.ts.map +1 -0
- package/dist/csp_of_fuzdev.js +9 -0
- package/dist/library.svelte.d.ts +1 -1
- package/dist/mdz_lexer.js +2 -2
- package/dist/{themer.svelte.d.ts → theme_state.svelte.d.ts} +10 -10
- package/dist/theme_state.svelte.d.ts.map +1 -0
- package/dist/{themer.svelte.js → theme_state.svelte.js} +3 -3
- package/dist/tome.d.ts +6 -62
- package/dist/tome.d.ts.map +1 -1
- package/dist/tome.js +2 -2
- package/package.json +9 -3
- package/src/lib/contextmenu_state.svelte.ts +1 -1
- package/src/lib/csp_of_fuzdev.ts +11 -0
- package/src/lib/mdz_lexer.ts +4 -4
- package/src/lib/{themer.svelte.ts → theme_state.svelte.ts} +7 -7
- package/src/lib/tome.ts +4 -4
- package/dist/Themed.svelte.d.ts.map +0 -1
- package/dist/csp_of_ryanatkn.d.ts +0 -6
- package/dist/csp_of_ryanatkn.d.ts.map +0 -1
- package/dist/csp_of_ryanatkn.js +0 -14
- package/dist/themer.svelte.d.ts.map +0 -1
- package/src/lib/csp_of_ryanatkn.ts +0 -16
package/README.md
CHANGED
|
@@ -59,10 +59,10 @@ import '@fuzdev/fuz_css/theme.css'; // or bring your own
|
|
|
59
59
|
import '$routes/fuz.css';
|
|
60
60
|
|
|
61
61
|
// then import Fuz Svelte components:
|
|
62
|
-
import
|
|
62
|
+
import ThemeRoot from '@fuzdev/fuz_ui/ThemeRoot.svelte';
|
|
63
63
|
|
|
64
64
|
// and Fuz TypeScript modules:
|
|
65
|
-
import {type Theme,
|
|
65
|
+
import {type Theme, theme_state_context} from '@fuzdev/fuz_ui/theme_state.svelte.js';
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
See [the library](https://ui.fuz.dev/docs) for more.
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import {color_schemes, type ColorScheme} from '@fuzdev/fuz_css/theme.js';
|
|
4
4
|
import type {SvelteHTMLElements} from 'svelte/elements';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {theme_state_context} from './theme_state.svelte.js';
|
|
7
|
+
|
|
8
|
+
const get_theme_state = theme_state_context.get();
|
|
7
9
|
|
|
8
10
|
const {
|
|
9
|
-
value =
|
|
11
|
+
value = get_theme_state(),
|
|
10
12
|
...rest
|
|
11
13
|
}: SvelteHTMLElements['menu'] & {
|
|
12
14
|
value?: {color_scheme: ColorScheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeInput.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ColorSchemeInput.svelte"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG;IACrD,KAAK,CAAC,EAAE;QAAC,YAAY,EAAE,WAAW,CAAA;KAAC,CAAC;CACpC,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorSchemeInput.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ColorSchemeInput.svelte"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG;IACrD,KAAK,CAAC,EAAE;QAAC,YAAY,EAAE,WAAW,CAAA;KAAC,CAAC;CACpC,CAAC;AAmCH,QAAA,MAAM,gBAAgB,sDAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
} = $props();
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const get_contextmenu = contextmenu_context.get();
|
|
21
|
+
const contextmenu = $derived(get_contextmenu());
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
// add_entry registers on the current instance at init — not reactive to contextmenu getter changes
|
|
24
|
+
const entry = get_contextmenu().add_entry(
|
|
23
25
|
() => run,
|
|
24
26
|
() => disabled_prop,
|
|
25
27
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextmenuEntry.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuEntry.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAIpC,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAEtF,KAAK,gBAAgB,GAAI;IACxB,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextmenuEntry.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuEntry.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAIpC,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAEtF,KAAK,gBAAgB,GAAI;IACxB,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA2DH,QAAA,MAAM,gBAAgB,sDAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -20,13 +20,15 @@
|
|
|
20
20
|
external_rel?: string;
|
|
21
21
|
} = $props();
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const get_contextmenu = contextmenu_context.get();
|
|
24
|
+
const contextmenu = $derived(get_contextmenu());
|
|
24
25
|
|
|
25
26
|
let anchor_el: HTMLAnchorElement | undefined = $state();
|
|
26
27
|
|
|
27
28
|
// Register with state management for keyboard navigation
|
|
28
29
|
// When activated via keyboard, programmatically click the anchor to trigger navigation
|
|
29
|
-
|
|
30
|
+
// add_entry registers on the current instance at init — not reactive to contextmenu getter changes
|
|
31
|
+
const entry = get_contextmenu().add_entry(
|
|
30
32
|
() => () => {
|
|
31
33
|
if (anchor_el) anchor_el.click();
|
|
32
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextmenuLinkEntry.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuLinkEntry.svelte"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAKnC,KAAK,gBAAgB,GAAI;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextmenuLinkEntry.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuLinkEntry.svelte"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAKnC,KAAK,gBAAgB,GAAI;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAkFH,QAAA,MAAM,oBAAoB,sDAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -55,14 +55,6 @@
|
|
|
55
55
|
separator_entry = separator_entry_default,
|
|
56
56
|
children,
|
|
57
57
|
}: {
|
|
58
|
-
/**
|
|
59
|
-
* The `contextmenu` prop is not reactive because that's a rare corner case and
|
|
60
|
-
* it's easier to put the `contextmenu` directly in the context
|
|
61
|
-
* rather than wrapping with a store or other reactivity.
|
|
62
|
-
* If you need to change the contextmenu prop for some reason, use a `{#key contextmenu}` block:
|
|
63
|
-
* https://svelte.dev/docs#template-syntax-key
|
|
64
|
-
* @nonreactive
|
|
65
|
-
*/
|
|
66
58
|
contextmenu?: ContextmenuState;
|
|
67
59
|
/**
|
|
68
60
|
* The number of pixels to offset from the pointer X position when opened.
|
|
@@ -117,7 +109,7 @@
|
|
|
117
109
|
children: Snippet;
|
|
118
110
|
} = $props();
|
|
119
111
|
|
|
120
|
-
contextmenu_context.set(contextmenu);
|
|
112
|
+
contextmenu_context.set(() => contextmenu);
|
|
121
113
|
|
|
122
114
|
if (DEV) contextmenu_check_global_root(() => scoped); // TODO @many is this import tree-shaken?
|
|
123
115
|
|
|
@@ -4,14 +4,6 @@ import ContextmenuLinkEntry from './ContextmenuLinkEntry.svelte';
|
|
|
4
4
|
import ContextmenuTextEntry from './ContextmenuTextEntry.svelte';
|
|
5
5
|
import ContextmenuSeparator from './ContextmenuSeparator.svelte';
|
|
6
6
|
type $$ComponentProps = {
|
|
7
|
-
/**
|
|
8
|
-
* The `contextmenu` prop is not reactive because that's a rare corner case and
|
|
9
|
-
* it's easier to put the `contextmenu` directly in the context
|
|
10
|
-
* rather than wrapping with a store or other reactivity.
|
|
11
|
-
* If you need to change the contextmenu prop for some reason, use a `{#key contextmenu}` block:
|
|
12
|
-
* https://svelte.dev/docs#template-syntax-key
|
|
13
|
-
* @nonreactive
|
|
14
|
-
*/
|
|
15
7
|
contextmenu?: ContextmenuState;
|
|
16
8
|
/**
|
|
17
9
|
* The number of pixels to offset from the pointer X position when opened.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextmenuRoot.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuRoot.svelte"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAGL,gBAAgB,EAGhB,MAAM,+BAA+B,CAAC;AACxC,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAahE,KAAK,gBAAgB,GAAI;IACxB
|
|
1
|
+
{"version":3,"file":"ContextmenuRoot.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuRoot.svelte"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAGL,gBAAgB,EAGhB,MAAM,+BAA+B,CAAC;AACxC,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAahE,KAAK,gBAAgB,GAAI;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3E;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3E;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChF,QAAQ,EAAE,OAAO,CAAC;CAClB,CAAC;AAsOH,QAAA,MAAM,eAAe,sDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
|
@@ -61,14 +61,6 @@
|
|
|
61
61
|
separator_entry = separator_entry_default,
|
|
62
62
|
children,
|
|
63
63
|
}: {
|
|
64
|
-
/**
|
|
65
|
-
* The `contextmenu` prop is not reactive because that's a rare corner case and
|
|
66
|
-
* it's easier to put the `contextmenu` directly in the context
|
|
67
|
-
* rather than wrapping with a store or other reactivity.
|
|
68
|
-
* If you need to change the contextmenu prop for some reason, use a `{#key contextmenu}` block:
|
|
69
|
-
* https://svelte.dev/docs#template-syntax-key
|
|
70
|
-
* @nonreactive
|
|
71
|
-
*/
|
|
72
64
|
contextmenu?: ContextmenuState;
|
|
73
65
|
/**
|
|
74
66
|
* The number of pixels the pointer can be moved without canceling `longpress`.
|
|
@@ -131,7 +123,7 @@
|
|
|
131
123
|
children: Snippet;
|
|
132
124
|
} = $props();
|
|
133
125
|
|
|
134
|
-
contextmenu_context.set(contextmenu);
|
|
126
|
+
contextmenu_context.set(() => contextmenu);
|
|
135
127
|
|
|
136
128
|
if (DEV) contextmenu_check_global_root(() => scoped); // TODO @many is this import tree-shaken?
|
|
137
129
|
|
|
@@ -4,14 +4,6 @@ import ContextmenuLinkEntry from './ContextmenuLinkEntry.svelte';
|
|
|
4
4
|
import ContextmenuTextEntry from './ContextmenuTextEntry.svelte';
|
|
5
5
|
import ContextmenuSeparator from './ContextmenuSeparator.svelte';
|
|
6
6
|
type $$ComponentProps = {
|
|
7
|
-
/**
|
|
8
|
-
* The `contextmenu` prop is not reactive because that's a rare corner case and
|
|
9
|
-
* it's easier to put the `contextmenu` directly in the context
|
|
10
|
-
* rather than wrapping with a store or other reactivity.
|
|
11
|
-
* If you need to change the contextmenu prop for some reason, use a `{#key contextmenu}` block:
|
|
12
|
-
* https://svelte.dev/docs#template-syntax-key
|
|
13
|
-
* @nonreactive
|
|
14
|
-
*/
|
|
15
7
|
contextmenu?: ContextmenuState;
|
|
16
8
|
/**
|
|
17
9
|
* The number of pixels the pointer can be moved without canceling `longpress`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextmenuRootForSafariCompatibility.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuRootForSafariCompatibility.svelte"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAGL,gBAAgB,EAGhB,MAAM,+BAA+B,CAAC;AACxC,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAehE,KAAK,gBAAgB,GAAI;IACxB
|
|
1
|
+
{"version":3,"file":"ContextmenuRootForSafariCompatibility.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuRootForSafariCompatibility.svelte"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAGL,gBAAgB,EAGhB,MAAM,+BAA+B,CAAC;AACxC,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAehE,KAAK,gBAAgB,GAAI;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3E;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3E;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChF,QAAQ,EAAE,OAAO,CAAC;CAClB,CAAC;AAoXH,QAAA,MAAM,qCAAqC,sDAAwC,CAAC;AACpF,KAAK,qCAAqC,GAAG,UAAU,CAAC,OAAO,qCAAqC,CAAC,CAAC;AACtG,eAAe,qCAAqC,CAAC"}
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
children: Snippet;
|
|
16
16
|
} = $props();
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const get_contextmenu = contextmenu_context.get();
|
|
19
|
+
const contextmenu = $derived(get_contextmenu());
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
// add_submenu registers on the current instance at init — not reactive to contextmenu getter changes
|
|
22
|
+
const submenu = get_contextmenu().add_submenu();
|
|
21
23
|
|
|
22
|
-
const {layout} = contextmenu;
|
|
24
|
+
const {layout} = $derived(contextmenu);
|
|
23
25
|
|
|
24
|
-
const selected = $derived(submenu
|
|
26
|
+
const {selected} = $derived(submenu);
|
|
25
27
|
|
|
26
28
|
let el: HTMLElement | undefined = $state();
|
|
27
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextmenuSubmenu.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuSubmenu.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAMnC,KAAK,gBAAgB,GAAI;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextmenuSubmenu.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ContextmenuSubmenu.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAMnC,KAAK,gBAAgB,GAAI;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CAClB,CAAC;AAoFH,QAAA,MAAM,kBAAkB,sDAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
package/dist/Docs.svelte
CHANGED
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
} = $props();
|
|
28
28
|
|
|
29
29
|
// TODO this API is messy, inconsistent usage of props/context
|
|
30
|
-
const tomes_by_name = new Map(tomes.map((t) => [t.name, t]));
|
|
31
|
-
tomes_context.set(tomes_by_name);
|
|
30
|
+
const tomes_by_name = $derived(new Map(tomes.map((t) => [t.name, t])));
|
|
31
|
+
tomes_context.set(() => tomes_by_name);
|
|
32
32
|
|
|
33
33
|
// TODO @many dialog navs - this is messy to satisfy SSR with the current design that puts the secondary nav in a dialog
|
|
34
34
|
const TERTIARY_NAV_BREAKPOINT = 1000;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
library,
|
|
20
20
|
repo_name,
|
|
21
21
|
description,
|
|
22
|
-
|
|
22
|
+
tagline,
|
|
23
23
|
npm_url,
|
|
24
24
|
homepage_url,
|
|
25
25
|
children,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
library: Library;
|
|
28
28
|
repo_name?: Snippet<[repo_name: string]>;
|
|
29
29
|
description?: Snippet<[description: string]>;
|
|
30
|
-
|
|
30
|
+
tagline?: Snippet<[description: string]>;
|
|
31
31
|
npm_url?: Snippet<[npm_url: string]>;
|
|
32
32
|
homepage_url?: Snippet<[homepage_url: string]>;
|
|
33
33
|
children?: Snippet<[library: Library]>;
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
<div class="description">{package_json.description}</div>
|
|
69
69
|
{/if}
|
|
70
70
|
{/if}
|
|
71
|
-
{#if package_json.
|
|
72
|
-
{#if
|
|
73
|
-
{@render
|
|
71
|
+
{#if package_json.tagline}
|
|
72
|
+
{#if tagline}
|
|
73
|
+
{@render tagline(package_json.tagline)}
|
|
74
74
|
{:else}
|
|
75
|
-
<div class="
|
|
75
|
+
<div class="tagline">{package_json.tagline}</div>
|
|
76
76
|
{/if}
|
|
77
77
|
{/if}
|
|
78
78
|
{#if library.npm_url}
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
.description {
|
|
246
246
|
margin-bottom: var(--space_lg);
|
|
247
247
|
}
|
|
248
|
-
.
|
|
248
|
+
.tagline {
|
|
249
249
|
margin-bottom: var(--space_lg);
|
|
250
250
|
}
|
|
251
251
|
.properties {
|
|
@@ -4,7 +4,7 @@ type $$ComponentProps = {
|
|
|
4
4
|
library: Library;
|
|
5
5
|
repo_name?: Snippet<[repo_name: string]>;
|
|
6
6
|
description?: Snippet<[description: string]>;
|
|
7
|
-
|
|
7
|
+
tagline?: Snippet<[description: string]>;
|
|
8
8
|
npm_url?: Snippet<[npm_url: string]>;
|
|
9
9
|
homepage_url?: Snippet<[homepage_url: string]>;
|
|
10
10
|
children?: Snippet<[library: Library]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibraryDetail.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/LibraryDetail.svelte"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAYhD,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,
|
|
1
|
+
{"version":3,"file":"LibraryDetail.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/LibraryDetail.svelte"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAYhD,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;CACvC,CAAC;AAuKH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
library,
|
|
11
11
|
repo_name,
|
|
12
12
|
logo,
|
|
13
|
-
|
|
13
|
+
tagline,
|
|
14
14
|
description,
|
|
15
15
|
npm_url,
|
|
16
16
|
homepage_url,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
library: Library;
|
|
20
20
|
repo_name?: Snippet<[repo_name: string]>;
|
|
21
21
|
logo?: Snippet<[logo_url: string, logo_alt: string]>;
|
|
22
|
-
|
|
22
|
+
tagline?: Snippet<[tagline: string, glyph?: string]>;
|
|
23
23
|
description?: Snippet<[description: string, glyph?: string]>;
|
|
24
24
|
npm_url?: Snippet<[npm_url: string]>;
|
|
25
25
|
homepage_url?: Snippet<[homepage_url: string]>;
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
{/if}
|
|
52
52
|
{/if}
|
|
53
53
|
</header>
|
|
54
|
-
{#if package_json.
|
|
55
|
-
{#if
|
|
56
|
-
{@render
|
|
54
|
+
{#if package_json.tagline}
|
|
55
|
+
{#if tagline}
|
|
56
|
+
{@render tagline(package_json.tagline, package_json.glyph)}
|
|
57
57
|
{:else}
|
|
58
58
|
<p class="panel py_md px_xl">
|
|
59
|
-
{package_json.
|
|
59
|
+
{package_json.tagline}
|
|
60
60
|
{package_json.glyph}
|
|
61
61
|
</p>
|
|
62
62
|
{/if}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
{:else}
|
|
68
68
|
<p class="text-align:center">
|
|
69
69
|
{package_json.description}
|
|
70
|
-
{#if !package_json.
|
|
70
|
+
{#if !package_json.tagline}
|
|
71
71
|
{package_json.glyph}
|
|
72
72
|
{/if}
|
|
73
73
|
</p>
|
|
@@ -4,7 +4,7 @@ type $$ComponentProps = {
|
|
|
4
4
|
library: Library;
|
|
5
5
|
repo_name?: Snippet<[repo_name: string]>;
|
|
6
6
|
logo?: Snippet<[logo_url: string, logo_alt: string]>;
|
|
7
|
-
|
|
7
|
+
tagline?: Snippet<[tagline: string, glyph?: string]>;
|
|
8
8
|
description?: Snippet<[description: string, glyph?: string]>;
|
|
9
9
|
npm_url?: Snippet<[npm_url: string]>;
|
|
10
10
|
homepage_url?: Snippet<[homepage_url: string]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibrarySummary.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/LibrarySummary.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAGpC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAGhD,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,
|
|
1
|
+
{"version":3,"file":"LibrarySummary.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/LibrarySummary.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAGpC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAGhD,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA2GH,QAAA,MAAM,cAAc,sDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
package/dist/Redirect.svelte
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import {page} from '$app/state';
|
|
3
3
|
import {strip_start} from '@fuzdev/fuz_util/string.js';
|
|
4
4
|
import {goto} from '$app/navigation';
|
|
5
|
-
import type
|
|
6
|
-
import {BROWSER} from 'esm-env';
|
|
5
|
+
import {onMount, type Snippet} from 'svelte';
|
|
7
6
|
|
|
8
7
|
const {
|
|
9
8
|
host = '',
|
|
@@ -12,26 +11,25 @@
|
|
|
12
11
|
children,
|
|
13
12
|
}: {
|
|
14
13
|
/**
|
|
15
|
-
* The target host to redirect to. Defaults to
|
|
16
|
-
* @nonreactive
|
|
14
|
+
* The target host to redirect to. Defaults to `''` (relative URL).
|
|
17
15
|
*/
|
|
18
16
|
host?: string;
|
|
19
17
|
/**
|
|
20
18
|
* The target path to redirect to. Defaults to the current `location.pathname`.
|
|
21
|
-
* @nonreactive
|
|
22
19
|
*/
|
|
23
20
|
path?: string;
|
|
24
21
|
/**
|
|
25
22
|
* Should the redirect happen automatically without user input? Defaults to `true`.
|
|
26
|
-
* @nonreactive
|
|
27
23
|
*/
|
|
28
24
|
auto?: boolean;
|
|
29
25
|
children?: Snippet<[url: string]>;
|
|
30
26
|
} = $props();
|
|
31
27
|
|
|
32
|
-
const url = host + path;
|
|
28
|
+
const url = $derived(host + path);
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
onMount(() => {
|
|
31
|
+
if (auto) void goto(url, {replaceState: true}); // eslint-disable-line svelte/no-navigation-without-resolve
|
|
32
|
+
});
|
|
35
33
|
</script>
|
|
36
34
|
|
|
37
35
|
<svelte:head>
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
/**
|
|
4
|
-
* The target host to redirect to. Defaults to
|
|
5
|
-
* @nonreactive
|
|
4
|
+
* The target host to redirect to. Defaults to `''` (relative URL).
|
|
6
5
|
*/
|
|
7
6
|
host?: string;
|
|
8
7
|
/**
|
|
9
8
|
* The target path to redirect to. Defaults to the current `location.pathname`.
|
|
10
|
-
* @nonreactive
|
|
11
9
|
*/
|
|
12
10
|
path?: string;
|
|
13
11
|
/**
|
|
14
12
|
* Should the redirect happen automatically without user input? Defaults to `true`.
|
|
15
|
-
* @nonreactive
|
|
16
13
|
*/
|
|
17
14
|
auto?: boolean;
|
|
18
15
|
children?: Snippet<[url: string]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Redirect.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/Redirect.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Redirect.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/Redirect.svelte"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,OAAO,EAAC,MAAM,QAAQ,CAAC;AAE5C,KAAK,gBAAgB,GAAI;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;CAClC,CAAC;AAgCH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
package/dist/ThemeInput.svelte
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
import {default_themes} from '@fuzdev/fuz_css/themes.js';
|
|
5
5
|
import type {SvelteHTMLElements} from 'svelte/elements';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {theme_state_context} from './theme_state.svelte.js';
|
|
8
|
+
|
|
9
|
+
const get_theme_state = theme_state_context.get();
|
|
8
10
|
|
|
9
11
|
const {
|
|
10
|
-
selected_theme =
|
|
12
|
+
selected_theme = get_theme_state(),
|
|
11
13
|
themes = default_themes,
|
|
12
14
|
enable_editing = false,
|
|
13
15
|
select = (theme) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeInput.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ThemeInput.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG;IACrD,cAAc,CAAC,EAAE;QAAC,KAAK,EAAE,KAAK,CAAA;KAAC,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeInput.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ThemeInput.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAIvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG;IACrD,cAAc,CAAC,EAAE;QAAC,KAAK,EAAE,KAAK,CAAA;KAAC,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC,CAAC;AAmDH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
sync_color_scheme as default_sync_color_scheme,
|
|
15
15
|
save_theme as default_save_theme,
|
|
16
16
|
load_theme as default_load_theme,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from './
|
|
17
|
+
theme_state_context,
|
|
18
|
+
ThemeState,
|
|
19
|
+
} from './theme_state.svelte.js';
|
|
20
20
|
import {effect_with_count} from './rune_helpers.svelte.js';
|
|
21
21
|
|
|
22
22
|
const {
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
load_theme = default_load_theme,
|
|
27
27
|
save_theme = default_save_theme,
|
|
28
28
|
theme_fallback,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
theme_state = new ThemeState({
|
|
30
|
+
theme: load_theme(theme_fallback),
|
|
31
|
+
color_scheme: load_color_scheme(),
|
|
32
|
+
}),
|
|
31
33
|
children,
|
|
32
34
|
}: {
|
|
33
35
|
sync_color_scheme?: typeof default_sync_color_scheme;
|
|
@@ -39,19 +41,18 @@
|
|
|
39
41
|
/**
|
|
40
42
|
* A reactive class containing the selected theme and color scheme.
|
|
41
43
|
* Defaults to the first default theme.
|
|
42
|
-
* The class reference is not reactive
|
|
43
|
-
* because it's set in context without a wrapper, use `{#key theme}` if it changes.
|
|
44
|
-
* @nonreactive
|
|
45
44
|
*/
|
|
46
|
-
|
|
47
|
-
children: Snippet<
|
|
45
|
+
theme_state?: ThemeState;
|
|
46
|
+
children: Snippet<
|
|
47
|
+
[theme_state: ThemeState, style: string | null, theme_style_html: string | null]
|
|
48
|
+
>;
|
|
48
49
|
} = $props();
|
|
49
50
|
|
|
50
|
-
// In dev mode only, warn about misuse of the singleton `
|
|
51
|
+
// In dev mode only, warn about misuse of the singleton `ThemeRoot`.
|
|
51
52
|
if (DEV) {
|
|
52
53
|
onMount(() => {
|
|
53
54
|
if (mounted) {
|
|
54
|
-
console.warn('more than one
|
|
55
|
+
console.warn('more than one ThemeRoot was mounted'); // eslint-disable-line no-console
|
|
55
56
|
}
|
|
56
57
|
mounted = true;
|
|
57
58
|
return () => {
|
|
@@ -61,34 +62,34 @@
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
|
-
* `
|
|
65
|
-
* It also sets in the Svelte context a reactive `
|
|
65
|
+
* `ThemeRoot` adds global color scheme and theme support to the page.
|
|
66
|
+
* It also sets in the Svelte context a reactive `theme_state` containing the theme and color scheme.
|
|
66
67
|
*
|
|
67
68
|
* @module
|
|
68
69
|
*/
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
theme_state_context.set(() => theme_state);
|
|
71
72
|
|
|
72
|
-
const selected_theme_name = $derived(
|
|
73
|
+
const selected_theme_name = $derived(theme_state.theme.name);
|
|
73
74
|
const style = $derived(
|
|
74
75
|
selected_theme_name === DEFAULT_THEME.name // TODO @many proper equality check, won't work when we allow editing, need an id or unique names and a deep equality check
|
|
75
76
|
? null
|
|
76
|
-
: render_theme_style(
|
|
77
|
+
: render_theme_style(theme_state.theme),
|
|
77
78
|
);
|
|
78
79
|
const theme_style_html = $derived(style ? `<style>${style}</style>` : null);
|
|
79
80
|
|
|
80
81
|
effect_with_count((count) => {
|
|
81
|
-
const v =
|
|
82
|
+
const v = theme_state.color_scheme;
|
|
82
83
|
if (count === 1) return;
|
|
83
84
|
sync_color_scheme(v);
|
|
84
85
|
});
|
|
85
86
|
effect_with_count((count) => {
|
|
86
|
-
const v =
|
|
87
|
+
const v = theme_state.color_scheme;
|
|
87
88
|
if (count === 1) return;
|
|
88
89
|
save_color_scheme(v); // helper may change, so is separate from `sync_color_scheme`
|
|
89
90
|
});
|
|
90
91
|
effect_with_count((count) => {
|
|
91
|
-
const v =
|
|
92
|
+
const v = theme_state.theme;
|
|
92
93
|
if (count === 1) return;
|
|
93
94
|
save_theme(v);
|
|
94
95
|
});
|
|
@@ -101,4 +102,4 @@
|
|
|
101
102
|
{#if theme_style_html}{@html theme_style_html}{/if}
|
|
102
103
|
</svelte:head>
|
|
103
104
|
|
|
104
|
-
{@render children(
|
|
105
|
+
{@render children(theme_state, style, theme_style_html)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import { type Theme } from '@fuzdev/fuz_css/theme.js';
|
|
3
|
-
import { load_color_scheme as default_load_color_scheme, save_color_scheme as default_save_color_scheme, sync_color_scheme as default_sync_color_scheme, save_theme as default_save_theme, load_theme as default_load_theme,
|
|
3
|
+
import { load_color_scheme as default_load_color_scheme, save_color_scheme as default_save_color_scheme, sync_color_scheme as default_sync_color_scheme, save_theme as default_save_theme, load_theme as default_load_theme, ThemeState } from './theme_state.svelte.js';
|
|
4
4
|
type $$ComponentProps = {
|
|
5
5
|
sync_color_scheme?: typeof default_sync_color_scheme;
|
|
6
6
|
load_color_scheme?: typeof default_load_color_scheme;
|
|
@@ -11,14 +11,15 @@ type $$ComponentProps = {
|
|
|
11
11
|
/**
|
|
12
12
|
* A reactive class containing the selected theme and color scheme.
|
|
13
13
|
* Defaults to the first default theme.
|
|
14
|
-
* The class reference is not reactive
|
|
15
|
-
* because it's set in context without a wrapper, use `{#key theme}` if it changes.
|
|
16
|
-
* @nonreactive
|
|
17
14
|
*/
|
|
18
|
-
|
|
19
|
-
children: Snippet<[
|
|
15
|
+
theme_state?: ThemeState;
|
|
16
|
+
children: Snippet<[
|
|
17
|
+
theme_state: ThemeState,
|
|
18
|
+
style: string | null,
|
|
19
|
+
theme_style_html: string | null
|
|
20
|
+
]>;
|
|
20
21
|
};
|
|
21
|
-
declare const
|
|
22
|
-
type
|
|
23
|
-
export default
|
|
24
|
-
//# sourceMappingURL=
|
|
22
|
+
declare const ThemeRoot: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
23
|
+
type ThemeRoot = ReturnType<typeof ThemeRoot>;
|
|
24
|
+
export default ThemeRoot;
|
|
25
|
+
//# sourceMappingURL=ThemeRoot.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeRoot.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ThemeRoot.svelte"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAqB,KAAK,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAIxE,OAAO,EACL,iBAAiB,IAAI,yBAAyB,EAC9C,iBAAiB,IAAI,yBAAyB,EAC9C,iBAAiB,IAAI,yBAAyB,EAC9C,UAAU,IAAI,kBAAkB,EAChC,UAAU,IAAI,kBAAkB,EAEhC,UAAU,EACV,MAAM,yBAAyB,CAAC;AAGjC,KAAK,gBAAgB,GAAI;IACxB,iBAAiB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACrD,iBAAiB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACrD,iBAAiB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACrD,UAAU,CAAC,EAAE,OAAO,kBAAkB,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,kBAAkB,CAAC;IACvC,cAAc,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,QAAQ,EAAE,OAAO,CAChB;QAAC,WAAW,EAAE,UAAU;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI;QAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI;KAAC,CAChF,CAAC;CACF,CAAC;AAoFH,QAAA,MAAM,SAAS,sDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
package/dist/TomeContent.svelte
CHANGED
package/dist/TomeHeader.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {page} from '$app/state';
|
|
3
|
-
import {onDestroy} from 'svelte';
|
|
4
3
|
import {DEV} from 'esm-env';
|
|
5
4
|
import type {SvelteHTMLElements} from 'svelte/elements';
|
|
6
5
|
|
|
@@ -11,17 +10,17 @@
|
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents
|
|
12
11
|
const props: SvelteHTMLElements['h1'] | SvelteHTMLElements['h2'] = $props();
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
if (DEV && !
|
|
13
|
+
const get_tome = tome_context.get();
|
|
14
|
+
if (DEV && !get_tome) throw Error('TomeHeader expects a tome in context'); // eslint-disable-line @typescript-eslint/no-unnecessary-condition
|
|
15
|
+
const tome = $derived(get_tome());
|
|
16
16
|
|
|
17
17
|
const docs_links = docs_links_context.get();
|
|
18
18
|
|
|
19
|
-
const fragment = docs_slugify(tome.name);
|
|
20
|
-
const path_slug = docs_slugify(tome.name);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
docs_links.remove(id);
|
|
19
|
+
const fragment = $derived(docs_slugify(tome.name));
|
|
20
|
+
const path_slug = $derived(docs_slugify(tome.name));
|
|
21
|
+
$effect(() => {
|
|
22
|
+
const id = docs_links.add(fragment, tome.name, page.url.pathname);
|
|
23
|
+
return () => docs_links.remove(id);
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
const {path, path_is_selected} = $derived(to_docs_path_info(path_slug, page.url.pathname));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TomeHeader.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TomeHeader.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TomeHeader.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TomeHeader.svelte"],"names":[],"mappings":"AA0DA,QAAA,MAAM,UAAU,kGAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|