@nil-/doc 0.2.43 → 0.2.45
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 +12 -0
- package/components/Layout.svelte +5 -2
- package/components/block/controls/Component.svelte +8 -7
- package/components/block/controls/Component.svelte.d.ts +1 -0
- package/components/block/controls/Controls.svelte +1 -1
- package/components/block/controls/Number.svelte +9 -5
- package/components/block/controls/Number.svelte.d.ts +1 -0
- package/components/block/controls/Object.svelte +12 -11
- package/components/block/controls/Object.svelte.d.ts +1 -0
- package/components/block/controls/Range.svelte +20 -16
- package/components/block/controls/Range.svelte.d.ts +1 -0
- package/components/block/controls/Select.svelte +13 -9
- package/components/block/controls/Select.svelte.d.ts +1 -0
- package/components/block/controls/Switch.svelte +9 -5
- package/components/block/controls/Switch.svelte.d.ts +1 -0
- package/components/block/controls/Text.svelte +9 -5
- package/components/block/controls/Text.svelte.d.ts +1 -0
- package/components/block/controls/Tuple.svelte +12 -11
- package/components/block/controls/Tuple.svelte.d.ts +1 -0
- package/components/block/controls/misc/GroupHeader.svelte +23 -7
- package/components/block/controls/misc/GroupHeader.svelte.d.ts +2 -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 +18 -16
- 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,17 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] keep control state when disabled after tuple/object parent toggles expand #[75](https://github.com/njaldea/mono/issues/75) ([#74](https://github.com/njaldea/mono/pull/74))
|
|
8
|
+
|
|
9
|
+
## 0.2.44
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [doc][new] tuple and object controls now collapsible without disabling ([#72](https://github.com/njaldea/mono/pull/72))
|
|
14
|
+
|
|
3
15
|
## 0.2.43
|
|
4
16
|
|
|
5
17
|
### 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
|
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
</style>
|
|
85
86
|
|
|
86
87
|
<script context="module">const defaultSorter = (l, r) => l.localeCompare(r);
|
|
88
|
+
const defaultRenamer = (s) => s;
|
|
87
89
|
</script>
|
|
88
90
|
<script>import Container from "./etc/Container.svelte";
|
|
89
91
|
import Nav from "./navigation/Nav.svelte";
|
|
@@ -120,7 +122,8 @@ const toggle = () => {
|
|
|
120
122
|
<div
|
|
121
123
|
class="icon"
|
|
122
124
|
title="Double click to open repo: https://github.com/njaldea/mono"
|
|
123
|
-
on:
|
|
125
|
+
on:click={() => window.open("https://github.com/njaldea/mono", "_blank")}
|
|
126
|
+
on:keypress={null}
|
|
124
127
|
>
|
|
125
128
|
<NilIcon />
|
|
126
129
|
</div>
|
|
@@ -133,7 +136,7 @@ const toggle = () => {
|
|
|
133
136
|
info={data}
|
|
134
137
|
selected={current ?? ""}
|
|
135
138
|
sorter={sorter ?? defaultSorter}
|
|
136
|
-
renamer={renamer ??
|
|
139
|
+
renamer={renamer ?? defaultRenamer}
|
|
137
140
|
on:navigate
|
|
138
141
|
/>
|
|
139
142
|
</div>
|
|
@@ -10,19 +10,20 @@ export let value;
|
|
|
10
10
|
export let info;
|
|
11
11
|
export let depth;
|
|
12
12
|
export let disabled = false;
|
|
13
|
+
export let visible = false;
|
|
13
14
|
</script>
|
|
14
15
|
{#if "object" === info.type}
|
|
15
|
-
<Object {info} bind:value {depth} {disabled} />
|
|
16
|
+
<Object {info} bind:value {depth} {disabled} {visible} />
|
|
16
17
|
{:else if "tuple" === info.type}
|
|
17
|
-
<Tuple {info} bind:value {depth} {disabled} />
|
|
18
|
+
<Tuple {info} bind:value {depth} {disabled} {visible} />
|
|
18
19
|
{:else if "text" === info.type}
|
|
19
|
-
<Text {info} bind:value {depth} {disabled} />
|
|
20
|
+
<Text {info} bind:value {depth} {disabled} {visible} />
|
|
20
21
|
{:else if "number" === info.type}
|
|
21
|
-
<Number {info} bind:value {depth} {disabled} />
|
|
22
|
+
<Number {info} bind:value {depth} {disabled} {visible} />
|
|
22
23
|
{:else if "range" === info.type}
|
|
23
|
-
<Range {info} bind:value {depth} {disabled} />
|
|
24
|
+
<Range {info} bind:value {depth} {disabled} {visible} />
|
|
24
25
|
{:else if "select" === info.type}
|
|
25
|
-
<Select {info} bind:value {depth} {disabled} />
|
|
26
|
+
<Select {info} bind:value {depth} {disabled} {visible} />
|
|
26
27
|
{:else if "switch" === info.type}
|
|
27
|
-
<Switch {info} bind:value {depth} {disabled} />
|
|
28
|
+
<Switch {info} bind:value {depth} {disabled} {visible} />
|
|
28
29
|
{/if}
|
|
@@ -1,16 +1,20 @@
|
|
|
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;
|
|
6
7
|
export let disabled = false;
|
|
8
|
+
export let visible = false;
|
|
7
9
|
let ivalue = value ?? getDefault(info);
|
|
8
10
|
let enabled = value !== void 0;
|
|
9
11
|
$:
|
|
10
12
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
13
|
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
{#if visible}
|
|
15
|
+
<div>
|
|
16
|
+
<Name name={info.name} {depth} />
|
|
17
|
+
<div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
|
|
18
|
+
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
@@ -6,21 +6,22 @@ export let value;
|
|
|
6
6
|
export let info;
|
|
7
7
|
export let depth;
|
|
8
8
|
export let disabled = false;
|
|
9
|
+
export let visible = false;
|
|
9
10
|
let ivalue = value ?? getDefault(info);
|
|
10
11
|
let enabled = value !== void 0;
|
|
12
|
+
let expand = info.values.length > 0 ? true : void 0;
|
|
11
13
|
$:
|
|
12
14
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
15
|
$:
|
|
14
16
|
values = info.values;
|
|
15
17
|
</script>
|
|
16
|
-
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
17
|
-
{#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{/if}
|
|
18
|
+
<Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
|
|
19
|
+
{#each values as info, i (i)}
|
|
20
|
+
<Component
|
|
21
|
+
{info}
|
|
22
|
+
bind:value={ivalue[info.name]}
|
|
23
|
+
depth={depth + 10}
|
|
24
|
+
disabled={!enabled || disabled}
|
|
25
|
+
visible={visible && expand && enabled && !disabled}
|
|
26
|
+
/>
|
|
27
|
+
{/each}
|
|
@@ -33,10 +33,12 @@
|
|
|
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;
|
|
39
40
|
export let disabled = false;
|
|
41
|
+
export let visible = false;
|
|
40
42
|
let ivalue = value ?? getDefault(info);
|
|
41
43
|
let enabled = value !== void 0;
|
|
42
44
|
$:
|
|
@@ -44,22 +46,24 @@ $:
|
|
|
44
46
|
$:
|
|
45
47
|
flag = !enabled || disabled;
|
|
46
48
|
</script>
|
|
47
|
-
|
|
48
|
-
<div
|
|
49
|
-
|
|
50
|
-
<div class="
|
|
51
|
-
|
|
49
|
+
{#if visible}
|
|
50
|
+
<div>
|
|
51
|
+
<Name name={info.name} {depth} />
|
|
52
|
+
<div class="input">
|
|
53
|
+
<div class="tooltip" class:disabled={flag}>
|
|
54
|
+
Current Value: {ivalue}
|
|
55
|
+
</div>
|
|
56
|
+
<div>{ivalue.toFixed(2)}</div>
|
|
57
|
+
<input
|
|
58
|
+
type="range"
|
|
59
|
+
bind:value={ivalue}
|
|
60
|
+
min={info.min}
|
|
61
|
+
max={info.max}
|
|
62
|
+
step={info.step}
|
|
63
|
+
disabled={flag}
|
|
64
|
+
/>
|
|
52
65
|
</div>
|
|
53
|
-
<div
|
|
54
|
-
<input
|
|
55
|
-
type="range"
|
|
56
|
-
bind:value={ivalue}
|
|
57
|
-
min={info.min}
|
|
58
|
-
max={info.max}
|
|
59
|
-
step={info.step}
|
|
60
|
-
disabled={flag}
|
|
61
|
-
/>
|
|
66
|
+
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
62
67
|
</div>
|
|
63
|
-
|
|
64
|
-
</div>
|
|
68
|
+
{/if}
|
|
65
69
|
|
|
@@ -1,22 +1,26 @@
|
|
|
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;
|
|
6
7
|
export let disabled = false;
|
|
8
|
+
export let visible = false;
|
|
7
9
|
let ivalue = value ?? getDefault(info);
|
|
8
10
|
let enabled = value !== void 0;
|
|
9
11
|
$:
|
|
10
12
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
13
|
</script>
|
|
12
|
-
|
|
13
|
-
<div style:padding-left={`${depth}px`} title={info.name}>- {info.name}</div>
|
|
14
|
+
{#if visible}
|
|
14
15
|
<div>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
<Name name={info.name} {depth} />
|
|
17
|
+
<div>
|
|
18
|
+
<select bind:value={ivalue} disabled={!enabled || disabled}>
|
|
19
|
+
{#each info.values as value}
|
|
20
|
+
<option {value}>{value}</option>
|
|
21
|
+
{/each}
|
|
22
|
+
</select>
|
|
23
|
+
</div>
|
|
24
|
+
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
20
25
|
</div>
|
|
21
|
-
|
|
22
|
-
</div>
|
|
26
|
+
{/if}
|
|
@@ -1,16 +1,20 @@
|
|
|
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;
|
|
6
7
|
export let disabled = false;
|
|
8
|
+
export let visible = false;
|
|
7
9
|
let ivalue = value ?? getDefault(info);
|
|
8
10
|
let enabled = value !== void 0;
|
|
9
11
|
$:
|
|
10
12
|
value = enabled && !disabled ? ivalue : void 0;
|
|
11
13
|
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
{#if visible}
|
|
15
|
+
<div>
|
|
16
|
+
<Name name={info.name} {depth} />
|
|
17
|
+
<div><input type="checkbox" bind:checked={ivalue} disabled={!enabled || disabled} /></div>
|
|
18
|
+
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
@@ -1,16 +1,20 @@
|
|
|
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;
|
|
6
7
|
export let disabled = false;
|
|
8
|
+
export let visible = false;
|
|
7
9
|
let ivalue = value ?? getDefault(info);
|
|
8
10
|
let ienabled = value !== void 0;
|
|
9
11
|
$:
|
|
10
12
|
value = ienabled && !disabled ? ivalue : void 0;
|
|
11
13
|
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
{#if visible}
|
|
15
|
+
<div>
|
|
16
|
+
<Name name={info.name} {depth} />
|
|
17
|
+
<div><input type="text" bind:value={ivalue} disabled={!ienabled || disabled} /></div>
|
|
18
|
+
<div><input type="checkbox" bind:checked={ienabled} {disabled} /></div>
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
@@ -6,21 +6,22 @@ export let value;
|
|
|
6
6
|
export let info;
|
|
7
7
|
export let depth;
|
|
8
8
|
export let disabled = false;
|
|
9
|
+
export let visible = false;
|
|
9
10
|
let ivalue = value ?? getDefault(info);
|
|
10
11
|
let enabled = value !== void 0;
|
|
11
12
|
$:
|
|
12
13
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
14
|
$:
|
|
14
15
|
values = info.values;
|
|
16
|
+
let expand = info.values.length > 0 ? true : void 0;
|
|
15
17
|
</script>
|
|
16
|
-
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
17
|
-
{#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{/if}
|
|
18
|
+
<Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
|
|
19
|
+
{#each values as info, i (i)}
|
|
20
|
+
<Component
|
|
21
|
+
info={{ ...info, name: `${i}` }}
|
|
22
|
+
bind:value={ivalue[i]}
|
|
23
|
+
depth={depth + 10}
|
|
24
|
+
disabled={!enabled || disabled}
|
|
25
|
+
visible={visible && expand && enabled && !disabled}
|
|
26
|
+
/>
|
|
27
|
+
{/each}
|
|
@@ -4,16 +4,32 @@
|
|
|
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
|
+
export let visible = false;
|
|
14
|
+
const flip = () => {
|
|
15
|
+
if (!disabled && checked) {
|
|
16
|
+
if (expand !== void 0) {
|
|
17
|
+
expand = !expand;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
|
|
22
|
+
{#if visible}
|
|
23
|
+
<div class="root" on:click={flip} on:keypress={null}>
|
|
24
|
+
<Name
|
|
25
|
+
expand={expand === undefined ? undefined : expand && checked && !disabled}
|
|
26
|
+
{name}
|
|
27
|
+
{depth}
|
|
28
|
+
/>
|
|
29
|
+
<div class="value">-</div>
|
|
30
|
+
<div>
|
|
31
|
+
<input type="checkbox" {disabled} bind:checked on:click={(e) => e.stopPropagation()} />
|
|
32
|
+
</div>
|
|
15
33
|
</div>
|
|
16
|
-
|
|
17
|
-
<div><input type="checkbox" bind:checked {disabled} /></div>
|
|
18
|
-
</div>
|
|
34
|
+
{/if}
|
|
19
35
|
|
|
@@ -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 {};
|
|
@@ -18,25 +18,20 @@ const dark = getTheme();
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
div > :global(div) {
|
|
21
|
-
width: 100%;
|
|
22
21
|
display: grid;
|
|
22
|
+
width: 100%;
|
|
23
23
|
padding: 2px 0px;
|
|
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
|
}
|
|
36
31
|
|
|
37
32
|
/* colors */
|
|
38
33
|
div > :global(div) {
|
|
39
|
-
transition: background-color
|
|
34
|
+
transition: background-color 150ms;
|
|
40
35
|
background-color: hsl(0, 0%, 100%);
|
|
41
36
|
}
|
|
42
37
|
|
|
@@ -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;
|
|
@@ -80,6 +67,21 @@ const dark = getTheme();
|
|
|
80
67
|
</style>
|
|
81
68
|
|
|
82
69
|
|
|
70
|
+
<!--
|
|
71
|
+
<div> this component
|
|
72
|
+
<div> Header
|
|
73
|
+
<div></div>
|
|
74
|
+
<div></div>
|
|
75
|
+
<div></div>
|
|
76
|
+
</div>
|
|
77
|
+
<div> Controls
|
|
78
|
+
<div></div>
|
|
79
|
+
<div></div>
|
|
80
|
+
<div></div>
|
|
81
|
+
</div>
|
|
82
|
+
...
|
|
83
|
+
</div>
|
|
84
|
+
-->
|
|
83
85
|
<div class:dark={$dark}>
|
|
84
86
|
<slot />
|
|
85
87
|
</div>
|
|
@@ -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
|
};
|