@nil-/doc 0.2.50 → 0.2.52
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/CHANGELOG.md +29 -0
- package/components/Base.svelte +65 -0
- package/components/Base.svelte.d.ts +19 -0
- package/components/block/Block.svelte +71 -24
- package/components/block/Controls.svelte +3 -5
- package/components/block/Controls.svelte.d.ts +2 -2
- package/components/block/Instance.svelte +39 -89
- package/components/block/context.d.ts +2 -2
- package/components/block/context.js +2 -1
- package/components/block/controls/events/Events.svelte +14 -5
- package/components/block/controls/events/misc/Styler.svelte +16 -46
- package/components/block/controls/events/misc/Styler.svelte.d.ts +17 -6
- package/components/block/controls/props/Color.svelte +86 -0
- package/components/block/controls/props/Color.svelte.d.ts +21 -0
- package/components/block/controls/props/Component.svelte +5 -0
- package/components/block/controls/props/Number.svelte +4 -5
- package/components/block/controls/props/Object.svelte +9 -12
- package/components/block/controls/props/Props.svelte +2 -5
- package/components/block/controls/props/Range.svelte +5 -4
- package/components/block/controls/props/Select.svelte +5 -8
- package/components/block/controls/props/Switch.svelte +4 -5
- package/components/block/controls/props/Text.svelte +8 -9
- package/components/block/controls/props/Tuple.svelte +13 -26
- package/components/block/controls/props/misc/Name.svelte +6 -7
- package/components/block/controls/props/misc/Styler.svelte +22 -34
- package/components/block/controls/props/misc/Styler.svelte.d.ts +17 -6
- package/components/block/controls/props/misc/defaulter.d.ts +9 -8
- package/components/block/controls/props/misc/defaulter.js +28 -48
- package/components/block/controls/props/misc/utils.d.ts +12 -0
- package/components/block/controls/props/misc/utils.js +37 -0
- package/components/block/controls/types.d.ts +12 -2
- package/components/block/icons/Button.svelte +30 -0
- package/components/block/icons/Button.svelte.d.ts +35 -0
- package/components/block/icons/ControlView.svelte +30 -0
- package/components/block/icons/ControlView.svelte.d.ts +16 -0
- package/components/block/icons/Position.svelte +29 -0
- package/components/block/icons/Position.svelte.d.ts +16 -0
- package/components/{etc → layout}/Container.svelte +24 -37
- package/components/{etc → layout}/Container.svelte.d.ts +0 -0
- package/components/layout/Content.svelte +23 -0
- package/components/layout/Content.svelte.d.ts +27 -0
- package/components/layout/Layout.svelte +124 -0
- package/components/{Layout.svelte.d.ts → layout/Layout.svelte.d.ts} +3 -2
- package/components/layout/Scrollable.svelte +20 -0
- package/components/layout/Scrollable.svelte.d.ts +27 -0
- package/components/layout/VerticalPanel.svelte +12 -0
- package/components/layout/VerticalPanel.svelte.d.ts +27 -0
- package/components/{etc → layout}/action.d.ts +0 -0
- package/components/{etc → layout}/action.js +0 -0
- package/components/{title → layout/icons}/Icon.svelte +3 -3
- package/components/{title → layout/icons}/Icon.svelte.d.ts +0 -0
- package/components/{icons/NilDoc.svelte → layout/icons/Nil.svelte} +3 -3
- package/components/layout/icons/Nil.svelte.d.ts +14 -0
- package/components/{icons → layout/icons}/Theme.svelte +41 -28
- package/components/{icons → layout/icons}/Theme.svelte.d.ts +1 -1
- package/components/navigation/Nav.svelte +6 -10
- package/components/navigation/Node.svelte +19 -11
- package/index.d.ts +4 -4
- package/index.js +4 -4
- package/package.json +8 -5
- package/sveltekit/index.d.ts +7 -1
- package/sveltekit/index.js +9 -5
- package/components/Layout.svelte +0 -151
- package/components/icons/NilDoc.svelte.d.ts +0 -14
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script context="module">const defaultSorter = (l, r) => l.localeCompare(r);
|
|
2
|
+
const defaultRenamer = (s) => s;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script>import Base from "../Base.svelte";
|
|
6
|
+
import Container from "./Container.svelte";
|
|
7
|
+
import Content from "./Content.svelte";
|
|
8
|
+
import Scrollable from "./Scrollable.svelte";
|
|
9
|
+
import VerticalPanel from "./VerticalPanel.svelte";
|
|
10
|
+
import Nav from "../navigation/Nav.svelte";
|
|
11
|
+
import Icon from "./icons/Icon.svelte";
|
|
12
|
+
import { getTheme, initTheme } from "../context";
|
|
13
|
+
import ThemeIcon from "./icons/Theme.svelte";
|
|
14
|
+
export let data;
|
|
15
|
+
export let current = null;
|
|
16
|
+
export let sorter = null;
|
|
17
|
+
export let renamer = null;
|
|
18
|
+
export let theme = void 0;
|
|
19
|
+
export let offset = 250;
|
|
20
|
+
const parentTheme = getTheme();
|
|
21
|
+
const dark = initTheme();
|
|
22
|
+
$:
|
|
23
|
+
$dark = theme === void 0 ? $parentTheme : "dark" === theme;
|
|
24
|
+
const toggle = () => {
|
|
25
|
+
if (theme !== void 0) {
|
|
26
|
+
theme = $dark ? "light" : "dark";
|
|
27
|
+
} else {
|
|
28
|
+
$dark = !$dark;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<!--
|
|
34
|
+
@component
|
|
35
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details.
|
|
36
|
+
-->
|
|
37
|
+
|
|
38
|
+
<Base dark={$dark} fill>
|
|
39
|
+
<div class="fill layout">
|
|
40
|
+
<div class="top">
|
|
41
|
+
<div class="title">
|
|
42
|
+
<slot name="title" />
|
|
43
|
+
</div>
|
|
44
|
+
<slot name="title-misc">
|
|
45
|
+
<Icon on:click={toggle}>
|
|
46
|
+
<ThemeIcon {theme} />
|
|
47
|
+
</Icon>
|
|
48
|
+
</slot>
|
|
49
|
+
</div>
|
|
50
|
+
<Container bind:offset vertical b>
|
|
51
|
+
<svelte:fragment slot="A">
|
|
52
|
+
<Scrollable>
|
|
53
|
+
<VerticalPanel>
|
|
54
|
+
<Nav
|
|
55
|
+
info={data}
|
|
56
|
+
selected={current ?? ""}
|
|
57
|
+
sorter={sorter ?? defaultSorter}
|
|
58
|
+
renamer={renamer ?? defaultRenamer}
|
|
59
|
+
on:navigate
|
|
60
|
+
/>
|
|
61
|
+
</VerticalPanel>
|
|
62
|
+
</Scrollable>
|
|
63
|
+
</svelte:fragment>
|
|
64
|
+
<svelte:fragment slot="B">
|
|
65
|
+
<Scrollable>
|
|
66
|
+
<Content>
|
|
67
|
+
{#key current}
|
|
68
|
+
<slot />
|
|
69
|
+
{/key}
|
|
70
|
+
</Content>
|
|
71
|
+
</Scrollable>
|
|
72
|
+
</svelte:fragment>
|
|
73
|
+
</Container>
|
|
74
|
+
</div>
|
|
75
|
+
</Base>
|
|
76
|
+
|
|
77
|
+
<style>
|
|
78
|
+
.fill {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.layout {
|
|
84
|
+
display: grid;
|
|
85
|
+
grid-template-columns: 1fr;
|
|
86
|
+
grid-template-rows: minmax(2.5rem, auto) 1fr;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.top {
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
font-size: 1rem;
|
|
92
|
+
display: grid;
|
|
93
|
+
grid-auto-flow: column;
|
|
94
|
+
grid-auto-columns: 2.5rem;
|
|
95
|
+
grid-template-columns: 1fr;
|
|
96
|
+
align-items: center;
|
|
97
|
+
padding-left: 0.5rem;
|
|
98
|
+
padding-right: 0.5rem;
|
|
99
|
+
border-bottom-width: 1px;
|
|
100
|
+
border-bottom-style: solid;
|
|
101
|
+
user-select: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.title {
|
|
105
|
+
display: grid;
|
|
106
|
+
grid-auto-flow: column;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: left;
|
|
109
|
+
gap: 0.25rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.layout {
|
|
113
|
+
color-scheme: var(--i-nil-doc-color-scheme);
|
|
114
|
+
color: var(--i-nil-doc-color);
|
|
115
|
+
background-color: var(--i-nil-doc-bg-color);
|
|
116
|
+
transition: color var(--i-nil-doc-transition-time),
|
|
117
|
+
background-color var(--i-nil-doc-transition-time);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.layout > .top {
|
|
121
|
+
transition: border-bottom-color var(--i-nil-doc-transition-time);
|
|
122
|
+
border-bottom-color: var(--i-nil-doc-container-p);
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Sorter, Renamer } from "
|
|
3
|
-
import { type Theme } from "
|
|
2
|
+
import type { Sorter, Renamer } from "../navigation/types";
|
|
3
|
+
import { type Theme } from "../context";
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
data: string[];
|
|
@@ -8,6 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
sorter?: Sorter | null | undefined;
|
|
9
9
|
renamer?: Renamer | null | undefined;
|
|
10
10
|
theme?: Theme;
|
|
11
|
+
offset?: number | undefined;
|
|
11
12
|
};
|
|
12
13
|
events: {
|
|
13
14
|
navigate: CustomEvent<any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<slot />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
/* scrollable */
|
|
7
|
+
div {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
overflow: scroll;
|
|
11
|
+
/* Firefox */
|
|
12
|
+
scrollbar-width: none;
|
|
13
|
+
/* IE and Edge */
|
|
14
|
+
-ms-overflow-style: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
div::-webkit-scrollbar {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ScrollableProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ScrollableEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ScrollableSlots */
|
|
4
|
+
export default class Scrollable extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type ScrollableProps = typeof __propDef.props;
|
|
13
|
+
export type ScrollableEvents = typeof __propDef.events;
|
|
14
|
+
export type ScrollableSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} VerticalPanelProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} VerticalPanelEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} VerticalPanelSlots */
|
|
4
|
+
export default class VerticalPanel extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type VerticalPanelProps = typeof __propDef.props;
|
|
13
|
+
export type VerticalPanelEvents = typeof __propDef.events;
|
|
14
|
+
export type VerticalPanelSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -21,10 +21,10 @@ $:
|
|
|
21
21
|
|
|
22
22
|
<svg viewBox="-35 -35 70 70" on:pointerenter={trigger}>
|
|
23
23
|
<g transform="rotate(45 0 0)">
|
|
24
|
-
<path {d} use:action={$length} />
|
|
24
|
+
<path {d} use:action={$length} pathLength={100} />
|
|
25
25
|
</g>
|
|
26
26
|
<g transform="rotate(225 0 0)">
|
|
27
|
-
<path {d} use:action={$length} />
|
|
27
|
+
<path {d} use:action={$length} pathLength={100} />
|
|
28
28
|
</g>
|
|
29
29
|
</svg>
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ $:
|
|
|
32
32
|
svg {
|
|
33
33
|
width: 100%;
|
|
34
34
|
height: 100%;
|
|
35
|
-
stroke-width:
|
|
35
|
+
stroke-width: 3;
|
|
36
36
|
stroke-linejoin: miter;
|
|
37
37
|
stroke: currentColor;
|
|
38
38
|
fill: transparent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type NilProps = typeof __propDef.props;
|
|
10
|
+
export type NilEvents = typeof __propDef.events;
|
|
11
|
+
export type NilSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Nil extends SvelteComponentTyped<NilProps, NilEvents, NilSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
<script context="module">let indexer = 0;
|
|
2
|
-
const vlight = {
|
|
3
|
-
rotate: 40,
|
|
4
|
-
mcy: -8,
|
|
5
|
-
cr: 10,
|
|
6
|
-
v: 0
|
|
7
|
-
};
|
|
8
|
-
const vdark = {
|
|
9
|
-
rotate: 180,
|
|
10
|
-
mcy: -24,
|
|
11
|
-
cr: 5,
|
|
12
|
-
v: 1
|
|
13
|
-
};
|
|
14
2
|
</script>
|
|
15
3
|
|
|
16
|
-
<script>
|
|
17
|
-
export let theme = "dark";
|
|
18
|
-
$:
|
|
19
|
-
dark = theme === "dark";
|
|
20
|
-
const values = tweened(dark ? vdark : vlight);
|
|
21
|
-
$:
|
|
22
|
-
$values = dark ? vdark : vlight;
|
|
4
|
+
<script>export let theme = "dark";
|
|
23
5
|
const index = indexer++;
|
|
24
6
|
</script>
|
|
25
7
|
|
|
26
|
-
<svg
|
|
8
|
+
<svg viewBox="-25 -25 50 50" class:dark={theme === "light"}>
|
|
27
9
|
<mask id={`nil_doc_theme_icon_${index}`}>
|
|
28
10
|
<rect x="-25" y="-25" fill="white" />
|
|
29
|
-
<circle
|
|
11
|
+
<circle r="11" fill="black" stroke="black" />
|
|
30
12
|
</mask>
|
|
31
|
-
<circle
|
|
32
|
-
<g
|
|
13
|
+
<circle mask={`url(#nil_doc_theme_icon_${index})`} />
|
|
14
|
+
<g>
|
|
33
15
|
<g>
|
|
34
16
|
<line x1="0" y1="9" x2="0" y2="11" />
|
|
35
17
|
<line x1="9" y1="0" x2="11" y2="0" />
|
|
@@ -49,11 +31,6 @@ const index = indexer++;
|
|
|
49
31
|
svg {
|
|
50
32
|
fill: currentColor;
|
|
51
33
|
stroke: currentColor;
|
|
52
|
-
|
|
53
|
-
-webkit-tap-highlight-color: transparent;
|
|
54
|
-
-moz-tap-highlight-color: transparent;
|
|
55
|
-
-o-tap-highlight-color: transparent;
|
|
56
|
-
/* tap-highlight-color: transparent; */
|
|
57
34
|
}
|
|
58
35
|
|
|
59
36
|
svg,
|
|
@@ -67,4 +44,40 @@ const index = indexer++;
|
|
|
67
44
|
stroke-linecap: round;
|
|
68
45
|
stroke-linejoin: round;
|
|
69
46
|
}
|
|
47
|
+
|
|
48
|
+
svg {
|
|
49
|
+
transition: transform 350ms;
|
|
50
|
+
transform: rotate(40deg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
svg > g {
|
|
54
|
+
transition: opacity 350ms;
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
svg > mask > circle {
|
|
59
|
+
transition: cy 350ms;
|
|
60
|
+
cy: -8px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
svg > circle {
|
|
64
|
+
transition: r 350ms;
|
|
65
|
+
r: 10px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
svg.dark {
|
|
69
|
+
transform: rotate(180deg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
svg.dark > g {
|
|
73
|
+
opacity: 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
svg.dark > mask > circle {
|
|
77
|
+
cy: -24px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
svg.dark > circle {
|
|
81
|
+
r: 5px;
|
|
82
|
+
}
|
|
70
83
|
</style>
|
|
@@ -88,28 +88,24 @@ $:
|
|
|
88
88
|
.nav {
|
|
89
89
|
width: 100%;
|
|
90
90
|
height: 100%;
|
|
91
|
-
min-width:
|
|
91
|
+
min-width: 12.5rem;
|
|
92
92
|
display: flex;
|
|
93
93
|
flex-direction: column;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
.search-bar {
|
|
97
|
-
padding:
|
|
97
|
+
padding: 0.25rem;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
input {
|
|
101
|
-
|
|
101
|
+
font-size: 0.75rem;
|
|
102
|
+
height: 1.75rem;
|
|
102
103
|
width: 100%;
|
|
103
|
-
padding: 0px
|
|
104
|
+
padding: 0px 0.5rem;
|
|
105
|
+
box-sizing: border-box;
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
input:focus {
|
|
107
109
|
outline: none;
|
|
108
110
|
}
|
|
109
|
-
|
|
110
|
-
* {
|
|
111
|
-
box-sizing: border-box;
|
|
112
|
-
padding: 0px;
|
|
113
|
-
margin: 0px;
|
|
114
|
-
}
|
|
115
111
|
</style>
|
|
@@ -11,12 +11,15 @@ export let sorter;
|
|
|
11
11
|
export let renamer;
|
|
12
12
|
const dispatch = createEventDispatcher();
|
|
13
13
|
$:
|
|
14
|
-
style = `padding-left: ${
|
|
14
|
+
style = `padding-left: ${0.5 + depth}rem; padding-right: 0.5rem`;
|
|
15
15
|
$:
|
|
16
16
|
hasChildren = Object.keys(value.sub).length > 0;
|
|
17
17
|
const click = (link) => {
|
|
18
18
|
if (link != null && selected !== link) {
|
|
19
19
|
dispatch("navigate", link);
|
|
20
|
+
if (hasChildren && !states.expanded) {
|
|
21
|
+
states.expanded = true;
|
|
22
|
+
}
|
|
20
23
|
} else if (hasChildren) {
|
|
21
24
|
states.expanded = !states.expanded;
|
|
22
25
|
}
|
|
@@ -30,6 +33,7 @@ const click = (link) => {
|
|
|
30
33
|
on:keypress={null}
|
|
31
34
|
{style}
|
|
32
35
|
class:selected={selected === value.url}
|
|
36
|
+
class:paged={value.url != null}
|
|
33
37
|
>
|
|
34
38
|
<div class="icon" class:expanded={hasChildren && (expand || states.expanded)}>
|
|
35
39
|
<div>{Object.keys(value.sub).length > 0 ? ">" : "-"}</div>
|
|
@@ -68,29 +72,33 @@ const click = (link) => {
|
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
.header {
|
|
71
|
-
height:
|
|
75
|
+
height: 1.75rem;
|
|
72
76
|
display: grid;
|
|
73
|
-
grid-template-columns:
|
|
77
|
+
grid-template-columns: 1rem 1fr;
|
|
74
78
|
align-items: center;
|
|
75
79
|
cursor: pointer;
|
|
76
|
-
gap:
|
|
77
|
-
|
|
80
|
+
gap: 0.25rem;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
padding-right: 0.5rem;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
.header:hover {
|
|
81
|
-
background-color:
|
|
86
|
+
background-color: var(--i-nil-doc-nav-hovered);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.header.paged:hover {
|
|
90
|
+
background-color: var(--i-nil-doc-nav-page-hovered);
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
.header.selected {
|
|
85
|
-
background-color:
|
|
86
|
-
color: black;
|
|
94
|
+
background-color: var(--i-nil-doc-nav-selected) !important;
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
.icon {
|
|
90
98
|
justify-content: center;
|
|
91
|
-
height:
|
|
92
|
-
width:
|
|
93
|
-
transition: transform
|
|
99
|
+
height: 1rem;
|
|
100
|
+
width: 1rem;
|
|
101
|
+
transition: transform var(--i-nil-doc-transition-time);
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
.icon.expanded {
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { renamer } from "./components/navigation/utils/renamer";
|
|
2
2
|
export { sorter } from "./components/navigation/utils/sorter";
|
|
3
3
|
export type { Prop, Event, PropType, Detailed, Flattened, Unionized } from "./components/block/controls/types";
|
|
4
|
-
export { default as Layout } from "./components/Layout.svelte";
|
|
4
|
+
export { default as Layout } from "./components/layout/Layout.svelte";
|
|
5
5
|
export { default as Instance } from "./components/block/Instance.svelte";
|
|
6
6
|
export { default as Block } from "./components/block/Block.svelte";
|
|
7
7
|
export { default as Template } from "./components/block/Template.svelte";
|
|
8
8
|
export { default as Controls } from "./components/block/Controls.svelte";
|
|
9
9
|
export { default as Params } from "./components/block/Params.svelte";
|
|
10
|
-
export { default as Icon } from "./components/
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as Theme } from "./components/icons/Theme.svelte";
|
|
10
|
+
export { default as Icon } from "./components/layout/icons/Icon.svelte";
|
|
11
|
+
export { default as Nil } from "./components/layout/icons/Nil.svelte";
|
|
12
|
+
export { default as Theme } from "./components/layout/icons/Theme.svelte";
|
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { renamer } from "./components/navigation/utils/renamer";
|
|
2
2
|
export { sorter } from "./components/navigation/utils/sorter";
|
|
3
|
-
export { default as Layout } from "./components/Layout.svelte";
|
|
3
|
+
export { default as Layout } from "./components/layout/Layout.svelte";
|
|
4
4
|
export { default as Instance } from "./components/block/Instance.svelte";
|
|
5
5
|
export { default as Block } from "./components/block/Block.svelte";
|
|
6
6
|
export { default as Template } from "./components/block/Template.svelte";
|
|
7
7
|
export { default as Controls } from "./components/block/Controls.svelte";
|
|
8
8
|
export { default as Params } from "./components/block/Params.svelte";
|
|
9
|
-
export { default as Icon } from "./components/
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as Theme } from "./components/icons/Theme.svelte";
|
|
9
|
+
export { default as Icon } from "./components/layout/icons/Icon.svelte";
|
|
10
|
+
export { default as Nil } from "./components/layout/icons/Nil.svelte";
|
|
11
|
+
export { default as Theme } from "./components/layout/icons/Theme.svelte";
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nil-/doc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.52",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "njaldea@gmail.com",
|
|
6
6
|
"name": "Neil Aldea"
|
|
7
7
|
},
|
|
8
8
|
"license": "ISC",
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@sveltejs/adapter-vercel": "^1.0.
|
|
11
|
-
"@sveltejs/kit": "^1.
|
|
10
|
+
"@sveltejs/adapter-vercel": "^1.0.6",
|
|
11
|
+
"@sveltejs/kit": "^1.5.5",
|
|
12
12
|
"@sveltejs/package": "^1.0.2",
|
|
13
13
|
"@vitest/coverage-c8": "^0.26.3",
|
|
14
14
|
"mdsvex": "^0.10.6",
|
|
15
15
|
"remark-admonitions": "^1.2.1",
|
|
16
16
|
"svelte-check": "^2.10.3",
|
|
17
17
|
"tslib": "^2.5.0",
|
|
18
|
-
"typescript": "^4.9.
|
|
19
|
-
"vite": "^4.
|
|
18
|
+
"typescript": "^4.9.5",
|
|
19
|
+
"vite": "^4.1.1",
|
|
20
20
|
"vitest": "^0.26.3"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"component"
|
|
32
32
|
],
|
|
33
33
|
"type": "module",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"vanilla-picker": "^2.12.1"
|
|
36
|
+
},
|
|
34
37
|
"exports": {
|
|
35
38
|
"./package.json": "./package.json",
|
|
36
39
|
".": "./index.js",
|
package/sveltekit/index.d.ts
CHANGED
|
@@ -19,10 +19,16 @@ type Settings = {
|
|
|
19
19
|
* Default is "dark"
|
|
20
20
|
*/
|
|
21
21
|
theme: Writable<Exclude<Theme, undefined>>;
|
|
22
|
+
/**
|
|
23
|
+
* A store that is responsible in keeping the offset in localStorage
|
|
24
|
+
* offset is the width of the navigation panel.
|
|
25
|
+
* Default is 250px
|
|
26
|
+
*/
|
|
27
|
+
offset: Writable<number>;
|
|
22
28
|
};
|
|
23
29
|
/**
|
|
24
30
|
* Dedicated helper method to be used for sveltekit
|
|
25
|
-
* @param detail - vite's `import.meta.glob(
|
|
31
|
+
* @param detail - vite's `import.meta.glob(...)`
|
|
26
32
|
* @param prefix - only use when layout is not in the root route
|
|
27
33
|
* @returns Settings
|
|
28
34
|
*/
|
package/sveltekit/index.js
CHANGED
|
@@ -13,13 +13,15 @@ const routeIsDynamic = /.*\[.*\].*/;
|
|
|
13
13
|
const isRouteDynamic = (p) => null == routeIsDynamic.exec(p);
|
|
14
14
|
/**
|
|
15
15
|
* Dedicated helper method to be used for sveltekit
|
|
16
|
-
* @param detail - vite's `import.meta.glob(
|
|
16
|
+
* @param detail - vite's `import.meta.glob(...)`
|
|
17
17
|
* @param prefix - only use when layout is not in the root route
|
|
18
18
|
* @returns Settings
|
|
19
19
|
*/
|
|
20
20
|
export const sveltekit = (detail, prefix = null) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const keyTheme = "@nil-/doc/theme";
|
|
22
|
+
const theme = browser && "light" === localStorage.getItem(keyTheme) ? "light" : "dark";
|
|
23
|
+
const keyOffset = "@nil-/doc/offset";
|
|
24
|
+
const offset = browser ? parseFloat(localStorage.getItem(keyOffset) ?? "250") : 250;
|
|
23
25
|
const result = {
|
|
24
26
|
data: Object.keys(detail)
|
|
25
27
|
.map(toRoute)
|
|
@@ -36,8 +38,10 @@ export const sveltekit = (detail, prefix = null) => {
|
|
|
36
38
|
return null;
|
|
37
39
|
}),
|
|
38
40
|
navigate: prefix ? (e) => goto(`${prefix}${e.detail}`) : (e) => goto(e.detail),
|
|
39
|
-
theme: writable(
|
|
41
|
+
theme: writable(theme),
|
|
42
|
+
offset: writable(offset)
|
|
40
43
|
};
|
|
41
|
-
browser && result.theme.subscribe((v) => localStorage.setItem(
|
|
44
|
+
browser && result.theme.subscribe((v) => localStorage.setItem(keyTheme, v));
|
|
45
|
+
browser && result.offset.subscribe((v) => localStorage.setItem(keyOffset, `${v}`));
|
|
42
46
|
return result;
|
|
43
47
|
};
|