@nil-/doc 0.2.38 → 0.2.40
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 +28 -0
- package/components/Layout.svelte +11 -10
- package/components/block/Block.svelte +2 -2
- package/components/block/Controls.svelte +1 -1
- package/components/block/Controls.svelte.d.ts +1 -1
- package/components/block/Instance.svelte +10 -0
- package/components/block/Instance.svelte.d.ts +1 -0
- package/components/block/Params.svelte +1 -1
- package/components/block/Params.svelte.d.ts +2 -2
- package/components/block/Template.svelte +9 -2
- package/components/block/Template.svelte.d.ts +2 -1
- package/components/block/context.d.ts +2 -4
- package/components/block/controls/Controls.svelte.d.ts +1 -1
- package/components/block/controls/Object.svelte +5 -3
- package/components/block/controls/Object.svelte.d.ts +1 -1
- package/components/block/controls/Tuple.svelte +5 -3
- package/components/block/controls/Tuple.svelte.d.ts +1 -1
- package/components/block/controls/misc/defaulter.d.ts +10 -5
- package/components/block/controls/misc/defaulter.js +24 -28
- package/components/block/types.d.ts +9 -0
- package/components/block/utils.d.ts +3 -5
- package/components/block/utils.js +7 -13
- package/components/context.d.ts +0 -1
- package/components/context.js +1 -7
- package/components/etc/NilIcon.svelte +1 -1
- package/components/etc/action.js +3 -3
- package/components/navigation/Nav.svelte +10 -10
- package/components/navigation/Node.svelte +1 -1
- package/components/navigation/types.d.ts +4 -4
- package/components/navigation/utils/sorter.js +1 -1
- package/package.json +5 -2
- package/sveltekit/index.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [doc][new] added scale flag prop for Instance/Template componen ([#63](https://github.com/njaldea/mono/pull/63))
|
|
8
|
+
|
|
9
|
+
- [doc][patch] fixed jsdoc link for public components ([#63](https://github.com/njaldea/mono/pull/63))
|
|
10
|
+
|
|
11
|
+
- [doc][docu] moved Sorting and Renaming section to their own pages ([#63](https://github.com/njaldea/mono/pull/63))
|
|
12
|
+
|
|
13
|
+
- [doc][new] added placeholder to search bar ([#63](https://github.com/njaldea/mono/pull/63))
|
|
14
|
+
|
|
15
|
+
- [doc][docu] added admonitions plugin ([#63](https://github.com/njaldea/mono/pull/63))
|
|
16
|
+
|
|
17
|
+
## 0.2.39
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [doc][fix] force state of navigation expand icon when filtering ([#61](https://github.com/njaldea/mono/pull/61))
|
|
22
|
+
|
|
23
|
+
- [doc][patch] tighter eslint ([#61](https://github.com/njaldea/mono/pull/61))
|
|
24
|
+
|
|
25
|
+
- [doc][patch] added tests for non-UI related code ([#61](https://github.com/njaldea/mono/pull/61))
|
|
26
|
+
|
|
27
|
+
- [doc][patch] moved type definition ([#61](https://github.com/njaldea/mono/pull/61))
|
|
28
|
+
|
|
29
|
+
- [doc][patch] enabled typescript eslint rules ([#61](https://github.com/njaldea/mono/pull/61))
|
|
30
|
+
|
|
3
31
|
## 0.2.38
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/components/Layout.svelte
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
display: grid;
|
|
6
6
|
grid-template-columns: 1fr;
|
|
7
7
|
grid-template-rows: minmax(40px, auto) 1fr;
|
|
8
|
-
gap: 1px;
|
|
9
8
|
width: 100%;
|
|
10
9
|
height: 100%;
|
|
11
10
|
box-sizing: border-box;
|
|
@@ -18,6 +17,8 @@
|
|
|
18
17
|
align-items: center;
|
|
19
18
|
padding-left: 10px;
|
|
20
19
|
padding-right: 10px;
|
|
20
|
+
border-bottom-width: 1px;
|
|
21
|
+
border-bottom-style: solid;
|
|
21
22
|
box-sizing: border-box;
|
|
22
23
|
user-select: none;
|
|
23
24
|
}
|
|
@@ -60,23 +61,23 @@
|
|
|
60
61
|
.layout {
|
|
61
62
|
color-scheme: light;
|
|
62
63
|
color: hsl(0, 0%, 0%);
|
|
63
|
-
background-color: hsl(0,
|
|
64
|
+
background-color: hsl(0, 0%, 100%);
|
|
64
65
|
transition: color 350ms, background-color 350ms;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
.layout.dark {
|
|
68
69
|
color-scheme: dark;
|
|
69
70
|
color: hsl(0, 0%, 80%);
|
|
70
|
-
background-color: hsl(
|
|
71
|
+
background-color: hsl(200, 4%, 14%);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
.layout >
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
.layout > .top {
|
|
75
|
+
transition: border-bottom-colo 350ms;
|
|
76
|
+
border-bottom-color: hsl(0, 2%, 70%);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
.layout.dark >
|
|
79
|
-
|
|
79
|
+
.layout.dark > .top {
|
|
80
|
+
border-bottom-color: hsl(0, 2%, 40%);
|
|
80
81
|
}
|
|
81
82
|
</style>
|
|
82
83
|
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
</script>
|
|
85
86
|
<script>import Container from "./etc/Container.svelte";
|
|
86
87
|
import Nav from "./navigation/Nav.svelte";
|
|
87
|
-
import { getTheme, initTheme
|
|
88
|
+
import { getTheme, initTheme } from "./context";
|
|
88
89
|
import ThemeIcon from "./etc/ThemeIcon.svelte";
|
|
89
90
|
import NilIcon from "./etc/NilIcon.svelte";
|
|
90
91
|
export let data;
|
|
@@ -95,7 +96,7 @@ export let theme = void 0;
|
|
|
95
96
|
const parentTheme = getTheme();
|
|
96
97
|
const dark = initTheme();
|
|
97
98
|
$:
|
|
98
|
-
$dark =
|
|
99
|
+
$dark = theme === void 0 ? $parentTheme : "dark" === theme;
|
|
99
100
|
</script>
|
|
100
101
|
<!--
|
|
101
102
|
@component
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
initControlsState,
|
|
43
43
|
initOrientation
|
|
44
44
|
} from "./context";
|
|
45
|
-
import { getTheme, initTheme
|
|
45
|
+
import { getTheme, initTheme } from "../context";
|
|
46
46
|
initParams();
|
|
47
47
|
initDefaults();
|
|
48
48
|
initControls();
|
|
@@ -52,7 +52,7 @@ export let theme = void 0;
|
|
|
52
52
|
const parentTheme = getTheme();
|
|
53
53
|
const dark = initTheme();
|
|
54
54
|
$:
|
|
55
|
-
$dark =
|
|
55
|
+
$dark = theme === void 0 ? $parentTheme : "dark" === theme;
|
|
56
56
|
</script>
|
|
57
57
|
<!--
|
|
58
58
|
@component
|
|
@@ -14,7 +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/
|
|
17
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Controls) for more details. */
|
|
18
18
|
export default class Controls extends SvelteComponentTyped<ControlsProps, ControlsEvents, ControlsSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.instance.scale {
|
|
11
|
+
transition: transform 350ms;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.instance.scale:hover {
|
|
15
|
+
transform: scale(1.015);
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
.cside {
|
|
11
19
|
display: grid;
|
|
12
20
|
grid-template-columns: 1fr 550px;
|
|
@@ -75,6 +83,7 @@ $:
|
|
|
75
83
|
expanded = $controls.length > 0 && !$controlsState.hide;
|
|
76
84
|
export let defaults = void 0;
|
|
77
85
|
export let noreset = false;
|
|
86
|
+
export let scale = false;
|
|
78
87
|
let key = false;
|
|
79
88
|
beforeUpdate(() => key = !key);
|
|
80
89
|
const resolveArgs = resolve;
|
|
@@ -87,6 +96,7 @@ $:
|
|
|
87
96
|
</script>
|
|
88
97
|
<div
|
|
89
98
|
class="instance"
|
|
99
|
+
class:scale
|
|
90
100
|
class:cside={expanded && "right" === $controlsState.position}
|
|
91
101
|
use:cquery={{
|
|
92
102
|
class: "cside",
|
|
@@ -17,5 +17,5 @@ $:
|
|
|
17
17
|
</script>
|
|
18
18
|
<!--
|
|
19
19
|
@component
|
|
20
|
-
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template/1-Params) for more details.
|
|
20
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template/1-Params) for more details.
|
|
21
21
|
-->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import type { ValueType } from "./types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
tag?: string | undefined;
|
|
@@ -13,7 +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
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template/1-Params) for more details. */
|
|
17
17
|
export default class Params extends SvelteComponentTyped<ParamsProps, ParamsEvents, ParamsSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -9,6 +9,7 @@ const orientation = getOrientation();
|
|
|
9
9
|
export let defaults = void 0;
|
|
10
10
|
export let noreset = false;
|
|
11
11
|
export let columns = false;
|
|
12
|
+
export let scale = false;
|
|
12
13
|
$:
|
|
13
14
|
$defaultsStore = defaults ?? {};
|
|
14
15
|
$:
|
|
@@ -20,10 +21,16 @@ const cast = (t) => t;
|
|
|
20
21
|
</script>
|
|
21
22
|
<!--
|
|
22
23
|
@component
|
|
23
|
-
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/2-Template) for more details.
|
|
24
|
+
See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template) for more details.
|
|
24
25
|
-->
|
|
25
26
|
{#each $params as param (param.id)}
|
|
26
|
-
<Instance
|
|
27
|
+
<Instance
|
|
28
|
+
defaults={resolveArgs($defaultsStore, param.values)}
|
|
29
|
+
{noreset}
|
|
30
|
+
{scale}
|
|
31
|
+
let:key
|
|
32
|
+
let:props
|
|
33
|
+
>
|
|
27
34
|
<slot id={param.id} tag={param.tag} props={cast(props)} {key} />
|
|
28
35
|
</Instance>
|
|
29
36
|
{/each}
|
|
@@ -4,6 +4,7 @@ declare class __sveltets_Render<Args> {
|
|
|
4
4
|
defaults?: Args | undefined;
|
|
5
5
|
noreset?: boolean | undefined;
|
|
6
6
|
columns?: boolean | undefined;
|
|
7
|
+
scale?: boolean | undefined;
|
|
7
8
|
};
|
|
8
9
|
events(): {} & {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -20,7 +21,7 @@ declare class __sveltets_Render<Args> {
|
|
|
20
21
|
export type TemplateProps<Args> = ReturnType<__sveltets_Render<Args>['props']>;
|
|
21
22
|
export type TemplateEvents<Args> = ReturnType<__sveltets_Render<Args>['events']>;
|
|
22
23
|
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. */
|
|
24
|
+
/** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/2-Template) for more details. */
|
|
24
25
|
export default class Template<Args> extends SvelteComponentTyped<TemplateProps<Args>, TemplateEvents<Args>, TemplateSlots<Args>> {
|
|
25
26
|
}
|
|
26
27
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type { Control } from "./controls/types";
|
|
2
1
|
import type { Writable } from "svelte/store";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
2
|
+
import type { Control } from "./controls/types";
|
|
3
|
+
import type { ValueType } from "./types";
|
|
6
4
|
export type Params = {
|
|
7
5
|
id: number;
|
|
8
6
|
tag: string;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import Component from "./Component.svelte";
|
|
3
3
|
import Header from "./misc/GroupHeader.svelte";
|
|
4
|
-
import {
|
|
4
|
+
import { getDefault } from "./misc/defaulter";
|
|
5
5
|
export let value;
|
|
6
6
|
export let info;
|
|
7
7
|
export let depth;
|
|
8
8
|
export let disabled = false;
|
|
9
|
-
let ivalue = value ??
|
|
9
|
+
let ivalue = value ?? getDefault(info);
|
|
10
10
|
let enabled = value !== void 0;
|
|
11
11
|
$:
|
|
12
12
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
|
+
$:
|
|
14
|
+
values = info.values;
|
|
13
15
|
</script>
|
|
14
16
|
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
15
17
|
{#if enabled && !disabled}
|
|
16
|
-
{#each
|
|
18
|
+
{#each values as info, i (i)}
|
|
17
19
|
<Component
|
|
18
20
|
{info}
|
|
19
21
|
bind:value={ivalue[info.name]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ValueType } from "../types";
|
|
2
3
|
import type { ControlObject } from "./types";
|
|
3
|
-
import type { ValueType } from "../context";
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
value: Record<string, ValueType> | undefined;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import Component from "./Component.svelte";
|
|
3
3
|
import Header from "./misc/GroupHeader.svelte";
|
|
4
|
-
import {
|
|
4
|
+
import { getDefault } from "./misc/defaulter";
|
|
5
5
|
export let value;
|
|
6
6
|
export let info;
|
|
7
7
|
export let depth;
|
|
8
8
|
export let disabled = false;
|
|
9
|
-
let ivalue = value ??
|
|
9
|
+
let ivalue = value ?? getDefault(info);
|
|
10
10
|
let enabled = value !== void 0;
|
|
11
11
|
$:
|
|
12
12
|
value = !disabled && enabled ? ivalue : void 0;
|
|
13
|
+
$:
|
|
14
|
+
values = info.values;
|
|
13
15
|
</script>
|
|
14
16
|
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
15
17
|
{#if enabled && !disabled}
|
|
16
|
-
{#each
|
|
18
|
+
{#each values as info, i (i)}
|
|
17
19
|
<Component
|
|
18
20
|
info={{ ...info, name: `${i}` }}
|
|
19
21
|
bind:value={ivalue[i]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { ValueType } from "../../
|
|
2
|
-
import type { Control, ControlTuple, ControlObject } from "../types";
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
1
|
+
import type { ValueType } from "../../types";
|
|
2
|
+
import type { Control, ControlNumber, ControlRange, ControlSelect, ControlSwitch, ControlText, ControlTuple, ControlObject } from "../types";
|
|
3
|
+
export declare function getDefault(i: ControlTuple): ValueType[];
|
|
4
|
+
export declare function getDefault(i: ControlObject): Record<string, ValueType>;
|
|
5
|
+
export declare function getDefault(i: ControlNumber): number;
|
|
6
|
+
export declare function getDefault(i: ControlRange): number;
|
|
7
|
+
export declare function getDefault(i: ControlSelect): string;
|
|
8
|
+
export declare function getDefault(i: ControlText): string;
|
|
9
|
+
export declare function getDefault(i: ControlSwitch): boolean;
|
|
10
|
+
export declare function getDefault(i: Control): ValueType;
|
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
};
|
|
27
|
-
export const getObjectDefaults = (info) => {
|
|
1
|
+
// eslint-disable-next-line func-style
|
|
2
|
+
export function getDefault(i) {
|
|
3
|
+
switch (i.type) {
|
|
4
|
+
case "object":
|
|
5
|
+
// eslint-disable-next-line no-use-before-define
|
|
6
|
+
return getObjectDefaults(i);
|
|
7
|
+
case "tuple":
|
|
8
|
+
// eslint-disable-next-line no-use-before-define
|
|
9
|
+
return getTupleDefaults(i);
|
|
10
|
+
case "text":
|
|
11
|
+
return "";
|
|
12
|
+
case "select":
|
|
13
|
+
return i.values.length > 0 ? i.values[0] : "";
|
|
14
|
+
case "number":
|
|
15
|
+
return 0;
|
|
16
|
+
case "range":
|
|
17
|
+
return i.min;
|
|
18
|
+
case "switch":
|
|
19
|
+
default:
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const getObjectDefaults = (info) => {
|
|
28
24
|
const ret = {};
|
|
29
25
|
for (const i of info.values) {
|
|
30
26
|
ret[i.name] = getDefault(i);
|
|
31
27
|
}
|
|
32
28
|
return ret;
|
|
33
29
|
};
|
|
34
|
-
|
|
30
|
+
const getTupleDefaults = (i) => {
|
|
35
31
|
const ret = [];
|
|
36
32
|
for (const info of i.values) {
|
|
37
33
|
ret.push(getDefault(info));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { ValueType } from "./
|
|
2
|
-
type VTObject =
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export declare const resolve: <Args>(d: VTObject | undefined, p: VTObject) => Args;
|
|
1
|
+
import type { ValueType } from "./types";
|
|
2
|
+
type VTObject = Record<string, ValueType>;
|
|
3
|
+
export declare const resolve: <Args = Record<string, ValueType>>(destination: VTObject, override: VTObject) => Args;
|
|
6
4
|
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
const resolveArray = (d, p) => {
|
|
2
|
-
if (d === undefined) {
|
|
3
|
-
return undefined;
|
|
4
|
-
}
|
|
5
2
|
const ret = [];
|
|
6
|
-
for (
|
|
3
|
+
for (let i = 0; i < d.length; ++i) {
|
|
7
4
|
if (d[i] instanceof Array) {
|
|
8
|
-
ret.push(resolveArray(d[i], p[i] ?? []));
|
|
5
|
+
ret.push(resolveArray(d[i], (p[i] ?? [])));
|
|
9
6
|
}
|
|
10
7
|
else if (d[i] instanceof Object) {
|
|
11
8
|
// eslint-disable-next-line no-use-before-define
|
|
12
|
-
ret.push(resolveObject(d[i], p[i] ?? {}));
|
|
9
|
+
ret.push(resolveObject(d[i], (p[i] ?? {})));
|
|
13
10
|
}
|
|
14
11
|
else {
|
|
15
12
|
ret.push(p[i] ?? d[i]);
|
|
@@ -18,16 +15,13 @@ const resolveArray = (d, p) => {
|
|
|
18
15
|
return ret;
|
|
19
16
|
};
|
|
20
17
|
const resolveObject = (d, p) => {
|
|
21
|
-
if (d === undefined) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
18
|
const ret = {};
|
|
25
19
|
for (const [key, value] of Object.entries(d)) {
|
|
26
20
|
if (value instanceof Array) {
|
|
27
|
-
ret[key] = resolveArray(value, p[key] ?? []);
|
|
21
|
+
ret[key] = resolveArray(value, (p[key] ?? []));
|
|
28
22
|
}
|
|
29
23
|
else if (value instanceof Object) {
|
|
30
|
-
ret[key] = resolveObject(value, p[key] ?? {});
|
|
24
|
+
ret[key] = resolveObject(value, (p[key] ?? {}));
|
|
31
25
|
}
|
|
32
26
|
else {
|
|
33
27
|
ret[key] = p[key] ?? value;
|
|
@@ -35,6 +29,6 @@ const resolveObject = (d, p) => {
|
|
|
35
29
|
}
|
|
36
30
|
return ret;
|
|
37
31
|
};
|
|
38
|
-
export const resolve = (
|
|
39
|
-
return resolveObject(
|
|
32
|
+
export const resolve = (destination, override) => {
|
|
33
|
+
return resolveObject(destination, override);
|
|
40
34
|
};
|
package/components/context.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import type { Writable } from "svelte/store";
|
|
|
2
2
|
export type Theme = undefined | "light" | "dark";
|
|
3
3
|
export declare const getTheme: () => Writable<boolean>;
|
|
4
4
|
export declare const initTheme: () => Writable<boolean>;
|
|
5
|
-
export declare const evalTheme: (parent: boolean, theme: Theme) => boolean;
|
package/components/context.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { setContext, getContext } from "svelte";
|
|
2
2
|
import { writable } from "svelte/store";
|
|
3
3
|
const theme = Symbol();
|
|
4
|
-
export const getTheme = () => getContext(theme);
|
|
4
|
+
export const getTheme = () => getContext(theme) ?? writable(true);
|
|
5
5
|
export const initTheme = () => setContext(theme, writable(true));
|
|
6
|
-
export const evalTheme = (parent, theme) => {
|
|
7
|
-
if (theme === undefined) {
|
|
8
|
-
return parent;
|
|
9
|
-
}
|
|
10
|
-
return "dark" === theme;
|
|
11
|
-
};
|
package/components/etc/action.js
CHANGED
|
@@ -3,7 +3,7 @@ export const createDraggable = (offset) => {
|
|
|
3
3
|
const position = writable(offset);
|
|
4
4
|
const draggable = (div, parameter) => {
|
|
5
5
|
let tm = new Date().getTime();
|
|
6
|
-
let param = parameter
|
|
6
|
+
let param = parameter;
|
|
7
7
|
position.set(param.reset());
|
|
8
8
|
let refPage = 0;
|
|
9
9
|
const disengage = () => param.moving.set(false);
|
|
@@ -15,14 +15,14 @@ export const createDraggable = (offset) => {
|
|
|
15
15
|
};
|
|
16
16
|
const engage = (e) => {
|
|
17
17
|
if (checkDoubleTap()) {
|
|
18
|
-
param
|
|
18
|
+
param.dbltap?.();
|
|
19
19
|
disengage();
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
param.moving.set(true);
|
|
23
23
|
position.set(param.reset());
|
|
24
24
|
refPage = param.vertical ? e.pageX : e.pageY;
|
|
25
|
-
param
|
|
25
|
+
param.tap?.();
|
|
26
26
|
};
|
|
27
27
|
const move = (e) => {
|
|
28
28
|
if (get(param.moving)) {
|
|
@@ -57,15 +57,15 @@ const apply = (paths, init, pre, next, post) => {
|
|
|
57
57
|
const filt = (path, filter, renamer) => {
|
|
58
58
|
return fuzz(path, filter) || fuzz(path.split("/").map(renamer).join("/"), filter);
|
|
59
59
|
};
|
|
60
|
-
const populate = (filter, info, renamer) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
t.url = p
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const populate = (filter, info, renamer) => {
|
|
61
|
+
return apply(
|
|
62
|
+
filter.length > 0 ? info.filter((path) => filt(path, filter, renamer)) : info,
|
|
63
|
+
() => ({ url: null, sub: {} }),
|
|
64
|
+
(t) => t,
|
|
65
|
+
(t) => t.sub,
|
|
66
|
+
(t, p) => void (t.url = p)
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
69
|
</script>
|
|
70
70
|
<script>import Tree from "./Tree.svelte";
|
|
71
71
|
export let info;
|
|
@@ -97,7 +97,7 @@ $:
|
|
|
97
97
|
</script>
|
|
98
98
|
<div class="nav">
|
|
99
99
|
<div class="search-bar">
|
|
100
|
-
<input bind:value={filter} type="text" />
|
|
100
|
+
<input bind:value={filter} type="text" placeholder="Search for page..." />
|
|
101
101
|
</div>
|
|
102
102
|
<div class="tree">
|
|
103
103
|
<Tree
|
|
@@ -74,7 +74,7 @@ const click = (link) => {
|
|
|
74
74
|
{style}
|
|
75
75
|
class:selected={selected === value.url}
|
|
76
76
|
>
|
|
77
|
-
<div class="icon" class:expanded={hasChildren && states.expanded}>
|
|
77
|
+
<div class="icon" class:expanded={hasChildren && (expand || states.expanded)}>
|
|
78
78
|
<div>{Object.keys(value.sub).length > 0 ? ">" : "-"}</div>
|
|
79
79
|
</div>
|
|
80
80
|
<span>{renamer(key)}</span>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Tree = {
|
|
2
2
|
url: string | null;
|
|
3
3
|
sub: Record<string, Tree>;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export type States = {
|
|
7
7
|
expanded: boolean;
|
|
8
8
|
sub: Record<string, States>;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export type Sorter = (l: string, r: string) => 1 | 0 | -1;
|
|
12
12
|
export type Renamer = (s: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nil-/doc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.40",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "njaldea@gmail.com",
|
|
6
6
|
"name": "Neil Aldea"
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
"@sveltejs/adapter-vercel": "^1.0.0",
|
|
11
11
|
"@sveltejs/kit": "^1.0.1",
|
|
12
12
|
"@sveltejs/package": "^1.0.1",
|
|
13
|
+
"@vitest/coverage-c8": "^0.26.3",
|
|
13
14
|
"mdsvex": "^0.10.6",
|
|
15
|
+
"remark-admonitions": "^1.2.1",
|
|
14
16
|
"svelte-check": "^2.10.3",
|
|
15
17
|
"tslib": "^2.4.1",
|
|
16
18
|
"typescript": "^4.9.4",
|
|
17
|
-
"vite": "^4.0.3"
|
|
19
|
+
"vite": "^4.0.3",
|
|
20
|
+
"vitest": "^0.26.3"
|
|
18
21
|
},
|
|
19
22
|
"peerDependencies": {
|
|
20
23
|
"svelte": "^3.55.0"
|
package/sveltekit/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type Routes = {
|
|
|
12
12
|
* Callback to navigate to other pages
|
|
13
13
|
* @param e - event that contains detail about the target url
|
|
14
14
|
*/
|
|
15
|
-
navigate: (e: CustomEvent<string>) => void
|
|
15
|
+
navigate: (e: CustomEvent<string>) => Promise<void>;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Dedicated helper method to be used for sveltekit
|