@jkwd/inbase 0.1.5 → 0.1.6

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.
@@ -13,6 +13,7 @@ import {
13
13
  filesImporting,
14
14
  folderChangeHighlights,
15
15
  folderOfFile,
16
+ mapPointOntoFolder,
16
17
  } from '../layout'
17
18
  import { WORLD_VOID } from '../theme'
18
19
  import type {
@@ -53,6 +54,8 @@ type WorldProps = {
53
54
  flyTo: FlyTo | null
54
55
  aimedRelation: AimedRelation | null
55
56
  onAimRelation: (aim: AimedRelation | null) => void
57
+ onAimFile?: (fileId: string | null) => void
58
+ onInspect?: (fileId: string) => void
56
59
  onTravelTo: (fromId: string, toId: string) => void
57
60
  importedBy?: boolean
58
61
  namingId?: string | null
@@ -63,6 +66,8 @@ type WorldProps = {
63
66
  userCreatedBlocks?: UserCreatedBlock[]
64
67
  userCreatedIslands?: UserCreatedIsland[]
65
68
  namingIslandId?: string | null
69
+ mapGraph?: CodebaseGraph | null
70
+ mapLayout?: WorldLayout | null
66
71
  }
67
72
 
68
73
  export function World({
@@ -89,6 +94,8 @@ export function World({
89
94
  flyTo,
90
95
  aimedRelation,
91
96
  onAimRelation,
97
+ onAimFile,
98
+ onInspect,
92
99
  onTravelTo,
93
100
  importedBy = false,
94
101
  namingId = null,
@@ -99,10 +106,18 @@ export function World({
99
106
  onCancelName,
100
107
  userCreatedBlocks = [],
101
108
  userCreatedIslands = [],
109
+ mapGraph = null,
110
+ mapLayout = null,
102
111
  }: WorldProps) {
103
112
  const created = new Set(createdIds)
104
113
  const deleted = new Set(deletedIds)
105
114
  const mapping = mode === 'map'
115
+ const viewGraph = mapping && mapGraph ? mapGraph : graph
116
+ const viewLayout = mapping && mapLayout ? mapLayout : layout
117
+ const mapMarker =
118
+ viewLayout === layout
119
+ ? landAt
120
+ : mapPointOntoFolder(landAt[0], landAt[1], layout, viewLayout)
106
121
  const placing = Boolean(namingId || namingIslandId)
107
122
  const planned = new Set(plannedIds)
108
123
  const ghosts = previewFiles
@@ -135,7 +150,7 @@ export function World({
135
150
  planned,
136
151
  created,
137
152
  deleted,
138
- layout.folders,
153
+ viewLayout.folders,
139
154
  )
140
155
 
141
156
  return (
@@ -149,9 +164,9 @@ export function World({
149
164
  />
150
165
  <ambientLight intensity={mapping ? 0.7 : 0.42} />
151
166
  <MapView
152
- layout={layout}
167
+ layout={viewLayout}
153
168
  enabled={mapping}
154
- marker={landAt}
169
+ marker={mapMarker}
155
170
  highlightedFolders={highlightedFolders}
156
171
  selectedFolder={selectedFolder}
157
172
  onLand={onLand}
@@ -160,7 +175,7 @@ export function World({
160
175
  onTravelTo={onTravelTo}
161
176
  />
162
177
 
163
- {Object.values(layout.folders).map((folder) => (
178
+ {Object.values(viewLayout.folders).map((folder) => (
164
179
  <FolderArea
165
180
  key={folder.path}
166
181
  folder={folder}
@@ -172,11 +187,11 @@ export function World({
172
187
  }
173
188
  />
174
189
  ))}
175
- {layout.bridges.map((bridge) => (
176
- <Bridge key={bridge.id} bridge={bridge} />
190
+ {viewLayout.bridges.map((bridge) => (
191
+ <Bridge key={bridge.id} bridge={bridge} folders={viewLayout.folders} />
177
192
  ))}
178
- {graph.files.map((file) => {
179
- const placed = layout.files[file.id]
193
+ {viewGraph.files.map((file) => {
194
+ const placed = viewLayout.files[file.id]
180
195
  if (!placed) return null
181
196
  const selected = file.id === selectedId
182
197
  const isRelated = related.has(file.id)
@@ -248,8 +263,8 @@ export function World({
248
263
  <RelationLines
249
264
  selectedId={selectedId}
250
265
  aimedRelation={aimedRelation}
251
- files={graph.files}
252
- layout={layout}
266
+ files={viewGraph.files}
267
+ layout={viewLayout}
253
268
  extras={ghosts}
254
269
  plannedEdges={plannedImports}
255
270
  fromAbove={mapping}
@@ -283,6 +298,8 @@ export function World({
283
298
  <SelectionController
284
299
  locked={locked && !mapping}
285
300
  onSelect={onSelect}
301
+ onInspect={onInspect}
302
+ onAimFile={onAimFile}
286
303
  onAimRelation={onAimRelation}
287
304
  onTravelTo={onTravelTo}
288
305
  files={{ ...layout.files, ...ghosts }}
@@ -110,11 +110,18 @@ export function dimColor(hex: string, amount = 0.32) {
110
110
  return `#${channel(0)}${channel(2)}${channel(4)}`
111
111
  }
112
112
 
113
- export function folderFloorColor(path: string) {
113
+ function folderHue(path: string) {
114
114
  let hash = 0
115
115
  for (let i = 0; i < path.length; i += 1) {
116
116
  hash = path.charCodeAt(i) + ((hash << 5) - hash)
117
117
  }
118
- const hue = Math.abs(hash) % 360
119
- return `hsl(${hue}, 16%, 18%)`
118
+ return Math.abs(hash) % 360
119
+ }
120
+
121
+ export function folderFloorColor(path: string) {
122
+ return `hsl(${folderHue(path)}, 5%, 48%)`
123
+ }
124
+
125
+ export function folderAisleColor(path: string) {
126
+ return `hsl(${folderHue(path)}, 6%, 40%)`
120
127
  }
@@ -214,6 +214,7 @@ export type WorkflowAction =
214
214
  | 'blueprint_no'
215
215
  | 'blueprint_send'
216
216
  | 'blueprint_update'
217
+ | 'set_step_by_step'
217
218
 
218
219
  export type AgentIntentBundle = {
219
220
  focusedSessionId: string | null
@@ -227,6 +228,7 @@ export type AgentIntent = {
227
228
  feature: string | null
228
229
  steps: PlanStep[]
229
230
  step: number | null
231
+ stepByStep: boolean
230
232
  files: string[]
231
233
  creates: string[]
232
234
  deletes: string[]
@@ -236,6 +238,8 @@ export type AgentIntent = {
236
238
  addedFunctions: PatchSymbolAddition[]
237
239
  addedVariables: PatchSymbolAddition[]
238
240
  addedImports: PatchImportAddition[]
241
+ changedFunctions: PatchSymbolAddition[]
242
+ changedVariables: PatchSymbolAddition[]
239
243
  reason: string | null
240
244
  sessionId: string | null
241
245
  diffId: string | null
@@ -246,6 +250,7 @@ export type AgentIntent = {
246
250
  preview: boolean
247
251
  phase: WorkflowPhase | null
248
252
  working: boolean
253
+ stalledWait: boolean
249
254
  creationMode: boolean
250
255
  canEnterBlueprint: boolean
251
256
  blueprintSessionId: string | null