@nil-/doc 0.2.11 → 0.2.12

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,17 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 6c2d946: [fix] Nav now is not scrollable
8
+ [fix] Removes Container's "reversed" flag
9
+ [fix] Adds "secondary" flag to Container
10
+ [fix] Changes Container slot name (primary is top or left, seconadry is bottom or right)
11
+ [fix] load now removes routes with parameters
12
+ [fix] Template now supports `noreset`
13
+ [fix] Updates documentation
14
+
3
15
  ## 0.2.11
4
16
 
5
17
  ### Patch Changes
@@ -28,19 +28,21 @@ export let renamer = null;
28
28
  const r = inRoot();
29
29
  </script>
30
30
  <div class="layout" class:nil-doc-reset={r}>
31
- <Container offset={250} padding={250} vertical>
32
- <svelte:fragment slot="a">
33
- <Nav
34
- info={data}
35
- selected={current ?? ""}
36
- sorter={sorter ?? ((l, r) => (l === r ? 0 : l < r ? -1 : +1))}
37
- renamer={renamer ?? ((s) => s)}
38
- on:navigate
39
- >
40
- <slot name="title">@nil-/doc</slot>
41
- </Nav>
31
+ <Container offset={250} padding={250} vertical secondary>
32
+ <svelte:fragment slot="primary">
33
+ <div class="content nil-doc-scrollable">
34
+ <Nav
35
+ info={data}
36
+ selected={current ?? ""}
37
+ sorter={sorter ?? ((l, r) => (l === r ? 0 : l < r ? -1 : +1))}
38
+ renamer={renamer ?? ((s) => s)}
39
+ on:navigate
40
+ >
41
+ <slot name="title">@nil-/doc</slot>
42
+ </Nav>
43
+ </div>
42
44
  </svelte:fragment>
43
- <svelte:fragment slot="b">
45
+ <svelte:fragment slot="secondary">
44
46
  <div class="content nil-doc-scrollable">
45
47
  {#key current}
46
48
  <slot name="content" />
@@ -59,6 +59,7 @@ function resolve(d, p) {
59
59
  return temporary;
60
60
  }
61
61
  let hovered = null;
62
+ export let noreset = false;
62
63
  /**
63
64
  * This flag is to rerender the whole slot component.
64
65
  * If the control is disabled, we use the default value provided from the defaults field.
@@ -70,8 +71,8 @@ let hovered = null;
70
71
  *
71
72
  * Similar case to: https://github.com/sveltejs/svelte/issues/4442
72
73
  */
73
- let rerender = false;
74
- beforeUpdate(() => (rerender = !rerender));
74
+ let key = false;
75
+ beforeUpdate(() => (key = !key));
75
76
  </script>
76
77
  <div class="template">
77
78
  {#each $params as { id, tag, values } (id)}
@@ -82,11 +83,17 @@ beforeUpdate(() => (rerender = !rerender));
82
83
  on:mouseleave={() => (hovered = null)}
83
84
  on:keypress={null}
84
85
  >
85
- {#key rerender}
86
+ {#if noreset}
86
87
  <div class="content nil-doc-scrollable">
87
88
  <slot {tag} props={resolve(defaults, values)} />
88
89
  </div>
89
- {/key}
90
+ {:else}
91
+ {#key key}
92
+ <div class="content nil-doc-scrollable">
93
+ <slot {tag} props={resolve(defaults, values)} />
94
+ </div>
95
+ {/key}
96
+ {/if}
90
97
  {#if $controls.length > 0 && ($current === id || hovered === id)}
91
98
  <div class="misc nil-doc-scrollable" transition:slide>
92
99
  <Controls infos={$controls} bind:values />
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare class __sveltets_Render<Args> {
3
3
  props(): {
4
4
  defaults: Args;
5
+ noreset?: boolean | undefined;
5
6
  };
6
7
  events(): {} & {
7
8
  [evt: string]: CustomEvent<any>;
@@ -56,10 +56,9 @@
56
56
  export let vertical = false;
57
57
  // initial value where the divider is located
58
58
  export let offset = 0;
59
- // which position is offset located
60
- // if true, the reference content is from slot="b"
61
- // if false, the reference content is from slot="a"
62
- export let reversed = false;
59
+ // when secondary is enabled, main focus will be the secondary slot
60
+ // collapsing will hide the primary slot
61
+ export let secondary = false;
63
62
  // min distance of divider to the edges
64
63
  export let padding = 0;
65
64
  let width;
@@ -75,7 +74,7 @@ function update(w, h, limit, value) {
75
74
  }
76
75
  $: update(width, height, padding, $position);
77
76
  $: offsetpx = collapse ? "10px" : `${offset}px`;
78
- $: style = reversed ? `auto 0px ${offsetpx}` : `${offsetpx} 0px auto`;
77
+ $: style = !secondary ? `auto 0px ${offsetpx}` : `${offsetpx} 0px auto`;
79
78
  </script>
80
79
  <div
81
80
  class="container"
@@ -83,23 +82,24 @@ $: style = reversed ? `auto 0px ${offsetpx}` : `${offsetpx} 0px auto`;
83
82
  bind:clientHeight={height}
84
83
  bind:clientWidth={width}
85
84
  style:grid-template-columns={vertical ? style : null}
85
+ style:grid-template-rows={!vertical ? style : null}
86
86
  >
87
87
  {#if width != null && height != null}
88
- <div style:grid-area={!reversed ? "primary" : "secondary"}>
89
- {#if !collapse || reversed}
90
- <slot name="a" />
88
+ <div style:grid-area="primary">
89
+ {#if !collapse || !secondary}
90
+ <slot name="primary" />
91
91
  {/if}
92
92
  </div>
93
93
  <div class="divider" class:vertical>
94
94
  <div
95
95
  class="overlay"
96
- use:draggable={{ reset: () => offset, reversed, vertical }}
96
+ use:draggable={{ reset: () => offset, reversed: !secondary, vertical }}
97
97
  on:dblclick={() => (collapse = !collapse)}
98
98
  />
99
99
  </div>
100
- <div style:grid-area={reversed ? "primary" : "secondary"}>
101
- {#if !collapse || !reversed}
102
- <slot name="b" />
100
+ <div style:grid-area="secondary">
101
+ {#if !collapse || secondary}
102
+ <slot name="secondary" />
103
103
  {/if}
104
104
  </div>
105
105
  {/if}
@@ -3,15 +3,15 @@ declare const __propDef: {
3
3
  props: {
4
4
  vertical?: boolean | undefined;
5
5
  offset?: number | undefined;
6
- reversed?: boolean | undefined;
6
+ secondary?: boolean | undefined;
7
7
  padding?: number | undefined;
8
8
  };
9
9
  events: {
10
10
  [evt: string]: CustomEvent<any>;
11
11
  };
12
12
  slots: {
13
- a: {};
14
- b: {};
13
+ primary: {};
14
+ secondary: {};
15
15
  };
16
16
  };
17
17
  export type ContainerProps = typeof __propDef.props;
@@ -4,5 +4,6 @@ export function load(files_from_import_meta) {
4
4
  const rootlen = "./+page.svelte".length;
5
5
  return Object.keys(files_from_import_meta)
6
6
  .filter((p) => p.length > rootlen) // remove root page
7
+ .filter((p) => /.*\[.*\].*/.exec(p) == null)
7
8
  .map((p) => p.substring(prefix, p.length - suffix));
8
9
  }
@@ -1,6 +1,4 @@
1
1
  <style>
2
- @import "../../styles/scrollable.css";
3
-
4
2
  .nav {
5
3
  width: 100%;
6
4
  height: 100%;
@@ -66,7 +64,7 @@ export let renamer;
66
64
  let filter = "";
67
65
  let states = apply(info, () => ({ expanded: false, sub: {} }), (t, path) => ({ expanded: t.expanded || selected === path, sub: t.sub }), (t) => t.sub);
68
66
  </script>
69
- <div class="nav nil-doc-scrollable">
67
+ <div class="nav">
70
68
  <div class="logo"><slot /></div>
71
69
  <div class="search-bar">
72
70
  <input bind:value={filter} type="text" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"