Skip to content

Commit 35873d3

Browse files
committed
move to v5
1 parent b9eb5b5 commit 35873d3

File tree

3 files changed

+6
-49
lines changed

3 files changed

+6
-49
lines changed

.vscode/tasks.json

-28
This file was deleted.

src/gridjs-vue.mjs

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Grid } from 'https://unpkg.com/gridjs/dist/gridjs.production.es.min.js'
2-
import parseStylesheet from 'https://unpkg.com/parse-css-stylesheet/index.js'
1+
import { Grid } from 'https://unpkg.com/gridjs@5.0.1/dist/gridjs.module.js'
2+
import { injectStyle } from 'https://unpkg.com/[email protected]/dist/es2015/index.js'
33
import { uid } from 'https://unpkg.com/uid/single/index.mjs'
44

55
const waitForSelector = selector => {
@@ -194,28 +194,13 @@ export default {
194194
const head = document.getElementsByTagName('head')[0]
195195

196196
let styles = document.createElement('style')
197-
styles.title = `${this.divId}__theme`
197+
styles.id = `${this.divId}__theme`
198198
styles.type = 'text/css'
199199
head.appendChild(styles)
200200

201-
for (let index in document.styleSheets) {
202-
if (document.styleSheets[index].title === styles.title) {
203-
styles = document.styleSheets[index]
204-
}
205-
}
206-
207-
let theme = await fetch(`https://unpkg.com/gridjs/dist/theme/${this.activeTheme}.css`)
201+
let theme = await fetch(`https://unpkg.com/gridjs/dist/theme/mermaid.css`)
208202
theme = await theme.text()
209-
theme = parseStylesheet(theme)
210-
211-
if (styles instanceof CSSStyleSheet) {
212-
for (const index in theme.cssRules) {
213-
let css = theme.cssRules[index].cssText
214-
if (css && !/^@/g.test(css)) {
215-
styles.insertRule(`#${this.divId} ${css}`)
216-
}
217-
}
218-
}
203+
injectStyle(theme, styles.id)
219204
} catch (error) {
220205
console.error(error)
221206
}

src/index.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createRef, h, html, PluginPosition } from 'https://unpkg.com/gridjs/dist/gridjs.production.es.min.js'
1+
import { createRef, h, html, PluginPosition } from 'https://unpkg.com/gridjs@5.0.1/dist/gridjs.module.js'
22
import { uid } from 'https://unpkg.com/uid/single/index.mjs'
33
import Grid from './gridjs-vue.mjs'
44

0 commit comments

Comments
 (0)