@nil-/doc 0.2.42 → 0.2.44
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 +14 -0
- package/components/Layout.svelte +8 -4
- package/components/block/controls/Number.svelte +2 -1
- package/components/block/controls/Object.svelte +3 -2
- package/components/block/controls/Range.svelte +7 -4
- package/components/block/controls/Select.svelte +2 -1
- package/components/block/controls/Switch.svelte +2 -1
- package/components/block/controls/Text.svelte +2 -1
- package/components/block/controls/Tuple.svelte +3 -2
- package/components/block/controls/misc/GroupHeader.svelte +19 -6
- package/components/block/controls/misc/GroupHeader.svelte.d.ts +1 -0
- package/components/block/controls/misc/Name.svelte +44 -0
- package/components/block/controls/misc/Name.svelte.d.ts +18 -0
- package/components/block/controls/misc/Styler.svelte +1 -14
- package/components/etc/NilIcon.svelte +22 -30
- package/components/etc/ThemeIcon.svelte +0 -1
- package/package.json +1 -1
- package/sveltekit/index.js +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][new] tuple and object controls now collapsible without disabling ([#72](https://github.com/njaldea/mono/pull/72))
|
|
8
|
+
|
|
9
|
+
## 0.2.43
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [doc][fix] disable Range.svelte tooltip when disabled ([#70](https://github.com/njaldea/mono/pull/70))
|
|
14
|
+
|
|
15
|
+
- [doc][new] added auto scroll when content of layout is only one component ([#70](https://github.com/njaldea/mono/pull/70))
|
|
16
|
+
|
|
3
17
|
## 0.2.42
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
.icon {
|
|
32
32
|
width: 100%;
|
|
33
33
|
height: 100%;
|
|
34
|
+
cursor: pointer;
|
|
34
35
|
transition: transform 350ms;
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -47,13 +48,15 @@
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/* scrollable */
|
|
50
|
-
.scrollable
|
|
51
|
+
.scrollable,
|
|
52
|
+
.page > :global(*:only-child) {
|
|
51
53
|
overflow: scroll;
|
|
52
54
|
scrollbar-width: none; /* Firefox */
|
|
53
55
|
-ms-overflow-style: none; /* IE and Edge */
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
.scrollable::-webkit-scrollbar
|
|
58
|
+
.scrollable::-webkit-scrollbar,
|
|
59
|
+
.page > :global(*:only-child::-webkit-scrollbar) {
|
|
57
60
|
display: none;
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -118,7 +121,8 @@ const toggle = () => {
|
|
|
118
121
|
<div
|
|
119
122
|
class="icon"
|
|
120
123
|
title="Double click to open repo: https://github.com/njaldea/mono"
|
|
121
|
-
on:
|
|
124
|
+
on:click={() => window.open("https://github.com/njaldea/mono", "_blank")}
|
|
125
|
+
on:keypress={null}
|
|
122
126
|
>
|
|
123
127
|
<NilIcon />
|
|
124
128
|
</div>
|
|
@@ -137,7 +141,7 @@ const toggle = () => {
|
|
|
137
141
|
</div>
|
|
138
142
|
</svelte:fragment>
|
|
139
143
|
<svelte:fragment slot="B">
|
|
140
|
-
<div class="content
|
|
144
|
+
<div class="content page">
|
|
141
145
|
{#key current}
|
|
142
146
|
<slot />
|
|
143
147
|
{/key}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
+
import Name from "./misc/Name.svelte";
|
|
3
4
|
export let value;
|
|
4
5
|
export let info;
|
|
5
6
|
export let depth;
|
|
@@ -10,7 +11,7 @@ $:
|
|
|
10
11
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
12
|
</script>
|
|
12
13
|
<div>
|
|
13
|
-
<
|
|
14
|
+
<Name name={info.name} {depth} />
|
|
14
15
|
<div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
|
|
15
16
|
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
16
17
|
</div>
|
|
@@ -12,9 +12,10 @@ $:
|
|
|
12
12
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
13
|
$:
|
|
14
14
|
values = info.values;
|
|
15
|
+
let expand = info.values.length > 0 ? true : void 0;
|
|
15
16
|
</script>
|
|
16
|
-
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
17
|
-
{#if enabled && !disabled}
|
|
17
|
+
<Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} />
|
|
18
|
+
{#if expand && enabled && !disabled}
|
|
18
19
|
{#each values as info, i (i)}
|
|
19
20
|
<Component
|
|
20
21
|
{info}
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
visibility: hidden;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.input:hover > .tooltip {
|
|
30
|
+
.input:hover > .tooltip:not(.disabled) {
|
|
31
31
|
visibility: visible;
|
|
32
32
|
}
|
|
33
33
|
</style>
|
|
34
34
|
|
|
35
35
|
<script>import { getDefault } from "./misc/defaulter";
|
|
36
|
+
import Name from "./misc/Name.svelte";
|
|
36
37
|
export let value;
|
|
37
38
|
export let info;
|
|
38
39
|
export let depth;
|
|
@@ -41,11 +42,13 @@ let ivalue = value ?? getDefault(info);
|
|
|
41
42
|
let enabled = value !== void 0;
|
|
42
43
|
$:
|
|
43
44
|
value = enabled && !disabled ? ivalue : void 0;
|
|
45
|
+
$:
|
|
46
|
+
flag = !enabled || disabled;
|
|
44
47
|
</script>
|
|
45
48
|
<div>
|
|
46
|
-
<
|
|
49
|
+
<Name name={info.name} {depth} />
|
|
47
50
|
<div class="input">
|
|
48
|
-
<div class="tooltip">
|
|
51
|
+
<div class="tooltip" class:disabled={flag}>
|
|
49
52
|
Current Value: {ivalue}
|
|
50
53
|
</div>
|
|
51
54
|
<div>{ivalue.toFixed(2)}</div>
|
|
@@ -55,7 +58,7 @@ $:
|
|
|
55
58
|
min={info.min}
|
|
56
59
|
max={info.max}
|
|
57
60
|
step={info.step}
|
|
58
|
-
disabled={
|
|
61
|
+
disabled={flag}
|
|
59
62
|
/>
|
|
60
63
|
</div>
|
|
61
64
|
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
+
import Name from "./misc/Name.svelte";
|
|
3
4
|
export let value;
|
|
4
5
|
export let info;
|
|
5
6
|
export let depth;
|
|
@@ -10,7 +11,7 @@ $:
|
|
|
10
11
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
12
|
</script>
|
|
12
13
|
<div>
|
|
13
|
-
<
|
|
14
|
+
<Name name={info.name} {depth} />
|
|
14
15
|
<div>
|
|
15
16
|
<select bind:value={ivalue} disabled={!enabled || disabled}>
|
|
16
17
|
{#each info.values as value}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
+
import Name from "./misc/Name.svelte";
|
|
3
4
|
export let value;
|
|
4
5
|
export let info;
|
|
5
6
|
export let depth;
|
|
@@ -10,7 +11,7 @@ $:
|
|
|
10
11
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
12
|
</script>
|
|
12
13
|
<div>
|
|
13
|
-
<
|
|
14
|
+
<Name name={info.name} {depth} />
|
|
14
15
|
<div><input type="checkbox" bind:checked={ivalue} disabled={!enabled || disabled} /></div>
|
|
15
16
|
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
16
17
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
+
import Name from "./misc/Name.svelte";
|
|
3
4
|
export let value;
|
|
4
5
|
export let info;
|
|
5
6
|
export let depth;
|
|
@@ -10,7 +11,7 @@ $:
|
|
|
10
11
|
value = ienabled && !disabled ? ivalue : void 0;
|
|
11
12
|
</script>
|
|
12
13
|
<div>
|
|
13
|
-
<
|
|
14
|
+
<Name name={info.name} {depth} />
|
|
14
15
|
<div><input type="text" bind:value={ivalue} disabled={!ienabled || disabled} /></div>
|
|
15
16
|
<div><input type="checkbox" bind:checked={ienabled} {disabled} /></div>
|
|
16
17
|
</div>
|
|
@@ -12,9 +12,10 @@ $:
|
|
|
12
12
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
13
|
$:
|
|
14
14
|
values = info.values;
|
|
15
|
+
let expand = info.values.length > 0 ? true : void 0;
|
|
15
16
|
</script>
|
|
16
|
-
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
17
|
-
{#if enabled && !disabled}
|
|
17
|
+
<Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} />
|
|
18
|
+
{#if expand && enabled && !disabled}
|
|
18
19
|
{#each values as info, i (i)}
|
|
19
20
|
<Component
|
|
20
21
|
info={{ ...info, name: `${i}` }}
|
|
@@ -4,16 +4,29 @@
|
|
|
4
4
|
}
|
|
5
5
|
</style>
|
|
6
6
|
|
|
7
|
-
<script>
|
|
7
|
+
<script>import Name from "./Name.svelte";
|
|
8
|
+
export let name;
|
|
8
9
|
export let depth;
|
|
9
10
|
export let checked;
|
|
10
11
|
export let disabled = false;
|
|
12
|
+
export let expand = void 0;
|
|
13
|
+
const flip = () => {
|
|
14
|
+
if (!disabled && checked) {
|
|
15
|
+
if (expand !== void 0) {
|
|
16
|
+
expand = !expand;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
11
20
|
</script>
|
|
12
|
-
<div>
|
|
13
|
-
<
|
|
14
|
-
{
|
|
15
|
-
|
|
21
|
+
<div on:click={flip} on:keypress={null}>
|
|
22
|
+
<Name
|
|
23
|
+
expand={expand === undefined ? undefined : expand && checked && !disabled}
|
|
24
|
+
{name}
|
|
25
|
+
{depth}
|
|
26
|
+
/>
|
|
16
27
|
<div class="value">-</div>
|
|
17
|
-
<div
|
|
28
|
+
<div>
|
|
29
|
+
<input type="checkbox" {disabled} bind:checked on:click={(e) => e.stopPropagation()} />
|
|
30
|
+
</div>
|
|
18
31
|
</div>
|
|
19
32
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.override {
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
white-space: nowrap;
|
|
5
|
+
text-overflow: ellipsis;
|
|
6
|
+
padding-right: 10px;
|
|
7
|
+
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: 20px 1fr;
|
|
10
|
+
align-items: center;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.icon {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
height: 15px;
|
|
19
|
+
width: 15px;
|
|
20
|
+
transition: transform 350ms;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.icon.expand {
|
|
24
|
+
transform: rotate(90deg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.icon > div {
|
|
28
|
+
margin: auto;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
|
|
32
|
+
<script>export let depth;
|
|
33
|
+
export let name;
|
|
34
|
+
export let expand = void 0;
|
|
35
|
+
</script>
|
|
36
|
+
<div class="override" style:padding-left={`${depth}px`} title={name}>
|
|
37
|
+
<div class="icon" class:expand={expand === true}>
|
|
38
|
+
<div>
|
|
39
|
+
{expand === undefined ? "-" : ">"}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<span>{name}</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
depth: number;
|
|
5
|
+
name: string;
|
|
6
|
+
expand?: boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type NameProps = typeof __propDef.props;
|
|
14
|
+
export type NameEvents = typeof __propDef.events;
|
|
15
|
+
export type NameSlots = typeof __propDef.slots;
|
|
16
|
+
export default class Name extends SvelteComponentTyped<NameProps, NameEvents, NameSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -24,12 +24,7 @@ const dark = getTheme();
|
|
|
24
24
|
grid-template-columns: minmax(250px, 1fr) 200px 40px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
div > :global(div > div) {
|
|
28
|
-
display: grid;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
div > :global(div > div > *) {
|
|
27
|
+
div > :global(div > div:not(:first-child) > *) {
|
|
33
28
|
width: 100%;
|
|
34
29
|
height: 100%;
|
|
35
30
|
}
|
|
@@ -48,14 +43,6 @@ const dark = getTheme();
|
|
|
48
43
|
background-color: hsl(210, 100%, 90%);
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
div > :global(div:nth-child(n + 2) > div:first-child) {
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
white-space: nowrap;
|
|
54
|
-
text-overflow: ellipsis;
|
|
55
|
-
padding-right: 10px;
|
|
56
|
-
display: block;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
46
|
div > :global(div:hover .tooltip) {
|
|
60
47
|
background-color: hsl(0, 0%, 100%);
|
|
61
48
|
outline: hsl(0, 100%, 0%) 1px solid;
|
|
@@ -1,47 +1,39 @@
|
|
|
1
|
+
<script>import { tweened } from "svelte/motion";
|
|
2
|
+
const d = "M 0 -15 L 15 -15 L 15 0 L 0 0 -9 0 A 6 8 135 0 1 9 0";
|
|
3
|
+
const length = tweened(100);
|
|
4
|
+
const trigger = () => {
|
|
5
|
+
if (0 === $length) {
|
|
6
|
+
$length = 100;
|
|
7
|
+
} else if (100 === $length) {
|
|
8
|
+
$length = 0;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
$:
|
|
12
|
+
0 === $length && trigger();
|
|
13
|
+
</script>
|
|
1
14
|
<style>
|
|
2
15
|
svg {
|
|
3
16
|
width: 100%;
|
|
4
17
|
height: 100%;
|
|
5
|
-
fill: transparent;
|
|
6
|
-
stroke: currentColor;
|
|
7
18
|
stroke-width: 4;
|
|
8
19
|
stroke-linejoin: miter;
|
|
9
|
-
|
|
20
|
+
stroke: currentColor;
|
|
21
|
+
fill: transparent;
|
|
10
22
|
}
|
|
11
23
|
</style>
|
|
12
24
|
|
|
13
|
-
<script>
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
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(1);
|
|
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
|
-
}
|
|
25
|
+
<script context="module">const action = (p, length) => {
|
|
26
|
+
const update = (length2) => p.style.strokeDasharray = `${length2} 100`;
|
|
27
|
+
update(length);
|
|
28
|
+
return { update };
|
|
35
29
|
};
|
|
36
|
-
$:
|
|
37
|
-
0 === $length && click();
|
|
38
30
|
</script>
|
|
39
|
-
<svg viewBox="-35 -35 70 70" on:
|
|
31
|
+
<svg viewBox="-35 -35 70 70" on:pointerenter={trigger}>
|
|
40
32
|
<g transform="rotate(45 0 0)">
|
|
41
|
-
<path {d} use:action={
|
|
33
|
+
<path {d} use:action={$length} />
|
|
42
34
|
</g>
|
|
43
35
|
<g transform="rotate(225 0 0)">
|
|
44
|
-
<path {d} use:action={
|
|
36
|
+
<path {d} use:action={$length} />
|
|
45
37
|
</g>
|
|
46
38
|
</svg>
|
|
47
39
|
|
package/package.json
CHANGED
package/sveltekit/index.js
CHANGED
|
@@ -20,8 +20,6 @@ const isRouteDynamic = (p) => null == routeIsDynamic.exec(p);
|
|
|
20
20
|
export const sveltekit = (detail, prefix = null) => {
|
|
21
21
|
const key = "@nil-/doc/theme";
|
|
22
22
|
const initialValue = browser && "light" === localStorage.getItem(key) ? "light" : "dark";
|
|
23
|
-
const theme = writable(initialValue);
|
|
24
|
-
theme.subscribe((v) => browser && localStorage.setItem(key, v));
|
|
25
23
|
const result = {
|
|
26
24
|
data: Object.keys(detail)
|
|
27
25
|
.map(toRoute)
|
|
@@ -38,7 +36,8 @@ export const sveltekit = (detail, prefix = null) => {
|
|
|
38
36
|
return null;
|
|
39
37
|
}),
|
|
40
38
|
navigate: prefix ? (e) => goto(`${prefix}${e.detail}`) : (e) => goto(e.detail),
|
|
41
|
-
theme
|
|
39
|
+
theme: writable(initialValue)
|
|
42
40
|
};
|
|
41
|
+
browser && result.theme.subscribe((v) => localStorage.setItem(key, v));
|
|
43
42
|
return result;
|
|
44
43
|
};
|