Skip to content

Commit

Permalink
feat: use vue's built-in CSSProperties instead of csstype
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Aug 27, 2022
1 parent 59d5fd8 commit 222b5c6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
## CHANGELOG

### v6.1.1 (2022-08-28)

- feat: use vue's built-in `CSSProperties` instead of `csstype`

### v6.1.0 (2022-08-27)

- feat: add `phrases` prop [#166](https://github.com/surmon-china/vue-codemirror/pull/166)

### v6.0.2 (2022-07-27)

- fix: Use the correct global component name [#161](https://github.com/surmon-china/vue-codemirror/discussions/161)
- fix: use the correct global component name [#161](https://github.com/surmon-china/vue-codemirror/discussions/161)

### v6.0.1 (2022-07-22)

Expand Down
2 changes: 1 addition & 1 deletion libundler.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default defineConfig({
entry: './src/index.ts',
outDir: './dist',
targets: ['esm', 'cjs'],
external: ['vue', 'csstype', 'codemirror', /@codemirror\/.*/],
external: ['vue', 'codemirror', /@codemirror\/.*/],
exports: 'named'
})
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-codemirror",
"description": "CodeMirror code editor component for Vue",
"version": "6.1.0",
"version": "6.1.1",
"author": "Surmon",
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -47,8 +47,7 @@
"@codemirror/commands": "6.x",
"@codemirror/language": "6.x",
"@codemirror/state": "6.x",
"@codemirror/view": "6.x",
"csstype": "^3.1.0"
"@codemirror/view": "6.x"
},
"devDependencies": {
"codemirror": "6.x",
Expand Down
6 changes: 3 additions & 3 deletions src/codemirror.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CSS from 'csstype'
import type { CSSProperties } from 'vue'
import { EditorState, EditorStateConfig, Compartment, Extension, StateEffect } from '@codemirror/state'
import { EditorView, EditorViewConfig, ViewUpdate, keymap, placeholder } from '@codemirror/view'
import { indentWithTab } from '@codemirror/commands'
Expand Down Expand Up @@ -112,8 +112,8 @@ export const getEditorTools = (view: EditorView) => {
// set style to editor element
// https://codemirror.net/examples/styling/
const { run: reStyle } = createEditorCompartment(view)
const setStyle = (style: CSS.Properties = {}) => {
reStyle(EditorView.theme({ '&': { ...style } }))
const setStyle = (style: CSSProperties = {}) => {
reStyle(EditorView.theme({ '&': { ...(style as any) } }))
}

return {
Expand Down
4 changes: 2 additions & 2 deletions src/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CSS from 'csstype'
import type { CSSProperties } from 'vue'
import { PropType, ExtractPropTypes } from 'vue'
import { EditorStateConfig } from '@codemirror/state'

Expand All @@ -14,7 +14,7 @@ export const configProps = {
indentWithTab: NonDefaultBooleanType,
tabSize: Number,
placeholder: String,
style: Object as PropType<CSS.Properties>,
style: Object as PropType<CSSProperties>,
autoDestroy: NonDefaultBooleanType,
phrases: Object as PropType<Record<string, string>>,
// codemirror options
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1603,11 +1603,6 @@ csstype@^2.6.8:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda"
integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==

csstype@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.0.tgz#4ddcac3718d787cf9df0d1b7d15033925c8f29f2"
integrity sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==

data-urls@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143"
Expand Down

0 comments on commit 222b5c6

Please sign in to comment.