timvir 0.2.49 → 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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/blocks/Arbitrary/samples/basic.d.ts +1 -1
  3. package/blocks/Code/index.js +21 -6
  4. package/blocks/Code/samples/basic.d.ts +1 -1
  5. package/blocks/ColorBar/index.js +1 -1
  6. package/blocks/ColorBar/styles.css +2 -2
  7. package/blocks/Exhibit/samples/bleed.d.ts +1 -1
  8. package/blocks/Font/index.js +3 -0
  9. package/blocks/Font/samples/basic.d.ts +1 -1
  10. package/blocks/Font/samples/timvir/body1.d.ts +1 -1
  11. package/blocks/Font/samples/timvir/caption.d.ts +1 -1
  12. package/blocks/Font/samples/timvir/h1.d.ts +1 -1
  13. package/blocks/Font/samples/timvir/h2.d.ts +1 -1
  14. package/blocks/Font/samples/timvir/h3.d.ts +1 -1
  15. package/blocks/Font/samples/timvir/h4.d.ts +1 -1
  16. package/blocks/Icon/Icon.d.ts +1 -1
  17. package/blocks/Icon/internal/Canvas.d.ts +1 -1
  18. package/blocks/Message/samples/basic.d.ts +1 -1
  19. package/blocks/Viewport/index.js +8 -2
  20. package/blocks/WebLink/index.js +1 -1
  21. package/blocks/WebLink/samples/basic.d.ts +1 -1
  22. package/blocks/styles.css +2 -2
  23. package/bus/index.d.ts +2 -2
  24. package/context/index.d.ts +2 -2
  25. package/core/components/Commands/internal/Action.d.ts +1 -1
  26. package/core/components/Footer/samples/basic.d.ts +1 -1
  27. package/core/components/NavigationFooter/NavigationFooter.d.ts +2 -2
  28. package/core/components/NavigationFooter/samples/basic.d.ts +1 -1
  29. package/core/components/Page/Page.d.ts +2 -2
  30. package/core/components/Page/internal/Section.d.ts +1 -1
  31. package/core/components/Page/internal/Sidebar.d.ts +1 -1
  32. package/core/components/Page/internal/SidebarItem.d.ts +1 -1
  33. package/core/components/Page/types.d.ts +1 -1
  34. package/core/index.d.ts +2 -2
  35. package/core/index.js +5 -4
  36. package/package.json +33 -9
  37. package/search/Search/Search.d.ts +1 -1
  38. package/styles.css +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.2.49
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Arbitrary } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Arbitrary>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -196,18 +196,33 @@ function Code(props$1, ref) {
196
196
  const stylexTransformer = {
197
197
  name: "stylex",
198
198
  pre(node) {
199
- this.addClassToHast(node, {
199
+ const {
200
+ className
201
+ } = {
200
202
  className: "timvir-s-1lliihq timvir-s-1ghz6dp timvir-s-1g8o3q3 timvir-s-1d0dlzq"
201
- }.className);
203
+ };
204
+ {
205
+ this.addClassToHast(node, className);
206
+ }
202
207
  },
203
208
  line(node, index) {
204
- this.addClassToHast(node, {
209
+ const {
210
+ className
211
+ } = {
205
212
  className: "timvir-s-1rg5ohu timvir-s-h8yej3 timvir-s-e193im"
206
- }.className);
213
+ };
214
+ {
215
+ this.addClassToHast(node, className);
216
+ }
207
217
  if (highlightedLines?.includes(index)) {
208
- this.addClassToHast(node, {
218
+ const {
219
+ className
220
+ } = {
209
221
  className: "timvir-s-15fpjw5"
210
- }.className);
222
+ };
223
+ {
224
+ this.addClassToHast(node, className);
225
+ }
211
226
  }
212
227
  }
213
228
  };
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Code } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Code>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -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-15311qs timvir-s-inzabm timvir-s-1bxid8z",
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: {
@@ -7,8 +7,8 @@
7
7
  --timvir-b-ColorBar-value-borderRadiusDefault: 2px 0 0 2px;
8
8
  }
9
9
 
10
- .timvir-s-15311qs {
11
- --timvir-b-ColorBar-value-margin: 0;
10
+ .timvir-s-12l46wj {
11
+ --timvir-b-ColorBar-value-margin: 0px;
12
12
  }
13
13
 
14
14
  .timvir-s-1f9b50e {
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Exhibit } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Exhibit>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -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";
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Font } from "../..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Font>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Descriptor } from "./types";
2
+ import type { Descriptor } from "./types";
3
3
  /**
4
4
  * The underlying DOM element which is rendered by this component.
5
5
  */
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  interface Props {
3
3
  width: number;
4
4
  height: number;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Message } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Message>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -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.style.userSelect = "";
369
- iframeRef.current.style.pointerEvents = "";
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;
@@ -262,7 +262,7 @@ const styles = {
262
262
  }
263
263
  };
264
264
  async function defaultUnfurl(url) {
265
- return fetch(`https://timvir.vercel.app/api/unfurl?url=${encodeURIComponent(url)}`).then(res => res.json());
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 };
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { WebLink } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof WebLink>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
package/blocks/styles.css CHANGED
@@ -391,8 +391,8 @@
391
391
  --timvir-b-ColorBar-value-borderRadiusDefault: 2px 0 0 2px;
392
392
  }
393
393
 
394
- .timvir-s-15311qs {
395
- --timvir-b-ColorBar-value-margin: 0;
394
+ .timvir-s-12l46wj {
395
+ --timvir-b-ColorBar-value-margin: 0px;
396
396
  }
397
397
 
398
398
  .timvir-s-1f9b50e {
package/bus/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Subject } from "wonka";
2
- import { Message } from "./messages";
1
+ import { type Subject } from "wonka";
2
+ import type { Message } from "./messages";
3
3
  export * from "./messages";
4
4
  /**
5
5
  * The bus is a wonka Subject that represents a stream of Messages.
@@ -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
  declare const Root = "div";
3
3
  interface Props extends Omit<React.ComponentPropsWithoutRef<typeof Root>, "className" | "style"> {
4
4
  label?: React.ReactNode;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  import { Footer } from "..";
3
3
  type Props = Partial<React.ComponentPropsWithoutRef<typeof Footer>>;
4
4
  export default function Sample(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Value } from "timvir/context";
1
+ import type * as React from "react";
2
+ import type { Value } from "timvir/context";
3
3
  /**
4
4
  * The underlying DOM element which is rendered by this component.
5
5
  */
@@ -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,4 +1,4 @@
1
- import { Node } from "../types";
1
+ import type { Node } from "../types";
2
2
  interface Props extends Node {
3
3
  depth: number;
4
4
  }
@@ -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[];
@@ -1,4 +1,4 @@
1
- import { Node } from "../types";
1
+ import type { Node } from "../types";
2
2
  interface Props extends Node {
3
3
  depth: number;
4
4
  active: boolean;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import type * as React from "react";
2
2
  export interface Node {
3
3
  readonly icon?: React.ReactElement<{
4
4
  className?: string;
package/core/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Source } from "wonka";
2
- import { Message } from "timvir/bus";
1
+ import { type Source } from "wonka";
2
+ import type { Message } from "timvir/bus";
3
3
  import * as React from "react";
4
4
  export * from "./components/Footer";
5
5
  export * from "./components/Page";
package/core/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { pipe, filter, subscribe } from 'wonka';
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';
@@ -47,7 +47,7 @@ function Footer(props, ref) {
47
47
  children: /*#__PURE__*/jsxs("div", {
48
48
  className: "timvir-s-htle6 timvir-s-euugli",
49
49
  children: ["Built with", " ", /*#__PURE__*/jsx("a", {
50
- href: "https://timvir.vercel.app",
50
+ href: "https://timvir.dev",
51
51
  className: "timvir-s-1heor9g timvir-s-1hl2dhg timvir-s-1dlxito timvir-s-1j43nte timvir-s-odwsf6 timvir-s-1w3jsh0 timvir-s-g7t5vw",
52
52
  children: "Timvir"
53
53
  })]
@@ -667,9 +667,10 @@ function Sidebar(props$1) {
667
667
  } = useContext();
668
668
  const [isMenuOpen, setMenuOpen] = React.useState(false);
669
669
  React.useEffect(() => {
670
- const scrollLockClassList = {
670
+ const className = {
671
671
  className: "timvir-s-1rife3k timvir-s-ixxii4 timvir-s-13vifvy timvir-s-h8yej3"
672
- }.className.split(" ");
672
+ }.className;
673
+ const scrollLockClassList = className.split(" ");
673
674
  for (const className of scrollLockClassList) {
674
675
  document.body.classList.toggle(className, isMenuOpen);
675
676
  }
package/package.json CHANGED
@@ -1,19 +1,43 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.2.49",
4
+ "version": "0.2.50",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
8
8
  "./styles.css": "./styles.css",
9
- "./blocks": "./blocks/index.js",
10
- "./blocks/*": "./blocks/*/index.js",
11
- "./builtins": "./builtins/index.js",
12
- "./bus": "./bus/index.js",
13
- "./context": "./context/index.js",
14
- "./core": "./core/index.js",
15
- "./hooks": "./hooks/index.js",
16
- "./search": "./search/index.js"
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",
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Node } from "timvir/core";
2
+ import type { Node } from "timvir/core";
3
3
  interface Props extends React.ComponentPropsWithoutRef<"div"> {
4
4
  open?: boolean;
5
5
  onClose?: (ev: React.SyntheticEvent<HTMLElement>) => void;
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-15311qs {
1696
- --timvir-b-ColorBar-value-margin: 0;
1695
+ .timvir-s-12l46wj {
1696
+ --timvir-b-ColorBar-value-margin: 0px;
1697
1697
  }
1698
1698
 
1699
1699
  .timvir-s-1f9b50e {