@mythrantic/svelte-rich-text 0.2.8
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 +289 -0
- package/dist/components/core/blockWrapper.svelte +88 -0
- package/dist/components/core/blockWrapper.svelte.d.ts +19 -0
- package/dist/components/core/editMode.svelte +95 -0
- package/dist/components/core/editMode.svelte.d.ts +16 -0
- package/dist/components/core/main.svelte +196 -0
- package/dist/components/core/main.svelte.d.ts +65 -0
- package/dist/components/core/toolBar.svelte +141 -0
- package/dist/components/core/toolBar.svelte.d.ts +16 -0
- package/dist/components/core/viewMode.svelte +28 -0
- package/dist/components/core/viewMode.svelte.d.ts +25 -0
- package/dist/components/editBlocks/code.svelte +68 -0
- package/dist/components/editBlocks/code.svelte.d.ts +24 -0
- package/dist/components/editBlocks/header.svelte +66 -0
- package/dist/components/editBlocks/header.svelte.d.ts +23 -0
- package/dist/components/editBlocks/img.svelte +47 -0
- package/dist/components/editBlocks/img.svelte.d.ts +24 -0
- package/dist/components/editBlocks/list.svelte +102 -0
- package/dist/components/editBlocks/list.svelte.d.ts +23 -0
- package/dist/components/editBlocks/paragraph.svelte +22 -0
- package/dist/components/editBlocks/paragraph.svelte.d.ts +26 -0
- package/dist/components/editBlocks/quote.svelte +57 -0
- package/dist/components/editBlocks/quote.svelte.d.ts +23 -0
- package/dist/components/editBlocks/space.svelte +24 -0
- package/dist/components/editBlocks/space.svelte.d.ts +22 -0
- package/dist/components/extra/dropDown.svelte +117 -0
- package/dist/components/extra/dropDown.svelte.d.ts +23 -0
- package/dist/components/extra/input.svelte +63 -0
- package/dist/components/extra/input.svelte.d.ts +21 -0
- package/dist/components/extra/select.svelte +50 -0
- package/dist/components/extra/select.svelte.d.ts +30 -0
- package/dist/components/extra/textarea.svelte +40 -0
- package/dist/components/extra/textarea.svelte.d.ts +21 -0
- package/dist/components/extra/upload.svelte +79 -0
- package/dist/components/extra/upload.svelte.d.ts +21 -0
- package/dist/components/icons/closeIcon.svelte +6 -0
- package/dist/components/icons/closeIcon.svelte.d.ts +25 -0
- package/dist/components/icons/closeQuoteIcon.svelte +9 -0
- package/dist/components/icons/closeQuoteIcon.svelte.d.ts +25 -0
- package/dist/components/icons/codeIcon.svelte +12 -0
- package/dist/components/icons/codeIcon.svelte.d.ts +25 -0
- package/dist/components/icons/copyIcon.svelte +12 -0
- package/dist/components/icons/copyIcon.svelte.d.ts +25 -0
- package/dist/components/icons/deleteIcon.svelte +12 -0
- package/dist/components/icons/deleteIcon.svelte.d.ts +25 -0
- package/dist/components/icons/doneIcon.svelte +17 -0
- package/dist/components/icons/doneIcon.svelte.d.ts +25 -0
- package/dist/components/icons/downIcon.svelte +12 -0
- package/dist/components/icons/downIcon.svelte.d.ts +25 -0
- package/dist/components/icons/headerIcon.svelte +12 -0
- package/dist/components/icons/headerIcon.svelte.d.ts +25 -0
- package/dist/components/icons/imageIcon.svelte +12 -0
- package/dist/components/icons/imageIcon.svelte.d.ts +25 -0
- package/dist/components/icons/listIcon.svelte +12 -0
- package/dist/components/icons/listIcon.svelte.d.ts +25 -0
- package/dist/components/icons/menuIcon.svelte +12 -0
- package/dist/components/icons/menuIcon.svelte.d.ts +25 -0
- package/dist/components/icons/openQuoteIcon.svelte +9 -0
- package/dist/components/icons/openQuoteIcon.svelte.d.ts +25 -0
- package/dist/components/icons/paragraphIcon.svelte +12 -0
- package/dist/components/icons/paragraphIcon.svelte.d.ts +25 -0
- package/dist/components/icons/plusIcon.svelte +3 -0
- package/dist/components/icons/plusIcon.svelte.d.ts +25 -0
- package/dist/components/icons/spaceIcon.svelte +9 -0
- package/dist/components/icons/spaceIcon.svelte.d.ts +25 -0
- package/dist/components/icons/upIcon.svelte +12 -0
- package/dist/components/icons/upIcon.svelte.d.ts +25 -0
- package/dist/components/icons/uploadIcon.svelte +9 -0
- package/dist/components/icons/uploadIcon.svelte.d.ts +25 -0
- package/dist/components/viewBlocks/viewCode.svelte +150 -0
- package/dist/components/viewBlocks/viewCode.svelte.d.ts +20 -0
- package/dist/components/viewBlocks/viewHeader.svelte +13 -0
- package/dist/components/viewBlocks/viewHeader.svelte.d.ts +19 -0
- package/dist/components/viewBlocks/viewImage.svelte +35 -0
- package/dist/components/viewBlocks/viewImage.svelte.d.ts +20 -0
- package/dist/components/viewBlocks/viewList.svelte +69 -0
- package/dist/components/viewBlocks/viewList.svelte.d.ts +19 -0
- package/dist/components/viewBlocks/viewParagraph.svelte +12 -0
- package/dist/components/viewBlocks/viewParagraph.svelte.d.ts +18 -0
- package/dist/components/viewBlocks/viewQuote.svelte +29 -0
- package/dist/components/viewBlocks/viewQuote.svelte.d.ts +19 -0
- package/dist/components/viewBlocks/viewSpace.svelte +4 -0
- package/dist/components/viewBlocks/viewSpace.svelte.d.ts +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -0
- package/dist/utils/consts.d.ts +96 -0
- package/dist/utils/consts.js +1 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/functions.js +12 -0
- package/dist/utils/stores.d.ts +6 -0
- package/dist/utils/stores.js +3 -0
- package/package.json +107 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type ComponentType } from 'svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
content: {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
active?: boolean;
|
|
9
|
+
id: string;
|
|
10
|
+
view?: ComponentType<SvelteComponent<{
|
|
11
|
+
text: string;
|
|
12
|
+
}>>;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
exports?: {};
|
|
19
|
+
bindings?: string;
|
|
20
|
+
};
|
|
21
|
+
export type ParagraphProps = typeof __propDef.props;
|
|
22
|
+
export type ParagraphEvents = typeof __propDef.events;
|
|
23
|
+
export type ParagraphSlots = typeof __propDef.slots;
|
|
24
|
+
export default class Paragraph extends SvelteComponent<ParagraphProps, ParagraphEvents, ParagraphSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>import { SvelteComponent, getContext } from "svelte";
|
|
2
|
+
import Input from "../extra/input.svelte";
|
|
3
|
+
import Textarea from "../extra/textarea.svelte";
|
|
4
|
+
import { updateData } from "../../utils/functions";
|
|
5
|
+
export let content;
|
|
6
|
+
export let id;
|
|
7
|
+
export let active = false;
|
|
8
|
+
const view = getContext("Quote");
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if active}
|
|
12
|
+
<div class="quoteEdit">
|
|
13
|
+
<Input
|
|
14
|
+
value={content.owner}
|
|
15
|
+
label="The Quote owner"
|
|
16
|
+
changeHandler={(textContent) => {
|
|
17
|
+
updateData(id, (prev) => {
|
|
18
|
+
if (prev.name == 'quote') prev.data.owner = textContent;
|
|
19
|
+
});
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
<div>
|
|
23
|
+
<span>The quote</span>
|
|
24
|
+
<Textarea
|
|
25
|
+
textContent={content.text}
|
|
26
|
+
textLevel={0}
|
|
27
|
+
changeHandler={(textContent) => {
|
|
28
|
+
updateData(id, (prev) => {
|
|
29
|
+
if (prev.name == 'quote') prev.data.text = textContent;
|
|
30
|
+
});
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
{:else}
|
|
36
|
+
<svelte:component this={view} {...content} />
|
|
37
|
+
{/if}
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.quoteEdit {
|
|
41
|
+
width: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: 15px;
|
|
45
|
+
}
|
|
46
|
+
.quoteEdit div {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 5px;
|
|
50
|
+
color: var(-textColor);
|
|
51
|
+
}
|
|
52
|
+
.quoteEdit div span {
|
|
53
|
+
margin-left: 10px;
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
font-size: var(--small);
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
content: {
|
|
5
|
+
text: string;
|
|
6
|
+
owner: string;
|
|
7
|
+
};
|
|
8
|
+
id: string;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
exports?: {};
|
|
16
|
+
bindings?: string;
|
|
17
|
+
};
|
|
18
|
+
export type QuoteProps = typeof __propDef.props;
|
|
19
|
+
export type QuoteEvents = typeof __propDef.events;
|
|
20
|
+
export type QuoteSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Quote extends SvelteComponent<QuoteProps, QuoteEvents, QuoteSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>import { updateData } from "../../utils/functions";
|
|
2
|
+
import Input from "../extra/input.svelte";
|
|
3
|
+
import ViewSpace from "../viewBlocks/viewSpace.svelte";
|
|
4
|
+
export let content;
|
|
5
|
+
export let id;
|
|
6
|
+
export let active = false;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#if active}
|
|
10
|
+
<div class="spaceEdit">
|
|
11
|
+
<Input
|
|
12
|
+
label="Space Block size"
|
|
13
|
+
type="number"
|
|
14
|
+
value="16"
|
|
15
|
+
changeHandler={(val) => {
|
|
16
|
+
updateData(id, (el) => {
|
|
17
|
+
if (el.name == 'space') el.data.size = parseInt(val);
|
|
18
|
+
});
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
{:else}
|
|
23
|
+
<ViewSpace size={content.size} />
|
|
24
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
content: {
|
|
5
|
+
size: number;
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
exports?: {};
|
|
15
|
+
bindings?: string;
|
|
16
|
+
};
|
|
17
|
+
export type SpaceProps = typeof __propDef.props;
|
|
18
|
+
export type SpaceEvents = typeof __propDef.events;
|
|
19
|
+
export type SpaceSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Space extends SvelteComponent<SpaceProps, SpaceEvents, SpaceSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script>import MenuIcon from "../icons/menuIcon.svelte";
|
|
2
|
+
import CloseIcon from "../icons/closeIcon.svelte";
|
|
3
|
+
export let options = [];
|
|
4
|
+
let dialog = null;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
8
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
9
|
+
<span
|
|
10
|
+
class="openMenu"
|
|
11
|
+
on:click|stopPropagation={() => {
|
|
12
|
+
dialog.showModal();
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<MenuIcon />
|
|
16
|
+
</span>
|
|
17
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
18
|
+
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
19
|
+
<dialog
|
|
20
|
+
bind:this={dialog}
|
|
21
|
+
on:click={(e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
<div class="dropDown">
|
|
26
|
+
<div class="label">
|
|
27
|
+
<MenuIcon />
|
|
28
|
+
<span>Menu</span>
|
|
29
|
+
</div>
|
|
30
|
+
{#each options as option}
|
|
31
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
32
|
+
<div
|
|
33
|
+
class="option"
|
|
34
|
+
on:click={() => {
|
|
35
|
+
option.cb();
|
|
36
|
+
dialog.close();
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<svelte:component this={option.icon} />
|
|
40
|
+
<span>{option.label}</span>
|
|
41
|
+
</div>
|
|
42
|
+
{/each}
|
|
43
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
44
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
45
|
+
<div
|
|
46
|
+
class="option"
|
|
47
|
+
on:click|stopPropagation={() => {
|
|
48
|
+
dialog.close();
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<CloseIcon />
|
|
52
|
+
<span>Close menu</span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</dialog>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
dialog {
|
|
59
|
+
border: none;
|
|
60
|
+
outline: none;
|
|
61
|
+
top: 50%;
|
|
62
|
+
left: 50%;
|
|
63
|
+
translate: -50% -50%;
|
|
64
|
+
background-color: var(--bgColor);
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
border: 2px solid var(--textColor);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
dialog::backdrop {
|
|
70
|
+
background: color-mix(in srgb, gray 70%, white 0%);
|
|
71
|
+
}
|
|
72
|
+
.openMenu {
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.openMenu :global(svg) {
|
|
77
|
+
width: 36px;
|
|
78
|
+
height: 36px;
|
|
79
|
+
}
|
|
80
|
+
.label {
|
|
81
|
+
border-bottom: 1px solid var(--textColor);
|
|
82
|
+
}
|
|
83
|
+
.dropDown {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: 2px;
|
|
87
|
+
padding-inline: 8px;
|
|
88
|
+
padding-block: 4px;
|
|
89
|
+
min-width: 18rem;
|
|
90
|
+
max-width: 25rem;
|
|
91
|
+
}
|
|
92
|
+
.dropDown div {
|
|
93
|
+
width: 100%;
|
|
94
|
+
padding-left: 3px;
|
|
95
|
+
padding-block: 8px;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 5px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
.dropDown span {
|
|
102
|
+
text-transform: capitalize;
|
|
103
|
+
color: var(--textColor);
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
}
|
|
106
|
+
.dropDown :global(svg) {
|
|
107
|
+
width: 20px;
|
|
108
|
+
height: 20px;
|
|
109
|
+
}
|
|
110
|
+
.dropDown .option :global(path) {
|
|
111
|
+
fill: var(--primaryColor);
|
|
112
|
+
}
|
|
113
|
+
.dropDown .option:hover {
|
|
114
|
+
background-color: color-mix(in srgb, var(--primaryColor) 38%, white 0%);
|
|
115
|
+
border-radius: 4px;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ComponentType } from 'svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
options?: {
|
|
6
|
+
icon: ComponentType<SvelteComponent>;
|
|
7
|
+
label: string;
|
|
8
|
+
cb: () => void;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
exports?: {};
|
|
16
|
+
bindings?: string;
|
|
17
|
+
};
|
|
18
|
+
export type DropDownProps = typeof __propDef.props;
|
|
19
|
+
export type DropDownEvents = typeof __propDef.events;
|
|
20
|
+
export type DropDownSlots = typeof __propDef.slots;
|
|
21
|
+
export default class DropDown extends SvelteComponent<DropDownProps, DropDownEvents, DropDownSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script>export let value = "";
|
|
2
|
+
export let label = "";
|
|
3
|
+
export let type = "text";
|
|
4
|
+
export let changeHandler;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="input-container">
|
|
8
|
+
<label for="custom-input">{label}</label>
|
|
9
|
+
<div>
|
|
10
|
+
<input
|
|
11
|
+
{type}
|
|
12
|
+
{value}
|
|
13
|
+
placeholder="Enter the {label.toLowerCase()}"
|
|
14
|
+
class="custom-input"
|
|
15
|
+
on:input={(e) => changeHandler(e.currentTarget.value)}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.input-container {
|
|
22
|
+
width: 65%;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
gap: 15px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.input-container label {
|
|
30
|
+
font-size: var(--small);
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
margin-left: 10px;
|
|
33
|
+
color: var(--textColor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input-container div {
|
|
37
|
+
padding: 2px;
|
|
38
|
+
border-radius: 0.4rem;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
box-shadow: 2px 2px 5px 5px color-mix(in srgb, var(--textColor) 28%, white 0%);
|
|
43
|
+
}
|
|
44
|
+
.input-container div:hover {
|
|
45
|
+
border: 3px solid var(--secondaryColor);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.custom-input {
|
|
49
|
+
width: 100%;
|
|
50
|
+
padding-left: 8px;
|
|
51
|
+
padding-block: 10px;
|
|
52
|
+
font-size: var(--body);
|
|
53
|
+
color: var(--textColor);
|
|
54
|
+
border: 1px solid var(--secondaryColor);
|
|
55
|
+
border-radius: 0.4rem;
|
|
56
|
+
outline: none;
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
.custom-input[type='number']::-webkit-outer-spin-button,
|
|
60
|
+
.custom-input::-webkit-inner-spin-button {
|
|
61
|
+
-webkit-appearance: none;
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
type?: "text" | "number";
|
|
7
|
+
changeHandler: (text: string) => void;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
exports?: {};
|
|
14
|
+
bindings?: string;
|
|
15
|
+
};
|
|
16
|
+
export type InputProps = typeof __propDef.props;
|
|
17
|
+
export type InputEvents = typeof __propDef.events;
|
|
18
|
+
export type InputSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Input extends SvelteComponent<InputProps, InputEvents, InputSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script>import Select from "svelte-select";
|
|
2
|
+
export let label;
|
|
3
|
+
export let elements;
|
|
4
|
+
export let changeHandler;
|
|
5
|
+
export let preSelected;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="select">
|
|
9
|
+
<span>{label}</span>
|
|
10
|
+
<Select
|
|
11
|
+
value={preSelected}
|
|
12
|
+
placeholder={'Select a ' + label}
|
|
13
|
+
items={elements}
|
|
14
|
+
showChevron={true}
|
|
15
|
+
hideEmptyState={true}
|
|
16
|
+
clearable={false}
|
|
17
|
+
--background={'transparent'}
|
|
18
|
+
--chevron-color={'var(--fontColor)'}
|
|
19
|
+
--item-color={'var(--fontColor)'}
|
|
20
|
+
--item-first-border-radius={'0'}
|
|
21
|
+
--input-color={'var(--fontColor)'}
|
|
22
|
+
--item-hover-bg={'color-mix(in srgb , var(--secondaryColor) 70%, white 0%)'}
|
|
23
|
+
--item-is-active-color={'var(--fontColor)'}
|
|
24
|
+
--item-is-active-bg={'var(--secondaryColor)'}
|
|
25
|
+
--list-border={'1px solid var(--secondaryColor)'}
|
|
26
|
+
--border={'2px solid var(--secondaryColor)'}
|
|
27
|
+
--border-focused={'2px solid var(--secondaryColor)'}
|
|
28
|
+
--border-hover={'2px solid var(--secondaryColor)'}
|
|
29
|
+
--clear-icon-color={'var(--fontColor)'}
|
|
30
|
+
on:change={(event) => {
|
|
31
|
+
changeHandler(event.detail);
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.select {
|
|
38
|
+
width: 50%;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: stretch;
|
|
42
|
+
gap: 15px;
|
|
43
|
+
}
|
|
44
|
+
.select span {
|
|
45
|
+
font-size: var(--small);
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
margin-left: 10px;
|
|
48
|
+
color: var(--textColor);
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
label: string;
|
|
5
|
+
elements: {
|
|
6
|
+
label: string;
|
|
7
|
+
value: any;
|
|
8
|
+
}[];
|
|
9
|
+
changeHandler: (item: {
|
|
10
|
+
value: any;
|
|
11
|
+
label: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
preSelected: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: any;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
exports?: {};
|
|
23
|
+
bindings?: string;
|
|
24
|
+
};
|
|
25
|
+
export type SelectProps = typeof __propDef.props;
|
|
26
|
+
export type SelectEvents = typeof __propDef.events;
|
|
27
|
+
export type SelectSlots = typeof __propDef.slots;
|
|
28
|
+
export default class Select extends SvelteComponent<SelectProps, SelectEvents, SelectSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>export let changeHandler;
|
|
2
|
+
export let textContent = "";
|
|
3
|
+
export let textLevel = 0;
|
|
4
|
+
export let width = 100;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="areaWrapper" style:width={`${width}%`}>
|
|
8
|
+
<span
|
|
9
|
+
style:font-size="var(--{textLevel == 0 ? 'body' : 'h' + textLevel})"
|
|
10
|
+
style:font-weight={textLevel == 0 ? '400' : 'bold'}
|
|
11
|
+
style:line-height="var(--l{textLevel == 0 ? 'body' : 'h'})"
|
|
12
|
+
style:font-family={textLevel == 0 ? 'var(--bodyFont)' : 'var(--headingFont)'}
|
|
13
|
+
class="editableArea"
|
|
14
|
+
contenteditable="plaintext-only"
|
|
15
|
+
bind:textContent
|
|
16
|
+
on:input={(e) => {
|
|
17
|
+
changeHandler(e.currentTarget.textContent);
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
{textContent}
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.areaWrapper {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
min-height: 2rem;
|
|
29
|
+
border-left: 6px solid var(--secondaryColor);
|
|
30
|
+
padding-left: 8px !important;
|
|
31
|
+
cursor: auto;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
.editableArea {
|
|
35
|
+
width: 100%;
|
|
36
|
+
color: var(--textColor);
|
|
37
|
+
border: none;
|
|
38
|
+
outline: none;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
changeHandler: (data: string) => void;
|
|
5
|
+
textContent?: string;
|
|
6
|
+
textLevel?: 0 | 1 | 2 | 3 | 4;
|
|
7
|
+
width?: number;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
exports?: {};
|
|
14
|
+
bindings?: string;
|
|
15
|
+
};
|
|
16
|
+
export type TextareaProps = typeof __propDef.props;
|
|
17
|
+
export type TextareaEvents = typeof __propDef.events;
|
|
18
|
+
export type TextareaSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Textarea extends SvelteComponent<TextareaProps, TextareaEvents, TextareaSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script>import UploadIcon from "../icons/uploadIcon.svelte";
|
|
2
|
+
export let label = "";
|
|
3
|
+
export let changeHandler;
|
|
4
|
+
export let fileType = "image/*";
|
|
5
|
+
export let currentFileName = "default.png";
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="input-container">
|
|
9
|
+
<span>{label}</span>
|
|
10
|
+
<input
|
|
11
|
+
type="file"
|
|
12
|
+
id="custom-input"
|
|
13
|
+
class="custom-input"
|
|
14
|
+
accept={fileType}
|
|
15
|
+
on:change={(e) => {
|
|
16
|
+
const file = e.currentTarget.files[0];
|
|
17
|
+
if (file) {
|
|
18
|
+
const reader = new FileReader();
|
|
19
|
+
reader.onload = () => {
|
|
20
|
+
changeHandler(reader.result.toString(), file.name);
|
|
21
|
+
currentFileName = file.name;
|
|
22
|
+
};
|
|
23
|
+
reader.readAsDataURL(file);
|
|
24
|
+
}
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
<div class="inputReplace">
|
|
28
|
+
<label class="uploadBtn" for="custom-input">
|
|
29
|
+
<span>Upload a file</span>
|
|
30
|
+
<UploadIcon />
|
|
31
|
+
</label>
|
|
32
|
+
<span>{currentFileName}</span>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.input-container {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: 15px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input-container span,
|
|
44
|
+
.input-container label {
|
|
45
|
+
color: var(--textColor);
|
|
46
|
+
font-size: var(--body);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.input-container span:first-child {
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
margin-left: 10px;
|
|
52
|
+
font-size: var(--small);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.inputReplace {
|
|
56
|
+
width: fit-content;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 20px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.custom-input {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
.uploadBtn {
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 5px;
|
|
70
|
+
border: 2px solid var(--secondaryColor);
|
|
71
|
+
padding-inline: 8px;
|
|
72
|
+
padding-block: 10px;
|
|
73
|
+
border-radius: 0.5rem;
|
|
74
|
+
box-shadow: 2px 2px 5px 5px color-mix(in srgb, var(--textColor) 28%, white 0%);
|
|
75
|
+
}
|
|
76
|
+
.uploadBtn span {
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
label?: string;
|
|
5
|
+
changeHandler: (base64: string, fileName: string) => void;
|
|
6
|
+
fileType?: "image/*" | ".pdf";
|
|
7
|
+
currentFileName?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
exports?: {};
|
|
14
|
+
bindings?: string;
|
|
15
|
+
};
|
|
16
|
+
export type UploadProps = typeof __propDef.props;
|
|
17
|
+
export type UploadEvents = typeof __propDef.events;
|
|
18
|
+
export type UploadSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Upload extends SvelteComponent<UploadProps, UploadEvents, UploadSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} CloseIconProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} CloseIconEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} CloseIconSlots */
|
|
4
|
+
export default class CloseIcon extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type CloseIconProps = typeof __propDef.props;
|
|
11
|
+
export type CloseIconEvents = typeof __propDef.events;
|
|
12
|
+
export type CloseIconSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
exports?: {};
|
|
23
|
+
bindings?: string;
|
|
24
|
+
};
|
|
25
|
+
export {};
|