@opensip-cli/cli-ui 0.1.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 +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/banner.d.ts +70 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +203 -0
- package/dist/banner.js.map +1 -0
- package/dist/clock.d.ts +28 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +45 -0
- package/dist/clock.js.map +1 -0
- package/dist/error-message.d.ts +12 -0
- package/dist/error-message.d.ts.map +1 -0
- package/dist/error-message.js +13 -0
- package/dist/error-message.js.map +1 -0
- package/dist/fit-table-format.d.ts +35 -0
- package/dist/fit-table-format.d.ts.map +1 -0
- package/dist/fit-table-format.js +48 -0
- package/dist/fit-table-format.js.map +1 -0
- package/dist/format-duration.d.ts +13 -0
- package/dist/format-duration.d.ts.map +1 -0
- package/dist/format-duration.js +23 -0
- package/dist/format-duration.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/live-progress.d.ts +57 -0
- package/dist/live-progress.d.ts.map +1 -0
- package/dist/live-progress.js +106 -0
- package/dist/live-progress.js.map +1 -0
- package/dist/progress-event.d.ts +66 -0
- package/dist/progress-event.d.ts.map +1 -0
- package/dist/progress-event.js +21 -0
- package/dist/progress-event.js.map +1 -0
- package/dist/project-header.d.ts +31 -0
- package/dist/project-header.d.ts.map +1 -0
- package/dist/project-header.js +38 -0
- package/dist/project-header.js.map +1 -0
- package/dist/render-to-ink.d.ts +15 -0
- package/dist/render-to-ink.d.ts.map +1 -0
- package/dist/render-to-ink.js +104 -0
- package/dist/render-to-ink.js.map +1 -0
- package/dist/render-to-text.d.ts +24 -0
- package/dist/render-to-text.d.ts.map +1 -0
- package/dist/render-to-text.js +86 -0
- package/dist/render-to-text.js.map +1 -0
- package/dist/run-footer-hints.d.ts +32 -0
- package/dist/run-footer-hints.d.ts.map +1 -0
- package/dist/run-footer-hints.js +33 -0
- package/dist/run-footer-hints.js.map +1 -0
- package/dist/run-header.d.ts +25 -0
- package/dist/run-header.d.ts.map +1 -0
- package/dist/run-header.js +19 -0
- package/dist/run-header.js.map +1 -0
- package/dist/run-summary.d.ts +48 -0
- package/dist/run-summary.d.ts.map +1 -0
- package/dist/run-summary.js +56 -0
- package/dist/run-summary.js.map +1 -0
- package/dist/run-timing-provider.d.ts +59 -0
- package/dist/run-timing-provider.d.ts.map +1 -0
- package/dist/run-timing-provider.js +52 -0
- package/dist/run-timing-provider.js.map +1 -0
- package/dist/spinner.d.ts +29 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +44 -0
- package/dist/spinner.js.map +1 -0
- package/dist/theme.d.ts +42 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +96 -0
- package/dist/theme.js.map +1 -0
- package/dist/verbose-detail.d.ts +43 -0
- package/dist/verbose-detail.d.ts.map +1 -0
- package/dist/verbose-detail.js +104 -0
- package/dist/verbose-detail.js.map +1 -0
- package/dist/view-model.d.ts +132 -0
- package/dist/view-model.d.ts.map +1 -0
- package/dist/view-model.js +71 -0
- package/dist/view-model.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
OpenSIP CLI
|
|
2
|
+
Copyright 2026 opensip-ai
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this software except in compliance with the License. A copy of the License is
|
|
6
|
+
included in the LICENSE file and is also available at:
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-package-readmes.mjs — do not edit by hand.
|
|
2
|
+
Change the package's "description" (or the generator template) and run
|
|
3
|
+
`pnpm docs:readmes`. CI enforces sync via `pnpm docs:readmes:check`. -->
|
|
4
|
+
|
|
5
|
+
# @opensip-cli/cli-ui
|
|
6
|
+
|
|
7
|
+
> Shared Ink/React presentational primitives for OpenSIP CLI CLI tools — banner, spinner, run header, theme. Used by every tool that ships an Ink live view.
|
|
8
|
+
|
|
9
|
+
This is an **internal library** of the opensip-cli toolkit. It is published so the CLI and tools can depend on it; most users will not install it directly.
|
|
10
|
+
|
|
11
|
+
Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase-analysis toolkit: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Most users install the CLI, which bundles the first-party tools:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
curl -fsSL https://opensip.ai/cli/install.sh | bash
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This package is published for the CLI and advanced plugin authors; most users should not install `@opensip-cli/cli-ui` directly.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- 📚 Project docs: https://opensip.ai/docs/opensip-cli/
|
|
26
|
+
- 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.0/docs/public/70-reference/02-package-catalog.md
|
|
27
|
+
- 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.0/packages/cli-ui
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
Apache-2.0 © opensip-ai
|
package/dist/banner.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Banner — the OpenSIP CLI ASCII art banner. Used as the header for every
|
|
3
|
+
* live-view tool runner and for App.tsx's static-render path.
|
|
4
|
+
*
|
|
5
|
+
* Four sizes are available via the `size` prop:
|
|
6
|
+
* - `lg` (default) — the full 8-row 3-D banner with shaded depth.
|
|
7
|
+
* - `md` — half-height. The OPENSIP wordmark is a mechanical half-block
|
|
8
|
+
* downscale of the `lg` art; the coffee cup + steam is hand-authored
|
|
9
|
+
* block art (a downscale smears away the handle-hole and saucer that
|
|
10
|
+
* make it read as a mug).
|
|
11
|
+
* - `sm` — half-height AND half-width (quarter-block wordmark, smaller mug).
|
|
12
|
+
* - `mini` — a compact, boxed identity card: a small amber coffee cup on
|
|
13
|
+
* the left and four info lines on the right (`opensip-cli v1.0.0`,
|
|
14
|
+
* the tagline, the `www.opensip.ai` URL, and the project path), framed in
|
|
15
|
+
* a rounded amber border. Modeled on the Claude Code session card. Unlike
|
|
16
|
+
* the wordmark sizes it carries the version + project path inline, so
|
|
17
|
+
* callers SUPPRESS the separate `ProjectHeader` line when `mini` is
|
|
18
|
+
* selected (the path would otherwise render twice).
|
|
19
|
+
*
|
|
20
|
+
* In the wordmark sizes (`lg`/`md`/`sm`) OPEN is brand-coloured and SIP is
|
|
21
|
+
* bold, matching `lg`; the cup column and wordmark column are bottom-aligned
|
|
22
|
+
* so the steam rises above the letters exactly as it does at full size. The
|
|
23
|
+
* `mini` size colours the whole cup + frame in `theme.brand` (amber).
|
|
24
|
+
*/
|
|
25
|
+
import React from 'react';
|
|
26
|
+
export type BannerSize = 'lg' | 'md' | 'sm' | 'mini';
|
|
27
|
+
/**
|
|
28
|
+
* UpdateHint — a single dim line printed UNDER the `mini` banner box when an
|
|
29
|
+
* update is available, giving the actionable upgrade command. The `mini`
|
|
30
|
+
* card's version-line flag (`(<new-version> available)`) announces the update but
|
|
31
|
+
* isn't actionable on its own; this line closes that gap without growing the
|
|
32
|
+
* fixed-height box. The other banner sizes get the same command via the
|
|
33
|
+
* stderr update nag, so callers render this only for `mini`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function UpdateHint(): React.ReactElement;
|
|
36
|
+
/**
|
|
37
|
+
* Narrow an untyped banner-size string (e.g. from `ui.banner` in
|
|
38
|
+
* `opensip-cli.config.yml`, which reaches the kernel as a plain `string`)
|
|
39
|
+
* to a {@link BannerSize}. Unknown / undefined values fall back to `lg`, the
|
|
40
|
+
* documented default. Centralised here so `cli-ui` stays the single owner of
|
|
41
|
+
* the `BannerSize` union and the layers below it (core, contracts) need only
|
|
42
|
+
* pass a string.
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeBannerSize(value: string | undefined): BannerSize;
|
|
45
|
+
/**
|
|
46
|
+
* Banner props. `version` / `projectPath` are only consumed by the `mini`
|
|
47
|
+
* size (the wordmark sizes ignore them); they're optional so existing
|
|
48
|
+
* `<Banner />` and `<Banner size="md" />` call sites stay valid.
|
|
49
|
+
*/
|
|
50
|
+
export interface BannerProps {
|
|
51
|
+
readonly size?: BannerSize;
|
|
52
|
+
/** CLI version, e.g. `1.0.0`. Rendered as `v<version>` in the `mini` card. */
|
|
53
|
+
readonly version?: string;
|
|
54
|
+
/** Absolute project root. Rendered as the third `mini` info line. */
|
|
55
|
+
readonly projectPath?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Ancestor steps walked from cwd to the project root. When > 0, the `mini`
|
|
58
|
+
* card appends `(found N levels up)` to the path line — the discovery hint
|
|
59
|
+
* the separate `ℹ Project:` line carries for the other sizes.
|
|
60
|
+
*/
|
|
61
|
+
readonly walkedUp?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Newer published version (e.g. `1.0.1`) when an update is available. The
|
|
64
|
+
* `mini` card appends `(<new-version> available)` to the version line; other sizes
|
|
65
|
+
* ignore it (they rely on the stderr update nag).
|
|
66
|
+
*/
|
|
67
|
+
readonly update?: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function Banner({ size, version, projectPath, walkedUp, update, }?: BannerProps): React.ReactElement;
|
|
70
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../src/banner.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAWrD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,KAAK,CAAC,YAAY,CAM/C;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAEzE;AA4ND;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,MAAM,CAAC,EACrB,IAAW,EACX,OAAY,EACZ,WAAW,EACX,QAAQ,EACR,MAAM,GACP,GAAE,WAAgB,GAAG,KAAK,CAAC,YAAY,CAsBvC"}
|
package/dist/banner.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Banner — the OpenSIP CLI ASCII art banner. Used as the header for every
|
|
4
|
+
* live-view tool runner and for App.tsx's static-render path.
|
|
5
|
+
*
|
|
6
|
+
* Four sizes are available via the `size` prop:
|
|
7
|
+
* - `lg` (default) — the full 8-row 3-D banner with shaded depth.
|
|
8
|
+
* - `md` — half-height. The OPENSIP wordmark is a mechanical half-block
|
|
9
|
+
* downscale of the `lg` art; the coffee cup + steam is hand-authored
|
|
10
|
+
* block art (a downscale smears away the handle-hole and saucer that
|
|
11
|
+
* make it read as a mug).
|
|
12
|
+
* - `sm` — half-height AND half-width (quarter-block wordmark, smaller mug).
|
|
13
|
+
* - `mini` — a compact, boxed identity card: a small amber coffee cup on
|
|
14
|
+
* the left and four info lines on the right (`opensip-cli v1.0.0`,
|
|
15
|
+
* the tagline, the `www.opensip.ai` URL, and the project path), framed in
|
|
16
|
+
* a rounded amber border. Modeled on the Claude Code session card. Unlike
|
|
17
|
+
* the wordmark sizes it carries the version + project path inline, so
|
|
18
|
+
* callers SUPPRESS the separate `ProjectHeader` line when `mini` is
|
|
19
|
+
* selected (the path would otherwise render twice).
|
|
20
|
+
*
|
|
21
|
+
* In the wordmark sizes (`lg`/`md`/`sm`) OPEN is brand-coloured and SIP is
|
|
22
|
+
* bold, matching `lg`; the cup column and wordmark column are bottom-aligned
|
|
23
|
+
* so the steam rises above the letters exactly as it does at full size. The
|
|
24
|
+
* `mini` size colours the whole cup + frame in `theme.brand` (amber).
|
|
25
|
+
*/
|
|
26
|
+
import { Text, Box } from 'ink';
|
|
27
|
+
import { useTheme } from './theme.js';
|
|
28
|
+
/** The valid banner sizes, as a runtime set for {@link normalizeBannerSize}. */
|
|
29
|
+
const BANNER_SIZES = new Set(['lg', 'md', 'sm', 'mini']);
|
|
30
|
+
/** Product tagline shown in the `mini` banner — mirrors the welcome screen. */
|
|
31
|
+
const MINI_TAGLINE = 'codebase analysis toolkit';
|
|
32
|
+
/** The command that installs/upgrades the CLI via the hosted install script. */
|
|
33
|
+
const UPGRADE_COMMAND = 'curl -fsSL https://opensip.ai/cli/install.sh | bash';
|
|
34
|
+
/**
|
|
35
|
+
* UpdateHint — a single dim line printed UNDER the `mini` banner box when an
|
|
36
|
+
* update is available, giving the actionable upgrade command. The `mini`
|
|
37
|
+
* card's version-line flag (`(<new-version> available)`) announces the update but
|
|
38
|
+
* isn't actionable on its own; this line closes that gap without growing the
|
|
39
|
+
* fixed-height box. The other banner sizes get the same command via the
|
|
40
|
+
* stderr update nag, so callers render this only for `mini`.
|
|
41
|
+
*/
|
|
42
|
+
export function UpdateHint() {
|
|
43
|
+
return (_jsx(Box, { paddingLeft: 2, children: _jsxs(Text, { dimColor: true, children: ["\u2191 Update: ", UPGRADE_COMMAND] }) }));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Narrow an untyped banner-size string (e.g. from `ui.banner` in
|
|
47
|
+
* `opensip-cli.config.yml`, which reaches the kernel as a plain `string`)
|
|
48
|
+
* to a {@link BannerSize}. Unknown / undefined values fall back to `lg`, the
|
|
49
|
+
* documented default. Centralised here so `cli-ui` stays the single owner of
|
|
50
|
+
* the `BannerSize` union and the layers below it (core, contracts) need only
|
|
51
|
+
* pass a string.
|
|
52
|
+
*/
|
|
53
|
+
export function normalizeBannerSize(value) {
|
|
54
|
+
return value !== undefined && BANNER_SIZES.has(value) ? value : 'lg';
|
|
55
|
+
}
|
|
56
|
+
// --- lg: full 3-D banner. Each entry: [cup, openPart, sipPart] ---
|
|
57
|
+
const BANNER_LG = [
|
|
58
|
+
[
|
|
59
|
+
' ░ ░ ',
|
|
60
|
+
' ██████ ████████ █████████ ████ ███',
|
|
61
|
+
' ███████ █████ ████████ ',
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
' ░ ░ ',
|
|
65
|
+
' ███░░░███░███░░░░██░███░░░░░░░░███ ███',
|
|
66
|
+
'███░░░░███░░███ ░███░░░░██',
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
' ░ ░ ',
|
|
70
|
+
'███ ░███░███ ░██░███ ░████ ███',
|
|
71
|
+
'░███ ░░░ ░███ ░███ ░██',
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
'███████████████ ',
|
|
75
|
+
'███ ░███░████████░░██████ ░██░█████',
|
|
76
|
+
'░░███████ ░███ ░████████░',
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
'███████████████ █████ ',
|
|
80
|
+
'███ ░███░███░░░░ ░███░░░ ░██ ░████',
|
|
81
|
+
' ░░░░░░███ ░███ ░███░░░░ ',
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
'███████████████ ░░░░███ ',
|
|
85
|
+
'░███ ████░███ ░███ ░██ ░███',
|
|
86
|
+
' ███ ███ ░███ ░███ ',
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
'███████████████ █████ ',
|
|
90
|
+
' ░██████░ ████ █████████ ████ ███',
|
|
91
|
+
'░░███████ █████ ████ ',
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
'░█████████████░ ░░░ ',
|
|
95
|
+
' ░░░░░░ ░░░░░ ░░░░░░░░░░░░░░ ░░░',
|
|
96
|
+
' ░░░░░░░ ░░░░░ ░░░░░ ',
|
|
97
|
+
],
|
|
98
|
+
];
|
|
99
|
+
const BANNER_SAUCER = ' ░███████████░';
|
|
100
|
+
const BANNER_MD = {
|
|
101
|
+
cup: [' ░ ░', ' ░ ░', '▟████████▙', '█████████▐▀▙', '█████████▐▄▟', '▝▀▀█████▀▀▘'],
|
|
102
|
+
open: [
|
|
103
|
+
'██▀▀█▄▄███▀▀▀█ ██▀▀▀▀▀ ▀██ ██ ',
|
|
104
|
+
'█ ██████▄▄▄█ ██▄▄▄ █▀█▄██ ',
|
|
105
|
+
'█▄ ▄██████ ██ █ ▀██ ',
|
|
106
|
+
'▀▀▀▀▀ ▀▀▀ ▀▀▀▀▀▀▀ ▀▀▀ ▀▀ ',
|
|
107
|
+
],
|
|
108
|
+
sip: [
|
|
109
|
+
'██▀▀▀█▄▄▀██▀ ██▀▀▀█▄',
|
|
110
|
+
'▀██▄▄▄▄ ██ ██▄▄▄█▀',
|
|
111
|
+
'▄▄▄ ███ ██ ██ ',
|
|
112
|
+
' ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀ ',
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
const BANNER_SM = {
|
|
116
|
+
cup: [' ░ ░', ' ░', '▟████▙', '█████▐▌', '▝▀██▀▀'],
|
|
117
|
+
open: [
|
|
118
|
+
'▗█▀▜▄▐█▀▀▙▐█▀▀▀▝█▌▐█▗',
|
|
119
|
+
'█▌ ▐█▐█▄▄▛▐█▄▖ █▜▟█ ',
|
|
120
|
+
'▜▙ ▟█▐█ ▐█ █ ▜█ ',
|
|
121
|
+
' ▀▀▀ ▝▀▘ ▝▀▀▀▀▝▀▘▝▀ ',
|
|
122
|
+
],
|
|
123
|
+
sip: ['█▀▀▙▖▜█▘█▛▀▜▖', '▜▙▄▄ ▐█ █▙▄▟▘', '▄▖ █▌▐█ █▌ ', '▝▀▀▀ ▀▀▘▀▀ '],
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* `mini` cup art — four rows (steam, lid, cup body, saucer), one per info
|
|
127
|
+
* line, so the steam sits beside the version line and the saucer beside the
|
|
128
|
+
* project path. The cup body and saucer render in `theme.brand` (amber); the
|
|
129
|
+
* steam and lid rows ({@link MINI_CUP_LIGHT_ROWS}) render in the default
|
|
130
|
+
* terminal foreground so they read as white vapor + a white to-go-cup lid on
|
|
131
|
+
* dark terminals and auto-contrast (rather than vanishing) on light
|
|
132
|
+
* backgrounds — see {@link MiniBanner}.
|
|
133
|
+
*/
|
|
134
|
+
const BANNER_MINI_CUP = [' ⋮ ⋮ ', '▟███▙', '▐███▌', ' ▀▀▀ '];
|
|
135
|
+
/**
|
|
136
|
+
* Rows of {@link BANNER_MINI_CUP} rendered in the default foreground (no
|
|
137
|
+
* `color`) rather than brand amber: the steam (row 0, white vapor) and the
|
|
138
|
+
* lid (row 1, white to-go-cup lid). Default fg is ≈bright white on dark
|
|
139
|
+
* terminals, an auto-contrast dark on light backgrounds, and correctly
|
|
140
|
+
* colorless under `NO_COLOR`. A literal `'white'` would be invisible on light
|
|
141
|
+
* terminals and would bypass the no-color theme.
|
|
142
|
+
*/
|
|
143
|
+
const MINI_CUP_LIGHT_ROWS = new Set([0, 1]);
|
|
144
|
+
/** Marketing URL shown in the `mini` banner — brand-coloured, reads as a link. */
|
|
145
|
+
const MINI_URL = 'www.opensip.ai';
|
|
146
|
+
/**
|
|
147
|
+
* The walk-up suffix shown after the project path, e.g. `(found 2 levels up)`.
|
|
148
|
+
* Mirrors {@link formatProjectHeader} so `mini` carries the same discovery
|
|
149
|
+
* hint the standalone `ℹ Project:` line shows for the other banner sizes —
|
|
150
|
+
* `mini` suppresses that line (its box owns the path), so the suffix has to
|
|
151
|
+
* live here or the hint is lost. Returns `''` when cwd IS the project root.
|
|
152
|
+
*/
|
|
153
|
+
function walkedUpSuffix(walkedUp) {
|
|
154
|
+
if (walkedUp === undefined || walkedUp === 0)
|
|
155
|
+
return '';
|
|
156
|
+
const noun = walkedUp === 1 ? 'level' : 'levels';
|
|
157
|
+
return ` (found ${walkedUp} ${noun} up)`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* MiniBanner — the boxed identity card (cup + version + tagline + path).
|
|
161
|
+
*
|
|
162
|
+
* Pure presentational: the version string and project path are INJECTED as
|
|
163
|
+
* props. `cli-ui` has no workspace dependencies, so it cannot read the CLI
|
|
164
|
+
* version (`readPackageVersion` would resolve cli-ui's own version) or the
|
|
165
|
+
* project scope — the caller resolves both and passes them in.
|
|
166
|
+
*
|
|
167
|
+
* Info lines: name+version, tagline, marketing URL, project path. The first
|
|
168
|
+
* three are always shown; `projectPath` is optional (project-agnostic
|
|
169
|
+
* commands like init/configure have no project root), so the fourth line is
|
|
170
|
+
* omitted while the cup keeps its four rows. `walkedUp` appends the discovery
|
|
171
|
+
* hint to the path line when the project root was found above cwd. `update`,
|
|
172
|
+
* when set, appends a `(<new-version> available)` flag (in `theme.success`) to the
|
|
173
|
+
* version line — the in-banner counterpart to the stderr update nag.
|
|
174
|
+
*/
|
|
175
|
+
function MiniBanner({ version, projectPath, walkedUp, update, }) {
|
|
176
|
+
const theme = useTheme();
|
|
177
|
+
return (_jsxs(Box, { borderStyle: "round", borderColor: theme.brand, paddingX: 1, alignSelf: "flex-start", children: [_jsx(Box, { flexDirection: "column", marginRight: 2, children: BANNER_MINI_CUP.map((line, i) => (_jsx(Text, { color: MINI_CUP_LIGHT_ROWS.has(i) ? undefined : theme.brand, children: line }, i))) }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "OpenSIP CLI" }), " ", _jsxs(Text, { dimColor: true, children: ["v", version] }), update !== undefined && _jsxs(Text, { color: theme.success, children: [" (v", update, " available)"] })] }), _jsx(Text, { dimColor: true, children: MINI_TAGLINE }), _jsx(Text, { color: theme.brand, children: MINI_URL }), projectPath !== undefined && (_jsxs(Text, { dimColor: true, children: [projectPath, walkedUpSuffix(walkedUp)] }))] })] }));
|
|
178
|
+
}
|
|
179
|
+
function LargeBanner() {
|
|
180
|
+
const theme = useTheme();
|
|
181
|
+
return (_jsxs(Box, { flexDirection: "column", children: [BANNER_LG.map(([cup, openPart, sipPart], i) => (_jsxs(Text, { children: [cup, _jsx(Text, { color: theme.brand, children: openPart }), " ", _jsx(Text, { bold: true, children: sipPart })] }, i))), _jsx(Text, { children: BANNER_SAUCER })] }));
|
|
182
|
+
}
|
|
183
|
+
function CompactBannerView({ art }) {
|
|
184
|
+
const theme = useTheme();
|
|
185
|
+
return (_jsxs(Box, { flexDirection: "row", alignItems: "flex-end", children: [_jsx(Box, { flexDirection: "column", marginRight: 2, children: art.cup.map((line, i) => (_jsx(Text, { children: line }, i))) }), _jsx(Box, { flexDirection: "column", children: art.open.map((openLine, i) => (_jsxs(Text, { children: [_jsx(Text, { color: theme.brand, children: openLine }), _jsx(Text, { bold: true, children: art.sip[i] })] }, i))) })] }));
|
|
186
|
+
}
|
|
187
|
+
export function Banner({ size = 'lg', version = '', projectPath, walkedUp, update, } = {}) {
|
|
188
|
+
switch (size) {
|
|
189
|
+
case 'md': {
|
|
190
|
+
return _jsx(CompactBannerView, { art: BANNER_MD });
|
|
191
|
+
}
|
|
192
|
+
case 'sm': {
|
|
193
|
+
return _jsx(CompactBannerView, { art: BANNER_SM });
|
|
194
|
+
}
|
|
195
|
+
case 'mini': {
|
|
196
|
+
return (_jsx(MiniBanner, { version: version, projectPath: projectPath, walkedUp: walkedUp, update: update }));
|
|
197
|
+
}
|
|
198
|
+
default: {
|
|
199
|
+
return _jsx(LargeBanner, {});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../src/banner.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,gFAAgF;AAChF,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1F,+EAA+E;AAC/E,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD,gFAAgF;AAChF,MAAM,eAAe,GAAG,qDAAqD,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,KAAC,GAAG,IAAC,WAAW,EAAE,CAAC,YACjB,MAAC,IAAI,IAAC,QAAQ,sCAAY,eAAe,IAAQ,GAC7C,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,OAAO,KAAK,KAAK,SAAS,IA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AE,CAAC,CACxB,KAAC,IAAI,cAAU,IAAI,IAAR,CAAC,CAAe,CAC5B,CAAC,GACE,EACN,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,YACxB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAC7B,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YAAG,QAAQ,GAAQ,EAC3C,KAAC,IAAI,IAAC,IAAI,kBAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAQ,KAFrB,CAAC,CAGL,CACR,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC;AA2BD,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,QAAQ,EACR,MAAM,MACS,EAAE;IACjB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,IAAI,CAAC,CAAC,CAAC;YACV,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,SAAS,GAAI,CAAC;QAC/C,CAAC;QACD,KAAK,IAAI,CAAC,CAAC,CAAC;YACV,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,SAAS,GAAI,CAAC;QAC/C,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,KAAC,WAAW,KAAG,CAAC;QACzB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/clock.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clock context — provides a tick counter that increments at a fixed interval.
|
|
3
|
+
* Used by useSpinner and any other animation that needs a frame counter.
|
|
4
|
+
*
|
|
5
|
+
* Two consumption shapes:
|
|
6
|
+
* - `<ClockProvider>` + `useClock()` — preferred when multiple components
|
|
7
|
+
* in the same tree need to share a single ticking timer (avoids N
|
|
8
|
+
* duplicate intervals).
|
|
9
|
+
* - `useTick()` — convenience hook that owns its own interval. Use when a
|
|
10
|
+
* single isolated component needs animation and pulling in a provider
|
|
11
|
+
* would be more setup than the component is worth.
|
|
12
|
+
*/
|
|
13
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
14
|
+
/** Props for {@link ClockProvider}: tick interval (ms) and tree children. */
|
|
15
|
+
export interface ClockProviderProps {
|
|
16
|
+
readonly intervalMs?: number;
|
|
17
|
+
readonly children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** React provider that broadcasts a tick counter to descendants via {@link useClock}. */
|
|
20
|
+
export declare function ClockProvider({ intervalMs, children, }: ClockProviderProps): ReactElement;
|
|
21
|
+
/** Returns the current tick from the enclosing {@link ClockProvider} (or 0). */
|
|
22
|
+
export declare function useClock(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Provider-free tick hook. Owns its own interval. Prefer `useClock()` inside
|
|
25
|
+
* a `<ClockProvider>` when multiple components on the same screen animate.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useTick(intervalMs?: number): number;
|
|
28
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrD,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,EAC5B,UAA6B,EAC7B,QAAQ,GACT,EAAE,kBAAkB,GAAG,YAAY,CAWnC;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,IAAI,MAAM,CAEjC;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,UAAU,GAAE,MAAyB,GAAG,MAAM,CASrE"}
|
package/dist/clock.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clock context — provides a tick counter that increments at a fixed interval.
|
|
3
|
+
* Used by useSpinner and any other animation that needs a frame counter.
|
|
4
|
+
*
|
|
5
|
+
* Two consumption shapes:
|
|
6
|
+
* - `<ClockProvider>` + `useClock()` — preferred when multiple components
|
|
7
|
+
* in the same tree need to share a single ticking timer (avoids N
|
|
8
|
+
* duplicate intervals).
|
|
9
|
+
* - `useTick()` — convenience hook that owns its own interval. Use when a
|
|
10
|
+
* single isolated component needs animation and pulling in a provider
|
|
11
|
+
* would be more setup than the component is worth.
|
|
12
|
+
*/
|
|
13
|
+
import { createContext, useContext, useEffect, useState, createElement } from 'react';
|
|
14
|
+
const TICK_INTERVAL_MS = 80;
|
|
15
|
+
const ClockContext = createContext(0);
|
|
16
|
+
/** React provider that broadcasts a tick counter to descendants via {@link useClock}. */
|
|
17
|
+
export function ClockProvider({ intervalMs = TICK_INTERVAL_MS, children, }) {
|
|
18
|
+
const [tick, setTick] = useState(0);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const id = setInterval(() => {
|
|
21
|
+
setTick((prev) => prev + 1);
|
|
22
|
+
}, intervalMs);
|
|
23
|
+
return () => clearInterval(id);
|
|
24
|
+
}, [intervalMs]);
|
|
25
|
+
return createElement(ClockContext.Provider, { value: tick }, children);
|
|
26
|
+
}
|
|
27
|
+
/** Returns the current tick from the enclosing {@link ClockProvider} (or 0). */
|
|
28
|
+
export function useClock() {
|
|
29
|
+
return useContext(ClockContext);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provider-free tick hook. Owns its own interval. Prefer `useClock()` inside
|
|
33
|
+
* a `<ClockProvider>` when multiple components on the same screen animate.
|
|
34
|
+
*/
|
|
35
|
+
export function useTick(intervalMs = TICK_INTERVAL_MS) {
|
|
36
|
+
const [tick, setTick] = useState(0);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const id = setInterval(() => {
|
|
39
|
+
setTick((prev) => prev + 1);
|
|
40
|
+
}, intervalMs);
|
|
41
|
+
return () => clearInterval(id);
|
|
42
|
+
}, [intervalMs]);
|
|
43
|
+
return tick;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItF,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,MAAM,YAAY,GAAG,aAAa,CAAS,CAAC,CAAC,CAAC;AAQ9C,yFAAyF;AACzF,MAAM,UAAU,aAAa,CAAC,EAC5B,UAAU,GAAG,gBAAgB,EAC7B,QAAQ,GACW;IACnB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE;YAC1B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,aAAa,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,aAAqB,gBAAgB;IAC3D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE;YAC1B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC,EAAE,UAAU,CAAC,CAAC;QACf,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorMessage — `✗ <message>` plus an optional dim-colored suggestion line.
|
|
3
|
+
* The canonical error-result render shape across every tool's live view and
|
|
4
|
+
* the App.tsx static path.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export interface ErrorMessageProps {
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly suggestion?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function ErrorMessage({ message, suggestion }: ErrorMessageProps): React.ReactElement;
|
|
12
|
+
//# sourceMappingURL=error-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../src/error-message.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAgB3F"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ErrorMessage — `✗ <message>` plus an optional dim-colored suggestion line.
|
|
4
|
+
* The canonical error-result render shape across every tool's live view and
|
|
5
|
+
* the App.tsx static path.
|
|
6
|
+
*/
|
|
7
|
+
import { Text, Box } from 'ink';
|
|
8
|
+
import { useTheme } from './theme.js';
|
|
9
|
+
export function ErrorMessage({ message, suggestion }) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.error, children: '✗' }), " ", message] }), suggestion !== undefined && (_jsxs(Text, { dimColor: true, children: [' ', suggestion] }))] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=error-message.js.map
|