@grafctory/clay-widgets 0.0.0-stage → 0.5.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.
Files changed (189) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -2
  3. package/dist/content/empty.css +107 -0
  4. package/dist/content/empty.d.ts +40 -0
  5. package/dist/content/empty.d.ts.map +1 -0
  6. package/dist/content/empty.js +42 -0
  7. package/dist/content/empty.js.map +1 -0
  8. package/dist/content/heading.css +34 -0
  9. package/dist/content/heading.d.ts +45 -0
  10. package/dist/content/heading.d.ts.map +1 -0
  11. package/dist/content/heading.js +49 -0
  12. package/dist/content/heading.js.map +1 -0
  13. package/dist/content/image.css +198 -0
  14. package/dist/content/image.d.ts +77 -0
  15. package/dist/content/image.d.ts.map +1 -0
  16. package/dist/content/image.js +67 -0
  17. package/dist/content/image.js.map +1 -0
  18. package/dist/content/infobox.css +186 -0
  19. package/dist/content/infobox.d.ts +72 -0
  20. package/dist/content/infobox.d.ts.map +1 -0
  21. package/dist/content/infobox.js +63 -0
  22. package/dist/content/infobox.js.map +1 -0
  23. package/dist/content/pill.css +76 -0
  24. package/dist/content/pill.d.ts +57 -0
  25. package/dist/content/pill.d.ts.map +1 -0
  26. package/dist/content/pill.js +48 -0
  27. package/dist/content/pill.js.map +1 -0
  28. package/dist/content/text.css +44 -0
  29. package/dist/content/text.d.ts +30 -0
  30. package/dist/content/text.d.ts.map +1 -0
  31. package/dist/content/text.js +42 -0
  32. package/dist/content/text.js.map +1 -0
  33. package/dist/controls/button.css +469 -0
  34. package/dist/controls/button.d.ts +116 -0
  35. package/dist/controls/button.d.ts.map +1 -0
  36. package/dist/controls/button.js +61 -0
  37. package/dist/controls/button.js.map +1 -0
  38. package/dist/controls/checkbox.css +23 -0
  39. package/dist/controls/checkbox.d.ts +54 -0
  40. package/dist/controls/checkbox.d.ts.map +1 -0
  41. package/dist/controls/checkbox.js +49 -0
  42. package/dist/controls/checkbox.js.map +1 -0
  43. package/dist/controls/choice.css +288 -0
  44. package/dist/controls/choice.d.ts +63 -0
  45. package/dist/controls/choice.d.ts.map +1 -0
  46. package/dist/controls/choice.js +52 -0
  47. package/dist/controls/choice.js.map +1 -0
  48. package/dist/controls/fieldset.css +37 -0
  49. package/dist/controls/fieldset.d.ts +49 -0
  50. package/dist/controls/fieldset.d.ts.map +1 -0
  51. package/dist/controls/fieldset.js +51 -0
  52. package/dist/controls/fieldset.js.map +1 -0
  53. package/dist/controls/form.css +50 -0
  54. package/dist/controls/form.d.ts +64 -0
  55. package/dist/controls/form.d.ts.map +1 -0
  56. package/dist/controls/form.js +62 -0
  57. package/dist/controls/form.js.map +1 -0
  58. package/dist/controls/input.css +57 -0
  59. package/dist/controls/input.d.ts +129 -0
  60. package/dist/controls/input.d.ts.map +1 -0
  61. package/dist/controls/input.js +71 -0
  62. package/dist/controls/input.js.map +1 -0
  63. package/dist/controls/label.css +73 -0
  64. package/dist/controls/label.d.ts +76 -0
  65. package/dist/controls/label.d.ts.map +1 -0
  66. package/dist/controls/label.js +73 -0
  67. package/dist/controls/label.js.map +1 -0
  68. package/dist/controls/radio.css +23 -0
  69. package/dist/controls/radio.d.ts +60 -0
  70. package/dist/controls/radio.d.ts.map +1 -0
  71. package/dist/controls/radio.js +50 -0
  72. package/dist/controls/radio.js.map +1 -0
  73. package/dist/controls/select.css +37 -0
  74. package/dist/controls/select.d.ts +71 -0
  75. package/dist/controls/select.d.ts.map +1 -0
  76. package/dist/controls/select.js +59 -0
  77. package/dist/controls/select.js.map +1 -0
  78. package/dist/controls/switch.css +154 -0
  79. package/dist/controls/switch.d.ts +44 -0
  80. package/dist/controls/switch.d.ts.map +1 -0
  81. package/dist/controls/switch.js +48 -0
  82. package/dist/controls/switch.js.map +1 -0
  83. package/dist/controls/textarea.css +50 -0
  84. package/dist/controls/textarea.d.ts +106 -0
  85. package/dist/controls/textarea.d.ts.map +1 -0
  86. package/dist/controls/textarea.js +68 -0
  87. package/dist/controls/textarea.js.map +1 -0
  88. package/dist/glyphs/icon.core.d.ts +52 -0
  89. package/dist/glyphs/icon.core.d.ts.map +1 -0
  90. package/dist/glyphs/icon.core.js +67 -0
  91. package/dist/glyphs/icon.core.js.map +1 -0
  92. package/dist/glyphs/icon.css +32 -0
  93. package/dist/glyphs/icon.d.ts +152 -0
  94. package/dist/glyphs/icon.d.ts.map +1 -0
  95. package/dist/glyphs/icon.js +167 -0
  96. package/dist/glyphs/icon.js.map +1 -0
  97. package/dist/glyphs/icon.md +76 -0
  98. package/dist/glyphs/logo.css +73 -0
  99. package/dist/glyphs/logo.d.ts +27 -0
  100. package/dist/glyphs/logo.d.ts.map +1 -0
  101. package/dist/glyphs/logo.js +49 -0
  102. package/dist/glyphs/logo.js.map +1 -0
  103. package/dist/index.core.d.ts +18 -0
  104. package/dist/index.core.d.ts.map +1 -0
  105. package/dist/index.core.js +36 -0
  106. package/dist/index.core.js.map +1 -0
  107. package/dist/index.d.ts +65 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +95 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/layouts/card.css +190 -0
  112. package/dist/layouts/card.d.ts +75 -0
  113. package/dist/layouts/card.d.ts.map +1 -0
  114. package/dist/layouts/card.js +62 -0
  115. package/dist/layouts/card.js.map +1 -0
  116. package/dist/layouts/stack.css +58 -0
  117. package/dist/layouts/stack.d.ts +64 -0
  118. package/dist/layouts/stack.d.ts.map +1 -0
  119. package/dist/layouts/stack.js +69 -0
  120. package/dist/layouts/stack.js.map +1 -0
  121. package/dist/layouts/strip.css +58 -0
  122. package/dist/layouts/strip.d.ts +72 -0
  123. package/dist/layouts/strip.d.ts.map +1 -0
  124. package/dist/layouts/strip.js +73 -0
  125. package/dist/layouts/strip.js.map +1 -0
  126. package/dist/layouts/tabs.core.d.ts +73 -0
  127. package/dist/layouts/tabs.core.d.ts.map +1 -0
  128. package/dist/layouts/tabs.core.js +65 -0
  129. package/dist/layouts/tabs.core.js.map +1 -0
  130. package/dist/layouts/tabs.css +260 -0
  131. package/dist/layouts/tabs.d.ts +57 -0
  132. package/dist/layouts/tabs.d.ts.map +1 -0
  133. package/dist/layouts/tabs.js +128 -0
  134. package/dist/layouts/tabs.js.map +1 -0
  135. package/dist/layouts/tree.css +138 -0
  136. package/dist/layouts/tree.d.ts +46 -0
  137. package/dist/layouts/tree.d.ts.map +1 -0
  138. package/dist/layouts/tree.js +69 -0
  139. package/dist/layouts/tree.js.map +1 -0
  140. package/dist/navigation/link.css +229 -0
  141. package/dist/navigation/link.d.ts +89 -0
  142. package/dist/navigation/link.d.ts.map +1 -0
  143. package/dist/navigation/link.js +91 -0
  144. package/dist/navigation/link.js.map +1 -0
  145. package/dist/navigation/path.css +122 -0
  146. package/dist/navigation/path.d.ts +42 -0
  147. package/dist/navigation/path.d.ts.map +1 -0
  148. package/dist/navigation/path.js +49 -0
  149. package/dist/navigation/path.js.map +1 -0
  150. package/dist/navigation/toc.core.d.ts +111 -0
  151. package/dist/navigation/toc.core.d.ts.map +1 -0
  152. package/dist/navigation/toc.core.js +60 -0
  153. package/dist/navigation/toc.core.js.map +1 -0
  154. package/dist/navigation/toc.css +53 -0
  155. package/dist/navigation/toc.d.ts +112 -0
  156. package/dist/navigation/toc.d.ts.map +1 -0
  157. package/dist/navigation/toc.js +321 -0
  158. package/dist/navigation/toc.js.map +1 -0
  159. package/dist/scopes/guard.css +26 -0
  160. package/dist/scopes/guard.d.ts +37 -0
  161. package/dist/scopes/guard.d.ts.map +1 -0
  162. package/dist/scopes/guard.js +60 -0
  163. package/dist/scopes/guard.js.map +1 -0
  164. package/dist/scopes/style.css +26 -0
  165. package/dist/scopes/style.d.ts +68 -0
  166. package/dist/scopes/style.d.ts.map +1 -0
  167. package/dist/scopes/style.js +108 -0
  168. package/dist/scopes/style.js.map +1 -0
  169. package/dist/shells/tool.css +770 -0
  170. package/dist/shells/tool.d.ts +167 -0
  171. package/dist/shells/tool.d.ts.map +1 -0
  172. package/dist/shells/tool.js +286 -0
  173. package/dist/shells/tool.js.map +1 -0
  174. package/dist/signals/more.css +42 -0
  175. package/dist/signals/more.d.ts +28 -0
  176. package/dist/signals/more.d.ts.map +1 -0
  177. package/dist/signals/more.js +61 -0
  178. package/dist/signals/more.js.map +1 -0
  179. package/dist/signals/note.css +221 -0
  180. package/dist/signals/note.d.ts +83 -0
  181. package/dist/signals/note.d.ts.map +1 -0
  182. package/dist/signals/note.js +72 -0
  183. package/dist/signals/note.js.map +1 -0
  184. package/dist/signals/toasts.css +463 -0
  185. package/dist/signals/toasts.d.ts +68 -0
  186. package/dist/signals/toasts.d.ts.map +1 -0
  187. package/dist/signals/toasts.js +160 -0
  188. package/dist/signals/toasts.js.map +1 -0
  189. package/package.json +331 -4
@@ -0,0 +1,190 @@
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 card lays its parts out as a two-column grid: the title over the description in a main column, the badge over the
19
+ * image in a side column kept to the end of the card, as wide as what it holds up to the cap set below. A card given
20
+ * a number of lines fixes the width of the side column beside an image instead, so a run of cards ends alike.
21
+ */
22
+
23
+ /*
24
+ * The widest the side column grows: capped on a wide card and a share of a narrow one, the share taken of the card
25
+ * where the knob is read, so the main column keeps the larger part of the card at any width. Past it, a badge is
26
+ * clipped and a picture is scaled down. A single dash keeps this layout knob apart from the `--skin--` contract.
27
+ */
28
+
29
+ @property --clay-card-side-max-width {
30
+ syntax: "*";
31
+ inherits: true;
32
+ initial-value: min(15rem, 33%);
33
+ }
34
+
35
+ /*
36
+ * The proportions of the side column beside an image in a card given a number of lines, as a width-to-height ratio
37
+ * over the height of the lines. Landscape by default, as the pictures standing for an item usually are.
38
+ */
39
+
40
+ @property --clay-card-image-ratio {
41
+ syntax: "*";
42
+ inherits: true;
43
+ initial-value: 16 / 9;
44
+ }
45
+
46
+ clay-card {
47
+
48
+ display: grid;
49
+ grid-template-columns: 1fr fit-content(var(--clay-card-side-max-width));
50
+ grid-template-rows: min-content min-content;
51
+ align-items: start;
52
+ gap: var(--skin--spacing-025) var(--skin--spacing-100);
53
+
54
+ /* Consecutive cards are set apart, so a run of them reads as a list of entries. */
55
+
56
+ & + & {
57
+ margin-top: var(--skin--spacing-100);
58
+ }
59
+
60
+ /*
61
+ * A card given a look stands on a surface of its own. The page colour is retuned to the surface rather than
62
+ * painted over it, so everything inside reads as standing on the card. A card stating no look draws nothing,
63
+ * whatever the look of the area around it, so one surface never outlines every card nested inside it. A
64
+ * strong look takes the raised colour edged by a border rather than a shadow, so it stands apart with no depth.
65
+ */
66
+
67
+ &[look] {
68
+ padding: var(--skin--spacing-100);
69
+ border-radius: var(--skin--border-radius-050);
70
+ background-color: var(--skin--background-color);
71
+ }
72
+
73
+ &[look="subtle"] {
74
+ --skin--background-color: var(--skin--background-color-sunken);
75
+ }
76
+
77
+ &[look="strong"] {
78
+ --skin--background-color: var(--skin--background-color-raised);
79
+ border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
80
+ }
81
+
82
+ /* The title and the badge share the first row, sitting on a common baseline as an infobox entry does. */
83
+
84
+ & > span {
85
+
86
+ grid-row: 1;
87
+ align-self: baseline;
88
+
89
+ /* The title names the resource the card sums up, so it reads at the strong weight whatever it holds. */
90
+
91
+ &:not(.badge) {
92
+ grid-column: 1;
93
+ justify-self: stretch;
94
+ font-weight: var(--skin--font-weight-strong);
95
+ }
96
+
97
+ }
98
+
99
+ & > div {
100
+
101
+ grid-row: 2;
102
+ grid-column: 1;
103
+ justify-self: stretch;
104
+
105
+ /* A description with no image beneath the side column runs on under the badge. */
106
+
107
+ &:last-child {
108
+ grid-column: 1 / -1;
109
+ }
110
+
111
+ }
112
+
113
+ /*
114
+ * A badge is guidance rather than text, rendered as a label of an infobox is: it takes the size and weight
115
+ * of the title beside it, set apart by the label colour alone, which holds 4.5:1 in both schemes, and is kept to
116
+ * one line, clipped with an ellipsis where it outruns the side column rather than wrapping the row.
117
+ */
118
+
119
+ & > .badge {
120
+
121
+ /* Held to the column, or the line keeps its full width and spills over the title rather than clipping. */
122
+
123
+ max-width: 100%;
124
+ grid-column: 2;
125
+ justify-self: end;
126
+ overflow: hidden;
127
+ text-overflow: ellipsis;
128
+ white-space: nowrap;
129
+ text-align: end;
130
+ color: var(--skin--color-label);
131
+
132
+ }
133
+
134
+ /*
135
+ * An image given as initials or an icon rather than a picture is set in the label colour, as the badge is, and a
136
+ * caption under a picture is aligned with its end edge, as the badge above it is aligned with the card end.
137
+ */
138
+
139
+ & > i {
140
+
141
+ /* The image may shrink below its own width, so a picture wider than the cap leaves the column as capped. */
142
+
143
+ min-width: 0;
144
+ grid-row: 2;
145
+ grid-column: 2;
146
+ justify-self: end;
147
+ text-align: end;
148
+ font-style: normal;
149
+ color: var(--skin--color-label);
150
+
151
+ }
152
+
153
+ /*
154
+ * A card given a number of lines cuts its description short with an ellipsis past them, and holds the image beside
155
+ * it to their height: a picture inside the border it draws, an empty state's glyph inside its padding and border.
156
+ */
157
+
158
+ &[lines] {
159
+
160
+ & > div {
161
+ display: -webkit-box;
162
+ -webkit-box-orient: vertical;
163
+ -webkit-line-clamp: var(--clay-card-lines);
164
+ line-clamp: var(--clay-card-lines);
165
+ overflow: hidden;
166
+ }
167
+
168
+ & > i {
169
+ --clay-image-max-height: calc(var(--clay-card-lines) * 1lh - 2 * var(--skin--border-width));
170
+ --clay-empty-icon-size: calc(
171
+ var(--clay-card-lines) * 1lh - 2 * (var(--skin--spacing-100) + var(--skin--border-width))
172
+ );
173
+ align-self: stretch;
174
+ }
175
+
176
+ /*
177
+ * Beside an image, the side column takes a fixed width rather than the width of the picture. The description
178
+ * then keeps its width while the picture loads, and a run of cards ends every description at the same edge.
179
+ */
180
+
181
+ &:has(> i) {
182
+ grid-template-columns: 1fr min(
183
+ var(--clay-card-side-max-width),
184
+ var(--clay-card-lines) * 1lh * (var(--clay-card-image-ratio))
185
+ );
186
+ }
187
+
188
+ }
189
+
190
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Summary card.
3
+ *
4
+ * Sums up an item in a single block: its title and badge over a description, beside an image standing for it. A list
5
+ * of search results or related items then reads as a run of cards without a layout written for each entry.
6
+ *
7
+ * @module card
8
+ */
9
+ import { type ComponentChildren } from "preact";
10
+ import "./card.css";
11
+ /**
12
+ * Creates a summary card.
13
+ *
14
+ * Sets the title over the description in a main column, and the badge over the image in a side column at the end of the
15
+ * card, sized to its content up to the cap set by the `--clay-card-side-max-width` knob. A description with no image
16
+ * beneath the side column runs on under the badge. Consecutive cards are set apart, so a run of them reads as a list of
17
+ * entries rather than as one block of text, with no layout written for each entry.
18
+ *
19
+ * Empty parts are left out, and a card left with none renders nothing, so a screen hands over whatever it knows about
20
+ * an item without first checking what is missing. A part is empty when it is `undefined`, `null`, an empty string
21
+ * or a boolean, as left by a conditional such as `label && <Link/>`; any other part is shown, `0` included.
22
+ *
23
+ * A card given a look sets its parts on a padded, rounded surface of its own, painting everything inside it as
24
+ * standing on that surface, so a run of results reads as a deck of tiles rather than as a list of entries.
25
+ *
26
+ * A card given a number of lines cuts its description short with an ellipsis past them, and holds its image to the
27
+ * same height. A run of cards then keeps its entries alike in height, with text and image ending together.
28
+ *
29
+ * A card given a number of lines and an image fixes the width of its side column, whatever the proportions of the
30
+ * picture. The description keeps its width while the picture loads, and a run of cards ends every description at the
31
+ * same edge. The column is sized for a landscape picture up to the cap, and the `--clay-card-image-ratio` knob retunes
32
+ * it to other proportions. A picture that does not match is scaled down to fit the column, and is never cropped.
33
+ *
34
+ * @param options The widget configuration
35
+ *
36
+ * @returns The card, or `null` if every part is empty
37
+ */
38
+ export declare function Card({ look, lines, title, badge, image, children }: {
39
+ /**
40
+ * The surface the card sets its parts on: sunk below the page (`subtle`), flat on the page colour (`normal`), or
41
+ * raised and edged by a border (`strong`); none if omitted, whatever the look of the area around the card.
42
+ */
43
+ look?: "subtle" | "normal" | "strong";
44
+ /**
45
+ * The most lines the description shows before it is cut short with an ellipsis. The image is held to the same
46
+ * height, in a side column of fixed width. If omitted, the description shows in full, and the image keeps its own
47
+ * height in a side column as wide as the picture, so the edge the description ends at varies from card to card.
48
+ */
49
+ lines?: number;
50
+ /**
51
+ * The title naming the item, at the top of the main column.
52
+ */
53
+ title?: ComponentChildren;
54
+ /**
55
+ * The badge classifying the item, at the top of the side column across from the title: a line of text,
56
+ * {@link pill!Pill pills} or anything else kept to one line, clipped with an ellipsis where it outruns the column.
57
+ */
58
+ badge?: ComponentChildren;
59
+ /**
60
+ * The image standing for the item, under the badge in the side column: a picture, captioned or not, as set by an
61
+ * {@link image!Image Image}, or an icon or initials, shown as given in the label colour of the badge.
62
+ */
63
+ image?: ComponentChildren;
64
+ /**
65
+ * The description of the item, under the title in the main column.
66
+ */
67
+ children?: ComponentChildren;
68
+ }): import("preact").VNode<{
69
+ look: "subtle" | "normal" | "strong" | undefined;
70
+ lines: number | undefined;
71
+ style: {
72
+ "--clay-card-lines": number;
73
+ } | undefined;
74
+ }> | null;
75
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/layouts/card.tsx"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,QAAQ,CAAC;AAE/D,OAAO,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,EAEpB,IAAI,EACJ,KAAK,EAEL,KAAK,EACL,KAAK,EACL,KAAK,EAEL,QAAQ,EAER,EAAE;IAEF;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAErC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAGd;;OAEG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAEzB;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAEzB;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAGzB;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAE5B;;;;;;UAiBA"}
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ /*
3
+ * Copyright © 2026 Metreeca srl
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Summary card.
19
+ *
20
+ * Sums up an item in a single block: its title and badge over a description, beside an image standing for it. A list
21
+ * of search results or related items then reads as a run of cards without a layout written for each entry.
22
+ *
23
+ * @module card
24
+ */
25
+ import { createElement } from "preact";
26
+ import { isContent } from "../index.js";
27
+ import "./card.css";
28
+ /**
29
+ * Creates a summary card.
30
+ *
31
+ * Sets the title over the description in a main column, and the badge over the image in a side column at the end of the
32
+ * card, sized to its content up to the cap set by the `--clay-card-side-max-width` knob. A description with no image
33
+ * beneath the side column runs on under the badge. Consecutive cards are set apart, so a run of them reads as a list of
34
+ * entries rather than as one block of text, with no layout written for each entry.
35
+ *
36
+ * Empty parts are left out, and a card left with none renders nothing, so a screen hands over whatever it knows about
37
+ * an item without first checking what is missing. A part is empty when it is `undefined`, `null`, an empty string
38
+ * or a boolean, as left by a conditional such as `label && <Link/>`; any other part is shown, `0` included.
39
+ *
40
+ * A card given a look sets its parts on a padded, rounded surface of its own, painting everything inside it as
41
+ * standing on that surface, so a run of results reads as a deck of tiles rather than as a list of entries.
42
+ *
43
+ * A card given a number of lines cuts its description short with an ellipsis past them, and holds its image to the
44
+ * same height. A run of cards then keeps its entries alike in height, with text and image ending together.
45
+ *
46
+ * A card given a number of lines and an image fixes the width of its side column, whatever the proportions of the
47
+ * picture. The description keeps its width while the picture loads, and a run of cards ends every description at the
48
+ * same edge. The column is sized for a landscape picture up to the cap, and the `--clay-card-image-ratio` knob retunes
49
+ * it to other proportions. A picture that does not match is scaled down to fit the column, and is never cropped.
50
+ *
51
+ * @param options The widget configuration
52
+ *
53
+ * @returns The card, or `null` if every part is empty
54
+ */
55
+ export function Card({ look, lines, title, badge, image, children }) {
56
+ return [title, badge, image, children].some(isContent) ? createElement("clay-card", {
57
+ look,
58
+ lines,
59
+ style: lines === undefined ? undefined : { "--clay-card-lines": lines } // attr() can't yet portably read a number
60
+ }, _jsxs(_Fragment, { children: [isContent(title) && _jsx("span", { children: title }), isContent(badge) && _jsx("span", { class: "badge", children: badge }), isContent(children) && _jsx("div", { children: children }), isContent(image) && _jsx("i", { children: image })] })) : null;
61
+ }
62
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/layouts/card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAA0B,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,IAAI,CAAC,EAEpB,IAAI,EACJ,KAAK,EAEL,KAAK,EACL,KAAK,EACL,KAAK,EAEL,QAAQ,EAyCR;IAEA,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE;QACnF,IAAI;QACJ,KAAK;QACL,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,0CAA0C;KAClH,EAAE,8BAED,SAAS,CAAC,KAAK,CAAC,IAAI,yBAAO,KAAK,GAAQ,EACxC,SAAS,CAAC,KAAK,CAAC,IAAI,eAAM,KAAK,EAAC,OAAO,YAAE,KAAK,GAAQ,EAEtD,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAM,QAAQ,GAAO,EAE5C,SAAS,CAAC,KAAK,CAAC,IAAI,sBAAI,KAAK,GAAK,IAEjC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEb,CAAC"}
@@ -0,0 +1,58 @@
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
+ * The stack is a column and nothing else. The alignment, the gap and the growth are settled by the widget on the
19
+ * element, being chosen by whoever renders the stack rather than by a rule written ahead of time. Only the split
20
+ * placements live here, as they reach the item set apart rather than the stack.
21
+ */
22
+
23
+ clay-stack {
24
+
25
+ display: flex;
26
+ flex-direction: column;
27
+
28
+ /*
29
+ * A stack given a look stands on a surface of its own. The page colour is retuned to the surface rather than
30
+ * painted over it, so everything inside reads as standing on the stack. A stack stating no look draws nothing,
31
+ * whatever the look of the area around it, so one surface never outlines every layout nested inside it. A
32
+ * strong look takes the raised colour edged by a border rather than a shadow, so it stands apart with no depth.
33
+ */
34
+
35
+ &[look] {
36
+ padding: var(--skin--spacing-100);
37
+ border-radius: var(--skin--border-radius-050);
38
+ background-color: var(--skin--background-color);
39
+ }
40
+
41
+ &[look="subtle"] {
42
+ --skin--background-color: var(--skin--background-color-sunken);
43
+ }
44
+
45
+ &[look="strong"] {
46
+ --skin--background-color: var(--skin--background-color-raised);
47
+ border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
48
+ }
49
+
50
+ &[place="head"] > :first-child {
51
+ margin-block-end: auto;
52
+ }
53
+
54
+ &[place="tail"] > :last-child {
55
+ margin-block-start: auto;
56
+ }
57
+
58
+ }
@@ -0,0 +1,64 @@
1
+ import { type Spacing } from "@grafctory/skin";
2
+ import { type ComponentChildren } from "preact";
3
+ import "./stack.css";
4
+ /**
5
+ * Creates a vertical stack.
6
+ *
7
+ * Places what it holds one item below the other, in the order given, with the same gap between each pair and none
8
+ * before the first or after the last. The gap is a step of the {@link @grafctory/skin!index.skin spacing ladder}, so it
9
+ * follows the text size of the stack and whatever an app retuned the ladder to.
10
+ *
11
+ * The stack stands as tall as its items and as wide as whatever holds it, each item taking the full width unless
12
+ * aligned otherwise; a stack told to grow takes whatever room its container leaves along the main axis, which is
13
+ * what lets `place` position the items within a stack taller than they are.
14
+ *
15
+ * A stack given a look sets its items on a padded, rounded surface of its own, painting everything inside it as
16
+ * standing on that surface, so a screen sets a bar, a sidebar or a tray apart without a wrapper of its own.
17
+ *
18
+ * The stack carries no semantics: grouping its items for assistive technology takes an element inside it or around it.
19
+ *
20
+ * @param options The widget configuration
21
+ *
22
+ * @returns The vertical stack
23
+ */
24
+ export declare function Stack({ look, grow, place, align, space, children }: {
25
+ /**
26
+ * The surface the stack sets its items on: sunk below the page (`subtle`), flat on the page colour (`normal`), or
27
+ * raised and edged by a border (`strong`); none if omitted, whatever the look of the area around the stack.
28
+ */
29
+ look?: "subtle" | "normal" | "strong";
30
+ /**
31
+ * Whether the stack takes the room its container leaves along the main axis, rather than the size of its items.
32
+ */
33
+ grow?: boolean;
34
+ /**
35
+ * Where the items sit along the column, when the stack is taller than they are: at the `start`, in the `center`,
36
+ * at the `end`, `spread` from edge to edge, the leftover room shared out between them, or split with the first item
37
+ * alone at the start and the others at the end (`head`), or the last item alone at the end and the others at the
38
+ * start (`tail`); at the start if omitted, packed against the leading edge as plain document flow leaves them.
39
+ */
40
+ place?: "start" | "center" | "end" | "spread" | "head" | "tail";
41
+ /**
42
+ * Where each item sits across the column: `start`, `center`, `end`, or `stretch`ed to the full width of the stack,
43
+ * as it is if omitted, so a column of controls lines up along both edges without a width of its own.
44
+ */
45
+ align?: "start" | "center" | "end" | "stretch";
46
+ /**
47
+ * The step of the spacing ladder setting each item apart from the next; the items touch where left out.
48
+ */
49
+ space?: Spacing;
50
+ /**
51
+ * What the stack holds, each child an item of the column.
52
+ */
53
+ children?: ComponentChildren;
54
+ }): import("preact").VNode<{
55
+ look: "subtle" | "normal" | "strong" | undefined;
56
+ place: "head" | "start" | "end" | "center" | "spread" | "tail";
57
+ style: {
58
+ flexGrow: number | undefined;
59
+ justifyContent: string | undefined;
60
+ alignItems: "start" | "end" | "center" | "stretch";
61
+ gap: import("@grafctory/core").Optional<string>;
62
+ };
63
+ }>;
64
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/layouts/stack.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,QAAQ,CAAC;AAC/D,OAAO,aAAa,CAAC;AAerB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,EAErB,IAAI,EAEJ,IAAY,EAEZ,KAAe,EACf,KAAiB,EACjB,KAAK,EAEL,QAAQ,EAER,EAAE;IAEF;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAGrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAGd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;IAE/D;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAA;IAE9C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAGf;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAE5B;;;;;;;;;GAgBA"}
@@ -0,0 +1,69 @@
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
+ * Vertical stack.
18
+ *
19
+ * Stacks what it holds top to bottom, a spacing step apart and optionally on a surface of its own, so a screen lays
20
+ * out its parts and sets a bar, a sidebar or a tray apart from the page without a rule of its own.
21
+ *
22
+ * @module stack
23
+ */
24
+ import { opt } from "@grafctory/core";
25
+ import { css, skin } from "@grafctory/skin";
26
+ import { createElement } from "preact";
27
+ import "./stack.css";
28
+ const justify = {
29
+ start: "start",
30
+ center: "center",
31
+ end: "end",
32
+ spread: "space-between",
33
+ head: undefined, // set apart by the stylesheet
34
+ tail: undefined // set apart by the stylesheet
35
+ };
36
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
37
+ /**
38
+ * Creates a vertical stack.
39
+ *
40
+ * Places what it holds one item below the other, in the order given, with the same gap between each pair and none
41
+ * before the first or after the last. The gap is a step of the {@link @grafctory/skin!index.skin spacing ladder}, so it
42
+ * follows the text size of the stack and whatever an app retuned the ladder to.
43
+ *
44
+ * The stack stands as tall as its items and as wide as whatever holds it, each item taking the full width unless
45
+ * aligned otherwise; a stack told to grow takes whatever room its container leaves along the main axis, which is
46
+ * what lets `place` position the items within a stack taller than they are.
47
+ *
48
+ * A stack given a look sets its items on a padded, rounded surface of its own, painting everything inside it as
49
+ * standing on that surface, so a screen sets a bar, a sidebar or a tray apart without a wrapper of its own.
50
+ *
51
+ * The stack carries no semantics: grouping its items for assistive technology takes an element inside it or around it.
52
+ *
53
+ * @param options The widget configuration
54
+ *
55
+ * @returns The vertical stack
56
+ */
57
+ export function Stack({ look, grow = false, place = "start", align = "stretch", space, children }) {
58
+ return createElement("clay-stack", {
59
+ look,
60
+ place,
61
+ style: {
62
+ flexGrow: grow ? 1 : undefined,
63
+ justifyContent: justify[place],
64
+ alignItems: align,
65
+ gap: opt(space, step => css.var(skin[step]))
66
+ }
67
+ }, children);
68
+ }
69
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/layouts/stack.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAgB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAA0B,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,aAAa,CAAC;AAGrB,MAAM,OAAO,GAAG;IACf,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,SAAS,EAAE,8BAA8B;IAC/C,IAAI,EAAE,SAAS,CAAC,8BAA8B;CAC9C,CAAC;AAGF,wHAAwH;AAExH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,KAAK,CAAC,EAErB,IAAI,EAEJ,IAAI,GAAG,KAAK,EAEZ,KAAK,GAAG,OAAO,EACf,KAAK,GAAG,SAAS,EACjB,KAAK,EAEL,QAAQ,EA0CR;IAEA,OAAO,aAAa,CAAC,YAAY,EAAE;QAElC,IAAI;QACJ,KAAK;QAEL,KAAK,EAAE;YACN,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;YAC9B,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC;YAC9B,UAAU,EAAE,KAAK;YACjB,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC5C;KAED,EAAE,QAAQ,CAAC,CAAC;AAEd,CAAC"}
@@ -0,0 +1,58 @@
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
+ * The strip is a row and nothing else. The alignment, the gaps, the growth and the wrapping are settled by the widget
19
+ * on the element, being chosen by whoever renders the strip rather than by a rule written ahead of time. Only the
20
+ * split placements live here, as they reach the item set apart rather than the strip.
21
+ */
22
+
23
+ clay-strip {
24
+
25
+ display: flex;
26
+ flex-direction: row;
27
+
28
+ /*
29
+ * A strip given a look stands on a surface of its own. The page colour is retuned to the surface rather than
30
+ * painted over it, so everything inside reads as standing on the strip. A strip stating no look draws nothing,
31
+ * whatever the look of the area around it, so one surface never outlines every layout nested inside it. A
32
+ * strong look takes the raised colour edged by a border rather than a shadow, so it stands apart with no depth.
33
+ */
34
+
35
+ &[look] {
36
+ padding: var(--skin--spacing-100);
37
+ border-radius: var(--skin--border-radius-050);
38
+ background-color: var(--skin--background-color);
39
+ }
40
+
41
+ &[look="subtle"] {
42
+ --skin--background-color: var(--skin--background-color-sunken);
43
+ }
44
+
45
+ &[look="strong"] {
46
+ --skin--background-color: var(--skin--background-color-raised);
47
+ border: var(--skin--border-width) var(--skin--border-style) var(--skin--border-color);
48
+ }
49
+
50
+ &[place="head"] > :first-child {
51
+ margin-inline-end: auto;
52
+ }
53
+
54
+ &[place="tail"] > :last-child {
55
+ margin-inline-start: auto;
56
+ }
57
+
58
+ }
@@ -0,0 +1,72 @@
1
+ import { type Spacing } from "@grafctory/skin";
2
+ import { type ComponentChildren } from "preact";
3
+ import "./strip.css";
4
+ /**
5
+ * Creates a horizontal strip.
6
+ *
7
+ * Places what it holds one item beside the other, in the order given, with the same gap between each pair and none
8
+ * before the first or after the last. The gap is a step of the {@link @grafctory/skin!index.skin spacing ladder}, so it
9
+ * follows the text size of the strip and whatever an app retuned the ladder to.
10
+ *
11
+ * The strip stands as wide as whatever holds it and as tall as its tallest item, each item keeping its own width;
12
+ * a strip told to grow takes whatever room its container leaves along the main axis. Items that do not fit stay on
13
+ * one line and overflow it, unless the strip is told to wrap, in which case they flow onto as many rows as they
14
+ * need, set apart as `wrap` states.
15
+ *
16
+ * A strip given a look sets its items on a padded, rounded surface of its own, painting everything inside it as
17
+ * standing on that surface, so a screen sets a toolbar or a row of tiles apart without a wrapper of its own.
18
+ *
19
+ * The strip carries no semantics: grouping its items for assistive technology takes an element inside it or around it.
20
+ *
21
+ * @param options The widget configuration
22
+ *
23
+ * @returns The horizontal strip
24
+ */
25
+ export declare function Strip({ look, grow, wrap, place, align, space, children }: {
26
+ /**
27
+ * The surface the strip sets its items on: sunk below the page (`subtle`), flat on the page colour (`normal`), or
28
+ * raised and edged by a border (`strong`); none if omitted, whatever the look of the area around the strip.
29
+ */
30
+ look?: "subtle" | "normal" | "strong";
31
+ /**
32
+ * Whether the strip takes the room its container leaves along the main axis, rather than the size of its items.
33
+ */
34
+ grow?: boolean;
35
+ /**
36
+ * Whether items that do not fit on one line flow onto further rows, rather than overflowing the strip: `true` sets
37
+ * the rows apart by `space`, a step of the spacing ladder sets them apart by that step instead.
38
+ */
39
+ wrap?: boolean | Spacing;
40
+ /**
41
+ * Where the items sit along the row, when the strip is wider than they are: at the `start`, in the `center`, at
42
+ * the `end`, `spread` from edge to edge, the leftover room shared out between them, or split with the first item
43
+ * alone at the start and the others at the end (`head`), or the last item alone at the end and the others at the
44
+ * start (`tail`); at the start if omitted, packed against the leading edge as plain document flow leaves them.
45
+ */
46
+ place?: "start" | "center" | "end" | "spread" | "head" | "tail";
47
+ /**
48
+ * Where each item sits across the row: against the `start` edge, in the `center`, against the `end` edge, on the
49
+ * text `baseline` shared with the other items, or `stretch`ed to the row height; at the `start` if omitted.
50
+ */
51
+ align?: "start" | "center" | "end" | "baseline" | "stretch";
52
+ /**
53
+ * The step of the spacing ladder setting each item apart from the next; the items touch where left out.
54
+ */
55
+ space?: Spacing;
56
+ /**
57
+ * What the strip holds, each child an item of the row.
58
+ */
59
+ children?: ComponentChildren;
60
+ }): import("preact").VNode<{
61
+ look: "subtle" | "normal" | "strong" | undefined;
62
+ place: "head" | "start" | "end" | "center" | "spread" | "tail";
63
+ style: {
64
+ flexGrow: number | undefined;
65
+ flexWrap: string | undefined;
66
+ justifyContent: string | undefined;
67
+ alignItems: "start" | "end" | "center" | "stretch" | "baseline";
68
+ columnGap: import("@grafctory/core").Optional<string>;
69
+ rowGap: import("@grafctory/core").Optional<string>;
70
+ };
71
+ }>;
72
+ //# sourceMappingURL=strip.d.ts.map