@nil-/doc 0.2.46 → 0.2.47

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/components/block/Instance.svelte +4 -0
  3. package/components/block/Instance.svelte.d.ts +1 -0
  4. package/components/block/controls/props/Component.svelte +34 -14
  5. package/components/block/controls/props/Number.svelte +4 -2
  6. package/components/block/controls/props/Number.svelte.d.ts +2 -2
  7. package/components/block/controls/props/Object.svelte +5 -3
  8. package/components/block/controls/props/Object.svelte.d.ts +2 -2
  9. package/components/block/controls/props/Props.svelte +5 -1
  10. package/components/block/controls/props/Range.svelte +13 -5
  11. package/components/block/controls/props/Range.svelte.d.ts +2 -2
  12. package/components/block/controls/props/Select.svelte +8 -4
  13. package/components/block/controls/props/Select.svelte.d.ts +2 -2
  14. package/components/block/controls/props/Switch.svelte +4 -2
  15. package/components/block/controls/props/Switch.svelte.d.ts +2 -2
  16. package/components/block/controls/props/Text.svelte +4 -2
  17. package/components/block/controls/props/Text.svelte.d.ts +2 -2
  18. package/components/block/controls/props/Tuple.svelte +22 -10
  19. package/components/block/controls/props/Tuple.svelte.d.ts +2 -2
  20. package/components/block/controls/props/misc/defaulter.d.ts +10 -8
  21. package/components/block/controls/props/misc/defaulter.js +59 -24
  22. package/components/block/controls/types.d.ts +45 -52
  23. package/components/etc/Container.svelte +4 -0
  24. package/components/navigation/types.d.ts +1 -1
  25. package/components/navigation/utils/renamer.d.ts +1 -5
  26. package/components/navigation/utils/renamer.js +2 -5
  27. package/components/navigation/utils/sorter.d.ts +1 -6
  28. package/components/navigation/utils/sorter.js +2 -6
  29. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.47
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][docu] minor adjustments to documentation ([#79](https://github.com/njaldea/mono/pull/79))
8
+
9
+ - [doc][new] added support for flattened prop schema ([#79](https://github.com/njaldea/mono/pull/79))
10
+
3
11
  ## 0.2.46
4
12
 
5
13
  ### Patch Changes
6
14
 
7
- - [doc][new] added event control support ([#77](https://github.com/njaldea/mono/pull/77))
15
+ - [doc][break] added event control support ([#77](https://github.com/njaldea/mono/pull/77))
8
16
 
9
17
  ## 0.2.45
10
18
 
@@ -107,6 +107,10 @@ $:
107
107
  updateBound(defaults);
108
108
  let handlers;
109
109
  </script>
110
+ <!--
111
+ @component
112
+ See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details.
113
+ -->
110
114
  <div
111
115
  class="instance"
112
116
  class:scale
@@ -19,6 +19,7 @@ declare class __sveltets_Render<PropArgs> {
19
19
  export type InstanceProps<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['props']>;
20
20
  export type InstanceEvents<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['events']>;
21
21
  export type InstanceSlots<PropArgs> = ReturnType<__sveltets_Render<PropArgs>['slots']>;
22
+ /** See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details. */
22
23
  export default class Instance<PropArgs> extends SvelteComponentTyped<InstanceProps<PropArgs>, InstanceEvents<PropArgs>, InstanceSlots<PropArgs>> {
23
24
  }
24
25
  export {};
@@ -12,18 +12,38 @@ export let depth;
12
12
  export let disabled = false;
13
13
  export let visible = false;
14
14
  </script>
15
- {#if "object" === info.type}
16
- <Object {info} bind:value {depth} {disabled} {visible} />
17
- {:else if "tuple" === info.type}
18
- <Tuple {info} bind:value {depth} {disabled} {visible} />
19
- {:else if "text" === info.type}
20
- <Text {info} bind:value {depth} {disabled} {visible} />
21
- {:else if "number" === info.type}
22
- <Number {info} bind:value {depth} {disabled} {visible} />
23
- {:else if "range" === info.type}
24
- <Range {info} bind:value {depth} {disabled} {visible} />
25
- {:else if "select" === info.type}
26
- <Select {info} bind:value {depth} {disabled} {visible} />
27
- {:else if "switch" === info.type}
28
- <Switch {info} bind:value {depth} {disabled} {visible} />
15
+ {#if info instanceof Array}
16
+ {@const type = info[1]}
17
+ {#if "object" === type}
18
+ <Object {info} bind:value {depth} {disabled} {visible} />
19
+ {:else if "tuple" === type}
20
+ <Tuple {info} bind:value {depth} {disabled} {visible} />
21
+ {:else if "text" === type}
22
+ <Text {info} bind:value {depth} {disabled} {visible} />
23
+ {:else if "number" === type}
24
+ <Number {info} bind:value {depth} {disabled} {visible} />
25
+ {:else if "range" === type}
26
+ <Range {info} bind:value {depth} {disabled} {visible} />
27
+ {:else if "select" === type}
28
+ <Select {info} bind:value {depth} {disabled} {visible} />
29
+ {:else if "switch" === type}
30
+ <Switch {info} bind:value {depth} {disabled} {visible} />
31
+ {/if}
32
+ {:else}
33
+ {@const type = info.type}
34
+ {#if "object" === type}
35
+ <Object {info} bind:value {depth} {disabled} {visible} />
36
+ {:else if "tuple" === type}
37
+ <Tuple {info} bind:value {depth} {disabled} {visible} />
38
+ {:else if "text" === type}
39
+ <Text {info} bind:value {depth} {disabled} {visible} />
40
+ {:else if "number" === type}
41
+ <Number {info} bind:value {depth} {disabled} {visible} />
42
+ {:else if "range" === type}
43
+ <Range {info} bind:value {depth} {disabled} {visible} />
44
+ {:else if "select" === type}
45
+ <Select {info} bind:value {depth} {disabled} {visible} />
46
+ {:else if "switch" === type}
47
+ <Switch {info} bind:value {depth} {disabled} {visible} />
48
+ {/if}
29
49
  {/if}
@@ -1,6 +1,6 @@
1
1
 
2
2
  <script>import { getDefault } from "./misc/defaulter";
3
- import Name from "./misc/Name.svelte";
3
+ import NameHeader from "./misc/Name.svelte";
4
4
  export let value;
5
5
  export let info;
6
6
  export let depth;
@@ -10,10 +10,12 @@ let ivalue = value ?? getDefault(info);
10
10
  let enabled = value !== void 0;
11
11
  $:
12
12
  value = enabled && !disabled ? ivalue : void 0;
13
+ $:
14
+ name = info instanceof Array ? info[0] : info.name;
13
15
  </script>
14
16
  {#if visible}
15
17
  <div>
16
- <Name name={info.name} {depth} />
18
+ <NameHeader {name} {depth} />
17
19
  <div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
18
20
  <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
19
21
  </div>
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PropNumber } from "../types";
2
+ import type { Name, PropNumber, FlatPropNumber } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: number | undefined;
6
- info: PropNumber;
6
+ info: (Name & PropNumber) | [string, ...FlatPropNumber];
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -13,13 +13,15 @@ let expand = info.values.length > 0 ? true : void 0;
13
13
  $:
14
14
  value = !disabled && enabled ? ivalue : void 0;
15
15
  $:
16
- values = info.values;
16
+ values = info instanceof Array ? info[2] : info.values;
17
+ $:
18
+ name = info instanceof Array ? info[0] : info.name;
17
19
  </script>
18
- <Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
20
+ <Header {name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
19
21
  {#each values as info, i (i)}
20
22
  <Component
21
23
  {info}
22
- bind:value={ivalue[info.name]}
24
+ bind:value={ivalue[name]}
23
25
  depth={depth + 10}
24
26
  disabled={!enabled || disabled}
25
27
  visible={visible && expand && enabled && !disabled}
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { ValueType } from "../../types";
3
- import type { PropObject } from "../types";
3
+ import type { Name, PropObject, FlatPropObject } from "../types";
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  value: Record<string, ValueType> | undefined;
7
- info: PropObject;
7
+ info: (Name & PropObject) | [string, ...FlatPropObject];
8
8
  depth: number;
9
9
  disabled?: boolean | undefined;
10
10
  visible?: boolean | undefined;
@@ -10,6 +10,10 @@ export let visible;
10
10
  <slot />
11
11
  {/if}
12
12
  {#each infos as info}
13
- <Component {info} bind:value={values[info.name]} depth={10} {visible} />
13
+ {#if info instanceof Array}
14
+ <Component {info} bind:value={values[info[0]]} depth={10} {visible} />
15
+ {:else}
16
+ <Component {info} bind:value={values[info.name]} depth={10} {visible} />
17
+ {/if}
14
18
  {/each}
15
19
  </Styler>
@@ -33,7 +33,7 @@
33
33
  </style>
34
34
 
35
35
  <script>import { getDefault } from "./misc/defaulter";
36
- import Name from "./misc/Name.svelte";
36
+ import NameHeader from "./misc/Name.svelte";
37
37
  export let value;
38
38
  export let info;
39
39
  export let depth;
@@ -45,10 +45,18 @@ $:
45
45
  value = enabled && !disabled ? ivalue : void 0;
46
46
  $:
47
47
  flag = !enabled || disabled;
48
+ $:
49
+ name = info instanceof Array ? info[0] : info.name;
50
+ $:
51
+ min = info instanceof Array ? info[2] : info.min;
52
+ $:
53
+ max = info instanceof Array ? info[3] : info.max;
54
+ $:
55
+ step = info instanceof Array ? info[4] : info.step;
48
56
  </script>
49
57
  {#if visible}
50
58
  <div>
51
- <Name name={info.name} {depth} />
59
+ <NameHeader {name} {depth} />
52
60
  <div class="input">
53
61
  <div class="tooltip" class:disabled={flag}>
54
62
  Current Value: {ivalue}
@@ -57,9 +65,9 @@ $:
57
65
  <input
58
66
  type="range"
59
67
  bind:value={ivalue}
60
- min={info.min}
61
- max={info.max}
62
- step={info.step}
68
+ {min}
69
+ {max}
70
+ {step}
63
71
  disabled={flag}
64
72
  />
65
73
  </div>
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PropRange } from "../types";
2
+ import type { Name, PropRange, FlatPropRange } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: number | undefined;
6
- info: PropRange;
6
+ info: (Name & PropRange) | [string, ...FlatPropRange];
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
 
2
2
  <script>import { getDefault } from "./misc/defaulter";
3
- import Name from "./misc/Name.svelte";
3
+ import NameHeader from "./misc/Name.svelte";
4
4
  export let value;
5
5
  export let info;
6
6
  export let depth;
@@ -10,14 +10,18 @@ let ivalue = value ?? getDefault(info);
10
10
  let enabled = value !== void 0;
11
11
  $:
12
12
  value = enabled && !disabled ? ivalue : void 0;
13
+ $:
14
+ name = info instanceof Array ? info[0] : info.name;
15
+ $:
16
+ values = info instanceof Array ? info[2] : info.values;
13
17
  </script>
14
18
  {#if visible}
15
19
  <div>
16
- <Name name={info.name} {depth} />
20
+ <NameHeader {name} {depth} />
17
21
  <div>
18
22
  <select bind:value={ivalue} disabled={!enabled || disabled}>
19
- {#each info.values as value}
20
- <option {value}>{value}</option>
23
+ {#each values as v}
24
+ <option value={v}>{v}</option>
21
25
  {/each}
22
26
  </select>
23
27
  </div>
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PropSelect } from "../types";
2
+ import type { Name, PropSelect, FlatPropSelect } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: string | undefined;
6
- info: PropSelect;
6
+ info: (Name & PropSelect) | [string, ...FlatPropSelect];
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
 
2
2
  <script>import { getDefault } from "./misc/defaulter";
3
- import Name from "./misc/Name.svelte";
3
+ import NameHeader from "./misc/Name.svelte";
4
4
  export let value;
5
5
  export let info;
6
6
  export let depth;
@@ -10,10 +10,12 @@ let ivalue = value ?? getDefault(info);
10
10
  let enabled = value !== void 0;
11
11
  $:
12
12
  value = enabled && !disabled ? ivalue : void 0;
13
+ $:
14
+ name = info instanceof Array ? info[0] : info.name;
13
15
  </script>
14
16
  {#if visible}
15
17
  <div>
16
- <Name name={info.name} {depth} />
18
+ <NameHeader {name} {depth} />
17
19
  <div><input type="checkbox" bind:checked={ivalue} disabled={!enabled || disabled} /></div>
18
20
  <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
19
21
  </div>
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PropSwitch } from "../types";
2
+ import type { Name, PropSwitch, FlatPropSwitch } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: boolean | undefined;
6
- info: PropSwitch;
6
+ info: (Name & PropSwitch) | [string, ...FlatPropSwitch];
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
 
2
2
  <script>import { getDefault } from "./misc/defaulter";
3
- import Name from "./misc/Name.svelte";
3
+ import NameHeader from "./misc/Name.svelte";
4
4
  export let value;
5
5
  export let info;
6
6
  export let depth;
@@ -10,10 +10,12 @@ let ivalue = value ?? getDefault(info);
10
10
  let ienabled = value !== void 0;
11
11
  $:
12
12
  value = ienabled && !disabled ? ivalue : void 0;
13
+ $:
14
+ name = info instanceof Array ? info[0] : info.name;
13
15
  </script>
14
16
  {#if visible}
15
17
  <div>
16
- <Name name={info.name} {depth} />
18
+ <NameHeader {name} {depth} />
17
19
  <div><input type="text" bind:value={ivalue} disabled={!ienabled || disabled} /></div>
18
20
  <div><input type="checkbox" bind:checked={ienabled} {disabled} /></div>
19
21
  </div>
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { PropText } from "../types";
2
+ import type { Name, PropText, FlatPropText } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: string | undefined;
6
- info: PropText;
6
+ info: (Name & PropText) | [string, ...FlatPropText];
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -12,16 +12,28 @@ let enabled = value !== void 0;
12
12
  $:
13
13
  value = !disabled && enabled ? ivalue : void 0;
14
14
  $:
15
- values = info.values;
15
+ values = info instanceof Array ? info[2] : info.values;
16
+ $:
17
+ name = info instanceof Array ? info[0] : info.name;
16
18
  let expand = info.values.length > 0 ? true : void 0;
17
19
  </script>
18
- <Header name={info.name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
19
- {#each values as info, i (i)}
20
- <Component
21
- info={{ ...info, name: `${i}` }}
22
- bind:value={ivalue[i]}
23
- depth={depth + 10}
24
- disabled={!enabled || disabled}
25
- visible={visible && expand && enabled && !disabled}
26
- />
20
+ <Header {name} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
21
+ {#each values as v, i (i)}
22
+ {#if v instanceof Array}
23
+ <Component
24
+ info={[`${i}`, ...v]}
25
+ bind:value={ivalue[i]}
26
+ depth={depth + 10}
27
+ disabled={!enabled || disabled}
28
+ visible={visible && expand && enabled && !disabled}
29
+ />
30
+ {:else}
31
+ <Component
32
+ info={{ ...v, name: `${i}` }}
33
+ bind:value={ivalue[i]}
34
+ depth={depth + 10}
35
+ disabled={!enabled || disabled}
36
+ visible={visible && expand && enabled && !disabled}
37
+ />
38
+ {/if}
27
39
  {/each}
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { ValueType } from "../../types";
3
- import type { PropTuple } from "../types";
3
+ import type { Name, PropTuple, FlatPropTuple } from "../types";
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  value: ValueType[] | undefined;
7
- info: PropTuple;
7
+ info: (Name & PropTuple) | [string, ...FlatPropTuple];
8
8
  depth: number;
9
9
  disabled?: boolean | undefined;
10
10
  visible?: boolean | undefined;
@@ -1,10 +1,12 @@
1
1
  import type { ValueType } from "../../../types";
2
- import type { Prop, PropNumber, PropRange, PropSelect, PropSwitch, PropText, PropTuple, PropObject } from "../../types";
3
- export declare function getDefault(i: PropTuple): ValueType[];
4
- export declare function getDefault(i: PropObject): Record<string, ValueType>;
5
- export declare function getDefault(i: PropNumber): number;
6
- export declare function getDefault(i: PropRange): number;
7
- export declare function getDefault(i: PropSelect): string;
8
- export declare function getDefault(i: PropText): string;
9
- export declare function getDefault(i: PropSwitch): boolean;
2
+ import type { Prop, Name } from "../../types";
3
+ import type { PropNumber, PropRange, PropSelect, PropSwitch, PropText, PropTuple, PropObject } from "../../types";
4
+ import type { FlatPropNumber, FlatPropRange, FlatPropSelect, FlatPropSwitch, FlatPropText, FlatPropTuple, FlatPropObject } from "../../types";
5
+ export declare function getDefault(i: (Name & PropTuple) | [string, ...FlatPropTuple]): ValueType[];
6
+ export declare function getDefault(i: (Name & PropObject) | [string, ...FlatPropObject]): Record<string, ValueType>;
7
+ export declare function getDefault(i: (Name & PropNumber) | [string, ...FlatPropNumber]): number;
8
+ export declare function getDefault(i: (Name & PropRange) | [string, ...FlatPropRange]): number;
9
+ export declare function getDefault(i: (Name & PropSelect) | [string, ...FlatPropSelect]): string;
10
+ export declare function getDefault(i: (Name & PropText) | [string, ...FlatPropText]): string;
11
+ export declare function getDefault(i: (Name & PropSwitch) | [string, ...FlatPropSwitch]): boolean;
10
12
  export declare function getDefault(i: Prop): ValueType;
@@ -1,36 +1,71 @@
1
1
  // eslint-disable-next-line func-style
2
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;
3
+ if (i instanceof Array) {
4
+ switch (i[1]) {
5
+ case "object":
6
+ // eslint-disable-next-line no-use-before-define
7
+ return getObjectDefaults(i);
8
+ case "tuple":
9
+ // eslint-disable-next-line no-use-before-define
10
+ return getTupleDefaults(i);
11
+ case "text":
12
+ return "";
13
+ case "select":
14
+ return i[2].length > 0 ? i[2][0] : "";
15
+ case "number":
16
+ return 0;
17
+ case "range":
18
+ return i[2];
19
+ case "switch":
20
+ default:
21
+ return false;
22
+ }
23
+ }
24
+ else {
25
+ switch (i.type) {
26
+ case "object":
27
+ // eslint-disable-next-line no-use-before-define
28
+ return getObjectDefaults(i);
29
+ case "tuple":
30
+ // eslint-disable-next-line no-use-before-define
31
+ return getTupleDefaults(i);
32
+ case "text":
33
+ return "";
34
+ case "select":
35
+ return i.values.length > 0 ? i.values[0] : "";
36
+ case "number":
37
+ return 0;
38
+ case "range":
39
+ return i.min;
40
+ case "switch":
41
+ default:
42
+ return false;
43
+ }
21
44
  }
22
45
  }
23
46
  const getObjectDefaults = (info) => {
24
47
  const ret = {};
25
- for (const i of info.values) {
26
- ret[i.name] = getDefault(i);
48
+ const values = info instanceof Array ? info[2] : info.values;
49
+ for (const v of values) {
50
+ if (v instanceof Array) {
51
+ ret[v[0]] = getDefault(v);
52
+ }
53
+ else {
54
+ ret[v.name] = getDefault(v);
55
+ }
27
56
  }
28
57
  return ret;
29
58
  };
30
- const getTupleDefaults = (i) => {
59
+ const getTupleDefaults = (info) => {
31
60
  const ret = [];
32
- for (const info of i.values) {
33
- ret.push(getDefault(info));
34
- }
61
+ const values = info instanceof Array ? info[2] : info.values;
62
+ values.forEach((v, i) => {
63
+ if (v instanceof Array) {
64
+ ret.push(getDefault([`${i}`, ...v]));
65
+ }
66
+ else {
67
+ ret.push(getDefault({ name: `${i}`, ...v }));
68
+ }
69
+ });
35
70
  return ret;
36
71
  };
@@ -1,62 +1,55 @@
1
- export type PropTuple = {
2
- name: string;
3
- type: "tuple";
4
- // eslint-disable-next-line no-use-before-define
5
- values: NonNamedProp[];
6
- };
7
-
8
- export type PropObject = {
9
- name: string;
10
- type: "object";
11
- // eslint-disable-next-line no-use-before-define
12
- values: Prop[];
13
- };
14
-
15
- export type PropText = {
16
- name: string;
17
- type: "text";
18
- };
19
-
20
- export type PropNumber = {
21
- name: string;
22
- type: "number";
23
- };
24
-
25
- export type PropRange = {
26
- name: string;
27
- type: "range";
28
- min: number;
29
- max: number;
30
- step: number;
31
- };
32
-
33
- export type PropSelect = {
34
- name: string;
35
- type: "select";
36
- values: string[];
37
- };
38
-
39
- export type PropSwitch = {
40
- name: string;
41
- type: "switch";
42
- };
1
+ // eslint-disable-next-line no-use-before-define
2
+ export type FlatPropTuple = ["tuple", NonNamedProp[]];
3
+ // eslint-disable-next-line no-use-before-define
4
+ export type FlatPropObject = ["object", Prop[]];
5
+ export type FlatPropText = ["text"];
6
+ export type FlatPropNumber = ["number"];
7
+ export type FlatPropRange = ["range", number, number, number];
8
+ export type FlatPropSelect = ["select", string[]];
9
+ export type FlatPropSwitch = ["switch"];
10
+
11
+ // eslint-disable-next-line no-use-before-define
12
+ export type PropTuple = { type: "tuple" } & { values: NonNamedProp[] };
13
+ // eslint-disable-next-line no-use-before-define
14
+ export type PropObject = { type: "object" } & { values: Prop[] };
15
+ export type PropText = { type: "text" };
16
+ export type PropNumber = { type: "number" };
17
+ export type PropSwitch = { type: "switch" };
18
+ export type PropSelect = { type: "select" } & { values: string[] };
19
+ export type PropRange = { type: "range" } & { min: number; max: number; step: number };
20
+
21
+ export type Name = { name: string };
43
22
 
44
23
  export type Prop =
24
+ | (Name & PropTuple)
25
+ | (Name & PropObject)
26
+ | (Name & PropText)
27
+ | (Name & PropNumber)
28
+ | (Name & PropSwitch)
29
+ | (Name & PropSelect)
30
+ | (Name & PropRange)
31
+ | [string, ...FlatPropTuple]
32
+ | [string, ...FlatPropObject]
33
+ | [string, ...FlatPropText]
34
+ | [string, ...FlatPropNumber]
35
+ | [string, ...FlatPropSwitch]
36
+ | [string, ...FlatPropSelect]
37
+ | [string, ...FlatPropRange];
38
+
39
+ type NonNamedProp =
45
40
  | PropTuple
46
41
  | PropObject
47
42
  | PropText
48
43
  | PropNumber
49
44
  | PropRange
50
45
  | PropSelect
51
- | PropSwitch;
52
-
53
- type NonNamedProp =
54
- | Omit<PropTuple, "name">
55
- | Omit<PropObject, "name">
56
- | Omit<PropText, "name">
57
- | Omit<PropNumber, "name">
58
- | Omit<PropRange, "name">
59
- | Omit<PropSelect, "name">
60
- | Omit<PropSwitch, "name">;
46
+ | PropSwitch
47
+ | FlatPropTuple
48
+ | FlatPropObject
49
+ | FlatPropText
50
+ | FlatPropNumber
51
+ | FlatPropRange
52
+ | FlatPropSelect
53
+ | FlatPropSwitch;
61
54
 
62
55
  export type Event = string;
@@ -76,18 +76,22 @@
76
76
  background-color: var(--color-p);
77
77
  }
78
78
 
79
+ .container:not(.b):not(.vertical) > .divider:hover,
79
80
  .container.moving:not(.b):not(.vertical) > .divider {
80
81
  border-bottom: var(--color-s) solid 2.5px;
81
82
  }
82
83
 
84
+ .container.b:not(.vertical) > .divider:hover,
83
85
  .container.moving.b:not(.vertical) > .divider {
84
86
  border-top: var(--color-s) solid 2.5px;
85
87
  }
86
88
 
89
+ .container:not(.b).vertical > .divider:hover,
87
90
  .container.moving:not(.b).vertical > .divider {
88
91
  border-right: var(--color-s) solid 2.5px;
89
92
  }
90
93
 
94
+ .container.vertical.b > .divider:hover,
91
95
  .container.moving.vertical.b > .divider {
92
96
  border-left: var(--color-s) solid 2.5px;
93
97
  }
@@ -8,5 +8,5 @@ export type States = {
8
8
  sub: Record<string, States>;
9
9
  };
10
10
 
11
- export type Sorter = (l: string, r: string) => 1 | 0 | -1;
11
+ export type Sorter = (l: string, r: string) => -1 | 0 | 1;
12
12
  export type Renamer = (s: string) => string;
@@ -1,9 +1,5 @@
1
- import type { Renamer } from "../types";
2
1
  /**
3
2
  * If a text follows `<I>-<Name>` format,
4
3
  * this method simply removes the Prefix.
5
- *
6
- * @param text
7
- * @returns `<Name>`
8
4
  */
9
- export declare const renamer: Renamer;
5
+ export declare const renamer: (text: string) => string;
@@ -2,14 +2,11 @@ const match = /(\d+)-(.+)/;
2
2
  /**
3
3
  * If a text follows `<I>-<Name>` format,
4
4
  * this method simply removes the Prefix.
5
- *
6
- * @param text
7
- * @returns `<Name>`
8
5
  */
9
- export const renamer = (text) => {
6
+ export const renamer = ((text) => {
10
7
  const m = match.exec(text);
11
8
  if (m) {
12
9
  return m[2];
13
10
  }
14
11
  return text;
15
- };
12
+ });
@@ -1,4 +1,3 @@
1
- import type { Sorter } from "../types";
2
1
  /**
3
2
  * Compares two texts for sorting.
4
3
  *
@@ -9,9 +8,5 @@ import type { Sorter } from "../types";
9
8
  * the text that follows the format is considered as higher in order.
10
9
  *
11
10
  * Else comparison is done using built-in `string` comparison.
12
- *
13
- * @param l - left operand
14
- * @param r - right operand
15
- * @returns `-1 | 0 | +1`
16
11
  */
17
- export declare const sorter: Sorter;
12
+ export declare const sorter: (l: string, r: string) => -1 | 0 | 1;
@@ -18,12 +18,8 @@ const sorterT = (l, r) => {
18
18
  * the text that follows the format is considered as higher in order.
19
19
  *
20
20
  * Else comparison is done using built-in `string` comparison.
21
- *
22
- * @param l - left operand
23
- * @param r - right operand
24
- * @returns `-1 | 0 | +1`
25
21
  */
26
- export const sorter = (l, r) => {
22
+ export const sorter = ((l, r) => {
27
23
  const lmatch = match.exec(l);
28
24
  const rmatch = match.exec(r);
29
25
  if (null == lmatch && null == rmatch) {
@@ -36,4 +32,4 @@ export const sorter = (l, r) => {
36
32
  return -1;
37
33
  }
38
34
  return sorterT(parseInt(lmatch[1]), parseInt(rmatch[1])) || sorterT(lmatch[2], rmatch[2]);
39
- };
35
+ });
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.46",
3
+ "version": "0.2.47",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"
7
7
  },
8
8
  "license": "ISC",
9
9
  "devDependencies": {
10
- "@sveltejs/adapter-vercel": "^1.0.0",
11
- "@sveltejs/kit": "^1.0.5",
10
+ "@sveltejs/adapter-vercel": "^1.0.5",
11
+ "@sveltejs/kit": "^1.3.2",
12
12
  "@sveltejs/package": "^1.0.2",
13
13
  "@vitest/coverage-c8": "^0.26.3",
14
14
  "mdsvex": "^0.10.6",
15
15
  "remark-admonitions": "^1.2.1",
16
16
  "svelte-check": "^2.10.3",
17
- "tslib": "^2.4.1",
17
+ "tslib": "^2.5.0",
18
18
  "typescript": "^4.9.4",
19
19
  "vite": "^4.0.4",
20
20
  "vitest": "^0.26.3"
21
21
  },
22
22
  "peerDependencies": {
23
- "svelte": "^3.55.0"
23
+ "svelte": "^3.55.1"
24
24
  },
25
25
  "publishConfig": {
26
26
  "linkDirectory": true