@nil-/doc 0.2.34 → 0.2.35
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 +8 -0
- package/components/Layout.svelte +5 -3
- package/components/block/Controls.svelte +2 -2
- package/components/block/Controls.svelte.d.ts +1 -1
- package/components/block/Template.svelte +14 -4
- package/components/block/action.d.ts +12 -0
- package/components/block/action.js +26 -0
- package/components/block/context.d.ts +1 -1
- package/components/block/context.js +1 -2
- package/components/etc/NilIcon.svelte +47 -0
- package/components/etc/NilIcon.svelte.d.ts +14 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc] changed Control "side" flag to "position" prop ([#53](https://github.com/njaldea/mono/pull/53))
|
|
8
|
+
|
|
9
|
+
- [misc] added nil icon ([#53](https://github.com/njaldea/mono/pull/53))
|
|
10
|
+
|
|
3
11
|
## 0.2.34
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
.top {
|
|
14
14
|
display: grid;
|
|
15
|
-
grid-template-columns: 1fr 40px;
|
|
15
|
+
grid-template-columns: 1fr 40px 40px;
|
|
16
16
|
align-items: center;
|
|
17
|
-
padding-left:
|
|
18
|
-
padding-right:
|
|
17
|
+
padding-left: 10px;
|
|
18
|
+
padding-right: 10px;
|
|
19
19
|
box-sizing: border-box;
|
|
20
20
|
user-select: none;
|
|
21
21
|
}
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
import Nav from "./navigation/Nav.svelte";
|
|
77
77
|
import { inRoot, getTheme, initTheme, evalTheme } from "./context";
|
|
78
78
|
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
79
|
+
import NilIcon from "./etc/NilIcon.svelte";
|
|
79
80
|
export let data;
|
|
80
81
|
export let current = null;
|
|
81
82
|
export let sorter = null;
|
|
@@ -91,6 +92,7 @@ $:
|
|
|
91
92
|
<div class="top">
|
|
92
93
|
<slot name="title"><span>@nil-/doc</span></slot>
|
|
93
94
|
<ThemeIcon bind:dark={$isDark} />
|
|
95
|
+
<NilIcon />
|
|
94
96
|
</div>
|
|
95
97
|
<Container offset={250} vertical secondary>
|
|
96
98
|
<svelte:fragment slot="primary">
|
|
@@ -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
|
|
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.
|
|
12
|
+
$state.position = position;
|
|
13
13
|
</script>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
user-select: none;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.cside > .misc {
|
|
34
|
+
.template > .cside > .misc {
|
|
35
35
|
border-top-right-radius: 5px;
|
|
36
36
|
border-bottom-right-radius: 5px;
|
|
37
37
|
user-select: none;
|
|
@@ -77,6 +77,7 @@ import { getControls, getControlsState } from "./context";
|
|
|
77
77
|
import { resolve } from "./utils";
|
|
78
78
|
import { getTheme } from "../context";
|
|
79
79
|
import Controls from "./controls/Controls.svelte";
|
|
80
|
+
import { cquery } from "./action";
|
|
80
81
|
import { beforeUpdate } from "svelte";
|
|
81
82
|
const params = getParams();
|
|
82
83
|
const controls = getControls();
|
|
@@ -92,15 +93,24 @@ const reset = () => {
|
|
|
92
93
|
};
|
|
93
94
|
$:
|
|
94
95
|
$defaultsStore, reset();
|
|
95
|
-
let key = false;
|
|
96
|
-
beforeUpdate(() => key = !key);
|
|
97
96
|
const resolveArgs = resolve;
|
|
98
97
|
$:
|
|
99
98
|
expanded = $controls.length > 0 && !$controlsState.hide;
|
|
99
|
+
let key = false;
|
|
100
|
+
beforeUpdate(() => key = !key);
|
|
100
101
|
</script>
|
|
101
102
|
<div class="template" class:columns>
|
|
102
103
|
{#each $params as param (param.id)}
|
|
103
|
-
<div
|
|
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
|
+
>
|
|
104
114
|
{#if noreset}
|
|
105
115
|
<div class="content scrollable" class:dark={$isDark}>
|
|
106
116
|
<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
|
-
|
|
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
|
}));
|
|
@@ -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 {};
|