@nil-/doc 0.2.36 → 0.2.37
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 +10 -0
- package/components/Layout.svelte +13 -17
- package/components/Layout.svelte.d.ts +1 -0
- package/components/block/Block.svelte +34 -17
- package/components/block/Block.svelte.d.ts +1 -0
- package/components/block/Controls.svelte +6 -1
- package/components/block/Controls.svelte.d.ts +1 -0
- package/components/block/Instance.svelte +111 -7
- package/components/block/Params.svelte +15 -18
- package/components/block/Params.svelte.d.ts +1 -0
- package/components/block/Template.svelte +21 -150
- package/components/block/Template.svelte.d.ts +1 -0
- package/components/block/context.d.ts +2 -2
- package/components/block/context.js +2 -1
- package/components/block/controls/misc/Styler.svelte +2 -2
- package/components/context.d.ts +0 -1
- package/components/context.js +0 -6
- package/components/etc/Container.svelte +19 -19
- package/components/etc/Container.svelte.d.ts +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][fix] params prop is now reactive ([#57](https://github.com/njaldea/mono/pull/57))
|
|
8
|
+
[doc] added component documentation link to deployment
|
|
9
|
+
[doc] removed inRoot
|
|
10
|
+
|
|
11
|
+
- [doc][cleanup] refactored Instance/Template/Params ([#57](https://github.com/njaldea/mono/pull/57))
|
|
12
|
+
|
|
3
13
|
## 0.2.36
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
gap: 1px;
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
|
+
box-sizing: border-box;
|
|
11
12
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -34,14 +35,6 @@
|
|
|
34
35
|
box-sizing: border-box;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
/* reset block */
|
|
38
|
-
.reset {
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
38
|
/* scrollable */
|
|
46
39
|
.scrollable {
|
|
47
40
|
overflow: scroll;
|
|
@@ -81,7 +74,7 @@
|
|
|
81
74
|
</script>
|
|
82
75
|
<script>import Container from "./etc/Container.svelte";
|
|
83
76
|
import Nav from "./navigation/Nav.svelte";
|
|
84
|
-
import {
|
|
77
|
+
import { getTheme, initTheme, evalTheme } from "./context";
|
|
85
78
|
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
86
79
|
import NilIcon from "./etc/NilIcon.svelte";
|
|
87
80
|
export let data;
|
|
@@ -89,21 +82,24 @@ export let current = null;
|
|
|
89
82
|
export let sorter = null;
|
|
90
83
|
export let renamer = null;
|
|
91
84
|
export let theme = void 0;
|
|
92
|
-
const r = inRoot();
|
|
93
85
|
const parentTheme = getTheme();
|
|
94
|
-
const
|
|
86
|
+
const dark = initTheme();
|
|
95
87
|
$:
|
|
96
|
-
$
|
|
88
|
+
$dark = evalTheme(parentTheme ? $parentTheme : true, theme);
|
|
97
89
|
</script>
|
|
98
|
-
|
|
90
|
+
<!--
|
|
91
|
+
@component
|
|
92
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details.
|
|
93
|
+
-->
|
|
94
|
+
<div class="layout" class:dark={$dark}>
|
|
99
95
|
<div class="top">
|
|
100
96
|
<slot name="title"><span>@nil-/doc</span></slot>
|
|
101
|
-
<ThemeIcon bind:dark={$
|
|
97
|
+
<ThemeIcon bind:dark={$dark} />
|
|
102
98
|
<NilIcon />
|
|
103
99
|
</div>
|
|
104
100
|
<div class="main">
|
|
105
|
-
<Container offset={250} vertical
|
|
106
|
-
<svelte:fragment slot="
|
|
101
|
+
<Container offset={250} vertical b>
|
|
102
|
+
<svelte:fragment slot="A">
|
|
107
103
|
<div class="content scrollable">
|
|
108
104
|
<Nav
|
|
109
105
|
info={data}
|
|
@@ -114,7 +110,7 @@ $:
|
|
|
114
110
|
/>
|
|
115
111
|
</div>
|
|
116
112
|
</svelte:fragment>
|
|
117
|
-
<svelte:fragment slot="
|
|
113
|
+
<svelte:fragment slot="B">
|
|
118
114
|
<div class="content scrollable">
|
|
119
115
|
{#key current}
|
|
120
116
|
<slot />
|
|
@@ -22,6 +22,7 @@ declare const __propDef: {
|
|
|
22
22
|
export type LayoutProps = typeof __propDef.props;
|
|
23
23
|
export type LayoutEvents = typeof __propDef.events;
|
|
24
24
|
export type LayoutSlots = typeof __propDef.slots;
|
|
25
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details. */
|
|
25
26
|
export default class Layout extends SvelteComponentTyped<LayoutProps, LayoutEvents, LayoutSlots> {
|
|
26
27
|
}
|
|
27
28
|
export {};
|
|
@@ -2,46 +2,63 @@
|
|
|
2
2
|
@import url("https://fonts.googleapis.com/css?family=Fira%20Code");
|
|
3
3
|
|
|
4
4
|
div {
|
|
5
|
-
display:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
display: grid;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
grid-auto-rows: 1fr;
|
|
8
|
+
grid-auto-columns: auto;
|
|
9
|
+
grid-auto-flow: row;
|
|
9
10
|
|
|
10
|
-
/* reset block */
|
|
11
|
-
.reset {
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
11
|
box-sizing: border-box;
|
|
15
12
|
font-family: "Fira Code", "Courier New", Courier, monospace;
|
|
13
|
+
padding: 3px;
|
|
14
|
+
gap: 3px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
div.columns {
|
|
18
|
+
grid-auto-rows: auto;
|
|
19
|
+
grid-auto-columns: 1fr;
|
|
20
|
+
grid-auto-flow: column;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
/* colors */
|
|
19
24
|
div {
|
|
20
25
|
color-scheme: light;
|
|
21
|
-
color: hsl(0,
|
|
22
|
-
|
|
26
|
+
color: hsl(0, 0%, 0%);
|
|
27
|
+
background-color: hsl(0, 2%, 70%);
|
|
28
|
+
transition: color 350ms, background-color 350ms;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
div.dark {
|
|
26
32
|
color-scheme: dark;
|
|
27
|
-
color: hsl(
|
|
33
|
+
color: hsl(0, 0%, 80%);
|
|
34
|
+
background-color: hsl(0, 2%, 40%);
|
|
28
35
|
}
|
|
29
36
|
</style>
|
|
30
37
|
|
|
31
|
-
<script>import {
|
|
32
|
-
|
|
38
|
+
<script>import {
|
|
39
|
+
initParams,
|
|
40
|
+
initDefaults,
|
|
41
|
+
initControls,
|
|
42
|
+
initControlsState,
|
|
43
|
+
initOrientation
|
|
44
|
+
} from "./context";
|
|
45
|
+
import { getTheme, initTheme, evalTheme } from "../context";
|
|
33
46
|
initParams();
|
|
34
47
|
initDefaults();
|
|
35
48
|
initControls();
|
|
36
49
|
initControlsState();
|
|
37
|
-
const
|
|
50
|
+
const columns = initOrientation();
|
|
38
51
|
export let theme = void 0;
|
|
39
52
|
const parentTheme = getTheme();
|
|
40
|
-
const
|
|
53
|
+
const dark = initTheme();
|
|
41
54
|
$:
|
|
42
|
-
$
|
|
55
|
+
$dark = evalTheme(parentTheme ? $parentTheme : false, theme);
|
|
43
56
|
</script>
|
|
44
|
-
|
|
57
|
+
<!--
|
|
58
|
+
@component
|
|
59
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block) for more details.
|
|
60
|
+
-->
|
|
61
|
+
<div class:columns={$columns} class:dark={$dark}>
|
|
45
62
|
<slot />
|
|
46
63
|
</div>
|
|
47
64
|
|
|
@@ -14,6 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
export type BlockProps = typeof __propDef.props;
|
|
15
15
|
export type BlockEvents = typeof __propDef.events;
|
|
16
16
|
export type BlockSlots = typeof __propDef.slots;
|
|
17
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block) for more details. */
|
|
17
18
|
export default class Block extends SvelteComponentTyped<BlockProps, BlockEvents, BlockSlots> {
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
@@ -4,10 +4,15 @@ export let props = [];
|
|
|
4
4
|
export let hide = false;
|
|
5
5
|
export let position = void 0;
|
|
6
6
|
const controls = getControls();
|
|
7
|
-
|
|
7
|
+
$:
|
|
8
|
+
$controls = props;
|
|
8
9
|
const state = getControlsState();
|
|
9
10
|
$:
|
|
10
11
|
$state.hide = hide;
|
|
11
12
|
$:
|
|
12
13
|
$state.position = position;
|
|
13
14
|
</script>
|
|
15
|
+
<!--
|
|
16
|
+
@component
|
|
17
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/3-Controls) for more details.
|
|
18
|
+
-->
|
|
@@ -14,6 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
export type ControlsProps = typeof __propDef.props;
|
|
15
15
|
export type ControlsEvents = typeof __propDef.events;
|
|
16
16
|
export type ControlsSlots = typeof __propDef.slots;
|
|
17
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/3-Controls) for more details. */
|
|
17
18
|
export default class Controls extends SvelteComponentTyped<ControlsProps, ControlsEvents, ControlsSlots> {
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
@@ -1,11 +1,115 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
div {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
.instance {
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.cside {
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-columns: 1fr 550px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.content {
|
|
16
|
+
min-height: 100px;
|
|
17
|
+
border-radius: 5px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
div:not(.cside) > .misc {
|
|
21
|
+
border-bottom-left-radius: 5px;
|
|
22
|
+
border-bottom-right-radius: 5px;
|
|
23
|
+
user-select: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cside > .misc {
|
|
27
|
+
border-top-right-radius: 5px;
|
|
28
|
+
border-bottom-right-radius: 5px;
|
|
29
|
+
user-select: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.content,
|
|
33
|
+
.misc {
|
|
34
|
+
border-style: solid;
|
|
35
|
+
border-width: 1px;
|
|
36
|
+
padding: 2px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* scrollable */
|
|
40
|
+
.scrollable {
|
|
41
|
+
overflow: scroll;
|
|
42
|
+
scrollbar-width: none; /* Firefox */
|
|
43
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.scrollable::-webkit-scrollbar {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* colors */
|
|
51
|
+
.content,
|
|
52
|
+
.misc {
|
|
53
|
+
border-color: hsl(0, 2%, 60%);
|
|
54
|
+
background-color: hsl(0, 0%, 100%);
|
|
55
|
+
transition: border-color 350ms, background-color 350ms;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.dark.content,
|
|
59
|
+
.dark.misc {
|
|
60
|
+
border-color: hsl(0, 2%, 40%);
|
|
61
|
+
background-color: hsl(200, 4%, 14%);
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
64
|
+
|
|
65
|
+
<script>import { beforeUpdate } from "svelte";
|
|
66
|
+
import { cquery } from "./action";
|
|
67
|
+
import { getControls, getControlsState } from "./context";
|
|
68
|
+
import { getTheme } from "../context";
|
|
69
|
+
import Controls from "./controls/Controls.svelte";
|
|
70
|
+
import { resolve } from "./utils";
|
|
71
|
+
const controls = getControls();
|
|
72
|
+
const controlsState = getControlsState();
|
|
73
|
+
const dark = getTheme();
|
|
74
|
+
$:
|
|
75
|
+
expanded = $controls.length > 0 && !$controlsState.hide;
|
|
4
76
|
export let defaults = void 0;
|
|
5
77
|
export let noreset = false;
|
|
6
|
-
|
|
78
|
+
let key = false;
|
|
79
|
+
beforeUpdate(() => key = !key);
|
|
80
|
+
const resolveArgs = resolve;
|
|
81
|
+
let bound = {};
|
|
82
|
+
const updateBound = (d) => {
|
|
83
|
+
bound = resolve(d ?? {}, {});
|
|
84
|
+
};
|
|
85
|
+
$:
|
|
86
|
+
updateBound(defaults);
|
|
7
87
|
</script>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
88
|
+
<div
|
|
89
|
+
class="instance"
|
|
90
|
+
class:cside={expanded && "right" === $controlsState.position}
|
|
91
|
+
use:cquery={{
|
|
92
|
+
class: "cside",
|
|
93
|
+
min: 1000,
|
|
94
|
+
w: true,
|
|
95
|
+
enabled: expanded && $controlsState.position === undefined
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{#if noreset}
|
|
99
|
+
<div class="content scrollable" class:dark={$dark}>
|
|
100
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} {key} />
|
|
101
|
+
</div>
|
|
102
|
+
{:else}
|
|
103
|
+
{#key key}
|
|
104
|
+
<div class="content scrollable" class:dark={$dark}>
|
|
105
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} {key} />
|
|
106
|
+
</div>
|
|
107
|
+
{/key}
|
|
108
|
+
{/if}
|
|
109
|
+
{#if expanded}
|
|
110
|
+
<div class="misc scrollable" class:dark={$dark}>
|
|
111
|
+
<Controls infos={$controls} bind:values={bound} />
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
<script>import {
|
|
3
|
-
import { getParams, getDefaults } from "./context";
|
|
2
|
+
<script>import { getParams } from "./context";
|
|
4
3
|
import { resolve } from "./utils";
|
|
5
4
|
export let tag = void 0;
|
|
6
5
|
export let props = {};
|
|
7
|
-
const defaults = getDefaults();
|
|
8
6
|
const params = getParams();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
);
|
|
7
|
+
const id = $params.length;
|
|
8
|
+
$params.push({
|
|
9
|
+
id,
|
|
10
|
+
tag: tag ?? `${id}`,
|
|
11
|
+
values: resolve(props, {})
|
|
12
|
+
});
|
|
13
|
+
$:
|
|
14
|
+
$params[id].tag = tag ?? `${id}`;
|
|
15
|
+
$:
|
|
16
|
+
$params[id].values = resolve(props, {});
|
|
24
17
|
</script>
|
|
18
|
+
<!--
|
|
19
|
+
@component
|
|
20
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template/1-Params) for more details.
|
|
21
|
+
-->
|
|
@@ -13,6 +13,7 @@ declare const __propDef: {
|
|
|
13
13
|
export type ParamsProps = typeof __propDef.props;
|
|
14
14
|
export type ParamsEvents = typeof __propDef.events;
|
|
15
15
|
export type ParamsSlots = typeof __propDef.slots;
|
|
16
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template/1-Params) for more details. */
|
|
16
17
|
export default class Params extends SvelteComponentTyped<ParamsProps, ParamsEvents, ParamsSlots> {
|
|
17
18
|
}
|
|
18
19
|
export {};
|
|
@@ -1,162 +1,33 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
div {
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
}
|
|
5
1
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
grid-auto-flow: row;
|
|
13
|
-
border-radius: 5px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.template.columns {
|
|
17
|
-
grid-auto-rows: auto;
|
|
18
|
-
grid-auto-columns: 1fr;
|
|
19
|
-
grid-auto-flow: column;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.template > .cside {
|
|
23
|
-
display: grid;
|
|
24
|
-
grid-template-columns: 1fr 550px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.content {
|
|
28
|
-
min-height: 100px;
|
|
29
|
-
border-radius: 5px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
div:not(.cside) > .misc {
|
|
33
|
-
border-bottom-left-radius: 5px;
|
|
34
|
-
border-bottom-right-radius: 5px;
|
|
35
|
-
user-select: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.template > .cside > .misc {
|
|
39
|
-
border-top-right-radius: 5px;
|
|
40
|
-
border-bottom-right-radius: 5px;
|
|
41
|
-
user-select: none;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.instance {
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.content,
|
|
49
|
-
.misc {
|
|
50
|
-
margin: 3px;
|
|
51
|
-
border-style: solid;
|
|
52
|
-
border-width: 1px;
|
|
53
|
-
padding: 1px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* scrollable */
|
|
57
|
-
.scrollable {
|
|
58
|
-
overflow: scroll;
|
|
59
|
-
scrollbar-width: none; /* Firefox */
|
|
60
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.scrollable::-webkit-scrollbar {
|
|
64
|
-
display: none;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* colors */
|
|
68
|
-
.template {
|
|
69
|
-
color: hsl(0, 0%, 0%);
|
|
70
|
-
background-color: hsl(0, 2%, 70%);
|
|
71
|
-
transition: color 350ms, background-color 350ms;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.template.dark {
|
|
75
|
-
color-scheme: dark;
|
|
76
|
-
color: hsl(0, 0%, 80%);
|
|
77
|
-
background-color: hsl(0, 2%, 40%);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.content,
|
|
81
|
-
.misc {
|
|
82
|
-
border-color: hsl(0, 2%, 60%);
|
|
83
|
-
background-color: hsl(0, 0%, 100%);
|
|
84
|
-
transition: border-color 350ms, background-color 350ms;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.dark .content,
|
|
88
|
-
.dark .misc {
|
|
89
|
-
border-color: hsl(0, 2%, 40%);
|
|
90
|
-
background-color: hsl(200, 4%, 14%);
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
93
|
-
|
|
94
|
-
<script>import { getParams, getDefaults } from "./context";
|
|
95
|
-
import { getControls, getControlsState } from "./context";
|
|
2
|
+
<script>import { beforeUpdate } from "svelte";
|
|
3
|
+
import {
|
|
4
|
+
getDefaults,
|
|
5
|
+
getParams,
|
|
6
|
+
getOrientation
|
|
7
|
+
} from "./context";
|
|
96
8
|
import { resolve } from "./utils";
|
|
97
|
-
import
|
|
98
|
-
import Controls from "./controls/Controls.svelte";
|
|
99
|
-
import { cquery } from "./action";
|
|
100
|
-
import { beforeUpdate } from "svelte";
|
|
9
|
+
import Instance from "./Instance.svelte";
|
|
101
10
|
const params = getParams();
|
|
102
|
-
const controls = getControls();
|
|
103
|
-
const controlsState = getControlsState();
|
|
104
11
|
const defaultsStore = getDefaults();
|
|
105
|
-
const
|
|
12
|
+
const orientation = getOrientation();
|
|
106
13
|
export let defaults = void 0;
|
|
107
14
|
export let noreset = false;
|
|
108
15
|
export let columns = false;
|
|
109
|
-
const reset = () => {
|
|
110
|
-
$params = [];
|
|
111
|
-
$defaultsStore = defaults;
|
|
112
|
-
};
|
|
113
16
|
$:
|
|
114
|
-
$defaultsStore
|
|
115
|
-
const resolveArgs = resolve;
|
|
17
|
+
$defaultsStore = defaults ?? {};
|
|
116
18
|
$:
|
|
117
|
-
|
|
19
|
+
$orientation = columns;
|
|
20
|
+
const resolveArgs = resolve;
|
|
118
21
|
let key = false;
|
|
119
22
|
beforeUpdate(() => key = !key);
|
|
23
|
+
const cast = (t) => t;
|
|
120
24
|
</script>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
enabled: expanded && $controlsState.position === undefined
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
{#if noreset}
|
|
134
|
-
<div class="content scrollable" class:dark={$isDark}>
|
|
135
|
-
<slot
|
|
136
|
-
id={param.id}
|
|
137
|
-
tag={param.tag}
|
|
138
|
-
props={resolveArgs(param.defaults, param.values)}
|
|
139
|
-
{key}
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
{:else}
|
|
143
|
-
{#key key}
|
|
144
|
-
<div class="content scrollable" class:dark={$isDark}>
|
|
145
|
-
<slot
|
|
146
|
-
id={param.id}
|
|
147
|
-
tag={param.tag}
|
|
148
|
-
props={resolveArgs(param.defaults, param.values)}
|
|
149
|
-
{key}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
{/key}
|
|
153
|
-
{/if}
|
|
154
|
-
{#if expanded}
|
|
155
|
-
<div class="misc scrollable" class:dark={$isDark}>
|
|
156
|
-
<Controls infos={$controls} bind:values={param.values} />
|
|
157
|
-
</div>
|
|
158
|
-
{/if}
|
|
159
|
-
</div>
|
|
160
|
-
{/each}
|
|
161
|
-
</div>
|
|
162
|
-
|
|
25
|
+
<!--
|
|
26
|
+
@component
|
|
27
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template) for more details.
|
|
28
|
+
-->
|
|
29
|
+
{#each $params as param (param.id)}
|
|
30
|
+
<Instance defaults={resolveArgs($defaultsStore, param.values)} {noreset} let:key let:props>
|
|
31
|
+
<slot id={param.id} tag={param.tag} props={cast(props)} {key} />
|
|
32
|
+
</Instance>
|
|
33
|
+
{/each}
|
|
@@ -20,6 +20,7 @@ declare class __sveltets_Render<Args> {
|
|
|
20
20
|
export type TemplateProps<Args> = ReturnType<__sveltets_Render<Args>['props']>;
|
|
21
21
|
export type TemplateEvents<Args> = ReturnType<__sveltets_Render<Args>['events']>;
|
|
22
22
|
export type TemplateSlots<Args> = ReturnType<__sveltets_Render<Args>['slots']>;
|
|
23
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template) for more details. */
|
|
23
24
|
export default class Template<Args> extends SvelteComponentTyped<TemplateProps<Args>, TemplateEvents<Args>, TemplateSlots<Args>> {
|
|
24
25
|
}
|
|
25
26
|
export {};
|
|
@@ -7,7 +7,6 @@ export type Params = {
|
|
|
7
7
|
id: number;
|
|
8
8
|
tag: string;
|
|
9
9
|
values: Record<string, ValueType>;
|
|
10
|
-
defaults: Record<string, ValueType>;
|
|
11
10
|
};
|
|
12
11
|
export type ControlState = {
|
|
13
12
|
hide: boolean;
|
|
@@ -15,5 +14,6 @@ export type ControlState = {
|
|
|
15
14
|
};
|
|
16
15
|
export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
|
|
17
16
|
export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
|
|
18
|
-
export declare const initDefaults: () => Writable<Record<string, ValueType
|
|
17
|
+
export declare const initDefaults: () => Writable<Record<string, ValueType>>, getDefaults: () => Writable<Record<string, ValueType>>;
|
|
19
18
|
export declare const initControlsState: () => Writable<ControlState>, getControlsState: () => Writable<ControlState>;
|
|
19
|
+
export declare const initOrientation: () => Writable<boolean>, getOrientation: () => Writable<boolean>;
|
|
@@ -9,7 +9,8 @@ const create = (defaulter) => {
|
|
|
9
9
|
};
|
|
10
10
|
export const { init: initParams, get: getParams } = create(() => []);
|
|
11
11
|
export const { init: initControls, get: getControls } = create(() => []);
|
|
12
|
-
export const { init: initDefaults, get: getDefaults } = create(() =>
|
|
12
|
+
export const { init: initDefaults, get: getDefaults } = create(() => ({}));
|
|
13
13
|
export const { init: initControlsState, get: getControlsState } = create(() => ({
|
|
14
14
|
hide: false
|
|
15
15
|
}));
|
|
16
|
+
export const { init: initOrientation, get: getOrientation } = create(() => false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { getTheme } from "../../../context";
|
|
2
|
-
const
|
|
2
|
+
const dark = getTheme();
|
|
3
3
|
</script>
|
|
4
4
|
<style>
|
|
5
5
|
div {
|
|
@@ -79,7 +79,7 @@ const isDark = getTheme();
|
|
|
79
79
|
</style>
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
<div class:dark={$
|
|
82
|
+
<div class:dark={$dark}>
|
|
83
83
|
<slot />
|
|
84
84
|
</div>
|
|
85
85
|
|
package/components/context.d.ts
CHANGED
package/components/context.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { setContext, getContext } from "svelte";
|
|
2
2
|
import { writable } from "svelte/store";
|
|
3
|
-
const root = Symbol();
|
|
4
|
-
export const inRoot = () => {
|
|
5
|
-
const value = getContext(root);
|
|
6
|
-
setContext(root, false);
|
|
7
|
-
return value !== false;
|
|
8
|
-
};
|
|
9
3
|
const theme = Symbol();
|
|
10
4
|
export const getTheme = () => getContext(theme);
|
|
11
5
|
export const initTheme = () => setContext(theme, writable(true));
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
height: 100%;
|
|
9
9
|
display: grid;
|
|
10
10
|
grid-template-areas:
|
|
11
|
-
"
|
|
11
|
+
"A"
|
|
12
12
|
"divider"
|
|
13
|
-
"
|
|
13
|
+
"B";
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.container.vertical {
|
|
18
|
-
grid-template-areas: "
|
|
18
|
+
grid-template-areas: "A divider B";
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.container > div {
|
|
@@ -76,19 +76,19 @@
|
|
|
76
76
|
background-color: var(--color-p);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.container.moving:not(.
|
|
79
|
+
.container.moving:not(.b):not(.vertical) > .divider {
|
|
80
80
|
border-bottom: var(--color-s) solid 2.5px;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
.container.moving.
|
|
83
|
+
.container.moving.b:not(.vertical) > .divider {
|
|
84
84
|
border-top: var(--color-s) solid 2.5px;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.container.moving:not(.
|
|
87
|
+
.container.moving:not(.b).vertical > .divider {
|
|
88
88
|
border-right: var(--color-s) solid 2.5px;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
.container.moving.vertical.
|
|
91
|
+
.container.moving.vertical.b > .divider {
|
|
92
92
|
border-left: var(--color-s) solid 2.5px;
|
|
93
93
|
}
|
|
94
94
|
</style>
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
import { tweened } from "svelte/motion";
|
|
98
98
|
import { createDraggable } from "./action";
|
|
99
99
|
import { getTheme } from "../context";
|
|
100
|
-
const
|
|
100
|
+
const dark = getTheme();
|
|
101
101
|
export let vertical = false;
|
|
102
102
|
export let offset = 0;
|
|
103
|
-
export let
|
|
103
|
+
export let b = false;
|
|
104
104
|
let width;
|
|
105
105
|
let height;
|
|
106
106
|
const { position, draggable } = createDraggable(offset);
|
|
@@ -119,7 +119,7 @@ $:
|
|
|
119
119
|
$:
|
|
120
120
|
$off = offset;
|
|
121
121
|
$:
|
|
122
|
-
style = !
|
|
122
|
+
style = !b ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
|
|
123
123
|
const moving = writable(false);
|
|
124
124
|
const addLast = (v) => {
|
|
125
125
|
if (v > 10) {
|
|
@@ -149,8 +149,8 @@ const check = (v, flag, s) => {
|
|
|
149
149
|
<div
|
|
150
150
|
class="container"
|
|
151
151
|
class:vertical
|
|
152
|
-
class:
|
|
153
|
-
class:dark={$
|
|
152
|
+
class:b
|
|
153
|
+
class:dark={$dark}
|
|
154
154
|
class:moving={$moving}
|
|
155
155
|
bind:clientWidth={width}
|
|
156
156
|
bind:clientHeight={height}
|
|
@@ -158,9 +158,9 @@ const check = (v, flag, s) => {
|
|
|
158
158
|
style:grid-template-rows={!vertical ? style : null}
|
|
159
159
|
>
|
|
160
160
|
{#if width != null && height != null}
|
|
161
|
-
<div style:grid-area="
|
|
162
|
-
{#if check($off, !
|
|
163
|
-
<slot name="
|
|
161
|
+
<div style:grid-area="A">
|
|
162
|
+
{#if check($off, !b, span)}
|
|
163
|
+
<slot name="A" />
|
|
164
164
|
{/if}
|
|
165
165
|
</div>
|
|
166
166
|
<div class="divider">
|
|
@@ -168,7 +168,7 @@ const check = (v, flag, s) => {
|
|
|
168
168
|
class="overlay"
|
|
169
169
|
use:draggable={{
|
|
170
170
|
reset: () => offset,
|
|
171
|
-
reversed: !
|
|
171
|
+
reversed: !b,
|
|
172
172
|
vertical,
|
|
173
173
|
dbltap: dbltap,
|
|
174
174
|
tap: () => addLast($off),
|
|
@@ -176,9 +176,9 @@ const check = (v, flag, s) => {
|
|
|
176
176
|
}}
|
|
177
177
|
/>
|
|
178
178
|
</div>
|
|
179
|
-
<div style:grid-area="
|
|
180
|
-
{#if check($off,
|
|
181
|
-
<slot name="
|
|
179
|
+
<div style:grid-area="B">
|
|
180
|
+
{#if check($off, b, span)}
|
|
181
|
+
<slot name="B" />
|
|
182
182
|
{/if}
|
|
183
183
|
</div>
|
|
184
184
|
{/if}
|
|
@@ -3,14 +3,14 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
vertical?: boolean | undefined;
|
|
5
5
|
offset?: number | undefined;
|
|
6
|
-
|
|
6
|
+
b?: boolean | undefined;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
|
10
10
|
};
|
|
11
11
|
slots: {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
A: {};
|
|
13
|
+
B: {};
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
export type ContainerProps = typeof __propDef.props;
|