@nil-/doc 0.2.52 → 0.2.53

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,5 +1,13 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.53
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][break] removed "scale" prop ([#92](https://github.com/njaldea/mono/pull/92))
8
+ [doc][fix] better block scrollable handling
9
+ [doc][fix] better style to vanilla-color popup
10
+
3
11
  ## 0.2.52
4
12
 
5
13
  ### Patch Changes
@@ -61,27 +61,46 @@ const cycleMode = () => {
61
61
  </Button>
62
62
  </div>
63
63
  </div>
64
- <div class="block" class:columns={$columns} class:dark={$dark}>
65
- <slot />
64
+ <div class="outer">
65
+ <div class="scrollable block" class:columns={$columns}>
66
+ <slot />
67
+ </div>
66
68
  </div>
67
69
  </Base>
68
70
 
69
71
  <style>
70
- .relative {
71
- z-index: 10;
72
- position: relative;
73
- }
74
-
75
72
  .block {
76
73
  display: grid;
77
- border-radius: 0.5rem;
78
74
  grid-auto-rows: 1fr;
79
75
  grid-auto-columns: auto;
80
76
  grid-auto-flow: row;
77
+ }
81
78
 
79
+ .outer {
80
+ border-radius: 0.5rem;
81
+ padding: 1.75rem 0.2rem 0.75rem 0.2rem;
82
82
  min-width: 10rem;
83
+ margin: 1px;
84
+ outline: solid 1px white;
85
+ }
86
+
87
+ .scrollable {
88
+ width: 100%;
89
+ height: 100%;
90
+ overflow: scroll;
91
+ /* Firefox */
92
+ scrollbar-width: none;
93
+ /* IE and Edge */
94
+ -ms-overflow-style: none;
95
+ }
96
+
97
+ .scrollable::-webkit-scrollbar {
98
+ display: none;
99
+ }
83
100
 
84
- padding: 1.75rem 0.2rem 0.5rem 0.2rem;
101
+ .relative {
102
+ z-index: 10;
103
+ position: relative;
85
104
  }
86
105
 
87
106
  .buttons {
@@ -100,7 +119,7 @@ const cycleMode = () => {
100
119
  grid-auto-flow: column;
101
120
  }
102
121
 
103
- .block {
122
+ .outer {
104
123
  color: var(--i-nil-doc-color);
105
124
  color-scheme: var(--i-nil-doc-color-scheme);
106
125
  background-color: var(--i-nil-doc-block-bg-color);
@@ -109,4 +128,8 @@ const cycleMode = () => {
109
128
  transition: color var(--i-nil-doc-transition-time),
110
129
  background-color var(--i-nil-doc-transition-time);
111
130
  }
131
+
132
+ .block {
133
+ outline: 1px solid var(--i-nil-doc-block-outline-color);
134
+ }
112
135
  </style>
@@ -9,7 +9,6 @@ $:
9
9
  expanded = $controlsState.position !== "hidden";
10
10
  export let defaults = void 0;
11
11
  export let noreset = false;
12
- export let scale = false;
13
12
  let key = false;
14
13
  beforeUpdate(() => key = !key);
15
14
  const resolveArgs = resolve;
@@ -25,8 +24,8 @@ let handlers = {};
25
24
  See [documentation](https://mono-doc.vercel.app/3-Components/2-Block/1-Content/1-Instance) for more details.
26
25
  -->
27
26
 
28
- <div class="instance" class:scale class:cside={expanded && "right" === $controlsState.position}>
29
- <div class="content scrollable">
27
+ <div class="instance" class:cside={expanded && "right" === $controlsState.position}>
28
+ <div class="content">
30
29
  {#if noreset}
31
30
  <slot props={resolveArgs(defaults ?? {}, bound)} events={handlers} {key} />
32
31
  {:else}
@@ -63,12 +62,9 @@ let handlers = {};
63
62
  </div>
64
63
 
65
64
  <style>
66
- .instance.scale {
67
- transition: transform var(--i-nil-doc-transition-time);
68
- }
69
-
70
- .instance.scale:hover {
71
- transform: scale(1.015);
65
+ .instance {
66
+ width: 100%;
67
+ height: 100%;
72
68
  }
73
69
 
74
70
  .cside {
@@ -78,18 +74,9 @@ let handlers = {};
78
74
 
79
75
  .content {
80
76
  min-height: 6.25rem;
81
- border-radius: 0.5rem;
82
77
  }
83
78
 
84
- div:not(.cside) > .misc {
85
- border-bottom-left-radius: 0.5rem;
86
- border-bottom-right-radius: 0.5rem;
87
- user-select: none;
88
- }
89
-
90
- .cside > .misc {
91
- border-top-right-radius: 0.5rem;
92
- border-bottom-right-radius: 0.5rem;
79
+ .misc {
93
80
  user-select: none;
94
81
  }
95
82
 
@@ -100,7 +87,7 @@ let handlers = {};
100
87
 
101
88
  /* colors */
102
89
  .instance {
103
- transition: background-color 350ms;
90
+ transition: background-color var(--i-nil-doc-transition-time);
104
91
  color: var(--i-nil-doc-color);
105
92
  background-color: var(--i-nil-doc-bg-color);
106
93
  }
@@ -3,7 +3,6 @@ declare class __sveltets_Render<PropArgs> {
3
3
  props(): {
4
4
  defaults?: PropArgs | undefined;
5
5
  noreset?: boolean | undefined;
6
- scale?: boolean | undefined;
7
6
  };
8
7
  events(): {} & {
9
8
  [evt: string]: CustomEvent<any>;
@@ -8,7 +8,6 @@ const orientation = getOrientation();
8
8
  export let defaults = void 0;
9
9
  export let noreset = false;
10
10
  export let columns = false;
11
- export let scale = false;
12
11
  $:
13
12
  $defaultsStore = defaults ?? {};
14
13
  $:
@@ -28,7 +27,6 @@ const cast = (t) => t;
28
27
  <Instance
29
28
  defaults={resolveArgs($defaultsStore, param.values)}
30
29
  {noreset}
31
- {scale}
32
30
  let:key
33
31
  let:props
34
32
  let:events
@@ -4,7 +4,6 @@ declare class __sveltets_Render<Args> {
4
4
  defaults?: Args | undefined;
5
5
  noreset?: boolean | undefined;
6
6
  columns?: boolean | undefined;
7
- scale?: boolean | undefined;
8
7
  };
9
8
  events(): {} & {
10
9
  [evt: string]: CustomEvent<any>;
@@ -1,19 +1,7 @@
1
- <!--
2
- <div> this component
3
- <div> Header
4
- <div></div>
5
- <div></div>
6
- <div></div>
7
- </div>
8
- <div> Controls
9
- <div></div>
10
- <div></div>
11
- <div></div>
12
- </div>
13
- ...
14
- </div>
15
- -->
16
- <div>
1
+ <script>export let type;
2
+ </script>
3
+
4
+ <div class:props={type === "props"} class:events={type === "events"}>
17
5
  <slot />
18
6
  </div>
19
7
 
@@ -25,6 +13,10 @@
25
13
  box-sizing: border-box;
26
14
  }
27
15
 
16
+ div.events {
17
+ height: 22rem;
18
+ }
19
+
28
20
  div :global(*),
29
21
  div :global(*::before),
30
22
  div :global(*::after) {
@@ -34,15 +26,23 @@
34
26
 
35
27
  div > :global(div) {
36
28
  display: grid;
29
+ }
30
+
31
+ div.props > :global(div) {
37
32
  grid-template-columns: minmax(15rem, 1fr) 12.5rem 2.5rem;
38
33
  }
39
34
 
35
+ div.events > :global(div) {
36
+ grid-template-columns: 2fr 3fr;
37
+ align-items: center;
38
+ }
39
+
40
40
  div > :global(div:first-child) {
41
41
  font-weight: bold;
42
42
  place-items: center;
43
43
  }
44
44
 
45
- div > :global(div > div:not(:first-child)) {
45
+ div.props > :global(div > div:not(:first-child)) {
46
46
  display: grid;
47
47
  place-items: center;
48
48
  }
@@ -50,7 +50,6 @@
50
50
  div > :global(div > div:not(:first-child) > *) {
51
51
  width: 100%;
52
52
  height: 80%;
53
- font-size: 1rem;
54
53
  }
55
54
 
56
55
  /* colors */
@@ -1,21 +1,7 @@
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
1
  import { SvelteComponentTyped } from "svelte";
16
2
  declare const __propDef: {
17
3
  props: {
18
- [x: string]: never;
4
+ type: "props" | "events";
19
5
  };
20
6
  events: {
21
7
  [evt: string]: CustomEvent<any>;
@@ -24,4 +10,9 @@ declare const __propDef: {
24
10
  default: {};
25
11
  };
26
12
  };
13
+ export type StylerProps = typeof __propDef.props;
14
+ export type StylerEvents = typeof __propDef.events;
15
+ export type StylerSlots = typeof __propDef.slots;
16
+ export default class Styler extends SvelteComponentTyped<StylerProps, StylerEvents, StylerSlots> {
17
+ }
27
18
  export {};
@@ -1,4 +1,4 @@
1
- <script>import Styler from "./misc/Styler.svelte";
1
+ <script>import Styler from "../Styler.svelte";
2
2
  export let visible;
3
3
  export let events;
4
4
  export let handlers;
@@ -41,7 +41,7 @@ $:
41
41
  </script>
42
42
 
43
43
  {#if visible}
44
- <Styler>
44
+ <Styler type={"events"}>
45
45
  <slot />
46
46
  {#each history as { count, detail, name }, i (i)}
47
47
  <div>
@@ -1,4 +1,5 @@
1
- <script context="module">const colorSetter = (format, color) => {
1
+ <script context="module">import Picker from "vanilla-picker";
2
+ const colorSetter = (format, color) => {
2
3
  switch (format) {
3
4
  case "hex":
4
5
  return color.hex.substring(0, 7);
@@ -14,28 +15,11 @@
14
15
  return color.rgbaString;
15
16
  }
16
17
  };
17
- const formatter = (format) => {
18
- switch (format) {
19
- case "hex":
20
- return "hex";
21
- case "hsl":
22
- return "hsl";
23
- case "rgb":
24
- return "rgb";
25
- case "hexa":
26
- return "hex";
27
- case "hsla":
28
- return "hsl";
29
- case "rgba":
30
- return "rgb";
31
- }
32
- };
33
18
  </script>
34
19
 
35
20
  <script>import { getName, getFormat } from "./misc/utils";
36
21
  import { defaulter } from "./misc/defaulter";
37
22
  import NameHeader from "./misc/Name.svelte";
38
- import Picker from "vanilla-picker";
39
23
  export let value;
40
24
  export let info;
41
25
  export let depth;
@@ -43,21 +27,25 @@ export let disabled = false;
43
27
  export let visible = false;
44
28
  let ivalue = value ?? defaulter(info);
45
29
  let enabled = value !== void 0;
46
- const action = (div, format) => {
30
+ const action = (d, format) => {
31
+ d.style.borderColor = ivalue;
47
32
  const picker = new Picker({
48
- parent: div,
33
+ parent: d,
49
34
  popup: "left",
50
- editorFormat: formatter(format),
35
+ editorFormat: format.substring(0, 3),
51
36
  editor: false,
52
37
  alpha: format.length === 4,
53
- onChange: (color) => ivalue = colorSetter(getFormat(info), color),
38
+ onChange: (color) => {
39
+ ivalue = colorSetter(getFormat(info), color);
40
+ d.style.borderColor = ivalue;
41
+ },
54
42
  color: ivalue
55
43
  });
56
44
  return {
57
45
  update: (format2) => {
58
46
  picker.setOptions({
59
47
  alpha: format2.length === 4,
60
- editorFormat: formatter(format2)
48
+ editorFormat: format2.substring(0, 3)
61
49
  });
62
50
  },
63
51
  destroy: () => picker.destroy()
@@ -70,17 +58,37 @@ $:
70
58
  {#if visible}
71
59
  <div>
72
60
  <NameHeader name={getName(info)} {depth} />
73
- <div>
74
- <button use:action={getFormat(info)} disabled={!enabled || disabled}>
75
- {value}
76
- </button>
77
- </div>
61
+ <button use:action={getFormat(info)} disabled={!enabled || disabled}>
62
+ {ivalue}
63
+ </button>
78
64
  <div><input type="checkbox" bind:checked={enabled} {disabled} /></div>
79
65
  </div>
80
66
  {/if}
81
67
 
82
68
  <style>
83
- div > div > button {
84
- font-size: 0.7rem;
69
+ button {
70
+ font-size: 0.6rem;
71
+ border-top-width: 1px;
72
+ border-bottom-width: 1px;
73
+ border-left-width: 10px;
74
+ border-right-width: 10px;
75
+ border-style: solid;
76
+ background-color: var(--i-nil-doc-bg-color);
77
+ outline: 1px solid gray;
78
+ margin-top: 3px;
79
+ margin-bottom: 3px;
80
+ }
81
+
82
+ button :global(.picker_wrapper),
83
+ button :global(.picker_arrow),
84
+ button :global(.picker_arrow::before),
85
+ button :global(.picker_arrow::after) {
86
+ background-color: var(--i-nil-doc-bg-color) !important;
87
+ }
88
+
89
+ button :global(.picker_done > button) {
90
+ background-image: initial;
91
+ background-color: var(--i-nil-doc-bg-color);
92
+ color: var(--i-nil-doc-color);
85
93
  }
86
94
  </style>
@@ -1,12 +1,12 @@
1
1
  <script>import Component from "./Component.svelte";
2
- import Styler from "./misc/Styler.svelte";
2
+ import Styler from "../Styler.svelte";
3
3
  import { getName } from "./misc/utils";
4
4
  export let infos;
5
5
  export let values;
6
6
  export let visible;
7
7
  </script>
8
8
 
9
- <Styler>
9
+ <Styler type={"props"}>
10
10
  {#if visible}
11
11
  <slot />
12
12
  {/if}
@@ -14,7 +14,8 @@
14
14
  }
15
15
 
16
16
  rect:not(:first-child) {
17
- transition: height 350ms, x 350ms, y 350ms;
17
+ transition: height var(--i-nil-doc-transition-time), x var(--i-nil-doc-transition-time),
18
+ y var(--i-nil-doc-transition-time);
18
19
  width: 60px;
19
20
  height: 0px;
20
21
  x: -30px;
@@ -3,7 +3,6 @@
3
3
  </div>
4
4
 
5
5
  <style>
6
- /* scrollable */
7
6
  div {
8
7
  width: 100%;
9
8
  height: 100%;
@@ -46,22 +46,22 @@ const index = indexer++;
46
46
  }
47
47
 
48
48
  svg {
49
- transition: transform 350ms;
49
+ transition: transform var(--i-nil-doc-transition-time);
50
50
  transform: rotate(40deg);
51
51
  }
52
52
 
53
53
  svg > g {
54
- transition: opacity 350ms;
54
+ transition: opacity var(--i-nil-doc-transition-time);
55
55
  opacity: 0;
56
56
  }
57
57
 
58
58
  svg > mask > circle {
59
- transition: cy 350ms;
59
+ transition: cy var(--i-nil-doc-transition-time);
60
60
  cy: -8px;
61
61
  }
62
62
 
63
63
  svg > circle {
64
- transition: r 350ms;
64
+ transition: r var(--i-nil-doc-transition-time);
65
65
  r: 10px;
66
66
  }
67
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.52",
3
+ "version": "0.2.53",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"
@@ -1,52 +0,0 @@
1
- <!--
2
- <div> this component
3
- <div> Header
4
- <div></div>
5
- <div></div>
6
- </div>
7
- <div> Controls
8
- <div></div>
9
- <div></div>
10
- </div>
11
- ...
12
- </div>
13
- -->
14
- <div>
15
- <slot />
16
- </div>
17
-
18
- <style>
19
- div {
20
- display: grid;
21
- height: 22rem;
22
- min-width: 31.25rem;
23
- grid-auto-rows: 2rem;
24
- }
25
-
26
- div > :global(div) {
27
- display: grid;
28
- grid-template-columns: 2fr 3fr;
29
- align-items: center;
30
- }
31
-
32
- div > :global(div:first-child) {
33
- font-weight: bold;
34
- justify-items: center;
35
- }
36
-
37
- /* colors */
38
- div {
39
- transition: background-color var(--i-nil-doc-transition-time);
40
- background-repeat: repeat;
41
- background-size: 100% 4rem;
42
- background-image: linear-gradient(
43
- to bottom,
44
- var(--i-nil-doc-controls-p) 2rem,
45
- var(--i-nil-doc-controls-s) 2rem
46
- );
47
- }
48
-
49
- div > :global(div:nth-child(n + 2):hover) {
50
- background-color: var(--i-nil-doc-controls-hover);
51
- }
52
- </style>
@@ -1,27 +0,0 @@
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 {};