mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 15:17:09 +00:00
Move more stuff to services folder
This commit is contained in:
@@ -9,7 +9,7 @@ import { Analytics } from './Analytics'
|
||||
import { Header } from './components'
|
||||
import { loadLocale, locale, Locales } from './Locales'
|
||||
import { Changelog, Generator, Home, Sounds, Worldgen } from './pages'
|
||||
import type { VersionId } from './Schemas'
|
||||
import type { VersionId } from './services'
|
||||
import { Store } from './Store'
|
||||
import { cleanUrl } from './Utils'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { VersionId } from './Schemas'
|
||||
import { VersionIds } from './Schemas'
|
||||
import type { VersionId } from './services'
|
||||
import { VersionIds } from './services'
|
||||
|
||||
export namespace Store {
|
||||
export const ID_LANGUAGE = 'language'
|
||||
|
||||
@@ -2,8 +2,8 @@ import { getCurrentUrl, Link, route } from 'preact-router'
|
||||
import { Btn, BtnMenu, Icons, Octicon } from '.'
|
||||
import config from '../../config.json'
|
||||
import { locale } from '../Locales'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import { checkVersion } from '../Schemas'
|
||||
import type { VersionId } from '../services'
|
||||
import { checkVersion } from '../services'
|
||||
import { cleanUrl, getGenerator } from '../Utils'
|
||||
|
||||
const Themes: Record<string, keyof typeof Octicon> = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DataModel } from '@mcschema/core'
|
||||
import { Path } from '@mcschema/core'
|
||||
import { useState } from 'preact/hooks'
|
||||
import { useModel } from '../../hooks'
|
||||
import type { VersionId } from '../../Schemas'
|
||||
import type { VersionId } from '../../services'
|
||||
import { BiomeSourcePreview, DecoratorPreview, NoisePreview, NoiseSettingsPreview } from '../previews'
|
||||
|
||||
export const HasPreview = ['dimension', 'worldgen/noise', 'worldgen/noise_settings', 'worldgen/configured_feature']
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Btn, BtnMenu } from '..'
|
||||
import { useModel } from '../../hooks'
|
||||
import { locale } from '../../Locales'
|
||||
import { transformOutput } from '../../schema/transformOutput'
|
||||
import type { BlockStateRegistry } from '../../Schemas'
|
||||
import type { BlockStateRegistry } from '../../services'
|
||||
import { Store } from '../../Store'
|
||||
import { message } from '../../Utils'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DataModel } from '@mcschema/core'
|
||||
import { useErrorBoundary, useState } from 'preact/hooks'
|
||||
import { useModel } from '../../hooks'
|
||||
import { FullNode } from '../../schema/renderHtml'
|
||||
import type { BlockStateRegistry, VersionId } from '../../Schemas'
|
||||
import type { BlockStateRegistry, VersionId } from '../../services'
|
||||
|
||||
type TreePanelProps = {
|
||||
lang: string,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Btn, BtnInput, BtnMenu } from '..'
|
||||
import { useCanvas } from '../../hooks'
|
||||
import { locale } from '../../Locales'
|
||||
import { noiseSettings } from '../../previews'
|
||||
import { checkVersion } from '../../Schemas'
|
||||
import { checkVersion } from '../../services'
|
||||
import { randomSeed } from '../../Utils'
|
||||
|
||||
export const NoiseSettingsPreview = ({ lang, data, shown, version }: PreviewProps) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DataModel } from '@mcschema/core'
|
||||
import type { VersionId } from '../../Schemas'
|
||||
import type { VersionId } from '../../services'
|
||||
|
||||
export * from './BiomeSourcePreview'
|
||||
export * from './DecoratorPreview'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Howl } from 'howler'
|
||||
import { useEffect, useRef, useState } from 'preact/hooks'
|
||||
import { Btn, NumberInput, RangeInput, TextInput } from '..'
|
||||
import { getResourceUrl } from '../../DataFetcher'
|
||||
import { locale } from '../../Locales'
|
||||
import type { SoundEvents, VersionAssets } from '../../Manifest'
|
||||
import type { SoundEvents, VersionAssets } from '../../services'
|
||||
import { getResourceUrl } from '../../services'
|
||||
|
||||
export interface SoundConfig {
|
||||
id: string,
|
||||
|
||||
@@ -2,9 +2,8 @@ import marked from 'marked'
|
||||
import { useEffect, useMemo, useState } from 'preact/hooks'
|
||||
import { Ad, Btn, ErrorPanel, Octicon, TextInput } from '../components'
|
||||
import { locale } from '../Locales'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import type { ChangelogEntry, ChangelogVersion } from '../services/Changelogs'
|
||||
import { getChangelogs } from '../services/Changelogs'
|
||||
import type { ChangelogEntry, ChangelogVersion, VersionId } from '../services'
|
||||
import { getChangelogs } from '../services'
|
||||
import { hashString } from '../Utils'
|
||||
|
||||
type ChangelogProps = {
|
||||
|
||||
@@ -4,11 +4,10 @@ import { useEffect, useErrorBoundary, useRef, useState } from 'preact/hooks'
|
||||
import config from '../../config.json'
|
||||
import { Analytics } from '../Analytics'
|
||||
import { Ad, Btn, BtnInput, BtnMenu, ErrorPanel, HasPreview, Octicon, PreviewPanel, SourcePanel, Tree } from '../components'
|
||||
import { fetchPreset } from '../DataFetcher'
|
||||
import { useModel } from '../hooks'
|
||||
import { locale } from '../Locales'
|
||||
import type { BlockStateRegistry, VersionId } from '../Schemas'
|
||||
import { checkVersion, getBlockStates, getCollections, getModel } from '../Schemas'
|
||||
import type { BlockStateRegistry, VersionId } from '../services'
|
||||
import { checkVersion, fetchPreset, getBlockStates, getCollections, getModel } from '../services'
|
||||
import { getGenerator, message } from '../Utils'
|
||||
|
||||
type GeneratorProps = {
|
||||
|
||||
@@ -2,9 +2,8 @@ import { useEffect, useRef, useState } from 'preact/hooks'
|
||||
import config from '../../config.json'
|
||||
import { Ad, Btn, BtnMenu, ErrorPanel, SoundConfig, TextInput } from '../components'
|
||||
import { locale } from '../Locales'
|
||||
import type { SoundEvents, VersionAssets } from '../Manifest'
|
||||
import { getAssets, getSounds } from '../Manifest'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import type { SoundEvents, VersionAssets, VersionId } from '../services'
|
||||
import { getAssets, getSounds } from '../services'
|
||||
import { hexId, message } from '../Utils'
|
||||
|
||||
type SoundsProps = {
|
||||
|
||||
@@ -4,8 +4,8 @@ import { FixedBiome, LegacyRandom, NormalNoise, TerrainShaper } from 'deepslate'
|
||||
import init, { biome_parameters, climate_noise, climate_sampler, multi_noise } from 'deepslate-rs'
|
||||
// @ts-expect-error
|
||||
import wasm from 'deepslate-rs/deepslate_rs_bg.wasm?url'
|
||||
import { fetchPreset } from '../DataFetcher'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import type { VersionId } from '../services'
|
||||
import { fetchPreset } from '../services'
|
||||
import { BiMap, clamp, deepClone, deepEqual, square, stringToColor } from '../Utils'
|
||||
|
||||
let ready = false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DataModel } from '@mcschema/core'
|
||||
import type { Random } from 'deepslate'
|
||||
import { LegacyRandom, PerlinNoise } from 'deepslate'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import type { VersionId } from '../services'
|
||||
import { clamp, stringToColor } from '../Utils'
|
||||
|
||||
type BlockPos = [number, number, number]
|
||||
|
||||
@@ -2,8 +2,8 @@ import { DataModel } from '@mcschema/core'
|
||||
import type { BlockPos, BlockState } from 'deepslate'
|
||||
import { Chunk, ChunkPos, FixedBiome, NoiseChunkGenerator, NoiseGeneratorSettings } from 'deepslate'
|
||||
import { getOctaves } from '../components'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import { checkVersion } from '../Schemas'
|
||||
import type { VersionId } from '../services'
|
||||
import { checkVersion } from '../services'
|
||||
import { deepClone, deepEqual } from '../Utils'
|
||||
import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DataModel } from '@mcschema/core'
|
||||
import { LegacyRandom, NoiseParameters, NormalNoise } from 'deepslate'
|
||||
import type { VersionId } from '../Schemas'
|
||||
import type { VersionId } from '../services'
|
||||
|
||||
export type NoiseOptions = {
|
||||
offset: [number, number],
|
||||
|
||||
@@ -3,12 +3,11 @@ import { DataModel, ListNode, MapNode, ModelPath, ObjectNode, Path, relativePath
|
||||
import type { ComponentChildren, JSX } from 'preact'
|
||||
import { memo } from 'preact/compat'
|
||||
import { useState } from 'preact/hooks'
|
||||
import { Btn } from '../components'
|
||||
import { Octicon } from '../components/Octicon'
|
||||
import { Btn, Octicon } from '../components'
|
||||
import { useFocus } from '../hooks'
|
||||
import { locale } from '../Locales'
|
||||
import type { BlockStateRegistry } from '../Schemas'
|
||||
import { CachedDecorator, CachedFeature } from '../Schemas'
|
||||
import type { BlockStateRegistry } from '../services'
|
||||
import { CachedDecorator, CachedFeature } from '../services'
|
||||
import { deepClone, deepEqual, hexId, isObject, newSeed } from '../Utils'
|
||||
import { ModelWrapper } from './ModelWrapper'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Hook } from '@mcschema/core'
|
||||
import { relativePath } from '@mcschema/core'
|
||||
import type { BlockStateRegistry } from '../Schemas'
|
||||
import type { BlockStateRegistry } from '../services'
|
||||
|
||||
export type OutputProps = {
|
||||
blockStates: BlockStateRegistry,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
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 { BlockStateRegistry, VersionId } from './Schemas'
|
||||
import { checkVersion } from './Schemas'
|
||||
import { message } from './Utils'
|
||||
|
||||
['1.15', '1.16', '1.17'].forEach(v => localStorage.removeItem(`cache_${v}`))
|
||||
|
||||
@@ -4,9 +4,9 @@ import * as java15 from '@mcschema/java-1.15'
|
||||
import * as java16 from '@mcschema/java-1.16'
|
||||
import * as java17 from '@mcschema/java-1.17'
|
||||
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 { message } from './Utils'
|
||||
|
||||
export const VersionIds = ['1.15', '1.16', '1.17', '1.18'] as const
|
||||
export type VersionId = typeof VersionIds[number]
|
||||
4
src/app/services/index.ts
Normal file
4
src/app/services/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './Changelogs'
|
||||
export * from './DataFetcher'
|
||||
export * from './Manifest'
|
||||
export * from './Schemas'
|
||||
Reference in New Issue
Block a user