@nil-/doc 0.2.44 → 0.2.46

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/components/Layout.svelte +2 -1
  3. package/components/block/Controls.svelte +2 -1
  4. package/components/block/Controls.svelte.d.ts +3 -2
  5. package/components/block/Instance.svelte +35 -8
  6. package/components/block/Instance.svelte.d.ts +8 -7
  7. package/components/block/Template.svelte +2 -1
  8. package/components/block/Template.svelte.d.ts +1 -0
  9. package/components/block/context.d.ts +7 -2
  10. package/components/block/context.js +4 -1
  11. package/components/block/controls/events/Events.svelte +69 -0
  12. package/components/block/controls/events/Events.svelte.d.ts +21 -0
  13. package/components/block/controls/events/misc/Styler.svelte +83 -0
  14. package/components/block/controls/{misc → events/misc}/Styler.svelte.d.ts +0 -0
  15. package/components/block/controls/{Component.svelte → props/Component.svelte} +8 -7
  16. package/components/block/controls/{Component.svelte.d.ts → props/Component.svelte.d.ts} +3 -2
  17. package/components/block/controls/{Switch.svelte → props/Number.svelte} +8 -5
  18. package/components/block/controls/{Number.svelte.d.ts → props/Number.svelte.d.ts} +3 -2
  19. package/components/block/controls/{Object.svelte → props/Object.svelte} +12 -12
  20. package/components/block/controls/{Object.svelte.d.ts → props/Object.svelte.d.ts} +4 -3
  21. package/components/block/controls/{Controls.svelte → props/Props.svelte} +5 -3
  22. package/components/block/controls/props/Props.svelte.d.ts +22 -0
  23. package/components/block/controls/{Range.svelte → props/Range.svelte} +19 -16
  24. package/components/block/controls/{Range.svelte.d.ts → props/Range.svelte.d.ts} +3 -2
  25. package/components/block/controls/props/Select.svelte +26 -0
  26. package/components/block/controls/{Select.svelte.d.ts → props/Select.svelte.d.ts} +3 -2
  27. package/components/block/controls/{Number.svelte → props/Switch.svelte} +8 -5
  28. package/components/block/controls/{Switch.svelte.d.ts → props/Switch.svelte.d.ts} +3 -2
  29. package/components/block/controls/{Text.svelte → props/Text.svelte} +8 -5
  30. package/components/block/controls/{Text.svelte.d.ts → props/Text.svelte.d.ts} +3 -2
  31. package/components/block/controls/{Tuple.svelte → props/Tuple.svelte} +11 -11
  32. package/components/block/controls/{Tuple.svelte.d.ts → props/Tuple.svelte.d.ts} +4 -3
  33. package/components/block/controls/props/misc/GroupHeader.svelte +35 -0
  34. package/components/block/controls/{misc → props/misc}/GroupHeader.svelte.d.ts +1 -0
  35. package/components/block/controls/{misc → props/misc}/Name.svelte +0 -0
  36. package/components/block/controls/{misc → props/misc}/Name.svelte.d.ts +0 -0
  37. package/components/block/controls/props/misc/Styler.svelte +87 -0
  38. package/components/block/controls/props/misc/Styler.svelte.d.ts +16 -0
  39. package/components/block/controls/props/misc/defaulter.d.ts +10 -0
  40. package/components/block/controls/{misc → props/misc}/defaulter.js +0 -0
  41. package/components/block/controls/types.d.ts +28 -26
  42. package/index.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/components/block/controls/Controls.svelte.d.ts +0 -19
  45. package/components/block/controls/Select.svelte +0 -23
  46. package/components/block/controls/misc/GroupHeader.svelte +0 -32
  47. package/components/block/controls/misc/Styler.svelte +0 -73
  48. package/components/block/controls/misc/TopHeader.svelte +0 -12
  49. package/components/block/controls/misc/TopHeader.svelte.d.ts +0 -23
  50. package/components/block/controls/misc/defaulter.d.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.46
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][new] added event control support ([#77](https://github.com/njaldea/mono/pull/77))
8
+
9
+ ## 0.2.45
10
+
11
+ ### Patch Changes
12
+
13
+ - [doc][fix] keep control state when disabled after tuple/object parent toggles expand #[75](https://github.com/njaldea/mono/issues/75) ([#74](https://github.com/njaldea/mono/pull/74))
14
+
3
15
  ## 0.2.44
4
16
 
5
17
  ### Patch Changes
@@ -85,6 +85,7 @@
85
85
  </style>
86
86
 
87
87
  <script context="module">const defaultSorter = (l, r) => l.localeCompare(r);
88
+ const defaultRenamer = (s) => s;
88
89
  </script>
89
90
  <script>import Container from "./etc/Container.svelte";
90
91
  import Nav from "./navigation/Nav.svelte";
@@ -135,7 +136,7 @@ const toggle = () => {
135
136
  info={data}
136
137
  selected={current ?? ""}
137
138
  sorter={sorter ?? defaultSorter}
138
- renamer={renamer ?? ((s) => s)}
139
+ renamer={renamer ?? defaultRenamer}
139
140
  on:navigate
140
141
  />
141
142
  </div>
@@ -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 { Control } from "./controls/types";
2
+ import type { Prop } from "./controls/types";
3
3
  declare const __propDef: {
4
4
  props: {
5
- props?: Control[] | undefined;
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 Controls from "./controls/Controls.svelte";
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
- expanded = $controls.length > 0 && !$controlsState.hide;
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,11 +102,10 @@ 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>
97
110
  <div
98
111
  class="instance"
@@ -107,18 +120,32 @@ $:
107
120
  >
108
121
  {#if noreset}
109
122
  <div class="content scrollable" class:dark={$dark}>
110
- <slot props={resolveArgs(defaults ?? {}, bound)} {key} />
123
+ <slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
111
124
  </div>
112
125
  {:else}
113
126
  {#key key}
114
127
  <div class="content scrollable" class:dark={$dark}>
115
- <slot props={resolveArgs(defaults ?? {}, bound)} {key} />
128
+ <slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
116
129
  </div>
117
130
  {/key}
118
131
  {/if}
119
132
  {#if expanded}
120
133
  <div class="misc scrollable" class:dark={$dark}>
121
- <Controls infos={$controls} bind:values={bound} />
134
+ <Props infos={$controls.props} bind:values={bound} visible={cvisible == "props"}>
135
+ <div on:dblclick={() => hasEvents && (cvisible = "events")}>
136
+ <div>Properties</div>
137
+ <div>Value</div>
138
+ <div>Use</div>
139
+ </div>
140
+ </Props>
141
+ <Events events={$controls.events} bind:handlers visible={cvisible == "events"}>
142
+ {#if cvisible == "events"}
143
+ <div on:dblclick={() => hasProps && (cvisible = "props")}>
144
+ <div>Events</div>
145
+ <div>Detail</div>
146
+ </div>
147
+ {/if}
148
+ </Events>
122
149
  </div>
123
150
  {/if}
124
151
  </div>
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- declare class __sveltets_Render<Args> {
2
+ declare class __sveltets_Render<PropArgs> {
3
3
  props(): {
4
- defaults?: Args | undefined;
4
+ defaults?: PropArgs | undefined;
5
5
  noreset?: boolean | undefined;
6
6
  scale?: boolean | undefined;
7
7
  };
@@ -10,14 +10,15 @@ declare class __sveltets_Render<Args> {
10
10
  };
11
11
  slots(): {
12
12
  default: {
13
- props: Args;
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<Args> = ReturnType<__sveltets_Render<Args>['props']>;
19
- export type InstanceEvents<Args> = ReturnType<__sveltets_Render<Args>['events']>;
20
- export type InstanceSlots<Args> = ReturnType<__sveltets_Render<Args>['slots']>;
21
- export default class Instance<Args> extends SvelteComponentTyped<InstanceProps<Args>, InstanceEvents<Args>, InstanceSlots<Args>> {
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
+ export default class Instance<PropArgs> extends SvelteComponentTyped<InstanceProps<PropArgs>, InstanceEvents<PropArgs>, InstanceSlots<PropArgs>> {
22
23
  }
23
24
  export {};
@@ -30,7 +30,8 @@ const cast = (t) => t;
30
30
  {scale}
31
31
  let:key
32
32
  let:props
33
+ let:events
33
34
  >
34
- <slot id={param.id} tag={param.tag} props={cast(props)} {key} />
35
+ <slot id={param.id} tag={param.tag} props={cast(props)} {events} {key} />
35
36
  </Instance>
36
37
  {/each}
@@ -14,6 +14,7 @@ declare class __sveltets_Render<Args> {
14
14
  id: number;
15
15
  tag: string;
16
16
  props: Args;
17
+ events: Record<string, (ev: CustomEvent<unknown>) => void>;
17
18
  key: boolean;
18
19
  };
19
20
  };
@@ -1,5 +1,5 @@
1
1
  import type { Writable } from "svelte/store";
2
- import type { Control } from "./controls/types";
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
- export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
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
+
@@ -10,19 +10,20 @@ export let value;
10
10
  export let info;
11
11
  export let depth;
12
12
  export let disabled = false;
13
+ export let visible = false;
13
14
  </script>
14
15
  {#if "object" === info.type}
15
- <Object {info} bind:value {depth} {disabled} />
16
+ <Object {info} bind:value {depth} {disabled} {visible} />
16
17
  {:else if "tuple" === info.type}
17
- <Tuple {info} bind:value {depth} {disabled} />
18
+ <Tuple {info} bind:value {depth} {disabled} {visible} />
18
19
  {:else if "text" === info.type}
19
- <Text {info} bind:value {depth} {disabled} />
20
+ <Text {info} bind:value {depth} {disabled} {visible} />
20
21
  {:else if "number" === info.type}
21
- <Number {info} bind:value {depth} {disabled} />
22
+ <Number {info} bind:value {depth} {disabled} {visible} />
22
23
  {:else if "range" === info.type}
23
- <Range {info} bind:value {depth} {disabled} />
24
+ <Range {info} bind:value {depth} {disabled} {visible} />
24
25
  {:else if "select" === info.type}
25
- <Select {info} bind:value {depth} {disabled} />
26
+ <Select {info} bind:value {depth} {disabled} {visible} />
26
27
  {:else if "switch" === info.type}
27
- <Switch {info} bind:value {depth} {disabled} />
28
+ <Switch {info} bind:value {depth} {disabled} {visible} />
28
29
  {/if}
@@ -1,11 +1,12 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Control } from "./types";
2
+ import type { Prop } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: any;
6
- info: Control;
6
+ info: Prop;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
+ visible?: boolean | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -5,13 +5,16 @@ export let value;
5
5
  export let info;
6
6
  export let depth;
7
7
  export let disabled = false;
8
+ export let visible = false;
8
9
  let ivalue = value ?? getDefault(info);
9
10
  let enabled = value !== void 0;
10
11
  $:
11
12
  value = enabled && !disabled ? ivalue : void 0;
12
13
  </script>
13
- <div>
14
- <Name name={info.name} {depth} />
15
- <div><input type="checkbox" bind:checked={ivalue} disabled={!enabled || disabled} /></div>
16
- <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
17
- </div>
14
+ {#if visible}
15
+ <div>
16
+ <Name name={info.name} {depth} />
17
+ <div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
18
+ <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
19
+ </div>
20
+ {/if}
@@ -1,11 +1,12 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ControlNumber } from "./types";
2
+ import type { PropNumber } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: number | undefined;
6
- info: ControlNumber;
6
+ info: PropNumber;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
+ visible?: boolean | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -6,22 +6,22 @@ export let value;
6
6
  export let info;
7
7
  export let depth;
8
8
  export let disabled = false;
9
+ export let visible = false;
9
10
  let ivalue = value ?? getDefault(info);
10
11
  let enabled = value !== void 0;
12
+ let expand = info.values.length > 0 ? true : void 0;
11
13
  $:
12
14
  value = !disabled && enabled ? ivalue : void 0;
13
15
  $:
14
16
  values = info.values;
15
- let expand = info.values.length > 0 ? true : void 0;
16
17
  </script>
17
- <Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} />
18
- {#if expand && enabled && !disabled}
19
- {#each values as info, i (i)}
20
- <Component
21
- {info}
22
- bind:value={ivalue[info.name]}
23
- depth={depth + 10}
24
- disabled={!enabled || disabled}
25
- />
26
- {/each}
27
- {/if}
18
+ <Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
19
+ {#each values as info, i (i)}
20
+ <Component
21
+ {info}
22
+ bind:value={ivalue[info.name]}
23
+ depth={depth + 10}
24
+ disabled={!enabled || disabled}
25
+ visible={visible && expand && enabled && !disabled}
26
+ />
27
+ {/each}
@@ -1,12 +1,13 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ValueType } from "../types";
3
- import type { ControlObject } from "./types";
2
+ import type { ValueType } from "../../types";
3
+ import type { PropObject } from "../types";
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  value: Record<string, ValueType> | undefined;
7
- info: ControlObject;
7
+ info: PropObject;
8
8
  depth: number;
9
9
  disabled?: boolean | undefined;
10
+ visible?: boolean | undefined;
10
11
  };
11
12
  events: {
12
13
  [evt: string]: CustomEvent<any>;
@@ -1,13 +1,15 @@
1
1
 
2
2
  <script>import Component from "./Component.svelte";
3
- import Header from "./misc/TopHeader.svelte";
4
3
  import Styler from "./misc/Styler.svelte";
5
4
  export let infos;
6
5
  export let values;
6
+ export let visible;
7
7
  </script>
8
8
  <Styler>
9
- <Header />
9
+ {#if visible}
10
+ <slot />
11
+ {/if}
10
12
  {#each infos as info}
11
- <Component {info} bind:value={values[info.name]} depth={10} disabled={false} />
13
+ <Component {info} bind:value={values[info.name]} depth={10} {visible} />
12
14
  {/each}
13
15
  </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 {};
@@ -38,6 +38,7 @@ export let value;
38
38
  export let info;
39
39
  export let depth;
40
40
  export let disabled = false;
41
+ export let visible = false;
41
42
  let ivalue = value ?? getDefault(info);
42
43
  let enabled = value !== void 0;
43
44
  $:
@@ -45,22 +46,24 @@ $:
45
46
  $:
46
47
  flag = !enabled || disabled;
47
48
  </script>
48
- <div>
49
- <Name name={info.name} {depth} />
50
- <div class="input">
51
- <div class="tooltip" class:disabled={flag}>
52
- Current Value: {ivalue}
49
+ {#if visible}
50
+ <div>
51
+ <Name name={info.name} {depth} />
52
+ <div class="input">
53
+ <div class="tooltip" class:disabled={flag}>
54
+ Current Value: {ivalue}
55
+ </div>
56
+ <div>{ivalue.toFixed(2)}</div>
57
+ <input
58
+ type="range"
59
+ bind:value={ivalue}
60
+ min={info.min}
61
+ max={info.max}
62
+ step={info.step}
63
+ disabled={flag}
64
+ />
53
65
  </div>
54
- <div>{ivalue.toFixed(2)}</div>
55
- <input
56
- type="range"
57
- bind:value={ivalue}
58
- min={info.min}
59
- max={info.max}
60
- step={info.step}
61
- disabled={flag}
62
- />
66
+ <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
63
67
  </div>
64
- <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
65
- </div>
68
+ {/if}
66
69
 
@@ -1,11 +1,12 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ControlRange } from "./types";
2
+ import type { PropRange } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: number | undefined;
6
- info: ControlRange;
6
+ info: PropRange;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
+ visible?: boolean | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;