@grafctory/clay-widgets 0.0.0-stage → 0.4.1
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 +201 -0
- package/README.md +46 -2
- package/dist/content/empty.css +107 -0
- package/dist/content/empty.d.ts +40 -0
- package/dist/content/empty.d.ts.map +1 -0
- package/dist/content/empty.js +42 -0
- package/dist/content/empty.js.map +1 -0
- package/dist/content/heading.css +34 -0
- package/dist/content/heading.d.ts +45 -0
- package/dist/content/heading.d.ts.map +1 -0
- package/dist/content/heading.js +49 -0
- package/dist/content/heading.js.map +1 -0
- package/dist/content/image.css +176 -0
- package/dist/content/image.d.ts +71 -0
- package/dist/content/image.d.ts.map +1 -0
- package/dist/content/image.js +63 -0
- package/dist/content/image.js.map +1 -0
- package/dist/content/infobox.css +186 -0
- package/dist/content/infobox.d.ts +72 -0
- package/dist/content/infobox.d.ts.map +1 -0
- package/dist/content/infobox.js +63 -0
- package/dist/content/infobox.js.map +1 -0
- package/dist/content/pill.css +76 -0
- package/dist/content/pill.d.ts +57 -0
- package/dist/content/pill.d.ts.map +1 -0
- package/dist/content/pill.js +48 -0
- package/dist/content/pill.js.map +1 -0
- package/dist/content/text.css +44 -0
- package/dist/content/text.d.ts +30 -0
- package/dist/content/text.d.ts.map +1 -0
- package/dist/content/text.js +42 -0
- package/dist/content/text.js.map +1 -0
- package/dist/controls/button.css +469 -0
- package/dist/controls/button.d.ts +116 -0
- package/dist/controls/button.d.ts.map +1 -0
- package/dist/controls/button.js +61 -0
- package/dist/controls/button.js.map +1 -0
- package/dist/controls/checkbox.css +23 -0
- package/dist/controls/checkbox.d.ts +54 -0
- package/dist/controls/checkbox.d.ts.map +1 -0
- package/dist/controls/checkbox.js +49 -0
- package/dist/controls/checkbox.js.map +1 -0
- package/dist/controls/choice.css +288 -0
- package/dist/controls/choice.d.ts +63 -0
- package/dist/controls/choice.d.ts.map +1 -0
- package/dist/controls/choice.js +52 -0
- package/dist/controls/choice.js.map +1 -0
- package/dist/controls/fieldset.css +37 -0
- package/dist/controls/fieldset.d.ts +49 -0
- package/dist/controls/fieldset.d.ts.map +1 -0
- package/dist/controls/fieldset.js +51 -0
- package/dist/controls/fieldset.js.map +1 -0
- package/dist/controls/form.css +50 -0
- package/dist/controls/form.d.ts +64 -0
- package/dist/controls/form.d.ts.map +1 -0
- package/dist/controls/form.js +62 -0
- package/dist/controls/form.js.map +1 -0
- package/dist/controls/input.css +57 -0
- package/dist/controls/input.d.ts +120 -0
- package/dist/controls/input.d.ts.map +1 -0
- package/dist/controls/input.js +78 -0
- package/dist/controls/input.js.map +1 -0
- package/dist/controls/label.css +73 -0
- package/dist/controls/label.d.ts +76 -0
- package/dist/controls/label.d.ts.map +1 -0
- package/dist/controls/label.js +73 -0
- package/dist/controls/label.js.map +1 -0
- package/dist/controls/radio.css +23 -0
- package/dist/controls/radio.d.ts +60 -0
- package/dist/controls/radio.d.ts.map +1 -0
- package/dist/controls/radio.js +50 -0
- package/dist/controls/radio.js.map +1 -0
- package/dist/controls/select.css +37 -0
- package/dist/controls/select.d.ts +62 -0
- package/dist/controls/select.d.ts.map +1 -0
- package/dist/controls/select.js +59 -0
- package/dist/controls/select.js.map +1 -0
- package/dist/controls/switch.css +154 -0
- package/dist/controls/switch.d.ts +44 -0
- package/dist/controls/switch.d.ts.map +1 -0
- package/dist/controls/switch.js +48 -0
- package/dist/controls/switch.js.map +1 -0
- package/dist/controls/textarea.css +50 -0
- package/dist/controls/textarea.d.ts +97 -0
- package/dist/controls/textarea.d.ts.map +1 -0
- package/dist/controls/textarea.js +75 -0
- package/dist/controls/textarea.js.map +1 -0
- package/dist/glyphs/icon.core.d.ts +52 -0
- package/dist/glyphs/icon.core.d.ts.map +1 -0
- package/dist/glyphs/icon.core.js +67 -0
- package/dist/glyphs/icon.core.js.map +1 -0
- package/dist/glyphs/icon.css +32 -0
- package/dist/glyphs/icon.d.ts +152 -0
- package/dist/glyphs/icon.d.ts.map +1 -0
- package/dist/glyphs/icon.js +167 -0
- package/dist/glyphs/icon.js.map +1 -0
- package/dist/glyphs/icon.md +76 -0
- package/dist/glyphs/logo.css +73 -0
- package/dist/glyphs/logo.d.ts +27 -0
- package/dist/glyphs/logo.d.ts.map +1 -0
- package/dist/glyphs/logo.js +49 -0
- package/dist/glyphs/logo.js.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/card.css +166 -0
- package/dist/layouts/card.d.ts +69 -0
- package/dist/layouts/card.d.ts.map +1 -0
- package/dist/layouts/card.js +57 -0
- package/dist/layouts/card.js.map +1 -0
- package/dist/layouts/stack.css +58 -0
- package/dist/layouts/stack.d.ts +64 -0
- package/dist/layouts/stack.d.ts.map +1 -0
- package/dist/layouts/stack.js +69 -0
- package/dist/layouts/stack.js.map +1 -0
- package/dist/layouts/strip.css +58 -0
- package/dist/layouts/strip.d.ts +72 -0
- package/dist/layouts/strip.d.ts.map +1 -0
- package/dist/layouts/strip.js +73 -0
- package/dist/layouts/strip.js.map +1 -0
- package/dist/layouts/tabs.core.d.ts +73 -0
- package/dist/layouts/tabs.core.d.ts.map +1 -0
- package/dist/layouts/tabs.core.js +65 -0
- package/dist/layouts/tabs.core.js.map +1 -0
- package/dist/layouts/tabs.css +260 -0
- package/dist/layouts/tabs.d.ts +57 -0
- package/dist/layouts/tabs.d.ts.map +1 -0
- package/dist/layouts/tabs.js +128 -0
- package/dist/layouts/tabs.js.map +1 -0
- package/dist/layouts/tree.css +138 -0
- package/dist/layouts/tree.d.ts +46 -0
- package/dist/layouts/tree.d.ts.map +1 -0
- package/dist/layouts/tree.js +69 -0
- package/dist/layouts/tree.js.map +1 -0
- package/dist/navigation/link.css +229 -0
- package/dist/navigation/link.d.ts +89 -0
- package/dist/navigation/link.d.ts.map +1 -0
- package/dist/navigation/link.js +91 -0
- package/dist/navigation/link.js.map +1 -0
- package/dist/navigation/path.css +122 -0
- package/dist/navigation/path.d.ts +42 -0
- package/dist/navigation/path.d.ts.map +1 -0
- package/dist/navigation/path.js +49 -0
- package/dist/navigation/path.js.map +1 -0
- package/dist/navigation/toc.core.d.ts +111 -0
- package/dist/navigation/toc.core.d.ts.map +1 -0
- package/dist/navigation/toc.core.js +60 -0
- package/dist/navigation/toc.core.js.map +1 -0
- package/dist/navigation/toc.css +53 -0
- package/dist/navigation/toc.d.ts +112 -0
- package/dist/navigation/toc.d.ts.map +1 -0
- package/dist/navigation/toc.js +321 -0
- package/dist/navigation/toc.js.map +1 -0
- package/dist/scopes/guard.css +26 -0
- package/dist/scopes/guard.d.ts +37 -0
- package/dist/scopes/guard.d.ts.map +1 -0
- package/dist/scopes/guard.js +60 -0
- package/dist/scopes/guard.js.map +1 -0
- package/dist/scopes/style.css +26 -0
- package/dist/scopes/style.d.ts +68 -0
- package/dist/scopes/style.d.ts.map +1 -0
- package/dist/scopes/style.js +108 -0
- package/dist/scopes/style.js.map +1 -0
- package/dist/shells/tool.css +778 -0
- package/dist/shells/tool.d.ts +164 -0
- package/dist/shells/tool.d.ts.map +1 -0
- package/dist/shells/tool.js +251 -0
- package/dist/shells/tool.js.map +1 -0
- package/dist/signals/more.css +42 -0
- package/dist/signals/more.d.ts +28 -0
- package/dist/signals/more.d.ts.map +1 -0
- package/dist/signals/more.js +61 -0
- package/dist/signals/more.js.map +1 -0
- package/dist/signals/note.css +221 -0
- package/dist/signals/note.d.ts +83 -0
- package/dist/signals/note.d.ts.map +1 -0
- package/dist/signals/note.js +72 -0
- package/dist/signals/note.js.map +1 -0
- package/dist/signals/toasts.css +463 -0
- package/dist/signals/toasts.d.ts +68 -0
- package/dist/signals/toasts.d.ts.map +1 -0
- package/dist/signals/toasts.js +160 -0
- package/dist/signals/toasts.js.map +1 -0
- package/package.json +331 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 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 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 those 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
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @grafctory/clay-widgets
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@grafctory/clay-widgets)
|
|
4
|
+
|
|
5
|
+
Preact interface components for [@grafctory/clay](https://github.com/grafctory/clay).
|
|
6
|
+
|
|
7
|
+
The components an interface is assembled from: buttons, forms with their labels, fields and field groups, links and
|
|
8
|
+
icons, the app logo, text runs, tags and captioned images, notices and placeholders, breadcrumb trails and incremental
|
|
9
|
+
loading triggers, a shell for app screens, stacks, strips and cards optionally set on surfaces of their own, tabs,
|
|
10
|
+
collapsible trees, property panels, transient notices and failure boundaries. A custom widget built on the shared class
|
|
11
|
+
and keyboard helpers, and marked with the same role-named glyphs, behaves and looks like the stock ones without
|
|
12
|
+
restating their keyboard handling or visual vocabulary, so a screen mixing both reads and responds as one interface.
|
|
13
|
+
|
|
14
|
+
Styling is structural only: what a widget needs to work, with colour, type and spacing left to
|
|
15
|
+
[@grafctory/skin](https://github.com/grafctory/skin) or to whoever styles the app.
|
|
16
|
+
|
|
17
|
+
# Installation
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
npm install @grafctory/clay-widgets # this package
|
|
21
|
+
npm install preact # peer dependency
|
|
22
|
+
npm install lucide-preact # peer dependency
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> [!WARNING]
|
|
26
|
+
>
|
|
27
|
+
> TypeScript consumers must use `"moduleResolution": "nodenext"/"node16"/"bundler"` in `tsconfig.json`.
|
|
28
|
+
> The legacy `"node"` resolver is not supported.
|
|
29
|
+
|
|
30
|
+
# Usage
|
|
31
|
+
|
|
32
|
+
> [!NOTE]
|
|
33
|
+
>
|
|
34
|
+
> This section introduces essential concepts; for complete coverage, see the
|
|
35
|
+
> [API reference](https://grafctory.github.io/clay/modules/_grafctory_clay-widgets.html).
|
|
36
|
+
|
|
37
|
+
{TBD: usage overview and examples}
|
|
38
|
+
|
|
39
|
+
# Support
|
|
40
|
+
|
|
41
|
+
- open an [issue](https://github.com/grafctory/clay/issues) to report a problem or to suggest a new feature
|
|
42
|
+
- start a [discussion](https://github.com/grafctory/clay/discussions) to ask a how-to question or to share an idea
|
|
43
|
+
|
|
44
|
+
# License
|
|
45
|
+
|
|
46
|
+
This project is licensed under the Apache 2.0 License –
|
|
47
|
+
see [LICENSE](https://github.com/grafctory/clay?tab=Apache-2.0-1-ov-file) file for details.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* An empty state fills its space and centres a large glyph over the wording saying why the content is missing. */
|
|
18
|
+
|
|
19
|
+
/* The size of the glyph, large enough for it to stand in for the content that is missing. */
|
|
20
|
+
|
|
21
|
+
@property --clay-empty-icon-size {
|
|
22
|
+
syntax: "*";
|
|
23
|
+
inherits: true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* The look of an empty state stating none, which an area assigns to every empty state it holds. */
|
|
27
|
+
|
|
28
|
+
@property --clay-empty-look {
|
|
29
|
+
syntax: "subtle | normal | strong";
|
|
30
|
+
inherits: true;
|
|
31
|
+
initial-value: normal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
clay-empty {
|
|
35
|
+
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
gap: var(--skin--spacing-100);
|
|
41
|
+
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
|
|
45
|
+
text-align: center;
|
|
46
|
+
|
|
47
|
+
/* The wording stands in for missing content, so it takes the placeholder colour, which still holds AA contrast. */
|
|
48
|
+
|
|
49
|
+
color: var(--skin--color-placeholder);
|
|
50
|
+
|
|
51
|
+
&[look="normal"],
|
|
52
|
+
&[look="strong"] {
|
|
53
|
+
|
|
54
|
+
padding: var(--skin--spacing-100);
|
|
55
|
+
|
|
56
|
+
border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
|
|
57
|
+
border-radius: var(--skin--border-radius-050);
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&[look="strong"] {
|
|
62
|
+
|
|
63
|
+
/* The placeholder holds 4.64:1 over the recess in the light scheme and 5.19:1 in the dark one. */
|
|
64
|
+
|
|
65
|
+
background-color: var(--skin--background-color-sunken);
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
& > svg:first-child {
|
|
70
|
+
|
|
71
|
+
flex: none;
|
|
72
|
+
|
|
73
|
+
width: var(--clay-empty-icon-size, var(--skin--scaling-250));
|
|
74
|
+
height: var(--clay-empty-icon-size, var(--skin--scaling-250));
|
|
75
|
+
|
|
76
|
+
color: var(--skin--color-disabled);
|
|
77
|
+
|
|
78
|
+
/* Half again the inverse of the 2.5× scaling above, so the strokes draw a shade heavier than inline glyphs. */
|
|
79
|
+
|
|
80
|
+
stroke-width: calc(0.6 * var(--skin--stroke-width));
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* An area stating no look of its own takes the one the area around it sets, read off the `--clay-empty-look`
|
|
86
|
+
* knob through a style query, as buttons and links do: the attribute has to be absent for the container to have
|
|
87
|
+
* a say, so each rule here holds itself to an area carrying none, restating the declarations of the rules above.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
@container style(--clay-empty-look: normal) {
|
|
91
|
+
&:not([look]) {
|
|
92
|
+
padding: var(--skin--spacing-100);
|
|
93
|
+
border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
|
|
94
|
+
border-radius: var(--skin--border-radius-050);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@container style(--clay-empty-look: strong) {
|
|
99
|
+
&:not([look]) {
|
|
100
|
+
padding: var(--skin--spacing-100);
|
|
101
|
+
border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
|
|
102
|
+
border-radius: var(--skin--border-radius-050);
|
|
103
|
+
background-color: var(--skin--background-color-sunken);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Missing content placeholder.
|
|
3
|
+
*
|
|
4
|
+
* Offers the placeholder an area shows while it has no content of its own, whether still loading, left empty or
|
|
5
|
+
* unable to fetch what it was to show, filling the space the content would take.
|
|
6
|
+
*
|
|
7
|
+
* @module empty
|
|
8
|
+
*/
|
|
9
|
+
import { type ComponentChildren } from "preact";
|
|
10
|
+
import "./empty.css";
|
|
11
|
+
/**
|
|
12
|
+
* Creates an empty state.
|
|
13
|
+
*
|
|
14
|
+
* Fills the space it is handed and centres what it carries there, so a table, a list or a media frame with nothing to
|
|
15
|
+
* show holds its place instead of collapsing. A glyph leading the content marks the area above the wording, drawn
|
|
16
|
+
* large enough to stand in for the missing content whatever the size of the area, unless the `--clay-empty-icon-size`
|
|
17
|
+
* property sets a size of its own, either on the empty state or on any element it is nested in.
|
|
18
|
+
*
|
|
19
|
+
* @param options The widget configuration
|
|
20
|
+
*
|
|
21
|
+
* @returns The empty state
|
|
22
|
+
*/
|
|
23
|
+
export declare function Empty({ look, // deliberately left undefaulted, so an unstated look falls through to the one the area assigns
|
|
24
|
+
children }: {
|
|
25
|
+
/**
|
|
26
|
+
* How loud the area appears: `subtle` stays flush with the surface around it, `normal` is outlined as room left
|
|
27
|
+
* for the missing content, and `strong` is outlined and recessed as well, standing apart from what surrounds it.
|
|
28
|
+
*
|
|
29
|
+
* An area stating nothing takes the look the {@link style!Style styled area} around it assigns as `emptyLook`,
|
|
30
|
+
* which is `normal` where nothing assigns it. Stating a look here answers to that alone, whatever the area says.
|
|
31
|
+
*/
|
|
32
|
+
look?: "subtle" | "normal" | "strong";
|
|
33
|
+
/**
|
|
34
|
+
* The content centred in the area: a leading glyph marking it, and the wording saying why the content is missing.
|
|
35
|
+
*/
|
|
36
|
+
children?: ComponentChildren;
|
|
37
|
+
}): import("preact").VNode<{
|
|
38
|
+
look: "subtle" | "normal" | "strong" | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/content/empty.tsx"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,QAAQ,CAAC;AAC/D,OAAO,aAAa,CAAC;AAGrB;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAErB,IAAI,EAAE,+FAA+F;AAErG,QAAQ,EAER,EAAE;IAEF;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAGrC;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAE5B;;GAIA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Missing content placeholder.
|
|
18
|
+
*
|
|
19
|
+
* Offers the placeholder an area shows while it has no content of its own, whether still loading, left empty or
|
|
20
|
+
* unable to fetch what it was to show, filling the space the content would take.
|
|
21
|
+
*
|
|
22
|
+
* @module empty
|
|
23
|
+
*/
|
|
24
|
+
import { createElement } from "preact";
|
|
25
|
+
import "./empty.css";
|
|
26
|
+
/**
|
|
27
|
+
* Creates an empty state.
|
|
28
|
+
*
|
|
29
|
+
* Fills the space it is handed and centres what it carries there, so a table, a list or a media frame with nothing to
|
|
30
|
+
* show holds its place instead of collapsing. A glyph leading the content marks the area above the wording, drawn
|
|
31
|
+
* large enough to stand in for the missing content whatever the size of the area, unless the `--clay-empty-icon-size`
|
|
32
|
+
* property sets a size of its own, either on the empty state or on any element it is nested in.
|
|
33
|
+
*
|
|
34
|
+
* @param options The widget configuration
|
|
35
|
+
*
|
|
36
|
+
* @returns The empty state
|
|
37
|
+
*/
|
|
38
|
+
export function Empty({ look, // deliberately left undefaulted, so an unstated look falls through to the one the area assigns
|
|
39
|
+
children }) {
|
|
40
|
+
return createElement("clay-empty", { look }, children);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.js","sourceRoot":"","sources":["../../src/content/empty.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAA0B,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,aAAa,CAAC;AAGrB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,EAErB,IAAI,EAAE,+FAA+F;AAErG,QAAQ,EAmBR;IAEA,OAAO,aAAa,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AAExD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* A title with no rank reads as a heading through the type the design system gives every heading, while its size stays
|
|
19
|
+
* that of the running text, since it holds no place in the outline the heading scale tells apart. It stands as close
|
|
20
|
+
* to the content it opens as the lowest ranked headings do, so it still reads as titling what follows it.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
clay-heading {
|
|
24
|
+
|
|
25
|
+
display: block;
|
|
26
|
+
margin-bottom: var(--skin--spacing-100);
|
|
27
|
+
|
|
28
|
+
font-size: calc(var(--skin--font-size-heading) * 1.25); /* A ratio on the heading size, which no em step can express. */
|
|
29
|
+
font-weight: var(--skin--font-weight-strong);
|
|
30
|
+
font-family: var(--skin--font-family-heading);
|
|
31
|
+
letter-spacing: var(--skin--letter-spacing-heading);
|
|
32
|
+
text-transform: var(--skin--text-transform-heading);
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page heading.
|
|
3
|
+
*
|
|
4
|
+
* Opens a stretch of a long page with a title, so a page reads as a sequence of stretches a reader can scan and link
|
|
5
|
+
* to, rather than as one unbroken run of text. A ranked title also places its stretch in the page outline for a reader
|
|
6
|
+
* to follow, while an unranked one titles a minor stretch that takes no place in the outline.
|
|
7
|
+
*
|
|
8
|
+
* @module heading
|
|
9
|
+
*/
|
|
10
|
+
import { type ComponentChildren } from "preact";
|
|
11
|
+
import "./heading.css";
|
|
12
|
+
/**
|
|
13
|
+
* Creates a page heading.
|
|
14
|
+
*
|
|
15
|
+
* Sets the title as a heading at its rank in the page outline, or in heading type outside the outline when given no
|
|
16
|
+
* rank. The heading holds nothing else: the content it opens follows it on the page as its sibling, so the heading
|
|
17
|
+
* never decides how that content is laid out. A ranked title is set as the design system sets any heading of its rank,
|
|
18
|
+
* so a page of headings reads like the rest of the page markup; a heading with no title renders nothing at all.
|
|
19
|
+
*
|
|
20
|
+
* The heading adds no landmark: the rank of its title alone places it in the page outline. A heading given an `id` is
|
|
21
|
+
* a target for links, such as the entries of a {@link @grafctory/clay-widgets!toc.TOC table of contents}, and comes to
|
|
22
|
+
* rest clear of any bar standing over the page when a link is followed, rather than hidden underneath it.
|
|
23
|
+
*
|
|
24
|
+
* @param options The widget configuration
|
|
25
|
+
*
|
|
26
|
+
* @returns The page heading, or `null` if given no title
|
|
27
|
+
*/
|
|
28
|
+
export declare function Heading({ id, level, children }: {
|
|
29
|
+
/**
|
|
30
|
+
* The id a link names the heading by, as the fragment of its location; none if omitted.
|
|
31
|
+
*/
|
|
32
|
+
id?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The rank of the title in the outline of the page: `1` for a heading of the page itself, `2` for a heading nested
|
|
35
|
+
* under one of them, `3` for one nested a level deeper. If omitted, the title still reads as a heading, but takes
|
|
36
|
+
* no place in the outline and keeps the size of the running text, titling a minor stretch within a ranked one.
|
|
37
|
+
*/
|
|
38
|
+
level?: 1 | 2 | 3;
|
|
39
|
+
/**
|
|
40
|
+
* The title of the stretch opened by the heading, set as a heading at `level`, or in heading type when no `level`
|
|
41
|
+
* is given; none if omitted, in which case the heading renders nothing, not even an empty element on the page.
|
|
42
|
+
*/
|
|
43
|
+
children?: ComponentChildren;
|
|
44
|
+
}): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & import("preact").HTMLAttributes<EventTarget> & import("preact").SVGAttributes<SVGElement>> | null;
|
|
45
|
+
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/content/heading.tsx"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,QAAQ,CAAC;AAE/D,OAAO,eAAe,CAAC;AAGvB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EAEvB,EAAE,EAEF,KAAK,EAEL,QAAQ,EAER,EAAE;IAEF;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAE5B,4KAMA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Page heading.
|
|
18
|
+
*
|
|
19
|
+
* Opens a stretch of a long page with a title, so a page reads as a sequence of stretches a reader can scan and link
|
|
20
|
+
* to, rather than as one unbroken run of text. A ranked title also places its stretch in the page outline for a reader
|
|
21
|
+
* to follow, while an unranked one titles a minor stretch that takes no place in the outline.
|
|
22
|
+
*
|
|
23
|
+
* @module heading
|
|
24
|
+
*/
|
|
25
|
+
import { createElement } from "preact";
|
|
26
|
+
import { isContent } from "../index.js";
|
|
27
|
+
import "./heading.css";
|
|
28
|
+
/**
|
|
29
|
+
* Creates a page heading.
|
|
30
|
+
*
|
|
31
|
+
* Sets the title as a heading at its rank in the page outline, or in heading type outside the outline when given no
|
|
32
|
+
* rank. The heading holds nothing else: the content it opens follows it on the page as its sibling, so the heading
|
|
33
|
+
* never decides how that content is laid out. A ranked title is set as the design system sets any heading of its rank,
|
|
34
|
+
* so a page of headings reads like the rest of the page markup; a heading with no title renders nothing at all.
|
|
35
|
+
*
|
|
36
|
+
* The heading adds no landmark: the rank of its title alone places it in the page outline. A heading given an `id` is
|
|
37
|
+
* a target for links, such as the entries of a {@link @grafctory/clay-widgets!toc.TOC table of contents}, and comes to
|
|
38
|
+
* rest clear of any bar standing over the page when a link is followed, rather than hidden underneath it.
|
|
39
|
+
*
|
|
40
|
+
* @param options The widget configuration
|
|
41
|
+
*
|
|
42
|
+
* @returns The page heading, or `null` if given no title
|
|
43
|
+
*/
|
|
44
|
+
export function Heading({ id, level, children }) {
|
|
45
|
+
return isContent(children)
|
|
46
|
+
? createElement(level ? `h${level}` : "clay-heading", { id }, children)
|
|
47
|
+
: null;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","sourceRoot":"","sources":["../../src/content/heading.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAA0B,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,eAAe,CAAC;AAGvB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,OAAO,CAAC,EAEvB,EAAE,EAEF,KAAK,EAEL,QAAQ,EAsBR;IAEA,OAAO,SAAS,CAAC,QAAQ,CAAC;QACzB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC;QACvE,CAAC,CAAC,IAAI,CAAC;AAET,CAAC"}
|