timvir 0.2.33 → 0.2.35

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 ADDED
@@ -0,0 +1,12 @@
1
+ # timvir
2
+
3
+ ## 0.2.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 3289108: Relax Link type
8
+
9
+ The `Link` prop on `timvir/core` `<Page>` used to heavily lean on the type used by Next.js.
10
+ In particular, it claimed to support `passHref` and `legacyBehavior` props.
11
+ This is no longer the case.
12
+ The `Link` can now be a plain HTMLAnchorElement (ie. `<a>`), or any component which implements a compatible inteface.
@@ -143,9 +143,7 @@ const classes = {
143
143
  root: "r9v2r0l",
144
144
  code: "cs7tint",
145
145
  fullWidth: "fjvaz2s",
146
- line: "lchll0h",
147
146
  highlightedLine: "h1xcko1i",
148
- lineNumber: "ll2b9hx",
149
147
  caption: "c5vr6r2"
150
148
  };
151
149
 
@@ -68,9 +68,7 @@ function Exhibit(props, ref) {
68
68
  var Exhibit$1 = /*#__PURE__*/React.forwardRef(Exhibit);
69
69
  const cssVariables = {
70
70
  bleed: "--timvir-b-Exhibit-bleed",
71
- borderColor: "--timvir-b-Exhibit-borderColor",
72
- background: "--timvir-b-Exhibit-background"
73
- };
71
+ borderColor: "--timvir-b-Exhibit-borderColor"};
74
72
  const classes = {
75
73
  root: "r1nql2f9",
76
74
  container: "c4ji594",
@@ -1,4 +1,5 @@
1
1
  import { useMDXComponents } from '@mdx-js/react';
2
+ import * as builtins from 'timvir/builtins';
2
3
  import * as React from 'react';
3
4
  import * as Icons from 'react-feather';
4
5
 
@@ -40,7 +41,7 @@ const classes = {
40
41
  };
41
42
  function Font(props, ref) {
42
43
  const components = {
43
- h3: "h3",
44
+ ...builtins,
44
45
  ...useMDXComponents()
45
46
  };
46
47
  const {
@@ -4,6 +4,7 @@ import { useResizeObserverEntry, useResizeObserver } from 'timvir/hooks';
4
4
  import * as React from 'react';
5
5
  import { useImmer } from 'use-immer';
6
6
  import { useMDXComponents } from '@mdx-js/react';
7
+ import * as builtins from 'timvir/builtins';
7
8
  import { Code } from 'timvir/blocks';
8
9
  import * as Icons from 'react-feather';
9
10
 
@@ -38,7 +39,7 @@ var cx_default = cx;
38
39
 
39
40
  function Caption(props) {
40
41
  const components = {
41
- a: "a",
42
+ ...builtins,
42
43
  ...useMDXComponents()
43
44
  };
44
45
  const {
@@ -119,25 +120,25 @@ function Ruler(props) {
119
120
  viewportWidth = 0
120
121
  } = props;
121
122
  return /*#__PURE__*/React.createElement("svg", {
122
- viewBox: `-${containerWidth / 2} ${-height / 2} ${containerWidth} ${height}`,
123
+ viewBox: `-${containerWidth / 2} ${ -16 / 2} ${containerWidth} ${height}`,
123
124
  className: "ssl4j8q"
124
125
  }, /*#__PURE__*/React.createElement("rect", {
125
126
  x: -containerWidth / 2,
126
- y: -height / 2,
127
+ y: -16 / 2,
127
128
  width: containerWidth,
128
129
  height: height,
129
130
  fill: "var(--timvir-secondary-background-color)"
130
131
  }), /*#__PURE__*/React.createElement("line", {
131
132
  x1: -viewportWidth / 2,
132
133
  x2: -viewportWidth / 2,
133
- y1: -height / 2,
134
+ y1: -16 / 2,
134
135
  y2: height / 2,
135
136
  strokeWidth: 2,
136
137
  stroke: "var(--timvir-text-color)"
137
138
  }), /*#__PURE__*/React.createElement("line", {
138
139
  x1: viewportWidth / 2,
139
140
  x2: viewportWidth / 2,
140
- y1: -height / 2,
141
+ y1: -16 / 2,
141
142
  y2: height / 2,
142
143
  strokeWidth: 2,
143
144
  stroke: "var(--timvir-text-color)"
@@ -3,7 +3,7 @@ interface Props {
3
3
  gridColumn: string;
4
4
  lock: React.MutableRefObject<string>;
5
5
  edge: "left" | "right";
6
- iframeRef: React.RefObject<HTMLIFrameElement>;
6
+ iframeRef: React.RefObject<null | HTMLIFrameElement>;
7
7
  }
8
8
  declare function Handle(props: Props): React.JSX.Element;
9
9
  declare const _default: React.MemoExoticComponent<typeof Handle>;
@@ -1,18 +1,18 @@
1
1
  import * as React from "react";
2
- export declare const h1: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement> & Record<never, unknown>>;
2
+ export declare const h1: any;
3
3
  export declare const h2: (props: React.HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
4
4
  export declare const h3: (props: React.HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
5
5
  export declare const h4: (props: React.HTMLAttributes<HTMLHeadingElement>) => React.JSX.Element;
6
- export declare const blockquote: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLQuoteElement> & React.BlockquoteHTMLAttributes<HTMLQuoteElement> & Record<never, unknown>>;
7
- export declare const hr: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLHRElement> & React.HTMLAttributes<HTMLHRElement> & Record<never, unknown>>;
8
- export declare const table: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableElement> & React.TableHTMLAttributes<HTMLTableElement> & Record<never, unknown>>;
9
- export declare const thead: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableSectionElement> & React.HTMLAttributes<HTMLTableSectionElement> & Record<never, unknown>>;
10
- export declare const tbody: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableSectionElement> & React.HTMLAttributes<HTMLTableSectionElement> & Record<never, unknown>>;
11
- export declare const tr: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableRowElement> & React.HTMLAttributes<HTMLTableRowElement> & Record<never, unknown>>;
12
- export declare const th: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableHeaderCellElement> & React.ThHTMLAttributes<HTMLTableHeaderCellElement> & Record<never, unknown>>;
13
- export declare const td: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLTableDataCellElement> & React.TdHTMLAttributes<HTMLTableDataCellElement> & Record<never, unknown>>;
14
- export declare const code: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & Record<never, unknown>>;
15
- export declare const a: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & Record<never, unknown>>;
16
- export declare const p: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLParagraphElement> & React.HTMLAttributes<HTMLParagraphElement> & Record<never, unknown>>;
17
- export declare const ul: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLUListElement> & React.HTMLAttributes<HTMLUListElement> & Record<never, unknown>>;
18
- export declare const ol: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLOListElement> & React.OlHTMLAttributes<HTMLOListElement> & Record<never, unknown>>;
6
+ export declare const blockquote: any;
7
+ export declare const hr: any;
8
+ export declare const table: any;
9
+ export declare const thead: any;
10
+ export declare const tbody: any;
11
+ export declare const tr: any;
12
+ export declare const th: any;
13
+ export declare const td: any;
14
+ export declare const code: any;
15
+ export declare const a: any;
16
+ export declare const p: any;
17
+ export declare const ul: any;
18
+ export declare const ol: any;
@@ -7,10 +7,7 @@ export interface Value {
7
7
  asPath: string;
8
8
  push: (path: string) => void;
9
9
  };
10
- Link: React.ComponentType<React.ComponentProps<"a"> & {
11
- passHref?: boolean;
12
- legacyBehavior?: boolean;
13
- }>;
10
+ Link: React.ComponentType<React.ComponentProps<"a">>;
14
11
  blocks?: {
15
12
  WebLink?: {
16
13
  unfurl: (url: string) => Promise<any>;
@@ -12,10 +12,7 @@ interface Props extends React.ComponentProps<typeof Root> {
12
12
  asPath: string;
13
13
  push: (path: string) => void;
14
14
  };
15
- Link: React.ComponentType<React.ComponentProps<"a"> & {
16
- passHref?: boolean;
17
- legacyBehavior?: boolean;
18
- }>;
15
+ Link: React.ComponentType<React.ComponentProps<"a">>;
19
16
  /**
20
17
  * Overrides the built-in MDX component implementations.
21
18
  *
@@ -1,6 +1,8 @@
1
1
  import * as React from "react";
2
2
  export interface Node {
3
- readonly icon?: React.ReactElement;
3
+ readonly icon?: React.ReactElement<{
4
+ className?: string;
5
+ }>;
4
6
  readonly label: string;
5
7
  readonly path?: string;
6
8
  readonly children?: readonly Node[];
package/core/index.js CHANGED
@@ -393,7 +393,7 @@ function SidebarItem(props) {
393
393
  });
394
394
  return /*#__PURE__*/React.createElement("div", {
395
395
  className: classes$2.root,
396
- "data-active": location.asPath === path
396
+ "data-active": location.asPath.replace(/#.*$/, "") === path
397
397
  }, path ? /*#__PURE__*/React.createElement(Link, {
398
398
  href: path,
399
399
  style: {
@@ -475,7 +475,7 @@ function Sidebar(props) {
475
475
  } = props;
476
476
  const node = function find(nodes) {
477
477
  for (const node of nodes) {
478
- if (node.path === location.asPath) {
478
+ if (location.asPath.replace(/#.*$/, "") === node.path) {
479
479
  return node;
480
480
  }
481
481
  if (node.children) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.2.33",
4
+ "version": "0.2.35",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -20,7 +20,7 @@
20
20
  "downshift": "^7 || ^8 || ^9",
21
21
  "fuzzaldrin-plus": "^0.6.0",
22
22
  "immer": "^9 || ^10",
23
- "shiki": "^1",
23
+ "shiki": "^1 || ^2 || ^3",
24
24
  "react-feather": "^2",
25
25
  "use-immer": "^0.8.0 || ^0.8.1 || ^0.9.0 || ^0.10.0 || ^0.11.0",
26
26
  "wonka": "^6"
@@ -2,11 +2,12 @@ import * as React from "react";
2
2
  /**
3
3
  * The underlying DOM element which is rendered by this component.
4
4
  */
5
- declare const Root = "div";
5
+ declare const Root = "a";
6
6
  interface Props extends React.ComponentProps<typeof Root> {
7
+ as?: React.ComponentType<React.ComponentProps<typeof Root>>;
7
8
  icon?: React.ReactNode;
8
9
  label: React.ReactNode;
9
10
  context?: React.ReactNode;
10
11
  }
11
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
12
13
  export default _default;
package/search/index.js CHANGED
@@ -63,18 +63,20 @@ var SearchBoxInput$1 = /*#__PURE__*/React.forwardRef(SearchBoxInput);
63
63
  /**
64
64
  * The underlying DOM element which is rendered by this component.
65
65
  */
66
- const Root$1 = "div";
66
+ const Root$1 = "a";
67
67
  function SearchBoxListItem(props, ref) {
68
68
  const {
69
+ as,
69
70
  icon,
70
71
  label,
71
72
  context,
72
73
  ...rest
73
74
  } = props;
74
- return /*#__PURE__*/React.createElement(Root$1, {
75
+ const Component = as ?? Root$1;
76
+ return /*#__PURE__*/React.createElement(Component, {
75
77
  role: "button",
76
78
  ref: ref,
77
- className: "r8yc6y",
79
+ className: "c8yc6y",
78
80
  ...rest
79
81
  }, /*#__PURE__*/React.createElement("div", {
80
82
  className: "dqzmx2q"
@@ -162,12 +164,10 @@ function Dialog(props, ref) {
162
164
  }), /*#__PURE__*/React.createElement("main", {
163
165
  ...getMenuProps(),
164
166
  className: "m1mgb53c"
165
- }, items.map((item, index) => /*#__PURE__*/React.createElement(Link, {
167
+ }, items.map((item, index) => /*#__PURE__*/React.createElement(SearchBoxListItem$1, {
166
168
  key: index,
169
+ as: Link,
167
170
  href: item.node.path,
168
- passHref: true,
169
- legacyBehavior: true
170
- }, /*#__PURE__*/React.createElement(SearchBoxListItem$1, {
171
171
  ...getItemProps({
172
172
  item,
173
173
  index,
@@ -207,7 +207,7 @@ function Dialog(props, ref) {
207
207
  style: {
208
208
  // background: highlightedIndex === index ? "rgba(0, 0, 0, 0.05)" : undefined,
209
209
  }
210
- }))))))));
210
+ })))))));
211
211
  }
212
212
  var Dialog$1 = /*#__PURE__*/React.forwardRef(Dialog);
213
213
 
package/search/styles.css CHANGED
@@ -2,7 +2,7 @@
2
2
  .s1sjvm51{width:18px;height:18px;display:block;fill:var(--timvir-secondary-text-color);flex-shrink:0;backface-visibility:hidden;margin-right:10px;flex-grow:0;}
3
3
  .i1f3edco{font-family:inherit;font-size:inherit;line-height:inherit;border:none;background:none;width:100%;display:block;resize:none;padding:0px;min-width:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--timvir-text-color);}.i1f3edco:focus{outline:0;}
4
4
 
5
- .r8yc6y{display:flex;padding:8px 0;font-size:14px;color:var(--timvir-text-color);cursor:pointer;box-shadow:rgba(55,53,47,0.09) 0px 1px 0px;}.r8yc6y:hover{background:rgba(0,0,0,0.05);}:root[data-timvir-theme="dark"] .r8yc6y{box-shadow:rgba(255,255,255,0.09) 0px 1px 0px;}:root[data-timvir-theme="dark"] .r8yc6y:hover{background:rgba(255,255,255,0.05);}
5
+ .c8yc6y{display:flex;padding:8px 0;font-size:14px;color:var(--timvir-text-color);cursor:pointer;box-shadow:rgba(55,53,47,0.09) 0px 1px 0px;text-decoration:none;}.c8yc6y:hover{background:rgba(0,0,0,0.05);}:root[data-timvir-theme="dark"] .c8yc6y{box-shadow:rgba(255,255,255,0.09) 0px 1px 0px;}:root[data-timvir-theme="dark"] .c8yc6y:hover{background:rgba(255,255,255,0.05);}
6
6
  .dqzmx2q{display:flex;align-items:center;justify-content:center;margin-left:14px;width:18px;height:24px;}
7
7
  .dp5wq1v{margin-left:14px;}
8
8
  .du5k8uq{font-size:12px;color:var(--timvir-secondary-text-color);}
package/styles.css CHANGED
@@ -182,7 +182,7 @@
182
182
  .s1sjvm51{width:18px;height:18px;display:block;fill:var(--timvir-secondary-text-color);flex-shrink:0;backface-visibility:hidden;margin-right:10px;flex-grow:0;}
183
183
  .i1f3edco{font-family:inherit;font-size:inherit;line-height:inherit;border:none;background:none;width:100%;display:block;resize:none;padding:0px;min-width:0px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--timvir-text-color);}.i1f3edco:focus{outline:0;}
184
184
 
185
- .r8yc6y{display:flex;padding:8px 0;font-size:14px;color:var(--timvir-text-color);cursor:pointer;box-shadow:rgba(55,53,47,0.09) 0px 1px 0px;}.r8yc6y:hover{background:rgba(0,0,0,0.05);}:root[data-timvir-theme="dark"] .r8yc6y{box-shadow:rgba(255,255,255,0.09) 0px 1px 0px;}:root[data-timvir-theme="dark"] .r8yc6y:hover{background:rgba(255,255,255,0.05);}
185
+ .c8yc6y{display:flex;padding:8px 0;font-size:14px;color:var(--timvir-text-color);cursor:pointer;box-shadow:rgba(55,53,47,0.09) 0px 1px 0px;text-decoration:none;}.c8yc6y:hover{background:rgba(0,0,0,0.05);}:root[data-timvir-theme="dark"] .c8yc6y{box-shadow:rgba(255,255,255,0.09) 0px 1px 0px;}:root[data-timvir-theme="dark"] .c8yc6y:hover{background:rgba(255,255,255,0.05);}
186
186
  .dqzmx2q{display:flex;align-items:center;justify-content:center;margin-left:14px;width:18px;height:24px;}
187
187
  .dp5wq1v{margin-left:14px;}
188
188
  .du5k8uq{font-size:12px;color:var(--timvir-secondary-text-color);}