@nil-/doc 0.2.45 → 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 (46) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/components/block/Controls.svelte +2 -1
  3. package/components/block/Controls.svelte.d.ts +3 -2
  4. package/components/block/Instance.svelte +35 -8
  5. package/components/block/Instance.svelte.d.ts +8 -7
  6. package/components/block/Template.svelte +2 -1
  7. package/components/block/Template.svelte.d.ts +1 -0
  8. package/components/block/context.d.ts +7 -2
  9. package/components/block/context.js +4 -1
  10. package/components/block/controls/events/Events.svelte +69 -0
  11. package/components/block/controls/events/Events.svelte.d.ts +21 -0
  12. package/components/block/controls/events/misc/Styler.svelte +83 -0
  13. package/components/block/controls/{misc → events/misc}/Styler.svelte.d.ts +0 -0
  14. package/components/block/controls/{Component.svelte → props/Component.svelte} +0 -0
  15. package/components/block/controls/{Component.svelte.d.ts → props/Component.svelte.d.ts} +2 -2
  16. package/components/block/controls/{Number.svelte → props/Number.svelte} +0 -0
  17. package/components/block/controls/{Number.svelte.d.ts → props/Number.svelte.d.ts} +2 -2
  18. package/components/block/controls/{Object.svelte → props/Object.svelte} +0 -0
  19. package/components/block/controls/{Object.svelte.d.ts → props/Object.svelte.d.ts} +3 -3
  20. package/components/block/controls/{Controls.svelte → props/Props.svelte} +5 -3
  21. package/components/block/controls/props/Props.svelte.d.ts +22 -0
  22. package/components/block/controls/{Range.svelte → props/Range.svelte} +0 -0
  23. package/components/block/controls/{Range.svelte.d.ts → props/Range.svelte.d.ts} +2 -2
  24. package/components/block/controls/{Select.svelte → props/Select.svelte} +0 -0
  25. package/components/block/controls/{Select.svelte.d.ts → props/Select.svelte.d.ts} +2 -2
  26. package/components/block/controls/{Switch.svelte → props/Switch.svelte} +0 -0
  27. package/components/block/controls/{Switch.svelte.d.ts → props/Switch.svelte.d.ts} +2 -2
  28. package/components/block/controls/{Text.svelte → props/Text.svelte} +0 -0
  29. package/components/block/controls/{Text.svelte.d.ts → props/Text.svelte.d.ts} +2 -2
  30. package/components/block/controls/{Tuple.svelte → props/Tuple.svelte} +0 -0
  31. package/components/block/controls/{Tuple.svelte.d.ts → props/Tuple.svelte.d.ts} +3 -3
  32. package/components/block/controls/{misc → props/misc}/GroupHeader.svelte +0 -0
  33. package/components/block/controls/{misc → props/misc}/GroupHeader.svelte.d.ts +0 -0
  34. package/components/block/controls/{misc → props/misc}/Name.svelte +0 -0
  35. package/components/block/controls/{misc → props/misc}/Name.svelte.d.ts +0 -0
  36. package/components/block/controls/{misc → props/misc}/Styler.svelte +25 -26
  37. package/components/block/controls/props/misc/Styler.svelte.d.ts +16 -0
  38. package/components/block/controls/props/misc/defaulter.d.ts +10 -0
  39. package/components/block/controls/{misc → props/misc}/defaulter.js +0 -0
  40. package/components/block/controls/types.d.ts +28 -26
  41. package/index.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/components/block/controls/Controls.svelte.d.ts +0 -19
  44. package/components/block/controls/misc/TopHeader.svelte +0 -12
  45. package/components/block/controls/misc/TopHeader.svelte.d.ts +0 -23
  46. package/components/block/controls/misc/defaulter.d.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.2.45
4
10
 
5
11
  ### 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 { 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
+
@@ -1,9 +1,9 @@
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
9
  visible?: boolean | undefined;
@@ -1,9 +1,9 @@
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
9
  visible?: boolean | undefined;
@@ -1,10 +1,10 @@
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
10
  visible?: boolean | undefined;
@@ -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} visible />
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 {};
@@ -1,9 +1,9 @@
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
9
  visible?: boolean | undefined;
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ControlSelect } from "./types";
2
+ import type { PropSelect } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: string | undefined;
6
- info: ControlSelect;
6
+ info: PropSelect;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ControlSwitch } from "./types";
2
+ import type { PropSwitch } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: boolean | undefined;
6
- info: ControlSwitch;
6
+ info: PropSwitch;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ControlText } from "./types";
2
+ import type { PropText } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: string | undefined;
6
- info: ControlText;
6
+ info: PropText;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ValueType } from "../types";
3
- import type { ControlTuple } from "./types";
2
+ import type { ValueType } from "../../types";
3
+ import type { PropTuple } from "../types";
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  value: ValueType[] | undefined;
7
- info: ControlTuple;
7
+ info: PropTuple;
8
8
  depth: number;
9
9
  disabled?: boolean | undefined;
10
10
  visible?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- <script>import { getTheme } from "../../../context";
1
+ <script>import { getTheme } from "../../../../context";
2
2
  const dark = getTheme();
3
3
  </script>
4
4
  <style>
@@ -24,45 +24,44 @@ const dark = getTheme();
24
24
  grid-template-columns: minmax(250px, 1fr) 200px 40px;
25
25
  }
26
26
 
27
+ div > :global(div:first-child) {
28
+ text-align: center;
29
+ }
30
+
27
31
  div > :global(div > div:not(:first-child) > *) {
28
32
  width: 100%;
29
33
  height: 100%;
30
34
  }
31
35
 
32
36
  /* colors */
33
- div > :global(div) {
34
- transition: background-color 150ms;
35
- background-color: hsl(0, 0%, 100%);
36
- }
37
-
38
- div > :global(div:nth-child(even)) {
39
- background-color: hsl(210, 29%, 97%);
40
- }
41
-
42
- div > :global(div:nth-child(n + 2):hover) {
43
- background-color: hsl(210, 100%, 90%);
44
- }
45
-
46
- div > :global(div:hover .tooltip) {
47
- background-color: hsl(0, 0%, 100%);
48
- outline: hsl(0, 100%, 0%) 1px solid;
37
+ div {
38
+ --pri-color: hsl(0, 0%, 100%);
39
+ --sec-color: hsl(210, 29%, 97%);
40
+ --hover-color: hsl(210, 100%, 90%);
41
+ --outline-color: hsl(0, 0%, 0%);
49
42
  }
50
43
 
51
- div.dark > :global(div) {
52
- background-color: hsl(213, 26%, 7%);
44
+ div.dark {
45
+ --pri-color: hsl(213, 26%, 7%);
46
+ --sec-color: hsl(213, 26%, 11%);
47
+ --hover-color: hsl(203, 100%, 15%);
48
+ --outline-color: hsl(200, 6%, 80%);
53
49
  }
54
50
 
55
- div.dark > :global(div:nth-child(even)) {
56
- background-color: hsl(213, 26%, 11%);
51
+ div {
52
+ transition: background-color 150ms;
53
+ background-repeat: repeat;
54
+ background-size: 100% 60px;
55
+ background-image: linear-gradient(to bottom, var(--pri-color) 30px, var(--sec-color) 30px);
57
56
  }
58
57
 
59
- div.dark > :global(div:nth-child(n + 2):hover) {
60
- background-color: hsl(203, 100%, 15%);
58
+ div > :global(div:nth-child(n + 2):hover) {
59
+ background-color: var(--hover-color);
61
60
  }
62
61
 
63
- div.dark > :global(div:hover .tooltip) {
64
- background-color: hsl(213, 26%, 7%);
65
- outline: hsl(200, 6%, 80%) 1px solid;
62
+ div > :global(div:hover .tooltip) {
63
+ background-color: var(--pri-color);
64
+ outline: var(--outline-color) 1px solid;
66
65
  }
67
66
  </style>
68
67
 
@@ -0,0 +1,16 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {
8
+ default: {};
9
+ };
10
+ };
11
+ export type StylerProps = typeof __propDef.props;
12
+ export type StylerEvents = typeof __propDef.events;
13
+ export type StylerSlots = typeof __propDef.slots;
14
+ export default class Styler extends SvelteComponentTyped<StylerProps, StylerEvents, StylerSlots> {
15
+ }
16
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ValueType } from "../../../types";
2
+ import type { Prop, PropNumber, PropRange, PropSelect, PropSwitch, PropText, PropTuple, PropObject } from "../../types";
3
+ export declare function getDefault(i: PropTuple): ValueType[];
4
+ export declare function getDefault(i: PropObject): Record<string, ValueType>;
5
+ export declare function getDefault(i: PropNumber): number;
6
+ export declare function getDefault(i: PropRange): number;
7
+ export declare function getDefault(i: PropSelect): string;
8
+ export declare function getDefault(i: PropText): string;
9
+ export declare function getDefault(i: PropSwitch): boolean;
10
+ export declare function getDefault(i: Prop): ValueType;
@@ -1,28 +1,28 @@
1
- export type ControlTuple = {
1
+ export type PropTuple = {
2
2
  name: string;
3
3
  type: "tuple";
4
4
  // eslint-disable-next-line no-use-before-define
5
- values: NonNamedControl[];
5
+ values: NonNamedProp[];
6
6
  };
7
7
 
8
- export type ControlObject = {
8
+ export type PropObject = {
9
9
  name: string;
10
10
  type: "object";
11
11
  // eslint-disable-next-line no-use-before-define
12
- values: Control[];
12
+ values: Prop[];
13
13
  };
14
14
 
15
- export type ControlText = {
15
+ export type PropText = {
16
16
  name: string;
17
17
  type: "text";
18
18
  };
19
19
 
20
- export type ControlNumber = {
20
+ export type PropNumber = {
21
21
  name: string;
22
22
  type: "number";
23
23
  };
24
24
 
25
- export type ControlRange = {
25
+ export type PropRange = {
26
26
  name: string;
27
27
  type: "range";
28
28
  min: number;
@@ -30,31 +30,33 @@ export type ControlRange = {
30
30
  step: number;
31
31
  };
32
32
 
33
- export type ControlSelect = {
33
+ export type PropSelect = {
34
34
  name: string;
35
35
  type: "select";
36
36
  values: string[];
37
37
  };
38
38
 
39
- export type ControlSwitch = {
39
+ export type PropSwitch = {
40
40
  name: string;
41
41
  type: "switch";
42
42
  };
43
43
 
44
- export type Control =
45
- | ControlTuple
46
- | ControlObject
47
- | ControlText
48
- | ControlNumber
49
- | ControlRange
50
- | ControlSelect
51
- | ControlSwitch;
52
-
53
- type NonNamedControl =
54
- | Omit<ControlTuple, "name">
55
- | Omit<ControlObject, "name">
56
- | Omit<ControlText, "name">
57
- | Omit<ControlNumber, "name">
58
- | Omit<ControlRange, "name">
59
- | Omit<ControlSelect, "name">
60
- | Omit<ControlSwitch, "name">;
44
+ export type Prop =
45
+ | PropTuple
46
+ | PropObject
47
+ | PropText
48
+ | PropNumber
49
+ | PropRange
50
+ | PropSelect
51
+ | PropSwitch;
52
+
53
+ type NonNamedProp =
54
+ | Omit<PropTuple, "name">
55
+ | Omit<PropObject, "name">
56
+ | Omit<PropText, "name">
57
+ | Omit<PropNumber, "name">
58
+ | Omit<PropRange, "name">
59
+ | Omit<PropSelect, "name">
60
+ | Omit<PropSwitch, "name">;
61
+
62
+ export type Event = string;
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { renamer } from "./components/navigation/utils/renamer";
2
2
  export { sorter } from "./components/navigation/utils/sorter";
3
- export type { Control } from "./components/block/controls/types";
3
+ export type { Prop, Event } from "./components/block/controls/types";
4
4
  export { default as Layout } from "./components/Layout.svelte";
5
5
  export { default as Instance } from "./components/block/Instance.svelte";
6
6
  export { default as Block } from "./components/block/Block.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { ValueType } from "../types";
3
- import type { Control } from "./types";
4
- declare const __propDef: {
5
- props: {
6
- infos: Control[];
7
- values: Record<string, ValueType>;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
13
- };
14
- export type ControlsProps = typeof __propDef.props;
15
- export type ControlsEvents = typeof __propDef.events;
16
- export type ControlsSlots = typeof __propDef.slots;
17
- export default class Controls extends SvelteComponentTyped<ControlsProps, ControlsEvents, ControlsSlots> {
18
- }
19
- export {};
@@ -1,12 +0,0 @@
1
- <style>
2
- div > div {
3
- text-align: center;
4
- }
5
- </style>
6
-
7
- <div>
8
- <div>Name</div>
9
- <div>Value</div>
10
- <div>Use</div>
11
- </div>
12
-
@@ -1,23 +0,0 @@
1
- /** @typedef {typeof __propDef.props} TopHeaderProps */
2
- /** @typedef {typeof __propDef.events} TopHeaderEvents */
3
- /** @typedef {typeof __propDef.slots} TopHeaderSlots */
4
- export default class TopHeader extends SvelteComponentTyped<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type TopHeaderProps = typeof __propDef.props;
11
- export type TopHeaderEvents = typeof __propDef.events;
12
- export type TopHeaderSlots = typeof __propDef.slots;
13
- import { SvelteComponentTyped } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- [x: string]: never;
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
22
- };
23
- export {};
@@ -1,10 +0,0 @@
1
- import type { ValueType } from "../../types";
2
- import type { Control, ControlNumber, ControlRange, ControlSelect, ControlSwitch, ControlText, ControlTuple, ControlObject } from "../types";
3
- export declare function getDefault(i: ControlTuple): ValueType[];
4
- export declare function getDefault(i: ControlObject): Record<string, ValueType>;
5
- export declare function getDefault(i: ControlNumber): number;
6
- export declare function getDefault(i: ControlRange): number;
7
- export declare function getDefault(i: ControlSelect): string;
8
- export declare function getDefault(i: ControlText): string;
9
- export declare function getDefault(i: ControlSwitch): boolean;
10
- export declare function getDefault(i: Control): ValueType;