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

View File

@@ -1,4 +1,4 @@
import { Octicon } from '.'
import { Octicon } from './index.js'
type BtnProps = {
icon?: keyof typeof Octicon,

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,

View File

@@ -1,4 +1,4 @@
import { Octicon } from '.'
import { Octicon } from './index.js'
interface Props {
link?: string,

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,

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,

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,

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,

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,

View File

@@ -1,4 +1,4 @@
import { ChangelogTag } from './versions'
import { ChangelogTag } from './index.js'
interface Props {
title: string,

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',

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) {

View File

@@ -1,5 +1,5 @@
import type { ComponentChildren } from 'preact'
import { Icons } from './Icons'
import { Icons } from './Icons.js'
type ToolCardProps = {
title: string,

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 = '/'

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,

View File

@@ -1,4 +1,4 @@
import { hexId } from '../../Utils'
import { hexId } from '../../Utils.js'
interface Props {
label: string,

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,

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[],

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'

View File

@@ -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,

View File

@@ -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,

View File

@@ -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']

View File

@@ -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,

View File

@@ -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,

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,

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

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,

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'

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'

View File

@@ -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

View File

@@ -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()

View File

@@ -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()

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()

View File

@@ -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()

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,

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,

View File

@@ -1 +1 @@
export * from './SoundConfig'
export * from './SoundConfig.js'

View File

@@ -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,

View File

@@ -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'

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,

View File

@@ -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'

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,

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'

View File

@@ -1,4 +1,4 @@
import { Octicon } from '..'
import { Octicon } from '../index.js'
interface Props {
label: string,

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'