@octane-xplat/devtools 0.0.0-nightly.g28d6eb6 → 0.0.0-nightly.g852be0c

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.
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type BackendRef, type ChannelError, type DevSocket, type SessionSnapshot } from './types.ts';
2
- export type { BackendRef, ChannelError, SelectedElement, SessionSnapshot } from './types.ts';
2
+ export type { BackendRef, ChannelError, SessionSnapshot } from './types.ts';
3
3
  /** The fields a panel needs from the dev server's discovery record. */
4
4
  export interface DevtoolsServerRecord {
5
5
  endpoint: string;
@@ -42,8 +42,6 @@ export interface DevtoolsConnection {
42
42
  close(): void;
43
43
  }
44
44
  export interface ConnectDevtoolsOptions {
45
- /** Tabs a desktop window can raise in response to app shortcuts. */
46
- desktopTabs?: readonly string[];
47
45
  /** Overrides the socket factory — the macOS JSC host has no global
48
46
  * `WebSocket`, so native panels inject their transport here. */
49
47
  socket?: (url: string) => DevSocket | undefined;
package/dist/client.js CHANGED
@@ -43,7 +43,6 @@ export function connectDevtools(record, options = {}) {
43
43
  version: 1,
44
44
  instanceId: record.instanceId,
45
45
  token: record.devtoolsToken,
46
- ...(options.desktopTabs ? { desktopTabs: options.desktopTabs } : {}),
47
46
  }));
48
47
  };
49
48
  next.onmessage = (event) => {
package/dist/types.d.ts CHANGED
@@ -23,14 +23,6 @@ export interface DevActionRef {
23
23
  cancellable?: boolean;
24
24
  } & Record<string, unknown>;
25
25
  }
26
- export interface SelectedElement {
27
- tag: string;
28
- id: string;
29
- classes: string[];
30
- path: string;
31
- styleIds: string[];
32
- component?: string;
33
- }
34
26
  /** A connected app session as the hub reports it in `ready`/`sessions`. */
35
27
  export interface SessionSnapshot {
36
28
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octane-xplat/devtools",
3
- "version": "0.0.0-nightly.g28d6eb6",
3
+ "version": "0.0.0-nightly.g852be0c",
4
4
  "description": "Devtools channel clients for Octane Xplat — app channels, per-target Node backends, and devtools panel connections over the xplat dev hub",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -66,17 +66,17 @@
66
66
  "test": "node --test tests/*.test.mts"
67
67
  },
68
68
  "dependencies": {
69
- "@octane-xplat/platform": "0.0.0-nightly.g28d6eb6",
70
- "@octane-xplat/ui": "0.0.0-nightly.g28d6eb6"
69
+ "@octane-xplat/platform": "0.0.0-nightly.g852be0c",
70
+ "@octane-xplat/ui": "0.0.0-nightly.g852be0c"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "octane": ">=0.6.3 <1"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@nativescript/macos-node-api": "0.5.0-beta.0",
77
- "@octane-xplat/cli": "0.0.0-nightly.g28d6eb6",
78
- "@octane-xplat/jsx": "0.0.0-nightly.g28d6eb6",
79
- "@octane-xplat/macos-appkit": "0.0.0-nightly.g28d6eb6",
77
+ "@octane-xplat/cli": "0.0.0-nightly.g852be0c",
78
+ "@octane-xplat/jsx": "0.0.0-nightly.g852be0c",
79
+ "@octane-xplat/macos-appkit": "0.0.0-nightly.g852be0c",
80
80
  "@octanejs/vite-plugin": "0.6.6",
81
81
  "@tsrx/content-mapper": "0.1.2",
82
82
  "@types/node": "26.6.6",
package/src/client.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  type SessionSnapshot,
12
12
  } from './types.ts'
13
13
 
14
- export type { BackendRef, ChannelError, SelectedElement, SessionSnapshot } from './types.ts'
14
+ export type { BackendRef, ChannelError, SessionSnapshot } from './types.ts'
15
15
 
16
16
  /** The fields a panel needs from the dev server's discovery record. */
17
17
  export interface DevtoolsServerRecord {
@@ -54,8 +54,6 @@ export interface DevtoolsConnection {
54
54
  }
55
55
 
56
56
  export interface ConnectDevtoolsOptions {
57
- /** Tabs a desktop window can raise in response to app shortcuts. */
58
- desktopTabs?: readonly string[]
59
57
  /** Overrides the socket factory — the macOS JSC host has no global
60
58
  * `WebSocket`, so native panels inject their transport here. */
61
59
  socket?: (url: string) => DevSocket | undefined
@@ -120,7 +118,6 @@ export function connectDevtools(
120
118
  version: 1,
121
119
  instanceId: record.instanceId,
122
120
  token: record.devtoolsToken,
123
- ...(options.desktopTabs ? { desktopTabs: options.desktopTabs } : {}),
124
121
  }),
125
122
  )
126
123
  }
@@ -4,10 +4,7 @@
4
4
  // launched from as preferredRoot; the apps/devtools harness passes null.
5
5
  import '../panel/styles.ts'
6
6
  import { useEffect, useRef, useState } from 'octane'
7
- import { Center, Pressable, ScrollableArea, Text, VStack } from '@octane-xplat/ui'
8
- import { NSURL, NSWorkspace } from '@octane-xplat/platform/macos'
9
- import { ProjectBar } from '../panel/ProjectBar.tsrx'
10
-
7
+ import { Button, Center, HStack, Pressable, ScrollableArea, Text, VStack } from '@octane-xplat/ui'
11
8
  import { listDevtoolsServers, nwDevSocket } from '../macos/index.macos.ts'
12
9
  import type { ListedDevtoolsServer } from '../macos/index.macos.ts'
13
10
  import { App } from '../panel/index.ts'
@@ -31,11 +28,12 @@ export function Shell(props: DevtoolsShellProps) @{
31
28
  // Mirrors of rendered state for the poll/selftest closures.
32
29
  const recordsRef = useRef<ListedDevtoolsServer[]>([])
33
30
  const targetRef = useRef<ListedDevtoolsServer | null>(null)
34
- // Once a project is chosen, polling follows its restarts.
31
+ // Auto-targeting applies only until the first target is chosen — auto or
32
+ // by click — or Switch is pressed; after that the user owns selection.
35
33
  const autoPick = useRef(true)
36
- const projectPath = target?.appRoot ?? props.preferredRoot
34
+ const [onTop, setOnTop] = useState(false)
37
35
 
38
- const choose = (record: ListedDevtoolsServer) => {
36
+ const choose = (record: ListedDevtoolsServer | null) => {
39
37
  autoPick.current = false
40
38
  targetRef.current = record
41
39
  setTarget(record)
@@ -90,15 +88,15 @@ export function Shell(props: DevtoolsShellProps) @{
90
88
  }, [])
91
89
 
92
90
  useEffect(() => {
93
- props.onTitle?.(projectPath ? `devtools — ${basename(projectPath)}` : 'devtools')
94
- }, [projectPath])
91
+ props.onTitle?.(target ? `devtools — ${basename(target.appRoot)}` : 'devtools')
92
+ }, [target])
95
93
 
96
94
  useEffect(() => {
97
95
  if (props.selftest) {
98
96
  props.selftest.pick = (index: number) => {
99
97
  const record = recordsRef.current[index]
100
98
 
101
- if (record && (!props.preferredRoot || autoTarget([record], props.preferredRoot))) {
99
+ if (record) {
102
100
  choose(record)
103
101
  }
104
102
  }
@@ -106,34 +104,37 @@ export function Shell(props: DevtoolsShellProps) @{
106
104
  }, [])
107
105
 
108
106
  <VStack className="dt-root">
109
- @if (projectPath) {
110
- <ProjectBar
111
- path={projectPath}
112
- onKeepOnTop={props.onKeepOnTop}
113
- onReveal={(path) =>
114
- NSWorkspace.sharedWorkspace.activateFileViewerSelectingURLs([
115
- NSURL.fileURLWithPath(path),
116
- ])
117
- }
118
- />
119
- }
120
107
  @if (target !== null) {
121
- <VStack className="dt-targeted">
122
- <App
123
- key={target.key}
124
- record={target}
125
- socket={nwDevSocket}
126
- plugins={panelPlugins}
127
- initialTab={props.initialTab}
128
- onPresent={props.onPresent}
129
- />
130
- </VStack>
131
- } @else if (props.preferredRoot) {
132
- <Center style={{ flex: 1 }}>
133
- <Text className="dt-empty">
134
- Waiting for this project’s dev server. Run xplat dev to connect.
135
- </Text>
136
- </Center>
108
+ const focused = target
109
+
110
+ <>
111
+ <HStack className="dt-target-bar">
112
+ <Text className="dt-target-name">{basename(focused.appRoot)}</Text>
113
+ <HStack className="dt-right">
114
+ @if (props.onKeepOnTop) {
115
+ <Button
116
+ label={onTop ? 'Unpin' : 'Keep on top'}
117
+ onPress={() => {
118
+ const next = !onTop
119
+
120
+ setOnTop(next)
121
+ props.onKeepOnTop?.(next)
122
+ }}
123
+ />
124
+ }
125
+ <Button label="Switch…" onPress={() => choose(null)} />
126
+ </HStack>
127
+ </HStack>
128
+ <VStack className="dt-targeted">
129
+ <App
130
+ key={`${focused.key}:${focused.instanceId}`}
131
+ record={focused}
132
+ socket={nwDevSocket}
133
+ plugins={panelPlugins}
134
+ initialTab={props.initialTab}
135
+ />
136
+ </VStack>
137
+ </>
137
138
  } @else if (records.length === 0) {
138
139
  <Center style={{ flex: 1 }}>
139
140
  <Text className="dt-empty">No xplat dev servers running</Text>
@@ -5,7 +5,6 @@ export interface DevtoolsShellProps {
5
5
  preferredRoot: string | null
6
6
  /** Tab to show on mount (DEVTOOLS_SELFTEST_TAB). */
7
7
  initialTab?: string
8
- onPresent?: () => void
9
8
  /** Toggle the main window's level (keep-on-top); absent → no toggle shown. */
10
9
  onKeepOnTop?: (onTop: boolean) => void
11
10
  /** Main-window title updates: `devtools` until a server is targeted. */
@@ -9,7 +9,6 @@ import { runMacOSApp } from '@octane-xplat/macos-appkit/host'
9
9
  import type { NSView } from '@octane-xplat/platform/macos'
10
10
  import { writeFileSync } from 'node:fs'
11
11
  import { Shell } from './Shell.macos.tsrx'
12
- import { devtoolsWindowSize } from './window-size.ts'
13
12
 
14
13
  // The project-built variant sets a Vite define for direct development launches.
15
14
  declare const __XPLAT_DEVTOOLS_PREFERRED_ROOT__: string
@@ -29,21 +28,14 @@ const selftest: { pick?: (index: number) => void } = {}
29
28
  runMacOSApp(
30
29
  {
31
30
  title: 'devtools',
32
- size: devtoolsWindowSize,
31
+ size: { width: 420, height: 720 },
33
32
  terminateAfterLastWindowClosed: true,
34
33
  },
35
- ({ app, window, root }) => {
34
+ ({ window, root }) => {
36
35
  window.contentMinSize = { width: 380, height: 360 }
37
36
  root.render(Shell as never, {
38
37
  preferredRoot: PREFERRED_ROOT,
39
38
  initialTab: SELFTEST_TAB,
40
- onPresent: () => {
41
- if (window.miniaturized) {
42
- window.deminiaturize(null)
43
- }
44
- window.makeKeyAndOrderFront(null)
45
- app.activateIgnoringOtherApps(true)
46
- },
47
39
  onKeepOnTop: (onTop: boolean) => {
48
40
  // NSFloatingWindowLevel (3) above NSNormalWindowLevel (0).
49
41
  const level = onTop ? 3 : 0
@@ -13,7 +13,7 @@ function normalizeRoot(path: string): string {
13
13
  }
14
14
 
15
15
  // Order: an explicit preferred root (the app `xplat devtools` ran from) wins;
16
- // when unbound, a sole record auto-targets; otherwise the picker decides. Both sides are
16
+ // a sole record auto-targets; otherwise the picker decides. Both sides are
17
17
  // canonical real paths — Go writes appRoot through osfs.Canonical and the
18
18
  // launcher realpaths the selected project — so trailing-slash
19
19
  // normalization is defensive only.
@@ -25,7 +25,9 @@ export function autoTarget(
25
25
  const root = normalizeRoot(preferredRoot)
26
26
  const match = records.find((record) => normalizeRoot(record.appRoot) === root)
27
27
 
28
- return match ?? null
28
+ if (match) {
29
+ return match
30
+ }
29
31
  }
30
32
 
31
33
  return records.length === 1 ? records[0] : null