mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-03 22:22:54 +00:00
Upgrade @mcschema
This commit is contained in:
Generated
+7
-7
@@ -5,16 +5,16 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@mcschema/core": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.5.5.tgz",
|
||||
"integrity": "sha512-2wwtBgwoFm3HgUiT2w/m9IBqGKcYcLY2aRieDSbK6DKoXUbPaU/yKXsZHK76Mr9u5S3knxL0gfZHFXrR03ajtg=="
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.6.1.tgz",
|
||||
"integrity": "sha512-9DIrcDw/OLs/SrPWBKK/8Y7JVUP1zu9MZfGv+JUrHahkHGsG7MZEAzPP8xqTWiMino2Z80F2khh2UPZX4zlRAQ=="
|
||||
},
|
||||
"@mcschema/java-1.16": {
|
||||
"version": "0.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@mcschema/java-1.16/-/java-1.16-0.2.14.tgz",
|
||||
"integrity": "sha512-5Jc4YlpDcSDzUXuyiu5+mihILYFuPZ56eAd77QALX1TmgceSEaR5BnUSV7tJ5Yyn/ifIDpKWGQYAGFFtPXM5Fw==",
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@mcschema/java-1.16/-/java-1.16-0.3.1.tgz",
|
||||
"integrity": "sha512-f9QOtKVSIngJGoBX2enC6cYJvmALzIy0sf7V7HCICYcWkzDj5Nj8uPEfKttpwDYgXC+jBcKI99niK/psP/dRYQ==",
|
||||
"requires": {
|
||||
"@mcschema/core": "^0.5.4"
|
||||
"@mcschema/core": "^0.6.1"
|
||||
}
|
||||
},
|
||||
"@mcschema/locales": {
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@
|
||||
"author": "Misode",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mcschema/core": "^0.5.5",
|
||||
"@mcschema/core": "^0.6.1",
|
||||
"@mcschema/locales": "^0.1.5",
|
||||
"@mcschema/java-1.16": "^0.2.14",
|
||||
"@mcschema/java-1.16": "^0.3.1",
|
||||
"@types/google.analytics": "0.0.40",
|
||||
"@types/split.js": "^1.4.0",
|
||||
"copy-webpack-plugin": "^6.0.1",
|
||||
|
||||
+17
-14
@@ -2,15 +2,14 @@ import Split from 'split.js'
|
||||
import {
|
||||
AbstractView,
|
||||
Base,
|
||||
COLLECTIONS,
|
||||
CollectionRegistry,
|
||||
DataModel,
|
||||
locale,
|
||||
LOCALES,
|
||||
SourceView,
|
||||
TreeView,
|
||||
SCHEMAS,
|
||||
} from '@mcschema/core'
|
||||
import '@mcschema/java-1.16'
|
||||
import { getCollections, getSchemas } from '@mcschema/java-1.16'
|
||||
import { RegistryFetcher } from './RegistryFetcher'
|
||||
import { ErrorsView } from './ErrorsView'
|
||||
import config from '../config.json'
|
||||
@@ -29,17 +28,6 @@ const addChecked = (el: HTMLElement) => {
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
const buildModel = (model: any) => {
|
||||
if (model.schema) {
|
||||
models[model.id] = new DataModel(SCHEMAS.get(model.schema))
|
||||
} else if (model.children) {
|
||||
model.children.forEach(buildModel)
|
||||
}
|
||||
}
|
||||
|
||||
let models: { [key: string]: DataModel } = {}
|
||||
config.models.forEach(buildModel)
|
||||
|
||||
const treeViewObserver = (el: HTMLElement) => {
|
||||
el.querySelectorAll('.node-header[data-help]').forEach(e => {
|
||||
const div = document.createElement('div')
|
||||
@@ -121,12 +109,27 @@ const views: {[key: string]: AbstractView} = {
|
||||
'errors': new ErrorsView(dummyModel, errorsViewEl)
|
||||
}
|
||||
|
||||
const COLLECTIONS = getCollections()
|
||||
|
||||
Promise.all([
|
||||
fetchLocale(LOCALES.language),
|
||||
...(LOCALES.language === 'en' ? [] : [fetchLocale('en')]),
|
||||
RegistryFetcher(COLLECTIONS, config.registries)
|
||||
]).then(responses => {
|
||||
|
||||
const SCHEMAS = getSchemas(COLLECTIONS)
|
||||
|
||||
let models: { [key: string]: DataModel } = {}
|
||||
const buildModel = (model: any) => {
|
||||
if (model.schema) {
|
||||
models[model.id] = new DataModel(SCHEMAS.get(model.schema))
|
||||
} else if (model.children) {
|
||||
model.children.forEach(buildModel)
|
||||
}
|
||||
}
|
||||
config.models.forEach(buildModel)
|
||||
|
||||
|
||||
let selected = ''
|
||||
Object.values(models).forEach(m => m.validate(true))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user