@nil-/doc 0.2.54 → 0.2.55

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 CHANGED
@@ -1,11 +1,22 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.55
4
+
5
+ ### Patch Changes
6
+
7
+ - [all][fix] separate eslint configuration ([#96](https://github.com/njaldea/mono/pull/96))
8
+
9
+ - [doc][docu] fix switch -> toggle ([#96](https://github.com/njaldea/mono/pull/96))
10
+
11
+ - [all][patch] update deps ([#96](https://github.com/njaldea/mono/pull/96))
12
+
13
+ - [doc][new] added special prop control "button" ([#96](https://github.com/njaldea/mono/pull/96))
14
+
3
15
  ## 0.2.54
4
16
 
5
17
  ### Patch Changes
6
18
 
7
19
  - [doc][fix] dynamic import of vanilla-picker to avoid ssr document access ([#94](https://github.com/njaldea/mono/pull/94))
8
-
9
20
  - [doc][patch] temporarily used svelte-toggle for checkbox/toggle ([#94](https://github.com/njaldea/mono/pull/94))
10
21
 
11
22
  ## 0.2.53
@@ -13,22 +24,18 @@
13
24
  ### Patch Changes
14
25
 
15
26
  - [doc][break] removed "scale" prop ([#92](https://github.com/njaldea/mono/pull/92))
16
- [doc][fix] better block scrollable handling
17
- [doc][fix] better style to vanilla-color popup
27
+ - [doc][fix] better block scrollable handling ([#92](https://github.com/njaldea/mono/pull/92))
28
+ - [doc][fix] better style to vanilla-color popup ([#92](https://github.com/njaldea/mono/pull/92))
18
29
 
19
30
  ## 0.2.52
20
31
 
21
32
  ### Patch Changes
22
33
 
23
34
  - [doc][fix] fix layout scrollable sections ([#90](https://github.com/njaldea/mono/pull/90))
24
-
25
35
  - [doc][patch] restructure code ([#90](https://github.com/njaldea/mono/pull/90))
26
-
27
36
  - [doc][patch] use vannilla-color library for color picker ([#90](https://github.com/njaldea/mono/pull/90))
28
- [doc][fix] removed position relative and overflow scroll for misc (controls)
29
-
37
+ - [doc][fix] removed position relative and overflow scroll for misc (controls) ([#90](https://github.com/njaldea/mono/pull/90))
30
38
  - [doc][fix] content fill width/height ([#90](https://github.com/njaldea/mono/pull/90))
31
-
32
39
  - [doc][new] added offset Layout.svelte and sveltekit for keeping state ([#90](https://github.com/njaldea/mono/pull/90))
33
40
 
34
41
  ## 0.2.51
@@ -36,21 +43,18 @@
36
43
  ### Patch Changes
37
44
 
38
45
  - [doc][fix] components now rely on root font-size ([#88](https://github.com/njaldea/mono/pull/88))
39
-
40
46
  - [doc][fix] fix object prop control ([#88](https://github.com/njaldea/mono/pull/88))
41
-
42
47
  - [doc][new] block button controls ([#88](https://github.com/njaldea/mono/pull/88))
43
- [doc][new] centralized custom css
44
-
48
+ - [doc][new] centralized custom css ([#88](https://github.com/njaldea/mono/pull/88))
45
49
  - [doc][misc] change styling ([#88](https://github.com/njaldea/mono/pull/88))
46
- [doc][fix] scrolling content of container
50
+ - [doc][fix] scrolling content of container ([#88](https://github.com/njaldea/mono/pull/88))
47
51
 
48
52
  ## 0.2.50
49
53
 
50
54
  ### Patch Changes
51
55
 
52
56
  - [doc][new] removed default nil icon ([#86](https://github.com/njaldea/mono/pull/86))
53
- [doc][new] allow override of theme icon
57
+ - [doc][new] allow override of theme icon ([#86](https://github.com/njaldea/mono/pull/86))
54
58
 
55
59
  ## 0.2.49
56
60
 
@@ -69,7 +73,6 @@
69
73
  ### Patch Changes
70
74
 
71
75
  - [doc][docu] minor adjustments to documentation ([#79](https://github.com/njaldea/mono/pull/79))
72
-
73
76
  - [doc][new] added support for flattened prop schema ([#79](https://github.com/njaldea/mono/pull/79))
74
77
 
75
78
  ## 0.2.46
@@ -95,7 +98,6 @@
95
98
  ### Patch Changes
96
99
 
97
100
  - [doc][fix] disable Range.svelte tooltip when disabled ([#70](https://github.com/njaldea/mono/pull/70))
98
-
99
101
  - [doc][new] added auto scroll when content of layout is only one component ([#70](https://github.com/njaldea/mono/pull/70))
100
102
 
101
103
  ## 0.2.42
@@ -115,13 +117,9 @@
115
117
  ### Patch Changes
116
118
 
117
119
  - [doc][new] added scale flag prop for Instance/Template componen ([#63](https://github.com/njaldea/mono/pull/63))
118
-
119
120
  - [doc][patch] fixed jsdoc link for public components ([#63](https://github.com/njaldea/mono/pull/63))
120
-
121
121
  - [doc][docu] moved Sorting and Renaming section to their own pages ([#63](https://github.com/njaldea/mono/pull/63))
122
-
123
122
  - [doc][new] added placeholder to search bar ([#63](https://github.com/njaldea/mono/pull/63))
124
-
125
123
  - [doc][docu] added admonitions plugin ([#63](https://github.com/njaldea/mono/pull/63))
126
124
 
127
125
  ## 0.2.39
@@ -129,13 +127,9 @@
129
127
  ### Patch Changes
130
128
 
131
129
  - [doc][fix] force state of navigation expand icon when filtering ([#61](https://github.com/njaldea/mono/pull/61))
132
-
133
130
  - [doc][patch] tighter eslint ([#61](https://github.com/njaldea/mono/pull/61))
134
-
135
131
  - [doc][patch] added tests for non-UI related code ([#61](https://github.com/njaldea/mono/pull/61))
136
-
137
132
  - [doc][patch] moved type definition ([#61](https://github.com/njaldea/mono/pull/61))
138
-
139
133
  - [doc][patch] enabled typescript eslint rules ([#61](https://github.com/njaldea/mono/pull/61))
140
134
 
141
135
  ## 0.2.38
@@ -199,7 +193,6 @@
199
193
  ### Patch Changes
200
194
 
201
195
  - [doc] Added color transition in Layout ([#43](https://github.com/njaldea/mono/pull/43))
202
-
203
196
  - [doc] added Instance component ([#43](https://github.com/njaldea/mono/pull/43))
204
197
 
205
198
  ## 0.2.29
@@ -207,7 +200,7 @@
207
200
  ### Patch Changes
208
201
 
209
202
  - [doc][feature] ThemeIcon ([#41](https://github.com/njaldea/mono/pull/41))
210
- [doc][feature] added top bar to separate title and other controls
203
+ - [doc][feature] added top bar to separate title and other controls ([#41](https://github.com/njaldea/mono/pull/41))
211
204
 
212
205
  ## 0.2.28
213
206
 
@@ -8,10 +8,8 @@ export let fill = false;
8
8
 
9
9
  <!-- prettier-ignore -->
10
10
  <style>
11
- @import url("https://fonts.googleapis.com/css?family=Fira%20Code");
12
-
13
11
  div {
14
- font-family: "Fira Code", "Courier New", Courier, monospace;
12
+ font-family: var(--nil-doc-font-family, ""), Verdana, Geneva, Tahoma, sans-serif;
15
13
  }
16
14
 
17
15
  .fill {
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Prop } from "./controls/types";
2
+ import type { SpecialProp, Prop } from "./controls/types";
3
3
  declare const __propDef: {
4
4
  props: {
5
- props?: Prop[] | undefined;
5
+ props?: (Prop | SpecialProp)[] | undefined;
6
6
  events?: string[] | undefined;
7
- position?: "bottom" | "right" | "hidden" | undefined;
7
+ position?: "right" | "bottom" | "hidden" | undefined;
8
8
  mode?: "prop" | "event" | undefined;
9
9
  };
10
10
  events: {
@@ -42,7 +42,7 @@ let handlers = {};
42
42
  visible={$controlsState.mode === "prop"}
43
43
  >
44
44
  <div>
45
- <div>Properties</div>
45
+ <div>Name</div>
46
46
  <div>Value</div>
47
47
  <div>Use</div>
48
48
  </div>
@@ -1,5 +1,5 @@
1
1
  import type { Writable } from "svelte/store";
2
- import type { Prop, Event } from "./controls/types";
2
+ import type { SpecialProp, Prop, Event } from "./controls/types";
3
3
  import type { ValueType } from "./types";
4
4
  export type Params = {
5
5
  id: number;
@@ -12,7 +12,7 @@ export type ControlState = {
12
12
  };
13
13
  export declare const initParams: () => Writable<Params[]>, getParams: () => Writable<Params[]>;
14
14
  type Controls = {
15
- props: Prop[];
15
+ props: (Prop | SpecialProp)[];
16
16
  events: Event[];
17
17
  };
18
18
  export declare const initControls: () => Writable<Controls>, getControls: () => Writable<Controls>;
@@ -0,0 +1,17 @@
1
+ <script>import { getClick, getName } from "./misc/utils";
2
+ export let info;
3
+ $:
4
+ click = getClick(info)();
5
+ </script>
6
+
7
+ <div>
8
+ <button on:click={click}>{getName(info)}</button>
9
+ </div>
10
+
11
+ <style>
12
+ button {
13
+ grid-column: 1 / 4;
14
+ box-sizing: border-box;
15
+ margin: 0.15rem 0.3rem;
16
+ }
17
+ </style>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Unionized, PropType } from "../types";
3
+ declare const __propDef: {
4
+ props: {
5
+ info: Unionized<PropType<"button">>;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type ButtonProps = typeof __propDef.props;
13
+ export type ButtonEvents = typeof __propDef.events;
14
+ export type ButtonSlots = typeof __propDef.slots;
15
+ export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
16
+ }
17
+ export {};
@@ -63,7 +63,7 @@ $:
63
63
  {ivalue}
64
64
  </button>
65
65
  {/await}
66
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
66
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
67
67
  </div>
68
68
  {/if}
69
69
 
@@ -31,6 +31,8 @@ export let visible = false;
31
31
  <Select {info} bind:value {depth} {disabled} {visible} />
32
32
  {:else if "toggle" === type}
33
33
  <Toggle {info} bind:value {depth} {disabled} {visible} />
34
+ {:else if "button" === type}
35
+ button
34
36
  {/if}
35
37
  {:else}
36
38
  {@const type = info.type}
@@ -50,5 +52,7 @@ export let visible = false;
50
52
  <Select {info} bind:value {depth} {disabled} {visible} />
51
53
  {:else if "toggle" === type}
52
54
  <Toggle {info} bind:value {depth} {disabled} {visible} />
55
+ {:else if "button" === type}
56
+ button
53
57
  {/if}
54
58
  {/if}
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { Prop } from "../types";
2
+ import type { SpecialProp, Prop } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: any;
6
- info: Prop;
6
+ info: Prop | SpecialProp;
7
7
  depth: number;
8
8
  disabled?: boolean | undefined;
9
9
  visible?: boolean | undefined;
@@ -17,6 +17,6 @@ $:
17
17
  <div>
18
18
  <NameHeader name={getName(info)} {depth} />
19
19
  <div><input type="number" bind:value={ivalue} disabled={!enabled || disabled} /></div>
20
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
20
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
21
21
  </div>
22
22
  {/if}
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { ValueType } from "../../types";
3
- import type { Prop } from "../types";
3
+ import type { SpecialProp, Prop } from "../types";
4
4
  declare const __propDef: {
5
5
  props: {
6
- infos: Prop[];
6
+ infos: (SpecialProp | Prop)[];
7
7
  values: Record<string, ValueType>;
8
8
  visible: boolean;
9
9
  };
@@ -42,7 +42,7 @@ $:
42
42
  disabled={!enabled || disabled}
43
43
  />
44
44
  </div>
45
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
45
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
46
46
  </div>
47
47
  {/if}
48
48
 
@@ -23,7 +23,7 @@ $:
23
23
  {/each}
24
24
  </select>
25
25
  </div>
26
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
26
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
27
27
  </div>
28
28
  {/if}
29
29
 
@@ -17,6 +17,6 @@ $:
17
17
  <div>
18
18
  <NameHeader name={getName(info)} {depth} />
19
19
  <div><input type="text" bind:value={ivalue} disabled={!enabled || disabled} /></div>
20
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
20
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
21
21
  </div>
22
22
  {/if}
@@ -16,7 +16,9 @@ $:
16
16
  {#if visible}
17
17
  <div>
18
18
  <NameHeader name={getName(info)} {depth} />
19
- <div style="margin: auto"><Toggle bind:toggled={ivalue} disabled={!enabled || disabled} hideLabel small/></div>
20
- <div><Toggle bind:toggled={enabled} {disabled} hideLabel small/></div>
19
+ <div style="margin: auto">
20
+ <Toggle bind:toggled={ivalue} disabled={!enabled || disabled} hideLabel small />
21
+ </div>
22
+ <div><Toggle bind:toggled={enabled} {disabled} hideLabel small /></div>
21
23
  </div>
22
24
  {/if}
@@ -23,7 +23,15 @@ const flip = () => {
23
23
  {depth}
24
24
  />
25
25
  <div class="value">-</div>
26
- <div><Toggle bind:toggled={checked} {disabled} hideLabel small on:click={e => e.stopPropagation()}/></div>
26
+ <div>
27
+ <Toggle
28
+ bind:toggled={checked}
29
+ {disabled}
30
+ hideLabel
31
+ small
32
+ on:click={(e) => e.stopPropagation()}
33
+ />
34
+ </div>
27
35
  </div>
28
36
  {/if}
29
37
 
@@ -18,7 +18,6 @@ export function defaulter(i) {
18
18
  return 0;
19
19
  case "range":
20
20
  return getMin(i);
21
- case "toggle":
22
21
  default:
23
22
  return false;
24
23
  }
@@ -1,12 +1,13 @@
1
- import type { Detailed, Unionized, PropType, Prop, NonNamedProp } from "../../types";
1
+ import type { Detailed, Unionized, PropType, Prop, NonNamedProp, SpecialProp } from "../../types";
2
2
  type TypesWithValue = "object" | "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
5
  export declare function getValues(info: Unionized<PropType<"object">>): Values<"object">;
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) => "number" | "object" | "select" | "toggle" | "text" | "range" | "tuple" | "color";
8
+ export declare const getType: (info: Prop | SpecialProp) => "number" | "object" | "select" | "toggle" | "button" | "text" | "range" | "tuple" | "color";
9
9
  export declare const getFormat: (info: Unionized<PropType<"color">>) => import("../../types").ColorFormat;
10
- export declare const getName: (info: Prop) => string;
10
+ export declare const getName: (info: Prop | SpecialProp) => string;
11
+ export declare const getClick: (info: SpecialProp) => () => () => void;
11
12
  export declare const addName: (name: string, info: NonNamedProp) => Prop;
12
13
  export {};
@@ -29,6 +29,12 @@ export const getName = (info) => {
29
29
  }
30
30
  return info.name;
31
31
  };
32
+ export const getClick = (info) => {
33
+ if (info instanceof Array) {
34
+ return info[2];
35
+ }
36
+ return info.click;
37
+ };
32
38
  export const addName = (name, info) => {
33
39
  if (info instanceof Array) {
34
40
  return [name, ...info];
@@ -1,5 +1,13 @@
1
- type Types = "text" | "color" | "number" | "select" | "range" | "toggle" | "tuple" | "object";
2
-
1
+ type Types =
2
+ | "text"
3
+ | "color"
4
+ | "number"
5
+ | "select"
6
+ | "range"
7
+ | "toggle"
8
+ | "tuple"
9
+ | "object"
10
+ | "button";
3
11
  type ColorFormat = "hsl" | "hsla" | "rgb" | "rgba" | "hex" | "hexa";
4
12
 
5
13
  // prettier-ignore
@@ -40,6 +48,10 @@ export type PropType<T extends Types> =
40
48
  // eslint-disable-next-line no-use-before-define
41
49
  { name: string; type: T; values: Prop[]; }
42
50
  ]
51
+ : T extends "button" ? [
52
+ [ name: string, type: "button", click: () => (() => void) ],
53
+ { name: string; type: "button"; click: () => (() => void); }
54
+ ]
43
55
  : never;
44
56
 
45
57
  export type Flattened<T extends PropType> = T[0];
@@ -67,6 +79,10 @@ export type Prop =
67
79
  | [ name: string, type: "object", values: Prop[] ]
68
80
  | { name: string; type: "object"; values: Prop[]; };
69
81
 
82
+ export type SpecialProp =
83
+ | [name: string, type: "button", click: () => () => void]
84
+ | { name: string; type: "button"; click: () => () => void };
85
+
70
86
  // prettier-ignore
71
87
  export type NonNamedProp =
72
88
  | [ type: "text" ]
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- position?: "bottom" | "right" | "hidden" | undefined;
4
+ position?: "right" | "bottom" | "hidden" | undefined;
5
5
  };
6
6
  events: {
7
7
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.54",
3
+ "version": "0.2.55",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"
@@ -8,7 +8,7 @@
8
8
  "license": "ISC",
9
9
  "devDependencies": {
10
10
  "@sveltejs/adapter-vercel": "^1.0.6",
11
- "@sveltejs/kit": "^1.5.5",
11
+ "@sveltejs/kit": "^1.8.8",
12
12
  "@sveltejs/package": "^1.0.2",
13
13
  "@vitest/coverage-c8": "^0.26.3",
14
14
  "mdsvex": "^0.10.6",
@@ -16,8 +16,13 @@
16
16
  "svelte-check": "^2.10.3",
17
17
  "tslib": "^2.5.0",
18
18
  "typescript": "^4.9.5",
19
- "vite": "^4.1.1",
20
- "vitest": "^0.26.3"
19
+ "vite": "^4.1.4",
20
+ "vitest": "^0.26.3",
21
+ "@typescript-eslint/eslint-plugin": "^5.54.0",
22
+ "@typescript-eslint/parser": "^5.54.0",
23
+ "eslint": "^8.35.0",
24
+ "eslint-config-prettier": "^8.6.0",
25
+ "eslint-plugin-svelte3": "^4.0.0"
21
26
  },
22
27
  "peerDependencies": {
23
28
  "svelte": "^3.55.1"