spaper 0.3.6 → 0.6.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 +29 -0
- package/components/Article.svelte +2 -1
- package/components/Article.svelte.d.ts +1 -0
- package/components/Badge.svelte +3 -1
- package/components/Badge.svelte.d.ts +1 -0
- package/components/Breadcrumb.svelte +3 -1
- package/components/Breadcrumb.svelte.d.ts +1 -0
- package/components/Button.svelte +4 -2
- package/components/Button.svelte.d.ts +1 -0
- package/components/Card.svelte +2 -1
- package/components/Card.svelte.d.ts +1 -0
- package/components/CopyButton.svelte +43 -0
- package/components/CopyButton.svelte.d.ts +24 -0
- package/components/Form/Checkbox.svelte +2 -1
- package/components/Form/Checkbox.svelte.d.ts +1 -0
- package/components/Form/Slider.svelte +5 -5
- package/components/Form/Switch.svelte +2 -1
- package/components/Modal/Modal.svelte +9 -2
- package/components/Modal/Modal.svelte.d.ts +3 -0
- package/components/Navbar.svelte +2 -1
- package/components/Popover.svelte +2 -1
- package/components/Progress.svelte +2 -1
- package/components/Table.svelte +3 -3
- package/components/Tabs/Tab.svelte +9 -2
- package/components/Tabs/Tab.svelte.d.ts +1 -0
- package/components/Tabs/Tabs.svelte +9 -2
- package/components/Tabs/index.d.ts +1 -0
- package/components/Tabs/index.js +3 -0
- package/components/Toast/ToastContainer.svelte +1 -1
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -51,6 +51,33 @@ npm i spaper
|
|
|
51
51
|
|
|
52
52
|
<hr />
|
|
53
53
|
|
|
54
|
+
### Sponsors
|
|
55
|
+
|
|
56
|
+
Thanks to these generous people! :heart:
|
|
57
|
+
|
|
58
|
+
<table>
|
|
59
|
+
<tr>
|
|
60
|
+
<td align="center">
|
|
61
|
+
<a href="https://github.com/mehdi-dalil">
|
|
62
|
+
<img src="https://avatars.githubusercontent.com/u/65339771?v=4" width="80px;" alt=""/><br />
|
|
63
|
+
<sub><b>mehdi-dalil</b></sub>
|
|
64
|
+
</a>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Donate
|
|
71
|
+
|
|
72
|
+
Any donation is greatly appreciated :heart:
|
|
73
|
+
|
|
74
|
+
| Source | Link / Address |
|
|
75
|
+
| :-------------- | :------------------------------------------|
|
|
76
|
+
| Github Sponsor | https://github.com/sponsors/Oli8 |
|
|
77
|
+
| PayPal | https://paypal.me/OliCrt |
|
|
78
|
+
| Bitcoin | 1Ez3Ts2WShUcbeGCjhZapdxVDK77DbYjdU |
|
|
79
|
+
| Ethereum | 0x6cd3d316a6ee6d210894981e1fcc83a00a27ede2 |
|
|
80
|
+
|
|
54
81
|
#### Components
|
|
55
82
|
|
|
56
83
|
- Alert
|
|
@@ -59,7 +86,9 @@ npm i spaper
|
|
|
59
86
|
- Breadcrumb
|
|
60
87
|
- Button
|
|
61
88
|
- Card
|
|
89
|
+
- CloseButton
|
|
62
90
|
- Collapsible
|
|
91
|
+
- CopyButton
|
|
63
92
|
- Form
|
|
64
93
|
- Checkbox
|
|
65
94
|
- Input
|
package/components/Badge.svelte
CHANGED
package/components/Button.svelte
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
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 />
|
|
9
9
|
</a>
|
|
10
10
|
{:else}
|
|
11
11
|
<button {...attr}
|
|
12
|
+
type={nativeType}
|
|
12
13
|
class:disabled
|
|
13
14
|
disabled={disabled}
|
|
14
15
|
on:click>
|
|
@@ -24,8 +25,9 @@ export let size = 'default';
|
|
|
24
25
|
export let block = false;
|
|
25
26
|
export let disabled = false;
|
|
26
27
|
export let outline = null;
|
|
28
|
+
export let nativeType = null;
|
|
27
29
|
export let isLink = false;
|
|
28
|
-
export let href =
|
|
30
|
+
export let href = null;
|
|
29
31
|
export let external = false;
|
|
30
32
|
let attr;
|
|
31
33
|
$: {
|
package/components/Card.svelte
CHANGED
|
@@ -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 {};
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
bind:this={rangeEl}
|
|
11
11
|
bind:value
|
|
12
12
|
class={classes}
|
|
13
|
-
{min} {max} {step}
|
|
14
|
-
on:input={updateOutput} />
|
|
13
|
+
{min} {max} {step} />
|
|
15
14
|
{#if !hideValue}
|
|
16
15
|
<output>
|
|
17
16
|
{#if $$slots.output}
|
|
@@ -42,11 +41,12 @@ let outputValue;
|
|
|
42
41
|
onMount(() => {
|
|
43
42
|
outputValue = rangeEl.value;
|
|
44
43
|
});
|
|
45
|
-
function updateOutput({ target }) {
|
|
46
|
-
outputValue = target.value;
|
|
47
|
-
}
|
|
48
44
|
let classes;
|
|
49
45
|
$: classes = `range-${background} ${computeClasses('input', { block })}`;
|
|
46
|
+
// need to react to programmatic change to `value` as well as slider variations
|
|
47
|
+
$: if (value !== null) {
|
|
48
|
+
outputValue = String(value);
|
|
49
|
+
}
|
|
50
50
|
$: if (percentage) {
|
|
51
51
|
outputValue = String(Math.round(Number(outputValue) / Number(max) * 100));
|
|
52
52
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<svelte:window on:keydown={handleKeydown} />
|
|
2
2
|
|
|
3
|
-
<div
|
|
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}
|
|
@@ -23,12 +25,14 @@
|
|
|
23
25
|
</div>
|
|
24
26
|
</div>
|
|
25
27
|
|
|
26
|
-
<script >import
|
|
28
|
+
<script >import { createEventDispatcher } from 'svelte';
|
|
29
|
+
import Button from '../Button.svelte';
|
|
27
30
|
import CloseButton from '../CloseButton.svelte';
|
|
28
31
|
export let active = false;
|
|
29
32
|
export let title = '';
|
|
30
33
|
export let subTitle = '';
|
|
31
34
|
export let closeBtnText = 'Close';
|
|
35
|
+
const dispatch = createEventDispatcher();
|
|
32
36
|
function close() {
|
|
33
37
|
active = false;
|
|
34
38
|
}
|
|
@@ -36,6 +40,9 @@ function handleKeydown({ key }) {
|
|
|
36
40
|
if (key === 'Escape')
|
|
37
41
|
close();
|
|
38
42
|
}
|
|
43
|
+
$: if (active === false) {
|
|
44
|
+
dispatch('close');
|
|
45
|
+
}
|
|
39
46
|
</script>
|
|
40
47
|
|
|
41
48
|
<style >.modal.active {
|
|
@@ -1,12 +1,15 @@
|
|
|
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;
|
|
7
8
|
closeBtnText?: string;
|
|
8
9
|
};
|
|
9
10
|
events: {
|
|
11
|
+
close: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
10
13
|
[evt: string]: CustomEvent<any>;
|
|
11
14
|
};
|
|
12
15
|
slots: {
|
package/components/Navbar.svelte
CHANGED
package/components/Table.svelte
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} content margin"
|
|
2
3
|
class:content--active={active}
|
|
3
|
-
|
|
4
|
+
id={controlLabel}
|
|
5
|
+
aria-hidden={!active}
|
|
6
|
+
aria-labelledby={controlLabel}
|
|
7
|
+
role="tabpanel"
|
|
8
|
+
tabindex={active ? 0 : -1}>
|
|
4
9
|
{#if $$slots.header}
|
|
5
10
|
<div bind:this={header}
|
|
6
11
|
style="display: none">
|
|
@@ -12,6 +17,7 @@
|
|
|
12
17
|
|
|
13
18
|
<script >import { onMount, getContext } from 'svelte';
|
|
14
19
|
;
|
|
20
|
+
import { genControlLabel } from './index';
|
|
15
21
|
export let label;
|
|
16
22
|
const key = {};
|
|
17
23
|
let active = false;
|
|
@@ -32,6 +38,7 @@ onMount(() => {
|
|
|
32
38
|
}
|
|
33
39
|
]);
|
|
34
40
|
});
|
|
41
|
+
$: controlLabel = genControlLabel(label);
|
|
35
42
|
</script>
|
|
36
43
|
|
|
37
44
|
<style>
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
<div
|
|
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}
|
|
5
|
+
{@const selected = index == activeTab}
|
|
4
6
|
<div class="tabs-label-header"
|
|
5
|
-
class:tabs-label-header--active={
|
|
7
|
+
class:tabs-label-header--active={selected}
|
|
8
|
+
aria-selected={selected}
|
|
9
|
+
aria-controls={genControlLabel(label)}
|
|
10
|
+
role="tab"
|
|
11
|
+
tabindex={selected ? 0 : -1}
|
|
6
12
|
on:click={showContent.bind(null, index)}>
|
|
7
13
|
{#if header}
|
|
8
14
|
{@html header.innerHTML}
|
|
@@ -19,6 +25,7 @@
|
|
|
19
25
|
import { writable } from 'svelte/store';
|
|
20
26
|
;
|
|
21
27
|
;
|
|
28
|
+
import { genControlLabel } from './index';
|
|
22
29
|
export let activeTab = 0;
|
|
23
30
|
export let placement = 'spaces';
|
|
24
31
|
export let contentAlign = 'left';
|
package/components/Tabs/index.js
CHANGED
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
|
-
|
|
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
|
-
|
|
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.
|
|
11
|
+
"version": "0.6.6",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git+https://github.com/Oli8/spaper.git"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/Oli8/spaper#readme",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"papercss": "^1.8.
|
|
21
|
+
"papercss": "^1.8.2"
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
@@ -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",
|
|
@@ -62,4 +63,4 @@
|
|
|
62
63
|
"./utils": "./utils.js"
|
|
63
64
|
},
|
|
64
65
|
"svelte": "./index.js"
|
|
65
|
-
}
|
|
66
|
+
}
|