timvir 0.2.48 → 0.2.50
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/blocks/Arbitrary/samples/basic.d.ts +1 -1
- package/blocks/Code/index.js +21 -6
- package/blocks/Code/samples/basic.d.ts +1 -1
- package/blocks/ColorBar/index.js +1 -1
- package/blocks/ColorBar/styles.css +2 -2
- package/blocks/Exhibit/samples/bleed.d.ts +1 -1
- package/blocks/Font/index.js +3 -0
- package/blocks/Font/samples/basic.d.ts +1 -1
- package/blocks/Font/samples/timvir/body1.d.ts +1 -1
- package/blocks/Font/samples/timvir/caption.d.ts +1 -1
- package/blocks/Font/samples/timvir/h1.d.ts +1 -1
- package/blocks/Font/samples/timvir/h2.d.ts +1 -1
- package/blocks/Font/samples/timvir/h3.d.ts +1 -1
- package/blocks/Font/samples/timvir/h4.d.ts +1 -1
- package/blocks/Icon/Icon.d.ts +1 -1
- package/blocks/Icon/internal/Canvas.d.ts +1 -1
- package/blocks/Message/samples/basic.d.ts +1 -1
- package/blocks/Viewport/index.js +8 -2
- package/blocks/WebLink/index.js +1 -1
- package/blocks/WebLink/samples/basic.d.ts +1 -1
- package/blocks/styles.css +2 -2
- package/bus/index.d.ts +2 -2
- package/context/index.d.ts +2 -2
- package/core/components/Commands/internal/Action.d.ts +1 -1
- package/core/components/Footer/samples/basic.d.ts +1 -1
- package/core/components/NavigationFooter/NavigationFooter.d.ts +2 -2
- package/core/components/NavigationFooter/samples/basic.d.ts +1 -1
- package/core/components/Page/Page.d.ts +2 -2
- package/core/components/Page/internal/Section.d.ts +1 -1
- package/core/components/Page/internal/Sidebar.d.ts +1 -1
- package/core/components/Page/internal/SidebarItem.d.ts +1 -1
- package/core/components/Page/types.d.ts +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.js +49 -14
- package/package.json +34 -11
- package/search/Search/Search.d.ts +1 -1
- package/styles.css +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# timvir
|
|
2
2
|
|
|
3
|
+
## 0.2.50
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **Add explicit types and import conditions to exports** ([#3708](https://github.com/timvir/timvir/pull/3708)) - This improves TypeScript IntelliSense and module resolution for modern build tools.
|
|
8
|
+
|
|
9
|
+
## 0.2.49
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- **Remove dependency on react-hotkeys-hook** ([#3660](https://github.com/timvir/timvir/pull/3660)) - Timvir has only relied on a small part of the full capability of react-hotkeys-hook. It was easy enough to re-implement the necessary functionality and drop the dependency.
|
|
14
|
+
|
|
3
15
|
## 0.2.48
|
|
4
16
|
|
|
5
17
|
## 0.2.47
|
package/blocks/Code/index.js
CHANGED
|
@@ -196,18 +196,33 @@ function Code(props$1, ref) {
|
|
|
196
196
|
const stylexTransformer = {
|
|
197
197
|
name: "stylex",
|
|
198
198
|
pre(node) {
|
|
199
|
-
|
|
199
|
+
const {
|
|
200
|
+
className
|
|
201
|
+
} = {
|
|
200
202
|
className: "timvir-s-1lliihq timvir-s-1ghz6dp timvir-s-1g8o3q3 timvir-s-1d0dlzq"
|
|
201
|
-
}
|
|
203
|
+
};
|
|
204
|
+
{
|
|
205
|
+
this.addClassToHast(node, className);
|
|
206
|
+
}
|
|
202
207
|
},
|
|
203
208
|
line(node, index) {
|
|
204
|
-
|
|
209
|
+
const {
|
|
210
|
+
className
|
|
211
|
+
} = {
|
|
205
212
|
className: "timvir-s-1rg5ohu timvir-s-h8yej3 timvir-s-e193im"
|
|
206
|
-
}
|
|
213
|
+
};
|
|
214
|
+
{
|
|
215
|
+
this.addClassToHast(node, className);
|
|
216
|
+
}
|
|
207
217
|
if (highlightedLines?.includes(index)) {
|
|
208
|
-
|
|
218
|
+
const {
|
|
219
|
+
className
|
|
220
|
+
} = {
|
|
209
221
|
className: "timvir-s-15fpjw5"
|
|
210
|
-
}
|
|
222
|
+
};
|
|
223
|
+
{
|
|
224
|
+
this.addClassToHast(node, className);
|
|
225
|
+
}
|
|
211
226
|
}
|
|
212
227
|
}
|
|
213
228
|
};
|
package/blocks/ColorBar/index.js
CHANGED
|
@@ -198,7 +198,7 @@ function ColorBar(props$1, ref) {
|
|
|
198
198
|
opacity: selected ? 0 : 1
|
|
199
199
|
},
|
|
200
200
|
children: values.map((value, i, self) => /*#__PURE__*/jsx("div", {
|
|
201
|
-
className: "timvir-s-1vqgdyp timvir-s-1iyjqo2 timvir-s-rvj5dj timvir-s-13b6k1y timvir-s-1ypdohk timvir-s-zkaem6 timvir-s-
|
|
201
|
+
className: "timvir-s-1vqgdyp timvir-s-1iyjqo2 timvir-s-rvj5dj timvir-s-13b6k1y timvir-s-1ypdohk timvir-s-zkaem6 timvir-s-12l46wj timvir-s-inzabm timvir-s-1bxid8z",
|
|
202
202
|
children: /*#__PURE__*/jsx("div", {
|
|
203
203
|
...props(i === 0 ? styles.firstChild : null, i === self.length - 1 ? styles.lastChild : null, styles.valueInner),
|
|
204
204
|
style: {
|
package/blocks/Font/index.js
CHANGED
|
@@ -250,6 +250,9 @@ function Font(props$1, ref) {
|
|
|
250
250
|
onClick: () => {
|
|
251
251
|
if (infoRef && contentRef) {
|
|
252
252
|
const infoParent = infoRef.parentElement;
|
|
253
|
+
if (!infoParent) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
253
256
|
if (infoParent.style.height === "0px") {
|
|
254
257
|
infoParent.style.height = `${infoRef.getBoundingClientRect().height}px`;
|
|
255
258
|
infoParent.style.opacity = "1";
|
package/blocks/Icon/Icon.d.ts
CHANGED
package/blocks/Viewport/index.js
CHANGED
|
@@ -217,6 +217,9 @@ function Caption(props$1) {
|
|
|
217
217
|
onClick: () => {
|
|
218
218
|
if (codeRef) {
|
|
219
219
|
const infoParent = codeRef.parentElement;
|
|
220
|
+
if (!infoParent) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
220
223
|
if (infoParent.style.height === "0px") {
|
|
221
224
|
infoParent.style.height = `${codeRef.getBoundingClientRect().height}px`;
|
|
222
225
|
infoParent.style.opacity = "1";
|
|
@@ -365,8 +368,11 @@ function Viewport(props$1, ref) {
|
|
|
365
368
|
};
|
|
366
369
|
const onMouseUp = () => {
|
|
367
370
|
lock.current = "";
|
|
368
|
-
iframeRef.current
|
|
369
|
-
|
|
371
|
+
const iframeElement = iframeRef.current;
|
|
372
|
+
if (iframeElement) {
|
|
373
|
+
iframeElement.style.userSelect = "";
|
|
374
|
+
iframeElement.style.pointerEvents = "";
|
|
375
|
+
}
|
|
370
376
|
setHeight(height => {
|
|
371
377
|
setMaxHeight(height);
|
|
372
378
|
return height;
|
package/blocks/WebLink/index.js
CHANGED
|
@@ -262,7 +262,7 @@ const styles = {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
async function defaultUnfurl(url) {
|
|
265
|
-
return fetch(`https://timvir.
|
|
265
|
+
return fetch(`https://timvir.dev/api/unfurl?url=${encodeURIComponent(url)}`).then(res => res.json());
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
export { WebLink_default as WebLink };
|
package/blocks/styles.css
CHANGED
package/bus/index.d.ts
CHANGED
package/context/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Bus } from "timvir/bus";
|
|
3
|
-
import { Node } from "../core/components/Page/types";
|
|
2
|
+
import type { Bus } from "timvir/bus";
|
|
3
|
+
import type { Node } from "../core/components/Page/types";
|
|
4
4
|
export interface Value {
|
|
5
5
|
bus: Bus;
|
|
6
6
|
articleComponents: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import type * as React from "react";
|
|
2
2
|
import { NavigationFooter } from "..";
|
|
3
3
|
type Props = Partial<React.ComponentPropsWithoutRef<typeof NavigationFooter>>;
|
|
4
4
|
export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Value } from "timvir/context";
|
|
3
|
-
import { Node } from "./types";
|
|
2
|
+
import { type Value } from "timvir/context";
|
|
3
|
+
import type { Node } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* The underlying DOM element which is rendered by this component.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as stylex from "@stylexjs/stylex";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Node } from "../types";
|
|
3
|
+
import type { Node } from "../types";
|
|
4
4
|
interface Props extends Omit<React.ComponentPropsWithoutRef<"nav">, "className" | "style"> {
|
|
5
5
|
sx: stylex.StyleXStyles;
|
|
6
6
|
toc: readonly Node[];
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { pipe,
|
|
2
|
+
import { pipe, subscribe, filter } from 'wonka';
|
|
3
3
|
import { useContext, Provider } from 'timvir/context';
|
|
4
4
|
export { useContext } from 'timvir/context';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import * as builtins from 'timvir/builtins';
|
|
7
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { useHotkeys } from 'react-hotkeys-hook';
|
|
9
8
|
import { makeBus } from 'timvir/bus';
|
|
10
9
|
import * as ReactDOM from 'react-dom';
|
|
11
10
|
import { defaultSearch } from 'timvir/search';
|
|
@@ -48,7 +47,7 @@ function Footer(props, ref) {
|
|
|
48
47
|
children: /*#__PURE__*/jsxs("div", {
|
|
49
48
|
className: "timvir-s-htle6 timvir-s-euugli",
|
|
50
49
|
children: ["Built with", " ", /*#__PURE__*/jsx("a", {
|
|
51
|
-
href: "https://timvir.
|
|
50
|
+
href: "https://timvir.dev",
|
|
52
51
|
className: "timvir-s-1heor9g timvir-s-1hl2dhg timvir-s-1dlxito timvir-s-1j43nte timvir-s-odwsf6 timvir-s-1w3jsh0 timvir-s-g7t5vw",
|
|
53
52
|
children: "Timvir"
|
|
54
53
|
})]
|
|
@@ -668,9 +667,10 @@ function Sidebar(props$1) {
|
|
|
668
667
|
} = useContext();
|
|
669
668
|
const [isMenuOpen, setMenuOpen] = React.useState(false);
|
|
670
669
|
React.useEffect(() => {
|
|
671
|
-
const
|
|
670
|
+
const className = {
|
|
672
671
|
className: "timvir-s-1rife3k timvir-s-ixxii4 timvir-s-13vifvy timvir-s-h8yej3"
|
|
673
|
-
}.className
|
|
672
|
+
}.className;
|
|
673
|
+
const scrollLockClassList = className.split(" ");
|
|
674
674
|
for (const className of scrollLockClassList) {
|
|
675
675
|
document.body.classList.toggle(className, isMenuOpen);
|
|
676
676
|
}
|
|
@@ -824,27 +824,31 @@ function Page(props$1, ref) {
|
|
|
824
824
|
blocks,
|
|
825
825
|
toc
|
|
826
826
|
}), [bus, mdxComponents, location, Link, blocks, toc]);
|
|
827
|
-
useHotkeys(
|
|
827
|
+
useHotkeys({
|
|
828
|
+
modifiers: ["meta"],
|
|
829
|
+
key: "p"
|
|
830
|
+
}, ev => {
|
|
828
831
|
ev.preventDefault();
|
|
829
832
|
setState({
|
|
830
833
|
search: {
|
|
831
834
|
open: !state.search.open
|
|
832
835
|
}
|
|
833
836
|
});
|
|
834
|
-
}, {
|
|
835
|
-
enableOnFormTags: true
|
|
836
837
|
});
|
|
837
|
-
useHotkeys(
|
|
838
|
+
useHotkeys({
|
|
839
|
+
modifiers: ["meta"],
|
|
840
|
+
key: "k"
|
|
841
|
+
}, ev => {
|
|
838
842
|
ev.preventDefault();
|
|
839
843
|
setState({
|
|
840
844
|
search: {
|
|
841
845
|
open: !state.search.open
|
|
842
846
|
}
|
|
843
847
|
});
|
|
844
|
-
}, {
|
|
845
|
-
enableOnFormTags: ["INPUT"]
|
|
846
848
|
});
|
|
847
|
-
useHotkeys(
|
|
849
|
+
useHotkeys({
|
|
850
|
+
key: "escape"
|
|
851
|
+
}, ev => {
|
|
848
852
|
if (state.search.open) {
|
|
849
853
|
ev.preventDefault();
|
|
850
854
|
setState({
|
|
@@ -853,8 +857,6 @@ function Page(props$1, ref) {
|
|
|
853
857
|
}
|
|
854
858
|
});
|
|
855
859
|
}
|
|
856
|
-
}, {
|
|
857
|
-
enableOnFormTags: true
|
|
858
860
|
});
|
|
859
861
|
return /*#__PURE__*/jsxs(Provider, {
|
|
860
862
|
value: context,
|
|
@@ -958,6 +960,39 @@ const styles = {
|
|
|
958
960
|
$$css: true
|
|
959
961
|
}
|
|
960
962
|
};
|
|
963
|
+
function useHotkeys(trigger, callback) {
|
|
964
|
+
const ref = React.useRef({
|
|
965
|
+
trigger,
|
|
966
|
+
callback
|
|
967
|
+
});
|
|
968
|
+
React.useLayoutEffect(() => {
|
|
969
|
+
ref.current = {
|
|
970
|
+
trigger,
|
|
971
|
+
callback
|
|
972
|
+
};
|
|
973
|
+
});
|
|
974
|
+
React.useEffect(() => {
|
|
975
|
+
const handleKeyDown = event => {
|
|
976
|
+
if (ref.current.trigger.key.toLowerCase() !== event.key.toLowerCase()) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
{
|
|
980
|
+
const allModifiers = ["alt", "ctrl", "meta", "shift"];
|
|
981
|
+
const expectedModifiers = ref.current.trigger.modifiers ?? [];
|
|
982
|
+
for (const modifier of allModifiers) {
|
|
983
|
+
if (event[`${modifier}Key`] !== expectedModifiers.includes(modifier)) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
ref.current.callback(event);
|
|
989
|
+
};
|
|
990
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
991
|
+
return () => {
|
|
992
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
993
|
+
};
|
|
994
|
+
}, []);
|
|
995
|
+
}
|
|
961
996
|
|
|
962
997
|
/**
|
|
963
998
|
* A mailbox is a wonka source which receives messages for one specific block (identified by its id).
|
package/package.json
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "timvir",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.50",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
8
8
|
"./styles.css": "./styles.css",
|
|
9
|
-
"./blocks":
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"./
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
"./blocks": {
|
|
10
|
+
"types": "./blocks/index.d.ts",
|
|
11
|
+
"import": "./blocks/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./blocks/*": {
|
|
14
|
+
"types": "./blocks/*/index.d.ts",
|
|
15
|
+
"import": "./blocks/*/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./builtins": {
|
|
18
|
+
"types": "./builtins/index.d.ts",
|
|
19
|
+
"import": "./builtins/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./bus": {
|
|
22
|
+
"types": "./bus/index.d.ts",
|
|
23
|
+
"import": "./bus/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./context": {
|
|
26
|
+
"types": "./context/index.d.ts",
|
|
27
|
+
"import": "./context/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./core": {
|
|
30
|
+
"types": "./core/index.d.ts",
|
|
31
|
+
"import": "./core/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./hooks": {
|
|
34
|
+
"types": "./hooks/index.d.ts",
|
|
35
|
+
"import": "./hooks/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./search": {
|
|
38
|
+
"types": "./search/index.d.ts",
|
|
39
|
+
"import": "./search/index.js"
|
|
40
|
+
}
|
|
17
41
|
},
|
|
18
42
|
"dependencies": {
|
|
19
43
|
"bytestring": "^1",
|
|
@@ -22,8 +46,7 @@
|
|
|
22
46
|
},
|
|
23
47
|
"peerDependencies": {
|
|
24
48
|
"react": "^17 || ^18 || ^19",
|
|
25
|
-
"react-dom": "^17 || ^18 || ^19"
|
|
26
|
-
"react-hotkeys-hook": "^4 || ^5"
|
|
49
|
+
"react-dom": "^17 || ^18 || ^19"
|
|
27
50
|
},
|
|
28
51
|
"repository": {
|
|
29
52
|
"type": "git",
|
package/styles.css
CHANGED
|
@@ -1692,8 +1692,8 @@ body {
|
|
|
1692
1692
|
--timvir-b-ColorBar-value-borderRadiusDefault: 2px 0 0 2px;
|
|
1693
1693
|
}
|
|
1694
1694
|
|
|
1695
|
-
.timvir-s-
|
|
1696
|
-
--timvir-b-ColorBar-value-margin:
|
|
1695
|
+
.timvir-s-12l46wj {
|
|
1696
|
+
--timvir-b-ColorBar-value-margin: 0px;
|
|
1697
1697
|
}
|
|
1698
1698
|
|
|
1699
1699
|
.timvir-s-1f9b50e {
|