mkui 0.1.0__tar.gz

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.
mkui-0.1.0/LICENSE ADDED
@@ -0,0 +1,190 @@
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
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Mark Kim
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
mkui-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: mkui
3
+ Version: 0.1.0
4
+ Summary: Config-driven, zero-dependency web GUI framework with dockable panes
5
+ Author: Mark Kim
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/markuskimius/mkui
8
+ Project-URL: Repository, https://github.com/markuskimius/mkui
9
+ Keywords: gui,web,framework,dockable,config-driven
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: JavaScript
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Internet :: WWW/HTTP
15
+ Classifier: Topic :: Software Development :: User Interfaces
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ # mkui
22
+
23
+ A config-driven, dependency-free web GUI framework with a floating-frame
24
+ workspace and dockable panes inside each frame. Designed to pair with
25
+ [mkio](../mkio) — the same project's TOML-driven microservice backend —
26
+ but works against any backend (or none at all).
27
+
28
+ ## Model
29
+
30
+ ```
31
+ mkui-app
32
+ ├── mkui-menubar
33
+ ├── mkui-workspace
34
+ │ ├── mkui-frame ← floating, movable, resizable. Clamped to workspace.
35
+ │ │ └── layout tree
36
+ │ │ └── TabGroup
37
+ │ │ ├── tab bar
38
+ │ │ └── mkui-pane ← leaf content host
39
+ │ ├── mkui-frame
40
+ │ │ └── split (h | v)
41
+ │ │ ├── TabGroup → panes
42
+ │ │ └── TabGroup → panes
43
+ │ └── ...
44
+ └── mkui-statusbar
45
+ ```
46
+
47
+ Top-level windows are **frames** — floating chrome with titlebar and 8-way
48
+ resize. Frames don't dock into each other. Inside each frame lives an
49
+ independent, normalized layout tree of **splits**, **tab groups**, and
50
+ **panes**. Docking — splitting, tabbing, tearing out — happens entirely
51
+ inside frames.
52
+
53
+ **Design commitments** (things meant to hold up indefinitely):
54
+
55
+ - **Structural invariant**: every pane leaf sits inside a tab group. A
56
+ single-pane frame is a single-tab group. This removes a whole class of
57
+ special cases from the renderer and the drop logic.
58
+ - **Proportional resize by construction**: frame positions are fractions
59
+ of the workspace rect, and split ratios sum to 1. Resizing the browser
60
+ rescales every frame, every split, and every pane with no extra code.
61
+ - **Viewport clamping invariant**: every frame move/resize passes through
62
+ a single `clampToDock` helper. Frames cannot escape the workspace —
63
+ shrinking the viewport drags stragglers back in.
64
+ - **Stable pane identity**: pane elements live in a workspace-owned pool
65
+ and are re-parented via `appendChild` when re-docked. Content state,
66
+ subscriptions, scroll position, and DOM focus all survive.
67
+ - **Zero runtime dependencies.** Web Components, so it drops into
68
+ React / Vue / Svelte / vanilla identically.
69
+
70
+ ## Interactions
71
+
72
+ - **Frame titlebar** → drag to move (clamped). **Frame edges/corners** →
73
+ 8-way resize (clamped, min 160×80).
74
+ - **Frame close button** → closes the frame; panes inside are parked in
75
+ the pool (state preserved) and can be brought back by code.
76
+ - **Tab click** → switch active pane in that tab group.
77
+ - **Tab drag** → if the cursor leaves the tab bar by more than a few
78
+ pixels, the pane is **torn out** into a new frame at the cursor.
79
+ - **Dragging a torn-out (or any single-pane) frame over another frame**
80
+ shows drop zones: edges split, center adds as a tab. Release to dock.
81
+ - **Splitter drag** → resize the ratio between two children of a split.
82
+ - **Any mousedown inside a frame** raises it to the top of the z-order.
83
+
84
+ ## Configs
85
+
86
+ mkui's runtime input is JSON. When the backend is mkio, mkio's Python
87
+ side parses `app.toml` with stdlib `tomllib` and serves the result as
88
+ JSON — so the browser never needs a TOML parser. For other backends,
89
+ author or generate `app.json` directly.
90
+
91
+ Minimal config:
92
+
93
+ ```json
94
+ {
95
+ "app": { "title": "Trading desk", "theme": "dark" },
96
+ "menubar": [{ "label": "File", "items": [{ "label": "Quit", "action": "app.quit" }] }],
97
+ "statusbar": { "left": [{ "type": "text", "bind": "status.message" }] },
98
+
99
+ "panes": {
100
+ "orders": { "title": "Orders", "type": "mkio-table", "service": "all_orders" },
101
+ "chart": { "title": "Chart", "widgets": [{ "type": "text", "text": "Chart goes here" }] },
102
+ "inspector": { "title": "Inspector", "widgets": [{ "type": "text", "text": "Properties" }] }
103
+ },
104
+
105
+ "frames": [
106
+ {
107
+ "id": "main",
108
+ "x": 0.05, "y": 0.05, "w": 0.65, "h": 0.9,
109
+ "layout": { "type": "tabs", "active": 0, "children": ["orders", "chart"] }
110
+ },
111
+ {
112
+ "id": "aux",
113
+ "x": 0.72, "y": 0.05, "w": 0.23, "h": 0.9,
114
+ "layout": { "type": "tabs", "children": ["inspector"] }
115
+ }
116
+ ],
117
+
118
+ "mkio": { "url": "ws://localhost:8080/ws" }
119
+ }
120
+ ```
121
+
122
+ Frame positions (`x`, `y`, `w`, `h`) are fractions of the workspace rect.
123
+
124
+ ## Standalone mode
125
+
126
+ ```html
127
+ <!doctype html>
128
+ <link rel="stylesheet" href="/mkui/styles/mkui.css">
129
+ <script type="module" src="/mkui/src/index.js"></script>
130
+ <mkui-app config="/mkui/config.json"></mkui-app>
131
+ ```
132
+
133
+ ## Library mode
134
+
135
+ ```js
136
+ import { registerPaneType } from "mkui";
137
+ import "mkui"; // side-effect: registers custom elements
138
+
139
+ registerPaneType("clock", (spec, app, host) => {
140
+ const el = document.createElement("div");
141
+ host.appendChild(el);
142
+ setInterval(() => { el.textContent = new Date().toLocaleTimeString(); }, 1000);
143
+ });
144
+
145
+ const root = document.querySelector("mkui-app");
146
+ await customElements.whenDefined("mkui-app");
147
+ root.setConfig({
148
+ panes: { clock: { title: "Clock", type: "clock" } },
149
+ frames: [{ id: "f1", x: 0.3, y: 0.3, w: 0.3, h: 0.3,
150
+ layout: { type: "tabs", children: ["clock"] } }],
151
+ });
152
+
153
+ // Add more frames at runtime:
154
+ root.workspace.addFrame({ x: 0.5, y: 0.1, w: 0.4, h: 0.4,
155
+ layout: { type: "tabs", children: ["other-pane"] } });
156
+ ```
157
+
158
+ ## Built-in widgets and pane types (v1)
159
+
160
+ - Widgets (lightweight content inside a pane or statusbar slot):
161
+ - `text` — static or `bind`-ed to a state path
162
+ - `button` — fires an action by name
163
+ - Pane types (whole-pane custom rendering):
164
+ - `mkio-table` — subscribes to an mkio subpub service and renders rows
165
+ - Custom pane types are the primary extensibility surface. Register with
166
+ `registerPaneType(name, factory)`; reference from config as `type = "<name>"`.
167
+
168
+ ## Installation
169
+
170
+ ```
171
+ pip install mkui
172
+ ```
173
+
174
+ Then serve the static assets from your Python backend:
175
+
176
+ ```python
177
+ import mkui
178
+
179
+ # With mkio (toml config):
180
+ # [static]
181
+ # "/mkui" = "<result of mkui.static_dir>"
182
+
183
+ # With FastAPI / Starlette:
184
+ from starlette.staticfiles import StaticFiles
185
+ app.mount("/mkui", StaticFiles(directory=mkui.static_dir))
186
+ ```
187
+
188
+ ## Running the examples
189
+
190
+ ```
191
+ cd mkui/static
192
+ python3 -m http.server 8000
193
+ # http://localhost:8000/examples/standalone-json/
194
+ # http://localhost:8000/examples/library-js/
195
+ ```
196
+
197
+ ## Project layout
198
+
199
+ ```
200
+ mkui/ Python package (pip install mkui)
201
+ __init__.py Exposes static_dir path
202
+ static/
203
+ src/
204
+ core.js State store, registries, App class
205
+ index.js Side-effect entry point
206
+ layout/
207
+ tree.js Normalized tree math
208
+ drag.js clampToDock, snap, dropZoneFor, frac↔rect
209
+ components/
210
+ app.js <mkui-app> — the shell
211
+ menubar.js <mkui-menubar>
212
+ statusbar.js <mkui-statusbar>
213
+ workspace.js <mkui-workspace> — frame list, arrangement, snap
214
+ frame.js <mkui-frame> + <mkui-pane>
215
+ widgets/
216
+ text.js button.js mkio-table.js
217
+ mkio-bridge.js Lazy-loads mkio's /mkio.js client
218
+ styles/mkui.css Default theme (CSS custom properties)
219
+ examples/
220
+ standalone-json/ Loaded from a static config
221
+ library-js/ Built imperatively from JS
222
+ pyproject.toml Python build config
223
+ package.json JS dev tooling
224
+ tests/layout.test.js 33 unit tests
225
+ ```
mkui-0.1.0/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # mkui
2
+
3
+ A config-driven, dependency-free web GUI framework with a floating-frame
4
+ workspace and dockable panes inside each frame. Designed to pair with
5
+ [mkio](../mkio) — the same project's TOML-driven microservice backend —
6
+ but works against any backend (or none at all).
7
+
8
+ ## Model
9
+
10
+ ```
11
+ mkui-app
12
+ ├── mkui-menubar
13
+ ├── mkui-workspace
14
+ │ ├── mkui-frame ← floating, movable, resizable. Clamped to workspace.
15
+ │ │ └── layout tree
16
+ │ │ └── TabGroup
17
+ │ │ ├── tab bar
18
+ │ │ └── mkui-pane ← leaf content host
19
+ │ ├── mkui-frame
20
+ │ │ └── split (h | v)
21
+ │ │ ├── TabGroup → panes
22
+ │ │ └── TabGroup → panes
23
+ │ └── ...
24
+ └── mkui-statusbar
25
+ ```
26
+
27
+ Top-level windows are **frames** — floating chrome with titlebar and 8-way
28
+ resize. Frames don't dock into each other. Inside each frame lives an
29
+ independent, normalized layout tree of **splits**, **tab groups**, and
30
+ **panes**. Docking — splitting, tabbing, tearing out — happens entirely
31
+ inside frames.
32
+
33
+ **Design commitments** (things meant to hold up indefinitely):
34
+
35
+ - **Structural invariant**: every pane leaf sits inside a tab group. A
36
+ single-pane frame is a single-tab group. This removes a whole class of
37
+ special cases from the renderer and the drop logic.
38
+ - **Proportional resize by construction**: frame positions are fractions
39
+ of the workspace rect, and split ratios sum to 1. Resizing the browser
40
+ rescales every frame, every split, and every pane with no extra code.
41
+ - **Viewport clamping invariant**: every frame move/resize passes through
42
+ a single `clampToDock` helper. Frames cannot escape the workspace —
43
+ shrinking the viewport drags stragglers back in.
44
+ - **Stable pane identity**: pane elements live in a workspace-owned pool
45
+ and are re-parented via `appendChild` when re-docked. Content state,
46
+ subscriptions, scroll position, and DOM focus all survive.
47
+ - **Zero runtime dependencies.** Web Components, so it drops into
48
+ React / Vue / Svelte / vanilla identically.
49
+
50
+ ## Interactions
51
+
52
+ - **Frame titlebar** → drag to move (clamped). **Frame edges/corners** →
53
+ 8-way resize (clamped, min 160×80).
54
+ - **Frame close button** → closes the frame; panes inside are parked in
55
+ the pool (state preserved) and can be brought back by code.
56
+ - **Tab click** → switch active pane in that tab group.
57
+ - **Tab drag** → if the cursor leaves the tab bar by more than a few
58
+ pixels, the pane is **torn out** into a new frame at the cursor.
59
+ - **Dragging a torn-out (or any single-pane) frame over another frame**
60
+ shows drop zones: edges split, center adds as a tab. Release to dock.
61
+ - **Splitter drag** → resize the ratio between two children of a split.
62
+ - **Any mousedown inside a frame** raises it to the top of the z-order.
63
+
64
+ ## Configs
65
+
66
+ mkui's runtime input is JSON. When the backend is mkio, mkio's Python
67
+ side parses `app.toml` with stdlib `tomllib` and serves the result as
68
+ JSON — so the browser never needs a TOML parser. For other backends,
69
+ author or generate `app.json` directly.
70
+
71
+ Minimal config:
72
+
73
+ ```json
74
+ {
75
+ "app": { "title": "Trading desk", "theme": "dark" },
76
+ "menubar": [{ "label": "File", "items": [{ "label": "Quit", "action": "app.quit" }] }],
77
+ "statusbar": { "left": [{ "type": "text", "bind": "status.message" }] },
78
+
79
+ "panes": {
80
+ "orders": { "title": "Orders", "type": "mkio-table", "service": "all_orders" },
81
+ "chart": { "title": "Chart", "widgets": [{ "type": "text", "text": "Chart goes here" }] },
82
+ "inspector": { "title": "Inspector", "widgets": [{ "type": "text", "text": "Properties" }] }
83
+ },
84
+
85
+ "frames": [
86
+ {
87
+ "id": "main",
88
+ "x": 0.05, "y": 0.05, "w": 0.65, "h": 0.9,
89
+ "layout": { "type": "tabs", "active": 0, "children": ["orders", "chart"] }
90
+ },
91
+ {
92
+ "id": "aux",
93
+ "x": 0.72, "y": 0.05, "w": 0.23, "h": 0.9,
94
+ "layout": { "type": "tabs", "children": ["inspector"] }
95
+ }
96
+ ],
97
+
98
+ "mkio": { "url": "ws://localhost:8080/ws" }
99
+ }
100
+ ```
101
+
102
+ Frame positions (`x`, `y`, `w`, `h`) are fractions of the workspace rect.
103
+
104
+ ## Standalone mode
105
+
106
+ ```html
107
+ <!doctype html>
108
+ <link rel="stylesheet" href="/mkui/styles/mkui.css">
109
+ <script type="module" src="/mkui/src/index.js"></script>
110
+ <mkui-app config="/mkui/config.json"></mkui-app>
111
+ ```
112
+
113
+ ## Library mode
114
+
115
+ ```js
116
+ import { registerPaneType } from "mkui";
117
+ import "mkui"; // side-effect: registers custom elements
118
+
119
+ registerPaneType("clock", (spec, app, host) => {
120
+ const el = document.createElement("div");
121
+ host.appendChild(el);
122
+ setInterval(() => { el.textContent = new Date().toLocaleTimeString(); }, 1000);
123
+ });
124
+
125
+ const root = document.querySelector("mkui-app");
126
+ await customElements.whenDefined("mkui-app");
127
+ root.setConfig({
128
+ panes: { clock: { title: "Clock", type: "clock" } },
129
+ frames: [{ id: "f1", x: 0.3, y: 0.3, w: 0.3, h: 0.3,
130
+ layout: { type: "tabs", children: ["clock"] } }],
131
+ });
132
+
133
+ // Add more frames at runtime:
134
+ root.workspace.addFrame({ x: 0.5, y: 0.1, w: 0.4, h: 0.4,
135
+ layout: { type: "tabs", children: ["other-pane"] } });
136
+ ```
137
+
138
+ ## Built-in widgets and pane types (v1)
139
+
140
+ - Widgets (lightweight content inside a pane or statusbar slot):
141
+ - `text` — static or `bind`-ed to a state path
142
+ - `button` — fires an action by name
143
+ - Pane types (whole-pane custom rendering):
144
+ - `mkio-table` — subscribes to an mkio subpub service and renders rows
145
+ - Custom pane types are the primary extensibility surface. Register with
146
+ `registerPaneType(name, factory)`; reference from config as `type = "<name>"`.
147
+
148
+ ## Installation
149
+
150
+ ```
151
+ pip install mkui
152
+ ```
153
+
154
+ Then serve the static assets from your Python backend:
155
+
156
+ ```python
157
+ import mkui
158
+
159
+ # With mkio (toml config):
160
+ # [static]
161
+ # "/mkui" = "<result of mkui.static_dir>"
162
+
163
+ # With FastAPI / Starlette:
164
+ from starlette.staticfiles import StaticFiles
165
+ app.mount("/mkui", StaticFiles(directory=mkui.static_dir))
166
+ ```
167
+
168
+ ## Running the examples
169
+
170
+ ```
171
+ cd mkui/static
172
+ python3 -m http.server 8000
173
+ # http://localhost:8000/examples/standalone-json/
174
+ # http://localhost:8000/examples/library-js/
175
+ ```
176
+
177
+ ## Project layout
178
+
179
+ ```
180
+ mkui/ Python package (pip install mkui)
181
+ __init__.py Exposes static_dir path
182
+ static/
183
+ src/
184
+ core.js State store, registries, App class
185
+ index.js Side-effect entry point
186
+ layout/
187
+ tree.js Normalized tree math
188
+ drag.js clampToDock, snap, dropZoneFor, frac↔rect
189
+ components/
190
+ app.js <mkui-app> — the shell
191
+ menubar.js <mkui-menubar>
192
+ statusbar.js <mkui-statusbar>
193
+ workspace.js <mkui-workspace> — frame list, arrangement, snap
194
+ frame.js <mkui-frame> + <mkui-pane>
195
+ widgets/
196
+ text.js button.js mkio-table.js
197
+ mkio-bridge.js Lazy-loads mkio's /mkio.js client
198
+ styles/mkui.css Default theme (CSS custom properties)
199
+ examples/
200
+ standalone-json/ Loaded from a static config
201
+ library-js/ Built imperatively from JS
202
+ pyproject.toml Python build config
203
+ package.json JS dev tooling
204
+ tests/layout.test.js 33 unit tests
205
+ ```
@@ -0,0 +1,19 @@
1
+ """mkui — config-driven web GUI framework with dockable panes."""
2
+
3
+ from pathlib import Path
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ static_dir = Path(__file__).parent / "static"
8
+ """Path to the directory containing mkui's JS, CSS, and example files.
9
+
10
+ Serve this directory from your web server to make mkui available to browsers::
11
+
12
+ # With mkio:
13
+ [static]
14
+ "/mkui" = "<mkui.static_dir>"
15
+
16
+ # With any ASGI/WSGI framework:
17
+ import mkui
18
+ app.mount("/mkui", StaticFiles(directory=mkui.static_dir))
19
+ """