Update to esm, update deepslate (#244)

This commit is contained in:
Misode
2022-06-16 00:58:14 +02:00
committed by GitHub
parent cbef6ef41b
commit 561cd341a1
98 changed files with 1243 additions and 1104 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import type { VersionId } from './services'
import type { VersionId } from './services/index.js'
type Method = 'menu' | 'hotkey'
+4 -4
View File
@@ -2,10 +2,10 @@ import type { RouterOnChangeArgs } from 'preact-router'
import { Router } from 'preact-router'
import '../styles/global.css'
import '../styles/nodes.css'
import { Analytics } from './Analytics'
import { Header } from './components'
import { Category, Changelog, Generator, Guide, Guides, Home, Partners, Sounds, Versions } from './pages'
import { cleanUrl } from './Utils'
import { Analytics } from './Analytics.js'
import { Header } from './components/index.js'
import { Category, Changelog, Generator, Guide, Guides, Home, Partners, Sounds, Versions } from './pages/index.js'
import { cleanUrl } from './Utils.js'
export function App() {
const changeRoute = (e: RouterOnChangeArgs) => {
+27
View File
@@ -0,0 +1,27 @@
import config from '../config.json'
interface Config {
languages: Array<{
code: string,
name: string,
schemas?: boolean,
}>,
versions: Array<{
id: string,
pack_format: number,
ref?: string,
dynamic?: boolean,
}>,
generators: Array<{
id: string,
url: string,
schema: string,
path?: string,
category?: string,
partner?: string,
minVersion?: string,
maxVersion?: string,
}>,
}
export default config as Config
+2 -2
View File
@@ -1,8 +1,8 @@
import { render } from 'preact'
import '../styles/global.css'
import '../styles/nodes.css'
import { App } from './App'
import { LocaleProvider, ProjectProvider, StoreProvider, ThemeProvider, TitleProvider, VersionProvider } from './contexts'
import { App } from './App.js'
import { LocaleProvider, ProjectProvider, StoreProvider, ThemeProvider, TitleProvider, VersionProvider } from './contexts/index.js'
function Main() {
return (
+4 -4
View File
@@ -1,7 +1,7 @@
import type { Project } from './contexts'
import { DRAFT_PROJECT } from './contexts'
import type { VersionId } from './services'
import { VersionIds } from './services'
import type { Project } from './contexts/index.js'
import { DRAFT_PROJECT } from './contexts/index.js'
import type { VersionId } from './services/index.js'
import { VersionIds } from './services/index.js'
export namespace Store {
export const ID_LANGUAGE = 'language'
+1 -1
View File
@@ -4,7 +4,7 @@ import * as zip from '@zip.js/zip.js'
import yaml from 'js-yaml'
import { route } from 'preact-router'
import rfdc from 'rfdc'
import config from '../config.json'
import config from './Config.js'
export function isPromise(obj: any): obj is Promise<any> {
return typeof (obj as any)?.then === 'function'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Octicon } from '.'
import { Octicon } from './index.js'
type BtnProps = {
icon?: keyof typeof Octicon,
+2 -2
View File
@@ -1,6 +1,6 @@
import { useEffect, useRef } from 'preact/hooks'
import { Octicon } from '.'
import { hexId } from '../Utils'
import { hexId } from '../Utils.js'
import { Octicon } from './index.js'
type BtnInputProps = {
icon?: keyof typeof Octicon,
+1 -1
View File
@@ -1,4 +1,4 @@
import { Octicon } from '.'
import { Octicon } from './index.js'
interface Props {
link?: string,
+3 -3
View File
@@ -1,7 +1,7 @@
import type { ComponentChildren } from 'preact'
import type { Octicon } from '.'
import { Btn } from '.'
import { useFocus } from '../hooks'
import { useFocus } from '../hooks/index.js'
import type { Octicon } from './index.js'
import { Btn } from './index.js'
interface BtnMenuProps extends JSX.HTMLAttributes<HTMLDivElement> {
icon?: keyof typeof Octicon,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState } from 'preact/hooks'
import { Octicon } from './Octicon'
import { Octicon } from './index.js'
type ErrorPanelProps = {
error: string | Error,
+2 -2
View File
@@ -1,6 +1,6 @@
import { useCallback, useRef } from 'preact/hooks'
import { Btn } from '.'
import { useLocale } from '../contexts'
import { useLocale } from '../contexts/index.js'
import { Btn } from './index.js'
interface Props {
value: File | undefined,
+2 -2
View File
@@ -1,5 +1,5 @@
import { Octicon } from '.'
import { useLocale } from '../contexts'
import { useLocale } from '../contexts/index.js'
import { Octicon } from './index.js'
interface Props {
donate?: boolean,
+1 -1
View File
@@ -1,5 +1,5 @@
import { Giscus as GiscusReact } from '@giscus/react'
import { useTheme } from '../contexts'
import { useTheme } from '../contexts/index.js'
interface Props {
term?: string,
+1 -1
View File
@@ -1,4 +1,4 @@
import { ChangelogTag } from './versions'
import { ChangelogTag } from './index.js'
interface Props {
title: string,
+5 -5
View File
@@ -1,9 +1,9 @@
import { getCurrentUrl, Link, route } from 'preact-router'
import { Btn, BtnMenu, Icons, Octicon } from '.'
import config from '../../config.json'
import { useLocale, useProject, useTheme, useTitle, useVersion } from '../contexts'
import { checkVersion } from '../services'
import { cleanUrl, getGenerator } from '../Utils'
import config from '../Config.js'
import { useLocale, useProject, useTheme, useTitle, useVersion } from '../contexts/index.js'
import { checkVersion } from '../services/index.js'
import { cleanUrl, getGenerator } from '../Utils.js'
import { Btn, BtnMenu, Icons, Octicon } from './index.js'
const Themes: Record<string, keyof typeof Octicon> = {
system: 'device_desktop',
+3 -3
View File
@@ -1,10 +1,10 @@
import type { JSX } from 'preact'
import { useCallback, useEffect } from 'preact/hooks'
import type { JSXInternal } from 'preact/src/jsx'
import { LOSE_FOCUS } from '../hooks'
import { LOSE_FOCUS } from '../hooks/index.js'
const MODALS_KEY = 'data-modals'
interface Props extends JSXInternal.HTMLAttributes<HTMLDivElement> {
interface Props extends JSX.HTMLAttributes<HTMLDivElement> {
onDismiss: () => void,
}
export function Modal(props: Props) {
+1 -1
View File
@@ -1,5 +1,5 @@
import type { ComponentChildren } from 'preact'
import { Icons } from './Icons'
import { Icons } from './Icons.js'
type ToolCardProps = {
title: string,
+2 -2
View File
@@ -1,6 +1,6 @@
import { useMemo, useState } from 'preact/hooks'
import { Octicon } from '.'
import { useFocus } from '../hooks'
import { useFocus } from '../hooks/index.js'
import { Octicon } from './index.js'
const SEPARATOR = '/'
+6 -6
View File
@@ -1,10 +1,10 @@
import { useMemo } from 'preact/hooks'
import config from '../../config.json'
import { useLocale } from '../contexts'
import type { VersionId } from '../services'
import { Store } from '../Store'
import { Btn } from './Btn'
import { BtnMenu } from './BtnMenu'
import config from '../Config.js'
import { useLocale } from '../contexts/index.js'
import type { VersionId } from '../services/index.js'
import { Store } from '../Store.js'
import { Btn } from './Btn.js'
import { BtnMenu } from './BtnMenu.js'
interface Props {
value?: VersionId,
+1 -1
View File
@@ -1,4 +1,4 @@
import { hexId } from '../../Utils'
import { hexId } from '../../Utils.js'
interface Props {
label: string,
+2 -2
View File
@@ -1,7 +1,7 @@
import type { JSX } from 'preact'
import { useEffect, useRef } from 'preact/hooks'
import type { JSXInternal } from 'preact/src/jsx'
type InputProps = JSXInternal.HTMLAttributes<HTMLInputElement>
type InputProps = JSX.HTMLAttributes<HTMLInputElement>
type BaseInputProps<T> = Omit<InputProps, 'onChange' | 'type'> & {
onChange?: (value: T) => unknown,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo, useState } from 'preact/hooks'
import { Btn, BtnInput } from '..'
import { Btn, BtnInput } from '../index.js'
interface Props {
values?: string[],
+3 -3
View File
@@ -1,3 +1,3 @@
export * from './Checkbox'
export * from './Input'
export * from './SearchList'
export * from './Checkbox.js'
export * from './Input.js'
export * from './SearchList.js'
@@ -1,10 +1,10 @@
import { DataModel } from '@mcschema/core'
import { useState } from 'preact/hooks'
import { Analytics } from '../../Analytics'
import { useLocale, useProject } from '../../contexts'
import { Btn } from '../Btn'
import { TextInput } from '../forms'
import { Modal } from '../Modal'
import { Analytics } from '../../Analytics.js'
import { useLocale, useProject } from '../../contexts/index.js'
import { Btn } from '../Btn.js'
import { TextInput } from '../forms/index.js'
import { Modal } from '../Modal.js'
interface Props {
model: DataModel,
@@ -1,9 +1,9 @@
import { useState } from 'preact/hooks'
import { Analytics } from '../../Analytics'
import { useLocale, useProject } from '../../contexts'
import { Btn } from '../Btn'
import { TextInput } from '../forms'
import { Modal } from '../Modal'
import { Analytics } from '../../Analytics.js'
import { useLocale, useProject } from '../../contexts/index.js'
import { Btn } from '../Btn.js'
import { TextInput } from '../forms/index.js'
import { Modal } from '../Modal.js'
interface Props {
id: string,
@@ -1,10 +1,10 @@
import type { DataModel } from '@mcschema/core'
import { Path } from '@mcschema/core'
import { useState } from 'preact/hooks'
import { useModel } from '../../hooks'
import type { VersionId } from '../../services'
import { checkVersion } from '../../services'
import { BiomeSourcePreview, DecoratorPreview, DensityFunctionPreview, NoisePreview, NoiseSettingsPreview } from '../previews'
import { useModel } from '../../hooks/index.js'
import type { VersionId } from '../../services/index.js'
import { checkVersion } from '../../services/index.js'
import { BiomeSourcePreview, DecoratorPreview, DensityFunctionPreview, NoisePreview, NoiseSettingsPreview } from '../previews/index.js'
export const HasPreview = ['dimension', 'worldgen/density_function', 'worldgen/noise', 'worldgen/noise_settings', 'worldgen/configured_feature', 'worldgen/placed_feature']
@@ -1,12 +1,12 @@
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
import { Btn, BtnMenu, FileUpload, Octicon, TextInput } from '..'
import config from '../../../config.json'
import type { Project } from '../../contexts'
import { disectFilePath, useLocale, useProject } from '../../contexts'
import type { VersionId } from '../../services'
import { DEFAULT_VERSION, parseSource } from '../../services'
import { message, readZip } from '../../Utils'
import { Modal } from '../Modal'
import config from '../../Config.js'
import type { Project } from '../../contexts/index.js'
import { disectFilePath, useLocale, useProject } from '../../contexts/index.js'
import type { VersionId } from '../../services/index.js'
import { DEFAULT_VERSION, parseSource } from '../../services/index.js'
import { message, readZip } from '../../Utils.js'
import { Btn, BtnMenu, FileUpload, Octicon, TextInput } from '../index.js'
import { Modal } from '../Modal.js'
interface Props {
onClose: () => unknown,
@@ -1,7 +1,7 @@
import { Analytics } from '../../Analytics'
import { useLocale, useProject } from '../../contexts'
import { Btn } from '../Btn'
import { Modal } from '../Modal'
import { Analytics } from '../../Analytics.js'
import { useLocale, useProject } from '../../contexts/index.js'
import { Btn } from '../Btn.js'
import { Modal } from '../Modal.js'
interface Props {
onClose: () => void,
+10 -10
View File
@@ -1,15 +1,15 @@
import type { DataModel } from '@mcschema/core'
import { useCallback, useMemo, useRef, useState } from 'preact/hooks'
import { Analytics } from '../../Analytics'
import { disectFilePath, DRAFT_PROJECT, getFilePath, useLocale, useProject } from '../../contexts'
import type { VersionId } from '../../services'
import { stringifySource } from '../../services'
import { Store } from '../../Store'
import { writeZip } from '../../Utils'
import { Btn } from '../Btn'
import { BtnMenu } from '../BtnMenu'
import type { EntryAction } from '../TreeView'
import { TreeView } from '../TreeView'
import { Analytics } from '../../Analytics.js'
import { disectFilePath, DRAFT_PROJECT, getFilePath, useLocale, useProject } from '../../contexts/index.js'
import type { VersionId } from '../../services/index.js'
import { stringifySource } from '../../services/index.js'
import { Store } from '../../Store.js'
import { writeZip } from '../../Utils.js'
import { Btn } from '../Btn.js'
import { BtnMenu } from '../BtnMenu.js'
import type { EntryAction } from '../TreeView.js'
import { TreeView } from '../TreeView.js'
interface Props {
model: DataModel | undefined,
+8 -8
View File
@@ -1,13 +1,13 @@
import { DataModel } from '@mcschema/core'
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
import { Btn, BtnMenu } from '..'
import { useLocale } from '../../contexts'
import { useModel } from '../../hooks'
import { getOutput } from '../../schema/transformOutput'
import type { BlockStateRegistry } from '../../services'
import { getSourceFormats, getSourceIndent, getSourceIndents, parseSource, stringifySource } from '../../services'
import { Store } from '../../Store'
import { message } from '../../Utils'
import { useLocale } from '../../contexts/index.js'
import { useModel } from '../../hooks/index.js'
import { getOutput } from '../../schema/transformOutput.js'
import type { BlockStateRegistry } from '../../services/index.js'
import { getSourceFormats, getSourceIndent, getSourceIndents, parseSource, stringifySource } from '../../services/index.js'
import { Store } from '../../Store.js'
import { message } from '../../Utils.js'
import { Btn, BtnMenu } from '../index.js'
interface Editor {
getValue(): string
+4 -4
View File
@@ -1,9 +1,9 @@
import type { DataModel } from '@mcschema/core'
import { useErrorBoundary, useState } from 'preact/hooks'
import { useLocale } from '../../contexts'
import { useModel } from '../../hooks'
import { FullNode } from '../../schema/renderHtml'
import type { BlockStateRegistry, VersionId } from '../../services'
import { useLocale } from '../../contexts/index.js'
import { useModel } from '../../hooks/index.js'
import { FullNode } from '../../schema/renderHtml.js'
import type { BlockStateRegistry, VersionId } from '../../services/index.js'
type TreePanelProps = {
version: VersionId,
+8 -8
View File
@@ -1,8 +1,8 @@
export * from './FileCreation'
export * from './FileRenaming'
export * from './PreviewPanel'
export * from './ProjectCreation'
export * from './ProjectDeletion'
export * from './ProjectPanel'
export * from './SourcePanel'
export * from './Tree'
export * from './FileCreation.js'
export * from './FileRenaming.js'
export * from './PreviewPanel.js'
export * from './ProjectCreation.js'
export * from './ProjectDeletion.js'
export * from './ProjectPanel.js'
export * from './SourcePanel.js'
export * from './Tree.js'
+22 -22
View File
@@ -1,22 +1,22 @@
export * from './Ad'
export * from './Btn'
export * from './BtnInput'
export * from './BtnLink'
export * from './BtnMenu'
export * from './ErrorPanel'
export * from './FileUpload'
export * from './Footer'
export * from './forms'
export * from './generator'
export * from './Giscus'
export * from './GuideCard'
export * from './Header'
export * from './Icons'
export * from './Modal'
export * from './Octicon'
export * from './previews'
export * from './sounds'
export * from './ToolCard'
export * from './TreeView'
export * from './versions'
export * from './VersionSwitcher'
export * from './Ad.js'
export * from './Btn.js'
export * from './BtnInput.js'
export * from './BtnLink.js'
export * from './BtnMenu.js'
export * from './ErrorPanel.js'
export * from './FileUpload.js'
export * from './Footer.js'
export * from './forms/index.js'
export * from './generator/index.js'
export * from './Giscus.js'
export * from './GuideCard.js'
export * from './Header.js'
export * from './Icons.js'
export * from './Modal.js'
export * from './Octicon.js'
export * from './previews/index.js'
export * from './sounds/index.js'
export * from './ToolCard.js'
export * from './TreeView.js'
export * from './versions/index.js'
export * from './VersionSwitcher.js'
@@ -1,12 +1,12 @@
import { Path } from '@mcschema/core'
import type { NoiseParameters } from 'deepslate/worldgen'
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
import type { PreviewProps } from '.'
import { Btn, BtnMenu } from '..'
import { useLocale, useStore } from '../../contexts'
import { useCanvas } from '../../hooks'
import { biomeMap, getBiome } from '../../previews'
import { newSeed, randomSeed } from '../../Utils'
import { useLocale, useStore } from '../../contexts/index.js'
import { useCanvas } from '../../hooks/index.js'
import { biomeMap, getBiome } from '../../previews/index.js'
import { newSeed, randomSeed } from '../../Utils.js'
import { Btn, BtnMenu } from '../index.js'
import type { PreviewProps } from './index.js'
const LAYERS = ['biomes', 'temperature', 'humidity', 'continentalness', 'erosion', 'weirdness'] as const
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'preact/hooks'
import type { PreviewProps } from '.'
import { Btn } from '..'
import { useLocale } from '../../contexts'
import { useCanvas } from '../../hooks'
import { decorator } from '../../previews'
import { randomSeed } from '../../Utils'
import { useLocale } from '../../contexts/index.js'
import { useCanvas } from '../../hooks/index.js'
import { decorator } from '../../previews/index.js'
import { randomSeed } from '../../Utils.js'
import { Btn } from '../index.js'
import type { PreviewProps } from './index.js'
export const DecoratorPreview = ({ data, version, shown }: PreviewProps) => {
const { locale } = useLocale()
@@ -1,10 +1,10 @@
import { useEffect, useRef, useState } from 'preact/hooks'
import type { PreviewProps } from '.'
import { Btn, BtnMenu } from '..'
import { useLocale } from '../../contexts'
import { useCanvas } from '../../hooks'
import { densityFunction } from '../../previews'
import { randomSeed } from '../../Utils'
import { useLocale } from '../../contexts/index.js'
import { useCanvas } from '../../hooks/index.js'
import { densityFunction } from '../../previews/index.js'
import { randomSeed } from '../../Utils.js'
import { Btn, BtnMenu } from '../index.js'
import type { PreviewProps } from './index.js'
export const DensityFunctionPreview = ({ data, shown, version }: PreviewProps) => {
const { locale } = useLocale()
+6 -6
View File
@@ -1,10 +1,10 @@
import { useEffect, useRef, useState } from 'preact/hooks'
import type { PreviewProps } from '.'
import { Btn } from '..'
import { useLocale } from '../../contexts'
import { useCanvas } from '../../hooks'
import { normalNoise } from '../../previews'
import { randomSeed } from '../../Utils'
import { useLocale } from '../../contexts/index.js'
import { useCanvas } from '../../hooks/index.js'
import { normalNoise } from '../../previews/index.js'
import { randomSeed } from '../../Utils.js'
import { Btn } from '../index.js'
import type { PreviewProps } from './index.js'
export const NoisePreview = ({ data, shown, version }: PreviewProps) => {
const { locale } = useLocale()
@@ -1,11 +1,11 @@
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
import type { PreviewProps } from '.'
import { Btn, BtnInput, BtnMenu } from '..'
import { useLocale } from '../../contexts'
import { useCanvas } from '../../hooks'
import { getNoiseBlock, noiseSettings } from '../../previews'
import { CachedCollections, checkVersion } from '../../services'
import { randomSeed } from '../../Utils'
import { useLocale } from '../../contexts/index.js'
import { useCanvas } from '../../hooks/index.js'
import { getNoiseBlock, noiseSettings } from '../../previews/index.js'
import { CachedCollections, checkVersion } from '../../services/index.js'
import { randomSeed } from '../../Utils.js'
import { Btn, BtnInput, BtnMenu } from '../index.js'
import type { PreviewProps } from './index.js'
export const NoiseSettingsPreview = ({ data, shown, version }: PreviewProps) => {
const { locale } = useLocale()
+6 -6
View File
@@ -1,11 +1,11 @@
import type { DataModel } from '@mcschema/core'
import type { VersionId } from '../../services'
import type { VersionId } from '../../services/index.js'
export * from './BiomeSourcePreview'
export * from './DecoratorPreview'
export * from './DensityFunctionPreview'
export * from './NoisePreview'
export * from './NoiseSettingsPreview'
export * from './BiomeSourcePreview.js'
export * from './DecoratorPreview.js'
export * from './DensityFunctionPreview.js'
export * from './NoisePreview.js'
export * from './NoiseSettingsPreview.js'
export type PreviewProps = {
model: DataModel,
+4 -4
View File
@@ -1,9 +1,9 @@
import type { Howl, HowlOptions } from 'howler'
import { useEffect, useRef, useState } from 'preact/hooks'
import { Btn, NumberInput, RangeInput, TextInput } from '..'
import { useLocale, useVersion } from '../../contexts'
import type { SoundEvents } from '../../services'
import { getSoundUrl } from '../../services'
import { useLocale, useVersion } from '../../contexts/index.js'
import type { SoundEvents } from '../../services/index.js'
import { getSoundUrl } from '../../services/index.js'
import { Btn, NumberInput, RangeInput, TextInput } from '../index.js'
export interface SoundConfig {
id: string,
+1 -1
View File
@@ -1 +1 @@
export * from './SoundConfig'
export * from './SoundConfig.js'
@@ -1,6 +1,6 @@
import { marked } from 'marked'
import { ChangelogTag } from '.'
import type { Change } from '../../services'
import type { Change } from '../../services/index.js'
import { ChangelogTag } from './index.js'
type Props = {
change: Change,
@@ -1,11 +1,10 @@
import { useMemo, useState } from 'preact/hooks'
import { Btn, TextInput } from '..'
import { useLocale } from '../../contexts'
import { useSearchParam } from '../../hooks'
import { useTags } from '../../hooks/useTags'
import type { Change } from '../../services'
import { ChangelogEntry } from './ChangelogEntry'
import { ChangelogTag } from './ChangelogTag'
import { useLocale } from '../../contexts/index.js'
import { useSearchParam, useTags } from '../../hooks/index.js'
import type { Change } from '../../services/index.js'
import { Btn, TextInput } from '../index.js'
import { ChangelogEntry } from './ChangelogEntry.js'
import { ChangelogTag } from './ChangelogTag.js'
const SEARCH_KEY = 'search'
+2 -2
View File
@@ -1,5 +1,5 @@
import { Octicon } from '..'
import { hashString } from '../../Utils'
import { hashString } from '../../Utils.js'
import { Octicon } from '../index.js'
type TagProps = {
label: string,
@@ -1,11 +1,11 @@
import { useEffect, useMemo, useState } from 'preact/hooks'
import { VersionMetaData } from '.'
import { useLocale } from '../../contexts'
import type { Change, VersionMeta } from '../../services'
import { getArticleLink, getChangelogs } from '../../services'
import { Giscus } from '../Giscus'
import { Octicon } from '../Octicon'
import { ChangelogList } from './ChangelogList'
import { useLocale } from '../../contexts/index.js'
import type { Change, VersionMeta } from '../../services/index.js'
import { getArticleLink, getChangelogs } from '../../services/index.js'
import { Giscus } from '../Giscus.js'
import { Octicon } from '../Octicon.js'
import { ChangelogList } from './ChangelogList.js'
import { VersionMetaData } from './index.js'
type Tab = 'changelog' | 'discussion'
+3 -3
View File
@@ -1,6 +1,6 @@
import { releaseDate, VersionMetaData } from '.'
import { useLocale } from '../../contexts'
import type { VersionMeta } from '../../services'
import { useLocale } from '../../contexts/index.js'
import type { VersionMeta } from '../../services/index.js'
import { releaseDate, VersionMetaData } from './index.js'
interface Props {
version: VersionMeta,
+5 -5
View File
@@ -1,9 +1,9 @@
import { useMemo, useState } from 'preact/hooks'
import { Checkbox, TextInput } from '..'
import { useLocale } from '../../contexts'
import { useSearchParam } from '../../hooks'
import type { VersionMeta } from '../../services'
import { VersionEntry } from './VersionEntry'
import { useLocale } from '../../contexts/index.js'
import { useSearchParam } from '../../hooks/index.js'
import type { VersionMeta } from '../../services/index.js'
import { Checkbox, TextInput } from '../index.js'
import { VersionEntry } from './VersionEntry.js'
const SEARCH_KEY = 'search'
@@ -1,4 +1,4 @@
import { Octicon } from '..'
import { Octicon } from '../index.js'
interface Props {
label: string,
+7 -7
View File
@@ -1,7 +1,7 @@
export * from './ChangelogEntry'
export * from './ChangelogList'
export * from './ChangelogTag'
export * from './VersionDetail'
export * from './VersionEntry'
export * from './VersionList'
export * from './VersionMetaData'
export * from './ChangelogEntry.js'
export * from './ChangelogList.js'
export * from './ChangelogTag.js'
export * from './VersionDetail.js'
export * from './VersionEntry.js'
export * from './VersionList.js'
export * from './VersionMetaData.js'
+6 -3
View File
@@ -1,10 +1,13 @@
// import { createRequire } from 'module'
import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { useCallback, useContext, useEffect, useState } from 'preact/hooks'
import config from '../../config.json'
import { Analytics } from '../Analytics.js'
import config from '../Config.js'
import { Store } from '../Store.js'
// const require = createRequire(import.meta.url)
// const English = require('../../locales/en.json')
import English from '../../locales/en.json'
import { Analytics } from '../Analytics'
import { Store } from '../Store'
interface Locale {
lang: string,
+4 -4
View File
@@ -2,10 +2,10 @@ import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { route } from 'preact-router'
import { useCallback, useContext, useMemo, useState } from 'preact/hooks'
import config from '../../config.json'
import type { VersionId } from '../services'
import { Store } from '../Store'
import { cleanUrl } from '../Utils'
import config from '../Config.js'
import type { VersionId } from '../services/index.js'
import { Store } from '../Store.js'
import { cleanUrl } from '../Utils.js'
export type Project = {
name: string,
+2 -2
View File
@@ -1,8 +1,8 @@
import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { useCallback, useContext } from 'preact/hooks'
import { useLocalStorage } from '../hooks'
import type { Color } from '../Utils'
import { useLocalStorage } from '../hooks/index.js'
import type { Color } from '../Utils.js'
interface Store {
biomeColors: Record<string, [number, number, number]>
+3 -3
View File
@@ -1,9 +1,9 @@
import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { useCallback, useContext, useEffect, useState } from 'preact/hooks'
import { Analytics } from '../Analytics'
import { useMediaQuery } from '../hooks'
import { Store } from '../Store'
import { Analytics } from '../Analytics.js'
import { useMediaQuery } from '../hooks/index.js'
import { Store } from '../Store.js'
interface Theme {
theme: string,
+3 -3
View File
@@ -1,9 +1,9 @@
import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { useCallback, useContext, useEffect, useState } from 'preact/hooks'
import { useLocale } from '.'
import config from '../../config.json'
import type { VersionId } from '../services'
import config from '../Config.js'
import type { VersionId } from '../services/index.js'
import { useLocale } from './index.js'
const VERSIONS_IN_TITLE = 3
+5 -5
View File
@@ -1,11 +1,11 @@
import type { ComponentChildren } from 'preact'
import { createContext } from 'preact'
import { useCallback, useContext, useEffect, useState } from 'preact/hooks'
import { Analytics } from '../Analytics'
import { useSearchParam } from '../hooks'
import type { VersionId } from '../services'
import { VersionIds } from '../services'
import { Store } from '../Store'
import { Analytics } from '../Analytics.js'
import { useSearchParam } from '../hooks/index.js'
import type { VersionId } from '../services/index.js'
import { VersionIds } from '../services/index.js'
import { Store } from '../Store.js'
const VERSION_PARAM = 'version'
+6 -6
View File
@@ -1,6 +1,6 @@
export * from './Locale'
export * from './Project'
export * from './Store'
export * from './Theme'
export * from './Title'
export * from './Version'
export * from './Locale.js'
export * from './Project.js'
export * from './Store.js'
export * from './Theme.js'
export * from './Title.js'
export * from './Version.js'
+11 -10
View File
@@ -1,10 +1,11 @@
export * from './useActiveTimout'
export * from './useAsync'
export * from './useAsyncFn'
export * from './useCanvas'
export * from './useFocus'
export * from './useHash'
export * from './useLocalStorage'
export * from './useMediaQuery'
export * from './useModel'
export * from './useSearchParam'
export * from './useActiveTimout.js'
export * from './useAsync.js'
export * from './useAsyncFn.js'
export * from './useCanvas.js'
export * from './useFocus.js'
export * from './useHash.js'
export * from './useLocalStorage.js'
export * from './useMediaQuery.js'
export * from './useModel.js'
export * from './useSearchParam.js'
export * from './useTags.js'
+2 -2
View File
@@ -1,7 +1,7 @@
import type { Inputs } from 'preact/hooks'
import { useEffect } from 'preact/hooks'
import type { AsyncCancel, AsyncState } from './useAsyncFn'
import { useAsyncFn } from './useAsyncFn'
import type { AsyncCancel, AsyncState } from './index.js'
import { useAsyncFn } from './index.js'
export function useAsync<R>(
fn: () => Promise<R | typeof AsyncCancel>,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'preact/hooks'
import { changeUrl } from '../Utils'
import { changeUrl } from '../Utils.js'
export function useHash(): [string, (hash: string) => unknown] {
const [hash, setHash] = useState(window.location.hash)
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'preact/hooks'
import { changeUrl } from '../Utils'
import { changeUrl } from '../Utils.js'
const getValue = (search: string, param: string) => new URLSearchParams(search).get(param) ?? undefined
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'preact/hooks'
import { useSearchParam } from './useSearchParam'
import { useSearchParam } from './index.js'
const TAG_KEY = 'tags'
const TAG_SEP = '|'
+4 -4
View File
@@ -1,7 +1,7 @@
import config from '../../config.json'
import { Footer, ToolCard } from '../components'
import { useLocale, useTitle } from '../contexts'
import { cleanUrl } from '../Utils'
import { Footer, ToolCard } from '../components/index.js'
import config from '../Config.js'
import { useLocale, useTitle } from '../contexts/index.js'
import { cleanUrl } from '../Utils.js'
interface Props {
category: string,
+4 -4
View File
@@ -1,7 +1,7 @@
import { Ad, ChangelogList, ErrorPanel, Footer } from '../components'
import { useLocale, useTitle } from '../contexts'
import { useAsync } from '../hooks'
import { getChangelogs } from '../services'
import { Ad, ChangelogList, ErrorPanel, Footer } from '../components/index.js'
import { useLocale, useTitle } from '../contexts/index.js'
import { useAsync } from '../hooks/index.js'
import { getChangelogs } from '../services/index.js'
interface Props {
path?: string,
+10 -10
View File
@@ -1,16 +1,16 @@
import { DataModel, Path } from '@mcschema/core'
import { getCurrentUrl, route } from 'preact-router'
import { useCallback, useEffect, useErrorBoundary, useMemo, useRef, useState } from 'preact/hooks'
import config from '../../config.json'
import { Analytics } from '../Analytics'
import { Ad, Btn, BtnMenu, ErrorPanel, FileCreation, FileRenaming, Footer, HasPreview, Octicon, PreviewPanel, ProjectCreation, ProjectDeletion, ProjectPanel, SearchList, SourcePanel, TextInput, Tree, VersionSwitcher } from '../components'
import { DRAFT_PROJECT, useLocale, useProject, useTitle, useVersion } from '../contexts'
import { AsyncCancel, useActiveTimeout, useAsync, useModel, useSearchParam } from '../hooks'
import { getOutput } from '../schema/transformOutput'
import type { VersionId } from '../services'
import { checkVersion, fetchPreset, getBlockStates, getCollections, getModel, getSnippet, shareSnippet } from '../services'
import { Store } from '../Store'
import { cleanUrl, deepEqual, getGenerator } from '../Utils'
import { Analytics } from '../Analytics.js'
import { Ad, Btn, BtnMenu, ErrorPanel, FileCreation, FileRenaming, Footer, HasPreview, Octicon, PreviewPanel, ProjectCreation, ProjectDeletion, ProjectPanel, SearchList, SourcePanel, TextInput, Tree, VersionSwitcher } from '../components/index.js'
import config from '../Config.js'
import { DRAFT_PROJECT, useLocale, useProject, useTitle, useVersion } from '../contexts/index.js'
import { AsyncCancel, useActiveTimeout, useAsync, useModel, useSearchParam } from '../hooks/index.js'
import { getOutput } from '../schema/transformOutput.js'
import type { VersionId } from '../services/index.js'
import { checkVersion, fetchPreset, getBlockStates, getCollections, getModel, getSnippet, shareSnippet } from '../services/index.js'
import { Store } from '../Store.js'
import { cleanUrl, deepEqual, getGenerator } from '../Utils.js'
export const SHARE_KEY = 'share'
+6 -6
View File
@@ -3,12 +3,12 @@ import json from 'highlight.js/lib/languages/json'
import { marked } from 'marked'
import { route } from 'preact-router'
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks'
import config from '../../config.json'
import { Ad, Btn, ChangelogTag, Footer, Giscus, Octicon, VersionSwitcher } from '../components'
import { useLocale, useTitle, useVersion } from '../contexts'
import { useActiveTimeout, useAsync, useHash } from '../hooks'
import type { VersionId } from '../services'
import { parseFrontMatter, versionContent } from '../Utils'
import { Ad, Btn, ChangelogTag, Footer, Giscus, Octicon, VersionSwitcher } from '../components/index.js'
import config from '../Config.js'
import { useLocale, useTitle, useVersion } from '../contexts/index.js'
import { useActiveTimeout, useAsync, useHash } from '../hooks/index.js'
import type { VersionId } from '../services/index.js'
import { parseFrontMatter, versionContent } from '../Utils.js'
const HASH = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M6.368 1.01a.75.75 0 01.623.859L6.57 4.5h3.98l.46-2.868a.75.75 0 011.48.237L12.07 4.5h2.18a.75.75 0 010 1.5h-2.42l-.64 4h2.56a.75.75 0 010 1.5h-2.8l-.46 2.869a.75.75 0 01-1.48-.237l.42-2.632H5.45l-.46 2.869a.75.75 0 01-1.48-.237l.42-2.632H1.75a.75.75 0 010-1.5h2.42l.64-4H2.25a.75.75 0 010-1.5h2.8l.46-2.868a.75.75 0 01.858-.622zM9.67 10l.64-4H6.33l-.64 4h3.98z"></path></svg>'
+3 -3
View File
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'preact/hooks'
import { ChangelogTag, Footer, GuideCard, TextInput, VersionSwitcher } from '../components'
import { useLocale, useTitle, useVersion } from '../contexts'
import { useTags } from '../hooks/useTags'
import { ChangelogTag, Footer, GuideCard, TextInput, VersionSwitcher } from '../components/index.js'
import { useLocale, useTitle, useVersion } from '../contexts/index.js'
import { useTags } from '../hooks/index.js'
interface Guide {
id: string,
+4 -4
View File
@@ -1,7 +1,7 @@
import config from '../../config.json'
import { Footer, Giscus, ToolCard } from '../components'
import { useLocale, useTitle } from '../contexts'
import { cleanUrl } from '../Utils'
import { Footer, Giscus, ToolCard } from '../components/index.js'
import config from '../Config.js'
import { useLocale, useTitle } from '../contexts/index.js'
import { cleanUrl } from '../Utils.js'
interface Props {
path?: string,
+4 -4
View File
@@ -1,7 +1,7 @@
import config from '../../config.json'
import { Footer, ToolCard } from '../components'
import { useLocale, useTitle } from '../contexts'
import { cleanUrl } from '../Utils'
import { Footer, ToolCard } from '../components/index.js'
import config from '../Config.js'
import { useLocale, useTitle } from '../contexts/index.js'
import { cleanUrl } from '../Utils.js'
const partners = [...new Set(config.generators
.filter(g => g.partner !== undefined)
+5 -5
View File
@@ -1,10 +1,10 @@
import type { Howl, HowlOptions } from 'howler'
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'
import { Btn, ErrorPanel, Footer, SoundConfig, TextInput, VersionSwitcher } from '../components'
import { useLocale, useTitle, useVersion } from '../contexts'
import { useAsync } from '../hooks'
import { fetchSounds } from '../services'
import { hexId } from '../Utils'
import { Btn, ErrorPanel, Footer, SoundConfig, TextInput, VersionSwitcher } from '../components/index.js'
import { useLocale, useTitle, useVersion } from '../contexts/index.js'
import { useAsync } from '../hooks/index.js'
import { fetchSounds } from '../services/index.js'
import { hexId } from '../Utils.js'
interface Props {
path?: string,
+5 -5
View File
@@ -1,8 +1,8 @@
import { Ad, BtnLink, ErrorPanel, Footer, VersionDetail, VersionList } from '../components'
import { useLocale, useTitle } from '../contexts'
import { useAsync, useSearchParam } from '../hooks'
import type { VersionMeta } from '../services'
import { fetchVersions } from '../services'
import { Ad, BtnLink, ErrorPanel, Footer, VersionDetail, VersionList } from '../components/index.js'
import { useLocale, useTitle } from '../contexts/index.js'
import { useAsync, useSearchParam } from '../hooks/index.js'
import type { VersionMeta } from '../services/index.js'
import { fetchVersions } from '../services/index.js'
interface Props {
path?: string,
+9 -9
View File
@@ -1,9 +1,9 @@
export * from './Category'
export * from './Changelog'
export * from './Generator'
export * from './Guide'
export * from './Guides'
export * from './Home'
export * from './Partners'
export * from './Sounds'
export * from './Versions'
export * from './Category.js'
export * from './Changelog.js'
export * from './Generator.js'
export * from './Guide.js'
export * from './Guides.js'
export * from './Home.js'
export * from './Partners.js'
export * from './Sounds.js'
export * from './Versions.js'
+2 -2
View File
@@ -1,7 +1,7 @@
import type { CollectionRegistry, SchemaRegistry } from '@mcschema/core'
import { initImmersiveWeathering } from './ImmersiveWeathering'
import { initImmersiveWeathering } from './ImmersiveWeathering.js'
export * from './ImmersiveWeathering'
export * from './ImmersiveWeathering.js'
export function initPartners(schemas: SchemaRegistry, collections: CollectionRegistry) {
initImmersiveWeathering(schemas, collections)
+4 -4
View File
@@ -1,12 +1,12 @@
import { DataModel } from '@mcschema/core'
import init, { biome_parameters, climate_noise, climate_sampler, multi_noise } from 'deepslate-rs'
import { biome_parameters, climate_noise, climate_sampler, default as init, multi_noise } from 'deepslate-rs'
// @ts-expect-error
import wasm from 'deepslate-rs/deepslate_rs_bg.wasm?url'
import type { NoiseParameters } from 'deepslate/worldgen'
import { FixedBiome, Identifier, LegacyRandom, NormalNoise } from 'deepslate/worldgen'
import type { VersionId } from '../services'
import { checkVersion, fetchPreset } from '../services'
import { BiMap, clamp, deepClone, deepEqual, square, stringToColor } from '../Utils'
import type { VersionId } from '../services/index.js'
import { checkVersion, fetchPreset } from '../services/index.js'
import { BiMap, clamp, deepClone, deepEqual, square, stringToColor } from '../Utils.js'
let ready = false
async function loadWasm() {
+3 -3
View File
@@ -1,9 +1,9 @@
import { DataModel } from '@mcschema/core'
import type { Random } from 'deepslate/worldgen'
import { LegacyRandom, PerlinNoise } from 'deepslate/worldgen'
import type { VersionId } from '../services'
import { checkVersion } from '../services'
import { clamp, isObject, stringToColor } from '../Utils'
import type { VersionId } from '../services/index.js'
import { checkVersion } from '../services/index.js'
import { clamp, isObject, stringToColor } from '../Utils.js'
type BlockPos = [number, number, number]
type Placement = [BlockPos, number]
+3 -3
View File
@@ -1,8 +1,8 @@
import { DataModel } from '@mcschema/core'
import * as deepslate19 from 'deepslate/worldgen'
import type { VersionId } from '../services'
import { checkVersion, fetchAllPresets } from '../services'
import { deepClone, deepEqual } from '../Utils'
import type { VersionId } from '../services/index.js'
import { checkVersion, fetchAllPresets } from '../services/index.js'
import { deepClone, deepEqual } from '../Utils.js'
export class Deepslate {
private d = deepslate19
+4 -4
View File
@@ -1,8 +1,8 @@
import { BlockState, clampedMap, DensityFunction } from 'deepslate/worldgen'
import type { VersionId } from '../services'
import { checkVersion } from '../services'
import { Deepslate } from './Deepslate'
import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator'
import type { VersionId } from '../services/index.js'
import { checkVersion } from '../services/index.js'
import { Deepslate } from './Deepslate.js'
import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator.js'
export type NoiseSettingsOptions = {
biome?: string,
+1 -1
View File
@@ -1,6 +1,6 @@
import { DataModel } from '@mcschema/core'
import { LegacyRandom, NoiseParameters, NormalNoise } from 'deepslate/worldgen'
import type { VersionId } from '../services'
import type { VersionId } from '../services/index.js'
export type NoiseOptions = {
offset: [number, number],
+4 -4
View File
@@ -1,4 +1,4 @@
export * from './BiomeSource'
export * from './Decorator'
export * from './NoiseSettings'
export * from './NormalNoise'
export * from './BiomeSource.js'
export * from './Decorator.js'
export * from './NoiseSettings.js'
export * from './NormalNoise.js'
@@ -1,5 +1,5 @@
import { LegacyRandom, PerlinNoise } from 'deepslate/worldgen'
import { clampedLerp, lerp2 } from '../../Utils'
import { clampedLerp, lerp2 } from '../../Utils.js'
export class NoiseChunkGenerator {
private readonly minLimitPerlinNoise: PerlinNoise
+9 -9
View File
@@ -3,15 +3,15 @@ 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 config from '../../config.json'
import { Btn, Octicon } from '../components'
import { localize, useStore } from '../contexts'
import { useFocus } from '../hooks'
import { VanillaColors } from '../previews'
import type { BlockStateRegistry, VersionId } from '../services'
import { CachedCollections, CachedDecorator, CachedFeature, getTextureUrl } from '../services'
import { deepClone, deepEqual, generateUUID, hexId, hexToRgb, isObject, newSeed, rgbToHex, stringToColor } from '../Utils'
import { ModelWrapper } from './ModelWrapper'
import { Btn, Octicon } from '../components/index.js'
import config from '../Config.js'
import { localize, useStore } from '../contexts/index.js'
import { useFocus } from '../hooks/index.js'
import { VanillaColors } from '../previews/index.js'
import type { BlockStateRegistry, VersionId } from '../services/index.js'
import { CachedCollections, CachedDecorator, CachedFeature, getTextureUrl } from '../services/index.js'
import { deepClone, deepEqual, generateUUID, hexId, hexToRgb, isObject, newSeed, rgbToHex, stringToColor } from '../Utils.js'
import { ModelWrapper } from './ModelWrapper.js'
const selectRegistries = ['loot_table.type', 'loot_entry.type', 'function.function', 'condition.condition', 'criterion.trigger', 'recipe.type', 'dimension.generator.type', 'dimension.generator.biome_source.type', 'dimension.generator.biome_source.preset', 'carver.type', 'feature.type', 'decorator.type', 'feature.tree.minimum_size.type', 'block_state_provider.type', 'trunk_placer.type', 'foliage_placer.type', 'tree_decorator.type', 'int_provider.type', 'float_provider.type', 'height_provider.type', 'structure_feature.type', 'surface_builder.type', 'processor.processor_type', 'rule_test.predicate_type', 'pos_rule_test.predicate_type', 'template_element.element_type', 'block_placer.type', 'block_predicate.type', 'material_rule.type', 'material_condition.type', 'structure_placement.type', 'density_function.type', 'root_placer.type', 'entity.type_specific.cat.variant', 'entity.type_specific.frog.variant']
const hiddenFields = ['number_provider.type', 'score_provider.type', 'nbt_provider.type', 'int_provider.type', 'float_provider.type', 'height_provider.type']
+1 -1
View File
@@ -1,6 +1,6 @@
import type { DataModel, Hook } from '@mcschema/core'
import { ModelPath, relativePath } from '@mcschema/core'
import type { BlockStateRegistry } from '../services'
import type { BlockStateRegistry } from '../services/index.js'
export function getOutput(model: DataModel, blockStates: BlockStateRegistry): any {
return model.schema.hook(transformOutput, new ModelPath(model), model.data, { blockStates })
+1 -1
View File
@@ -1,4 +1,4 @@
import { isObject } from '../Utils'
import { isObject } from '../Utils.js'
const repo = 'https://raw.githubusercontent.com/misode/technical-changes/main'
+3 -3
View File
@@ -1,7 +1,7 @@
import type { CollectionRegistry } from '@mcschema/core'
import config from '../../config.json'
import { message } from '../Utils'
import type { BlockStateRegistry, VersionId } from './Schemas'
import config from '../Config.js'
import { message } from '../Utils.js'
import type { BlockStateRegistry, VersionId } from './Schemas.js'
const CACHE_NAME = 'misode-v2'
const CACHE_LATEST_VERSION = 'cached_latest_version'
+4 -4
View File
@@ -1,9 +1,9 @@
import type { CollectionRegistry, INode, SchemaRegistry } from '@mcschema/core'
import { ChoiceNode, DataModel, Reference, StringNode } from '@mcschema/core'
import config from '../../config.json'
import { initPartners } from '../partners'
import { message } from '../Utils'
import { fetchData } from './DataFetcher'
import config from '../Config.js'
import { initPartners } from '../partners/index.js'
import { message } from '../Utils.js'
import { fetchData } from './DataFetcher.js'
export const VersionIds = ['1.15', '1.16', '1.17', '1.18', '1.18.2', '1.19'] as const
export type VersionId = typeof VersionIds[number]
+1 -1
View File
@@ -1,5 +1,5 @@
import lz from 'lz-string'
import type { VersionId } from './Schemas'
import type { VersionId } from './Schemas.js'
const API_PREFIX = 'https://z15g7can.directus.app/items'
+1 -1
View File
@@ -1,5 +1,5 @@
import yaml from 'js-yaml'
import { Store } from '../Store'
import { Store } from '../Store.js'
const INDENTS: Record<string, number | string | undefined> = {
'2_spaces': 2,
+5 -5
View File
@@ -1,5 +1,5 @@
export * from './Changelogs'
export * from './DataFetcher'
export * from './Schemas'
export * from './Sharing'
export * from './Source'
export * from './Changelogs.js'
export * from './DataFetcher.js'
export * from './Schemas.js'
export * from './Sharing.js'
export * from './Source.js'