Move more stuff to services folder

This commit is contained in:
Misode
2021-11-03 01:27:49 +01:00
parent ce7baa571f
commit 95097e6091
22 changed files with 36 additions and 36 deletions

View File

@@ -9,7 +9,7 @@ import { Analytics } from './Analytics'
import { Header } from './components' import { Header } from './components'
import { loadLocale, locale, Locales } from './Locales' import { loadLocale, locale, Locales } from './Locales'
import { Changelog, Generator, Home, Sounds, Worldgen } from './pages' import { Changelog, Generator, Home, Sounds, Worldgen } from './pages'
import type { VersionId } from './Schemas' import type { VersionId } from './services'
import { Store } from './Store' import { Store } from './Store'
import { cleanUrl } from './Utils' import { cleanUrl } from './Utils'

View File

@@ -1,5 +1,5 @@
import type { VersionId } from './Schemas' import type { VersionId } from './services'
import { VersionIds } from './Schemas' import { VersionIds } from './services'
export namespace Store { export namespace Store {
export const ID_LANGUAGE = 'language' export const ID_LANGUAGE = 'language'

View File

@@ -2,8 +2,8 @@ import { getCurrentUrl, Link, route } from 'preact-router'
import { Btn, BtnMenu, Icons, Octicon } from '.' import { Btn, BtnMenu, Icons, Octicon } from '.'
import config from '../../config.json' import config from '../../config.json'
import { locale } from '../Locales' import { locale } from '../Locales'
import type { VersionId } from '../Schemas' import type { VersionId } from '../services'
import { checkVersion } from '../Schemas' import { checkVersion } from '../services'
import { cleanUrl, getGenerator } from '../Utils' import { cleanUrl, getGenerator } from '../Utils'
const Themes: Record<string, keyof typeof Octicon> = { const Themes: Record<string, keyof typeof Octicon> = {

View File

@@ -2,7 +2,7 @@ import type { DataModel } from '@mcschema/core'
import { Path } from '@mcschema/core' import { Path } from '@mcschema/core'
import { useState } from 'preact/hooks' import { useState } from 'preact/hooks'
import { useModel } from '../../hooks' import { useModel } from '../../hooks'
import type { VersionId } from '../../Schemas' import type { VersionId } from '../../services'
import { BiomeSourcePreview, DecoratorPreview, NoisePreview, NoiseSettingsPreview } from '../previews' import { BiomeSourcePreview, DecoratorPreview, NoisePreview, NoiseSettingsPreview } from '../previews'
export const HasPreview = ['dimension', 'worldgen/noise', 'worldgen/noise_settings', 'worldgen/configured_feature'] export const HasPreview = ['dimension', 'worldgen/noise', 'worldgen/noise_settings', 'worldgen/configured_feature']

View File

@@ -4,7 +4,7 @@ import { Btn, BtnMenu } from '..'
import { useModel } from '../../hooks' import { useModel } from '../../hooks'
import { locale } from '../../Locales' import { locale } from '../../Locales'
import { transformOutput } from '../../schema/transformOutput' import { transformOutput } from '../../schema/transformOutput'
import type { BlockStateRegistry } from '../../Schemas' import type { BlockStateRegistry } from '../../services'
import { Store } from '../../Store' import { Store } from '../../Store'
import { message } from '../../Utils' import { message } from '../../Utils'

View File

@@ -2,7 +2,7 @@ import type { DataModel } from '@mcschema/core'
import { useErrorBoundary, useState } from 'preact/hooks' import { useErrorBoundary, useState } from 'preact/hooks'
import { useModel } from '../../hooks' import { useModel } from '../../hooks'
import { FullNode } from '../../schema/renderHtml' import { FullNode } from '../../schema/renderHtml'
import type { BlockStateRegistry, VersionId } from '../../Schemas' import type { BlockStateRegistry, VersionId } from '../../services'
type TreePanelProps = { type TreePanelProps = {
lang: string, lang: string,

View File

@@ -4,7 +4,7 @@ import { Btn, BtnInput, BtnMenu } from '..'
import { useCanvas } from '../../hooks' import { useCanvas } from '../../hooks'
import { locale } from '../../Locales' import { locale } from '../../Locales'
import { noiseSettings } from '../../previews' import { noiseSettings } from '../../previews'
import { checkVersion } from '../../Schemas' import { checkVersion } from '../../services'
import { randomSeed } from '../../Utils' import { randomSeed } from '../../Utils'
export const NoiseSettingsPreview = ({ lang, data, shown, version }: PreviewProps) => { export const NoiseSettingsPreview = ({ lang, data, shown, version }: PreviewProps) => {

View File

@@ -1,5 +1,5 @@
import type { DataModel } from '@mcschema/core' import type { DataModel } from '@mcschema/core'
import type { VersionId } from '../../Schemas' import type { VersionId } from '../../services'
export * from './BiomeSourcePreview' export * from './BiomeSourcePreview'
export * from './DecoratorPreview' export * from './DecoratorPreview'

View File

@@ -1,9 +1,9 @@
import { Howl } from 'howler' import { Howl } from 'howler'
import { useEffect, useRef, useState } from 'preact/hooks' import { useEffect, useRef, useState } from 'preact/hooks'
import { Btn, NumberInput, RangeInput, TextInput } from '..' import { Btn, NumberInput, RangeInput, TextInput } from '..'
import { getResourceUrl } from '../../DataFetcher'
import { locale } from '../../Locales' import { locale } from '../../Locales'
import type { SoundEvents, VersionAssets } from '../../Manifest' import type { SoundEvents, VersionAssets } from '../../services'
import { getResourceUrl } from '../../services'
export interface SoundConfig { export interface SoundConfig {
id: string, id: string,

View File

@@ -2,9 +2,8 @@ import marked from 'marked'
import { useEffect, useMemo, useState } from 'preact/hooks' import { useEffect, useMemo, useState } from 'preact/hooks'
import { Ad, Btn, ErrorPanel, Octicon, TextInput } from '../components' import { Ad, Btn, ErrorPanel, Octicon, TextInput } from '../components'
import { locale } from '../Locales' import { locale } from '../Locales'
import type { VersionId } from '../Schemas' import type { ChangelogEntry, ChangelogVersion, VersionId } from '../services'
import type { ChangelogEntry, ChangelogVersion } from '../services/Changelogs' import { getChangelogs } from '../services'
import { getChangelogs } from '../services/Changelogs'
import { hashString } from '../Utils' import { hashString } from '../Utils'
type ChangelogProps = { type ChangelogProps = {

View File

@@ -4,11 +4,10 @@ import { useEffect, useErrorBoundary, useRef, useState } from 'preact/hooks'
import config from '../../config.json' import config from '../../config.json'
import { Analytics } from '../Analytics' import { Analytics } from '../Analytics'
import { Ad, Btn, BtnInput, BtnMenu, ErrorPanel, HasPreview, Octicon, PreviewPanel, SourcePanel, Tree } from '../components' import { Ad, Btn, BtnInput, BtnMenu, ErrorPanel, HasPreview, Octicon, PreviewPanel, SourcePanel, Tree } from '../components'
import { fetchPreset } from '../DataFetcher'
import { useModel } from '../hooks' import { useModel } from '../hooks'
import { locale } from '../Locales' import { locale } from '../Locales'
import type { BlockStateRegistry, VersionId } from '../Schemas' import type { BlockStateRegistry, VersionId } from '../services'
import { checkVersion, getBlockStates, getCollections, getModel } from '../Schemas' import { checkVersion, fetchPreset, getBlockStates, getCollections, getModel } from '../services'
import { getGenerator, message } from '../Utils' import { getGenerator, message } from '../Utils'
type GeneratorProps = { type GeneratorProps = {

View File

@@ -2,9 +2,8 @@ import { useEffect, useRef, useState } from 'preact/hooks'
import config from '../../config.json' import config from '../../config.json'
import { Ad, Btn, BtnMenu, ErrorPanel, SoundConfig, TextInput } from '../components' import { Ad, Btn, BtnMenu, ErrorPanel, SoundConfig, TextInput } from '../components'
import { locale } from '../Locales' import { locale } from '../Locales'
import type { SoundEvents, VersionAssets } from '../Manifest' import type { SoundEvents, VersionAssets, VersionId } from '../services'
import { getAssets, getSounds } from '../Manifest' import { getAssets, getSounds } from '../services'
import type { VersionId } from '../Schemas'
import { hexId, message } from '../Utils' import { hexId, message } from '../Utils'
type SoundsProps = { type SoundsProps = {

View File

@@ -4,8 +4,8 @@ import { FixedBiome, LegacyRandom, NormalNoise, TerrainShaper } from 'deepslate'
import init, { biome_parameters, climate_noise, climate_sampler, multi_noise } from 'deepslate-rs' import init, { biome_parameters, climate_noise, climate_sampler, multi_noise } from 'deepslate-rs'
// @ts-expect-error // @ts-expect-error
import wasm from 'deepslate-rs/deepslate_rs_bg.wasm?url' import wasm from 'deepslate-rs/deepslate_rs_bg.wasm?url'
import { fetchPreset } from '../DataFetcher' import type { VersionId } from '../services'
import type { VersionId } from '../Schemas' import { fetchPreset } from '../services'
import { BiMap, clamp, deepClone, deepEqual, square, stringToColor } from '../Utils' import { BiMap, clamp, deepClone, deepEqual, square, stringToColor } from '../Utils'
let ready = false let ready = false

View File

@@ -1,7 +1,7 @@
import { DataModel } from '@mcschema/core' import { DataModel } from '@mcschema/core'
import type { Random } from 'deepslate' import type { Random } from 'deepslate'
import { LegacyRandom, PerlinNoise } from 'deepslate' import { LegacyRandom, PerlinNoise } from 'deepslate'
import type { VersionId } from '../Schemas' import type { VersionId } from '../services'
import { clamp, stringToColor } from '../Utils' import { clamp, stringToColor } from '../Utils'
type BlockPos = [number, number, number] type BlockPos = [number, number, number]

View File

@@ -2,8 +2,8 @@ import { DataModel } from '@mcschema/core'
import type { BlockPos, BlockState } from 'deepslate' import type { BlockPos, BlockState } from 'deepslate'
import { Chunk, ChunkPos, FixedBiome, NoiseChunkGenerator, NoiseGeneratorSettings } from 'deepslate' import { Chunk, ChunkPos, FixedBiome, NoiseChunkGenerator, NoiseGeneratorSettings } from 'deepslate'
import { getOctaves } from '../components' import { getOctaves } from '../components'
import type { VersionId } from '../Schemas' import type { VersionId } from '../services'
import { checkVersion } from '../Schemas' import { checkVersion } from '../services'
import { deepClone, deepEqual } from '../Utils' import { deepClone, deepEqual } from '../Utils'
import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator' import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator'

View File

@@ -1,6 +1,6 @@
import { DataModel } from '@mcschema/core' import { DataModel } from '@mcschema/core'
import { LegacyRandom, NoiseParameters, NormalNoise } from 'deepslate' import { LegacyRandom, NoiseParameters, NormalNoise } from 'deepslate'
import type { VersionId } from '../Schemas' import type { VersionId } from '../services'
export type NoiseOptions = { export type NoiseOptions = {
offset: [number, number], offset: [number, number],

View File

@@ -3,12 +3,11 @@ import { DataModel, ListNode, MapNode, ModelPath, ObjectNode, Path, relativePath
import type { ComponentChildren, JSX } from 'preact' import type { ComponentChildren, JSX } from 'preact'
import { memo } from 'preact/compat' import { memo } from 'preact/compat'
import { useState } from 'preact/hooks' import { useState } from 'preact/hooks'
import { Btn } from '../components' import { Btn, Octicon } from '../components'
import { Octicon } from '../components/Octicon'
import { useFocus } from '../hooks' import { useFocus } from '../hooks'
import { locale } from '../Locales' import { locale } from '../Locales'
import type { BlockStateRegistry } from '../Schemas' import type { BlockStateRegistry } from '../services'
import { CachedDecorator, CachedFeature } from '../Schemas' import { CachedDecorator, CachedFeature } from '../services'
import { deepClone, deepEqual, hexId, isObject, newSeed } from '../Utils' import { deepClone, deepEqual, hexId, isObject, newSeed } from '../Utils'
import { ModelWrapper } from './ModelWrapper' import { ModelWrapper } from './ModelWrapper'

View File

@@ -1,6 +1,6 @@
import type { Hook } from '@mcschema/core' import type { Hook } from '@mcschema/core'
import { relativePath } from '@mcschema/core' import { relativePath } from '@mcschema/core'
import type { BlockStateRegistry } from '../Schemas' import type { BlockStateRegistry } from '../services'
export type OutputProps = { export type OutputProps = {
blockStates: BlockStateRegistry, blockStates: BlockStateRegistry,

View File

@@ -1,9 +1,9 @@
import type { CollectionRegistry } from '@mcschema/core' import type { CollectionRegistry } from '@mcschema/core'
import config from '../config.json' import config from '../../config.json'
import { message } from '../Utils'
import type { VersionAssets, VersionManifest } from './Manifest' import type { VersionAssets, VersionManifest } from './Manifest'
import type { BlockStateRegistry, VersionId } from './Schemas' import type { BlockStateRegistry, VersionId } from './Schemas'
import { checkVersion } from './Schemas' import { checkVersion } from './Schemas'
import { message } from './Utils'
['1.15', '1.16', '1.17'].forEach(v => localStorage.removeItem(`cache_${v}`)) ['1.15', '1.16', '1.17'].forEach(v => localStorage.removeItem(`cache_${v}`))

View File

@@ -4,9 +4,9 @@ import * as java15 from '@mcschema/java-1.15'
import * as java16 from '@mcschema/java-1.16' import * as java16 from '@mcschema/java-1.16'
import * as java17 from '@mcschema/java-1.17' import * as java17 from '@mcschema/java-1.17'
import * as java18 from '@mcschema/java-1.18' import * as java18 from '@mcschema/java-1.18'
import config from '../config.json' import config from '../../config.json'
import { message } from '../Utils'
import { fetchData } from './DataFetcher' import { fetchData } from './DataFetcher'
import { message } from './Utils'
export const VersionIds = ['1.15', '1.16', '1.17', '1.18'] as const export const VersionIds = ['1.15', '1.16', '1.17', '1.18'] as const
export type VersionId = typeof VersionIds[number] export type VersionId = typeof VersionIds[number]

View File

@@ -0,0 +1,4 @@
export * from './Changelogs'
export * from './DataFetcher'
export * from './Manifest'
export * from './Schemas'