@nil-/doc 2.0.1 → 2.0.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.
- package/components/Base.svelte +1 -4
- package/components/block/Instance.svelte.d.ts +13 -6
- package/components/block/Params.svelte +12 -8
- package/components/block/Template.svelte +1 -4
- package/components/block/Template.svelte.d.ts +13 -6
- package/components/block/controls/props/Props.svelte +1 -6
- package/components/block/controls/props/Range.svelte +11 -9
- package/components/block/controls/props/misc/GroupHeader.svelte +0 -1
- package/components/block/icons/Button.svelte +1 -1
- package/components/layout/Body.svelte +60 -0
- package/components/layout/Body.svelte.d.ts +19 -0
- package/components/layout/Content.svelte +0 -4
- package/components/layout/DocLayout.svelte +1 -2
- package/components/layout/Header.svelte +45 -0
- package/components/layout/Header.svelte.d.ts +9 -0
- package/components/layout/Layout.svelte +17 -81
- package/components/layout/Layout.svelte.d.ts +1 -1
- package/components/layout/{Container.svelte.d.ts → Split.svelte.d.ts} +3 -3
- package/components/navigation/Nav.svelte +8 -6
- package/components/navigation/Nav.svelte.d.ts +1 -1
- package/package.json +6 -2
- package/components/layout/VerticalPanel.svelte +0 -15
- package/components/layout/VerticalPanel.svelte.d.ts +0 -7
- /package/components/layout/{Container.svelte → Split.svelte} +0 -0
package/components/Base.svelte
CHANGED
|
@@ -11,16 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
<!-- prettier-ignore -->
|
|
13
13
|
<style>
|
|
14
|
-
div {
|
|
15
|
-
font-family: var(--nil-doc-font-family, ""), Consolas, Courier, 'Courier New', monospace;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
.fill {
|
|
19
15
|
width: 100%;
|
|
20
16
|
height: 100%;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
div {
|
|
20
|
+
font-family: var(--nil-doc-font-family, ""), Consolas, Courier, 'Courier New', monospace;
|
|
24
21
|
--i-nil-doc-color: var(--nil-doc-color, hsl(0, 0%, 0%));
|
|
25
22
|
--i-nil-doc-color-scheme: var(--nil-doc-color-scheme, light);
|
|
26
23
|
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { type Snippet } from "svelte";
|
|
2
|
-
declare
|
|
3
|
-
props
|
|
4
|
-
defaults?: Args
|
|
2
|
+
declare function $$render<Args>(): {
|
|
3
|
+
props: {
|
|
4
|
+
defaults?: Args;
|
|
5
5
|
noreset?: boolean;
|
|
6
6
|
children?: Snippet<[{
|
|
7
7
|
values: Args;
|
|
8
8
|
events: Record<string, (ev?: any) => void>;
|
|
9
9
|
key: boolean;
|
|
10
|
-
}]
|
|
10
|
+
}]>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
exports: {};
|
|
13
|
+
bindings: "";
|
|
14
|
+
slots: {};
|
|
15
|
+
events: {};
|
|
16
|
+
};
|
|
17
|
+
declare class __sveltets_Render<Args> {
|
|
18
|
+
props(): ReturnType<typeof $$render<Args>>['props'];
|
|
19
|
+
events(): ReturnType<typeof $$render<Args>>['events'];
|
|
20
|
+
slots(): ReturnType<typeof $$render<Args>>['slots'];
|
|
14
21
|
bindings(): "";
|
|
15
22
|
exports(): {};
|
|
16
23
|
}
|
|
@@ -15,14 +15,18 @@ params.update((p) => {
|
|
|
15
15
|
});
|
|
16
16
|
return p;
|
|
17
17
|
});
|
|
18
|
-
$effect(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
$effect(
|
|
19
|
+
() => params.update((p) => {
|
|
20
|
+
p[id].tag = tag ?? `${id}`;
|
|
21
|
+
return p;
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
$effect(
|
|
25
|
+
() => params.update((p) => {
|
|
26
|
+
p[id].values = resolve(props, {});
|
|
27
|
+
return p;
|
|
28
|
+
})
|
|
29
|
+
);
|
|
26
30
|
</script>
|
|
27
31
|
|
|
28
32
|
<!--
|
|
@@ -35,10 +35,7 @@ const resolveArgs = resolve;
|
|
|
35
35
|
-->
|
|
36
36
|
|
|
37
37
|
{#each $params as param (param.id)}
|
|
38
|
-
<Instance
|
|
39
|
-
defaults={resolveArgs($defaultsStore, param.values)}
|
|
40
|
-
{noreset}
|
|
41
|
-
>
|
|
38
|
+
<Instance defaults={resolveArgs($defaultsStore, param.values)} {noreset}>
|
|
42
39
|
{#snippet children({ values, events, key })}
|
|
43
40
|
{@render cc?.({
|
|
44
41
|
id: param.id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Snippet } from "svelte";
|
|
2
|
-
declare
|
|
3
|
-
props
|
|
4
|
-
defaults?: Args
|
|
2
|
+
declare function $$render<Args>(): {
|
|
3
|
+
props: {
|
|
4
|
+
defaults?: Args;
|
|
5
5
|
noreset?: boolean;
|
|
6
6
|
columns?: boolean;
|
|
7
7
|
children?: Snippet<[{
|
|
@@ -10,10 +10,17 @@ declare class __sveltets_Render<Args> {
|
|
|
10
10
|
values: Args;
|
|
11
11
|
events: Record<string, (ev?: any) => void>;
|
|
12
12
|
key: boolean;
|
|
13
|
-
}]
|
|
13
|
+
}]>;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
exports: {};
|
|
16
|
+
bindings: "";
|
|
17
|
+
slots: {};
|
|
18
|
+
events: {};
|
|
19
|
+
};
|
|
20
|
+
declare class __sveltets_Render<Args> {
|
|
21
|
+
props(): ReturnType<typeof $$render<Args>>['props'];
|
|
22
|
+
events(): ReturnType<typeof $$render<Args>>['events'];
|
|
23
|
+
slots(): ReturnType<typeof $$render<Args>>['slots'];
|
|
17
24
|
bindings(): "";
|
|
18
25
|
exports(): {};
|
|
19
26
|
}
|
|
@@ -16,15 +16,17 @@ const set_value = (v) => {
|
|
|
16
16
|
value = v;
|
|
17
17
|
};
|
|
18
18
|
$effect(() => set_value(enabled && !disabled ? ivalue : void 0));
|
|
19
|
-
let i = $derived(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
let i = $derived(
|
|
20
|
+
info instanceof Array ? {
|
|
21
|
+
min: info[2],
|
|
22
|
+
max: info[3],
|
|
23
|
+
step: info[4]
|
|
24
|
+
} : {
|
|
25
|
+
min: info.min,
|
|
26
|
+
max: info.max,
|
|
27
|
+
step: info.step
|
|
28
|
+
}
|
|
29
|
+
);
|
|
28
30
|
</script>
|
|
29
31
|
|
|
30
32
|
{#if visible}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">import Split from "./Split.svelte";
|
|
2
|
+
import Content from "./Content.svelte";
|
|
3
|
+
import Controls from "../block/controls/Controls.svelte";
|
|
4
|
+
import Scrollable from "./Scrollable.svelte";
|
|
5
|
+
import Nav from "../navigation/Nav.svelte";
|
|
6
|
+
let {
|
|
7
|
+
data,
|
|
8
|
+
current,
|
|
9
|
+
sorter,
|
|
10
|
+
renamer,
|
|
11
|
+
onnavigate,
|
|
12
|
+
offset = $bindable(250),
|
|
13
|
+
panelOffset = $bindable(4),
|
|
14
|
+
panel = $bindable(),
|
|
15
|
+
mode = $bindable("props"),
|
|
16
|
+
children
|
|
17
|
+
} = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Split bind:offset vertical b persistent>
|
|
21
|
+
{#snippet side_a()}
|
|
22
|
+
<Scrollable>
|
|
23
|
+
<Nav
|
|
24
|
+
info={data}
|
|
25
|
+
selected={current ?? ""}
|
|
26
|
+
{sorter}
|
|
27
|
+
{renamer}
|
|
28
|
+
{onnavigate}
|
|
29
|
+
/>
|
|
30
|
+
</Scrollable>
|
|
31
|
+
{/snippet}
|
|
32
|
+
{#snippet side_b()}
|
|
33
|
+
{#if panel == null}
|
|
34
|
+
<Scrollable>
|
|
35
|
+
<Content>
|
|
36
|
+
{#key current}
|
|
37
|
+
{@render children?.()}
|
|
38
|
+
{/key}
|
|
39
|
+
</Content>
|
|
40
|
+
</Scrollable>
|
|
41
|
+
{:else}
|
|
42
|
+
<Split vertical={"right" === panel} persistent bind:offset={panelOffset}>
|
|
43
|
+
{#snippet side_a()}
|
|
44
|
+
<Scrollable>
|
|
45
|
+
<Content>
|
|
46
|
+
{#key current}
|
|
47
|
+
{@render children?.()}
|
|
48
|
+
{/key}
|
|
49
|
+
</Content>
|
|
50
|
+
</Scrollable>
|
|
51
|
+
{/snippet}
|
|
52
|
+
{#snippet side_b()}
|
|
53
|
+
<Scrollable>
|
|
54
|
+
<Controls bind:position={panel} bind:mode />
|
|
55
|
+
</Scrollable>
|
|
56
|
+
{/snippet}
|
|
57
|
+
</Split>
|
|
58
|
+
{/if}
|
|
59
|
+
{/snippet}
|
|
60
|
+
</Split>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Sorter, Renamer } from "../navigation/types";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
data: readonly string[];
|
|
5
|
+
current: string | null;
|
|
6
|
+
sorter: Sorter;
|
|
7
|
+
renamer: Renamer;
|
|
8
|
+
onnavigate?: (e: {
|
|
9
|
+
detail: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
offset?: number;
|
|
12
|
+
panelOffset?: number;
|
|
13
|
+
panel?: "bottom" | "right";
|
|
14
|
+
mode?: "props" | "events";
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
};
|
|
17
|
+
declare const Body: import("svelte").Component<$$ComponentProps, {}, "offset" | "mode" | "panelOffset" | "panel">;
|
|
18
|
+
type Body = ReturnType<typeof Body>;
|
|
19
|
+
export default Body;
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
height: min-content;
|
|
17
17
|
min-width: calc(100% - 1rem);
|
|
18
18
|
min-height: calc(100% - 1rem);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* color */
|
|
22
|
-
div {
|
|
23
19
|
border: solid 1px var(--i-nil-doc-content-outline-color);
|
|
24
20
|
box-shadow: 0 0 0.5rem 0 var(--i-nil-doc-content-outline-color);
|
|
25
21
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">import ThemeToggle from "./ThemeToggle.svelte";
|
|
2
|
+
let {
|
|
3
|
+
title,
|
|
4
|
+
title_misc,
|
|
5
|
+
theme = $bindable()
|
|
6
|
+
} = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="top">
|
|
10
|
+
<div class="title">
|
|
11
|
+
{@render title()}
|
|
12
|
+
</div>
|
|
13
|
+
{#if title_misc}
|
|
14
|
+
{@render title_misc()}
|
|
15
|
+
{:else}
|
|
16
|
+
<ThemeToggle bind:theme />
|
|
17
|
+
{/if}
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.top {
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
font-size: 1rem;
|
|
24
|
+
display: grid;
|
|
25
|
+
grid-auto-flow: column;
|
|
26
|
+
grid-auto-columns: 2.5rem;
|
|
27
|
+
grid-template-columns: 1fr;
|
|
28
|
+
align-items: center;
|
|
29
|
+
padding-left: 0.5rem;
|
|
30
|
+
padding-right: 0.5rem;
|
|
31
|
+
border-bottom-width: 1px;
|
|
32
|
+
border-bottom-style: solid;
|
|
33
|
+
user-select: none;
|
|
34
|
+
transition: border-bottom-color var(--i-nil-doc-transition-time);
|
|
35
|
+
border-bottom-color: var(--i-nil-doc-container-p);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.title {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-auto-flow: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: left;
|
|
43
|
+
gap: 0.25rem;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
title: Snippet;
|
|
4
|
+
title_misc?: Snippet;
|
|
5
|
+
theme?: "light" | "dark";
|
|
6
|
+
};
|
|
7
|
+
declare const Header: import("svelte").Component<$$ComponentProps, {}, "theme">;
|
|
8
|
+
type Header = ReturnType<typeof Header>;
|
|
9
|
+
export default Header;
|
|
@@ -3,13 +3,8 @@ const defaultRenamer = (s) => s;
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">import Base from "../Base.svelte";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import Controls from "../block/controls/Controls.svelte";
|
|
9
|
-
import Scrollable from "./Scrollable.svelte";
|
|
10
|
-
import VerticalPanel from "./VerticalPanel.svelte";
|
|
11
|
-
import Nav from "../navigation/Nav.svelte";
|
|
12
|
-
import ThemeToggle from "./ThemeToggle.svelte";
|
|
6
|
+
import Body from "./Body.svelte";
|
|
7
|
+
import Header from "./Header.svelte";
|
|
13
8
|
import {
|
|
14
9
|
initControlInfo,
|
|
15
10
|
initControlValue
|
|
@@ -24,7 +19,7 @@ let {
|
|
|
24
19
|
renamer = null,
|
|
25
20
|
theme = $bindable(),
|
|
26
21
|
offset = $bindable(250),
|
|
27
|
-
panel = $bindable(
|
|
22
|
+
panel = $bindable(),
|
|
28
23
|
title,
|
|
29
24
|
title_misc,
|
|
30
25
|
children,
|
|
@@ -63,49 +58,20 @@ onDestroy(activeControl.subscribe((v) => panelChange(v)));
|
|
|
63
58
|
|
|
64
59
|
<Base dark={$dark} fill>
|
|
65
60
|
<div class="fill layout">
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<Nav
|
|
81
|
-
info={data}
|
|
82
|
-
selected={current ?? ""}
|
|
83
|
-
sorter={sorter ?? defaultSorter}
|
|
84
|
-
renamer={renamer ?? defaultRenamer}
|
|
85
|
-
{onnavigate}
|
|
86
|
-
/>
|
|
87
|
-
<!-- </VerticalPanel> -->
|
|
88
|
-
</Scrollable>
|
|
89
|
-
{/snippet}
|
|
90
|
-
{#snippet side_b()}
|
|
91
|
-
<Container vertical={"right" === panel} persistent bind:offset={panelOffset}>
|
|
92
|
-
{#snippet side_a()}
|
|
93
|
-
<Scrollable>
|
|
94
|
-
<Content>
|
|
95
|
-
{#key current}
|
|
96
|
-
{@render children?.()}
|
|
97
|
-
{/key}
|
|
98
|
-
</Content>
|
|
99
|
-
</Scrollable>
|
|
100
|
-
{/snippet}
|
|
101
|
-
{#snippet side_b()}
|
|
102
|
-
<Scrollable>
|
|
103
|
-
<Controls bind:position={panel} bind:mode />
|
|
104
|
-
</Scrollable>
|
|
105
|
-
{/snippet}
|
|
106
|
-
</Container>
|
|
107
|
-
{/snippet}
|
|
108
|
-
</Container>
|
|
61
|
+
<Header {title} {title_misc} bind:theme />
|
|
62
|
+
<Body
|
|
63
|
+
data={data}
|
|
64
|
+
current={current}
|
|
65
|
+
sorter={sorter ?? defaultSorter}
|
|
66
|
+
renamer={renamer ?? defaultRenamer}
|
|
67
|
+
{onnavigate}
|
|
68
|
+
bind:offset
|
|
69
|
+
bind:panelOffset
|
|
70
|
+
bind:panel
|
|
71
|
+
bind:mode
|
|
72
|
+
>
|
|
73
|
+
{@render children?.()}
|
|
74
|
+
</Body>
|
|
109
75
|
</div>
|
|
110
76
|
</Base>
|
|
111
77
|
|
|
@@ -119,32 +85,6 @@ onDestroy(activeControl.subscribe((v) => panelChange(v)));
|
|
|
119
85
|
display: grid;
|
|
120
86
|
grid-template-columns: 1fr;
|
|
121
87
|
grid-template-rows: minmax(2.5rem, auto) 1fr;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.top {
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
font-size: 1rem;
|
|
127
|
-
display: grid;
|
|
128
|
-
grid-auto-flow: column;
|
|
129
|
-
grid-auto-columns: 2.5rem;
|
|
130
|
-
grid-template-columns: 1fr;
|
|
131
|
-
align-items: center;
|
|
132
|
-
padding-left: 0.5rem;
|
|
133
|
-
padding-right: 0.5rem;
|
|
134
|
-
border-bottom-width: 1px;
|
|
135
|
-
border-bottom-style: solid;
|
|
136
|
-
user-select: none;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.title {
|
|
140
|
-
display: grid;
|
|
141
|
-
grid-auto-flow: column;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: left;
|
|
144
|
-
gap: 0.25rem;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.layout {
|
|
148
88
|
color-scheme: var(--i-nil-doc-color-scheme);
|
|
149
89
|
color: var(--i-nil-doc-color);
|
|
150
90
|
background-color: var(--i-nil-doc-bg-color);
|
|
@@ -153,8 +93,4 @@ onDestroy(activeControl.subscribe((v) => panelChange(v)));
|
|
|
153
93
|
background-color var(--i-nil-doc-transition-time);
|
|
154
94
|
}
|
|
155
95
|
|
|
156
|
-
.layout > .top {
|
|
157
|
-
transition: border-bottom-color var(--i-nil-doc-transition-time);
|
|
158
|
-
border-bottom-color: var(--i-nil-doc-container-p);
|
|
159
|
-
}
|
|
160
96
|
</style>
|
|
@@ -17,6 +17,6 @@ type $$ComponentProps = {
|
|
|
17
17
|
}) => void;
|
|
18
18
|
};
|
|
19
19
|
/** See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details. */
|
|
20
|
-
declare const Layout: import("svelte").Component<$$ComponentProps, {}, "offset" | "
|
|
20
|
+
declare const Layout: import("svelte").Component<$$ComponentProps, {}, "offset" | "panel" | "theme">;
|
|
21
21
|
type Layout = ReturnType<typeof Layout>;
|
|
22
22
|
export default Layout;
|
|
@@ -7,6 +7,6 @@ type $$ComponentProps = {
|
|
|
7
7
|
side_a: Snippet;
|
|
8
8
|
side_b: Snippet;
|
|
9
9
|
};
|
|
10
|
-
declare const
|
|
11
|
-
type
|
|
12
|
-
export default
|
|
10
|
+
declare const Split: import("svelte").Component<$$ComponentProps, {}, "offset">;
|
|
11
|
+
type Split = ReturnType<typeof Split>;
|
|
12
|
+
export default Split;
|
|
@@ -47,12 +47,14 @@ let {
|
|
|
47
47
|
onnavigate
|
|
48
48
|
} = $props();
|
|
49
49
|
let filter = $state("");
|
|
50
|
-
let states = $state(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)
|
|
50
|
+
let states = $state(
|
|
51
|
+
apply(
|
|
52
|
+
info,
|
|
53
|
+
() => ({ expanded: false, sub: {} }),
|
|
54
|
+
(t, path) => ({ expanded: t.expanded || selected === path, sub: t.sub }),
|
|
55
|
+
(t) => t.sub
|
|
56
|
+
)
|
|
57
|
+
);
|
|
56
58
|
const update = (selected2) => {
|
|
57
59
|
if (!info.includes(selected2)) {
|
|
58
60
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nil-/doc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "njaldea@gmail.com",
|
|
6
6
|
"name": "Neil Aldea"
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
"types": "./index.d.ts",
|
|
22
22
|
"svelte": "./index.js",
|
|
23
23
|
"default": "./index.js"
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
"./components/*": "./components/*",
|
|
26
|
+
"./layout/*": "./components/layout/*",
|
|
27
|
+
"./navigation/*": "./components/navigation/*",
|
|
28
|
+
"./block/*": "./components/block/*"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|
|
27
31
|
"vanilla-picker": "^2.12.3"
|
|
File without changes
|