Add Iris Studio app

- Add the Electron studio (electron-vite, React, three)
- Ignore node_modules and build output under studio/
This commit is contained in:
piexel committed 2026-11-15 11:17:34 +01:00
1 parent 832070cd69
commit 564dcdcc72
252 files changed
+24496

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
import { existsSync, readdirSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
const NVIDIA_VENDOR_ID = '0x10de'
const DRM_FOLDER = '/sys/class/drm'
const RENDER_NODE_PREFIX = 'renderD'
// Where the Vulkan loader looks for drivers, NixOS's first.
const VULKAN_DRIVER_FOLDERS = ['/run/opengl-driver/share/vulkan/icd.d', '/usr/share/vulkan/icd.d', '/etc/vulkan/icd.d']
const NVIDIA_VULKAN_DRIVER_PREFIX = 'nvidia_icd'
const VULKAN_DRIVER_VARIABLES = ['VK_DRIVER_FILES', 'VK_ICD_FILENAMES']
/**
* Chromium on Wayland hands the desktop buffers made on the GPU it draws with, and a desktop that composites on the
* integrated GPU cannot show buffers of an NVIDIA GPU: the window stays empty. Through XWayland with Chromium drawing
* on Vulkan, NVIDIA's Vulkan driver copies each frame to the integrated GPU itself, as it does for games.
*/
export const DEDICATED_GPU_SWITCHES = ['--ozone-platform=x11', '--use-angle=vulkan', '--enable-features=Vulkan,VulkanFromANGLE,DefaultANGLEVulkan']
/** NVIDIA's Vulkan driver file on a Linux machine with an NVIDIA GPU; null where there is no such GPU or driver. */
export function dedicatedGpuDriver(): string | null {
if (process.platform !== 'linux' || !hasNvidiaGpu()) {
return null
}
for (const folder of VULKAN_DRIVER_FOLDERS) {
const driver = driverIn(folder)
if (driver !== null) {
return driver
}
}
return null
}
/** Shows Chromium only the given Vulkan driver, so it draws on that driver's GPU. */
export function showOnlyVulkanDriver(env: NodeJS.ProcessEnv, driver: string): void {
for (const variable of VULKAN_DRIVER_VARIABLES) {
env[variable] = driver
}
}
export function showEveryVulkanDriver(env: NodeJS.ProcessEnv): void {
for (const variable of VULKAN_DRIVER_VARIABLES) {
delete env[variable]
}
}
export function runsOnDedicatedGpu(argv: string[]): boolean {
return DEDICATED_GPU_SWITCHES.every((option) => argv.includes(option))
}
/** The arguments with the dedicated GPU's switches in place of any the studio was started with under the same names. */
export function withDedicatedGpuSwitches(argv: string[]): string[] {
const names = DEDICATED_GPU_SWITCHES.map(switchName)
return [...argv.filter((option) => !names.includes(switchName(option))), ...DEDICATED_GPU_SWITCHES]
}
export function withoutDedicatedGpuSwitches(argv: string[]): string[] {
return argv.filter((option) => !DEDICATED_GPU_SWITCHES.includes(option))
}
function switchName(option: string): string {
return option.split('=')[0]
}
function hasNvidiaGpu(): boolean {
try {
return readdirSync(DRM_FOLDER)
.filter((name) => name.startsWith(RENDER_NODE_PREFIX))
.some((name) => readFileSync(join(DRM_FOLDER, name, 'device', 'vendor'), 'utf8').trim() === NVIDIA_VENDOR_ID)
} catch {
return false
}
}
function driverIn(folder: string): string | null {
if (!existsSync(folder)) {
return null
}
const file = readdirSync(folder).find((name) => name.startsWith(NVIDIA_VULKAN_DRIVER_PREFIX))
return file === undefined ? null : join(folder, file)
}
+198
View File
@@ -0,0 +1,198 @@
import { app, BrowserWindow, clipboard, ipcMain, nativeTheme, shell } from 'electron'
import { readFileSync } from 'node:fs'
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
import { homedir } from 'node:os'
import { dirname, join } from 'node:path'
import type { BridgeConnection, GraphicsInfo, StoredShortcuts, ThemeChoice } from '../shared/bridge'
import {
dedicatedGpuDriver,
runsOnDedicatedGpu,
showEveryVulkanDriver,
showOnlyVulkanDriver,
withDedicatedGpuSwitches,
withoutDedicatedGpuSwitches
} from './dedicatedGpu'
const CONNECTION_FOLDER = join(homedir(), '.iris', 'studio', 'bridges')
const SETTINGS_FILE = 'studio.json'
const SHORTCUTS_KEY = 'shortcuts'
const DEDICATED_GPU_KEY = 'dedicatedGpu'
const SETTINGS_INDENT = 2
const LINK_PREFIX = 'iris-studio://'
const DARK_BACKGROUND = '#1e1f22'
const WINDOW_SIZE = { width: 1440, height: 880, minWidth: 820, minHeight: 520 }
let window: BrowserWindow | null = null
let pendingLink: string | null = findLink(process.argv)
const dedicatedGpu = dedicatedGpuDriver()
function findLink(argv: string[]): string | null {
return argv.find((argument) => argument.startsWith(LINK_PREFIX)) ?? null
}
function isRunning(pid: unknown): boolean {
if (typeof pid !== 'number') {
return true
}
try {
process.kill(pid, 0)
return true
} catch (error) {
return (error as NodeJS.ErrnoException).code === 'EPERM'
}
}
/** The bridges announced on this machine whose server still runs, newest first. */
async function listBridges(): Promise<BridgeConnection[]> {
let files: string[]
try {
files = (await readdir(CONNECTION_FOLDER)).filter((name) => name.endsWith('.json'))
} catch {
return []
}
const bridges = await Promise.all(files.map(readConnection))
return bridges
.filter((bridge): bridge is BridgeConnection => bridge !== null)
.sort((first, second) => (second.startedMillis ?? 0) - (first.startedMillis ?? 0))
}
async function readConnection(name: string): Promise<BridgeConnection | null> {
try {
const file = JSON.parse(await readFile(join(CONNECTION_FOLDER, name), 'utf8'))
if (!isRunning(file.pid) || typeof file.port !== 'number' || typeof file.token !== 'string') {
return null
}
return { world: String(file.world ?? ''), port: file.port, token: file.token, startedMillis: file.startedMillis }
} catch {
return null
}
}
function settingsPath(): string {
return join(app.getPath('userData'), SETTINGS_FILE)
}
async function readSettings(): Promise<Record<string, unknown>> {
try {
const settings: unknown = JSON.parse(await readFile(settingsPath(), 'utf8'))
return typeof settings === 'object' && settings !== null && !Array.isArray(settings) ? (settings as Record<string, unknown>) : {}
} catch {
return {}
}
}
async function saveSetting(key: string, value: unknown): Promise<void> {
try {
const settings = { ...(await readSettings()), [key]: value }
await mkdir(dirname(settingsPath()), { recursive: true })
await writeFile(settingsPath(), JSON.stringify(settings, null, SETTINGS_INDENT))
} catch (failure) {
console.error(`Could not save the studio setting ${key} to ${settingsPath()}`, failure)
}
}
/** Read before the app is ready, as the GPU the studio draws on is chosen by how it was started. */
function choosesDedicatedGpu(): boolean {
try {
const settings: unknown = JSON.parse(readFileSync(settingsPath(), 'utf8'))
return typeof settings === 'object' && settings !== null && (settings as Record<string, unknown>)[DEDICATED_GPU_KEY] === true
} catch {
return false
}
}
function restartOnGpu(dedicated: boolean): void {
const args = process.argv.slice(1)
if (dedicated && dedicatedGpu !== null) {
showOnlyVulkanDriver(process.env, dedicatedGpu)
app.relaunch({ args: withDedicatedGpuSwitches(args) })
} else {
showEveryVulkanDriver(process.env)
app.relaunch({ args: withoutDedicatedGpuSwitches(args) })
}
app.exit(0)
}
async function useDedicatedGpu(dedicated: boolean): Promise<void> {
await saveSetting(DEDICATED_GPU_KEY, dedicated)
restartOnGpu(dedicated)
}
function graphicsInfo(): GraphicsInfo {
return { canUseDedicatedGpu: dedicatedGpu !== null, usesDedicatedGpu: runsOnDedicatedGpu(process.argv) }
}
function createWindow(): void {
window = new BrowserWindow({
...WINDOW_SIZE,
title: 'Iris Studio',
backgroundColor: DARK_BACKGROUND,
autoHideMenuBar: true,
show: false,
webPreferences: {
preload: join(import.meta.dirname, '../preload/index.cjs'),
sandbox: true,
contextIsolation: true
}
})
window.once('ready-to-show', () => window?.show())
window.webContents.setWindowOpenHandler(({ url }) => {
void shell.openExternal(url)
return { action: 'deny' }
})
if (process.env.ELECTRON_RENDERER_URL) {
void window.loadURL(process.env.ELECTRON_RENDERER_URL)
} else {
void window.loadFile(join(import.meta.dirname, '../renderer/index.html'))
}
}
function deliverLink(link: string): void {
if (window === null) {
pendingLink = link
return
}
window.webContents.send('studio:link', link)
if (window.isMinimized()) {
window.restore()
}
window.focus()
}
if (dedicatedGpu !== null && choosesDedicatedGpu() && !runsOnDedicatedGpu(process.argv)) {
restartOnGpu(true)
} else if (!app.requestSingleInstanceLock()) {
app.quit()
} else {
app.setAsDefaultProtocolClient('iris-studio')
app.on('second-instance', (_event, argv) => {
const link = findLink(argv)
if (link !== null) {
deliverLink(link)
} else {
window?.focus()
}
})
app.on('open-url', (event, url) => {
event.preventDefault()
deliverLink(url)
})
ipcMain.handle('studio:list-bridges', listBridges)
ipcMain.handle('studio:initial-link', () => {
const link = pendingLink
pendingLink = null
return link
})
ipcMain.on('studio:set-theme', (_event, theme: ThemeChoice) => {
nativeTheme.themeSource = theme
})
ipcMain.handle('studio:load-shortcuts', async () => (await readSettings())[SHORTCUTS_KEY] ?? {})
ipcMain.on('studio:save-shortcuts', (_event, shortcuts: StoredShortcuts) => void saveSetting(SHORTCUTS_KEY, shortcuts))
ipcMain.handle('studio:graphics', graphicsInfo)
ipcMain.on('studio:use-dedicated-gpu', (_event, dedicated: boolean) => void useDedicatedGpu(dedicated))
ipcMain.on('studio:copy-text', (_event, text: string) => clipboard.writeText(text))
void app.whenReady().then(createWindow)
app.on('window-all-closed', () => app.quit())
}
+20
View File
@@ -0,0 +1,20 @@
import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'
import type { StoredShortcuts, StudioHost, ThemeChoice } from '../shared/bridge'
const host: StudioHost = {
listBridges: () => ipcRenderer.invoke('studio:list-bridges'),
initialLink: () => ipcRenderer.invoke('studio:initial-link'),
onLink: (listener) => {
const forward = (_event: IpcRendererEvent, link: string): void => listener(link)
ipcRenderer.on('studio:link', forward)
return () => ipcRenderer.removeListener('studio:link', forward)
},
setTheme: (theme: ThemeChoice) => ipcRenderer.send('studio:set-theme', theme),
copyText: (text: string) => ipcRenderer.send('studio:copy-text', text),
loadShortcuts: () => ipcRenderer.invoke('studio:load-shortcuts'),
saveShortcuts: (shortcuts: StoredShortcuts) => ipcRenderer.send('studio:save-shortcuts', shortcuts),
graphics: () => ipcRenderer.invoke('studio:graphics'),
useDedicatedGpu: (dedicated: boolean) => ipcRenderer.send('studio:use-dedicated-gpu', dedicated)
}
contextBridge.exposeInMainWorld('studio', host)
+15
View File
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; connect-src 'self' http://127.0.0.1:* ws://localhost:*; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'"
/>
<title>Iris Studio</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+68
View File
@@ -0,0 +1,68 @@
import { useCallback, useEffect, useState } from 'react'
import { parseStudioLink, type BridgeConnection } from '../../shared/bridge'
import { BridgeClient } from './bridge/BridgeClient'
import type { WorldInfo } from './bridge/types'
import { ConnectScreen } from './studio/ConnectScreen'
import { MapStudio } from './studio/MapStudio'
import { useTheme } from './studio/theme'
import { shortcutStore } from './studio/useBindings'
interface Session {
client: BridgeClient
world: WorldInfo
}
/** The studio: a connect screen until a bridge answers, then the map of its world. */
export function App(): React.JSX.Element {
const theme = useTheme()
const [session, setSession] = useState<Session | null>(null)
const [error, setError] = useState<string | null>(null)
const [connecting, setConnecting] = useState(false)
const connect = useCallback(async (connection: BridgeConnection) => {
setConnecting(true)
setError(null)
const client = new BridgeClient(connection)
try {
setSession({ client, world: await client.world() })
} catch (failure) {
setError(failure instanceof Error ? failure.message : String(failure))
} finally {
setConnecting(false)
}
}, [])
const connectLink = useCallback(
(link: string) => {
const connection = parseStudioLink(link)
if (connection === null) {
setError('That is not a studio link')
return
}
void connect(connection)
},
[connect]
)
useEffect(() => {
void shortcutStore.load()
}, [])
useEffect(() => {
void window.studio.initialLink().then((link) => link !== null && connectLink(link))
return window.studio.onLink(connectLink)
}, [connectLink])
if (session === null) {
return <ConnectScreen connecting={connecting} error={error} onConnect={connect} onLink={connectLink} />
}
return (
<MapStudio
key={`${session.client.connection.port}`}
client={session.client}
world={session.world}
theme={theme}
onDisconnect={() => setSession(null)}
/>
)
}
@@ -0,0 +1,391 @@
import type { BridgeConnection } from '../../../shared/bridge'
import { decodeScene, type BlockScene } from '../scene/sceneDecoding'
import { decodePattern } from './patternDecoding'
import { decodeSavedTile } from './savedTileDecoding'
import { decodeTile } from './tileDecoding'
import type {
BakeRun,
BlockSource,
EditorState,
GraphEdit,
MapHover,
MapLabel,
MapTile,
Marker,
ModuleViewInfo,
NoiseSource,
NoiseTile,
PatternEntry,
PatternTile,
PickInspection,
SavedStart,
SavedTile,
SavedWorldInfo,
SceneEntry,
SceneViewInfo,
ServerUsage,
WorldInfo
} from './types'
export const STATUS_NOT_FOUND = 404
export const STATUS_CONFLICT = 409
export const STATUS_UNAVAILABLE = 503
export class BridgeError extends Error {
constructor(
readonly status: number,
message: string
) {
super(message)
}
}
/** Which scene of a scene view: an entry's variant, at one of the view's sizes or null when it has none. */
export interface ScenePlace {
key: string
variant: number
size: number | null
}
export interface TileRequest {
view: string
/** The region the region view previews everywhere, or null for the world as it is. */
preview: string | null
tileX: number
tileZ: number
blocksPerPixel: number
size: number
heights: boolean
pickNoise: boolean
/** Where the tile's blocks come from, or null for a tile without them. */
blocks: BlockSource | null
/**
* Whether a tile with blocks also carries the ground's shape in 3D: every block seen from the open air at a block a
* pixel, the runs of solid blocks of each cell's area when coarser.
*/
shape?: boolean
}
/** One tile of a pattern: tile (x, z) covers columns × blocksPerColumn blocks from x × that, z × that. */
export interface PatternRequest {
viewId: string
key: string
depth: number
tileX: number
tileZ: number
blocksPerColumn: number
columns: number
}
/** What a map spot or area is asked about: a view, and the region it previews. */
export interface MapLayerQuery {
view: string
preview: string | null
}
export interface WorldRect {
minX: number
minZ: number
maxX: number
maxZ: number
}
export interface BridgeEvents {
onWorld(running: boolean): void
onPlayers(players: Marker[]): void
onUsage(usage: ServerUsage): void
onClosed(): void
}
const EVENT_SEPARATOR = '\n\n'
/** One connection to a world's bridge, over HTTP on the loopback interface. */
export class BridgeClient {
private readonly base: string
private readonly authorization: string
constructor(readonly connection: BridgeConnection) {
this.base = `http://127.0.0.1:${connection.port}/v1/`
this.authorization = `Bearer ${connection.token}`
}
world(): Promise<WorldInfo> {
return this.json('world')
}
hover(layer: MapLayerQuery, worldX: number, worldZ: number, signal?: AbortSignal): Promise<MapHover> {
return this.json(`hover?${layerQuery(layer, { x: String(worldX), z: String(worldZ) })}`, { signal })
}
/** How the noise picks what the layer shows across {@code area}. */
picks(layer: MapLayerQuery, area: WorldRect, signal?: AbortSignal): Promise<PickInspection> {
const corners = { minX: String(area.minX), minZ: String(area.minZ), maxX: String(area.maxX), maxZ: String(area.maxZ) }
return this.json(`picks?${layerQuery(layer, corners)}`, { signal })
}
/** The regions the world picks biomes for, which the region view can preview. */
regions(): Promise<MapLabel[]> {
return this.json('regions')
}
entities(): Promise<Marker[]> {
return this.json('entities')
}
async teleport(worldX: number, worldZ: number): Promise<void> {
await this.json(`teleport?x=${worldX}&z=${worldZ}`, { method: 'POST' })
}
/** Opens the file of the biome or region at a spot on the server's machine; the server's answer, if any. */
async openInEditor(worldX: number, worldZ: number, view: string): Promise<string | null> {
const answer = await this.json<{ message: string | null }>(`open?x=${worldX}&z=${worldZ}&view=${view}`, { method: 'POST' })
return answer.message
}
async tile(request: TileRequest, signal: AbortSignal): Promise<MapTile> {
const query = layerQuery(request, {
x: String(request.tileX),
z: String(request.tileZ),
scale: String(request.blocksPerPixel),
size: String(request.size),
heights: request.heights ? '1' : '0',
noise: request.pickNoise ? '1' : '0'
})
if (request.blocks !== null) {
query.set('blocks', request.blocks)
if (request.shape === true) {
query.set('shape', '1')
}
this.cancelOnAbort(query, signal)
}
const response = await this.fetch(`tile?${query}`, { signal })
return decodeTile(await response.arrayBuffer())
}
// A tile with blocks can keep the server generating chunks for a minute; dropping the request alone would not stop it.
private cancelOnAbort(query: URLSearchParams, signal: AbortSignal): void {
const request = crypto.randomUUID()
query.set('request', request)
signal.addEventListener('abort', () => void this.fetch(`tile-cancel?${new URLSearchParams({ request })}`, { method: 'POST' }).catch(() => {}), { once: true })
}
/** The scene views the pack's modules show, such as its objects. */
sceneViews(): Promise<SceneViewInfo[]> {
return this.json('scenes')
}
/** An editable entry's file, as nodes. */
sceneFile(viewId: string, key: string, signal?: AbortSignal): Promise<EditorState> {
return this.json(`scene-file?${new URLSearchParams({ view: viewId, key })}`, { signal })
}
/** Makes {@code edit} on the file as it was at {@code revision} and saves it; refused with STATUS_CONFLICT when it changed since. */
sceneEdit(viewId: string, key: string, revision: string, edit: GraphEdit): Promise<EditorState> {
return this.json(`scene-edit?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST', body: JSON.stringify({ revision, edit }) })
}
/** Replaces the whole file, as undoing does; refused with STATUS_CONFLICT when it changed since {@code revision}. */
sceneWrite(viewId: string, key: string, revision: string, text: string): Promise<EditorState> {
return this.json(`scene-write?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST', body: JSON.stringify({ revision, text }) })
}
/** Writes a new entry from its view's starter; it is listed once the pack has reloaded. Refused when the key can't name a new one. */
async sceneCreate(viewId: string, key: string): Promise<void> {
await this.json(`scene-create?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST' })
}
/** The pack files that still name the entry, such as the biomes that place it. */
async sceneUses(viewId: string, key: string): Promise<string[]> {
const uses = await this.json<{ files: string[] }>(`scene-uses?${new URLSearchParams({ view: viewId, key })}`)
return uses.files
}
/** Moves the entry's file to the trash; says where it went. */
async sceneDelete(viewId: string, key: string): Promise<string> {
const trashed = await this.json<{ to: string }>(`scene-delete?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST' })
return trashed.to
}
/** What a setting naming an entry of a platform registry (reference) or a resource of the pack (resource) may be typed as, sorted. */
suggestions(of: { reference: string } | { resource: string }): Promise<string[]> {
return this.json(`suggestions?${new URLSearchParams(of)}`)
}
sceneEntries(viewId: string): Promise<SceneEntry[]> {
return this.json(`scene-entries?${new URLSearchParams({ view: viewId })}`)
}
/** Bakes the entry once more and times each step; one run of the median the studio shows. */
sceneBake(viewId: string, key: string, signal?: AbortSignal): Promise<BakeRun> {
return this.json(`scene-bake?${new URLSearchParams({ view: viewId, key })}`, { signal })
}
async scene(viewId: string, place: ScenePlace, signal?: AbortSignal): Promise<BlockScene> {
const response = await this.fetch(`scene?${sceneQuery(viewId, place)}`, { signal })
return decodeScene(await response.arrayBuffer())
}
/** The part that placed each block of {@link scene}, in the same order, or NO_PART; baked again on the server to find out. */
async sceneParts(viewId: string, place: ScenePlace, signal?: AbortSignal): Promise<Int32Array> {
const response = await this.fetch(`scene-parts?${sceneQuery(viewId, place)}`, { signal })
return new Int32Array(await response.arrayBuffer())
}
/**
* The caves of the world's generated chunks over a square {@code size} blocks across around a spot: every air block
* under the terrain, drawn as blocks coloured by height. Every chunk of the square is generated, which takes seconds.
*/
async caves(centerX: number, centerZ: number, size: number, signal: AbortSignal): Promise<BlockScene> {
const query = new URLSearchParams({ x: String(Math.round(centerX)), z: String(Math.round(centerZ)), size: String(size) })
this.cancelOnAbort(query, signal)
const response = await this.fetch(`caves?${query}`, { signal })
return decodeScene(await response.arrayBuffer())
}
/** The pattern views the pack's modules show, such as its palettes. */
patternViews(): Promise<ModuleViewInfo[]> {
return this.json('patterns')
}
patternEntries(viewId: string): Promise<PatternEntry[]> {
return this.json(`pattern-entries?${new URLSearchParams({ view: viewId })}`)
}
/** What an entry places at {@code depth} below the top across one tile, a column every {@code blocksPerColumn} blocks. */
async pattern(request: PatternRequest, signal: AbortSignal): Promise<PatternTile> {
const query = new URLSearchParams({
view: request.viewId,
key: request.key,
depth: String(request.depth),
x: String(request.tileX),
z: String(request.tileZ),
scale: String(request.blocksPerColumn),
size: String(request.columns)
})
const response = await this.fetch(`pattern?${query}`, { signal })
return decodePattern(await response.arrayBuffer())
}
/** The worlds saved on the server's disk. */
savedWorlds(): Promise<SavedWorldInfo[]> {
return this.json('saved-worlds')
}
/** Where a saved world's view opens; reads the region nearest the origin whole, so it can take a second or two. */
savedStart(worldId: string, signal?: AbortSignal): Promise<SavedStart> {
return this.json(`saved-start?${new URLSearchParams({ world: worldId })}`, { signal })
}
async savedTile(worldId: string, tileX: number, tileZ: number, blocksPerPixel: number, size: number, signal: AbortSignal): Promise<SavedTile> {
const query = new URLSearchParams({ world: worldId, x: String(tileX), z: String(tileZ), scale: String(blocksPerPixel), size: String(size) })
const response = await this.fetch(`saved-tile?${query}`, { signal })
return decodeSavedTile(await response.arrayBuffer())
}
/** The pack's generators and expressions, the dimension's overlay noise, and the built-in noise styles. */
noiseSources(): Promise<NoiseSource[]> {
return this.json('noise-sources')
}
async noiseTile(sourceId: string, seed: string, tileX: number, tileZ: number, blocksPerPixel: number, size: number, signal: AbortSignal): Promise<NoiseTile> {
const query = new URLSearchParams({ source: sourceId, seed, x: String(tileX), z: String(tileZ), scale: String(blocksPerPixel), size: String(size) })
const response = await this.fetch(`noise-tile?${query}`, { signal })
return { size, values: new Float32Array(await response.arrayBuffer()) }
}
/** A file of the Minecraft client's assets, such as {@code minecraft/blockstates/stone.json}; null when there is none. */
async asset(path: string): Promise<Response | null> {
try {
return await this.fetch(`assets/${path}`, {})
} catch (error) {
if (error instanceof BridgeError && error.status === STATUS_NOT_FOUND) {
return null
}
throw error
}
}
/** Streams the bridge's events until {@code signal} aborts or the bridge goes away. */
async listen(events: BridgeEvents, signal: AbortSignal): Promise<void> {
try {
const response = await this.fetch('events', { signal })
const reader = response.body!.pipeThrough(new TextDecoderStream()).getReader()
let pending = ''
for (;;) {
const { value, done } = await reader.read()
if (done) {
break
}
pending += value
let end: number
while ((end = pending.indexOf(EVENT_SEPARATOR)) >= 0) {
dispatch(pending.slice(0, end), events)
pending = pending.slice(end + EVENT_SEPARATOR.length)
}
}
} catch (error) {
if (signal.aborted) {
return
}
console.warn('Studio events stopped', error)
}
if (!signal.aborted) {
events.onClosed()
}
}
private async json<T>(endpoint: string, init: RequestInit = {}): Promise<T> {
const response = await this.fetch(endpoint, init)
return (await response.json()) as T
}
private async fetch(endpoint: string, init: RequestInit): Promise<Response> {
const response = await fetch(this.base + endpoint, {
...init,
headers: { Authorization: this.authorization }
})
if (!response.ok) {
const body = await response.json().catch(() => ({ error: response.statusText }))
throw new BridgeError(response.status, String(body.error ?? response.statusText))
}
return response
}
}
function sceneQuery(viewId: string, place: ScenePlace): URLSearchParams {
const query = new URLSearchParams({ view: viewId, key: place.key, variant: String(place.variant) })
if (place.size !== null) {
query.set('size', String(place.size))
}
return query
}
function layerQuery(layer: MapLayerQuery, rest: Record<string, string>): URLSearchParams {
const query = new URLSearchParams({ view: layer.view, ...rest })
if (layer.preview !== null) {
query.set('preview', layer.preview)
}
return query
}
function dispatch(block: string, events: BridgeEvents): void {
let name = 'message'
let data = ''
for (const line of block.split('\n')) {
if (line.startsWith('event: ')) {
name = line.slice('event: '.length)
} else if (line.startsWith('data: ')) {
data += line.slice('data: '.length)
}
}
if (data === '') {
return
}
if (name === 'world') {
events.onWorld((JSON.parse(data) as { running: boolean }).running)
} else if (name === 'players') {
events.onPlayers(JSON.parse(data) as Marker[])
} else if (name === 'usage') {
events.onUsage(JSON.parse(data) as ServerUsage)
}
}
@@ -0,0 +1,32 @@
import { describe, expect, it } from 'vitest'
import { decodePattern } from './patternDecoding'
import { NO_PATTERN_BLOCK } from './types'
function encodedPattern(header: object, picks: number[]): ArrayBuffer {
const headerBytes = new TextEncoder().encode(JSON.stringify(header))
const picksAt = Math.ceil((4 + headerBytes.length) / 4) * 4
const buffer = new ArrayBuffer(picksAt + picks.length * 2)
const view = new DataView(buffer)
view.setUint32(0, headerBytes.length, true)
new Uint8Array(buffer, 4).set(headerBytes)
picks.forEach((pick, index) => view.setInt16(picksAt + index * 2, pick, true))
return buffer
}
describe('decodePattern', () => {
it('reads the picks after the padded header, row by row, with no block as -1', () => {
const header = {
columns: 2,
blocksPerColumn: 4,
blocks: ['minecraft:grass_block[snowy=false]', 'etopia:grass_block'],
drawnAs: ['minecraft:grass_block[snowy=false]', 'minecraft:note_block[note=7]'],
noBlock: -1
}
const pattern = decodePattern(encodedPattern(header, [0, -1, 1, 0]))
expect(pattern.columns).toBe(2)
expect(pattern.blocksPerColumn).toBe(4)
expect(pattern.blocks).toEqual(header.blocks)
expect(pattern.drawnAs).toEqual(header.drawnAs)
expect([...pattern.picks]).toEqual([0, NO_PATTERN_BLOCK, 1, 0])
})
})
@@ -0,0 +1,27 @@
import type { PatternTile } from './types'
const ALIGNMENT_BYTES = 4
interface PatternHeader {
columns: number
blocksPerColumn: number
blocks: string[]
drawnAs: string[]
}
/**
* Reads a pattern as the bridge writes it (PatternEncoding): a u32 header length, the JSON header, then from the next
* multiple of 4 bytes an i16 pick per column, row by row. The picks are a view into the buffer, not a copy.
*/
export function decodePattern(buffer: ArrayBuffer): PatternTile {
const headerLength = new DataView(buffer).getUint32(0, true)
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as PatternHeader
const picksAt = Math.ceil((4 + headerLength) / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
return {
columns: header.columns,
blocksPerColumn: header.blocksPerColumn,
blocks: header.blocks,
drawnAs: header.drawnAs,
picks: new Int16Array(buffer, picksAt, header.columns * header.columns)
}
}
@@ -0,0 +1,41 @@
import type { MapLabel, SavedTile } from './types'
const ALIGNMENT_BYTES = 4
interface SavedTileHeader {
size: number
blocksPerPixel: number
blocks: { name: string; drawnAs: string }[]
biomes: MapLabel[]
noGround: number
noWater: number
}
function aligned(bytes: number): number {
return Math.ceil(bytes / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
}
/**
* Reads a saved tile as the bridge writes it (SavedTileEncoding): a u32 header length, the JSON header, then the ground,
* water, block and biome grids, each starting on a multiple of 4 bytes. The grids are views into the buffer.
*/
export function decodeSavedTile(buffer: ArrayBuffer): SavedTile {
const headerLength = new DataView(buffer).getUint32(0, true)
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as SavedTileHeader
const pixels = header.size * header.size
const gridBytes = aligned(pixels * Int16Array.BYTES_PER_ELEMENT)
const gridAt = (index: number): Int16Array => new Int16Array(buffer, aligned(4 + headerLength) + index * gridBytes, pixels)
return {
size: header.size,
blocksPerPixel: header.blocksPerPixel,
groundY: gridAt(0),
waterSurfaceY: gridAt(1),
blocks: gridAt(2),
biomes: gridAt(3),
blockNames: header.blocks.map((block) => block.name),
blocksDrawnAs: header.blocks.map((block) => block.drawnAs),
biomeLabels: header.biomes,
noGround: header.noGround,
noWater: header.noWater
}
}
@@ -0,0 +1,145 @@
import type { LabelKind, MapLabel, MapTile, TileBlocks, TileRuns, TileVoxels } from './types'
const ALIGNMENT_BYTES = 4
interface TileHeader {
size: number
blocksPerPixel: number
subjectKind: LabelKind
labels: MapLabel[]
heights: boolean
pickNoise: boolean
/** The blocks the ground and cover grids index; absent or null on a tile without them. */
blocks?: string[] | null
/** How many blocks are raised over the ground of all cells together. */
raised?: number
/** How many blocks can be seen from the open air, or -1 on a tile without them. */
voxels?: number
/** How many runs of solid blocks the cells have together, or -1 on a tile without them. */
runs?: number
}
const NONE = -1
function aligned(bytes: number): number {
return Math.ceil(bytes / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
}
/**
* Reads a tile as the bridge writes it (MapTileEncoding): a u32 header length, the JSON header, then the subject,
* region, height, pick noise, ground, cover and raised block grids, each starting on a multiple of 4 bytes. The grids
* are views into the buffer, not copies.
*/
export function decodeTile(buffer: ArrayBuffer): MapTile {
const view = new DataView(buffer)
const headerLength = view.getUint32(0, true)
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as TileHeader
const gridSize = header.size + 2
const cells = gridSize * gridSize
const subjectsAt = aligned(4 + headerLength)
const regionsAt = aligned(subjectsAt + cells * Int16Array.BYTES_PER_ELEMENT)
const heightsAt = aligned(regionsAt + cells * Int16Array.BYTES_PER_ELEMENT)
const pickNoiseAt = heightsAt + (header.heights ? cells * Float32Array.BYTES_PER_ELEMENT : 0)
const groundAt = pickNoiseAt + (header.pickNoise ? cells * Float32Array.BYTES_PER_ELEMENT : 0)
return {
size: header.size,
blocksPerPixel: header.blocksPerPixel,
subjectKind: header.subjectKind,
labels: header.labels,
subjects: new Int16Array(buffer, subjectsAt, cells),
regions: new Int16Array(buffer, regionsAt, cells),
heights: header.heights ? new Float32Array(buffer, heightsAt, cells) : null,
pickNoise: header.pickNoise ? new Float32Array(buffer, pickNoiseAt, cells) : null,
blocks: header.blocks == null ? null : decodeBlocks(buffer, groundAt, cells, header.blocks, header.raised ?? 0, header.voxels ?? NONE, header.runs ?? NONE)
}
}
function decodeBlocks(buffer: ArrayBuffer, groundAt: number, cells: number, names: string[], raisedCount: number, voxelCount: number, runCount: number): TileBlocks {
const gridBytes = aligned(cells * Int16Array.BYTES_PER_ELEMENT)
const coverAt = groundAt + gridBytes
const raisedCountsAt = coverAt + gridBytes
const raisedYAt = raisedCountsAt + gridBytes
const raisedAt = aligned(raisedYAt + raisedCount * Int16Array.BYTES_PER_ELEMENT)
const voxelsAt = aligned(raisedAt + raisedCount * Int16Array.BYTES_PER_ELEMENT)
const runsAt = voxelsAt + (voxelCount === NONE ? 0 : voxelBytes(voxelCount))
return {
names,
ground: new Int16Array(buffer, groundAt, cells),
cover: new Int16Array(buffer, coverAt, cells),
raisedStart: startsOf(new Int16Array(buffer, raisedCountsAt, cells)),
raisedY: new Int16Array(buffer, raisedYAt, raisedCount),
raised: new Int16Array(buffer, raisedAt, raisedCount),
voxels: voxelCount === NONE ? null : decodeVoxels(buffer, voxelsAt, voxelCount),
runs: runCount === NONE ? null : decodeRuns(buffer, runsAt, cells, runCount),
colors: [],
looks: [],
covers: [],
models: []
}
}
function voxelBytes(count: number): number {
return aligned(count) * 3 + aligned(count * Int16Array.BYTES_PER_ELEMENT) * 2
}
function decodeRuns(buffer: ArrayBuffer, countsAt: number, cells: number, count: number): TileRuns {
const bottomsAt = countsAt + aligned(cells * Int16Array.BYTES_PER_ELEMENT)
const topsAt = bottomsAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const blocksAt = topsAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const coversAt = blocksAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const coverSharesAt = coversAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const lightsAt = coverSharesAt + aligned(count)
const occlusionsAt = lightsAt + aligned(count)
return {
starts: startsOf(new Int16Array(buffer, countsAt, cells)),
bottoms: new Int16Array(buffer, bottomsAt, count),
tops: new Int16Array(buffer, topsAt, count),
blocks: new Int16Array(buffer, blocksAt, count),
covers: new Int16Array(buffer, coversAt, count),
coverShares: new Uint8Array(buffer, coverSharesAt, count),
lights: new Uint8Array(buffer, lightsAt, count),
occlusions: new Uint8Array(buffer, occlusionsAt, count)
}
}
function decodeVoxels(buffer: ArrayBuffer, xAt: number, count: number): TileVoxels {
const zAt = xAt + aligned(count)
const yAt = zAt + aligned(count)
const blocksAt = yAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const facesAt = blocksAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
const lightsAt = facesAt + aligned(count)
const shadesAt = lightsAt + aligned(count)
const faces = new Uint8Array(buffer, facesAt, count)
return {
x: new Uint8Array(buffer, xAt, count),
z: new Uint8Array(buffer, zAt, count),
y: new Int16Array(buffer, yAt, count),
blocks: new Int16Array(buffer, blocksAt, count),
faces,
lights: new Uint8Array(buffer, lightsAt, count),
shades: new Uint16Array(buffer, shadesAt, facesShown(faces))
}
}
function facesShown(faces: Uint8Array): number {
let shown = 0
for (const sides of faces) {
for (let rest = sides; rest !== 0; rest &= rest - 1) {
shown++
}
}
return shown
}
function startsOf(counts: Int16Array): Int32Array {
const starts = new Int32Array(counts.length + 1)
for (let cell = 0; cell < counts.length; cell++) {
starts[cell + 1] = starts[cell] + counts[cell]
}
return starts
}
/** The grid index of a pixel; pixel coordinates run from -1 to size, the ring being the neighbours'. */
export function gridIndex(tile: MapTile, pixelX: number, pixelZ: number): number {
return (pixelZ + 1) * (tile.size + 2) + pixelX + 1
}
+436
View File
@@ -0,0 +1,436 @@
/** The shapes the Iris bridge answers with (Iris core, art.arcane.iris.core.studio). */
import type { BlockLook } from '../scene/blockLooks'
import type { CoverLook } from '../scene/coverLooks'
export type LabelKind = 'BIOME' | 'REGION'
export interface MapLabel {
kind: LabelKind
key: string
name: string
/** 0xRRGGBB */
color: number
}
export interface ViewInfo {
id: string
label: string
description: string
group: string
groupLabel: string
}
/** A studio view a module of the pack shows (IrisApi StudioView): block scenes such as its objects, or patterns such as its palettes. */
export interface ModuleViewInfo {
id: string
label: string
description: string
}
export interface SceneEntry {
key: string
name: string
/** The folder it is listed under; empty for none. */
group: string
variants: number
}
/** A scene view as the server lists it; `editable` when its entries can be edited as nodes, `creatable` when they can also be created and deleted, `baked` when their bake can be timed, `parts` when a block can be traced to the part that placed it. */
export interface SceneViewInfo extends ModuleViewInfo {
editable: boolean
creatable: boolean
baked: boolean
parts: boolean
/** The sizes the scenes can be built at, or null when each entry has its own. */
sizes: SceneSizes | null
}
/** The sizes a scene view builds its scenes at, as blocks across, smallest first, and the one shown first (IrisApi SceneSizes). */
export interface SceneSizes {
blocksAcross: number[]
opening: number
}
/** One timed bake of a scene entry (IrisApi BakeRun): a time per step, added up over every variant. */
export interface BakeRun {
variantCount: number
stages: { label: string; nanos: number }[]
}
/** Where a value sits in a JSON file: member names and element indices from the root. */
export type JsonPath = (string | number)[]
/** An entry's file as the node editor shows it (StudioEditors.EditorState). */
export interface EditorState {
/** Where it is below the pack folder. */
file: string
/** Tells this text from any other; an edit sent with an older one is refused. */
revision: string
text: string
/** The file as nodes, or null when it can't be read as nodes and `problem` says why. */
roots: GraphNode[] | null
problem: string | null
/** Why the file can't be edited here, such as outside a studio world; null when it can. */
locked: string | null
types: Record<string, SettingsType>
}
export interface GraphNode {
kind: string
title: string
path: JsonPath
/** The scene part it draws, or NO_PART. */
partId: number
roles: string[]
settings: NodeSettings[]
children: { wire: string; node: GraphNode }[]
/** The array a node moved under this one joins; null when nothing can move here. */
childList: JsonPath | null
movable: boolean
duplicable: boolean
additions: { label: string; list: JsonPath; literal: string }[]
}
export const NO_PART = -1
/** The settings of the object at `path`, of schema type `type`, without the members shown as nodes. */
export interface NodeSettings {
title: string
path: JsonPath
type: string
shownAsNodes: string[]
}
/** A settings type of the pack's schema (SchemaTypes.TypeWire). */
export interface SettingsType {
description: string
options: SettingOption[]
}
export interface SettingOption {
name: string
description: string
required: boolean
minimum: number | null
maximum: number | null
minItems: number | null
defaultValue: unknown
kind: ValueKind
}
export type ValueKind =
| { kind: 'boolean' }
| { kind: 'integer' }
| { kind: 'decimal' }
| { kind: 'text'; format: string }
| { kind: 'reference'; reference: string; format: string }
| { kind: 'resource'; resource: string }
| { kind: 'enum'; constants: { name: string; description: string }[] }
| { kind: 'list'; element: ValueKind; unique: boolean }
| { kind: 'map'; value: ValueKind }
| { kind: 'object'; type: string }
| { kind: 'host'; type: string }
| { kind: 'any' }
/** One change the node editor makes (GraphEditRequest). */
export type GraphEdit =
| { op: 'set'; object: JsonPath; key: string; literal: string }
| { op: 'unset'; object: JsonPath; key: string }
| { op: 'append'; list: JsonPath; literal: string }
| { op: 'addItem'; list: JsonPath }
| { op: 'delete'; path: JsonPath }
| { op: 'duplicate'; path: JsonPath }
| { op: 'move'; path: JsonPath; toList: JsonPath }
/** Something a pattern view lays out, such as one of a biome's palettes (IrisApi PatternEntry). */
export interface PatternEntry {
key: string
name: string
/** The heading it is listed under, such as its biome. */
group: string
/** How many depths below the top it has a pick for; at least 1. */
depths: number
/** Short lines about it, such as its blocks and noise. */
facts: string[]
}
/** What a pattern entry places across a square of columns, row by row from the north west. */
export interface PatternTile {
columns: number
blocksPerColumn: number
/** The block states the picks index, as BlockState keys; a plugin's block by the name the pack gives it. */
blocks: string[]
/** Per block, the state players see and the studio draws: the block itself, or the vanilla state a plugin block borrows. */
drawnAs: string[]
/** Each column's block, or NO_PATTERN_BLOCK where the pattern places none. */
picks: Int16Array
}
export const NO_PATTERN_BLOCK = -1
/** A world saved on the server's disk, a dimension folder of region files. */
export interface SavedWorldInfo {
/** Its folder below the server's level folder. */
id: string
name: string
/** Who added the dimension, such as minecraft or iris. */
namespace: string
}
/** One noise the noise view can show. */
export interface NoiseSource {
id: string
name: string
category: string
/** Whether the view's seed changes it; the dimension's overlay keeps the world's. */
usesSeed: boolean
/** What the noise spans where it is measured in blocks above the fluid; null for noise of 0 to 1. */
blockRange: { lowest: number; highest: number } | null
}
/** A square of noise values, a pixel's value taken at its north west corner, row by row from the north west. */
export interface NoiseTile {
size: number
values: Float32Array
}
/** Where a saved world's view opens: the middle of the region nearest the origin, and how its ground lies there. */
export interface SavedStart {
centerX: number
centerZ: number
minY: number
lowestGround: number
highestGround: number
/** The water surface most water lies at, or null where the region holds none. */
seaLevel: number | null
}
/** A square of a saved world, one column per pixel, row by row from the north west. */
export interface SavedTile {
size: number
blocksPerPixel: number
/** The top block of the ground under any water; {@link noGround} where nothing finished is saved. */
groundY: Int16Array
/** The top water block over the ground; {@link noWater} where it is dry. */
waterSurfaceY: Int16Array
/** Indices into {@link blockNames}, {@link blocksDrawnAs} and {@link biomeLabels}. */
blocks: Int16Array
biomes: Int16Array
/** Each block without its properties; a plugin's block by the name its plugin gives it. */
blockNames: string[]
/** Per block, the state it was saved as, which players see and the studio draws; a plugin block's is the vanilla state it borrows. */
blocksDrawnAs: string[]
biomeLabels: MapLabel[]
noGround: number
noWater: number
}
export interface WorldInfo {
world: string
dimension: string
dimensionName: string
seed: string
minY: number
height: number
fluidHeight: number
tileSize: number
hasPlayers: boolean
views: ViewInfo[]
}
export interface MapHover {
worldX: number
worldZ: number
biome: MapLabel | null
caveBiome: MapLabel | null
region: MapLabel | null
vanillaBiome: string | null
height: number
fluidHeight: number
slopeDegrees: number
biomeFile: string | null
regionFile: string | null
/** How the spot got its region and the biome the view shows, region first. */
pickPath: PickStep[]
}
/** REGION, BIOME and CHILD were picked by noise; IMAGE_MAP, FOCUS and PREVIEW were set without a pick. */
export type PickKind = 'REGION' | 'BIOME' | 'CHILD' | 'IMAGE_MAP' | 'FOCUS' | 'PREVIEW'
export interface PickStep {
kind: PickKind
picked: MapLabel
/** The biome list a BIOME step picked from, such as "land". */
list: string | null
/** The parent name a CHILD step replaced; null when the parent kept the spot. */
replaced: string | null
/** 0 to 1; null when nothing was picked. */
noise: number | null
bands: PickBand[]
}
/** One option's share of a pick noise: picked from `from` up to `to`. */
export interface PickBand {
option: MapLabel
from: number
to: number
}
/** How the noise picks what an area of the map shows (MapPickInspection). */
export interface PickInspection {
detail: string
sections: PickSection[]
}
/** The picks on one region's ground; `region` is null in the region view, where the regions themselves are picked. */
export interface PickSection {
region: MapLabel | null
/** How much of the area's picked ground the region holds. */
share: number
biomeCount: number
spreads: PickSpread[]
}
/** One noise in the area: its values in 50 equal steps from 0 to 1, and each option's share of it. */
export interface PickSpread {
title: string
bands: PickBand[]
histogram: number[]
samples: number
rows: PickShare[]
}
/** `weight`: how much of the noise picks the option; `inView`: how much of the area's values do. */
export interface PickShare {
option: MapLabel
weight: number
inView: number
}
/** How the region and biome views draw their picks: the labels, the noise that picked them, or the labels by noise. */
export type PickDisplay = 'picks' | 'noise' | 'both'
export interface Marker {
label: string
worldX: number
worldY: number
worldZ: number
/** The way it faces, in Minecraft's degrees: 0 is south, 90 is west; 0 for entities. */
yaw: number
health: number
maxHealth: number
}
/** What the server asks of its machine, as it sends it every second. */
export interface ServerUsage {
/** The server's CPU use with 100 per busy thread, or null when the JVM cannot tell. */
cpuPercent: number | null
/** The threads the server's CPU has, so the CPU can reach 100 times this. */
threads: number
heapUsedBytes: number
heapMaxBytes: number
}
/**
* A decoded map tile. Grids hold (size + 2)² cells, the tile's pixels inside a ring of its neighbours' edge pixels.
*/
export interface MapTile {
size: number
blocksPerPixel: number
subjectKind: LabelKind
labels: MapLabel[]
subjects: Int16Array
regions: Int16Array
heights: Float32Array | null
/** The noise value that settled each cell's pick, 0 to 1 and NaN where nothing picked it; null unless asked for. */
pickNoise: Float32Array | null
/** The block on top of each cell's column; null unless asked for. */
blocks: TileBlocks | null
}
/** Where a tile's blocks come from: the chunks the server generates in memory. */
export type BlockSource = 'generated'
/**
* The top of each cell's column: its ground block, the terrain's top; the block standing on it, such as grass; and the
* solid blocks raised above it, such as a tree's wood and leaves.
*/
export interface TileBlocks {
/** The block states the grids index, as BlockState keys. */
names: string[]
/** {@link NO_BLOCK} where the column holds no ground. */
ground: Int16Array
/** {@link NO_BLOCK} where nothing stands on the ground. */
cover: Int16Array
/** Where each cell's raised blocks start in {@link raisedY} and {@link raised}, with one more entry for where the last cell's end. */
raisedStart: Int32Array
/** The Y of each raised block, cell after cell and each cell's highest first. */
raisedY: Int16Array
/** Each raised block, in the order of {@link raisedY}. */
raised: Int16Array
/** The blocks seen from the open air, where the tile is a block a column and they were asked for; else null. */
voxels: TileVoxels | null
/** The runs of solid blocks of the area each cell stands for, where the tile is coarser and they were asked for; else null. */
runs: TileRuns | null
/** Each named block's model with its pictures placed, for the blocks {@link voxels} names; the tile source fills it in. */
models: (CoverLook | null)[]
/** The colour of each named block from above, as 0xRRGGBB; the tile source fills it in. */
colors: number[]
/** What each named block looks like on a column, where the tile is fine enough to show textures; else empty. */
looks: (BlockLook | null)[]
/** What each named block looks like standing on the ground, for the blocks {@link cover} names, on a tile that shows textures; else empty. */
covers: (CoverLook | null)[]
}
/**
* The blocks of a tile that can be seen from the open air, as the server found them in the chunks it generated, with
* the sides of each that face that air.
*/
export interface TileVoxels {
/** Each block's column from the tile's west edge. */
x: Uint8Array
/** Each block's column from the tile's north edge. */
z: Uint8Array
y: Int16Array
/** Each block's index in the tile's block names. */
blocks: Int16Array
/** The sides of each block that face the open air, a bit each in {@link VOXEL_SIDES}' order. */
faces: Uint8Array
/** The sky's light each block shows on faces that stand inside it, such as a plant's, 0 to 15. */
lights: Uint8Array
/** The shade of each face {@link faces} names, block after block and side after side, as skyLight reads it. */
shades: Uint16Array
}
/**
* The ground of a coarser tile in 3D, as Distant Horizons draws far terrain: for each cell, the runs of solid blocks of
* the area it stands for, highest first. The last run of a cell is its ground, which reaches down out of sight.
*/
export interface TileRuns {
/** Where each cell's runs start in the arrays below, with one more entry for where the last cell's end. */
starts: Int32Array
bottoms: Int16Array
tops: Int16Array
/** The index in the tile's block names of the block most of each run's top shows. */
blocks: Int16Array
/** The index of the plant most often standing on each run's top, or {@link NO_BLOCK}. */
covers: Int16Array
/** How much of each run's top plants stand on, 0 to 255 for all of it. */
coverShares: Uint8Array
/** The sky's light on each run's top, the mean of its blocks' tops, in sixteenths of a level. */
lights: Uint8Array
/** How many opaque cells stand around each corner of each run's top, the mean of its blocks' tops, in sixty-fourths. */
occlusions: Uint8Array
}
/** {@link TileRuns.lights} to a light level. */
export const RUN_LIGHT_STEPS = 16
/** {@link TileRuns.occlusions} to a count of opaque cells. */
export const RUN_OCCLUSION_STEPS = 64
/** The order of the sides in {@link TileVoxels.faces}. */
export const VOXEL_SIDES = ['down', 'up', 'north', 'south', 'west', 'east'] as const
export const NO_BLOCK = -1
export const NO_LABEL = -1
@@ -0,0 +1,64 @@
import { cn } from '@/lib/utils'
// IntelliJ's expui icons and the studio's own drawn to match (see icons/NOTICE.txt): each has a light file and a "_dark" twin in its own colours.
const ICON_URLS = import.meta.glob<string>('../icons/**/*.svg', { eager: true, query: '?url', import: 'default' })
const DARK_SUFFIX = '_dark'
export type IdeIconName =
| 'actualZoom'
| 'add'
| 'blocks'
| 'borders'
| 'checked'
| 'closeSmall'
| 'chevronLeft'
| 'chevronRight'
| 'decoration'
| 'delete'
| 'exit'
| 'grid'
| 'groups'
| 'help'
| 'lightning'
| 'locate'
| 'locked'
| 'memory'
| 'mob'
| 'redo'
| 'refresh'
| 'reset'
| 'search'
| 'settings'
| 'shading'
| 'stopWatch'
| 'symlink'
| 'theme'
| 'undo'
| 'web'
| 'views/biomes'
| 'views/noise'
| 'views/objects'
| 'views/palettes'
| 'views/procedural'
| 'views/regions'
| 'views/saved-world'
| 'views/world-3d'
function iconUrl(name: string): string {
const url = ICON_URLS[`../icons/${name}.svg`]
if (url === undefined) {
throw new Error(`No icon named ${name}`)
}
return url
}
/** An IntelliJ icon, 16 px unless sized, in the light or dark colours the window shows. */
export function IdeIcon({ name, className }: { name: IdeIconName; className?: string }): React.JSX.Element {
const size = cn('size-4 shrink-0', className)
return (
<>
<img src={iconUrl(name)} alt="" draggable={false} className={cn(size, 'dark:hidden')} />
<img src={iconUrl(name + DARK_SUFFIX)} alt="" draggable={false} className={cn(size, 'hidden dark:block')} />
</>
)
}
@@ -0,0 +1,63 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Slot } from "radix-ui"
const buttonVariants = cva(
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
"icon-sm": "size-8",
"icon-lg": "size-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
function Button({
className,
variant = "default",
size = "default",
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot.Root : "button"
return (
<Comp
data-slot="button"
data-variant={variant}
data-size={size}
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
)
}
export { Button, buttonVariants }
@@ -0,0 +1,254 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { IdeIcon } from "@/components/IdeIcon"
import { ContextMenu as ContextMenuPrimitive } from "radix-ui"
function ContextMenu({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
}
function ContextMenuTrigger({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
return (
<ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
)
}
function ContextMenuGroup({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
return (
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
)
}
function ContextMenuPortal({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
return (
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
)
}
function ContextMenuSub({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
}
function ContextMenuRadioGroup({
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
return (
<ContextMenuPrimitive.RadioGroup
data-slot="context-menu-radio-group"
{...props}
/>
)
}
function ContextMenuSubTrigger({
className,
inset,
children,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
inset?: boolean
}) {
return (
<ContextMenuPrimitive.SubTrigger
data-slot="context-menu-sub-trigger"
data-inset={inset}
className={cn(
"flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
className
)}
{...props}
>
{children}
<span className="ml-auto">
<IdeIcon name="chevronRight" />
</span>
</ContextMenuPrimitive.SubTrigger>
)
}
function ContextMenuSubContent({
className,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
// Portalled like the menu itself: inside it, the menu's blur and scrolling would clip the submenu away.
return (
<ContextMenuPrimitive.Portal>
<ContextMenuPrimitive.SubContent
data-slot="context-menu-sub-content"
className={cn(
"z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 backdrop-blur-sm text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
className
)}
{...props}
/>
</ContextMenuPrimitive.Portal>
)
}
function ContextMenuContent({
className,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
return (
<ContextMenuPrimitive.Portal>
<ContextMenuPrimitive.Content
data-slot="context-menu-content"
className={cn(
"z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground backdrop-blur-sm shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
className
)}
{...props}
/>
</ContextMenuPrimitive.Portal>
)
}
function ContextMenuItem({
className,
inset,
variant = "default",
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
inset?: boolean
variant?: "default" | "destructive"
}) {
return (
<ContextMenuPrimitive.Item
data-slot="context-menu-item"
data-inset={inset}
data-variant={variant}
className={cn(
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
className
)}
{...props}
/>
)
}
function ContextMenuCheckboxItem({
className,
children,
checked,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
return (
<ContextMenuPrimitive.CheckboxItem
data-slot="context-menu-checkbox-item"
className={cn(
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
checked={checked}
{...props}
>
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<IdeIcon name="checked" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
</ContextMenuPrimitive.CheckboxItem>
)
}
function ContextMenuRadioItem({
className,
children,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
return (
<ContextMenuPrimitive.RadioItem
data-slot="context-menu-radio-item"
className={cn(
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<span className="size-1.5 rounded-full bg-current" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
</ContextMenuPrimitive.RadioItem>
)
}
function ContextMenuLabel({
className,
inset,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
inset?: boolean
}) {
return (
<ContextMenuPrimitive.Label
data-slot="context-menu-label"
data-inset={inset}
className={cn(
"px-2 py-1.5 text-sm font-medium text-foreground data-[inset]:pl-8",
className
)}
{...props}
/>
)
}
function ContextMenuSeparator({
className,
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
return (
<ContextMenuPrimitive.Separator
data-slot="context-menu-separator"
className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
)
}
function ContextMenuShortcut({
className,
...props
}: React.ComponentProps<"span">) {
return (
<span
data-slot="context-menu-shortcut"
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className
)}
{...props}
/>
)
}
export {
ContextMenu,
ContextMenuTrigger,
ContextMenuContent,
ContextMenuItem,
ContextMenuCheckboxItem,
ContextMenuRadioItem,
ContextMenuLabel,
ContextMenuSeparator,
ContextMenuShortcut,
ContextMenuGroup,
ContextMenuPortal,
ContextMenuSub,
ContextMenuSubContent,
ContextMenuSubTrigger,
ContextMenuRadioGroup,
}
@@ -0,0 +1,158 @@
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { IdeIcon } from "@/components/IdeIcon"
import { Dialog as DialogPrimitive } from "radix-ui"
import { Button } from "@/components/ui/button"
function Dialog({
...props
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />
}
function DialogTrigger({
...props
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
}
function DialogPortal({
...props
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
}
function DialogClose({
...props
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
function DialogOverlay({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
return (
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
className
)}
{...props}
/>
)
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
showCloseButton?: boolean
}) {
return (
<DialogPortal data-slot="dialog-portal">
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
className={cn(
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
>
<IdeIcon name="closeSmall" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
)
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props}
/>
)
}
function DialogFooter({
className,
showCloseButton = false,
children,
...props
}: React.ComponentProps<"div"> & {
showCloseButton?: boolean
}) {
return (
<div
data-slot="dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close asChild>
<Button variant="outline">Close</Button>
</DialogPrimitive.Close>
)}
</div>
)
}
function DialogTitle({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn("text-lg leading-none font-semibold", className)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}
@@ -0,0 +1,20 @@
import * as React from "react"
import { cn } from "@/lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
<input
type={type}
data-slot="input"
className={cn(
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
className
)}
{...props}
/>
)
}
export { Input }
@@ -0,0 +1,28 @@
import { cn } from "@/lib/utils"
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
return (
<kbd
data-slot="kbd"
className={cn(
"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none",
"[&_svg:not([class*='size-'])]:size-3",
"[[data-slot=tooltip-content]_&]:bg-secondary [[data-slot=tooltip-content]_&]:text-secondary-text",
className
)}
{...props}
/>
)
}
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
return (
<kbd
data-slot="kbd-group"
className={cn("inline-flex items-center gap-1", className)}
{...props}
/>
)
}
export { Kbd, KbdGroup }
@@ -0,0 +1,57 @@
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
function ScrollArea({
className,
children,
...props
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
return (
<ScrollAreaPrimitive.Root
data-slot="scroll-area"
className={cn("relative", className)}
{...props}
>
<ScrollAreaPrimitive.Viewport
data-slot="scroll-area-viewport"
className="size-full rounded-[inherit] [&>div]:block! transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
>
{children}
</ScrollAreaPrimitive.Viewport>
<ScrollBar />
<ScrollAreaPrimitive.Corner />
</ScrollAreaPrimitive.Root>
)
}
function ScrollBar({
className,
orientation = "vertical",
...props
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
return (
<ScrollAreaPrimitive.ScrollAreaScrollbar
data-slot="scroll-area-scrollbar"
orientation={orientation}
className={cn(
"flex touch-none p-px transition-colors select-none",
orientation === "vertical" &&
"h-full w-2.5 border-l border-l-transparent",
orientation === "horizontal" &&
"h-2.5 flex-col border-t border-t-transparent",
className
)}
{...props}
>
<ScrollAreaPrimitive.ScrollAreaThumb
data-slot="scroll-area-thumb"
className="relative flex-1 rounded-full bg-border"
/>
</ScrollAreaPrimitive.ScrollAreaScrollbar>
)
}
export { ScrollArea, ScrollBar }
@@ -0,0 +1,25 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { Separator as SeparatorPrimitive } from "radix-ui"
function Separator({
className,
orientation = "horizontal",
decorative = true,
...props
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
return (
<SeparatorPrimitive.Root
data-slot="separator"
decorative={decorative}
orientation={orientation}
className={cn(
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
className
)}
{...props}
/>
)
}
export { Separator }
@@ -0,0 +1,69 @@
import * as React from "react"
import { type VariantProps } from "class-variance-authority"
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
import { toggleVariants } from "@/components/ui/toggle"
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
size: "default",
variant: "default",
})
function ToggleGroup({
className,
variant,
size,
children,
...props
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
VariantProps<typeof toggleVariants>) {
return (
<ToggleGroupPrimitive.Root
data-slot="toggle-group"
data-variant={variant}
data-size={size}
className={cn(
"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
className
)}
{...props}
>
<ToggleGroupContext.Provider value={{ variant, size }}>
{children}
</ToggleGroupContext.Provider>
</ToggleGroupPrimitive.Root>
)
}
function ToggleGroupItem({
className,
children,
variant,
size,
...props
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
VariantProps<typeof toggleVariants>) {
const context = React.useContext(ToggleGroupContext)
return (
<ToggleGroupPrimitive.Item
data-slot="toggle-group-item"
data-variant={context.variant || variant}
data-size={context.size || size}
className={cn(
toggleVariants({
variant: context.variant || variant,
size: context.size || size,
}),
"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
className
)}
{...props}
>
{children}
</ToggleGroupPrimitive.Item>
)
}
export { ToggleGroup, ToggleGroupItem }
@@ -0,0 +1,44 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Toggle as TogglePrimitive } from "radix-ui"
const toggleVariants = cva(
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
default: "bg-transparent",
outline:
"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
},
size: {
default: "h-9 min-w-9 px-2",
sm: "h-8 min-w-8 px-1.5",
lg: "h-10 min-w-10 px-2.5",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
function Toggle({
className,
variant,
size,
...props
}: React.ComponentProps<typeof TogglePrimitive.Root> &
VariantProps<typeof toggleVariants>) {
return (
<TogglePrimitive.Root
data-slot="toggle"
className={cn(toggleVariants({ variant, size, className }))}
{...props}
/>
)
}
export { Toggle, toggleVariants }
@@ -0,0 +1,55 @@
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { Tooltip as TooltipPrimitive } from "radix-ui"
function TooltipProvider({
delayDuration = 0,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
return (
<TooltipPrimitive.Provider
data-slot="tooltip-provider"
delayDuration={delayDuration}
{...props}
/>
)
}
function Tooltip({
...props
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
}
function TooltipTrigger({
...props
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
}
function TooltipContent({
className,
sideOffset = 6,
children,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
return (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-overlay-border bg-popover px-2.5 py-1.5 text-xs text-balance text-popover-foreground shadow-md fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
className
)}
{...props}
>
{children}
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
)
}
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
+1
View File
@@ -0,0 +1 @@
declare module '*.css'
@@ -0,0 +1,35 @@
import { describe, expect, it } from 'vitest'
import { EditHistory } from './EditHistory'
describe('EditHistory', () => {
it('undoes back to the text before an edit and redoes forward again', () => {
const history = new EditHistory()
history.edited('a')
expect(history.nextUndo()).toBe('a')
history.undone('b')
expect(history.canUndo).toBe(false)
expect(history.nextRedo()).toBe('b')
history.redone('a')
expect(history.nextUndo()).toBe('a')
})
it('forgets what could be redone once a new edit is made', () => {
const history = new EditHistory()
history.edited('a')
history.undone('b')
history.edited('a')
expect(history.canRedo).toBe(false)
})
it('keeps the history as it was when an undo is never written', () => {
const history = new EditHistory()
history.edited('a')
history.nextUndo()
expect(history.canUndo).toBe(true)
})
})
@@ -0,0 +1,45 @@
const KEPT_STEPS = 100
/**
* The texts a file had before each edit, so undoing writes an earlier text back whole. A step is only taken once its
* write succeeded, so a refused undo leaves the history as it was.
*/
export class EditHistory {
private readonly undos: string[] = []
private readonly redos: string[] = []
get canUndo(): boolean {
return this.undos.length > 0
}
get canRedo(): boolean {
return this.redos.length > 0
}
edited(before: string): void {
this.undos.push(before)
if (this.undos.length > KEPT_STEPS) {
this.undos.shift()
}
this.redos.length = 0
}
/** The text undoing writes, if there is one. */
nextUndo(): string | undefined {
return this.undos.at(-1)
}
undone(before: string): void {
this.undos.pop()
this.redos.push(before)
}
nextRedo(): string | undefined {
return this.redos.at(-1)
}
redone(before: string): void {
this.redos.pop()
this.undos.push(before)
}
}
@@ -0,0 +1,84 @@
import { describe, expect, it } from 'vitest'
import { canBecomeCurve, curveAt, curveFrom, isCurve, keyframesFrom, samplesOf, shapeFrom, withAddedKeyframe, withKeyframe, withoutKeyframe, withSetting, withShape } from './curves'
describe('isCurve', () => {
it('holds only for keyframes and named shapes', () => {
expect(isCurve([[0, 1.3], [1, 0.2]])).toBe(true)
expect(isCurve({ shape: 'power', exponent: 3 })).toBe(true)
expect(isCurve([15, 20])).toBe(false)
expect(isCurve(4)).toBe(false)
expect(isCurve({ min: 3, max: 8 })).toBe(false)
expect(isCurve({ shape: 'zigzag' })).toBe(false)
})
})
describe('samplesOf', () => {
it('runs from the start of the curve to its end', () => {
expect(samplesOf([[0, 1.3], [1, 0.2]], 3)).toEqual([1.3, 0.75, 0.2].map((expected) => expect.closeTo(expected, 9)))
})
it('has none for a value that is no curve', () => {
expect(samplesOf(4, 3)).toBeNull()
})
it('follows a named curve between its from and to', () => {
expect(curveAt({ shape: 'power', exponent: 2, from: 10, to: 20 }, 0.5)).toBeCloseTo(12.5, 9)
expect(curveAt({ shape: 'linear' }, 0.25)).toBeCloseTo(0.25, 9)
})
it('holds the first and last values beyond the keyframes', () => {
expect(curveAt([[0.2, 5], [0.8, 9]], 0)).toBe(5)
expect(curveAt([[0.2, 5], [0.8, 9]], 1)).toBe(9)
})
})
describe('curveFrom', () => {
it('makes a number a flat curve and a range a rising one', () => {
expect(curveFrom(4)).toEqual([[0, 4], [1, 4]])
expect(curveFrom([15, 20])).toEqual([[0, 15], [1, 20]])
expect(curveFrom({ min: 3, max: 8 })).toEqual([[0, 3], [1, 8]])
})
it('leaves what is not a number or range alone', () => {
expect(curveFrom('wood')).toBeNull()
expect(canBecomeCurve([[0, 1], [1, 2]])).toBe(false)
expect(canBecomeCurve(4)).toBe(true)
})
})
describe('changing how a curve is written', () => {
it('turns keyframes into a linear shape between their ends, and back into sampled keyframes', () => {
const shape = shapeFrom([[1, 8], [0, 2]])
expect(shape).toEqual({ shape: 'linear', from: 2, to: 8 })
expect(keyframesFrom(shape).map(([t, value]) => [t, value])).toEqual([[0, 2], [0.25, 3.5], [0.5, 5], [0.75, 6.5], [1, 8]])
})
it('sets a shape setting, or leaves it out so the default applies', () => {
expect(withSetting({ shape: 'power', exponent: 3 }, 'exponent', 4)).toEqual({ shape: 'power', exponent: 4 })
expect(withSetting({ shape: 'power', exponent: 3 }, 'exponent', undefined)).toEqual({ shape: 'power' })
})
it('keeps from and to when the shape changes, but not the old shape settings', () => {
expect(withShape({ shape: 'power', exponent: 3, from: 1, to: 4 }, 'sine')).toEqual({ shape: 'sine', from: 1, to: 4 })
})
})
describe('editing keyframes', () => {
const keys: [number, number][] = [[0, 1], [1, 3]]
it('adds a keyframe halfway across the widest gap, on the curve', () => {
expect(withAddedKeyframe(keys)).toEqual([[0, 1], [0.5, 2], [1, 3]])
expect(withAddedKeyframe([[0, 1], [0.25, 1], [1, 3]])[2]).toEqual([0.625, expect.closeTo(1 + (2 * 0.375) / 0.75, 9)])
})
it('gives a lone keyframe a partner at the other end', () => {
expect(withAddedKeyframe([[0, 4]])).toEqual([[0, 4], [1, 4]])
})
it('sets and removes a keyframe but never removes the last one', () => {
expect(withKeyframe(keys, 1, [0.9, 5])).toEqual([[0, 1], [0.9, 5]])
expect(withoutKeyframe(keys, 0)).toEqual([[1, 3]])
expect(withoutKeyframe([[1, 3]], 0)).toEqual([[1, 3]])
})
})
+217
View File
@@ -0,0 +1,217 @@
/** One keyframe of a curve: where it is from 0 to 1, and the value there. */
export type Keyframe = [number, number]
export interface ShapeParameter {
name: string
fallback: number
}
/** A named curve (ProceduralValue.CurveShape): from 0 at t = 0 toward 1, stretched between a value's from and to. */
export interface CurveShape {
key: string
parameters: ShapeParameter[]
at(t: number, parameter: (name: string) => number): number
}
const DEFAULT_FROM = 0
const DEFAULT_TO = 1
const KEYFRAME_SIZE = 2
const RANGE_SIZE = 2
const NARROWEST_BELL = 1e-6
const SHAPE_STOPS = 5
const FIRST_STOP = 0
const LAST_STOP = 1
export const CURVE_SHAPES: CurveShape[] = [
{ key: 'linear', parameters: [], at: (t) => t },
{ key: 'smooth', parameters: [], at: (t) => t * t * (3 - 2 * t) },
{ key: 'power', parameters: [{ name: 'exponent', fallback: 2 }], at: (t, p) => Math.pow(t, p('exponent')) },
{
key: 'sigmoid',
parameters: [
{ name: 'steepness', fallback: 10 },
{ name: 'mid', fallback: 0.5 }
],
at: (t, p) => 1 / (1 + Math.exp(-p('steepness') * (t - p('mid'))))
},
{
key: 'bell',
parameters: [
{ name: 'mid', fallback: 0.5 },
{ name: 'width', fallback: 0.15 }
],
at: (t, p) => Math.exp(-0.5 * Math.pow((t - p('mid')) / Math.max(NARROWEST_BELL, p('width')), 2))
},
{
key: 'periodic',
parameters: [
{ name: 'periods', fallback: 4 },
{ name: 'sharpness', fallback: 8 }
],
at: (t, p) => Math.pow(Math.max(0, Math.sin(2 * Math.PI * t * p('periods'))), p('sharpness'))
},
{ key: 'sine', parameters: [{ name: 'periods', fallback: 1 }], at: (t, p) => 0.5 + 0.5 * Math.sin(2 * Math.PI * t * p('periods')) }
]
export function shapeNamed(key: unknown): CurveShape | undefined {
return typeof key === 'string' ? CURVE_SHAPES.find((shape) => shape.key === key.toLowerCase()) : undefined
}
function isObject(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
}
function isKeyframe(value: unknown): value is Keyframe {
return Array.isArray(value) && value.length === KEYFRAME_SIZE && value.every((part) => typeof part === 'number')
}
/** Whether {@code value} is keyframes [[t, value], ...], which a range [min, max] and a number are not. */
export function isKeyframes(value: unknown): value is Keyframe[] {
return Array.isArray(value) && value.length > 0 && value.every(isKeyframe)
}
/** Whether {@code value} is a named curve {"shape": ...} the studio knows. */
export function isShape(value: unknown): value is Record<string, unknown> {
return isObject(value) && shapeNamed(value.shape) !== undefined
}
/** Whether {@code value} is a curve, as opposed to a number or a [min, max] range. */
export function isCurve(value: unknown): boolean {
return isKeyframes(value) || isShape(value)
}
/** Whether {@code value} is a number or a range, which {@link curveFrom} makes a curve. */
export function canBecomeCurve(value: unknown): boolean {
return typeof value === 'number' || rangeOf(value) !== null
}
function rangeOf(value: unknown): [number, number] | null {
if (Array.isArray(value) && value.length === RANGE_SIZE && value.every((part) => typeof part === 'number')) {
return [value[0], value[1]]
}
if (isObject(value) && typeof value.min === 'number' && typeof value.max === 'number') {
return [value.min, value.max]
}
return null
}
/** A number as a curve that stays at it, a range as a curve rising from its low end to its high end; null for anything else. */
export function curveFrom(value: unknown): Keyframe[] | null {
if (typeof value === 'number') {
return [
[0, value],
[1, value]
]
}
const range = rangeOf(value)
return range === null
? null
: [
[0, range[0]],
[1, range[1]]
]
}
function numberOf(written: unknown, fallback: number): number {
return typeof written === 'number' ? written : fallback
}
/** The value of a curve at {@code t}, from 0 to 1; NaN for a value that is no curve. */
export function curveAt(value: unknown, t: number): number {
if (isKeyframes(value)) {
return keyframesAt(sortedKeyframes(value), t)
}
if (!isShape(value)) {
return Number.NaN
}
const shape = shapeNamed(value.shape)!
const from = numberOf(value.from, DEFAULT_FROM)
const to = numberOf(value.to, DEFAULT_TO)
const parameter = (name: string): number => numberOf(value[name], shape.parameters.find((candidate) => candidate.name === name)!.fallback)
return from + (to - from) * shape.at(Math.max(0, Math.min(1, t)), parameter)
}
export function sortedKeyframes(keys: Keyframe[]): Keyframe[] {
return [...keys].sort((a, b) => a[0] - b[0])
}
function keyframesAt(keys: Keyframe[], t: number): number {
if (t <= keys[0][0]) {
return keys[0][1]
}
for (let index = 1; index < keys.length; index++) {
if (t <= keys[index][0]) {
const span = keys[index][0] - keys[index - 1][0]
const blend = span <= 0 ? 1 : (t - keys[index - 1][0]) / span
return keys[index - 1][1] + (keys[index][1] - keys[index - 1][1]) * blend
}
}
return keys[keys.length - 1][1]
}
/** {@code count} values of the curve, from its start to its end; null for a value that is no curve. */
export function samplesOf(value: unknown, count: number): number[] | null {
if (!isCurve(value)) {
return null
}
return Array.from({ length: count }, (_, index) => curveAt(value, count === 1 ? 0 : index / (count - 1)))
}
/** The curve as keyframes, such as to move a named curve's shape by hand: its values at evenly spaced points. */
export function keyframesFrom(value: unknown): Keyframe[] {
if (isKeyframes(value)) {
return value
}
const stops = Array.from({ length: SHAPE_STOPS }, (_, index) => FIRST_STOP + ((LAST_STOP - FIRST_STOP) * index) / (SHAPE_STOPS - 1))
return stops.map((t): Keyframe => [t, curveAt(value, t)])
}
/** A linear named curve between the first and last keyframes' values, or the shape itself. */
export function shapeFrom(value: unknown): Record<string, unknown> {
if (isShape(value)) {
return value
}
const keys = isKeyframes(value) ? sortedKeyframes(value) : []
return { shape: 'linear', from: keys.length > 0 ? keys[0][1] : DEFAULT_FROM, to: keys.length > 0 ? keys[keys.length - 1][1] : DEFAULT_TO }
}
/** The shape with {@code key}, keeping its from and to; the other settings of the old shape do not carry over. */
export function withShape(shape: Record<string, unknown>, key: string): Record<string, unknown> {
return { shape: key, from: numberOf(shape.from, DEFAULT_FROM), to: numberOf(shape.to, DEFAULT_TO) }
}
/** The shape with {@code name} set to {@code number}, or left out when it is undefined so the shape's own default applies. */
export function withSetting(shape: Record<string, unknown>, name: string, number: number | undefined): Record<string, unknown> {
const { [name]: _replaced, ...others } = shape
return number === undefined ? others : { ...others, [name]: number }
}
/** The keyframes with the one at {@code index} (as listed) set to {@code keyframe}. */
export function withKeyframe(keys: Keyframe[], index: number, keyframe: Keyframe): Keyframe[] {
return keys.map((existing, position) => (position === index ? keyframe : existing))
}
/** The keyframes without the one at {@code index}; the last one stays, since a curve needs a keyframe. */
export function withoutKeyframe(keys: Keyframe[], index: number): Keyframe[] {
return keys.length <= 1 ? keys : keys.filter((_, position) => position !== index)
}
/** The keyframes with one more halfway across the widest gap, on the curve as it is; a lone keyframe gets one at the other end. */
export function withAddedKeyframe(keys: Keyframe[]): Keyframe[] {
const sorted = sortedKeyframes(keys)
if (sorted.length === 1) {
const t = sorted[0][0] === LAST_STOP ? FIRST_STOP : LAST_STOP
return sortedKeyframes([...sorted, [t, sorted[0][1]]])
}
let widest = 0
let before = 0
for (let index = 1; index < sorted.length; index++) {
const gap = sorted[index][0] - sorted[index - 1][0]
if (gap > widest) {
widest = gap
before = index - 1
}
}
const t = sorted[before][0] + widest / 2
return sortedKeyframes([...sorted, [t, keyframesAt(sorted, t)]])
}
@@ -0,0 +1,32 @@
import { describe, expect, it } from 'vitest'
import { folderPrefixOf, refusalOfNewKey } from './entryKeys'
describe('refusalOfNewKey', () => {
it('accepts a free, plain key', () => {
expect(refusalOfNewKey('trees/oak-2', ['trees/oak'])).toBeNull()
})
it('refuses a key that is taken', () => {
expect(refusalOfNewKey('trees/oak', ['trees/oak'])).toBe('trees/oak already exists')
})
it('refuses a blank name', () => {
expect(refusalOfNewKey(' ', [])).toBe('Give it a name')
})
it('refuses keys that could leave the folder or are not plain', () => {
for (const key of ['Trees/Oak', 'trees//oak', '/oak', 'oak/', '../oak', 'trees/../oak', 'oak.json', 'trees\\oak']) {
expect(refusalOfNewKey(key, []), key).toMatch(/^Use lower case/)
}
})
})
describe('folderPrefixOf', () => {
it('keeps the folders of a key with their closing slash', () => {
expect(folderPrefixOf('trees/oak/tall')).toBe('trees/oak/')
})
it('is empty for a key in no folder', () => {
expect(folderPrefixOf('oak')).toBe('')
})
})
@@ -0,0 +1,18 @@
const FOLDER_SEPARATOR = '/'
const KEY = /^[a-z0-9_-]+(\/[a-z0-9_-]+)*$/
/** Why `key` can't name a new entry beside the `existing` ones, or null when it can; the server checks the same. */
export function refusalOfNewKey(key: string, existing: readonly string[]): string | null {
if (key.trim() === '') {
return 'Give it a name'
}
if (!KEY.test(key)) {
return 'Use lower case letters, digits, - and _, with / between folders'
}
return existing.includes(key) ? `${key} already exists` : null
}
/** The folder of `key` as a start for naming a new entry in it, such as `trees/`; empty for an entry in no folder. */
export function folderPrefixOf(key: string): string {
return key.slice(0, key.lastIndexOf(FOLDER_SEPARATOR) + 1)
}
@@ -0,0 +1,22 @@
import type { JsonPath } from '../bridge/types'
/** The value at {@code path} in a parsed file; undefined where nothing is written. */
export function valueAt(root: unknown, path: JsonPath): unknown {
let current = root
for (const step of path) {
if (current === null || typeof current !== 'object') {
return undefined
}
current = (current as Record<string | number, unknown>)[step]
}
return current
}
/** The file parsed, or undefined when it is not JSON (the editor then shows why instead). */
export function parsedText(text: string): unknown {
try {
return JSON.parse(text)
} catch {
return undefined
}
}
@@ -0,0 +1,68 @@
import { describe, expect, it } from 'vitest'
import type { GraphNode, JsonPath } from '../bridge/types'
import { NO_PART } from '../bridge/types'
import { isWithin, layoutNodes, nodeDrawingPart, NODE_WIDTH } from './nodeLayout'
function node(path: JsonPath, children: GraphNode[] = []): GraphNode {
return {
kind: 'Stem',
title: 'Stem',
path,
partId: NO_PART,
roles: [],
settings: [],
children: children.map((child) => ({ wire: '', node: child })),
childList: null,
movable: true,
duplicable: true,
additions: []
}
}
describe('layoutNodes', () => {
it('sets a parent level with the middle of its children, a column to their left', () => {
const layout = layoutNodes([node([], [node(['parts', 0]), node(['parts', 1]), node(['parts', 2])])])
const [first, , last, parent] = layout.nodes
expect(parent.y).toBe((first.y + last.y) / 2)
expect(first.x - parent.x).toBeGreaterThan(NODE_WIDTH)
expect(layout.wires).toHaveLength(3)
})
it('lays the next root out under the tree before it', () => {
const layout = layoutNodes([node([], [node(['parts', 0])]), node(['materials', 0])])
const material = layout.nodes.find((placed) => placed.id === JSON.stringify(['materials', 0]))!
expect(material.x).toBe(0)
expect(material.y).toBeGreaterThan(Math.max(...layout.nodes.filter((placed) => placed !== material).map((placed) => placed.y)))
})
})
describe('nodeDrawingPart', () => {
const drawing = (path: JsonPath, partId: number, children: GraphNode[] = []): GraphNode => ({ ...node(path, children), partId })
it('finds the node that draws the part, whichever tree and depth it is in', () => {
const roots = [drawing([], 0, [drawing(['parts', 0], 1)]), drawing(['materials', 0], NO_PART, [drawing(['materials', 0, 'parts', 0], 2)])]
expect(nodeDrawingPart(roots, 1)?.path).toEqual(['parts', 0])
expect(nodeDrawingPart(roots, 2)?.path).toEqual(['materials', 0, 'parts', 0])
})
it('takes the outer node when a node and the one it copies draw the same part', () => {
const roots = [drawing([], 3, [drawing(['branches', 'part'], 3)])]
expect(nodeDrawingPart(roots, 3)?.path).toEqual([])
})
it('finds none for a part no node draws', () => {
expect(nodeDrawingPart([drawing([], 0)], 5)).toBeNull()
})
})
describe('isWithin', () => {
it('holds for the path itself and what sits inside it, not for a sibling', () => {
expect(isWithin(['parts', 0, 'children', 1], ['parts', 0])).toBe(true)
expect(isWithin(['parts', 0], ['parts', 0])).toBe(true)
expect(isWithin(['parts', 1], ['parts', 0])).toBe(false)
})
})
@@ -0,0 +1,108 @@
import type { GraphNode, JsonPath } from '../bridge/types'
export const NODE_WIDTH = 168
export const NODE_HEIGHT = 46
const COLUMN_GAP = 64
const ROW_GAP = 10
const TREE_GAP = 26
/** A node where the canvas draws it, by its top left corner; `id` tells it from every other node of the file. */
export interface PlacedNode {
id: string
node: GraphNode
x: number
y: number
}
export interface PlacedWire {
from: PlacedNode
to: PlacedNode
label: string
}
export interface NodeLayout {
nodes: PlacedNode[]
wires: PlacedWire[]
width: number
height: number
}
export function idOf(path: JsonPath): string {
return JSON.stringify(path)
}
/** The node at {@code path} among the trees of {@code roots}, or null when there is none, such as after it was deleted. */
export function nodeWithPath(roots: GraphNode[], path: JsonPath): GraphNode | null {
const id = idOf(path)
for (const root of roots) {
if (idOf(root.path) === id) {
return root
}
const found = nodeWithPath(
root.children.map((link) => link.node),
path
)
if (found !== null) {
return found
}
}
return null
}
/** The first node, going down each tree in turn, that draws {@code part}, or null when none does. */
export function nodeDrawingPart(roots: GraphNode[], part: number): GraphNode | null {
for (const root of roots) {
if (root.partId === part) {
return root
}
const found = nodeDrawingPart(
root.children.map((link) => link.node),
part
)
if (found !== null) {
return found
}
}
return null
}
/** Whether {@code path} is {@code ancestor} or sits inside it. */
export function isWithin(path: JsonPath, ancestor: JsonPath): boolean {
return ancestor.length <= path.length && ancestor.every((step, index) => path[index] === step)
}
/**
* Lays each root's tree out from left to right, a column per generation, one tree under the other. Leaves take a row
* each and a parent sits level with the middle of its children, so wires never cross.
*/
export function layoutNodes(roots: GraphNode[]): NodeLayout {
const nodes: PlacedNode[] = []
const wires: PlacedWire[] = []
let nextTop = 0
let width = 0
const place = (node: GraphNode, depth: number): PlacedNode => {
const x = depth * (NODE_WIDTH + COLUMN_GAP)
width = Math.max(width, x + NODE_WIDTH)
const children = node.children.map((link) => ({ label: link.wire, placed: place(link.node, depth + 1) }))
const y = children.length === 0 ? takeRow() : (children[0].placed.y + children[children.length - 1].placed.y) / 2
const placed: PlacedNode = { id: idOf(node.path), node, x, y }
nodes.push(placed)
for (const child of children) {
wires.push({ from: placed, to: child.placed, label: child.label })
}
return placed
}
const takeRow = (): number => {
const top = nextTop
nextTop += NODE_HEIGHT + ROW_GAP
return top
}
for (const root of roots) {
place(root, 0)
nextTop += TREE_GAP
}
return { nodes, wires, width, height: Math.max(0, nextTop - ROW_GAP - TREE_GAP) }
}
@@ -0,0 +1,79 @@
import { describe, expect, it } from 'vitest'
import type { NodeSettings, SettingOption, SettingsType, ValueKind } from '../bridge/types'
import { foldedSections, idOfFold, visibleFolds } from './settingFolds'
function option(name: string, kind: ValueKind): SettingOption {
return { name, description: '', required: false, minimum: null, maximum: null, minItems: null, defaultValue: null, kind }
}
const text: ValueKind = { kind: 'text', format: 'PLAIN' }
const any: ValueKind = { kind: 'any' }
const types: Record<string, SettingsType> = {
Material: {
description: '',
options: [
option('role', text),
option('block', { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }),
option('offset', { kind: 'object', type: 'Offset' }),
option('rules', { kind: 'list', element: { kind: 'object', type: 'Rule' }, unique: false }),
option('parts', { kind: 'list', element: { kind: 'object', type: 'Rule' }, unique: false })
]
},
Offset: { description: '', options: [option('x', any), option('y', any)] },
Rule: { description: '', options: [option('chance', any), option('face', text)] }
}
const material: NodeSettings = { title: 'Material', path: ['materials', 0], type: 'Material', shownAsNodes: ['parts'] }
const file = {
materials: [
{
role: 'wood',
block: 'minecraft:birch_wood',
offset: { x: 2, y: [[0, 1], [1, 0]] },
rules: [{ chance: 0.5 }, { face: 'top' }]
}
]
}
describe('foldedSections', () => {
it('folds an object setting into a section, and a list of objects into a section of items', () => {
const folds = foldedSections(material, types, file)
expect(folds.map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules', '1', '2'])
expect(folds.map((fold) => fold.kind)).toEqual(['own', 'group', 'list', 'item', 'item'])
expect(folds.map((fold) => fold.depth)).toEqual([0, 1, 1, 2, 2])
expect(folds[4].path).toEqual(['materials', 0, 'rules', 1])
expect(folds[2].holder).toEqual({ object: ['materials', 0], key: 'rules' })
})
it('leaves the folded settings and the ones shown as nodes out of the fields of the section that holds them', () => {
const [own] = foldedSections(material, types, file)
expect(own.options.map((setting) => setting.name)).toEqual(['role', 'block'])
})
it('sums a section up by what it holds, a curve as curve and the default namespace left off', () => {
const folds = foldedSections(material, types, file)
expect(folds[0].summary).toBe('role wood · block birch_wood · rules 2')
expect(folds[1].summary).toBe('x 2 · y curve')
expect(folds[2].summary).toBe('2 items')
})
it('keeps a setting that is not written as an object a field', () => {
const [own, ...inside] = foldedSections(material, types, { materials: [{ role: 'wood' }] })
expect(inside).toEqual([])
expect(own.options.map((setting) => setting.name)).toEqual(['role', 'block', 'offset', 'rules'])
})
})
describe('visibleFolds', () => {
it('hides what is inside a fold that is folded', () => {
const folds = foldedSections(material, types, file)
expect(visibleFolds(folds, new Set()).map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules'])
expect(visibleFolds(folds, new Set([idOfFold(folds[2])])).map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules', '1', '2'])
})
})
@@ -0,0 +1,128 @@
import type { JsonPath, NodeSettings, SettingOption, SettingsType } from '../bridge/types'
import { isCurve } from './curves'
import { isWithin } from './nodeLayout'
import { textOf } from './settingText'
import { valueAt } from './jsonValues'
const SUMMARY_SETTINGS = 3
const SUMMARY_SEPARATOR = ' · '
const DEFAULT_NAMESPACE = 'minecraft:'
/**
* What a section is: a node's own settings, a setting written as an object, a setting written as a list of objects, or
* one element of such a list. All but the first fold.
*/
export type FoldKind = 'own' | 'group' | 'list' | 'item'
/** One object of the file whose settings the inspector shows, below the ones that hold it. */
export interface SettingsFold {
title: string
path: JsonPath
type: string
kind: FoldKind
/** 0 for a node's own sections, one more for each object it is inside. */
depth: number
/** A short reading of what it holds, shown while it is folded. */
summary: string
/** The object and member that hold a group or list, to unset it; null for the rest. */
holder: { object: JsonPath; key: string } | null
/** The settings written plainly in it, as fields; those that are folds of their own are not among them. */
options: SettingOption[]
}
function isObject(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
}
function isObjects(value: unknown): value is Record<string, unknown>[] {
return Array.isArray(value) && value.every(isObject)
}
export function idOfFold(fold: SettingsFold): string {
return JSON.stringify(fold.path)
}
/**
* The sections of one object of a node and the objects inside it, in file order, each followed by those inside it. A
* setting that is itself an object whose type the schema describes is a section of its own one level deeper, and so is
* each element of a list of objects; one that is not written stays a field.
*/
export function foldedSections(section: NodeSettings, types: Record<string, SettingsType>, values: unknown): SettingsFold[] {
const folds: SettingsFold[] = []
addFold(folds, types, values, { title: section.title, path: section.path, type: section.type, kind: 'own', depth: 0, holder: null }, new Set(section.shownAsNodes))
return folds
}
type FoldHead = Pick<SettingsFold, 'title' | 'path' | 'type' | 'kind' | 'depth' | 'holder'>
function addFold(into: SettingsFold[], types: Record<string, SettingsType>, values: unknown, head: FoldHead, shownAsNodes: Set<string>): void {
const options: SettingOption[] = []
const inside: SettingsFold[] = []
const summary: string[] = []
for (const option of types[head.type]?.options ?? []) {
if (shownAsNodes.has(option.name)) {
continue
}
const path = [...head.path, option.name]
const value = valueAt(values, path)
const holder = { object: head.path, key: option.name }
const objectType = option.kind.kind === 'object' ? option.kind.type : null
const itemType = option.kind.kind === 'list' && option.kind.element.kind === 'object' ? option.kind.element.type : null
if (objectType !== null && isObject(value) && types[objectType] !== undefined) {
addFold(inside, types, values, { title: option.name, path, type: objectType, kind: 'group', depth: head.depth + 1, holder }, new Set())
continue
}
if (itemType !== null && isObjects(value) && types[itemType] !== undefined) {
addList(inside, types, values, { option, path, itemType, count: value.length, depth: head.depth + 1, holder })
summary.push(`${option.name} ${value.length}`)
continue
}
options.push(option)
if (value !== undefined) {
summary.push(`${option.name} ${shortText(option, value)}`)
}
}
into.push({ ...head, summary: summary.slice(0, SUMMARY_SETTINGS).join(SUMMARY_SEPARATOR), options })
into.push(...inside)
}
interface ListFold {
option: SettingOption
path: JsonPath
itemType: string
count: number
depth: number
holder: { object: JsonPath; key: string }
}
function addList(into: SettingsFold[], types: Record<string, SettingsType>, values: unknown, list: ListFold): void {
into.push({
title: list.option.name,
path: list.path,
type: list.itemType,
kind: 'list',
depth: list.depth,
summary: `${list.count} ${list.count === 1 ? 'item' : 'items'}`,
holder: list.holder,
options: []
})
for (let index = 0; index < list.count; index++) {
addFold(
into,
types,
values,
{ title: String(index + 1), path: [...list.path, index], type: list.itemType, kind: 'item', depth: list.depth + 1, holder: null },
new Set()
)
}
}
function shortText(option: SettingOption, value: unknown): string {
return isCurve(value) ? 'curve' : textOf(option.kind, value).replaceAll(DEFAULT_NAMESPACE, '')
}
/** The folds shown while the ones in {@code open} are unfolded: a fold inside another that is folded is hidden. */
export function visibleFolds(folds: SettingsFold[], open: ReadonlySet<string>): SettingsFold[] {
const foldable = folds.filter((fold) => fold.kind !== 'own')
return folds.filter((fold) => !foldable.some((outer) => outer !== fold && !open.has(idOfFold(outer)) && outer.path.length < fold.path.length && isWithin(fold.path, outer.path)))
}
@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest'
import type { ValueKind } from '../bridge/types'
import { literalOf, textOf } from './settingText'
const roles: ValueKind = { kind: 'list', element: { kind: 'text', format: 'PLAIN' }, unique: false }
describe('string lists', () => {
it('read as commas and are written back quoted', () => {
expect(textOf(roles, ['wood', 'leaves'])).toBe('wood, leaves')
expect(literalOf(roles, 'wood, leaves, ')).toBe('["wood","leaves"]')
expect(literalOf(roles, ',')).toBe('[]')
})
it('keep a list typed as JSON, and show a list of anything else as JSON', () => {
expect(literalOf(roles, '["a", "b"]')).toBe('["a", "b"]')
expect(textOf(roles, [1, 2])).toBe('[1,2]')
})
})
describe('text', () => {
it('shows a string as it is and writes it quoted', () => {
const text: ValueKind = { kind: 'text', format: 'PLAIN' }
expect(textOf(text, 'wood')).toBe('wood')
expect(literalOf(text, 'wood "a"')).toBe('"wood \\"a\\""')
})
})
@@ -0,0 +1,48 @@
import type { ValueKind } from '../bridge/types'
export const NOT_SET = ''
export const LIST_SEPARATOR = ', '
/** Whether {@code kind} is a string naming something, typed as text. */
export function isText(kind: ValueKind): boolean {
return kind.kind === 'text' || kind.kind === 'reference' || kind.kind === 'resource'
}
/** Whether {@code kind} is a list of strings, such as the roles a decoration goes on, which is typed as {@code a, b}. */
export function isStringList(kind: ValueKind): boolean {
return kind.kind === 'list' && isText(kind.element)
}
function isStrings(value: unknown): value is string[] {
return Array.isArray(value) && value.every((element) => typeof element === 'string')
}
/** What the field shows for the value the file holds. */
export function textOf(kind: ValueKind, value: unknown): string {
if (value === undefined) {
return NOT_SET
}
if (isText(kind) && typeof value === 'string') {
return value
}
return isStringList(kind) && isStrings(value) ? value.join(LIST_SEPARATOR) : JSON.stringify(value)
}
/** The strings a list is typed as, each trimmed, and none left empty. */
export function itemsOf(draft: string): string[] {
return draft
.split(',')
.map((item) => item.trim())
.filter((item) => item !== '')
}
/** What the field holds as JSON to write; a list typed as {@code a, b} is written as an array unless it already is one. */
export function literalOf(kind: ValueKind, draft: string): string {
if (isText(kind)) {
return JSON.stringify(draft)
}
if (isStringList(kind) && !draft.trim().startsWith('[')) {
return JSON.stringify(itemsOf(draft))
}
return draft.trim()
}
@@ -0,0 +1,25 @@
import { describe, expect, it, vi } from 'vitest'
import { SuggestionStore } from './suggestionStore'
describe('SuggestionStore', () => {
it('asks once for a list however often it is read', async () => {
const fetch = vi.fn().mockResolvedValue(['minecraft:stone'])
const store = new SuggestionStore(fetch)
await store.load({ from: 'reference', reference: 'BLOCK' })
const again = await store.load({ from: 'reference', reference: 'BLOCK' })
expect(again).toEqual(['minecraft:stone'])
expect(fetch).toHaveBeenCalledTimes(1)
expect(fetch).toHaveBeenCalledWith({ reference: 'BLOCK' })
})
it('asks again after a list could not be read', async () => {
const fetch = vi.fn().mockRejectedValueOnce(new Error('down')).mockResolvedValue(['birch'])
const store = new SuggestionStore(fetch)
await expect(store.load({ from: 'resource', resource: 'iris:object' })).rejects.toThrow('down')
await expect(store.load({ from: 'resource', resource: 'iris:object' })).resolves.toEqual(['birch'])
expect(fetch).toHaveBeenLastCalledWith({ resource: 'iris:object' })
})
})
@@ -0,0 +1,23 @@
import { sourceKey, type ListedSource } from './suggestions'
/** What the server lists for the suggestions of a source that names platform or pack entries. */
export type SuggestionFetch = (of: { reference: string } | { resource: string }) => Promise<string[]>
/** The suggestion lists, each asked for once; a list that could not be read is asked for again next time. */
export class SuggestionStore {
private readonly lists = new Map<string, Promise<string[]>>()
constructor(private readonly fetch: SuggestionFetch) {}
load(source: ListedSource): Promise<string[]> {
const key = sourceKey(source)
const known = this.lists.get(key)
if (known !== undefined) {
return known
}
const asked = this.fetch(source.from === 'reference' ? { reference: source.reference } : { resource: source.resource })
this.lists.set(key, asked)
asked.catch(() => this.lists.delete(key))
return asked
}
}
@@ -0,0 +1,82 @@
import { describe, expect, it } from 'vitest'
import type { GraphNode, SettingOption } from '../bridge/types'
import { NO_PART } from '../bridge/types'
import { completed, matching, rolesOf, suggestionSourceOf, wordBeingTyped } from './suggestions'
function option(name: string, kind: SettingOption['kind']): SettingOption {
return { name, description: '', required: false, minimum: null, maximum: null, minItems: null, defaultValue: null, kind }
}
function node(roles: string[], children: GraphNode[] = []): GraphNode {
return {
kind: 'Stem',
title: 'Stem',
path: [],
partId: NO_PART,
roles,
settings: [],
children: children.map((child) => ({ wire: '', node: child })),
childList: null,
movable: false,
duplicable: false,
additions: []
}
}
describe('suggestionSourceOf', () => {
it('names the registry of a reference, the kind of a resource and the roles of the object', () => {
expect(suggestionSourceOf('Material', option('block', { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }))).toEqual({ from: 'reference', reference: 'BLOCK' })
expect(suggestionSourceOf('Part', option('skin', { kind: 'resource', resource: 'iris:object' }))).toEqual({ from: 'resource', resource: 'iris:object' })
})
it('takes the roles for the settings that name one', () => {
const on = option('on', { kind: 'list', element: { kind: 'text', format: 'PLAIN' }, unique: false })
expect(suggestionSourceOf('art.arcane.iris.engine.procedural.part.ProceduralDecoration', on)).toEqual({ from: 'roles' })
expect(suggestionSourceOf('art.arcane.iris.engine.procedural.part.ProceduralDecoration', option('at', { kind: 'text', format: 'PLAIN' }))).toBeNull()
})
it('takes the elements of a list of references, and nothing for free text', () => {
expect(suggestionSourceOf('Rule', option('blocks', { kind: 'list', element: { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }, unique: false }))).toEqual({ from: 'reference', reference: 'BLOCK' })
expect(suggestionSourceOf('Rule', option('note', { kind: 'text', format: 'PLAIN' }))).toBeNull()
})
})
describe('rolesOf', () => {
it('lists each role of the whole tree once, sorted', () => {
expect(rolesOf([node(['wood', 'leaves'], [node(['wood', 'bark'])]), node(['moss'])])).toEqual(['bark', 'leaves', 'moss', 'wood'])
})
})
describe('matching', () => {
const blocks = ['minecraft:oak_log', 'minecraft:birch_log', 'minecraft:oak_leaves', 'minecraft:stone']
it('puts what starts with the typed text before what holds it', () => {
expect(matching(blocks, 'minecraft:oak')).toEqual(['minecraft:oak_log', 'minecraft:oak_leaves'])
expect(matching(blocks, 'oak')).toEqual(['minecraft:oak_log', 'minecraft:oak_leaves'])
expect(matching(['a_log', 'log'], 'log')).toEqual([])
expect(matching(['a_log', 'logs'], 'log')).toEqual(['logs', 'a_log'])
})
it('suggests nothing for nothing typed or a choice that is already typed out', () => {
expect(matching(blocks, '')).toEqual([])
expect(matching(blocks, 'MINECRAFT:STONE')).toEqual([])
})
it('shows only the first few', () => {
expect(matching(Array.from({ length: 30 }, (_, index) => `block_${index}`), 'block')).toHaveLength(8)
})
})
describe('the word being typed', () => {
it('is the whole text, or for a list the item after the last comma', () => {
expect(wordBeingTyped('oak', false)).toEqual({ start: 0, typed: 'oak' })
expect(wordBeingTyped('wood, lea', true)).toEqual({ start: 6, typed: 'lea' })
expect(wordBeingTyped('wood, ', true)).toEqual({ start: 6, typed: '' })
})
it('is replaced by the choice, a list ready for its next item', () => {
expect(completed('minecraft:oa', 'minecraft:oak_log', false)).toBe('minecraft:oak_log')
expect(completed('wood, lea', 'leaves', true)).toBe('wood, leaves, ')
})
})
@@ -0,0 +1,79 @@
import type { GraphNode, SettingOption, ValueKind } from '../bridge/types'
import { LIST_SEPARATOR } from './settingText'
/** What an option may be typed as: the entries of a platform registry, the keys of the pack's resources of a kind, or the roles of the object. */
export type SuggestionSource = { from: 'reference'; reference: string } | { from: 'resource'; resource: string } | { from: 'roles' }
/** Settings that name a role of the object being edited, by the schema type and option (ProceduralPart, ProceduralMaterial and ProceduralDecoration). */
const ROLE_OPTIONS: ReadonlySet<string> = new Set([
'art.arcane.iris.engine.procedural.part.ProceduralPart.role',
'art.arcane.iris.engine.procedural.part.ProceduralMaterial.role',
'art.arcane.iris.engine.procedural.part.ProceduralDecoration.on'
])
/** A source the server lists, as opposed to the roles, which the studio reads from the nodes. */
export type ListedSource = Exclude<SuggestionSource, { from: 'roles' }>
const MOST_SHOWN = 8
/** Where the suggestions for {@code option} of the schema type {@code type} come from; null when it is typed freely. */
export function suggestionSourceOf(type: string, option: SettingOption): SuggestionSource | null {
if (ROLE_OPTIONS.has(`${type}.${option.name}`)) {
return { from: 'roles' }
}
const kind: ValueKind = option.kind.kind === 'list' ? option.kind.element : option.kind
if (kind.kind === 'reference') {
return { from: 'reference', reference: kind.reference }
}
return kind.kind === 'resource' ? { from: 'resource', resource: kind.resource } : null
}
export function sourceKey(source: ListedSource): string {
return source.from === 'reference' ? `reference:${source.reference}` : `resource:${source.resource}`
}
/** Every role the nodes place or decorate, once each and sorted. */
export function rolesOf(roots: GraphNode[]): string[] {
const roles = new Set<string>()
const visit = (node: GraphNode): void => {
node.roles.forEach((role) => roles.add(role))
node.children.forEach((link) => visit(link.node))
}
roots.forEach(visit)
return [...roles].sort()
}
/** The word being typed: from where it starts in {@code draft}, with what is typed of it. For a list that is the item after the last comma. */
export function wordBeingTyped(draft: string, isList: boolean): { start: number; typed: string } {
const start = isList ? draft.lastIndexOf(',') + 1 : 0
const typed = draft.slice(start)
return { start: start + (typed.length - typed.trimStart().length), typed: typed.trim() }
}
/** The choices that hold what is typed, those that start with it first; none while nothing is typed or it is already a choice. */
export function matching(choices: readonly string[], typed: string): string[] {
const wanted = typed.toLowerCase()
if (wanted === '') {
return []
}
const starting: string[] = []
const containing: string[] = []
for (const choice of choices) {
const lower = choice.toLowerCase()
if (lower === wanted) {
return []
}
if (lower.startsWith(wanted)) {
starting.push(choice)
} else if (lower.includes(wanted)) {
containing.push(choice)
}
}
return [...starting, ...containing].slice(0, MOST_SHOWN)
}
/** The draft with the word being typed replaced by {@code choice}; a list gets its separator ready for the next item. */
export function completed(draft: string, choice: string, isList: boolean): string {
const { start } = wordBeingTyped(draft, isList)
return draft.slice(0, start) + choice + (isList ? LIST_SEPARATOR : '')
}
@@ -0,0 +1,122 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import { BridgeError, STATUS_CONFLICT, type BridgeClient } from '../bridge/BridgeClient'
import type { EditorState, GraphEdit } from '../bridge/types'
import { EditHistory } from './EditHistory'
export interface NodeEditor {
/** The entry's file as it is now; null while it is read. */
state: EditorState | null
saving: boolean
canUndo: boolean
canRedo: boolean
edit(edit: GraphEdit): void
undo(): void
redo(): void
}
/**
* Reads an entry's file as nodes and edits it. Edits are sent one after another, each on the text the one before left,
* so quick edits never refuse each other; one refused because the file changed elsewhere reads the file again.
*/
export function useNodeEditor(client: BridgeClient, viewId: string, key: string | null, packRevision: number, tell: (message: string) => void): NodeEditor {
const [state, setState] = useState<EditorState | null>(null)
const [saving, setSaving] = useState(false)
const [, setHistoryChanges] = useState(0)
const history = useRef(new EditHistory())
const shown = useRef<EditorState | null>(null)
const queue = useRef<Promise<void>>(Promise.resolve())
const entry = useRef({ viewId, key })
const run = useCallback(
(task: (current: EditorState | null) => Promise<EditorState | null>): void => {
const asked = entry.current
queue.current = queue.current.then(async () => {
if (entry.current !== asked) {
return
}
setSaving(true)
try {
const next = await task(shown.current)
if (entry.current === asked && next !== null) {
shown.current = next
setState(next)
}
} catch (failure) {
if (entry.current !== asked) {
return
}
tell((failure as Error).message)
if (failure instanceof BridgeError && failure.status === STATUS_CONFLICT && asked.key !== null) {
const reread = await client.sceneFile(asked.viewId, asked.key).catch(() => null)
if (reread !== null && entry.current === asked) {
shown.current = reread
setState(reread)
}
}
} finally {
setSaving(false)
setHistoryChanges((changes) => changes + 1)
}
})
},
[client, tell]
)
useEffect(() => {
entry.current = { viewId, key }
history.current = new EditHistory()
shown.current = null
setState(null)
}, [viewId, key])
useEffect(() => {
if (key !== null) {
run(() => client.sceneFile(viewId, key))
}
}, [client, viewId, key, packRevision, run])
const edit = useCallback(
(change: GraphEdit) =>
run(async (current) => {
if (current === null || key === null) {
return null
}
const next = await client.sceneEdit(viewId, key, current.revision, change)
if (next.text !== current.text) {
history.current.edited(current.text)
}
return next
}),
[client, viewId, key, run]
)
const undo = useCallback(
() =>
run(async (current) => {
const earlier = history.current.nextUndo()
if (current === null || key === null || earlier === undefined) {
return null
}
const next = await client.sceneWrite(viewId, key, current.revision, earlier)
history.current.undone(current.text)
return next
}),
[client, viewId, key, run]
)
const redo = useCallback(
() =>
run(async (current) => {
const later = history.current.nextRedo()
if (current === null || key === null || later === undefined) {
return null
}
const next = await client.sceneWrite(viewId, key, current.revision, later)
history.current.redone(current.text)
return next
}),
[client, viewId, key, run]
)
return { state, saving, canUndo: history.current.canUndo, canRedo: history.current.canRedo, edit, undo, redo }
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference types="vite/client" />
import type { StudioHost } from '../../shared/bridge'
declare global {
interface Window {
studio: StudioHost
}
}
export {}
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+6
View File
@@ -0,0 +1,6 @@
The icons in this folder and its subfolders come from the IntelliJ Platform (https://github.com/JetBrains/intellij-community),
platform/icons/src/expui, Copyright 2000-2023 JetBrains s.r.o. and contributors,
used under the Apache License 2.0 (LICENSE-APACHE-2.0.txt).
memory.svg is profileMemory.svg with its profiling badge removed.
theme.svg, blocks.svg, borders.svg, shading.svg, mob.svg, actualZoom.svg, decoration.svg, and in views/ biomes.svg, regions.svg,
world-3d.svg, saved-world.svg, noise.svg and objects.svg are the studio's own, drawn to match.
@@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="7.75" cy="6.5" r="0.75" fill="#6C707E"/>
<circle cx="7.75" cy="10.5" r="0.75" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 323 B

@@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="7.75" cy="6.5" r="0.75" fill="#CED0D6"/>
<circle cx="7.75" cy="10.5" r="0.75" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 323 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 1C7.77614 1 8 1.22386 8 1.5V7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H8V13.5C8 13.7761 7.77614 14 7.5 14C7.22386 14 7 13.7761 7 13.5V8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H7V1.5C7 1.22386 7.22386 1 7.5 1Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 1C7.77614 1 8 1.22386 8 1.5V7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H8V13.5C8 13.7761 7.77614 14 7.5 14C7.22386 14 7 13.7761 7 13.5V8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H7V1.5C7 1.22386 7.22386 1 7.5 1Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

+4
View File
@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 1.5L13.5 4.5V11.5L8 14.5L2.5 11.5V4.5L8 1.5Z" stroke="#6C707E" stroke-linejoin="round"/>
<path d="M2.5 4.5L8 7.5L13.5 4.5M8 7.5V14.5" stroke="#6C707E" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 292 B

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 1.5L13.5 4.5V11.5L8 14.5L2.5 11.5V4.5L8 1.5Z" stroke="#CED0D6" stroke-linejoin="round"/>
<path d="M2.5 4.5L8 7.5L13.5 4.5M8 7.5V14.5" stroke="#CED0D6" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 292 B

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#6C707E" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 362 B

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#CED0D6" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 362 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 8.25L6 11.75L13.5 4.25" stroke="#6C707E" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 353 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 8.25L6 11.75L13.5 4.25" stroke="#CED0D6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 353 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 11.5L6 8L9.5 4.5" stroke="#969AAB" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 11.5L6 8L9.5 4.5" stroke="#B4B8BF" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 304 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 11.5L9.5 8L6 4.5" stroke="#818594" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 302 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 11.5L9.5 8L6 4.5" stroke="#B4B8BF" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 302 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4939 4.48784C11.3002 4.28007 10.9724 4.27548 10.7729 4.47775L8.00074 7.28849L5.22871 4.47788C5.02922 4.27561 4.70143 4.2802 4.50768 4.48797C4.32506 4.68382 4.32933 4.98882 4.51736 5.17947L7.29908 7.99991L4.51756 10.8201C4.32953 11.0108 4.32526 11.3158 4.50788 11.5116C4.70163 11.7194 5.02942 11.724 5.22892 11.5217L8.00074 8.71133L10.7727 11.5219C10.9722 11.7241 11.3 11.7196 11.4937 11.5118C11.6764 11.3159 11.6721 11.0109 11.484 10.8203L8.7024 7.99991L11.4843 5.17934C11.6723 4.98869 11.6766 4.68368 11.4939 4.48784Z" fill="#A8ADBD"/>
</svg>

After

Width:  |  Height:  |  Size: 820 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4939 4.48784C11.3002 4.28007 10.9724 4.27548 10.7729 4.47775L8.00074 7.28849L5.22871 4.47788C5.02922 4.27561 4.70143 4.2802 4.50768 4.48797C4.32506 4.68382 4.32933 4.98882 4.51736 5.17947L7.29908 7.99991L4.51756 10.8201C4.32953 11.0108 4.32526 11.3158 4.50788 11.5116C4.70163 11.7194 5.02942 11.724 5.22892 11.5217L8.00074 8.71133L10.7727 11.5219C10.9722 11.7241 11.3 11.7196 11.4937 11.5118C11.6764 11.3159 11.6721 11.0109 11.484 10.8203L8.7024 7.99991L11.4843 5.17934C11.6723 4.98869 11.6766 4.68368 11.4939 4.48784Z" fill="#6F737A"/>
</svg>

After

Width:  |  Height:  |  Size: 820 B

@@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 14.5V8" stroke="#6C707E" stroke-linecap="round"/>
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#6C707E" stroke-linejoin="round"/>
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#6C707E" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

@@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 14.5V8" stroke="#CED0D6" stroke-linecap="round"/>
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#CED0D6" stroke-linejoin="round"/>
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#CED0D6" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2H9C9.55228 2 10 2.44772 10 3H6C6 2.44772 6.44772 2 7 2ZM5 3C5 1.89543 5.89543 1 7 1H9C10.1046 1 11 1.89543 11 3H13C13.5523 3 14 3.44772 14 4V5V6H13V13C13 14.1046 12.1046 15 11 15H5C3.89543 15 3 14.1046 3 13V6H2V5V4C2 3.44772 2.44772 3 3 3H5ZM11 4H10H6H5H3V5H4H12H13V4H11ZM4 6H12V13C12 13.5523 11.5523 14 11 14H5C4.44772 14 4 13.5523 4 13V6ZM6.5 7C6.22386 7 6 7.22386 6 7.5V11.5C6 11.7761 6.22386 12 6.5 12C6.77614 12 7 11.7761 7 11.5V7.5C7 7.22386 6.77614 7 6.5 7ZM9 7.5C9 7.22386 9.22386 7 9.5 7C9.77614 7 10 7.22386 10 7.5V11.5C10 11.7761 9.77614 12 9.5 12C9.22386 12 9 11.7761 9 11.5V7.5Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 893 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2H9C9.55228 2 10 2.44772 10 3H6C6 2.44772 6.44772 2 7 2ZM5 3C5 1.89543 5.89543 1 7 1H9C10.1046 1 11 1.89543 11 3H13C13.5523 3 14 3.44772 14 4V5V6H13V13C13 14.1046 12.1046 15 11 15H5C3.89543 15 3 14.1046 3 13V6H2V5V4C2 3.44772 2.44772 3 3 3H5ZM11 4H10H6H5H3V5H4H12H13V4H11ZM4 6H12V13C12 13.5523 11.5523 14 11 14H5C4.44772 14 4 13.5523 4 13V6ZM6.5 7C6.22386 7 6 7.22386 6 7.5V11.5C6 11.7761 6.22386 12 6.5 12C6.77614 12 7 11.7761 7 11.5V7.5C7 7.22386 6.77614 7 6.5 7ZM9 7.5C9 7.22386 9.22386 7 9.5 7C9.77614 7 10 7.22386 10 7.5V11.5C10 11.7761 9.77614 12 9.5 12C9.22386 12 9 11.7761 9 11.5V7.5Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 893 B

+5
View File
@@ -0,0 +1,5 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H6C5.44772 14 5 13.5523 5 13V10H4V13C4 14.1046 4.89543 15 6 15H13C14.1046 15 15 14.1046 15 13V3C15 1.89543 14.1046 1 13 1H6C4.89543 1 4 1.89543 4 3V6H5V3C5 2.44772 5.44772 2 6 2Z" fill="#6C707E"/>
<path d="M2.5 8H11M11 8L8.5 5.5M11 8L8.5 10.5" stroke="#DB3B4B" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 653 B

@@ -0,0 +1,12 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2414_33890)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H6C5.44772 14 5 13.5523 5 13V10H4V13C4 14.1046 4.89543 15 6 15H13C14.1046 15 15 14.1046 15 13V3C15 1.89543 14.1046 1 13 1H6C4.89543 1 4 1.89543 4 3V6H5V3C5 2.44772 5.44772 2 6 2Z" fill="#CED0D6"/>
<path d="M2.5 8H11M11 8L8.5 5.5M11 8L8.5 10.5" stroke="#DB5C5C" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_2414_33890">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 801 B

+7
View File
@@ -0,0 +1,7 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="11" y="2" width="1" height="12" rx="0.5" fill="#6C707E"/>
<rect x="14" y="11" width="1" height="12" rx="0.5" transform="rotate(90 14 11)" fill="#6C707E"/>
<rect x="4" y="2" width="1" height="12" rx="0.5" fill="#6C707E"/>
<rect x="14" y="4" width="1" height="12" rx="0.5" transform="rotate(90 14 4)" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 555 B

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="11" y="2" width="1" height="12" rx="0.5" fill="#CED0D6"/>
<rect x="14" y="11" width="1" height="12" rx="0.5" transform="rotate(90 14 11)" fill="#CED0D6"/>
<rect x="4" y="2" width="1" height="12" rx="0.5" fill="#CED0D6"/>
<rect x="14" y="4" width="1" height="12" rx="0.5" transform="rotate(90 14 4)" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 555 B

+7
View File
@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 514 B

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 514 B

+5
View File
@@ -0,0 +1,5 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.79995" cy="14.15" r="0.85" fill="#6C707E"/>
<path d="M7.97962 8.25128C8.20415 8.01392 8.49793 7.73622 8.8602 7.41844C9.23243 7.09036 9.52729 6.80791 9.74572 6.57075L9.74668 6.56973C9.96622 6.33799 10.1503 6.0594 10.2982 5.73275L10.2988 5.73133C10.45 5.4108 10.5268 5.0457 10.5268 4.634C10.5268 4.13537 10.4222 3.69607 10.2158 3.31349C10.0093 2.93099 9.71876 2.63442 9.34261 2.42208L9.34155 2.42149C8.96585 2.20334 8.53389 2.093 8.04277 2.093C7.53263 2.093 7.08144 2.20651 6.68653 2.43124C6.29797 2.65595 5.9944 2.97134 5.77499 3.3796C5.67273 3.57247 5.59473 3.77918 5.54126 4C5.51644 4.10252 5.49691 4.20808 5.48269 4.31671C5.44318 4.61868 5.20739 4.867 4.90285 4.867H4.77896C4.47828 4.867 4.23781 4.61717 4.24929 4.31671C4.25956 4.2093 4.27359 4.10373 4.2914 4C4.36501 3.57119 4.50313 3.17391 4.7064 2.80885C5.03226 2.23534 5.4864 1.7906 6.06642 1.47769C6.64663 1.15834 7.30949 1 8.05227 1C8.77568 1 9.4194 1.15185 9.98062 1.45842C10.5475 1.75827 10.9888 2.17975 11.3023 2.72194C11.6162 3.26467 11.7718 3.88719 11.7718 4.5865C11.7718 5.13576 11.6813 5.62465 11.4976 6.05106C11.3166 6.47121 11.0924 6.82638 10.8239 7.11469C10.567 7.39722 10.2283 7.71973 9.80882 8.08202C9.47419 8.37245 9.2138 8.61414 9.02667 8.8075C8.85057 8.98968 8.70116 9.20284 8.57871 9.44772L8.57826 9.44864C8.4595 9.6802 8.39927 9.93983 8.39927 10.2295C8.39927 10.4946 8.18437 10.7095 7.91927 10.7095H7.71977C7.42844 10.7095 7.19227 10.4733 7.19227 10.182C7.19227 9.77678 7.26749 9.41044 7.42025 9.08501C7.57001 8.76595 7.75635 8.48769 7.97962 8.25128Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,5 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.79995" cy="14.15" r="0.85" fill="#CED0D6"/>
<path d="M7.97962 8.25128C8.20415 8.01392 8.49793 7.73622 8.8602 7.41844C9.23243 7.09036 9.52729 6.80791 9.74572 6.57075L9.74668 6.56973C9.96622 6.33799 10.1503 6.0594 10.2982 5.73275L10.2988 5.73133C10.45 5.4108 10.5268 5.0457 10.5268 4.634C10.5268 4.13537 10.4222 3.69607 10.2158 3.31349C10.0093 2.93099 9.71876 2.63442 9.34261 2.42208L9.34155 2.42149C8.96585 2.20334 8.53389 2.093 8.04277 2.093C7.53263 2.093 7.08144 2.20651 6.68653 2.43124C6.29797 2.65595 5.9944 2.97134 5.77499 3.3796C5.67273 3.57247 5.59473 3.77918 5.54126 4C5.51644 4.10252 5.49691 4.20808 5.48269 4.31671C5.44318 4.61868 5.20739 4.867 4.90285 4.867H4.77896C4.47828 4.867 4.23781 4.61717 4.24929 4.31671C4.25956 4.2093 4.27359 4.10373 4.2914 4C4.36501 3.57119 4.50313 3.17391 4.7064 2.80885C5.03226 2.23534 5.4864 1.7906 6.06642 1.47769C6.64663 1.15834 7.30949 1 8.05227 1C8.77568 1 9.4194 1.15185 9.98062 1.45842C10.5475 1.75827 10.9888 2.17975 11.3023 2.72194C11.6162 3.26467 11.7718 3.88719 11.7718 4.5865C11.7718 5.13576 11.6813 5.62465 11.4976 6.05106C11.3166 6.47121 11.0924 6.82638 10.8239 7.11469C10.567 7.39722 10.2283 7.71973 9.80882 8.08202C9.47419 8.37245 9.2138 8.61414 9.02667 8.8075C8.85057 8.98968 8.70116 9.20284 8.57871 9.44772L8.57826 9.44864C8.4595 9.6802 8.39927 9.93983 8.39927 10.2295C8.39927 10.4946 8.18437 10.7095 7.91927 10.7095H7.71977C7.42844 10.7095 7.19227 10.4733 7.19227 10.182C7.19227 9.77678 7.26749 9.41044 7.42025 9.08501C7.57001 8.76595 7.75635 8.48769 7.97962 8.25128Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.24408 6.65516C8.05415 6.43616 7.96859 6.14552 8.00959 5.85854L8.50238 2.40901L3.10978 8.99996H6.99954C7.28943 8.99996 7.56505 9.12576 7.75499 9.34476C7.94493 9.56376 8.03048 9.85441 7.98949 10.1414L7.4967 13.5909L12.8893 6.99996H8.99954C8.70965 6.99996 8.43402 6.87416 8.24408 6.65516ZM9.74593 0.775195C9.81752 0.274069 9.18453 -0.00392066 8.86398 0.387867L1.66768 9.18334C1.40057 9.50981 1.63285 9.99996 2.05466 9.99996H6.99954L6.25314 15.2247C6.18155 15.7259 6.81454 16.0038 7.1351 15.6121L14.3314 6.81658C14.5985 6.49012 14.3662 5.99996 13.9444 5.99996H8.99954L9.74593 0.775195Z" fill="#E66D17"/>
</svg>

After

Width:  |  Height:  |  Size: 882 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.24408 6.65516C8.05415 6.43616 7.96859 6.14552 8.00959 5.85854L8.50238 2.40901L3.10978 8.99996H6.99954C7.28943 8.99996 7.56505 9.12576 7.75499 9.34476C7.94493 9.56376 8.03048 9.85441 7.98949 10.1414L7.4967 13.5909L12.8893 6.99996H8.99954C8.70965 6.99996 8.43402 6.87416 8.24408 6.65516ZM9.74593 0.775195C9.81752 0.274069 9.18453 -0.00392066 8.86398 0.387867L1.66768 9.18334C1.40057 9.50981 1.63285 9.99996 2.05466 9.99996H6.99954L6.25314 15.2247C6.18155 15.7259 6.81454 16.0038 7.1351 15.6121L14.3314 6.81658C14.5985 6.49012 14.3662 5.99996 13.9444 5.99996H8.99954L9.74593 0.775195Z" fill="#C77D55"/>
</svg>

After

Width:  |  Height:  |  Size: 882 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 5V2.02054C11.4149 2.26101 13.739 4.5851 13.9795 7.5H11C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H13.9795C13.739 11.4149 11.4149 13.739 8.5 13.9795V11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11V13.9795C4.5851 13.739 2.26101 11.4149 2.02054 8.5H5C5.27614 8.5 5.5 8.27614 5.5 8C5.5 7.72386 5.27614 7.5 5 7.5H2.02054C2.26101 4.5851 4.5851 2.26101 7.5 2.02054V5C7.5 5.27614 7.72386 5.5 8 5.5C8.27614 5.5 8.5 5.27614 8.5 5ZM1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 866 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 5V2.02054C11.4149 2.26101 13.739 4.5851 13.9795 7.5H11C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H13.9795C13.739 11.4149 11.4149 13.739 8.5 13.9795V11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11V13.9795C4.5851 13.739 2.26101 11.4149 2.02054 8.5H5C5.27614 8.5 5.5 8.27614 5.5 8C5.5 7.72386 5.27614 7.5 5 7.5H2.02054C2.26101 4.5851 4.5851 2.26101 7.5 2.02054V5C7.5 5.27614 7.72386 5.5 8 5.5C8.27614 5.5 8.5 5.27614 8.5 5ZM1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 866 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5C5 3.34315 6.34315 2 8 2C9.65685 2 11 3.34315 11 5V6C12.1046 6 13 6.89543 13 8V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V8C3 6.89543 3.89543 6 5 6V5ZM10 5V6H6V5C6 3.89543 6.89543 3 8 3C9.10457 3 10 3.89543 10 5ZM5 7C4.44772 7 4 7.44772 4 8V12C4 12.5523 4.44772 13 5 13H11C11.5523 13 12 12.5523 12 12V8C12 7.44772 11.5523 7 11 7H5ZM8 8.5C7.72386 8.5 7.5 8.72386 7.5 9V11C7.5 11.2761 7.72386 11.5 8 11.5C8.27614 11.5 8.5 11.2761 8.5 11V9C8.5 8.72386 8.27614 8.5 8 8.5Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 785 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5C5 3.34315 6.34315 2 8 2C9.65685 2 11 3.34315 11 5V6C12.1046 6 13 6.89543 13 8V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V8C3 6.89543 3.89543 6 5 6V5ZM10 5V6H6V5C6 3.89543 6.89543 3 8 3C9.10457 3 10 3.89543 10 5ZM5 7C4.44772 7 4 7.44772 4 8V12C4 12.5523 4.44772 13 5 13H11C11.5523 13 12 12.5523 12 12V8C12 7.44772 11.5523 7 11 7H5ZM8 8.5C7.72386 8.5 7.5 8.72386 7.5 9V11C7.5 11.2761 7.72386 11.5 8 11.5C8.27614 11.5 8.5 11.2761 8.5 11V9C8.5 8.72386 8.27614 8.5 8 8.5Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 785 B

+7
View File
@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- expui/actions/profileMemory.svg without its profiling badge, its pins mirrored onto the side the badge covered. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2C4.89543 2 4 2.89543 4 4V12C4 13.1046 4.89543 14 6 14H10C11.1046 14 12 13.1046 12 12V4C12 2.89543 11.1046 2 10 2H6ZM6 3C5.44772 3 5 3.44772 5 4V12C5 12.5523 5.44772 13 6 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H6Z" fill="#6C707E"/>
<path d="M1.5 4C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H4V4H1.5ZM1.5 7.5C1.22386 7.5 1 7.72386 1 8C1 8.27614 1.22386 8.5 1.5 8.5H4V7.5H1.5ZM1.5 11C1.22386 11 1 11.2239 1 11.5C1 11.7761 1.22386 12 1.5 12H4V11H1.5Z" fill="#6C707E"/>
<path d="M14.5 4C14.7761 4 15 4.22386 15 4.5C15 4.77614 14.7761 5 14.5 5H12V4H14.5ZM14.5 7.5C14.7761 7.5 15 7.72386 15 8C15 8.27614 14.7761 8.5 14.5 8.5H12V7.5H14.5ZM14.5 11C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12H12V11H14.5Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- memory.svg in expui's dark colour. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2C4.89543 2 4 2.89543 4 4V12C4 13.1046 4.89543 14 6 14H10C11.1046 14 12 13.1046 12 12V4C12 2.89543 11.1046 2 10 2H6ZM6 3C5.44772 3 5 3.44772 5 4V12C5 12.5523 5.44772 13 6 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H6Z" fill="#CED0D6"/>
<path d="M1.5 4C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H4V4H1.5ZM1.5 7.5C1.22386 7.5 1 7.72386 1 8C1 8.27614 1.22386 8.5 1.5 8.5H4V7.5H1.5ZM1.5 11C1.22386 11 1 11.2239 1 11.5C1 11.7761 1.22386 12 1.5 12H4V11H1.5Z" fill="#CED0D6"/>
<path d="M14.5 4C14.7761 4 15 4.22386 15 4.5C15 4.77614 14.7761 5 14.5 5H12V4H14.5ZM14.5 7.5C14.7761 7.5 15 7.72386 15 8C15 8.27614 14.7761 8.5 14.5 8.5H12V7.5H14.5ZM14.5 11C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12H12V11H14.5Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+6
View File
@@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#6C707E"/>
<rect x="5" y="6" width="2" height="2" fill="#6C707E"/>
<rect x="9" y="6" width="2" height="2" fill="#6C707E"/>
<rect x="6" y="10" width="4" height="1" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 345 B

@@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#CED0D6"/>
<rect x="5" y="6" width="2" height="2" fill="#CED0D6"/>
<rect x="9" y="6" width="2" height="2" fill="#CED0D6"/>
<rect x="6" y="10" width="4" height="1" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 345 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 10.5C1 10.7761 1.22386 11 1.5 11C1.77614 11 2 10.7761 2 10.5H1ZM13.6263 10.3322C13.8098 10.5386 14.1258 10.5572 14.3322 10.3737C14.5386 10.1902 14.5572 9.87421 14.3737 9.66782L13.6263 10.3322ZM11.5 9.99999C11.2239 9.99999 11 10.2238 11 10.5C11 10.7761 11.2239 11 11.5 11V9.99999ZM14.5 10.5V11H15V10.5H14.5ZM15 7.49999C15 7.22385 14.7761 6.99999 14.5 6.99999C14.2239 6.99999 14 7.22385 14 7.49999H15ZM1.5 10.5C2 10.5 2 10.5002 2 10.5004C2 10.5005 2 10.5007 2 10.5008C2 10.5009 2 10.501 2 10.5011C2 10.5011 2 10.5009 2 10.5003C2.00001 10.4993 2.00003 10.4971 2.00009 10.4937C2.0002 10.487 2.00043 10.4759 2.00094 10.4605C2.00197 10.4298 2.00409 10.3824 2.00849 10.3208C2.01731 10.1974 2.03519 10.0178 2.07132 9.80095C2.14399 9.36495 2.28839 8.79125 2.57221 8.22361C2.85506 7.65792 3.27147 7.10745 3.88673 6.69728C4.49885 6.28919 5.33749 6 6.5 6V5C5.16251 5 4.12615 5.33581 3.33203 5.86522C2.54103 6.39255 2.01994 7.09208 1.67779 7.77639C1.33661 8.45875 1.16851 9.13505 1.08493 9.63655C1.04294 9.88848 1.02175 10.0995 1.01104 10.2495C1.00567 10.3246 1.00292 10.3847 1.0015 10.4272C1.00079 10.4485 1.00041 10.4654 1.00022 10.4776C1.00012 10.4837 1.00006 10.4887 1.00003 10.4924C1.00002 10.4943 1.00001 10.4959 1.00001 10.4971C1 10.4978 1 10.4983 1 10.4988C1 10.499 1 10.4993 1 10.4995C1 10.4997 1 10.5 1.5 10.5ZM6.5 6C8.06824 6 9.82619 7.02606 11.2543 8.14375C11.9546 8.69176 12.5497 9.24102 12.97 9.65366C13.1799 9.85969 13.3454 10.0309 13.4578 10.15C13.514 10.2094 13.5568 10.2558 13.5853 10.287C13.5995 10.3025 13.6102 10.3142 13.617 10.3219C13.6205 10.3257 13.623 10.3285 13.6245 10.3302C13.6253 10.3311 13.6258 10.3317 13.6261 10.332C13.6263 10.3322 13.6264 10.3323 13.6264 10.3323C13.6264 10.3323 13.6264 10.3323 13.6264 10.3323C13.6264 10.3322 13.6263 10.3322 14 10C14.3737 9.66782 14.3736 9.66772 14.3735 9.66761C14.3735 9.66755 14.3733 9.66742 14.3732 9.66729C14.373 9.66705 14.3727 9.66674 14.3724 9.66636C14.3717 9.6656 14.3708 9.66457 14.3696 9.66327C14.3673 9.66068 14.364 9.65701 14.3598 9.65231C14.3513 9.64292 14.3391 9.62938 14.3231 9.61197C14.2913 9.57717 14.2448 9.52688 14.1848 9.46333C14.0648 9.33626 13.8904 9.15594 13.6706 8.94009C13.2315 8.50898 12.6079 7.93324 11.8707 7.35625C10.4238 6.22394 8.43176 5 6.5 5V6ZM11.5 11H14.5V9.99999H11.5V11ZM15 10.5V7.49999H14V10.5H15Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 10.5C1 10.7761 1.22386 11 1.5 11C1.77614 11 2 10.7761 2 10.5H1ZM13.6263 10.3322C13.8098 10.5386 14.1258 10.5572 14.3322 10.3737C14.5386 10.1902 14.5572 9.87421 14.3737 9.66782L13.6263 10.3322ZM11.5 9.99999C11.2239 9.99999 11 10.2238 11 10.5C11 10.7761 11.2239 11 11.5 11V9.99999ZM14.5 10.5V11H15V10.5H14.5ZM15 7.49999C15 7.22385 14.7761 6.99999 14.5 6.99999C14.2239 6.99999 14 7.22385 14 7.49999H15ZM1.5 10.5C2 10.5 2 10.5002 2 10.5004C2 10.5005 2 10.5007 2 10.5008C2 10.5009 2 10.501 2 10.5011C2 10.5011 2 10.5009 2 10.5003C2.00001 10.4993 2.00003 10.4971 2.00009 10.4937C2.0002 10.487 2.00043 10.4759 2.00094 10.4605C2.00197 10.4298 2.00409 10.3824 2.00849 10.3208C2.01731 10.1974 2.03519 10.0178 2.07132 9.80095C2.14399 9.36495 2.28839 8.79125 2.57221 8.22361C2.85506 7.65792 3.27147 7.10745 3.88673 6.69728C4.49885 6.28919 5.33749 6 6.5 6V5C5.16251 5 4.12615 5.33581 3.33203 5.86522C2.54103 6.39255 2.01994 7.09208 1.67779 7.77639C1.33661 8.45875 1.16851 9.13505 1.08493 9.63655C1.04294 9.88848 1.02175 10.0995 1.01104 10.2495C1.00567 10.3246 1.00292 10.3847 1.0015 10.4272C1.00079 10.4485 1.00041 10.4654 1.00022 10.4776C1.00012 10.4837 1.00006 10.4887 1.00003 10.4924C1.00002 10.4943 1.00001 10.4959 1.00001 10.4971C1 10.4978 1 10.4983 1 10.4988C1 10.499 1 10.4993 1 10.4995C1 10.4997 1 10.5 1.5 10.5ZM6.5 6C8.06824 6 9.82619 7.02606 11.2543 8.14375C11.9546 8.69176 12.5497 9.24102 12.97 9.65366C13.1799 9.85969 13.3454 10.0309 13.4578 10.15C13.514 10.2094 13.5568 10.2558 13.5853 10.287C13.5995 10.3025 13.6102 10.3142 13.617 10.3219C13.6205 10.3257 13.623 10.3285 13.6245 10.3302C13.6253 10.3311 13.6258 10.3317 13.6261 10.332C13.6263 10.3322 13.6264 10.3323 13.6264 10.3323C13.6264 10.3323 13.6264 10.3323 13.6264 10.3323C13.6264 10.3322 13.6263 10.3322 14 10C14.3737 9.66782 14.3736 9.66772 14.3735 9.66761C14.3735 9.66755 14.3733 9.66742 14.3732 9.66729C14.373 9.66705 14.3727 9.66674 14.3724 9.66636C14.3717 9.6656 14.3708 9.66457 14.3696 9.66327C14.3673 9.66068 14.364 9.65701 14.3598 9.65231C14.3513 9.64292 14.3391 9.62938 14.3231 9.61197C14.2913 9.57717 14.2448 9.52688 14.1848 9.46333C14.0648 9.33626 13.8904 9.15594 13.6706 8.94009C13.2315 8.50898 12.6079 7.93324 11.8707 7.35625C10.4238 6.22394 8.43176 5 6.5 5V6ZM11.5 11H14.5V9.99999H11.5V11ZM15 10.5V7.49999H14V10.5H15Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 9V8C2.5 4.96243 4.96243 2.5 8 2.5C9.10679 2.5 10.1372 2.82692 11 3.38947" stroke="#6C707E" stroke-linecap="round"/>
<path d="M5 12.6105C5.86278 13.1731 6.89321 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8V7" stroke="#6C707E" stroke-linecap="round"/>
<path d="M0.49997 7.50027L2.5 9.5L4.49998 7.50023" stroke="#6C707E" stroke-linecap="round"/>
<path d="M11.5 8.49982L13.5 6.5L15.5 8.49982" stroke="#6C707E" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 675 B

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.5 9V8C2.5 4.96243 4.96243 2.5 8 2.5C9.10679 2.5 10.1372 2.82692 11 3.38947" stroke="#CED0D6" stroke-linecap="round"/>
<path d="M5 12.6105C5.86278 13.1731 6.89321 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8V7" stroke="#CED0D6" stroke-linecap="round"/>
<path d="M0.49997 7.50027L2.5 9.5L4.49998 7.50023" stroke="#CED0D6" stroke-linecap="round"/>
<path d="M11.5 8.49982L13.5 6.5L15.5 8.49982" stroke="#CED0D6" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 675 B

+4
View File
@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.85363 2.35355C6.04889 2.15829 6.04889 1.84171 5.85363 1.64645C5.65837 1.45118 5.34178 1.45118 5.14652 1.64645L1.64652 5.14645L1.29297 5.5L1.64652 5.85355L5.14652 9.35355C5.34178 9.54882 5.65837 9.54882 5.85363 9.35355C6.04889 9.15829 6.04889 8.84171 5.85363 8.64645L3.20718 6H10.5001C12.4331 6 14.0001 7.567 14.0001 9.5C14.0001 11.433 12.4331 13 10.5001 13H5.50008C5.22393 13 5.00008 13.2239 5.00008 13.5C5.00008 13.7761 5.22393 14 5.50008 14H10.5001C12.9854 14 15.0001 11.9853 15.0001 9.5C15.0001 7.01472 12.9854 5 10.5001 5H3.20718L5.85363 2.35355Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 851 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.85363 2.35355C6.04889 2.15829 6.04889 1.84171 5.85363 1.64645C5.65837 1.45118 5.34178 1.45118 5.14652 1.64645L1.64652 5.14645L1.29297 5.5L1.64652 5.85355L5.14652 9.35355C5.34178 9.54882 5.65837 9.54882 5.85363 9.35355C6.04889 9.15829 6.04889 8.84171 5.85363 8.64645L3.20718 6H10.5001C12.4331 6 14.0001 7.567 14.0001 9.5C14.0001 11.433 12.4331 13 10.5001 13H5.50008C5.22393 13 5.00008 13.2239 5.00008 13.5C5.00008 13.7761 5.22393 14 5.50008 14H10.5001C12.9854 14 15.0001 11.9853 15.0001 9.5C15.0001 7.01472 12.9854 5 10.5001 5H3.20718L5.85363 2.35355Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 851 B

+5
View File
@@ -0,0 +1,5 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7" cy="7" r="4.5" stroke="#6C707E"/>
<path d="M10.1992 10.2002L13.4992 13.4961" stroke="#6C707E" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 364 B

@@ -0,0 +1,5 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7" cy="7" r="4.5" stroke="#CED0D6"/>
<path d="M10.1992 10.2002L13.4992 13.4961" stroke="#CED0D6" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 364 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.22655 4.36961C2.92233 4.76924 2.66735 5.20781 2.47037 5.67626L3.30992 7.0943C3.6406 7.65283 3.6406 8.34718 3.30992 8.9057L2.47037 10.3237C2.66736 10.7922 2.92233 11.2308 3.22656 11.6304L4.87261 11.6124C5.52165 11.6053 6.12297 11.9524 6.44133 12.5181L7.24899 13.953C7.49593 13.984 7.74792 14 8.00408 14C8.2602 14 8.51214 13.984 8.75904 13.9531L9.56671 12.5181C9.88507 11.9524 10.4864 11.6053 11.1354 11.6124L12.7816 11.6304C13.0858 11.2308 13.3408 10.7923 13.5377 10.3239L12.6981 8.9057C12.3674 8.34718 12.3674 7.65283 12.6981 7.0943L13.5377 5.67613C13.3408 5.20773 13.0858 4.76921 12.7816 4.36961L11.1354 4.38764C10.4864 4.39475 9.88507 4.04758 9.56671 3.48194L8.75904 2.04693C8.51214 2.01599 8.2602 2 8.00408 2C7.74792 2 7.49594 2.016 7.24899 2.04695L6.44133 3.48194C6.12297 4.04758 5.52165 4.39475 4.87261 4.38764L3.22655 4.36961ZM10.655 8.00001C10.655 9.46412 9.46811 10.651 8.004 10.651C6.5399 10.651 5.353 9.46412 5.353 8.00001C5.353 6.53591 6.5399 5.34902 8.004 5.34902C9.46811 5.34902 10.655 6.53591 10.655 8.00001ZM4.88356 3.3877C5.16752 3.39081 5.4306 3.23892 5.56988 2.99146L6.43817 1.44875C6.54914 1.25159 6.7401 1.1101 6.96387 1.07676C7.30327 1.0262 7.65062 1 8.00408 1C8.3575 1 8.7048 1.02619 9.04414 1.07674C9.26792 1.11007 9.45889 1.25157 9.56986 1.44873L10.4382 2.99146C10.5774 3.23892 10.8405 3.39081 11.1245 3.3877L12.8938 3.36832C13.1196 3.36585 13.3372 3.46012 13.4781 3.63661C13.9099 4.17766 14.2632 4.78416 14.5207 5.43884C14.6034 5.6491 14.5763 5.88489 14.4612 6.07931L13.5586 7.60376C13.4139 7.84811 13.4139 8.15189 13.5586 8.39625L14.4612 9.92069C14.5763 10.1151 14.6034 10.3509 14.5207 10.5612C14.2632 11.2158 13.9099 11.8223 13.4781 12.3634C13.3372 12.5399 13.1196 12.6342 12.8938 12.6317L11.1245 12.6123C10.8405 12.6092 10.5774 12.7611 10.4382 13.0085L9.56986 14.5513C9.45889 14.7484 9.26792 14.8899 9.04414 14.9233C8.7048 14.9738 8.3575 15 8.00408 15C7.65062 15 7.30327 14.9738 6.96387 14.9232C6.7401 14.8899 6.54914 14.7484 6.43817 14.5512L5.56988 13.0085C5.4306 12.7611 5.16752 12.6092 4.88356 12.6123L3.1144 12.6317C2.8886 12.6342 2.67096 12.5399 2.5301 12.3634C2.09822 11.8223 1.74489 11.2158 1.48738 10.561C1.40469 10.3508 1.43184 10.115 1.54695 9.92057L2.44942 8.39625C2.5941 8.15189 2.5941 7.84811 2.44942 7.60376L1.54695 6.07944C1.43184 5.88502 1.40469 5.64924 1.48738 5.43898C1.74489 4.78425 2.09822 4.1777 2.53009 3.63661C2.67096 3.46012 2.8886 3.36585 3.1144 3.36832L4.88356 3.3877ZM9.655 8.00001C9.655 8.91183 8.91582 9.65101 8.004 9.65101C7.09218 9.65101 6.353 8.91183 6.353 8.00001C6.353 7.08819 7.09218 6.34902 8.004 6.34902C8.91582 6.34902 9.655 7.08819 9.655 8.00001Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.22655 4.36961C2.92233 4.76924 2.66735 5.20781 2.47037 5.67626L3.30992 7.0943C3.6406 7.65283 3.6406 8.34718 3.30992 8.9057L2.47037 10.3237C2.66736 10.7922 2.92233 11.2308 3.22656 11.6304L4.87261 11.6124C5.52165 11.6053 6.12297 11.9524 6.44133 12.5181L7.24899 13.953C7.49593 13.984 7.74792 14 8.00408 14C8.2602 14 8.51214 13.984 8.75904 13.9531L9.56671 12.5181C9.88507 11.9524 10.4864 11.6053 11.1354 11.6124L12.7816 11.6304C13.0858 11.2308 13.3408 10.7923 13.5377 10.3239L12.6981 8.9057C12.3674 8.34718 12.3674 7.65283 12.6981 7.0943L13.5377 5.67613C13.3408 5.20773 13.0858 4.76921 12.7816 4.36961L11.1354 4.38764C10.4864 4.39475 9.88507 4.04758 9.56671 3.48194L8.75904 2.04693C8.51214 2.01599 8.2602 2 8.00408 2C7.74792 2 7.49594 2.016 7.24899 2.04695L6.44133 3.48194C6.12297 4.04758 5.52165 4.39475 4.87261 4.38764L3.22655 4.36961ZM10.655 8.00001C10.655 9.46412 9.46811 10.651 8.004 10.651C6.5399 10.651 5.353 9.46412 5.353 8.00001C5.353 6.53591 6.5399 5.34902 8.004 5.34902C9.46811 5.34902 10.655 6.53591 10.655 8.00001ZM4.88356 3.3877C5.16752 3.39081 5.4306 3.23892 5.56988 2.99146L6.43817 1.44875C6.54914 1.25159 6.7401 1.1101 6.96387 1.07676C7.30327 1.0262 7.65062 1 8.00408 1C8.3575 1 8.7048 1.02619 9.04414 1.07674C9.26792 1.11007 9.45889 1.25157 9.56986 1.44873L10.4382 2.99146C10.5774 3.23892 10.8405 3.39081 11.1245 3.3877L12.8938 3.36832C13.1196 3.36585 13.3372 3.46012 13.4781 3.63661C13.9099 4.17766 14.2632 4.78416 14.5207 5.43884C14.6034 5.6491 14.5763 5.88489 14.4612 6.07931L13.5586 7.60376C13.4139 7.84811 13.4139 8.15189 13.5586 8.39625L14.4612 9.92069C14.5763 10.1151 14.6034 10.3509 14.5207 10.5612C14.2632 11.2158 13.9099 11.8223 13.4781 12.3634C13.3372 12.5399 13.1196 12.6342 12.8938 12.6317L11.1245 12.6123C10.8405 12.6092 10.5774 12.7611 10.4382 13.0085L9.56986 14.5513C9.45889 14.7484 9.26792 14.8899 9.04414 14.9233C8.7048 14.9738 8.3575 15 8.00408 15C7.65062 15 7.30327 14.9738 6.96387 14.9232C6.7401 14.8899 6.54914 14.7484 6.43817 14.5512L5.56988 13.0085C5.4306 12.7611 5.16752 12.6092 4.88356 12.6123L3.1144 12.6317C2.8886 12.6342 2.67096 12.5399 2.5301 12.3634C2.09822 11.8223 1.74489 11.2158 1.48738 10.561C1.40469 10.3508 1.43184 10.115 1.54695 9.92057L2.44942 8.39625C2.5941 8.15189 2.5941 7.84811 2.44942 7.60376L1.54695 6.07944C1.43184 5.88502 1.40469 5.64924 1.48738 5.43898C1.74489 4.78425 2.09822 4.1777 2.53009 3.63661C2.67096 3.46012 2.8886 3.36585 3.1144 3.36832L4.88356 3.3877ZM9.655 8.00001C9.655 8.91183 8.91582 9.65101 8.004 9.65101C7.09218 9.65101 6.353 8.91183 6.353 8.00001C6.353 7.08819 7.09218 6.34902 8.004 6.34902C8.91582 6.34902 9.655 7.08819 9.655 8.00001Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 3L14.5 13.5H8V3Z" fill="#6C707E"/>
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#6C707E" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 227 B

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 3L14.5 13.5H8V3Z" fill="#CED0D6"/>
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#CED0D6" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 227 B

@@ -0,0 +1,6 @@
<!-- Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 1.5C4 1.22386 4.22386 1 4.5 1H11.5C11.7761 1 12 1.22386 12 1.5C12 1.77614 11.7761 2 11.5 2H4.5C4.22386 2 4 1.77614 4 1.5Z" fill="#6C707E"/>
<path d="M8 5.5C8.27614 5.5 8.5 5.72386 8.5 6V8.13378C8.7989 8.30669 9 8.62986 9 9C9 9.55229 8.55229 10 8 10C7.44772 10 7 9.55229 7 9C7 8.62986 7.2011 8.30669 7.5 8.13378V6C7.5 5.72386 7.72386 5.5 8 5.5Z" fill="#6C707E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.8536 3.85355C14.0488 3.65829 14.0488 3.34171 13.8536 3.14645C13.6583 2.95118 13.3417 2.95118 13.1464 3.14645L11.8744 4.41847C10.8291 3.53358 9.47685 3 8 3C4.68629 3 2 5.68629 2 9C2 12.3137 4.68629 15 8 15C11.3137 15 14 12.3137 14 9C14 7.52315 13.4664 6.17092 12.5815 5.12558L13.8536 3.85355ZM13 9C13 11.7614 10.7614 14 8 14C5.23858 14 3 11.7614 3 9C3 6.23858 5.23858 4 8 4C10.7614 4 13 6.23858 13 9Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,6 @@
<!-- Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 1.5C4 1.22386 4.22386 1 4.5 1H11.5C11.7761 1 12 1.22386 12 1.5C12 1.77614 11.7761 2 11.5 2H4.5C4.22386 2 4 1.77614 4 1.5Z" fill="#CED0D6"/>
<path d="M8 5.5C8.27614 5.5 8.5 5.72386 8.5 6V8.13378C8.7989 8.30669 9 8.62986 9 9C9 9.55229 8.55229 10 8 10C7.44772 10 7 9.55229 7 9C7 8.62986 7.2011 8.30669 7.5 8.13378V6C7.5 5.72386 7.72386 5.5 8 5.5Z" fill="#CED0D6"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.8536 3.85355C14.0488 3.65829 14.0488 3.34171 13.8536 3.14645C13.6583 2.95118 13.3417 2.95118 13.1464 3.14645L11.8744 4.41847C10.8291 3.53358 9.47685 3 8 3C4.68629 3 2 5.68629 2 9C2 12.3137 4.68629 15 8 15C11.3137 15 14 12.3137 14 9C14 7.52315 13.4664 6.17092 12.5815 5.12558L13.8536 3.85355ZM13 9C13 11.7614 10.7614 14 8 14C5.23858 14 3 11.7614 3 9C3 6.23858 5.23858 4 8 4C10.7614 4 13 6.23858 13 9Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 0.5C11 0.223858 11.2239 0 11.5 0H15.5C15.7761 0 16 0.223858 16 0.5V4.5C16 4.77614 15.7761 5 15.5 5C15.2239 5 15 4.77614 15 4.5V1.70711L10.8536 5.85355C10.6583 6.04882 10.3417 6.04882 10.1464 5.85355C9.95118 5.65829 9.95118 5.34171 10.1464 5.14645L14.2929 1H11.5C11.2239 1 11 0.776142 11 0.5Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 593 B

@@ -0,0 +1,4 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 0.5C11 0.223858 11.2239 0 11.5 0H15.5C15.7761 0 16 0.223858 16 0.5V4.5C16 4.77614 15.7761 5 15.5 5C15.2239 5 15 4.77614 15 4.5V1.70711L10.8536 5.85355C10.6583 6.04882 10.3417 6.04882 10.1464 5.85355C9.95118 5.65829 9.95118 5.34171 10.1464 5.14645L14.2929 1H11.5C11.2239 1 11 0.776142 11 0.5Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 593 B

+4
View File
@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="6" stroke="#6C707E"/>
<path d="M8 2.5C11.0376 2.5 13.5 4.96243 13.5 8C13.5 11.0376 11.0376 13.5 8 13.5V2.5Z" fill="#6C707E"/>
</svg>

After

Width:  |  Height:  |  Size: 254 B

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="8" cy="8" r="6" stroke="#CED0D6"/>
<path d="M8 2.5C11.0376 2.5 13.5 4.96243 13.5 8C13.5 11.0376 11.0376 13.5 8 13.5V2.5Z" fill="#CED0D6"/>
</svg>

After

Width:  |  Height:  |  Size: 254 B

Loaded 100 of 252 files, more files were not shown because too many files have changed in this diff. Show more