@autumnsgrove/groveengine 0.3.3 → 0.4.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/auth/index.d.ts +2 -0
- package/dist/auth/index.js +5 -0
- package/dist/components/admin/GutterManager.svelte +4 -4
- package/dist/components/admin/MarkdownEditor.svelte +381 -1311
- package/dist/components/admin/MarkdownEditor.svelte.d.ts +2 -8
- package/dist/components/admin/composables/index.d.ts +7 -0
- package/dist/components/admin/composables/index.js +12 -0
- package/dist/components/admin/composables/useAmbientSounds.svelte.d.ts +53 -0
- package/dist/components/admin/composables/useAmbientSounds.svelte.js +192 -0
- package/dist/components/admin/composables/useCommandPalette.svelte.d.ts +17 -0
- package/dist/components/admin/composables/useCommandPalette.svelte.js +118 -0
- package/dist/components/admin/composables/useDraftManager.svelte.d.ts +17 -0
- package/dist/components/admin/composables/useDraftManager.svelte.js +154 -0
- package/dist/components/admin/composables/useEditorTheme.svelte.d.ts +195 -0
- package/dist/components/admin/composables/useEditorTheme.svelte.js +182 -0
- package/dist/components/admin/composables/useSlashCommands.svelte.d.ts +32 -0
- package/dist/components/admin/composables/useSlashCommands.svelte.js +166 -0
- package/dist/components/admin/composables/useSnippets.svelte.d.ts +5 -0
- package/dist/components/admin/composables/useSnippets.svelte.js +122 -0
- package/dist/components/admin/composables/useWritingSession.svelte.d.ts +13 -0
- package/dist/components/admin/composables/useWritingSession.svelte.js +100 -0
- package/dist/components/custom/ContentWithGutter.svelte +1 -1
- package/dist/components/custom/GutterItem.svelte +2 -2
- package/dist/config/ai-models.d.ts +25 -0
- package/dist/config/ai-models.js +50 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +4 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -6
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +4 -0
- package/dist/ui/components/charts/ActivityOverview.svelte +293 -0
- package/dist/ui/components/charts/ActivityOverview.svelte.d.ts +12 -0
- package/dist/ui/components/charts/LOCBar.svelte +129 -0
- package/dist/ui/components/charts/LOCBar.svelte.d.ts +21 -0
- package/dist/ui/components/charts/RepoBreakdown.svelte +136 -0
- package/dist/ui/components/charts/RepoBreakdown.svelte.d.ts +16 -0
- package/dist/ui/components/charts/Sparkline.svelte +139 -0
- package/dist/ui/components/charts/Sparkline.svelte.d.ts +6 -0
- package/dist/ui/components/charts/index.d.ts +5 -0
- package/dist/ui/components/charts/index.js +11 -0
- package/dist/ui/components/content/PlanCard.svelte +91 -0
- package/dist/ui/components/content/PlanCard.svelte.d.ts +13 -0
- package/dist/ui/components/content/ProductCard.svelte +125 -0
- package/dist/ui/components/content/ProductCard.svelte.d.ts +14 -0
- package/dist/ui/components/content/SearchCard.svelte +60 -0
- package/dist/ui/components/content/SearchCard.svelte.d.ts +10 -0
- package/dist/ui/components/content/index.d.ts +4 -0
- package/dist/ui/components/content/index.js +10 -0
- package/dist/ui/components/forms/SearchInput.svelte +89 -0
- package/dist/ui/components/forms/SearchInput.svelte.d.ts +11 -0
- package/dist/ui/components/forms/index.d.ts +2 -0
- package/dist/ui/components/forms/index.js +8 -0
- package/dist/ui/components/gallery/index.d.ts +5 -0
- package/dist/ui/components/gallery/index.js +13 -0
- package/dist/ui/components/icons/IconLegend.svelte +83 -0
- package/dist/ui/components/icons/IconLegend.svelte.d.ts +11 -0
- package/dist/ui/components/icons/Icons.svelte +115 -0
- package/dist/ui/components/icons/Icons.svelte.d.ts +8 -0
- package/dist/ui/components/icons/index.d.ts +3 -0
- package/dist/ui/components/icons/index.js +9 -0
- package/dist/ui/components/indicators/CreditBalance.svelte +67 -0
- package/dist/ui/components/indicators/CreditBalance.svelte.d.ts +9 -0
- package/dist/ui/components/indicators/ScoreBar.svelte +63 -0
- package/dist/ui/components/indicators/ScoreBar.svelte.d.ts +9 -0
- package/dist/ui/components/indicators/StatusBadge.svelte +46 -0
- package/dist/ui/components/indicators/StatusBadge.svelte.d.ts +7 -0
- package/dist/ui/components/indicators/index.d.ts +4 -0
- package/dist/ui/components/indicators/index.js +10 -0
- package/dist/{components/ui → ui/components/primitives}/accordion/accordion-content.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/accordion/accordion-item.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/accordion/accordion-trigger.svelte +1 -1
- package/dist/ui/components/primitives/badge/badge.svelte +50 -0
- package/dist/ui/components/primitives/badge/badge.svelte.d.ts +60 -0
- package/dist/ui/components/primitives/badge/index.d.ts +2 -0
- package/dist/ui/components/primitives/badge/index.js +2 -0
- package/dist/ui/components/primitives/button/button.svelte +82 -0
- package/dist/ui/components/primitives/button/button.svelte.d.ts +132 -0
- package/dist/ui/components/primitives/button/index.d.ts +2 -0
- package/dist/ui/components/primitives/button/index.js +4 -0
- package/dist/ui/components/primitives/card/card-content.svelte +16 -0
- package/dist/ui/components/primitives/card/card-content.svelte.d.ts +5 -0
- package/dist/ui/components/primitives/card/card-description.svelte +16 -0
- package/dist/ui/components/primitives/card/card-description.svelte.d.ts +5 -0
- package/dist/ui/components/primitives/card/card-footer.svelte +16 -0
- package/dist/ui/components/primitives/card/card-footer.svelte.d.ts +5 -0
- package/dist/ui/components/primitives/card/card-header.svelte +16 -0
- package/dist/ui/components/primitives/card/card-header.svelte.d.ts +5 -0
- package/dist/ui/components/primitives/card/card-title.svelte +25 -0
- package/dist/ui/components/primitives/card/card-title.svelte.d.ts +8 -0
- package/dist/ui/components/primitives/card/card.svelte +20 -0
- package/dist/ui/components/primitives/card/card.svelte.d.ts +5 -0
- package/dist/ui/components/primitives/card/index.d.ts +7 -0
- package/dist/ui/components/primitives/card/index.js +9 -0
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-content.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-description.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-footer.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-header.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-overlay.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/dialog/dialog-title.svelte +1 -1
- package/dist/ui/components/primitives/input/index.d.ts +2 -0
- package/dist/ui/components/primitives/input/index.js +4 -0
- package/dist/ui/components/primitives/input/input.svelte +46 -0
- package/dist/ui/components/primitives/input/input.svelte.d.ts +13 -0
- package/dist/{components/ui → ui/components/primitives}/select/select-content.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-group-heading.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-item.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-scroll-down-button.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-scroll-up-button.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-separator.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/select/select-trigger.svelte +1 -1
- package/dist/ui/components/primitives/separator/index.d.ts +2 -0
- package/dist/ui/components/primitives/separator/index.js +4 -0
- package/dist/ui/components/primitives/separator/separator.svelte +22 -0
- package/dist/ui/components/primitives/separator/separator.svelte.d.ts +4 -0
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-content.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-description.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-footer.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-header.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-overlay.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/sheet/sheet-title.svelte +1 -1
- package/dist/ui/components/primitives/skeleton/index.d.ts +2 -0
- package/dist/ui/components/primitives/skeleton/index.js +4 -0
- package/dist/ui/components/primitives/skeleton/skeleton.svelte +17 -0
- package/dist/ui/components/primitives/skeleton/skeleton.svelte.d.ts +5 -0
- package/dist/{components/ui → ui/components/primitives}/table/table-body.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-caption.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-cell.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-footer.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-head.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-header.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table-row.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/table/table.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/tabs/tabs-content.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/tabs/tabs-list.svelte +1 -1
- package/dist/{components/ui → ui/components/primitives}/tabs/tabs-trigger.svelte +1 -1
- package/dist/ui/components/primitives/textarea/index.d.ts +2 -0
- package/dist/ui/components/primitives/textarea/index.js +4 -0
- package/dist/ui/components/primitives/textarea/textarea.svelte +24 -0
- package/dist/ui/components/primitives/textarea/textarea.svelte.d.ts +6 -0
- package/dist/ui/components/states/EmptyState.svelte +28 -0
- package/dist/ui/components/states/EmptyState.svelte.d.ts +10 -0
- package/dist/ui/components/states/Loading.svelte +62 -0
- package/dist/ui/components/states/Loading.svelte.d.ts +7 -0
- package/dist/ui/components/states/LoadingSkeleton.svelte +46 -0
- package/dist/ui/components/states/LoadingSkeleton.svelte.d.ts +8 -0
- package/dist/ui/components/states/ThemeToggle.svelte +138 -0
- package/dist/ui/components/states/ThemeToggle.svelte.d.ts +6 -0
- package/dist/ui/components/states/index.d.ts +5 -0
- package/dist/ui/components/states/index.js +11 -0
- package/dist/{components → ui/components}/ui/Accordion.svelte +1 -1
- package/dist/ui/components/ui/Badge.svelte +52 -0
- package/dist/ui/components/ui/Badge.svelte.d.ts +28 -0
- package/dist/ui/components/ui/Button.svelte +77 -0
- package/dist/ui/components/ui/Button.svelte.d.ts +34 -0
- package/dist/ui/components/ui/Card.svelte +102 -0
- package/dist/ui/components/ui/Card.svelte.d.ts +46 -0
- package/dist/ui/components/ui/CollapsibleSection.svelte +65 -0
- package/dist/ui/components/ui/CollapsibleSection.svelte.d.ts +10 -0
- package/dist/{components → ui/components}/ui/Dialog.svelte +1 -1
- package/dist/ui/components/ui/Input.svelte +81 -0
- package/dist/ui/components/ui/Input.svelte.d.ts +35 -0
- package/dist/{components → ui/components}/ui/Select.svelte +1 -1
- package/dist/{components → ui/components}/ui/Sheet.svelte +1 -1
- package/dist/ui/components/ui/Skeleton.svelte +31 -0
- package/dist/ui/components/ui/Skeleton.svelte.d.ts +26 -0
- package/dist/ui/components/ui/Spinner.svelte +45 -0
- package/dist/ui/components/ui/Spinner.svelte.d.ts +15 -0
- package/dist/{components → ui/components}/ui/Table.svelte +2 -2
- package/dist/{components → ui/components}/ui/Table.svelte.d.ts +1 -1
- package/dist/{components → ui/components}/ui/Tabs.svelte +2 -2
- package/dist/ui/components/ui/Textarea.svelte +81 -0
- package/dist/ui/components/ui/Textarea.svelte.d.ts +35 -0
- package/dist/{components → ui/components}/ui/Toast.svelte +1 -1
- package/dist/ui/components/ui/index.d.ts +18 -0
- package/dist/ui/components/ui/index.js +28 -0
- package/dist/{components → ui/components}/ui/toast.d.ts +1 -1
- package/dist/{components → ui/components}/ui/toast.js +2 -2
- package/dist/ui/index.d.ts +10 -0
- package/dist/ui/index.js +22 -0
- package/dist/ui/stores/theme.d.ts +12 -0
- package/dist/ui/stores/theme.js +52 -0
- package/dist/ui/styles/content.css +514 -0
- package/dist/ui/styles/grove.css +715 -0
- package/dist/ui/styles/tokens.css +429 -0
- package/dist/ui/tailwind.preset.d.ts +340 -0
- package/dist/ui/tailwind.preset.js +441 -0
- package/dist/ui/tokens/animation.d.ts +417 -0
- package/dist/ui/tokens/animation.js +139 -0
- package/dist/ui/tokens/colors.d.ts +183 -0
- package/dist/ui/tokens/colors.js +97 -0
- package/dist/ui/tokens/effects.d.ts +111 -0
- package/dist/ui/tokens/effects.js +61 -0
- package/dist/ui/tokens/index.d.ts +6 -0
- package/dist/ui/tokens/index.js +19 -0
- package/dist/ui/tokens/spacing.d.ts +89 -0
- package/dist/ui/tokens/spacing.js +49 -0
- package/dist/ui/tokens/typography.d.ts +85 -0
- package/dist/ui/tokens/typography.js +68 -0
- package/dist/ui/utils/cn.d.ts +13 -0
- package/dist/ui/utils/cn.js +24 -0
- package/dist/ui/utils/index.d.ts +2 -0
- package/dist/ui/utils/index.js +8 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +14 -0
- package/dist/utils/markdown.d.ts +11 -0
- package/dist/utils/markdown.js +25 -0
- package/dist/utils/sanitize.js +2 -3
- package/package.json +73 -10
- package/dist/components/ui/index.d.ts +0 -14
- package/dist/components/ui/index.js +0 -18
- /package/dist/{components → ui/components}/gallery/ImageGallery.svelte +0 -0
- /package/dist/{components → ui/components}/gallery/ImageGallery.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/gallery/Lightbox.svelte +0 -0
- /package/dist/{components → ui/components}/gallery/Lightbox.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/gallery/LightboxCaption.svelte +0 -0
- /package/dist/{components → ui/components}/gallery/LightboxCaption.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/gallery/ZoomableImage.svelte +0 -0
- /package/dist/{components → ui/components}/gallery/ZoomableImage.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/accordion/accordion-content.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/accordion/accordion-item.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/accordion/accordion-trigger.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/accordion/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/accordion/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-content.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-description.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-footer.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-header.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-overlay.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/dialog-title.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/dialog/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-content.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-group-heading.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-item.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-scroll-down-button.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-scroll-up-button.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-separator.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/select/select-trigger.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-content.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-description.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-footer.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-header.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-overlay.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/sheet/sheet-title.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-body.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-caption.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-cell.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-footer.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-head.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-header.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table-row.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/table/table.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/tabs/index.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/tabs/index.js +0 -0
- /package/dist/{components/ui → ui/components/primitives}/tabs/tabs-content.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/tabs/tabs-list.svelte.d.ts +0 -0
- /package/dist/{components/ui → ui/components/primitives}/tabs/tabs-trigger.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Accordion.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Dialog.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Select.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Sheet.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Tabs.svelte.d.ts +0 -0
- /package/dist/{components → ui/components}/ui/Toast.svelte.d.ts +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an editor theme manager with Svelte 5 runes
|
|
3
|
+
* @returns {object} Theme state and controls
|
|
4
|
+
*/
|
|
5
|
+
export function useEditorTheme(): object;
|
|
6
|
+
export namespace themes {
|
|
7
|
+
namespace grove {
|
|
8
|
+
let name: string;
|
|
9
|
+
let label: string;
|
|
10
|
+
let desc: string;
|
|
11
|
+
let accent: string;
|
|
12
|
+
let accentDim: string;
|
|
13
|
+
let accentBright: string;
|
|
14
|
+
let accentGlow: string;
|
|
15
|
+
let bg: string;
|
|
16
|
+
let bgSecondary: string;
|
|
17
|
+
let bgTertiary: string;
|
|
18
|
+
let border: string;
|
|
19
|
+
let borderAccent: string;
|
|
20
|
+
let text: string;
|
|
21
|
+
let textDim: string;
|
|
22
|
+
let statusBg: string;
|
|
23
|
+
let statusBorder: string;
|
|
24
|
+
}
|
|
25
|
+
namespace amber {
|
|
26
|
+
let name_1: string;
|
|
27
|
+
export { name_1 as name };
|
|
28
|
+
let label_1: string;
|
|
29
|
+
export { label_1 as label };
|
|
30
|
+
let desc_1: string;
|
|
31
|
+
export { desc_1 as desc };
|
|
32
|
+
let accent_1: string;
|
|
33
|
+
export { accent_1 as accent };
|
|
34
|
+
let accentDim_1: string;
|
|
35
|
+
export { accentDim_1 as accentDim };
|
|
36
|
+
let accentBright_1: string;
|
|
37
|
+
export { accentBright_1 as accentBright };
|
|
38
|
+
let accentGlow_1: string;
|
|
39
|
+
export { accentGlow_1 as accentGlow };
|
|
40
|
+
let bg_1: string;
|
|
41
|
+
export { bg_1 as bg };
|
|
42
|
+
let bgSecondary_1: string;
|
|
43
|
+
export { bgSecondary_1 as bgSecondary };
|
|
44
|
+
let bgTertiary_1: string;
|
|
45
|
+
export { bgTertiary_1 as bgTertiary };
|
|
46
|
+
let border_1: string;
|
|
47
|
+
export { border_1 as border };
|
|
48
|
+
let borderAccent_1: string;
|
|
49
|
+
export { borderAccent_1 as borderAccent };
|
|
50
|
+
let text_1: string;
|
|
51
|
+
export { text_1 as text };
|
|
52
|
+
let textDim_1: string;
|
|
53
|
+
export { textDim_1 as textDim };
|
|
54
|
+
let statusBg_1: string;
|
|
55
|
+
export { statusBg_1 as statusBg };
|
|
56
|
+
let statusBorder_1: string;
|
|
57
|
+
export { statusBorder_1 as statusBorder };
|
|
58
|
+
}
|
|
59
|
+
namespace matrix {
|
|
60
|
+
let name_2: string;
|
|
61
|
+
export { name_2 as name };
|
|
62
|
+
let label_2: string;
|
|
63
|
+
export { label_2 as label };
|
|
64
|
+
let desc_2: string;
|
|
65
|
+
export { desc_2 as desc };
|
|
66
|
+
let accent_2: string;
|
|
67
|
+
export { accent_2 as accent };
|
|
68
|
+
let accentDim_2: string;
|
|
69
|
+
export { accentDim_2 as accentDim };
|
|
70
|
+
let accentBright_2: string;
|
|
71
|
+
export { accentBright_2 as accentBright };
|
|
72
|
+
let accentGlow_2: string;
|
|
73
|
+
export { accentGlow_2 as accentGlow };
|
|
74
|
+
let bg_2: string;
|
|
75
|
+
export { bg_2 as bg };
|
|
76
|
+
let bgSecondary_2: string;
|
|
77
|
+
export { bgSecondary_2 as bgSecondary };
|
|
78
|
+
let bgTertiary_2: string;
|
|
79
|
+
export { bgTertiary_2 as bgTertiary };
|
|
80
|
+
let border_2: string;
|
|
81
|
+
export { border_2 as border };
|
|
82
|
+
let borderAccent_2: string;
|
|
83
|
+
export { borderAccent_2 as borderAccent };
|
|
84
|
+
let text_2: string;
|
|
85
|
+
export { text_2 as text };
|
|
86
|
+
let textDim_2: string;
|
|
87
|
+
export { textDim_2 as textDim };
|
|
88
|
+
let statusBg_2: string;
|
|
89
|
+
export { statusBg_2 as statusBg };
|
|
90
|
+
let statusBorder_2: string;
|
|
91
|
+
export { statusBorder_2 as statusBorder };
|
|
92
|
+
}
|
|
93
|
+
namespace dracula {
|
|
94
|
+
let name_3: string;
|
|
95
|
+
export { name_3 as name };
|
|
96
|
+
let label_3: string;
|
|
97
|
+
export { label_3 as label };
|
|
98
|
+
let desc_3: string;
|
|
99
|
+
export { desc_3 as desc };
|
|
100
|
+
let accent_3: string;
|
|
101
|
+
export { accent_3 as accent };
|
|
102
|
+
let accentDim_3: string;
|
|
103
|
+
export { accentDim_3 as accentDim };
|
|
104
|
+
let accentBright_3: string;
|
|
105
|
+
export { accentBright_3 as accentBright };
|
|
106
|
+
let accentGlow_3: string;
|
|
107
|
+
export { accentGlow_3 as accentGlow };
|
|
108
|
+
let bg_3: string;
|
|
109
|
+
export { bg_3 as bg };
|
|
110
|
+
let bgSecondary_3: string;
|
|
111
|
+
export { bgSecondary_3 as bgSecondary };
|
|
112
|
+
let bgTertiary_3: string;
|
|
113
|
+
export { bgTertiary_3 as bgTertiary };
|
|
114
|
+
let border_3: string;
|
|
115
|
+
export { border_3 as border };
|
|
116
|
+
let borderAccent_3: string;
|
|
117
|
+
export { borderAccent_3 as borderAccent };
|
|
118
|
+
let text_3: string;
|
|
119
|
+
export { text_3 as text };
|
|
120
|
+
let textDim_3: string;
|
|
121
|
+
export { textDim_3 as textDim };
|
|
122
|
+
let statusBg_3: string;
|
|
123
|
+
export { statusBg_3 as statusBg };
|
|
124
|
+
let statusBorder_3: string;
|
|
125
|
+
export { statusBorder_3 as statusBorder };
|
|
126
|
+
}
|
|
127
|
+
namespace nord {
|
|
128
|
+
let name_4: string;
|
|
129
|
+
export { name_4 as name };
|
|
130
|
+
let label_4: string;
|
|
131
|
+
export { label_4 as label };
|
|
132
|
+
let desc_4: string;
|
|
133
|
+
export { desc_4 as desc };
|
|
134
|
+
let accent_4: string;
|
|
135
|
+
export { accent_4 as accent };
|
|
136
|
+
let accentDim_4: string;
|
|
137
|
+
export { accentDim_4 as accentDim };
|
|
138
|
+
let accentBright_4: string;
|
|
139
|
+
export { accentBright_4 as accentBright };
|
|
140
|
+
let accentGlow_4: string;
|
|
141
|
+
export { accentGlow_4 as accentGlow };
|
|
142
|
+
let bg_4: string;
|
|
143
|
+
export { bg_4 as bg };
|
|
144
|
+
let bgSecondary_4: string;
|
|
145
|
+
export { bgSecondary_4 as bgSecondary };
|
|
146
|
+
let bgTertiary_4: string;
|
|
147
|
+
export { bgTertiary_4 as bgTertiary };
|
|
148
|
+
let border_4: string;
|
|
149
|
+
export { border_4 as border };
|
|
150
|
+
let borderAccent_4: string;
|
|
151
|
+
export { borderAccent_4 as borderAccent };
|
|
152
|
+
let text_4: string;
|
|
153
|
+
export { text_4 as text };
|
|
154
|
+
let textDim_4: string;
|
|
155
|
+
export { textDim_4 as textDim };
|
|
156
|
+
let statusBg_4: string;
|
|
157
|
+
export { statusBg_4 as statusBg };
|
|
158
|
+
let statusBorder_4: string;
|
|
159
|
+
export { statusBorder_4 as statusBorder };
|
|
160
|
+
}
|
|
161
|
+
namespace rose {
|
|
162
|
+
let name_5: string;
|
|
163
|
+
export { name_5 as name };
|
|
164
|
+
let label_5: string;
|
|
165
|
+
export { label_5 as label };
|
|
166
|
+
let desc_5: string;
|
|
167
|
+
export { desc_5 as desc };
|
|
168
|
+
let accent_5: string;
|
|
169
|
+
export { accent_5 as accent };
|
|
170
|
+
let accentDim_5: string;
|
|
171
|
+
export { accentDim_5 as accentDim };
|
|
172
|
+
let accentBright_5: string;
|
|
173
|
+
export { accentBright_5 as accentBright };
|
|
174
|
+
let accentGlow_5: string;
|
|
175
|
+
export { accentGlow_5 as accentGlow };
|
|
176
|
+
let bg_5: string;
|
|
177
|
+
export { bg_5 as bg };
|
|
178
|
+
let bgSecondary_5: string;
|
|
179
|
+
export { bgSecondary_5 as bgSecondary };
|
|
180
|
+
let bgTertiary_5: string;
|
|
181
|
+
export { bgTertiary_5 as bgTertiary };
|
|
182
|
+
let border_5: string;
|
|
183
|
+
export { border_5 as border };
|
|
184
|
+
let borderAccent_5: string;
|
|
185
|
+
export { borderAccent_5 as borderAccent };
|
|
186
|
+
let text_5: string;
|
|
187
|
+
export { text_5 as text };
|
|
188
|
+
let textDim_5: string;
|
|
189
|
+
export { textDim_5 as textDim };
|
|
190
|
+
let statusBg_5: string;
|
|
191
|
+
export { statusBg_5 as statusBg };
|
|
192
|
+
let statusBorder_5: string;
|
|
193
|
+
export { statusBorder_5 as statusBorder };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Theme Composable
|
|
3
|
+
* Manages theme selection and CSS variable application
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const THEME_STORAGE_KEY = "grove-editor-theme";
|
|
7
|
+
|
|
8
|
+
// Theme definitions
|
|
9
|
+
export const themes = {
|
|
10
|
+
grove: {
|
|
11
|
+
name: "grove",
|
|
12
|
+
label: "Grove",
|
|
13
|
+
desc: "forest green",
|
|
14
|
+
accent: "#8bc48b",
|
|
15
|
+
accentDim: "#7a9a7a",
|
|
16
|
+
accentBright: "#a8dca8",
|
|
17
|
+
accentGlow: "#c8f0c8",
|
|
18
|
+
bg: "#1e1e1e",
|
|
19
|
+
bgSecondary: "#252526",
|
|
20
|
+
bgTertiary: "#1a1a1a",
|
|
21
|
+
border: "#3a3a3a",
|
|
22
|
+
borderAccent: "#4a7c4a",
|
|
23
|
+
text: "#d4d4d4",
|
|
24
|
+
textDim: "#9d9d9d",
|
|
25
|
+
statusBg: "#2d4a2d",
|
|
26
|
+
statusBorder: "#3d5a3d",
|
|
27
|
+
},
|
|
28
|
+
amber: {
|
|
29
|
+
name: "amber",
|
|
30
|
+
label: "Amber",
|
|
31
|
+
desc: "classic terminal",
|
|
32
|
+
accent: "#ffb000",
|
|
33
|
+
accentDim: "#c98b00",
|
|
34
|
+
accentBright: "#ffc940",
|
|
35
|
+
accentGlow: "#ffe080",
|
|
36
|
+
bg: "#1a1400",
|
|
37
|
+
bgSecondary: "#241c00",
|
|
38
|
+
bgTertiary: "#140e00",
|
|
39
|
+
border: "#3a3000",
|
|
40
|
+
borderAccent: "#5a4800",
|
|
41
|
+
text: "#ffcc66",
|
|
42
|
+
textDim: "#aa8844",
|
|
43
|
+
statusBg: "#2a2000",
|
|
44
|
+
statusBorder: "#3a3000",
|
|
45
|
+
},
|
|
46
|
+
matrix: {
|
|
47
|
+
name: "matrix",
|
|
48
|
+
label: "Matrix",
|
|
49
|
+
desc: "digital rain",
|
|
50
|
+
accent: "#00ff00",
|
|
51
|
+
accentDim: "#00aa00",
|
|
52
|
+
accentBright: "#44ff44",
|
|
53
|
+
accentGlow: "#88ff88",
|
|
54
|
+
bg: "#0a0a0a",
|
|
55
|
+
bgSecondary: "#111111",
|
|
56
|
+
bgTertiary: "#050505",
|
|
57
|
+
border: "#1a3a1a",
|
|
58
|
+
borderAccent: "#00aa00",
|
|
59
|
+
text: "#00dd00",
|
|
60
|
+
textDim: "#008800",
|
|
61
|
+
statusBg: "#0a1a0a",
|
|
62
|
+
statusBorder: "#1a3a1a",
|
|
63
|
+
},
|
|
64
|
+
dracula: {
|
|
65
|
+
name: "dracula",
|
|
66
|
+
label: "Dracula",
|
|
67
|
+
desc: "purple night",
|
|
68
|
+
accent: "#bd93f9",
|
|
69
|
+
accentDim: "#9580c9",
|
|
70
|
+
accentBright: "#d4b0ff",
|
|
71
|
+
accentGlow: "#e8d0ff",
|
|
72
|
+
bg: "#282a36",
|
|
73
|
+
bgSecondary: "#343746",
|
|
74
|
+
bgTertiary: "#21222c",
|
|
75
|
+
border: "#44475a",
|
|
76
|
+
borderAccent: "#6272a4",
|
|
77
|
+
text: "#f8f8f2",
|
|
78
|
+
textDim: "#a0a0a0",
|
|
79
|
+
statusBg: "#3a3c4e",
|
|
80
|
+
statusBorder: "#44475a",
|
|
81
|
+
},
|
|
82
|
+
nord: {
|
|
83
|
+
name: "nord",
|
|
84
|
+
label: "Nord",
|
|
85
|
+
desc: "arctic frost",
|
|
86
|
+
accent: "#88c0d0",
|
|
87
|
+
accentDim: "#6a9aa8",
|
|
88
|
+
accentBright: "#a3d4e2",
|
|
89
|
+
accentGlow: "#c0e8f0",
|
|
90
|
+
bg: "#2e3440",
|
|
91
|
+
bgSecondary: "#3b4252",
|
|
92
|
+
bgTertiary: "#272c36",
|
|
93
|
+
border: "#434c5e",
|
|
94
|
+
borderAccent: "#5e81ac",
|
|
95
|
+
text: "#eceff4",
|
|
96
|
+
textDim: "#a0a8b0",
|
|
97
|
+
statusBg: "#3b4252",
|
|
98
|
+
statusBorder: "#434c5e",
|
|
99
|
+
},
|
|
100
|
+
rose: {
|
|
101
|
+
name: "rose",
|
|
102
|
+
label: "Rose",
|
|
103
|
+
desc: "soft pink",
|
|
104
|
+
accent: "#f5a9b8",
|
|
105
|
+
accentDim: "#c98a96",
|
|
106
|
+
accentBright: "#ffccd5",
|
|
107
|
+
accentGlow: "#ffe0e6",
|
|
108
|
+
bg: "#1f1a1b",
|
|
109
|
+
bgSecondary: "#2a2224",
|
|
110
|
+
bgTertiary: "#171314",
|
|
111
|
+
border: "#3a3234",
|
|
112
|
+
borderAccent: "#5a4a4e",
|
|
113
|
+
text: "#e8d8dc",
|
|
114
|
+
textDim: "#a09498",
|
|
115
|
+
statusBg: "#2a2224",
|
|
116
|
+
statusBorder: "#3a3234",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates an editor theme manager with Svelte 5 runes
|
|
122
|
+
* @returns {object} Theme state and controls
|
|
123
|
+
*/
|
|
124
|
+
export function useEditorTheme() {
|
|
125
|
+
let currentTheme = $state("grove");
|
|
126
|
+
|
|
127
|
+
function applyTheme(themeName) {
|
|
128
|
+
const theme = themes[themeName];
|
|
129
|
+
if (!theme) return;
|
|
130
|
+
|
|
131
|
+
const root = document.documentElement;
|
|
132
|
+
root.style.setProperty("--editor-accent", theme.accent);
|
|
133
|
+
root.style.setProperty("--editor-accent-dim", theme.accentDim);
|
|
134
|
+
root.style.setProperty("--editor-accent-bright", theme.accentBright);
|
|
135
|
+
root.style.setProperty("--editor-accent-glow", theme.accentGlow);
|
|
136
|
+
root.style.setProperty("--editor-bg", theme.bg);
|
|
137
|
+
root.style.setProperty("--editor-bg-secondary", theme.bgSecondary);
|
|
138
|
+
root.style.setProperty("--editor-bg-tertiary", theme.bgTertiary);
|
|
139
|
+
root.style.setProperty("--editor-border", theme.border);
|
|
140
|
+
root.style.setProperty("--editor-border-accent", theme.borderAccent);
|
|
141
|
+
root.style.setProperty("--editor-text", theme.text);
|
|
142
|
+
root.style.setProperty("--editor-text-dim", theme.textDim);
|
|
143
|
+
root.style.setProperty("--editor-status-bg", theme.statusBg);
|
|
144
|
+
root.style.setProperty("--editor-status-border", theme.statusBorder);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function loadTheme() {
|
|
148
|
+
try {
|
|
149
|
+
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
|
150
|
+
if (stored && themes[stored]) {
|
|
151
|
+
currentTheme = stored;
|
|
152
|
+
applyTheme(stored);
|
|
153
|
+
}
|
|
154
|
+
} catch (e) {
|
|
155
|
+
console.warn("Failed to load theme:", e);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function saveTheme(themeName) {
|
|
160
|
+
try {
|
|
161
|
+
localStorage.setItem(THEME_STORAGE_KEY, themeName);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
console.warn("Failed to save theme:", e);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function setTheme(themeName) {
|
|
168
|
+
if (!themes[themeName]) return;
|
|
169
|
+
currentTheme = themeName;
|
|
170
|
+
applyTheme(themeName);
|
|
171
|
+
saveTheme(themeName);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
get currentTheme() {
|
|
176
|
+
return currentTheme;
|
|
177
|
+
},
|
|
178
|
+
themes,
|
|
179
|
+
loadTheme,
|
|
180
|
+
setTheme,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a slash commands manager with Svelte 5 runes
|
|
3
|
+
* @param {object} options - Configuration options
|
|
4
|
+
* @param {Function} options.getTextareaRef - Function to get textarea reference
|
|
5
|
+
* @param {Function} options.getContent - Function to get content
|
|
6
|
+
* @param {Function} options.setContent - Function to set content
|
|
7
|
+
* @param {Function} options.getSnippets - Function to get user snippets
|
|
8
|
+
* @param {Function} options.onOpenSnippetsModal - Callback to open snippets modal
|
|
9
|
+
* @returns {object} Slash commands state and controls
|
|
10
|
+
*/
|
|
11
|
+
export function useSlashCommands(options?: {
|
|
12
|
+
getTextareaRef: Function;
|
|
13
|
+
getContent: Function;
|
|
14
|
+
setContent: Function;
|
|
15
|
+
getSnippets: Function;
|
|
16
|
+
onOpenSnippetsModal: Function;
|
|
17
|
+
}): object;
|
|
18
|
+
/**
|
|
19
|
+
* Slash Commands Composable
|
|
20
|
+
* Manages the slash command menu and execution
|
|
21
|
+
*/
|
|
22
|
+
export const baseSlashCommands: ({
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
insert: string;
|
|
26
|
+
cursorOffset?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
insert: string;
|
|
31
|
+
cursorOffset: number;
|
|
32
|
+
})[];
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash Commands Composable
|
|
3
|
+
* Manages the slash command menu and execution
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Base slash commands definition
|
|
7
|
+
export const baseSlashCommands = [
|
|
8
|
+
{ id: "heading1", label: "Heading 1", insert: "# " },
|
|
9
|
+
{ id: "heading2", label: "Heading 2", insert: "## " },
|
|
10
|
+
{ id: "heading3", label: "Heading 3", insert: "### " },
|
|
11
|
+
{ id: "code", label: "Code Block", insert: "```\n\n```", cursorOffset: 4 },
|
|
12
|
+
{ id: "quote", label: "Quote", insert: "> " },
|
|
13
|
+
{ id: "list", label: "Bullet List", insert: "- " },
|
|
14
|
+
{ id: "numbered", label: "Numbered List", insert: "1. " },
|
|
15
|
+
{ id: "link", label: "Link", insert: "[](url)", cursorOffset: 1 },
|
|
16
|
+
{ id: "image", label: "Image", insert: "", cursorOffset: 2 },
|
|
17
|
+
{ id: "divider", label: "Divider", insert: "\n---\n" },
|
|
18
|
+
{
|
|
19
|
+
id: "anchor",
|
|
20
|
+
label: "Custom Anchor",
|
|
21
|
+
insert: "<!-- anchor:name -->\n",
|
|
22
|
+
cursorOffset: 14,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a slash commands manager with Svelte 5 runes
|
|
28
|
+
* @param {object} options - Configuration options
|
|
29
|
+
* @param {Function} options.getTextareaRef - Function to get textarea reference
|
|
30
|
+
* @param {Function} options.getContent - Function to get content
|
|
31
|
+
* @param {Function} options.setContent - Function to set content
|
|
32
|
+
* @param {Function} options.getSnippets - Function to get user snippets
|
|
33
|
+
* @param {Function} options.onOpenSnippetsModal - Callback to open snippets modal
|
|
34
|
+
* @returns {object} Slash commands state and controls
|
|
35
|
+
*/
|
|
36
|
+
export function useSlashCommands(options = {}) {
|
|
37
|
+
const {
|
|
38
|
+
getTextareaRef,
|
|
39
|
+
getContent,
|
|
40
|
+
setContent,
|
|
41
|
+
getSnippets,
|
|
42
|
+
onOpenSnippetsModal,
|
|
43
|
+
} = options;
|
|
44
|
+
|
|
45
|
+
let menu = $state({
|
|
46
|
+
open: false,
|
|
47
|
+
query: "",
|
|
48
|
+
position: { x: 0, y: 0 },
|
|
49
|
+
selectedIndex: 0,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Build full command list including snippets
|
|
53
|
+
function getAllCommands() {
|
|
54
|
+
const snippets = getSnippets ? getSnippets() : [];
|
|
55
|
+
const snippetCommands = snippets.map((s) => ({
|
|
56
|
+
id: s.id,
|
|
57
|
+
label: `> ${s.name}`,
|
|
58
|
+
insert: s.content,
|
|
59
|
+
isSnippet: true,
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
const newSnippetCommand = {
|
|
63
|
+
id: "newSnippet",
|
|
64
|
+
label: "Create New Snippet...",
|
|
65
|
+
insert: "",
|
|
66
|
+
isAction: true,
|
|
67
|
+
action: onOpenSnippetsModal,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return [...baseSlashCommands, newSnippetCommand, ...snippetCommands];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Get filtered commands based on query
|
|
74
|
+
function getFilteredCommands() {
|
|
75
|
+
const allCommands = getAllCommands();
|
|
76
|
+
return allCommands.filter((cmd) =>
|
|
77
|
+
cmd.label.toLowerCase().includes(menu.query.toLowerCase())
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function open() {
|
|
82
|
+
menu.open = true;
|
|
83
|
+
menu.query = "";
|
|
84
|
+
menu.selectedIndex = 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function close() {
|
|
88
|
+
menu.open = false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function navigate(direction) {
|
|
92
|
+
const filtered = getFilteredCommands();
|
|
93
|
+
const count = filtered.length;
|
|
94
|
+
if (count === 0) return;
|
|
95
|
+
|
|
96
|
+
if (direction === "down") {
|
|
97
|
+
menu.selectedIndex = (menu.selectedIndex + 1) % count;
|
|
98
|
+
} else if (direction === "up") {
|
|
99
|
+
menu.selectedIndex = (menu.selectedIndex - 1 + count) % count;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function execute(index) {
|
|
104
|
+
const filtered = getFilteredCommands();
|
|
105
|
+
const cmd = filtered[index];
|
|
106
|
+
if (!cmd) return;
|
|
107
|
+
|
|
108
|
+
const textareaRef = getTextareaRef();
|
|
109
|
+
const content = getContent();
|
|
110
|
+
|
|
111
|
+
// Handle action commands (like "Create New Snippet...")
|
|
112
|
+
if (cmd.isAction && cmd.action) {
|
|
113
|
+
// Remove the slash that triggered the menu
|
|
114
|
+
const pos = textareaRef.selectionStart;
|
|
115
|
+
const textBefore = content.substring(0, pos);
|
|
116
|
+
const lastSlashIndex = textBefore.lastIndexOf("/");
|
|
117
|
+
if (lastSlashIndex >= 0) {
|
|
118
|
+
setContent(content.substring(0, lastSlashIndex) + content.substring(pos));
|
|
119
|
+
}
|
|
120
|
+
menu.open = false;
|
|
121
|
+
cmd.action();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Remove the slash that triggered the menu and insert command
|
|
126
|
+
const pos = textareaRef.selectionStart;
|
|
127
|
+
const textBefore = content.substring(0, pos);
|
|
128
|
+
const lastSlashIndex = textBefore.lastIndexOf("/");
|
|
129
|
+
|
|
130
|
+
if (lastSlashIndex >= 0) {
|
|
131
|
+
setContent(
|
|
132
|
+
content.substring(0, lastSlashIndex) + cmd.insert + content.substring(pos)
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
const newPos = lastSlashIndex + (cmd.cursorOffset || cmd.insert.length);
|
|
137
|
+
textareaRef.selectionStart = textareaRef.selectionEnd = newPos;
|
|
138
|
+
textareaRef.focus();
|
|
139
|
+
}, 0);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
menu.open = false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function shouldTrigger(key, cursorPos, content) {
|
|
146
|
+
if (key !== "/" || menu.open) return false;
|
|
147
|
+
// Only trigger at start of line or after whitespace
|
|
148
|
+
return cursorPos === 0 || /\s$/.test(content.substring(0, cursorPos));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
get menu() {
|
|
153
|
+
return menu;
|
|
154
|
+
},
|
|
155
|
+
get isOpen() {
|
|
156
|
+
return menu.open;
|
|
157
|
+
},
|
|
158
|
+
getAllCommands,
|
|
159
|
+
getFilteredCommands,
|
|
160
|
+
open,
|
|
161
|
+
close,
|
|
162
|
+
navigate,
|
|
163
|
+
execute,
|
|
164
|
+
shouldTrigger,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snippets Composable
|
|
3
|
+
* Manages user-created markdown snippets stored in localStorage
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const SNIPPETS_STORAGE_KEY = "grove-editor-snippets";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a snippets manager with Svelte 5 runes
|
|
10
|
+
* @returns {object} Snippets state and controls
|
|
11
|
+
*/
|
|
12
|
+
export function useSnippets() {
|
|
13
|
+
let snippets = $state([]);
|
|
14
|
+
|
|
15
|
+
let modal = $state({
|
|
16
|
+
open: false,
|
|
17
|
+
editingId: null,
|
|
18
|
+
name: "",
|
|
19
|
+
content: "",
|
|
20
|
+
trigger: "",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function load() {
|
|
24
|
+
try {
|
|
25
|
+
const stored = localStorage.getItem(SNIPPETS_STORAGE_KEY);
|
|
26
|
+
if (stored) {
|
|
27
|
+
snippets = JSON.parse(stored);
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.warn("Failed to load snippets:", e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function save() {
|
|
35
|
+
try {
|
|
36
|
+
localStorage.setItem(SNIPPETS_STORAGE_KEY, JSON.stringify(snippets));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
console.warn("Failed to save snippets:", e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function openModal(editId = null) {
|
|
43
|
+
if (editId) {
|
|
44
|
+
const snippet = snippets.find((s) => s.id === editId);
|
|
45
|
+
if (snippet) {
|
|
46
|
+
modal.editingId = editId;
|
|
47
|
+
modal.name = snippet.name;
|
|
48
|
+
modal.content = snippet.content;
|
|
49
|
+
modal.trigger = snippet.trigger || "";
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
modal.editingId = null;
|
|
53
|
+
modal.name = "";
|
|
54
|
+
modal.content = "";
|
|
55
|
+
modal.trigger = "";
|
|
56
|
+
}
|
|
57
|
+
modal.open = true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function closeModal() {
|
|
61
|
+
modal.open = false;
|
|
62
|
+
modal.editingId = null;
|
|
63
|
+
modal.name = "";
|
|
64
|
+
modal.content = "";
|
|
65
|
+
modal.trigger = "";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function saveSnippet() {
|
|
69
|
+
if (!modal.name.trim() || !modal.content.trim()) return;
|
|
70
|
+
|
|
71
|
+
if (modal.editingId) {
|
|
72
|
+
// Update existing snippet
|
|
73
|
+
snippets = snippets.map((s) =>
|
|
74
|
+
s.id === modal.editingId
|
|
75
|
+
? {
|
|
76
|
+
...s,
|
|
77
|
+
name: modal.name.trim(),
|
|
78
|
+
content: modal.content,
|
|
79
|
+
trigger: modal.trigger.trim() || null,
|
|
80
|
+
}
|
|
81
|
+
: s
|
|
82
|
+
);
|
|
83
|
+
} else {
|
|
84
|
+
// Create new snippet
|
|
85
|
+
const newSnippet = {
|
|
86
|
+
id: `snippet-${Date.now()}`,
|
|
87
|
+
name: modal.name.trim(),
|
|
88
|
+
content: modal.content,
|
|
89
|
+
trigger: modal.trigger.trim() || null,
|
|
90
|
+
createdAt: new Date().toISOString(),
|
|
91
|
+
};
|
|
92
|
+
snippets = [...snippets, newSnippet];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
save();
|
|
96
|
+
closeModal();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function deleteSnippet(id) {
|
|
100
|
+
if (confirm("Delete this snippet?")) {
|
|
101
|
+
snippets = snippets.filter((s) => s.id !== id);
|
|
102
|
+
save();
|
|
103
|
+
if (modal.editingId === id) {
|
|
104
|
+
closeModal();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
get snippets() {
|
|
111
|
+
return snippets;
|
|
112
|
+
},
|
|
113
|
+
get modal() {
|
|
114
|
+
return modal;
|
|
115
|
+
},
|
|
116
|
+
load,
|
|
117
|
+
openModal,
|
|
118
|
+
closeModal,
|
|
119
|
+
saveSnippet,
|
|
120
|
+
deleteSnippet,
|
|
121
|
+
};
|
|
122
|
+
}
|