@molecule/app-ide-default 1.0.0 → 1.0.1
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/README.md +188 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:51:03.945Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-ide-default
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
Default IDE workspace provider for molecule.dev — panel layout state
|
|
16
|
+
(chat / editor / preview), sizes, collapse/active state, with optional
|
|
17
|
+
persistence through an injectable storage adapter.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { setProvider } from '@molecule/app-ide'
|
|
23
|
+
import { provider } from '@molecule/app-ide-default'
|
|
24
|
+
|
|
25
|
+
setProvider(provider) // once, at app startup (bonds.ts)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Type
|
|
29
|
+
|
|
30
|
+
`provider`
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @molecule/app-ide-default @molecule/app-ide
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### Interfaces
|
|
41
|
+
|
|
42
|
+
#### `DefaultWorkspaceConfig`
|
|
43
|
+
|
|
44
|
+
Configuration for default workspace.
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
interface DefaultWorkspaceConfig {
|
|
48
|
+
/** Default panel layout. */
|
|
49
|
+
defaultLayout?: WorkspaceLayout
|
|
50
|
+
/** Persist layout using the provided storage adapter. */
|
|
51
|
+
persistLayout?: boolean
|
|
52
|
+
/** Key for storage persistence. */
|
|
53
|
+
storageKey?: string
|
|
54
|
+
/** Storage adapter for persistence. Required when persistLayout is true. */
|
|
55
|
+
storage?: StorageAdapter
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### `StorageAdapter`
|
|
60
|
+
|
|
61
|
+
Adapter interface for storage.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
interface StorageAdapter {
|
|
65
|
+
getItem(key: string): string | null
|
|
66
|
+
setItem(key: string, value: string): void
|
|
67
|
+
removeItem(key: string): void
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Classes
|
|
72
|
+
|
|
73
|
+
#### `DefaultWorkspaceProvider`
|
|
74
|
+
|
|
75
|
+
Default implementation of `WorkspaceProvider`. Manages panel layout (chat, editor, preview),
|
|
76
|
+
sizes, visibility, collapse state, and optional persistence via a storage adapter.
|
|
77
|
+
|
|
78
|
+
### Functions
|
|
79
|
+
|
|
80
|
+
#### `createProvider(config)`
|
|
81
|
+
|
|
82
|
+
Creates a `DefaultWorkspaceProvider` with optional layout configuration and persistence.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
function createProvider(config?: DefaultWorkspaceConfig): DefaultWorkspaceProvider
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- `config` — Workspace configuration (default layout, persistence options, storage adapter).
|
|
89
|
+
|
|
90
|
+
**Returns:** A `DefaultWorkspaceProvider` that manages panel layout state.
|
|
91
|
+
|
|
92
|
+
#### `getBrowserStorage()`
|
|
93
|
+
|
|
94
|
+
Returns a {@link StorageAdapter} backed by the browser's `localStorage`, or
|
|
95
|
+
`null` when no usable `localStorage` exists. A `null` result means
|
|
96
|
+
"persistence unavailable — fall back to in-memory".
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
function getBrowserStorage(): StorageAdapter | null
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Returns:** A `localStorage`-backed adapter, or `null` if unavailable.
|
|
103
|
+
|
|
104
|
+
### Constants
|
|
105
|
+
|
|
106
|
+
#### `provider`
|
|
107
|
+
|
|
108
|
+
Pre-instantiated provider singleton. Persists the layout to the browser's
|
|
109
|
+
`localStorage` when available, so a panel resize survives a page reload;
|
|
110
|
+
falls back to a non-persistent in-memory provider where storage is missing
|
|
111
|
+
or blocked (SSR, tests). Consumers wanting different behavior (a custom
|
|
112
|
+
storage adapter, key, or opting out) should call {@link createProvider}.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const provider: DefaultWorkspaceProvider
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Core Interface
|
|
119
|
+
|
|
120
|
+
Implements `@molecule/app-ide` interface.
|
|
121
|
+
|
|
122
|
+
## Bond Wiring
|
|
123
|
+
|
|
124
|
+
Setup function to register this provider with the core interface:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { setProvider } from '@molecule/app-ide'
|
|
128
|
+
import { provider } from '@molecule/app-ide-default'
|
|
129
|
+
|
|
130
|
+
export function setupIdeDefault(): void {
|
|
131
|
+
setProvider(provider)
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Injection Notes
|
|
136
|
+
|
|
137
|
+
### Requirements
|
|
138
|
+
|
|
139
|
+
Peer dependencies:
|
|
140
|
+
|
|
141
|
+
- `@molecule/app-ide` ^1.0.1
|
|
142
|
+
|
|
143
|
+
### Runtime Dependencies
|
|
144
|
+
|
|
145
|
+
- `@molecule/app-ide`
|
|
146
|
+
|
|
147
|
+
- **A persisted layout SHADOWS default-layout changes.** The `provider`
|
|
148
|
+
singleton saves to `localStorage` key `'molecule-workspace-layout'`; once a
|
|
149
|
+
user has a saved layout, changes to `defaultLayout` (or the built-in
|
|
150
|
+
default) have no visible effect until `resetLayout()` runs or the key is
|
|
151
|
+
cleared. If "my layout change doesn't show up", this is why.
|
|
152
|
+
- Default layout: `chat` (left, 25%) / `editor` (center, 50%) / `preview`
|
|
153
|
+
(right, 25%). `PanelId` accepts custom strings — extend the layout rather
|
|
154
|
+
than building a parallel one.
|
|
155
|
+
- State-only: pair with `@molecule/app-ide-react` (or your own renderer
|
|
156
|
+
reading `getLayout()` + `subscribe()`).
|
|
157
|
+
- Need different persistence (custom adapter, key, or none)? Build your own
|
|
158
|
+
instance with `createProvider({...})` instead of the singleton.
|
|
159
|
+
|
|
160
|
+
## E2E Tests
|
|
161
|
+
|
|
162
|
+
Integration checklist — drive the real rendered UI (live preview, no mocks):
|
|
163
|
+
`navigate_preview` to the IDE, `read_preview_ui` to snapshot the panel
|
|
164
|
+
regions, `interact_preview` to drag dividers and toggle panels. Adapt each
|
|
165
|
+
item to this app's actual panels/layout and check every box off one by one.
|
|
166
|
+
A box you can't check is an integration bug to fix — not a skip:
|
|
167
|
+
|
|
168
|
+
- [ ] The IDE renders its panel regions in the default layout — snapshot the
|
|
169
|
+
preview and confirm each visible panel the app configures (e.g. a left
|
|
170
|
+
sidebar/files, a center editor, a right preview, a bottom terminal) is
|
|
171
|
+
present and laid out, none overlapping or collapsed to nothing.
|
|
172
|
+
- [ ] Dragging a divider between two panels resizes the adjacent panels and
|
|
173
|
+
the sizes update live — grab the handle, drag, and confirm in a fresh
|
|
174
|
+
snapshot that both neighbors changed size (not the whole window, no
|
|
175
|
+
snap-back to the previous sizes).
|
|
176
|
+
- [ ] Toggling a panel's visibility (hide the terminal or the sidebar via its
|
|
177
|
+
control) removes it from the layout, and toggling again restores it in the
|
|
178
|
+
same position — the neighbors reflow to fill, they don't leave a blank gap.
|
|
179
|
+
- [ ] Collapsing a collapsible panel shrinks it out of the way and expanding
|
|
180
|
+
restores its prior size; clicking into a panel updates the active-panel
|
|
181
|
+
state (its highlight/toolbar follows the panel you focus).
|
|
182
|
+
- [ ] A resized / collapsed / hidden layout PERSISTS across a full reload —
|
|
183
|
+
after reload the panels return at the sizes and visibility you left them,
|
|
184
|
+
not reset to the default layout (the default bond persists to browser
|
|
185
|
+
storage).
|
|
186
|
+
- [ ] A panel's minimum size is respected — dragging a divider to the far end
|
|
187
|
+
cannot shrink a resizable panel to zero or an unusable sliver; it stops at
|
|
188
|
+
its configured min.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-ide-default",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Default workspace layout provider with panel management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|
|
@@ -27,13 +28,13 @@
|
|
|
27
28
|
],
|
|
28
29
|
"license": "Apache-2.0",
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@molecule/app-ide": "1.0.
|
|
31
|
+
"@molecule/app-ide": "1.0.1",
|
|
31
32
|
"@types/node": "26.1.2",
|
|
32
33
|
"typescript": "6.0.3",
|
|
33
34
|
"vitest": "4.1.10"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
|
-
"@molecule/app-ide": "^1.0.
|
|
37
|
+
"@molecule/app-ide": "^1.0.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependenciesMeta": {
|
|
39
40
|
"@molecule/app-ide": {
|