playroom 0.34.2 → 0.36.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 (38) hide show
  1. package/.github/workflows/preview-site.yml +3 -3
  2. package/.github/workflows/release.yml +3 -3
  3. package/.github/workflows/snapshot.yml +3 -3
  4. package/.github/workflows/validate.yml +5 -5
  5. package/.nvmrc +1 -1
  6. package/CHANGELOG.md +55 -0
  7. package/README.md +6 -0
  8. package/bin/cli.cjs +2 -1
  9. package/cypress/e2e/editor.cy.js +1 -1
  10. package/cypress/e2e/keymaps.cy.js +1507 -11
  11. package/cypress/e2e/scope.cy.js +1 -1
  12. package/cypress/e2e/smoke.cy.js +2 -2
  13. package/cypress/e2e/toolbar.cy.js +1 -2
  14. package/cypress/e2e/urlHandling.cy.js +4 -5
  15. package/cypress/support/utils.js +62 -54
  16. package/lib/makeWebpackConfig.js +0 -3
  17. package/lib/provideDefaultConfig.js +13 -2
  18. package/package.json +18 -17
  19. package/src/Playroom/CatchErrors/CatchErrors.tsx +5 -6
  20. package/src/Playroom/CodeEditor/CodeEditor.tsx +11 -0
  21. package/src/Playroom/CodeEditor/keymaps/comment.ts +326 -0
  22. package/src/Playroom/CodeEditor/keymaps/wrap.ts +4 -1
  23. package/src/Playroom/Frame.tsx +9 -5
  24. package/src/Playroom/FramesPanel/FramesPanel.css.ts +19 -0
  25. package/src/Playroom/FramesPanel/FramesPanel.tsx +89 -46
  26. package/src/Playroom/Preview.tsx +12 -3
  27. package/src/Playroom/PreviewPanel/PreviewPanel.tsx +1 -1
  28. package/src/Playroom/SettingsPanel/SettingsPanel.tsx +11 -7
  29. package/src/Playroom/Stack/Stack.css.ts +4 -35
  30. package/src/Playroom/Stack/Stack.tsx +2 -9
  31. package/src/Playroom/Toolbar/Toolbar.tsx +2 -2
  32. package/src/Playroom/sprinkles.css.ts +1 -0
  33. package/src/StoreContext/StoreContext.tsx +31 -6
  34. package/src/index.d.ts +2 -0
  35. package/src/utils/params.ts +5 -8
  36. package/src/utils/usePreviewUrl.ts +2 -1
  37. package/utils/index.d.ts +3 -0
  38. package/utils/index.js +21 -7
@@ -13,13 +13,13 @@ jobs:
13
13
  CI: true
14
14
  steps:
15
15
  - name: Checkout Repo
16
- uses: actions/checkout@v3
16
+ uses: actions/checkout@v4
17
17
 
18
18
  - name: Set up pnpm
19
- uses: pnpm/action-setup@v2.2.4
19
+ uses: pnpm/action-setup@v3
20
20
 
21
21
  - name: Set up Node.js
22
- uses: actions/setup-node@v3
22
+ uses: actions/setup-node@v4
23
23
  with:
24
24
  node-version-file: 'package.json'
25
25
  cache: 'pnpm'
@@ -13,17 +13,17 @@ jobs:
13
13
  CI: true
14
14
  steps:
15
15
  - name: Checkout Repo
16
- uses: actions/checkout@v3
16
+ uses: actions/checkout@v4
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
20
  token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
21
21
 
22
22
  - name: Set up pnpm
23
- uses: pnpm/action-setup@v2
23
+ uses: pnpm/action-setup@v3
24
24
 
25
25
  - name: Set up Node.js
26
- uses: actions/setup-node@v3
26
+ uses: actions/setup-node@v4
27
27
  with:
28
28
  node-version-file: 'package.json'
29
29
  cache: 'pnpm'
@@ -10,17 +10,17 @@ jobs:
10
10
  CI: true
11
11
  steps:
12
12
  - name: Check out repo
13
- uses: actions/checkout@v3
13
+ uses: actions/checkout@v4
14
14
  with:
15
15
  # This makes Actions fetch all Git history for semantic-release
16
16
  fetch-depth: 0
17
17
  token: ${{ secrets.GITHUB_TOKEN }}
18
18
 
19
19
  - name: Set up pnpm
20
- uses: pnpm/action-setup@v2.2.4
20
+ uses: pnpm/action-setup@v3
21
21
 
22
22
  - name: Set up Node.js
23
- uses: actions/setup-node@v3
23
+ uses: actions/setup-node@v4
24
24
  with:
25
25
  node-version-file: 'package.json'
26
26
  cache: 'pnpm'
@@ -13,13 +13,13 @@ jobs:
13
13
  CI: true
14
14
  steps:
15
15
  - name: Checkout Repo
16
- uses: actions/checkout@v3
16
+ uses: actions/checkout@v4
17
17
 
18
18
  - name: Set up pnpm
19
- uses: pnpm/action-setup@v2.2.4
19
+ uses: pnpm/action-setup@v3
20
20
 
21
21
  - name: Set up Node.js
22
- uses: actions/setup-node@v3
22
+ uses: actions/setup-node@v4
23
23
  with:
24
24
  node-version-file: 'package.json'
25
25
 
@@ -30,7 +30,7 @@ jobs:
30
30
  echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
31
31
 
32
32
  - name: Cache node modules
33
- uses: actions/cache@v3
33
+ uses: actions/cache@v4
34
34
  with:
35
35
  path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
36
36
  key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -39,7 +39,7 @@ jobs:
39
39
 
40
40
  - name: Cache Cypress binary
41
41
  id: cypress-cache
42
- uses: actions/cache@v3
42
+ uses: actions/cache@v4
43
43
  with:
44
44
  path: ~/.cache/Cypress
45
45
  key: cypress-${{ runner.os }}-cypress-${{ hashFiles('**/pnpm-lock.yaml') }}
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.13.0
1
+ 18.19.1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # playroom
2
2
 
3
+ ## 0.36.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c3f0373: Drop support for Node versions <18.12.0
8
+ - 90edcc8: Add keybinding for copying Playroom link to clipboard with <kbd>⌘</kbd> + <kbd>⇧</kbd> + <kbd>C</kbd> (or, on Windows, <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>C</kbd>).
9
+ - c99cc30: Add keybinding to toggle comment syntax for the current selection.
10
+
11
+ Pressing <kbd>Cmd</kbd> + <kbd>/</kbd> (or, on Windows, <kbd>Ctrl</kbd> + <kbd>/</kbd>) will toggle comment syntax for the currently selected text.
12
+ If no text is selected, the line the cursor is on will toggle comment syntax.
13
+
14
+ ### Patch Changes
15
+
16
+ - dd95719: Add 'Insert snippet' shortcut to 'Keyboard Shortcuts' list in settings panel for better discoverability.
17
+ - cad1ded: Remove dependency on `current-git-branch` package
18
+ - 0215bb4: Replace `query-string` dependency with `URLSearchParams`
19
+ - 6ad5895: Update shortcut format for Windows users for consistency with standard styling.
20
+ - cb3c427: In the Settings Panel, sort keyboard shortcuts order by most frequently and widely used. Related shortcuts are grouped together.
21
+ - b1766c2: Move Title setting from Settings Panel to Frame Panel to group current playroom settings together and improve discoverability.
22
+
23
+ Now, all settings that affect the current playroom tab live in the Frame Panel.
24
+ Settings affecting all playroom tabs live in the Settings Panel.
25
+
26
+ - 41e8cfa: Fix an issue where new Playroom tabs without a set title would load a recently used title.
27
+ - 134c5a4: Upgrade `webpack-dev-server` to v5
28
+ - c3f0373: Update dependencies
29
+ - f88a4e6: Fix async import of playroom config on Windows
30
+
31
+ ## 0.35.0
32
+
33
+ ### Minor Changes
34
+
35
+ - ad60e01: Add support for specifying default subsets of themes and screen widths via the config.
36
+
37
+ #### Example usage
38
+
39
+ ```js
40
+ // playroom.config.js
41
+ module.exports = {
42
+ ...,
43
+ defaultVisibleWidths: [
44
+ // subset of widths to display on first load
45
+ ],
46
+ defaultVisibleThemes: [
47
+ // subset of themes to display on first load
48
+ ],
49
+ }
50
+ ```
51
+
52
+ - f45dd04: Add ability to customise tab titles via a "Title" section in the settings panel.
53
+
54
+ ### Patch Changes
55
+
56
+ - f491105: Fix bug in "Wrap selection in tag" command that caused the start cursor to occasionally be placed in the wrong postion.
57
+
3
58
  ## 0.34.2
4
59
 
5
60
  ### Patch Changes
package/README.md CHANGED
@@ -80,6 +80,12 @@ module.exports = {
80
80
  // Custom webpack config goes here...
81
81
  }),
82
82
  iframeSandbox: 'allow-scripts',
83
+ defaultVisibleWidths: [
84
+ // subset of widths to display on first load
85
+ ],
86
+ defaultVisibleThemes: [
87
+ // subset of themes to display on first load
88
+ ],
83
89
  };
84
90
  ```
85
91
 
package/bin/cli.cjs CHANGED
@@ -4,6 +4,7 @@ const commandLineArgs = require('command-line-args');
4
4
  const commandLineUsage = require('command-line-usage');
5
5
  const findUp = require('find-up');
6
6
  const lib = require('../lib');
7
+ const url = require('url');
7
8
 
8
9
  const showUsage = () => {
9
10
  console.log(
@@ -65,7 +66,7 @@ const showUsage = () => {
65
66
  process.exit(1);
66
67
  }
67
68
 
68
- const { default: config } = await import(configPath);
69
+ const { default: config } = await import(url.pathToFileURL(configPath));
69
70
 
70
71
  const playroom = lib({
71
72
  cwd: path.dirname(configPath),
@@ -21,7 +21,7 @@ describe('Editor', () => {
21
21
  });
22
22
 
23
23
  it('autocompletes', () => {
24
- typeCode('<F{enter} c{enter}={downarrow}{enter} />');
24
+ typeCode('<F{enter} c{enter}={downarrow}{enter} />', { delay: 100 });
25
25
  assertFirstFrameContains('Foo');
26
26
  assertCodePaneContains('<Foo color="blue" />');
27
27
  });