@nil-/doc 0.3.0 → 0.3.1
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/components/block/Instance.svelte +4 -4
- package/components/block/controls/Controls.svelte +52 -16
- package/components/block/controls/Controls.svelte.d.ts +3 -1
- package/components/block/controls/props/Color.svelte +1 -1
- package/components/block/controls/props/Range.svelte +4 -0
- package/components/block/icons/ControlView.svelte +2 -2
- package/components/block/icons/ControlView.svelte.d.ts +1 -1
- package/components/layout/Layout.svelte +3 -2
- package/components/layout/Layout.svelte.d.ts +1 -0
- package/package.json +1 -1
- package/sveltekit/index.d.ts +1 -0
- package/sveltekit/index.js +5 -1
|
@@ -43,16 +43,16 @@ const populate = (ext) => {
|
|
|
43
43
|
obj[name] = (ev) => {
|
|
44
44
|
const detail = stringify(ev.detail);
|
|
45
45
|
if ($values.events.length > 0) {
|
|
46
|
-
const last = $values.events[
|
|
46
|
+
const last = $values.events[0];
|
|
47
47
|
if (last.name === name && last.detail === detail && last.count < 99) {
|
|
48
48
|
last.count += 1;
|
|
49
49
|
$values.events = $values.events;
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
$values.events.
|
|
54
|
-
if ($values.events.length >
|
|
55
|
-
$values.events.
|
|
53
|
+
$values.events.unshift({ name, detail, count: 1 });
|
|
54
|
+
if ($values.events.length > 50) {
|
|
55
|
+
$values.events.pop();
|
|
56
56
|
}
|
|
57
57
|
$values.events = $values.events;
|
|
58
58
|
};
|
|
@@ -2,42 +2,78 @@
|
|
|
2
2
|
import Props from "./props/Props.svelte";
|
|
3
3
|
import Events from "./events/Events.svelte";
|
|
4
4
|
import { getControlInfo, getControlValue } from "../context";
|
|
5
|
+
import Button from "../icons/Button.svelte";
|
|
6
|
+
import ControlView from "../icons/ControlView.svelte";
|
|
7
|
+
import Position from "../icons/Position.svelte";
|
|
5
8
|
const controls = getControlInfo();
|
|
6
9
|
const values = getControlValue();
|
|
7
10
|
$:
|
|
8
11
|
cc = $controls;
|
|
9
12
|
$:
|
|
10
13
|
vv = $values;
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
let mode = "props";
|
|
15
|
+
export let position = "bottom";
|
|
16
|
+
const cyclePosition = () => {
|
|
17
|
+
switch (position) {
|
|
18
|
+
case "bottom":
|
|
19
|
+
position = "right";
|
|
20
|
+
break;
|
|
21
|
+
case "right":
|
|
22
|
+
position = "bottom";
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const cycleMode = () => {
|
|
27
|
+
switch (mode) {
|
|
28
|
+
case "events":
|
|
29
|
+
mode = "props";
|
|
30
|
+
break;
|
|
31
|
+
case "props":
|
|
32
|
+
mode = "events";
|
|
33
|
+
break;
|
|
17
34
|
}
|
|
18
35
|
};
|
|
19
36
|
</script>
|
|
20
37
|
|
|
21
|
-
<Styler type={
|
|
22
|
-
|
|
23
|
-
<div
|
|
38
|
+
<Styler type={mode}>
|
|
39
|
+
<div class="header">
|
|
40
|
+
<div class="buttons">
|
|
41
|
+
<Button scale on:click={cyclePosition} title={position}>
|
|
42
|
+
<Position {position} />
|
|
43
|
+
</Button>
|
|
44
|
+
<Button scale on:click={cycleMode} title={mode}>
|
|
45
|
+
<ControlView {mode} />
|
|
46
|
+
</Button>
|
|
47
|
+
</div>
|
|
48
|
+
{#if mode === "props"}
|
|
24
49
|
<div>Name</div>
|
|
25
50
|
<div>Value</div>
|
|
26
51
|
<div>Use</div>
|
|
27
|
-
|
|
28
|
-
{:else if style === "events"}
|
|
29
|
-
<div on:dblclick={cycle} on:keypress={null}>
|
|
52
|
+
{:else if mode === "events"}
|
|
30
53
|
<div>Events</div>
|
|
31
54
|
<div>Detail</div>
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
34
57
|
{#key $values && $controls}
|
|
35
58
|
{#if cc != null && $cc != null && vv != null && $vv != null}
|
|
36
|
-
<Props infos={$cc.props} visible={
|
|
37
|
-
<Events events={$vv.events} visible={
|
|
59
|
+
<Props infos={$cc.props} visible={mode === "props"} bind:values={$vv.props} />
|
|
60
|
+
<Events events={$vv.events} visible={mode === "events"} />
|
|
38
61
|
{/if}
|
|
39
62
|
{/key}
|
|
40
63
|
</Styler>
|
|
41
64
|
|
|
42
65
|
<style>
|
|
66
|
+
.header {
|
|
67
|
+
position: relative;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.buttons {
|
|
71
|
+
position: absolute;
|
|
72
|
+
width: 3.5rem;
|
|
73
|
+
height: 1.75rem;
|
|
74
|
+
left: 0.3rem;
|
|
75
|
+
top: 0.15rem;
|
|
76
|
+
display: flex;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
}
|
|
43
79
|
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>export let mode = "
|
|
3
|
+
<script>export let mode = "props";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<svg viewBox="-50 -50 100 100">
|
|
7
7
|
<rect width="60" height="60" x="-30" y="-30" fill="transparent" />
|
|
8
8
|
<rect
|
|
9
|
-
x={mode === "
|
|
9
|
+
x={mode === "props" ? 0 : -20}
|
|
10
10
|
class="mv"
|
|
11
11
|
height="40"
|
|
12
12
|
width="20"
|
|
@@ -19,6 +19,7 @@ export let sorter = null;
|
|
|
19
19
|
export let renamer = null;
|
|
20
20
|
export let theme = void 0;
|
|
21
21
|
export let offset = 250;
|
|
22
|
+
export let panel_pos = "bottom";
|
|
22
23
|
initControlInfo();
|
|
23
24
|
initControlValue();
|
|
24
25
|
const parentTheme = getTheme();
|
|
@@ -66,7 +67,7 @@ const toggle = () => {
|
|
|
66
67
|
</Scrollable>
|
|
67
68
|
</svelte:fragment>
|
|
68
69
|
<svelte:fragment slot="B">
|
|
69
|
-
<Container offset={100}>
|
|
70
|
+
<Container offset={100} vertical={panel_pos === "right"}>
|
|
70
71
|
<svelte:fragment slot="A">
|
|
71
72
|
<Scrollable>
|
|
72
73
|
<Content>
|
|
@@ -77,7 +78,7 @@ const toggle = () => {
|
|
|
77
78
|
</Scrollable>
|
|
78
79
|
</svelte:fragment>
|
|
79
80
|
<svelte:fragment slot="B">
|
|
80
|
-
<Controls />
|
|
81
|
+
<Controls bind:position={panel_pos} />
|
|
81
82
|
</svelte:fragment>
|
|
82
83
|
</Container>
|
|
83
84
|
</svelte:fragment>
|
package/package.json
CHANGED
package/sveltekit/index.d.ts
CHANGED
package/sveltekit/index.js
CHANGED
|
@@ -22,6 +22,8 @@ export const sveltekit = (detail, prefix = null) => {
|
|
|
22
22
|
const theme = browser && "light" === localStorage.getItem(keyTheme) ? "light" : "dark";
|
|
23
23
|
const keyOffset = "@nil-/doc/offset";
|
|
24
24
|
const offset = browser ? parseFloat(localStorage.getItem(keyOffset) ?? "250") : 250;
|
|
25
|
+
const keyPos = "@nil-/doc/panel_pos";
|
|
26
|
+
const panel_pos = browser ? localStorage.getItem(keyPos) ?? "bottom" : "bottom";
|
|
25
27
|
const result = {
|
|
26
28
|
data: Object.keys(detail)
|
|
27
29
|
.map(toRoute)
|
|
@@ -39,9 +41,11 @@ export const sveltekit = (detail, prefix = null) => {
|
|
|
39
41
|
}),
|
|
40
42
|
navigate: prefix ? (e) => goto(`${prefix}${e.detail}`) : (e) => goto(e.detail),
|
|
41
43
|
theme: writable(theme),
|
|
42
|
-
offset: writable(offset)
|
|
44
|
+
offset: writable(offset),
|
|
45
|
+
panel_pos: writable(panel_pos)
|
|
43
46
|
};
|
|
44
47
|
browser && result.theme.subscribe((v) => localStorage.setItem(keyTheme, v));
|
|
45
48
|
browser && result.offset.subscribe((v) => localStorage.setItem(keyOffset, `${v}`));
|
|
49
|
+
browser && result.panel_pos.subscribe((v) => localStorage.setItem(keyPos, v));
|
|
46
50
|
return result;
|
|
47
51
|
};
|