@peteai/presentation-editor 0.0.2 → 0.0.4
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 +2 -2
- package/dist/components/presentation-editor/active-layers-buttons.svelte +53 -0
- package/dist/components/presentation-editor/active-layers-buttons.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/active-layers.svelte +181 -0
- package/dist/components/presentation-editor/active-layers.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte +81 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte +21 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte +23 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte.d.ts +6 -0
- package/dist/components/presentation-editor/color-indicator/index.d.ts +4 -0
- package/dist/components/presentation-editor/color-indicator/index.js +6 -0
- package/dist/components/presentation-editor/cursor-tooltip.svelte +1 -1
- package/dist/components/presentation-editor/dragged.svelte +21 -11
- package/dist/components/presentation-editor/fonts.d.ts +3 -0
- package/dist/components/presentation-editor/fonts.js +1278 -0
- package/dist/components/presentation-editor/header.svelte +21 -33
- package/dist/components/presentation-editor/header.svelte.d.ts +16 -6
- package/dist/components/presentation-editor/hotkeys.svelte +85 -0
- package/dist/components/presentation-editor/{sidebar/layers.svelte.d.ts → hotkeys.svelte.d.ts} +3 -3
- package/dist/components/presentation-editor/layers/active-background-border.svelte +3 -7
- package/dist/components/presentation-editor/layers/active-layer-border.svelte +2 -5
- package/dist/components/presentation-editor/layers/active-layer-border.svelte.d.ts +0 -1
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte +113 -129
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte +51 -32
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte +30 -7
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte +76 -33
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte +89 -59
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +5 -100
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +337 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +104 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte +128 -43
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +1 -5
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte +68 -57
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +2 -110
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte +45 -32
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -54
- package/dist/components/presentation-editor/layers/index.d.ts +4 -5
- package/dist/components/presentation-editor/layers/index.js +7 -8
- package/dist/components/presentation-editor/layers/layer-button.svelte +25 -7
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte +212 -162
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte +41 -0
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte +28 -74
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte.d.ts +2 -17
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte +69 -61
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.js +2 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte +55 -12
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte +59 -24
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte +27 -76
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte +36 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte +72 -29
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +71 -18
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte +54 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte +54 -9
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/editor/createEditor.js +2 -2
- package/dist/components/presentation-editor/layers/types/html/editor/utils.d.ts +11 -0
- package/dist/components/presentation-editor/layers/types/html/editor/utils.js +88 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.d.ts +27 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.js +40 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.d.ts +5 -1
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.js +3 -7
- package/dist/components/presentation-editor/layers/types/html/extensions.d.ts +1 -0
- package/dist/components/presentation-editor/layers/types/html/extensions.js +56 -0
- package/dist/components/presentation-editor/layers/types/html/html-content.svelte +26 -5
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte +26 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +103 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +61 -53
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/index.js +3 -56
- package/dist/components/presentation-editor/layers/types/image/{image-content.svelte → image-layer-content.svelte} +11 -3
- package/dist/components/presentation-editor/layers/types/image/image-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer.svelte +51 -21
- package/dist/components/presentation-editor/layers/types/image/index.d.ts +2 -4
- package/dist/components/presentation-editor/layers/types/image/index.js +2 -4
- package/dist/components/presentation-editor/layers/utils.d.ts +68 -9
- package/dist/components/presentation-editor/layers/utils.js +260 -25
- package/dist/components/presentation-editor/menu/background-menu-content.svelte +80 -0
- package/dist/components/presentation-editor/menu/background-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte +183 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte +67 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/presentation-editor.svelte +119 -175
- package/dist/components/presentation-editor/presentation-editor.svelte.js +597 -136
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte +58 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +144 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte +404 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte +26 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte +216 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte +130 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte +90 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte +82 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/{images-library.svelte → sidebar-uploads-tab.svelte} +0 -1
- package/dist/components/presentation-editor/sidebar/sidebar-uploads-tab.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte +25 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar.svelte +71 -15
- package/dist/components/presentation-editor/sidebar/sidebar.svelte.d.ts +16 -5
- package/dist/components/presentation-editor/sidebar/uploads-image.svelte +28 -11
- package/dist/components/presentation-editor/slide-editor.svelte +20 -22
- package/dist/components/presentation-editor/slide-inner.svelte +19 -18
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte +61 -52
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte +6 -8
- package/dist/components/presentation-editor/snapping-guides.svelte +3 -3
- package/dist/components/presentation-editor/types.d.ts +67 -27
- package/dist/components/presentation-editor/utils.d.ts +50 -1
- package/dist/components/presentation-editor/utils.js +101 -6
- package/dist/components/ui/button/button.svelte +3 -2
- package/dist/components/ui/button/button.svelte.d.ts +5 -82
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte +43 -0
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte.d.ts +8 -0
- package/dist/components/ui/color-picker/color-picker.svelte +344 -0
- package/dist/components/ui/color-picker/color-picker.svelte.d.ts +13 -0
- package/dist/components/ui/color-picker/index.d.ts +3 -0
- package/dist/components/ui/color-picker/index.js +5 -0
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte +6 -3
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +6 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/infinite-loader/index.d.ts +4 -0
- package/dist/components/ui/infinite-loader/index.js +4 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.d.ts +13 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.js +44 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.d.ts +15 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.js +28 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte +149 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte.d.ts +17 -0
- package/dist/components/ui/input/input.svelte +1 -1
- package/dist/components/ui/slider/slider.svelte +20 -18
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/tabs/index.js +8 -0
- package/dist/components/ui/tabs/tabs-content.svelte +19 -0
- package/dist/components/ui/tabs/tabs-content.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +19 -0
- package/dist/components/ui/tabs/tabs-list.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte +19 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte.d.ts +4 -0
- package/dist/components/ui/toggle/toggle.svelte +3 -2
- package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -46
- package/dist/plugin.js +3 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +28 -25
- package/dist/components/presentation-editor/app.css +0 -12
- package/dist/components/presentation-editor/layers/hovered-layer.svelte +0 -34
- package/dist/components/presentation-editor/layers/hovered-layer.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte +0 -11
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte +0 -12
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte +0 -159
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte +0 -42
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte +0 -24
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-content.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte +0 -21
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte +0 -13
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/sidebar/images-library.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/sidebar/layers.svelte +0 -94
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte +0 -32
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte +0 -34
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte.d.ts +0 -10
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick } from 'svelte';
|
|
3
|
+
import SearchIcon from 'lucide-svelte/icons/search';
|
|
4
|
+
import BackIcon from 'lucide-svelte/icons/arrow-left';
|
|
5
|
+
import DocumentIcon from 'lucide-svelte/icons/file-text';
|
|
6
|
+
import PopularIcon from 'lucide-svelte/icons/chart-no-axes-combined';
|
|
7
|
+
import { InfiniteLoader, LoaderState } from '../../../ui/infinite-loader/index.js';
|
|
8
|
+
import { Input } from '../../../ui/input/index.js';
|
|
9
|
+
import { Button } from '../../../ui/button/index.js';
|
|
10
|
+
import { Separator } from '../../../ui/separator/index.js';
|
|
11
|
+
import { cn } from '../../../../utils.js';
|
|
12
|
+
import { getPresentationEditorContext } from '../../presentation-editor.svelte.js';
|
|
13
|
+
import SidebarWrapper from '../sidebar-wrapper.svelte';
|
|
14
|
+
import {
|
|
15
|
+
createEditorNotReactive,
|
|
16
|
+
extractNodeFonts,
|
|
17
|
+
extractSelectionFonts,
|
|
18
|
+
} from '../../layers/types/html/editor/utils.js';
|
|
19
|
+
import FontSidebarButton from './font-sidebar-button.svelte';
|
|
20
|
+
import { applyHtmlToLayer } from '../../layers/utils.js';
|
|
21
|
+
|
|
22
|
+
const editor = getPresentationEditorContext();
|
|
23
|
+
|
|
24
|
+
let { htmlEditor } = editor;
|
|
25
|
+
|
|
26
|
+
let search = $state('');
|
|
27
|
+
|
|
28
|
+
const mapFont = (family: string) => ({ ...editor.fonts[family], family });
|
|
29
|
+
|
|
30
|
+
const fonts = Object.keys(editor.fonts).map(mapFont);
|
|
31
|
+
|
|
32
|
+
let htmlLayers = $derived(editor.activeLayers.filter((layer) => layer.type === 'html'));
|
|
33
|
+
|
|
34
|
+
const currentFonts = $derived.by(() => {
|
|
35
|
+
if (editor.activeAction?.type === 'edit') {
|
|
36
|
+
return extractSelectionFonts($htmlEditor);
|
|
37
|
+
} else {
|
|
38
|
+
const set = new Set<string>();
|
|
39
|
+
htmlLayers.forEach((layer) => extractNodeFonts(layer.html, set));
|
|
40
|
+
return Array.from(set);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const documentFonts = $derived.by(() => {
|
|
45
|
+
const fontsSet = new Set<string>();
|
|
46
|
+
|
|
47
|
+
editor.slides.forEach((slide) => {
|
|
48
|
+
slide.layers.forEach((layer) => {
|
|
49
|
+
if (layer.type === 'html') {
|
|
50
|
+
extractNodeFonts(layer.html).forEach(fontsSet.add, fontsSet);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
let fonts = Array.from(fontsSet);
|
|
56
|
+
|
|
57
|
+
return fonts
|
|
58
|
+
.sort()
|
|
59
|
+
.filter((family) => editor.fonts[family])
|
|
60
|
+
.map(mapFont);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const editorNotReactive = createEditorNotReactive();
|
|
64
|
+
|
|
65
|
+
const setFont = async (family: string) => {
|
|
66
|
+
if (editor.activeAction?.type === 'edit') {
|
|
67
|
+
$htmlEditor.commands.setFontFamily(family);
|
|
68
|
+
} else {
|
|
69
|
+
editor.historyPush({
|
|
70
|
+
type: 'layersGroup',
|
|
71
|
+
actions: await Promise.all(
|
|
72
|
+
htmlLayers.map(async (layer) => {
|
|
73
|
+
editorNotReactive
|
|
74
|
+
.chain()
|
|
75
|
+
.setContent(layer.html)
|
|
76
|
+
.selectAll()
|
|
77
|
+
.setFontFamily(family)
|
|
78
|
+
.run();
|
|
79
|
+
|
|
80
|
+
const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
|
|
81
|
+
const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
type: 'layer',
|
|
85
|
+
slideId: editor.activeSlide.id,
|
|
86
|
+
layer: { id: layer.id, type: layer.type },
|
|
87
|
+
undo,
|
|
88
|
+
redo,
|
|
89
|
+
};
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
$effect(() => {
|
|
97
|
+
if (editor.activeSidebarPopup === 'font') {
|
|
98
|
+
if (!editor.activeLayers.some((layer) => layer.type === 'html')) {
|
|
99
|
+
editor.activeSidebarPopup = null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const itemsPerPage = 30;
|
|
105
|
+
|
|
106
|
+
let popularPagesLoaded = $state(1);
|
|
107
|
+
let popularFonts = $derived(fonts.slice(0, popularPagesLoaded * itemsPerPage));
|
|
108
|
+
const popularLoaderState = new LoaderState();
|
|
109
|
+
const popularLoadMore = async () => {
|
|
110
|
+
const itemsCount = popularFonts.length;
|
|
111
|
+
popularPagesLoaded++;
|
|
112
|
+
if (itemsCount < popularFonts.length) {
|
|
113
|
+
popularLoaderState.loaded();
|
|
114
|
+
} else {
|
|
115
|
+
popularLoaderState.complete();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
let searchedPagesLoaded = $state(1);
|
|
120
|
+
let searchedFonts = $derived(
|
|
121
|
+
search ? editor.searchFonts(search, searchedPagesLoaded * itemsPerPage).map(mapFont) : [],
|
|
122
|
+
);
|
|
123
|
+
const searchedLoaderState = new LoaderState();
|
|
124
|
+
const searchedLoadMore = async () => {
|
|
125
|
+
const itemsCount = searchedFonts.length;
|
|
126
|
+
searchedPagesLoaded++;
|
|
127
|
+
if (itemsCount < searchedFonts.length) {
|
|
128
|
+
searchedLoaderState.loaded();
|
|
129
|
+
} else {
|
|
130
|
+
searchedLoaderState.complete();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const cancelSearch = () => {
|
|
135
|
+
search = '';
|
|
136
|
+
searchedPagesLoaded = 1;
|
|
137
|
+
};
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<SidebarWrapper name="Font">
|
|
141
|
+
<div class="relative flex items-center">
|
|
142
|
+
<div class="pointer-events-none absolute flex w-10 items-center justify-center">
|
|
143
|
+
{#if search}
|
|
144
|
+
<Button variant="ghost" size="icon-xs" class="pointer-events-auto" onclick={cancelSearch}>
|
|
145
|
+
<BackIcon class="h-6 w-6" />
|
|
146
|
+
</Button>
|
|
147
|
+
{:else}
|
|
148
|
+
<SearchIcon class="h-6 w-6" />
|
|
149
|
+
{/if}
|
|
150
|
+
</div>
|
|
151
|
+
<Input
|
|
152
|
+
class="pl-10"
|
|
153
|
+
bind:value={search}
|
|
154
|
+
placeholder="Try “Calligraphy” or “Open Sans”"
|
|
155
|
+
oninput={() => (searchedPagesLoaded = 1)}
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
<div class={cn('flex-1 overflow-y-auto', search && 'hidden')}>
|
|
159
|
+
<div class="flex items-center gap-2 py-2">
|
|
160
|
+
<DocumentIcon class="h-6 w-6" />
|
|
161
|
+
<h5 class="text-left text-sm font-bold">Document fonts</h5>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="flex flex-col">
|
|
164
|
+
{#each documentFonts as font}
|
|
165
|
+
<FontSidebarButton
|
|
166
|
+
family={font.family}
|
|
167
|
+
active={currentFonts.includes(font.family)}
|
|
168
|
+
onclick={() => setFont(font.family)}
|
|
169
|
+
/>
|
|
170
|
+
{/each}
|
|
171
|
+
</div>
|
|
172
|
+
<Separator class="my-2" />
|
|
173
|
+
<div class="flex items-center gap-2 py-2">
|
|
174
|
+
<PopularIcon class="h-6 w-6" />
|
|
175
|
+
<h5 class="text-left text-sm font-bold">Popular fonts</h5>
|
|
176
|
+
</div>
|
|
177
|
+
<div class="flex flex-col">
|
|
178
|
+
{#each popularFonts as font}
|
|
179
|
+
<FontSidebarButton
|
|
180
|
+
family={font.family}
|
|
181
|
+
active={currentFonts.includes(font.family)}
|
|
182
|
+
onclick={() => setFont(font.family)}
|
|
183
|
+
/>
|
|
184
|
+
{/each}
|
|
185
|
+
<InfiniteLoader loaderState={popularLoaderState} triggerLoad={popularLoadMore}>
|
|
186
|
+
{#snippet noData()}{/snippet}
|
|
187
|
+
</InfiniteLoader>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
{#if search}
|
|
192
|
+
<div class="flex-1 overflow-y-auto">
|
|
193
|
+
{#if searchedFonts.length}
|
|
194
|
+
<div class="flex items-center gap-2 py-2">
|
|
195
|
+
<h5 class="text-left text-sm font-bold">All results</h5>
|
|
196
|
+
</div>
|
|
197
|
+
<div class="flex flex-col">
|
|
198
|
+
{#each searchedFonts as font}
|
|
199
|
+
<FontSidebarButton
|
|
200
|
+
family={font.family}
|
|
201
|
+
active={currentFonts.includes(font.family)}
|
|
202
|
+
onclick={() => setFont(font.family)}
|
|
203
|
+
/>
|
|
204
|
+
{/each}
|
|
205
|
+
<InfiniteLoader loaderState={searchedLoaderState} triggerLoad={searchedLoadMore}>
|
|
206
|
+
{#snippet noData()}{/snippet}
|
|
207
|
+
</InfiniteLoader>
|
|
208
|
+
</div>
|
|
209
|
+
{:else}
|
|
210
|
+
<p class="text-muted-foreground text-sm">
|
|
211
|
+
We couldn't find any results for “{search}”. Try searching for something else.
|
|
212
|
+
</p>
|
|
213
|
+
{/if}
|
|
214
|
+
</div>
|
|
215
|
+
{/if}
|
|
216
|
+
</SidebarWrapper>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { flip } from 'svelte/animate';
|
|
3
|
+
import { dndzone } from 'svelte-dnd-action';
|
|
4
|
+
import XIcon from 'lucide-svelte/icons/x';
|
|
5
|
+
import * as ContextMenu from '../../ui/context-menu/index.js';
|
|
6
|
+
import { Button } from '../../ui/button/index.js';
|
|
7
|
+
import {
|
|
8
|
+
LayerButton,
|
|
9
|
+
LayerThumbWrapper,
|
|
10
|
+
HtmlLayerContent,
|
|
11
|
+
ImageLayerContent,
|
|
12
|
+
BackgroundLayerContent,
|
|
13
|
+
} from '../layers/index.js';
|
|
14
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
15
|
+
import LayerMenuContent from '../menu/layer-menu-content.svelte';
|
|
16
|
+
import BackgroundMenuContent from '../menu/background-menu-content.svelte';
|
|
17
|
+
|
|
18
|
+
const editor = getPresentationEditorContext();
|
|
19
|
+
|
|
20
|
+
const flipDurationMs = 300;
|
|
21
|
+
const otherOptions = { flipDurationMs, type: 'layers', dropTargetStyle: {} };
|
|
22
|
+
|
|
23
|
+
function handleDndConsider(e) {
|
|
24
|
+
editor.activeSlide.layers = e.detail.items;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function handleDndFinalize(e) {
|
|
28
|
+
console.log('handleDndFinalize', e);
|
|
29
|
+
|
|
30
|
+
editor.activeSlide.layers = e.detail.items;
|
|
31
|
+
|
|
32
|
+
const index = e.detail.items.findIndex((item) => item.id === e.detail.info.id);
|
|
33
|
+
const item = e.detail.items[index];
|
|
34
|
+
|
|
35
|
+
let redo;
|
|
36
|
+
const prev = e.detail.items[index - 1];
|
|
37
|
+
const next = e.detail.items[index + 1];
|
|
38
|
+
if (prev && next) {
|
|
39
|
+
if (!(prev.sortOrder < item.sortOrder && next.sortOrder > item.sortOrder)) {
|
|
40
|
+
redo = { sortOrder: (prev.sortOrder + next.sortOrder) / 2 };
|
|
41
|
+
}
|
|
42
|
+
} else if (next) {
|
|
43
|
+
if (next && next.sortOrder <= item.sortOrder) {
|
|
44
|
+
redo = { sortOrder: next.sortOrder - 1 };
|
|
45
|
+
}
|
|
46
|
+
} else if (prev) {
|
|
47
|
+
if (prev && prev.sortOrder >= item.sortOrder) {
|
|
48
|
+
redo = { sortOrder: prev.sortOrder + 1 };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (redo) {
|
|
53
|
+
editor.historyPush({
|
|
54
|
+
type: 'layer',
|
|
55
|
+
slideId: editor.activeSlide.id,
|
|
56
|
+
layer: { id: item.id, type: item.type },
|
|
57
|
+
undo: { sortOrder: item.sortOrder },
|
|
58
|
+
redo,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<div class="flex flex-col gap-2">
|
|
65
|
+
<div class="flex items-center justify-between">
|
|
66
|
+
<div class="text-sm font-bold">Position</div>
|
|
67
|
+
<Button variant="ghost" size="icon" onclick={() => (editor.activeSidebarPopup = null)}>
|
|
68
|
+
<XIcon />
|
|
69
|
+
</Button>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="text-lg font-medium text-gray-500">Layers</div>
|
|
72
|
+
<div class="flex-1 resize-none overflow-y-auto">
|
|
73
|
+
<div class="flex flex-col gap-2">
|
|
74
|
+
<section
|
|
75
|
+
class="flex flex-col-reverse gap-2"
|
|
76
|
+
aria-label="Layers"
|
|
77
|
+
use:dndzone={{
|
|
78
|
+
items: editor.activeSlide.layers,
|
|
79
|
+
dragDisabled: editor.activeSlide.locked,
|
|
80
|
+
...otherOptions,
|
|
81
|
+
}}
|
|
82
|
+
onconsider={handleDndConsider}
|
|
83
|
+
onfinalize={handleDndFinalize}
|
|
84
|
+
>
|
|
85
|
+
{#each editor.activeSlide.layers as layer (layer.id)}
|
|
86
|
+
<div aria-label={layer.type} animate:flip={{ duration: flipDurationMs }}>
|
|
87
|
+
<ContextMenu.Root
|
|
88
|
+
onOpenChange={(open) =>
|
|
89
|
+
open && !editor.activeLayerIds.has(layer.id) && editor.setActiveLayers(layer.id)}
|
|
90
|
+
>
|
|
91
|
+
<ContextMenu.Trigger>
|
|
92
|
+
<LayerButton {layer}>
|
|
93
|
+
<LayerThumbWrapper {layer} thumb={{ width: 192, height: 32 }}>
|
|
94
|
+
{#snippet children({ thumbScale })}
|
|
95
|
+
{#if layer.type === 'html'}
|
|
96
|
+
<HtmlLayerContent {layer} {thumbScale} />
|
|
97
|
+
{:else if layer.type === 'image'}
|
|
98
|
+
<ImageLayerContent {layer} {thumbScale} />
|
|
99
|
+
{/if}
|
|
100
|
+
{/snippet}
|
|
101
|
+
</LayerThumbWrapper>
|
|
102
|
+
</LayerButton>
|
|
103
|
+
</ContextMenu.Trigger>
|
|
104
|
+
<ContextMenu.Content class="w-72">
|
|
105
|
+
<LayerMenuContent />
|
|
106
|
+
</ContextMenu.Content>
|
|
107
|
+
</ContextMenu.Root>
|
|
108
|
+
</div>
|
|
109
|
+
{/each}
|
|
110
|
+
</section>
|
|
111
|
+
<ContextMenu.Root>
|
|
112
|
+
<ContextMenu.Trigger>
|
|
113
|
+
<LayerButton>
|
|
114
|
+
{@const thumbScale = Math.max(192 / editor.width, 32 / editor.height)}
|
|
115
|
+
<div
|
|
116
|
+
class="absolute top-1/2 -translate-y-1/2"
|
|
117
|
+
style:width="{editor.width * thumbScale}px"
|
|
118
|
+
style:height="{editor.height * thumbScale}px"
|
|
119
|
+
>
|
|
120
|
+
<BackgroundLayerContent slide={editor.activeSlide} {thumbScale} />
|
|
121
|
+
</div>
|
|
122
|
+
</LayerButton>
|
|
123
|
+
</ContextMenu.Trigger>
|
|
124
|
+
<ContextMenu.Content class="w-72">
|
|
125
|
+
<BackgroundMenuContent {editor} slide={editor.activeSlide} />
|
|
126
|
+
</ContextMenu.Content>
|
|
127
|
+
</ContextMenu.Root>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const PositionSlidebar: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type PositionSlidebar = InstanceType<typeof PositionSlidebar>;
|
|
18
|
+
export default PositionSlidebar;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from '../../ui/button/button.svelte';
|
|
3
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
4
|
+
import { HtmlContent } from '../layers/types/html/index.js';
|
|
5
|
+
import type { DraggedHtml } from '../types.js';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
html: DraggedHtml['html'];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { html }: Props = $props();
|
|
12
|
+
|
|
13
|
+
let ref: HTMLDivElement;
|
|
14
|
+
|
|
15
|
+
const editor = getPresentationEditorContext();
|
|
16
|
+
|
|
17
|
+
let dragging = $state(false);
|
|
18
|
+
|
|
19
|
+
const scale = 4;
|
|
20
|
+
|
|
21
|
+
const onDocumentDragEnter = (e: DragEvent) => {
|
|
22
|
+
console.log('document dragenter', e);
|
|
23
|
+
if (editor.dragged) {
|
|
24
|
+
editor.dragged = { ...editor.dragged, inside: false };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onDragStart = (e: DragEvent) => {
|
|
29
|
+
if (!e.target || !e.dataTransfer) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
34
|
+
editor.dragged = {
|
|
35
|
+
x: e.clientX,
|
|
36
|
+
y: e.clientY,
|
|
37
|
+
offsetX: e.offsetX,
|
|
38
|
+
offsetY: e.offsetY,
|
|
39
|
+
opacity: 1,
|
|
40
|
+
hidden: false,
|
|
41
|
+
sticky: true,
|
|
42
|
+
inside: false,
|
|
43
|
+
initialScale: 1,
|
|
44
|
+
scale,
|
|
45
|
+
html,
|
|
46
|
+
};
|
|
47
|
+
addEventListener('dragenter', onDocumentDragEnter);
|
|
48
|
+
dragging = true;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const onDragEnd = (e: DragEvent) => {
|
|
52
|
+
console.log('dragend', e);
|
|
53
|
+
removeEventListener('dragenter', onDocumentDragEnter);
|
|
54
|
+
dragging = false;
|
|
55
|
+
editor.dragged = null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onDrag = (e: DragEvent) => {
|
|
59
|
+
// console.log('drag', e);
|
|
60
|
+
if (editor.dragged) {
|
|
61
|
+
editor.dragged = { ...editor.dragged, x: e.clientX, y: e.clientY };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const createLayer = () => {
|
|
66
|
+
const rect = ref.getBoundingClientRect();
|
|
67
|
+
const layer = editor.buildHtmlLayer({
|
|
68
|
+
width: rect.width,
|
|
69
|
+
height: rect.height,
|
|
70
|
+
scale,
|
|
71
|
+
html,
|
|
72
|
+
});
|
|
73
|
+
editor.addLayers(editor.activeSlide.id, layer);
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<Button variant="outline" class="h-auto justify-start py-0" onclick={createLayer}>
|
|
78
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
79
|
+
<div
|
|
80
|
+
bind:this={ref}
|
|
81
|
+
class="my-2"
|
|
82
|
+
draggable={true}
|
|
83
|
+
ondragstart={onDragStart}
|
|
84
|
+
ondragend={onDragEnd}
|
|
85
|
+
ondrag={onDrag}
|
|
86
|
+
style:opacity={dragging ? 0 : null}
|
|
87
|
+
>
|
|
88
|
+
<HtmlContent {html} />
|
|
89
|
+
</div>
|
|
90
|
+
</Button>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DraggedHtml } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
html: DraggedHtml['html'];
|
|
4
|
+
}
|
|
5
|
+
declare const SidebarTextTabButton: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type SidebarTextTabButton = ReturnType<typeof SidebarTextTabButton>;
|
|
7
|
+
export default SidebarTextTabButton;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import TextIcon from 'lucide-svelte/icons/type';
|
|
3
|
+
import Button from '../../ui/button/button.svelte';
|
|
4
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
5
|
+
import { buildParagraphHtml } from '../utils.js';
|
|
6
|
+
import SidebarTextTabButton from './sidebar-text-tab-button.svelte';
|
|
7
|
+
|
|
8
|
+
const editor = getPresentationEditorContext();
|
|
9
|
+
|
|
10
|
+
const createTextBox = () => {
|
|
11
|
+
const fontSize = 80 / 0.75;
|
|
12
|
+
const lineHeight = 1;
|
|
13
|
+
const layer = editor.buildHtmlLayer({
|
|
14
|
+
html: buildParagraphHtml({
|
|
15
|
+
text: 'Your paragraph text',
|
|
16
|
+
fontSize,
|
|
17
|
+
lineHeight,
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
bold: true,
|
|
20
|
+
italic: true,
|
|
21
|
+
uppercase: true,
|
|
22
|
+
}),
|
|
23
|
+
width: 1280,
|
|
24
|
+
height: fontSize * lineHeight,
|
|
25
|
+
});
|
|
26
|
+
editor.addLayers(editor.activeSlide.id, layer);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const defaultTextButtons = [
|
|
30
|
+
{
|
|
31
|
+
text: 'Add a heading',
|
|
32
|
+
fontSize: 28,
|
|
33
|
+
fontWeight: 700,
|
|
34
|
+
html: buildParagraphHtml({
|
|
35
|
+
text: 'Add a heading',
|
|
36
|
+
fontSize: 28,
|
|
37
|
+
lineHeight: 1.4,
|
|
38
|
+
textAlign: 'center',
|
|
39
|
+
bold: true,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
text: 'Add a subheading',
|
|
44
|
+
fontSize: 16.8,
|
|
45
|
+
fontWeight: 700,
|
|
46
|
+
html: buildParagraphHtml({
|
|
47
|
+
text: 'Add a subheading',
|
|
48
|
+
fontSize: 16.8,
|
|
49
|
+
lineHeight: 1.4,
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
bold: true,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
text: 'Add a little bit of body text',
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
fontWeight: 400,
|
|
58
|
+
html: buildParagraphHtml({
|
|
59
|
+
text: 'Add a little bit of body text',
|
|
60
|
+
fontSize: 12,
|
|
61
|
+
lineHeight: 1.4,
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div class="flex flex-col">
|
|
69
|
+
<Button variant="default" class="w-full" onclick={createTextBox}>
|
|
70
|
+
<TextIcon />
|
|
71
|
+
Add a text box
|
|
72
|
+
</Button>
|
|
73
|
+
|
|
74
|
+
<div class="flex-1 py-4">
|
|
75
|
+
<div class="flex flex-col gap-2">
|
|
76
|
+
<p class="text-sm font-semibold">Default text styles</p>
|
|
77
|
+
{#each defaultTextButtons as button}
|
|
78
|
+
<SidebarTextTabButton html={button.html} />
|
|
79
|
+
{/each}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const SidebarTextTab: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type SidebarTextTab = InstanceType<typeof SidebarTextTab>;
|
|
18
|
+
export default SidebarTextTab;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import XIcon from 'lucide-svelte/icons/x';
|
|
3
|
+
import { Button } from '../../ui/button/index.js';
|
|
4
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
name: string;
|
|
8
|
+
children?: import('svelte').Snippet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { name, children }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const editor = getPresentationEditorContext();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class="flex h-full select-none flex-col gap-2">
|
|
17
|
+
<div class="flex items-center justify-between">
|
|
18
|
+
<div class="text-sm font-bold">{name}</div>
|
|
19
|
+
<Button variant="ghost" size="icon" onclick={() => (editor.activeSidebarPopup = null)}>
|
|
20
|
+
<XIcon />
|
|
21
|
+
</Button>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|