@nil-/doc 0.2.35 → 0.2.37

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.37
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][fix] params prop is now reactive ([#57](https://github.com/njaldea/mono/pull/57))
8
+ [doc] added component documentation link to deployment
9
+ [doc] removed inRoot
10
+
11
+ - [doc][cleanup] refactored Instance/Template/Params ([#57](https://github.com/njaldea/mono/pull/57))
12
+
13
+ ## 0.2.36
14
+
15
+ ### Patch Changes
16
+
17
+ - [doc][fix] color changes and transition ([#55](https://github.com/njaldea/mono/pull/55))
18
+
19
+ - [all] added html meta details ([#55](https://github.com/njaldea/mono/pull/55))
20
+
3
21
  ## 0.2.35
4
22
 
5
23
  ### Patch Changes
@@ -5,8 +5,10 @@
5
5
  display: grid;
6
6
  grid-template-columns: 1fr;
7
7
  grid-template-rows: minmax(40px, auto) 1fr;
8
+ gap: 1px;
8
9
  width: 100%;
9
10
  height: 100%;
11
+ box-sizing: border-box;
10
12
  font-family: "Fira Code", "Courier New", Courier, monospace;
11
13
  }
12
14
 
@@ -20,6 +22,11 @@
20
22
  user-select: none;
21
23
  }
22
24
 
25
+ .main {
26
+ height: 100%;
27
+ overflow: hidden;
28
+ }
29
+
23
30
  .content {
24
31
  height: 100%;
25
32
  padding: 5px;
@@ -28,14 +35,6 @@
28
35
  box-sizing: border-box;
29
36
  }
30
37
 
31
- /* reset block */
32
- .reset {
33
- width: 100%;
34
- height: 100%;
35
- box-sizing: border-box;
36
- font-family: "Fira Code", "Courier New", Courier, monospace;
37
- }
38
-
39
38
  /* scrollable */
40
39
  .scrollable {
41
40
  overflow: scroll;
@@ -49,24 +48,25 @@
49
48
 
50
49
  /* colors */
51
50
  .layout {
52
- transition: color 350ms, background-color 350ms;
53
- background-color: hsl(0, 0%, 100%);
54
- color: hsl(0, 100%, 0%);
55
51
  color-scheme: light;
52
+ color: hsl(0, 0%, 0%);
53
+ background-color: hsl(0, 2%, 70%);
54
+ transition: color 350ms, background-color 350ms;
56
55
  }
57
56
 
58
- .layout > .top {
59
- border-bottom: hsl(0, 2%, 70%) solid 1px;
57
+ .layout.dark {
58
+ color-scheme: dark;
59
+ color: hsl(0, 0%, 80%);
60
+ background-color: hsl(0, 2%, 40%);
60
61
  }
61
62
 
62
- .layout.dark > .top {
63
- border-bottom: hsl(0, 2%, 38%) solid 1px;
63
+ .layout > div {
64
+ background-color: hsl(0, 0%, 100%);
65
+ transition: background-color 350ms;
64
66
  }
65
67
 
66
- .layout.dark {
68
+ .layout.dark > div {
67
69
  background-color: hsl(200, 4%, 14%);
68
- color: hsl(200, 6%, 80%);
69
- color-scheme: dark;
70
70
  }
71
71
  </style>
72
72
 
@@ -74,7 +74,7 @@
74
74
  </script>
75
75
  <script>import Container from "./etc/Container.svelte";
76
76
  import Nav from "./navigation/Nav.svelte";
77
- import { inRoot, getTheme, initTheme, evalTheme } from "./context";
77
+ import { getTheme, initTheme, evalTheme } from "./context";
78
78
  import ThemeIcon from "./etc/ThemeIcon.svelte";
79
79
  import NilIcon from "./etc/NilIcon.svelte";
80
80
  export let data;
@@ -82,37 +82,42 @@ export let current = null;
82
82
  export let sorter = null;
83
83
  export let renamer = null;
84
84
  export let theme = void 0;
85
- const r = inRoot();
86
85
  const parentTheme = getTheme();
87
- const isDark = initTheme();
86
+ const dark = initTheme();
88
87
  $:
89
- $isDark = evalTheme(parentTheme ? $parentTheme : true, theme);
88
+ $dark = evalTheme(parentTheme ? $parentTheme : true, theme);
90
89
  </script>
91
- <div class="layout" class:reset={r} class:dark={$isDark}>
90
+ <!--
91
+ @component
92
+ See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details.
93
+ -->
94
+ <div class="layout" class:dark={$dark}>
92
95
  <div class="top">
93
96
  <slot name="title"><span>@nil-/doc</span></slot>
94
- <ThemeIcon bind:dark={$isDark} />
97
+ <ThemeIcon bind:dark={$dark} />
95
98
  <NilIcon />
96
99
  </div>
97
- <Container offset={250} vertical secondary>
98
- <svelte:fragment slot="primary">
99
- <div class="content scrollable">
100
- <Nav
101
- info={data}
102
- selected={current ?? ""}
103
- sorter={sorter ?? defaultSorter}
104
- renamer={renamer ?? ((s) => s)}
105
- on:navigate
106
- />
107
- </div>
108
- </svelte:fragment>
109
- <svelte:fragment slot="secondary">
110
- <div class="content scrollable">
111
- {#key current}
112
- <slot />
113
- {/key}
114
- </div>
115
- </svelte:fragment>
116
- </Container>
100
+ <div class="main">
101
+ <Container offset={250} vertical b>
102
+ <svelte:fragment slot="A">
103
+ <div class="content scrollable">
104
+ <Nav
105
+ info={data}
106
+ selected={current ?? ""}
107
+ sorter={sorter ?? defaultSorter}
108
+ renamer={renamer ?? ((s) => s)}
109
+ on:navigate
110
+ />
111
+ </div>
112
+ </svelte:fragment>
113
+ <svelte:fragment slot="B">
114
+ <div class="content scrollable">
115
+ {#key current}
116
+ <slot />
117
+ {/key}
118
+ </div>
119
+ </svelte:fragment>
120
+ </Container>
121
+ </div>
117
122
  </div>
118
123
 
@@ -22,6 +22,7 @@ declare const __propDef: {
22
22
  export type LayoutProps = typeof __propDef.props;
23
23
  export type LayoutEvents = typeof __propDef.events;
24
24
  export type LayoutSlots = typeof __propDef.slots;
25
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/1-Layout) for more details. */
25
26
  export default class Layout extends SvelteComponentTyped<LayoutProps, LayoutEvents, LayoutSlots> {
26
27
  }
27
28
  export {};
@@ -2,45 +2,63 @@
2
2
  @import url("https://fonts.googleapis.com/css?family=Fira%20Code");
3
3
 
4
4
  div {
5
- display: flex;
6
- flex-direction: column;
7
- font-family: "Fira Code", "Courier New", Courier, monospace;
8
- }
5
+ display: grid;
6
+ border-radius: 5px;
7
+ grid-auto-rows: 1fr;
8
+ grid-auto-columns: auto;
9
+ grid-auto-flow: row;
9
10
 
10
- /* reset block */
11
- .reset {
12
- width: 100%;
13
- height: 100%;
14
11
  box-sizing: border-box;
15
12
  font-family: "Fira Code", "Courier New", Courier, monospace;
13
+ padding: 3px;
14
+ gap: 3px;
15
+ }
16
+
17
+ div.columns {
18
+ grid-auto-rows: auto;
19
+ grid-auto-columns: 1fr;
20
+ grid-auto-flow: column;
16
21
  }
17
22
 
18
23
  /* colors */
19
24
  div {
20
25
  color-scheme: light;
21
- color: hsl(0, 100%, 0%);
26
+ color: hsl(0, 0%, 0%);
27
+ background-color: hsl(0, 2%, 70%);
28
+ transition: color 350ms, background-color 350ms;
22
29
  }
23
30
 
24
31
  div.dark {
25
32
  color-scheme: dark;
26
- color: hsl(200, 6%, 80%);
33
+ color: hsl(0, 0%, 80%);
34
+ background-color: hsl(0, 2%, 40%);
27
35
  }
28
36
  </style>
29
37
 
30
- <script>import { initParams, initDefaults, initControls, initControlsState } from "./context";
31
- import { inRoot, getTheme, initTheme, evalTheme } from "../context";
38
+ <script>import {
39
+ initParams,
40
+ initDefaults,
41
+ initControls,
42
+ initControlsState,
43
+ initOrientation
44
+ } from "./context";
45
+ import { getTheme, initTheme, evalTheme } from "../context";
32
46
  initParams();
33
47
  initDefaults();
34
48
  initControls();
35
49
  initControlsState();
36
- const r = inRoot();
50
+ const columns = initOrientation();
37
51
  export let theme = void 0;
38
52
  const parentTheme = getTheme();
39
- const isDark = initTheme();
53
+ const dark = initTheme();
40
54
  $:
41
- $isDark = evalTheme(parentTheme ? $parentTheme : false, theme);
55
+ $dark = evalTheme(parentTheme ? $parentTheme : false, theme);
42
56
  </script>
43
- <div class:reset={r} class:dark={$isDark}>
57
+ <!--
58
+ @component
59
+ See [documentation](https://mono-doc.vercel.app/3-Components/2-Block) for more details.
60
+ -->
61
+ <div class:columns={$columns} class:dark={$dark}>
44
62
  <slot />
45
63
  </div>
46
64
 
@@ -14,6 +14,7 @@ declare const __propDef: {
14
14
  export type BlockProps = typeof __propDef.props;
15
15
  export type BlockEvents = typeof __propDef.events;
16
16
  export type BlockSlots = typeof __propDef.slots;
17
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block) for more details. */
17
18
  export default class Block extends SvelteComponentTyped<BlockProps, BlockEvents, BlockSlots> {
18
19
  }
19
20
  export {};
@@ -4,10 +4,15 @@ export let props = [];
4
4
  export let hide = false;
5
5
  export let position = void 0;
6
6
  const controls = getControls();
7
- $controls = props;
7
+ $:
8
+ $controls = props;
8
9
  const state = getControlsState();
9
10
  $:
10
11
  $state.hide = hide;
11
12
  $:
12
13
  $state.position = position;
13
14
  </script>
15
+ <!--
16
+ @component
17
+ See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/3-Controls) for more details.
18
+ -->
@@ -14,6 +14,7 @@ declare const __propDef: {
14
14
  export type ControlsProps = typeof __propDef.props;
15
15
  export type ControlsEvents = typeof __propDef.events;
16
16
  export type ControlsSlots = typeof __propDef.slots;
17
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/3-Controls) for more details. */
17
18
  export default class Controls extends SvelteComponentTyped<ControlsProps, ControlsEvents, ControlsSlots> {
18
19
  }
19
20
  export {};
@@ -1,11 +1,115 @@
1
+ <style>
2
+ div {
3
+ box-sizing: border-box;
4
+ }
1
5
 
2
- <script>import Template from "./Template.svelte";
3
- import Params from "./Params.svelte";
6
+ .instance {
7
+ overflow: hidden;
8
+ }
9
+
10
+ .cside {
11
+ display: grid;
12
+ grid-template-columns: 1fr 550px;
13
+ }
14
+
15
+ .content {
16
+ min-height: 100px;
17
+ border-radius: 5px;
18
+ }
19
+
20
+ div:not(.cside) > .misc {
21
+ border-bottom-left-radius: 5px;
22
+ border-bottom-right-radius: 5px;
23
+ user-select: none;
24
+ }
25
+
26
+ .cside > .misc {
27
+ border-top-right-radius: 5px;
28
+ border-bottom-right-radius: 5px;
29
+ user-select: none;
30
+ }
31
+
32
+ .content,
33
+ .misc {
34
+ border-style: solid;
35
+ border-width: 1px;
36
+ padding: 2px;
37
+ }
38
+
39
+ /* scrollable */
40
+ .scrollable {
41
+ overflow: scroll;
42
+ scrollbar-width: none; /* Firefox */
43
+ -ms-overflow-style: none; /* IE and Edge */
44
+ }
45
+
46
+ .scrollable::-webkit-scrollbar {
47
+ display: none;
48
+ }
49
+
50
+ /* colors */
51
+ .content,
52
+ .misc {
53
+ border-color: hsl(0, 2%, 60%);
54
+ background-color: hsl(0, 0%, 100%);
55
+ transition: border-color 350ms, background-color 350ms;
56
+ }
57
+
58
+ .dark.content,
59
+ .dark.misc {
60
+ border-color: hsl(0, 2%, 40%);
61
+ background-color: hsl(200, 4%, 14%);
62
+ }
63
+ </style>
64
+
65
+ <script>import { beforeUpdate } from "svelte";
66
+ import { cquery } from "./action";
67
+ import { getControls, getControlsState } from "./context";
68
+ import { getTheme } from "../context";
69
+ import Controls from "./controls/Controls.svelte";
70
+ import { resolve } from "./utils";
71
+ const controls = getControls();
72
+ const controlsState = getControlsState();
73
+ const dark = getTheme();
74
+ $:
75
+ expanded = $controls.length > 0 && !$controlsState.hide;
4
76
  export let defaults = void 0;
5
77
  export let noreset = false;
6
- const cast = (t) => t;
78
+ let key = false;
79
+ beforeUpdate(() => key = !key);
80
+ const resolveArgs = resolve;
81
+ let bound = {};
82
+ const updateBound = (d) => {
83
+ bound = resolve(d ?? {}, {});
84
+ };
85
+ $:
86
+ updateBound(defaults);
7
87
  </script>
8
- <Template {defaults} {noreset} let:props let:key>
9
- <slot props={cast(props)} {key} />
10
- </Template>
11
- <Params />
88
+ <div
89
+ class="instance"
90
+ class:cside={expanded && "right" === $controlsState.position}
91
+ use:cquery={{
92
+ class: "cside",
93
+ min: 1000,
94
+ w: true,
95
+ enabled: expanded && $controlsState.position === undefined
96
+ }}
97
+ >
98
+ {#if noreset}
99
+ <div class="content scrollable" class:dark={$dark}>
100
+ <slot props={resolveArgs(defaults ?? {}, bound)} {key} />
101
+ </div>
102
+ {:else}
103
+ {#key key}
104
+ <div class="content scrollable" class:dark={$dark}>
105
+ <slot props={resolveArgs(defaults ?? {}, bound)} {key} />
106
+ </div>
107
+ {/key}
108
+ {/if}
109
+ {#if expanded}
110
+ <div class="misc scrollable" class:dark={$dark}>
111
+ <Controls infos={$controls} bind:values={bound} />
112
+ </div>
113
+ {/if}
114
+ </div>
115
+
@@ -1,24 +1,21 @@
1
1
 
2
- <script>import { onMount } from "svelte";
3
- import { getParams, getDefaults } from "./context";
2
+ <script>import { getParams } from "./context";
4
3
  import { resolve } from "./utils";
5
4
  export let tag = void 0;
6
5
  export let props = {};
7
- const defaults = getDefaults();
8
6
  const params = getParams();
9
- onMount(
10
- () => defaults.subscribe((d) => {
11
- if (d != null) {
12
- params.update((p) => [
13
- ...p,
14
- {
15
- id: p.length,
16
- tag: tag ?? `${p.length}`,
17
- values: resolve(d, props),
18
- defaults: resolve(d, props)
19
- }
20
- ]);
21
- }
22
- })
23
- );
7
+ const id = $params.length;
8
+ $params.push({
9
+ id,
10
+ tag: tag ?? `${id}`,
11
+ values: resolve(props, {})
12
+ });
13
+ $:
14
+ $params[id].tag = tag ?? `${id}`;
15
+ $:
16
+ $params[id].values = resolve(props, {});
24
17
  </script>
18
+ <!--
19
+ @component
20
+ See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template/1-Params) for more details.
21
+ -->
@@ -13,6 +13,7 @@ declare const __propDef: {
13
13
  export type ParamsProps = typeof __propDef.props;
14
14
  export type ParamsEvents = typeof __propDef.events;
15
15
  export type ParamsSlots = typeof __propDef.slots;
16
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template/1-Params) for more details. */
16
17
  export default class Params extends SvelteComponentTyped<ParamsProps, ParamsEvents, ParamsSlots> {
17
18
  }
18
19
  export {};
@@ -1,143 +1,33 @@
1
- <style>
2
- .template {
3
- display: grid;
4
- gap: 5px;
5
- padding-bottom: 10px;
6
- padding-top: 10px;
7
- grid-auto-rows: 1fr;
8
- grid-auto-columns: auto;
9
- grid-auto-flow: row;
10
- }
11
1
 
12
- .template.columns {
13
- grid-auto-rows: auto;
14
- grid-auto-columns: 1fr;
15
- grid-auto-flow: column;
16
- }
17
-
18
- .template > .cside {
19
- display: grid;
20
- grid-template-columns: 1fr 550px;
21
- }
22
-
23
- .content {
24
- min-height: 100px;
25
- border-radius: 5px 5px 5px 5px;
26
- }
27
-
28
- div:not(.cside) > .misc {
29
- border-bottom-left-radius: 5px;
30
- border-bottom-right-radius: 5px;
31
- user-select: none;
32
- }
33
-
34
- .template > .cside > .misc {
35
- border-top-right-radius: 5px;
36
- border-bottom-right-radius: 5px;
37
- user-select: none;
38
- }
39
-
40
- .template > div > div {
41
- margin: 3px;
42
- }
43
-
44
- /* scrollable */
45
- .scrollable {
46
- overflow: scroll;
47
- scrollbar-width: none; /* Firefox */
48
- -ms-overflow-style: none; /* IE and Edge */
49
- }
50
-
51
- .scrollable::-webkit-scrollbar {
52
- display: none;
53
- }
54
-
55
- /* colors */
56
- .content {
57
- border: hsl(0, 2%, 60%) solid 1px;
58
- background-color: hsl(0, 0%, 100%);
59
- }
60
-
61
- .misc {
62
- border: hsl(0, 2%, 60%) solid 1px;
63
- }
64
-
65
- .content.dark {
66
- border: hsl(0, 2%, 40%) solid 1px;
67
- background-color: hsl(200, 4%, 14%);
68
- }
69
-
70
- .misc.dark {
71
- outline: hsl(0, 2%, 40%) solid 1px;
72
- }
73
- </style>
74
-
75
- <script>import { getParams, getDefaults } from "./context";
76
- import { getControls, getControlsState } from "./context";
2
+ <script>import { beforeUpdate } from "svelte";
3
+ import {
4
+ getDefaults,
5
+ getParams,
6
+ getOrientation
7
+ } from "./context";
77
8
  import { resolve } from "./utils";
78
- import { getTheme } from "../context";
79
- import Controls from "./controls/Controls.svelte";
80
- import { cquery } from "./action";
81
- import { beforeUpdate } from "svelte";
9
+ import Instance from "./Instance.svelte";
82
10
  const params = getParams();
83
- const controls = getControls();
84
- const controlsState = getControlsState();
85
11
  const defaultsStore = getDefaults();
86
- const isDark = getTheme();
12
+ const orientation = getOrientation();
87
13
  export let defaults = void 0;
88
14
  export let noreset = false;
89
15
  export let columns = false;
90
- const reset = () => {
91
- $params = [];
92
- $defaultsStore = defaults;
93
- };
94
16
  $:
95
- $defaultsStore, reset();
96
- const resolveArgs = resolve;
17
+ $defaultsStore = defaults ?? {};
97
18
  $:
98
- expanded = $controls.length > 0 && !$controlsState.hide;
19
+ $orientation = columns;
20
+ const resolveArgs = resolve;
99
21
  let key = false;
100
22
  beforeUpdate(() => key = !key);
23
+ const cast = (t) => t;
101
24
  </script>
102
- <div class="template" class:columns>
103
- {#each $params as param (param.id)}
104
- <div
105
- class="scrollable"
106
- class:cside={expanded && "right" === $controlsState.position}
107
- use:cquery={{
108
- class: "cside",
109
- min: 1000,
110
- w: true,
111
- enabled: expanded && $controlsState.position === undefined
112
- }}
113
- >
114
- {#if noreset}
115
- <div class="content scrollable" class:dark={$isDark}>
116
- <slot
117
- id={param.id}
118
- tag={param.tag}
119
- props={resolveArgs(param.defaults, param.values)}
120
- {key}
121
- />
122
- </div>
123
- {:else}
124
- {#key key}
125
- <div class="content scrollable" class:dark={$isDark}>
126
- <slot
127
- id={param.id}
128
- tag={param.tag}
129
- props={resolveArgs(param.defaults, param.values)}
130
- {key}
131
- />
132
- </div>
133
- {/key}
134
- {/if}
135
- {#if expanded}
136
- <div class="misc scrollable" class:dark={$isDark}>
137
- <Controls infos={$controls} bind:values={param.values} />
138
- </div>
139
- {/if}
140
- </div>
141
- {/each}
142
- </div>
143
-
25
+ <!--
26
+ @component
27
+ See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template) for more details.
28
+ -->
29
+ {#each $params as param (param.id)}
30
+ <Instance defaults={resolveArgs($defaultsStore, param.values)} {noreset} let:key let:props>
31
+ <slot id={param.id} tag={param.tag} props={cast(props)} {key} />
32
+ </Instance>
33
+ {/each}
@@ -20,6 +20,7 @@ declare class __sveltets_Render<Args> {
20
20
  export type TemplateProps<Args> = ReturnType<__sveltets_Render<Args>['props']>;
21
21
  export type TemplateEvents<Args> = ReturnType<__sveltets_Render<Args>['events']>;
22
22
  export type TemplateSlots<Args> = ReturnType<__sveltets_Render<Args>['slots']>;
23
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template) for more details. */
23
24
  export default class Template<Args> extends SvelteComponentTyped<TemplateProps<Args>, TemplateEvents<Args>, TemplateSlots<Args>> {
24
25
  }
25
26
  export {};
@@ -7,7 +7,6 @@ export type Params = {
7
7
  id: number;
8
8
  tag: string;
9
9
  values: Record<string, ValueType>;
10
- defaults: Record<string, ValueType>;
11
10
  };
12
11
  export type ControlState = {
13
12
  hide: boolean;
@@ -15,5 +14,6 @@ export type ControlState = {
15
14
  };
16
15
  export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
17
16
  export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
18
- export declare const initDefaults: () => Writable<Record<string, ValueType> | null>, getDefaults: () => Writable<Record<string, ValueType> | null>;
17
+ export declare const initDefaults: () => Writable<Record<string, ValueType>>, getDefaults: () => Writable<Record<string, ValueType>>;
19
18
  export declare const initControlsState: () => Writable<ControlState>, getControlsState: () => Writable<ControlState>;
19
+ export declare const initOrientation: () => Writable<boolean>, getOrientation: () => Writable<boolean>;
@@ -9,7 +9,8 @@ const create = (defaulter) => {
9
9
  };
10
10
  export const { init: initParams, get: getParams } = create(() => []);
11
11
  export const { init: initControls, get: getControls } = create(() => []);
12
- export const { init: initDefaults, get: getDefaults } = create(() => null);
12
+ export const { init: initDefaults, get: getDefaults } = create(() => ({}));
13
13
  export const { init: initControlsState, get: getControlsState } = create(() => ({
14
14
  hide: false
15
15
  }));
16
+ export const { init: initOrientation, get: getOrientation } = create(() => false);
@@ -1,5 +1,5 @@
1
1
  <script>import { getTheme } from "../../../context";
2
- const isDark = getTheme();
2
+ const dark = getTheme();
3
3
  </script>
4
4
  <style>
5
5
  div {
@@ -79,7 +79,7 @@ const isDark = getTheme();
79
79
  </style>
80
80
 
81
81
 
82
- <div class:dark={$isDark}>
82
+ <div class:dark={$dark}>
83
83
  <slot />
84
84
  </div>
85
85
 
@@ -1,5 +1,4 @@
1
1
  import type { Writable } from "svelte/store";
2
- export declare const inRoot: () => boolean;
3
2
  export type Theme = undefined | "light" | "dark";
4
3
  export declare const getTheme: () => Writable<boolean>;
5
4
  export declare const initTheme: () => Writable<boolean>;
@@ -1,11 +1,5 @@
1
1
  import { setContext, getContext } from "svelte";
2
2
  import { writable } from "svelte/store";
3
- const root = Symbol();
4
- export const inRoot = () => {
5
- const value = getContext(root);
6
- setContext(root, false);
7
- return value !== false;
8
- };
9
3
  const theme = Symbol();
10
4
  export const getTheme = () => getContext(theme);
11
5
  export const initTheme = () => setContext(theme, writable(true));
@@ -8,14 +8,14 @@
8
8
  height: 100%;
9
9
  display: grid;
10
10
  grid-template-areas:
11
- "primary"
11
+ "A"
12
12
  "divider"
13
- "secondary";
13
+ "B";
14
14
  overflow: hidden;
15
15
  }
16
16
 
17
17
  .container.vertical {
18
- grid-template-areas: "primary divider secondary";
18
+ grid-template-areas: "A divider B";
19
19
  }
20
20
 
21
21
  .container > div {
@@ -56,10 +56,14 @@
56
56
  }
57
57
 
58
58
  .container.dark {
59
- --color-p: hsl(0, 2%, 38%);
59
+ --color-p: hsl(0, 2%, 40%);
60
60
  --color-s: hsl(0, 0%, 100%);
61
61
  }
62
62
 
63
+ .divider {
64
+ transition: border-color 350ms, background-color 350ms;
65
+ }
66
+
63
67
  .container:not(.vertical) > .divider {
64
68
  border-bottom: var(--color-p) solid 2.5px;
65
69
  border-top: var(--color-p) solid 2.5px;
@@ -72,19 +76,19 @@
72
76
  background-color: var(--color-p);
73
77
  }
74
78
 
75
- .container.moving:not(.secondary):not(.vertical) > .divider {
79
+ .container.moving:not(.b):not(.vertical) > .divider {
76
80
  border-bottom: var(--color-s) solid 2.5px;
77
81
  }
78
82
 
79
- .container.moving.secondary:not(.vertical) > .divider {
83
+ .container.moving.b:not(.vertical) > .divider {
80
84
  border-top: var(--color-s) solid 2.5px;
81
85
  }
82
86
 
83
- .container.moving:not(.secondary).vertical > .divider {
87
+ .container.moving:not(.b).vertical > .divider {
84
88
  border-right: var(--color-s) solid 2.5px;
85
89
  }
86
90
 
87
- .container.moving.vertical.secondary > .divider {
91
+ .container.moving.vertical.b > .divider {
88
92
  border-left: var(--color-s) solid 2.5px;
89
93
  }
90
94
  </style>
@@ -93,10 +97,10 @@
93
97
  import { tweened } from "svelte/motion";
94
98
  import { createDraggable } from "./action";
95
99
  import { getTheme } from "../context";
96
- const isDark = getTheme();
100
+ const dark = getTheme();
97
101
  export let vertical = false;
98
102
  export let offset = 0;
99
- export let secondary = false;
103
+ export let b = false;
100
104
  let width;
101
105
  let height;
102
106
  const { position, draggable } = createDraggable(offset);
@@ -115,7 +119,7 @@ $:
115
119
  $:
116
120
  $off = offset;
117
121
  $:
118
- style = !secondary ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
122
+ style = !b ? `auto 5px ${$off}px` : `${$off}px 5px auto`;
119
123
  const moving = writable(false);
120
124
  const addLast = (v) => {
121
125
  if (v > 10) {
@@ -145,8 +149,8 @@ const check = (v, flag, s) => {
145
149
  <div
146
150
  class="container"
147
151
  class:vertical
148
- class:secondary
149
- class:dark={$isDark}
152
+ class:b
153
+ class:dark={$dark}
150
154
  class:moving={$moving}
151
155
  bind:clientWidth={width}
152
156
  bind:clientHeight={height}
@@ -154,9 +158,9 @@ const check = (v, flag, s) => {
154
158
  style:grid-template-rows={!vertical ? style : null}
155
159
  >
156
160
  {#if width != null && height != null}
157
- <div style:grid-area="primary">
158
- {#if check($off, !secondary, span)}
159
- <slot name="primary" />
161
+ <div style:grid-area="A">
162
+ {#if check($off, !b, span)}
163
+ <slot name="A" />
160
164
  {/if}
161
165
  </div>
162
166
  <div class="divider">
@@ -164,7 +168,7 @@ const check = (v, flag, s) => {
164
168
  class="overlay"
165
169
  use:draggable={{
166
170
  reset: () => offset,
167
- reversed: !secondary,
171
+ reversed: !b,
168
172
  vertical,
169
173
  dbltap: dbltap,
170
174
  tap: () => addLast($off),
@@ -172,9 +176,9 @@ const check = (v, flag, s) => {
172
176
  }}
173
177
  />
174
178
  </div>
175
- <div style:grid-area="secondary">
176
- {#if check($off, secondary, span)}
177
- <slot name="secondary" />
179
+ <div style:grid-area="B">
180
+ {#if check($off, b, span)}
181
+ <slot name="B" />
178
182
  {/if}
179
183
  </div>
180
184
  {/if}
@@ -3,14 +3,14 @@ declare const __propDef: {
3
3
  props: {
4
4
  vertical?: boolean | undefined;
5
5
  offset?: number | undefined;
6
- secondary?: boolean | undefined;
6
+ b?: boolean | undefined;
7
7
  };
8
8
  events: {
9
9
  [evt: string]: CustomEvent<any>;
10
10
  };
11
11
  slots: {
12
- primary: {};
13
- secondary: {};
12
+ A: {};
13
+ B: {};
14
14
  };
15
15
  };
16
16
  export type ContainerProps = typeof __propDef.props;
@@ -1,7 +1,6 @@
1
1
  <script>import { tweened } from "svelte/motion";
2
- import { elasticOut } from "svelte/easing";
3
2
  export let dark = true;
4
- const values = tweened(dark ? vdark : vlight, { duration: 1e3, easing: elasticOut });
3
+ const values = tweened(dark ? vdark : vlight);
5
4
  $:
6
5
  $values = dark ? vdark : vlight;
7
6
  const index = indexer++;
@@ -49,7 +48,6 @@ const vdark = {
49
48
  class:dark
50
49
  viewBox="-25 -25 50 50"
51
50
  transform={`rotate(${$values.rotate})`}
52
- style={`color: hsl(0, 0%, ${$values.v * 100}%);`}
53
51
  on:click={() => (dark = !dark)}
54
52
  on:keypress={null}
55
53
  >
@@ -2,6 +2,7 @@
2
2
  .nav {
3
3
  width: 100%;
4
4
  height: 100%;
5
+ min-width: 200px;
5
6
  gap: 10px;
6
7
  display: flex;
7
8
  flex-direction: column;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.35",
3
+ "version": "0.2.37",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"