@nil-/doc 0.2.49 → 0.2.50

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 (37) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/components/Layout.svelte +78 -81
  3. package/components/Layout.svelte.d.ts +1 -0
  4. package/components/block/Block.svelte +29 -28
  5. package/components/block/Controls.svelte +1 -1
  6. package/components/block/Instance.svelte +73 -72
  7. package/components/block/Params.svelte +1 -1
  8. package/components/block/Template.svelte +2 -1
  9. package/components/block/controls/events/Events.svelte +9 -9
  10. package/components/block/controls/events/misc/Styler.svelte +18 -19
  11. package/components/block/controls/props/Component.svelte +1 -1
  12. package/components/block/controls/props/Number.svelte +1 -1
  13. package/components/block/controls/props/Object.svelte +2 -1
  14. package/components/block/controls/props/Props.svelte +1 -1
  15. package/components/block/controls/props/Range.svelte +35 -35
  16. package/components/block/controls/props/Select.svelte +6 -6
  17. package/components/block/controls/props/Switch.svelte +1 -1
  18. package/components/block/controls/props/Text.svelte +1 -1
  19. package/components/block/controls/props/Tuple.svelte +2 -1
  20. package/components/block/controls/props/misc/GroupHeader.svelte +6 -6
  21. package/components/block/controls/props/misc/Name.svelte +14 -14
  22. package/components/block/controls/props/misc/Styler.svelte +20 -21
  23. package/components/etc/Container.svelte +92 -92
  24. package/components/{etc/NilIcon.svelte → icons/NilDoc.svelte} +17 -16
  25. package/components/icons/NilDoc.svelte.d.ts +14 -0
  26. package/components/{etc/ThemeIcon.svelte → icons/Theme.svelte} +34 -31
  27. package/components/icons/Theme.svelte.d.ts +17 -0
  28. package/components/navigation/Nav.svelte +31 -30
  29. package/components/navigation/Node.svelte +47 -47
  30. package/components/navigation/Tree.svelte +1 -1
  31. package/components/title/Icon.svelte +19 -0
  32. package/components/title/Icon.svelte.d.ts +21 -0
  33. package/index.d.ts +3 -0
  34. package/index.js +3 -0
  35. package/package.json +1 -1
  36. package/components/etc/NilIcon.svelte.d.ts +0 -14
  37. package/components/etc/ThemeIcon.svelte.d.ts +0 -16
@@ -1,9 +1,3 @@
1
- <style>
2
- select {
3
- text-align: center;
4
- }
5
- </style>
6
-
7
1
  <script>import { getDefault } from "./misc/defaulter";
8
2
  import NameHeader from "./misc/Name.svelte";
9
3
  export let value;
@@ -20,6 +14,7 @@ $:
20
14
  $:
21
15
  values = info instanceof Array ? info[2] : info.values;
22
16
  </script>
17
+
23
18
  {#if visible}
24
19
  <div>
25
20
  <NameHeader {name} {depth} />
@@ -34,3 +29,8 @@ $:
34
29
  </div>
35
30
  {/if}
36
31
 
32
+ <style>
33
+ select {
34
+ text-align: center;
35
+ }
36
+ </style>
@@ -1,4 +1,3 @@
1
-
2
1
  <script>import { getDefault } from "./misc/defaulter";
3
2
  import NameHeader from "./misc/Name.svelte";
4
3
  export let value;
@@ -13,6 +12,7 @@ $:
13
12
  $:
14
13
  name = info instanceof Array ? info[0] : info.name;
15
14
  </script>
15
+
16
16
  {#if visible}
17
17
  <div>
18
18
  <NameHeader {name} {depth} />
@@ -1,4 +1,3 @@
1
-
2
1
  <script>import { getDefault } from "./misc/defaulter";
3
2
  import NameHeader from "./misc/Name.svelte";
4
3
  export let value;
@@ -13,6 +12,7 @@ $:
13
12
  $:
14
13
  name = info instanceof Array ? info[0] : info.name;
15
14
  </script>
15
+
16
16
  {#if visible}
17
17
  <div>
18
18
  <NameHeader {name} {depth} />
@@ -1,4 +1,3 @@
1
-
2
1
  <script>import Component from "./Component.svelte";
3
2
  import Header from "./misc/GroupHeader.svelte";
4
3
  import { getDefault } from "./misc/defaulter";
@@ -17,7 +16,9 @@ $:
17
16
  name = info instanceof Array ? info[0] : info.name;
18
17
  let expand = info.values.length > 0 ? true : void 0;
19
18
  </script>
19
+
20
20
  <Header {name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
21
+
21
22
  {#each values as v, i (i)}
22
23
  {#if v instanceof Array}
23
24
  <Component
@@ -1,9 +1,3 @@
1
- <style>
2
- .value {
3
- text-align: center;
4
- }
5
- </style>
6
-
7
1
  <script>import Name from "./Name.svelte";
8
2
  export let name;
9
3
  export let depth;
@@ -19,6 +13,7 @@ const flip = () => {
19
13
  }
20
14
  };
21
15
  </script>
16
+
22
17
  {#if visible}
23
18
  <div class="root" on:click={flip} on:keypress={null}>
24
19
  <Name
@@ -33,3 +28,8 @@ const flip = () => {
33
28
  </div>
34
29
  {/if}
35
30
 
31
+ <style>
32
+ .value {
33
+ text-align: center;
34
+ }
35
+ </style>
@@ -1,3 +1,17 @@
1
+ <script>export let depth;
2
+ export let name;
3
+ export let expand = void 0;
4
+ </script>
5
+
6
+ <div class="override" style:padding-left={`${depth}px`} title={name}>
7
+ <div class="icon" class:expand={expand === true}>
8
+ <div>
9
+ {expand === undefined ? "-" : ">"}
10
+ </div>
11
+ </div>
12
+ <span>{name}</span>
13
+ </div>
14
+
1
15
  <style>
2
16
  .override {
3
17
  overflow: hidden;
@@ -28,17 +42,3 @@
28
42
  margin: auto;
29
43
  }
30
44
  </style>
31
-
32
- <script>export let depth;
33
- export let name;
34
- export let expand = void 0;
35
- </script>
36
- <div class="override" style:padding-left={`${depth}px`} title={name}>
37
- <div class="icon" class:expand={expand === true}>
38
- <div>
39
- {expand === undefined ? "-" : ">"}
40
- </div>
41
- </div>
42
- <span>{name}</span>
43
- </div>
44
-
@@ -1,6 +1,26 @@
1
1
  <script>import { getTheme } from "../../../../context";
2
2
  const dark = getTheme();
3
3
  </script>
4
+
5
+ <!--
6
+ <div> this component
7
+ <div> Header
8
+ <div></div>
9
+ <div></div>
10
+ <div></div>
11
+ </div>
12
+ <div> Controls
13
+ <div></div>
14
+ <div></div>
15
+ <div></div>
16
+ </div>
17
+ ...
18
+ </div>
19
+ -->
20
+ <div class:dark={$dark}>
21
+ <slot />
22
+ </div>
23
+
4
24
  <style>
5
25
  div {
6
26
  width: 100%;
@@ -66,24 +86,3 @@ const dark = getTheme();
66
86
  outline: var(--outline-color) 1px solid;
67
87
  }
68
88
  </style>
69
-
70
-
71
- <!--
72
- <div> this component
73
- <div> Header
74
- <div></div>
75
- <div></div>
76
- <div></div>
77
- </div>
78
- <div> Controls
79
- <div></div>
80
- <div></div>
81
- <div></div>
82
- </div>
83
- ...
84
- </div>
85
- -->
86
- <div class:dark={$dark}>
87
- <slot />
88
- </div>
89
-
@@ -1,3 +1,95 @@
1
+ <script>import { writable } from "svelte/store";
2
+ import { tweened } from "svelte/motion";
3
+ import { createDraggable } from "./action";
4
+ import { getTheme } from "../context";
5
+ const dark = getTheme();
6
+ export let vertical = false;
7
+ export let offset = 0;
8
+ export let b = false;
9
+ let width;
10
+ let height;
11
+ const { position, draggable } = createDraggable(offset);
12
+ $:
13
+ span = vertical ? width : height;
14
+ const update = (limit, value) => {
15
+ if (null == span) {
16
+ return;
17
+ }
18
+ offset = Math.max(Math.min(value, span - limit), limit);
19
+ };
20
+ const off = tweened(offset, { duration: 50 });
21
+ let last = [];
22
+ $:
23
+ update(10, $position);
24
+ $:
25
+ $off = offset;
26
+ $:
27
+ style = !b ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
28
+ const moving = writable(false);
29
+ const addLast = (v) => {
30
+ if (v > 10) {
31
+ if (last.length < 2) {
32
+ last = [...last, v];
33
+ } else {
34
+ last = [last[1], v];
35
+ }
36
+ }
37
+ };
38
+ const dbltap = () => {
39
+ if ($off > 10) {
40
+ addLast(offset);
41
+ offset = 10;
42
+ } else if (last.length > 0) {
43
+ offset = last.pop();
44
+ }
45
+ };
46
+ const check = (v, flag, s) => {
47
+ if (flag) {
48
+ return v < s - 10;
49
+ } else {
50
+ return v > 10;
51
+ }
52
+ };
53
+ </script>
54
+
55
+ <div
56
+ class="container"
57
+ class:vertical
58
+ class:b
59
+ class:dark={$dark}
60
+ class:moving={$moving}
61
+ bind:clientWidth={width}
62
+ bind:clientHeight={height}
63
+ style:grid-template-columns={vertical ? style : null}
64
+ style:grid-template-rows={!vertical ? style : null}
65
+ >
66
+ {#if width != null && height != null}
67
+ <div style:grid-area="A">
68
+ {#if check($off, !b, span)}
69
+ <slot name="A" />
70
+ {/if}
71
+ </div>
72
+ <div class="divider">
73
+ <div
74
+ class="overlay"
75
+ use:draggable={{
76
+ reset: () => offset,
77
+ reversed: !b,
78
+ vertical,
79
+ dbltap: dbltap,
80
+ tap: () => addLast($off),
81
+ moving
82
+ }}
83
+ />
84
+ </div>
85
+ <div style:grid-area="B">
86
+ {#if check($off, b, span)}
87
+ <slot name="B" />
88
+ {/if}
89
+ </div>
90
+ {/if}
91
+ </div>
92
+
1
93
  <style>
2
94
  div {
3
95
  box-sizing: border-box;
@@ -96,95 +188,3 @@
96
188
  border-left: var(--color-s) solid 2.5px;
97
189
  }
98
190
  </style>
99
-
100
- <script>import { writable } from "svelte/store";
101
- import { tweened } from "svelte/motion";
102
- import { createDraggable } from "./action";
103
- import { getTheme } from "../context";
104
- const dark = getTheme();
105
- export let vertical = false;
106
- export let offset = 0;
107
- export let b = false;
108
- let width;
109
- let height;
110
- const { position, draggable } = createDraggable(offset);
111
- $:
112
- span = vertical ? width : height;
113
- const update = (limit, value) => {
114
- if (null == span) {
115
- return;
116
- }
117
- offset = Math.max(Math.min(value, span - limit), limit);
118
- };
119
- const off = tweened(offset, { duration: 50 });
120
- let last = [];
121
- $:
122
- update(10, $position);
123
- $:
124
- $off = offset;
125
- $:
126
- style = !b ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
127
- const moving = writable(false);
128
- const addLast = (v) => {
129
- if (v > 10) {
130
- if (last.length < 2) {
131
- last = [...last, v];
132
- } else {
133
- last = [last[1], v];
134
- }
135
- }
136
- };
137
- const dbltap = () => {
138
- if ($off > 10) {
139
- addLast(offset);
140
- offset = 10;
141
- } else if (last.length > 0) {
142
- offset = last.pop();
143
- }
144
- };
145
- const check = (v, flag, s) => {
146
- if (flag) {
147
- return v < s - 10;
148
- } else {
149
- return v > 10;
150
- }
151
- };
152
- </script>
153
- <div
154
- class="container"
155
- class:vertical
156
- class:b
157
- class:dark={$dark}
158
- class:moving={$moving}
159
- bind:clientWidth={width}
160
- bind:clientHeight={height}
161
- style:grid-template-columns={vertical ? style : null}
162
- style:grid-template-rows={!vertical ? style : null}
163
- >
164
- {#if width != null && height != null}
165
- <div style:grid-area="A">
166
- {#if check($off, !b, span)}
167
- <slot name="A" />
168
- {/if}
169
- </div>
170
- <div class="divider">
171
- <div
172
- class="overlay"
173
- use:draggable={{
174
- reset: () => offset,
175
- reversed: !b,
176
- vertical,
177
- dbltap: dbltap,
178
- tap: () => addLast($off),
179
- moving
180
- }}
181
- />
182
- </div>
183
- <div style:grid-area="B">
184
- {#if check($off, b, span)}
185
- <slot name="B" />
186
- {/if}
187
- </div>
188
- {/if}
189
- </div>
190
-
@@ -1,3 +1,10 @@
1
+ <script context="module">const action = (p, length) => {
2
+ const update = (length2) => p.style.strokeDasharray = `${length2} 100`;
3
+ update(length);
4
+ return { update };
5
+ };
6
+ </script>
7
+
1
8
  <script>import { tweened } from "svelte/motion";
2
9
  const d = "M 0 -15 L 15 -15 L 15 0 L 0 0 -9 0 A 6 8 135 0 1 9 0";
3
10
  const length = tweened(100);
@@ -11,23 +18,7 @@ const trigger = () => {
11
18
  $:
12
19
  0 === $length && trigger();
13
20
  </script>
14
- <style>
15
- svg {
16
- width: 100%;
17
- height: 100%;
18
- stroke-width: 4;
19
- stroke-linejoin: miter;
20
- stroke: currentColor;
21
- fill: transparent;
22
- }
23
- </style>
24
21
 
25
- <script context="module">const action = (p, length) => {
26
- const update = (length2) => p.style.strokeDasharray = `${length2} 100`;
27
- update(length);
28
- return { update };
29
- };
30
- </script>
31
22
  <svg viewBox="-35 -35 70 70" on:pointerenter={trigger}>
32
23
  <g transform="rotate(45 0 0)">
33
24
  <path {d} use:action={$length} />
@@ -37,3 +28,13 @@ $:
37
28
  </g>
38
29
  </svg>
39
30
 
31
+ <style>
32
+ svg {
33
+ width: 100%;
34
+ height: 100%;
35
+ stroke-width: 4;
36
+ stroke-linejoin: miter;
37
+ stroke: currentColor;
38
+ fill: transparent;
39
+ }
40
+ </style>
@@ -0,0 +1,14 @@
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
+ };
9
+ export type NilDocProps = typeof __propDef.props;
10
+ export type NilDocEvents = typeof __propDef.events;
11
+ export type NilDocSlots = typeof __propDef.slots;
12
+ export default class NilDoc extends SvelteComponentTyped<NilDocProps, NilDocEvents, NilDocSlots> {
13
+ }
14
+ export {};
@@ -1,34 +1,3 @@
1
- <script>import { tweened } from "svelte/motion";
2
- export let dark = true;
3
- const values = tweened(dark ? vdark : vlight);
4
- $:
5
- $values = dark ? vdark : vlight;
6
- const index = indexer++;
7
- </script>
8
- <style>
9
- svg {
10
- fill: currentColor;
11
- stroke: currentColor;
12
-
13
- -webkit-tap-highlight-color: transparent;
14
- -moz-tap-highlight-color: transparent;
15
- -o-tap-highlight-color: transparent;
16
- /* tap-highlight-color: transparent; */
17
- }
18
-
19
- svg,
20
- rect {
21
- width: 100%;
22
- height: 100%;
23
- }
24
-
25
- line {
26
- stroke-width: 2;
27
- stroke-linecap: round;
28
- stroke-linejoin: round;
29
- }
30
- </style>
31
-
32
1
  <script context="module">let indexer = 0;
33
2
  const vlight = {
34
3
  rotate: 40,
@@ -43,6 +12,17 @@ const vdark = {
43
12
  v: 1
44
13
  };
45
14
  </script>
15
+
16
+ <script>import { tweened } from "svelte/motion";
17
+ export let theme = "dark";
18
+ $:
19
+ dark = theme === "dark";
20
+ const values = tweened(dark ? vdark : vlight);
21
+ $:
22
+ $values = dark ? vdark : vlight;
23
+ const index = indexer++;
24
+ </script>
25
+
46
26
  <svg class:dark viewBox="-25 -25 50 50" transform={`rotate(${$values.rotate})`}>
47
27
  <mask id={`nil_doc_theme_icon_${index}`}>
48
28
  <rect x="-25" y="-25" fill="white" />
@@ -65,3 +45,26 @@ const vdark = {
65
45
  </g>
66
46
  </svg>
67
47
 
48
+ <style>
49
+ svg {
50
+ fill: currentColor;
51
+ stroke: currentColor;
52
+
53
+ -webkit-tap-highlight-color: transparent;
54
+ -moz-tap-highlight-color: transparent;
55
+ -o-tap-highlight-color: transparent;
56
+ /* tap-highlight-color: transparent; */
57
+ }
58
+
59
+ svg,
60
+ rect {
61
+ width: 100%;
62
+ height: 100%;
63
+ }
64
+
65
+ line {
66
+ stroke-width: 2;
67
+ stroke-linecap: round;
68
+ stroke-linejoin: round;
69
+ }
70
+ </style>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Theme } from "../context";
3
+ declare const __propDef: {
4
+ props: {
5
+ theme?: Theme;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type ThemeProps = typeof __propDef.props;
13
+ export type ThemeEvents = typeof __propDef.events;
14
+ export type ThemeSlots = typeof __propDef.slots;
15
+ export default class Theme extends SvelteComponentTyped<ThemeProps, ThemeEvents, ThemeSlots> {
16
+ }
17
+ export {};
@@ -1,33 +1,3 @@
1
- <style>
2
- .nav {
3
- width: 100%;
4
- height: 100%;
5
- min-width: 200px;
6
- display: flex;
7
- flex-direction: column;
8
- }
9
-
10
- .search-bar {
11
- padding: 5px;
12
- }
13
-
14
- input {
15
- height: 30px;
16
- width: 100%;
17
- padding: 0px 10px;
18
- }
19
-
20
- input:focus {
21
- outline: none;
22
- }
23
-
24
- * {
25
- box-sizing: border-box;
26
- padding: 0px;
27
- margin: 0px;
28
- }
29
- </style>
30
-
31
1
  <script context="module">import { fuzz } from "./utils/fuzz";
32
2
  const apply = (paths, init, pre, next, post) => {
33
3
  const retval = {};
@@ -67,6 +37,7 @@ const populate = (filter, info, renamer) => {
67
37
  );
68
38
  };
69
39
  </script>
40
+
70
41
  <script>import Tree from "./Tree.svelte";
71
42
  export let info;
72
43
  export let selected;
@@ -95,6 +66,7 @@ const update = (selected2) => {
95
66
  $:
96
67
  update(selected);
97
68
  </script>
69
+
98
70
  <div class="nav">
99
71
  <div class="search-bar">
100
72
  <input bind:value={filter} type="text" placeholder="Search for page..." />
@@ -112,3 +84,32 @@ $:
112
84
  </div>
113
85
  </div>
114
86
 
87
+ <style>
88
+ .nav {
89
+ width: 100%;
90
+ height: 100%;
91
+ min-width: 200px;
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+
96
+ .search-bar {
97
+ padding: 5px;
98
+ }
99
+
100
+ input {
101
+ height: 30px;
102
+ width: 100%;
103
+ padding: 0px 10px;
104
+ }
105
+
106
+ input:focus {
107
+ outline: none;
108
+ }
109
+
110
+ * {
111
+ box-sizing: border-box;
112
+ padding: 0px;
113
+ margin: 0px;
114
+ }
115
+ </style>