@nil-/doc 0.2.51 → 0.2.52
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/{etc/Base.svelte → Base.svelte} +18 -11
- package/components/{etc/Base.svelte.d.ts → Base.svelte.d.ts} +1 -0
- package/components/block/Block.svelte +12 -7
- package/components/block/Instance.svelte +8 -25
- package/components/block/controls/events/misc/Styler.svelte +1 -6
- package/components/block/controls/events/misc/Styler.svelte.d.ts +17 -6
- package/components/block/controls/props/Color.svelte +67 -2
- package/components/block/controls/props/Object.svelte +1 -1
- package/components/block/controls/props/Props.svelte +1 -1
- package/components/block/controls/props/Range.svelte +1 -1
- package/components/block/controls/props/Tuple.svelte +1 -1
- package/components/block/controls/props/misc/Name.svelte +5 -5
- package/components/block/controls/props/misc/Styler.svelte +1 -6
- package/components/block/controls/props/misc/Styler.svelte.d.ts +17 -6
- package/components/block/controls/props/misc/defaulter.d.ts +1 -0
- package/components/block/controls/props/misc/defaulter.js +1 -1
- package/components/block/controls/props/misc/utils.d.ts +2 -1
- package/components/block/controls/props/misc/utils.js +6 -0
- package/components/block/controls/types.d.ts +8 -6
- package/components/block/icons/ControlView.svelte +22 -6
- package/components/block/icons/Position.svelte +17 -38
- package/components/{etc → layout}/Container.svelte +1 -1
- package/components/{etc → layout}/Container.svelte.d.ts +0 -0
- package/components/layout/Content.svelte +23 -0
- package/components/{etc → layout}/Content.svelte.d.ts +15 -6
- package/components/{Layout.svelte → layout/Layout.svelte} +32 -25
- package/components/{Layout.svelte.d.ts → layout/Layout.svelte.d.ts} +3 -2
- package/components/layout/Scrollable.svelte +20 -0
- package/components/layout/Scrollable.svelte.d.ts +27 -0
- package/components/layout/VerticalPanel.svelte +12 -0
- package/components/layout/VerticalPanel.svelte.d.ts +27 -0
- package/components/{etc → layout}/action.d.ts +0 -0
- package/components/{etc → layout}/action.js +0 -0
- package/components/{title → layout/icons}/Icon.svelte +0 -0
- package/components/{title → layout/icons}/Icon.svelte.d.ts +0 -0
- package/components/{icons/NilDoc.svelte → layout/icons/Nil.svelte} +2 -2
- package/components/layout/icons/Nil.svelte.d.ts +14 -0
- package/components/{icons → layout/icons}/Theme.svelte +41 -23
- package/components/{icons → layout/icons}/Theme.svelte.d.ts +1 -1
- package/components/navigation/Nav.svelte +3 -3
- package/components/navigation/Node.svelte +14 -5
- package/index.d.ts +4 -4
- package/index.js +4 -4
- package/package.json +8 -5
- package/sveltekit/index.d.ts +7 -1
- package/sveltekit/index.js +9 -5
- package/components/etc/Content.svelte +0 -45
- package/components/icons/NilDoc.svelte.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] fix layout scrollable sections ([#90](https://github.com/njaldea/mono/pull/90))
|
|
8
|
+
|
|
9
|
+
- [doc][patch] restructure code ([#90](https://github.com/njaldea/mono/pull/90))
|
|
10
|
+
|
|
11
|
+
- [doc][patch] use vannilla-color library for color picker ([#90](https://github.com/njaldea/mono/pull/90))
|
|
12
|
+
[doc][fix] removed position relative and overflow scroll for misc (controls)
|
|
13
|
+
|
|
14
|
+
- [doc][fix] content fill width/height ([#90](https://github.com/njaldea/mono/pull/90))
|
|
15
|
+
|
|
16
|
+
- [doc][new] added offset Layout.svelte and sveltekit for keeping state ([#90](https://github.com/njaldea/mono/pull/90))
|
|
17
|
+
|
|
3
18
|
## 0.2.51
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
<script>export let dark =
|
|
1
|
+
<script>export let dark = false;
|
|
2
|
+
export let fill = false;
|
|
2
3
|
</script>
|
|
3
4
|
|
|
4
|
-
<div class:dark>
|
|
5
|
+
<div class:dark class:fill>
|
|
5
6
|
<slot />
|
|
6
7
|
</div>
|
|
7
8
|
|
|
9
|
+
<!-- prettier-ignore -->
|
|
8
10
|
<style>
|
|
9
11
|
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
10
12
|
|
|
11
13
|
div {
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
14
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
15
|
+
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
--i-nil-doc-transition-time: var(--nil-doc-transition-time, 350ms);
|
|
17
|
+
.fill {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
div {
|
|
@@ -41,10 +40,10 @@
|
|
|
41
40
|
div.dark {
|
|
42
41
|
--i-nil-doc-color: var(--nil-doc-color, hsl(0, 0%, 80%));
|
|
43
42
|
--i-nil-doc-color-scheme: var(--nil-doc-color-scheme, dark);
|
|
44
|
-
|
|
43
|
+
|
|
45
44
|
--i-nil-doc-bg-color: var(--nil-doc-bg-color, hsl(210, 6%, 7%));
|
|
46
45
|
--i-nil-doc-content-outline-color: var(--nil-doc-content-outline-color, hsla(0, 0%, 100%, 0.3));
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
--i-nil-doc-block-bg-color: var(--nil-doc-block-bg-color, hsla(200, 4%, 7%, 0.3));
|
|
49
48
|
--i-nil-doc-block-outline-color: var(--nil-doc-block-outline-color, hsla(0, 0%, 1000%, 0.3));
|
|
50
49
|
|
|
@@ -55,4 +54,12 @@
|
|
|
55
54
|
--i-nil-doc-controls-s: var(--nil-doc-controls-s, hsl(213, 26%, 11%));
|
|
56
55
|
--i-nil-doc-controls-hover: var(--nil-doc-controls-hover, hsl(203, 100%, 15%));
|
|
57
56
|
}
|
|
57
|
+
|
|
58
|
+
div {
|
|
59
|
+
--i-nil-doc-nav-hovered: var(--nil-doc-nav-hovered, hsla(203, 98%, 50%, 0.1));
|
|
60
|
+
--i-nil-doc-nav-page-hovered: var(--nil-doc-nav-page-hovered, hsla(203, 98%, 50%, 0.5));
|
|
61
|
+
--i-nil-doc-nav-selected: var(--nil-doc-nav-selected, hsla(203, 98%, 50%, 0.85));
|
|
62
|
+
|
|
63
|
+
--i-nil-doc-transition-time: var(--nil-doc-transition-time, 350ms);
|
|
64
|
+
}
|
|
58
65
|
</style>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
initControlsState,
|
|
6
6
|
initOrientation
|
|
7
7
|
} from "./context";
|
|
8
|
-
import Base from "../
|
|
8
|
+
import Base from "../Base.svelte";
|
|
9
9
|
import { getTheme, initTheme } from "../context";
|
|
10
10
|
import Button from "./icons/Button.svelte";
|
|
11
11
|
import Position from "./icons/Position.svelte";
|
|
@@ -51,7 +51,7 @@ const cycleMode = () => {
|
|
|
51
51
|
-->
|
|
52
52
|
|
|
53
53
|
<Base dark={$dark}>
|
|
54
|
-
<div class="
|
|
54
|
+
<div class="relative">
|
|
55
55
|
<div class="buttons">
|
|
56
56
|
<Button scale on:click={cycleMode} title={$state.mode}>
|
|
57
57
|
<ControlView mode={$state.mode} />
|
|
@@ -60,14 +60,21 @@ const cycleMode = () => {
|
|
|
60
60
|
<Position position={$state.position} />
|
|
61
61
|
</Button>
|
|
62
62
|
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="block" class:columns={$columns} class:dark={$dark}>
|
|
63
65
|
<slot />
|
|
64
66
|
</div>
|
|
65
67
|
</Base>
|
|
66
68
|
|
|
67
69
|
<style>
|
|
70
|
+
.relative {
|
|
71
|
+
z-index: 10;
|
|
72
|
+
position: relative;
|
|
73
|
+
}
|
|
74
|
+
|
|
68
75
|
.block {
|
|
69
76
|
display: grid;
|
|
70
|
-
border-radius: 0.
|
|
77
|
+
border-radius: 0.5rem;
|
|
71
78
|
grid-auto-rows: 1fr;
|
|
72
79
|
grid-auto-columns: auto;
|
|
73
80
|
grid-auto-flow: row;
|
|
@@ -75,13 +82,11 @@ const cycleMode = () => {
|
|
|
75
82
|
min-width: 10rem;
|
|
76
83
|
|
|
77
84
|
padding: 1.75rem 0.2rem 0.5rem 0.2rem;
|
|
78
|
-
gap: 0.1875rem;
|
|
79
|
-
position: relative;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
.buttons {
|
|
83
88
|
position: absolute;
|
|
84
|
-
width:
|
|
89
|
+
width: 3.5rem;
|
|
85
90
|
height: 1.75rem;
|
|
86
91
|
right: 1rem;
|
|
87
92
|
top: 0rem;
|
|
@@ -99,7 +104,7 @@ const cycleMode = () => {
|
|
|
99
104
|
color: var(--i-nil-doc-color);
|
|
100
105
|
color-scheme: var(--i-nil-doc-color-scheme);
|
|
101
106
|
background-color: var(--i-nil-doc-block-bg-color);
|
|
102
|
-
box-shadow:
|
|
107
|
+
box-shadow: 0 0 0.5rem 0 var(--i-nil-doc-block-outline-color);
|
|
103
108
|
outline: 1px solid var(--i-nil-doc-block-outline-color);
|
|
104
109
|
transition: color var(--i-nil-doc-transition-time),
|
|
105
110
|
background-color var(--i-nil-doc-transition-time);
|
|
@@ -36,7 +36,7 @@ let handlers = {};
|
|
|
36
36
|
{/if}
|
|
37
37
|
</div>
|
|
38
38
|
{#if expanded}
|
|
39
|
-
<div class="misc
|
|
39
|
+
<div class="misc">
|
|
40
40
|
<Props
|
|
41
41
|
infos={$controls.props}
|
|
42
42
|
bind:values={bound}
|
|
@@ -63,10 +63,6 @@ let handlers = {};
|
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
65
|
<style>
|
|
66
|
-
.instance {
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
66
|
.instance.scale {
|
|
71
67
|
transition: transform var(--i-nil-doc-transition-time);
|
|
72
68
|
}
|
|
@@ -77,23 +73,23 @@ let handlers = {};
|
|
|
77
73
|
|
|
78
74
|
.cside {
|
|
79
75
|
display: grid;
|
|
80
|
-
grid-template-columns: 1fr
|
|
76
|
+
grid-template-columns: 1fr 35rem;
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
.content {
|
|
84
|
-
min-height:
|
|
85
|
-
border-radius: 0.
|
|
80
|
+
min-height: 6.25rem;
|
|
81
|
+
border-radius: 0.5rem;
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
div:not(.cside) > .misc {
|
|
89
|
-
border-bottom-left-radius: 0.
|
|
90
|
-
border-bottom-right-radius: 0.
|
|
85
|
+
border-bottom-left-radius: 0.5rem;
|
|
86
|
+
border-bottom-right-radius: 0.5rem;
|
|
91
87
|
user-select: none;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
90
|
.cside > .misc {
|
|
95
|
-
border-top-right-radius: 0.
|
|
96
|
-
border-bottom-right-radius: 0.
|
|
91
|
+
border-top-right-radius: 0.5rem;
|
|
92
|
+
border-bottom-right-radius: 0.5rem;
|
|
97
93
|
user-select: none;
|
|
98
94
|
}
|
|
99
95
|
|
|
@@ -102,19 +98,6 @@ let handlers = {};
|
|
|
102
98
|
border: 1px solid var(--i-nil-doc-block-outline-color);
|
|
103
99
|
}
|
|
104
100
|
|
|
105
|
-
/* scrollable */
|
|
106
|
-
.scrollable {
|
|
107
|
-
overflow: scroll;
|
|
108
|
-
/* Firefox */
|
|
109
|
-
scrollbar-width: none;
|
|
110
|
-
/* IE and Edge */
|
|
111
|
-
-ms-overflow-style: none;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.scrollable::-webkit-scrollbar {
|
|
115
|
-
display: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
101
|
/* colors */
|
|
119
102
|
.instance {
|
|
120
103
|
transition: background-color 350ms;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<script>import { getTheme } from "../../../../context";
|
|
2
|
-
const dark = getTheme();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
1
|
<!--
|
|
6
2
|
<div> this component
|
|
7
3
|
<div> Header
|
|
@@ -15,14 +11,13 @@ const dark = getTheme();
|
|
|
15
11
|
...
|
|
16
12
|
</div>
|
|
17
13
|
-->
|
|
18
|
-
<div
|
|
14
|
+
<div>
|
|
19
15
|
<slot />
|
|
20
16
|
</div>
|
|
21
17
|
|
|
22
18
|
<style>
|
|
23
19
|
div {
|
|
24
20
|
display: grid;
|
|
25
|
-
overflow: hidden;
|
|
26
21
|
height: 22rem;
|
|
27
22
|
min-width: 31.25rem;
|
|
28
23
|
grid-auto-rows: 2rem;
|
|
@@ -1,6 +1,22 @@
|
|
|
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;
|
|
1
15
|
import { SvelteComponentTyped } from "svelte";
|
|
2
16
|
declare const __propDef: {
|
|
3
|
-
props:
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
4
20
|
events: {
|
|
5
21
|
[evt: string]: CustomEvent<any>;
|
|
6
22
|
};
|
|
@@ -8,9 +24,4 @@ declare const __propDef: {
|
|
|
8
24
|
default: {};
|
|
9
25
|
};
|
|
10
26
|
};
|
|
11
|
-
export type StylerProps = typeof __propDef.props;
|
|
12
|
-
export type StylerEvents = typeof __propDef.events;
|
|
13
|
-
export type StylerSlots = typeof __propDef.slots;
|
|
14
|
-
export default class Styler extends SvelteComponentTyped<StylerProps, StylerEvents, StylerSlots> {
|
|
15
|
-
}
|
|
16
27
|
export {};
|
|
@@ -1,6 +1,41 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module">const colorSetter = (format, color) => {
|
|
2
|
+
switch (format) {
|
|
3
|
+
case "hex":
|
|
4
|
+
return color.hex.substring(0, 7);
|
|
5
|
+
case "hexa":
|
|
6
|
+
return color.hex.substring(0, 9);
|
|
7
|
+
case "hsl":
|
|
8
|
+
return color.hslString;
|
|
9
|
+
case "hsla":
|
|
10
|
+
return color.hslaString;
|
|
11
|
+
case "rgb":
|
|
12
|
+
return color.rgbString;
|
|
13
|
+
case "rgba":
|
|
14
|
+
return color.rgbaString;
|
|
15
|
+
}
|
|
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
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<script>import { getName, getFormat } from "./misc/utils";
|
|
2
36
|
import { defaulter } from "./misc/defaulter";
|
|
3
37
|
import NameHeader from "./misc/Name.svelte";
|
|
38
|
+
import Picker from "vanilla-picker";
|
|
4
39
|
export let value;
|
|
5
40
|
export let info;
|
|
6
41
|
export let depth;
|
|
@@ -8,6 +43,26 @@ export let disabled = false;
|
|
|
8
43
|
export let visible = false;
|
|
9
44
|
let ivalue = value ?? defaulter(info);
|
|
10
45
|
let enabled = value !== void 0;
|
|
46
|
+
const action = (div, format) => {
|
|
47
|
+
const picker = new Picker({
|
|
48
|
+
parent: div,
|
|
49
|
+
popup: "left",
|
|
50
|
+
editorFormat: formatter(format),
|
|
51
|
+
editor: false,
|
|
52
|
+
alpha: format.length === 4,
|
|
53
|
+
onChange: (color) => ivalue = colorSetter(getFormat(info), color),
|
|
54
|
+
color: ivalue
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
update: (format2) => {
|
|
58
|
+
picker.setOptions({
|
|
59
|
+
alpha: format2.length === 4,
|
|
60
|
+
editorFormat: formatter(format2)
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
destroy: () => picker.destroy()
|
|
64
|
+
};
|
|
65
|
+
};
|
|
11
66
|
$:
|
|
12
67
|
value = enabled && !disabled ? ivalue : void 0;
|
|
13
68
|
</script>
|
|
@@ -15,7 +70,17 @@ $:
|
|
|
15
70
|
{#if visible}
|
|
16
71
|
<div>
|
|
17
72
|
<NameHeader name={getName(info)} {depth} />
|
|
18
|
-
<div
|
|
73
|
+
<div>
|
|
74
|
+
<button use:action={getFormat(info)} disabled={!enabled || disabled}>
|
|
75
|
+
{value}
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
19
78
|
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
20
79
|
</div>
|
|
21
80
|
{/if}
|
|
81
|
+
|
|
82
|
+
<style>
|
|
83
|
+
div > div > button {
|
|
84
|
+
font-size: 0.7rem;
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -3,7 +3,7 @@ export let name;
|
|
|
3
3
|
export let expand = void 0;
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<div class="override" style:padding-left={`${depth}
|
|
6
|
+
<div class="override" style:padding-left={`${depth}rem`} title={name}>
|
|
7
7
|
<div class="icon" class:expand={expand === true}>
|
|
8
8
|
<div>
|
|
9
9
|
{expand === undefined ? "-" : ">"}
|
|
@@ -17,10 +17,10 @@ export let expand = void 0;
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
white-space: nowrap;
|
|
19
19
|
text-overflow: ellipsis;
|
|
20
|
-
padding-right:
|
|
20
|
+
padding-right: 0.5rem;
|
|
21
21
|
|
|
22
22
|
display: grid;
|
|
23
|
-
grid-template-columns:
|
|
23
|
+
grid-template-columns: 1.25rem 1fr;
|
|
24
24
|
align-items: center;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -28,8 +28,8 @@ export let expand = void 0;
|
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-direction: column;
|
|
30
30
|
justify-content: center;
|
|
31
|
-
height:
|
|
32
|
-
width:
|
|
31
|
+
height: 1rem;
|
|
32
|
+
width: 1rem;
|
|
33
33
|
transition: transform var(--i-nil-doc-transition-time);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<script>import { getTheme } from "../../../../context";
|
|
2
|
-
const dark = getTheme();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
1
|
<!--
|
|
6
2
|
<div> this component
|
|
7
3
|
<div> Header
|
|
@@ -17,14 +13,13 @@ const dark = getTheme();
|
|
|
17
13
|
...
|
|
18
14
|
</div>
|
|
19
15
|
-->
|
|
20
|
-
<div
|
|
16
|
+
<div>
|
|
21
17
|
<slot />
|
|
22
18
|
</div>
|
|
23
19
|
|
|
24
20
|
<style>
|
|
25
21
|
div {
|
|
26
22
|
display: grid;
|
|
27
|
-
overflow: hidden;
|
|
28
23
|
min-width: 31.25rem;
|
|
29
24
|
grid-auto-rows: 2rem;
|
|
30
25
|
box-sizing: border-box;
|
|
@@ -1,6 +1,22 @@
|
|
|
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;
|
|
1
15
|
import { SvelteComponentTyped } from "svelte";
|
|
2
16
|
declare const __propDef: {
|
|
3
|
-
props:
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
4
20
|
events: {
|
|
5
21
|
[evt: string]: CustomEvent<any>;
|
|
6
22
|
};
|
|
@@ -8,9 +24,4 @@ declare const __propDef: {
|
|
|
8
24
|
default: {};
|
|
9
25
|
};
|
|
10
26
|
};
|
|
11
|
-
export type StylerProps = typeof __propDef.props;
|
|
12
|
-
export type StylerEvents = typeof __propDef.events;
|
|
13
|
-
export type StylerSlots = typeof __propDef.slots;
|
|
14
|
-
export default class Styler extends SvelteComponentTyped<StylerProps, StylerEvents, StylerSlots> {
|
|
15
|
-
}
|
|
16
27
|
export {};
|
|
@@ -7,4 +7,5 @@ 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
9
|
export declare function defaulter(i: Unionized<PropType<"switch">>): boolean;
|
|
10
|
+
export declare function defaulter(i: Unionized<PropType<"color">>): string;
|
|
10
11
|
export declare function defaulter(i: Prop): ValueType;
|
|
@@ -5,7 +5,8 @@ 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" | "text" | "
|
|
8
|
+
export declare const getType: (info: Prop) => "number" | "object" | "select" | "text" | "switch" | "range" | "tuple" | "color";
|
|
9
|
+
export declare const getFormat: (info: Unionized<PropType<"color">>) => import("../../types").ColorFormat;
|
|
9
10
|
export declare const getName: (info: Prop) => string;
|
|
10
11
|
export declare const addName: (name: string, info: NonNamedProp) => Prop;
|
|
11
12
|
export {};
|
|
@@ -17,6 +17,12 @@ export const getType = (info) => {
|
|
|
17
17
|
}
|
|
18
18
|
return info.type;
|
|
19
19
|
};
|
|
20
|
+
export const getFormat = (info) => {
|
|
21
|
+
if (info instanceof Array) {
|
|
22
|
+
return info[2];
|
|
23
|
+
}
|
|
24
|
+
return info.format;
|
|
25
|
+
};
|
|
20
26
|
export const getName = (info) => {
|
|
21
27
|
if (info instanceof Array) {
|
|
22
28
|
return info[0];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
type Types = "text" | "color" | "number" | "select" | "range" | "switch" | "tuple" | "object";
|
|
2
2
|
|
|
3
|
+
type ColorFormat = "hsl" | "hsla" | "rgb" | "rgba" | "hex" | "hexa";
|
|
4
|
+
|
|
3
5
|
// prettier-ignore
|
|
4
6
|
export type PropType<T extends Types> =
|
|
5
7
|
T extends "text" ? [
|
|
@@ -7,8 +9,8 @@ export type PropType<T extends Types> =
|
|
|
7
9
|
{ name: string; type: T; }
|
|
8
10
|
]
|
|
9
11
|
: T extends "color" ? [
|
|
10
|
-
[ name: string, type: T ],
|
|
11
|
-
{ name: string; type: T; }
|
|
12
|
+
[ name: string, type: T, format: ColorFormat ],
|
|
13
|
+
{ name: string; type: T; format: ColorFormat; }
|
|
12
14
|
]
|
|
13
15
|
: T extends "number" ? [
|
|
14
16
|
[ name: string, type: T ],
|
|
@@ -48,8 +50,8 @@ export type Unionized<T extends PropTyoe> = T[number];
|
|
|
48
50
|
export type Prop =
|
|
49
51
|
| [ name: string, type: "text" ]
|
|
50
52
|
| { name: string; type: "text"; }
|
|
51
|
-
| [ name: string, type: "color" ]
|
|
52
|
-
| { name: string; type: "color"; }
|
|
53
|
+
| [ name: string, type: "color", format: ColorFormat ]
|
|
54
|
+
| { name: string; type: "color"; format: ColorFormat; }
|
|
53
55
|
| [ name: string, type: "number" ]
|
|
54
56
|
| { name: string; type: "number"; }
|
|
55
57
|
| [ name: string, type: "switch" ]
|
|
@@ -69,8 +71,8 @@ export type Prop =
|
|
|
69
71
|
export type NonNamedProp =
|
|
70
72
|
| [ type: "text" ]
|
|
71
73
|
| { type: "text"; }
|
|
72
|
-
| [ type: "color" ]
|
|
73
|
-
| { type: "color"; }
|
|
74
|
+
| [ type: "color", format: ColorFormat ]
|
|
75
|
+
| { type: "color"; format: ColorFormat; }
|
|
74
76
|
| [ type: "number" ]
|
|
75
77
|
| { type: "number"; }
|
|
76
78
|
| [ type: "switch" ]
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>
|
|
4
|
-
export let mode = "prop";
|
|
5
|
-
const v = tweened(mode === "event" ? 1 : 0, { duration: 150 });
|
|
6
|
-
$:
|
|
7
|
-
$v = mode === "event" ? 1 : 0;
|
|
3
|
+
<script>export let mode = "prop";
|
|
8
4
|
</script>
|
|
9
5
|
|
|
10
6
|
<svg viewBox="-50 -50 100 100">
|
|
11
7
|
<rect width="60" height="60" x="-30" y="-30" fill="transparent" />
|
|
12
|
-
<rect
|
|
8
|
+
<rect
|
|
9
|
+
class:right={mode === "prop"}
|
|
10
|
+
class="mv"
|
|
11
|
+
height="40"
|
|
12
|
+
width="20"
|
|
13
|
+
y="-20"
|
|
14
|
+
rx="2"
|
|
15
|
+
ry="2"
|
|
16
|
+
fill="transparent"
|
|
17
|
+
/>
|
|
13
18
|
<polygon transform="translate(5, 0)" points="-15,-2 1,-2, 1,-6 6,0 1,6 1,2 -15,2" />
|
|
14
19
|
</svg>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.mv {
|
|
23
|
+
transition: x var(--i-nil-doc-transition-time);
|
|
24
|
+
x: -20px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.mv.right {
|
|
28
|
+
x: 0px;
|
|
29
|
+
}
|
|
30
|
+
</style>
|