@brainfish-ai/editor 0.16.1 → 0.16.2

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 (27) hide show
  1. package/dist/editor/internal/codeMirrorTheme.d.ts +14 -0
  2. package/dist/{index-Pbdt_JAa.js → index-B4R1rT37.js} +2 -2
  3. package/dist/{index-DaEJooLf.js → index-BBMUH80b.js} +2 -2
  4. package/dist/{index-CkC8SVWG.js → index-BIHNHMyg.js} +2 -2
  5. package/dist/{index-B3Tj0aeA.js → index-BJKQPlcf.js} +2 -2
  6. package/dist/{index-BoGCS5K8.js → index-BQa2bres.js} +2 -2
  7. package/dist/{index-DmshtaDi.js → index-C-bL3Cy9.js} +3 -3
  8. package/dist/{index-mjlRw27L.js → index-CFr33LuW.js} +2 -2
  9. package/dist/{index-DcHkonsK.js → index-COD_xliD.js} +4 -4
  10. package/dist/{index-BgzDJCPK.js → index-CgzQ1jj0.js} +2 -2
  11. package/dist/{index-DLaMyc-O.js → index-CsaeJbB5.js} +2 -2
  12. package/dist/{index-D1lvHOEq.js → index-CyTfufcP.js} +2 -2
  13. package/dist/{index-DnIbufdg.js → index-D7noxe1h.js} +3 -3
  14. package/dist/{index-o1kUBM0B.js → index-DJWghCuI.js} +69 -31
  15. package/dist/{index-DO4yrIc-.js → index-Dk6UNQWp.js} +4 -4
  16. package/dist/{index-DPERyOhC.js → index-DnbjsrWF.js} +2 -2
  17. package/dist/{index-DC7kmwxC.js → index-DnpXm_wT.js} +4 -4
  18. package/dist/{index-dd3JkZcJ.js → index-DsUx-yKw.js} +2 -2
  19. package/dist/{index-yGP3q8Ph.js → index-Dv14TLjz.js} +3 -3
  20. package/dist/{index-3kIhnnQF.js → index-DveiglG-.js} +3 -3
  21. package/dist/{index-DQl-jPCB.js → index-DztBKea2.js} +2 -2
  22. package/dist/{index-ugK_d0Eb.js → index-LyNcRvuh.js} +2 -2
  23. package/dist/{index-FnbDXzus.js → index-dKic9ff-.js} +1 -1
  24. package/dist/{index-TzlF4I2U.js → index-mEwvGwcX.js} +2 -2
  25. package/dist/{index-D2xHwKn1.js → index-paWgasj8.js} +3 -3
  26. package/dist/index.js +1 -1
  27. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Extension } from '@codemirror/state';
3
+ import { ViewPlugin } from '@codemirror/view';
4
+ /**
5
+ * Crepe bakes the CodeMirror theme when the editor is created. `html.dark` often
6
+ * lands after that (Storybook theme decorator, platform class toggle), so the
7
+ * crepe CSS variables go dark while CodeMirror stays on the light theme.
8
+ * Compartment lets existing and later-mounted code blocks follow the live theme.
9
+ */
10
+ export declare const codeMirrorThemeConfig: (themeRef: MutableRefObject<"light" | "dark">) => {
11
+ theme: Extension;
12
+ extensions: ViewPlugin<{}, undefined>[];
13
+ };
14
+ export declare const syncCodeMirrorTheme: (root: ParentNode, theme: "light" | "dark") => void;
@@ -1,5 +1,5 @@
1
- import { L as LRParser } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
1
+ import { L as LRParser } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
3
 
4
4
  const jsonHighlighting = styleTags({
5
5
  String: tags.string,
@@ -1,5 +1,5 @@
1
- import { L as LRParser } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
1
+ import { L as LRParser } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
3
 
4
4
  const javaHighlighting = styleTags({
5
5
  null: tags.null,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, G as ifNotIn, H as completeFromList, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside, ab as sublanguageProp, N as snippetCompletion, a3 as defineLanguageFacet, O as NodeWeakMap, P as IterMode } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, G as ifNotIn, H as completeFromList, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside, ab as sublanguageProp, N as snippetCompletion, a3 as defineLanguageFacet, O as NodeWeakMap, P as IterMode } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const noSemi = 316,
@@ -1,5 +1,5 @@
1
- import { A as LanguageSupport, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside, E as styleTags, F as tags } from './index-o1kUBM0B.js';
2
- import { L as LRParser } from './index-FnbDXzus.js';
1
+ import { A as LanguageSupport, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside, E as styleTags, F as tags } from './index-DJWghCuI.js';
2
+ import { L as LRParser } from './index-dKic9ff-.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const spec_Keyword = {__proto__:null,anyref:34, dataref:34, eqref:34, externref:34, i31ref:34, funcref:34, i8:34, i16:34, i32:34, i64:34, f32:34, f64:34};
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, G as ifNotIn, H as completeFromList, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside, I as syntaxTree, N as snippetCompletion, O as NodeWeakMap, P as IterMode } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, G as ifNotIn, H as completeFromList, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside, I as syntaxTree, N as snippetCompletion, O as NodeWeakMap, P as IterMode } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const insertedSemi = 177,
@@ -1,6 +1,6 @@
1
- import { A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside, E as styleTags, F as tags } from './index-o1kUBM0B.js';
2
- import { defineCSSCompletionSource } from './index-TzlF4I2U.js';
3
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
1
+ import { A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside, E as styleTags, F as tags } from './index-DJWghCuI.js';
2
+ import { defineCSSCompletionSource } from './index-mEwvGwcX.js';
3
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
4
4
 
5
5
  // This file was generated by lezer-generator. You probably shouldn't edit it.
6
6
  const descendantOp = 110,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, D as foldNodeProp, a9 as bracketMatchingHandle } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, D as foldNodeProp, a9 as bracketMatchingHandle } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const StartTag = 1,
@@ -1,7 +1,7 @@
1
- import { L as LRLanguage, A as LanguageSupport, S as parseMixed, E as styleTags, F as tags } from './index-o1kUBM0B.js';
2
- import { html } from './index-DO4yrIc-.js';
3
- import { javascriptLanguage } from './index-CkC8SVWG.js';
4
- import { L as LRParser, a as LocalTokenGroup } from './index-FnbDXzus.js';
1
+ import { L as LRLanguage, A as LanguageSupport, S as parseMixed, E as styleTags, F as tags } from './index-DJWghCuI.js';
2
+ import { html } from './index-Dk6UNQWp.js';
3
+ import { javascriptLanguage } from './index-BIHNHMyg.js';
4
+ import { L as LRParser, a as LocalTokenGroup } from './index-dKic9ff-.js';
5
5
 
6
6
  // This file was generated by lezer-generator. You probably shouldn't edit it.
7
7
  const parser = /*@__PURE__*/LRParser.deserialize({
@@ -1,5 +1,5 @@
1
- import { u as useInstance, e as editorViewCtx, r as reviewSuggestionsDecoKey, o as orderReviewSuggestionsByResolvedRanges, g as getNextReviewSuggestionId, p as parserCtx, a as parseProposedMd, c as createApplyReviewSuggestionTransaction, i as isMilkdownContextNotFoundError, b as createDismissReviewSuggestionTransaction } from './index-o1kUBM0B.js';
2
- export { d as applyAllReviewSuggestions, f as buildReviewSuggestionsPlugin, h as createInlineSuggestionElement, j as createReviewSuggestionBulkActions, k as getActiveReviewSuggestions, l as rejectAllReviewSuggestions, m as resolveReviewSuggestionRanges, n as reviewSuggestionApplyMeta, q as reviewSuggestionDismissMeta, s as reviewSuggestionsDecorationPlugin, t as reviewSuggestionsSelectionMeta, v as reviewSuggestionsUpdateMeta, w as useDefaultReviewSuggestionSelection, x as useReviewSuggestionBulkActionsRef, y as useReviewSuggestionSelectionSync, z as useReviewSuggestionsLoader } from './index-o1kUBM0B.js';
1
+ import { u as useInstance, e as editorViewCtx, r as reviewSuggestionsDecoKey, o as orderReviewSuggestionsByResolvedRanges, g as getNextReviewSuggestionId, p as parserCtx, a as parseProposedMd, c as createApplyReviewSuggestionTransaction, i as isMilkdownContextNotFoundError, b as createDismissReviewSuggestionTransaction } from './index-DJWghCuI.js';
2
+ export { d as applyAllReviewSuggestions, f as buildReviewSuggestionsPlugin, h as createInlineSuggestionElement, j as createReviewSuggestionBulkActions, k as getActiveReviewSuggestions, l as rejectAllReviewSuggestions, m as resolveReviewSuggestionRanges, n as reviewSuggestionApplyMeta, q as reviewSuggestionDismissMeta, s as reviewSuggestionsDecorationPlugin, t as reviewSuggestionsSelectionMeta, v as reviewSuggestionsUpdateMeta, w as useDefaultReviewSuggestionSelection, x as useReviewSuggestionBulkActionsRef, y as useReviewSuggestionSelectionSync, z as useReviewSuggestionsLoader } from './index-DJWghCuI.js';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import { createContext, useRef, useLayoutEffect, useEffect, useContext, useId, useCallback, useMemo, Fragment, createElement, useInsertionEffect, forwardRef, Component } from 'react';
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, J as flatIndent, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const RawString = 1,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const closureParamDelim = 1,
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, D as foldNodeProp, M as foldInside, B as indentNodeProp, C as continuedIndent } from './index-o1kUBM0B.js';
3
- import { defineCSSCompletionSource } from './index-TzlF4I2U.js';
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, L as LRLanguage, D as foldNodeProp, M as foldInside, B as indentNodeProp, C as continuedIndent } from './index-DJWghCuI.js';
3
+ import { defineCSSCompletionSource } from './index-mEwvGwcX.js';
4
4
 
5
5
  // This file was generated by lezer-generator. You probably shouldn't edit it.
6
6
  const indent = 168,
@@ -43135,7 +43135,11 @@ const getThemeFromHtml = () => {
43135
43135
  return getSystemTheme();
43136
43136
  };
43137
43137
  const useEditorTheme = (theme = "system") => {
43138
- const [resolvedTheme, setResolvedTheme] = useState(theme === "system" ? "light" : theme);
43138
+ const [resolvedTheme, setResolvedTheme] = useState(() => {
43139
+ if (theme !== "system") return theme;
43140
+ if (typeof document === "undefined") return "light";
43141
+ return getThemeFromHtml();
43142
+ });
43139
43143
  useEffect(() => {
43140
43144
  if (theme !== "system") {
43141
43145
  setResolvedTheme(theme);
@@ -70109,7 +70113,7 @@ function legacy(parser) {
70109
70113
  return new LanguageSupport(StreamLanguage.define(parser));
70110
70114
  }
70111
70115
  function sql(dialectName) {
70112
- return import('./index-DPERyOhC.js').then(m => m.sql({ dialect: m[dialectName] }));
70116
+ return import('./index-DnbjsrWF.js').then(m => m.sql({ dialect: m[dialectName] }));
70113
70117
  }
70114
70118
  /**
70115
70119
  An array of language descriptions for known language packages.
@@ -70120,7 +70124,7 @@ const languages = [
70120
70124
  name: "C",
70121
70125
  extensions: ["c", "h", "ino"],
70122
70126
  load() {
70123
- return import('./index-DLaMyc-O.js').then(m => m.cpp());
70127
+ return import('./index-CsaeJbB5.js').then(m => m.cpp());
70124
70128
  }
70125
70129
  }),
70126
70130
  /*@__PURE__*/LanguageDescription.of({
@@ -70128,7 +70132,7 @@ const languages = [
70128
70132
  alias: ["cpp"],
70129
70133
  extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
70130
70134
  load() {
70131
- return import('./index-DLaMyc-O.js').then(m => m.cpp());
70135
+ return import('./index-CsaeJbB5.js').then(m => m.cpp());
70132
70136
  }
70133
70137
  }),
70134
70138
  /*@__PURE__*/LanguageDescription.of({
@@ -70141,14 +70145,14 @@ const languages = [
70141
70145
  name: "CSS",
70142
70146
  extensions: ["css"],
70143
70147
  load() {
70144
- return import('./index-TzlF4I2U.js').then(m => m.css());
70148
+ return import('./index-mEwvGwcX.js').then(m => m.css());
70145
70149
  }
70146
70150
  }),
70147
70151
  /*@__PURE__*/LanguageDescription.of({
70148
70152
  name: "Go",
70149
70153
  extensions: ["go"],
70150
70154
  load() {
70151
- return import('./index-BoGCS5K8.js').then(m => m.go());
70155
+ return import('./index-BQa2bres.js').then(m => m.go());
70152
70156
  }
70153
70157
  }),
70154
70158
  /*@__PURE__*/LanguageDescription.of({
@@ -70156,14 +70160,14 @@ const languages = [
70156
70160
  alias: ["xhtml"],
70157
70161
  extensions: ["html", "htm", "handlebars", "hbs"],
70158
70162
  load() {
70159
- return import('./index-DO4yrIc-.js').then(m => m.html());
70163
+ return import('./index-Dk6UNQWp.js').then(m => m.html());
70160
70164
  }
70161
70165
  }),
70162
70166
  /*@__PURE__*/LanguageDescription.of({
70163
70167
  name: "Java",
70164
70168
  extensions: ["java"],
70165
70169
  load() {
70166
- return import('./index-DaEJooLf.js').then(m => m.java());
70170
+ return import('./index-BBMUH80b.js').then(m => m.java());
70167
70171
  }
70168
70172
  }),
70169
70173
  /*@__PURE__*/LanguageDescription.of({
@@ -70171,14 +70175,14 @@ const languages = [
70171
70175
  alias: ["ecmascript", "js", "node"],
70172
70176
  extensions: ["js", "mjs", "cjs"],
70173
70177
  load() {
70174
- return import('./index-CkC8SVWG.js').then(m => m.javascript());
70178
+ return import('./index-BIHNHMyg.js').then(m => m.javascript());
70175
70179
  }
70176
70180
  }),
70177
70181
  /*@__PURE__*/LanguageDescription.of({
70178
70182
  name: "Jinja",
70179
70183
  extensions: ["j2", "jinja", "jinja2"],
70180
70184
  load() {
70181
- return import('./index-D2xHwKn1.js').then(m => m.jinja());
70185
+ return import('./index-paWgasj8.js').then(m => m.jinja());
70182
70186
  }
70183
70187
  }),
70184
70188
  /*@__PURE__*/LanguageDescription.of({
@@ -70186,28 +70190,28 @@ const languages = [
70186
70190
  alias: ["json5"],
70187
70191
  extensions: ["json", "map"],
70188
70192
  load() {
70189
- return import('./index-Pbdt_JAa.js').then(m => m.json());
70193
+ return import('./index-B4R1rT37.js').then(m => m.json());
70190
70194
  }
70191
70195
  }),
70192
70196
  /*@__PURE__*/LanguageDescription.of({
70193
70197
  name: "JSX",
70194
70198
  extensions: ["jsx"],
70195
70199
  load() {
70196
- return import('./index-CkC8SVWG.js').then(m => m.javascript({ jsx: true }));
70200
+ return import('./index-BIHNHMyg.js').then(m => m.javascript({ jsx: true }));
70197
70201
  }
70198
70202
  }),
70199
70203
  /*@__PURE__*/LanguageDescription.of({
70200
70204
  name: "LESS",
70201
70205
  extensions: ["less"],
70202
70206
  load() {
70203
- return import('./index-DmshtaDi.js').then(m => m.less());
70207
+ return import('./index-C-bL3Cy9.js').then(m => m.less());
70204
70208
  }
70205
70209
  }),
70206
70210
  /*@__PURE__*/LanguageDescription.of({
70207
70211
  name: "Liquid",
70208
70212
  extensions: ["liquid"],
70209
70213
  load() {
70210
- return import('./index-yGP3q8Ph.js').then(m => m.liquid());
70214
+ return import('./index-Dv14TLjz.js').then(m => m.liquid());
70211
70215
  }
70212
70216
  }),
70213
70217
  /*@__PURE__*/LanguageDescription.of({
@@ -70218,7 +70222,7 @@ const languages = [
70218
70222
  name: "Markdown",
70219
70223
  extensions: ["md", "markdown", "mkd"],
70220
70224
  load() {
70221
- return import('./index-ugK_d0Eb.js').then(m => m.markdown());
70225
+ return import('./index-LyNcRvuh.js').then(m => m.markdown());
70222
70226
  }
70223
70227
  }),
70224
70228
  /*@__PURE__*/LanguageDescription.of({
@@ -70233,7 +70237,7 @@ const languages = [
70233
70237
  name: "PHP",
70234
70238
  extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
70235
70239
  load() {
70236
- return import('./index-3kIhnnQF.js').then(m => m.php());
70240
+ return import('./index-DveiglG-.js').then(m => m.php());
70237
70241
  }
70238
70242
  }),
70239
70243
  /*@__PURE__*/LanguageDescription.of({
@@ -70250,28 +70254,28 @@ const languages = [
70250
70254
  extensions: ["BUILD", "bzl", "py", "pyw"],
70251
70255
  filename: /^(BUCK|BUILD)$/,
70252
70256
  load() {
70253
- return import('./index-dd3JkZcJ.js').then(m => m.python());
70257
+ return import('./index-DsUx-yKw.js').then(m => m.python());
70254
70258
  }
70255
70259
  }),
70256
70260
  /*@__PURE__*/LanguageDescription.of({
70257
70261
  name: "Rust",
70258
70262
  extensions: ["rs"],
70259
70263
  load() {
70260
- return import('./index-D1lvHOEq.js').then(m => m.rust());
70264
+ return import('./index-CyTfufcP.js').then(m => m.rust());
70261
70265
  }
70262
70266
  }),
70263
70267
  /*@__PURE__*/LanguageDescription.of({
70264
70268
  name: "Sass",
70265
70269
  extensions: ["sass"],
70266
70270
  load() {
70267
- return import('./index-DnIbufdg.js').then(m => m.sass({ indented: true }));
70271
+ return import('./index-D7noxe1h.js').then(m => m.sass({ indented: true }));
70268
70272
  }
70269
70273
  }),
70270
70274
  /*@__PURE__*/LanguageDescription.of({
70271
70275
  name: "SCSS",
70272
70276
  extensions: ["scss"],
70273
70277
  load() {
70274
- return import('./index-DnIbufdg.js').then(m => m.sass());
70278
+ return import('./index-D7noxe1h.js').then(m => m.sass());
70275
70279
  }
70276
70280
  }),
70277
70281
  /*@__PURE__*/LanguageDescription.of({
@@ -70287,7 +70291,7 @@ const languages = [
70287
70291
  name: "TSX",
70288
70292
  extensions: ["tsx"],
70289
70293
  load() {
70290
- return import('./index-CkC8SVWG.js').then(m => m.javascript({ jsx: true, typescript: true }));
70294
+ return import('./index-BIHNHMyg.js').then(m => m.javascript({ jsx: true, typescript: true }));
70291
70295
  }
70292
70296
  }),
70293
70297
  /*@__PURE__*/LanguageDescription.of({
@@ -70295,14 +70299,14 @@ const languages = [
70295
70299
  alias: ["ts"],
70296
70300
  extensions: ["ts", "mts", "cts"],
70297
70301
  load() {
70298
- return import('./index-CkC8SVWG.js').then(m => m.javascript({ typescript: true }));
70302
+ return import('./index-BIHNHMyg.js').then(m => m.javascript({ typescript: true }));
70299
70303
  }
70300
70304
  }),
70301
70305
  /*@__PURE__*/LanguageDescription.of({
70302
70306
  name: "WebAssembly",
70303
70307
  extensions: ["wat", "wast"],
70304
70308
  load() {
70305
- return import('./index-B3Tj0aeA.js').then(m => m.wast());
70309
+ return import('./index-BJKQPlcf.js').then(m => m.wast());
70306
70310
  }
70307
70311
  }),
70308
70312
  /*@__PURE__*/LanguageDescription.of({
@@ -70310,7 +70314,7 @@ const languages = [
70310
70314
  alias: ["rss", "wsdl", "xsd"],
70311
70315
  extensions: ["xml", "xsl", "xsd", "svg"],
70312
70316
  load() {
70313
- return import('./index-mjlRw27L.js').then(m => m.xml());
70317
+ return import('./index-CFr33LuW.js').then(m => m.xml());
70314
70318
  }
70315
70319
  }),
70316
70320
  /*@__PURE__*/LanguageDescription.of({
@@ -70318,7 +70322,7 @@ const languages = [
70318
70322
  alias: ["yml"],
70319
70323
  extensions: ["yaml", "yml"],
70320
70324
  load() {
70321
- return import('./index-DQl-jPCB.js').then(m => m.yaml());
70325
+ return import('./index-DztBKea2.js').then(m => m.yaml());
70322
70326
  }
70323
70327
  }),
70324
70328
  // Legacy modes ported from CodeMirror 5
@@ -71107,13 +71111,13 @@ const languages = [
71107
71111
  name: "Vue",
71108
71112
  extensions: ["vue"],
71109
71113
  load() {
71110
- return import('./index-DcHkonsK.js').then(m => m.vue());
71114
+ return import('./index-COD_xliD.js').then(m => m.vue());
71111
71115
  }
71112
71116
  }),
71113
71117
  /*@__PURE__*/LanguageDescription.of({
71114
71118
  name: "Angular Template",
71115
71119
  load() {
71116
- return import('./index-DC7kmwxC.js').then(m => m.angular());
71120
+ return import('./index-DnpXm_wT.js').then(m => m.angular());
71117
71121
  }
71118
71122
  })
71119
71123
  ];
@@ -110760,6 +110764,38 @@ const createVitesseLightTheme = (options = {}) => {
110760
110764
  };
110761
110765
  const vitesseLight = createVitesseLightTheme();
110762
110766
 
110767
+ const themeCompartment = new Compartment();
110768
+ const appliedTheme = /* @__PURE__ */ new WeakMap();
110769
+ const themeExtension = (theme) => theme === "dark" ? oneDark : vitesseLight;
110770
+ const applyTheme = (view, theme) => {
110771
+ if (appliedTheme.get(view) === theme) return;
110772
+ appliedTheme.set(view, theme);
110773
+ view.dispatch({ effects: themeCompartment.reconfigure(themeExtension(theme)) });
110774
+ };
110775
+ const codeMirrorThemeConfig = (themeRef) => ({
110776
+ theme: themeCompartment.of(themeExtension(themeRef.current)),
110777
+ extensions: [
110778
+ ViewPlugin.fromClass(
110779
+ class {
110780
+ constructor(view) {
110781
+ queueMicrotask(() => {
110782
+ if (!view.dom.isConnected) return;
110783
+ applyTheme(view, themeRef.current);
110784
+ });
110785
+ }
110786
+ }
110787
+ )
110788
+ ]
110789
+ });
110790
+ const syncCodeMirrorTheme = (root, theme) => {
110791
+ root.querySelectorAll(".cm-editor").forEach((node) => {
110792
+ if (!(node instanceof HTMLElement)) return;
110793
+ const view = EditorView.findFromDOM(node);
110794
+ if (!view) return;
110795
+ applyTheme(view, theme);
110796
+ });
110797
+ };
110798
+
110763
110799
  var DateType = /* @__PURE__ */ ((DateType2) => {
110764
110800
  DateType2["DATE"] = "date";
110765
110801
  DateType2["TIME"] = "time";
@@ -117237,9 +117273,7 @@ function buildCrepe({
117237
117273
  }
117238
117274
  }
117239
117275
  },
117240
- [Crepe.Feature.CodeMirror]: {
117241
- theme: resolvedThemeRef.current === "dark" ? oneDark : vitesseLight
117242
- },
117276
+ [Crepe.Feature.CodeMirror]: codeMirrorThemeConfig(resolvedThemeRef),
117243
117277
  ...placeholder ? { [Crepe.Feature.Placeholder]: { text: placeholder, mode: "doc" } } : {}
117244
117278
  }
117245
117279
  });
@@ -124285,7 +124319,7 @@ function useSlashMenuPortal(container) {
124285
124319
  }
124286
124320
 
124287
124321
  const ReviewSuggestionsViewport = lazy(
124288
- () => import('./index-BgzDJCPK.js').then((module) => ({ default: module.ReviewSuggestionsViewport }))
124322
+ () => import('./index-CgzQ1jj0.js').then((module) => ({ default: module.ReviewSuggestionsViewport }))
124289
124323
  );
124290
124324
  const MilkdownEditorInner = ({
124291
124325
  readOnly = false,
@@ -124482,6 +124516,10 @@ const MilkdownEditorInner = ({
124482
124516
  [editorReadyRef]
124483
124517
  );
124484
124518
  useSlashMenuPortal(editorHost);
124519
+ useEffect(() => {
124520
+ if (!editorHost) return;
124521
+ syncCodeMirrorTheme(editorHost, resolvedTheme);
124522
+ }, [editorHost, resolvedTheme]);
124485
124523
  if (!reviewSuggestionsLoader && !hasReviewSuggestions) {
124486
124524
  return /* @__PURE__ */ jsx("div", { ref: containerRef, className, "data-testid": "brainfish-editor", children: /* @__PURE__ */ jsx(Milkdown, {}) });
124487
124525
  }
@@ -1,7 +1,7 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { S as parseMixed, E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, D as foldNodeProp, a9 as bracketMatchingHandle } from './index-o1kUBM0B.js';
3
- import { cssLanguage, css } from './index-TzlF4I2U.js';
4
- import { typescriptLanguage, jsxLanguage, tsxLanguage, javascriptLanguage, javascript } from './index-CkC8SVWG.js';
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { S as parseMixed, E as styleTags, F as tags, Q as EditorView, I as syntaxTree, R as EditorSelection, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, D as foldNodeProp, a9 as bracketMatchingHandle } from './index-DJWghCuI.js';
3
+ import { cssLanguage, css } from './index-mEwvGwcX.js';
4
+ import { typescriptLanguage, jsxLanguage, tsxLanguage, javascriptLanguage, javascript } from './index-BIHNHMyg.js';
5
5
 
6
6
  // This file was generated by lezer-generator. You probably shouldn't edit it.
7
7
  const scriptText = 55,
@@ -1,5 +1,5 @@
1
- import { L as LRLanguage, A as LanguageSupport, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, E as styleTags, F as tags, G as ifNotIn, H as completeFromList, I as syntaxTree } from './index-o1kUBM0B.js';
2
- import { E as ExternalTokenizer, L as LRParser } from './index-FnbDXzus.js';
1
+ import { L as LRLanguage, A as LanguageSupport, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, E as styleTags, F as tags, G as ifNotIn, H as completeFromList, I as syntaxTree } from './index-DJWghCuI.js';
2
+ import { E as ExternalTokenizer, L as LRParser } from './index-dKic9ff-.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const whitespace = 36,
@@ -1,7 +1,7 @@
1
- import { L as LRLanguage, A as LanguageSupport, S as parseMixed, E as styleTags, F as tags } from './index-o1kUBM0B.js';
2
- import { html } from './index-DO4yrIc-.js';
3
- import { javascriptLanguage } from './index-CkC8SVWG.js';
4
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
1
+ import { L as LRLanguage, A as LanguageSupport, S as parseMixed, E as styleTags, F as tags } from './index-DJWghCuI.js';
2
+ import { html } from './index-Dk6UNQWp.js';
3
+ import { javascriptLanguage } from './index-BIHNHMyg.js';
4
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
5
5
 
6
6
  // This file was generated by lezer-generator. You probably shouldn't edit it.
7
7
  const Text = 1,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, G as ifNotIn, I as syntaxTree, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside, O as NodeWeakMap, P as IterMode, H as completeFromList, N as snippetCompletion } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, G as ifNotIn, I as syntaxTree, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside, O as NodeWeakMap, P as IterMode, H as completeFromList, N as snippetCompletion } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const printKeyword = 1,
@@ -1,6 +1,6 @@
1
- import { Q as EditorView, R as EditorSelection, A as LanguageSupport, S as parseMixed, I as syntaxTree, L as LRLanguage, E as styleTags, F as tags, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp } from './index-o1kUBM0B.js';
2
- import { html } from './index-DO4yrIc-.js';
3
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
1
+ import { Q as EditorView, R as EditorSelection, A as LanguageSupport, S as parseMixed, I as syntaxTree, L as LRLanguage, E as styleTags, F as tags, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp } from './index-DJWghCuI.js';
2
+ import { html } from './index-Dk6UNQWp.js';
3
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
4
4
 
5
5
  // This file was generated by lezer-generator. You probably shouldn't edit it.
6
6
  const interpolationStart = 1,
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, S as parseMixed, L as LRLanguage, B as indentNodeProp, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
3
- import { html } from './index-DO4yrIc-.js';
1
+ import { L as LRParser, E as ExternalTokenizer } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, S as parseMixed, L as LRLanguage, B as indentNodeProp, C as continuedIndent, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
+ import { html } from './index-Dk6UNQWp.js';
4
4
 
5
5
  // This file was generated by lezer-generator. You probably shouldn't edit it.
6
6
  const castOpen = 1,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags, A as LanguageSupport, S as parseMixed, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags, A as LanguageSupport, S as parseMixed, L as LRLanguage, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp, M as foldInside } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const blockEnd = 63,
@@ -1,5 +1,5 @@
1
- import { T as Parser, U as NodeType, V as NodeProp, W as Tag, X as NodeSet, E as styleTags, Y as Tree, S as parseMixed, F as tags, I as syntaxTree, R as EditorSelection, Z as countColumn, A as LanguageSupport, _ as Prec, $ as keymap, Q as EditorView, a0 as Language, a1 as indentUnit, a2 as foldService, a3 as defineLanguageFacet, a4 as CompletionContext, a5 as EditorState, D as foldNodeProp, B as indentNodeProp, a6 as languageDataProp, a7 as LanguageDescription, a8 as ParseContext } from './index-o1kUBM0B.js';
2
- import { html, htmlCompletionSource } from './index-DO4yrIc-.js';
1
+ import { T as Parser, U as NodeType, V as NodeProp, W as Tag, X as NodeSet, E as styleTags, Y as Tree, S as parseMixed, F as tags, I as syntaxTree, R as EditorSelection, Z as countColumn, A as LanguageSupport, _ as Prec, $ as keymap, Q as EditorView, a0 as Language, a1 as indentUnit, a2 as foldService, a3 as defineLanguageFacet, a4 as CompletionContext, a5 as EditorState, D as foldNodeProp, B as indentNodeProp, a6 as languageDataProp, a7 as LanguageDescription, a8 as ParseContext } from './index-DJWghCuI.js';
2
+ import { html, htmlCompletionSource } from './index-Dk6UNQWp.js';
3
3
 
4
4
  class CompositeBlock {
5
5
  static create(type, value, from, parentHash, end) {
@@ -1,4 +1,4 @@
1
- import { T as Parser, X as NodeSet, U as NodeType, aa as DefaultBufferLength, V as NodeProp, Y as Tree, P as IterMode } from './index-o1kUBM0B.js';
1
+ import { T as Parser, X as NodeSet, U as NodeType, aa as DefaultBufferLength, V as NodeProp, Y as Tree, P as IterMode } from './index-DJWghCuI.js';
2
2
 
3
3
  /**
4
4
  A parse stack. These are used internally by the parser to track
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from './index-FnbDXzus.js';
2
- import { E as styleTags, F as tags$1, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside, I as syntaxTree, O as NodeWeakMap, P as IterMode } from './index-o1kUBM0B.js';
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from './index-dKic9ff-.js';
2
+ import { E as styleTags, F as tags$1, A as LanguageSupport, L as LRLanguage, B as indentNodeProp, C as continuedIndent, D as foldNodeProp, M as foldInside, I as syntaxTree, O as NodeWeakMap, P as IterMode } from './index-DJWghCuI.js';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const descendantOp = 122,
@@ -1,6 +1,6 @@
1
- import { Q as EditorView, R as EditorSelection, A as LanguageSupport, S as parseMixed, I as syntaxTree, L as LRLanguage, E as styleTags, F as tags, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp } from './index-o1kUBM0B.js';
2
- import { html } from './index-DO4yrIc-.js';
3
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from './index-FnbDXzus.js';
1
+ import { Q as EditorView, R as EditorSelection, A as LanguageSupport, S as parseMixed, I as syntaxTree, L as LRLanguage, E as styleTags, F as tags, B as indentNodeProp, K as delimitedIndent, D as foldNodeProp } from './index-DJWghCuI.js';
2
+ import { html } from './index-Dk6UNQWp.js';
3
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from './index-dKic9ff-.js';
4
4
 
5
5
  // This file was generated by lezer-generator. You probably shouldn't edit it.
6
6
  const interpolationStart = 1,
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { ac as BrainfishEditor, ad as MarkdownSourceEditor, ae as MilkdownProvider, j as createReviewSuggestionBulkActions } from './index-o1kUBM0B.js';
1
+ export { ac as BrainfishEditor, ad as MarkdownSourceEditor, ae as MilkdownProvider, j as createReviewSuggestionBulkActions } from './index-DJWghCuI.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/editor",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Markdown editor package for Brainfish based on Milkdown",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": [