timvir 0.2.10 → 0.2.11

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.
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * This is documentation for the Code component.
3
3
  */
4
- import { Language } from "prism-react-renderer";
5
4
  import * as React from "react";
6
5
  /**
7
6
  * The underlying DOM element which is rendered by this component.
@@ -17,7 +16,7 @@ interface Props extends React.ComponentPropsWithoutRef<typeof Root> {
17
16
  *
18
17
  * @default "markup"
19
18
  */
20
- language?: Language;
19
+ language?: string;
21
20
  /**
22
21
  * When set, the code block spans the full width. Note that the text itself
23
22
  * is still aligned with the main column. Use this when you expect the text
@@ -1,6 +1,6 @@
1
1
  import * as Page from 'timvir/core';
2
2
  import { useBlock } from 'timvir/core';
3
- import Highlight, { defaultProps } from 'prism-react-renderer';
3
+ import { Highlight } from 'prism-react-renderer';
4
4
  import * as React from 'react';
5
5
  import * as Icons from 'react-feather';
6
6
  import { useImmer } from 'use-immer';
@@ -70,7 +70,6 @@ function Code(props, ref) {
70
70
  className: cx_default(classes.root, fullWidth && Page.fullWidth),
71
71
  ...rest
72
72
  }, /*#__PURE__*/React.createElement(Highlight, {
73
- ...defaultProps,
74
73
  code: children.trim(),
75
74
  language: language !== null && language !== void 0 ? language : "markup",
76
75
  theme: nullTheme
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample({ language, children }: any): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  containerWidth?: number;
3
4
  viewportWidth?: number;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  open?: boolean;
3
4
  onClose?: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Node } from "../types";
2
3
  interface Props extends Node {
3
4
  depth: number;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
package/core/index.js CHANGED
@@ -416,9 +416,15 @@ var warnIfInvalid = (value, componentName) => {
416
416
  );
417
417
  }
418
418
  };
419
+ var idx = 0;
419
420
  function styled(tag) {
421
+ var _a;
422
+ let mockedClass = `mocked-styled-${idx++}`;
423
+ if ((_a = tag == null ? void 0 : tag.__linaria) == null ? void 0 : _a.className) {
424
+ mockedClass += ` ${tag.__linaria.className}`;
425
+ }
420
426
  return (options) => {
421
- if (process.env.NODE_ENV !== "production") {
427
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test") {
422
428
  if (Array.isArray(options)) {
423
429
  throw new Error(
424
430
  'Using the "styled" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly. See https://github.com/callstack/linaria#setup'
@@ -426,7 +432,7 @@ function styled(tag) {
426
432
  }
427
433
  }
428
434
  const render = (props, ref) => {
429
- const { as: component = tag, class: className } = props;
435
+ const { as: component = tag, class: className = mockedClass } = props;
430
436
  const shouldKeepProps = options.propsAsIs === void 0 ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs;
431
437
  const filteredProps = filterProps(shouldKeepProps, props, [
432
438
  "as",
@@ -466,7 +472,7 @@ function styled(tag) {
466
472
  };
467
473
  Result.displayName = options.name;
468
474
  Result.__linaria = {
469
- className: options.class,
475
+ className: options.class ?? mockedClass,
470
476
  extends: tag
471
477
  };
472
478
  return Result;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.2.10",
4
+ "version": "0.2.11",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "downshift": "^7",
20
20
  "fuzzaldrin-plus": "^0.6.0",
21
21
  "immer": "^9 || ^10",
22
- "prism-react-renderer": "^1",
22
+ "prism-react-renderer": "^2",
23
23
  "react-feather": "^2",
24
24
  "use-immer": "^0.8.0 || ^0.8.1 || ^0.9.0",
25
25
  "wonka": "^6"
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  string: string;
3
4
  query: string;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Sample(): JSX.Element;