@nil-/doc 0.2.27 → 0.2.29
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 +13 -0
- package/components/Layout.svelte +29 -5
- package/components/block/Block.svelte +2 -2
- package/components/etc/ThemeIcon.svelte +69 -0
- package/components/etc/ThemeIcon.svelte.d.ts +16 -0
- package/components/navigation/utils.d.ts +3 -3
- package/components/navigation/utils.js +3 -3
- package/package.json +3 -3
- package/sveltekit/index.d.ts +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][feature] ThemeIcon ([#41](https://github.com/njaldea/mono/pull/41))
|
|
8
|
+
[doc][feature] added top bar to separate title and other controls
|
|
9
|
+
|
|
10
|
+
## 0.2.28
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [doc][fix] reorder css style ([#37](https://github.com/njaldea/mono/pull/37))
|
|
15
|
+
|
|
3
16
|
## 0.2.27
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
<style>
|
|
2
|
+
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
|
+
|
|
2
4
|
.layout {
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: 1fr;
|
|
7
|
+
grid-template-rows: minmax(40px, auto) 1fr;
|
|
3
8
|
width: 100%;
|
|
4
9
|
height: 100%;
|
|
5
10
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
6
11
|
}
|
|
7
12
|
|
|
13
|
+
.top {
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: 1fr 40px;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding-left: 20px;
|
|
18
|
+
padding-right: 20px;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
user-select: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
.content {
|
|
9
24
|
height: 100%;
|
|
10
25
|
padding: 5px;
|
|
@@ -14,8 +29,6 @@
|
|
|
14
29
|
}
|
|
15
30
|
|
|
16
31
|
/* reset block */
|
|
17
|
-
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
18
|
-
|
|
19
32
|
.reset {
|
|
20
33
|
width: 100%;
|
|
21
34
|
height: 100%;
|
|
@@ -41,6 +54,14 @@
|
|
|
41
54
|
color-scheme: light;
|
|
42
55
|
}
|
|
43
56
|
|
|
57
|
+
.layout > .top {
|
|
58
|
+
border-bottom: hsl(0, 2%, 70%) solid 1px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.layout.dark > .top {
|
|
62
|
+
border-bottom: hsl(0, 2%, 38%) solid 1px;
|
|
63
|
+
}
|
|
64
|
+
|
|
44
65
|
.layout.dark {
|
|
45
66
|
background-color: hsl(200, 4%, 14%);
|
|
46
67
|
color: hsl(200, 6%, 80%);
|
|
@@ -51,6 +72,7 @@
|
|
|
51
72
|
<script>import Container from "./etc/Container.svelte";
|
|
52
73
|
import Nav from "./navigation/Nav.svelte";
|
|
53
74
|
import { inRoot, getTheme, initTheme, evalTheme } from "./context";
|
|
75
|
+
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
54
76
|
export let data;
|
|
55
77
|
export let current = null;
|
|
56
78
|
export let sorter = null;
|
|
@@ -63,6 +85,10 @@ $:
|
|
|
63
85
|
$isDark = evalTheme(parentTheme ? $parentTheme : true, theme);
|
|
64
86
|
</script>
|
|
65
87
|
<div class="layout" class:reset={r} class:dark={$isDark}>
|
|
88
|
+
<div class="top">
|
|
89
|
+
<slot name="title"><span>@nil-/doc</span></slot>
|
|
90
|
+
<ThemeIcon bind:dark={$isDark} />
|
|
91
|
+
</div>
|
|
66
92
|
<Container offset={250} padding={250} vertical secondary>
|
|
67
93
|
<svelte:fragment slot="primary">
|
|
68
94
|
<div class="content scrollable">
|
|
@@ -72,9 +98,7 @@ $:
|
|
|
72
98
|
sorter={sorter ?? ((l, r) => (l === r ? 0 : l < r ? -1 : +1))}
|
|
73
99
|
renamer={renamer ?? ((s) => s)}
|
|
74
100
|
on:navigate
|
|
75
|
-
|
|
76
|
-
<slot name="title">@nil-/doc</slot>
|
|
77
|
-
</Nav>
|
|
101
|
+
/>
|
|
78
102
|
</div>
|
|
79
103
|
</svelte:fragment>
|
|
80
104
|
<svelte:fragment slot="secondary">
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<style>
|
|
2
|
+
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
|
+
|
|
2
4
|
div {
|
|
3
5
|
display: flex;
|
|
4
6
|
flex-direction: column;
|
|
@@ -6,8 +8,6 @@
|
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
/* reset block */
|
|
9
|
-
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
10
|
-
|
|
11
11
|
.reset {
|
|
12
12
|
width: 100%;
|
|
13
13
|
height: 100%;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script context="module">let indexer = 0;
|
|
2
|
+
</script>
|
|
3
|
+
<script>export let dark = true;
|
|
4
|
+
import { spring } from "svelte/motion";
|
|
5
|
+
function iter() {
|
|
6
|
+
dark = !dark;
|
|
7
|
+
}
|
|
8
|
+
const rotate = spring(dark ? 90 : 40);
|
|
9
|
+
const mcx = spring(dark ? 30 : 12);
|
|
10
|
+
const mcy = spring(dark ? 0 : 4);
|
|
11
|
+
const cr = spring(dark ? 5 : 9);
|
|
12
|
+
const opacity = spring(dark ? 0 : 1);
|
|
13
|
+
$:
|
|
14
|
+
rotate.set(dark ? 90 : 40);
|
|
15
|
+
$:
|
|
16
|
+
mcx.set(dark ? 30 : 12);
|
|
17
|
+
$:
|
|
18
|
+
mcy.set(dark ? 0 : 4);
|
|
19
|
+
$:
|
|
20
|
+
cr.set(dark ? 5 : 9);
|
|
21
|
+
$:
|
|
22
|
+
opacity.set(dark ? 1 : 0);
|
|
23
|
+
const index = indexer++;
|
|
24
|
+
</script>
|
|
25
|
+
<style>
|
|
26
|
+
svg {
|
|
27
|
+
all: unset;
|
|
28
|
+
width: 50%;
|
|
29
|
+
height: 50%;
|
|
30
|
+
fill: none;
|
|
31
|
+
stroke: currentColor;
|
|
32
|
+
stroke-width: 2;
|
|
33
|
+
stroke-linecap: round;
|
|
34
|
+
stroke-linejoin: round;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
color: black;
|
|
37
|
+
margin: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
svg.dark {
|
|
41
|
+
color: white;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<svg
|
|
47
|
+
on:click={iter}
|
|
48
|
+
on:keypress={null}
|
|
49
|
+
viewBox="0 0 24 24"
|
|
50
|
+
class:dark
|
|
51
|
+
style={`transform: rotate(${$rotate}deg)`}
|
|
52
|
+
>
|
|
53
|
+
<mask id={`theme_icon_${index}`}>
|
|
54
|
+
<rect x="0" y="0" width="100%" height="100%" fill="white" />
|
|
55
|
+
<circle cx={$mcx} cy={$mcy} r="9" fill="currentColor" />
|
|
56
|
+
</mask>
|
|
57
|
+
<circle cx="12" cy="12" r={$cr} fill="currentColor" mask={`url(#theme_icon_${index})`} />
|
|
58
|
+
<g style={`opacity: ${$opacity}`}>
|
|
59
|
+
<line x1="12" y1="1" x2="12" y2="3" />
|
|
60
|
+
<line x1="12" y1="21" x2="12" y2="23" />
|
|
61
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
|
62
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
|
63
|
+
<line x1="1" y1="12" x2="3" y2="12" />
|
|
64
|
+
<line x1="21" y1="12" x2="23" y2="12" />
|
|
65
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
|
66
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
|
67
|
+
</g>
|
|
68
|
+
</svg>
|
|
69
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
dark?: boolean | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type ThemeIconProps = typeof __propDef.props;
|
|
12
|
+
export type ThemeIconEvents = typeof __propDef.events;
|
|
13
|
+
export type ThemeIconSlots = typeof __propDef.slots;
|
|
14
|
+
export default class ThemeIcon extends SvelteComponentTyped<ThemeIconProps, ThemeIconEvents, ThemeIconSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -10,8 +10,8 @@ import type { Tree, Sorter, Renamer } from "./types";
|
|
|
10
10
|
*
|
|
11
11
|
* Else comparison is done using built-in `string` comparison.
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
13
|
+
* @param l - left operand
|
|
14
|
+
* @param r - right operand
|
|
15
15
|
* @returns `-1 | 0 | +1`
|
|
16
16
|
*/
|
|
17
17
|
declare const sorter: Sorter;
|
|
@@ -19,7 +19,7 @@ declare const sorter: Sorter;
|
|
|
19
19
|
* If a text follows `<I>-<Name>` format,
|
|
20
20
|
* this method simply removes the Prefix.
|
|
21
21
|
*
|
|
22
|
-
* @param
|
|
22
|
+
* @param text
|
|
23
23
|
* @returns `<Name>`
|
|
24
24
|
*/
|
|
25
25
|
declare const renamer: Renamer;
|
|
@@ -19,8 +19,8 @@ function sorterT(l, r) {
|
|
|
19
19
|
*
|
|
20
20
|
* Else comparison is done using built-in `string` comparison.
|
|
21
21
|
*
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
22
|
+
* @param l - left operand
|
|
23
|
+
* @param r - right operand
|
|
24
24
|
* @returns `-1 | 0 | +1`
|
|
25
25
|
*/
|
|
26
26
|
const sorter = (l, r) => {
|
|
@@ -41,7 +41,7 @@ const sorter = (l, r) => {
|
|
|
41
41
|
* If a text follows `<I>-<Name>` format,
|
|
42
42
|
* this method simply removes the Prefix.
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param text
|
|
45
45
|
* @returns `<Name>`
|
|
46
46
|
*/
|
|
47
47
|
const renamer = (text) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nil-/doc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.29",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "njaldea@gmail.com",
|
|
6
6
|
"name": "Neil Aldea"
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"@sveltejs/kit": "^1.0.1",
|
|
12
12
|
"@sveltejs/package": "^1.0.1",
|
|
13
13
|
"mdsvex": "^0.10.6",
|
|
14
|
-
"svelte-check": "^2.10.
|
|
14
|
+
"svelte-check": "^2.10.3",
|
|
15
15
|
"svelte-markdown": "^0.2.3",
|
|
16
16
|
"tslib": "^2.4.1",
|
|
17
17
|
"typescript": "^4.9.4",
|
|
18
|
-
"vite": "^4.0.
|
|
18
|
+
"vite": "^4.0.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"svelte": "^3.55.0"
|
package/sveltekit/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type Readable } from "svelte/store";
|
|
2
2
|
type Routes = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* List of routes
|
|
5
5
|
*/
|
|
6
6
|
data: string[];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {string} route
|
|
10
|
-
* @returns
|
|
8
|
+
* Current route but removes unneeded group layout in the route
|
|
11
9
|
*/
|
|
12
10
|
current: Readable<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Callback to navigate to other pages
|
|
13
|
+
* @param e - event that contains detail about the target url
|
|
14
|
+
*/
|
|
13
15
|
navigate: (e: CustomEvent<string>) => void;
|
|
14
16
|
};
|
|
15
17
|
/**
|