@maple-kit/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 +9 -0
- package/README.md +39 -0
- package/dist/composer/actions.d.ts +15 -0
- package/dist/composer/actions.js +59 -0
- package/dist/composer/attachments.d.ts +33 -0
- package/dist/composer/attachments.js +166 -0
- package/dist/composer/badge.d.ts +13 -0
- package/dist/composer/badge.js +25 -0
- package/dist/composer/body.d.ts +13 -0
- package/dist/composer/body.js +119 -0
- package/dist/composer/composer.d.ts +23 -0
- package/dist/composer/composer.js +122 -0
- package/dist/composer/css.js +559 -0
- package/dist/composer/detail.d.ts +32 -0
- package/dist/composer/detail.js +102 -0
- package/dist/composer/emoji.d.ts +54 -0
- package/dist/composer/emoji.js +131 -0
- package/dist/composer/index.d.ts +15 -0
- package/dist/composer/index.js +15 -0
- package/dist/composer/inset.js +20 -0
- package/dist/composer/leave.d.ts +19 -0
- package/dist/composer/leave.js +34 -0
- package/dist/composer/peek.d.ts +21 -0
- package/dist/composer/peek.js +29 -0
- package/dist/composer/phrase.d.ts +27 -0
- package/dist/composer/phrase.js +30 -0
- package/dist/composer/picker-emoji.d.ts +34 -0
- package/dist/composer/picker-emoji.js +48 -0
- package/dist/composer/prompt.js +31 -0
- package/dist/composer/scope.d.ts +11 -0
- package/dist/composer/scope.js +16 -0
- package/dist/composer/target.d.ts +13 -0
- package/dist/composer/target.js +45 -0
- package/dist/context.d.ts +21 -0
- package/dist/context.js +16 -0
- package/dist/data.d.ts +52 -0
- package/dist/data.js +30 -0
- package/dist/icons/branch.d.ts +4 -0
- package/dist/icons/branch.js +8 -0
- package/dist/icons/cog.d.ts +4 -0
- package/dist/icons/cog.js +8 -0
- package/dist/icons/commit.d.ts +4 -0
- package/dist/icons/commit.js +5 -0
- package/dist/icons/crossfade.d.ts +15 -0
- package/dist/icons/crossfade.js +27 -0
- package/dist/icons/element.d.ts +4 -0
- package/dist/icons/element.js +5 -0
- package/dist/icons/icon.d.ts +24 -0
- package/dist/icons/icon.js +27 -0
- package/dist/icons/index.d.ts +13 -0
- package/dist/icons/index.js +13 -0
- package/dist/icons/noplace.d.ts +4 -0
- package/dist/icons/noplace.js +5 -0
- package/dist/icons/region.d.ts +4 -0
- package/dist/icons/region.js +8 -0
- package/dist/icons/smiley.d.ts +4 -0
- package/dist/icons/smiley.js +8 -0
- package/dist/icons/sparkle.d.ts +4 -0
- package/dist/icons/sparkle.js +8 -0
- package/dist/icons/target.d.ts +4 -0
- package/dist/icons/target.js +5 -0
- package/dist/icons/text.d.ts +4 -0
- package/dist/icons/text.js +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/island/account.d.ts +10 -0
- package/dist/island/account.js +52 -0
- package/dist/island/comments.d.ts +24 -0
- package/dist/island/comments.js +40 -0
- package/dist/island/content.d.ts +10 -0
- package/dist/island/content.js +26 -0
- package/dist/island/context.d.ts +58 -0
- package/dist/island/context.js +23 -0
- package/dist/island/css.d.ts +13 -0
- package/dist/island/css.js +1020 -0
- package/dist/island/drag.d.ts +10 -0
- package/dist/island/drag.js +77 -0
- package/dist/island/filters.d.ts +10 -0
- package/dist/island/filters.js +63 -0
- package/dist/island/header.d.ts +32 -0
- package/dist/island/header.js +47 -0
- package/dist/island/index.d.ts +18 -0
- package/dist/island/index.js +18 -0
- package/dist/island/island.d.ts +12 -0
- package/dist/island/island.js +111 -0
- package/dist/island/item.d.ts +12 -0
- package/dist/island/item.js +158 -0
- package/dist/island/language.d.ts +55 -0
- package/dist/island/language.js +125 -0
- package/dist/island/leaf.js +17 -0
- package/dist/island/list.d.ts +12 -0
- package/dist/island/list.js +31 -0
- package/dist/island/new-comment.d.ts +18 -0
- package/dist/island/new-comment.js +56 -0
- package/dist/island/settings.d.ts +10 -0
- package/dist/island/settings.js +134 -0
- package/dist/island/stagger.d.ts +12 -0
- package/dist/island/stagger.js +4 -0
- package/dist/island/time.d.ts +17 -0
- package/dist/island/time.js +29 -0
- package/dist/island/trigger.d.ts +10 -0
- package/dist/island/trigger.js +39 -0
- package/dist/language.d.ts +45 -0
- package/dist/language.js +66 -0
- package/dist/maple.d.ts +25 -0
- package/dist/maple.js +65 -0
- package/dist/marks/avatar.d.ts +16 -0
- package/dist/marks/avatar.js +36 -0
- package/dist/marks/css.d.ts +12 -0
- package/dist/marks/css.js +371 -0
- package/dist/marks/frame.d.ts +25 -0
- package/dist/marks/frame.js +53 -0
- package/dist/marks/geometry.d.ts +55 -0
- package/dist/marks/geometry.js +61 -0
- package/dist/marks/index.d.ts +14 -0
- package/dist/marks/index.js +14 -0
- package/dist/marks/label.d.ts +23 -0
- package/dist/marks/label.js +31 -0
- package/dist/marks/layer.d.ts +16 -0
- package/dist/marks/layer.js +194 -0
- package/dist/marks/leaf.d.ts +18 -0
- package/dist/marks/leaf.js +7 -0
- package/dist/marks/mark.d.ts +28 -0
- package/dist/marks/mark.js +43 -0
- package/dist/marks/nudge.d.ts +50 -0
- package/dist/marks/nudge.js +76 -0
- package/dist/marks/paint.d.ts +11 -0
- package/dist/marks/paint.js +19 -0
- package/dist/marks/placement.d.ts +24 -0
- package/dist/marks/placement.js +28 -0
- package/dist/marks/ring.d.ts +28 -0
- package/dist/marks/ring.js +85 -0
- package/dist/marks/shape.d.ts +21 -0
- package/dist/marks/shape.js +51 -0
- package/dist/notice/css.d.ts +11 -0
- package/dist/notice/css.js +74 -0
- package/dist/notice/index.d.ts +4 -0
- package/dist/notice/index.js +4 -0
- package/dist/notice/language.d.ts +15 -0
- package/dist/notice/language.js +14 -0
- package/dist/notice/notice.d.ts +14 -0
- package/dist/notice/notice.js +49 -0
- package/dist/part.d.ts +9 -0
- package/dist/part.js +11 -0
- package/dist/picker/css.d.ts +13 -0
- package/dist/picker/css.js +141 -0
- package/dist/picker/index.d.ts +6 -0
- package/dist/picker/index.js +6 -0
- package/dist/picker/language.d.ts +14 -0
- package/dist/picker/language.js +17 -0
- package/dist/picker/picker.d.ts +18 -0
- package/dist/picker/picker.js +164 -0
- package/dist/picker/session.d.ts +16 -0
- package/dist/picker/session.js +35 -0
- package/dist/picker/target.d.ts +23 -0
- package/dist/picker/target.js +37 -0
- package/dist/root.d.ts +42 -0
- package/dist/root.js +75 -0
- package/dist/shots.js +32 -0
- package/dist/slot.d.ts +28 -0
- package/dist/slot.js +52 -0
- package/dist/slots.d.ts +24 -0
- package/dist/slots.js +75 -0
- package/dist/stylesheet.d.ts +15 -0
- package/dist/stylesheet.js +188 -0
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +13 -0
- package/dist/tip.d.ts +40 -0
- package/dist/tip.js +82 -0
- package/dist/tokens.d.ts +28 -0
- package/dist/tokens.js +180 -0
- package/package.json +56 -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 2026 The Maple Authors
|
|
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,9 @@
|
|
|
1
|
+
Maple
|
|
2
|
+
Copyright 2026 The Maple Authors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by The Maple Authors
|
|
5
|
+
(https://github.com/maple-kit/maple).
|
|
6
|
+
|
|
7
|
+
Portions of this software are derived from third-party sources. Each derived
|
|
8
|
+
file carries an attribution header naming its origin and license. A summary is
|
|
9
|
+
kept in packages/core/src/lib/README.md.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @maple-kit/ui
|
|
2
|
+
|
|
3
|
+
Maple's composed reviewer parts: the marks and the ring, the island, and the
|
|
4
|
+
composer. The surface a person actually touches on a preview deployment.
|
|
5
|
+
|
|
6
|
+
**Pre-release.** Every package here is 0.x and makes no compatibility promise.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @maple-kit/ui
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`react` and `react-dom` are peer dependencies. `@maple-kit/core` and
|
|
15
|
+
`@maple-kit/react` come with it.
|
|
16
|
+
|
|
17
|
+
## What is in it
|
|
18
|
+
|
|
19
|
+
`@maple-kit/ui/maple` is the whole overlay as one component. The parts are also
|
|
20
|
+
exported on their own: `/marks`, `/island`, `/composer`, `/picker`, `/notice`
|
|
21
|
+
and `/icons`.
|
|
22
|
+
|
|
23
|
+
Everything renders inside one shadow root, styled only through
|
|
24
|
+
`new CSSStyleSheet()` and `adoptedStyleSheets`, with positions set by
|
|
25
|
+
`style.setProperty()`. That is what lets Maple mount under
|
|
26
|
+
`script-src 'nonce' 'strict-dynamic'` without asking for a policy change — and
|
|
27
|
+
it stays checkable by reading one function.
|
|
28
|
+
|
|
29
|
+
Every part carries a size budget, held in CI by `scripts/size.js`. Raising one
|
|
30
|
+
is a decision recorded in a commit, not a number that drifts.
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
- [The overlay and CSP](https://github.com/maple-kit/maple/blob/main/docs/overlay-csp.md)
|
|
35
|
+
- [UI conventions](https://github.com/maple-kit/maple/blob/main/docs/ui-conventions.md)
|
|
36
|
+
|
|
37
|
+
## Licence
|
|
38
|
+
|
|
39
|
+
Apache-2.0. See `LICENSE` and `NOTICE`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AsChildProps } from "../slot.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/composer/actions.d.ts
|
|
4
|
+
/** The footer. `children` lead it: that is where developer detail lands. */
|
|
5
|
+
export interface MapleActionsProps extends AsChildProps {
|
|
6
|
+
readonly className?: string;
|
|
7
|
+
readonly children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** Leaves the draft where it is. */
|
|
10
|
+
export declare const CANCEL_LABEL = "Cancel";
|
|
11
|
+
/** The noun: it is what the reviewer is making. */
|
|
12
|
+
export declare const SEND_LABEL = "Comment";
|
|
13
|
+
/** The two controls, and room beside them for a later one. */
|
|
14
|
+
export declare const MapleActions: import("react").ForwardRefExoticComponent<MapleActionsProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
//#endregion
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Slot } from "../slot.js";
|
|
2
|
+
import { useComposerScope } from "./scope.js";
|
|
3
|
+
import { createElement, forwardRef } from "react";
|
|
4
|
+
import { useMaple, useMapleClient } from "@maple-kit/react";
|
|
5
|
+
//#region src/composer/actions.ts
|
|
6
|
+
const CANCEL_LABEL = "Cancel";
|
|
7
|
+
const SEND_LABEL = "Comment";
|
|
8
|
+
const VIEW_LABELS = {
|
|
9
|
+
close: "Close",
|
|
10
|
+
resolve: "Resolve",
|
|
11
|
+
reopen: "Reopen"
|
|
12
|
+
};
|
|
13
|
+
const MapleActions = forwardRef(function MapleActions(props, ref) {
|
|
14
|
+
const { composer } = useMaple();
|
|
15
|
+
const client = useMapleClient();
|
|
16
|
+
const scope = useComposerScope("Maple.Actions");
|
|
17
|
+
const Element = props.asChild ? Slot : "footer";
|
|
18
|
+
const send = () => {
|
|
19
|
+
client.send().then(() => scope.clear(), () => void 0);
|
|
20
|
+
};
|
|
21
|
+
const className = props.className ? `mk-composer-foot ${props.className}` : "mk-composer-foot";
|
|
22
|
+
if (composer.viewing !== void 0) return createElement(Element, {
|
|
23
|
+
ref,
|
|
24
|
+
className
|
|
25
|
+
}, props.children, createElement("span", { className: "mk-composer-fill" }), ...reading(composer.viewing, client));
|
|
26
|
+
return createElement(Element, {
|
|
27
|
+
ref,
|
|
28
|
+
className
|
|
29
|
+
}, props.children, createElement("span", { className: "mk-composer-fill" }), createElement("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
className: "mk-btn mk-btn-quiet mk-press",
|
|
32
|
+
onClick: () => client.closeComposer()
|
|
33
|
+
}, CANCEL_LABEL), createElement("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
className: "mk-btn mk-btn-primary mk-press",
|
|
36
|
+
disabled: composer.body.trim() === "" || composer.sending,
|
|
37
|
+
onClick: send
|
|
38
|
+
}, SEND_LABEL));
|
|
39
|
+
});
|
|
40
|
+
function reading(id, client) {
|
|
41
|
+
const status = client.getState().comments.find((one) => one.id === id)?.status;
|
|
42
|
+
const done = status === "resolved";
|
|
43
|
+
return [createElement("button", {
|
|
44
|
+
key: "close",
|
|
45
|
+
type: "button",
|
|
46
|
+
className: "mk-btn mk-btn-quiet mk-press",
|
|
47
|
+
onClick: () => client.closeComposer()
|
|
48
|
+
}, VIEW_LABELS.close), status === "orphaned" ? null : moveOn(id, done, client)];
|
|
49
|
+
}
|
|
50
|
+
function moveOn(id, done, client) {
|
|
51
|
+
return createElement("button", {
|
|
52
|
+
key: "status",
|
|
53
|
+
type: "button",
|
|
54
|
+
className: "mk-btn mk-btn-primary mk-press",
|
|
55
|
+
onClick: () => void client.setStatus(id, done ? "open" : "resolved")
|
|
56
|
+
}, done ? VIEW_LABELS.reopen : VIEW_LABELS.resolve);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { CANCEL_LABEL, MapleActions, SEND_LABEL, VIEW_LABELS };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AsChildProps } from "../slot.js";
|
|
2
|
+
import { PastedImage } from "@maple-kit/core/screenshot";
|
|
3
|
+
import { MediaRef } from "@maple-kit/core";
|
|
4
|
+
//#region src/composer/attachments.d.ts
|
|
5
|
+
/** The strip. Both seams default to the route, and are overrides, not options. */
|
|
6
|
+
export interface MapleAttachmentsProps extends AsChildProps {
|
|
7
|
+
readonly className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Puts the image wherever blobs live and returns the ref a comment keeps.
|
|
10
|
+
* Defaults to `POST /media` on the route, served by its media connector.
|
|
11
|
+
*/
|
|
12
|
+
readonly upload?: (image: PastedImage) => Promise<MediaRef>;
|
|
13
|
+
/**
|
|
14
|
+
* Turns a stored comment's media reference into something an `img` loads.
|
|
15
|
+
* Defaults to the route's own redirect. A `MediaRef` is never a URL.
|
|
16
|
+
*/
|
|
17
|
+
readonly resolve?: (ref: MediaRef) => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** Every word this part shows, spelled once. */
|
|
20
|
+
export declare const ATTACH_WORDS: {
|
|
21
|
+
readonly hint: "Paste or drop an image to attach one";
|
|
22
|
+
readonly taken: "Taken of the page when you picked";
|
|
23
|
+
readonly remove: "Remove";
|
|
24
|
+
readonly alt: "Screenshot attached to this comment";
|
|
25
|
+
readonly kept: "A screenshot was attached when this was sent";
|
|
26
|
+
readonly failed: "That image could not be attached.";
|
|
27
|
+
readonly nowhere: "This deployment keeps no screenshots, so one cannot be attached.";
|
|
28
|
+
readonly notKept: "This deployment keeps no screenshots, so this one will not be sent.";
|
|
29
|
+
readonly uncaptured: "Maple could not take a screenshot. Paste or drop one instead.";
|
|
30
|
+
};
|
|
31
|
+
/** The screenshot, before and after it is attached. */
|
|
32
|
+
export declare const MapleAttachments: import("react").ForwardRefExoticComponent<MapleAttachmentsProps & import("react").RefAttributes<HTMLElement>>;
|
|
33
|
+
//#endregion
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { useShots } from "../shots.js";
|
|
2
|
+
import { Slot } from "../slot.js";
|
|
3
|
+
import { useComposerScope } from "./scope.js";
|
|
4
|
+
import { SparkleIcon } from "../icons/sparkle.js";
|
|
5
|
+
import { createElement, forwardRef, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useMaple, useMapleClient } from "@maple-kit/react";
|
|
7
|
+
//#region src/composer/attachments.ts
|
|
8
|
+
const ATTACH_WORDS = {
|
|
9
|
+
hint: "Paste or drop an image to attach one",
|
|
10
|
+
taken: "Taken of the page when you picked",
|
|
11
|
+
remove: "Remove",
|
|
12
|
+
alt: "Screenshot attached to this comment",
|
|
13
|
+
kept: "A screenshot was attached when this was sent",
|
|
14
|
+
failed: "That image could not be attached.",
|
|
15
|
+
nowhere: "This deployment keeps no screenshots, so one cannot be attached.",
|
|
16
|
+
notKept: "This deployment keeps no screenshots, so this one will not be sent.",
|
|
17
|
+
uncaptured: "Maple could not take a screenshot. Paste or drop one instead."
|
|
18
|
+
};
|
|
19
|
+
const MapleAttachments = forwardRef(function MapleAttachments(props, ref) {
|
|
20
|
+
const scope = useComposerScope("Maple.Attachments");
|
|
21
|
+
const { composer, media, phase } = useMaple();
|
|
22
|
+
const client = useMapleClient();
|
|
23
|
+
const resolve = props.resolve ?? ((one) => client.mediaUrl(one));
|
|
24
|
+
const claimed = useClaimed(scope);
|
|
25
|
+
const failed = useUpload(scope, media, props.upload);
|
|
26
|
+
const Element = props.asChild ? Slot : "div";
|
|
27
|
+
const className = [
|
|
28
|
+
"mk-composer-row",
|
|
29
|
+
"mk-shots",
|
|
30
|
+
props.className
|
|
31
|
+
].filter(Boolean).join(" ");
|
|
32
|
+
if (composer.viewing !== void 0) return kept({
|
|
33
|
+
className,
|
|
34
|
+
attachments: composer.attachments,
|
|
35
|
+
resolve
|
|
36
|
+
}, ref);
|
|
37
|
+
const captured = scope.pending?.source === "capture";
|
|
38
|
+
const keeps = media || !(phase === "error" || phase === "ready");
|
|
39
|
+
const children = scope.pending ? filled(scope, {
|
|
40
|
+
failed,
|
|
41
|
+
captured,
|
|
42
|
+
keeps
|
|
43
|
+
}) : [said(resting(keeps, claimed), false, "said")];
|
|
44
|
+
return createElement(Element, {
|
|
45
|
+
ref,
|
|
46
|
+
className,
|
|
47
|
+
...captured ? { "data-mk-maple": "true" } : {}
|
|
48
|
+
}, ...children);
|
|
49
|
+
});
|
|
50
|
+
function resting(keeps, claimed) {
|
|
51
|
+
if (!keeps) return ATTACH_WORDS.nowhere;
|
|
52
|
+
return claimed === "failed" ? ATTACH_WORDS.uncaptured : ATTACH_WORDS.hint;
|
|
53
|
+
}
|
|
54
|
+
function shot(one, resolve) {
|
|
55
|
+
const src = resolve(one);
|
|
56
|
+
const byMaple = one.source === "capture";
|
|
57
|
+
const words = byMaple ? ATTACH_WORDS.taken : ATTACH_WORDS.kept;
|
|
58
|
+
return [...src === void 0 ? [] : [createElement("img", {
|
|
59
|
+
key: `${one.key}-img`,
|
|
60
|
+
className: "mk-shot",
|
|
61
|
+
src,
|
|
62
|
+
alt: ATTACH_WORDS.alt
|
|
63
|
+
})], said(words, byMaple, one.key)];
|
|
64
|
+
}
|
|
65
|
+
function kept(props, ref) {
|
|
66
|
+
if (props.attachments.length === 0) return createElement("div", {
|
|
67
|
+
ref,
|
|
68
|
+
hidden: true
|
|
69
|
+
});
|
|
70
|
+
const byMaple = props.attachments.some((one) => one.source === "capture");
|
|
71
|
+
return createElement("div", {
|
|
72
|
+
ref,
|
|
73
|
+
className: props.className,
|
|
74
|
+
...byMaple ? { "data-mk-maple": "true" } : {}
|
|
75
|
+
}, ...props.attachments.flatMap((one) => shot(one, props.resolve)));
|
|
76
|
+
}
|
|
77
|
+
function filled(scope, held) {
|
|
78
|
+
const { captured, failed, keeps } = held;
|
|
79
|
+
return [
|
|
80
|
+
createElement("img", {
|
|
81
|
+
key: "shot",
|
|
82
|
+
className: "mk-shot",
|
|
83
|
+
src: scope.pending?.preview.url,
|
|
84
|
+
alt: ATTACH_WORDS.alt
|
|
85
|
+
}),
|
|
86
|
+
said(taking(held), captured && keeps, "said"),
|
|
87
|
+
createElement("button", {
|
|
88
|
+
key: "off",
|
|
89
|
+
type: "button",
|
|
90
|
+
className: "mk-btn mk-btn-quiet mk-press",
|
|
91
|
+
onClick: scope.clear
|
|
92
|
+
}, ATTACH_WORDS.remove),
|
|
93
|
+
failed ? createElement("span", {
|
|
94
|
+
key: "bad",
|
|
95
|
+
className: "mk-chip"
|
|
96
|
+
}, ATTACH_WORDS.failed) : null
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
function said(words, byMaple, key) {
|
|
100
|
+
return createElement("span", {
|
|
101
|
+
key,
|
|
102
|
+
className: "mk-shot-said",
|
|
103
|
+
...byMaple ? { "data-mk-maple": "true" } : {}
|
|
104
|
+
}, byMaple ? createElement(SparkleIcon, {
|
|
105
|
+
key: "spark",
|
|
106
|
+
size: 12
|
|
107
|
+
}) : null, words);
|
|
108
|
+
}
|
|
109
|
+
function taking(held) {
|
|
110
|
+
if (!held.keeps) return ATTACH_WORDS.notKept;
|
|
111
|
+
return held.captured ? ATTACH_WORDS.taken : ATTACH_WORDS.hint;
|
|
112
|
+
}
|
|
113
|
+
function useClaimed(scope) {
|
|
114
|
+
const shots = useShots();
|
|
115
|
+
const [claimed, setClaimed] = useState("none");
|
|
116
|
+
const offered = scope.offer;
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!shots) return;
|
|
119
|
+
const claim = () => {
|
|
120
|
+
const shot = shots.get() ? shots.take() : void 0;
|
|
121
|
+
if (!shot) return;
|
|
122
|
+
if (shot.status === "taken") offered(shot.image, "capture");
|
|
123
|
+
setClaimed(shot.status);
|
|
124
|
+
};
|
|
125
|
+
claim();
|
|
126
|
+
return shots.subscribe(claim);
|
|
127
|
+
}, [offered, shots]);
|
|
128
|
+
return claimed;
|
|
129
|
+
}
|
|
130
|
+
function useUpload(scope, media, upload) {
|
|
131
|
+
const client = useMapleClient();
|
|
132
|
+
const sent = useRef(void 0);
|
|
133
|
+
const [failed, setFailed] = useState(false);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const image = scope.pending?.image;
|
|
136
|
+
const put = upload ?? (media ? routed(client) : void 0);
|
|
137
|
+
if (!image || !put || sent.current === image) return;
|
|
138
|
+
sent.current = image;
|
|
139
|
+
const source = scope.pending?.source ?? "offered";
|
|
140
|
+
let live = true;
|
|
141
|
+
const done = (ref) => {
|
|
142
|
+
if (live) client.attach({
|
|
143
|
+
...ref,
|
|
144
|
+
source
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const broke = () => {
|
|
148
|
+
if (live) setFailed(true);
|
|
149
|
+
};
|
|
150
|
+
put(image).then(done, broke);
|
|
151
|
+
return () => {
|
|
152
|
+
live = false;
|
|
153
|
+
};
|
|
154
|
+
}, [
|
|
155
|
+
scope.pending,
|
|
156
|
+
upload,
|
|
157
|
+
media,
|
|
158
|
+
client
|
|
159
|
+
]);
|
|
160
|
+
return failed;
|
|
161
|
+
}
|
|
162
|
+
function routed(client) {
|
|
163
|
+
return (image) => client.uploadMedia(image.blob, image.type);
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { ATTACH_WORDS, MapleAttachments };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AsChildProps } from "../slot.js";
|
|
2
|
+
import { PageContext } from "@maple-kit/core/overlay";
|
|
3
|
+
import { CommentContext } from "@maple-kit/core";
|
|
4
|
+
//#region src/composer/badge.d.ts
|
|
5
|
+
/** The badge. The context defaults to the one the pick captured. */
|
|
6
|
+
export interface MapleContextProps extends AsChildProps {
|
|
7
|
+
readonly className?: string;
|
|
8
|
+
/** A captured page, or a stored comment's context. Both render identically. */
|
|
9
|
+
readonly context?: CommentContext | PageContext;
|
|
10
|
+
}
|
|
11
|
+
/** Labels muted, values aligned, two columns. */
|
|
12
|
+
export declare const MapleContextBadge: import("react").ForwardRefExoticComponent<MapleContextProps & import("react").RefAttributes<HTMLElement>>;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Slot } from "../slot.js";
|
|
2
|
+
import { Fragment, createElement, forwardRef } from "react";
|
|
3
|
+
import { contextRows } from "@maple-kit/core/overlay";
|
|
4
|
+
import { useMaple } from "@maple-kit/react";
|
|
5
|
+
//#region src/composer/badge.ts
|
|
6
|
+
const MapleContextBadge = forwardRef(function MapleContextBadge(props, ref) {
|
|
7
|
+
const { composer, detail } = useMaple();
|
|
8
|
+
const context = props.context ?? composer.target?.context;
|
|
9
|
+
const Element = props.asChild ? Slot : "dl";
|
|
10
|
+
if (!context) return null;
|
|
11
|
+
const className = [
|
|
12
|
+
"mk-composer-row",
|
|
13
|
+
"mk-ctx",
|
|
14
|
+
props.className
|
|
15
|
+
].filter(Boolean).join(" ");
|
|
16
|
+
return createElement(Element, {
|
|
17
|
+
ref,
|
|
18
|
+
className
|
|
19
|
+
}, ...contextRows(context, detail).map(row));
|
|
20
|
+
});
|
|
21
|
+
function row(one) {
|
|
22
|
+
return createElement(Fragment, { key: one.label }, createElement("dt", null, one.label), createElement("dd", one.mono === true ? { className: "mk-mono" } : null, one.value, one.note === void 0 ? null : createElement("em", null, ` · ${one.note}`)));
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { MapleContextBadge };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AsChildProps } from "../slot.js";
|
|
2
|
+
//#region src/composer/body.d.ts
|
|
3
|
+
/** The field. `asChild` hands it to an application's own textarea. */
|
|
4
|
+
export interface MapleBodyProps extends AsChildProps {
|
|
5
|
+
readonly className?: string;
|
|
6
|
+
/** The control in the field's corner. On unless an application draws its own. */
|
|
7
|
+
readonly emoji?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** It asks for a problem rather than for a comment. */
|
|
10
|
+
export declare const COMPOSER_PLACEHOLDER = "What is wrong with this?";
|
|
11
|
+
/** The comment itself. Focused on open; never cleared by a close. */
|
|
12
|
+
export declare const MapleBody: import("react").ForwardRefExoticComponent<MapleBodyProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
13
|
+
//#endregion
|