@molecule/app-ide 1.0.0
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/LICENSE +115 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/provider.d.ts +36 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +51 -0
- package/dist/types.d.ts +79 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the
|
|
45
|
+
original version of the Work and any modifications or additions
|
|
46
|
+
to that Work, that is intentionally submitted to the Licensor for
|
|
47
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
48
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
49
|
+
|
|
50
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
52
|
+
subsequently incorporated within the Work.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
58
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
59
|
+
Work and such Derivative Works in Source or Object form.
|
|
60
|
+
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
+
and otherwise transfer the Work.
|
|
66
|
+
|
|
67
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
69
|
+
modifications, and in Source or Object form, provided that You
|
|
70
|
+
meet the following conditions:
|
|
71
|
+
|
|
72
|
+
(a) You must give any other recipients of the Work or
|
|
73
|
+
Derivative Works a copy of this License; and
|
|
74
|
+
|
|
75
|
+
(b) You must cause any modified files to carry prominent notices
|
|
76
|
+
stating that You changed the files; and
|
|
77
|
+
|
|
78
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
79
|
+
that You distribute, all copyright, patent, trademark, and
|
|
80
|
+
attribution notices from the Source form of the Work,
|
|
81
|
+
excluding those notices that do not pertain to any part of
|
|
82
|
+
the Derivative Works; and
|
|
83
|
+
|
|
84
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
|
+
distribution, then any Derivative Works that You distribute must
|
|
86
|
+
include a readable copy of the attribution notices contained
|
|
87
|
+
within such NOTICE file.
|
|
88
|
+
|
|
89
|
+
5. Submission of Contributions.
|
|
90
|
+
|
|
91
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
93
|
+
|
|
94
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
97
|
+
|
|
98
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
99
|
+
any Contributor be liable to You for damages.
|
|
100
|
+
|
|
101
|
+
9. Accepting Warranty or Additional Liability.
|
|
102
|
+
|
|
103
|
+
Copyright 2026 Molecule Dev, Inc.
|
|
104
|
+
|
|
105
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
you may not use this file except in compliance with the License.
|
|
107
|
+
You may obtain a copy of the License at
|
|
108
|
+
|
|
109
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
|
|
111
|
+
Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
See the License for the specific language governing permissions and
|
|
115
|
+
limitations under the License.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDE workspace core interface for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic contract for multi-panel workspace layouts (chat,
|
|
5
|
+
* editor, preview, terminal, …): panel visibility, sizing, active panel,
|
|
6
|
+
* and layout persistence. Bond a provider (e.g. `@molecule/app-ide-default`,
|
|
7
|
+
* which persists layout in browser storage) at startup; a framework binding
|
|
8
|
+
* (e.g. `@molecule/app-ide-react`) renders the layout from this state.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { setProvider, requireProvider } from '@molecule/app-ide'
|
|
13
|
+
* import { provider } from '@molecule/app-ide-default'
|
|
14
|
+
*
|
|
15
|
+
* setProvider(provider) // once, at app startup (bonds.ts)
|
|
16
|
+
*
|
|
17
|
+
* const workspace = requireProvider()
|
|
18
|
+
* workspace.togglePanel('terminal')
|
|
19
|
+
* const unsubscribe = workspace.subscribe((state) => renderLayout(state))
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - **This core manages layout STATE only — panels render via a framework
|
|
24
|
+
* binding** (React: `@molecule/app-ide-react`) or your own components reading
|
|
25
|
+
* `getLayout()` + `subscribe()`. Wire the bond before the workspace mounts.
|
|
26
|
+
* - `subscribe()` returns an unsubscribe function — call it on teardown to avoid
|
|
27
|
+
* duplicate renders after remounts.
|
|
28
|
+
* - `PanelId` accepts custom strings beyond the built-ins ('chat' | 'editor' |
|
|
29
|
+
* 'preview' | 'terminal' | 'deploy' | 'files') — register custom panels in the
|
|
30
|
+
* layout rather than hardcoding a parallel layout system.
|
|
31
|
+
* - Layout persistence is the provider's concern (the default bond uses browser
|
|
32
|
+
* storage) — never write layout state to `localStorage` yourself.
|
|
33
|
+
*
|
|
34
|
+
* @e2e
|
|
35
|
+
* Integration checklist — drive the real rendered UI (live preview, no mocks):
|
|
36
|
+
* `navigate_preview` to the IDE, `read_preview_ui` to snapshot the panel
|
|
37
|
+
* regions, `interact_preview` to drag dividers and toggle panels. Adapt each
|
|
38
|
+
* item to this app's actual panels/layout and check every box off one by one.
|
|
39
|
+
* A box you can't check is an integration bug to fix — not a skip:
|
|
40
|
+
* - [ ] The IDE renders its panel regions in the default layout — snapshot the
|
|
41
|
+
* preview and confirm each visible panel the app configures (e.g. a left
|
|
42
|
+
* sidebar/files, a center editor, a right preview, a bottom terminal) is
|
|
43
|
+
* present and laid out, none overlapping or collapsed to nothing.
|
|
44
|
+
* - [ ] Dragging a divider between two panels resizes the adjacent panels and
|
|
45
|
+
* the sizes update live — grab the handle, drag, and confirm in a fresh
|
|
46
|
+
* snapshot that both neighbors changed size (not the whole window, no
|
|
47
|
+
* snap-back to the previous sizes).
|
|
48
|
+
* - [ ] Toggling a panel's visibility (hide the terminal or the sidebar via its
|
|
49
|
+
* control) removes it from the layout, and toggling again restores it in the
|
|
50
|
+
* same position — the neighbors reflow to fill, they don't leave a blank gap.
|
|
51
|
+
* - [ ] Collapsing a collapsible panel shrinks it out of the way and expanding
|
|
52
|
+
* restores its prior size; clicking into a panel updates the active-panel
|
|
53
|
+
* state (its highlight/toolbar follows the panel you focus).
|
|
54
|
+
* - [ ] A resized / collapsed / hidden layout PERSISTS across a full reload —
|
|
55
|
+
* after reload the panels return at the sizes and visibility you left them,
|
|
56
|
+
* not reset to the default layout (the default bond persists to browser
|
|
57
|
+
* storage).
|
|
58
|
+
* - [ ] A panel's minimum size is respected — dragging a divider to the far end
|
|
59
|
+
* cannot shrink a resizable panel to zero or an unusable sliver; it stops at
|
|
60
|
+
* its configured min.
|
|
61
|
+
*
|
|
62
|
+
* @module
|
|
63
|
+
*/
|
|
64
|
+
export * from './provider.js';
|
|
65
|
+
export * from './types.js';
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDE workspace core interface for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic contract for multi-panel workspace layouts (chat,
|
|
5
|
+
* editor, preview, terminal, …): panel visibility, sizing, active panel,
|
|
6
|
+
* and layout persistence. Bond a provider (e.g. `@molecule/app-ide-default`,
|
|
7
|
+
* which persists layout in browser storage) at startup; a framework binding
|
|
8
|
+
* (e.g. `@molecule/app-ide-react`) renders the layout from this state.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { setProvider, requireProvider } from '@molecule/app-ide'
|
|
13
|
+
* import { provider } from '@molecule/app-ide-default'
|
|
14
|
+
*
|
|
15
|
+
* setProvider(provider) // once, at app startup (bonds.ts)
|
|
16
|
+
*
|
|
17
|
+
* const workspace = requireProvider()
|
|
18
|
+
* workspace.togglePanel('terminal')
|
|
19
|
+
* const unsubscribe = workspace.subscribe((state) => renderLayout(state))
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* - **This core manages layout STATE only — panels render via a framework
|
|
24
|
+
* binding** (React: `@molecule/app-ide-react`) or your own components reading
|
|
25
|
+
* `getLayout()` + `subscribe()`. Wire the bond before the workspace mounts.
|
|
26
|
+
* - `subscribe()` returns an unsubscribe function — call it on teardown to avoid
|
|
27
|
+
* duplicate renders after remounts.
|
|
28
|
+
* - `PanelId` accepts custom strings beyond the built-ins ('chat' | 'editor' |
|
|
29
|
+
* 'preview' | 'terminal' | 'deploy' | 'files') — register custom panels in the
|
|
30
|
+
* layout rather than hardcoding a parallel layout system.
|
|
31
|
+
* - Layout persistence is the provider's concern (the default bond uses browser
|
|
32
|
+
* storage) — never write layout state to `localStorage` yourself.
|
|
33
|
+
*
|
|
34
|
+
* @e2e
|
|
35
|
+
* Integration checklist — drive the real rendered UI (live preview, no mocks):
|
|
36
|
+
* `navigate_preview` to the IDE, `read_preview_ui` to snapshot the panel
|
|
37
|
+
* regions, `interact_preview` to drag dividers and toggle panels. Adapt each
|
|
38
|
+
* item to this app's actual panels/layout and check every box off one by one.
|
|
39
|
+
* A box you can't check is an integration bug to fix — not a skip:
|
|
40
|
+
* - [ ] The IDE renders its panel regions in the default layout — snapshot the
|
|
41
|
+
* preview and confirm each visible panel the app configures (e.g. a left
|
|
42
|
+
* sidebar/files, a center editor, a right preview, a bottom terminal) is
|
|
43
|
+
* present and laid out, none overlapping or collapsed to nothing.
|
|
44
|
+
* - [ ] Dragging a divider between two panels resizes the adjacent panels and
|
|
45
|
+
* the sizes update live — grab the handle, drag, and confirm in a fresh
|
|
46
|
+
* snapshot that both neighbors changed size (not the whole window, no
|
|
47
|
+
* snap-back to the previous sizes).
|
|
48
|
+
* - [ ] Toggling a panel's visibility (hide the terminal or the sidebar via its
|
|
49
|
+
* control) removes it from the layout, and toggling again restores it in the
|
|
50
|
+
* same position — the neighbors reflow to fill, they don't leave a blank gap.
|
|
51
|
+
* - [ ] Collapsing a collapsible panel shrinks it out of the way and expanding
|
|
52
|
+
* restores its prior size; clicking into a panel updates the active-panel
|
|
53
|
+
* state (its highlight/toolbar follows the panel you focus).
|
|
54
|
+
* - [ ] A resized / collapsed / hidden layout PERSISTS across a full reload —
|
|
55
|
+
* after reload the panels return at the sizes and visibility you left them,
|
|
56
|
+
* not reset to the default layout (the default bond persists to browser
|
|
57
|
+
* storage).
|
|
58
|
+
* - [ ] A panel's minimum size is respected — dragging a divider to the far end
|
|
59
|
+
* cannot shrink a resizable panel to zero or an unusable sliver; it stops at
|
|
60
|
+
* its configured min.
|
|
61
|
+
*
|
|
62
|
+
* @module
|
|
63
|
+
*/
|
|
64
|
+
export * from './provider.js';
|
|
65
|
+
export * from './types.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDE workspace bond accessor.
|
|
3
|
+
*
|
|
4
|
+
* Bond packages call `setProvider()` during setup. Application code uses
|
|
5
|
+
* `requireProvider()` to access IDE workspace operations (panels, tabs,
|
|
6
|
+
* file tree, terminal, etc.).
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { WorkspaceProvider } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Registers an IDE workspace provider as the active singleton.
|
|
13
|
+
*
|
|
14
|
+
* @param provider - The workspace provider implementation to bond.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setProvider(provider: WorkspaceProvider): void;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the bonded IDE workspace provider, or `null` if none is bonded.
|
|
19
|
+
*
|
|
20
|
+
* @returns The bonded workspace provider, or `null`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getProvider(): WorkspaceProvider | null;
|
|
23
|
+
/**
|
|
24
|
+
* Checks whether an IDE workspace provider is currently bonded.
|
|
25
|
+
*
|
|
26
|
+
* @returns `true` if an IDE workspace provider is bonded.
|
|
27
|
+
*/
|
|
28
|
+
export declare function hasProvider(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the bonded IDE workspace provider, throwing if none is configured.
|
|
31
|
+
*
|
|
32
|
+
* @returns The bonded workspace provider.
|
|
33
|
+
* @throws {Error} If no IDE workspace provider has been bonded.
|
|
34
|
+
*/
|
|
35
|
+
export declare function requireProvider(): WorkspaceProvider;
|
|
36
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAInD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,GAAG,IAAI,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAUnD"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDE workspace bond accessor.
|
|
3
|
+
*
|
|
4
|
+
* Bond packages call `setProvider()` during setup. Application code uses
|
|
5
|
+
* `requireProvider()` to access IDE workspace operations (panels, tabs,
|
|
6
|
+
* file tree, terminal, etc.).
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { bond, get as bondGet, isBonded } from '@molecule/app-bond';
|
|
11
|
+
import { t } from '@molecule/app-i18n';
|
|
12
|
+
const BOND_TYPE = 'ide';
|
|
13
|
+
/**
|
|
14
|
+
* Registers an IDE workspace provider as the active singleton.
|
|
15
|
+
*
|
|
16
|
+
* @param provider - The workspace provider implementation to bond.
|
|
17
|
+
*/
|
|
18
|
+
export function setProvider(provider) {
|
|
19
|
+
bond(BOND_TYPE, provider);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the bonded IDE workspace provider, or `null` if none is bonded.
|
|
23
|
+
*
|
|
24
|
+
* @returns The bonded workspace provider, or `null`.
|
|
25
|
+
*/
|
|
26
|
+
export function getProvider() {
|
|
27
|
+
return bondGet(BOND_TYPE) ?? null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether an IDE workspace provider is currently bonded.
|
|
31
|
+
*
|
|
32
|
+
* @returns `true` if an IDE workspace provider is bonded.
|
|
33
|
+
*/
|
|
34
|
+
export function hasProvider() {
|
|
35
|
+
return isBonded(BOND_TYPE);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves the bonded IDE workspace provider, throwing if none is configured.
|
|
39
|
+
*
|
|
40
|
+
* @returns The bonded workspace provider.
|
|
41
|
+
* @throws {Error} If no IDE workspace provider has been bonded.
|
|
42
|
+
*/
|
|
43
|
+
export function requireProvider() {
|
|
44
|
+
const provider = bondGet(BOND_TYPE);
|
|
45
|
+
if (!provider) {
|
|
46
|
+
throw new Error(t('ide.error.noProvider', undefined, {
|
|
47
|
+
defaultValue: 'IDE workspace provider not configured. Bond an IDE provider first.',
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
return provider;
|
|
51
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace layout and panel management types.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Identifier for a workspace panel (built-in names or custom strings).
|
|
8
|
+
*/
|
|
9
|
+
export type PanelId = 'chat' | 'editor' | 'preview' | 'terminal' | 'deploy' | 'files' | string;
|
|
10
|
+
/**
|
|
11
|
+
* Position of a panel within the workspace layout.
|
|
12
|
+
*/
|
|
13
|
+
export type PanelPosition = 'left' | 'center' | 'right' | 'bottom';
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for an individual workspace panel including
|
|
16
|
+
* position, sizing constraints, and visibility.
|
|
17
|
+
*/
|
|
18
|
+
export interface PanelConfig {
|
|
19
|
+
id: PanelId;
|
|
20
|
+
position: PanelPosition;
|
|
21
|
+
minWidth?: number;
|
|
22
|
+
minHeight?: number;
|
|
23
|
+
defaultSize?: number;
|
|
24
|
+
resizable?: boolean;
|
|
25
|
+
collapsible?: boolean;
|
|
26
|
+
visible?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Complete workspace layout describing panel arrangement and sizing.
|
|
30
|
+
*/
|
|
31
|
+
export interface WorkspaceLayout {
|
|
32
|
+
panels: PanelConfig[];
|
|
33
|
+
sizes: Record<PanelPosition, number[]>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Current workspace state including layout, active panel,
|
|
37
|
+
* collapsed panels, and fullscreen mode.
|
|
38
|
+
*/
|
|
39
|
+
export interface WorkspaceState {
|
|
40
|
+
layout: WorkspaceLayout;
|
|
41
|
+
activePanel: PanelId | null;
|
|
42
|
+
collapsedPanels: Set<PanelId>;
|
|
43
|
+
isFullscreen: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Configuration options for creating a workspace provider.
|
|
47
|
+
*/
|
|
48
|
+
export interface WorkspaceConfig {
|
|
49
|
+
defaultLayout: WorkspaceLayout;
|
|
50
|
+
persistLayout?: boolean;
|
|
51
|
+
storageKey?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Workspace provider interface that all IDE workspace bond packages
|
|
55
|
+
* must implement. Manages panel layout, sizing, and visibility.
|
|
56
|
+
*/
|
|
57
|
+
export interface WorkspaceProvider {
|
|
58
|
+
/** Provider name identifier. */
|
|
59
|
+
readonly name: string;
|
|
60
|
+
/** Returns the current workspace layout. */
|
|
61
|
+
getLayout(): WorkspaceLayout;
|
|
62
|
+
/** Sets the entire workspace layout. */
|
|
63
|
+
setLayout(layout: WorkspaceLayout): void;
|
|
64
|
+
/** Toggles visibility of a panel by ID. */
|
|
65
|
+
togglePanel(panelId: PanelId): void;
|
|
66
|
+
/** Resizes a panel to the given size. */
|
|
67
|
+
resizePanel(panelId: PanelId, size: number): void;
|
|
68
|
+
/** Sets the active (focused) panel. */
|
|
69
|
+
setActivePanel(panelId: PanelId): void;
|
|
70
|
+
/**
|
|
71
|
+
* Subscribes to workspace state changes.
|
|
72
|
+
*
|
|
73
|
+
* @returns An unsubscribe function.
|
|
74
|
+
*/
|
|
75
|
+
subscribe(callback: (state: WorkspaceState) => void): () => void;
|
|
76
|
+
/** Resets layout to the default configuration. */
|
|
77
|
+
resetLayout(): void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9F;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,aAAa,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,KAAK,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAA;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,eAAe,CAAA;IACvB,WAAW,EAAE,OAAO,GAAG,IAAI,CAAA;IAC3B,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC7B,YAAY,EAAE,OAAO,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,eAAe,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,4CAA4C;IAC5C,SAAS,IAAI,eAAe,CAAA;IAE5B,wCAAwC;IACxC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;IAExC,2CAA2C;IAC3C,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAEnC,yCAAyC;IACzC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAEjD,uCAAuC;IACvC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAEtC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IAEhE,kDAAkD;IAClD,WAAW,IAAI,IAAI,CAAA;CACpB"}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/app-ide",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "IDE workspace layout and resizable panel management",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"workspace",
|
|
25
|
+
"layout",
|
|
26
|
+
"panels"
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@molecule/app-bond": "^1.0.0",
|
|
31
|
+
"@molecule/app-i18n": "^1.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@molecule/app-bond": "1.0.0",
|
|
35
|
+
"@molecule/app-i18n": "1.0.0",
|
|
36
|
+
"@types/node": "26.1.2",
|
|
37
|
+
"typescript": "6.0.3",
|
|
38
|
+
"vitest": "4.1.10"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
43
|
+
"directory": "packages/app/core/ide"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/app/core/ide",
|
|
46
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|