timvir 0.2.50 → 0.2.52
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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/blocks/Arbitrary/Arbitrary.d.ts +2 -2
- package/blocks/Arbitrary/docs/index.mdx +57 -10
- package/blocks/Arbitrary/index.d.ts +1 -1
- package/blocks/Arbitrary/index.js +16 -71
- package/blocks/Arbitrary/styles.css +11 -7
- package/blocks/Code/Code.d.ts +3 -3
- package/blocks/Code/docs/index.mdx +1 -1
- package/blocks/Code/index.d.ts +1 -1
- package/blocks/Code/index.js +2 -4
- package/blocks/Code/styles.css +8 -8
- package/blocks/ColorBar/ColorBar.d.ts +3 -3
- package/blocks/ColorBar/docs/index.mdx +1 -1
- package/blocks/ColorBar/index.d.ts +1 -1
- package/blocks/ColorBar/index.js +2 -4
- package/blocks/ColorBar/styles.css +6 -6
- package/blocks/ColorBook/ColorBook.d.ts +4 -4
- package/blocks/ColorBook/index.d.ts +1 -1
- package/blocks/ColorBook/index.js +3 -5
- package/blocks/ColorBook/styles.css +18 -18
- package/blocks/Cover/Cover.d.ts +4 -4
- package/blocks/Cover/index.d.ts +1 -1
- package/blocks/Cover/index.js +2 -5
- package/blocks/Cover/styles.css +6 -6
- package/blocks/Exhibit/Exhibit.d.ts +4 -4
- package/blocks/Exhibit/docs/index.mdx +11 -8
- package/blocks/Exhibit/index.d.ts +1 -1
- package/blocks/Exhibit/index.js +2 -5
- package/blocks/Exhibit/styles.css +7 -7
- package/blocks/Font/Font.d.ts +3 -3
- package/blocks/Font/index.d.ts +1 -1
- package/blocks/Font/index.js +2 -4
- package/blocks/Font/styles.css +7 -6
- package/blocks/Grid/Grid.d.ts +2 -2
- package/blocks/Grid/docs/index.mdx +1 -1
- package/blocks/Grid/index.d.ts +1 -1
- package/blocks/Grid/index.js +2 -4
- package/blocks/Grid/styles.css +6 -6
- package/blocks/Icon/Icon.d.ts +3 -3
- package/blocks/Icon/index.d.ts +1 -1
- package/blocks/Icon/index.js +2 -5
- package/blocks/Icon/internal/Canvas.d.ts +2 -2
- package/blocks/Icon/internal/index.d.ts +1 -1
- package/blocks/Icon/styles.css +1 -0
- package/blocks/Message/Message.d.ts +3 -3
- package/blocks/Message/docs/index.mdx +1 -1
- package/blocks/Message/index.d.ts +1 -1
- package/blocks/Message/index.js +2 -4
- package/blocks/Message/styles.css +6 -6
- package/blocks/Swatch/Swatch.d.ts +3 -3
- package/blocks/Swatch/docs/index.mdx +1 -2
- package/blocks/Swatch/index.d.ts +1 -1
- package/blocks/Swatch/index.js +2 -4
- package/blocks/Swatch/styles.css +6 -6
- package/blocks/Viewport/Viewport.d.ts +3 -3
- package/blocks/Viewport/docs/index.mdx +5 -8
- package/blocks/Viewport/index.d.ts +1 -1
- package/blocks/Viewport/index.js +6 -10
- package/blocks/Viewport/internal/Caption.d.ts +2 -4
- package/blocks/Viewport/internal/Handle.d.ts +3 -4
- package/blocks/Viewport/internal/Ruler.d.ts +2 -2
- package/blocks/Viewport/internal/index.d.ts +3 -3
- package/blocks/Viewport/styles.css +7 -7
- package/blocks/WebLink/WebLink.d.ts +3 -3
- package/blocks/WebLink/docs/index.mdx +3 -1
- package/blocks/WebLink/index.d.ts +1 -1
- package/blocks/WebLink/index.js +2 -4
- package/blocks/WebLink/styles.css +6 -6
- package/blocks/styles.css +95 -89
- package/builtins/index.js +1 -1
- package/builtins/styles.css +11 -11
- package/context/index.d.ts +1 -1
- package/context/index.js +1 -1
- package/core/components/Footer/Footer.d.ts +4 -4
- package/core/components/Page/Page.d.ts +2 -2
- package/core/index.js +13 -17
- package/core/styles.css +13 -14
- package/package.json +5 -5
- package/search/Search/Search.d.ts +4 -4
- package/search/index.js +2 -5
- package/styles.css +119 -114
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# timvir
|
|
2
2
|
|
|
3
|
+
## 0.2.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **Mark sub-path imports of dependencies as external** ([#3783](https://github.com/timvir/timvir/pull/3783)) - Due to a mistake in our Rollup config, we were inlining the `bytestring` package into our code. The `bytestring` package is declared as dependency and should be kept external. This change slightly decreases the bundle size of the `timvir/blocks/Arbitrary` module.
|
|
8
|
+
|
|
9
|
+
## 0.2.51
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- **Make React 19 required** ([#3732](https://github.com/timvir/timvir/pull/3732)) - Up until now we've supported React 17, 18, and 19. React 19 has introduced changes that make components simpler. The version has been out for over a year. This version makes React 19 a required peer dependency.
|
|
14
|
+
|
|
3
15
|
## 0.2.50
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tomáś Čarnecký
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -7,5 +7,5 @@ declare const Root = "div";
|
|
|
7
7
|
interface Props extends React.ComponentPropsWithRef<typeof Root> {
|
|
8
8
|
ExhibitProps?: React.ComponentPropsWithRef<typeof Exhibit>;
|
|
9
9
|
}
|
|
10
|
-
declare
|
|
11
|
-
export
|
|
10
|
+
export declare function Arbitrary(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -3,22 +3,31 @@ import { Exhibit } from "timvir/blocks";
|
|
|
3
3
|
|
|
4
4
|
# Arbitrary
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
in an input field where users can copy it from.
|
|
8
|
-
|
|
9
|
-
The component renders its children in an `<Exhibit>`. The children can make use of the seed in the
|
|
10
|
-
React context to render themselves in a predictable way.
|
|
6
|
+
> Renders children with a controllable random seed exposed via React context.
|
|
11
7
|
|
|
12
8
|
<Sample variant="basic" />
|
|
13
9
|
|
|
10
|
+
Use `<Arbitrary>` when you want to feed randomly generated props into a component.
|
|
11
|
+
This is particularly useful for exploring edge cases or stress-testing a component's appearance without hand-authoring every combination.
|
|
12
|
+
The block exposes a numeric seed via React context, so children can produce a stable, reproducible set of inputs for any given seed value.
|
|
13
|
+
|
|
14
|
+
Libraries like [fast-check](https://fast-check.dev) provide composable random value generators.
|
|
15
|
+
They provide generators for all basic types such as strings, numbers, arrays, and objects.
|
|
16
|
+
You can combine those builtin generators to produce random values for your own types.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
The seed is displayed in an input field where users can copy it or set a specific value.
|
|
21
|
+
Children can consume it to render themselves in a predictable, reproducible way.
|
|
22
|
+
|
|
14
23
|
## Usage
|
|
15
24
|
|
|
16
25
|
Given a component-under-test:
|
|
17
26
|
|
|
18
27
|
```jsx
|
|
19
|
-
import { useContext } from "timvir/blocks/Arbitrary"
|
|
28
|
+
import { useContext } from "timvir/blocks/Arbitrary";
|
|
20
29
|
|
|
21
|
-
function
|
|
30
|
+
function Sample() {
|
|
22
31
|
const { seed } = useContext();
|
|
23
32
|
return <div>{seed}</div>;
|
|
24
33
|
}
|
|
@@ -26,11 +35,49 @@ function Component() {
|
|
|
26
35
|
|
|
27
36
|
We can take it and display it inside an `<Arbitrary>` in a timvir doc page:
|
|
28
37
|
|
|
29
|
-
```
|
|
30
|
-
import { Arbitrary } from "timvir/blocks"
|
|
31
|
-
import { Component } from "
|
|
38
|
+
```tsx
|
|
39
|
+
import { Arbitrary } from "timvir/blocks";
|
|
40
|
+
import { Component } from "../Component";
|
|
32
41
|
|
|
33
42
|
<Arbitrary>
|
|
34
43
|
<Component />
|
|
35
44
|
</Arbitrary>
|
|
36
45
|
```
|
|
46
|
+
|
|
47
|
+
## fast-check
|
|
48
|
+
|
|
49
|
+
Let's assume you have a component that takes this Props shape.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
interface Props {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
label: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function Component(props: Props) {
|
|
58
|
+
// React component implementation
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
First define a generator that produces values of that type.
|
|
63
|
+
Then use the seed from the Arbitrary context to generate props for your component.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import fc from "fast-check";
|
|
67
|
+
import { useContext } from "timvir/blocks/Arbitrary";
|
|
68
|
+
import { Component } from "../Component";
|
|
69
|
+
|
|
70
|
+
const arbProps = fc.object({
|
|
71
|
+
enabled: fc.boolean(),
|
|
72
|
+
label: fc.string(),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function Sample() {
|
|
76
|
+
const { seed } = useContext();
|
|
77
|
+
|
|
78
|
+
const engine = new fc.Random(fc.xoroshiro128plus(seed));
|
|
79
|
+
const props = arbProps.generate(engine, undefined);
|
|
80
|
+
|
|
81
|
+
return <Component {...props} />;
|
|
82
|
+
}
|
|
83
|
+
```
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Arbitrary } from "./Arbitrary";
|
|
2
2
|
export { useContext } from "./context";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import * as base58 from 'bytestring/base58';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { Exhibit } from 'timvir/blocks';
|
|
4
5
|
import { useBlock } from 'timvir/core';
|
|
@@ -166,62 +167,6 @@ function props(...styles) {
|
|
|
166
167
|
return result;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
const bytesToHex = (() => {
|
|
170
|
-
const s = Array.from({
|
|
171
|
-
length: 256
|
|
172
|
-
}).map((_, i) => i.toString(16).padStart(2, "0"));
|
|
173
|
-
return uint8a => [...uint8a].map(o => s[o]).join("");
|
|
174
|
-
})();
|
|
175
|
-
const alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
176
|
-
function encode(input) {
|
|
177
|
-
if (input.length === 0) {
|
|
178
|
-
return "";
|
|
179
|
-
}
|
|
180
|
-
// Uint8Array -> BigInt (Big Endian)
|
|
181
|
-
let x = BigInt("0x" + bytesToHex(input));
|
|
182
|
-
const output = [];
|
|
183
|
-
while (x > 0n) {
|
|
184
|
-
const mod = x % 58n;
|
|
185
|
-
x = x / 58n;
|
|
186
|
-
output.push(alphabet[Number(mod)]);
|
|
187
|
-
}
|
|
188
|
-
for (let i = 0; input[i] === 0; i++) {
|
|
189
|
-
output.push(alphabet[0]);
|
|
190
|
-
}
|
|
191
|
-
return output.reverse().join("");
|
|
192
|
-
}
|
|
193
|
-
function decode(output) {
|
|
194
|
-
if (output.length === 0) {
|
|
195
|
-
return new Uint8Array();
|
|
196
|
-
}
|
|
197
|
-
const bytes = [0];
|
|
198
|
-
const letters = alphabet;
|
|
199
|
-
for (const char of output) {
|
|
200
|
-
const value = letters.indexOf(char);
|
|
201
|
-
if (value === undefined) {
|
|
202
|
-
throw new Error(`base58.decode received invalid input. Character '${char}' is not in the base58 alphabet.`);
|
|
203
|
-
}
|
|
204
|
-
for (let j = 0; j < bytes.length; j++) {
|
|
205
|
-
bytes[j] *= 58;
|
|
206
|
-
}
|
|
207
|
-
bytes[0] += value;
|
|
208
|
-
let carry = 0;
|
|
209
|
-
for (let j = 0; j < bytes.length; j++) {
|
|
210
|
-
bytes[j] += carry;
|
|
211
|
-
carry = bytes[j] >> 8;
|
|
212
|
-
bytes[j] &= 0xff;
|
|
213
|
-
}
|
|
214
|
-
while (carry > 0) {
|
|
215
|
-
bytes.push(carry & 0xff);
|
|
216
|
-
carry >>= 8;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
for (let i = 0; i < output.length - 1 && output[i] === "1"; i++) {
|
|
220
|
-
bytes.push(0);
|
|
221
|
-
}
|
|
222
|
-
return new Uint8Array(bytes.reverse());
|
|
223
|
-
}
|
|
224
|
-
|
|
225
170
|
const layoutStyles = {
|
|
226
171
|
block: {
|
|
227
172
|
kBCFzs: "timvir-s-htle6",
|
|
@@ -236,7 +181,7 @@ const Context = /*#__PURE__*/React.createContext({
|
|
|
236
181
|
const useContext = () => React.useContext(Context);
|
|
237
182
|
|
|
238
183
|
const Root = "div";
|
|
239
|
-
function Arbitrary(props$1
|
|
184
|
+
function Arbitrary(props$1) {
|
|
240
185
|
const block = useBlock(props$1);
|
|
241
186
|
const {
|
|
242
187
|
ExhibitProps,
|
|
@@ -245,13 +190,16 @@ function Arbitrary(props$1, ref) {
|
|
|
245
190
|
...rest
|
|
246
191
|
} = block.props;
|
|
247
192
|
const [value, setValue] = React.useState({
|
|
193
|
+
settled: false,
|
|
248
194
|
seed: 0
|
|
249
195
|
});
|
|
250
|
-
React.
|
|
196
|
+
const refreshSeed = React.useCallback(() => {
|
|
251
197
|
setValue({
|
|
198
|
+
settled: true,
|
|
252
199
|
seed: crypto.getRandomValues(new Uint32Array(1))[0]
|
|
253
200
|
});
|
|
254
201
|
}, []);
|
|
202
|
+
React.useEffect(refreshSeed, [refreshSeed]);
|
|
255
203
|
React.useEffect(() => {
|
|
256
204
|
if (props$1.id) {
|
|
257
205
|
block.bus.next({
|
|
@@ -264,14 +212,15 @@ function Arbitrary(props$1, ref) {
|
|
|
264
212
|
}
|
|
265
213
|
}, [props$1.id, block.bus, value.seed]);
|
|
266
214
|
const rootStyleProps = props(layoutStyles.block, styles.root);
|
|
267
|
-
return /*#__PURE__*/jsx(Context
|
|
268
|
-
value:
|
|
215
|
+
return /*#__PURE__*/jsx(Context, {
|
|
216
|
+
value: React.useMemo(() => ({
|
|
217
|
+
seed: value.seed
|
|
218
|
+
}), [value.seed]),
|
|
269
219
|
children: /*#__PURE__*/jsxs(Root, {
|
|
270
|
-
ref: ref,
|
|
271
220
|
"data-timvir-b-arbitrary": true,
|
|
272
221
|
...rest,
|
|
273
222
|
...rootStyleProps,
|
|
274
|
-
className: cx(rootStyleProps.className, className),
|
|
223
|
+
className: cx(!value.settled && "timvir-unsettled", rootStyleProps.className, className),
|
|
275
224
|
style: {
|
|
276
225
|
margin: "1em 0",
|
|
277
226
|
...rootStyleProps.style,
|
|
@@ -288,12 +237,13 @@ function Arbitrary(props$1, ref) {
|
|
|
288
237
|
"data-timvir-b-arbitrary-seed": true,
|
|
289
238
|
className: "timvir-s-c342km timvir-s-1a2a7pz timvir-s-ln7xf2 timvir-s-jbqb8w timvir-s-kh2ocl timvir-s-1717udv timvir-s-h8yej3 timvir-s-1heor9g",
|
|
290
239
|
placeholder: "Seed",
|
|
291
|
-
value: encode(new TextEncoder().encode(`${value.seed}`)),
|
|
240
|
+
value: base58.encode(new TextEncoder().encode(`${value.seed}`)),
|
|
292
241
|
readOnly: true,
|
|
293
242
|
onPaste: ev => {
|
|
294
243
|
const v = ev.clipboardData.getData("text/plain");
|
|
295
244
|
setValue({
|
|
296
|
-
|
|
245
|
+
settled: true,
|
|
246
|
+
seed: +new TextDecoder().decode(base58.decode(v))
|
|
297
247
|
});
|
|
298
248
|
},
|
|
299
249
|
onFocus: ev => {
|
|
@@ -303,11 +253,7 @@ function Arbitrary(props$1, ref) {
|
|
|
303
253
|
}), /*#__PURE__*/jsx("button", {
|
|
304
254
|
type: "button",
|
|
305
255
|
className: "timvir-s-1a2a7pz timvir-s-u0aao5 timvir-s-mkeg23 timvir-s-1y0btm7 timvir-s-j7gikm timvir-s-1cum3z5 timvir-s-1d0dlzq timvir-s-1cdhzux timvir-s-ln7xf2 timvir-s-49kzi4 timvir-s-1dc5b4e timvir-s-13m658e timvir-s-1bx2y69",
|
|
306
|
-
onClick:
|
|
307
|
-
setValue({
|
|
308
|
-
seed: crypto.getRandomValues(new Uint32Array(1))[0]
|
|
309
|
-
});
|
|
310
|
-
},
|
|
256
|
+
onClick: refreshSeed,
|
|
311
257
|
children: "Refresh"
|
|
312
258
|
})]
|
|
313
259
|
}), /*#__PURE__*/jsx(Exhibit, {
|
|
@@ -320,7 +266,6 @@ function Arbitrary(props$1, ref) {
|
|
|
320
266
|
})
|
|
321
267
|
});
|
|
322
268
|
}
|
|
323
|
-
var Arbitrary_default = /*#__PURE__*/React.forwardRef(Arbitrary);
|
|
324
269
|
const styles = {
|
|
325
270
|
root: {
|
|
326
271
|
kogj98: "timvir-s-9t3ola",
|
|
@@ -328,4 +273,4 @@ const styles = {
|
|
|
328
273
|
}
|
|
329
274
|
};
|
|
330
275
|
|
|
331
|
-
export {
|
|
276
|
+
export { Arbitrary, useContext };
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
outline: none;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.timvir-s-
|
|
80
|
+
.timvir-s-49kzi4:hover, .timvir-s-13m658e:active {
|
|
81
81
|
border-color: var(--timvir-text-color);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
grid-auto-rows: min-content;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
.timvir-s-
|
|
131
|
-
grid-template-columns: [le]
|
|
130
|
+
.timvir-s-1u7e2r6 {
|
|
131
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex lc]1fr[rc rex]var(--timvir-page-margin)[re];
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.timvir-s-9flyx0 {
|
|
@@ -148,14 +148,14 @@
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
@media (width >= 72rem) {
|
|
151
|
-
.timvir-s-
|
|
152
|
-
grid-template-columns: [le]
|
|
151
|
+
.timvir-s-5diife.timvir-s-5diife {
|
|
152
|
+
grid-template-columns: [le]1fr var(--timvir-page-margin)[lex]minmax(0,12rem)[lc]48rem[rc]minmax(0,12rem)[rex]var(--timvir-page-margin) 1fr[re];
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
@media (width >= 48rem) {
|
|
157
|
-
.timvir-s-
|
|
158
|
-
grid-template-columns: [le]
|
|
157
|
+
.timvir-s-1s3i72i.timvir-s-1s3i72i {
|
|
158
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex]1fr[lc]minmax(0,48rem)[rc]1fr[rex]var(--timvir-page-margin)[re];
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -204,6 +204,10 @@
|
|
|
204
204
|
.timvir-s-5hscyn:after {
|
|
205
205
|
border-width: 1px;
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
.timvir-s-1o0ppuw:focus-within:after, .timvir-s-hqgf4x:hover:after {
|
|
209
|
+
border-color: var(--timvir-text-color);
|
|
210
|
+
}
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
@layer priority8 {
|
package/blocks/Code/Code.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
* The underlying DOM element which is rendered by this component.
|
|
4
4
|
*/
|
|
5
5
|
declare const Root = "div";
|
|
6
|
-
interface Props extends React.
|
|
6
|
+
interface Props extends React.ComponentPropsWithRef<typeof Root> {
|
|
7
7
|
/**
|
|
8
8
|
* The code that should be highlighted.
|
|
9
9
|
*/
|
|
@@ -21,5 +21,5 @@ interface Props extends React.ComponentPropsWithoutRef<typeof Root> {
|
|
|
21
21
|
highlightedLines?: Array<number>;
|
|
22
22
|
caption?: React.ReactNode;
|
|
23
23
|
}
|
|
24
|
-
declare
|
|
25
|
-
export
|
|
24
|
+
export declare function Code(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { Exhibit } from "../../Exhibit";
|
|
|
3
3
|
|
|
4
4
|
# Code
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
> Syntax highlighting for code blocks.
|
|
7
7
|
|
|
8
8
|
The component supports many different languages such as
|
|
9
9
|
<Sample variant="toggle" language="javascript">JavaScript</Sample>,
|
package/blocks/Code/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Code } from "./Code";
|
package/blocks/Code/index.js
CHANGED
|
@@ -175,7 +175,7 @@ const layoutStyles = {
|
|
|
175
175
|
}};
|
|
176
176
|
|
|
177
177
|
const Root = "div";
|
|
178
|
-
function Code(props$1
|
|
178
|
+
function Code(props$1) {
|
|
179
179
|
const block = useBlock(props$1);
|
|
180
180
|
const {
|
|
181
181
|
children,
|
|
@@ -245,7 +245,6 @@ function Code(props$1, ref) {
|
|
|
245
245
|
}, [children, language, highlightedLines]);
|
|
246
246
|
const rootStyleProps = props(layoutStyles.block);
|
|
247
247
|
return /*#__PURE__*/jsxs(Root, {
|
|
248
|
-
ref: ref,
|
|
249
248
|
"data-timvir-b-code": true,
|
|
250
249
|
...rest,
|
|
251
250
|
...rootStyleProps,
|
|
@@ -267,6 +266,5 @@ function Code(props$1, ref) {
|
|
|
267
266
|
})]
|
|
268
267
|
});
|
|
269
268
|
}
|
|
270
|
-
var Code_default = /*#__PURE__*/React.forwardRef(Code);
|
|
271
269
|
|
|
272
|
-
export {
|
|
270
|
+
export { Code };
|
package/blocks/Code/styles.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.timvir-s-idmeni {
|
|
7
|
-
--timvir-b-Code-inlinePadding: max(var(--timvir-b-Code-bleed),
|
|
7
|
+
--timvir-b-Code-inlinePadding: max(var(--timvir-b-Code-bleed),8px);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.timvir-s-1f9b50e {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.timvir-s-1etwjqo {
|
|
31
|
-
margin: 0 calc(-1
|
|
31
|
+
margin: 0 calc(-1*var(--timvir-b-Code-bleed));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.timvir-s-1ghz6dp {
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
grid-auto-rows: min-content;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.timvir-s-
|
|
123
|
-
grid-template-columns: [le]
|
|
122
|
+
.timvir-s-1u7e2r6 {
|
|
123
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex lc]1fr[rc rex]var(--timvir-page-margin)[re];
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.timvir-s-jkpybl {
|
|
@@ -128,14 +128,14 @@
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
@media (width >= 72rem) {
|
|
131
|
-
.timvir-s-
|
|
132
|
-
grid-template-columns: [le]
|
|
131
|
+
.timvir-s-5diife.timvir-s-5diife {
|
|
132
|
+
grid-template-columns: [le]1fr var(--timvir-page-margin)[lex]minmax(0,12rem)[lc]48rem[rc]minmax(0,12rem)[rex]var(--timvir-page-margin) 1fr[re];
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
@media (width >= 48rem) {
|
|
137
|
-
.timvir-s-
|
|
138
|
-
grid-template-columns: [le]
|
|
137
|
+
.timvir-s-1s3i72i.timvir-s-1s3i72i {
|
|
138
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex]1fr[lc]minmax(0,48rem)[rc]1fr[rex]var(--timvir-page-margin)[re];
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
* The underlying DOM element which is rendered by this component.
|
|
4
4
|
*/
|
|
5
5
|
declare const Root = "div";
|
|
6
|
-
interface Props extends React.
|
|
6
|
+
interface Props extends React.ComponentPropsWithRef<typeof Root> {
|
|
7
7
|
/**
|
|
8
8
|
* Array of CSS Color values.
|
|
9
9
|
*/
|
|
@@ -14,5 +14,5 @@ interface Props extends React.ComponentPropsWithoutRef<typeof Root> {
|
|
|
14
14
|
ancestry?: string;
|
|
15
15
|
}>;
|
|
16
16
|
}
|
|
17
|
-
declare
|
|
18
|
-
export
|
|
17
|
+
export declare function ColorBar(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ColorBar } from "./ColorBar";
|
package/blocks/ColorBar/index.js
CHANGED
|
@@ -175,7 +175,7 @@ const layoutStyles = {
|
|
|
175
175
|
}};
|
|
176
176
|
|
|
177
177
|
const Root = "div";
|
|
178
|
-
function ColorBar(props$1
|
|
178
|
+
function ColorBar(props$1) {
|
|
179
179
|
const block = useBlock(props$1);
|
|
180
180
|
const {
|
|
181
181
|
values,
|
|
@@ -184,7 +184,6 @@ function ColorBar(props$1, ref) {
|
|
|
184
184
|
const [selected, setSelected] = React.useState(undefined);
|
|
185
185
|
const rootStyleProps = props(layoutStyles.block, styles.root);
|
|
186
186
|
return /*#__PURE__*/jsxs(Root, {
|
|
187
|
-
ref: ref,
|
|
188
187
|
...rest,
|
|
189
188
|
...rootStyleProps,
|
|
190
189
|
className: cx(rest.className, rootStyleProps.className),
|
|
@@ -227,7 +226,6 @@ function ColorBar(props$1, ref) {
|
|
|
227
226
|
})]
|
|
228
227
|
});
|
|
229
228
|
}
|
|
230
|
-
var ColorBar_default = /*#__PURE__*/React.forwardRef(ColorBar);
|
|
231
229
|
const styles = {
|
|
232
230
|
root: {
|
|
233
231
|
kVAEAm: "timvir-s-1n2onr6",
|
|
@@ -250,4 +248,4 @@ const styles = {
|
|
|
250
248
|
}
|
|
251
249
|
};
|
|
252
250
|
|
|
253
|
-
export {
|
|
251
|
+
export { ColorBar };
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
grid-auto-rows: min-content;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.timvir-s-
|
|
95
|
-
grid-template-columns: [le]
|
|
94
|
+
.timvir-s-1u7e2r6 {
|
|
95
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex lc]1fr[rc rex]var(--timvir-page-margin)[re];
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.timvir-s-dz4c1r {
|
|
@@ -124,14 +124,14 @@
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
@media (width >= 72rem) {
|
|
127
|
-
.timvir-s-
|
|
128
|
-
grid-template-columns: [le]
|
|
127
|
+
.timvir-s-5diife.timvir-s-5diife {
|
|
128
|
+
grid-template-columns: [le]1fr var(--timvir-page-margin)[lex]minmax(0,12rem)[lc]48rem[rc]minmax(0,12rem)[rex]var(--timvir-page-margin) 1fr[re];
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
@media (width >= 48rem) {
|
|
133
|
-
.timvir-s-
|
|
134
|
-
grid-template-columns: [le]
|
|
133
|
+
.timvir-s-1s3i72i.timvir-s-1s3i72i {
|
|
134
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex]1fr[lc]minmax(0,48rem)[rc]1fr[rex]var(--timvir-page-margin)[re];
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import type * as React from "react";
|
|
2
2
|
/**
|
|
3
3
|
* The underlying DOM element which is rendered by this component.
|
|
4
4
|
*/
|
|
5
5
|
declare const Root = "div";
|
|
6
|
-
interface Props extends React.
|
|
6
|
+
interface Props extends React.ComponentPropsWithRef<typeof Root> {
|
|
7
7
|
chapters: Array<Chapter>;
|
|
8
8
|
selectedChapter?: number;
|
|
9
9
|
onSelectChapter?: (i: number) => void;
|
|
@@ -12,5 +12,5 @@ interface Chapter {
|
|
|
12
12
|
name?: string;
|
|
13
13
|
values: Array<string>;
|
|
14
14
|
}
|
|
15
|
-
declare
|
|
16
|
-
export
|
|
15
|
+
export declare function ColorBook(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ColorBook } from "./ColorBook";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var styleq = {};
|
|
@@ -161,7 +161,7 @@ const layoutStyles = {
|
|
|
161
161
|
}};
|
|
162
162
|
|
|
163
163
|
const Root = "div";
|
|
164
|
-
function ColorBook(props$1
|
|
164
|
+
function ColorBook(props$1) {
|
|
165
165
|
const {
|
|
166
166
|
chapters,
|
|
167
167
|
selectedChapter,
|
|
@@ -169,7 +169,6 @@ function ColorBook(props$1, ref) {
|
|
|
169
169
|
...rest
|
|
170
170
|
} = props$1;
|
|
171
171
|
return /*#__PURE__*/jsx(Root, {
|
|
172
|
-
ref: ref,
|
|
173
172
|
...rest,
|
|
174
173
|
...props(layoutStyles.block, styles.root),
|
|
175
174
|
children: chapters.map(({
|
|
@@ -213,7 +212,6 @@ function ColorBook(props$1, ref) {
|
|
|
213
212
|
}, i))
|
|
214
213
|
});
|
|
215
214
|
}
|
|
216
|
-
var ColorBook_default = /*#__PURE__*/React.forwardRef(ColorBook);
|
|
217
215
|
const styles = {
|
|
218
216
|
root: {
|
|
219
217
|
k1xSpc: "timvir-s-rvj5dj",
|
|
@@ -243,4 +241,4 @@ const styles = {
|
|
|
243
241
|
}
|
|
244
242
|
};
|
|
245
243
|
|
|
246
|
-
export {
|
|
244
|
+
export { ColorBook };
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
grid-auto-rows: min-content;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.timvir-s-
|
|
87
|
-
grid-template-columns: [le]
|
|
86
|
+
.timvir-s-1u7e2r6 {
|
|
87
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex lc]1fr[rc rex]var(--timvir-page-margin)[re];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
.timvir-s-o5v014 {
|
|
@@ -99,27 +99,15 @@
|
|
|
99
99
|
text-align: center;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.timvir-s-115iamj:hover:before {
|
|
103
|
-
box-shadow: 0 0 0 2px #00000040;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.timvir-s-ach7vw:hover:before {
|
|
107
|
-
box-shadow: 0 0 0 2px var(--c-p-5);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.timvir-s-s2hnm7:hover:before {
|
|
111
|
-
opacity: 1;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
102
|
@media (width >= 72rem) {
|
|
115
|
-
.timvir-s-
|
|
116
|
-
grid-template-columns: [le]
|
|
103
|
+
.timvir-s-5diife.timvir-s-5diife {
|
|
104
|
+
grid-template-columns: [le]1fr var(--timvir-page-margin)[lex]minmax(0,12rem)[lc]48rem[rc]minmax(0,12rem)[rex]var(--timvir-page-margin) 1fr[re];
|
|
117
105
|
}
|
|
118
106
|
}
|
|
119
107
|
|
|
120
108
|
@media (width >= 48rem) {
|
|
121
|
-
.timvir-s-
|
|
122
|
-
grid-template-columns: [le]
|
|
109
|
+
.timvir-s-1s3i72i.timvir-s-1s3i72i {
|
|
110
|
+
grid-template-columns: [le]var(--timvir-page-margin)[lex]1fr[lc]minmax(0,48rem)[rc]1fr[rex]var(--timvir-page-margin)[re];
|
|
123
111
|
}
|
|
124
112
|
}
|
|
125
113
|
}
|
|
@@ -204,6 +192,18 @@
|
|
|
204
192
|
.timvir-s-1hmns74:before {
|
|
205
193
|
position: absolute;
|
|
206
194
|
}
|
|
195
|
+
|
|
196
|
+
.timvir-s-115iamj:hover:before {
|
|
197
|
+
box-shadow: 0 0 0 2px #00000040;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.timvir-s-ach7vw:hover:before {
|
|
201
|
+
box-shadow: 0 0 0 2px var(--c-p-5);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.timvir-s-s2hnm7:hover:before {
|
|
205
|
+
opacity: 1;
|
|
206
|
+
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
@layer priority8 {
|