playroom 0.31.0 → 0.32.0

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 (87) hide show
  1. package/.babelrc +1 -1
  2. package/.github/workflows/release.yml +2 -1
  3. package/.prettierignore +1 -0
  4. package/@types/babel__standalone.d.ts +1 -1
  5. package/CHANGELOG.md +7 -0
  6. package/README.md +3 -1
  7. package/cypress/e2e/smoke.cy.js +8 -0
  8. package/cypress/e2e/snippets.cy.js +2 -2
  9. package/cypress/e2e/toolbar.cy.js +2 -2
  10. package/cypress/projects/basic/components.js +0 -1
  11. package/cypress/projects/basic/snippets.js +5 -0
  12. package/cypress/projects/themed/components.js +0 -1
  13. package/cypress/projects/typescript/components/Bar.tsx +13 -0
  14. package/cypress/projects/typescript/components/Foo.tsx +13 -0
  15. package/cypress/projects/typescript/components/styles.ts +4 -0
  16. package/cypress/projects/typescript/components.ts +2 -0
  17. package/cypress/projects/typescript/playroom.config.js +33 -0
  18. package/cypress/projects/typescript/snippets.ts +22 -0
  19. package/cypress/projects/typescript/tsconfig.json +18 -0
  20. package/cypress/support/utils.js +13 -15
  21. package/cypress/tsconfig.json +9 -0
  22. package/lib/defaultModules/FrameComponent.js +1 -3
  23. package/lib/makeDefaultWebpackConfig.js +4 -1
  24. package/lib/makeWebpackConfig.js +8 -2
  25. package/package.json +19 -12
  26. package/src/Playroom/Button/Button.tsx +1 -1
  27. package/src/Playroom/CatchErrors/CatchErrors.tsx +1 -1
  28. package/src/Playroom/CodeEditor/CodeEditor.tsx +7 -3
  29. package/src/Playroom/CodeEditor/keymaps/complete.ts +1 -1
  30. package/src/Playroom/CodeEditor/keymaps/cursors.ts +2 -2
  31. package/src/Playroom/CodeEditor/keymaps/lines.ts +2 -3
  32. package/src/Playroom/CodeEditor/keymaps/types.ts +1 -1
  33. package/src/Playroom/CodeEditor/keymaps/wrap.ts +3 -2
  34. package/src/Playroom/Divider/Divider.tsx +0 -2
  35. package/src/Playroom/Frame.tsx +2 -1
  36. package/src/Playroom/Frames/Frames.tsx +2 -2
  37. package/src/Playroom/Frames/Iframe.tsx +3 -3
  38. package/src/Playroom/FramesPanel/CheckmarkSvg.tsx +1 -1
  39. package/src/Playroom/FramesPanel/FramesPanel.tsx +1 -1
  40. package/src/Playroom/Heading/Heading.tsx +1 -1
  41. package/src/Playroom/Inline/Inline.tsx +1 -1
  42. package/src/Playroom/Logo/Logo.tsx +0 -2
  43. package/src/Playroom/Playroom.tsx +7 -3
  44. package/src/Playroom/Preview.tsx +1 -1
  45. package/src/Playroom/PreviewPanel/CopyButton.tsx +1 -1
  46. package/src/Playroom/PreviewPanel/PreviewPanel.tsx +1 -1
  47. package/src/Playroom/PreviewPanel/ThemeSelector.tsx +1 -1
  48. package/src/Playroom/SettingsPanel/SettingsPanel.tsx +3 -3
  49. package/src/Playroom/Snippets/SearchField/SearchField.tsx +1 -1
  50. package/src/Playroom/Snippets/Snippets.tsx +4 -3
  51. package/src/Playroom/SplashScreen/SplashScreen.tsx +1 -1
  52. package/src/Playroom/Stack/Stack.tsx +1 -1
  53. package/src/Playroom/StatusMessage/StatusMessage.tsx +1 -7
  54. package/src/Playroom/Strong/Strong.tsx +1 -1
  55. package/src/Playroom/Text/Text.tsx +1 -1
  56. package/src/Playroom/Toolbar/Toolbar.tsx +2 -2
  57. package/src/Playroom/ToolbarItem/ToolbarItem.tsx +1 -1
  58. package/src/Playroom/ToolbarPanel/ToolbarPanel.tsx +1 -1
  59. package/src/Playroom/WindowPortal/index.tsx +1 -1
  60. package/src/Playroom/icons/AddIcon.tsx +1 -1
  61. package/src/Playroom/icons/ChevronIcon.tsx +1 -1
  62. package/src/Playroom/icons/ColorModeDarkIcon.tsx +0 -2
  63. package/src/Playroom/icons/ColorModeLightIcon.tsx +0 -2
  64. package/src/Playroom/icons/ColorModeSystemIcon.tsx +0 -2
  65. package/src/Playroom/icons/DismissIcon.tsx +0 -2
  66. package/src/Playroom/icons/EditorBottomIcon.tsx +1 -1
  67. package/src/Playroom/icons/EditorRightIcon.tsx +1 -1
  68. package/src/Playroom/icons/EditorUndockedIcon.tsx +1 -1
  69. package/src/Playroom/icons/FramesIcon.tsx +1 -1
  70. package/src/Playroom/icons/PlayIcon.tsx +0 -2
  71. package/src/Playroom/icons/SettingsIcon.tsx +0 -2
  72. package/src/Playroom/icons/ShareIcon.tsx +0 -2
  73. package/src/Playroom/icons/ThemesIcon.tsx +1 -1
  74. package/src/Playroom/icons/TickIcon.tsx +0 -2
  75. package/src/Playroom/icons/WidthsIcon.tsx +1 -1
  76. package/src/StoreContext/StoreContext.tsx +6 -5
  77. package/src/frame.js +0 -1
  78. package/src/index.d.ts +1 -0
  79. package/src/index.js +0 -2
  80. package/src/preview.js +0 -1
  81. package/src/utils/componentsToHints.ts +1 -1
  82. package/src/utils/cursor.ts +1 -1
  83. package/src/utils/formatting.ts +1 -1
  84. package/src/utils/params.ts +1 -1
  85. package/tsconfig.json +10 -5
  86. package/cypress/.eslintrc +0 -12
  87. /package/{cypress.config.ts → cypress.config.mjs} +0 -0
package/.babelrc CHANGED
@@ -2,6 +2,6 @@
2
2
  "presets": [
3
3
  "@babel/preset-typescript",
4
4
  "@babel/preset-env",
5
- "@babel/preset-react"
5
+ ["@babel/preset-react", { "runtime": "automatic" }]
6
6
  ]
7
7
  }
@@ -17,9 +17,10 @@ jobs:
17
17
  with:
18
18
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
19
19
  fetch-depth: 0
20
+ token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
20
21
 
21
22
  - name: Set up pnpm
22
- uses: pnpm/action-setup@v2.2.4
23
+ uses: pnpm/action-setup@v2
23
24
 
24
25
  - name: Set up Node.js
25
26
  uses: actions/setup-node@v3
package/.prettierignore CHANGED
@@ -1,3 +1,4 @@
1
1
  cypress/plugins/
2
2
  cypress/fixtures/
3
3
  dist
4
+ pnpm-lock.yaml
@@ -3,7 +3,7 @@ interface TransformResponse {
3
3
  }
4
4
 
5
5
  declare module '@babel/standalone' {
6
- import { TransformOptions } from '@babel/core';
6
+ import type { TransformOptions } from '@babel/core';
7
7
 
8
8
  function transform(
9
9
  code: string,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # playroom
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 720d542: Drop support for React 16. Consumers are encouraged to upgrade to React 17+, which is a drop-in replacement.
8
+ - 720d542: Support TypeScript 5.0+
9
+
3
10
  ## 0.31.0
4
11
 
5
12
  ### Minor Changes
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <img src="images/logo.png?raw=true#gh-light-mode-only" alt="Playroom" title="Playroom" width="292" height="50" />
2
2
  <img src="images/logo-inverted.png?raw=true#gh-dark-mode-only" alt="Playroom" title="Playroom" width="292" height="50" />
3
3
 
4
- [![npm](https://img.shields.io/npm/v/playroom.svg?style=for-the-badge)](https://www.npmjs.com/package/playroom) [![Build Status](https://img.shields.io/github/workflow/status/seek-oss/playroom/Validate/master.svg?style=for-the-badge)](https://github.com/seek-oss/playroom/actions?query=workflow%3AValidate+branch%3Amaster)
4
+ [![npm](https://img.shields.io/npm/v/playroom.svg?style=for-the-badge)](https://www.npmjs.com/package/playroom) [![Build Status](https://img.shields.io/github/actions/workflow/status/seek-oss/playroom/validate.yml?branch=master&style=for-the-badge)](https://github.com/seek-oss/playroom/actions?query=workflow%3AValidate+branch%3Amaster)
5
5
 
6
6
  ---
7
7
 
@@ -32,6 +32,8 @@ Playroom allows you to create a zero-install code-oriented design environment, b
32
32
 
33
33
  [Shopify Polaris](https://polaris.shopify.com/sandbox?code=N4Igxg9gJgpiBcIA8BhAhgJygHQHYAJ8BnGSXKTATwDEIIAXGDAQTHoEsJciBeYAbWBlGuevHwByACLsiAW1lEJAXwC6yvIQAOGdnKq0GTVhy58hXEWMkBRAB5aIGevgBKMR85UbcAPk34qJhQAHQAEjBosBj4aGyc3HyC%2BMIwouISACoMaAA2%2BADKeTBK%2BGrK%2BBz0uTA82CBFNUT1-gSEgQAKEI4AbkwB7bHxfXwAZnkkPoOEcRw9aPROfAPTSABCAK70iwRQsmC5EEQbGDD4Wrlo7H4r0-gAauwwAO6Fxc1td0gA9JvbXK07lNplwUIcSHwABQASnwPF8%2BGAymBhEBqxMCQAMrIXOxGHJeAILKI0tYJABxDBHIhvJoqAA0iNS6UkADkYC5GiUVOp8N80YQfl1ekw0T90FhwpFomKJaECqRTDdPoFMjA7PQUJYrrhRbd8ABNCAbFJoAgbEjEd74U6eeg0xbEGBna6jJz6JWxABGxpclGNMTAFsWciYREAmAT6pzRGletAkKD4LgpXSMXRoYgbMAAC1iNKI1ogfRiHFDjK9lBS2bNutyjKc%2BAr%2BqI9DQo1GIRWPzVGq1oh1era4uCIQV8QBASCkrHnqqNTqIGyrfyXJpa1OaAA1lAIM9cC0u%2B4iAGwDBsS39adjydT6y0KHzERrgBzDaXDAZAs1CSMi4nPKfu83j6niMAEkk%2BqEMAkHtF%2BJQZAA8lgYY-jBMxyMaLISAAqgUUgACQAAwhIRhGoSqdwnLkGS2k49rfNGKH0jByjMRR7TQexgxwUQGTuPQJzcORdyDPemFkgAtLhBEAEwAKzEaRwkiYQVE0R4dFEN8pwCRgQlsSprH6uol5pNEACS%2BJQqBciwvCiIwWQLaIjxjJiRsoiMlRFQ8PgNkANwwTpgn4JCaGBEeJ5njiISWWB4WqRguR8N5CVDKeRBPl67C5HilCYmgXowMlwAAAaPC8tIlPgboxPhwA8copUoip%2BACq1SAFK2YCbu1rWBF1cSbrF%2BI1TluS%2BA17zKD8g09SNYF9R1c3DXFciTe5ogzd8K0LetaWzd1vXhT8kU3tFLZ7UthDQoF7HIvq-KTt8cqjoqCSyiOM4JJUeLzvUUiRMMCwwImtHOM0ICZl6UAbKD7VIOe9BLYjMVrb4HRoP6WxED8SNXfqqOXejS55FVa6Vig1a4LWeNo-iCPfEjYovV970TkOr3fcmc61PUrJGAeKpID2mratcg53Jk2ZnDxNoaRDsSnLE8w5YVNRJrguSVuwoz4NjMQtk4Lo0jzMuFNm3S65Q%2BoXGaSYxNm7DPjLGCdsL3yi32rYSxgLNc%2BzyrDlgvggPSID0DLoZEAg-AgIcYDFPAaQgKo4fPOwUCRzH8D8OoQA)
34
34
 
35
+ [Agriculture Design System](https://design-system.agriculture.gov.au/playroom/#?code=N4Igxg9gJgpiBcIA8AhCAPABFAhgJwGsA%2BAHQDtNMkAJGHWPTAIxzAIHM8IBXMqAXhIgm0AJ4BBADYAXIZkkR2EfsCQAZRREwB6IgF9MACzpQAlmXaCQAUXQAHCHmmYAyjDwA3U2Bhzd5SiQAWRxzADkcDwDKTFNpGABbAGcVAG1geRwmGEl4TCFqCATfEAAaIzwYADM8oW05PQBdPWjKJJhIPnxRAEl45LSMySyc2pAXU3YKcyFymD5rSUT56TykcQ8caXwezp0iTCaWin3yJG00dFIyJAAFHHYYAGEIMni3zBwUoQTQsiFroFblx2oCYkhDABGIj3R5GEzmdjnKFgwJ2VExDSVBKxOxJbg4qAQBSMJJxT7FaTlTrtMDxaTcRj0Ux2UxJMCIzA5OIAOkwtxySzeMCSAEduDBPrITjFPngwNwuUtTFV5lByps8KZuEkuWRTDiyK85srVXxMPqmIY%2BQBFbhs8WS1iZDn6nBK3mtGIAeXlpkwmu1urIWwgjswdnmW1MTB1XOcvymbOwybs%2BAZWpWmASr3iSXKIfZMAzXsoWrMCskcYSOr5PWFj1JPiWWrFEql8km3GGmH6DkYORgKrVfIAaiLpDHuwTSwHidxpGmqdhiY4uYq8AvNziaTBxVtypIY%2B4tAArHXSLTDV2md2XpyOcqmKCzwNx%2B-3z7CzBk5w4SkWmykh8uI8x0BQWzYPaKb-nyTx4F8nyduw3bujgs44N%2BOBHvuOLXuYt58gAqs4RIkpguHlJwkTPu6MCKlA0Himy5Q5ksSSTr4MoxPhboriSfIAGI6j4LrVqY5R2IY%2BDFgh2bEhOpiSh%2Ba70eUVQEbGSSzrxt6dtkXA8l65zosZpncZQLg6pGfBsu0mCqtw7C3s4eCGK8Cq6omIZKkOZpQJ8OHcLBmBBI4TD%2BvRbI5gFMDoLOnSbJIR66l4HjuHJg7DnwfJhN2ww4ulkgOZpcZHgZEB8iEHRRrqSxaO0CSlAlry0vSjI-uS-7Fri%2BKFTk1JFDFWj9tIk6frhuX5f%2B%2BknrOZDTdSjL4rqd6MqyurFuU00JJAeCRowCgiE4yaUrWmBSKYuGBVdwUJLOSTQNhIrZs9%2BL0DgfK3NJ7TJXGv4Uj15UnpgC4WtNEaONsmCOCGlR1v8Fkes4Sx0jqT6sN2yY9R486LpBMCPMufZrrDMlciCCPxHgjE4sWs6-OxwW4A53WrWAX7xL1BIRlqCTJuYrPcByWl8lZSQ2WYST2Y9uDsQzxZxsxqXdnYC5bJKiXYSlVXhf6nQoZKqMMptROvdL7oaZaOo6cLJtfYKKwiuGfZxox-pFZ8dtrjte0HUZ3EmWC5zAhAoJnNosLPLmKzXKgGDYPgxDREggkQBA1PMKwHBcLwAhCCIUASDIALGSGHhyreAC0wzZJIVhVOn1Ol0j6jmAQahstKsqyu5WoAF65ths6UEeZAECkwCpCPMQZIYlQ1PkIAAMSzJkddjIUxQNM1SOynPC9jKvZTr6MS8ACruMkX4BZ0ZiTq1O8z5QB-VEfa%2B12fQjAqYmxgKIkMjz-yfnvWeFQ35L2PoeEYuQl7iEwJUbWACFAWE7OPXscQlggJ7jEZos5-CB20OXYO2g04Z3cHHC4GBrggD0EAA)
36
+
35
37
  Send us a PR if you'd like to be in this list!
36
38
 
37
39
  ## Getting Started
@@ -17,4 +17,12 @@ describe('Smoke', () => {
17
17
 
18
18
  assertPreviewContains('Foo\nFoo\nBar');
19
19
  });
20
+
21
+ it('preview mode works with TypeScript components', () => {
22
+ cy.visit(
23
+ 'http://localhost:9002/preview#?code=N4Igxg9gJgpiBcIA8AxCEB8r1YEIEMAnAei2LUyXJxAF8g'
24
+ );
25
+
26
+ assertPreviewContains('Foo\nFoo\nBar');
27
+ });
20
28
  });
@@ -27,7 +27,7 @@ describe('Snippets', () => {
27
27
  assertCodePaneLineCount(8);
28
28
 
29
29
  // Browse snippetlist
30
- assertSnippetCount(4);
30
+ assertSnippetCount(5);
31
31
  mouseOverSnippet(0);
32
32
  assertFirstFrameContains('Initial code\nFoo\nFoo');
33
33
  mouseOverSnippet(1);
@@ -78,7 +78,7 @@ describe('Snippets', () => {
78
78
  assertCodePaneLineCount(8);
79
79
 
80
80
  // Browse snippetlist
81
- assertSnippetCount(4);
81
+ assertSnippetCount(5);
82
82
  filterSnippets('{downarrow}');
83
83
  assertFirstFrameContains('Initial code\nFoo\nFoo');
84
84
  filterSnippets('{downarrow}');
@@ -47,7 +47,7 @@ describe('Toolbar', () => {
47
47
  });
48
48
  })
49
49
  .get('[data-testid="copyToClipboard"]')
50
- .click()
51
- .then(() => expect(copySpy).to.have.been.called);
50
+ .click();
51
+ cy.then(() => expect(copySpy).to.have.been.called);
52
52
  });
53
53
  });
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
2
 
4
3
  const withPropTypes = (component) => {
@@ -19,4 +19,9 @@ export default [
19
19
  name: 'Blue',
20
20
  code: '<Bar color="blue">Blue Bar</Bar>',
21
21
  },
22
+ {
23
+ group: 'Scope',
24
+ name: 'hello world',
25
+ code: '<Foo>{hello()} {world()}</Foo>',
26
+ },
22
27
  ];
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
2
 
4
3
  const withPropTypes = (component) => {
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ import { parent } from './styles';
3
+
4
+ type Props = {
5
+ color: 'red' | 'blue' | 'black';
6
+ children: React.ReactNode;
7
+ };
8
+
9
+ export const Bar: React.FC<Props> = ({ color = 'black', children }) => (
10
+ <div style={{ color }}>
11
+ Bar{children ? <div style={parent}>{children}</div> : null}
12
+ </div>
13
+ );
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ import { parent } from './styles';
3
+
4
+ type Props = {
5
+ color: 'red' | 'blue' | 'black';
6
+ children: React.ReactNode;
7
+ };
8
+
9
+ export const Foo: React.FC<Props> = ({ color = 'black', children }) => (
10
+ <div style={{ color }}>
11
+ Foo{children ? <div style={parent}>{children}</div> : null}
12
+ </div>
13
+ );
@@ -0,0 +1,4 @@
1
+ export const parent = {
2
+ border: '4px solid currentColor',
3
+ padding: '10px 10px 10px 15px',
4
+ };
@@ -0,0 +1,2 @@
1
+ export { Foo } from './components/Foo';
2
+ export { Bar } from './components/Bar';
@@ -0,0 +1,33 @@
1
+ module.exports = {
2
+ components: './components.ts',
3
+ snippets: './snippets.ts',
4
+ outputPath: './dist',
5
+ openBrowser: false,
6
+ storageKey: 'playroom-example-typescript',
7
+ webpackConfig: () => ({
8
+ module: {
9
+ rules: [
10
+ {
11
+ test: /\.tsx?$/,
12
+ exclude: /node_modules/,
13
+ use: [
14
+ {
15
+ loader: require.resolve('babel-loader'),
16
+ options: {
17
+ babelrc: false,
18
+ presets: [
19
+ require.resolve('@babel/preset-env'),
20
+ [
21
+ require.resolve('@babel/preset-react'),
22
+ { runtime: 'automatic' },
23
+ ],
24
+ require.resolve('@babel/preset-typescript'),
25
+ ],
26
+ },
27
+ },
28
+ ],
29
+ },
30
+ ],
31
+ },
32
+ }),
33
+ };
@@ -0,0 +1,22 @@
1
+ export default [
2
+ {
3
+ group: 'Foo',
4
+ name: 'Default',
5
+ code: '<Foo>Foo</Foo>',
6
+ },
7
+ {
8
+ group: 'Foo',
9
+ name: 'Red',
10
+ code: '<Foo color="red">Red Foo</Foo>',
11
+ },
12
+ {
13
+ group: 'Bar',
14
+ name: 'Default',
15
+ code: '<Bar>Bar</Bar>',
16
+ },
17
+ {
18
+ group: 'Bar',
19
+ name: 'Blue',
20
+ code: '<Bar color="blue">Blue Bar</Bar>',
21
+ },
22
+ ];
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noEmit": true,
4
+ "skipLibCheck": true,
5
+ "moduleResolution": "node",
6
+ "module": "es2022",
7
+ "allowImportingTsExtensions": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "esModuleInterop": true,
10
+ "isolatedModules": true,
11
+ "resolveJsonModule": true,
12
+ "strict": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "jsx": "react-jsx",
15
+ "lib": ["dom", "es2022"],
16
+ "target": "es2022"
17
+ }
18
+ }
@@ -58,12 +58,11 @@ export const gotoPreview = () => {
58
58
  export const toggleSnippets = () =>
59
59
  cy.get('[data-testid="toggleSnippets"]').click();
60
60
 
61
- export const filterSnippets = (search) =>
62
- // eslint-disable-next-line cypress/no-unnecessary-waiting
63
- cy
64
- .get('[data-testid="filterSnippets"]')
65
- .type(search, { force: true })
66
- .wait(200);
61
+ export const filterSnippets = (search) => {
62
+ cy.get('[data-testid="filterSnippets"]').type(search, { force: true });
63
+ // eslint-disable-next-line @finsit/cypress/no-unnecessary-waiting
64
+ cy.wait(200);
65
+ };
67
66
 
68
67
  export const assertSnippetsListIsVisible = () =>
69
68
  cy.get('[data-testid="snippets"]').should('be.visible');
@@ -82,7 +81,7 @@ export const assertSnippetCount = (count) =>
82
81
 
83
82
  export const assertFirstFrameContains = (text) => {
84
83
  getFirstFrame().then(($el) =>
85
- // eslint-disable-next-line cypress/no-unnecessary-waiting
84
+ // eslint-disable-next-line @finsit/cypress/no-unnecessary-waiting
86
85
  cy
87
86
  .wrap($el.contents().find('body'))
88
87
  .wait(WAIT_FOR_FRAME_TO_RENDER)
@@ -120,14 +119,13 @@ export const selectLines = (numLines, direction = 'down') => {
120
119
  export const assertCodePaneContains = (text) => {
121
120
  getCodeEditor().within(() => {
122
121
  const lines = [];
123
- cy.get('.CodeMirror-line')
124
- .each(($el) => lines.push($el.text()))
125
- .then(() => {
126
- const code = lines.join('\n');
127
- // removes code mirrors invisible last line character placeholder
128
- // which is inserted to preserve prettiers new line at end of string.
129
- expect(code.replace(/[\u200b]$/, '')).to.eq(text);
130
- });
122
+ cy.get('.CodeMirror-line').each(($el) => lines.push($el.text()));
123
+ cy.then(() => {
124
+ const code = lines.join('\n');
125
+ // removes code mirrors invisible last line character placeholder
126
+ // which is inserted to preserve prettiers new line at end of string.
127
+ expect(code.replace(/[\u200b]$/, '')).to.eq(text);
128
+ });
131
129
  });
132
130
  };
133
131
 
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "isolatedModules": false,
5
+ "types": ["cypress"]
6
+ },
7
+ "include": ["**/*"], // override the include from the root tsconfig
8
+ "exclude": [] // override the exclude from the root tsconfig
9
+ }
@@ -1,3 +1 @@
1
- import React, { Fragment } from 'react';
2
-
3
- export default ({ children }) => <Fragment>{children}</Fragment>;
1
+ export default ({ children }) => <>{children}</>;
@@ -11,7 +11,10 @@ module.exports = (playroomConfig) => ({
11
11
  options: {
12
12
  presets: [
13
13
  require.resolve('@babel/preset-env'),
14
- require.resolve('@babel/preset-react'),
14
+ [
15
+ require.resolve('@babel/preset-react'),
16
+ { runtime: 'automatic' },
17
+ ],
15
18
  ],
16
19
  },
17
20
  },
@@ -90,7 +90,10 @@ module.exports = async (playroomConfig, options) => {
90
90
  require.resolve('@babel/preset-env'),
91
91
  { shippedProposals: true },
92
92
  ],
93
- require.resolve('@babel/preset-react'),
93
+ [
94
+ require.resolve('@babel/preset-react'),
95
+ { runtime: 'automatic' },
96
+ ],
94
97
  require.resolve('@babel/preset-typescript'),
95
98
  ],
96
99
  },
@@ -109,7 +112,10 @@ module.exports = async (playroomConfig, options) => {
109
112
  require.resolve('@babel/preset-env'),
110
113
  { shippedProposals: true },
111
114
  ],
112
- require.resolve('@babel/preset-react'),
115
+ [
116
+ require.resolve('@babel/preset-react'),
117
+ { runtime: 'automatic' },
118
+ ],
113
119
  ],
114
120
  },
115
121
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playroom",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Design with code, powered by your own component library",
5
5
  "main": "utils/index.js",
6
6
  "types": "utils/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  "react-use": "^17.4.0",
76
76
  "read-pkg-up": "^7.0.1",
77
77
  "scope-eval": "^1.0.0",
78
- "typescript": "^4.5.4",
78
+ "typescript": ">=5.0.0",
79
79
  "use-debounce": "^9.0.2",
80
80
  "webpack": "^5.75.0",
81
81
  "webpack-dev-server": "^4.11.1",
@@ -88,8 +88,8 @@
88
88
  "@types/jest": "^29.2.4",
89
89
  "concurrently": "^7.6.0",
90
90
  "cypress": "^12.0.2",
91
- "eslint": "^8.29.0",
92
- "eslint-config-seek": "^10.1.2",
91
+ "eslint": "^8.44.0",
92
+ "eslint-config-seek": "^11.3.1",
93
93
  "husky": "^8.0.2",
94
94
  "jest": "^29.3.1",
95
95
  "lint-staged": "^13.1.0",
@@ -100,16 +100,16 @@
100
100
  "surge": "^0.23.1"
101
101
  },
102
102
  "peerDependencies": {
103
- "react": "^16.8 || ^17 || ^18",
104
- "react-dom": "^16.8 || ^17 || ^18"
103
+ "react": "^17 || ^18",
104
+ "react-dom": "^17 || ^18"
105
105
  },
106
106
  "packageManager": "pnpm@7.18.1",
107
107
  "volta": {
108
108
  "node": "16.13.0"
109
109
  },
110
110
  "scripts": {
111
- "cypress": "start-server-and-test build-and-serve:all '9000|9001' 'cypress run'",
112
- "cypress:dev": "start-server-and-test start:all '9000|9001' 'cypress open --browser chrome --e2e'",
111
+ "cypress": "start-server-and-test build-and-serve:all '9000|9001|9002' 'cypress run'",
112
+ "cypress:dev": "start-server-and-test start:all '9000|9001|9002' 'cypress open --browser chrome --e2e'",
113
113
  "cypress:verify": "cypress verify",
114
114
  "start:basic": "./bin/cli.js start --config cypress/projects/basic/playroom.config.js",
115
115
  "build:basic": "./bin/cli.js build --config cypress/projects/basic/playroom.config.js",
@@ -117,11 +117,18 @@
117
117
  "start:themed": "./bin/cli.js start --config cypress/projects/themed/playroom.config.js",
118
118
  "build:themed": "./bin/cli.js build --config cypress/projects/themed/playroom.config.js",
119
119
  "serve:themed": "PORT=9001 serve --config ../serve.json --no-request-logging cypress/projects/themed/dist",
120
- "start:all": "concurrently 'npm:start:basic' 'npm:start:themed'",
121
- "build:all": "concurrently 'npm:build:basic' 'npm:build:themed'",
122
- "serve:all": "concurrently 'npm:serve:basic' 'npm:serve:themed'",
120
+ "start:typescript": "./bin/cli.js start --config cypress/projects/typescript/playroom.config.js",
121
+ "build:typescript": "./bin/cli.js build --config cypress/projects/typescript/playroom.config.js",
122
+ "serve:typescript": "PORT=9002 serve --no-request-logging cypress/projects/typescript/dist",
123
+ "start:all": "concurrently 'npm:start:*(!all)'",
124
+ "build:all": "concurrently 'npm:build:*(!all)'",
125
+ "serve:all": "concurrently 'npm:serve:*(!all)'",
123
126
  "build-and-serve:all": "pnpm build:all && pnpm serve:all",
124
- "lint": "eslint . && prettier --list-different '**/*.{js,md,ts,tsx}' && tsc --noEmit",
127
+ "lint": "concurrently 'npm:lint:*'",
128
+ "lint:eslint": "eslint --cache .",
129
+ "lint:prettier": "prettier --list-different '**/*.{js,md,ts,tsx}'",
130
+ "lint:tsc": "tsc --noEmit",
131
+ "lint:cypress": "tsc --project cypress/tsconfig.json",
125
132
  "format": "prettier --write '**/*.{js,md,ts,tsx}'",
126
133
  "version": "changeset version",
127
134
  "release": "changeset publish",
@@ -1,4 +1,4 @@
1
- import React, { ElementType, AllHTMLAttributes, ReactElement } from 'react';
1
+ import type { ElementType, AllHTMLAttributes, ReactElement } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import * as styles from './Button.css';
@@ -1,4 +1,4 @@
1
- import React, { Component, ErrorInfo, ReactNode } from 'react';
1
+ import { Component, type ErrorInfo, type ReactNode } from 'react';
2
2
  import { Text } from '../Text/Text';
3
3
  import { Strong } from '../Strong/Strong';
4
4
 
@@ -1,10 +1,14 @@
1
- import React, { useRef, useContext, useEffect, useCallback } from 'react';
1
+ import { useRef, useContext, useEffect, useCallback } from 'react';
2
+ // @ts-expect-error no types
2
3
  import { useDebouncedCallback } from 'use-debounce';
3
- import { Editor } from 'codemirror';
4
+ import type { Editor } from 'codemirror';
4
5
  import 'codemirror/lib/codemirror.css';
5
6
  import 'codemirror/theme/neo.css';
6
7
 
7
- import { StoreContext, CursorPosition } from '../../StoreContext/StoreContext';
8
+ import {
9
+ StoreContext,
10
+ type CursorPosition,
11
+ } from '../../StoreContext/StoreContext';
8
12
  import { formatCode as format, isMac } from '../../utils/formatting';
9
13
  import {
10
14
  closeFragmentTag,
@@ -1,4 +1,4 @@
1
- import CodeMirror, { Editor } from 'codemirror';
1
+ import CodeMirror, { type Editor } from 'codemirror';
2
2
 
3
3
  export const completeAfter = (cm: Editor, predicate?: () => boolean) => {
4
4
  if (!predicate || predicate()) {
@@ -1,8 +1,8 @@
1
- import CodeMirror, { Editor, Pos } from 'codemirror';
1
+ import CodeMirror, { type Editor, Pos } from 'codemirror';
2
2
 
3
3
  import 'codemirror/addon/search/searchcursor';
4
4
 
5
- import { Direction, Selection } from './types';
5
+ import type { Direction, Selection } from './types';
6
6
 
7
7
  function wordAt(cm: Editor, pos: CodeMirror.Position) {
8
8
  let start = pos.ch;
@@ -1,6 +1,5 @@
1
- import CodeMirror from 'codemirror';
2
- import { Editor, Pos } from 'codemirror';
3
- import { Direction, Selection } from './types';
1
+ import CodeMirror, { type Editor, Pos } from 'codemirror';
2
+ import type { Direction, Selection } from './types';
4
3
  type RangeMethod = Extract<keyof CodeMirror.Range, 'from' | 'to'>;
5
4
 
6
5
  const directionToMethod: Record<Direction, RangeMethod> = {
@@ -1,4 +1,4 @@
1
- import { Editor } from 'codemirror';
1
+ import type { Editor } from 'codemirror';
2
2
 
3
3
  export type Direction = 'up' | 'down';
4
4
 
@@ -1,5 +1,6 @@
1
- import CodeMirror, { Editor, Pos } from 'codemirror';
2
- import { Selection } from './types';
1
+ import type CodeMirror from 'codemirror';
2
+ import { type Editor, Pos } from 'codemirror';
3
+ import type { Selection } from './types';
3
4
 
4
5
  interface TagRange {
5
6
  from: CodeMirror.Position;
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import * as styles from './Divider.css';
4
2
 
5
3
  export const Divider = () => (
@@ -1,4 +1,5 @@
1
- import React, { ReactNode } from 'react';
1
+ import type React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import { useParams } from '../utils/params';
3
4
  import CatchErrors from './CatchErrors/CatchErrors';
4
5
  // @ts-expect-error
@@ -1,8 +1,8 @@
1
- import React, { useRef } from 'react';
1
+ import { useRef } from 'react';
2
2
  import flatMap from 'lodash/flatMap';
3
3
  import Iframe from './Iframe';
4
4
  import { compileJsx } from '../../utils/compileJsx';
5
- import { PlayroomProps } from '../Playroom';
5
+ import type { PlayroomProps } from '../Playroom';
6
6
  import { Strong } from '../Strong/Strong';
7
7
  import { Text } from '../Text/Text';
8
8
  import playroomConfig from '../../config';
@@ -1,9 +1,9 @@
1
- import React, {
1
+ import {
2
2
  useState,
3
3
  useEffect,
4
4
  useRef,
5
- AllHTMLAttributes,
6
- MutableRefObject,
5
+ type AllHTMLAttributes,
6
+ type MutableRefObject,
7
7
  } from 'react';
8
8
  import { useIntersection } from 'react-use';
9
9
 
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,4 +1,4 @@
1
- import React, { useContext, ReactNode } from 'react';
1
+ import { useContext, type ReactNode } from 'react';
2
2
  import Checkmark from './CheckmarkSvg';
3
3
  import { Heading } from '../Heading/Heading';
4
4
  import { ToolbarPanel } from '../ToolbarPanel/ToolbarPanel';
@@ -1,4 +1,4 @@
1
- import React, { ElementType, ReactNode } from 'react';
1
+ import React, { type ElementType, type ReactNode } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import * as styles from './Heading.css';
@@ -1,4 +1,4 @@
1
- import React, { ReactElement, Children } from 'react';
1
+ import { type ReactElement, Children } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import * as styles from './Inline.css';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  interface Props {
4
2
  size?: number | string;
5
3
  }
@@ -1,15 +1,19 @@
1
- import React, { useContext, ComponentType, Fragment } from 'react';
1
+ import { useContext, type ComponentType, Fragment } from 'react';
2
2
  import classnames from 'classnames';
3
+ // @ts-expect-error no types
3
4
  import { useDebouncedCallback } from 'use-debounce';
4
5
  import { Resizable } from 're-resizable';
5
6
  import Frames from './Frames/Frames';
6
7
  import { WindowPortal } from './WindowPortal';
7
- import { Snippets } from '../../utils';
8
+ import type { Snippets } from '../../utils';
8
9
  import componentsToHints from '../utils/componentsToHints';
9
10
  import Toolbar, { toolbarItemCount } from './Toolbar/Toolbar';
10
11
  import ChevronIcon from './icons/ChevronIcon';
11
12
  import { StatusMessage } from './StatusMessage/StatusMessage';
12
- import { StoreContext, EditorPosition } from '../StoreContext/StoreContext';
13
+ import {
14
+ StoreContext,
15
+ type EditorPosition,
16
+ } from '../StoreContext/StoreContext';
13
17
 
14
18
  const MIN_HEIGHT = toolbarItemSize * toolbarItemCount;
15
19
  const MIN_WIDTH = toolbarOpenSize + toolbarItemSize + 80;
@@ -1,4 +1,4 @@
1
- import React, { ComponentType, ReactNode } from 'react';
1
+ import type { ComponentType, ReactNode } from 'react';
2
2
  import lzString from 'lz-string';
3
3
 
4
4
  import { useParams } from '../utils/params';
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
  import copy from 'copy-to-clipboard';
3
3
 
4
4
  import TickIcon from '../icons/TickIcon';
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import { useState } from 'react';
2
2
 
3
3
  import usePreviewUrl from '../../utils/usePreviewUrl';
4
4
  import { ThemeSelector } from './ThemeSelector';
@@ -1,4 +1,4 @@
1
- import React, { Fragment } from 'react';
1
+ import { Fragment } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import ChevronIcon from '../icons/ChevronIcon';
@@ -1,9 +1,9 @@
1
- import React, { useContext, ReactChild } from 'react';
1
+ import React, { useContext, type ReactChild } from 'react';
2
2
  import { Heading } from '../Heading/Heading';
3
3
  import { ToolbarPanel } from '../ToolbarPanel/ToolbarPanel';
4
4
  import {
5
- ColorScheme,
6
- EditorPosition,
5
+ type ColorScheme,
6
+ type EditorPosition,
7
7
  StoreContext,
8
8
  } from '../../StoreContext/StoreContext';
9
9
  import { Stack } from '../Stack/Stack';
@@ -1,4 +1,4 @@
1
- import React, { AllHTMLAttributes } from 'react';
1
+ import type { AllHTMLAttributes } from 'react';
2
2
 
3
3
  import * as styles from './SearchField.css';
4
4
 
@@ -1,9 +1,10 @@
1
- import React, { useState, useEffect, useMemo, useRef } from 'react';
1
+ import { useState, useEffect, useMemo, useRef } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import fuzzy from 'fuzzy';
4
+ // @ts-expect-error no types
4
5
  import { useDebouncedCallback } from 'use-debounce';
5
- import { PlayroomProps } from '../Playroom';
6
- import { Snippet } from '../../../utils';
6
+ import type { PlayroomProps } from '../Playroom';
7
+ import type { Snippet } from '../../../utils';
7
8
  import SearchField from './SearchField/SearchField';
8
9
  import { Strong } from '../Strong/Strong';
9
10
  import { Text } from '../Text/Text';
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { Logo } from '../Logo/Logo';
4
4
 
@@ -1,4 +1,4 @@
1
- import React, { ReactElement, Children } from 'react';
1
+ import { type ReactElement, Children } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import { Divider } from '../Divider/Divider';
@@ -1,10 +1,4 @@
1
- import React, {
2
- useContext,
3
- useState,
4
- useEffect,
5
- useRef,
6
- useCallback,
7
- } from 'react';
1
+ import { useContext, useState, useEffect, useRef, useCallback } from 'react';
8
2
  import classnames from 'classnames';
9
3
  import { StoreContext } from '../../StoreContext/StoreContext';
10
4
  import { Text } from '../Text/Text';
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
 
3
3
  import * as styles from './Strong.css';
4
4
 
@@ -1,4 +1,4 @@
1
- import React, { ElementType, ReactNode } from 'react';
1
+ import React, { type ElementType, type ReactNode } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import * as styles from './Text.css';
@@ -1,7 +1,7 @@
1
- import React, { useContext, useState, useCallback } from 'react';
1
+ import { useContext, useState, useCallback } from 'react';
2
2
  import { useTimeoutFn } from 'react-use';
3
3
  import classnames from 'classnames';
4
- import { PlayroomProps } from '../Playroom';
4
+ import type { PlayroomProps } from '../Playroom';
5
5
  import { StoreContext } from '../../StoreContext/StoreContext';
6
6
  import FramesPanel from '../FramesPanel/FramesPanel';
7
7
  import PreviewPanel from '../PreviewPanel/PreviewPanel';
@@ -1,4 +1,4 @@
1
- import React, { ReactChild } from 'react';
1
+ import type { ReactChild } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import TickIcon from '../icons/TickIcon';
4
4
 
@@ -1,4 +1,4 @@
1
- import React, { ElementType, ReactNode } from 'react';
1
+ import React, { type ElementType, type ReactNode } from 'react';
2
2
 
3
3
  import * as styles from './ToolbarPanel.css';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ReactNode, useEffect, useRef, useState } from 'react';
1
+ import { type ReactNode, useEffect, useRef, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
 
4
4
  import playroomConfig from '../../config';
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
  import classnames from 'classnames';
3
3
 
4
4
  import * as styles from './ChevronIcon.css';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  export default () => (
4
2
  <svg
5
3
  xmlns="http://www.w3.org/2000/svg"
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  export default () => (
4
2
  <svg
5
3
  xmlns="http://www.w3.org/2000/svg"
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  export default () => (
4
2
  <svg
5
3
  xmlns="http://www.w3.org/2000/svg"
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  interface Props {
4
2
  size?: number | string;
5
3
  }
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  interface PlayIconProps {
4
2
  size?: number;
5
3
  }
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  export default () => (
4
2
  <svg
5
3
  xmlns="http://www.w3.org/2000/svg"
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  interface Props {
4
2
  size?: number;
5
3
  }
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  interface TickIconProps {
4
2
  size?: number;
5
3
  }
@@ -1,4 +1,4 @@
1
- import React, { SVGProps } from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
3
  export default (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
@@ -1,20 +1,21 @@
1
- import React, {
1
+ import {
2
2
  useEffect,
3
3
  createContext,
4
4
  useReducer,
5
- ReactNode,
6
- Dispatch,
5
+ type ReactNode,
6
+ type Dispatch,
7
7
  } from 'react';
8
8
  import copy from 'copy-to-clipboard';
9
9
  import localforage from 'localforage';
10
10
  import lzString from 'lz-string';
11
11
  import dedent from 'dedent';
12
+ // @ts-expect-error no types
12
13
  import { useDebouncedCallback } from 'use-debounce';
13
14
 
14
- import { Snippet, compressParams } from '../../utils';
15
+ import { type Snippet, compressParams } from '../../utils';
15
16
  import { formatForInsertion, formatAndInsert } from '../utils/formatting';
16
17
  import { getParamsFromQuery, updateUrlCode } from '../utils/params';
17
- import { PlayroomProps } from '../Playroom/Playroom';
18
+ import type { PlayroomProps } from '../Playroom/Playroom';
18
19
  import { isValidLocation } from '../utils/cursor';
19
20
  import playroomConfig from '../config';
20
21
 
package/src/frame.js CHANGED
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { renderElement } from './render';
3
2
  import Frame from './Playroom/Frame';
4
3
 
package/src/index.d.ts CHANGED
@@ -13,6 +13,7 @@ interface PlayroomConfig {
13
13
  baseUrl?: string;
14
14
  paramType: 'hash' | 'search';
15
15
  iframeSandbox?: string;
16
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
16
17
  reactDocgenTypescriptConfig?: import('react-docgen-typescript').ParserOptions;
17
18
  }
18
19
 
package/src/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { renderElement } from './render';
4
2
  import Playroom from './Playroom/Playroom';
5
3
  import { StoreProvider } from './StoreContext/StoreContext';
package/src/preview.js CHANGED
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { renderElement } from './render';
3
2
  import Preview from './Playroom/Preview';
4
3
 
@@ -1,7 +1,7 @@
1
1
  import omit from 'lodash/omit';
2
2
  // @ts-expect-error
3
3
  import parsePropTypes from 'parse-prop-types';
4
- import { PlayroomProps } from '../Playroom/Playroom';
4
+ import type { PlayroomProps } from '../Playroom/Playroom';
5
5
 
6
6
  const staticTypes = __PLAYROOM_GLOBAL__STATIC_TYPES__;
7
7
 
@@ -1,4 +1,4 @@
1
- import { CursorPosition } from '../StoreContext/StoreContext';
1
+ import type { CursorPosition } from '../StoreContext/StoreContext';
2
2
  import { validateCode } from './compileJsx';
3
3
 
4
4
  const breakoutString = '<b>"b"</b>';
@@ -1,6 +1,6 @@
1
1
  import prettier from 'prettier/standalone';
2
2
  import babel from 'prettier/parser-babel';
3
- import { CursorPosition } from '../StoreContext/StoreContext';
3
+ import type { CursorPosition } from '../StoreContext/StoreContext';
4
4
  import { insertAtCursor } from './cursor';
5
5
 
6
6
  export interface CodeWithCursor {
@@ -1,6 +1,6 @@
1
1
  import { createBrowserHistory } from 'history';
2
2
  import { useState, useEffect } from 'react';
3
- import queryString, { ParsedQuery } from 'query-string';
3
+ import queryString, { type ParsedQuery } from 'query-string';
4
4
 
5
5
  import playroomConfig from '../config';
6
6
 
package/tsconfig.json CHANGED
@@ -2,14 +2,19 @@
2
2
  "compilerOptions": {
3
3
  "noEmit": true,
4
4
  "skipLibCheck": true,
5
- "esModuleInterop": true,
5
+ "moduleResolution": "bundler",
6
+ "module": "es2022",
6
7
  "allowSyntheticDefaultImports": true,
8
+ "esModuleInterop": true,
9
+ "isolatedModules": true,
7
10
  "resolveJsonModule": true,
8
11
  "noUnusedLocals": true,
9
12
  "strict": true,
10
- "jsx": "preserve",
11
- "lib": ["dom", "es2019"],
12
- "target": "es5"
13
+ "forceConsistentCasingInFileNames": true,
14
+ "jsx": "react-jsx",
15
+ "lib": ["dom", "es2022"],
16
+ "target": "es2022"
13
17
  },
14
- "include": ["lib", "src", "@types"]
18
+ "include": ["src", "@types"],
19
+ "exclude": ["cypress", "node_modules"]
15
20
  }
package/cypress/.eslintrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "plugins": [
3
- "cypress"
4
- ],
5
- "extends": [
6
- "seek",
7
- "plugin:cypress/recommended"
8
- ],
9
- "env": {
10
- "cypress/globals": true
11
- }
12
- }
File without changes