@nil-/doc 0.2.33 → 0.2.34
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 +8 -0
- package/components/block/Block.svelte +1 -8
- package/components/block/Controls.svelte +5 -2
- package/components/block/Controls.svelte.d.ts +2 -1
- package/components/block/Template.svelte +18 -18
- package/components/block/context.d.ts +2 -2
- package/components/block/context.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][new] added Control hide property ([#51](https://github.com/njaldea/mono/pull/51))
|
|
8
|
+
[doc][break] renamed Control expand property to hide
|
|
9
|
+
[doc][break] Control now defaults to show
|
|
10
|
+
|
|
3
11
|
## 0.2.33
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -27,16 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
</style>
|
|
29
29
|
|
|
30
|
-
<script>import {
|
|
31
|
-
initParams,
|
|
32
|
-
initCurrent,
|
|
33
|
-
initDefaults,
|
|
34
|
-
initControls,
|
|
35
|
-
initControlsState
|
|
36
|
-
} from "./context";
|
|
30
|
+
<script>import { initParams, initDefaults, initControls, initControlsState } from "./context";
|
|
37
31
|
import { inRoot, getTheme, initTheme, evalTheme } from "../context";
|
|
38
32
|
initParams();
|
|
39
|
-
initCurrent();
|
|
40
33
|
initDefaults();
|
|
41
34
|
initControls();
|
|
42
35
|
initControlsState();
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getControls, getControlsState } from "./context";
|
|
3
3
|
export let props = [];
|
|
4
|
-
export let
|
|
4
|
+
export let hide = false;
|
|
5
|
+
export let side = false;
|
|
5
6
|
const controls = getControls();
|
|
6
7
|
$controls = props;
|
|
7
8
|
const state = getControlsState();
|
|
8
9
|
$:
|
|
9
|
-
$state.
|
|
10
|
+
$state.hide = hide;
|
|
11
|
+
$:
|
|
12
|
+
$state.side = side;
|
|
10
13
|
</script>
|
|
@@ -3,7 +3,8 @@ import type { Control } from "./controls/types";
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
props?: Control[] | undefined;
|
|
6
|
-
|
|
6
|
+
hide?: boolean | undefined;
|
|
7
|
+
side?: boolean | undefined;
|
|
7
8
|
};
|
|
8
9
|
events: {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
gap: 5px;
|
|
5
5
|
padding-bottom: 10px;
|
|
6
6
|
padding-top: 10px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.template:not(.column) {
|
|
10
7
|
grid-auto-rows: 1fr;
|
|
11
8
|
grid-auto-columns: auto;
|
|
12
9
|
grid-auto-flow: row;
|
|
@@ -18,17 +15,28 @@
|
|
|
18
15
|
grid-auto-flow: column;
|
|
19
16
|
}
|
|
20
17
|
|
|
18
|
+
.template > .cside {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: 1fr 550px;
|
|
21
|
+
}
|
|
22
|
+
|
|
21
23
|
.content {
|
|
22
24
|
min-height: 100px;
|
|
23
25
|
border-radius: 5px 5px 5px 5px;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
.misc {
|
|
28
|
+
div:not(.cside) > .misc {
|
|
27
29
|
border-bottom-left-radius: 5px;
|
|
28
30
|
border-bottom-right-radius: 5px;
|
|
29
31
|
user-select: none;
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
.cside > .misc {
|
|
35
|
+
border-top-right-radius: 5px;
|
|
36
|
+
border-bottom-right-radius: 5px;
|
|
37
|
+
user-select: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
.template > div > div {
|
|
33
41
|
margin: 3px;
|
|
34
42
|
}
|
|
@@ -63,17 +71,14 @@
|
|
|
63
71
|
outline: hsl(0, 2%, 40%) solid 1px;
|
|
64
72
|
}
|
|
65
73
|
</style>
|
|
66
|
-
<svelte:window on:click={() => ($current = null)} />
|
|
67
74
|
|
|
68
|
-
<script>import { getParams,
|
|
75
|
+
<script>import { getParams, getDefaults } from "./context";
|
|
69
76
|
import { getControls, getControlsState } from "./context";
|
|
70
77
|
import { resolve } from "./utils";
|
|
71
78
|
import { getTheme } from "../context";
|
|
72
79
|
import Controls from "./controls/Controls.svelte";
|
|
73
80
|
import { beforeUpdate } from "svelte";
|
|
74
|
-
import { slide } from "svelte/transition";
|
|
75
81
|
const params = getParams();
|
|
76
|
-
const current = getCurrent();
|
|
77
82
|
const controls = getControls();
|
|
78
83
|
const controlsState = getControlsState();
|
|
79
84
|
const defaultsStore = getDefaults();
|
|
@@ -87,20 +92,15 @@ const reset = () => {
|
|
|
87
92
|
};
|
|
88
93
|
$:
|
|
89
94
|
$defaultsStore, reset();
|
|
90
|
-
let hovered = null;
|
|
91
95
|
let key = false;
|
|
92
96
|
beforeUpdate(() => key = !key);
|
|
93
97
|
const resolveArgs = resolve;
|
|
98
|
+
$:
|
|
99
|
+
expanded = $controls.length > 0 && !$controlsState.hide;
|
|
94
100
|
</script>
|
|
95
101
|
<div class="template" class:columns>
|
|
96
102
|
{#each $params as param (param.id)}
|
|
97
|
-
<div
|
|
98
|
-
class="scrollable"
|
|
99
|
-
on:click|stopPropagation={() => ($current = param.id)}
|
|
100
|
-
on:mouseenter={() => (hovered = param.id)}
|
|
101
|
-
on:mouseleave={() => (hovered = null)}
|
|
102
|
-
on:keypress={null}
|
|
103
|
-
>
|
|
103
|
+
<div class="scrollable" class:cside={$controlsState.side && expanded}>
|
|
104
104
|
{#if noreset}
|
|
105
105
|
<div class="content scrollable" class:dark={$isDark}>
|
|
106
106
|
<slot
|
|
@@ -122,8 +122,8 @@ const resolveArgs = resolve;
|
|
|
122
122
|
</div>
|
|
123
123
|
{/key}
|
|
124
124
|
{/if}
|
|
125
|
-
{#if
|
|
126
|
-
<div class="misc scrollable" class:dark={$isDark}
|
|
125
|
+
{#if expanded}
|
|
126
|
+
<div class="misc scrollable" class:dark={$isDark}>
|
|
127
127
|
<Controls infos={$controls} bind:values={param.values} />
|
|
128
128
|
</div>
|
|
129
129
|
{/if}
|
|
@@ -10,9 +10,9 @@ export type Params = {
|
|
|
10
10
|
defaults: Record<string, ValueType>;
|
|
11
11
|
};
|
|
12
12
|
export type ControlState = {
|
|
13
|
-
|
|
13
|
+
hide: boolean;
|
|
14
|
+
side: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare const initCurrent: () => Writable<number | null>, getCurrent: () => Writable<number | null>;
|
|
16
16
|
export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
|
|
17
17
|
export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
|
|
18
18
|
export declare const initDefaults: () => Writable<Record<string, ValueType> | null>, getDefaults: () => Writable<Record<string, ValueType> | null>;
|
|
@@ -7,10 +7,10 @@ const create = (defaulter) => {
|
|
|
7
7
|
get: () => getContext(symbol)
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export const { init: initCurrent, get: getCurrent } = create(() => null);
|
|
11
10
|
export const { init: initParams, get: getParams } = create(() => []);
|
|
12
11
|
export const { init: initControls, get: getControls } = create(() => []);
|
|
13
12
|
export const { init: initDefaults, get: getDefaults } = create(() => null);
|
|
14
13
|
export const { init: initControlsState, get: getControlsState } = create(() => ({
|
|
15
|
-
|
|
14
|
+
hide: false,
|
|
15
|
+
side: false
|
|
16
16
|
}));
|