@scalar/api-client 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 0.9.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3d712d74]
8
+ - @scalar/use-codemirror@0.7.20
9
+
3
10
  ## 0.9.3
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -14001,7 +14001,7 @@ function scaleBlock(block, scaler) {
14001
14001
  return new BlockInfo(block.from, block.length, bTop, bBottom - bTop, Array.isArray(block._content) ? block._content.map((b) => scaleBlock(b, scaler)) : block._content);
14002
14002
  }
14003
14003
  const theme = /* @__PURE__ */ Facet.define({ combine: (strs) => strs.join(" ") });
14004
- const darkTheme$1 = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.indexOf(true) > -1 });
14004
+ const darkTheme = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.indexOf(true) > -1 });
14005
14005
  const baseThemeID = /* @__PURE__ */ StyleModule.newName(), baseLightID = /* @__PURE__ */ StyleModule.newName(), baseDarkID = /* @__PURE__ */ StyleModule.newName();
14006
14006
  const lightDarkIDs = { "&light": "." + baseLightID, "&dark": "." + baseDarkID };
14007
14007
  function buildTheme(main, spec, scopes) {
@@ -15329,7 +15329,7 @@ class EditorView {
15329
15329
  Get the CSS classes for the currently active editor themes.
15330
15330
  */
15331
15331
  get themeClasses() {
15332
- return baseThemeID + " " + (this.state.facet(darkTheme$1) ? baseDarkID : baseLightID) + " " + this.state.facet(theme);
15332
+ return baseThemeID + " " + (this.state.facet(darkTheme) ? baseDarkID : baseLightID) + " " + this.state.facet(theme);
15333
15333
  }
15334
15334
  updateAttrs() {
15335
15335
  let editorAttrs = attrsFromFacet(this, editorAttributes, {
@@ -15765,7 +15765,7 @@ class EditorView {
15765
15765
  let prefix = StyleModule.newName();
15766
15766
  let result = [theme.of(prefix), styleModule.of(buildTheme(`.${prefix}`, spec))];
15767
15767
  if (options && options.dark)
15768
- result.push(darkTheme$1.of(true));
15768
+ result.push(darkTheme.of(true));
15769
15769
  return result;
15770
15770
  }
15771
15771
  /**
@@ -15803,7 +15803,7 @@ EditorView.decorations = decorations;
15803
15803
  EditorView.atomicRanges = atomicRanges;
15804
15804
  EditorView.bidiIsolatedRanges = bidiIsolatedRanges;
15805
15805
  EditorView.scrollMargins = scrollMargins;
15806
- EditorView.darkTheme = darkTheme$1;
15806
+ EditorView.darkTheme = darkTheme;
15807
15807
  EditorView.cspNonce = /* @__PURE__ */ Facet.define({ combine: (values2) => values2.length ? values2[0] : "" });
15808
15808
  EditorView.contentAttributes = contentAttributes;
15809
15809
  EditorView.editorAttributes = editorAttributes;
@@ -24756,7 +24756,7 @@ var createTheme = (_ref) => {
24756
24756
  var extension = [themeExtension, syntaxHighlighting(highlightStyle)];
24757
24757
  return extension;
24758
24758
  };
24759
- const lightTheme = createTheme({
24759
+ const customTheme = createTheme({
24760
24760
  theme: "light",
24761
24761
  settings: {
24762
24762
  background: "var(--theme-background-2, var(--default-theme-background-2))",
@@ -24842,95 +24842,8 @@ const lightTheme = createTheme({
24842
24842
  }
24843
24843
  ]
24844
24844
  });
24845
- const darkTheme = createTheme({
24846
- theme: "dark",
24847
- settings: {
24848
- background: "var(--theme-background-2, var(--default-theme-background-2))",
24849
- foreground: "var(--theme-color-1, var(--default-theme-color-1))",
24850
- caret: "var(--theme-color-1, var(--default-theme-color-1))",
24851
- selection: "var(--theme-background-3, var(--default-theme-background-3))",
24852
- selectionMatch: "#e3dcce",
24853
- gutterBackground: "var(--theme-background-2, var(--default-theme-background-2))",
24854
- gutterForeground: "var(--theme-color-3, var(--default-theme-color-3))",
24855
- gutterBorder: "transparent",
24856
- lineHighlight: "var(--theme-background-3, var(--default-theme-background-3))",
24857
- fontFamily: "var(--theme-font-code, var(--default-theme-font-code))"
24858
- },
24859
- styles: [
24860
- {
24861
- tag: [tags$1.standard(tags$1.tagName), tags$1.tagName],
24862
- color: "var(--theme-color-purple, var(--default-theme-color-purple))"
24863
- },
24864
- {
24865
- tag: [tags$1.comment],
24866
- color: "var(--theme-color-3, var(--default-theme-color-3))"
24867
- },
24868
- {
24869
- tag: [tags$1.className],
24870
- color: "var(--theme-color-orange, var(--default-theme-color-orange))"
24871
- },
24872
- {
24873
- tag: [tags$1.variableName, tags$1.propertyName, tags$1.attributeName],
24874
- color: "var(--theme-color-1, var(--default-theme-color-1))"
24875
- },
24876
- {
24877
- tag: [tags$1.operator],
24878
- color: "var(--theme-color-2, var(--default-theme-color-2))"
24879
- },
24880
- {
24881
- tag: [tags$1.keyword, tags$1.typeName, tags$1.typeOperator],
24882
- color: "var(--theme-color-green, var(--default-theme-color-green))"
24883
- },
24884
- {
24885
- tag: [tags$1.string],
24886
- color: "var(--theme-color-blue, var(--default-theme-color-blue))"
24887
- },
24888
- {
24889
- tag: [tags$1.bracket, tags$1.regexp, tags$1.meta],
24890
- color: "var(--theme-color-3, var(--default-theme-color-3))"
24891
- },
24892
- {
24893
- tag: [tags$1.number],
24894
- color: "var(--theme-color-blue, var(--default-theme-color-blue))"
24895
- },
24896
- {
24897
- tag: [tags$1.name, tags$1.quote],
24898
- color: "var(--theme-color-3, var(--default-theme-color-3))"
24899
- },
24900
- {
24901
- tag: [tags$1.heading],
24902
- color: "var(--theme-color-3, var(--default-theme-color-3))",
24903
- fontWeight: "bold"
24904
- },
24905
- {
24906
- tag: [tags$1.emphasis],
24907
- color: "var(--theme-color-3, var(--default-theme-color-3))",
24908
- fontStyle: "italic"
24909
- },
24910
- {
24911
- tag: [tags$1.deleted],
24912
- color: "var(--theme-color-3, var(--default-theme-color-3))",
24913
- backgroundColor: "transparent"
24914
- },
24915
- {
24916
- tag: [tags$1.atom, tags$1.bool, tags$1.special(tags$1.variableName)],
24917
- color: "var(--theme-color-3, var(--default-theme-color-3))"
24918
- },
24919
- {
24920
- tag: [tags$1.url, tags$1.escape, tags$1.regexp, tags$1.link],
24921
- color: "var(--theme-color-1, var(--default-theme-color-1))"
24922
- },
24923
- { tag: tags$1.link, textDecoration: "underline" },
24924
- { tag: tags$1.strikethrough, textDecoration: "line-through" },
24925
- {
24926
- tag: tags$1.invalid,
24927
- color: "var(--theme-color-3, var(--default-theme-color-3))"
24928
- }
24929
- ]
24930
- });
24931
- const isDark = ref(false);
24932
24845
  const useCodeMirror = (parameters) => {
24933
- const { extensions, content: content2, forceDarkMode, forceLightMode, withoutTheme } = parameters;
24846
+ const { extensions, content: content2, withoutTheme } = parameters;
24934
24847
  const value = ref(content2 ?? "");
24935
24848
  const codeMirrorRef = ref(null);
24936
24849
  const codeMirror = ref(null);
@@ -24950,55 +24863,20 @@ const useCodeMirror = (parameters) => {
24950
24863
  codeMirror.value = new EditorView(configuration);
24951
24864
  }
24952
24865
  };
24953
- const getCurrentTheme = () => {
24954
- if (withoutTheme) {
24955
- return null;
24956
- }
24957
- if (forceDarkMode) {
24958
- return darkTheme;
24959
- }
24960
- if (forceLightMode) {
24961
- return lightTheme;
24962
- }
24963
- if (isDark.value) {
24964
- return darkTheme;
24965
- }
24966
- return lightTheme;
24967
- };
24968
24866
  const addDefaultExtensions = (newExtensions = []) => {
24969
- const selectAllKeyBinding = {
24970
- key: "Mod-a",
24971
- run: (view) => {
24972
- view.dispatch({
24973
- selection: { anchor: 0, head: view.state.doc.length },
24974
- scrollIntoView: false
24975
- });
24976
- return true;
24977
- }
24978
- };
24979
24867
  const defaultExtensions = [
24980
- EditorView.theme(
24981
- {
24982
- ".cm-line": {
24983
- lineHeight: "20px"
24984
- },
24985
- ".cm-gutterElement": {
24986
- lineHeight: "20px"
24987
- }
24868
+ withoutTheme ? null : customTheme,
24869
+ EditorView.theme({
24870
+ ".cm-line": {
24871
+ lineHeight: "20px"
24988
24872
  },
24989
- { dark: forceDarkMode ? false : isDark.value }
24990
- ),
24991
- keymap.of([selectAllKeyBinding]),
24992
- getCurrentTheme()
24873
+ ".cm-gutterElement": {
24874
+ lineHeight: "20px"
24875
+ }
24876
+ })
24993
24877
  ].filter((extension) => extension !== null);
24994
24878
  return [...defaultExtensions, newExtensions];
24995
24879
  };
24996
- watch(isDark, () => {
24997
- const { extensions: configuredExtensions } = parameters;
24998
- if (!forceDarkMode) {
24999
- reconfigureCodeMirror(configuredExtensions);
25000
- }
25001
- });
25002
24880
  const destroyCodeMirror = () => {
25003
24881
  var _a2;
25004
24882
  (_a2 = codeMirror.value) == null ? void 0 : _a2.destroy();
@@ -25110,8 +24988,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
25110
24988
  withVariables: { type: Boolean },
25111
24989
  lineNumbers: { type: Boolean },
25112
24990
  withoutTheme: { type: Boolean },
25113
- disableEnter: { type: Boolean, default: false },
25114
- forceDarkMode: { type: Boolean, default: false }
24991
+ disableEnter: { type: Boolean, default: false }
25115
24992
  },
25116
24993
  emits: ["change"],
25117
24994
  setup(__props, { expose: __expose, emit }) {
@@ -25207,8 +25084,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
25207
25084
  } = useCodeMirror({
25208
25085
  content: props.content ?? "",
25209
25086
  extensions: getCodeMirrorExtensions(),
25210
- withoutTheme: props.withoutTheme,
25211
- forceDarkMode: props.forceDarkMode
25087
+ withoutTheme: props.withoutTheme
25212
25088
  });
25213
25089
  watch(
25214
25090
  () => props.content,
@@ -25225,7 +25101,6 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
25225
25101
  watch(
25226
25102
  [
25227
25103
  () => props.disableEnter,
25228
- () => props.forceDarkMode,
25229
25104
  () => props.languages,
25230
25105
  () => props.lineNumbers,
25231
25106
  () => props.readOnly,
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "rest",
14
14
  "testing"
15
15
  ],
16
- "version": "0.9.3",
16
+ "version": "0.9.4",
17
17
  "engines": {
18
18
  "node": ">=18"
19
19
  },
@@ -44,7 +44,7 @@
44
44
  "pretty-ms": "^8.0.0",
45
45
  "vue": "^3.3.0",
46
46
  "@scalar/themes": "0.5.4",
47
- "@scalar/use-codemirror": "0.7.19",
47
+ "@scalar/use-codemirror": "0.7.20",
48
48
  "@scalar/use-keyboard-event": "0.5.8",
49
49
  "@scalar/use-modal": "0.2.3"
50
50
  },
@@ -57,8 +57,8 @@
57
57
  "vite-plugin-css-injected-by-js": "^3.3.0",
58
58
  "vitest": "^0.34.4",
59
59
  "vue-tsc": "^1.8.19",
60
- "@scalar/api-client-proxy": "0.5.13",
61
- "@scalar/echo-server": "0.5.8"
60
+ "@scalar/echo-server": "0.5.8",
61
+ "@scalar/api-client-proxy": "0.5.13"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "vue": "^3.3.0"