@jkwd/inbase 0.1.13 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import { PerspectiveCamera, PointerLockControls } from '@react-three/drei'
4
4
  import type { PointerLockControls as PointerLockControlsImpl } from 'three-stdlib'
5
5
  import * as THREE from 'three'
6
6
  import { CONFIG } from '../theme'
7
+ import { isKeyboardIsolated, shouldIgnoreShortcut } from '../keyboard'
7
8
  import type { FlyTo, ViewMode, WorldLayout } from '../types'
8
9
 
9
10
  const lookDir = new THREE.Vector3()
@@ -143,15 +144,7 @@ export function Player({
143
144
 
144
145
  useEffect(() => {
145
146
  const onKey = (event: KeyboardEvent, down: boolean) => {
146
- if (
147
- event.target instanceof HTMLElement &&
148
- (event.target.tagName === 'TEXTAREA' ||
149
- event.target.tagName === 'INPUT' ||
150
- event.target.tagName === 'SELECT' ||
151
- event.target.isContentEditable)
152
- ) {
153
- return
154
- }
147
+ if (shouldIgnoreShortcut(event)) return
155
148
  if (event.code === 'KeyW' || event.code === 'ArrowUp') keys.current.forward = down
156
149
  if (event.code === 'KeyS' || event.code === 'ArrowDown') keys.current.back = down
157
150
  if (event.code === 'KeyA' || event.code === 'ArrowLeft') keys.current.left = down
@@ -235,6 +228,13 @@ export function Player({
235
228
  setSteering(true)
236
229
  }
237
230
  } else if (walking && locked) {
231
+ if (isKeyboardIsolated()) {
232
+ keys.current.forward = false
233
+ keys.current.back = false
234
+ keys.current.left = false
235
+ keys.current.right = false
236
+ keys.current.sprint = false
237
+ }
238
238
  camera.getWorldDirection(front.current)
239
239
  front.current.y = 0
240
240
  front.current.normalize()
@@ -9,6 +9,7 @@ import {
9
9
  folderOfFile,
10
10
  } from '../layout'
11
11
  import { CONFIG, WORLD_VOID, type ChangeKind } from '../theme'
12
+ import { shouldIgnoreShortcut } from '../keyboard'
12
13
  import type { CodebaseGraph, PlacedFile, PlacedFolder, WorldLayout } from '../types'
13
14
  import { FileBlock } from './FileBlock'
14
15
  import { FolderArea } from './FolderArea'
@@ -903,6 +904,7 @@ export function SelectionThumbnail({
903
904
  if (!maximized) return
904
905
  const onKeyDown = (event: KeyboardEvent) => {
905
906
  if (event.key !== 'Escape') return
907
+ if (shouldIgnoreShortcut(event)) return
906
908
  event.preventDefault()
907
909
  onMaximize?.()
908
910
  }
@@ -19,7 +19,7 @@ import {
19
19
  folderOfFile,
20
20
  mapPointOntoFolder,
21
21
  } from '../layout'
22
- import { WORLD_VOID } from '../theme'
22
+ import { WORLD_VOID, CONFIG, fileHeight } from '../theme'
23
23
  import type {
24
24
  CodebaseGraph,
25
25
  FileNode,
@@ -33,6 +33,7 @@ import type {
33
33
  ViewMode,
34
34
  WorldLayout,
35
35
  } from '../types'
36
+ import { toCreatedFile } from '../userCreated'
36
37
 
37
38
  type WorldProps = {
38
39
  graph: CodebaseGraph
@@ -67,8 +68,11 @@ type WorldProps = {
67
68
  onBlueprintMenu?: (menu: MapBlueprintMenu) => void
68
69
  onCommitName?: (id: string, name: string) => boolean
69
70
  onCancelName?: (id: string) => void
71
+ onCommitIslandName?: (id: string, name: string) => boolean
72
+ onCancelIslandName?: (id: string) => void
70
73
  userCreatedBlocks?: UserCreatedBlock[]
71
74
  userCreatedIslands?: UserCreatedIsland[]
75
+ overlayBlocks?: UserCreatedBlock[]
72
76
  namingIslandId?: string | null
73
77
  mapGraph?: CodebaseGraph | null
74
78
  mapLayout?: WorldLayout | null
@@ -108,8 +112,11 @@ export function World({
108
112
  onBlueprintMenu,
109
113
  onCommitName,
110
114
  onCancelName,
115
+ onCommitIslandName,
116
+ onCancelIslandName,
111
117
  userCreatedBlocks = [],
112
118
  userCreatedIslands = [],
119
+ overlayBlocks = [],
113
120
  mapGraph = null,
114
121
  mapLayout = null,
115
122
  }: WorldProps) {
@@ -226,6 +233,7 @@ export function World({
226
233
  marker={mapMarker}
227
234
  highlightedFolders={highlightedFolders}
228
235
  selectedFolder={selectedFolder}
236
+ namingFolderPath={namingIslandId}
229
237
  onLand={onLand}
230
238
  onSelect={onSelect}
231
239
  onSelectFolder={onSelectFolder}
@@ -248,6 +256,18 @@ export function World({
248
256
  mapping ? highlightedFolders[folder.path] ?? null : null
249
257
  }
250
258
  labelVisible={!lod || lod.folderLabels.has(folder.path)}
259
+ onCommitName={
260
+ folder.path === namingIslandId && onCommitIslandName
261
+ ? (name) => {
262
+ onCommitIslandName(folder.path, name)
263
+ }
264
+ : undefined
265
+ }
266
+ onCancelName={
267
+ folder.path === namingIslandId && onCancelIslandName
268
+ ? () => onCancelIslandName(folder.path)
269
+ : undefined
270
+ }
251
271
  />
252
272
  )
253
273
  })}
@@ -309,6 +329,31 @@ export function World({
309
329
  )
310
330
  })}
311
331
  <DistantFileBlocks items={distantFiles} />
332
+ {overlayBlocks.map((block) => {
333
+ const file = toCreatedFile(block)
334
+ const height = fileHeight(12)
335
+ const placed: PlacedFile = {
336
+ id: block.id,
337
+ position: [block.x, height / 2 + 0.42, block.z],
338
+ size: [CONFIG.fileWidth, height, CONFIG.fileDepth],
339
+ aisleFace: 1,
340
+ }
341
+ return (
342
+ <FileBlock
343
+ key={`blueprint:${block.id}`}
344
+ file={file}
345
+ placed={placed}
346
+ selected={file.id === selectedId}
347
+ related={false}
348
+ planned={false}
349
+ changeKind="add"
350
+ added
351
+ dimmed={false}
352
+ mapMode={mapping}
353
+ labelVisible
354
+ />
355
+ )
356
+ })}
312
357
  {Object.values(ghosts).map((placed) => {
313
358
  const file: FileNode = {
314
359
  id: placed.id,
@@ -216,6 +216,15 @@ export type PatchImportAddition = {
216
216
  file: string
217
217
  }
218
218
 
219
+ export type BlueprintNoteKind = 'file' | 'function' | 'variable'
220
+
221
+ export type BlueprintNote = {
222
+ file: string
223
+ kind: BlueprintNoteKind
224
+ name?: string
225
+ note: string
226
+ }
227
+
219
228
  export type AimedRelation = {
220
229
  from: string
221
230
  to: string
@@ -250,13 +259,29 @@ export type WorkflowAction =
250
259
  | 'blueprint_no'
251
260
  | 'blueprint_send'
252
261
  | 'blueprint_update'
262
+ | 'blueprint_clear'
263
+ | 'blueprint_cleanup'
264
+ | 'blueprint_set_hidden'
253
265
  | 'focus'
254
266
  | 'set_step_by_step'
255
267
 
268
+ export type SharedBlueprint = {
269
+ hidden: boolean
270
+ revision: number
271
+ enabled: boolean
272
+ userCreatedBlocks: UserCreatedBlock[]
273
+ userCreatedIslands: UserCreatedIsland[]
274
+ addedFunctions: PatchSymbolAddition[]
275
+ addedVariables: PatchSymbolAddition[]
276
+ addedImports: PatchImportAddition[]
277
+ notes: BlueprintNote[]
278
+ }
279
+
256
280
  export type AgentIntentBundle = {
257
281
  focusedSessionId: string | null
258
282
  nextAttachSessionId: string | null
259
283
  intents: AgentIntent[]
284
+ blueprint: SharedBlueprint
260
285
  }
261
286
 
262
287
  export type AgentIntent = {
@@ -301,10 +326,13 @@ export type AgentIntent = {
301
326
  initialInstruction?: string | null
302
327
  creationMode: boolean
303
328
  canEnterBlueprint: boolean
329
+ blueprintHidden?: boolean
330
+ blueprintRevision?: number
304
331
  blueprintSessionId: string | null
305
332
  userCreatedBlocks: UserCreatedBlock[]
306
333
  userCreatedIslands: UserCreatedIsland[]
307
334
  blueprintFunctions: PatchSymbolAddition[]
308
335
  blueprintVariables: PatchSymbolAddition[]
309
336
  blueprintImports: PatchImportAddition[]
337
+ blueprintNotes: BlueprintNote[]
310
338
  }
@@ -15,6 +15,10 @@ export class CanvasErrorBoundary extends Component<Props, State> {
15
15
  return { failed: true }
16
16
  }
17
17
 
18
+ componentDidCatch(error: Error) {
19
+ console.error('Visualizer canvas error', error)
20
+ }
21
+
18
22
  render() {
19
23
  if (this.state.failed) {
20
24
  return (