@nil-/doc 0.2.28 → 0.2.30
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 +15 -0
- package/components/Layout.svelte +28 -3
- package/components/block/Instance.svelte +11 -0
- package/components/block/Instance.svelte.d.ts +22 -0
- package/components/etc/ThemeIcon.svelte +78 -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/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/sveltekit/index.d.ts +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.30
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc] Added color transition in Layout ([#43](https://github.com/njaldea/mono/pull/43))
|
|
8
|
+
|
|
9
|
+
- [doc] added Instance component ([#43](https://github.com/njaldea/mono/pull/43))
|
|
10
|
+
|
|
11
|
+
## 0.2.29
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [doc][feature] ThemeIcon ([#41](https://github.com/njaldea/mono/pull/41))
|
|
16
|
+
[doc][feature] added top bar to separate title and other controls
|
|
17
|
+
|
|
3
18
|
## 0.2.28
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -2,11 +2,24 @@
|
|
|
2
2
|
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
3
|
|
|
4
4
|
.layout {
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: 1fr;
|
|
7
|
+
grid-template-rows: minmax(40px, auto) 1fr;
|
|
5
8
|
width: 100%;
|
|
6
9
|
height: 100%;
|
|
7
10
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
8
11
|
}
|
|
9
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
|
+
|
|
10
23
|
.content {
|
|
11
24
|
height: 100%;
|
|
12
25
|
padding: 5px;
|
|
@@ -36,11 +49,20 @@
|
|
|
36
49
|
|
|
37
50
|
/* colors */
|
|
38
51
|
.layout {
|
|
52
|
+
transition: color 350ms, background-color 350ms;
|
|
39
53
|
background-color: hsl(0, 0%, 100%);
|
|
40
54
|
color: hsl(0, 100%, 0%);
|
|
41
55
|
color-scheme: light;
|
|
42
56
|
}
|
|
43
57
|
|
|
58
|
+
.layout > .top {
|
|
59
|
+
border-bottom: hsl(0, 2%, 70%) solid 1px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.layout.dark > .top {
|
|
63
|
+
border-bottom: hsl(0, 2%, 38%) solid 1px;
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
.layout.dark {
|
|
45
67
|
background-color: hsl(200, 4%, 14%);
|
|
46
68
|
color: hsl(200, 6%, 80%);
|
|
@@ -51,6 +73,7 @@
|
|
|
51
73
|
<script>import Container from "./etc/Container.svelte";
|
|
52
74
|
import Nav from "./navigation/Nav.svelte";
|
|
53
75
|
import { inRoot, getTheme, initTheme, evalTheme } from "./context";
|
|
76
|
+
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
54
77
|
export let data;
|
|
55
78
|
export let current = null;
|
|
56
79
|
export let sorter = null;
|
|
@@ -63,6 +86,10 @@ $:
|
|
|
63
86
|
$isDark = evalTheme(parentTheme ? $parentTheme : true, theme);
|
|
64
87
|
</script>
|
|
65
88
|
<div class="layout" class:reset={r} class:dark={$isDark}>
|
|
89
|
+
<div class="top">
|
|
90
|
+
<slot name="title"><span>@nil-/doc</span></slot>
|
|
91
|
+
<ThemeIcon bind:dark={$isDark} />
|
|
92
|
+
</div>
|
|
66
93
|
<Container offset={250} padding={250} vertical secondary>
|
|
67
94
|
<svelte:fragment slot="primary">
|
|
68
95
|
<div class="content scrollable">
|
|
@@ -72,9 +99,7 @@ $:
|
|
|
72
99
|
sorter={sorter ?? ((l, r) => (l === r ? 0 : l < r ? -1 : +1))}
|
|
73
100
|
renamer={renamer ?? ((s) => s)}
|
|
74
101
|
on:navigate
|
|
75
|
-
|
|
76
|
-
<slot name="title">@nil-/doc</slot>
|
|
77
|
-
</Nav>
|
|
102
|
+
/>
|
|
78
103
|
</div>
|
|
79
104
|
</svelte:fragment>
|
|
80
105
|
<svelte:fragment slot="secondary">
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
<script>import Template from "./Template.svelte";
|
|
3
|
+
import Params from "./Params.svelte";
|
|
4
|
+
export let defaults = void 0;
|
|
5
|
+
export let noreset = false;
|
|
6
|
+
const cast = (t) => t;
|
|
7
|
+
</script>
|
|
8
|
+
<Template {defaults} {noreset} let:props let:key>
|
|
9
|
+
<slot props={cast(props)} {key} />
|
|
10
|
+
</Template>
|
|
11
|
+
<Params />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare class __sveltets_Render<Args> {
|
|
3
|
+
props(): {
|
|
4
|
+
defaults?: Args | undefined;
|
|
5
|
+
noreset?: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
events(): {} & {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots(): {
|
|
11
|
+
default: {
|
|
12
|
+
props: Args;
|
|
13
|
+
key: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export type InstanceProps<Args> = ReturnType<__sveltets_Render<Args>['props']>;
|
|
18
|
+
export type InstanceEvents<Args> = ReturnType<__sveltets_Render<Args>['events']>;
|
|
19
|
+
export type InstanceSlots<Args> = ReturnType<__sveltets_Render<Args>['slots']>;
|
|
20
|
+
export default class Instance<Args> extends SvelteComponentTyped<InstanceProps<Args>, InstanceEvents<Args>, InstanceSlots<Args>> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script>export let dark = true;
|
|
2
|
+
import { tweened } from "svelte/motion";
|
|
3
|
+
const values = tweened(dark ? vdark : vlight, { duration: 350 });
|
|
4
|
+
$:
|
|
5
|
+
values.set(dark ? vdark : vlight);
|
|
6
|
+
const index = indexer++;
|
|
7
|
+
</script>
|
|
8
|
+
<style>
|
|
9
|
+
svg {
|
|
10
|
+
all: unset;
|
|
11
|
+
width: 50%;
|
|
12
|
+
height: 50%;
|
|
13
|
+
margin: auto;
|
|
14
|
+
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
color: black;
|
|
17
|
+
fill: none;
|
|
18
|
+
|
|
19
|
+
stroke: currentColor;
|
|
20
|
+
stroke-width: 2;
|
|
21
|
+
stroke-linecap: round;
|
|
22
|
+
stroke-linejoin: round;
|
|
23
|
+
|
|
24
|
+
-webkit-tap-highlight-color: transparent;
|
|
25
|
+
-moz-tap-highlight-color: transparent;
|
|
26
|
+
-o-tap-highlight-color: transparent;
|
|
27
|
+
tap-highlight-color: transparent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
svg.dark {
|
|
31
|
+
color: white;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
|
|
35
|
+
<script context="module">let indexer = 0;
|
|
36
|
+
const vlight = {
|
|
37
|
+
rotate: 40,
|
|
38
|
+
mask: {
|
|
39
|
+
cx: 12,
|
|
40
|
+
cy: 4
|
|
41
|
+
},
|
|
42
|
+
cr: 10,
|
|
43
|
+
opacity: 0
|
|
44
|
+
};
|
|
45
|
+
const vdark = {
|
|
46
|
+
rotate: 180,
|
|
47
|
+
mask: {
|
|
48
|
+
cx: 30,
|
|
49
|
+
cy: 0
|
|
50
|
+
},
|
|
51
|
+
cr: 5,
|
|
52
|
+
opacity: 1
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
55
|
+
<svg
|
|
56
|
+
class:dark
|
|
57
|
+
viewBox="0 0 24 24"
|
|
58
|
+
style={`transform: rotate(${$values.rotate}deg)`}
|
|
59
|
+
on:click={() => (dark = !dark)}
|
|
60
|
+
on:keypress={null}
|
|
61
|
+
>
|
|
62
|
+
<mask id={`theme_icon_${index}`}>
|
|
63
|
+
<rect x="0" y="0" width="100%" height="100%" fill="white" />
|
|
64
|
+
<circle cx={$values.mask.cx} cy={$values.mask.cy} r="11" fill="currentColor" />
|
|
65
|
+
</mask>
|
|
66
|
+
<circle cx="12" cy="12" r={$values.cr} fill="currentColor" mask={`url(#theme_icon_${index})`} />
|
|
67
|
+
<g style={`opacity: ${$values.opacity}`}>
|
|
68
|
+
<line x1="12" y1="1" x2="12" y2="3" />
|
|
69
|
+
<line x1="12" y1="21" x2="12" y2="23" />
|
|
70
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
|
71
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
|
72
|
+
<line x1="1" y1="12" x2="3" y2="12" />
|
|
73
|
+
<line x1="21" y1="12" x2="23" y2="12" />
|
|
74
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
|
75
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
|
76
|
+
</g>
|
|
77
|
+
</svg>
|
|
78
|
+
|
|
@@ -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/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { renamer, sorter } from "./components/navigation/utils";
|
|
2
2
|
export type { Control } from "./components/block/controls/types";
|
|
3
3
|
export { default as Layout } from "./components/Layout.svelte";
|
|
4
|
+
export { default as Instance } from "./components/block/Instance.svelte";
|
|
4
5
|
export { default as Block } from "./components/block/Block.svelte";
|
|
5
6
|
export { default as Template } from "./components/block/Template.svelte";
|
|
6
7
|
export { default as Controls } from "./components/block/Controls.svelte";
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { renamer, sorter } from "./components/navigation/utils";
|
|
2
2
|
export { default as Layout } from "./components/Layout.svelte";
|
|
3
|
+
export { default as Instance } from "./components/block/Instance.svelte";
|
|
3
4
|
export { default as Block } from "./components/block/Block.svelte";
|
|
4
5
|
export { default as Template } from "./components/block/Template.svelte";
|
|
5
6
|
export { default as Controls } from "./components/block/Controls.svelte";
|
package/package.json
CHANGED
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
|
/**
|