@nil-/doc 0.2.34 → 0.2.36

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,21 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.36
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][fix] color changes and transition ([#55](https://github.com/njaldea/mono/pull/55))
8
+
9
+ - [all] added html meta details ([#55](https://github.com/njaldea/mono/pull/55))
10
+
11
+ ## 0.2.35
12
+
13
+ ### Patch Changes
14
+
15
+ - [doc] changed Control "side" flag to "position" prop ([#53](https://github.com/njaldea/mono/pull/53))
16
+
17
+ - [misc] added nil icon ([#53](https://github.com/njaldea/mono/pull/53))
18
+
3
19
  ## 0.2.34
4
20
 
5
21
  ### Patch Changes
@@ -5,6 +5,7 @@
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%;
10
11
  font-family: "Fira Code", "Courier New", Courier, monospace;
@@ -12,14 +13,19 @@
12
13
 
13
14
  .top {
14
15
  display: grid;
15
- grid-template-columns: 1fr 40px;
16
+ grid-template-columns: 1fr 40px 40px;
16
17
  align-items: center;
17
- padding-left: 20px;
18
- padding-right: 20px;
18
+ padding-left: 10px;
19
+ padding-right: 10px;
19
20
  box-sizing: border-box;
20
21
  user-select: none;
21
22
  }
22
23
 
24
+ .main {
25
+ height: 100%;
26
+ overflow: hidden;
27
+ }
28
+
23
29
  .content {
24
30
  height: 100%;
25
31
  padding: 5px;
@@ -49,24 +55,25 @@
49
55
 
50
56
  /* colors */
51
57
  .layout {
52
- transition: color 350ms, background-color 350ms;
53
- background-color: hsl(0, 0%, 100%);
54
- color: hsl(0, 100%, 0%);
55
58
  color-scheme: light;
59
+ color: hsl(0, 0%, 0%);
60
+ background-color: hsl(0, 2%, 70%);
61
+ transition: color 350ms, background-color 350ms;
56
62
  }
57
63
 
58
- .layout > .top {
59
- border-bottom: hsl(0, 2%, 70%) solid 1px;
64
+ .layout.dark {
65
+ color-scheme: dark;
66
+ color: hsl(0, 0%, 80%);
67
+ background-color: hsl(0, 2%, 40%);
60
68
  }
61
69
 
62
- .layout.dark > .top {
63
- border-bottom: hsl(0, 2%, 38%) solid 1px;
70
+ .layout > div {
71
+ background-color: hsl(0, 0%, 100%);
72
+ transition: background-color 350ms;
64
73
  }
65
74
 
66
- .layout.dark {
75
+ .layout.dark > div {
67
76
  background-color: hsl(200, 4%, 14%);
68
- color: hsl(200, 6%, 80%);
69
- color-scheme: dark;
70
77
  }
71
78
  </style>
72
79
 
@@ -76,6 +83,7 @@
76
83
  import Nav from "./navigation/Nav.svelte";
77
84
  import { inRoot, getTheme, initTheme, evalTheme } from "./context";
78
85
  import ThemeIcon from "./etc/ThemeIcon.svelte";
86
+ import NilIcon from "./etc/NilIcon.svelte";
79
87
  export let data;
80
88
  export let current = null;
81
89
  export let sorter = null;
@@ -91,26 +99,29 @@ $:
91
99
  <div class="top">
92
100
  <slot name="title"><span>@nil-/doc</span></slot>
93
101
  <ThemeIcon bind:dark={$isDark} />
102
+ <NilIcon />
103
+ </div>
104
+ <div class="main">
105
+ <Container offset={250} vertical secondary>
106
+ <svelte:fragment slot="primary">
107
+ <div class="content scrollable">
108
+ <Nav
109
+ info={data}
110
+ selected={current ?? ""}
111
+ sorter={sorter ?? defaultSorter}
112
+ renamer={renamer ?? ((s) => s)}
113
+ on:navigate
114
+ />
115
+ </div>
116
+ </svelte:fragment>
117
+ <svelte:fragment slot="secondary">
118
+ <div class="content scrollable">
119
+ {#key current}
120
+ <slot />
121
+ {/key}
122
+ </div>
123
+ </svelte:fragment>
124
+ </Container>
94
125
  </div>
95
- <Container offset={250} vertical secondary>
96
- <svelte:fragment slot="primary">
97
- <div class="content scrollable">
98
- <Nav
99
- info={data}
100
- selected={current ?? ""}
101
- sorter={sorter ?? defaultSorter}
102
- renamer={renamer ?? ((s) => s)}
103
- on:navigate
104
- />
105
- </div>
106
- </svelte:fragment>
107
- <svelte:fragment slot="secondary">
108
- <div class="content scrollable">
109
- {#key current}
110
- <slot />
111
- {/key}
112
- </div>
113
- </svelte:fragment>
114
- </Container>
115
126
  </div>
116
127
 
@@ -19,6 +19,7 @@
19
19
  div {
20
20
  color-scheme: light;
21
21
  color: hsl(0, 100%, 0%);
22
+ transition: color 350ms;
22
23
  }
23
24
 
24
25
  div.dark {
@@ -2,12 +2,12 @@
2
2
  <script>import { getControls, getControlsState } from "./context";
3
3
  export let props = [];
4
4
  export let hide = false;
5
- export let side = false;
5
+ export let position = void 0;
6
6
  const controls = getControls();
7
7
  $controls = props;
8
8
  const state = getControlsState();
9
9
  $:
10
10
  $state.hide = hide;
11
11
  $:
12
- $state.side = side;
12
+ $state.position = position;
13
13
  </script>
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  props: {
5
5
  props?: Control[] | undefined;
6
6
  hide?: boolean | undefined;
7
- side?: boolean | undefined;
7
+ position?: undefined | "bottom" | "right";
8
8
  };
9
9
  events: {
10
10
  [evt: string]: CustomEvent<any>;
@@ -1,12 +1,16 @@
1
1
  <style>
2
+ div {
3
+ box-sizing: border-box;
4
+ }
5
+
2
6
  .template {
3
7
  display: grid;
4
- gap: 5px;
5
8
  padding-bottom: 10px;
6
9
  padding-top: 10px;
7
10
  grid-auto-rows: 1fr;
8
11
  grid-auto-columns: auto;
9
12
  grid-auto-flow: row;
13
+ border-radius: 5px;
10
14
  }
11
15
 
12
16
  .template.columns {
@@ -22,7 +26,7 @@
22
26
 
23
27
  .content {
24
28
  min-height: 100px;
25
- border-radius: 5px 5px 5px 5px;
29
+ border-radius: 5px;
26
30
  }
27
31
 
28
32
  div:not(.cside) > .misc {
@@ -31,14 +35,22 @@
31
35
  user-select: none;
32
36
  }
33
37
 
34
- .cside > .misc {
38
+ .template > .cside > .misc {
35
39
  border-top-right-radius: 5px;
36
40
  border-bottom-right-radius: 5px;
37
41
  user-select: none;
38
42
  }
39
43
 
40
- .template > div > div {
44
+ .instance {
45
+ overflow: hidden;
46
+ }
47
+
48
+ .content,
49
+ .misc {
41
50
  margin: 3px;
51
+ border-style: solid;
52
+ border-width: 1px;
53
+ padding: 1px;
42
54
  }
43
55
 
44
56
  /* scrollable */
@@ -53,22 +65,29 @@
53
65
  }
54
66
 
55
67
  /* colors */
56
- .content {
57
- border: hsl(0, 2%, 60%) solid 1px;
58
- background-color: hsl(0, 0%, 100%);
68
+ .template {
69
+ color: hsl(0, 0%, 0%);
70
+ background-color: hsl(0, 2%, 70%);
71
+ transition: color 350ms, background-color 350ms;
59
72
  }
60
73
 
61
- .misc {
62
- border: hsl(0, 2%, 60%) solid 1px;
74
+ .template.dark {
75
+ color-scheme: dark;
76
+ color: hsl(0, 0%, 80%);
77
+ background-color: hsl(0, 2%, 40%);
63
78
  }
64
79
 
65
- .content.dark {
66
- border: hsl(0, 2%, 40%) solid 1px;
67
- background-color: hsl(200, 4%, 14%);
80
+ .content,
81
+ .misc {
82
+ border-color: hsl(0, 2%, 60%);
83
+ background-color: hsl(0, 0%, 100%);
84
+ transition: border-color 350ms, background-color 350ms;
68
85
  }
69
86
 
70
- .misc.dark {
71
- outline: hsl(0, 2%, 40%) solid 1px;
87
+ .dark .content,
88
+ .dark .misc {
89
+ border-color: hsl(0, 2%, 40%);
90
+ background-color: hsl(200, 4%, 14%);
72
91
  }
73
92
  </style>
74
93
 
@@ -77,6 +96,7 @@ import { getControls, getControlsState } from "./context";
77
96
  import { resolve } from "./utils";
78
97
  import { getTheme } from "../context";
79
98
  import Controls from "./controls/Controls.svelte";
99
+ import { cquery } from "./action";
80
100
  import { beforeUpdate } from "svelte";
81
101
  const params = getParams();
82
102
  const controls = getControls();
@@ -92,15 +112,24 @@ const reset = () => {
92
112
  };
93
113
  $:
94
114
  $defaultsStore, reset();
95
- let key = false;
96
- beforeUpdate(() => key = !key);
97
115
  const resolveArgs = resolve;
98
116
  $:
99
117
  expanded = $controls.length > 0 && !$controlsState.hide;
118
+ let key = false;
119
+ beforeUpdate(() => key = !key);
100
120
  </script>
101
- <div class="template" class:columns>
121
+ <div class="template" class:columns class:dark={$isDark}>
102
122
  {#each $params as param (param.id)}
103
- <div class="scrollable" class:cside={$controlsState.side && expanded}>
123
+ <div
124
+ class="instance"
125
+ class:cside={expanded && "right" === $controlsState.position}
126
+ use:cquery={{
127
+ class: "cside",
128
+ min: 1000,
129
+ w: true,
130
+ enabled: expanded && $controlsState.position === undefined
131
+ }}
132
+ >
104
133
  {#if noreset}
105
134
  <div class="content scrollable" class:dark={$isDark}>
106
135
  <slot
@@ -0,0 +1,12 @@
1
+ import type { ActionReturn } from "svelte/action";
2
+ type Options = {
3
+ class: string;
4
+ min: number;
5
+ w: boolean;
6
+ enabled: boolean;
7
+ };
8
+ /**
9
+ * Temporary support for container query until svelte supports it
10
+ */
11
+ export declare const cquery: (div: HTMLDivElement, options: Options) => ActionReturn<Options>;
12
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Temporary support for container query until svelte supports it
3
+ */
4
+ export const cquery = (div, options) => {
5
+ let o = options;
6
+ const check = () => div.classList.toggle(o.class, (o.w ? div.clientWidth : div.clientHeight) > o.min);
7
+ const observer = new ResizeObserver(check);
8
+ if (o.enabled) {
9
+ observer.observe(div);
10
+ }
11
+ return {
12
+ update: (options) => {
13
+ if (o.enabled !== options.enabled) {
14
+ if (!o.enabled && options.enabled) {
15
+ observer.observe(div);
16
+ }
17
+ else {
18
+ observer.disconnect();
19
+ }
20
+ }
21
+ o = options;
22
+ check();
23
+ },
24
+ destroy: () => o.enabled && observer.disconnect()
25
+ };
26
+ };
@@ -11,7 +11,7 @@ export type Params = {
11
11
  };
12
12
  export type ControlState = {
13
13
  hide: boolean;
14
- side: boolean;
14
+ position?: "bottom" | "right";
15
15
  };
16
16
  export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
17
17
  export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
@@ -11,6 +11,5 @@ export const { init: initParams, get: getParams } = create(() => []);
11
11
  export const { init: initControls, get: getControls } = create(() => []);
12
12
  export const { init: initDefaults, get: getDefaults } = create(() => null);
13
13
  export const { init: initControlsState, get: getControlsState } = create(() => ({
14
- hide: false,
15
- side: false
14
+ hide: false
16
15
  }));
@@ -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;
@@ -0,0 +1,47 @@
1
+ <style>
2
+ svg {
3
+ width: 100%;
4
+ height: 100%;
5
+ fill: transparent;
6
+ stroke: currentColor;
7
+ stroke-width: 4;
8
+ stroke-linejoin: miter;
9
+ cursor: pointer;
10
+ }
11
+ </style>
12
+
13
+ <script>import { tweened } from "svelte/motion";
14
+ const action = (p, options) => {
15
+ const total = p.getTotalLength();
16
+ p.style.strokeDasharray = `${total * options.length} ${total}`;
17
+ return {
18
+ update: (options2) => {
19
+ const total2 = p.getTotalLength();
20
+ p.style.strokeDasharray = `${total2 * options2.length} ${total2}`;
21
+ }
22
+ };
23
+ };
24
+ const d = "M 0 -15 L 15 -15 L 15 0 L 0 0 -9 0 A 6 8 135 0 1 9 0";
25
+ const length = tweened(0);
26
+ let out = false;
27
+ const click = () => {
28
+ if (0 === $length) {
29
+ $length = 1;
30
+ out = false;
31
+ } else if (!out) {
32
+ $length = 0;
33
+ out = true;
34
+ }
35
+ };
36
+ $:
37
+ 0 === $length && click();
38
+ </script>
39
+ <svg viewBox="-35 -35 70 70" on:click={click} on:keypress={null}>
40
+ <g transform="rotate(45 0 0)">
41
+ <path {d} use:action={{ length: $length }} />
42
+ </g>
43
+ <g transform="rotate(225 0 0)">
44
+ <path {d} use:action={{ length: $length }} />
45
+ </g>
46
+ </svg>
47
+
@@ -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 NilIconProps = typeof __propDef.props;
10
+ export type NilIconEvents = typeof __propDef.events;
11
+ export type NilIconSlots = typeof __propDef.slots;
12
+ export default class NilIcon extends SvelteComponentTyped<NilIconProps, NilIconEvents, NilIconSlots> {
13
+ }
14
+ export {};
@@ -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.34",
3
+ "version": "0.2.36",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"