@nil-/doc 0.2.49 → 0.2.51
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 +21 -0
- package/components/Layout.svelte +72 -109
- package/components/Layout.svelte.d.ts +1 -0
- package/components/block/Block.svelte +84 -41
- package/components/block/Controls.svelte +4 -6
- package/components/block/Controls.svelte.d.ts +2 -2
- package/components/block/Instance.svelte +79 -111
- package/components/block/Params.svelte +1 -1
- package/components/block/Template.svelte +2 -1
- package/components/block/context.d.ts +2 -2
- package/components/block/context.js +2 -1
- package/components/block/controls/events/Events.svelte +23 -14
- package/components/block/controls/events/misc/Styler.svelte +34 -60
- package/components/block/controls/props/Color.svelte +21 -0
- package/components/block/controls/props/Color.svelte.d.ts +21 -0
- package/components/block/controls/props/Component.svelte +6 -1
- package/components/block/controls/props/Number.svelte +5 -6
- package/components/block/controls/props/Object.svelte +10 -12
- package/components/block/controls/props/Props.svelte +3 -6
- package/components/block/controls/props/Range.svelte +38 -37
- package/components/block/controls/props/Select.svelte +11 -14
- package/components/block/controls/props/Switch.svelte +5 -6
- package/components/block/controls/props/Text.svelte +9 -10
- package/components/block/controls/props/Tuple.svelte +15 -27
- package/components/block/controls/props/misc/GroupHeader.svelte +6 -6
- package/components/block/controls/props/misc/Name.svelte +15 -16
- package/components/block/controls/props/misc/Styler.svelte +42 -50
- package/components/block/controls/props/misc/defaulter.d.ts +8 -8
- package/components/block/controls/props/misc/defaulter.js +28 -48
- package/components/block/controls/props/misc/utils.d.ts +11 -0
- package/components/block/controls/props/misc/utils.js +31 -0
- package/components/block/controls/types.d.ts +10 -2
- package/components/block/icons/Button.svelte +30 -0
- package/components/block/icons/Button.svelte.d.ts +35 -0
- package/components/block/icons/ControlView.svelte +14 -0
- package/components/block/icons/ControlView.svelte.d.ts +16 -0
- package/components/block/icons/Position.svelte +50 -0
- package/components/block/icons/Position.svelte.d.ts +16 -0
- package/components/etc/Base.svelte +58 -0
- package/components/etc/Base.svelte.d.ts +18 -0
- package/components/etc/Container.svelte +96 -109
- package/components/etc/Content.svelte +45 -0
- package/components/etc/Content.svelte.d.ts +18 -0
- package/components/{etc/NilIcon.svelte → icons/NilDoc.svelte} +17 -16
- package/components/icons/NilDoc.svelte.d.ts +14 -0
- package/components/{etc/ThemeIcon.svelte → icons/Theme.svelte} +29 -31
- package/components/icons/Theme.svelte.d.ts +17 -0
- package/components/navigation/Nav.svelte +27 -30
- package/components/navigation/Node.svelte +46 -47
- package/components/navigation/Tree.svelte +1 -1
- package/components/title/Icon.svelte +19 -0
- package/components/title/Icon.svelte.d.ts +21 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/components/etc/NilIcon.svelte.d.ts +0 -14
- package/components/etc/ThemeIcon.svelte.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.51
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] components now rely on root font-size ([#88](https://github.com/njaldea/mono/pull/88))
|
|
8
|
+
|
|
9
|
+
- [doc][fix] fix object prop control ([#88](https://github.com/njaldea/mono/pull/88))
|
|
10
|
+
|
|
11
|
+
- [doc][new] block button controls ([#88](https://github.com/njaldea/mono/pull/88))
|
|
12
|
+
[doc][new] centralized custom css
|
|
13
|
+
|
|
14
|
+
- [doc][misc] change styling ([#88](https://github.com/njaldea/mono/pull/88))
|
|
15
|
+
[doc][fix] scrolling content of container
|
|
16
|
+
|
|
17
|
+
## 0.2.50
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [doc][new] removed default nil icon ([#86](https://github.com/njaldea/mono/pull/86))
|
|
22
|
+
[doc][new] allow override of theme icon
|
|
23
|
+
|
|
3
24
|
## 0.2.49
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -1,97 +1,14 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
|
-
|
|
4
|
-
.layout {
|
|
5
|
-
display: grid;
|
|
6
|
-
grid-template-columns: 1fr;
|
|
7
|
-
grid-template-rows: minmax(40px, auto) 1fr;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.top {
|
|
15
|
-
display: grid;
|
|
16
|
-
grid-template-columns: 1fr 40px 40px;
|
|
17
|
-
align-items: center;
|
|
18
|
-
padding-left: 10px;
|
|
19
|
-
padding-right: 10px;
|
|
20
|
-
border-bottom-width: 1px;
|
|
21
|
-
border-bottom-style: solid;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
user-select: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.main {
|
|
27
|
-
height: 100%;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.icon {
|
|
32
|
-
width: 100%;
|
|
33
|
-
height: 100%;
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
transition: transform 350ms;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.icon:hover {
|
|
39
|
-
transform: scale(1.5);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.content {
|
|
43
|
-
height: 100%;
|
|
44
|
-
padding: 5px;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
box-sizing: border-box;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* scrollable */
|
|
51
|
-
.scrollable,
|
|
52
|
-
.page > :global(*:only-child) {
|
|
53
|
-
overflow: scroll;
|
|
54
|
-
scrollbar-width: none; /* Firefox */
|
|
55
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.scrollable::-webkit-scrollbar,
|
|
59
|
-
.page > :global(*:only-child::-webkit-scrollbar) {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* colors */
|
|
64
|
-
.layout {
|
|
65
|
-
color-scheme: light;
|
|
66
|
-
color: hsl(0, 0%, 0%);
|
|
67
|
-
background-color: hsl(0, 0%, 100%);
|
|
68
|
-
transition: color 350ms, background-color 350ms;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.layout.dark {
|
|
72
|
-
color-scheme: dark;
|
|
73
|
-
color: hsl(0, 0%, 80%);
|
|
74
|
-
background-color: hsl(200, 4%, 14%);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.layout > .top {
|
|
78
|
-
transition: border-bottom-colo 350ms;
|
|
79
|
-
border-bottom-color: hsl(0, 2%, 70%);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.layout.dark > .top {
|
|
83
|
-
border-bottom-color: hsl(0, 2%, 40%);
|
|
84
|
-
}
|
|
85
|
-
</style>
|
|
86
|
-
|
|
87
1
|
<script context="module">const defaultSorter = (l, r) => l.localeCompare(r);
|
|
88
2
|
const defaultRenamer = (s) => s;
|
|
89
3
|
</script>
|
|
90
|
-
|
|
4
|
+
|
|
5
|
+
<script>import Base from "./etc/Base.svelte";
|
|
6
|
+
import Container from "./etc/Container.svelte";
|
|
91
7
|
import Nav from "./navigation/Nav.svelte";
|
|
8
|
+
import Icon from "./title/Icon.svelte";
|
|
92
9
|
import { getTheme, initTheme } from "./context";
|
|
93
|
-
import ThemeIcon from "./
|
|
94
|
-
import
|
|
10
|
+
import ThemeIcon from "./icons/Theme.svelte";
|
|
11
|
+
import Content from "./etc/Content.svelte";
|
|
95
12
|
export let data;
|
|
96
13
|
export let current = null;
|
|
97
14
|
export let sorter = null;
|
|
@@ -109,29 +26,27 @@ const toggle = () => {
|
|
|
109
26
|
}
|
|
110
27
|
};
|
|
111
28
|
</script>
|
|
29
|
+
|
|
112
30
|
<!--
|
|
113
31
|
@component
|
|
114
32
|
See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details.
|
|
115
33
|
-->
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<div class="
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<NilIcon />
|
|
34
|
+
|
|
35
|
+
<Base dark={$dark}>
|
|
36
|
+
<div class="fill layout">
|
|
37
|
+
<div class="top">
|
|
38
|
+
<div class="title">
|
|
39
|
+
<slot name="title" />
|
|
40
|
+
</div>
|
|
41
|
+
<slot name="title-misc">
|
|
42
|
+
<Icon on:click={toggle}>
|
|
43
|
+
<ThemeIcon {theme} />
|
|
44
|
+
</Icon>
|
|
45
|
+
</slot>
|
|
129
46
|
</div>
|
|
130
|
-
</div>
|
|
131
|
-
<div class="main">
|
|
132
47
|
<Container offset={250} vertical b>
|
|
133
48
|
<svelte:fragment slot="A">
|
|
134
|
-
<
|
|
49
|
+
<Content flat>
|
|
135
50
|
<Nav
|
|
136
51
|
info={data}
|
|
137
52
|
selected={current ?? ""}
|
|
@@ -139,16 +54,64 @@ const toggle = () => {
|
|
|
139
54
|
renamer={renamer ?? defaultRenamer}
|
|
140
55
|
on:navigate
|
|
141
56
|
/>
|
|
142
|
-
</
|
|
57
|
+
</Content>
|
|
143
58
|
</svelte:fragment>
|
|
144
59
|
<svelte:fragment slot="B">
|
|
145
|
-
<
|
|
60
|
+
<Content>
|
|
146
61
|
{#key current}
|
|
147
62
|
<slot />
|
|
148
63
|
{/key}
|
|
149
|
-
</
|
|
64
|
+
</Content>
|
|
150
65
|
</svelte:fragment>
|
|
151
66
|
</Container>
|
|
152
67
|
</div>
|
|
153
|
-
</
|
|
68
|
+
</Base>
|
|
69
|
+
|
|
70
|
+
<style>
|
|
71
|
+
.fill {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.layout {
|
|
77
|
+
display: grid;
|
|
78
|
+
grid-template-columns: 1fr;
|
|
79
|
+
grid-template-rows: minmax(2.5rem, auto) 1fr;
|
|
80
|
+
}
|
|
154
81
|
|
|
82
|
+
.top {
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
font-size: 1rem;
|
|
85
|
+
display: grid;
|
|
86
|
+
grid-auto-flow: column;
|
|
87
|
+
grid-auto-columns: 2.5rem;
|
|
88
|
+
grid-template-columns: 1fr;
|
|
89
|
+
align-items: center;
|
|
90
|
+
padding-left: 0.625rem;
|
|
91
|
+
padding-right: 0.625rem;
|
|
92
|
+
border-bottom-width: 1px;
|
|
93
|
+
border-bottom-style: solid;
|
|
94
|
+
user-select: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.title {
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-auto-flow: column;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: left;
|
|
102
|
+
gap: 0.3125rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.layout {
|
|
106
|
+
color-scheme: var(--i-nil-doc-color-scheme);
|
|
107
|
+
color: var(--i-nil-doc-color);
|
|
108
|
+
background-color: var(--i-nil-doc-bg-color);
|
|
109
|
+
transition: color var(--i-nil-doc-transition-time),
|
|
110
|
+
background-color var(--i-nil-doc-transition-time);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.layout > .top {
|
|
114
|
+
transition: border-bottom-color var(--i-nil-doc-transition-time);
|
|
115
|
+
border-bottom-color: var(--i-nil-doc-container-p);
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
|
-
|
|
4
|
-
div {
|
|
5
|
-
display: grid;
|
|
6
|
-
border-radius: 5px;
|
|
7
|
-
grid-auto-rows: 1fr;
|
|
8
|
-
grid-auto-columns: auto;
|
|
9
|
-
grid-auto-flow: row;
|
|
10
|
-
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
13
|
-
padding: 13px 3px;
|
|
14
|
-
gap: 3px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
div.columns {
|
|
18
|
-
grid-auto-rows: auto;
|
|
19
|
-
grid-auto-columns: 1fr;
|
|
20
|
-
grid-auto-flow: column;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/* colors */
|
|
24
|
-
div {
|
|
25
|
-
color-scheme: light;
|
|
26
|
-
color: hsl(0, 0%, 0%);
|
|
27
|
-
background-color: hsl(0, 2%, 70%);
|
|
28
|
-
transition: color 350ms, background-color 350ms;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
div.dark {
|
|
32
|
-
color-scheme: dark;
|
|
33
|
-
color: hsl(0, 0%, 80%);
|
|
34
|
-
background-color: hsl(0, 2%, 40%);
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
37
|
-
|
|
38
1
|
<script>import {
|
|
39
2
|
initParams,
|
|
40
3
|
initDefaults,
|
|
@@ -42,23 +5,103 @@
|
|
|
42
5
|
initControlsState,
|
|
43
6
|
initOrientation
|
|
44
7
|
} from "./context";
|
|
8
|
+
import Base from "../etc/Base.svelte";
|
|
45
9
|
import { getTheme, initTheme } from "../context";
|
|
10
|
+
import Button from "./icons/Button.svelte";
|
|
11
|
+
import Position from "./icons/Position.svelte";
|
|
12
|
+
import ControlView from "./icons/ControlView.svelte";
|
|
46
13
|
initParams();
|
|
47
14
|
initDefaults();
|
|
48
15
|
initControls();
|
|
49
|
-
initControlsState();
|
|
16
|
+
const state = initControlsState();
|
|
50
17
|
const columns = initOrientation();
|
|
51
18
|
export let theme = void 0;
|
|
52
19
|
const parentTheme = getTheme();
|
|
53
20
|
const dark = initTheme();
|
|
54
21
|
$:
|
|
55
22
|
$dark = theme === void 0 ? $parentTheme : "dark" === theme;
|
|
23
|
+
const cyclePosition = () => {
|
|
24
|
+
switch ($state.position) {
|
|
25
|
+
case "hidden":
|
|
26
|
+
$state.position = "bottom";
|
|
27
|
+
break;
|
|
28
|
+
case "bottom":
|
|
29
|
+
$state.position = "right";
|
|
30
|
+
break;
|
|
31
|
+
case "right":
|
|
32
|
+
$state.position = "hidden";
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const cycleMode = () => {
|
|
37
|
+
switch ($state.mode) {
|
|
38
|
+
case "event":
|
|
39
|
+
$state.mode = "prop";
|
|
40
|
+
break;
|
|
41
|
+
case "prop":
|
|
42
|
+
$state.mode = "event";
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
56
46
|
</script>
|
|
47
|
+
|
|
57
48
|
<!--
|
|
58
49
|
@component
|
|
59
50
|
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block) for more details.
|
|
60
51
|
-->
|
|
61
|
-
<div class:columns={$columns} class:dark={$dark}>
|
|
62
|
-
<slot />
|
|
63
|
-
</div>
|
|
64
52
|
|
|
53
|
+
<Base dark={$dark}>
|
|
54
|
+
<div class="block" class:columns={$columns} class:dark={$dark}>
|
|
55
|
+
<div class="buttons">
|
|
56
|
+
<Button scale on:click={cycleMode} title={$state.mode}>
|
|
57
|
+
<ControlView mode={$state.mode} />
|
|
58
|
+
</Button>
|
|
59
|
+
<Button scale on:click={cyclePosition} title={$state.position}>
|
|
60
|
+
<Position position={$state.position} />
|
|
61
|
+
</Button>
|
|
62
|
+
</div>
|
|
63
|
+
<slot />
|
|
64
|
+
</div>
|
|
65
|
+
</Base>
|
|
66
|
+
|
|
67
|
+
<style>
|
|
68
|
+
.block {
|
|
69
|
+
display: grid;
|
|
70
|
+
border-radius: 0.3125rem;
|
|
71
|
+
grid-auto-rows: 1fr;
|
|
72
|
+
grid-auto-columns: auto;
|
|
73
|
+
grid-auto-flow: row;
|
|
74
|
+
|
|
75
|
+
min-width: 10rem;
|
|
76
|
+
|
|
77
|
+
padding: 1.75rem 0.2rem 0.5rem 0.2rem;
|
|
78
|
+
gap: 0.1875rem;
|
|
79
|
+
position: relative;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.buttons {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: calc(1.75rem * 2);
|
|
85
|
+
height: 1.75rem;
|
|
86
|
+
right: 1rem;
|
|
87
|
+
top: 0rem;
|
|
88
|
+
display: flex;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.block.columns {
|
|
93
|
+
grid-auto-rows: auto;
|
|
94
|
+
grid-auto-columns: 1fr;
|
|
95
|
+
grid-auto-flow: column;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.block {
|
|
99
|
+
color: var(--i-nil-doc-color);
|
|
100
|
+
color-scheme: var(--i-nil-doc-color-scheme);
|
|
101
|
+
background-color: var(--i-nil-doc-block-bg-color);
|
|
102
|
+
box-shadow: 0px 0px 5px 0px var(--i-nil-doc-block-outline-color);
|
|
103
|
+
outline: 1px solid var(--i-nil-doc-block-outline-color);
|
|
104
|
+
transition: color var(--i-nil-doc-transition-time),
|
|
105
|
+
background-color var(--i-nil-doc-transition-time);
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
<script>import { getControls, getControlsState } from "./context";
|
|
3
2
|
export let props = [];
|
|
4
3
|
export let events = [];
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
4
|
+
export let position = "bottom";
|
|
5
|
+
export let mode = "prop";
|
|
7
6
|
const controls = getControls();
|
|
8
7
|
$:
|
|
9
8
|
$controls = { props, events };
|
|
10
9
|
const state = getControlsState();
|
|
11
10
|
$:
|
|
12
|
-
$state
|
|
13
|
-
$:
|
|
14
|
-
$state.position = position;
|
|
11
|
+
$state = { position, mode };
|
|
15
12
|
</script>
|
|
13
|
+
|
|
16
14
|
<!--
|
|
17
15
|
@component
|
|
18
16
|
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Controls) for more details.
|
|
@@ -4,8 +4,8 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
props?: Prop[] | undefined;
|
|
6
6
|
events?: string[] | undefined;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
position?: "bottom" | "right" | "hidden" | undefined;
|
|
8
|
+
mode?: "prop" | "event" | undefined;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,14 +1,74 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script>import { beforeUpdate } from "svelte";
|
|
2
|
+
import { getControls, getControlsState } from "./context";
|
|
3
|
+
import Props from "./controls/props/Props.svelte";
|
|
4
|
+
import Events from "./controls/events/Events.svelte";
|
|
5
|
+
import { resolve } from "./utils";
|
|
6
|
+
const controls = getControls();
|
|
7
|
+
const controlsState = getControlsState();
|
|
8
|
+
$:
|
|
9
|
+
expanded = $controlsState.position !== "hidden";
|
|
10
|
+
export let defaults = void 0;
|
|
11
|
+
export let noreset = false;
|
|
12
|
+
export let scale = false;
|
|
13
|
+
let key = false;
|
|
14
|
+
beforeUpdate(() => key = !key);
|
|
15
|
+
const resolveArgs = resolve;
|
|
16
|
+
let bound = {};
|
|
17
|
+
const updateBound = (d) => bound = resolve(d ?? {}, {});
|
|
18
|
+
$:
|
|
19
|
+
updateBound(defaults);
|
|
20
|
+
let handlers = {};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<!--
|
|
24
|
+
@component
|
|
25
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details.
|
|
26
|
+
-->
|
|
27
|
+
|
|
28
|
+
<div class="instance" class:scale class:cside={expanded && "right" === $controlsState.position}>
|
|
29
|
+
<div class="content scrollable">
|
|
30
|
+
{#if noreset}
|
|
31
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
32
|
+
{:else}
|
|
33
|
+
{#key key}
|
|
34
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
35
|
+
{/key}
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
{#if expanded}
|
|
39
|
+
<div class="misc scrollable">
|
|
40
|
+
<Props
|
|
41
|
+
infos={$controls.props}
|
|
42
|
+
bind:values={bound}
|
|
43
|
+
visible={$controlsState.mode === "prop"}
|
|
44
|
+
>
|
|
45
|
+
<div>
|
|
46
|
+
<div>Properties</div>
|
|
47
|
+
<div>Value</div>
|
|
48
|
+
<div>Use</div>
|
|
49
|
+
</div>
|
|
50
|
+
</Props>
|
|
51
|
+
<Events
|
|
52
|
+
events={$controls.events}
|
|
53
|
+
bind:handlers
|
|
54
|
+
visible={$controlsState.mode === "event"}
|
|
55
|
+
>
|
|
56
|
+
<div>
|
|
57
|
+
<div>Events</div>
|
|
58
|
+
<div>Detail</div>
|
|
59
|
+
</div>
|
|
60
|
+
</Events>
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
5
64
|
|
|
65
|
+
<style>
|
|
6
66
|
.instance {
|
|
7
67
|
overflow: hidden;
|
|
8
68
|
}
|
|
9
69
|
|
|
10
70
|
.instance.scale {
|
|
11
|
-
transition: transform
|
|
71
|
+
transition: transform var(--i-nil-doc-transition-time);
|
|
12
72
|
}
|
|
13
73
|
|
|
14
74
|
.instance.scale:hover {
|
|
@@ -22,33 +82,33 @@
|
|
|
22
82
|
|
|
23
83
|
.content {
|
|
24
84
|
min-height: 100px;
|
|
25
|
-
border-radius:
|
|
85
|
+
border-radius: 0.3125rem;
|
|
26
86
|
}
|
|
27
87
|
|
|
28
88
|
div:not(.cside) > .misc {
|
|
29
|
-
border-bottom-left-radius:
|
|
30
|
-
border-bottom-right-radius:
|
|
89
|
+
border-bottom-left-radius: 0.3125rem;
|
|
90
|
+
border-bottom-right-radius: 0.3125rem;
|
|
31
91
|
user-select: none;
|
|
32
92
|
}
|
|
33
93
|
|
|
34
94
|
.cside > .misc {
|
|
35
|
-
border-top-right-radius:
|
|
36
|
-
border-bottom-right-radius:
|
|
95
|
+
border-top-right-radius: 0.3125rem;
|
|
96
|
+
border-bottom-right-radius: 0.3125rem;
|
|
37
97
|
user-select: none;
|
|
38
98
|
}
|
|
39
99
|
|
|
40
100
|
.content,
|
|
41
101
|
.misc {
|
|
42
|
-
border
|
|
43
|
-
border-width: 1px;
|
|
44
|
-
padding: 2px;
|
|
102
|
+
border: 1px solid var(--i-nil-doc-block-outline-color);
|
|
45
103
|
}
|
|
46
104
|
|
|
47
105
|
/* scrollable */
|
|
48
106
|
.scrollable {
|
|
49
107
|
overflow: scroll;
|
|
50
|
-
|
|
51
|
-
-
|
|
108
|
+
/* Firefox */
|
|
109
|
+
scrollbar-width: none;
|
|
110
|
+
/* IE and Edge */
|
|
111
|
+
-ms-overflow-style: none;
|
|
52
112
|
}
|
|
53
113
|
|
|
54
114
|
.scrollable::-webkit-scrollbar {
|
|
@@ -56,101 +116,9 @@
|
|
|
56
116
|
}
|
|
57
117
|
|
|
58
118
|
/* colors */
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
background-color:
|
|
63
|
-
transition: border-color 350ms, background-color 350ms;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.dark.content,
|
|
67
|
-
.dark.misc {
|
|
68
|
-
border-color: hsl(0, 2%, 40%);
|
|
69
|
-
background-color: hsl(200, 4%, 14%);
|
|
119
|
+
.instance {
|
|
120
|
+
transition: background-color 350ms;
|
|
121
|
+
color: var(--i-nil-doc-color);
|
|
122
|
+
background-color: var(--i-nil-doc-bg-color);
|
|
70
123
|
}
|
|
71
124
|
</style>
|
|
72
|
-
|
|
73
|
-
<script>import { beforeUpdate } from "svelte";
|
|
74
|
-
import { cquery } from "./action";
|
|
75
|
-
import { getControls, getControlsState } from "./context";
|
|
76
|
-
import { getTheme } from "../context";
|
|
77
|
-
import Props from "./controls/props/Props.svelte";
|
|
78
|
-
import Events from "./controls/events/Events.svelte";
|
|
79
|
-
import { resolve } from "./utils";
|
|
80
|
-
const controls = getControls();
|
|
81
|
-
const controlsState = getControlsState();
|
|
82
|
-
const dark = getTheme();
|
|
83
|
-
$:
|
|
84
|
-
hasProps = $controls.props.length > 0;
|
|
85
|
-
$:
|
|
86
|
-
hasEvents = $controls.events.length > 0;
|
|
87
|
-
let cvisible = null;
|
|
88
|
-
$:
|
|
89
|
-
if (cvisible == null && hasProps) {
|
|
90
|
-
cvisible = "props";
|
|
91
|
-
} else if (cvisible == null && hasEvents) {
|
|
92
|
-
cvisible = "events";
|
|
93
|
-
} else if (!hasProps && !hasEvents) {
|
|
94
|
-
cvisible = null;
|
|
95
|
-
}
|
|
96
|
-
$:
|
|
97
|
-
expanded = !$controlsState.hide && cvisible != null;
|
|
98
|
-
export let defaults = void 0;
|
|
99
|
-
export let noreset = false;
|
|
100
|
-
export let scale = false;
|
|
101
|
-
let key = false;
|
|
102
|
-
beforeUpdate(() => key = !key);
|
|
103
|
-
const resolveArgs = resolve;
|
|
104
|
-
let bound = {};
|
|
105
|
-
const updateBound = (d) => bound = resolve(d ?? {}, {});
|
|
106
|
-
$:
|
|
107
|
-
updateBound(defaults);
|
|
108
|
-
let handlers;
|
|
109
|
-
</script>
|
|
110
|
-
<!--
|
|
111
|
-
@component
|
|
112
|
-
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details.
|
|
113
|
-
-->
|
|
114
|
-
<div
|
|
115
|
-
class="instance"
|
|
116
|
-
class:scale
|
|
117
|
-
class:cside={expanded && "right" === $controlsState.position}
|
|
118
|
-
use:cquery={{
|
|
119
|
-
class: "cside",
|
|
120
|
-
min: 1000,
|
|
121
|
-
w: true,
|
|
122
|
-
enabled: expanded && $controlsState.position === undefined
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
{#if noreset}
|
|
126
|
-
<div class="content scrollable" class:dark={$dark}>
|
|
127
|
-
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
128
|
-
</div>
|
|
129
|
-
{:else}
|
|
130
|
-
{#key key}
|
|
131
|
-
<div class="content scrollable" class:dark={$dark}>
|
|
132
|
-
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
133
|
-
</div>
|
|
134
|
-
{/key}
|
|
135
|
-
{/if}
|
|
136
|
-
{#if expanded}
|
|
137
|
-
<div class="misc scrollable" class:dark={$dark}>
|
|
138
|
-
<Props infos={$controls.props} bind:values={bound} visible={cvisible == "props"}>
|
|
139
|
-
<div on:dblclick={() => hasEvents && (cvisible = "events")}>
|
|
140
|
-
<div>Properties</div>
|
|
141
|
-
<div>Value</div>
|
|
142
|
-
<div>Use</div>
|
|
143
|
-
</div>
|
|
144
|
-
</Props>
|
|
145
|
-
<Events events={$controls.events} bind:handlers visible={cvisible == "events"}>
|
|
146
|
-
{#if cvisible == "events"}
|
|
147
|
-
<div on:dblclick={() => hasProps && (cvisible = "props")}>
|
|
148
|
-
<div>Events</div>
|
|
149
|
-
<div>Detail</div>
|
|
150
|
-
</div>
|
|
151
|
-
{/if}
|
|
152
|
-
</Events>
|
|
153
|
-
</div>
|
|
154
|
-
{/if}
|
|
155
|
-
</div>
|
|
156
|
-
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<script>import { getParams } from "./context";
|
|
3
2
|
import { resolve } from "./utils";
|
|
4
3
|
export let tag = void 0;
|
|
@@ -15,6 +14,7 @@ $:
|
|
|
15
14
|
$:
|
|
16
15
|
$params[id].values = resolve(props, {});
|
|
17
16
|
</script>
|
|
17
|
+
|
|
18
18
|
<!--
|
|
19
19
|
@component
|
|
20
20
|
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template/1-Params) for more details.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<script>import { beforeUpdate } from "svelte";
|
|
3
2
|
import { getDefaults, getParams, getOrientation } from "./context";
|
|
4
3
|
import { resolve } from "./utils";
|
|
@@ -19,10 +18,12 @@ beforeUpdate(() => key = !key);
|
|
|
19
18
|
const resolveArgs = resolve;
|
|
20
19
|
const cast = (t) => t;
|
|
21
20
|
</script>
|
|
21
|
+
|
|
22
22
|
<!--
|
|
23
23
|
@component
|
|
24
24
|
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template) for more details.
|
|
25
25
|
-->
|
|
26
|
+
|
|
26
27
|
{#each $params as param (param.id)}
|
|
27
28
|
<Instance
|
|
28
29
|
defaults={resolveArgs($defaultsStore, param.values)}
|