timvir 0.2.34 → 0.2.36

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",
package/builtins/index.js CHANGED
@@ -101,7 +101,7 @@ function styled(tag) {
101
101
  }
102
102
  const render = (props, ref) => {
103
103
  const { as: component = tag, class: className = mockedClass } = props;
104
- const shouldKeepProps = options.propsAsIs === undefined ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs;
104
+ const shouldKeepProps = options.propsAsIs === void 0 ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs;
105
105
  const filteredProps = filterProps(shouldKeepProps, props, [
106
106
  "as",
107
107
  "class"
@@ -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
  *
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.34",
4
+ "version": "0.2.36",
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 || ^2",
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"
@@ -29,7 +29,7 @@
29
29
  "@mdx-js/react": "^2 || ^3",
30
30
  "react": "^17 || ^18 || ^19",
31
31
  "react-dom": "^17 || ^18 || ^19",
32
- "react-hotkeys-hook": "^4"
32
+ "react-hotkeys-hook": "^4 || ^5"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -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);}