diff --git a/src/app/components/generator/McdocRenderer.tsx b/src/app/components/generator/McdocRenderer.tsx index 417afb9c..b3fff37e 100644 --- a/src/app/components/generator/McdocRenderer.tsx +++ b/src/app/components/generator/McdocRenderer.tsx @@ -8,10 +8,13 @@ import { TypeDefSymbolData } from '@spyglassmc/mcdoc/lib/binder/index.js' import type { McdocCheckerContext, SimplifiedEnum, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifiedStructType, SimplifyValueNode } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js' import { simplify } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js' import { getValues } from '@spyglassmc/mcdoc/lib/runtime/completer/index.js' +import { Identifier, ItemStack } from 'deepslate' import { useCallback, useMemo } from 'preact/hooks' +import config from '../../Config.js' import { useLocale } from '../../contexts/Locale.jsx' import { useFocus } from '../../hooks/useFocus.js' import { generateColor, hexId } from '../../Utils.js' +import { ItemDisplay } from '../ItemDisplay.jsx' import { Octicon } from '../Octicon.jsx' const SPECIAL_UNSET = '__unset__' @@ -119,6 +122,8 @@ function StringHead({ type, optional, node, makeEdit, ctx }: StringHeadProps) { const datalistId = `mcdoc_completions_${hexId()}` + const gen = idRegistry ? config.generators.find(gen => gen.id === idRegistry) : undefined + const color = type.attributes?.find(a => a.name === 'color')?.value const colorKind = color?.kind === 'literal' && color.value.kind === 'string' ? color.value.value : undefined @@ -128,6 +133,9 @@ function StringHead({ type, optional, node, makeEdit, ctx }: StringHeadProps) { }, [onChangeValue]) return <> + {(idRegistry === 'item' && value) && } {isSelect ? <> onChangeValue((e.target as HTMLInputElement).value)} list={completions.length > 0 ? datalistId : undefined} /> + onChangeValue((e.target as HTMLInputElement).value)} list={completions.length > 0 ? datalistId : undefined} /> + {value && gen && + {Octicon.link_external} + } } {colorKind === 'hex_rgb' && <> onChangeValue((e.target as HTMLInputElement).value)} /> diff --git a/src/styles/nodes.css b/src/styles/nodes.css index 03bd1fda..c7e61f86 100644 --- a/src/styles/nodes.css +++ b/src/styles/nodes.css @@ -422,6 +422,10 @@ button.move:disabled { width: 100px; } +.long-input { + width: 300px; +} + /* Color categories */ [data-category=predicate] > .node-header > label,