@websline/system-components 1.3.4 → 1.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/dist/components/atoms/checkbox/Checkbox.svelte +1 -1
- package/dist/components/atoms/chip/Chip.svelte +4 -3
- package/dist/components/atoms/chip/chip.variants.d.ts +15 -15
- package/dist/components/atoms/chip/chip.variants.js +48 -29
- package/dist/components/atoms/icon/components/AiStars.svelte +29 -0
- package/dist/components/atoms/icon/components/AiStars.svelte.d.ts +33 -0
- package/dist/components/atoms/icon/components/AlignBottom.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignBottom.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignBottomOne.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignBottomOne.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignCenter.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignCenter.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignCenterOne.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignCenterOne.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignLeft.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignLeft.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignMiddle.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignMiddle.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignMiddleOne.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignMiddleOne.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignRight.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignRight.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignRightOne.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignRightOne.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignTop.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignTop.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/AlignTopOne.svelte +27 -0
- package/dist/components/atoms/icon/components/AlignTopOne.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ArrowDown.svelte +13 -8
- package/dist/components/atoms/icon/components/ArrowUp.svelte +13 -8
- package/dist/components/atoms/icon/components/BoxIn.svelte +27 -0
- package/dist/components/atoms/icon/components/{Unlink.svelte.d.ts → BoxIn.svelte.d.ts} +3 -3
- package/dist/components/atoms/icon/components/BoxOut.svelte +27 -0
- package/dist/components/atoms/icon/components/BoxOut.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ChevronDoubleLeft.svelte +27 -0
- package/dist/components/atoms/icon/components/ChevronDoubleLeft.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ChevronDoubleRight.svelte +27 -0
- package/dist/components/atoms/icon/components/ChevronDoubleRight.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Clipboard.svelte +27 -0
- package/dist/components/atoms/icon/components/Clipboard.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Computer.svelte +26 -0
- package/dist/components/atoms/icon/components/Computer.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Connect.svelte +26 -0
- package/dist/components/atoms/icon/components/Connect.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ConnectCrossed.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ContactCard.svelte +27 -0
- package/dist/components/atoms/icon/components/ContactCard.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Crop.svelte +27 -0
- package/dist/components/atoms/icon/components/Crop.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Envelope.svelte +27 -0
- package/dist/components/atoms/icon/components/Envelope.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Envelopes.svelte +27 -0
- package/dist/components/atoms/icon/components/Envelopes.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Expand.svelte +27 -0
- package/dist/components/atoms/icon/components/Expand.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Eye.svelte +31 -0
- package/dist/components/atoms/icon/components/Eye.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/EyeCrossed.svelte +36 -0
- package/dist/components/atoms/icon/components/EyeCrossed.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Filter.svelte +27 -0
- package/dist/components/atoms/icon/components/Filter.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/FocalPoint.svelte +26 -0
- package/dist/components/atoms/icon/components/FocalPoint.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/FolderPlus.svelte +27 -0
- package/dist/components/atoms/icon/components/FolderPlus.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Funnel.svelte +26 -0
- package/dist/components/atoms/icon/components/Funnel.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Inbox.svelte +27 -0
- package/dist/components/atoms/icon/components/Inbox.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Intergration.svelte +27 -0
- package/dist/components/atoms/icon/components/Intergration.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/LinkAi.svelte +33 -0
- package/dist/components/atoms/icon/components/LinkAi.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ListTasks.svelte +27 -0
- package/dist/components/atoms/icon/components/ListTasks.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Lock.svelte +27 -0
- package/dist/components/atoms/icon/components/Lock.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Minus.svelte +27 -0
- package/dist/components/atoms/icon/components/Minus.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/PageEdit.svelte +27 -0
- package/dist/components/atoms/icon/components/PageEdit.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Pages.svelte +33 -0
- package/dist/components/atoms/icon/components/Pages.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Payment.svelte +27 -0
- package/dist/components/atoms/icon/components/Payment.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Pencil.svelte +27 -0
- package/dist/components/atoms/icon/components/Pencil.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Phone.svelte +26 -0
- package/dist/components/atoms/icon/components/Phone.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Plus.svelte +27 -0
- package/dist/components/atoms/icon/components/Plus.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Print.svelte +36 -0
- package/dist/components/atoms/icon/components/Print.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/RefreshCircle.svelte +27 -0
- package/dist/components/atoms/icon/components/RefreshCircle.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Replace.svelte +27 -0
- package/dist/components/atoms/icon/components/Replace.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Report.svelte +27 -0
- package/dist/components/atoms/icon/components/Report.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/SEO.svelte +33 -0
- package/dist/components/atoms/icon/components/SEO.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Shop.svelte +27 -0
- package/dist/components/atoms/icon/components/Shop.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Smartphone.svelte +26 -0
- package/dist/components/atoms/icon/components/Smartphone.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Sort.svelte +27 -0
- package/dist/components/atoms/icon/components/Sort.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Star.svelte +26 -0
- package/dist/components/atoms/icon/components/Star.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/StyleGuide.svelte +38 -0
- package/dist/components/atoms/icon/components/StyleGuide.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Tablet.svelte +26 -0
- package/dist/components/atoms/icon/components/Tablet.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Translate.svelte +27 -0
- package/dist/components/atoms/icon/components/Translate.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/TranslateCrossed.svelte +36 -0
- package/dist/components/atoms/icon/components/TranslateCrossed.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Width.svelte +27 -0
- package/dist/components/atoms/icon/components/Width.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/index.d.ts +6 -774
- package/dist/components/atoms/icon/index.js +43 -87
- package/dist/components/atoms/radio/Radio.svelte +1 -1
- package/dist/components/atoms/switch/Switch.svelte +1 -1
- package/dist/components/atoms/tag/Tag.svelte +47 -0
- package/dist/components/atoms/tag/Tag.svelte.d.ts +73 -0
- package/dist/components/atoms/tag/tag.variants.d.ts +58 -0
- package/dist/components/atoms/tag/tag.variants.js +32 -0
- package/dist/components/molecules/richTextEditor/RichTextEditor.svelte +50 -63
- package/dist/components/molecules/richTextEditor/RichTextEditor.svelte.d.ts +15 -135
- package/dist/components/molecules/richTextEditor/toolbar/RichTextEditorToolbar.svelte +10 -11
- package/dist/components/molecules/richTextEditor/toolbar/RichTextEditorToolbar.svelte.d.ts +0 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte +9 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte +7 -4
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte.d.ts +0 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte +9 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte +11 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte.d.ts +0 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte +9 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte +9 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte +2 -1
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte +9 -2
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte.d.ts +2 -7
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte +2 -1
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte.d.ts +2 -7
- package/dist/components/molecules/selectorCard/SelectorCard.svelte +1 -1
- package/dist/components/molecules/tagSelector/ValueList.svelte +5 -9
- package/dist/components/molecules/toggleGroup/ToggleGroup.svelte +21 -3
- package/dist/components/molecules/toggleGroup/ToggleGroup.svelte.d.ts +16 -0
- package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +5 -3
- package/dist/components/molecules/toggleGroup/toggleGroup.variants.d.ts +32 -13
- package/dist/components/molecules/toggleGroup/toggleGroup.variants.js +12 -0
- package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.d.ts +9 -0
- package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.js +8 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- /package/dist/components/atoms/icon/components/{Unlink.svelte → ConnectCrossed.svelte} +0 -0
|
@@ -1,89 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import Attach from "./components/Attach.svelte";
|
|
7
|
-
import Block from "./components/Block.svelte";
|
|
8
|
-
import Bold from "./components/Bold.svelte";
|
|
9
|
-
import Calendar from "./components/Calendar.svelte";
|
|
10
|
-
import Check from "./components/Check.svelte";
|
|
11
|
-
import CheckboxStack from "./components/CheckboxStack.svelte";
|
|
12
|
-
import ChevronDown from "./components/ChevronDown.svelte";
|
|
13
|
-
import Close from "./components/Close.svelte";
|
|
14
|
-
import CloseSmall from "./components/CloseSmall.svelte";
|
|
15
|
-
import Controlling from "./components/Controlling.svelte";
|
|
16
|
-
import Dashboard from "./components/Dashboard.svelte";
|
|
17
|
-
import Database from "./components/Database.svelte";
|
|
18
|
-
import Download from "./components/Download.svelte";
|
|
19
|
-
import Dragger from "./components/Dragger.svelte";
|
|
20
|
-
import FilePDF from "./components/FilePDF.svelte";
|
|
21
|
-
import Globe from "./components/Globe.svelte";
|
|
22
|
-
import History from "./components/History.svelte";
|
|
23
|
-
import Info from "./components/Info.svelte";
|
|
24
|
-
import Italic from "./components/Italic.svelte";
|
|
25
|
-
import Layout from "./components/Layout.svelte";
|
|
26
|
-
import Link from "./components/Link.svelte";
|
|
27
|
-
import ListOrdered from "./components/ListOrdered.svelte";
|
|
28
|
-
import ListUnordered from "./components/ListUnordered.svelte";
|
|
29
|
-
import Menu from "./components/Menu.svelte";
|
|
30
|
-
import Notifications from "./components/Notifications.svelte";
|
|
31
|
-
import Out from "./components/Out.svelte";
|
|
32
|
-
import Overflow from "./components/Overflow.svelte";
|
|
33
|
-
import Page from "./components/Page.svelte";
|
|
34
|
-
import Picture from "./components/Picture.svelte";
|
|
35
|
-
import Redo from "./components/Redo.svelte";
|
|
36
|
-
import Refresh from "./components/Refresh.svelte";
|
|
37
|
-
import Search from "./components/Search.svelte";
|
|
38
|
-
import Settings from "./components/Settings.svelte";
|
|
39
|
-
import Trash from "./components/Trash.svelte";
|
|
40
|
-
import Underline from "./components/Underline.svelte";
|
|
41
|
-
import Undo from "./components/Undo.svelte";
|
|
42
|
-
import Unlink from "./components/Unlink.svelte";
|
|
43
|
-
import WebslineSupport from "./components/WebslineSupport.svelte";
|
|
1
|
+
const moduleRegistry = import.meta.glob("./**/*.svelte", {
|
|
2
|
+
eager: true,
|
|
3
|
+
base: "./components",
|
|
4
|
+
import: "default",
|
|
5
|
+
});
|
|
44
6
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
layout: Layout,
|
|
71
|
-
link: Link,
|
|
72
|
-
listOrdered: ListOrdered,
|
|
73
|
-
listUnordered: ListUnordered,
|
|
74
|
-
menu: Menu,
|
|
75
|
-
notifications: Notifications,
|
|
76
|
-
out: Out,
|
|
77
|
-
overflow: Overflow,
|
|
78
|
-
page: Page,
|
|
79
|
-
picture: Picture,
|
|
80
|
-
redo: Redo,
|
|
81
|
-
refresh: Refresh,
|
|
82
|
-
search: Search,
|
|
83
|
-
settings: Settings,
|
|
84
|
-
trash: Trash,
|
|
85
|
-
underline: Underline,
|
|
86
|
-
undo: Undo,
|
|
87
|
-
unlink: Unlink,
|
|
88
|
-
webslineSupport: WebslineSupport,
|
|
7
|
+
// paths within the components folder are imported as component names automatically
|
|
8
|
+
// e.g. ./components/subDir/testIcon.svelte -> subDirTestIcon
|
|
9
|
+
// Check the icon story in Storybook to easily extract the icon name
|
|
10
|
+
const registry = Object.fromEntries(
|
|
11
|
+
Object.entries(moduleRegistry).map(([path, module]) => {
|
|
12
|
+
const name = path
|
|
13
|
+
// remove extension
|
|
14
|
+
.replace(/\.[^/.]+$/, "")
|
|
15
|
+
// squash any non-alphanumeric into single hyphen (handles underscores)
|
|
16
|
+
.replace(/[^a-zA-Z0-9]+/g, "-")
|
|
17
|
+
// replace "-" w/ uppercase of the following letter
|
|
18
|
+
.replace(/-([a-z])/g, (m, p1) => p1.toUpperCase())
|
|
19
|
+
// remove remaining "-"
|
|
20
|
+
.replaceAll("-", "")
|
|
21
|
+
// first letter lowercase
|
|
22
|
+
.replace(/^([A-Z])/, (m, p1) => p1.toLowerCase());
|
|
23
|
+
return [name, module];
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// e.g. for backwards compatibility
|
|
28
|
+
const synonyms = {
|
|
29
|
+
"checkbox-stack": "checkboxStack",
|
|
30
|
+
"file-pdf": "filePDF",
|
|
31
|
+
unlink: "connectCrossed",
|
|
89
32
|
};
|
|
33
|
+
|
|
34
|
+
// attach synonyms to registry, with error handling for duplicates
|
|
35
|
+
Object.entries(synonyms).map(([k, v]) => {
|
|
36
|
+
if (registry[k]) {
|
|
37
|
+
console.error(
|
|
38
|
+
`skipping synonym "${k}" because it already exists in the registry`,
|
|
39
|
+
);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
registry[k] = registry[v];
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export { registry, synonyms };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Icon } from "../../../index.js";
|
|
3
|
+
import { tagVariants } from "./tag.variants.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} Props
|
|
7
|
+
* @property {import('svelte').Snippet} [children] Content inside the tag – can be text, HTML, or Svelte components
|
|
8
|
+
* @property {string} [class=""] Additional CSS classes for the tag
|
|
9
|
+
* @property {string} [icon=""] Name of the icon to display
|
|
10
|
+
* @property {"start" | "end"} [iconPosition="start"] Position of the icon relative to the content
|
|
11
|
+
* @property {boolean} [selected=false] Whether the tag is in a visually selected state
|
|
12
|
+
* @property {"round" | "round-big"} [shape="round"] Shape of the tag
|
|
13
|
+
* @property {"small" | "big"} [size="small"] Size of the tag
|
|
14
|
+
* @property {"filled" | "outline"} [variant="filled"] Visual style of the tag
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** @type {Props} */
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
class: className,
|
|
21
|
+
icon = "",
|
|
22
|
+
iconPosition = "start",
|
|
23
|
+
selected = false,
|
|
24
|
+
shape = "round",
|
|
25
|
+
size = "small",
|
|
26
|
+
variant = "filled",
|
|
27
|
+
...rest
|
|
28
|
+
} = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<button
|
|
32
|
+
class={tagVariants({
|
|
33
|
+
class: className,
|
|
34
|
+
iconPosition,
|
|
35
|
+
selected,
|
|
36
|
+
shape,
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
})}
|
|
40
|
+
{...rest}>
|
|
41
|
+
{#if icon}
|
|
42
|
+
<Icon name={icon} size={14} />
|
|
43
|
+
{/if}
|
|
44
|
+
<span>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</span>
|
|
47
|
+
</button>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export default Tag;
|
|
2
|
+
type Tag = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Tag: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Content inside the tag – can be text, HTML, or Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes for the tag
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of the icon to display
|
|
17
|
+
*/
|
|
18
|
+
icon?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Position of the icon relative to the content
|
|
21
|
+
*/
|
|
22
|
+
iconPosition?: "start" | "end";
|
|
23
|
+
/**
|
|
24
|
+
* Whether the tag is in a visually selected state
|
|
25
|
+
*/
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Shape of the tag
|
|
29
|
+
*/
|
|
30
|
+
shape?: "round" | "round-big";
|
|
31
|
+
/**
|
|
32
|
+
* Size of the tag
|
|
33
|
+
*/
|
|
34
|
+
size?: "small" | "big";
|
|
35
|
+
/**
|
|
36
|
+
* Visual style of the tag
|
|
37
|
+
*/
|
|
38
|
+
variant?: "filled" | "outline";
|
|
39
|
+
}, {}, "">;
|
|
40
|
+
type Props = {
|
|
41
|
+
/**
|
|
42
|
+
* Content inside the tag – can be text, HTML, or Svelte components
|
|
43
|
+
*/
|
|
44
|
+
children?: import("svelte").Snippet;
|
|
45
|
+
/**
|
|
46
|
+
* Additional CSS classes for the tag
|
|
47
|
+
*/
|
|
48
|
+
class?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Name of the icon to display
|
|
51
|
+
*/
|
|
52
|
+
icon?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Position of the icon relative to the content
|
|
55
|
+
*/
|
|
56
|
+
iconPosition?: "start" | "end";
|
|
57
|
+
/**
|
|
58
|
+
* Whether the tag is in a visually selected state
|
|
59
|
+
*/
|
|
60
|
+
selected?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Shape of the tag
|
|
63
|
+
*/
|
|
64
|
+
shape?: "round" | "round-big";
|
|
65
|
+
/**
|
|
66
|
+
* Size of the tag
|
|
67
|
+
*/
|
|
68
|
+
size?: "small" | "big";
|
|
69
|
+
/**
|
|
70
|
+
* Visual style of the tag
|
|
71
|
+
*/
|
|
72
|
+
variant?: "filled" | "outline";
|
|
73
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const tagVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
iconPosition: {
|
|
3
|
+
end: string;
|
|
4
|
+
};
|
|
5
|
+
selected: {
|
|
6
|
+
true: string;
|
|
7
|
+
};
|
|
8
|
+
shape: {
|
|
9
|
+
round: string;
|
|
10
|
+
"round-big": string;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
big: string;
|
|
14
|
+
small: string;
|
|
15
|
+
};
|
|
16
|
+
variant: {
|
|
17
|
+
filled: string;
|
|
18
|
+
outline: string;
|
|
19
|
+
};
|
|
20
|
+
}, undefined, string[], {
|
|
21
|
+
iconPosition: {
|
|
22
|
+
end: string;
|
|
23
|
+
};
|
|
24
|
+
selected: {
|
|
25
|
+
true: string;
|
|
26
|
+
};
|
|
27
|
+
shape: {
|
|
28
|
+
round: string;
|
|
29
|
+
"round-big": string;
|
|
30
|
+
};
|
|
31
|
+
size: {
|
|
32
|
+
big: string;
|
|
33
|
+
small: string;
|
|
34
|
+
};
|
|
35
|
+
variant: {
|
|
36
|
+
filled: string;
|
|
37
|
+
outline: string;
|
|
38
|
+
};
|
|
39
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
40
|
+
iconPosition: {
|
|
41
|
+
end: string;
|
|
42
|
+
};
|
|
43
|
+
selected: {
|
|
44
|
+
true: string;
|
|
45
|
+
};
|
|
46
|
+
shape: {
|
|
47
|
+
round: string;
|
|
48
|
+
"round-big": string;
|
|
49
|
+
};
|
|
50
|
+
size: {
|
|
51
|
+
big: string;
|
|
52
|
+
small: string;
|
|
53
|
+
};
|
|
54
|
+
variant: {
|
|
55
|
+
filled: string;
|
|
56
|
+
outline: string;
|
|
57
|
+
};
|
|
58
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { tv } from "../../../utils/tailwind.js";
|
|
2
|
+
|
|
3
|
+
const tagVariants = tv({
|
|
4
|
+
base: [
|
|
5
|
+
"relative inline-flex cursor-pointer items-center gap-1 align-middle ui-tag-badge select-none",
|
|
6
|
+
"ring-blue-500 ring-offset-1 ring-offset-transparent outline-0 focus-visible:ring-1 dark:ring-blue-400",
|
|
7
|
+
"text-neutral-900 hover:bg-neutral-200 dark:text-neutral-200 hover:dark:bg-neutral-700",
|
|
8
|
+
"border border-neutral-100 hover:border-neutral-200 dark:border-neutral-700 hover:dark:border-neutral-700",
|
|
9
|
+
],
|
|
10
|
+
variants: {
|
|
11
|
+
iconPosition: {
|
|
12
|
+
end: "flex-row-reverse",
|
|
13
|
+
},
|
|
14
|
+
selected: {
|
|
15
|
+
true: "border-neutral-900 bg-neutral-900 text-neutral-100 dark:border-blue-400 dark:bg-blue-400",
|
|
16
|
+
},
|
|
17
|
+
shape: {
|
|
18
|
+
round: "rounded-sm",
|
|
19
|
+
"round-big": "rounded-lg",
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
big: "min-h-8 px-3",
|
|
23
|
+
small: "min-h-6 px-2",
|
|
24
|
+
},
|
|
25
|
+
variant: {
|
|
26
|
+
filled: "bg-neutral-100 dark:bg-neutral-700",
|
|
27
|
+
outline: "bg-transparent",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { tagVariants };
|
|
@@ -1,61 +1,53 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { onMount,
|
|
2
|
+
import { onMount, setContext } from "svelte";
|
|
3
3
|
import RichTextEditorToolbar from "./toolbar/RichTextEditorToolbar.svelte";
|
|
4
4
|
import { richTextEditorVariants } from "./richTextEditor.variants.js";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
list: {
|
|
41
|
-
enabled: true,
|
|
42
|
-
},
|
|
43
|
-
listOrdered: {
|
|
44
|
-
enabled: true,
|
|
45
|
-
},
|
|
46
|
-
underline: {
|
|
47
|
-
enabled: true,
|
|
48
|
-
},
|
|
49
|
-
color: {
|
|
50
|
-
enabled: true,
|
|
51
|
-
colors: ["#121110", "#0000ff"],
|
|
52
|
-
defaultColor: "#121110",
|
|
6
|
+
let {
|
|
7
|
+
classes = {},
|
|
8
|
+
content = "",
|
|
9
|
+
fieldName = "",
|
|
10
|
+
hideToolbar = false,
|
|
11
|
+
placeholder = "",
|
|
12
|
+
size = "medium",
|
|
13
|
+
toolbarConfig = {
|
|
14
|
+
bold: {
|
|
15
|
+
enabled: true,
|
|
16
|
+
},
|
|
17
|
+
history: {
|
|
18
|
+
enabled: true,
|
|
19
|
+
},
|
|
20
|
+
italic: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
},
|
|
23
|
+
link: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
},
|
|
26
|
+
list: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
},
|
|
29
|
+
listOrdered: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
},
|
|
32
|
+
underline: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
enabled: true,
|
|
37
|
+
colors: ["#121110", "#0000ff"],
|
|
38
|
+
defaultColor: "#121110",
|
|
39
|
+
},
|
|
53
40
|
},
|
|
54
|
-
|
|
41
|
+
...rest
|
|
42
|
+
} = $props();
|
|
55
43
|
|
|
56
|
-
let element;
|
|
57
|
-
let
|
|
58
|
-
let
|
|
44
|
+
let element = $state();
|
|
45
|
+
let htmlInputValue = $state();
|
|
46
|
+
let editor = $state.raw();
|
|
47
|
+
|
|
48
|
+
let styles = $derived(richTextEditorVariants({ hideToolbar, size }));
|
|
49
|
+
|
|
50
|
+
setContext("richt-text-editor", () => editor);
|
|
59
51
|
|
|
60
52
|
const initEditor = async () => {
|
|
61
53
|
const { Editor } = await import("@tiptap/core");
|
|
@@ -111,8 +103,7 @@
|
|
|
111
103
|
},
|
|
112
104
|
},
|
|
113
105
|
content,
|
|
114
|
-
|
|
115
|
-
editor = editor;
|
|
106
|
+
onUpdate: () => {
|
|
116
107
|
htmlInputValue = editor.getHTML();
|
|
117
108
|
},
|
|
118
109
|
});
|
|
@@ -122,12 +113,10 @@
|
|
|
122
113
|
|
|
123
114
|
onMount(() => {
|
|
124
115
|
initEditor();
|
|
125
|
-
});
|
|
126
116
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
117
|
+
return () => {
|
|
118
|
+
editor?.destroy();
|
|
119
|
+
};
|
|
131
120
|
});
|
|
132
121
|
|
|
133
122
|
const cleanHTMLWhitespace = (html) => {
|
|
@@ -152,14 +141,12 @@
|
|
|
152
141
|
|
|
153
142
|
return dom.innerHTML.trim();
|
|
154
143
|
};
|
|
155
|
-
|
|
156
|
-
let styles = richTextEditorVariants({ hideToolbar, size });
|
|
157
144
|
</script>
|
|
158
145
|
|
|
159
|
-
<div class={styles.base({ class: classes.base })}>
|
|
146
|
+
<div class={styles.base({ class: classes.base })} {...rest}>
|
|
160
147
|
{#if !hideToolbar}
|
|
161
148
|
<div class={styles.toolbar({ class: classes.toolbar })}>
|
|
162
|
-
<RichTextEditorToolbar {
|
|
149
|
+
<RichTextEditorToolbar {toolbarConfig} />
|
|
163
150
|
</div>
|
|
164
151
|
{/if}
|
|
165
152
|
{#if fieldName}
|
|
@@ -1,143 +1,23 @@
|
|
|
1
1
|
export default RichTextEditor;
|
|
2
|
-
type RichTextEditor =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
toolbarConfig?: {
|
|
7
|
-
bold: {
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
};
|
|
10
|
-
history: {
|
|
11
|
-
enabled: boolean;
|
|
12
|
-
};
|
|
13
|
-
italic: {
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
};
|
|
16
|
-
link: {
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
};
|
|
19
|
-
list: {
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
};
|
|
22
|
-
listOrdered: {
|
|
23
|
-
enabled: boolean;
|
|
24
|
-
};
|
|
25
|
-
underline: {
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
};
|
|
28
|
-
color: {
|
|
29
|
-
enabled: boolean;
|
|
30
|
-
colors: string[];
|
|
31
|
-
defaultColor: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
hideToolbar?: boolean;
|
|
35
|
-
classes?: Props;
|
|
36
|
-
fieldName?: string;
|
|
37
|
-
}, {
|
|
38
|
-
[evt: string]: CustomEvent<any>;
|
|
39
|
-
}, {}> & {
|
|
40
|
-
$$bindings?: string;
|
|
2
|
+
type RichTextEditor = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
41
5
|
};
|
|
42
|
-
declare const RichTextEditor:
|
|
6
|
+
declare const RichTextEditor: import("svelte").Component<{
|
|
7
|
+
classes?: Record<string, any>;
|
|
43
8
|
content?: string;
|
|
44
|
-
size?: string;
|
|
45
|
-
placeholder?: string;
|
|
46
|
-
toolbarConfig?: {
|
|
47
|
-
bold: {
|
|
48
|
-
enabled: boolean;
|
|
49
|
-
};
|
|
50
|
-
history: {
|
|
51
|
-
enabled: boolean;
|
|
52
|
-
};
|
|
53
|
-
italic: {
|
|
54
|
-
enabled: boolean;
|
|
55
|
-
};
|
|
56
|
-
link: {
|
|
57
|
-
enabled: boolean;
|
|
58
|
-
};
|
|
59
|
-
list: {
|
|
60
|
-
enabled: boolean;
|
|
61
|
-
};
|
|
62
|
-
listOrdered: {
|
|
63
|
-
enabled: boolean;
|
|
64
|
-
};
|
|
65
|
-
underline: {
|
|
66
|
-
enabled: boolean;
|
|
67
|
-
};
|
|
68
|
-
color: {
|
|
69
|
-
enabled: boolean;
|
|
70
|
-
colors: string[];
|
|
71
|
-
defaultColor: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
hideToolbar?: boolean;
|
|
75
|
-
classes?: {
|
|
76
|
-
/**
|
|
77
|
-
* CSS class overrides for editor parts
|
|
78
|
-
*/
|
|
79
|
-
classes?: any;
|
|
80
|
-
/**
|
|
81
|
-
* The initial content of the editor
|
|
82
|
-
*/
|
|
83
|
-
content?: string;
|
|
84
|
-
/**
|
|
85
|
-
* The name of the field for form submissions
|
|
86
|
-
*/
|
|
87
|
-
fieldName?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Whether to hide the toolbar
|
|
90
|
-
*/
|
|
91
|
-
hideToolbar?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* RichTextEditor size
|
|
94
|
-
*/
|
|
95
|
-
size?: "small" | "medium" | "large";
|
|
96
|
-
/**
|
|
97
|
-
* Placeholder text for the editor
|
|
98
|
-
*/
|
|
99
|
-
placeholder?: string;
|
|
100
|
-
};
|
|
101
9
|
fieldName?: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
classes?: any;
|
|
110
|
-
/**
|
|
111
|
-
* The initial content of the editor
|
|
112
|
-
*/
|
|
10
|
+
hideToolbar?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
size?: string;
|
|
13
|
+
toolbarConfig?: Record<string, any>;
|
|
14
|
+
} & Record<string, any>, {}, "">;
|
|
15
|
+
type $$ComponentProps = {
|
|
16
|
+
classes?: Record<string, any>;
|
|
113
17
|
content?: string;
|
|
114
|
-
/**
|
|
115
|
-
* The name of the field for form submissions
|
|
116
|
-
*/
|
|
117
18
|
fieldName?: string;
|
|
118
|
-
/**
|
|
119
|
-
* Whether to hide the toolbar
|
|
120
|
-
*/
|
|
121
19
|
hideToolbar?: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* RichTextEditor size
|
|
124
|
-
*/
|
|
125
|
-
size?: "small" | "medium" | "large";
|
|
126
|
-
/**
|
|
127
|
-
* Placeholder text for the editor
|
|
128
|
-
*/
|
|
129
20
|
placeholder?: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
$$bindings?: Bindings;
|
|
134
|
-
} & Exports;
|
|
135
|
-
(internal: unknown, props: Props & {
|
|
136
|
-
$$events?: Events;
|
|
137
|
-
$$slots?: Slots;
|
|
138
|
-
}): Exports & {
|
|
139
|
-
$set?: any;
|
|
140
|
-
$on?: any;
|
|
141
|
-
};
|
|
142
|
-
z_$$bindings?: Bindings;
|
|
143
|
-
}
|
|
21
|
+
size?: string;
|
|
22
|
+
toolbarConfig?: Record<string, any>;
|
|
23
|
+
} & Record<string, any>;
|