@nil-/doc 0.2.54 → 0.2.56

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,28 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.56
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][patch] use consolas as default font ([#98](https://github.com/njaldea/mono/pull/98))
8
+
9
+ ## 0.2.55
10
+
11
+ ### Patch Changes
12
+
13
+ - [all][fix] separate eslint configuration ([#96](https://github.com/njaldea/mono/pull/96))
14
+
15
+ - [doc][docu] fix switch -> toggle ([#96](https://github.com/njaldea/mono/pull/96))
16
+
17
+ - [all][patch] update deps ([#96](https://github.com/njaldea/mono/pull/96))
18
+
19
+ - [doc][new] added special prop control "button" ([#96](https://github.com/njaldea/mono/pull/96))
20
+
3
21
  ## 0.2.54
4
22
 
5
23
  ### Patch Changes
6
24
 
7
25
  - [doc][fix] dynamic import of vanilla-picker to avoid ssr document access ([#94](https://github.com/njaldea/mono/pull/94))
8
-
9
26
  - [doc][patch] temporarily used svelte-toggle for checkbox/toggle ([#94](https://github.com/njaldea/mono/pull/94))
10
27
 
11
28
  ## 0.2.53
@@ -13,22 +30,18 @@
13
30
  ### Patch Changes
14
31
 
15
32
  - [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
33
+ - [doc][fix] better block scrollable handling ([#92](https://github.com/njaldea/mono/pull/92))
34
+ - [doc][fix] better style to vanilla-color popup ([#92](https://github.com/njaldea/mono/pull/92))
18
35
 
19
36
  ## 0.2.52
20
37
 
21
38
  ### Patch Changes
22
39
 
23
40
  - [doc][fix] fix layout scrollable sections ([#90](https://github.com/njaldea/mono/pull/90))
24
-
25
41
  - [doc][patch] restructure code ([#90](https://github.com/njaldea/mono/pull/90))
26
-
27
42
  - [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
-
43
+ - [doc][fix] removed position relative and overflow scroll for misc (controls) ([#90](https://github.com/njaldea/mono/pull/90))
30
44
  - [doc][fix] content fill width/height ([#90](https://github.com/njaldea/mono/pull/90))
31
-
32
45
  - [doc][new] added offset Layout.svelte and sveltekit for keeping state ([#90](https://github.com/njaldea/mono/pull/90))
33
46
 
34
47
  ## 0.2.51
@@ -36,21 +49,18 @@
36
49
  ### Patch Changes
37
50
 
38
51
  - [doc][fix] components now rely on root font-size ([#88](https://github.com/njaldea/mono/pull/88))
39
-
40
52
  - [doc][fix] fix object prop control ([#88](https://github.com/njaldea/mono/pull/88))
41
-
42
53
  - [doc][new] block button controls ([#88](https://github.com/njaldea/mono/pull/88))
43
- [doc][new] centralized custom css
44
-
54
+ - [doc][new] centralized custom css ([#88](https://github.com/njaldea/mono/pull/88))
45
55
  - [doc][misc] change styling ([#88](https://github.com/njaldea/mono/pull/88))
46
- [doc][fix] scrolling content of container
56
+ - [doc][fix] scrolling content of container ([#88](https://github.com/njaldea/mono/pull/88))
47
57
 
48
58
  ## 0.2.50
49
59
 
50
60
  ### Patch Changes
51
61
 
52
62
  - [doc][new] removed default nil icon ([#86](https://github.com/njaldea/mono/pull/86))
53
- [doc][new] allow override of theme icon
63
+ - [doc][new] allow override of theme icon ([#86](https://github.com/njaldea/mono/pull/86))
54
64
 
55
65
  ## 0.2.49
56
66
 
@@ -69,7 +79,6 @@
69
79
  ### Patch Changes
70
80
 
71
81
  - [doc][docu] minor adjustments to documentation ([#79](https://github.com/njaldea/mono/pull/79))
72
-
73
82
  - [doc][new] added support for flattened prop schema ([#79](https://github.com/njaldea/mono/pull/79))
74
83
 
75
84
  ## 0.2.46
@@ -95,7 +104,6 @@
95
104
  ### Patch Changes
96
105
 
97
106
  - [doc][fix] disable Range.svelte tooltip when disabled ([#70](https://github.com/njaldea/mono/pull/70))
98
-
99
107
  - [doc][new] added auto scroll when content of layout is only one component ([#70](https://github.com/njaldea/mono/pull/70))
100
108
 
101
109
  ## 0.2.42
@@ -115,13 +123,9 @@
115
123
  ### Patch Changes
116
124
 
117
125
  - [doc][new] added scale flag prop for Instance/Template componen ([#63](https://github.com/njaldea/mono/pull/63))
118
-
119
126
  - [doc][patch] fixed jsdoc link for public components ([#63](https://github.com/njaldea/mono/pull/63))
120
-
121
127
  - [doc][docu] moved Sorting and Renaming section to their own pages ([#63](https://github.com/njaldea/mono/pull/63))
122
-
123
128
  - [doc][new] added placeholder to search bar ([#63](https://github.com/njaldea/mono/pull/63))
124
-
125
129
  - [doc][docu] added admonitions plugin ([#63](https://github.com/njaldea/mono/pull/63))
126
130
 
127
131
  ## 0.2.39
@@ -129,13 +133,9 @@
129
133
  ### Patch Changes
130
134
 
131
135
  - [doc][fix] force state of navigation expand icon when filtering ([#61](https://github.com/njaldea/mono/pull/61))
132
-
133
136
  - [doc][patch] tighter eslint ([#61](https://github.com/njaldea/mono/pull/61))
134
-
135
137
  - [doc][patch] added tests for non-UI related code ([#61](https://github.com/njaldea/mono/pull/61))
136
-
137
138
  - [doc][patch] moved type definition ([#61](https://github.com/njaldea/mono/pull/61))
138
-
139
139
  - [doc][patch] enabled typescript eslint rules ([#61](https://github.com/njaldea/mono/pull/61))
140
140
 
141
141
  ## 0.2.38
@@ -199,7 +199,6 @@
199
199
  ### Patch Changes
200
200
 
201
201
  - [doc] Added color transition in Layout ([#43](https://github.com/njaldea/mono/pull/43))
202
-
203
202
  - [doc] added Instance component ([#43](https://github.com/njaldea/mono/pull/43))
204
203
 
205
204
  ## 0.2.29
@@ -207,7 +206,7 @@
207
206
  ### Patch Changes
208
207
 
209
208
  - [doc][feature] ThemeIcon ([#41](https://github.com/njaldea/mono/pull/41))
210
- [doc][feature] added top bar to separate title and other controls
209
+ - [doc][feature] added top bar to separate title and other controls ([#41](https://github.com/njaldea/mono/pull/41))
211
210
 
212
211
  ## 0.2.28
213
212
 
@@ -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, ""), Consolas, Courier, 'Courier New', monospace;
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,13 +63,13 @@ $:
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
 
70
70
  <style>
71
71
  button {
72
- font-size: 0.6rem;
72
+ font-size: 0.7rem;
73
73
  border-top-width: 1px;
74
74
  border-bottom-width: 1px;
75
75
  border-left-width: 10px;
@@ -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.56",
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"