answerui-py 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,358 @@
1
+ :root {
2
+ --prose-scale: 0.75;
3
+ --prose-font-scale: 1;
4
+ --divider-icon-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22none%22%20stroke%3D%22%23e6e6e6%22%20stroke-width%3D%222%22%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%227%22%20%2F%3E%0A%3C%2Fsvg%3E%0A);
5
+ --divider-invert-icon-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22none%22%20stroke%3D%22%23364153%22%20stroke-width%3D%222%22%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%227%22%20%2F%3E%0A%3C%2Fsvg%3E%0A);
6
+ }
7
+
8
+ .prose {
9
+ /* Spacing unit */
10
+ --sp: calc(var(--prose-scale) * 1em);
11
+
12
+ /* Default colors (gray) */
13
+ --prose-body: var(--color-gray-700, oklch(37.3% 0.034 259.733));
14
+ --prose-headings: var(--color-gray-900, oklch(21% 0.034 264.665));
15
+ --prose-lead: var(--color-gray-600, oklch(44.6% 0.03 256.802));
16
+ --prose-links: var(--color-gray-900, oklch(21% 0.034 264.665));
17
+ --prose-bold: var(--color-gray-900, oklch(21% 0.034 264.665));
18
+ --prose-counters: var(--color-gray-500, oklch(55.1% 0.027 264.364));
19
+ --prose-bullets: var(--color-gray-300, oklch(87.2% 0.01 258.338));
20
+ --prose-hr: var(--color-gray-200, oklch(92.8% 0.006 264.531));
21
+ --prose-quotes: var(--color-gray-900, oklch(21% 0.034 264.665));
22
+ --prose-quote-borders: var(--color-gray-200, oklch(92.8% 0.006 264.531));
23
+ --prose-captions: var(--color-gray-500, oklch(55.1% 0.027 264.364));
24
+ --prose-code: var(--color-gray-900, oklch(21% 0.034 264.665));
25
+ --prose-pre-code: var(--color-gray-200, oklch(92.8% 0.006 264.531));
26
+ --prose-pre-bg: var(--color-gray-800, oklch(27.8% 0.033 256.848));
27
+ --prose-th-borders: var(--color-gray-300, oklch(87.2% 0.01 258.338));
28
+ --prose-td-borders: var(--color-gray-200, oklch(92.8% 0.006 264.531));
29
+
30
+ /* Invert colors (for dark mode) */
31
+ --prose-invert-body: var(--color-gray-300, oklch(87.2% 0.01 258.338));
32
+ --prose-invert-headings: white;
33
+ --prose-invert-lead: var(--color-gray-400, oklch(70.7% 0.022 261.325));
34
+ --prose-invert-links: white;
35
+ --prose-invert-bold: white;
36
+ --prose-invert-counters: var(--color-gray-400, oklch(70.7% 0.022 261.325));
37
+ --prose-invert-bullets: var(--color-gray-600, oklch(44.6% 0.03 256.802));
38
+ --prose-invert-hr: var(--color-gray-700, oklch(37.3% 0.034 259.733));
39
+ --prose-invert-quotes: var(--color-gray-100, oklch(96.7% 0.003 264.542));
40
+ --prose-invert-quote-borders: var(--color-gray-700, oklch(37.3% 0.034 259.733));
41
+ --prose-invert-captions: var(--color-gray-400, oklch(70.7% 0.022 261.325));
42
+ --prose-invert-code: white;
43
+ --prose-invert-pre-code: var(--color-gray-300, oklch(87.2% 0.01 258.338));
44
+ --prose-invert-pre-bg: rgb(0 0 0 / 50%);
45
+ --prose-invert-th-borders: var(--color-gray-600, oklch(44.6% 0.03 256.802));
46
+ --prose-invert-td-borders: var(--color-gray-700, oklch(37.3% 0.034 259.733));
47
+
48
+ /* Base styles */
49
+ font-size: calc(var(--prose-font-scale) * 1rem);
50
+ line-height: 1.3;
51
+ color: var(--prose-body);
52
+
53
+ /* Block spacing */
54
+ p, ol, ul, dl { margin: var(--sp) 0 0; }
55
+ dt { margin-top: var(--sp); color: var(--prose-headings); font-weight: 600; }
56
+ dd { margin-top: calc(var(--sp) * 0.25); padding-inline-start: 1.375em; }
57
+ li { margin: calc(var(--sp) * 0.25) 0 0; }
58
+ ol > li, ul > li { padding-inline-start: 0.375em; }
59
+ ol, ul { padding-inline-start: 1.7em; }
60
+ ol { list-style-type: decimal; }
61
+ ul { list-style-type: disc; }
62
+ ol[type="A"], ol[type="A" s] { list-style-type: upper-alpha; }
63
+ ol[type="a"], ol[type="a" s] { list-style-type: lower-alpha; }
64
+ ol[type="I"], ol[type="I" s] { list-style-type: upper-roman; }
65
+ ol[type="i"], ol[type="i" s] { list-style-type: lower-roman; }
66
+ ol[type="1"] { list-style-type: decimal; }
67
+ ul ul, ul ol, ol ul, ol ol { margin: 0; }
68
+ > ul > li p { margin: calc(var(--sp) * 0.5) 0 0; }
69
+ > ul > li > p:first-child, > ol > li > p:first-child { margin-top: calc(var(--sp) * 0.75); }
70
+ ol > li::marker { font-weight: 400; color: var(--prose-counters); }
71
+ ul > li::marker { color: var(--prose-bullets); }
72
+ p + ul, p + ol { margin-top: calc(var(--sp) * 0.25); }
73
+
74
+ /* Headings */
75
+ h1, h2, h3, h4 { color: var(--prose-headings); }
76
+ h1 {
77
+ font-size: 2.25em; font-weight: 800; line-height: 1.1;
78
+ margin: calc(var(--sp) * 1.4) 0 0;
79
+ }
80
+ h2 {
81
+ font-size: 1.5em; font-weight: 700; line-height: 1.3;
82
+ margin: calc(var(--sp) * 1.4) 0 0;
83
+ }
84
+ h3 {
85
+ font-size: 1.25em; font-weight: 600; line-height: 1.4;
86
+ margin: calc(var(--sp) * 1.2) 0 0;
87
+ }
88
+ h4 {
89
+ font-size: 1em; font-weight: 600; line-height: 1.4;
90
+ margin: calc(var(--sp) * 1.25) 0 0;
91
+ }
92
+ h1 strong { font-weight: 900; color: inherit; }
93
+ h2 strong { font-weight: 800; color: inherit; }
94
+ h3 strong, h4 strong { font-weight: 700; color: inherit; }
95
+
96
+ /* Lead */
97
+ [class~="lead"] {
98
+ font-size: 1.25em; line-height: 1.6; color: var(--prose-lead);
99
+ margin: var(--sp) 0 0;
100
+ }
101
+
102
+ /* Links */
103
+ a { color: var(--prose-links); text-decoration: underline; font-weight: 500; }
104
+ a strong, a code { color: inherit; }
105
+
106
+ /* Strong */
107
+ strong { color: var(--prose-bold); font-weight: 600; }
108
+
109
+ /* Media */
110
+ img, picture, video, figure { margin: calc(var(--sp) * 1.5) 0 0; }
111
+ picture { display: block; }
112
+ figcaption {
113
+ font-size: 0.875em; line-height: 1.4; color: var(--prose-captions);
114
+ margin-top: calc(var(--sp) * 0.5);
115
+ }
116
+
117
+ /* Blockquote */
118
+ blockquote {
119
+ font-style: italic; font-weight: 500; color: var(--prose-quotes);
120
+ margin: calc(var(--sp) * 1.5) 0 0; padding-inline-start: 1em;
121
+ border-inline-start: 0.25rem solid var(--prose-quote-borders);
122
+ quotes: "\201C" "\201D" "\2018" "\2019";
123
+ }
124
+ blockquote strong, blockquote code { color: inherit; }
125
+
126
+ /* Code */
127
+ *:not(pre) > code { font-size: 0.875em; font-weight: 600; color: var(--prose-code); }
128
+ h1 code, h2 code, h3 code, h4 code, blockquote code, thead th code { color: inherit; }
129
+
130
+ /* Kbd */
131
+ kbd {
132
+ font-size: 0.875em; font-weight: 500; font-family: inherit;
133
+ color: var(--prose-code);
134
+ padding: 0.125em 0.3125em;
135
+ border-radius: 0.3125rem;
136
+ box-shadow: 0 0 0 1px rgb(0 0 0 / 10%), 0 3px 0 rgb(0 0 0 / 10%);
137
+ }
138
+
139
+ /* Table */
140
+ table {
141
+ display: block; width: fit-content; max-width: calc(100% + 1em);
142
+ overflow-x: auto; border-collapse: collapse;
143
+ font-size: 0.875em; line-height: 1.5; margin: calc(var(--sp) * 2) -0.5em 0;
144
+ }
145
+ caption { width: max-content; max-width: 100%; padding: 0 0.5em; }
146
+
147
+ th, td { overflow-wrap: break-word; }
148
+ th:not([align]), td:not([align]) { text-align: start; }
149
+ thead { border-bottom: 1px solid var(--prose-th-borders); }
150
+ thead th {
151
+ color: var(--prose-headings); font-weight: 600; vertical-align: bottom;
152
+ padding: 0 0.5em calc(var(--sp) * 0.5);
153
+ }
154
+ thead th strong, thead th code { color: inherit; }
155
+ tbody tr { border-bottom: 1px solid var(--prose-td-borders); }
156
+ tbody tr:last-child { border-bottom: 0; }
157
+ tbody td { vertical-align: baseline; padding: calc(var(--sp) * 0.5) 0.5em; }
158
+ tfoot { border-top: 1px solid var(--prose-th-borders); }
159
+ tfoot td { vertical-align: top; padding: calc(var(--sp) * 0.5) 0.5em; }
160
+
161
+ hr {
162
+ border: none; margin-top: var(--sp);
163
+ position: relative; height: 1.25rem;
164
+ background-image: var(--divider-icon-image);
165
+ background-repeat: no-repeat; background-position: 50% 50%;
166
+ }
167
+ hr::before, hr::after {
168
+ content: ""; position: absolute; top: 50%;
169
+ max-width: calc(50% - (3rem / 2));
170
+ border-bottom: 1px solid var(--prose-hr);
171
+ }
172
+ hr::before {
173
+ right: calc(50% + (3rem / 2)); width: 100%;
174
+ }
175
+ hr::after {
176
+ left: calc(50% + (3rem / 2)); width: 100%;
177
+ }
178
+
179
+
180
+ /* Shared reset rules */
181
+ h1 + * { margin-top: calc(var(--sp) * 1.5); }
182
+ h2 + * { margin-top: var(--sp); }
183
+ h3 + *, h4 + * { margin-top: calc(var(--sp) * 0.5); }
184
+ picture > img, figure > * { margin-top: 0; margin-bottom: 0; }
185
+ > :first-child { margin-top: 0; }
186
+ > :last-child { margin-bottom: 0; }
187
+ }
188
+
189
+ /* Size variants */
190
+ .prose-sm { --prose-scale: 0.7; --prose-font-scale: 0.875; }
191
+ .prose-lg { --prose-scale: 0.8; --prose-font-scale: 1.125; }
192
+ .prose-xl { --prose-scale: 0.9; --prose-font-scale: 1.25; }
193
+ .prose-2xl { --prose-scale: 1.1; --prose-font-scale: 1.5; }
194
+
195
+ /* Color themes - slate */
196
+ .prose-slate {
197
+ --prose-body: var(--color-slate-700, oklch(37.2% 0.044 257.287));
198
+ --prose-headings: var(--color-slate-900, oklch(20.8% 0.042 265.755));
199
+ --prose-lead: var(--color-slate-600, oklch(44.6% 0.043 257.281));
200
+ --prose-links: var(--color-slate-900, oklch(20.8% 0.042 265.755));
201
+ --prose-bold: var(--color-slate-900, oklch(20.8% 0.042 265.755));
202
+ --prose-counters: var(--color-slate-500, oklch(55.4% 0.046 257.417));
203
+ --prose-bullets: var(--color-slate-300, oklch(86.9% 0.022 252.894));
204
+ --prose-hr: var(--color-slate-200, oklch(92.9% 0.013 255.508));
205
+ --prose-quotes: var(--color-slate-900, oklch(20.8% 0.042 265.755));
206
+ --prose-quote-borders: var(--color-slate-200, oklch(92.9% 0.013 255.508));
207
+ --prose-captions: var(--color-slate-500, oklch(55.4% 0.046 257.417));
208
+ --prose-code: var(--color-slate-900, oklch(20.8% 0.042 265.755));
209
+ --prose-pre-code: var(--color-slate-200, oklch(92.9% 0.013 255.508));
210
+ --prose-pre-bg: var(--color-slate-800, oklch(27.9% 0.041 260.031));
211
+ --prose-th-borders: var(--color-slate-300, oklch(86.9% 0.022 252.894));
212
+ --prose-td-borders: var(--color-slate-200, oklch(92.9% 0.013 255.508));
213
+ --prose-invert-body: var(--color-slate-300, oklch(86.9% 0.022 252.894));
214
+ --prose-invert-headings: white;
215
+ --prose-invert-lead: var(--color-slate-400, oklch(70.4% 0.04 256.788));
216
+ --prose-invert-links: white;
217
+ --prose-invert-bold: white;
218
+ --prose-invert-counters: var(--color-slate-400, oklch(70.4% 0.04 256.788));
219
+ --prose-invert-bullets: var(--color-slate-600, oklch(44.6% 0.043 257.281));
220
+ --prose-invert-hr: var(--color-slate-700, oklch(37.2% 0.044 257.287));
221
+ --prose-invert-quotes: var(--color-slate-100, oklch(96.8% 0.007 247.896));
222
+ --prose-invert-quote-borders: var(--color-slate-700, oklch(37.2% 0.044 257.287));
223
+ --prose-invert-captions: var(--color-slate-400, oklch(70.4% 0.04 256.788));
224
+ --prose-invert-code: white;
225
+ --prose-invert-pre-code: var(--color-slate-300, oklch(86.9% 0.022 252.894));
226
+ --prose-invert-pre-bg: rgb(0 0 0 / 50%);
227
+ --prose-invert-th-borders: var(--color-slate-600, oklch(44.6% 0.043 257.281));
228
+ --prose-invert-td-borders: var(--color-slate-700, oklch(37.2% 0.044 257.287));
229
+ }
230
+
231
+ /* Color themes - zinc */
232
+ .prose-zinc {
233
+ --prose-body: var(--color-zinc-700, oklch(37% 0.013 285.805));
234
+ --prose-headings: var(--color-zinc-900, oklch(21% 0.006 285.885));
235
+ --prose-lead: var(--color-zinc-600, oklch(44.2% 0.017 285.786));
236
+ --prose-links: var(--color-zinc-900, oklch(21% 0.006 285.885));
237
+ --prose-bold: var(--color-zinc-900, oklch(21% 0.006 285.885));
238
+ --prose-counters: var(--color-zinc-500, oklch(55.2% 0.016 285.938));
239
+ --prose-bullets: var(--color-zinc-300, oklch(87.1% 0.006 286.286));
240
+ --prose-hr: var(--color-zinc-200, oklch(92% 0.004 286.32));
241
+ --prose-quotes: var(--color-zinc-900, oklch(21% 0.006 285.885));
242
+ --prose-quote-borders: var(--color-zinc-200, oklch(92% 0.004 286.32));
243
+ --prose-captions: var(--color-zinc-500, oklch(55.2% 0.016 285.938));
244
+ --prose-code: var(--color-zinc-900, oklch(21% 0.006 285.885));
245
+ --prose-pre-code: var(--color-zinc-200, oklch(92% 0.004 286.32));
246
+ --prose-pre-bg: var(--color-zinc-800, oklch(27.4% 0.006 286.033));
247
+ --prose-th-borders: var(--color-zinc-300, oklch(87.1% 0.006 286.286));
248
+ --prose-td-borders: var(--color-zinc-200, oklch(92% 0.004 286.32));
249
+ --prose-invert-body: var(--color-zinc-300, oklch(87.1% 0.006 286.286));
250
+ --prose-invert-headings: white;
251
+ --prose-invert-lead: var(--color-zinc-400, oklch(70.5% 0.015 286.067));
252
+ --prose-invert-links: white;
253
+ --prose-invert-bold: white;
254
+ --prose-invert-counters: var(--color-zinc-400, oklch(70.5% 0.015 286.067));
255
+ --prose-invert-bullets: var(--color-zinc-600, oklch(44.2% 0.017 285.786));
256
+ --prose-invert-hr: var(--color-zinc-700, oklch(37% 0.013 285.805));
257
+ --prose-invert-quotes: var(--color-zinc-100, oklch(96.7% 0.001 286.375));
258
+ --prose-invert-quote-borders: var(--color-zinc-700, oklch(37% 0.013 285.805));
259
+ --prose-invert-captions: var(--color-zinc-400, oklch(70.5% 0.015 286.067));
260
+ --prose-invert-code: white;
261
+ --prose-invert-pre-code: var(--color-zinc-300, oklch(87.1% 0.006 286.286));
262
+ --prose-invert-pre-bg: rgb(0 0 0 / 50%);
263
+ --prose-invert-th-borders: var(--color-zinc-600, oklch(44.2% 0.017 285.786));
264
+ --prose-invert-td-borders: var(--color-zinc-700, oklch(37% 0.013 285.805));
265
+ }
266
+
267
+ /* Color themes - neutral */
268
+ .prose-neutral {
269
+ --prose-body: var(--color-neutral-700, oklch(37.1% 0 0));
270
+ --prose-headings: var(--color-neutral-900, oklch(20.5% 0 0));
271
+ --prose-lead: var(--color-neutral-600, oklch(43.9% 0 0));
272
+ --prose-links: var(--color-neutral-900, oklch(20.5% 0 0));
273
+ --prose-bold: var(--color-neutral-900, oklch(20.5% 0 0));
274
+ --prose-counters: var(--color-neutral-500, oklch(55.6% 0 0));
275
+ --prose-bullets: var(--color-neutral-300, oklch(87% 0 0));
276
+ --prose-hr: var(--color-neutral-200, oklch(92.2% 0 0));
277
+ --prose-quotes: var(--color-neutral-900, oklch(20.5% 0 0));
278
+ --prose-quote-borders: var(--color-neutral-200, oklch(92.2% 0 0));
279
+ --prose-captions: var(--color-neutral-500, oklch(55.6% 0 0));
280
+ --prose-code: var(--color-neutral-900, oklch(20.5% 0 0));
281
+ --prose-pre-code: var(--color-neutral-200, oklch(92.2% 0 0));
282
+ --prose-pre-bg: var(--color-neutral-800, oklch(26.9% 0 0));
283
+ --prose-th-borders: var(--color-neutral-300, oklch(87% 0 0));
284
+ --prose-td-borders: var(--color-neutral-200, oklch(92.2% 0 0));
285
+ --prose-invert-body: var(--color-neutral-300, oklch(87% 0 0));
286
+ --prose-invert-headings: white;
287
+ --prose-invert-lead: var(--color-neutral-400, oklch(70.8% 0 0));
288
+ --prose-invert-links: white;
289
+ --prose-invert-bold: white;
290
+ --prose-invert-counters: var(--color-neutral-400, oklch(70.8% 0 0));
291
+ --prose-invert-bullets: var(--color-neutral-600, oklch(43.9% 0 0));
292
+ --prose-invert-hr: var(--color-neutral-700, oklch(37.1% 0 0));
293
+ --prose-invert-quotes: var(--color-neutral-100, oklch(97% 0 0));
294
+ --prose-invert-quote-borders: var(--color-neutral-700, oklch(37.1% 0 0));
295
+ --prose-invert-captions: var(--color-neutral-400, oklch(70.8% 0 0));
296
+ --prose-invert-code: white;
297
+ --prose-invert-pre-code: var(--color-neutral-300, oklch(87% 0 0));
298
+ --prose-invert-pre-bg: rgb(0 0 0 / 50%);
299
+ --prose-invert-th-borders: var(--color-neutral-600, oklch(43.9% 0 0));
300
+ --prose-invert-td-borders: var(--color-neutral-700, oklch(37.1% 0 0));
301
+ }
302
+
303
+ /* Color themes - stone */
304
+ .prose-stone {
305
+ --prose-body: var(--color-stone-700, oklch(37.4% 0.01 67.558));
306
+ --prose-headings: var(--color-stone-900, oklch(21.6% 0.006 56.043));
307
+ --prose-lead: var(--color-stone-600, oklch(44.4% 0.011 73.639));
308
+ --prose-links: var(--color-stone-900, oklch(21.6% 0.006 56.043));
309
+ --prose-bold: var(--color-stone-900, oklch(21.6% 0.006 56.043));
310
+ --prose-counters: var(--color-stone-500, oklch(55.3% 0.013 58.071));
311
+ --prose-bullets: var(--color-stone-300, oklch(86.9% 0.005 56.366));
312
+ --prose-hr: var(--color-stone-200, oklch(92.3% 0.003 48.717));
313
+ --prose-quotes: var(--color-stone-900, oklch(21.6% 0.006 56.043));
314
+ --prose-quote-borders: var(--color-stone-200, oklch(92.3% 0.003 48.717));
315
+ --prose-captions: var(--color-stone-500, oklch(55.3% 0.013 58.071));
316
+ --prose-code: var(--color-stone-900, oklch(21.6% 0.006 56.043));
317
+ --prose-pre-code: var(--color-stone-200, oklch(92.3% 0.003 48.717));
318
+ --prose-pre-bg: var(--color-stone-800, oklch(26.8% 0.007 34.298));
319
+ --prose-th-borders: var(--color-stone-300, oklch(86.9% 0.005 56.366));
320
+ --prose-td-borders: var(--color-stone-200, oklch(92.3% 0.003 48.717));
321
+ --prose-invert-body: var(--color-stone-300, oklch(86.9% 0.005 56.366));
322
+ --prose-invert-headings: white;
323
+ --prose-invert-lead: var(--color-stone-400, oklch(70.9% 0.01 56.259));
324
+ --prose-invert-links: white;
325
+ --prose-invert-bold: white;
326
+ --prose-invert-counters: var(--color-stone-400, oklch(70.9% 0.01 56.259));
327
+ --prose-invert-bullets: var(--color-stone-600, oklch(44.4% 0.011 73.639));
328
+ --prose-invert-hr: var(--color-stone-700, oklch(37.4% 0.01 67.558));
329
+ --prose-invert-quotes: var(--color-stone-100, oklch(97% 0.001 106.424));
330
+ --prose-invert-quote-borders: var(--color-stone-700, oklch(37.4% 0.01 67.558));
331
+ --prose-invert-captions: var(--color-stone-400, oklch(70.9% 0.01 56.259));
332
+ --prose-invert-code: white;
333
+ --prose-invert-pre-code: var(--color-stone-300, oklch(86.9% 0.005 56.366));
334
+ --prose-invert-pre-bg: rgb(0 0 0 / 50%);
335
+ --prose-invert-th-borders: var(--color-stone-600, oklch(44.4% 0.011 73.639));
336
+ --prose-invert-td-borders: var(--color-stone-700, oklch(37.4% 0.01 67.558));
337
+ }
338
+
339
+ /* Dark mode (invert) */
340
+ .prose-invert {
341
+ --prose-body: var(--prose-invert-body);
342
+ --prose-headings: var(--prose-invert-headings);
343
+ --prose-lead: var(--prose-invert-lead);
344
+ --prose-links: var(--prose-invert-links);
345
+ --prose-bold: var(--prose-invert-bold);
346
+ --prose-counters: var(--prose-invert-counters);
347
+ --prose-bullets: var(--prose-invert-bullets);
348
+ --prose-hr: var(--prose-invert-hr);
349
+ --prose-quotes: var(--prose-invert-quotes);
350
+ --prose-quote-borders: var(--prose-invert-quote-borders);
351
+ --prose-captions: var(--prose-invert-captions);
352
+ --prose-code: var(--prose-invert-code);
353
+ --prose-pre-code: var(--prose-invert-pre-code);
354
+ --prose-pre-bg: var(--prose-invert-pre-bg);
355
+ --prose-th-borders: var(--prose-invert-th-borders);
356
+ --prose-td-borders: var(--prose-invert-td-borders);
357
+ --divider-icon-image: var(--divider-invert-icon-image);
358
+ }
answerui/data.py ADDED
@@ -0,0 +1,43 @@
1
+ """Tables and other displays of structured data
2
+
3
+ A table is a native `table`, styled plainly by the base layer, and the browser already gives it its structure: a caption, a head, a body, and a foot. This module adds `DataTable`, a table of figures on a raised surface that scrolls sideways when the table is wider than the page, with a head band and single-line cells.
4
+
5
+ Docs: https://AnswerDotAI.github.io/answerui/data.html.md"""
6
+
7
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/13_data.ipynb.
8
+
9
+ # %% auto #0
10
+ __all__ = ['DataTable']
11
+
12
+ # %% ../nbs/13_data.ipynb #1a63437d
13
+ from fasthtml.common import Div, Table, Caption, Thead, Tbody, Tfoot, Tr, Th, Td
14
+ from .registry import hypelt
15
+ from .demo import example
16
+ import answerui.base # the base layer the data table extends
17
+
18
+ # %% ../nbs/13_data.ipynb #ac5f7b09
19
+ _datatable_css = r'''
20
+ [datatable] {
21
+ --face: var(--n-3); background: var(--face); overflow-x: auto; contain: inline-size;
22
+ border: 1px solid var(--n-1); border-radius: var(--radius); box-shadow: var(--raised);
23
+ > table { inline-size: 100%; }
24
+ :is(th, td) { white-space: nowrap; }
25
+ tbody tr:first-child > * { border-block-start: 1px solid var(--n-1); }
26
+ thead th { background: var(--n-2); color: var(--n1); font: var(--weight) var(--text-1) var(--font-mono); text-transform: uppercase; letter-spacing: .08em; border-block-end: 0; }
27
+ }
28
+ '''
29
+
30
+ @hypelt(sel='[datatable]', layer='components', css=_datatable_css)
31
+ def DataTable(*c, **attrs):
32
+ "A table of data on a bordered surface that scrolls sideways when the table is wider than the page; attributes go on the surface"
33
+ return Div(Table(*c), datatable=True, **attrs)
34
+
35
+
36
+ # %% ../nbs/13_data.ipynb #cf26ac6f
37
+ @example(DataTable)
38
+ def _datatable_example():
39
+ rows = [('North', '1,204', '38,410', '31.90'), ('South', '862', '27,955', '32.43'), ('West', '1,531', '50,112', '32.73')]
40
+ def row(nm, *figs): return Tr(Td(nm), *[Td(f, num=True) for f in figs])
41
+ head = Thead(Tr(Th('Region'), Th('Orders', num=True), Th('Revenue', num=True), Th('Average', num=True)))
42
+ foot = Tfoot(Tr(Th('Total'), Td('3,597', num=True), Td('116,477', num=True), Td('32.38', num=True)))
43
+ return DataTable(Caption('Revenue and average order in US$, Q3'), head, Tbody(*[row(*r) for r in rows]), foot)
answerui/demo.py ADDED
@@ -0,0 +1,98 @@
1
+ """Isolated rendering of markup with current styles and behaviors, for notebooks and docs
2
+
3
+ The registry holds styles and behaviors, and the behavior runtime turns them into JavaScript. To develop a component, we need to see the result and try its interactions. `demo` renders ordinary FastHTML markup in an isolated document with the current assets. The same preview is used both during notebook authoring and when viewing generated docs.
4
+
5
+ Docs: https://AnswerDotAI.github.io/answerui/demo.html.md"""
6
+
7
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/02_demo.ipynb.
8
+
9
+ # %% auto #0
10
+ __all__ = ['demo_html', 'Preview', 'demo', 'example']
11
+
12
+ # %% ../nbs/02_demo.ipynb #6ae7b22e
13
+ from fastcore.utils import *
14
+ from fastcore.meta import delegates
15
+ from fasthtml.common import to_xml, Div, Iframe, Button, Html, Head, Body, Style, Script, FT
16
+ from fastcore.xml import highlight
17
+ from fasthtml.core import def_hdrs
18
+ from .registry import reg, Hyperelement
19
+ import answerui.behaviors # installs Registry.build_js
20
+ from fastlucide.icons import spritesheet
21
+
22
+ # %% ../nbs/02_demo.ipynb #351e46af
23
+ _verbs = dict(get='hx-get', post='hx-post', put='hx-put', delete='hx-delete', patch='hx-patch', link='href')
24
+ def _as_served(o):
25
+ "FastHTML's `get`, `post` and friends renamed to their htmx attributes, as a served page would render them"
26
+ if isinstance(o, (list, tuple)): return [_as_served(c) for c in o]
27
+ if not isinstance(o, FT): return o
28
+ for k,v in _verbs.items():
29
+ if k in o.attrs: o.attrs[v] = o.attrs.pop(k)
30
+ for c in o.children: _as_served(c)
31
+ return o
32
+
33
+ _routes_js = r'''const routes = %s;
34
+ document.addEventListener('htmx:beforeRequest', e => {
35
+ const r = e.detail.requestConfig, html = routes[`${r.verb.toUpperCase()} ${r.path}`];
36
+ if (html == null) return;
37
+ e.preventDefault();
38
+ const spec = (htmx.closest(e.detail.elt, '[hx-swap]')?.getAttribute('hx-swap') ?? 'innerHTML').split(' ')[0];
39
+ htmx.swap(e.detail.target, html, {swapStyle: spec});
40
+ });'''
41
+
42
+ # %% ../nbs/02_demo.ipynb #533a2e38
43
+ def demo_html(
44
+ *fts, # Markup to render
45
+ registry=reg, # Registry whose stylesheet and behavior script the document carries
46
+ css=None, # Stylesheet for the document; None uses the registry's build_css()
47
+ htmx4=False, # Use htmx 4 with FastHTML's config, as `fast_app(htmx4=True)` does, instead of htmx 2
48
+ routes=None, # Canned responses for the document's htmx requests, `{'GET path': markup}`, standing in for a server
49
+ ):
50
+ "A standalone document containing markup, CSS, behaviors, the sprite sheet, and FastHTML's default headers"
51
+ head = Head(*def_hdrs(htmx4=htmx4, surreal=False), Style(registry.build_css() if css is None else css), Script(registry.build_js()))
52
+ if routes: head = head(Script(_routes_js % dumps({k: to_xml(_as_served(v)) for k,v in routes.items()})))
53
+ return to_xml(Html(head, Body(*_as_served(fts), spritesheet, style='min-block-size: auto')))
54
+
55
+
56
+ # %% ../nbs/02_demo.ipynb #103de975
57
+ _sizer = Script(r"new ResizeObserver(() => frameElement.style.height = document.body.scrollHeight+24+'px').observe(document.body)")
58
+
59
+ class Preview:
60
+ "A rendered preview: the frame as HTML for the page, the markup as Markdown for the notebook file and the model"
61
+ def __init__(self, fts, frame): store_attr()
62
+ def __repr__(self): return to_xml(self.fts)
63
+ def _repr_mimebundle_(self, include=None, exclude=None): return {'text/html': to_xml(self.frame), 'text/markdown': highlight(self.fts)}, {'nbdev': {'strip': ['text/html']}}
64
+
65
+ def demo(
66
+ *fts, # Markup to render
67
+ registry=reg, # Registry whose stylesheet and behavior script the preview carries
68
+ css=None, # Stylesheet for the document; None uses the registry's build_css()
69
+ height=None, # Fixed iframe height, e.g. '10rem', for top-layer content the frame can't measure; None follows the content
70
+ width=None, # Fixed iframe width, e.g. '24rem', to preview a narrow viewport; None fills the cell
71
+ htmx4=False, # Use htmx 4 with FastHTML's config, as `fast_app(htmx4=True)` does, instead of htmx 2
72
+ routes=None, # Canned responses for the preview's htmx requests, `{'GET path': markup}`, standing in for a server
73
+ ):
74
+ "Render markup in an isolated, replayable notebook preview"
75
+ doc = fts if height is not None else fts + (_sizer,)
76
+ style = f'width:100%;box-sizing:border-box;border:1px solid #e3e3e8;border-radius:8px;height:{height or "auto"};'
77
+ frame = Iframe(srcdoc=demo_html(*doc, registry=registry, css=css, htmx4=htmx4, routes=routes), title='answerui preview', style=style)
78
+ replay = Button('↻', type='button', aria_label='replay', title='replay',
79
+ onclick=r"const f=this.parentElement.nextElementSibling; f.srcdoc=f.srcdoc",
80
+ style='border:0;background:none;font-size:14px;opacity:.6;cursor:pointer;padding:0 4px')
81
+ return Preview(fts, Div(Div(replay, style='text-align:right'), frame, answerui_preview=True, style=f'width:{width or "100%"}'))
82
+
83
+
84
+ # %% ../nbs/02_demo.ipynb #7008abc5
85
+ def example(h):
86
+ "Decorate a no-argument markup function as `h.example`, the markup `h.demo()` renders"
87
+ def _attach(f):
88
+ h.example = f
89
+ return f
90
+ return _attach
91
+
92
+ @patch
93
+ @delegates(demo, but=['registry'])
94
+ def demo(self:Hyperelement, **kwargs):
95
+ "Render this hyperelement's example with its registry's current styles and behaviors"
96
+ if not hasattr(self, 'example'): raise ValueError(f'{self.__name__} has no example; attach one with @example({self.__name__})')
97
+ return demo(self.example(), registry=self.registry, **kwargs)
98
+
@@ -0,0 +1,93 @@
1
+ Copyright 2019 IBM Corp. All rights reserved. IBMPlexSans-Italic[wdth,wght].ttf: Copyright 2019 IBM Corp. All rights reserved.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.