@nil-/doc 0.2.45 → 0.2.47
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 +14 -0
- package/components/block/Controls.svelte +2 -1
- package/components/block/Controls.svelte.d.ts +3 -2
- package/components/block/Instance.svelte +39 -8
- package/components/block/Instance.svelte.d.ts +9 -7
- package/components/block/Template.svelte +2 -1
- package/components/block/Template.svelte.d.ts +1 -0
- package/components/block/context.d.ts +7 -2
- package/components/block/context.js +4 -1
- package/components/block/controls/events/Events.svelte +69 -0
- package/components/block/controls/events/Events.svelte.d.ts +21 -0
- package/components/block/controls/events/misc/Styler.svelte +83 -0
- package/components/block/controls/{misc → events/misc}/Styler.svelte.d.ts +0 -0
- package/components/block/controls/props/Component.svelte +49 -0
- package/components/block/controls/{Component.svelte.d.ts → props/Component.svelte.d.ts} +2 -2
- package/components/block/controls/{Number.svelte → props/Number.svelte} +4 -2
- package/components/block/controls/{Number.svelte.d.ts → props/Number.svelte.d.ts} +2 -2
- package/components/block/controls/{Object.svelte → props/Object.svelte} +5 -3
- package/components/block/controls/{Object.svelte.d.ts → props/Object.svelte.d.ts} +3 -3
- package/components/block/controls/props/Props.svelte +19 -0
- package/components/block/controls/props/Props.svelte.d.ts +22 -0
- package/components/block/controls/{Range.svelte → props/Range.svelte} +13 -5
- package/components/block/controls/{Range.svelte.d.ts → props/Range.svelte.d.ts} +2 -2
- package/components/block/controls/{Select.svelte → props/Select.svelte} +8 -4
- package/components/block/controls/{Select.svelte.d.ts → props/Select.svelte.d.ts} +2 -2
- package/components/block/controls/{Switch.svelte → props/Switch.svelte} +4 -2
- package/components/block/controls/{Switch.svelte.d.ts → props/Switch.svelte.d.ts} +2 -2
- package/components/block/controls/{Text.svelte → props/Text.svelte} +4 -2
- package/components/block/controls/{Text.svelte.d.ts → props/Text.svelte.d.ts} +2 -2
- package/components/block/controls/props/Tuple.svelte +39 -0
- package/components/block/controls/{Tuple.svelte.d.ts → props/Tuple.svelte.d.ts} +3 -3
- package/components/block/controls/{misc → props/misc}/GroupHeader.svelte +0 -0
- package/components/block/controls/{misc → props/misc}/GroupHeader.svelte.d.ts +0 -0
- package/components/block/controls/{misc → props/misc}/Name.svelte +0 -0
- package/components/block/controls/{misc → props/misc}/Name.svelte.d.ts +0 -0
- package/components/block/controls/{misc → props/misc}/Styler.svelte +25 -26
- package/components/block/controls/props/misc/Styler.svelte.d.ts +16 -0
- package/components/block/controls/props/misc/defaulter.d.ts +12 -0
- package/components/block/controls/props/misc/defaulter.js +71 -0
- package/components/block/controls/types.d.ts +55 -60
- package/components/etc/Container.svelte +4 -0
- package/components/navigation/types.d.ts +1 -1
- package/components/navigation/utils/renamer.d.ts +1 -5
- package/components/navigation/utils/renamer.js +2 -5
- package/components/navigation/utils/sorter.d.ts +1 -6
- package/components/navigation/utils/sorter.js +2 -6
- package/index.d.ts +1 -1
- package/package.json +5 -5
- package/components/block/controls/Component.svelte +0 -29
- package/components/block/controls/Controls.svelte +0 -13
- package/components/block/controls/Controls.svelte.d.ts +0 -19
- package/components/block/controls/Tuple.svelte +0 -27
- package/components/block/controls/misc/TopHeader.svelte +0 -12
- package/components/block/controls/misc/TopHeader.svelte.d.ts +0 -23
- package/components/block/controls/misc/defaulter.d.ts +0 -10
- package/components/block/controls/misc/defaulter.js +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.47
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][docu] minor adjustments to documentation ([#79](https://github.com/njaldea/mono/pull/79))
|
|
8
|
+
|
|
9
|
+
- [doc][new] added support for flattened prop schema ([#79](https://github.com/njaldea/mono/pull/79))
|
|
10
|
+
|
|
11
|
+
## 0.2.46
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [doc][break] added event control support ([#77](https://github.com/njaldea/mono/pull/77))
|
|
16
|
+
|
|
3
17
|
## 0.2.45
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getControls, getControlsState } from "./context";
|
|
3
3
|
export let props = [];
|
|
4
|
+
export let events = [];
|
|
4
5
|
export let hide = false;
|
|
5
6
|
export let position = void 0;
|
|
6
7
|
const controls = getControls();
|
|
7
8
|
$:
|
|
8
|
-
$controls = props;
|
|
9
|
+
$controls = { props, events };
|
|
9
10
|
const state = getControlsState();
|
|
10
11
|
$:
|
|
11
12
|
$state.hide = hide;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Prop } from "./controls/types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
props?:
|
|
5
|
+
props?: Prop[] | undefined;
|
|
6
|
+
events?: string[] | undefined;
|
|
6
7
|
hide?: boolean | undefined;
|
|
7
8
|
position?: undefined | "bottom" | "right";
|
|
8
9
|
};
|
|
@@ -74,13 +74,27 @@
|
|
|
74
74
|
import { cquery } from "./action";
|
|
75
75
|
import { getControls, getControlsState } from "./context";
|
|
76
76
|
import { getTheme } from "../context";
|
|
77
|
-
import
|
|
77
|
+
import Props from "./controls/props/Props.svelte";
|
|
78
|
+
import Events from "./controls/events/Events.svelte";
|
|
78
79
|
import { resolve } from "./utils";
|
|
79
80
|
const controls = getControls();
|
|
80
81
|
const controlsState = getControlsState();
|
|
81
82
|
const dark = getTheme();
|
|
82
83
|
$:
|
|
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;
|
|
84
98
|
export let defaults = void 0;
|
|
85
99
|
export let noreset = false;
|
|
86
100
|
export let scale = false;
|
|
@@ -88,12 +102,15 @@ let key = false;
|
|
|
88
102
|
beforeUpdate(() => key = !key);
|
|
89
103
|
const resolveArgs = resolve;
|
|
90
104
|
let bound = {};
|
|
91
|
-
const updateBound = (d) => {
|
|
92
|
-
bound = resolve(d ?? {}, {});
|
|
93
|
-
};
|
|
105
|
+
const updateBound = (d) => bound = resolve(d ?? {}, {});
|
|
94
106
|
$:
|
|
95
107
|
updateBound(defaults);
|
|
108
|
+
let handlers;
|
|
96
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
|
+
-->
|
|
97
114
|
<div
|
|
98
115
|
class="instance"
|
|
99
116
|
class:scale
|
|
@@ -107,18 +124,32 @@ $:
|
|
|
107
124
|
>
|
|
108
125
|
{#if noreset}
|
|
109
126
|
<div class="content scrollable" class:dark={$dark}>
|
|
110
|
-
<slot props={resolveArgs(defaults ?? {}, bound)} {key} />
|
|
127
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
111
128
|
</div>
|
|
112
129
|
{:else}
|
|
113
130
|
{#key key}
|
|
114
131
|
<div class="content scrollable" class:dark={$dark}>
|
|
115
|
-
<slot props={resolveArgs(defaults ?? {}, bound)} {key} />
|
|
132
|
+
<slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
|
|
116
133
|
</div>
|
|
117
134
|
{/key}
|
|
118
135
|
{/if}
|
|
119
136
|
{#if expanded}
|
|
120
137
|
<div class="misc scrollable" class:dark={$dark}>
|
|
121
|
-
<
|
|
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>
|
|
122
153
|
</div>
|
|
123
154
|
{/if}
|
|
124
155
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare class __sveltets_Render<
|
|
2
|
+
declare class __sveltets_Render<PropArgs> {
|
|
3
3
|
props(): {
|
|
4
|
-
defaults?:
|
|
4
|
+
defaults?: PropArgs | undefined;
|
|
5
5
|
noreset?: boolean | undefined;
|
|
6
6
|
scale?: boolean | undefined;
|
|
7
7
|
};
|
|
@@ -10,14 +10,16 @@ declare class __sveltets_Render<Args> {
|
|
|
10
10
|
};
|
|
11
11
|
slots(): {
|
|
12
12
|
default: {
|
|
13
|
-
props:
|
|
13
|
+
props: PropArgs;
|
|
14
|
+
events: Record<string, (ev: CustomEvent<unknown>) => void>;
|
|
14
15
|
key: boolean;
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
export type InstanceProps<
|
|
19
|
-
export type InstanceEvents<
|
|
20
|
-
export type InstanceSlots<
|
|
21
|
-
|
|
19
|
+
export type InstanceProps<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['props']>;
|
|
20
|
+
export type InstanceEvents<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['events']>;
|
|
21
|
+
export type InstanceSlots<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['slots']>;
|
|
22
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details. */
|
|
23
|
+
export default class Instance<PropArgs> extends SvelteComponentTyped<InstanceProps<PropArgs>, InstanceEvents<PropArgs>, InstanceSlots<PropArgs>> {
|
|
22
24
|
}
|
|
23
25
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Writable } from "svelte/store";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Prop, Event } from "./controls/types";
|
|
3
3
|
import type { ValueType } from "./types";
|
|
4
4
|
export type Params = {
|
|
5
5
|
id: number;
|
|
@@ -11,7 +11,12 @@ export type ControlState = {
|
|
|
11
11
|
position?: "bottom" | "right";
|
|
12
12
|
};
|
|
13
13
|
export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
|
|
14
|
-
|
|
14
|
+
type Controls = {
|
|
15
|
+
props: Prop[];
|
|
16
|
+
events: Event[];
|
|
17
|
+
};
|
|
18
|
+
export declare const initControls: () => Writable<Controls>, getControls: () => Writable<Controls>;
|
|
15
19
|
export declare const initDefaults: () => Writable<Record<string, ValueType>>, getDefaults: () => Writable<Record<string, ValueType>>;
|
|
16
20
|
export declare const initControlsState: () => Writable<ControlState>, getControlsState: () => Writable<ControlState>;
|
|
17
21
|
export declare const initOrientation: () => Writable<boolean>, getOrientation: () => Writable<boolean>;
|
|
22
|
+
export {};
|
|
@@ -8,7 +8,10 @@ const create = (defaulter) => {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export const { init: initParams, get: getParams } = create(() => []);
|
|
11
|
-
export const { init: initControls, get: getControls } = create(() =>
|
|
11
|
+
export const { init: initControls, get: getControls } = create(() => ({
|
|
12
|
+
props: [],
|
|
13
|
+
events: []
|
|
14
|
+
}));
|
|
12
15
|
export const { init: initDefaults, get: getDefaults } = create(() => ({}));
|
|
13
16
|
export const { init: initControlsState, get: getControlsState } = create(() => ({
|
|
14
17
|
hide: false
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.count {
|
|
3
|
+
display: grid;
|
|
4
|
+
place-items: center;
|
|
5
|
+
text-align: center;
|
|
6
|
+
font-size: 0.8rem;
|
|
7
|
+
}
|
|
8
|
+
</style>
|
|
9
|
+
|
|
10
|
+
<script>import Styler from "./misc/Styler.svelte";
|
|
11
|
+
export let visible;
|
|
12
|
+
export let events;
|
|
13
|
+
export let handlers;
|
|
14
|
+
let history = [];
|
|
15
|
+
const stringify = (detail) => {
|
|
16
|
+
if (detail) {
|
|
17
|
+
if (typeof detail === "string") {
|
|
18
|
+
return detail;
|
|
19
|
+
}
|
|
20
|
+
return JSON.stringify(detail);
|
|
21
|
+
}
|
|
22
|
+
return "";
|
|
23
|
+
};
|
|
24
|
+
const wrap = (ext) => {
|
|
25
|
+
const obj = {};
|
|
26
|
+
if (ext != null) {
|
|
27
|
+
for (const name of ext) {
|
|
28
|
+
obj[name] = (ev) => {
|
|
29
|
+
const detail = stringify(ev.detail);
|
|
30
|
+
if (history.length > 0) {
|
|
31
|
+
const last = history[history.length - 1];
|
|
32
|
+
if (last.name === name && last.detail === detail && last.count < 99) {
|
|
33
|
+
last.count += 1;
|
|
34
|
+
history = history;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
history.push({ name, detail, count: 1 });
|
|
39
|
+
if (history.length > 10) {
|
|
40
|
+
history.shift();
|
|
41
|
+
}
|
|
42
|
+
history = history;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return obj;
|
|
47
|
+
};
|
|
48
|
+
$:
|
|
49
|
+
handlers = wrap(events);
|
|
50
|
+
</script>
|
|
51
|
+
{#if visible}
|
|
52
|
+
<Styler>
|
|
53
|
+
<slot />
|
|
54
|
+
{#each history as { count, detail, name }, i (i)}
|
|
55
|
+
<div>
|
|
56
|
+
<div>
|
|
57
|
+
<div>{name}</div>
|
|
58
|
+
<div class="count">
|
|
59
|
+
{#if count > 1}
|
|
60
|
+
[{count.toString().padStart(2, "0")}]
|
|
61
|
+
{/if}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div>{detail}</div>
|
|
65
|
+
</div>
|
|
66
|
+
{/each}
|
|
67
|
+
</Styler>
|
|
68
|
+
{/if}
|
|
69
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Event } from "../types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
events: Event[];
|
|
7
|
+
handlers: Record<string, (ev: CustomEvent<unknown>) => void> | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type EventsProps = typeof __propDef.props;
|
|
17
|
+
export type EventsEvents = typeof __propDef.events;
|
|
18
|
+
export type EventsSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Events extends SvelteComponentTyped<EventsProps, EventsEvents, EventsSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script>import { getTheme } from "../../../../context";
|
|
2
|
+
const dark = getTheme();
|
|
3
|
+
</script>
|
|
4
|
+
<style>
|
|
5
|
+
div {
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 330px;
|
|
8
|
+
min-width: 500px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-auto-rows: 30px;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div :global(*),
|
|
16
|
+
div :global(*::before),
|
|
17
|
+
div :global(*::after) {
|
|
18
|
+
box-sizing: inherit;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div > :global(div) {
|
|
22
|
+
display: grid;
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding: 2px 0px;
|
|
25
|
+
grid-template-columns: 1fr 2fr;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
div > :global(div > div) {
|
|
29
|
+
padding: 0px 10px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
div > :global(div:first-child) {
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
div > :global(div:not(:first-child) > div:first-child) {
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: 1fr 30px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* colors */
|
|
42
|
+
div {
|
|
43
|
+
--pri-color: hsl(0, 0%, 100%);
|
|
44
|
+
--sec-color: hsl(210, 29%, 97%);
|
|
45
|
+
--hover-color: hsl(210, 100%, 90%);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
div.dark {
|
|
49
|
+
--pri-color: hsl(213, 26%, 7%);
|
|
50
|
+
--sec-color: hsl(213, 26%, 11%);
|
|
51
|
+
--hover-color: hsl(203, 100%, 15%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
div {
|
|
55
|
+
transition: background-color 150ms;
|
|
56
|
+
background-repeat: repeat;
|
|
57
|
+
background-size: 100% 60px;
|
|
58
|
+
background-image: linear-gradient(to bottom, var(--pri-color) 30px, var(--sec-color) 30px);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
div > :global(div:nth-child(n + 2):hover) {
|
|
62
|
+
background-color: var(--hover-color);
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<!--
|
|
68
|
+
<div> this component
|
|
69
|
+
<div> Header
|
|
70
|
+
<div></div>
|
|
71
|
+
<div></div>
|
|
72
|
+
</div>
|
|
73
|
+
<div> Controls
|
|
74
|
+
<div></div>
|
|
75
|
+
<div></div>
|
|
76
|
+
</div>
|
|
77
|
+
...
|
|
78
|
+
</div>
|
|
79
|
+
-->
|
|
80
|
+
<div class:dark={$dark}>
|
|
81
|
+
<slot />
|
|
82
|
+
</div>
|
|
83
|
+
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
<script>import Text from "./Text.svelte";
|
|
3
|
+
import Number from "./Number.svelte";
|
|
4
|
+
import Range from "./Range.svelte";
|
|
5
|
+
import Switch from "./Switch.svelte";
|
|
6
|
+
import Select from "./Select.svelte";
|
|
7
|
+
import Tuple from "./Tuple.svelte";
|
|
8
|
+
import Object from "./Object.svelte";
|
|
9
|
+
export let value;
|
|
10
|
+
export let info;
|
|
11
|
+
export let depth;
|
|
12
|
+
export let disabled = false;
|
|
13
|
+
export let visible = false;
|
|
14
|
+
</script>
|
|
15
|
+
{#if info instanceof Array}
|
|
16
|
+
{@const type = info[1]}
|
|
17
|
+
{#if "object" === type}
|
|
18
|
+
<Object {info} bind:value {depth} {disabled} {visible} />
|
|
19
|
+
{:else if "tuple" === type}
|
|
20
|
+
<Tuple {info} bind:value {depth} {disabled} {visible} />
|
|
21
|
+
{:else if "text" === type}
|
|
22
|
+
<Text {info} bind:value {depth} {disabled} {visible} />
|
|
23
|
+
{:else if "number" === type}
|
|
24
|
+
<Number {info} bind:value {depth} {disabled} {visible} />
|
|
25
|
+
{:else if "range" === type}
|
|
26
|
+
<Range {info} bind:value {depth} {disabled} {visible} />
|
|
27
|
+
{:else if "select" === type}
|
|
28
|
+
<Select {info} bind:value {depth} {disabled} {visible} />
|
|
29
|
+
{:else if "switch" === type}
|
|
30
|
+
<Switch {info} bind:value {depth} {disabled} {visible} />
|
|
31
|
+
{/if}
|
|
32
|
+
{:else}
|
|
33
|
+
{@const type = info.type}
|
|
34
|
+
{#if "object" === type}
|
|
35
|
+
<Object {info} bind:value {depth} {disabled} {visible} />
|
|
36
|
+
{:else if "tuple" === type}
|
|
37
|
+
<Tuple {info} bind:value {depth} {disabled} {visible} />
|
|
38
|
+
{:else if "text" === type}
|
|
39
|
+
<Text {info} bind:value {depth} {disabled} {visible} />
|
|
40
|
+
{:else if "number" === type}
|
|
41
|
+
<Number {info} bind:value {depth} {disabled} {visible} />
|
|
42
|
+
{:else if "range" === type}
|
|
43
|
+
<Range {info} bind:value {depth} {disabled} {visible} />
|
|
44
|
+
{:else if "select" === type}
|
|
45
|
+
<Select {info} bind:value {depth} {disabled} {visible} />
|
|
46
|
+
{:else if "switch" === type}
|
|
47
|
+
<Switch {info} bind:value {depth} {disabled} {visible} />
|
|
48
|
+
{/if}
|
|
49
|
+
{/if}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Prop } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
value: any;
|
|
6
|
-
info:
|
|
6
|
+
info: Prop;
|
|
7
7
|
depth: number;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
visible?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
-
import
|
|
3
|
+
import NameHeader from "./misc/Name.svelte";
|
|
4
4
|
export let value;
|
|
5
5
|
export let info;
|
|
6
6
|
export let depth;
|
|
@@ -10,10 +10,12 @@ let ivalue = value ?? getDefault(info);
|
|
|
10
10
|
let enabled = value !== void 0;
|
|
11
11
|
$:
|
|
12
12
|
value = enabled && !disabled ? ivalue : void 0;
|
|
13
|
+
$:
|
|
14
|
+
name = info instanceof Array ? info[0] : info.name;
|
|
13
15
|
</script>
|
|
14
16
|
{#if visible}
|
|
15
17
|
<div>
|
|
16
|
-
<
|
|
18
|
+
<NameHeader {name} {depth} />
|
|
17
19
|
<div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
|
|
18
20
|
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
19
21
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Name, PropNumber, FlatPropNumber } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
value: number | undefined;
|
|
6
|
-
info:
|
|
6
|
+
info: (Name & PropNumber) | [string, ...FlatPropNumber];
|
|
7
7
|
depth: number;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
visible?: boolean | undefined;
|
|
@@ -13,13 +13,15 @@ let expand = info.values.length > 0 ? true : void 0;
|
|
|
13
13
|
$:
|
|
14
14
|
value = !disabled && enabled ? ivalue : void 0;
|
|
15
15
|
$:
|
|
16
|
-
values = info.values;
|
|
16
|
+
values = info instanceof Array ? info[2] : info.values;
|
|
17
|
+
$:
|
|
18
|
+
name = info instanceof Array ? info[0] : info.name;
|
|
17
19
|
</script>
|
|
18
|
-
<Header
|
|
20
|
+
<Header {name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
|
|
19
21
|
{#each values as info, i (i)}
|
|
20
22
|
<Component
|
|
21
23
|
{info}
|
|
22
|
-
bind:value={ivalue[
|
|
24
|
+
bind:value={ivalue[name]}
|
|
23
25
|
depth={depth + 10}
|
|
24
26
|
disabled={!enabled || disabled}
|
|
25
27
|
visible={visible && expand && enabled && !disabled}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { ValueType } from "
|
|
3
|
-
import type {
|
|
2
|
+
import type { ValueType } from "../../types";
|
|
3
|
+
import type { Name, PropObject, FlatPropObject } from "../types";
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
value: Record<string, ValueType> | undefined;
|
|
7
|
-
info:
|
|
7
|
+
info: (Name & PropObject) | [string, ...FlatPropObject];
|
|
8
8
|
depth: number;
|
|
9
9
|
disabled?: boolean | undefined;
|
|
10
10
|
visible?: boolean | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
<script>import Component from "./Component.svelte";
|
|
3
|
+
import Styler from "./misc/Styler.svelte";
|
|
4
|
+
export let infos;
|
|
5
|
+
export let values;
|
|
6
|
+
export let visible;
|
|
7
|
+
</script>
|
|
8
|
+
<Styler>
|
|
9
|
+
{#if visible}
|
|
10
|
+
<slot />
|
|
11
|
+
{/if}
|
|
12
|
+
{#each infos as info}
|
|
13
|
+
{#if info instanceof Array}
|
|
14
|
+
<Component {info} bind:value={values[info[0]]} depth={10} {visible} />
|
|
15
|
+
{:else}
|
|
16
|
+
<Component {info} bind:value={values[info.name]} depth={10} {visible} />
|
|
17
|
+
{/if}
|
|
18
|
+
{/each}
|
|
19
|
+
</Styler>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ValueType } from "../../types";
|
|
3
|
+
import type { Prop } from "../types";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
infos: Prop[];
|
|
7
|
+
values: Record<string, ValueType>;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type PropsProps = typeof __propDef.props;
|
|
18
|
+
export type PropsEvents = typeof __propDef.events;
|
|
19
|
+
export type PropsSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Props extends SvelteComponentTyped<PropsProps, PropsEvents, PropsSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</style>
|
|
34
34
|
|
|
35
35
|
<script>import { getDefault } from "./misc/defaulter";
|
|
36
|
-
import
|
|
36
|
+
import NameHeader from "./misc/Name.svelte";
|
|
37
37
|
export let value;
|
|
38
38
|
export let info;
|
|
39
39
|
export let depth;
|
|
@@ -45,10 +45,18 @@ $:
|
|
|
45
45
|
value = enabled && !disabled ? ivalue : void 0;
|
|
46
46
|
$:
|
|
47
47
|
flag = !enabled || disabled;
|
|
48
|
+
$:
|
|
49
|
+
name = info instanceof Array ? info[0] : info.name;
|
|
50
|
+
$:
|
|
51
|
+
min = info instanceof Array ? info[2] : info.min;
|
|
52
|
+
$:
|
|
53
|
+
max = info instanceof Array ? info[3] : info.max;
|
|
54
|
+
$:
|
|
55
|
+
step = info instanceof Array ? info[4] : info.step;
|
|
48
56
|
</script>
|
|
49
57
|
{#if visible}
|
|
50
58
|
<div>
|
|
51
|
-
<
|
|
59
|
+
<NameHeader {name} {depth} />
|
|
52
60
|
<div class="input">
|
|
53
61
|
<div class="tooltip" class:disabled={flag}>
|
|
54
62
|
Current Value: {ivalue}
|
|
@@ -57,9 +65,9 @@ $:
|
|
|
57
65
|
<input
|
|
58
66
|
type="range"
|
|
59
67
|
bind:value={ivalue}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
{min}
|
|
69
|
+
{max}
|
|
70
|
+
{step}
|
|
63
71
|
disabled={flag}
|
|
64
72
|
/>
|
|
65
73
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Name, PropRange, FlatPropRange } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
value: number | undefined;
|
|
6
|
-
info:
|
|
6
|
+
info: (Name & PropRange) | [string, ...FlatPropRange];
|
|
7
7
|
depth: number;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
visible?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import { getDefault } from "./misc/defaulter";
|
|
3
|
-
import
|
|
3
|
+
import NameHeader from "./misc/Name.svelte";
|
|
4
4
|
export let value;
|
|
5
5
|
export let info;
|
|
6
6
|
export let depth;
|
|
@@ -10,14 +10,18 @@ let ivalue = value ?? getDefault(info);
|
|
|
10
10
|
let enabled = value !== void 0;
|
|
11
11
|
$:
|
|
12
12
|
value = enabled && !disabled ? ivalue : void 0;
|
|
13
|
+
$:
|
|
14
|
+
name = info instanceof Array ? info[0] : info.name;
|
|
15
|
+
$:
|
|
16
|
+
values = info instanceof Array ? info[2] : info.values;
|
|
13
17
|
</script>
|
|
14
18
|
{#if visible}
|
|
15
19
|
<div>
|
|
16
|
-
<
|
|
20
|
+
<NameHeader {name} {depth} />
|
|
17
21
|
<div>
|
|
18
22
|
<select bind:value={ivalue} disabled={!enabled || disabled}>
|
|
19
|
-
{#each
|
|
20
|
-
<option {
|
|
23
|
+
{#each values as v}
|
|
24
|
+
<option value={v}>{v}</option>
|
|
21
25
|
{/each}
|
|
22
26
|
</select>
|
|
23
27
|
</div>
|