@nil-/doc 0.2.52 → 0.2.54
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/block/Block.svelte +33 -10
- package/components/block/Instance.svelte +7 -20
- package/components/block/Instance.svelte.d.ts +0 -1
- package/components/block/Template.svelte +0 -2
- package/components/block/Template.svelte.d.ts +0 -1
- package/components/block/controls/{props/misc/Styler.svelte → Styler.svelte} +21 -18
- package/components/block/controls/{props/misc/Styler.svelte.d.ts → Styler.svelte.d.ts} +6 -15
- package/components/block/controls/events/Events.svelte +2 -2
- package/components/block/controls/props/Color.svelte +41 -31
- package/components/block/controls/props/Component.svelte +5 -5
- package/components/block/controls/props/Number.svelte +2 -1
- package/components/block/controls/props/Props.svelte +2 -2
- package/components/block/controls/props/Range.svelte +11 -4
- package/components/block/controls/props/Select.svelte +2 -1
- package/components/block/controls/props/Text.svelte +2 -1
- package/components/block/controls/props/{Switch.svelte → Toggle.svelte} +3 -2
- package/components/block/controls/props/{Switch.svelte.d.ts → Toggle.svelte.d.ts} +5 -5
- package/components/block/controls/props/misc/GroupHeader.svelte +2 -3
- package/components/block/controls/props/misc/defaulter.d.ts +1 -1
- package/components/block/controls/props/misc/defaulter.js +1 -1
- package/components/block/controls/props/misc/utils.d.ts +1 -1
- package/components/block/controls/types.d.ts +6 -6
- package/components/block/icons/Position.svelte +2 -1
- package/components/layout/Scrollable.svelte +0 -1
- package/components/layout/icons/Theme.svelte +4 -4
- package/package.json +2 -1
- package/components/block/controls/events/misc/Styler.svelte +0 -52
- package/components/block/controls/events/misc/Styler.svelte.d.ts +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.54
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] dynamic import of vanilla-picker to avoid ssr document access ([#94](https://github.com/njaldea/mono/pull/94))
|
|
8
|
+
|
|
9
|
+
- [doc][patch] temporarily used svelte-toggle for checkbox/toggle ([#94](https://github.com/njaldea/mono/pull/94))
|
|
10
|
+
|
|
11
|
+
## 0.2.53
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [doc][break] removed "scale" prop ([#92](https://github.com/njaldea/mono/pull/92))
|
|
16
|
+
[doc][fix] better block scrollable handling
|
|
17
|
+
[doc][fix] better style to vanilla-color popup
|
|
18
|
+
|
|
3
19
|
## 0.2.52
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -61,27 +61,46 @@ const cycleMode = () => {
|
|
|
61
61
|
</Button>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
|
-
<div class="
|
|
65
|
-
<
|
|
64
|
+
<div class="outer">
|
|
65
|
+
<div class="scrollable block" class:columns={$columns}>
|
|
66
|
+
<slot />
|
|
67
|
+
</div>
|
|
66
68
|
</div>
|
|
67
69
|
</Base>
|
|
68
70
|
|
|
69
71
|
<style>
|
|
70
|
-
.relative {
|
|
71
|
-
z-index: 10;
|
|
72
|
-
position: relative;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
72
|
.block {
|
|
76
73
|
display: grid;
|
|
77
|
-
border-radius: 0.5rem;
|
|
78
74
|
grid-auto-rows: 1fr;
|
|
79
75
|
grid-auto-columns: auto;
|
|
80
76
|
grid-auto-flow: row;
|
|
77
|
+
}
|
|
81
78
|
|
|
79
|
+
.outer {
|
|
80
|
+
border-radius: 0.5rem;
|
|
81
|
+
padding: 1.75rem 0.2rem 0.75rem 0.2rem;
|
|
82
82
|
min-width: 10rem;
|
|
83
|
+
margin: 1px;
|
|
84
|
+
outline: solid 1px white;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.scrollable {
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
overflow: scroll;
|
|
91
|
+
/* Firefox */
|
|
92
|
+
scrollbar-width: none;
|
|
93
|
+
/* IE and Edge */
|
|
94
|
+
-ms-overflow-style: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.scrollable::-webkit-scrollbar {
|
|
98
|
+
display: none;
|
|
99
|
+
}
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
.relative {
|
|
102
|
+
z-index: 10;
|
|
103
|
+
position: relative;
|
|
85
104
|
}
|
|
86
105
|
|
|
87
106
|
.buttons {
|
|
@@ -100,7 +119,7 @@ const cycleMode = () => {
|
|
|
100
119
|
grid-auto-flow: column;
|
|
101
120
|
}
|
|
102
121
|
|
|
103
|
-
.
|
|
122
|
+
.outer {
|
|
104
123
|
color: var(--i-nil-doc-color);
|
|
105
124
|
color-scheme: var(--i-nil-doc-color-scheme);
|
|
106
125
|
background-color: var(--i-nil-doc-block-bg-color);
|
|
@@ -109,4 +128,8 @@ const cycleMode = () => {
|
|
|
109
128
|
transition: color var(--i-nil-doc-transition-time),
|
|
110
129
|
background-color var(--i-nil-doc-transition-time);
|
|
111
130
|
}
|
|
131
|
+
|
|
132
|
+
.block {
|
|
133
|
+
outline: 1px solid var(--i-nil-doc-block-outline-color);
|
|
134
|
+
}
|
|
112
135
|
</style>
|
|
@@ -9,7 +9,6 @@ $:
|
|
|
9
9
|
expanded = $controlsState.position !== "hidden";
|
|
10
10
|
export let defaults = void 0;
|
|
11
11
|
export let noreset = false;
|
|
12
|
-
export let scale = false;
|
|
13
12
|
let key = false;
|
|
14
13
|
beforeUpdate(() => key = !key);
|
|
15
14
|
const resolveArgs = resolve;
|
|
@@ -25,8 +24,8 @@ let handlers = {};
|
|
|
25
24
|
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details.
|
|
26
25
|
-->
|
|
27
26
|
|
|
28
|
-
<div class="instance" class:
|
|
29
|
-
<div class="content
|
|
27
|
+
<div class="instance" class:cside={expanded && "right" === $controlsState.position}>
|
|
28
|
+
<div class="content">
|
|
30
29
|
{#if noreset}
|
|
31
30
|
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
32
31
|
{:else}
|
|
@@ -63,12 +62,9 @@ let handlers = {};
|
|
|
63
62
|
</div>
|
|
64
63
|
|
|
65
64
|
<style>
|
|
66
|
-
.instance
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.instance.scale:hover {
|
|
71
|
-
transform: scale(1.015);
|
|
65
|
+
.instance {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
.cside {
|
|
@@ -78,18 +74,9 @@ let handlers = {};
|
|
|
78
74
|
|
|
79
75
|
.content {
|
|
80
76
|
min-height: 6.25rem;
|
|
81
|
-
border-radius: 0.5rem;
|
|
82
77
|
}
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
border-bottom-left-radius: 0.5rem;
|
|
86
|
-
border-bottom-right-radius: 0.5rem;
|
|
87
|
-
user-select: none;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.cside > .misc {
|
|
91
|
-
border-top-right-radius: 0.5rem;
|
|
92
|
-
border-bottom-right-radius: 0.5rem;
|
|
79
|
+
.misc {
|
|
93
80
|
user-select: none;
|
|
94
81
|
}
|
|
95
82
|
|
|
@@ -100,7 +87,7 @@ let handlers = {};
|
|
|
100
87
|
|
|
101
88
|
/* colors */
|
|
102
89
|
.instance {
|
|
103
|
-
transition: background-color
|
|
90
|
+
transition: background-color var(--i-nil-doc-transition-time);
|
|
104
91
|
color: var(--i-nil-doc-color);
|
|
105
92
|
background-color: var(--i-nil-doc-bg-color);
|
|
106
93
|
}
|
|
@@ -8,7 +8,6 @@ const orientation = getOrientation();
|
|
|
8
8
|
export let defaults = void 0;
|
|
9
9
|
export let noreset = false;
|
|
10
10
|
export let columns = false;
|
|
11
|
-
export let scale = false;
|
|
12
11
|
$:
|
|
13
12
|
$defaultsStore = defaults ?? {};
|
|
14
13
|
$:
|
|
@@ -28,7 +27,6 @@ const cast = (t) => t;
|
|
|
28
27
|
<Instance
|
|
29
28
|
defaults={resolveArgs($defaultsStore, param.values)}
|
|
30
29
|
{noreset}
|
|
31
|
-
{scale}
|
|
32
30
|
let:key
|
|
33
31
|
let:props
|
|
34
32
|
let:events
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<div></div>
|
|
6
|
-
<div></div>
|
|
7
|
-
</div>
|
|
8
|
-
<div> Controls
|
|
9
|
-
<div></div>
|
|
10
|
-
<div></div>
|
|
11
|
-
<div></div>
|
|
12
|
-
</div>
|
|
13
|
-
...
|
|
14
|
-
</div>
|
|
15
|
-
-->
|
|
16
|
-
<div>
|
|
1
|
+
<script>export let type;
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<div class:props={type === "props"} class:events={type === "events"}>
|
|
17
5
|
<slot />
|
|
18
6
|
</div>
|
|
19
7
|
|
|
@@ -25,6 +13,10 @@
|
|
|
25
13
|
box-sizing: border-box;
|
|
26
14
|
}
|
|
27
15
|
|
|
16
|
+
div.events {
|
|
17
|
+
height: 22rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
28
20
|
div :global(*),
|
|
29
21
|
div :global(*::before),
|
|
30
22
|
div :global(*::after) {
|
|
@@ -34,23 +26,34 @@
|
|
|
34
26
|
|
|
35
27
|
div > :global(div) {
|
|
36
28
|
display: grid;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
div.props > :global(div) {
|
|
37
32
|
grid-template-columns: minmax(15rem, 1fr) 12.5rem 2.5rem;
|
|
38
33
|
}
|
|
39
34
|
|
|
35
|
+
div.events > :global(div) {
|
|
36
|
+
grid-template-columns: 2fr 3fr;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
40
|
div > :global(div:first-child) {
|
|
41
41
|
font-weight: bold;
|
|
42
42
|
place-items: center;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
div > :global(div > div:
|
|
45
|
+
div.props > :global(div > div:nth-child(2)) {
|
|
46
46
|
display: grid;
|
|
47
47
|
place-items: center;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
div.props > :global(div > div:nth-child(3)) {
|
|
51
|
+
margin: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
div > :global(div > div:not(:first-child) > *) {
|
|
51
55
|
width: 100%;
|
|
52
56
|
height: 80%;
|
|
53
|
-
font-size: 1rem;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
/* colors */
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} StylerProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} StylerEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} StylerSlots */
|
|
4
|
-
export default class Styler extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {
|
|
9
|
-
default: {};
|
|
10
|
-
}> {
|
|
11
|
-
}
|
|
12
|
-
export type StylerProps = typeof __propDef.props;
|
|
13
|
-
export type StylerEvents = typeof __propDef.events;
|
|
14
|
-
export type StylerSlots = typeof __propDef.slots;
|
|
15
1
|
import { SvelteComponentTyped } from "svelte";
|
|
16
2
|
declare const __propDef: {
|
|
17
3
|
props: {
|
|
18
|
-
|
|
4
|
+
type: "props" | "events";
|
|
19
5
|
};
|
|
20
6
|
events: {
|
|
21
7
|
[evt: string]: CustomEvent<any>;
|
|
@@ -24,4 +10,9 @@ declare const __propDef: {
|
|
|
24
10
|
default: {};
|
|
25
11
|
};
|
|
26
12
|
};
|
|
13
|
+
export type StylerProps = typeof __propDef.props;
|
|
14
|
+
export type StylerEvents = typeof __propDef.events;
|
|
15
|
+
export type StylerSlots = typeof __propDef.slots;
|
|
16
|
+
export default class Styler extends SvelteComponentTyped<StylerProps, StylerEvents, StylerSlots> {
|
|
17
|
+
}
|
|
27
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import Styler from "
|
|
1
|
+
<script>import Styler from "../Styler.svelte";
|
|
2
2
|
export let visible;
|
|
3
3
|
export let events;
|
|
4
4
|
export let handlers;
|
|
@@ -41,7 +41,7 @@ $:
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
{#if visible}
|
|
44
|
-
<Styler>
|
|
44
|
+
<Styler type={"events"}>
|
|
45
45
|
<slot />
|
|
46
46
|
{#each history as { count, detail, name }, i (i)}
|
|
47
47
|
<div>
|
|
@@ -14,28 +14,12 @@
|
|
|
14
14
|
return color.rgbaString;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
const formatter = (format) => {
|
|
18
|
-
switch (format) {
|
|
19
|
-
case "hex":
|
|
20
|
-
return "hex";
|
|
21
|
-
case "hsl":
|
|
22
|
-
return "hsl";
|
|
23
|
-
case "rgb":
|
|
24
|
-
return "rgb";
|
|
25
|
-
case "hexa":
|
|
26
|
-
return "hex";
|
|
27
|
-
case "hsla":
|
|
28
|
-
return "hsl";
|
|
29
|
-
case "rgba":
|
|
30
|
-
return "rgb";
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
17
|
</script>
|
|
34
18
|
|
|
35
19
|
<script>import { getName, getFormat } from "./misc/utils";
|
|
36
20
|
import { defaulter } from "./misc/defaulter";
|
|
37
21
|
import NameHeader from "./misc/Name.svelte";
|
|
38
|
-
import
|
|
22
|
+
import Toggle from "svelte-toggle";
|
|
39
23
|
export let value;
|
|
40
24
|
export let info;
|
|
41
25
|
export let depth;
|
|
@@ -43,21 +27,25 @@ export let disabled = false;
|
|
|
43
27
|
export let visible = false;
|
|
44
28
|
let ivalue = value ?? defaulter(info);
|
|
45
29
|
let enabled = value !== void 0;
|
|
46
|
-
const action = (
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
const action = (d, { format, P }) => {
|
|
31
|
+
d.style.borderColor = ivalue;
|
|
32
|
+
const picker = new P({
|
|
33
|
+
parent: d,
|
|
49
34
|
popup: "left",
|
|
50
|
-
editorFormat:
|
|
51
|
-
editor:
|
|
35
|
+
editorFormat: format.substring(0, 3),
|
|
36
|
+
editor: true,
|
|
52
37
|
alpha: format.length === 4,
|
|
53
|
-
onChange: (color) =>
|
|
38
|
+
onChange: (color) => {
|
|
39
|
+
ivalue = colorSetter(getFormat(info), color);
|
|
40
|
+
d.style.borderColor = ivalue;
|
|
41
|
+
},
|
|
54
42
|
color: ivalue
|
|
55
43
|
});
|
|
56
44
|
return {
|
|
57
45
|
update: (format2) => {
|
|
58
46
|
picker.setOptions({
|
|
59
47
|
alpha: format2.length === 4,
|
|
60
|
-
editorFormat:
|
|
48
|
+
editorFormat: format2.substring(0, 3)
|
|
61
49
|
});
|
|
62
50
|
},
|
|
63
51
|
destroy: () => picker.destroy()
|
|
@@ -70,17 +58,39 @@ $:
|
|
|
70
58
|
{#if visible}
|
|
71
59
|
<div>
|
|
72
60
|
<NameHeader name={getName(info)} {depth} />
|
|
73
|
-
|
|
74
|
-
<button use:action={getFormat(info)} disabled={!enabled || disabled}>
|
|
75
|
-
{
|
|
61
|
+
{#await import("vanilla-picker") then { default: P }}
|
|
62
|
+
<button use:action={{ format: getFormat(info), P }} disabled={!enabled || disabled}>
|
|
63
|
+
{ivalue}
|
|
76
64
|
</button>
|
|
77
|
-
|
|
78
|
-
<div><
|
|
65
|
+
{/await}
|
|
66
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
79
67
|
</div>
|
|
80
68
|
{/if}
|
|
81
69
|
|
|
82
70
|
<style>
|
|
83
|
-
|
|
84
|
-
font-size: 0.
|
|
71
|
+
button {
|
|
72
|
+
font-size: 0.6rem;
|
|
73
|
+
border-top-width: 1px;
|
|
74
|
+
border-bottom-width: 1px;
|
|
75
|
+
border-left-width: 10px;
|
|
76
|
+
border-right-width: 10px;
|
|
77
|
+
border-style: solid;
|
|
78
|
+
background-color: var(--i-nil-doc-bg-color);
|
|
79
|
+
outline: 1px solid gray;
|
|
80
|
+
margin-top: 3px;
|
|
81
|
+
margin-bottom: 3px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
button :global(.picker_wrapper),
|
|
85
|
+
button :global(.picker_arrow),
|
|
86
|
+
button :global(.picker_arrow::before),
|
|
87
|
+
button :global(.picker_arrow::after) {
|
|
88
|
+
background-color: var(--i-nil-doc-bg-color) !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
button :global(.picker_done > button) {
|
|
92
|
+
background-image: initial;
|
|
93
|
+
background-color: var(--i-nil-doc-bg-color);
|
|
94
|
+
color: var(--i-nil-doc-color);
|
|
85
95
|
}
|
|
86
96
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import Text from "./Text.svelte";
|
|
2
2
|
import Number from "./Number.svelte";
|
|
3
3
|
import Range from "./Range.svelte";
|
|
4
|
-
import
|
|
4
|
+
import Toggle from "./Toggle.svelte";
|
|
5
5
|
import Select from "./Select.svelte";
|
|
6
6
|
import Tuple from "./Tuple.svelte";
|
|
7
7
|
import Object from "./Object.svelte";
|
|
@@ -29,8 +29,8 @@ export let visible = false;
|
|
|
29
29
|
<Range {info} bind:value {depth} {disabled} {visible} />
|
|
30
30
|
{:else if "select" === type}
|
|
31
31
|
<Select {info} bind:value {depth} {disabled} {visible} />
|
|
32
|
-
{:else if "
|
|
33
|
-
<
|
|
32
|
+
{:else if "toggle" === type}
|
|
33
|
+
<Toggle {info} bind:value {depth} {disabled} {visible} />
|
|
34
34
|
{/if}
|
|
35
35
|
{:else}
|
|
36
36
|
{@const type = info.type}
|
|
@@ -48,7 +48,7 @@ export let visible = false;
|
|
|
48
48
|
<Range {info} bind:value {depth} {disabled} {visible} />
|
|
49
49
|
{:else if "select" === type}
|
|
50
50
|
<Select {info} bind:value {depth} {disabled} {visible} />
|
|
51
|
-
{:else if "
|
|
52
|
-
<
|
|
51
|
+
{:else if "toggle" === type}
|
|
52
|
+
<Toggle {info} bind:value {depth} {disabled} {visible} />
|
|
53
53
|
{/if}
|
|
54
54
|
{/if}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { getName } from "./misc/utils";
|
|
2
2
|
import { defaulter } from "./misc/defaulter";
|
|
3
3
|
import NameHeader from "./misc/Name.svelte";
|
|
4
|
+
import Toggle from "svelte-toggle";
|
|
4
5
|
export let value;
|
|
5
6
|
export let info;
|
|
6
7
|
export let depth;
|
|
@@ -16,6 +17,6 @@ $:
|
|
|
16
17
|
<div>
|
|
17
18
|
<NameHeader name={getName(info)} {depth} />
|
|
18
19
|
<div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
|
|
19
|
-
<div><
|
|
20
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
20
21
|
</div>
|
|
21
22
|
{/if}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>import Component from "./Component.svelte";
|
|
2
|
-
import Styler from "
|
|
2
|
+
import Styler from "../Styler.svelte";
|
|
3
3
|
import { getName } from "./misc/utils";
|
|
4
4
|
export let infos;
|
|
5
5
|
export let values;
|
|
6
6
|
export let visible;
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<Styler>
|
|
9
|
+
<Styler type={"props"}>
|
|
10
10
|
{#if visible}
|
|
11
11
|
<slot />
|
|
12
12
|
{/if}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { defaulter } from "./misc/defaulter";
|
|
2
2
|
import NameHeader from "./misc/Name.svelte";
|
|
3
3
|
import { nformat } from "./misc/nformat";
|
|
4
|
+
import Toggle from "svelte-toggle";
|
|
4
5
|
export let value;
|
|
5
6
|
export let info;
|
|
6
7
|
export let depth;
|
|
@@ -27,8 +28,8 @@ $:
|
|
|
27
28
|
{#if visible}
|
|
28
29
|
<div>
|
|
29
30
|
<NameHeader name={i.name} {depth} />
|
|
30
|
-
<div class="input">
|
|
31
|
-
<div class="tooltip"
|
|
31
|
+
<div class="input" class:disabled={!enabled || disabled}>
|
|
32
|
+
<div class="tooltip">
|
|
32
33
|
Value: {nformat(ivalue, 6, 11)}
|
|
33
34
|
</div>
|
|
34
35
|
<div>{nformat(ivalue, 3, 5)}</div>
|
|
@@ -41,12 +42,14 @@ $:
|
|
|
41
42
|
disabled={!enabled || disabled}
|
|
42
43
|
/>
|
|
43
44
|
</div>
|
|
44
|
-
<div><
|
|
45
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
45
46
|
</div>
|
|
46
47
|
{/if}
|
|
47
48
|
|
|
48
49
|
<style>
|
|
49
50
|
.input {
|
|
51
|
+
/* TODO: align color schema for toggle */
|
|
52
|
+
color-scheme: light;
|
|
50
53
|
width: 100%;
|
|
51
54
|
display: grid;
|
|
52
55
|
grid-template-columns: 4rem 1fr;
|
|
@@ -76,7 +79,11 @@ $:
|
|
|
76
79
|
place-items: center;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
.input
|
|
82
|
+
.input.disabled > div {
|
|
83
|
+
filter: contrast(0%);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.input:not(.disabled):hover > .tooltip {
|
|
80
87
|
visibility: visible;
|
|
81
88
|
}
|
|
82
89
|
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { defaulter } from "./misc/defaulter";
|
|
2
2
|
import { getValues, getName } from "./misc/utils";
|
|
3
3
|
import NameHeader from "./misc/Name.svelte";
|
|
4
|
+
import Toggle from "svelte-toggle";
|
|
4
5
|
export let value;
|
|
5
6
|
export let info;
|
|
6
7
|
export let depth;
|
|
@@ -22,7 +23,7 @@ $:
|
|
|
22
23
|
{/each}
|
|
23
24
|
</select>
|
|
24
25
|
</div>
|
|
25
|
-
<div><
|
|
26
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
26
27
|
</div>
|
|
27
28
|
{/if}
|
|
28
29
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { getName } from "./misc/utils";
|
|
2
2
|
import { defaulter } from "./misc/defaulter";
|
|
3
3
|
import NameHeader from "./misc/Name.svelte";
|
|
4
|
+
import Toggle from "svelte-toggle";
|
|
4
5
|
export let value;
|
|
5
6
|
export let info;
|
|
6
7
|
export let depth;
|
|
@@ -16,6 +17,6 @@ $:
|
|
|
16
17
|
<div>
|
|
17
18
|
<NameHeader name={getName(info)} {depth} />
|
|
18
19
|
<div><input type="text" bind:value={ivalue} disabled={!enabled || disabled} /></div>
|
|
19
|
-
<div><
|
|
20
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
20
21
|
</div>
|
|
21
22
|
{/if}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { getName } from "./misc/utils";
|
|
2
2
|
import { defaulter } from "./misc/defaulter";
|
|
3
3
|
import NameHeader from "./misc/Name.svelte";
|
|
4
|
+
import Toggle from "svelte-toggle";
|
|
4
5
|
export let value;
|
|
5
6
|
export let info;
|
|
6
7
|
export let depth;
|
|
@@ -15,7 +16,7 @@ $:
|
|
|
15
16
|
{#if visible}
|
|
16
17
|
<div>
|
|
17
18
|
<NameHeader name={getName(info)} {depth} />
|
|
18
|
-
<div
|
|
19
|
-
<div><
|
|
19
|
+
<div style="margin: auto"><Toggle bind:toggled={ivalue} disabled={!enabled || disabled} hideLabel small/></div>
|
|
20
|
+
<div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
|
|
20
21
|
</div>
|
|
21
22
|
{/if}
|
|
@@ -3,7 +3,7 @@ import type { Unionized, PropType } from "../types";
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
value: boolean | undefined;
|
|
6
|
-
info: Unionized<PropType<"
|
|
6
|
+
info: Unionized<PropType<"toggle">>;
|
|
7
7
|
depth: number;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
visible?: boolean | undefined;
|
|
@@ -13,9 +13,9 @@ declare const __propDef: {
|
|
|
13
13
|
};
|
|
14
14
|
slots: {};
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export default class
|
|
16
|
+
export type ToggleProps = typeof __propDef.props;
|
|
17
|
+
export type ToggleEvents = typeof __propDef.events;
|
|
18
|
+
export type ToggleSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Toggle extends SvelteComponentTyped<ToggleProps, ToggleEvents, ToggleSlots> {
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import Name from "./Name.svelte";
|
|
2
|
+
import Toggle from "svelte-toggle";
|
|
2
3
|
export let name;
|
|
3
4
|
export let depth;
|
|
4
5
|
export let checked;
|
|
@@ -22,9 +23,7 @@ const flip = () => {
|
|
|
22
23
|
{depth}
|
|
23
24
|
/>
|
|
24
25
|
<div class="value">-</div>
|
|
25
|
-
<div>
|
|
26
|
-
<input type="checkbox" {disabled} bind:checked on:click={(e) => e.stopPropagation()} />
|
|
27
|
-
</div>
|
|
26
|
+
<div><Toggle bind:toggled={checked} {disabled} hideLabel small on:click={e => e.stopPropagation()}/></div>
|
|
28
27
|
</div>
|
|
29
28
|
{/if}
|
|
30
29
|
|
|
@@ -6,6 +6,6 @@ export declare function defaulter(i: Unionized<PropType<"number">>): number;
|
|
|
6
6
|
export declare function defaulter(i: Unionized<PropType<"range">>): number;
|
|
7
7
|
export declare function defaulter(i: Unionized<PropType<"select">>): string;
|
|
8
8
|
export declare function defaulter(i: Unionized<PropType<"text">>): string;
|
|
9
|
-
export declare function defaulter(i: Unionized<PropType<"
|
|
9
|
+
export declare function defaulter(i: Unionized<PropType<"toggle">>): boolean;
|
|
10
10
|
export declare function defaulter(i: Unionized<PropType<"color">>): string;
|
|
11
11
|
export declare function defaulter(i: Prop): ValueType;
|
|
@@ -5,7 +5,7 @@ export declare function getValues(info: Unionized<PropType<"select">>): Values<"
|
|
|
5
5
|
export declare function getValues(info: Unionized<PropType<"object">>): Values<"object">;
|
|
6
6
|
export declare function getValues(info: Unionized<PropType<"tuple">>): Values<"tuple">;
|
|
7
7
|
export declare const getMin: (info: Unionized<PropType<"range">>) => number;
|
|
8
|
-
export declare const getType: (info: Prop) => "number" | "object" | "select" | "
|
|
8
|
+
export declare const getType: (info: Prop) => "number" | "object" | "select" | "toggle" | "text" | "range" | "tuple" | "color";
|
|
9
9
|
export declare const getFormat: (info: Unionized<PropType<"color">>) => import("../../types").ColorFormat;
|
|
10
10
|
export declare const getName: (info: Prop) => string;
|
|
11
11
|
export declare const addName: (name: string, info: NonNamedProp) => Prop;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type Types = "text" | "color" | "number" | "select" | "range" | "
|
|
1
|
+
type Types = "text" | "color" | "number" | "select" | "range" | "toggle" | "tuple" | "object";
|
|
2
2
|
|
|
3
3
|
type ColorFormat = "hsl" | "hsla" | "rgb" | "rgba" | "hex" | "hexa";
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export type PropType<T extends Types> =
|
|
|
16
16
|
[ name: string, type: T ],
|
|
17
17
|
{ name: string; type: T; }
|
|
18
18
|
]
|
|
19
|
-
: T extends "
|
|
19
|
+
: T extends "toggle" ? [
|
|
20
20
|
[ name: string, type: T ],
|
|
21
21
|
{ name: string; type: T; }
|
|
22
22
|
]
|
|
@@ -54,8 +54,8 @@ export type Prop =
|
|
|
54
54
|
| { name: string; type: "color"; format: ColorFormat; }
|
|
55
55
|
| [ name: string, type: "number" ]
|
|
56
56
|
| { name: string; type: "number"; }
|
|
57
|
-
| [ name: string, type: "
|
|
58
|
-
| { name: string; type: "
|
|
57
|
+
| [ name: string, type: "toggle" ]
|
|
58
|
+
| { name: string; type: "toggle"; }
|
|
59
59
|
| [ name: string, type: "select", values: string[] ]
|
|
60
60
|
| { name: string; type: "select"; values: string[]; }
|
|
61
61
|
| [ name: string, type: "range", min: number, max: number, step: number ]
|
|
@@ -75,8 +75,8 @@ export type NonNamedProp =
|
|
|
75
75
|
| { type: "color"; format: ColorFormat; }
|
|
76
76
|
| [ type: "number" ]
|
|
77
77
|
| { type: "number"; }
|
|
78
|
-
| [ type: "
|
|
79
|
-
| { type: "
|
|
78
|
+
| [ type: "toggle" ]
|
|
79
|
+
| { type: "toggle"; }
|
|
80
80
|
| [ type: "select", values: string[] ]
|
|
81
81
|
| { type: "select"; values: string[]; }
|
|
82
82
|
| [ type: "range", min: number, max: number, step: number ]
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
rect:not(:first-child) {
|
|
17
|
-
transition: height
|
|
17
|
+
transition: height var(--i-nil-doc-transition-time), x var(--i-nil-doc-transition-time),
|
|
18
|
+
y var(--i-nil-doc-transition-time);
|
|
18
19
|
width: 60px;
|
|
19
20
|
height: 0px;
|
|
20
21
|
x: -30px;
|
|
@@ -46,22 +46,22 @@ const index = indexer++;
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
svg {
|
|
49
|
-
transition: transform
|
|
49
|
+
transition: transform var(--i-nil-doc-transition-time);
|
|
50
50
|
transform: rotate(40deg);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
svg > g {
|
|
54
|
-
transition: opacity
|
|
54
|
+
transition: opacity var(--i-nil-doc-transition-time);
|
|
55
55
|
opacity: 0;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
svg > mask > circle {
|
|
59
|
-
transition: cy
|
|
59
|
+
transition: cy var(--i-nil-doc-transition-time);
|
|
60
60
|
cy: -8px;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
svg > circle {
|
|
64
|
-
transition: r
|
|
64
|
+
transition: r var(--i-nil-doc-transition-time);
|
|
65
65
|
r: 10px;
|
|
66
66
|
}
|
|
67
67
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nil-/doc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.54",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "njaldea@gmail.com",
|
|
6
6
|
"name": "Neil Aldea"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"type": "module",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"svelte-toggle": "^3.1.0",
|
|
35
36
|
"vanilla-picker": "^2.12.1"
|
|
36
37
|
},
|
|
37
38
|
"exports": {
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
<div> this component
|
|
3
|
-
<div> Header
|
|
4
|
-
<div></div>
|
|
5
|
-
<div></div>
|
|
6
|
-
</div>
|
|
7
|
-
<div> Controls
|
|
8
|
-
<div></div>
|
|
9
|
-
<div></div>
|
|
10
|
-
</div>
|
|
11
|
-
...
|
|
12
|
-
</div>
|
|
13
|
-
-->
|
|
14
|
-
<div>
|
|
15
|
-
<slot />
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<style>
|
|
19
|
-
div {
|
|
20
|
-
display: grid;
|
|
21
|
-
height: 22rem;
|
|
22
|
-
min-width: 31.25rem;
|
|
23
|
-
grid-auto-rows: 2rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
div > :global(div) {
|
|
27
|
-
display: grid;
|
|
28
|
-
grid-template-columns: 2fr 3fr;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
div > :global(div:first-child) {
|
|
33
|
-
font-weight: bold;
|
|
34
|
-
justify-items: center;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* colors */
|
|
38
|
-
div {
|
|
39
|
-
transition: background-color var(--i-nil-doc-transition-time);
|
|
40
|
-
background-repeat: repeat;
|
|
41
|
-
background-size: 100% 4rem;
|
|
42
|
-
background-image: linear-gradient(
|
|
43
|
-
to bottom,
|
|
44
|
-
var(--i-nil-doc-controls-p) 2rem,
|
|
45
|
-
var(--i-nil-doc-controls-s) 2rem
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
div > :global(div:nth-child(n + 2):hover) {
|
|
50
|
-
background-color: var(--i-nil-doc-controls-hover);
|
|
51
|
-
}
|
|
52
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} StylerProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} StylerEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} StylerSlots */
|
|
4
|
-
export default class Styler extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {
|
|
9
|
-
default: {};
|
|
10
|
-
}> {
|
|
11
|
-
}
|
|
12
|
-
export type StylerProps = typeof __propDef.props;
|
|
13
|
-
export type StylerEvents = typeof __propDef.events;
|
|
14
|
-
export type StylerSlots = typeof __propDef.slots;
|
|
15
|
-
import { SvelteComponentTyped } from "svelte";
|
|
16
|
-
declare const __propDef: {
|
|
17
|
-
props: {
|
|
18
|
-
[x: string]: never;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
};
|
|
23
|
-
slots: {
|
|
24
|
-
default: {};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export {};
|