timvir 0.2.39 → 0.2.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/blocks/Arbitrary/Arbitrary.d.ts +1 -1
  3. package/blocks/Arbitrary/index.js +193 -48
  4. package/blocks/Arbitrary/styles.css +166 -6
  5. package/blocks/Code/Code.d.ts +0 -6
  6. package/blocks/Code/docs/index.mdx +0 -11
  7. package/blocks/Code/index.js +205 -112
  8. package/blocks/Code/styles.css +100 -15
  9. package/blocks/ColorBar/docs/index.mdx +8 -2
  10. package/blocks/ColorBar/index.js +198 -47
  11. package/blocks/ColorBar/styles.css +103 -4
  12. package/blocks/ColorBook/docs/index.mdx +1 -1
  13. package/blocks/ColorBook/index.js +198 -39
  14. package/blocks/ColorBook/styles.css +166 -6
  15. package/blocks/Cover/index.js +165 -36
  16. package/blocks/Cover/styles.css +18 -0
  17. package/blocks/Exhibit/index.js +192 -41
  18. package/blocks/Exhibit/styles.css +66 -3
  19. package/blocks/Font/index.js +188 -58
  20. package/blocks/Font/styles.css +82 -8
  21. package/blocks/Grid/docs/index.mdx +4 -4
  22. package/blocks/Grid/index.js +176 -33
  23. package/blocks/Grid/styles.css +20 -1
  24. package/blocks/Icon/docs/index.mdx +13 -13
  25. package/blocks/Icon/index.js +25 -43
  26. package/blocks/Icon/styles.css +117 -5
  27. package/blocks/Message/docs/index.mdx +5 -8
  28. package/blocks/Message/index.js +233 -54
  29. package/blocks/Message/styles.css +94 -6
  30. package/blocks/Swatch/docs/index.mdx +16 -16
  31. package/blocks/Swatch/index.js +180 -35
  32. package/blocks/Swatch/styles.css +82 -4
  33. package/blocks/Viewport/index.js +198 -91
  34. package/blocks/Viewport/styles.css +259 -14
  35. package/blocks/WebLink/index.js +192 -48
  36. package/blocks/WebLink/styles.css +170 -8
  37. package/blocks/styles.css +1460 -97
  38. package/builtins/components.d.ts +2 -2
  39. package/builtins/index.d.ts +0 -1
  40. package/builtins/index.js +300 -243
  41. package/builtins/styles.css +265 -25
  42. package/context/index.d.ts +6 -1
  43. package/core/components/Commands/Commands.d.ts +5 -1
  44. package/core/components/NavigationFooter/NavigationFooter.d.ts +4 -2
  45. package/core/components/Page/Page.d.ts +12 -3
  46. package/core/components/Page/docs/index.mdx +44 -11
  47. package/core/index.d.ts +191 -2
  48. package/core/index.js +415 -256
  49. package/core/layout.d.ts +41 -0
  50. package/core/styles.css +857 -88
  51. package/global.css +79 -0
  52. package/internal/cx.d.ts +1 -0
  53. package/package.json +1 -2
  54. package/search/index.js +2 -223
  55. package/styles.css +2670 -235
  56. package/blocks/Code/theme.d.ts +0 -2
  57. package/bus/styles.css +0 -1
  58. package/context/styles.css +0 -1
  59. package/core/theme/index.d.ts +0 -1
  60. package/hooks/styles.css +0 -1
  61. package/search/Search/internal/Dialog.d.ts +0 -20
  62. package/search/Search/internal/index.d.ts +0 -1
  63. package/search/SearchBoxInput/SearchBoxInput.d.ts +0 -11
  64. package/search/SearchBoxInput/docs/api.mdx +0 -76
  65. package/search/SearchBoxInput/docs/index.mdx +0 -6
  66. package/search/SearchBoxInput/index.d.ts +0 -1
  67. package/search/SearchBoxInput/samples/basic.d.ts +0 -1
  68. package/search/SearchBoxListItem/SearchBoxListItem.d.ts +0 -13
  69. package/search/SearchBoxListItem/docs/api.mdx +0 -76
  70. package/search/SearchBoxListItem/docs/index.mdx +0 -30
  71. package/search/SearchBoxListItem/index.d.ts +0 -1
  72. package/search/SearchBoxListItem/samples/basic.d.ts +0 -1
  73. package/search/styles.css +0 -16
package/global.css ADDED
@@ -0,0 +1,79 @@
1
+ :root {
2
+ box-sizing: border-box;
3
+ scroll-padding-top: 20px;
4
+ }
5
+
6
+ *,
7
+ *:before,
8
+ *:after {
9
+ box-sizing: inherit;
10
+ }
11
+
12
+ :root {
13
+ --timvir-background-color: #ffffff;
14
+ --timvir-text-color: #000000c9;
15
+ --timvir-secondary-text-color: #00000066;
16
+ --timvir-secondary-background-color: #f9f8f9;
17
+
18
+ --timvir-border-color: #e9e8ea;
19
+
20
+ --timvir-sidebar-highlight-color: rgb(237, 237, 237);
21
+
22
+ --timvir-accent-color: #38a585;
23
+
24
+ --timvir-background-pattern: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAHElEQVR4AWP4/u07Mvr75y8yGlBpND6a6oGUBgAxMSSkDKa/pQAAAABJRU5ErkJggg==);
25
+ --timvir-highlight-background-color: #ffe10044;
26
+ }
27
+
28
+ :root[data-timvir-theme="dark"] {
29
+ --timvir-background-color: #1f2023;
30
+ --timvir-text-color: rgba(255 255 255 / 0.86);
31
+ --timvir-secondary-text-color: rgba(255 255 255 / 0.56);
32
+ --timvir-secondary-background-color: #161618;
33
+
34
+ --timvir-border-color: #27292f;
35
+
36
+ --timvir-sidebar-highlight-color: rgb(41, 43, 47);
37
+
38
+ --timvir-accent-color: #38a585;
39
+
40
+ --timvir-background-pattern: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAAFklEQVQI12NQBQF2EGAghQkmwXxSmADZJQiZ2ZZ46gAAAABJRU5ErkJggg==);
41
+ --timvir-highlight-background-color: rgba(174, 124, 20, 0.15);
42
+ }
43
+
44
+ /*
45
+ * Temporary kludge to enable light/dark support in Code blocks. To be
46
+ * removed once theming is implemented properly.
47
+ */
48
+ .timvir-b-Code .shiki span {
49
+ color: var(--timvir-b-Code-shiki-light);
50
+ font-style: var(--timvir-b-Code-shiki-light-font-style);
51
+ font-weight: var(--timvir-b-Code-shiki-light-font-weight);
52
+ text-decoration: var(--timvir-b-Code-shiki-light-text-decoration);
53
+ }
54
+
55
+ :root[data-timvir-theme="dark"] .timvir-b-Code .shiki span {
56
+ color: var(--timvir-b-Code-shiki-dark);
57
+ font-style: var(--timvir-b-Code-shiki-dark-font-style);
58
+ font-weight: var(--timvir-b-Code-shiki-dark-font-weight);
59
+ text-decoration: var(--timvir-b-Code-shiki-dark-text-decoration);
60
+ }
61
+
62
+ body {
63
+ font-family: system-ui, sans-serif;
64
+ font-feature-settings: "liga", "kern";
65
+ text-rendering: optimizelegibility;
66
+
67
+ font-size: 0.9375rem;
68
+ line-height: 1.7333;
69
+
70
+ background-color: var(--timvir-background-color);
71
+ color: var(--timvir-text-color);
72
+
73
+ --c-p-0: #f0fcf6;
74
+ --c-p-1: #d1f6e4;
75
+ --c-p-2: #a0dbc1;
76
+ --c-p-3: #61c19f;
77
+ --c-p-4: #38a585;
78
+ --c-p-5: #1b896b;
79
+ }
@@ -0,0 +1 @@
1
+ export declare function cx(...args: Array<null | undefined | boolean | string>): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.2.39",
4
+ "version": "0.2.42",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -23,7 +23,6 @@
23
23
  "wonka": "^6"
24
24
  },
25
25
  "peerDependencies": {
26
- "@mdx-js/react": "^2 || ^3",
27
26
  "react": "^17 || ^18 || ^19",
28
27
  "react-dom": "^17 || ^18 || ^19",
29
28
  "react-hotkeys-hook": "^4 || ^5"
package/search/index.js CHANGED
@@ -1,228 +1,7 @@
1
1
  import * as React from 'react';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { useContext } from 'timvir/core';
4
- import { useCombobox } from 'downshift';
5
2
 
6
- // src/css.ts
7
-
8
- // src/cx.ts
9
- var cx = function cx2() {
10
- const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
11
- const atomicClasses = {};
12
- const nonAtomicClasses = [];
13
- presentClassNames.forEach((arg) => {
14
- const individualClassNames = arg ? arg.split(" ") : [];
15
- individualClassNames.forEach((className) => {
16
- if (className.startsWith("atm_")) {
17
- const [, keyHash] = className.split("_");
18
- atomicClasses[keyHash] = className;
19
- } else {
20
- nonAtomicClasses.push(className);
21
- }
22
- });
23
- });
24
- const result = [];
25
- for (const keyHash in atomicClasses) {
26
- if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
27
- result.push(atomicClasses[keyHash]);
28
- }
29
- }
30
- result.push(...nonAtomicClasses);
31
- return result.join(" ");
32
- };
33
- var cx_default = cx;
34
-
35
- /**
36
- * The underlying DOM element which is rendered by this component.
37
- */
38
- const Root$2 = "div";
39
- function SearchBoxInput(props, ref) {
40
- const {
41
- value,
42
- onChange,
43
- ...rest
44
- } = props;
45
- return /*#__PURE__*/jsxs(Root$2, {
46
- ref: ref,
47
- className: "r710k81",
48
- ...rest,
49
- children: [/*#__PURE__*/jsx("svg", {
50
- viewBox: "0 0 17 17",
51
- className: "s1sjvm51",
52
- children: /*#__PURE__*/jsx("path", {
53
- d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z"
54
- })
55
- }), /*#__PURE__*/jsx("input", {
56
- autoFocus: true,
57
- value: value,
58
- onChange: onChange,
59
- className: "i1f3edco"
60
- })]
61
- });
62
- }
63
- var SearchBoxInput$1 = /*#__PURE__*/React.forwardRef(SearchBoxInput);
64
-
65
- /**
66
- * The underlying DOM element which is rendered by this component.
67
- */
68
- const Root$1 = "a";
69
- function SearchBoxListItem(props, ref) {
70
- const {
71
- as,
72
- icon,
73
- label,
74
- context,
75
- ...rest
76
- } = props;
77
- const Component = as ?? Root$1;
78
- return /*#__PURE__*/jsxs(Component, {
79
- role: "button",
80
- ref: ref,
81
- className: "c8yc6y",
82
- ...rest,
83
- children: [/*#__PURE__*/jsx("div", {
84
- className: "dqzmx2q",
85
- children: icon
86
- }), /*#__PURE__*/jsxs("div", {
87
- className: "dp5wq1v",
88
- children: [/*#__PURE__*/jsx("div", {
89
- children: label
90
- }), context && /*#__PURE__*/jsx("div", {
91
- className: "du5k8uq",
92
- children: context
93
- })]
94
- })]
95
- });
96
- }
97
- var SearchBoxListItem$1 = /*#__PURE__*/React.forwardRef(SearchBoxListItem);
98
-
99
- /**
100
- * The underlying DOM element which is rendered by this component.
101
- */
102
- const Root = "div";
103
- function Dialog(props, ref) {
104
- const {
105
- onClose,
106
- q,
107
- className,
108
- ...rest
109
- } = props;
110
- const {
111
- location,
112
- Link
113
- } = useContext();
114
- const [value, setValue] = React.useState("");
115
- const [result, setResult] = React.useState(undefined);
116
- React.useEffect(() => {
117
- q(value).then(result => {
118
- setResult(result);
119
- });
120
- }, [value, q]);
121
- const items = result?.edges ?? [];
122
- const {
123
- getMenuProps,
124
- getInputProps,
125
- /* highlightedIndex, */getItemProps,
126
- closeMenu
127
- } = useCombobox({
128
- defaultHighlightedIndex: 0,
129
- items,
130
- itemToString: item => item ? item.node.label : "",
131
- onInputValueChange: ({
132
- inputValue
133
- }) => {
134
- setValue(inputValue ?? "");
135
- },
136
- onSelectedItemChange: ({
137
- selectedItem
138
- }) => {
139
- if (selectedItem) {
140
- location.push(selectedItem.node.path);
141
- }
142
- closeMenu();
143
- }
144
- });
145
- return /*#__PURE__*/jsx(Root, {
146
- ref: ref,
147
- ...rest,
148
- className: cx_default(className, "r5ea8qd"),
149
- children: /*#__PURE__*/jsx("div", {
150
- className: "dp0smwa",
151
- children: /*#__PURE__*/jsxs("div", {
152
- className: "d1a28btb",
153
- children: [/*#__PURE__*/jsx("div", {
154
- className: "d1c5pom9",
155
- onClick: onClose
156
- }), /*#__PURE__*/jsxs("div", {
157
- className: "djje8s3",
158
- children: [/*#__PURE__*/jsx(SearchBoxInput$1, {
159
- ...getInputProps()
160
- }), /*#__PURE__*/jsx("main", {
161
- ...getMenuProps(),
162
- className: "m1mgb53c",
163
- children: items.map((item, index) => /*#__PURE__*/jsx(SearchBoxListItem$1, {
164
- as: Link,
165
- href: item.node.path,
166
- ...getItemProps({
167
- item,
168
- index,
169
- onClick: onClose
170
- }),
171
- icon: /*#__PURE__*/jsx("svg", {
172
- x: "0px",
173
- y: "0px",
174
- width: "16px",
175
- height: "16px",
176
- viewBox: "0 0 16 16",
177
- children: /*#__PURE__*/jsxs("g", {
178
- fill: "none",
179
- stroke: "#444",
180
- strokeLinecap: "round",
181
- strokeLinejoin: "round",
182
- strokeMiterlimit: 10,
183
- children: [/*#__PURE__*/jsx("path", {
184
- "data-color": "color-2",
185
- d: "M4.5 11.5L11.5 11.5"
186
- }), /*#__PURE__*/jsx("path", {
187
- "data-color": "color-2",
188
- d: "M4.5 8.5L11.5 8.5"
189
- }), /*#__PURE__*/jsx("path", {
190
- "data-color": "color-2",
191
- d: "M4.5 5.5L6.5 5.5"
192
- }), /*#__PURE__*/jsx("path", {
193
- d: "M9.5 0.5L1.5 0.5 1.5 15.5 14.5 15.5 14.5 5.5z"
194
- }), /*#__PURE__*/jsx("path", {
195
- d: "M9.5 0.5L9.5 5.5 14.5 5.5"
196
- })]
197
- })
198
- }),
199
- label: item.node.path,
200
- context: item.node.context,
201
- style: {
202
- // background: highlightedIndex === index ? "rgba(0, 0, 0, 0.05)" : undefined,
203
- }
204
- }, index))
205
- })]
206
- })]
207
- })
208
- })
209
- });
210
- }
211
- var Dialog$1 = /*#__PURE__*/React.forwardRef(Dialog);
212
-
213
- function Search(props, ref) {
214
- const {
215
- open,
216
- ...rest
217
- } = props;
218
- if (!open) {
219
- return null;
220
- } else {
221
- return /*#__PURE__*/jsx(Dialog$1, {
222
- ref: ref,
223
- ...rest
224
- });
225
- }
3
+ function Search(_props, _ref) {
4
+ return null;
226
5
  }
227
6
  var Search$1 = /*#__PURE__*/React.forwardRef(Search);
228
7
  function defaultSearch(toc) {