@scalar/use-codemirror 0.4.0 → 0.5.1

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/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Scalar useCodeMirror()
2
+
3
+ ![Version](https://img.shields.io/npm/v/%40scalar/use-codemirror)
4
+ ![Downloads](https://img.shields.io/npm/dm/%40scalar/use-codemirror)
5
+ ![License](https://img.shields.io/npm/l/%40scalar%2Fuse-codemirror)
6
+ [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/mw6FQRPh)
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @scalar/use-codemirror
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```vue
17
+ <script setup>
18
+ import { CodeMirror } from '@scalar/use-codemirror'
19
+ </script>
20
+
21
+ <CodeMirror
22
+ class="my-custom-class"
23
+ content="const foobar = true"
24
+ readOnly
25
+ @change="(value) => …" />
26
+ ```
@@ -0,0 +1,74 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ type Language = 'axios' | 'c' | 'clojure' | 'csharp' | 'go' | 'http' | 'java' | 'javascript' | 'json' | 'kotlin' | 'node' | 'objc' | 'ocaml' | 'powershell' | 'python' | 'r' | 'ruby' | 'shell' | 'swift' | 'php';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ extensions: {
5
+ type: import("vue").PropType<Extension[]>;
6
+ };
7
+ content: {
8
+ type: import("vue").PropType<string>;
9
+ };
10
+ forceDarkMode: {
11
+ type: import("vue").PropType<boolean>;
12
+ default: boolean;
13
+ };
14
+ withoutTheme: {
15
+ type: import("vue").PropType<boolean>;
16
+ };
17
+ readOnly: {
18
+ type: import("vue").PropType<boolean>;
19
+ };
20
+ languages: {
21
+ type: import("vue").PropType<Language[]>;
22
+ };
23
+ withVariables: {
24
+ type: import("vue").PropType<boolean>;
25
+ };
26
+ lineNumbers: {
27
+ type: import("vue").PropType<boolean>;
28
+ };
29
+ disableEnter: {
30
+ type: import("vue").PropType<boolean>;
31
+ default: boolean;
32
+ };
33
+ }, {
34
+ setCodeMirrorContent: (content: string) => void;
35
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
+ change: (value: string) => void;
37
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
38
+ extensions: {
39
+ type: import("vue").PropType<Extension[]>;
40
+ };
41
+ content: {
42
+ type: import("vue").PropType<string>;
43
+ };
44
+ forceDarkMode: {
45
+ type: import("vue").PropType<boolean>;
46
+ default: boolean;
47
+ };
48
+ withoutTheme: {
49
+ type: import("vue").PropType<boolean>;
50
+ };
51
+ readOnly: {
52
+ type: import("vue").PropType<boolean>;
53
+ };
54
+ languages: {
55
+ type: import("vue").PropType<Language[]>;
56
+ };
57
+ withVariables: {
58
+ type: import("vue").PropType<boolean>;
59
+ };
60
+ lineNumbers: {
61
+ type: import("vue").PropType<boolean>;
62
+ };
63
+ disableEnter: {
64
+ type: import("vue").PropType<boolean>;
65
+ default: boolean;
66
+ };
67
+ }>> & {
68
+ onChange?: ((value: string) => any) | undefined;
69
+ }, {
70
+ forceDarkMode: boolean;
71
+ disableEnter: boolean;
72
+ }, {}>;
73
+ export default _default;
74
+ //# sourceMappingURL=CodeMirror.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeMirror.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeMirror/CodeMirror.vue.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AA4DlD,KAAK,QAAQ,GACT,OAAO,GACP,GAAG,GACH,SAAS,GACT,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,MAAM,GACN,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,YAAY,GACZ,QAAQ,GACR,GAAG,GACH,MAAM,GACN,OAAO,GACP,OAAO,GACP,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KT,wBAAkD"}
@@ -0,0 +1,6 @@
1
+ import { type DecorationSet, ViewPlugin, type ViewUpdate } from '@codemirror/view';
2
+ export declare const variables: () => ViewPlugin<{
3
+ variables: DecorationSet;
4
+ update(update: ViewUpdate): void;
5
+ }>;
6
+ //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeMirror/extensions/variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAGlB,UAAU,EACV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAA;AAYzB,eAAO,MAAM,SAAS;;mBAOD,UAAU;EAc5B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default as CodeMirror } from './CodeMirror.vue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CodeMirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './useCodeMirror';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -11,9 +11,13 @@ type UseCodeMirrorParameters = {
11
11
  */
12
12
  content?: string;
13
13
  /**
14
- * Inverse the dark mode.
14
+ * Force the dark mode.
15
15
  */
16
16
  forceDarkMode?: boolean;
17
+ /**
18
+ * Force the light mode.
19
+ */
20
+ forceLightMode?: boolean;
17
21
  /**
18
22
  * Whether to load a theme.
19
23
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/hooks/useCodeMirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,KAAK,CAAA;AAO1C,KAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,eACZ,uBAAuB;WAE5B,IAAI,MAAM,CAAC;mBACH,IAAI,cAAc,GAAG,IAAI,CAAC;gBAC7B,IAAI,UAAU,GAAG,IAAI,CAAC;oCACF,MAAM,KAAK,IAAI;2CACR,SAAS,EAAE,KAAK,IAAI;uCACxB,SAAS,EAAE,KAAK,IAAI;CA2IxD,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './useCodeMirror';
1
+ export { CodeMirror } from './components/CodeMirror';
2
+ export * from './hooks/useCodeMirror';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,cAAc,uBAAuB,CAAA"}