@nil-/doc 1.0.0 → 2.0.1

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 (84) hide show
  1. package/components/Base.svelte +6 -3
  2. package/components/Base.svelte.d.ts +8 -18
  3. package/components/block/Block.svelte +5 -3
  4. package/components/block/Block.svelte.d.ts +6 -15
  5. package/components/block/Controls.svelte +6 -5
  6. package/components/block/Controls.svelte.d.ts +7 -17
  7. package/components/block/Instance.svelte +48 -33
  8. package/components/block/Instance.svelte.d.ts +22 -19
  9. package/components/block/Params.svelte +22 -12
  10. package/components/block/Params.svelte.d.ts +6 -16
  11. package/components/block/Template.svelte +32 -15
  12. package/components/block/Template.svelte.d.ts +21 -18
  13. package/components/block/controls/Controls.svelte +15 -10
  14. package/components/block/controls/Controls.svelte.d.ts +6 -16
  15. package/components/block/controls/Styler.svelte +5 -2
  16. package/components/block/controls/Styler.svelte.d.ts +7 -17
  17. package/components/block/controls/events/Events.svelte +4 -2
  18. package/components/block/controls/events/Events.svelte.d.ts +10 -20
  19. package/components/block/controls/props/Button.svelte +7 -6
  20. package/components/block/controls/props/Button.svelte.d.ts +6 -16
  21. package/components/block/controls/props/Color.svelte +15 -12
  22. package/components/block/controls/props/Color.svelte.d.ts +9 -19
  23. package/components/block/controls/props/Component.svelte +13 -11
  24. package/components/block/controls/props/Component.svelte.d.ts +9 -19
  25. package/components/block/controls/props/Number.svelte +14 -10
  26. package/components/block/controls/props/Number.svelte.d.ts +9 -19
  27. package/components/block/controls/props/Props.svelte +12 -5
  28. package/components/block/controls/props/Props.svelte.d.ts +9 -18
  29. package/components/block/controls/props/Range.svelte +23 -20
  30. package/components/block/controls/props/Range.svelte.d.ts +9 -19
  31. package/components/block/controls/props/Select.svelte +14 -10
  32. package/components/block/controls/props/Select.svelte.d.ts +9 -19
  33. package/components/block/controls/props/{Object.svelte → Table.svelte} +15 -11
  34. package/components/block/controls/props/Table.svelte.d.ts +12 -0
  35. package/components/block/controls/props/Text.svelte +14 -10
  36. package/components/block/controls/props/Text.svelte.d.ts +9 -19
  37. package/components/block/controls/props/Toggle.svelte +14 -10
  38. package/components/block/controls/props/Toggle.svelte.d.ts +10 -19
  39. package/components/block/controls/props/Tuple.svelte +15 -11
  40. package/components/block/controls/props/Tuple.svelte.d.ts +9 -19
  41. package/components/block/controls/props/misc/GroupHeader.svelte +12 -11
  42. package/components/block/controls/props/misc/GroupHeader.svelte.d.ts +10 -20
  43. package/components/block/controls/props/misc/Name.svelte +5 -3
  44. package/components/block/controls/props/misc/Name.svelte.d.ts +7 -17
  45. package/components/block/controls/props/misc/Toggle.svelte +10 -6
  46. package/components/block/controls/props/misc/Toggle.svelte.d.ts +7 -18
  47. package/components/block/controls/props/misc/defaulter.d.ts +1 -1
  48. package/components/block/controls/props/misc/defaulter.js +1 -1
  49. package/components/block/controls/props/misc/utils.d.ts +3 -3
  50. package/components/block/controls/types.d.ts +6 -6
  51. package/components/block/icons/Button.svelte +9 -5
  52. package/components/block/icons/Button.svelte.d.ts +10 -34
  53. package/components/block/icons/ControlView.svelte +3 -1
  54. package/components/block/icons/ControlView.svelte.d.ts +5 -15
  55. package/components/block/icons/Position.svelte +8 -6
  56. package/components/block/icons/Position.svelte.d.ts +5 -15
  57. package/components/layout/Container.svelte +28 -25
  58. package/components/layout/Container.svelte.d.ts +11 -21
  59. package/components/layout/Content.svelte +4 -1
  60. package/components/layout/Content.svelte.d.ts +6 -26
  61. package/components/layout/DocLayout.svelte +15 -21
  62. package/components/layout/DocLayout.svelte.d.ts +11 -25
  63. package/components/layout/Layout.svelte +42 -32
  64. package/components/layout/Layout.svelte.d.ts +18 -27
  65. package/components/layout/Scrollable.svelte +4 -1
  66. package/components/layout/Scrollable.svelte.d.ts +6 -26
  67. package/components/layout/ThemeToggle.svelte +5 -3
  68. package/components/layout/ThemeToggle.svelte.d.ts +5 -15
  69. package/components/layout/VerticalPanel.svelte +4 -1
  70. package/components/layout/VerticalPanel.svelte.d.ts +6 -26
  71. package/components/layout/icons/Icon.svelte +8 -3
  72. package/components/layout/icons/Icon.svelte.d.ts +9 -20
  73. package/components/layout/icons/Nil.svelte +16 -13
  74. package/components/layout/icons/Nil.svelte.d.ts +3 -14
  75. package/components/layout/icons/Theme.svelte +2 -2
  76. package/components/layout/icons/Theme.svelte.d.ts +5 -15
  77. package/components/navigation/Nav.svelte +14 -12
  78. package/components/navigation/Nav.svelte.d.ts +11 -20
  79. package/components/navigation/Node.svelte +22 -22
  80. package/components/navigation/Node.svelte.d.ts +16 -24
  81. package/components/navigation/Tree.svelte +11 -8
  82. package/components/navigation/Tree.svelte.d.ts +13 -22
  83. package/package.json +3 -3
  84. package/components/block/controls/props/Object.svelte.d.ts +0 -22
@@ -1,16 +1,20 @@
1
- <script>import { getName } from "./misc/utils";
1
+ <script lang="ts">import { getName } from "./misc/utils";
2
2
  import { defaulter } from "./misc/defaulter";
3
3
  import NameHeader from "./misc/Name.svelte";
4
4
  import Toggle from "./misc/Toggle.svelte";
5
- export let value;
6
- export let info;
7
- export let depth;
8
- export let disabled = false;
9
- export let visible = false;
10
- let ivalue = value ?? defaulter(info);
11
- let enabled = value !== void 0;
12
- $:
13
- value = enabled && !disabled ? ivalue : void 0;
5
+ let {
6
+ value = $bindable(),
7
+ info,
8
+ depth,
9
+ disabled = false,
10
+ visible = false
11
+ } = $props();
12
+ let ivalue = $state(value ?? defaulter(info));
13
+ let enabled = $state(value !== void 0);
14
+ const set_value = (v) => {
15
+ value = v;
16
+ };
17
+ $effect(() => set_value(enabled && !disabled ? ivalue : void 0));
14
18
  </script>
15
19
 
16
20
  {#if visible}
@@ -1,21 +1,12 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import Toggle from "./misc/Toggle.svelte";
2
2
  import type { Unionized, PropType } from "../types";
3
- declare const __propDef: {
4
- props: {
5
- value: boolean | undefined;
6
- info: Unionized<PropType<"toggle">>;
7
- depth: number;
8
- disabled?: boolean | undefined;
9
- visible?: boolean | undefined;
10
- };
11
- events: {
12
- [evt: string]: CustomEvent<any>;
13
- };
14
- slots: {};
3
+ type $$ComponentProps = {
4
+ value: boolean | undefined;
5
+ info: Unionized<PropType<"toggle">>;
6
+ depth: number;
7
+ disabled?: boolean;
8
+ visible?: boolean;
15
9
  };
16
- export type ToggleProps = typeof __propDef.props;
17
- export type ToggleEvents = typeof __propDef.events;
18
- export type ToggleSlots = typeof __propDef.slots;
19
- export default class Toggle extends SvelteComponentTyped<ToggleProps, ToggleEvents, ToggleSlots> {
20
- }
21
- export {};
10
+ declare const Toggle: import("svelte").Component<$$ComponentProps, {}, "value">;
11
+ type Toggle = ReturnType<typeof Toggle>;
12
+ export default Toggle;
@@ -1,17 +1,21 @@
1
- <script>import Component from "./Component.svelte";
1
+ <script lang="ts">import Component from "./Component.svelte";
2
2
  import Header from "./misc/GroupHeader.svelte";
3
3
  import { defaulter } from "./misc/defaulter";
4
4
  import { getValues, getName, addName } from "./misc/utils";
5
- export let value;
6
- export let info;
7
- export let depth;
8
- export let disabled = false;
9
- export let visible = false;
10
- const ivalue = value ?? defaulter(info);
11
- let enabled = value !== void 0;
12
- let expand = getValues(info).length > 0 ? true : void 0;
13
- $:
14
- value = !disabled && enabled ? ivalue : void 0;
5
+ let {
6
+ value = $bindable(),
7
+ info,
8
+ depth,
9
+ disabled = false,
10
+ visible = false
11
+ } = $props();
12
+ let ivalue = $state(value ?? defaulter(info));
13
+ let enabled = $state(value !== void 0);
14
+ let expand = $state(getValues(info).length > 0 ? true : void 0);
15
+ const set_value = (v) => {
16
+ value = v;
17
+ };
18
+ $effect(() => set_value(enabled && !disabled ? ivalue : void 0));
15
19
  </script>
16
20
 
17
21
  <Header name={getName(info)} bind:expand bind:checked={enabled} {depth} {disabled} {visible} />
@@ -1,22 +1,12 @@
1
- import { SvelteComponentTyped } from "svelte";
2
1
  import type { ValueType } from "../../types";
3
2
  import type { Unionized, PropType } from "../types";
4
- declare const __propDef: {
5
- props: {
6
- value: ValueType[] | undefined;
7
- info: Unionized<PropType<"tuple">>;
8
- depth: number;
9
- disabled?: boolean | undefined;
10
- visible?: boolean | undefined;
11
- };
12
- events: {
13
- [evt: string]: CustomEvent<any>;
14
- };
15
- slots: {};
3
+ type $$ComponentProps = {
4
+ value: ValueType[] | undefined;
5
+ info: Unionized<PropType<"tuple">>;
6
+ depth: number;
7
+ disabled?: boolean;
8
+ visible?: boolean;
16
9
  };
17
- export type TupleProps = typeof __propDef.props;
18
- export type TupleEvents = typeof __propDef.events;
19
- export type TupleSlots = typeof __propDef.slots;
20
- export default class Tuple extends SvelteComponentTyped<TupleProps, TupleEvents, TupleSlots> {
21
- }
22
- export {};
10
+ declare const Tuple: import("svelte").Component<$$ComponentProps, {}, "value">;
11
+ type Tuple = ReturnType<typeof Tuple>;
12
+ export default Tuple;
@@ -1,22 +1,22 @@
1
- <script>import Name from "./Name.svelte";
1
+ <script lang="ts">import Name from "./Name.svelte";
2
2
  import Toggle from "./Toggle.svelte";
3
- export let name;
4
- export let depth;
5
- export let checked;
6
- export let disabled = false;
7
- export let expand = void 0;
8
- export let visible = false;
3
+ let {
4
+ name,
5
+ depth,
6
+ checked = $bindable(),
7
+ disabled = false,
8
+ expand = $bindable(false),
9
+ visible = false
10
+ } = $props();
9
11
  const flip = () => {
10
12
  if (!disabled && checked) {
11
- if (expand !== void 0) {
12
- expand = !expand;
13
- }
13
+ expand = !expand;
14
14
  }
15
15
  };
16
16
  </script>
17
17
 
18
18
  {#if visible}
19
- <div on:click={flip} on:keypress={null} role="none">
19
+ <div onclick={flip} onkeypress={null} role="none">
20
20
  <Name
21
21
  expand={expand === undefined ? undefined : expand && checked && !disabled}
22
22
  {name}
@@ -32,3 +32,4 @@ const flip = () => {
32
32
  color: hsl(0, 0%, 50%);
33
33
  }
34
34
  </style>
35
+
@@ -1,21 +1,11 @@
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
- expand?: boolean | undefined;
9
- visible?: boolean | undefined;
10
- };
11
- events: {
12
- [evt: string]: CustomEvent<any>;
13
- };
14
- slots: {};
1
+ type $$ComponentProps = {
2
+ name: string;
3
+ depth: number;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ expand?: boolean;
7
+ visible?: boolean;
15
8
  };
16
- export type GroupHeaderProps = typeof __propDef.props;
17
- export type GroupHeaderEvents = typeof __propDef.events;
18
- export type GroupHeaderSlots = typeof __propDef.slots;
19
- export default class GroupHeader extends SvelteComponentTyped<GroupHeaderProps, GroupHeaderEvents, GroupHeaderSlots> {
20
- }
21
- export {};
9
+ declare const GroupHeader: import("svelte").Component<$$ComponentProps, {}, "expand" | "checked">;
10
+ type GroupHeader = ReturnType<typeof GroupHeader>;
11
+ export default GroupHeader;
@@ -1,6 +1,8 @@
1
- <script>export let depth;
2
- export let name;
3
- export let expand = void 0;
1
+ <script lang="ts">let {
2
+ depth,
3
+ name,
4
+ expand
5
+ } = $props();
4
6
  </script>
5
7
 
6
8
  <div class="override" style:padding-left={`${depth}rem`} title={name}>
@@ -1,18 +1,8 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- depth: number;
5
- name: string;
6
- expand?: boolean | undefined;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
1
+ type $$ComponentProps = {
2
+ depth: number;
3
+ name: string;
4
+ expand?: boolean;
12
5
  };
13
- export type NameProps = typeof __propDef.props;
14
- export type NameEvents = typeof __propDef.events;
15
- export type NameSlots = typeof __propDef.slots;
16
- export default class Name extends SvelteComponentTyped<NameProps, NameEvents, NameSlots> {
17
- }
18
- export {};
6
+ declare const Name: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type Name = ReturnType<typeof Name>;
8
+ export default Name;
@@ -1,7 +1,11 @@
1
- <script>import { getTheme } from "../../../../context";
2
- export let disabled = false;
3
- export let toggled = false;
4
- const click = () => {
1
+ <script lang="ts">import { getTheme } from "../../../../context";
2
+ let {
3
+ disabled = false,
4
+ toggled = $bindable(false),
5
+ onkeypress
6
+ } = $props();
7
+ const onclick = (e) => {
8
+ e.stopPropagation();
5
9
  if (!disabled) {
6
10
  toggled = !toggled;
7
11
  }
@@ -12,8 +16,8 @@ const dark = getTheme();
12
16
  <div>
13
17
  <svg
14
18
  viewBox="-30 -30 60 60"
15
- on:click|stopPropagation={click}
16
- on:keypress
19
+ {onclick}
20
+ {onkeypress}
17
21
  role="none"
18
22
  class:disabled
19
23
  class:dark={$dark}
@@ -1,19 +1,8 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- disabled?: boolean | undefined;
5
- toggled?: boolean | undefined;
6
- };
7
- events: {
8
- keypress: KeyboardEvent;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
1
+ type $$ComponentProps = {
2
+ disabled?: boolean;
3
+ toggled?: boolean;
4
+ onkeypress?: (e: KeyboardEvent) => void;
13
5
  };
14
- export type ToggleProps = typeof __propDef.props;
15
- export type ToggleEvents = typeof __propDef.events;
16
- export type ToggleSlots = typeof __propDef.slots;
17
- export default class Toggle extends SvelteComponentTyped<ToggleProps, ToggleEvents, ToggleSlots> {
18
- }
19
- export {};
6
+ declare const Toggle: import("svelte").Component<$$ComponentProps, {}, "toggled">;
7
+ type Toggle = ReturnType<typeof Toggle>;
8
+ export default Toggle;
@@ -1,7 +1,7 @@
1
1
  import type { ValueType } from "../../../types";
2
2
  import type { Unionized, PropType, Prop } from "../../types";
3
3
  export declare function defaulter(i: Unionized<PropType<"tuple">>): ValueType[];
4
- export declare function defaulter(i: Unionized<PropType<"object">>): Record<string, ValueType>;
4
+ export declare function defaulter(i: Unionized<PropType<"table">>): Record<string, ValueType>;
5
5
  export declare function defaulter(i: Unionized<PropType<"number">>): number;
6
6
  export declare function defaulter(i: Unionized<PropType<"range">>): number;
7
7
  export declare function defaulter(i: Unionized<PropType<"select">>): string;
@@ -2,7 +2,7 @@ import { getType, getValues, getMin } from "./utils";
2
2
  // eslint-disable-next-line func-style
3
3
  export function defaulter(i) {
4
4
  switch (getType(i)) {
5
- case "object":
5
+ case "table":
6
6
  // eslint-disable-next-line no-use-before-define
7
7
  return defaulterO(i);
8
8
  case "tuple":
@@ -1,11 +1,11 @@
1
1
  import type { Detailed, Unionized, PropType, Prop, NonNamedProp, SpecialProp } from "../../types";
2
- type TypesWithValue = "object" | "tuple" | "select";
2
+ type TypesWithValue = "table" | "tuple" | "select";
3
3
  type Values<T extends TypesWithValue> = Detailed<PropType<T>>["values"];
4
4
  export declare function getValues(info: Unionized<PropType<"select">>): Values<"select">;
5
- export declare function getValues(info: Unionized<PropType<"object">>): Values<"object">;
5
+ export declare function getValues(info: Unionized<PropType<"table">>): Values<"table">;
6
6
  export declare function getValues(info: Unionized<PropType<"tuple">>): Values<"tuple">;
7
7
  export declare const getMin: (info: Unionized<PropType<"range">>) => number;
8
- export declare const getType: (info: Prop | SpecialProp) => "number" | "object" | "select" | "toggle" | "button" | "tuple" | "text" | "color" | "range";
8
+ export declare const getType: (info: Prop | SpecialProp) => "number" | "select" | "toggle" | "button" | "table" | "tuple" | "text" | "color" | "range";
9
9
  export declare const getFormat: (info: Unionized<PropType<"color">>) => import("../../types").ColorFormat;
10
10
  export declare const getName: (info: Prop | SpecialProp) => string;
11
11
  export declare const getClick: (info: SpecialProp) => () => () => void;
@@ -6,7 +6,7 @@ type Types =
6
6
  | "range"
7
7
  | "toggle"
8
8
  | "tuple"
9
- | "object"
9
+ | "table"
10
10
  | "button";
11
11
  type ColorFormat = "hsl" | "hsla" | "rgb" | "rgba" | "hex" | "hexa";
12
12
 
@@ -42,7 +42,7 @@ export type PropType<T extends Types> =
42
42
  // eslint-disable-next-line no-use-before-define
43
43
  { name: string; type: T; values: NonNamedProp[]; }
44
44
  ]
45
- : T extends "object" ? [
45
+ : T extends "table" ? [
46
46
  // eslint-disable-next-line no-use-before-define
47
47
  [ name: string, type: T, values: Prop[] ],
48
48
  // eslint-disable-next-line no-use-before-define
@@ -76,8 +76,8 @@ export type Prop =
76
76
  | [ name: string, type: "tuple", values: NonNamedProp[] ]
77
77
  // eslint-disable-next-line no-use-before-define
78
78
  | { name: string; type: "tuple"; values: NonNamedProp[]; }
79
- | [ name: string, type: "object", values: Prop[] ]
80
- | { name: string; type: "object"; values: Prop[]; };
79
+ | [ name: string, type: "table", values: Prop[] ]
80
+ | { name: string; type: "table"; values: Prop[]; };
81
81
 
82
82
  export type SpecialProp =
83
83
  | [name: string, type: "button", click: () => () => void]
@@ -99,7 +99,7 @@ export type NonNamedProp =
99
99
  | { type: "range"; min: number; max: number; step: number; }
100
100
  | [ type: "tuple", values: NonNamedProp[] ]
101
101
  | { type: "tuple"; values: NonNamedProp[]; }
102
- | [ type: "object", values: Prop[] ]
103
- | { type: "object"; values: Prop[]; };
102
+ | [ type: "table", values: Prop[] ]
103
+ | { type: "table"; values: Prop[]; };
104
104
 
105
105
  export type Event = string;
@@ -1,10 +1,14 @@
1
- <script>
2
- export let title = "";
3
- export let scale = false;
1
+ <script lang="ts">let {
2
+ title = "",
3
+ scale = false,
4
+ onclick,
5
+ onkeypress,
6
+ children
7
+ } = $props();
4
8
  </script>
5
9
 
6
- <div on:click on:keypress role="none" {title} class:scale>
7
- <slot />
10
+ <div onclick={onclick} onkeypress={onkeypress} role="none" {title} class:scale>
11
+ {@render children?.()}
8
12
  </div>
9
13
 
10
14
  <style>
@@ -1,35 +1,11 @@
1
- /** @typedef {typeof __propDef.props} ButtonProps */
2
- /** @typedef {typeof __propDef.events} ButtonEvents */
3
- /** @typedef {typeof __propDef.slots} ButtonSlots */
4
- export default class Button extends SvelteComponentTyped<{
5
- title?: string | undefined;
6
- scale?: boolean | undefined;
7
- }, {
8
- click: MouseEvent;
9
- keypress: KeyboardEvent;
10
- } & {
11
- [evt: string]: CustomEvent<any>;
12
- }, {
13
- default: {};
14
- }> {
15
- }
16
- export type ButtonProps = typeof __propDef.props;
17
- export type ButtonEvents = typeof __propDef.events;
18
- export type ButtonSlots = typeof __propDef.slots;
19
- import { SvelteComponentTyped } from "svelte";
20
- declare const __propDef: {
21
- props: {
22
- title?: string | undefined;
23
- scale?: boolean | undefined;
24
- };
25
- events: {
26
- click: MouseEvent;
27
- keypress: KeyboardEvent;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- };
31
- slots: {
32
- default: {};
33
- };
1
+ import type { Snippet } from "svelte";
2
+ type $$ComponentProps = {
3
+ title?: string;
4
+ scale?: boolean;
5
+ onclick?: (e: MouseEvent) => void;
6
+ onkeypress?: (e: KeyboardEvent) => void;
7
+ children?: Snippet;
34
8
  };
35
- export {};
9
+ declare const Button: import("svelte").Component<$$ComponentProps, {}, "">;
10
+ type Button = ReturnType<typeof Button>;
11
+ export default Button;
@@ -1,4 +1,6 @@
1
- <script>export let mode = "props";
1
+ <script lang="ts">let {
2
+ mode = "props"
3
+ } = $props();
2
4
  </script>
3
5
 
4
6
  <svg viewBox="-50 -50 100 100">
@@ -1,16 +1,6 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- mode?: "props" | "events" | undefined;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {};
1
+ type $$ComponentProps = {
2
+ mode: "props" | "events";
10
3
  };
11
- export type ControlViewProps = typeof __propDef.props;
12
- export type ControlViewEvents = typeof __propDef.events;
13
- export type ControlViewSlots = typeof __propDef.slots;
14
- export default class ControlView extends SvelteComponentTyped<ControlViewProps, ControlViewEvents, ControlViewSlots> {
15
- }
16
- export {};
4
+ declare const ControlView: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type ControlView = ReturnType<typeof ControlView>;
6
+ export default ControlView;
@@ -1,8 +1,8 @@
1
- <script>export let position = "hidden";
2
- $:
3
- bottom = "bottom" === position;
4
- $:
5
- right = "right" === position;
1
+ <script lang="ts">let {
2
+ position = "hidden"
3
+ } = $props();
4
+ let bottom = $derived("bottom" === position);
5
+ let right = $derived("right" === position);
6
6
  </script>
7
7
 
8
8
  <svg viewBox="-50 -50 100 100">
@@ -24,7 +24,9 @@ $:
24
24
  }
25
25
 
26
26
  rect:nth-child(n + 2) {
27
- transition: height var(--i-nil-doc-transition-time), x var(--i-nil-doc-transition-time),
27
+ transition:
28
+ height var(--i-nil-doc-transition-time),
29
+ x var(--i-nil-doc-transition-time),
28
30
  y var(--i-nil-doc-transition-time);
29
31
  }
30
32
  </style>
@@ -1,16 +1,6 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- position?: "right" | "bottom" | "hidden" | undefined;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {};
1
+ type $$ComponentProps = {
2
+ position: "hidden" | "bottom" | "right";
10
3
  };
11
- export type PositionProps = typeof __propDef.props;
12
- export type PositionEvents = typeof __propDef.events;
13
- export type PositionSlots = typeof __propDef.slots;
14
- export default class Position extends SvelteComponentTyped<PositionProps, PositionEvents, PositionSlots> {
15
- }
16
- export {};
4
+ declare const Position: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type Position = ReturnType<typeof Position>;
6
+ export default Position;
@@ -1,30 +1,32 @@
1
- <script>import { writable } from "svelte/store";
2
- import { tweened } from "svelte/motion";
1
+ <script lang="ts">import { writable } from "svelte/store";
2
+ import { Tween } from "svelte/motion";
3
3
  import { createDraggable } from "./action";
4
- export let vertical = false;
5
- export let offset = 4;
6
- export let b = false;
7
- export let persistent = false;
8
- let width = null;
9
- let height = null;
4
+ let {
5
+ vertical = false,
6
+ offset = $bindable(4),
7
+ b = false,
8
+ persistent = false,
9
+ side_a,
10
+ side_b
11
+ } = $props();
12
+ let width = $state(null);
13
+ let height = $state(null);
10
14
  const { position, draggable } = createDraggable(offset);
11
- $:
12
- span = vertical ? width : height;
15
+ let span = $derived(vertical ? width : height);
13
16
  const update = (limit, value) => {
14
17
  if (null == span) {
15
18
  return;
16
19
  }
17
20
  offset = Math.max(Math.min(value, span - limit), limit);
18
21
  };
19
- const off = tweened(offset, { duration: 50 });
22
+ const off = new Tween(offset, { duration: 50 });
20
23
  const min = 4;
21
24
  let last = [];
22
- $:
23
- update(min, $position);
24
- $:
25
- $off = offset;
26
- $:
27
- style = !b ? `auto 0.2rem ${$off}px` : `${$off}px 0.2rem auto`;
25
+ $effect(() => update(min, $position));
26
+ $effect(() => {
27
+ off.set(offset);
28
+ });
29
+ let style = $derived(!b ? `auto 0.2rem ${off.current}px` : `${off.current}px 0.2rem auto`);
28
30
  const moving = writable(false);
29
31
  const addLast = (v) => {
30
32
  if (v > min) {
@@ -36,7 +38,7 @@ const addLast = (v) => {
36
38
  }
37
39
  };
38
40
  const dbltap = () => {
39
- if ($off > min) {
41
+ if (off.current > min) {
40
42
  addLast(offset);
41
43
  offset = min;
42
44
  } else if (last.length > 0) {
@@ -72,8 +74,8 @@ const title = (v, b2) => {
72
74
  >
73
75
  {#if width != null && height != null}
74
76
  <div style:grid-area="A">
75
- {#if persistent || check($off, !b, span ?? 0)}
76
- <slot name="A" />
77
+ {#if persistent || check(off.current, !b, span ?? 0)}
78
+ {@render side_a()}
77
79
  {/if}
78
80
  </div>
79
81
  <div class="divider">
@@ -85,14 +87,14 @@ const title = (v, b2) => {
85
87
  reversed: !b,
86
88
  vertical,
87
89
  dbltap: dbltap,
88
- tap: () => addLast($off),
90
+ tap: () => addLast(off.current),
89
91
  moving
90
92
  }}
91
- />
93
+ ></div>
92
94
  </div>
93
95
  <div style:grid-area="B">
94
- {#if persistent || check($off, b, span ?? 0)}
95
- <slot name="B" />
96
+ {#if persistent || check(off.current, b, span ?? 0)}
97
+ {@render side_b()}
96
98
  {/if}
97
99
  </div>
98
100
  {/if}
@@ -147,7 +149,8 @@ const title = (v, b2) => {
147
149
 
148
150
  /* colors */
149
151
  .divider {
150
- transition: border-color var(--i-nil-doc-transition-time),
152
+ transition:
153
+ border-color var(--i-nil-doc-transition-time),
151
154
  background-color var(--i-nil-doc-transition-time);
152
155
  --width: 0.0625rem;
153
156
  }