@@ -201,17 +156,11 @@
flex-direction: column;
}
- .carta-toolbar {
- height: 2rem;
- display: flex;
- flex-shrink: 0;
- }
-
- :global(.mode-split > *) {
+ :global(.carta-container.mode-split > *) {
width: 50%;
}
- :global(.mode-tabs > *) {
+ :global(.carta-container.mode-tabs > *) {
width: 100%;
}
@@ -219,27 +168,4 @@
display: flex;
position: relative;
}
-
- .carta-toolbar-left {
- height: 100%;
- }
-
- .carta-toolbar-right {
- height: 100%;
- flex-grow: 1;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
-
- .carta-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 1.5rem;
- height: 1.5rem;
- border-radius: 3px;
- cursor: pointer;
- margin-left: 4px;
- }
diff --git a/packages/carta-md/src/lib/default.css b/packages/carta-md/src/lib/default.css
index dac1fc61..d18bde17 100644
--- a/packages/carta-md/src/lib/default.css
+++ b/packages/carta-md/src/lib/default.css
@@ -70,12 +70,22 @@
}
/* Icons */
-.carta-theme__default .carta-icon {
+.carta-theme__default .carta-icon,
+.carta-theme__default .carta-icon-full {
border: 0;
background: transparent;
}
-.carta-theme__default .carta-icon:hover {
+.carta-theme__default .carta-icon-full {
+ padding: 6px 4px;
+}
+
+.carta-theme__default .carta-icon-full span {
+ margin-left: 6px;
+}
+
+.carta-theme__default .carta-icon:hover,
+.carta-theme__default .carta-icon-full:hover {
background: var(--hover-color);
}
@@ -83,6 +93,21 @@
background: inherit;
}
+.carta-theme__default .carta-icons-menu {
+ padding: 6px;
+ border: 1px solid var(--border-color);
+ border-radius: 6px;
+ min-width: 180px;
+}
+
+.carta-theme__default .carta-icons-menu .carta-icon-full {
+ margin-top: 2px;
+}
+
+.carta-theme__default .carta-icons-menu .carta-icon-full:first-child {
+ margin-top: 0;
+}
+
/* Buttons */
.carta-theme__default .carta-toolbar-left button {
background: none;
diff --git a/packages/carta-md/src/lib/internal/components/Toolbar.svelte b/packages/carta-md/src/lib/internal/components/Toolbar.svelte
new file mode 100644
index 00000000..87697a4b
--- /dev/null
+++ b/packages/carta-md/src/lib/internal/components/Toolbar.svelte
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+{#if showMenu && iconsHidden}
+
+{/if}
+
+
diff --git a/packages/carta-md/src/lib/internal/components/icons/MenuIcon.svelte b/packages/carta-md/src/lib/internal/components/icons/MenuIcon.svelte
new file mode 100644
index 00000000..88d4ccc5
--- /dev/null
+++ b/packages/carta-md/src/lib/internal/components/icons/MenuIcon.svelte
@@ -0,0 +1,6 @@
+
diff --git a/packages/carta-md/src/lib/internal/highlight.ts b/packages/carta-md/src/lib/internal/highlight.ts
index d7926b56..96602637 100644
--- a/packages/carta-md/src/lib/internal/highlight.ts
+++ b/packages/carta-md/src/lib/internal/highlight.ts
@@ -7,13 +7,9 @@ import {
} from '@speed-highlight/core';
import type { CartaExtension } from './carta';
import cartaMarkdown from './shj';
+import type { Intellisense } from './utils';
-// Workaround to add intellisense
-// eslint-disable-next-line @typescript-eslint/no-empty-interface
-interface Nothing {}
-type Union
= T | (U & Nothing);
-
-type Lang = Union;
+type Lang = Intellisense;
/**
* Highlight text using Speed-Highlight. May return null on error(usually if requested
diff --git a/packages/carta-md/src/lib/internal/icons.ts b/packages/carta-md/src/lib/internal/icons.ts
index aed4c4bb..e0508ad6 100644
--- a/packages/carta-md/src/lib/internal/icons.ts
+++ b/packages/carta-md/src/lib/internal/icons.ts
@@ -102,4 +102,4 @@ export const defaultIcons = [
}
] as const satisfies readonly CartaIcon[];
-export type DefaultIconId = (typeof defaultIcons)[number]['id'];
+export type DefaultIconId = (typeof defaultIcons)[number]['id'] | 'menu';
diff --git a/packages/carta-md/src/lib/internal/labels.ts b/packages/carta-md/src/lib/internal/labels.ts
index 00fa5dca..5e439a1b 100644
--- a/packages/carta-md/src/lib/internal/labels.ts
+++ b/packages/carta-md/src/lib/internal/labels.ts
@@ -1,12 +1,19 @@
+import type { DefaultIconId } from './icons';
+import type { Intellisense } from './utils';
+
+type IconId = Intellisense;
+
/**
* Labels that may appear in the editor.
*/
export interface CartaLabels {
writeTab: string;
previewTab: string;
+ iconsLabels: Partial>;
}
export const DefaultCartaLabels: CartaLabels = {
writeTab: 'Write',
- previewTab: 'Preview'
+ previewTab: 'Preview',
+ iconsLabels: {}
};
diff --git a/packages/carta-md/src/lib/internal/utils.ts b/packages/carta-md/src/lib/internal/utils.ts
index 3d1ce8bf..abf942a1 100644
--- a/packages/carta-md/src/lib/internal/utils.ts
+++ b/packages/carta-md/src/lib/internal/utils.ts
@@ -1,3 +1,10 @@
+// Workaround to add intellisense
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+interface Nothing {}
+type Union = T | (U & Nothing);
+
+export type Intellisense = Union;
+
/**
* Debounce the provided function.
* @param cb Callback function.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0bce3502..29be69ac 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1402,7 +1402,7 @@ packages:
peerDependencies:
'@sveltejs/kit': ^2.0.0
dependencies:
- '@sveltejs/kit': 2.5.4(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.2)(vite@5.1.6)
+ '@sveltejs/kit': 2.5.4(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.12)(vite@5.1.6)
import-meta-resolve: 4.0.0
dev: true