@nil-/doc 0.2.50 → 0.2.51

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 (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/Layout.svelte +37 -71
  3. package/components/block/Block.svelte +67 -25
  4. package/components/block/Controls.svelte +3 -5
  5. package/components/block/Controls.svelte.d.ts +2 -2
  6. package/components/block/Instance.svelte +41 -74
  7. package/components/block/context.d.ts +2 -2
  8. package/components/block/context.js +2 -1
  9. package/components/block/controls/events/Events.svelte +14 -5
  10. package/components/block/controls/events/misc/Styler.svelte +16 -41
  11. package/components/block/controls/props/Color.svelte +21 -0
  12. package/components/block/controls/props/Color.svelte.d.ts +21 -0
  13. package/components/block/controls/props/Component.svelte +5 -0
  14. package/components/block/controls/props/Number.svelte +4 -5
  15. package/components/block/controls/props/Object.svelte +8 -11
  16. package/components/block/controls/props/Props.svelte +2 -5
  17. package/components/block/controls/props/Range.svelte +5 -4
  18. package/components/block/controls/props/Select.svelte +5 -8
  19. package/components/block/controls/props/Switch.svelte +4 -5
  20. package/components/block/controls/props/Text.svelte +8 -9
  21. package/components/block/controls/props/Tuple.svelte +13 -26
  22. package/components/block/controls/props/misc/Name.svelte +1 -2
  23. package/components/block/controls/props/misc/Styler.svelte +22 -29
  24. package/components/block/controls/props/misc/defaulter.d.ts +8 -8
  25. package/components/block/controls/props/misc/defaulter.js +28 -48
  26. package/components/block/controls/props/misc/utils.d.ts +11 -0
  27. package/components/block/controls/props/misc/utils.js +31 -0
  28. package/components/block/controls/types.d.ts +10 -2
  29. package/components/block/icons/Button.svelte +30 -0
  30. package/components/block/icons/Button.svelte.d.ts +35 -0
  31. package/components/block/icons/ControlView.svelte +14 -0
  32. package/components/block/icons/ControlView.svelte.d.ts +16 -0
  33. package/components/block/icons/Position.svelte +50 -0
  34. package/components/block/icons/Position.svelte.d.ts +16 -0
  35. package/components/etc/Base.svelte +58 -0
  36. package/components/etc/Base.svelte.d.ts +18 -0
  37. package/components/etc/Container.svelte +24 -37
  38. package/components/etc/Content.svelte +45 -0
  39. package/components/etc/Content.svelte.d.ts +18 -0
  40. package/components/icons/NilDoc.svelte +1 -1
  41. package/components/icons/Theme.svelte +0 -5
  42. package/components/navigation/Nav.svelte +6 -10
  43. package/components/navigation/Node.svelte +9 -10
  44. package/components/title/Icon.svelte +3 -3
  45. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ /** @typedef {typeof __propDef.props} ButtonProps */
2
+ /** @typedef {typeof __propDef.events} ButtonEvents */
3
+ /** @typedef {typeof __propDef.slots} ButtonSlots */
4
+ export default class Button extends SvelteComponentTyped<{
5
+ title?: string | undefined;
6
+ scale?: boolean | undefined;
7
+ }, {
8
+ click: MouseEvent;
9
+ keypress: KeyboardEvent;
10
+ } & {
11
+ [evt: string]: CustomEvent<any>;
12
+ }, {
13
+ default: {};
14
+ }> {
15
+ }
16
+ export type ButtonProps = typeof __propDef.props;
17
+ export type ButtonEvents = typeof __propDef.events;
18
+ export type ButtonSlots = typeof __propDef.slots;
19
+ import { SvelteComponentTyped } from "svelte";
20
+ declare const __propDef: {
21
+ props: {
22
+ title?: string | undefined;
23
+ scale?: boolean | undefined;
24
+ };
25
+ events: {
26
+ click: MouseEvent;
27
+ keypress: KeyboardEvent;
28
+ } & {
29
+ [evt: string]: CustomEvent<any>;
30
+ };
31
+ slots: {
32
+ default: {};
33
+ };
34
+ };
35
+ export {};
@@ -0,0 +1,14 @@
1
+ <script context="module"></script>
2
+
3
+ <script>import { tweened } from "svelte/motion";
4
+ export let mode = "prop";
5
+ const v = tweened(mode === "event" ? 1 : 0, { duration: 150 });
6
+ $:
7
+ $v = mode === "event" ? 1 : 0;
8
+ </script>
9
+
10
+ <svg viewBox="-50 -50 100 100">
11
+ <rect width="60" height="60" x="-30" y="-30" fill="transparent" />
12
+ <rect height="40" width="20" x={-$v * 20} y="-20" rx="2" ry="2" fill="transparent" />
13
+ <polygon transform="translate(5, 0)" points="-15,-2 1,-2, 1,-6 6,0 1,6 1,2 -15,2" />
14
+ </svg>
@@ -0,0 +1,16 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ mode?: "prop" | "event" | undefined;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {};
10
+ };
11
+ export type ControlViewProps = typeof __propDef.props;
12
+ export type ControlViewEvents = typeof __propDef.events;
13
+ export type ControlViewSlots = typeof __propDef.slots;
14
+ export default class ControlView extends SvelteComponentTyped<ControlViewProps, ControlViewEvents, ControlViewSlots> {
15
+ }
16
+ export {};
@@ -0,0 +1,50 @@
1
+ <script context="module">const bottom = {
2
+ width: 60,
3
+ height: 20,
4
+ x: -30,
5
+ y: 10
6
+ };
7
+ const right = {
8
+ width: 20,
9
+ height: 60,
10
+ x: 10,
11
+ y: -30
12
+ };
13
+ const nobottom = {
14
+ width: 60,
15
+ height: 0,
16
+ x: -30,
17
+ y: 30
18
+ };
19
+ const noright = {
20
+ width: 0,
21
+ height: 60,
22
+ x: 30,
23
+ y: -30
24
+ };
25
+ const settings = {
26
+ hidden: [nobottom, noright],
27
+ bottom: [bottom, noright],
28
+ right: [nobottom, right]
29
+ };
30
+ </script>
31
+
32
+ <script>import { tweened } from "svelte/motion";
33
+ export let position = "hidden";
34
+ const offset = tweened(settings[position], { duration: 150 });
35
+ $:
36
+ $offset = settings[position];
37
+ </script>
38
+
39
+ <svg viewBox="-50 -50 100 100">
40
+ <rect width="60" height="60" x="-30" y="-30" fill="transparent" />
41
+ <rect {...$offset[0]} />
42
+ <rect {...$offset[1]} />
43
+ </svg>
44
+
45
+ <style>
46
+ svg {
47
+ stroke-width: 3;
48
+ fill: currentColor;
49
+ }
50
+ </style>
@@ -0,0 +1,16 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ position?: "bottom" | "right" | "hidden" | undefined;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {};
10
+ };
11
+ export type PositionProps = typeof __propDef.props;
12
+ export type PositionEvents = typeof __propDef.events;
13
+ export type PositionSlots = typeof __propDef.slots;
14
+ export default class Position extends SvelteComponentTyped<PositionProps, PositionEvents, PositionSlots> {
15
+ }
16
+ export {};
@@ -0,0 +1,58 @@
1
+ <script>export let dark = true;
2
+ </script>
3
+
4
+ <div class:dark>
5
+ <slot />
6
+ </div>
7
+
8
+ <style>
9
+ @import url("https://fonts.googleapis.com/css?family=Fira%20Code");
10
+
11
+ div {
12
+ width: 100%;
13
+ height: 100%;
14
+ font-family: "Fira Code", "Courier New", Courier, monospace;
15
+
16
+ --i-nil-doc-nav-hovered: var(--nil-doc-nav-hovered, hsla(203, 98%, 50%, 0.07));
17
+ --i-nil-doc-nav-selected: var(--nil-doc-nav-selected, hsla(203, 98%, 50%, 0.822));
18
+ --i-nil-doc-nav-selected-color: var(--nil-doc-nav-selected-color, black);
19
+
20
+ --i-nil-doc-transition-time: var(--nil-doc-transition-time, 350ms);
21
+ }
22
+
23
+ div {
24
+ --i-nil-doc-color: var(--nil-doc-color, hsl(0, 0%, 0%));
25
+ --i-nil-doc-color-scheme: var(--nil-doc-color-scheme, light);
26
+
27
+ --i-nil-doc-bg-color: var(--nil-doc-bg-color, hsl(0, 0%, 98%));
28
+ --i-nil-doc-content-outline-color: var(--nil-doc-content-outline-color, hsla(0, 0%, 0%, 0.3));
29
+
30
+ --i-nil-doc-block-bg-color: var(--nil-doc-block-bg-color, hsla(0, 0%, 98%, 0.3));
31
+ --i-nil-doc-block-outline-color: var(--nil-doc-block-outline-color, hsla(0, 0%, 0%, 0.3));
32
+
33
+ --i-nil-doc-container-p: var(--nil-doc-container-p, hsl(0, 2%, 70%));
34
+ --i-nil-doc-container-s: var(--nil-doc-container-s, hsl(0, 0%, 0%));
35
+
36
+ --i-nil-doc-controls-p: var(--nil-doc-controls-p, hsl(0, 0%, 100%));
37
+ --i-nil-doc-controls-s: var(--nil-doc-controls-s, hsl(210, 29%, 97%));
38
+ --i-nil-doc-controls-hover: var(--nil-doc-controls-hover, hsl(210, 100%, 90%));
39
+ }
40
+
41
+ div.dark {
42
+ --i-nil-doc-color: var(--nil-doc-color, hsl(0, 0%, 80%));
43
+ --i-nil-doc-color-scheme: var(--nil-doc-color-scheme, dark);
44
+
45
+ --i-nil-doc-bg-color: var(--nil-doc-bg-color, hsl(210, 6%, 7%));
46
+ --i-nil-doc-content-outline-color: var(--nil-doc-content-outline-color, hsla(0, 0%, 100%, 0.3));
47
+
48
+ --i-nil-doc-block-bg-color: var(--nil-doc-block-bg-color, hsla(200, 4%, 7%, 0.3));
49
+ --i-nil-doc-block-outline-color: var(--nil-doc-block-outline-color, hsla(0, 0%, 1000%, 0.3));
50
+
51
+ --i-nil-doc-container-p: var(--nil-doc-container-p, hsl(0, 2%, 40%));
52
+ --i-nil-doc-container-s: var(--nil-doc-container-s, hsl(0, 0%, 100%));
53
+
54
+ --i-nil-doc-controls-p: var(--nil-doc-controls-p, hsl(213, 26%, 7%));
55
+ --i-nil-doc-controls-s: var(--nil-doc-controls-s, hsl(213, 26%, 11%));
56
+ --i-nil-doc-controls-hover: var(--nil-doc-controls-hover, hsl(203, 100%, 15%));
57
+ }
58
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ dark?: boolean | undefined;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {
10
+ default: {};
11
+ };
12
+ };
13
+ export type BaseProps = typeof __propDef.props;
14
+ export type BaseEvents = typeof __propDef.events;
15
+ export type BaseSlots = typeof __propDef.slots;
16
+ export default class Base extends SvelteComponentTyped<BaseProps, BaseEvents, BaseSlots> {
17
+ }
18
+ export {};
@@ -1,8 +1,6 @@
1
1
  <script>import { writable } from "svelte/store";
2
2
  import { tweened } from "svelte/motion";
3
3
  import { createDraggable } from "./action";
4
- import { getTheme } from "../context";
5
- const dark = getTheme();
6
4
  export let vertical = false;
7
5
  export let offset = 0;
8
6
  export let b = false;
@@ -18,16 +16,17 @@ const update = (limit, value) => {
18
16
  offset = Math.max(Math.min(value, span - limit), limit);
19
17
  };
20
18
  const off = tweened(offset, { duration: 50 });
19
+ const min = 4;
21
20
  let last = [];
22
21
  $:
23
- update(10, $position);
22
+ update(min, $position);
24
23
  $:
25
24
  $off = offset;
26
25
  $:
27
- style = !b ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
26
+ style = !b ? `auto 0.2rem ${$off}px` : `${$off}px 0.2rem auto`;
28
27
  const moving = writable(false);
29
28
  const addLast = (v) => {
30
- if (v > 10) {
29
+ if (v > min) {
31
30
  if (last.length < 2) {
32
31
  last = [...last, v];
33
32
  } else {
@@ -36,18 +35,18 @@ const addLast = (v) => {
36
35
  }
37
36
  };
38
37
  const dbltap = () => {
39
- if ($off > 10) {
38
+ if ($off > min) {
40
39
  addLast(offset);
41
- offset = 10;
40
+ offset = min;
42
41
  } else if (last.length > 0) {
43
42
  offset = last.pop();
44
43
  }
45
44
  };
46
45
  const check = (v, flag, s) => {
47
46
  if (flag) {
48
- return v < s - 10;
47
+ return v < s - min;
49
48
  } else {
50
- return v > 10;
49
+ return v > min;
51
50
  }
52
51
  };
53
52
  </script>
@@ -56,7 +55,6 @@ const check = (v, flag, s) => {
56
55
  class="container"
57
56
  class:vertical
58
57
  class:b
59
- class:dark={$dark}
60
58
  class:moving={$moving}
61
59
  bind:clientWidth={width}
62
60
  bind:clientHeight={height}
@@ -72,6 +70,7 @@ const check = (v, flag, s) => {
72
70
  <div class="divider">
73
71
  <div
74
72
  class="overlay"
73
+ title={`Collapse ${vertical ? (b ? "left" : "right"): (b ? "top" : "bottom")}`}
75
74
  use:draggable={{
76
75
  reset: () => offset,
77
76
  reversed: !b,
@@ -91,10 +90,6 @@ const check = (v, flag, s) => {
91
90
  </div>
92
91
 
93
92
  <style>
94
- div {
95
- box-sizing: border-box;
96
- }
97
-
98
93
  .container {
99
94
  width: 100%;
100
95
  height: 100%;
@@ -129,62 +124,54 @@ const check = (v, flag, s) => {
129
124
 
130
125
  .container > .divider > .overlay {
131
126
  width: 100%;
132
- height: 20px;
127
+ height: 1.5rem;
133
128
  cursor: ns-resize;
134
129
  transform: translateY(-50%);
135
130
  }
136
131
 
137
132
  .container.vertical > .divider > .overlay {
138
- width: 20px;
133
+ width: 1.5rem;
139
134
  height: 100%;
140
135
  cursor: ew-resize;
141
136
  transform: translateX(-50%);
142
137
  }
143
138
 
144
139
  /* colors */
145
- .container {
146
- --color-p: hsl(0, 2%, 70%);
147
- --color-s: hsl(0, 0%, 0%);
148
- }
149
-
150
- .container.dark {
151
- --color-p: hsl(0, 2%, 40%);
152
- --color-s: hsl(0, 0%, 100%);
153
- }
154
-
155
140
  .divider {
156
- transition: border-color 350ms, background-color 350ms;
141
+ transition: border-color var(--i-nil-doc-transition-time),
142
+ background-color var(--i-nil-doc-transition-time);
143
+ --width: 0.0625rem;
157
144
  }
158
145
 
159
146
  .container:not(.vertical) > .divider {
160
- border-bottom: var(--color-p) solid 2.5px;
161
- border-top: var(--color-p) solid 2.5px;
162
- background-color: var(--color-p);
147
+ border-bottom: var(--i-nil-doc-container-p) solid var(--width);
148
+ border-top: var(--i-nil-doc-container-p) solid var(--width);
149
+ background-color: var(--i-nil-doc-container-p);
163
150
  }
164
151
 
165
152
  .container.vertical > .divider {
166
- border-right: var(--color-p) solid 2.5px;
167
- border-left: var(--color-p) solid 2.5px;
168
- background-color: var(--color-p);
153
+ border-right: var(--i-nil-doc-container-p) solid var(--width);
154
+ border-left: var(--i-nil-doc-container-p) solid var(--width);
155
+ background-color: var(--i-nil-doc-container-p);
169
156
  }
170
157
 
171
158
  .container:not(.b):not(.vertical) > .divider:hover,
172
159
  .container.moving:not(.b):not(.vertical) > .divider {
173
- border-bottom: var(--color-s) solid 2.5px;
160
+ border-bottom: var(--i-nil-doc-container-s) solid var(--width);
174
161
  }
175
162
 
176
163
  .container.b:not(.vertical) > .divider:hover,
177
164
  .container.moving.b:not(.vertical) > .divider {
178
- border-top: var(--color-s) solid 2.5px;
165
+ border-top: var(--i-nil-doc-container-s) solid var(--width);
179
166
  }
180
167
 
181
168
  .container:not(.b).vertical > .divider:hover,
182
169
  .container.moving:not(.b).vertical > .divider {
183
- border-right: var(--color-s) solid 2.5px;
170
+ border-right: var(--i-nil-doc-container-s) solid var(--width);
184
171
  }
185
172
 
186
173
  .container.vertical.b > .divider:hover,
187
174
  .container.moving.vertical.b > .divider {
188
- border-left: var(--color-s) solid 2.5px;
175
+ border-left: var(--i-nil-doc-container-s) solid var(--width);
189
176
  }
190
177
  </style>
@@ -0,0 +1,45 @@
1
+ <script>export let flat = false;
2
+ </script>
3
+
4
+ <div class="scrollable">
5
+ {#if flat}
6
+ <slot />
7
+ {:else}
8
+ <div class="wrapper">
9
+ <slot />
10
+ </div>
11
+ {/if}
12
+ </div>
13
+
14
+ <style>
15
+ .wrapper {
16
+ display: inline-block;
17
+ box-sizing: border-box;
18
+ margin: 0.5rem;
19
+ padding: 0.5rem;
20
+ border-radius: 0.5rem;
21
+ min-width: calc(100% - 1rem);
22
+ min-height: calc(100% - 1rem);
23
+ }
24
+
25
+ /* scrollable */
26
+ .scrollable {
27
+ width: 100%;
28
+ height: 100%;
29
+ overflow: scroll;
30
+ /* Firefox */
31
+ scrollbar-width: none;
32
+ /* IE and Edge */
33
+ -ms-overflow-style: none;
34
+ }
35
+
36
+ .scrollable::-webkit-scrollbar {
37
+ display: none;
38
+ }
39
+
40
+ /* color */
41
+ .wrapper {
42
+ border: solid 1px var(--i-nil-doc-content-outline-color);
43
+ box-shadow: 0px 0px 5px 0px var(--i-nil-doc-content-outline-color);
44
+ }
45
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ flat?: boolean | undefined;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {
10
+ default: {};
11
+ };
12
+ };
13
+ export type ContentProps = typeof __propDef.props;
14
+ export type ContentEvents = typeof __propDef.events;
15
+ export type ContentSlots = typeof __propDef.slots;
16
+ export default class Content extends SvelteComponentTyped<ContentProps, ContentEvents, ContentSlots> {
17
+ }
18
+ export {};
@@ -32,7 +32,7 @@ $:
32
32
  svg {
33
33
  width: 100%;
34
34
  height: 100%;
35
- stroke-width: 4;
35
+ stroke-width: 3;
36
36
  stroke-linejoin: miter;
37
37
  stroke: currentColor;
38
38
  fill: transparent;
@@ -49,11 +49,6 @@ const index = indexer++;
49
49
  svg {
50
50
  fill: currentColor;
51
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
52
  }
58
53
 
59
54
  svg,
@@ -88,28 +88,24 @@ $:
88
88
  .nav {
89
89
  width: 100%;
90
90
  height: 100%;
91
- min-width: 200px;
91
+ min-width: 12.5rem;
92
92
  display: flex;
93
93
  flex-direction: column;
94
94
  }
95
95
 
96
96
  .search-bar {
97
- padding: 5px;
97
+ padding: 0.3125rem;
98
98
  }
99
99
 
100
100
  input {
101
- height: 30px;
101
+ font-size: 0.75rem;
102
+ height: 1.875rem;
102
103
  width: 100%;
103
- padding: 0px 10px;
104
+ padding: 0px 0.625rem;
105
+ box-sizing: border-box;
104
106
  }
105
107
 
106
108
  input:focus {
107
109
  outline: none;
108
110
  }
109
-
110
- * {
111
- box-sizing: border-box;
112
- padding: 0px;
113
- margin: 0px;
114
- }
115
111
  </style>
@@ -68,29 +68,28 @@ const click = (link) => {
68
68
  }
69
69
 
70
70
  .header {
71
- height: 30px;
71
+ height: 1.875rem;
72
72
  display: grid;
73
- grid-template-columns: 15px 1fr;
73
+ grid-template-columns: 1rem 1fr;
74
74
  align-items: center;
75
75
  cursor: pointer;
76
- gap: 5px;
77
- box-sizing: border-box;
76
+ gap: 0.3125rem;
78
77
  }
79
78
 
80
79
  .header:hover {
81
- background-color: hsla(203, 98%, 50%, 0.07);
80
+ background-color: var(--i-nil-doc-nav-hovered);
82
81
  }
83
82
 
84
83
  .header.selected {
85
- background-color: hsla(203, 98%, 50%, 0.822);
86
- color: black;
84
+ background-color: var(--i-nil-doc-nav-selected);
85
+ color: var(--i-nil-doc-nav-selected-color);
87
86
  }
88
87
 
89
88
  .icon {
90
89
  justify-content: center;
91
- height: 15px;
92
- width: 15px;
93
- transition: transform 350ms;
90
+ height: 1rem;
91
+ width: 1rem;
92
+ transition: transform var(--i-nil-doc-transition-time);
94
93
  }
95
94
 
96
95
  .icon.expanded {
@@ -7,10 +7,10 @@
7
7
 
8
8
  <style>
9
9
  div {
10
- width: 40px;
11
- height: 40px;
10
+ width: 2.5rem;
11
+ height: 2.5rem;
12
12
  cursor: pointer;
13
- transition: transform 350ms;
13
+ transition: transform var(--i-nil-doc-transition-time);
14
14
  }
15
15
 
16
16
  div:hover {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"