spaper 0.2.6 → 0.3.6

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/README.md CHANGED
@@ -14,7 +14,7 @@ Browse [documentation and demo here](https://oli8.github.io/spaper/).
14
14
  Add a link to the CDN into your HTML file:
15
15
 
16
16
  ```html
17
- <link rel="stylesheet" href="https://unpkg.com/papercss@1.8.2/dist/paper.min.css">
17
+ <link rel="stylesheet" href="https://unpkg.com/papercss@1.8.3/dist/paper.min.css">
18
18
  ```
19
19
 
20
20
  Or use NPM:
@@ -8,7 +8,7 @@
8
8
  {/if}
9
9
  </div>
10
10
 
11
- <script lang="ts">var _a;
11
+ <script >var _a;
12
12
  ;
13
13
  import CloseButton from './CloseButton.svelte';
14
14
  import { computeClasses } from '../utils';
@@ -21,7 +21,7 @@ function close() {
21
21
  $: classes = `${(_a = $$restProps.class) !== null && _a !== void 0 ? _a : ''} alert ${computeClasses('alert', { type })}`;
22
22
  </script>
23
23
 
24
- <style lang="scss">.alert {
24
+ <style >.alert {
25
25
  transition: all 0.25s ease-out;
26
26
  }
27
27
  .alert.closed {
@@ -31,7 +31,7 @@
31
31
  {/if}
32
32
  </article>
33
33
 
34
- <script lang="ts">export let title = '';
34
+ <script >export let title = '';
35
35
  export let meta = '';
36
36
  export let textLead = '';
37
37
  export let border = false;
@@ -2,7 +2,7 @@
2
2
  <slot />
3
3
  </span>
4
4
 
5
- <script lang="ts">;
5
+ <script >;
6
6
  export let type = 'primary';
7
7
  export let rounded = false;
8
8
  </script>
@@ -10,6 +10,6 @@
10
10
  {/each}
11
11
  </ul>
12
12
 
13
- <script lang="ts">export let border = false;
13
+ <script >export let border = false;
14
14
  export let items = [];
15
15
  </script>
@@ -16,7 +16,7 @@
16
16
  </button>
17
17
  {/if}
18
18
 
19
- <script lang="ts">var _a;
19
+ <script >var _a;
20
20
  ;
21
21
  import { computeClasses, getDomAttributes } from '../utils';
22
22
  export let type = null;
@@ -57,7 +57,7 @@
57
57
  {/if}
58
58
  </div>
59
59
 
60
- <script lang="ts">;
60
+ <script >;
61
61
  export let title = '';
62
62
  export let subTitle = '';
63
63
  export let image = '';
@@ -5,10 +5,10 @@
5
5
  X
6
6
  </button>
7
7
 
8
- <script lang="ts">export let ariaLabel = 'close';
8
+ <script >export let ariaLabel = 'close';
9
9
  </script>
10
10
 
11
- <style lang="scss">button {
11
+ <style >button {
12
12
  float: right;
13
13
  border: 0;
14
14
  padding: 0;
@@ -14,10 +14,10 @@
14
14
  </div>
15
15
  </section>
16
16
 
17
- <script lang="ts" context="module">let count = 0;
17
+ <script context="module">let count = 0;
18
18
  </script>
19
19
 
20
- <script lang="ts">var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
20
+ <script >var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
21
21
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22
22
  return new (P || (P = Promise))(function (resolve, reject) {
23
23
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -9,7 +9,7 @@
9
9
  <span>{label}</span>
10
10
  </label>
11
11
 
12
- <script lang="ts">import { createEventDispatcher } from 'svelte';
12
+ <script >import { createEventDispatcher } from 'svelte';
13
13
  export let label = '';
14
14
  export let value = '';
15
15
  export let name = '';
@@ -30,7 +30,7 @@ function onChange({ target }) {
30
30
  }
31
31
  </script>
32
32
 
33
- <style lang="scss">input[disabled] + span::before, input[disabled] ~ span {
33
+ <style >input[disabled] + span::before, input[disabled] ~ span {
34
34
  opacity: 0.5;
35
35
  cursor: not-allowed;
36
36
  }</style>
@@ -29,7 +29,7 @@
29
29
  on:change />
30
30
  {/if}
31
31
 
32
- <script lang="ts">var _a;
32
+ <script >var _a;
33
33
  import { createEventDispatcher } from 'svelte';
34
34
  import { computeClasses, getDomAttributes } from '../../utils';
35
35
  ;
@@ -19,7 +19,7 @@
19
19
  on:change />
20
20
  {/if}
21
21
 
22
- <script lang="ts">export let label = '';
22
+ <script >export let label = '';
23
23
  export let value = '';
24
24
  export let group = '';
25
25
  </script>
@@ -21,7 +21,7 @@
21
21
  </select>
22
22
  {/if}
23
23
 
24
- <script lang="ts">import { createEventDispatcher } from 'svelte';
24
+ <script >import { createEventDispatcher } from 'svelte';
25
25
  export let label = '';
26
26
  export let value = '';
27
27
  let selectElement;
@@ -24,7 +24,7 @@
24
24
  {/if}
25
25
  </label>
26
26
 
27
- <script lang="ts">import { onMount } from 'svelte';
27
+ <script >import { onMount } from 'svelte';
28
28
  ;
29
29
  import { computeClasses } from '../../utils';
30
30
  export let label = '';
@@ -52,7 +52,7 @@ $: if (percentage) {
52
52
  }
53
53
  </script>
54
54
 
55
- <style lang="scss">label.block {
55
+ <style >label.block {
56
56
  width: 100%;
57
57
  }
58
58
  label.disabled {
@@ -3,7 +3,8 @@
3
3
  class:disabled>
4
4
  <input bind:checked
5
5
  type="checkbox"
6
- {disabled} />
6
+ {disabled}
7
+ on:change={onChange} />
7
8
  <div class="paper-switch-tile-card border">
8
9
  <div class={`paper-switch-tile-card-front border
9
10
  ${bgClass(tile.off.background)}`}>
@@ -20,7 +21,8 @@
20
21
  <input id={domId}
21
22
  bind:checked
22
23
  type="checkbox"
23
- {disabled} />
24
+ {disabled}
25
+ on:change={onChange} />
24
26
  <span class="paper-switch-slider"
25
27
  class:round></span>
26
28
  </label>
@@ -32,16 +34,17 @@
32
34
  {/if}
33
35
  {/if}
34
36
 
35
- <script lang="ts" context="module">let count = 0;
37
+ <script context="module">let count = 0;
36
38
  </script>
37
39
 
38
- <script lang="ts">import { onMount } from "svelte";
40
+ <script >import { onMount, createEventDispatcher } from "svelte";
39
41
  ;
40
42
  export let checked = false;
41
43
  export let disabled = false;
42
44
  export let round = false;
43
45
  export let inline = false;
44
46
  export let tile = null;
47
+ const dispatch = createEventDispatcher();
45
48
  let id;
46
49
  onMount(() => {
47
50
  id = count++;
@@ -50,6 +53,9 @@ let domId;
50
53
  $: domId = `paper-switch-input-${id}`;
51
54
  let prefix;
52
55
  $: prefix = 'paper-switch' + (inline ? '-2' : '');
56
+ function onChange() {
57
+ dispatch('change', checked);
58
+ }
53
59
  function bgClass(color) {
54
60
  if (!color)
55
61
  return;
@@ -57,7 +63,7 @@ function bgClass(color) {
57
63
  }
58
64
  </script>
59
65
 
60
- <style lang="scss">input[disabled] + span,
66
+ <style >input[disabled] + span,
61
67
  .paper-switch-tile.disabled {
62
68
  opacity: 0.5;
63
69
  cursor: not-allowed;
@@ -23,7 +23,7 @@
23
23
  </div>
24
24
  </div>
25
25
 
26
- <script lang="ts">import Button from '../Button.svelte';
26
+ <script >import Button from '../Button.svelte';
27
27
  import CloseButton from '../CloseButton.svelte';
28
28
  export let active = false;
29
29
  export let title = '';
@@ -38,7 +38,7 @@ function handleKeydown({ key }) {
38
38
  }
39
39
  </script>
40
40
 
41
- <style lang="scss">.modal.active {
41
+ <style >.modal.active {
42
42
  opacity: 1;
43
43
  visibility: visible;
44
44
  }
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  </nav>
16
16
 
17
- <script lang="ts">export let border = true;
17
+ <script >export let border = true;
18
18
  export let fixed = false;
19
19
  export let split = true;
20
20
  let open = false;
@@ -23,7 +23,7 @@ function collapse() {
23
23
  }
24
24
  </script>
25
25
 
26
- <style lang="scss">/* Papercss removes border of buttons in .collapsible */
26
+ <style >/* Papercss removes border of buttons in .collapsible */
27
27
  .collapsible > button {
28
28
  border: 2px solid var(--primary);
29
29
  }
@@ -7,7 +7,7 @@
7
7
  {/if}
8
8
  </svg>
9
9
 
10
- <script lang="ts">;
10
+ <script >;
11
11
  ;
12
12
  import arrowDimension from './arrow-dimension';
13
13
  export let size;
@@ -10,7 +10,7 @@
10
10
  {/if}
11
11
  </Button>
12
12
 
13
- <script lang="ts">import Button from '../Button.svelte';
13
+ <script >import Button from '../Button.svelte';
14
14
  import Arrow from './Arrow.svelte';
15
15
  ;
16
16
  export let size;
@@ -51,7 +51,7 @@
51
51
  {/if}
52
52
  </section>
53
53
 
54
- <script lang="ts">import { createEventDispatcher } from 'svelte';
54
+ <script >import { createEventDispatcher } from 'svelte';
55
55
  import Button from '../Button.svelte';
56
56
  import Input from '../Form/Input.svelte';
57
57
  ;
@@ -105,7 +105,7 @@ function changePage(val) {
105
105
  }
106
106
  </script>
107
107
 
108
- <style lang="scss">ul, li {
108
+ <style >ul, li {
109
109
  display: inline;
110
110
  }
111
111
 
@@ -5,7 +5,7 @@
5
5
  <slot />
6
6
  </div>
7
7
 
8
- <script lang="ts">;
8
+ <script >;
9
9
  export let label = '';
10
10
  export let position = 'top';
11
11
  export let inline = true;
@@ -17,7 +17,7 @@ function bgClass(color) {
17
17
  }
18
18
  </script>
19
19
 
20
- <style lang="scss">.inline {
20
+ <style >.inline {
21
21
  display: inline;
22
22
  }
23
23
 
@@ -10,7 +10,7 @@
10
10
  </div>
11
11
  </div>
12
12
 
13
- <script lang="ts">;
13
+ <script >;
14
14
  export let value = 50;
15
15
  export let type = 'primary';
16
16
  export let showValue = false;
@@ -41,8 +41,7 @@
41
41
  </tbody>
42
42
  </table>
43
43
 
44
- <script lang="ts">import pick from 'lodash.pick';
45
- let tmpCol;
44
+ <script >let tmpCol;
46
45
  export let columns = [];
47
46
  export let data = [];
48
47
  export let striped = false;
@@ -63,7 +62,7 @@ function isColumnObj(arg) {
63
62
  return arg.field;
64
63
  }
65
64
  function getRowFiltered(row) {
66
- return Object.entries(pick(row, displayedFields));
65
+ return Object.entries(row).filter(([key, _val]) => displayedFields.includes(key));
67
66
  }
68
67
  $: if (!columns.length) {
69
68
  columns = Object.keys(data[0] || {});
@@ -10,7 +10,7 @@
10
10
  <slot />
11
11
  </div>
12
12
 
13
- <script lang="ts">import { onMount, getContext } from 'svelte';
13
+ <script >import { onMount, getContext } from 'svelte';
14
14
  ;
15
15
  export let label;
16
16
  const key = {};
@@ -15,7 +15,7 @@
15
15
  <slot />
16
16
  </div>
17
17
 
18
- <script lang="ts">import { onMount, setContext, createEventDispatcher } from 'svelte';
18
+ <script >import { onMount, setContext, createEventDispatcher } from 'svelte';
19
19
  import { writable } from 'svelte/store';
20
20
  ;
21
21
  ;
@@ -52,7 +52,7 @@ function updateTabsVisility() {
52
52
  $: activeTab && updateTabsVisility();
53
53
  </script>
54
54
 
55
- <style lang="scss">.tabs-label-header {
55
+ <style >.tabs-label-header {
56
56
  cursor: pointer;
57
57
  color: var(--primary-light);
58
58
  display: inline-block;
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  {/if}
16
16
 
17
- <script lang="ts">import { onMount } from 'svelte';
17
+ <script >import { onMount } from 'svelte';
18
18
  import { fly, fade } from 'svelte/transition';
19
19
  ;
20
20
  ;
@@ -1,14 +1,14 @@
1
1
  <div class="{containerClass} {position}">
2
2
  </div>
3
3
 
4
- <script lang="ts" context="module">export const containerClass = 'paper-toast-container';
4
+ <script context="module">export const containerClass = 'paper-toast-container';
5
5
  </script>
6
6
 
7
- <script lang="ts">;
7
+ <script >;
8
8
  export let position = 'top-right';
9
9
  </script>
10
10
 
11
- <style lang="scss">:global(.paper-toast-container:is(.top, .bottom) > div) {
11
+ <style >:global(.paper-toast-container:is(.top, .bottom) > div) {
12
12
  align-self: center;
13
13
  }
14
14
 
@@ -32,6 +32,6 @@ export const warn = warning;
32
32
  export const danger = openType('danger');
33
33
  export const error = danger;
34
34
  Object.assign(Toast, {
35
- open, info, success, warning, warn, danger
35
+ open, info, success, warning, warn, error, danger
36
36
  });
37
37
  export default Toast;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "papercss",
9
9
  "components"
10
10
  ],
11
- "version": "0.2.6",
11
+ "version": "0.3.6",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/Oli8/spaper.git"
@@ -18,13 +18,9 @@
18
18
  },
19
19
  "homepage": "https://github.com/Oli8/spaper#readme",
20
20
  "peerDependencies": {
21
- "papercss": "^1.8.2"
21
+ "papercss": "^1.8.3"
22
22
  },
23
23
  "type": "module",
24
- "dependencies": {
25
- "lodash.omit": "^4.5.0",
26
- "lodash.pick": "^4.4.0"
27
- },
28
24
  "exports": {
29
25
  "./package.json": "./package.json",
30
26
  "./components/Alert.svelte": "./components/Alert.svelte",
@@ -50,7 +46,7 @@
50
46
  "./components/Pagination/Arrow.svelte": "./components/Pagination/Arrow.svelte",
51
47
  "./components/Pagination/NavigationButton.svelte": "./components/Pagination/NavigationButton.svelte",
52
48
  "./components/Pagination/Pagination.svelte": "./components/Pagination/Pagination.svelte",
53
- "./components/Pagination/arrow-dimension.js": "./components/Pagination/arrow-dimension.js",
49
+ "./components/Pagination/arrow-dimension": "./components/Pagination/arrow-dimension.js",
54
50
  "./components/Pagination": "./components/Pagination/index.js",
55
51
  "./components/Popover.svelte": "./components/Popover.svelte",
56
52
  "./components/Progress.svelte": "./components/Progress.svelte",
@@ -63,6 +59,7 @@
63
59
  "./components/Toast": "./components/Toast/index.js",
64
60
  "./components/style.scss": "./components/style.scss",
65
61
  ".": "./index.js",
66
- "./utils.js": "./utils.js"
67
- }
62
+ "./utils": "./utils.js"
63
+ },
64
+ "svelte": "./index.js"
68
65
  }
package/utils.js CHANGED
@@ -1,10 +1,13 @@
1
- import omit from 'lodash.omit';
2
1
  const propToClass = {
3
2
  size: (pf, val) => `${pf}-${val}`,
4
3
  block: (pf, _val) => `${pf}-block`,
5
4
  type: (pf, val) => `${pf}-${val}`,
6
5
  outline: (pf, val) => `${pf}-${val}-outline`,
7
6
  };
7
+ function omit(obj, properties) {
8
+ return Object.fromEntries(Object.entries(obj)
9
+ .filter(([key, _val]) => !properties.includes(key)));
10
+ }
8
11
  export function computeClasses(elPrefix, props) {
9
12
  return Object.entries(props)
10
13
  .filter(([_prop, val]) => val)