@nil-/doc 0.2.34 → 0.2.36
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 +16 -0
- package/components/Layout.svelte +44 -33
- package/components/block/Block.svelte +1 -0
- package/components/block/Controls.svelte +2 -2
- package/components/block/Controls.svelte.d.ts +1 -1
- package/components/block/Template.svelte +47 -18
- package/components/block/action.d.ts +12 -0
- package/components/block/action.js +26 -0
- package/components/block/context.d.ts +1 -1
- package/components/block/context.js +1 -2
- package/components/etc/Container.svelte +5 -1
- package/components/etc/NilIcon.svelte +47 -0
- package/components/etc/NilIcon.svelte.d.ts +14 -0
- package/components/etc/ThemeIcon.svelte +1 -3
- package/components/navigation/Nav.svelte +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] color changes and transition ([#55](https://github.com/njaldea/mono/pull/55))
|
|
8
|
+
|
|
9
|
+
- [all] added html meta details ([#55](https://github.com/njaldea/mono/pull/55))
|
|
10
|
+
|
|
11
|
+
## 0.2.35
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [doc] changed Control "side" flag to "position" prop ([#53](https://github.com/njaldea/mono/pull/53))
|
|
16
|
+
|
|
17
|
+
- [misc] added nil icon ([#53](https://github.com/njaldea/mono/pull/53))
|
|
18
|
+
|
|
3
19
|
## 0.2.34
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
display: grid;
|
|
6
6
|
grid-template-columns: 1fr;
|
|
7
7
|
grid-template-rows: minmax(40px, auto) 1fr;
|
|
8
|
+
gap: 1px;
|
|
8
9
|
width: 100%;
|
|
9
10
|
height: 100%;
|
|
10
11
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
@@ -12,14 +13,19 @@
|
|
|
12
13
|
|
|
13
14
|
.top {
|
|
14
15
|
display: grid;
|
|
15
|
-
grid-template-columns: 1fr 40px;
|
|
16
|
+
grid-template-columns: 1fr 40px 40px;
|
|
16
17
|
align-items: center;
|
|
17
|
-
padding-left:
|
|
18
|
-
padding-right:
|
|
18
|
+
padding-left: 10px;
|
|
19
|
+
padding-right: 10px;
|
|
19
20
|
box-sizing: border-box;
|
|
20
21
|
user-select: none;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
.main {
|
|
25
|
+
height: 100%;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
.content {
|
|
24
30
|
height: 100%;
|
|
25
31
|
padding: 5px;
|
|
@@ -49,24 +55,25 @@
|
|
|
49
55
|
|
|
50
56
|
/* colors */
|
|
51
57
|
.layout {
|
|
52
|
-
transition: color 350ms, background-color 350ms;
|
|
53
|
-
background-color: hsl(0, 0%, 100%);
|
|
54
|
-
color: hsl(0, 100%, 0%);
|
|
55
58
|
color-scheme: light;
|
|
59
|
+
color: hsl(0, 0%, 0%);
|
|
60
|
+
background-color: hsl(0, 2%, 70%);
|
|
61
|
+
transition: color 350ms, background-color 350ms;
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
.layout
|
|
59
|
-
|
|
64
|
+
.layout.dark {
|
|
65
|
+
color-scheme: dark;
|
|
66
|
+
color: hsl(0, 0%, 80%);
|
|
67
|
+
background-color: hsl(0, 2%, 40%);
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
.layout
|
|
63
|
-
|
|
70
|
+
.layout > div {
|
|
71
|
+
background-color: hsl(0, 0%, 100%);
|
|
72
|
+
transition: background-color 350ms;
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
.layout.dark {
|
|
75
|
+
.layout.dark > div {
|
|
67
76
|
background-color: hsl(200, 4%, 14%);
|
|
68
|
-
color: hsl(200, 6%, 80%);
|
|
69
|
-
color-scheme: dark;
|
|
70
77
|
}
|
|
71
78
|
</style>
|
|
72
79
|
|
|
@@ -76,6 +83,7 @@
|
|
|
76
83
|
import Nav from "./navigation/Nav.svelte";
|
|
77
84
|
import { inRoot, getTheme, initTheme, evalTheme } from "./context";
|
|
78
85
|
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
86
|
+
import NilIcon from "./etc/NilIcon.svelte";
|
|
79
87
|
export let data;
|
|
80
88
|
export let current = null;
|
|
81
89
|
export let sorter = null;
|
|
@@ -91,26 +99,29 @@ $:
|
|
|
91
99
|
<div class="top">
|
|
92
100
|
<slot name="title"><span>@nil-/doc</span></slot>
|
|
93
101
|
<ThemeIcon bind:dark={$isDark} />
|
|
102
|
+
<NilIcon />
|
|
103
|
+
</div>
|
|
104
|
+
<div class="main">
|
|
105
|
+
<Container offset={250} vertical secondary>
|
|
106
|
+
<svelte:fragment slot="primary">
|
|
107
|
+
<div class="content scrollable">
|
|
108
|
+
<Nav
|
|
109
|
+
info={data}
|
|
110
|
+
selected={current ?? ""}
|
|
111
|
+
sorter={sorter ?? defaultSorter}
|
|
112
|
+
renamer={renamer ?? ((s) => s)}
|
|
113
|
+
on:navigate
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</svelte:fragment>
|
|
117
|
+
<svelte:fragment slot="secondary">
|
|
118
|
+
<div class="content scrollable">
|
|
119
|
+
{#key current}
|
|
120
|
+
<slot />
|
|
121
|
+
{/key}
|
|
122
|
+
</div>
|
|
123
|
+
</svelte:fragment>
|
|
124
|
+
</Container>
|
|
94
125
|
</div>
|
|
95
|
-
<Container offset={250} vertical secondary>
|
|
96
|
-
<svelte:fragment slot="primary">
|
|
97
|
-
<div class="content scrollable">
|
|
98
|
-
<Nav
|
|
99
|
-
info={data}
|
|
100
|
-
selected={current ?? ""}
|
|
101
|
-
sorter={sorter ?? defaultSorter}
|
|
102
|
-
renamer={renamer ?? ((s) => s)}
|
|
103
|
-
on:navigate
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
</svelte:fragment>
|
|
107
|
-
<svelte:fragment slot="secondary">
|
|
108
|
-
<div class="content scrollable">
|
|
109
|
-
{#key current}
|
|
110
|
-
<slot />
|
|
111
|
-
{/key}
|
|
112
|
-
</div>
|
|
113
|
-
</svelte:fragment>
|
|
114
|
-
</Container>
|
|
115
126
|
</div>
|
|
116
127
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
<script>import { getControls, getControlsState } from "./context";
|
|
3
3
|
export let props = [];
|
|
4
4
|
export let hide = false;
|
|
5
|
-
export let
|
|
5
|
+
export let position = void 0;
|
|
6
6
|
const controls = getControls();
|
|
7
7
|
$controls = props;
|
|
8
8
|
const state = getControlsState();
|
|
9
9
|
$:
|
|
10
10
|
$state.hide = hide;
|
|
11
11
|
$:
|
|
12
|
-
$state.
|
|
12
|
+
$state.position = position;
|
|
13
13
|
</script>
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<style>
|
|
2
|
+
div {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
.template {
|
|
3
7
|
display: grid;
|
|
4
|
-
gap: 5px;
|
|
5
8
|
padding-bottom: 10px;
|
|
6
9
|
padding-top: 10px;
|
|
7
10
|
grid-auto-rows: 1fr;
|
|
8
11
|
grid-auto-columns: auto;
|
|
9
12
|
grid-auto-flow: row;
|
|
13
|
+
border-radius: 5px;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
.template.columns {
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
|
|
23
27
|
.content {
|
|
24
28
|
min-height: 100px;
|
|
25
|
-
border-radius: 5px
|
|
29
|
+
border-radius: 5px;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
div:not(.cside) > .misc {
|
|
@@ -31,14 +35,22 @@
|
|
|
31
35
|
user-select: none;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
.cside > .misc {
|
|
38
|
+
.template > .cside > .misc {
|
|
35
39
|
border-top-right-radius: 5px;
|
|
36
40
|
border-bottom-right-radius: 5px;
|
|
37
41
|
user-select: none;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
.
|
|
44
|
+
.instance {
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.content,
|
|
49
|
+
.misc {
|
|
41
50
|
margin: 3px;
|
|
51
|
+
border-style: solid;
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
padding: 1px;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
/* scrollable */
|
|
@@ -53,22 +65,29 @@
|
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
/* colors */
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
background-color: hsl(0,
|
|
68
|
+
.template {
|
|
69
|
+
color: hsl(0, 0%, 0%);
|
|
70
|
+
background-color: hsl(0, 2%, 70%);
|
|
71
|
+
transition: color 350ms, background-color 350ms;
|
|
59
72
|
}
|
|
60
73
|
|
|
61
|
-
.
|
|
62
|
-
|
|
74
|
+
.template.dark {
|
|
75
|
+
color-scheme: dark;
|
|
76
|
+
color: hsl(0, 0%, 80%);
|
|
77
|
+
background-color: hsl(0, 2%, 40%);
|
|
63
78
|
}
|
|
64
79
|
|
|
65
|
-
.content
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
.content,
|
|
81
|
+
.misc {
|
|
82
|
+
border-color: hsl(0, 2%, 60%);
|
|
83
|
+
background-color: hsl(0, 0%, 100%);
|
|
84
|
+
transition: border-color 350ms, background-color 350ms;
|
|
68
85
|
}
|
|
69
86
|
|
|
70
|
-
.
|
|
71
|
-
|
|
87
|
+
.dark .content,
|
|
88
|
+
.dark .misc {
|
|
89
|
+
border-color: hsl(0, 2%, 40%);
|
|
90
|
+
background-color: hsl(200, 4%, 14%);
|
|
72
91
|
}
|
|
73
92
|
</style>
|
|
74
93
|
|
|
@@ -77,6 +96,7 @@ import { getControls, getControlsState } from "./context";
|
|
|
77
96
|
import { resolve } from "./utils";
|
|
78
97
|
import { getTheme } from "../context";
|
|
79
98
|
import Controls from "./controls/Controls.svelte";
|
|
99
|
+
import { cquery } from "./action";
|
|
80
100
|
import { beforeUpdate } from "svelte";
|
|
81
101
|
const params = getParams();
|
|
82
102
|
const controls = getControls();
|
|
@@ -92,15 +112,24 @@ const reset = () => {
|
|
|
92
112
|
};
|
|
93
113
|
$:
|
|
94
114
|
$defaultsStore, reset();
|
|
95
|
-
let key = false;
|
|
96
|
-
beforeUpdate(() => key = !key);
|
|
97
115
|
const resolveArgs = resolve;
|
|
98
116
|
$:
|
|
99
117
|
expanded = $controls.length > 0 && !$controlsState.hide;
|
|
118
|
+
let key = false;
|
|
119
|
+
beforeUpdate(() => key = !key);
|
|
100
120
|
</script>
|
|
101
|
-
<div class="template" class:columns>
|
|
121
|
+
<div class="template" class:columns class:dark={$isDark}>
|
|
102
122
|
{#each $params as param (param.id)}
|
|
103
|
-
<div
|
|
123
|
+
<div
|
|
124
|
+
class="instance"
|
|
125
|
+
class:cside={expanded && "right" === $controlsState.position}
|
|
126
|
+
use:cquery={{
|
|
127
|
+
class: "cside",
|
|
128
|
+
min: 1000,
|
|
129
|
+
w: true,
|
|
130
|
+
enabled: expanded && $controlsState.position === undefined
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
104
133
|
{#if noreset}
|
|
105
134
|
<div class="content scrollable" class:dark={$isDark}>
|
|
106
135
|
<slot
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ActionReturn } from "svelte/action";
|
|
2
|
+
type Options = {
|
|
3
|
+
class: string;
|
|
4
|
+
min: number;
|
|
5
|
+
w: boolean;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Temporary support for container query until svelte supports it
|
|
10
|
+
*/
|
|
11
|
+
export declare const cquery: (div: HTMLDivElement, options: Options) => ActionReturn<Options>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporary support for container query until svelte supports it
|
|
3
|
+
*/
|
|
4
|
+
export const cquery = (div, options) => {
|
|
5
|
+
let o = options;
|
|
6
|
+
const check = () => div.classList.toggle(o.class, (o.w ? div.clientWidth : div.clientHeight) > o.min);
|
|
7
|
+
const observer = new ResizeObserver(check);
|
|
8
|
+
if (o.enabled) {
|
|
9
|
+
observer.observe(div);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
update: (options) => {
|
|
13
|
+
if (o.enabled !== options.enabled) {
|
|
14
|
+
if (!o.enabled && options.enabled) {
|
|
15
|
+
observer.observe(div);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
observer.disconnect();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
o = options;
|
|
22
|
+
check();
|
|
23
|
+
},
|
|
24
|
+
destroy: () => o.enabled && observer.disconnect()
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -11,7 +11,7 @@ export type Params = {
|
|
|
11
11
|
};
|
|
12
12
|
export type ControlState = {
|
|
13
13
|
hide: boolean;
|
|
14
|
-
|
|
14
|
+
position?: "bottom" | "right";
|
|
15
15
|
};
|
|
16
16
|
export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
|
|
17
17
|
export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
|
|
@@ -11,6 +11,5 @@ export const { init: initParams, get: getParams } = create(() => []);
|
|
|
11
11
|
export const { init: initControls, get: getControls } = create(() => []);
|
|
12
12
|
export const { init: initDefaults, get: getDefaults } = create(() => null);
|
|
13
13
|
export const { init: initControlsState, get: getControlsState } = create(() => ({
|
|
14
|
-
hide: false
|
|
15
|
-
side: false
|
|
14
|
+
hide: false
|
|
16
15
|
}));
|
|
@@ -56,10 +56,14 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.container.dark {
|
|
59
|
-
--color-p: hsl(0, 2%,
|
|
59
|
+
--color-p: hsl(0, 2%, 40%);
|
|
60
60
|
--color-s: hsl(0, 0%, 100%);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
.divider {
|
|
64
|
+
transition: border-color 350ms, background-color 350ms;
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
.container:not(.vertical) > .divider {
|
|
64
68
|
border-bottom: var(--color-p) solid 2.5px;
|
|
65
69
|
border-top: var(--color-p) solid 2.5px;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
svg {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
fill: transparent;
|
|
6
|
+
stroke: currentColor;
|
|
7
|
+
stroke-width: 4;
|
|
8
|
+
stroke-linejoin: miter;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
|
|
13
|
+
<script>import { tweened } from "svelte/motion";
|
|
14
|
+
const action = (p, options) => {
|
|
15
|
+
const total = p.getTotalLength();
|
|
16
|
+
p.style.strokeDasharray = `${total * options.length} ${total}`;
|
|
17
|
+
return {
|
|
18
|
+
update: (options2) => {
|
|
19
|
+
const total2 = p.getTotalLength();
|
|
20
|
+
p.style.strokeDasharray = `${total2 * options2.length} ${total2}`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const d = "M 0 -15 L 15 -15 L 15 0 L 0 0 -9 0 A 6 8 135 0 1 9 0";
|
|
25
|
+
const length = tweened(0);
|
|
26
|
+
let out = false;
|
|
27
|
+
const click = () => {
|
|
28
|
+
if (0 === $length) {
|
|
29
|
+
$length = 1;
|
|
30
|
+
out = false;
|
|
31
|
+
} else if (!out) {
|
|
32
|
+
$length = 0;
|
|
33
|
+
out = true;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
$:
|
|
37
|
+
0 === $length && click();
|
|
38
|
+
</script>
|
|
39
|
+
<svg viewBox="-35 -35 70 70" on:click={click} on:keypress={null}>
|
|
40
|
+
<g transform="rotate(45 0 0)">
|
|
41
|
+
<path {d} use:action={{ length: $length }} />
|
|
42
|
+
</g>
|
|
43
|
+
<g transform="rotate(225 0 0)">
|
|
44
|
+
<path {d} use:action={{ length: $length }} />
|
|
45
|
+
</g>
|
|
46
|
+
</svg>
|
|
47
|
+
|
|
@@ -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 NilIconProps = typeof __propDef.props;
|
|
10
|
+
export type NilIconEvents = typeof __propDef.events;
|
|
11
|
+
export type NilIconSlots = typeof __propDef.slots;
|
|
12
|
+
export default class NilIcon extends SvelteComponentTyped<NilIconProps, NilIconEvents, NilIconSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>import { tweened } from "svelte/motion";
|
|
2
|
-
import { elasticOut } from "svelte/easing";
|
|
3
2
|
export let dark = true;
|
|
4
|
-
const values = tweened(dark ? vdark : vlight
|
|
3
|
+
const values = tweened(dark ? vdark : vlight);
|
|
5
4
|
$:
|
|
6
5
|
$values = dark ? vdark : vlight;
|
|
7
6
|
const index = indexer++;
|
|
@@ -49,7 +48,6 @@ const vdark = {
|
|
|
49
48
|
class:dark
|
|
50
49
|
viewBox="-25 -25 50 50"
|
|
51
50
|
transform={`rotate(${$values.rotate})`}
|
|
52
|
-
style={`color: hsl(0, 0%, ${$values.v * 100}%);`}
|
|
53
51
|
on:click={() => (dark = !dark)}
|
|
54
52
|
on:keypress={null}
|
|
55
53
|
>
|