motui 1.0.0__py3-none-any.whl
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.
- motui/__init__.py +146 -0
- motui/__main__.py +15 -0
- motui/app.py +1208 -0
- motui/chrome.py +1260 -0
- motui/demo/__init__.py +87 -0
- motui/demo/__main__.py +8 -0
- motui/demo/content.py +80 -0
- motui/demo/fixture.md +346 -0
- motui/demo/page.py +61 -0
- motui/demo/pages/__init__.py +1 -0
- motui/demo/pages/action.py +51 -0
- motui/demo/pages/choice.py +57 -0
- motui/demo/pages/chrome.py +151 -0
- motui/demo/pages/content.py +137 -0
- motui/demo/pages/data.py +94 -0
- motui/demo/pages/feedback.py +75 -0
- motui/demo/pages/input.py +57 -0
- motui/demo/pages/layout.py +74 -0
- motui/demo/pages/overview.py +38 -0
- motui/demo/pages/streaming.py +192 -0
- motui/demo/pages/styles.py +87 -0
- motui/demo/registry.py +49 -0
- motui/demo/script.py +175 -0
- motui/demo/session.py +444 -0
- motui/demo/shell.py +107 -0
- motui/interaction/__init__.py +31 -0
- motui/interaction/focus.py +267 -0
- motui/interaction/gesture.py +616 -0
- motui/interaction/pointer.py +266 -0
- motui/interaction/search.py +403 -0
- motui/kernel/__init__.py +170 -0
- motui/kernel/ansi.py +277 -0
- motui/kernel/block.py +298 -0
- motui/kernel/events.py +121 -0
- motui/kernel/frame.py +1286 -0
- motui/kernel/lines.py +661 -0
- motui/kernel/painter.py +201 -0
- motui/kernel/screen.py +329 -0
- motui/kernel/selection.py +297 -0
- motui/kernel/style.py +407 -0
- motui/kernel/text.py +581 -0
- motui/kernel/theme.py +172 -0
- motui/kernel/viewport.py +334 -0
- motui/keys/__init__.py +53 -0
- motui/keys/console.py +425 -0
- motui/keys/decoder.py +429 -0
- motui/keys/keymap.py +95 -0
- motui/keys/sources.py +305 -0
- motui/py.typed +0 -0
- motui/testing.py +61 -0
- motui/widgets/__init__.py +99 -0
- motui/widgets/autocomplete.py +105 -0
- motui/widgets/button.py +109 -0
- motui/widgets/checkbox.py +96 -0
- motui/widgets/choice.py +437 -0
- motui/widgets/collapsible.py +172 -0
- motui/widgets/decor.py +245 -0
- motui/widgets/diff.py +281 -0
- motui/widgets/editor.py +107 -0
- motui/widgets/field.py +369 -0
- motui/widgets/input.py +152 -0
- motui/widgets/layout.py +304 -0
- motui/widgets/link.py +75 -0
- motui/widgets/list.py +366 -0
- motui/widgets/markdown/__init__.py +104 -0
- motui/widgets/markdown/blocks.py +336 -0
- motui/widgets/markdown/component.py +473 -0
- motui/widgets/markdown/context.py +35 -0
- motui/widgets/markdown/inline.py +233 -0
- motui/widgets/markdown/nested.py +252 -0
- motui/widgets/markdown/tables.py +113 -0
- motui/widgets/palette.py +145 -0
- motui/widgets/progress.py +96 -0
- motui/widgets/radio.py +221 -0
- motui/widgets/shortcutbar.py +74 -0
- motui/widgets/slider.py +249 -0
- motui/widgets/spinner.py +60 -0
- motui/widgets/statusline.py +111 -0
- motui/widgets/syntax.py +566 -0
- motui/widgets/table.py +698 -0
- motui/widgets/tabs.py +240 -0
- motui/widgets/textbuf.py +813 -0
- motui/widgets/tree.py +403 -0
- motui-1.0.0.dist-info/METADATA +641 -0
- motui-1.0.0.dist-info/RECORD +87 -0
- motui-1.0.0.dist-info/WHEEL +4 -0
- motui-1.0.0.dist-info/licenses/LICENSE +21 -0
motui/__init__.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""motui: a layered, full-screen TUI toolkit.
|
|
2
|
+
|
|
3
|
+
It takes over the terminal on the alternate screen, renders a document of
|
|
4
|
+
addressable blocks one diffed row at a time, owns its own scrollback, and
|
|
5
|
+
keeps pinned bands (fixed top and bottom regions, the frame's own footer)
|
|
6
|
+
that never scroll away.
|
|
7
|
+
|
|
8
|
+
Five layers carry it:
|
|
9
|
+
|
|
10
|
+
* :mod:`motui.kernel` -- the kernel and the root of the dependency graph:
|
|
11
|
+
the frozen :class:`~motui.kernel.block.Component` protocol and the
|
|
12
|
+
addressable ``Block`` document model, the
|
|
13
|
+
:class:`~motui.kernel.lines.Line` / :class:`~motui.kernel.lines.Segment`
|
|
14
|
+
row primitive, :class:`~motui.kernel.style.Style` /
|
|
15
|
+
:class:`~motui.kernel.theme.Theme`, the measuring helpers, the event
|
|
16
|
+
model, the render core (:class:`~motui.kernel.screen.Screen`,
|
|
17
|
+
:class:`~motui.kernel.viewport.Viewport`,
|
|
18
|
+
:class:`~motui.kernel.painter.Painter`), the frame model
|
|
19
|
+
(:class:`~motui.kernel.frame.Pane`, :class:`~motui.kernel.frame.Rect`)
|
|
20
|
+
and the selection kernel (:class:`~motui.kernel.selection.Selection`,
|
|
21
|
+
:func:`~motui.kernel.selection.highlight`,
|
|
22
|
+
:func:`~motui.kernel.selection.extract`).
|
|
23
|
+
* :mod:`motui.keys` -- raw terminal bytes into events: the pure
|
|
24
|
+
:class:`~motui.keys.KeyDecoder`, the keymaps and the terminal key
|
|
25
|
+
sources.
|
|
26
|
+
* :mod:`motui.widgets` -- the generic component library: the renderers plus
|
|
27
|
+
the minimal action primitives, the Markdown rule registries under
|
|
28
|
+
:mod:`motui.widgets.markdown` and the zero-dependency highlighting seam in
|
|
29
|
+
:mod:`motui.widgets.syntax`.
|
|
30
|
+
* :mod:`motui.interaction` -- the four strategy tiers a host mounts on the
|
|
31
|
+
driver: :class:`~motui.interaction.focus.FocusRing`,
|
|
32
|
+
:class:`~motui.interaction.gesture.SelectionGesture` (with
|
|
33
|
+
:func:`~motui.interaction.gesture.copy_on_select`),
|
|
34
|
+
:class:`~motui.interaction.pointer.Pointer` and
|
|
35
|
+
:class:`~motui.interaction.search.Find`.
|
|
36
|
+
* :mod:`motui.app` -- :class:`~motui.app.TUI`, the driver and the
|
|
37
|
+
composition root -- with the assembly tiers beside it:
|
|
38
|
+
:mod:`motui.chrome` (:class:`~motui.chrome.Scrollbar`,
|
|
39
|
+
:class:`~motui.chrome.Toasts`, :class:`~motui.chrome.Tooltip`,
|
|
40
|
+
:class:`~motui.chrome.Stats`) and :mod:`motui.testing`
|
|
41
|
+
(:func:`~motui.testing.headless_tui`,
|
|
42
|
+
:func:`~motui.testing.snapshot`).
|
|
43
|
+
|
|
44
|
+
This module is the curated face: the 31 names one application needs to
|
|
45
|
+
start, in one import line. The root carries the driver, the styling trio
|
|
46
|
+
(:class:`Theme`, :data:`DEFAULT_THEME`, :class:`Style`), the row primitive
|
|
47
|
+
(:class:`Line`, :class:`Segment`), the event trio (:class:`Key`,
|
|
48
|
+
:class:`MouseEvent`, :class:`Paste`), the content, editing, data, selection
|
|
49
|
+
and action components a host reaches for first, the wiring entry points of
|
|
50
|
+
the interaction and chrome tiers, and the two headless helpers. Everything
|
|
51
|
+
else stays public at its own layer namespace::
|
|
52
|
+
|
|
53
|
+
from motui import TUI, Input, Markdown # the root: 31 names
|
|
54
|
+
from motui.widgets import Row, Panel, Diff # a layer: the whole library
|
|
55
|
+
from motui.kernel import Style, Line, Selection # the kernel seam
|
|
56
|
+
from motui.keys import DEFAULT_INPUT_KEYMAP
|
|
57
|
+
from motui.interaction import FocusRing, Pointer, SelectionGesture, Find
|
|
58
|
+
from motui.chrome import Scrollbar, Toasts
|
|
59
|
+
|
|
60
|
+
The deep seams stay public at their own module paths -- the painter, the
|
|
61
|
+
viewport layout, the document model, the frame and the selection kernel
|
|
62
|
+
under :mod:`motui.kernel`, the byte decoder under :mod:`motui.keys`, and
|
|
63
|
+
the Markdown rule registries and the highlighter protocol under
|
|
64
|
+
:mod:`motui.widgets` -- for hosts that reach below the layers.
|
|
65
|
+
|
|
66
|
+
Dependencies point one way: the kernel depends on nothing outside itself,
|
|
67
|
+
``keys`` and ``widgets`` build on it, and the interaction tiers, the driver,
|
|
68
|
+
the chrome and the headless helpers compose them from above.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
72
|
+
|
|
73
|
+
#: The distribution version, read from the installed metadata so the wheel's
|
|
74
|
+
#: number is the only place it can drift from. A source checkout that was
|
|
75
|
+
#: never installed carries no metadata and falls back to the number of the
|
|
76
|
+
#: release it is cut from.
|
|
77
|
+
try:
|
|
78
|
+
__version__ = version("motui")
|
|
79
|
+
except PackageNotFoundError: # pragma: no cover - a pure source checkout
|
|
80
|
+
__version__ = "1.0.0"
|
|
81
|
+
|
|
82
|
+
from .app import TUI
|
|
83
|
+
from .chrome import Scrollbar, Toasts
|
|
84
|
+
from .interaction import FocusRing, Pointer, SelectionGesture
|
|
85
|
+
from .kernel import (
|
|
86
|
+
DEFAULT_THEME,
|
|
87
|
+
Key,
|
|
88
|
+
Line,
|
|
89
|
+
MouseEvent,
|
|
90
|
+
Paste,
|
|
91
|
+
Segment,
|
|
92
|
+
Style,
|
|
93
|
+
Text,
|
|
94
|
+
Theme,
|
|
95
|
+
)
|
|
96
|
+
from .testing import headless_tui, snapshot
|
|
97
|
+
from .widgets import (
|
|
98
|
+
Button,
|
|
99
|
+
Checkbox,
|
|
100
|
+
Editor,
|
|
101
|
+
Input,
|
|
102
|
+
Link,
|
|
103
|
+
List,
|
|
104
|
+
Markdown,
|
|
105
|
+
Option,
|
|
106
|
+
Palette,
|
|
107
|
+
Select,
|
|
108
|
+
StatusLine,
|
|
109
|
+
Table,
|
|
110
|
+
Tabs,
|
|
111
|
+
Tree,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
__all__ = [
|
|
115
|
+
"DEFAULT_THEME",
|
|
116
|
+
"Button",
|
|
117
|
+
"Checkbox",
|
|
118
|
+
"Editor",
|
|
119
|
+
"FocusRing",
|
|
120
|
+
"Input",
|
|
121
|
+
"Key",
|
|
122
|
+
"Line",
|
|
123
|
+
"Link",
|
|
124
|
+
"List",
|
|
125
|
+
"Markdown",
|
|
126
|
+
"MouseEvent",
|
|
127
|
+
"Option",
|
|
128
|
+
"Palette",
|
|
129
|
+
"Paste",
|
|
130
|
+
"Pointer",
|
|
131
|
+
"Scrollbar",
|
|
132
|
+
"Segment",
|
|
133
|
+
"Select",
|
|
134
|
+
"SelectionGesture",
|
|
135
|
+
"StatusLine",
|
|
136
|
+
"Style",
|
|
137
|
+
"TUI",
|
|
138
|
+
"Table",
|
|
139
|
+
"Tabs",
|
|
140
|
+
"Text",
|
|
141
|
+
"Theme",
|
|
142
|
+
"Toasts",
|
|
143
|
+
"Tree",
|
|
144
|
+
"headless_tui",
|
|
145
|
+
"snapshot",
|
|
146
|
+
]
|
motui/__main__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""``python -m motui``: the demo's entry point.
|
|
2
|
+
|
|
3
|
+
The one documented way to run the shipped demo (``ref/demo.md`` §1): the
|
|
4
|
+
module entry the toolkit's peers use (``python -m rich``, ``python -m
|
|
5
|
+
textual``), so a plain ``pip install motui`` gets the exhibits without a
|
|
6
|
+
console script that would read as a CLI tool. This file is only the
|
|
7
|
+
dispatch; the demo lives in :mod:`motui.demo`.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from motui.demo import main
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
raise SystemExit(main())
|