@nil-/doc 0.2.14 → 0.2.16
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 +15 -0
- package/components/block/Block.svelte +3 -2
- package/components/block/Controls.svelte +6 -2
- package/components/block/Controls.svelte.d.ts +1 -0
- package/components/block/Params.svelte +19 -6
- package/components/block/Template.svelte +20 -25
- package/components/block/Template.svelte.d.ts +3 -3
- package/components/block/context.d.ts +13 -4
- package/components/block/context.js +4 -1
- package/components/block/controls/Controls.svelte +6 -34
- package/components/block/controls/Controls.svelte.d.ts +1 -2
- package/components/block/controls/Object.svelte +3 -8
- package/components/block/controls/Tuple.svelte +3 -8
- package/components/block/controls/misc/GroupHeader.svelte +19 -0
- package/components/block/controls/misc/GroupHeader.svelte.d.ts +19 -0
- package/components/block/controls/misc/Styler.svelte +38 -0
- package/components/block/controls/misc/Styler.svelte.d.ts +27 -0
- package/components/block/controls/{Header.svelte → misc/TopHeader.svelte} +0 -0
- package/components/block/controls/misc/TopHeader.svelte.d.ts +23 -0
- package/components/block/controls/{defaulter.d.ts → misc/defaulter.d.ts} +1 -1
- package/components/block/controls/{defaulter.js → misc/defaulter.js} +0 -0
- package/components/block/utils.d.ts +1 -0
- package/components/block/utils.js +40 -0
- package/components/routes.d.ts +6 -0
- package/components/{load.js → routes.js} +9 -6
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/components/block/controls/Header.svelte.d.ts +0 -23
- package/components/load.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @nil-/doc
|
|
2
2
|
|
|
3
|
+
## 0.2.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 650eb4b: [doc] revived proper ordering of params
|
|
8
|
+
[doc] each param now has its own defaults (which is resolved from template's default and pram's props)
|
|
9
|
+
|
|
10
|
+
## 0.2.15
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 44a7113: [doc] added documentation for internal Container
|
|
15
|
+
[doc] adjusted api for load (now `routes`)
|
|
16
|
+
[doc] fix for layout group route
|
|
17
|
+
|
|
3
18
|
## 0.2.14
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
<script>import { initCurrent,
|
|
1
|
+
<script>import { initParams, initCurrent, initDefaults, initControls, initControlsState } from "./context";
|
|
2
2
|
import { inRoot } from "../context";
|
|
3
3
|
initParams();
|
|
4
4
|
initCurrent();
|
|
5
|
-
initControls();
|
|
6
5
|
initDefaults();
|
|
6
|
+
initControls();
|
|
7
|
+
initControlsState();
|
|
7
8
|
const r = inRoot();
|
|
8
9
|
</script>
|
|
9
10
|
<style>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
<script>import { getControls } from "./context";
|
|
2
|
+
<script>import { getControls, getControlsState } from "./context";
|
|
3
3
|
export let props = [];
|
|
4
|
-
|
|
4
|
+
export let expand = false;
|
|
5
|
+
const controls = getControls();
|
|
6
|
+
$controls = props;
|
|
7
|
+
const state = getControlsState();
|
|
8
|
+
$: $state.expand = expand;
|
|
5
9
|
</script>
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
|
|
2
|
-
<script>import {
|
|
2
|
+
<script>import { onMount } from "svelte";
|
|
3
|
+
import { getParams, getDefaults } from "./context";
|
|
4
|
+
import { resolve } from "./utils";
|
|
3
5
|
export let tag;
|
|
4
6
|
export let props = {};
|
|
5
7
|
const defaults = getDefaults();
|
|
6
8
|
const params = getParams();
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
|
|
9
|
+
onMount(() => defaults.subscribe((d) => {
|
|
10
|
+
if (d != null) {
|
|
11
|
+
params.update((p) => {
|
|
12
|
+
const v = [
|
|
13
|
+
...p,
|
|
14
|
+
{
|
|
15
|
+
id: p.length,
|
|
16
|
+
tag,
|
|
17
|
+
values: resolve(d, props),
|
|
18
|
+
defaults: resolve(d, props)
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
console.log(v);
|
|
22
|
+
return v;
|
|
23
|
+
});
|
|
10
24
|
}
|
|
11
|
-
}
|
|
12
|
-
$: set(tag, props);
|
|
25
|
+
}));
|
|
13
26
|
</script>
|
|
@@ -33,30 +33,25 @@
|
|
|
33
33
|
</style>
|
|
34
34
|
<svelte:window on:click={() => ($current = null)} />
|
|
35
35
|
|
|
36
|
-
<script>import {
|
|
37
|
-
import {
|
|
36
|
+
<script>import { getParams, getCurrent, getDefaults } from "./context";
|
|
37
|
+
import { getControls, getControlsState } from "./context";
|
|
38
|
+
import { resolve } from "./utils";
|
|
38
39
|
import Controls from "./controls/Controls.svelte";
|
|
40
|
+
import { beforeUpdate } from "svelte";
|
|
39
41
|
import { slide } from "svelte/transition";
|
|
40
42
|
const params = getParams();
|
|
41
43
|
const current = getCurrent();
|
|
42
44
|
const controls = getControls();
|
|
43
|
-
|
|
44
|
-
getDefaults()
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const temporary = { ...d };
|
|
51
|
-
for (const key of keys) {
|
|
52
|
-
if (key in p && p[key] !== undefined) {
|
|
53
|
-
temporary[key] = p[key];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return temporary;
|
|
45
|
+
const controlsState = getControlsState();
|
|
46
|
+
const defaultsStore = getDefaults();
|
|
47
|
+
export let defaults = undefined;
|
|
48
|
+
export let noreset = false;
|
|
49
|
+
function reset() {
|
|
50
|
+
$params = [];
|
|
51
|
+
$defaultsStore = defaults;
|
|
57
52
|
}
|
|
53
|
+
$: $defaultsStore, reset();
|
|
58
54
|
let hovered = null;
|
|
59
|
-
export let noreset = false;
|
|
60
55
|
/**
|
|
61
56
|
* This flag is to rerender the whole slot component.
|
|
62
57
|
* If the control is disabled, we use the default value provided from the defaults field.
|
|
@@ -72,28 +67,28 @@ let key = false;
|
|
|
72
67
|
beforeUpdate(() => (key = !key));
|
|
73
68
|
</script>
|
|
74
69
|
<div class="template">
|
|
75
|
-
{#each
|
|
70
|
+
{#each $params as param (param.id)}
|
|
76
71
|
<div
|
|
77
72
|
class="instance"
|
|
78
|
-
on:click|stopPropagation={() => ($current =
|
|
79
|
-
on:mouseenter={() => (hovered =
|
|
73
|
+
on:click|stopPropagation={() => ($current = param.id)}
|
|
74
|
+
on:mouseenter={() => (hovered = param.id)}
|
|
80
75
|
on:mouseleave={() => (hovered = null)}
|
|
81
76
|
on:keypress={null}
|
|
82
77
|
>
|
|
83
78
|
{#if noreset}
|
|
84
79
|
<div class="content nil-doc-scrollable">
|
|
85
|
-
<slot {tag} props={resolve(defaults,
|
|
80
|
+
<slot tag={param.tag} props={resolve(param.defaults, param.values)} />
|
|
86
81
|
</div>
|
|
87
82
|
{:else}
|
|
88
83
|
{#key key}
|
|
89
84
|
<div class="content nil-doc-scrollable">
|
|
90
|
-
<slot {tag} props={resolve(defaults,
|
|
85
|
+
<slot tag={param.tag} props={resolve(param.defaults, param.values)} />
|
|
91
86
|
</div>
|
|
92
87
|
{/key}
|
|
93
88
|
{/if}
|
|
94
|
-
{#if $controls.length > 0 && ($current ===
|
|
95
|
-
<div class="misc nil-doc-scrollable" transition:slide>
|
|
96
|
-
<Controls infos={$controls} bind:values={
|
|
89
|
+
{#if $controls.length > 0 && ($controlsState.expand || $current === param.id || hovered === param.id)}
|
|
90
|
+
<div class="misc nil-doc-scrollable" transition:slide|local>
|
|
91
|
+
<Controls infos={$controls} bind:values={param.values} />
|
|
97
92
|
</div>
|
|
98
93
|
{/if}
|
|
99
94
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare class __sveltets_Render<Args> {
|
|
3
3
|
props(): {
|
|
4
|
-
defaults
|
|
4
|
+
defaults?: Args | undefined;
|
|
5
5
|
noreset?: boolean | undefined;
|
|
6
6
|
};
|
|
7
7
|
events(): {} & {
|
|
@@ -9,8 +9,8 @@ declare class __sveltets_Render<Args> {
|
|
|
9
9
|
};
|
|
10
10
|
slots(): {
|
|
11
11
|
default: {
|
|
12
|
-
tag: string;
|
|
13
|
-
props:
|
|
12
|
+
tag: string | undefined;
|
|
13
|
+
props: Record<string, any>;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { Control } from "./controls/types";
|
|
2
2
|
import type { Writable } from "svelte/store";
|
|
3
|
-
export type Params =
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type Params = {
|
|
4
|
+
id: number;
|
|
5
|
+
tag?: string;
|
|
6
|
+
values: Record<string, any>;
|
|
7
|
+
defaults: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
export type ControlState = {
|
|
10
|
+
expand: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const initCurrent: () => Writable<number | null>, getCurrent: () => Writable<number | null>;
|
|
13
|
+
export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
|
|
6
14
|
export declare const initControls: () => Writable<Control[]>, getControls: () => Writable<Control[]>;
|
|
7
|
-
export declare const initDefaults: () => Writable<
|
|
15
|
+
export declare const initDefaults: () => Writable<Record<string, any> | null>, getDefaults: () => Writable<Record<string, any> | null>;
|
|
16
|
+
export declare const initControlsState: () => Writable<ControlState>, getControlsState: () => Writable<ControlState>;
|
|
@@ -8,6 +8,9 @@ function create(defaulter) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export const { init: initCurrent, get: getCurrent } = create(() => null);
|
|
11
|
-
export const { init: initParams, get: getParams } = create(() =>
|
|
11
|
+
export const { init: initParams, get: getParams } = create(() => []);
|
|
12
12
|
export const { init: initControls, get: getControls } = create(() => []);
|
|
13
13
|
export const { init: initDefaults, get: getDefaults } = create(() => null);
|
|
14
|
+
export const { init: initControlsState, get: getControlsState } = create(() => ({
|
|
15
|
+
expand: false
|
|
16
|
+
}));
|
|
@@ -1,42 +1,14 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
.controls {
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: grid;
|
|
5
|
-
grid-auto-rows: 1fr;
|
|
6
|
-
}
|
|
7
1
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
padding: 2px 0px;
|
|
12
|
-
grid-template-columns: 1fr 200px 75px;
|
|
13
|
-
background-color: hsl(205, 50%, 5%);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.controls > :global(div:nth-child(even)) {
|
|
17
|
-
background-color: hsl(205, 15%, 15%);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.controls > :global(div > div) {
|
|
21
|
-
display: grid;
|
|
22
|
-
align-items: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.controls > :global(div > div > *) {
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
30
|
-
|
|
31
|
-
<script>import Header from "./Header.svelte";
|
|
32
|
-
import Component from "./Component.svelte";
|
|
2
|
+
<script>import Component from "./Component.svelte";
|
|
3
|
+
import Header from "./misc/TopHeader.svelte";
|
|
4
|
+
import Styler from "./misc/Styler.svelte";
|
|
33
5
|
export let infos;
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
7
|
export let values;
|
|
35
8
|
</script>
|
|
36
|
-
<
|
|
9
|
+
<Styler>
|
|
37
10
|
<Header />
|
|
38
11
|
{#each infos as info}
|
|
39
12
|
<Component {info} bind:value={values[info.name]} />
|
|
40
13
|
{/each}
|
|
41
|
-
</
|
|
42
|
-
|
|
14
|
+
</Styler>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Control } from "./types";
|
|
3
|
-
import type { Params } from "../context";
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
6
5
|
infos: Control[];
|
|
7
|
-
values:
|
|
6
|
+
values: Record<string, any>;
|
|
8
7
|
};
|
|
9
8
|
events: {
|
|
10
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import Component from "./Component.svelte";
|
|
3
|
-
import
|
|
3
|
+
import Header from "./misc/GroupHeader.svelte";
|
|
4
|
+
import { getObjectDefaults } from "./misc/defaulter";
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
export let value;
|
|
6
7
|
export let info;
|
|
@@ -10,13 +11,7 @@ let ivalue = value ?? getObjectDefaults(info);
|
|
|
10
11
|
let enabled = value !== undefined;
|
|
11
12
|
$: value = !disabled && enabled ? ivalue : undefined;
|
|
12
13
|
</script>
|
|
13
|
-
<
|
|
14
|
-
<div style:padding-left={`${depth}px`}>
|
|
15
|
-
> {info.name}
|
|
16
|
-
</div>
|
|
17
|
-
<div>-</div>
|
|
18
|
-
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
19
|
-
</div>
|
|
14
|
+
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
20
15
|
{#if enabled && !disabled}
|
|
21
16
|
{#each info.values as info, i (i)}
|
|
22
17
|
<Component
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<script>import Component from "./Component.svelte";
|
|
3
|
-
import
|
|
3
|
+
import Header from "./misc/GroupHeader.svelte";
|
|
4
|
+
import { getTupleDefaults } from "./misc/defaulter";
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
export let value;
|
|
6
7
|
export let info;
|
|
@@ -10,13 +11,7 @@ let ivalue = value ?? getTupleDefaults(info);
|
|
|
10
11
|
let enabled = value !== undefined;
|
|
11
12
|
$: value = !disabled && enabled ? ivalue : undefined;
|
|
12
13
|
</script>
|
|
13
|
-
<
|
|
14
|
-
<div style:padding-left={`${depth}px`}>
|
|
15
|
-
> {info.name}
|
|
16
|
-
</div>
|
|
17
|
-
<div>-</div>
|
|
18
|
-
<div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
|
|
19
|
-
</div>
|
|
14
|
+
<Header name={info.name} bind:checked={enabled} {depth} {disabled} />
|
|
20
15
|
{#if enabled && !disabled}
|
|
21
16
|
{#each info.values as info, i (i)}
|
|
22
17
|
<Component
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.value {
|
|
3
|
+
text-align: center;
|
|
4
|
+
}
|
|
5
|
+
</style>
|
|
6
|
+
|
|
7
|
+
<script>export let name;
|
|
8
|
+
export let depth;
|
|
9
|
+
export let checked;
|
|
10
|
+
export let disabled = false;
|
|
11
|
+
</script>
|
|
12
|
+
<div>
|
|
13
|
+
<div style:padding-left={`${depth}px`}>
|
|
14
|
+
{`> ${name}`}
|
|
15
|
+
</div>
|
|
16
|
+
<div class="value">-</div>
|
|
17
|
+
<div><input type="checkbox" bind:checked {disabled} /></div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
name: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type GroupHeaderProps = typeof __propDef.props;
|
|
15
|
+
export type GroupHeaderEvents = typeof __propDef.events;
|
|
16
|
+
export type GroupHeaderSlots = typeof __propDef.slots;
|
|
17
|
+
export default class GroupHeader extends SvelteComponentTyped<GroupHeaderProps, GroupHeaderEvents, GroupHeaderSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
div {
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-auto-rows: 30px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
div > :global(div) {
|
|
9
|
+
width: 100%;
|
|
10
|
+
display: grid;
|
|
11
|
+
padding: 2px 0px;
|
|
12
|
+
grid-template-columns: 1fr 200px 75px;
|
|
13
|
+
background-color: hsl(205, 50%, 5%);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
div > :global(div:nth-child(even)) {
|
|
17
|
+
background-color: hsl(205, 15%, 15%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
div > :global(div:hover) {
|
|
21
|
+
background-color: rgba(2, 156, 253, 0.07);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
div > :global(div > div) {
|
|
25
|
+
display: grid;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
div > :global(div > div > *) {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
|
|
35
|
+
<div>
|
|
36
|
+
<slot />
|
|
37
|
+
</div>
|
|
38
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} StylerProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} StylerEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} StylerSlots */
|
|
4
|
+
export default class Styler extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type StylerProps = typeof __propDef.props;
|
|
13
|
+
export type StylerEvents = typeof __propDef.events;
|
|
14
|
+
export type StylerSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} TopHeaderProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} TopHeaderEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} TopHeaderSlots */
|
|
4
|
+
export default class TopHeader extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type TopHeaderProps = typeof __propDef.props;
|
|
11
|
+
export type TopHeaderEvents = typeof __propDef.events;
|
|
12
|
+
export type TopHeaderSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Control, ControlTuple, ControlObject } from "
|
|
1
|
+
import type { Control, ControlTuple, ControlObject } from "../types";
|
|
2
2
|
export declare function getObjectDefaults(info: ControlObject): Record<string, any>;
|
|
3
3
|
export declare function getTupleDefaults(i: ControlTuple): any[];
|
|
4
4
|
export declare function getDefault(i: Control): any;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolve<Args>(d: Args | undefined, p: Record<string, any>): Args;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
function resolveArray(d, p) {
|
|
3
|
+
if (d === undefined) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const ret = [];
|
|
7
|
+
for (const i in d) {
|
|
8
|
+
if (d[i] instanceof Array) {
|
|
9
|
+
ret.push(resolveArray(d[i], p[i] ?? []));
|
|
10
|
+
}
|
|
11
|
+
else if (d[i] instanceof Object) {
|
|
12
|
+
ret.push(resolveObject(d[i], p[i] ?? {}));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
ret.push(p[i] ?? d[i]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return ret;
|
|
19
|
+
}
|
|
20
|
+
function resolveObject(d, p) {
|
|
21
|
+
if (d === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const ret = {};
|
|
25
|
+
for (const [key, value] of Object.entries(d)) {
|
|
26
|
+
if (value instanceof Array) {
|
|
27
|
+
ret[key] = resolveArray(value, p[key] ?? []);
|
|
28
|
+
}
|
|
29
|
+
else if (value instanceof Object) {
|
|
30
|
+
ret[key] = resolveObject(value, p[key] ?? {});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
ret[key] = p[key] ?? value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return ret;
|
|
37
|
+
}
|
|
38
|
+
export function resolve(d, p) {
|
|
39
|
+
return resolveObject(d ?? {}, p);
|
|
40
|
+
}
|
|
@@ -17,10 +17,13 @@ const route_rest_match = /.*\[.*\].*/;
|
|
|
17
17
|
function isRouteDynamic(p) {
|
|
18
18
|
return route_rest_match.exec(p) == null;
|
|
19
19
|
}
|
|
20
|
-
export function
|
|
21
|
-
return
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
export function routes(files_from_import_meta) {
|
|
21
|
+
return {
|
|
22
|
+
data: Object.keys(files_from_import_meta)
|
|
23
|
+
.map(toRoute)
|
|
24
|
+
.map(collapseLayout)
|
|
25
|
+
.filter(isNotRoot)
|
|
26
|
+
.filter(isRouteDynamic),
|
|
27
|
+
process: (r) => (r ? collapseLayout(r) : null)
|
|
28
|
+
};
|
|
26
29
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { routes } from "./components/routes";
|
|
2
2
|
export { renamer, sorter } from "./components/navigation/utils";
|
|
3
3
|
export type { Control } from "./components/block/controls/types";
|
|
4
4
|
export { default as Layout } from "./components/Layout.svelte";
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { routes } from "./components/routes";
|
|
2
2
|
export { renamer, sorter } from "./components/navigation/utils";
|
|
3
3
|
export { default as Layout } from "./components/Layout.svelte";
|
|
4
4
|
export { default as Block } from "./components/block/Block.svelte";
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} HeaderProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} HeaderEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} HeaderSlots */
|
|
4
|
-
export default class Header extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
}
|
|
10
|
-
export type HeaderProps = typeof __propDef.props;
|
|
11
|
-
export type HeaderEvents = typeof __propDef.events;
|
|
12
|
-
export type HeaderSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponentTyped } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
};
|
|
23
|
-
export {};
|
package/components/load.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function load(files_from_import_meta: Record<string, unknown>): string[];
|