svelte-multistyle-ui 0.0.9-alpha → 0.0.13-alpha

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.
Files changed (30) hide show
  1. package/README.md +1 -1
  2. package/cli/registry.js +2 -0
  3. package/dist/components/CodeEditor.svelte +130 -0
  4. package/dist/components/CodeEditor.svelte.d.ts +25 -0
  5. package/dist/components/TextEditor.svelte +187 -0
  6. package/dist/components/TextEditor.svelte.d.ts +27 -0
  7. package/dist/components/charts/chart-config.d.ts +2 -2
  8. package/dist/components/codeeditor-styles.css +292 -0
  9. package/dist/components/text-editor-core/dom-utils.d.ts +17 -0
  10. package/dist/components/text-editor-core/dom-utils.js +151 -0
  11. package/dist/components/text-editor-core/editor-core.d.ts +113 -0
  12. package/dist/components/text-editor-core/editor-core.js +808 -0
  13. package/dist/components/text-editor-core/history.d.ts +14 -0
  14. package/dist/components/text-editor-core/history.js +78 -0
  15. package/dist/components/text-editor-core/html-formatter.d.ts +4 -0
  16. package/dist/components/text-editor-core/html-formatter.js +80 -0
  17. package/dist/components/text-editor-core/index.d.ts +7 -0
  18. package/dist/components/text-editor-core/index.js +22 -0
  19. package/dist/components/text-editor-core/sanitizer.d.ts +3 -0
  20. package/dist/components/text-editor-core/sanitizer.js +161 -0
  21. package/dist/components/text-editor-core/selection-engine.d.ts +11 -0
  22. package/dist/components/text-editor-core/selection-engine.js +137 -0
  23. package/dist/components/text-editor-core/toolbar-config.d.ts +91 -0
  24. package/dist/components/text-editor-core/toolbar-config.js +138 -0
  25. package/dist/components/texteditor-styles.css +493 -0
  26. package/dist/config.svelte.d.ts +3 -3
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +2 -0
  29. package/dist/themes/presets.d.ts +21 -21
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -84,7 +84,7 @@ A Svelte action for portaling content to `document.body`:
84
84
  The library exports the following components from `svelte-multistyle-ui`:
85
85
 
86
86
  - Actions: `Button`, `IconButton`, `FAB`, `ButtonGroup`, `DropdownMenu`, `Popover`
87
- - Form: `Input`, `Textarea`, `Select`, `MultiSelect`, `Checkbox`, `Radio`, `Toggle`, `Slider`, `FileUpload`, `DatePicker`, `SortableList`
87
+ - Form: `Input`, `Textarea`, `TextEditor`, `Select`, `MultiSelect`, `Checkbox`, `Radio`, `Toggle`, `Slider`, `FileUpload`, `DatePicker`, `SortableList`
88
88
  - Layout: `Card`, `Divider`, `Tabs`, `Accordion`, `Modal`, `Drawer`, `CommandPalette`, `Row`, `Column`, `Grid`
89
89
  - Navigation: `Breadcrumb`, `Pagination`, `Stepper`
90
90
  - Data display: `Avatar`, `Chip`, `Tooltip`, `ProgressBar`, `Table`, `Spinner`, `Skeleton`, `Rating`
package/cli/registry.js CHANGED
@@ -23,6 +23,8 @@ const registry = {
23
23
  // ---------------- Form ----------------
24
24
  Input: { importName: "Input", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
25
25
  Textarea: { importName: "Textarea", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
26
+ TextEditor: { importName: "TextEditor", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
27
+ CodeEditor: { importName: "CodeEditor", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
26
28
  Select: { importName: "Select", kind: "leaf", bindable: ["value"], primaryBindable: "value", listProps: ["options"] },
27
29
  MultiSelect: { importName: "MultiSelect", kind: "leaf", bindable: ["selected"], primaryBindable: "selected", listProps: ["options"] },
28
30
  Checkbox: { importName: "Checkbox", kind: "leaf", bindable: ["checked"], primaryBindable: "checked" },
@@ -0,0 +1,130 @@
1
+ <script>
2
+ import "./codeeditor-styles.css";
3
+ import { defaults } from "../config.js";
4
+ import { cn } from "../utils/cn.js";
5
+ import Prism from "prismjs";
6
+ // Core ships markup, css, clike, javascript. Register the rest of the curated set.
7
+ import "prismjs/components/prism-typescript";
8
+ import "prismjs/components/prism-json";
9
+ import "prismjs/components/prism-bash";
10
+ import "prismjs/components/prism-python";
11
+
12
+ // prismjs does not ship a svelte component; alias it to markup (HTML-like)
13
+ // so Svelte code still gets tag/attribute/string highlighting.
14
+ if (!Prism.languages.svelte) {
15
+ Prism.languages.svelte = Prism.languages.markup;
16
+ }
17
+
18
+ let {
19
+ style: styleProp,
20
+ theme: themeProp,
21
+ value = $bindable(""),
22
+ language = "javascript",
23
+ editable = true,
24
+ label = "",
25
+ rows = 10,
26
+ class: className = "",
27
+ ...rest
28
+ } = $props();
29
+
30
+ const style = $derived(styleProp ?? defaults.style);
31
+ const theme = $derived(themeProp ?? defaults.theme);
32
+ const styleClass = $derived(`s-codeeditor-${style}`);
33
+ const themeClass = $derived(`theme-${theme}`);
34
+
35
+ const LANG_LABELS = {
36
+ javascript: "JS",
37
+ typescript: "TS",
38
+ markup: "HTML",
39
+ css: "CSS",
40
+ json: "JSON",
41
+ svelte: "Svelte",
42
+ bash: "Bash",
43
+ python: "Python",
44
+ };
45
+
46
+ function escapeHtml(s) {
47
+ return String(s)
48
+ .replace(/&/g, "&amp;")
49
+ .replace(/</g, "&lt;")
50
+ .replace(/>/g, "&gt;")
51
+ .replace(/"/g, "&quot;")
52
+ .replace(/'/g, "&#39;");
53
+ }
54
+
55
+ function highlight(code, lang) {
56
+ const grammar = Prism.languages[lang];
57
+ if (!grammar) return escapeHtml(code);
58
+ try {
59
+ return Prism.highlight(code, grammar, lang);
60
+ } catch {
61
+ return escapeHtml(code);
62
+ }
63
+ }
64
+
65
+ const highlighted = $derived(highlight(value, language));
66
+ const langLabel = $derived(
67
+ LANG_LABELS[language] ?? String(language).toUpperCase(),
68
+ );
69
+
70
+ let copyStatus = $state(""); // "" | "copied" | "failed"
71
+ async function copyCode() {
72
+ try {
73
+ await navigator.clipboard.writeText(value);
74
+ copyStatus = "copied";
75
+ } catch {
76
+ copyStatus = "failed";
77
+ }
78
+ setTimeout(() => (copyStatus = ""), 1800);
79
+ }
80
+ const copyLabel = $derived(
81
+ copyStatus === "copied"
82
+ ? "Copied!"
83
+ : copyStatus === "failed"
84
+ ? "Failed"
85
+ : "Copy",
86
+ );
87
+
88
+ // Scroll sync: keep the highlighted <pre> (behind) aligned with the
89
+ // transparent <textarea> (front) so the caret tracks the tokens.
90
+ let preEl = $state(null);
91
+ let taEl = $state(null);
92
+ function syncScroll() {
93
+ if (preEl && taEl) {
94
+ preEl.scrollTop = taEl.scrollTop;
95
+ preEl.scrollLeft = taEl.scrollLeft;
96
+ }
97
+ }
98
+ </script>
99
+
100
+ <div class={cn("s-codeeditor-wrapper", styleClass, themeClass, className)}>
101
+ {#if label}
102
+ <label class="s-codeeditor-label">{label}</label>
103
+ {/if}
104
+ <div class="s-codeeditor-toolbar">
105
+ <span class="s-codeeditor-lang">{langLabel}</span>
106
+ <button
107
+ type="button"
108
+ class={cn("s-codeeditor-copy-btn", copyStatus)}
109
+ onclick={copyCode}
110
+ aria-label="Copy code"
111
+ >
112
+ {copyLabel}
113
+ </button>
114
+ </div>
115
+ <div class="s-codeeditor-code" style:--codeeditor-rows={rows}>
116
+ <pre class="s-codeeditor-pre" bind:this={preEl} aria-hidden="true"><code
117
+ >{@html highlighted}</code></pre>
118
+ {#if editable}
119
+ <textarea
120
+ class="s-codeeditor-textarea"
121
+ bind:value
122
+ bind:this={taEl}
123
+ onscroll={syncScroll}
124
+ spellcheck="false"
125
+ aria-label={label || "code editor"}
126
+ {...rest}
127
+ ></textarea>
128
+ {/if}
129
+ </div>
130
+ </div>
@@ -0,0 +1,25 @@
1
+ export default CodeEditor;
2
+ type CodeEditor = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const CodeEditor: import("svelte").Component<{
7
+ style: any;
8
+ theme: any;
9
+ value?: string;
10
+ language?: string;
11
+ editable?: boolean;
12
+ label?: string;
13
+ rows?: number;
14
+ class?: string;
15
+ } & Record<string, any>, {}, "value">;
16
+ type $$ComponentProps = {
17
+ style: any;
18
+ theme: any;
19
+ value?: string;
20
+ language?: string;
21
+ editable?: boolean;
22
+ label?: string;
23
+ rows?: number;
24
+ class?: string;
25
+ } & Record<string, any>;
@@ -0,0 +1,187 @@
1
+ <script>
2
+ import "./texteditor-styles.css";
3
+ import { defaults } from "../config.js";
4
+ import { cn } from "../utils/cn.js";
5
+ import { onMount, onDestroy } from "svelte";
6
+ import { TextEditorCore } from "./text-editor-core/index.js";
7
+ import { Modal, Button, Input, Textarea } from "../index.js";
8
+
9
+ let {
10
+ style: styleProp,
11
+ theme: themeProp,
12
+ value = $bindable(""),
13
+ label = "",
14
+ placeholder = "",
15
+ disabled = false,
16
+ rows = 8,
17
+ toolbar,
18
+ class: className = "",
19
+ ...rest
20
+ } = $props();
21
+
22
+ const style = $derived(styleProp ?? defaults.style);
23
+ const theme = $derived(themeProp ?? defaults.theme);
24
+
25
+ const styleClass = $derived(`s-texteditor-${style}`);
26
+ const themeClass = $derived(`theme-${theme}`);
27
+
28
+ let wrapper = $state(null);
29
+ let core = $state(null);
30
+ let previousDisabled = $state(disabled);
31
+
32
+ let dialog = $state({ open: false, type: null, data: null });
33
+ let imageFileInput = $state(null);
34
+
35
+ onMount(() => {
36
+ core = new TextEditorCore({
37
+ element: wrapper,
38
+ placeholder,
39
+ readOnly: disabled,
40
+ toolbar,
41
+ onChange: (html) => {
42
+ value = html;
43
+ },
44
+ onAction: (action) => {
45
+ if (action.type === "dialog") {
46
+ dialog = { open: true, type: action.dialog, data: { ...action.data } };
47
+ }
48
+ },
49
+ });
50
+
51
+ core.setHTML(value ?? "");
52
+ });
53
+
54
+ $effect(() => {
55
+ if (!core) return;
56
+ // Don't overwrite code-view textarea from external value changes.
57
+ if (core.isCodeView()) return;
58
+
59
+ const html = value ?? "";
60
+ if (core.getHTML() !== html) {
61
+ core.setHTML(html);
62
+ }
63
+ });
64
+
65
+ $effect(() => {
66
+ if (!core) return;
67
+ if (disabled !== previousDisabled) {
68
+ core.setReadOnly(disabled);
69
+ previousDisabled = disabled;
70
+ }
71
+ });
72
+
73
+ onDestroy(() => {
74
+ core?.destroy();
75
+ });
76
+
77
+ function applyLink() {
78
+ const { text, href, title, target } = dialog.data;
79
+ core?.insertLink({ text, href, title, target });
80
+ dialog = { open: false, type: null, data: null };
81
+ }
82
+
83
+ function applyImage() {
84
+ const { src, alt, width, align, caption } = dialog.data;
85
+ core?.insertImage({ src, alt, width, align, caption });
86
+ dialog = { open: false, type: null, data: null };
87
+ }
88
+
89
+ function applyVideo() {
90
+ const { src, width, height } = dialog.data;
91
+ core?.insertVideo({ src, width, height });
92
+ dialog = { open: false, type: null, data: null };
93
+ }
94
+
95
+ function applyTable() {
96
+ const { rows, cols } = dialog.data;
97
+ core?.insertTable({ rows, cols });
98
+ dialog = { open: false, type: null, data: null };
99
+ }
100
+
101
+ function onImageFileChange(e) {
102
+ const file = e.target.files?.[0];
103
+ if (!file) return;
104
+ const reader = new FileReader();
105
+ reader.onload = (ev) => {
106
+ dialog.data = { ...dialog.data, src: ev.target.result };
107
+ };
108
+ reader.readAsDataURL(file);
109
+ }
110
+ </script>
111
+
112
+ <div
113
+ class={cn("s-texteditor-wrapper", styleClass, themeClass, className)}
114
+ {...rest}
115
+ >
116
+ {#if label}
117
+ <label class="s-texteditor-label">{label}</label>
118
+ {/if}
119
+ <div
120
+ bind:this={wrapper}
121
+ class="s-texteditor-root"
122
+ data-placeholder={placeholder}
123
+ style:--texteditor-rows={rows}
124
+ aria-disabled={disabled}
125
+ ></div>
126
+ </div>
127
+
128
+ {#if dialog.open}
129
+ {#if dialog.type === "link"}
130
+ <Modal bind:open={dialog.open} title="Insert link" size="small">
131
+ <div class="s-texteditor-dialog">
132
+ <Input label="Text" bind:value={dialog.data.text} />
133
+ <Input label="URL" bind:value={dialog.data.href} />
134
+ <Input label="Title" bind:value={dialog.data.title} />
135
+ <Input label="Target" bind:value={dialog.data.target} />
136
+ <div class="s-texteditor-dialog-actions">
137
+ <Button onclick={applyLink}>Apply</Button>
138
+ <Button variant="outlined" onclick={() => (dialog.open = false)}>Cancel</Button>
139
+ </div>
140
+ </div>
141
+ </Modal>
142
+ {:else if dialog.type === "image"}
143
+ <Modal bind:open={dialog.open} title="Insert image" size="small">
144
+ <div class="s-texteditor-dialog">
145
+ <Input label="Image URL" bind:value={dialog.data.src} />
146
+ <div class="s-texteditor-dialog-row">
147
+ <input
148
+ bind:this={imageFileInput}
149
+ type="file"
150
+ accept="image/*"
151
+ onchange={onImageFileChange}
152
+ />
153
+ </div>
154
+ <Input label="Alt text" bind:value={dialog.data.alt} />
155
+ <Input label="Width (e.g. 200px)" bind:value={dialog.data.width} />
156
+ <Input label="Caption" bind:value={dialog.data.caption} />
157
+ <div class="s-texteditor-dialog-actions">
158
+ <Button onclick={applyImage}>Insert</Button>
159
+ <Button variant="outlined" onclick={() => (dialog.open = false)}>Cancel</Button>
160
+ </div>
161
+ </div>
162
+ </Modal>
163
+ {:else if dialog.type === "video"}
164
+ <Modal bind:open={dialog.open} title="Insert video" size="small">
165
+ <div class="s-texteditor-dialog">
166
+ <Textarea label="YouTube, Vimeo, or direct URL" rows={3} bind:value={dialog.data.src} />
167
+ <Input label="Width" bind:value={dialog.data.width} />
168
+ <Input label="Height" bind:value={dialog.data.height} />
169
+ <div class="s-texteditor-dialog-actions">
170
+ <Button onclick={applyVideo}>Insert</Button>
171
+ <Button variant="outlined" onclick={() => (dialog.open = false)}>Cancel</Button>
172
+ </div>
173
+ </div>
174
+ </Modal>
175
+ {:else if dialog.type === "table"}
176
+ <Modal bind:open={dialog.open} title="Insert table" size="small">
177
+ <div class="s-texteditor-dialog">
178
+ <Input label="Rows" type="number" bind:value={dialog.data.rows} />
179
+ <Input label="Columns" type="number" bind:value={dialog.data.cols} />
180
+ <div class="s-texteditor-dialog-actions">
181
+ <Button onclick={applyTable}>Insert</Button>
182
+ <Button variant="outlined" onclick={() => (dialog.open = false)}>Cancel</Button>
183
+ </div>
184
+ </div>
185
+ </Modal>
186
+ {/if}
187
+ {/if}
@@ -0,0 +1,27 @@
1
+ export default TextEditor;
2
+ type TextEditor = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const TextEditor: import("svelte").Component<{
7
+ style: any;
8
+ theme: any;
9
+ value?: string;
10
+ label?: string;
11
+ placeholder?: string;
12
+ disabled?: boolean;
13
+ rows?: number;
14
+ toolbar: any;
15
+ class?: string;
16
+ } & Record<string, any>, {}, "value">;
17
+ type $$ComponentProps = {
18
+ style: any;
19
+ theme: any;
20
+ value?: string;
21
+ label?: string;
22
+ placeholder?: string;
23
+ disabled?: boolean;
24
+ rows?: number;
25
+ toolbar: any;
26
+ class?: string;
27
+ } & Record<string, any>;
@@ -30,7 +30,7 @@ export function buildData(type: any, { data, series, labels }: {
30
30
  labels: any;
31
31
  }, tokens: any): {
32
32
  datasets: {
33
- label: any;
33
+ label: undefined;
34
34
  data: any;
35
35
  backgroundColor: any;
36
36
  }[];
@@ -122,6 +122,6 @@ export function buildOptions(type: string, style: string, tokens: object, { titl
122
122
  padding: {
123
123
  bottom: number;
124
124
  };
125
- };
125
+ } | undefined;
126
126
  };
127
127
  };
@@ -0,0 +1,292 @@
1
+ /* ===== BASE ===== */
2
+ /* Theme-controlled: colors, border-width, shadow, radius. Style-controlled: shape. */
3
+ .s-codeeditor-wrapper {
4
+ display: flex;
5
+ flex-direction: column;
6
+ width: 100%;
7
+ box-sizing: border-box;
8
+ background: var(--t-card-bg);
9
+ color: var(--t-text);
10
+ border: var(--t-border-width) solid var(--t-border);
11
+ border-radius: var(--t-card-radius);
12
+ box-shadow: var(--t-shadow-xs);
13
+ overflow: hidden;
14
+ }
15
+ .s-codeeditor-label {
16
+ display: block;
17
+ padding: 10px 14px 0;
18
+ font-size: 13px;
19
+ font-weight: 600;
20
+ color: var(--t-text);
21
+ }
22
+ .s-codeeditor-toolbar {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ gap: 8px;
27
+ padding: 8px 12px;
28
+ border-bottom: var(--t-border-width) solid var(--t-border);
29
+ background: color-mix(in srgb, var(--t-surface) 60%, transparent);
30
+ }
31
+ .s-codeeditor-lang {
32
+ font-size: 11px;
33
+ font-weight: 600;
34
+ text-transform: uppercase;
35
+ letter-spacing: 0.06em;
36
+ color: var(--t-text-muted);
37
+ }
38
+ .s-codeeditor-copy-btn {
39
+ appearance: none;
40
+ cursor: pointer;
41
+ font-size: 12px;
42
+ font-weight: 600;
43
+ padding: 4px 10px;
44
+ border: var(--t-border-width) solid var(--t-primary);
45
+ border-radius: var(--t-input-radius);
46
+ background: var(--t-primary);
47
+ color: var(--t-text-on-primary);
48
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
49
+ }
50
+ .s-codeeditor-copy-btn:hover {
51
+ filter: brightness(1.08);
52
+ }
53
+ .s-codeeditor-copy-btn:active {
54
+ transform: translateY(1px);
55
+ }
56
+ .s-codeeditor-copy-btn.copied {
57
+ border-color: var(--t-success);
58
+ background: var(--t-success);
59
+ }
60
+ .s-codeeditor-copy-btn.failed {
61
+ border-color: var(--t-error);
62
+ background: var(--t-error);
63
+ }
64
+
65
+ /* Code area + overlay. pre (highlighted, behind) and textarea (transparent, front)
66
+ MUST share identical font metrics, padding, line-height, white-space and tab-size
67
+ so the caret lines up with the tokens. */
68
+ .s-codeeditor-code {
69
+ position: relative;
70
+ height: calc(var(--codeeditor-rows, 10) * 1.5em + 24px);
71
+ overflow: hidden;
72
+ background: var(--t-surface);
73
+ }
74
+ .s-codeeditor-pre,
75
+ .s-codeeditor-textarea {
76
+ margin: 0;
77
+ padding: 12px 14px;
78
+ box-sizing: border-box;
79
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
80
+ "Liberation Mono", monospace;
81
+ font-size: 13px;
82
+ line-height: 1.5;
83
+ tab-size: 2;
84
+ -moz-tab-size: 2;
85
+ white-space: pre;
86
+ overflow: auto;
87
+ }
88
+ .s-codeeditor-pre {
89
+ position: absolute;
90
+ inset: 0;
91
+ color: var(--t-text);
92
+ background: transparent;
93
+ border: 0;
94
+ pointer-events: none;
95
+ }
96
+ .s-codeeditor-pre code {
97
+ font: inherit;
98
+ color: inherit;
99
+ background: none;
100
+ }
101
+ .s-codeeditor-textarea {
102
+ position: absolute;
103
+ inset: 0;
104
+ color: transparent;
105
+ caret-color: var(--t-text);
106
+ background: transparent;
107
+ border: 0;
108
+ resize: none;
109
+ outline: none;
110
+ -webkit-text-fill-color: transparent;
111
+ }
112
+ .s-codeeditor-textarea::selection {
113
+ background: color-mix(in srgb, var(--t-primary) 30%, transparent);
114
+ }
115
+
116
+ /* ===== PRISM TOKEN COLORS (re-hosted from demo app.css; package does not export app.css) ===== */
117
+ .token.comment,
118
+ .token.prolog,
119
+ .token.doctype,
120
+ .token.cdata {
121
+ color: var(--t-text-hint, #94a3b8);
122
+ }
123
+ .token.punctuation {
124
+ color: color-mix(in srgb, var(--t-text) 60%, transparent);
125
+ }
126
+ .token.property,
127
+ .token.tag,
128
+ .token.boolean,
129
+ .token.number,
130
+ .token.constant,
131
+ .token.symbol,
132
+ .token.deleted {
133
+ color: #f472b6;
134
+ }
135
+ .token.selector,
136
+ .token.attr-name,
137
+ .token.string,
138
+ .token.char,
139
+ .token.builtin,
140
+ .token.inserted {
141
+ color: #34d399;
142
+ }
143
+ .token.operator,
144
+ .token.entity,
145
+ .token.url {
146
+ color: #fbbf24;
147
+ }
148
+ .token.atrule,
149
+ .token.attr-value,
150
+ .token.keyword {
151
+ color: #818cf8;
152
+ }
153
+ .token.function,
154
+ .token.class-name {
155
+ color: #60a5fa;
156
+ }
157
+ .token.regex,
158
+ .token.important,
159
+ .token.variable {
160
+ color: #f97316;
161
+ }
162
+ .token.bold {
163
+ font-weight: bold;
164
+ }
165
+ .token.italic {
166
+ font-style: italic;
167
+ }
168
+
169
+ /* ===== STYLE OVERRIDES ===== */
170
+ /* Material is the base default. */
171
+ .s-codeeditor-material3 {
172
+ border-radius: var(--t-input-radius);
173
+ box-shadow: none;
174
+ }
175
+ .s-codeeditor-material3 .s-codeeditor-toolbar {
176
+ background: color-mix(in srgb, var(--t-primary) 6%, var(--t-surface));
177
+ }
178
+
179
+ .s-codeeditor-fluent {
180
+ border-radius: 6px;
181
+ box-shadow: var(--t-shadow-xs);
182
+ }
183
+ .s-codeeditor-fluent .s-codeeditor-toolbar {
184
+ border-bottom-width: 1px;
185
+ }
186
+
187
+ .s-codeeditor-brutalist {
188
+ border: 2px solid var(--t-text);
189
+ border-radius: 0;
190
+ box-shadow: 5px 5px 0 var(--t-text);
191
+ }
192
+ .s-codeeditor-brutalist .s-codeeditor-copy-btn {
193
+ border-radius: 0;
194
+ border: 2px solid var(--t-text);
195
+ font-weight: 800;
196
+ }
197
+
198
+ .s-codeeditor-pixel {
199
+ border-radius: 0;
200
+ border: var(--t-border-width) solid var(--t-primary);
201
+ box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25),
202
+ inset 3px 3px 0 rgba(255, 255, 255, 0.1);
203
+ }
204
+ .s-codeeditor-pixel .s-codeeditor-pre,
205
+ .s-codeeditor-pixel .s-codeeditor-textarea {
206
+ font-family: "Courier New", monospace;
207
+ }
208
+ .s-codeeditor-pixel .s-codeeditor-copy-btn {
209
+ border-radius: 0;
210
+ }
211
+
212
+ .s-codeeditor-neon {
213
+ border-radius: var(--t-input-radius);
214
+ border-color: var(--t-primary);
215
+ box-shadow: 0 0 8px var(--t-primary), 0 0 16px var(--t-shadow);
216
+ }
217
+ .s-codeeditor-neon .s-codeeditor-copy-btn {
218
+ box-shadow: 0 0 6px var(--t-primary);
219
+ }
220
+
221
+ .s-codeeditor-metro {
222
+ border-radius: 0;
223
+ border: var(--t-border-width) solid var(--t-primary);
224
+ box-shadow: none;
225
+ }
226
+ .s-codeeditor-metro .s-codeeditor-toolbar {
227
+ background: var(--t-primary);
228
+ color: var(--t-text-on-primary);
229
+ }
230
+ .s-codeeditor-metro .s-codeeditor-lang {
231
+ color: var(--t-text-on-primary);
232
+ }
233
+
234
+ .s-codeeditor-bootstrap {
235
+ border-radius: 6px;
236
+ box-shadow: var(--t-shadow-xs);
237
+ }
238
+ .s-codeeditor-bootstrap .s-codeeditor-copy-btn {
239
+ border-radius: 4px;
240
+ }
241
+
242
+ .s-codeeditor-cartoon {
243
+ border-radius: 16px;
244
+ border: 2px solid var(--t-text);
245
+ box-shadow: 4px 4px 0 var(--t-primary);
246
+ }
247
+ .s-codeeditor-cartoon .s-codeeditor-copy-btn {
248
+ border-radius: 999px;
249
+ font-weight: 800;
250
+ }
251
+
252
+ .s-codeeditor-illustration {
253
+ border-radius: 12px;
254
+ border: var(--t-border-width) solid var(--t-text);
255
+ box-shadow: 3px 3px 0 var(--t-border);
256
+ }
257
+ .s-codeeditor-illustration .s-codeeditor-toolbar {
258
+ font-style: italic;
259
+ }
260
+
261
+ .s-codeeditor-carbon {
262
+ border-radius: 0;
263
+ border: var(--t-border-width) solid var(--t-border);
264
+ border-bottom-width: 2px;
265
+ box-shadow: none;
266
+ }
267
+ .s-codeeditor-carbon .s-codeeditor-pre,
268
+ .s-codeeditor-carbon .s-codeeditor-textarea {
269
+ font-family: "IBM Plex Mono", ui-monospace, monospace;
270
+ }
271
+
272
+ .s-codeeditor-liquid-glass {
273
+ background: rgba(255, 255, 255, 0.08);
274
+ border: 1px solid rgba(255, 255, 255, 0.2);
275
+ border-radius: 16px;
276
+ backdrop-filter: blur(24px) saturate(1.6);
277
+ -webkit-backdrop-filter: blur(24px) saturate(1.6);
278
+ box-shadow: var(--t-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.3);
279
+ }
280
+ .s-codeeditor-liquid-glass .s-codeeditor-toolbar {
281
+ background: rgba(255, 255, 255, 0.06);
282
+ border-bottom-color: rgba(255, 255, 255, 0.15);
283
+ }
284
+ .s-codeeditor-liquid-glass .s-codeeditor-code {
285
+ background: rgba(0, 0, 0, 0.12);
286
+ }
287
+ .s-codeeditor-liquid-glass .s-codeeditor-copy-btn {
288
+ background: rgba(255, 255, 255, 0.15);
289
+ border-color: rgba(255, 255, 255, 0.3);
290
+ color: var(--t-text);
291
+ backdrop-filter: blur(8px);
292
+ }