@scalar/use-codemirror 0.8.0 → 0.8.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.
- package/CHANGELOG.md +12 -0
- package/dist/hooks/useCodeMirror.d.ts +7 -1
- package/dist/hooks/useCodeMirror.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25469 -97
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +23 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scalar/use-codemirror
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f8650e4f: Bundle codemirror and update packages
|
|
8
|
+
|
|
9
|
+
## 0.8.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b1f3cb49: feat: Add optional extensions and reactive provider to useCodemirror
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
2
3
|
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
3
4
|
import type { CodeMirrorLanguage } from '../types';
|
|
4
5
|
type BaseParameters = {
|
|
5
6
|
/** Element Ref to mount codemirror to */
|
|
6
7
|
codeMirrorRef: Ref<HTMLDivElement | null>;
|
|
8
|
+
/** List of optional extensions for the instance */
|
|
9
|
+
extensions?: MaybeRefOrGetter<Extension[]>;
|
|
7
10
|
/** Whether to load a theme.*/
|
|
8
11
|
withoutTheme?: MaybeRefOrGetter<boolean | undefined>;
|
|
9
12
|
/** Languages to support for syntax highlighting */
|
|
@@ -16,19 +19,22 @@ type BaseParameters = {
|
|
|
16
19
|
lineNumbers?: MaybeRefOrGetter<boolean | undefined>;
|
|
17
20
|
withVariables?: MaybeRefOrGetter<boolean | undefined>;
|
|
18
21
|
disableEnter?: MaybeRefOrGetter<boolean | undefined>;
|
|
22
|
+
onBlur?: (v: string) => void;
|
|
23
|
+
onFocus?: (v: string) => void;
|
|
19
24
|
};
|
|
20
25
|
export type UseCodeMirrorParameters = (BaseParameters & {
|
|
21
26
|
/** Prefill the content. Will be ignored when a provider is given. */
|
|
22
27
|
content: MaybeRefOrGetter<string | undefined>;
|
|
23
28
|
onChange: (v: string) => void;
|
|
24
29
|
}) | (BaseParameters & {
|
|
25
|
-
provider: Extension
|
|
30
|
+
provider: MaybeRefOrGetter<Extension | null>;
|
|
26
31
|
content?: MaybeRefOrGetter<string | undefined>;
|
|
27
32
|
onChange?: (v: string) => void;
|
|
28
33
|
});
|
|
29
34
|
/** Reactive CodeMirror Integration */
|
|
30
35
|
export declare const useCodeMirror: (params: UseCodeMirrorParameters) => {
|
|
31
36
|
setCodeMirrorContent: (content?: string) => void;
|
|
37
|
+
codeMirror: Ref<EditorView | null>;
|
|
32
38
|
};
|
|
33
39
|
export {};
|
|
34
40
|
//# sourceMappingURL=useCodeMirror.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/hooks/useCodeMirror.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/hooks/useCodeMirror.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EACL,UAAU,EAGX,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EAMT,MAAM,KAAK,CAAA;AAGZ,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAGlD,KAAK,cAAc,GAAG;IACpB,yCAAy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,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,CAAC,CAAA;AAUN,sCAAsC;AACtC,eAAO,MAAM,aAAa,WAChB,uBAAuB;qCAEE,MAAM,KAAK,IAAI;gBACpC,IAAI,UAAU,GAAG,IAAI,CAAC;CA+HnC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { type Extension } from '@codemirror/state';
|
|
2
|
+
export { yCollab } from 'y-codemirror.next';
|
|
3
|
+
export { colorPicker } from '@replit/codemirror-css-color-picker';
|
|
1
4
|
export { CodeMirror } from './components/CodeMirror';
|
|
2
5
|
export * from './hooks';
|
|
3
6
|
export * from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|