timvir 0.2.44 → 0.2.45

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # timvir
2
2
 
3
+ ## 0.2.45
4
+
5
+ ### Patch Changes
6
+
7
+ - **Use data attributes instead of CSS classes to identify block elements** ([#3511](https://github.com/timvir/timvir/pull/3511)) - Previously we've added well-known class names to certain blocks. This was used to allow external tools to more easily identify blocks on a rendered page. The custom CSS classes have been replaced by data attributes. If you used class selectors to identify blocks, you'll need to replace them with data attribute selectors. For example, instead of `.timvir-b-Exhibit` use `[data-timvir-b-exhibit]`. Note: data attributes are lowercase.
8
+
3
9
  ## 0.2.44
4
10
 
5
11
  ### Patch Changes
@@ -264,16 +264,14 @@ function Arbitrary(props$1, ref) {
264
264
  }
265
265
  }, [props$1.id, block.bus, value.seed]);
266
266
  const rootStyleProps = props(layoutStyles.block, styles.root);
267
- const inputStyleProps = {
268
- 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"
269
- };
270
267
  return /*#__PURE__*/jsx(Context.Provider, {
271
268
  value: value,
272
269
  children: /*#__PURE__*/jsxs(Root, {
273
270
  ref: ref,
271
+ "data-timvir-b-arbitrary": true,
274
272
  ...rest,
275
273
  ...rootStyleProps,
276
- className: cx("timvir-b-Arbitrary", rootStyleProps.className, className),
274
+ className: cx(rootStyleProps.className, className),
277
275
  style: {
278
276
  margin: "1em 0",
279
277
  ...rootStyleProps.style,
@@ -287,11 +285,8 @@ function Arbitrary(props$1, ref) {
287
285
  className: "timvir-s-1rg5ohu timvir-s-vgvpxu timvir-s-15ku74s",
288
286
  children: "Seed:"
289
287
  }), /*#__PURE__*/jsx("input", {
290
- ...inputStyleProps,
291
- className: cx("timvir-b-Arbitrary-seed", inputStyleProps.className),
292
- style: {
293
- ...inputStyleProps.style
294
- },
288
+ "data-timvir-b-arbitrary-seed": true,
289
+ 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",
295
290
  placeholder: "Seed",
296
291
  value: encode(new TextEncoder().encode(`${value.seed}`)),
297
292
  readOnly: true,
@@ -325,7 +320,7 @@ function Arbitrary(props$1, ref) {
325
320
  })
326
321
  });
327
322
  }
328
- var Arbitrary$1 = /*#__PURE__*/React.forwardRef(Arbitrary);
323
+ var Arbitrary_default = /*#__PURE__*/React.forwardRef(Arbitrary);
329
324
  const styles = {
330
325
  root: {
331
326
  kogj98: "timvir-s-9t3ola",
@@ -333,4 +328,4 @@ const styles = {
333
328
  }
334
329
  };
335
330
 
336
- export { Arbitrary$1 as Arbitrary, useContext };
331
+ export { Arbitrary_default as Arbitrary, useContext };
@@ -229,34 +229,29 @@ function Code(props$1, ref) {
229
229
  })();
230
230
  }, [children, language, highlightedLines]);
231
231
  const rootStyleProps = props(layoutStyles.block);
232
- const codeStyleProps = {
233
- className: "timvir-s-w2csxc timvir-s-6wvzqs timvir-s-sfzzmd timvir-s-1sxf85j timvir-s-15o1dgp timvir-s-idmeni timvir-s-1717udv timvir-s-1etwjqo timvir-s-mkeg23 timvir-s-1y0btm7 timvir-s-j7gikm timvir-s-1d0dlzq"
234
- };
235
- const captionStyleProps = {
236
- className: "timvir-s-1dcheo9 timvir-s-jkpybl timvir-s-vgvpxu timvir-s-lwy1ot"
237
- };
238
232
  return /*#__PURE__*/jsxs(Root, {
239
233
  ref: ref,
234
+ "data-timvir-b-code": true,
240
235
  ...rest,
241
236
  ...rootStyleProps,
242
- className: cx("timvir-b-Code", !state.settled && "timvir-unsettled", className, rootStyleProps.className),
237
+ className: cx(!state.settled && "timvir-unsettled", className, rootStyleProps.className),
243
238
  style: {
244
239
  ...rootStyleProps.style,
245
240
  ...rest.style
246
241
  },
247
242
  children: [/*#__PURE__*/jsx("div", {
248
- ...codeStyleProps,
249
- className: cx("timvir-b-Code-container", codeStyleProps.className),
243
+ "data-timvir-b-code-container": true,
244
+ className: "timvir-s-w2csxc timvir-s-6wvzqs timvir-s-sfzzmd timvir-s-1sxf85j timvir-s-i27niw timvir-s-idmeni timvir-s-1717udv timvir-s-1etwjqo timvir-s-mkeg23 timvir-s-1y0btm7 timvir-s-j7gikm timvir-s-1d0dlzq",
250
245
  dangerouslySetInnerHTML: {
251
246
  __html: state.html
252
247
  }
253
248
  }), caption && /*#__PURE__*/jsx("div", {
254
- ...captionStyleProps,
255
- className: cx("timvir-b-Code-caption", captionStyleProps.className),
249
+ "data-timvir-b-code-caption": true,
250
+ className: "timvir-s-1dcheo9 timvir-s-jkpybl timvir-s-vgvpxu timvir-s-lwy1ot",
256
251
  children: caption
257
252
  })]
258
253
  });
259
254
  }
260
- var Code$1 = /*#__PURE__*/React.forwardRef(Code);
255
+ var Code_default = /*#__PURE__*/React.forwardRef(Code);
261
256
 
262
- export { Code$1 as Code };
257
+ export { Code_default as Code };
@@ -1,6 +1,6 @@
1
1
  @layer priority1 {
2
- .timvir-s-15o1dgp {
3
- --timvir-b-Code-bleed: calc(var(--timvir-margin, 0) * .6666);
2
+ .timvir-s-i27niw {
3
+ --timvir-b-Code-bleed: calc(var(--timvir-margin, 0px) * .6666);
4
4
  }
5
5
 
6
6
  .timvir-s-idmeni {
@@ -5,130 +5,45 @@ import { Code, Exhibit } from "timvir/blocks";
5
5
 
6
6
  A `ColorBar` is a horizontal arrangement of swatches.
7
7
 
8
- <Exhibit>
9
- <ColorBar
10
- values={[
11
- "#D6CCFF",
12
- "#C8BCF5",
13
- "#BAACEB",
14
- "#AC9CE1",
15
- "#9E8CD7",
16
- "#907DCD",
17
- "#826EC3",
18
- "#745FBA",
19
- "#6550B0",
20
- "#5642A6",
21
- ]}
22
- style={{ margin: 0 }}
23
- />
24
- </Exhibit>
8
+ <Sample variant="basic" />
25
9
 
26
- <Exhibit>
27
- <ColorBar values={["#a0dbc2", "#60c19f", "#1a896b", "#0e6d54"]} style={{ margin: 0 }} />
28
- </Exhibit>
10
+ Pass the colors as an array of CSS color values.
29
11
 
30
- <Code language="jsx" caption="Pass an array of color values to the component." highlightedLines={[4]}>
12
+ <Code language="jsx" highlightedLines={[4]}>
31
13
  <Sample variant="basic" as="source" />
32
14
  </Code>
33
15
 
34
- The ColorBar works comfortably with as few as two colors and as many as 20
35
-
36
- <Exhibit caption="Two colors in a ColorBar">
37
- <ColorBar
38
- values={[
39
- { value: "#FFE4A0", name: "Yellow Submarine", ancestry: "Yellow 001" },
40
- { value: "#A67908", name: "Yellow Spaceship", ancestry: "Yellow 999", contrastValue: "white" },
41
- ]}
42
- style={{ margin: 0 }}
43
- />
44
- </Exhibit>
45
-
46
- <Exhibit caption="20 colors in a ColorBar">
47
- <ColorBar
48
- values={[
49
- "#FFE4A0",
50
- "#FBDE98",
51
- "#F6D891",
52
- "#F2D28A",
53
- "#EDCC82",
54
- "#E8C77B",
55
- "#E4C173",
56
- "#DFBB6C",
57
- "#DBB565",
58
- "#D6B05D",
59
- "#D1AA56",
60
- "#CDA54F",
61
- "#C89F47",
62
- "#C39940",
63
- "#BE9438",
64
- "#BA8E30",
65
- "#B58928",
66
- "#B0841F",
67
- "#AB7E15",
68
- "#A67908",
69
- ]}
70
- style={{ margin: 0 }}
71
- />
72
- </Exhibit>
73
-
74
- ## Text Colors
75
-
76
- These are the main text colors that are used in our website. We have a **textPrimary** color for
77
- headings and body text, **textSecondary** for captions and meta lines, and a third (yet unamed)
78
- text color for card descriptions.
79
-
80
- All text colors are taken from the **Gray** palette.
81
-
82
- <Exhibit caption="Text Colors" style={{ margin: "10px 0 20px 0" }}>
83
- <ColorBar
84
- values={[
85
- { value: "rgba(0, 0, 13, 0.89)", name: "textPrimary", ancestry: "Gray 01", contrastValue: "white" },
86
- { value: "rgba(0, 0, 13, 0.69)", name: "???? (unnamed)", ancestry: "Gray 03", contrastValue: "white" },
87
- { value: "rgba(0, 0, 13, 0.49)", name: "textSecondary", ancestry: "Gray 05" },
88
- ]}
89
- style={{ margin: 0 }}
90
- />
91
- </Exhibit>
92
- <Exhibit caption="Gray Color Palette (00 – 09)" style={{ margin: "-12px 0 20px 0" }}>
93
- <ColorBar
94
- values={[
95
- { value: "rgba(0, 0, 13, 0.99)", name: "Gray 00", contrastValue: "white" },
96
- { value: "rgba(0, 0, 13, 0.89)", name: "Gray 01", contrastValue: "white" },
97
- { value: "rgba(0, 0, 13, 0.79)", name: "Gray 02", contrastValue: "white" },
98
- { value: "rgba(0, 0, 13, 0.69)", name: "Gray 03", contrastValue: "white" },
99
- { value: "rgba(0, 0, 13, 0.59)", name: "Gray 04", contrastValue: "white" },
100
- { value: "rgba(0, 0, 13, 0.49)", name: "Gray 05", contrastValue: "black" },
101
- { value: "rgba(0, 0, 13, 0.39)", name: "Gray 06", contrastValue: "black" },
102
- { value: "rgba(0, 0, 13, 0.29)", name: "Gray 07", contrastValue: "black" },
103
- { value: "rgba(0, 0, 13, 0.19)", name: "Gray 08", contrastValue: "black" },
104
- { value: "rgba(0, 0, 13, 0.09)", name: "Gray 09", contrastValue: "black" },
105
- ]}
106
- style={{ margin: 0 }}
107
- />
108
- </Exhibit>
109
-
110
- Wrap a `<ColorBar>` in a `<Exhibit>` to add a caption to it. The caption can even include links!
111
-
112
- <Exhibit
113
- caption={
114
- <>
115
- Source: <a href="https://hihayk.github.io/scale/#2/7/50/90/0/0/0/-0/1190D7/17/144/215">hihayk.github.io/scale</a>
116
- </>
117
- }
118
- >
119
- <ColorBar
120
- values={[
121
- "#E7F4FB",
122
- "#C9E6F6",
123
- "#AAD7F1",
124
- "#8BC9EC",
125
- "#6DBBE6",
126
- "#4EADE1",
127
- "#309EDC",
128
- "#1190D7",
129
- "#0D6CA1",
130
- "#09486C",
131
- ]}
132
- style={{ margin: 0 }}
133
- />
134
- </Exhibit>
16
+ The ColorBar works comfortably with as few as two colors and as many as 20.
17
+ If you specify more colors than that, each individual swatch becomes tiny, especially on smaller viewports.
18
+
19
+ <ColorBar
20
+ values={[
21
+ { value: "#FFE4A0", name: "Yellow Submarine", ancestry: "Yellow 001" },
22
+ { value: "#A67908", name: "Yellow Spaceship", ancestry: "Yellow 999", contrastValue: "white" },
23
+ ]}
24
+ />
25
+
26
+ <ColorBar
27
+ values={[
28
+ "#FFE4A0",
29
+ "#FBDE98",
30
+ "#F6D891",
31
+ "#F2D28A",
32
+ "#EDCC82",
33
+ "#E8C77B",
34
+ "#E4C173",
35
+ "#DFBB6C",
36
+ "#DBB565",
37
+ "#D6B05D",
38
+ "#D1AA56",
39
+ "#CDA54F",
40
+ "#C89F47",
41
+ "#C39940",
42
+ "#BE9438",
43
+ "#BA8E30",
44
+ "#B58928",
45
+ "#B0841F",
46
+ "#AB7E15",
47
+ "#A67908",
48
+ ]}
49
+ />
@@ -227,7 +227,7 @@ function ColorBar(props$1, ref) {
227
227
  })]
228
228
  });
229
229
  }
230
- var ColorBar$1 = /*#__PURE__*/React.forwardRef(ColorBar);
230
+ var ColorBar_default = /*#__PURE__*/React.forwardRef(ColorBar);
231
231
  const styles = {
232
232
  root: {
233
233
  kVAEAm: "timvir-s-1n2onr6",
@@ -250,4 +250,4 @@ const styles = {
250
250
  }
251
251
  };
252
252
 
253
- export { ColorBar$1 as ColorBar };
253
+ export { ColorBar_default as ColorBar };
@@ -213,7 +213,7 @@ function ColorBook(props$1, ref) {
213
213
  }, i))
214
214
  });
215
215
  }
216
- var ColorBook$1 = /*#__PURE__*/React.forwardRef(ColorBook);
216
+ var ColorBook_default = /*#__PURE__*/React.forwardRef(ColorBook);
217
217
  const styles = {
218
218
  root: {
219
219
  k1xSpc: "timvir-s-rvj5dj",
@@ -243,4 +243,4 @@ const styles = {
243
243
  }
244
244
  };
245
245
 
246
- export { ColorBook$1 as ColorBook };
246
+ export { ColorBook_default as ColorBook };
@@ -201,6 +201,6 @@ function Cover(props$1, ref) {
201
201
  })
202
202
  });
203
203
  }
204
- var Cover$1 = /*#__PURE__*/React.forwardRef(Cover);
204
+ var Cover_default = /*#__PURE__*/React.forwardRef(Cover);
205
205
 
206
- export { Cover$1 as Cover };
206
+ export { Cover_default as Cover };
@@ -194,14 +194,12 @@ function Exhibit(props$1, ref) {
194
194
  className: "timvir-s-ufnvkl timvir-s-7zdco timvir-s-1sxf85j timvir-s-mkeg23 timvir-s-1tffoc1 timvir-s-ng3xce timvir-s-rxpjvj timvir-s-1717udv"
195
195
  }
196
196
  }[!!(bleed === 0) << 0];
197
- const captionStyleProps = {
198
- className: "timvir-s-1dcheo9 timvir-s-jkpybl timvir-s-vgvpxu timvir-s-lwy1ot"
199
- };
200
197
  return /*#__PURE__*/jsxs(Root, {
201
198
  ref: ref,
199
+ "data-timvir-b-exhibit": true,
202
200
  ...rest,
203
201
  ...rootStyleProps,
204
- className: cx("timvir-b-Exhibit", className, rootStyleProps.className),
202
+ className: cx(className, rootStyleProps.className),
205
203
  style: {
206
204
  ...rootStyleProps.style,
207
205
  ...style,
@@ -210,9 +208,10 @@ function Exhibit(props$1, ref) {
210
208
  [cssVariables.background]: "var(--timvir-background-pattern)"
211
209
  },
212
210
  children: [/*#__PURE__*/jsx("div", {
211
+ "data-timvir-b-exhibit-container": true,
213
212
  ...BackdropProps,
214
213
  ...containerStyleProps,
215
- className: cx("timvir-b-Exhibit-container", containerStyleProps.className, BackdropProps?.className),
214
+ className: cx(containerStyleProps.className, BackdropProps?.className),
216
215
  style: {
217
216
  ...containerStyleProps.style,
218
217
  border: bleed === 0 ? "none" : `1px solid var(${cssVariables.borderColor})`,
@@ -220,13 +219,13 @@ function Exhibit(props$1, ref) {
220
219
  },
221
220
  children: children
222
221
  }), caption && /*#__PURE__*/jsx("div", {
223
- ...captionStyleProps,
224
- className: cx("timvir-b-Exhibit-caption", captionStyleProps.className),
222
+ "data-timvir-b-exhibit-caption": true,
223
+ className: "timvir-s-1dcheo9 timvir-s-jkpybl timvir-s-vgvpxu timvir-s-lwy1ot",
225
224
  children: caption
226
225
  })]
227
226
  });
228
227
  }
229
- var Exhibit$1 = /*#__PURE__*/React.forwardRef(Exhibit);
228
+ var Exhibit_default = /*#__PURE__*/React.forwardRef(Exhibit);
230
229
  const cssVariables = {
231
230
  bleed: "--timvir-b-Exhibit-bleed",
232
231
  borderColor: "--timvir-b-Exhibit-borderColor",
@@ -238,4 +237,4 @@ const styles = {
238
237
  }
239
238
  };
240
239
 
241
- export { Exhibit$1 as Exhibit };
240
+ export { Exhibit_default as Exhibit };
@@ -300,6 +300,6 @@ function Font(props$1, ref) {
300
300
  })]
301
301
  });
302
302
  }
303
- var Font$1 = /*#__PURE__*/React.forwardRef(Font);
303
+ var Font_default = /*#__PURE__*/React.forwardRef(Font);
304
304
 
305
- export { Font$1 as Font };
305
+ export { Font_default as Font };
@@ -188,10 +188,26 @@ function Grid(props$1, ref) {
188
188
  ...rest.style
189
189
  },
190
190
  className: cx(className, rootStyleProps.className),
191
- children: children
191
+ children: React.Children.map(children, child => {
192
+ if (! /*#__PURE__*/React.isValidElement(child)) {
193
+ return child;
194
+ }
195
+ const {
196
+ style,
197
+ ...props
198
+ } = child.props;
199
+ return /*#__PURE__*/React.createElement(child.type, {
200
+ ...props,
201
+ style: {
202
+ margin: 0,
203
+ gridColumn: "initial",
204
+ ...style
205
+ }
206
+ });
207
+ })
192
208
  });
193
209
  }
194
- var Grid$1 = /*#__PURE__*/React.forwardRef(Grid);
210
+ var Grid_default = /*#__PURE__*/React.forwardRef(Grid);
195
211
  const styles = {
196
212
  root: {
197
213
  k1xSpc: "timvir-s-rvj5dj",
@@ -202,4 +218,4 @@ const styles = {
202
218
  }
203
219
  };
204
220
 
205
- export { Grid$1 as Grid };
221
+ export { Grid_default as Grid };
@@ -136,6 +136,6 @@ function Icon(props, ref) {
136
136
  })
137
137
  });
138
138
  }
139
- var Icon$1 = /*#__PURE__*/React.forwardRef(Icon);
139
+ var Icon_default = /*#__PURE__*/React.forwardRef(Icon);
140
140
 
141
- export { Icon$1 as Icon };
141
+ export { Icon_default as Icon };
@@ -1,48 +1,57 @@
1
- import { Exhibit } from "../../Exhibit";
2
- import { Grid } from "../../Grid";
3
1
  import { Swatch } from "../../Swatch";
4
2
  import { Code } from "../../Code";
5
3
 
6
4
  # Message
7
5
 
8
- <Exhibit>
9
- <Sample variant="basic" />
10
- </Exhibit>
6
+ The `<Message>` component is a simple container for messages.
11
7
 
12
- <Code language="jsx">
13
- <Sample variant="basic" as="source" />
14
- </Code>
8
+ <Sample variant="basic" />
15
9
 
16
10
  ## Variants
17
11
 
18
- <Grid>
19
- <Exhibit caption="info" style={{ margin: 0, gridColumn: "initial" }}>
20
- <Sample variant="basic" props={{ variant: "info" }} />
21
- </Exhibit>
22
- <Exhibit caption="warning" style={{ margin: 0, gridColumn: "initial" }}>
23
- <Sample variant="basic" props={{ variant: "warning" }} />
24
- </Exhibit>
25
- <Exhibit caption="alert" style={{ margin: 0, gridColumn: "initial" }}>
26
- <Sample variant="basic" props={{ variant: "alert" }} />
27
- </Exhibit>
28
- </Grid>
12
+ The Message block comes in four variants: **plain**, **info**, **warning**, and **alert**.
13
+ Each variant uses a different color and icon.
14
+ Below are examples in which situations to use the variants.
29
15
 
30
- ## Content
16
+ <Sample variant="basic">
17
+ This is the **plain** variant. Use it for simple notes, neutral remarks, or secondary information that doesn’t require emphasis.
18
+
19
+ _Example:_ This component is defined in src/components/Message.tsx.
20
+
21
+ </Sample>
22
+
23
+ <Sample variant="basic" props={{ variant: "info" }}>
24
+ This is the **info** variant. Use it to share helpful or contextual information about the code or component.
25
+
26
+ _Example:_ This hook is useful for managing form state.
27
+
28
+ </Sample>
31
29
 
32
- Make the title bold and place it before the message, or use a level 3 heading. You can use arbitrary markdown inside the message.
30
+ <Sample variant="basic" props={{ variant: "warning" }}>
31
+ This is the **warning** variant. Use it to call attention to potential pitfalls, limitations, or special cases to consider when using the code.
33
32
 
34
- <Grid>
35
- <Exhibit caption="Inline title" style={{ margin: 0, gridColumn: "initial" }}>
36
- <Sample variant="basic">
33
+ _Example:_ This component has not been tested with server-side rendering.
37
34
 
38
- **Short Messages** should place the title in front of the message and make it stand out.
35
+ </Sample>
39
36
 
40
- </Sample>
41
- </Exhibit>
37
+ <Sample variant="basic" props={{ variant: "alert" }}>
38
+ This is the **alert** variant. Use it for strict requirements, do-nots, or critical caveats that must be followed when using the code.
42
39
 
43
- <Exhibit caption="Title as a separate block elment" style={{ margin: 0, gridColumn: "initial" }}>
44
- <Sample variant="basic">
40
+ _Example:_ You must not use this component inside a React Suspense boundary.
45
41
 
42
+ </Sample>
43
+
44
+ ## Content
45
+
46
+ You can use arbitrary markdown inside the message, or even blocks.
47
+ Note that not all combinations have been exhaustively tested.
48
+ If you come across markup that doesn't render well, please raise an issue in the Timvir project.
49
+
50
+ <Sample variant="basic">
51
+ **Short Messages** should place the title in front of the message and make it stand out.
52
+ </Sample>
53
+
54
+ <Sample variant="basic">
46
55
  ### Longer Messages
47
56
 
48
57
  Longer messages should make the title a separate block element. This body uses [links](#) and _italic_ text.
@@ -50,10 +59,7 @@ Longer messages should make the title a separate block element. This body uses [
50
59
  And multiple paragraphs. And even a component:
51
60
 
52
61
  <Swatch value="#FF00FF" />
53
-
54
- </Sample>
55
- </Exhibit>
56
- </Grid>
62
+ </Sample>
57
63
 
58
64
  ## References
59
65
 
@@ -234,6 +234,7 @@ function Message(props$1, ref) {
234
234
  className: "timvir-s-3psx0u timvir-s-1lliihq timvir-s-1n2onr6 timvir-s-xk6nc9 timvir-s-jvto2c timvir-s-dpf0h8 timvir-s-ozkzq6 timvir-s-1mz1spe"
235
235
  })
236
236
  }[variant], /*#__PURE__*/jsx("div", {
237
+ className: "timvir-s-1iyjqo2 timvir-s-euugli",
237
238
  children: React.Children.toArray(children).map((child, index, array) => {
238
239
  if (/*#__PURE__*/React.isValidElement(child)) {
239
240
  const style = {
@@ -256,7 +257,7 @@ function Message(props$1, ref) {
256
257
  })]
257
258
  });
258
259
  }
259
- var Message$1 = /*#__PURE__*/React.forwardRef(Message);
260
+ var Message_default = /*#__PURE__*/React.forwardRef(Message);
260
261
  const styles = {
261
262
  root: {
262
263
  kVAEAm: "timvir-s-1n2onr6",
@@ -307,7 +308,12 @@ const styles = {
307
308
  iconAlert: {
308
309
  kMwMTN: "timvir-s-1mz1spe",
309
310
  $$css: true
311
+ },
312
+ content: {
313
+ kzQI83: "timvir-s-1iyjqo2",
314
+ k7Eaqz: "timvir-s-euugli",
315
+ $$css: true
310
316
  }
311
317
  };
312
318
 
313
- export { Message$1 as Message };
319
+ export { Message_default as Message };
@@ -103,6 +103,10 @@
103
103
  display: grid;
104
104
  }
105
105
 
106
+ .timvir-s-1iyjqo2 {
107
+ flex-grow: 1;
108
+ }
109
+
106
110
  .timvir-s-kpwil5 {
107
111
  font-size: .875rem;
108
112
  }
@@ -4,36 +4,38 @@ import { Grid } from "../../Grid";
4
4
 
5
5
  # Swatch
6
6
 
7
- <Exhibit caption="Plain color" style={{ marginBottom: 24 }}>
8
- <Swatch value="#FF00FF" style={{ margin: 0 }} />
9
- </Exhibit>
7
+ A `<Swatch>` is a colored block element.
8
+ It highlights a particular color, and provides additional information to it.
10
9
 
11
- <Exhibit caption="Give the color a meaningful name" style={{ marginBottom: 24 }}>
12
- <Swatch value="#FF00FF" name="Primary" style={{ margin: 0 }} />
13
- </Exhibit>
10
+ <Swatch value="#FF00FF" />
14
11
 
15
- <Exhibit caption="Add a note about its ancenstry (how or where from it was derived)" style={{ marginBottom: 24 }}>
16
- <Swatch value="#FF00FF" name="Primary" ancestry="Red 700" style={{ margin: 0 }} />
17
- </Exhibit>
12
+ You can provide a meaningful name along with the color value.
13
+ This helps users to correlate the color to names used outside of this documentation, for example in a design system.
14
+
15
+ <Swatch value="#FF00FF" name="Primary" />
16
+
17
+ Use the secondary label to add a secondary explanation or reference.
18
+
19
+ <Swatch value="#FF00FF" name="Primary" ancestry="Red 700" />
18
20
 
19
21
  ## In a Grid
20
22
 
21
23
  <Grid style={{ gridGap: 6 }}>
22
- <Swatch value="#0E5A8A" contrastValue="#FFFFFF" name="@blue1" style={{ margin: 0, gridColumn: "initial" }} />
23
- <Swatch value="#106BA3" contrastValue="#FFFFFF" name="@blue2" style={{ margin: 0, gridColumn: "initial" }} />
24
- <Swatch value="#137CBD" contrastValue="#FFFFFF" name="@blue3" style={{ margin: 0, gridColumn: "initial" }} />
25
- <Swatch value="#2B95D6" contrastValue="#000000" name="@blue4" style={{ margin: 0, gridColumn: "initial" }} />
26
- <Swatch value="#48AFF0" contrastValue="#000000" name="@blue5" style={{ margin: 0, gridColumn: "initial" }} />
24
+ <Swatch value="#0E5A8A" contrastValue="#FFFFFF" name="@blue1" />
25
+ <Swatch value="#106BA3" contrastValue="#FFFFFF" name="@blue2" />
26
+ <Swatch value="#137CBD" contrastValue="#FFFFFF" name="@blue3" />
27
+ <Swatch value="#2B95D6" contrastValue="#000000" name="@blue4" />
28
+ <Swatch value="#48AFF0" contrastValue="#000000" name="@blue5" />
27
29
  </Grid>
28
30
 
29
31
  ## Another example
30
32
 
31
- <div style={{ gridColumn: "lc / rc", display: "grid", gridGap: 6 }}>
32
- <Swatch value="#F58221" name="Access" ancestry="Orange 300" style={{ margin: 0, gridColumn: "initial" }} />
33
- <Swatch value="#D9418D" name="Use" ancestry="Red 500" style={{ margin: 0, gridColumn: "initial" }} />
34
- <Swatch value="#B87AF2" name="Innovation" ancestry="Violett 500" style={{ margin: 0, gridColumn: "initial" }} />
35
- <Swatch value="#4188D9" name="Jobs" ancestry="Blue 500" style={{ margin: 0, gridColumn: "initial" }} />
36
- <Swatch value="#4AE6CC" name="Society" ancestry="…" style={{ margin: 0, gridColumn: "initial" }} />
37
- <Swatch value="#1FD35B" name="Trust" ancestry="Green 400" style={{ margin: 0, gridColumn: "initial" }} />
38
- <Swatch value="#C4D534" name="Market Openness" ancestry="…" style={{ margin: 0, gridColumn: "initial" }} />
39
- </div>
33
+ <Grid style={{ gridGap: 6, gridTemplateColumns: "1fr" }}>
34
+ <Swatch value="#F58221" name="Access" ancestry="Orange 300" />
35
+ <Swatch value="#D9418D" name="Use" ancestry="Red 500" />
36
+ <Swatch value="#B87AF2" name="Innovation" ancestry="Violett 500" />
37
+ <Swatch value="#4188D9" name="Jobs" ancestry="Blue 500" />
38
+ <Swatch value="#4AE6CC" name="Society" ancestry="…" />
39
+ <Swatch value="#1FD35B" name="Trust" ancestry="Green 400" />
40
+ <Swatch value="#C4D534" name="Market Openness" ancestry="…" />
41
+ </Grid>
@@ -236,7 +236,7 @@ function Swatch(props$1, ref) {
236
236
  })
237
237
  });
238
238
  }
239
- var Swatch$1 = /*#__PURE__*/React.forwardRef(Swatch);
239
+ var Swatch_default = /*#__PURE__*/React.forwardRef(Swatch);
240
240
  const styles = {
241
241
  root: {
242
242
  kVAEAm: "timvir-s-1n2onr6",
@@ -244,4 +244,4 @@ const styles = {
244
244
  }
245
245
  };
246
246
 
247
- export { Swatch$1 as Swatch };
247
+ export { Swatch_default as Swatch };
@@ -388,8 +388,9 @@ function Viewport(props$1, ref) {
388
388
  return /*#__PURE__*/jsxs(Fragment, {
389
389
  children: [/*#__PURE__*/jsxs(Root, {
390
390
  ref: ref,
391
+ "data-timvir-b-viewport": true,
391
392
  ...rest,
392
- className: cx("timvir-b-Viewport", !state.settled && "timvir-unsettled", className, rootStyleProps.className),
393
+ className: cx(!state.settled && "timvir-unsettled", className, rootStyleProps.className),
393
394
  style: {
394
395
  ...rootStyleProps.style,
395
396
  ...rest.style
@@ -496,7 +497,7 @@ function Viewport(props$1, ref) {
496
497
  })]
497
498
  });
498
499
  }
499
- var Viewport$1 = /*#__PURE__*/React.forwardRef(Viewport);
500
+ var Viewport_default = /*#__PURE__*/React.forwardRef(Viewport);
500
501
  const styles = {
501
502
  root: {
502
503
  ktR8K2: "timvir-s-1vjgj0v",
@@ -505,4 +506,4 @@ const styles = {
505
506
  }
506
507
  };
507
508
 
508
- export { Viewport$1 as Viewport };
509
+ export { Viewport_default as Viewport };
@@ -200,12 +200,13 @@ function WebLink(props$1, ref) {
200
200
  const rootStyleProps = props(layoutStyles.block, styles.root);
201
201
  return /*#__PURE__*/jsxs(Root, {
202
202
  ref: ref,
203
+ "data-timvir-b-weblink": true,
203
204
  href: url,
204
205
  target: "_blank",
205
206
  rel: "noopener noreferrer",
206
207
  ...rest,
207
208
  ...rootStyleProps,
208
- className: cx("timvir-b-WebLink", !state.settled && "timvir-unsettled", className, rootStyleProps.className),
209
+ className: cx(!state.settled && "timvir-unsettled", className, rootStyleProps.className),
209
210
  style: {
210
211
  ...rootStyleProps.style,
211
212
  ...rest.style
@@ -241,7 +242,7 @@ function WebLink(props$1, ref) {
241
242
  })]
242
243
  });
243
244
  }
244
- var WebLink$1 = /*#__PURE__*/React.forwardRef(WebLink);
245
+ var WebLink_default = /*#__PURE__*/React.forwardRef(WebLink);
245
246
  const styles = {
246
247
  root: {
247
248
  kmkexE: "timvir-s-zhuw26",
@@ -264,4 +265,4 @@ async function defaultUnfurl(url) {
264
265
  return fetch(`https://timvir.vercel.app/api/unfurl?url=${encodeURIComponent(url)}`).then(res => res.json());
265
266
  }
266
267
 
267
- export { WebLink$1 as WebLink };
268
+ export { WebLink_default as WebLink };
package/blocks/styles.css CHANGED
@@ -222,8 +222,8 @@
222
222
  }
223
223
  }
224
224
  @layer priority1 {
225
- .timvir-s-15o1dgp {
226
- --timvir-b-Code-bleed: calc(var(--timvir-margin, 0) * .6666);
225
+ .timvir-s-i27niw {
226
+ --timvir-b-Code-bleed: calc(var(--timvir-margin, 0px) * .6666);
227
227
  }
228
228
 
229
229
  .timvir-s-idmeni {
@@ -1420,6 +1420,10 @@
1420
1420
  display: grid;
1421
1421
  }
1422
1422
 
1423
+ .timvir-s-1iyjqo2 {
1424
+ flex-grow: 1;
1425
+ }
1426
+
1423
1427
  .timvir-s-kpwil5 {
1424
1428
  font-size: .875rem;
1425
1429
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  declare const Root = "div";
3
- interface Props extends React.ComponentPropsWithoutRef<typeof Root> {
3
+ interface Props extends Omit<React.ComponentPropsWithoutRef<typeof Root>, "className" | "style"> {
4
4
  label?: React.ReactNode;
5
5
  }
6
6
  declare function Action(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,7 @@ import { Node } from "./types";
5
5
  * The underlying DOM element which is rendered by this component.
6
6
  */
7
7
  declare const Root = "div";
8
- interface Props extends React.ComponentProps<typeof Root> {
8
+ interface Props extends Omit<React.ComponentProps<typeof Root>, "className" | "style"> {
9
9
  toc: readonly Node[];
10
10
  location: {
11
11
  asPath: string;
@@ -1,6 +1,8 @@
1
+ import * as stylex from "@stylexjs/stylex";
1
2
  import * as React from "react";
2
3
  import { Node } from "../types";
3
- interface Props extends React.ComponentPropsWithoutRef<"nav"> {
4
+ interface Props extends Omit<React.ComponentPropsWithoutRef<"nav">, "className" | "style"> {
5
+ sx: stylex.StyleXStyles;
4
6
  toc: readonly Node[];
5
7
  search?: {
6
8
  open: () => void;
package/core/index.js CHANGED
@@ -56,18 +56,7 @@ function Footer(props, ref) {
56
56
  })]
57
57
  });
58
58
  }
59
- var Footer$1 = /*#__PURE__*/React.forwardRef(Footer);
60
-
61
- function cx(...args) {
62
- let str = "";
63
- for (let i = 0; i < args.length; i++) {
64
- const arg = args[i];
65
- if (typeof arg === "string") {
66
- str += (str && " ") + arg;
67
- }
68
- }
69
- return str;
70
- }
59
+ var Footer_default = /*#__PURE__*/React.forwardRef(Footer);
71
60
 
72
61
  var styleq = {};
73
62
  var hasRequiredStyleq;
@@ -258,17 +247,9 @@ function Action(props) {
258
247
  label,
259
248
  ...rest
260
249
  } = props;
261
- const rootStyleProps = {
262
- className: "timvir-s-jbqb8w timvir-s-vc674v timvir-s-uxw1ft timvir-s-78zum5 timvir-s-6s0dn4 timvir-s-17zmd2n timvir-s-wvwv9b timvir-s-1q0g3np timvir-s-1iyjqo2 timvir-s-s83m0k timvir-s-dl72j9 timvir-s-b3r6kr timvir-s-qin4a2 timvir-s-cym7qx timvir-s-t0e3qv timvir-s-1d6mti2"
263
- };
264
250
  return /*#__PURE__*/jsxs(Root$2, {
265
251
  ...rest,
266
- ...rootStyleProps,
267
- className: cx(rest.className, rootStyleProps.className),
268
- style: {
269
- ...rootStyleProps.style,
270
- ...rest.style
271
- },
252
+ className: "timvir-s-jbqb8w timvir-s-vc674v timvir-s-uxw1ft timvir-s-78zum5 timvir-s-6s0dn4 timvir-s-17zmd2n timvir-s-wvwv9b timvir-s-1q0g3np timvir-s-1iyjqo2 timvir-s-s83m0k timvir-s-dl72j9 timvir-s-b3r6kr timvir-s-qin4a2 timvir-s-cym7qx timvir-s-t0e3qv timvir-s-1d6mti2",
272
253
  children: [/*#__PURE__*/jsx("div", {
273
254
  className: "timvir-s-1wsuqlk timvir-s-1kky2od",
274
255
  children: /*#__PURE__*/jsxs("svg", {
@@ -681,7 +662,7 @@ function Section(props) {
681
662
  });
682
663
  }
683
664
 
684
- function Sidebar(props) {
665
+ function Sidebar(props$1) {
685
666
  const {
686
667
  location
687
668
  } = useContext();
@@ -703,7 +684,7 @@ function Sidebar(props) {
703
684
  toc,
704
685
  search,
705
686
  ...rest
706
- } = props;
687
+ } = props$1;
707
688
  const node = function find(nodes) {
708
689
  for (const node of nodes) {
709
690
  if (location.asPath.replace(/#.*$/, "") === node.path) {
@@ -717,13 +698,9 @@ function Sidebar(props) {
717
698
  }
718
699
  }
719
700
  }(toc);
720
- const rootStyleProps = {
721
- className: "timvir-s-78zum5 timvir-s-dt5ytf timvir-s-1fsrbvp"
722
- };
723
701
  return /*#__PURE__*/jsxs("nav", {
724
702
  ...rest,
725
- ...rootStyleProps,
726
- className: cx(rest.className, rootStyleProps.className),
703
+ ...props(props$1.sx, styles$1.root),
727
704
  children: [/*#__PURE__*/jsxs("header", {
728
705
  className: "timvir-s-7uxsod timvir-s-1pizb70 timvir-s-78zum5 timvir-s-6s0dn4 timvir-s-1d813ht timvir-s-1m2nq6k timvir-s-1vptubt",
729
706
  children: [/*#__PURE__*/jsxs("div", {
@@ -782,6 +759,14 @@ function Sidebar(props) {
782
759
  })]
783
760
  });
784
761
  }
762
+ const styles$1 = {
763
+ root: {
764
+ k1xSpc: "timvir-s-78zum5",
765
+ kXwgrk: "timvir-s-dt5ytf",
766
+ kHSMxh: "timvir-s-1fsrbvp",
767
+ $$css: true
768
+ }
769
+ };
785
770
  function Search(props) {
786
771
  const {
787
772
  open,
@@ -871,22 +856,14 @@ function Page(props$1, ref) {
871
856
  }, {
872
857
  enableOnFormTags: true
873
858
  });
874
- const rootStyleProps = {
875
- className: "timvir-s-g6iff7 timvir-s-1hz7z82 timvir-s-rvj5dj timvir-s-c0s83b timvir-s-1i3za4p timvir-s-oxwh6b timvir-s-1w3eerp"
876
- };
877
859
  return /*#__PURE__*/jsxs(Provider, {
878
860
  value: context,
879
861
  children: [/*#__PURE__*/jsxs(Root, {
880
862
  ref: ref,
881
863
  ...rest,
882
- ...rootStyleProps,
883
- className: cx(rest.className, rootStyleProps.className),
884
- style: {
885
- ...rest.style,
886
- ...rootStyleProps.style
887
- },
864
+ className: "timvir-s-g6iff7 timvir-s-1hz7z82 timvir-s-rvj5dj timvir-s-c0s83b timvir-s-1i3za4p timvir-s-oxwh6b timvir-s-1w3eerp",
888
865
  children: [/*#__PURE__*/jsx(Sidebar, {
889
- className: "timvir-s-1nkj2r4 timvir-s-13tdkmf timvir-s-1b7vwdu timvir-s-7wzq59 timvir-s-13vifvy timvir-s-1b3g1kt timvir-s-1uk07ai timvir-s-bvzrs5 timvir-s-1i1dbpq timvir-s-zfhgub timvir-s-3f8au3",
866
+ sx: styles.sidebar,
890
867
  toc: toc,
891
868
  search: search && {
892
869
  open: () => {
@@ -960,8 +937,22 @@ function Page(props$1, ref) {
960
937
  })]
961
938
  });
962
939
  }
963
- var Page$1 = /*#__PURE__*/React.forwardRef(Page);
940
+ var Page_default = /*#__PURE__*/React.forwardRef(Page);
964
941
  const styles = {
942
+ sidebar: {
943
+ kJuA4N: "timvir-s-1nkj2r4",
944
+ kY2c9j: "timvir-s-13tdkmf",
945
+ kWkggS: "timvir-s-1b7vwdu",
946
+ kVAEAm: "timvir-s-7wzq59",
947
+ k87sOh: "timvir-s-13vifvy",
948
+ kZ9C5d: "timvir-s-1b3g1kt",
949
+ kYjXgR: "timvir-s-1uk07ai",
950
+ kY6lvZ: "timvir-s-bvzrs5",
951
+ kTTLU8: "timvir-s-1i1dbpq",
952
+ kMbnel: "timvir-s-zfhgub",
953
+ kg8xMQ: "timvir-s-3f8au3",
954
+ $$css: true
955
+ },
965
956
  content: {
966
957
  kTgw9: "timvir-s-13faqbe",
967
958
  $$css: true
@@ -1037,4 +1028,4 @@ function useArticleComponents() {
1037
1028
  };
1038
1029
  }
1039
1030
 
1040
- export { Footer$1 as Footer, Page$1 as Page, extendedWidth, fullWidth, grid, layoutStyles, noLayout, useArticleComponents, useBlock, useMailbox };
1031
+ export { Footer_default as Footer, Page_default as Page, extendedWidth, fullWidth, grid, layoutStyles, noLayout, useArticleComponents, useBlock, useMailbox };
package/global.css CHANGED
@@ -45,14 +45,14 @@
45
45
  * Temporary kludge to enable light/dark support in Code blocks. To be
46
46
  * removed once theming is implemented properly.
47
47
  */
48
- .timvir-b-Code .shiki span {
48
+ [data-timvir-b-Code] .shiki span {
49
49
  color: var(--timvir-b-Code-shiki-light);
50
50
  font-style: var(--timvir-b-Code-shiki-light-font-style);
51
51
  font-weight: var(--timvir-b-Code-shiki-light-font-weight);
52
52
  text-decoration: var(--timvir-b-Code-shiki-light-text-decoration);
53
53
  }
54
54
 
55
- :root[data-timvir-theme="dark"] .timvir-b-Code .shiki span {
55
+ :root[data-timvir-theme="dark"] [data-timvir-b-Code] .shiki span {
56
56
  color: var(--timvir-b-Code-shiki-dark);
57
57
  font-style: var(--timvir-b-Code-shiki-dark-font-style);
58
58
  font-weight: var(--timvir-b-Code-shiki-dark-font-weight);
@@ -33,24 +33,3 @@ export declare function useResizeObserverEntries<T extends Element>(): readonly
33
33
  * > <div ref={ref}>{entry?.contentRect.width}</div>
34
34
  */
35
35
  export declare function useResizeObserverEntry<T extends Element>(): readonly [(el: T | null) => void, ResizeObserverEntry | undefined];
36
- interface ResizeObserver {
37
- observe(target: Element): void;
38
- unobserve(target: Element): void;
39
- disconnect(): void;
40
- }
41
- interface ResizeObserverSize {
42
- inlineSize: number;
43
- blockSize: number;
44
- }
45
- interface ResizeObserverEntry {
46
- readonly target: Element;
47
- readonly contentRect: DOMRectReadOnly;
48
- readonly borderBoxSize: ResizeObserverSize;
49
- readonly contentBoxSize: ResizeObserverSize;
50
- }
51
- type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void;
52
- declare const ResizeObserver: {
53
- prototype: ResizeObserver;
54
- new (callback: ResizeObserverCallback): ResizeObserver;
55
- };
56
- export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.2.44",
4
+ "version": "0.2.45",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
package/search/index.js CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  function Search(_props, _ref) {
4
4
  return null;
5
5
  }
6
- var Search$1 = /*#__PURE__*/React.forwardRef(Search);
6
+ var Search_default = /*#__PURE__*/React.forwardRef(Search);
7
7
  function defaultSearch(toc) {
8
8
  return {
9
9
  q: async query => {
@@ -41,4 +41,4 @@ function flatten(n) {
41
41
  return ret;
42
42
  }
43
43
 
44
- export { Search$1 as Search, defaultSearch };
44
+ export { Search_default as Search, defaultSearch };
package/styles.css CHANGED
@@ -45,14 +45,14 @@
45
45
  * Temporary kludge to enable light/dark support in Code blocks. To be
46
46
  * removed once theming is implemented properly.
47
47
  */
48
- .timvir-b-Code .shiki span {
48
+ [data-timvir-b-Code] .shiki span {
49
49
  color: var(--timvir-b-Code-shiki-light);
50
50
  font-style: var(--timvir-b-Code-shiki-light-font-style);
51
51
  font-weight: var(--timvir-b-Code-shiki-light-font-weight);
52
52
  text-decoration: var(--timvir-b-Code-shiki-light-text-decoration);
53
53
  }
54
54
 
55
- :root[data-timvir-theme="dark"] .timvir-b-Code .shiki span {
55
+ :root[data-timvir-theme="dark"] [data-timvir-b-Code] .shiki span {
56
56
  color: var(--timvir-b-Code-shiki-dark);
57
57
  font-style: var(--timvir-b-Code-shiki-dark-font-style);
58
58
  font-weight: var(--timvir-b-Code-shiki-dark-font-weight);
@@ -1491,8 +1491,8 @@ body {
1491
1491
  }
1492
1492
  }
1493
1493
  @layer priority1 {
1494
- .timvir-s-15o1dgp {
1495
- --timvir-b-Code-bleed: calc(var(--timvir-margin, 0) * .6666);
1494
+ .timvir-s-i27niw {
1495
+ --timvir-b-Code-bleed: calc(var(--timvir-margin, 0px) * .6666);
1496
1496
  }
1497
1497
 
1498
1498
  .timvir-s-idmeni {
@@ -2689,6 +2689,10 @@ body {
2689
2689
  display: grid;
2690
2690
  }
2691
2691
 
2692
+ .timvir-s-1iyjqo2 {
2693
+ flex-grow: 1;
2694
+ }
2695
+
2692
2696
  .timvir-s-kpwil5 {
2693
2697
  font-size: .875rem;
2694
2698
  }