@placeholderco/placeholder-ui 2.1.1 → 2.2.0
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/editors/CodeMirror.svelte +295 -297
- package/dist/editors/tiptap/LinkActionMenu.svelte +6 -1
- package/dist/editors/tiptap/extensions/Alert.js +17 -17
- package/dist/editors/tiptap/extensions/Div.js +19 -19
- package/dist/editors/tiptap/extensions/Span.js +14 -14
- package/dist/editors/tiptap/toolbar/AlertButton.svelte +254 -253
- package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/BoldButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/BulletListButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/CodeButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/ColorButton.svelte +265 -265
- package/dist/editors/tiptap/toolbar/DocumentButton.svelte +51 -51
- package/dist/editors/tiptap/toolbar/HeadingButton.svelte +21 -21
- package/dist/editors/tiptap/toolbar/HtmlButton.svelte +48 -52
- package/dist/editors/tiptap/toolbar/ImageButton.svelte +35 -39
- package/dist/editors/tiptap/toolbar/ItalicButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/LinkButton.svelte +249 -249
- package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/RedoButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/TableButton.svelte +231 -224
- package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +59 -65
- package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/UndoButton.svelte +11 -11
- package/dist/form/Autocomplete.svelte +24 -22
- package/dist/form/AutocompleteMulti.svelte +24 -22
- package/dist/form/Checkbox.svelte +4 -4
- package/dist/form/Chips.svelte +15 -7
- package/dist/form/ColorPicker.svelte +5 -20
- package/dist/form/ComboBox.svelte +4 -4
- package/dist/form/ComboBoxItemBuilder.svelte +14 -32
- package/dist/form/ComboBoxMulti.svelte +7 -3
- package/dist/form/CronBuilder.svelte +32 -110
- package/dist/form/DatePicker.svelte +9 -28
- package/dist/form/DateRangePicker.svelte +46 -36
- package/dist/form/DateTimePicker.svelte +11 -30
- package/dist/form/Number.svelte +1 -3
- package/dist/form/RadioGroup.svelte +1 -3
- package/dist/form/Select.svelte +25 -28
- package/dist/form/SelectMulti.svelte +36 -38
- package/dist/form/StringArrayBuilder.svelte +1 -3
- package/dist/form/TextArea.svelte +5 -6
- package/dist/form/Textbox.svelte +10 -4
- package/dist/form/TimePicker.svelte +10 -4
- package/dist/icon/Icon.svelte +5 -1
- package/dist/index.d.ts +147 -146
- package/dist/index.js +78 -77
- package/dist/layout/CustomNavbar.svelte +1 -1
- package/dist/layout/NavbarItemDisplay.svelte +1 -1
- package/dist/layout/NavbarItemView.svelte +3 -1
- package/dist/layout/Sidenav.svelte +1 -1
- package/dist/models/ComboBoxItem.d.ts +4 -4
- package/dist/models/NotifyModel.js +0 -1
- package/dist/theme.svelte.d.ts +1 -1
- package/dist/theme.svelte.js +46 -22
- package/dist/ui/Accordion.svelte +1 -3
- package/dist/ui/Badge.svelte +4 -5
- package/dist/ui/Button.svelte +7 -1
- package/dist/ui/ContextMenu.svelte +5 -11
- package/dist/ui/Dialog.svelte +16 -3
- package/dist/ui/Dialog.svelte.d.ts +7 -1
- package/dist/ui/Dropdown.svelte +21 -10
- package/dist/ui/MultiSortable.svelte +1 -3
- package/dist/ui/Pagination.svelte +2 -2
- package/dist/ui/Popover.svelte +16 -37
- package/dist/ui/ProgressBar.svelte +1 -4
- package/dist/ui/ThemeSwitcher.svelte +2 -1
- package/dist/ui/Tooltip.svelte +1 -37
- package/dist/util/DateFunctions.js +1 -1
- package/dist/util/Floating.d.ts +70 -0
- package/dist/util/Floating.js +321 -0
- package/dist/util/NavigateTo.js +2 -2
- package/dist/util/Transitions.d.ts +1 -1
- package/dist/util/Transitions.js +1 -1
- package/package.json +1 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconPaperclip } from '../../../icon/index.js';
|
|
5
|
+
import type { DocumentUploadResult } from '../TipTap.svelte';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
onDocumentUpload?: (file: File) => Promise<DocumentUploadResult | null>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { editor, onDocumentUpload }: Props = $props();
|
|
13
|
+
|
|
14
|
+
let fileInputElement: HTMLInputElement | undefined = $state();
|
|
15
|
+
|
|
16
|
+
const handleFileSelect = async (event: Event) => {
|
|
17
|
+
const target = event.target as HTMLInputElement;
|
|
18
|
+
const file = target.files?.[0];
|
|
19
|
+
|
|
20
|
+
if (!file || !onDocumentUpload) return;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const result = await onDocumentUpload(file);
|
|
24
|
+
|
|
25
|
+
if (result) {
|
|
26
|
+
editor
|
|
27
|
+
.chain()
|
|
28
|
+
.focus()
|
|
29
|
+
.insertContent({
|
|
30
|
+
type: 'text',
|
|
31
|
+
text: result.label,
|
|
32
|
+
marks: [{ type: 'link', attrs: { href: result.url } }]
|
|
33
|
+
})
|
|
34
|
+
.run();
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Failed to upload document:', error);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Reset the input
|
|
41
|
+
if (fileInputElement) {
|
|
42
|
+
fileInputElement.value = '';
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const openFilePicker = () => {
|
|
47
|
+
fileInputElement?.click();
|
|
48
|
+
};
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<input
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
type="file"
|
|
53
|
+
bind:this={fileInputElement}
|
|
54
|
+
onchange={handleFileSelect}
|
|
55
|
+
style="display: none;"
|
|
56
56
|
/>
|
|
57
57
|
|
|
58
58
|
<ToolbarButton icon={iconPaperclip} title="Attach Document" onclick={openFilePicker} />
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconH1, iconH2, iconH3, iconH4, iconH5, iconH6 } from '../../../icon/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let { editor, level = 1 }: Props = $props();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const iconMap = {
|
|
14
|
+
1: iconH1,
|
|
15
|
+
2: iconH2,
|
|
16
|
+
3: iconH3,
|
|
17
|
+
4: iconH4,
|
|
18
|
+
5: iconH5,
|
|
19
|
+
6: iconH6
|
|
20
|
+
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const icon = $derived(iconMap[level]);
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<ToolbarButton
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
{icon}
|
|
27
|
+
title="Heading {level}"
|
|
28
|
+
active={editor.isActive('heading', { level })}
|
|
29
|
+
onclick={() => editor.chain().focus().toggleHeading({ level }).run()}
|
|
30
30
|
/>
|
|
@@ -1,68 +1,64 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import Dialog from '../../../ui/Dialog.svelte';
|
|
5
|
+
import Button from '../../../ui/Button.svelte';
|
|
6
|
+
import CodeMirror from '../../CodeMirror.svelte';
|
|
7
|
+
import { iconCode } from '../../../icon/index.js';
|
|
8
|
+
import { themeState } from '../../../theme.svelte.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
interface Props {
|
|
11
|
+
editor: Editor;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
let { editor }: Props = $props();
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let showDialog = $state(false);
|
|
17
|
+
let htmlContent = $state('');
|
|
18
|
+
let codeMirrorRef: any;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const openHtmlEditor = () => {
|
|
21
|
+
htmlContent = editor.getHTML();
|
|
22
|
+
showDialog = true;
|
|
23
|
+
};
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const closeDialog = () => {
|
|
26
|
+
showDialog = false;
|
|
27
|
+
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
const saveHtml = () => {
|
|
30
|
+
if (codeMirrorRef) {
|
|
31
|
+
const newHtml = codeMirrorRef.getValue();
|
|
32
|
+
editor.commands.setContent(newHtml);
|
|
33
|
+
}
|
|
34
|
+
closeDialog();
|
|
35
|
+
};
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
|
-
<ToolbarButton
|
|
39
|
-
icon={iconCode}
|
|
40
|
-
title="Edit HTML"
|
|
41
|
-
onclick={openHtmlEditor}
|
|
42
|
-
/>
|
|
38
|
+
<ToolbarButton icon={iconCode} title="Edit HTML" onclick={openHtmlEditor} />
|
|
43
39
|
|
|
44
40
|
<Dialog bind:show={showDialog} title="Edit HTML" size="full" preventOverflow={false}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
<div class="html-editor-container">
|
|
42
|
+
<CodeMirror
|
|
43
|
+
bind:this={codeMirrorRef}
|
|
44
|
+
value={htmlContent}
|
|
45
|
+
language="html"
|
|
46
|
+
theme={themeState.isDarkMode ? 'dark' : 'light'}
|
|
47
|
+
height="100%"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
{#snippet footer()}
|
|
52
|
+
<Button variant="secondary" onclick={closeDialog}>Cancel</Button>
|
|
53
|
+
<Button onclick={saveHtml}>Save</Button>
|
|
54
|
+
{/snippet}
|
|
59
55
|
</Dialog>
|
|
60
56
|
|
|
61
57
|
<style>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
.html-editor-container {
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: calc(100vh - 200px);
|
|
61
|
+
max-height: 600px;
|
|
62
|
+
min-height: 300px;
|
|
63
|
+
}
|
|
68
64
|
</style>
|
|
@@ -1,54 +1,50 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconPhoto } from '../../../icon/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
onImageUpload?: (file: File) => Promise<string | null>;
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let { editor, onImageUpload }: Props = $props();
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let fileInputElement: HTMLInputElement | undefined = $state();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const handleFileSelect = async (event: Event) => {
|
|
16
|
+
const target = event.target as HTMLInputElement;
|
|
17
|
+
const file = target.files?.[0];
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
if (!file || !onImageUpload) return;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
try {
|
|
22
|
+
const imageUrl = await onImageUpload(file);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
if (imageUrl) {
|
|
25
|
+
editor.chain().focus().setImage({ src: imageUrl }).run();
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Failed to upload image:', error);
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
// Reset the input
|
|
32
|
+
if (fileInputElement) {
|
|
33
|
+
fileInputElement.value = '';
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const openFilePicker = () => {
|
|
38
|
+
fileInputElement?.click();
|
|
39
|
+
};
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
<input
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
type="file"
|
|
44
|
+
accept="image/*"
|
|
45
|
+
bind:this={fileInputElement}
|
|
46
|
+
onchange={handleFileSelect}
|
|
47
|
+
style="display: none;"
|
|
48
48
|
/>
|
|
49
49
|
|
|
50
|
-
<ToolbarButton
|
|
51
|
-
icon={iconPhoto}
|
|
52
|
-
title="Add Image"
|
|
53
|
-
onclick={openFilePicker}
|
|
54
|
-
/>
|
|
50
|
+
<ToolbarButton icon={iconPhoto} title="Add Image" onclick={openFilePicker} />
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconItalic } from '../../../icon/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let { editor }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<ToolbarButton
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
icon={iconItalic}
|
|
15
|
+
title="Italic"
|
|
16
|
+
active={editor.isActive('italic')}
|
|
17
|
+
onclick={() => editor.chain().focus().toggleItalic().run()}
|
|
18
18
|
/>
|