spaper 0.3.6 → 0.4.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
@@ -59,7 +59,9 @@ npm i spaper
59
59
  - Breadcrumb
60
60
  - Button
61
61
  - Card
62
+ - CloseButton
62
63
  - Collapsible
64
+ - CopyButton
63
65
  - Form
64
66
  - Checkbox
65
67
  - Input
@@ -1,4 +1,5 @@
1
- <article class="article padding-small"
1
+ <article {...$$restProps}
2
+ class="{$$restProps.class ?? ''} article padding-small"
2
3
  class:border>
3
4
  <h1 class="article-title">
4
5
  {#if $$slots.title}
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  title?: string;
5
6
  meta?: string;
6
7
  textLead?: string;
@@ -1,4 +1,6 @@
1
- <span class={`badge ${type}`} class:rounded>
1
+ <span {...$$restProps}
2
+ class="{$$restProps.class ?? ''} badge {type}"
3
+ class:rounded>
2
4
  <slot />
3
5
  </span>
4
6
 
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  type?: any;
5
6
  rounded?: boolean;
6
7
  };
@@ -1,4 +1,6 @@
1
- <ul class="breadcrumb" class:border>
1
+ <ul {...$$restProps}
2
+ class="{$$restProps.class ?? ''} breadcrumb"
3
+ class:border>
2
4
  {#each items as { text, href }}
3
5
  <li>
4
6
  {#if href}
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  border?: boolean;
5
6
  items?: {
6
7
  text: string;
@@ -2,7 +2,7 @@
2
2
  <a {...attr}
3
3
  class:disabled
4
4
  role="button"
5
- {href}
5
+ href={href ?? 'javascript:void(0);'}
6
6
  target={external ? '_blank' : '_self'}
7
7
  on:click>
8
8
  <slot />
@@ -25,7 +25,7 @@ export let block = false;
25
25
  export let disabled = false;
26
26
  export let outline = null;
27
27
  export let isLink = false;
28
- export let href = 'javascript:void(0);';
28
+ export let href = null;
29
29
  export let external = false;
30
30
  let attr;
31
31
  $: {
@@ -1,4 +1,5 @@
1
- <div class="card"
1
+ <div {...$$restProps}
2
+ class="{$$restProps.class ?? ''} card"
2
3
  style={`width: ${width}`}>
3
4
  {#if header || $$slots.header}
4
5
  <header class="card-header">
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { PositionY } from "../types";
3
3
  declare const __propDef: {
4
4
  props: {
5
+ [x: string]: any;
5
6
  title?: string;
6
7
  subTitle?: string;
7
8
  image?: string;
@@ -0,0 +1,43 @@
1
+ <Button {...$$restProps}
2
+ aria-label={ariaLabel}
3
+ on:click
4
+ on:click={copy}>
5
+ <slot />
6
+ </Button>
7
+
8
+ <script >var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ import { createEventDispatcher } from 'svelte';
18
+ import Button from './Button.svelte';
19
+ import { success } from './Toast';
20
+ export let text;
21
+ export let successMessage = 'Copied!';
22
+ export let ariaLabel = 'Copy to clipboard';
23
+ const dispatch = createEventDispatcher();
24
+ function copy() {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ if (!text)
27
+ return;
28
+ try {
29
+ yield navigator.clipboard.writeText(text);
30
+ dispatch('copy', text);
31
+ if (successMessage)
32
+ success({
33
+ message: successMessage,
34
+ position: 'top',
35
+ duration: 1000,
36
+ });
37
+ }
38
+ catch (e) {
39
+ console.error(e);
40
+ }
41
+ });
42
+ }
43
+ </script>
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ text: string;
6
+ successMessage?: string;
7
+ ariaLabel?: string;
8
+ };
9
+ events: {
10
+ click: MouseEvent;
11
+ copy: CustomEvent<any>;
12
+ } & {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {
16
+ default: {};
17
+ };
18
+ };
19
+ export declare type CopyButtonProps = typeof __propDef.props;
20
+ export declare type CopyButtonEvents = typeof __propDef.events;
21
+ export declare type CopyButtonSlots = typeof __propDef.slots;
22
+ export default class CopyButton extends SvelteComponentTyped<CopyButtonProps, CopyButtonEvents, CopyButtonSlots> {
23
+ }
24
+ export {};
@@ -1,4 +1,5 @@
1
- <label class="paper-check">
1
+ <label {...$$restProps}
2
+ class="{$$restProps.class ?? ''} paper-check">
2
3
  <input type="checkbox"
3
4
  {value} {name}
4
5
  {disabled}
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  label?: string;
5
6
  value?: string;
6
7
  name?: string;
@@ -1,5 +1,6 @@
1
1
  {#if tile}
2
- <label class="paper-switch-tile"
2
+ <label {...$$restProps}
3
+ class="{$$restProps.class ?? ''} paper-switch-tile"
3
4
  class:disabled>
4
5
  <input bind:checked
5
6
  type="checkbox"
@@ -1,6 +1,8 @@
1
1
  <svelte:window on:keydown={handleKeydown} />
2
2
 
3
- <div class="modal" class:active>
3
+ <div {...$$restProps}
4
+ class="{$$restProps.class ?? ''} modal"
5
+ class:active>
4
6
  <div class="modal-body">
5
7
  <CloseButton on:click={close} />
6
8
  {#if title}
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  active?: boolean;
5
6
  title?: string;
6
7
  subTitle?: string;
@@ -1,4 +1,5 @@
1
- <nav class={`${$$restProps.class ?? ''} paper-navbar`}
1
+ <nav {...$$restProps}
2
+ class={`${$$restProps.class ?? ''} paper-navbar`}
2
3
  class:border class:fixed
3
4
  class:split-nav={split}>
4
5
  {#if $$slots.brand}
@@ -1,4 +1,5 @@
1
- <div { ...{[`popover-${position}`]: label} }
1
+ <div {...$$restProps}
2
+ { ...{[`popover-${position}`]: label} }
2
3
  class={`${$$restProps.class} ${bgClass(background)}`}
3
4
  class:inline
4
5
  class:active={always || active}>
@@ -1,4 +1,5 @@
1
- <div class={`progress ${$$restProps.class ?? ''}`}
1
+ <div {...$$restProps}
2
+ class={`progress ${$$restProps.class ?? ''}`}
2
3
  class:margin-bottom={marginBottom}>
3
4
  <div class={`bar ${type} w-${cappedValue}`}
4
5
  class:striped class:infinite>
@@ -1,6 +1,6 @@
1
- <table class:table-alternating={striped}
2
- class:table-hover={hoverable}
3
- {...$$restProps}>
1
+ <table {...$$restProps}
2
+ class:table-alternating={striped}
3
+ class:table-hover={hoverable}>
4
4
  {#if showHeader}
5
5
  <thead>
6
6
  <tr>
@@ -1,4 +1,5 @@
1
- <div class="content margin"
1
+ <div {...$$restProps}
2
+ class="{$$restProps.class ?? ''} content margin"
2
3
  class:content--active={active}
3
4
  aria-hidden={!active}>
4
5
  {#if $$slots.header}
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  label: string;
5
6
  };
6
7
  events: {
@@ -1,4 +1,5 @@
1
- <div class={`row flex-${placement} tabs ${$$restProps.class ?? ''}`}
1
+ <div {...$$restProps}
2
+ class={`row flex-${placement} tabs ${$$restProps.class ?? ''}`}
2
3
  style={`text-align: ${contentAlign}`}>
3
4
  {#each $tabs as { label, header }, index}
4
5
  <div class="tabs-label-header"
@@ -17,11 +17,11 @@ export let position = 'top-right';
17
17
  }
18
18
 
19
19
  div {
20
+ height: 0;
20
21
  position: fixed;
21
22
  display: flex;
22
23
  width: 100%;
23
24
  padding: 2em;
24
- overflow: hidden;
25
25
  z-index: 9999;
26
26
  flex-direction: column;
27
27
  }
package/index.d.ts CHANGED
@@ -14,4 +14,6 @@ import Progress from './components/Progress.svelte';
14
14
  import Table from './components/Table.svelte';
15
15
  import Pagination from './components/Pagination';
16
16
  import Toast from './components/Toast';
17
- export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, };
17
+ import CloseButton from './components/CloseButton.svelte';
18
+ import CopyButton from './components/CopyButton.svelte';
19
+ export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, };
package/index.js CHANGED
@@ -14,4 +14,6 @@ import Progress from './components/Progress.svelte';
14
14
  import Table from './components/Table.svelte';
15
15
  import Pagination from './components/Pagination';
16
16
  import Toast from './components/Toast';
17
- export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, };
17
+ import CloseButton from './components/CloseButton.svelte';
18
+ import CopyButton from './components/CopyButton.svelte';
19
+ export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "papercss",
9
9
  "components"
10
10
  ],
11
- "version": "0.3.6",
11
+ "version": "0.4.6",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/Oli8/spaper.git"
@@ -31,6 +31,7 @@
31
31
  "./components/Card.svelte": "./components/Card.svelte",
32
32
  "./components/CloseButton.svelte": "./components/CloseButton.svelte",
33
33
  "./components/Collapsible.svelte": "./components/Collapsible.svelte",
34
+ "./components/CopyButton.svelte": "./components/CopyButton.svelte",
34
35
  "./components/Form/Checkbox.svelte": "./components/Form/Checkbox.svelte",
35
36
  "./components/Form/Form.svelte": "./components/Form/Form.svelte",
36
37
  "./components/Form/Input.svelte": "./components/Form/Input.svelte",