playroom 0.37.1 → 0.38.1

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 (82) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +4 -0
  3. package/lib/start.js +3 -0
  4. package/package.json +17 -5
  5. package/src/Playroom/Box/Box.tsx +33 -0
  6. package/src/Playroom/Button/Button.css.ts +3 -2
  7. package/src/Playroom/Button/Button.tsx +0 -1
  8. package/src/Playroom/CodeEditor/CodeEditor.css.ts +5 -4
  9. package/src/Playroom/Frames/Frames.css.ts +21 -42
  10. package/src/Playroom/Frames/Frames.tsx +31 -28
  11. package/src/Playroom/FramesPanel/FramesPanel.css.ts +8 -24
  12. package/src/Playroom/FramesPanel/FramesPanel.tsx +89 -116
  13. package/src/Playroom/Heading/Heading.css.ts +2 -1
  14. package/src/Playroom/Inline/Inline.css.ts +22 -49
  15. package/src/Playroom/Inline/Inline.tsx +12 -16
  16. package/src/Playroom/Playroom.css.ts +2 -1
  17. package/src/Playroom/Playroom.tsx +22 -0
  18. package/src/Playroom/PreviewPanel/CopyButton.tsx +0 -1
  19. package/src/Playroom/PreviewPanel/PreviewPanel.tsx +2 -3
  20. package/src/Playroom/SettingsPanel/SettingsPanel.css.ts +12 -25
  21. package/src/Playroom/SettingsPanel/SettingsPanel.tsx +76 -73
  22. package/src/Playroom/Snippets/SearchField/SearchField.css.ts +2 -1
  23. package/src/Playroom/Snippets/SearchField/SearchField.tsx +3 -3
  24. package/src/Playroom/Snippets/Snippets.css.ts +4 -3
  25. package/src/Playroom/Snippets/Snippets.tsx +3 -3
  26. package/src/Playroom/Stack/Stack.css.ts +4 -6
  27. package/src/Playroom/Stack/Stack.tsx +4 -19
  28. package/src/Playroom/StatusMessage/StatusMessage.css.ts +2 -1
  29. package/src/Playroom/Toolbar/Toolbar.css.ts +35 -41
  30. package/src/Playroom/Toolbar/Toolbar.tsx +37 -36
  31. package/src/Playroom/ToolbarItem/ToolbarItem.css.ts +2 -1
  32. package/src/Playroom/ToolbarItem/ToolbarItem.tsx +1 -4
  33. package/src/Playroom/ToolbarPanel/ToolbarPanel.tsx +1 -7
  34. package/src/Playroom/icons/ChevronIcon.css.ts +1 -1
  35. package/src/Playroom/sprinkles.css.ts +9 -49
  36. package/src/Playroom/vars.css.ts +47 -0
  37. package/.changeset/README.md +0 -8
  38. package/.changeset/config.json +0 -11
  39. package/.editorconfig +0 -13
  40. package/.eslintignore +0 -4
  41. package/.eslintrc +0 -16
  42. package/.github/CODEOWNERS +0 -5
  43. package/.github/workflows/preview-site.yml +0 -42
  44. package/.github/workflows/release.yml +0 -41
  45. package/.github/workflows/snapshot.yml +0 -35
  46. package/.github/workflows/validate.yml +0 -63
  47. package/.husky/pre-commit +0 -4
  48. package/.nvmrc +0 -1
  49. package/.prettierignore +0 -4
  50. package/.prettierrc +0 -3
  51. package/cypress/e2e/editor.cy.js +0 -35
  52. package/cypress/e2e/keymaps.cy.js +0 -2025
  53. package/cypress/e2e/scope.cy.js +0 -16
  54. package/cypress/e2e/smoke.cy.js +0 -28
  55. package/cypress/e2e/snippets.cy.js +0 -117
  56. package/cypress/e2e/toolbar.cy.js +0 -52
  57. package/cypress/e2e/urlHandling.cy.js +0 -50
  58. package/cypress/projects/basic/components.js +0 -26
  59. package/cypress/projects/basic/playroom.config.js +0 -8
  60. package/cypress/projects/basic/snippets.js +0 -27
  61. package/cypress/projects/basic/useScope.js +0 -4
  62. package/cypress/projects/themed/components.js +0 -26
  63. package/cypress/projects/themed/playroom.config.js +0 -10
  64. package/cypress/projects/themed/serve.json +0 -3
  65. package/cypress/projects/themed/snippets.js +0 -22
  66. package/cypress/projects/themed/themes.js +0 -2
  67. package/cypress/projects/typescript/components/Bar.tsx +0 -13
  68. package/cypress/projects/typescript/components/Foo.tsx +0 -13
  69. package/cypress/projects/typescript/components/styles.ts +0 -4
  70. package/cypress/projects/typescript/components.ts +0 -2
  71. package/cypress/projects/typescript/playroom.config.js +0 -33
  72. package/cypress/projects/typescript/snippets.ts +0 -22
  73. package/cypress/projects/typescript/tsconfig.json +0 -18
  74. package/cypress/support/commands.js +0 -10
  75. package/cypress/support/e2e.js +0 -1
  76. package/cypress/support/utils.js +0 -236
  77. package/cypress/tsconfig.json +0 -9
  78. package/cypress.config.mjs +0 -7
  79. package/scripts/postCommitStatus.js +0 -50
  80. package/src/Playroom/Divider/Divider.css.ts +0 -16
  81. package/src/Playroom/Divider/Divider.tsx +0 -7
  82. package/tsconfig.json +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # playroom
2
2
 
3
+ ## 0.38.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a62002d: Apply `title` from url on page load
8
+
9
+ Previously the document `title` would only update when the frames panel is open.
10
+ The title is now correctly reflected from the url on page load.
11
+
12
+ - cf0fa9e: start: Disable webpack error overlay
13
+
14
+ Prevent the default webpack dev server error overlay from blocking the preview frames in `start` mode.
15
+ Playroom handles its own errors, and this would block the preview frames and need to be dismissed manually.
16
+
17
+ ## 0.38.0
18
+
19
+ ### Minor Changes
20
+
21
+ - 7df36e3: Improve frame filtering UX.
22
+
23
+ - Allow users to select all checkboxes in a frame filter section, rather than automatically unselecting all checkboxes when all are selected.
24
+ - Rename the "Show all" button to "Clear" to reinforce the filtering pattern.
25
+
26
+ - 384810e: Use CSS gap and grid for layout spacing in Playroom UI.
27
+
28
+ ### Patch Changes
29
+
30
+ - a0724d2: Fixes a bug in the side panel exit animation that was causing the contents to vanish abruptly
31
+ - 934a017: Exclude irrelevant files from published package
32
+ - 92a0039: Fix Playroom UI icon centering
33
+ - 422a259: Remove `data-testid` attributes from UI elements
34
+
3
35
  ## 0.37.1
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -208,6 +208,10 @@ Playroom supports loading [ESM](https://nodejs.org/api/esm.html#introduction) co
208
208
 
209
209
  If you are interested in integrating Playroom into Storybook, check out [storybook-addon-playroom](https://github.com/rbardini/storybook-addon-playroom).
210
210
 
211
+ ## Browser Support
212
+
213
+ Playroom is built to work on the latest stable versions of all major browsers. Some features may not work as expected in older browsers.
214
+
211
215
  ## License
212
216
 
213
217
  MIT.
package/lib/start.js CHANGED
@@ -30,6 +30,9 @@ module.exports = async (config, callback) => {
30
30
  devMiddleware: {
31
31
  stats: false,
32
32
  },
33
+ client: {
34
+ overlay: false,
35
+ },
33
36
  compress: true,
34
37
  static: {
35
38
  watch: { ignored: /node_modules/ },
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "playroom",
3
- "version": "0.37.1",
3
+ "version": "0.38.1",
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",
7
7
  "bin": {
8
8
  "playroom": "bin/cli.cjs"
9
9
  },
10
+ "files": [
11
+ "CHANGELOG.md",
12
+ ".babelrc",
13
+ "images",
14
+ "lib",
15
+ "src",
16
+ "utils"
17
+ ],
10
18
  "lint-staged": {
11
19
  "**/*.{js,ts,tsx}": [
12
20
  "eslint"
@@ -44,6 +52,7 @@
44
52
  "@vanilla-extract/webpack-plugin": "^2.3.6",
45
53
  "babel-loader": "^9.1.0",
46
54
  "classnames": "^2.3.2",
55
+ "clsx": "^2.1.1",
47
56
  "codemirror": "^5.65.10",
48
57
  "command-line-args": "^5.2.1",
49
58
  "command-line-usage": "^6.1.3",
@@ -69,6 +78,7 @@
69
78
  "re-resizable": "^6.9.9",
70
79
  "react-docgen-typescript": "^2.2.2",
71
80
  "react-helmet": "^6.1.0",
81
+ "react-transition-group": "^4.4.5",
72
82
  "react-use": "^17.4.0",
73
83
  "read-pkg-up": "^7.0.1",
74
84
  "scope-eval": "^1.0.0",
@@ -83,11 +93,13 @@
83
93
  "@actions/core": "^1.10.0",
84
94
  "@changesets/cli": "^2.25.2",
85
95
  "@octokit/rest": "^19.0.5",
96
+ "@testing-library/cypress": "^10.0.1",
86
97
  "@types/jest": "^29.2.4",
87
98
  "@types/react-helmet": "^6.1.6",
99
+ "@types/react-transition-group": "^4.4.10",
88
100
  "concurrently": "^7.6.0",
89
101
  "cypress": "^13.6.6",
90
- "eslint": "^8.44.0",
102
+ "eslint": "^8.56.0",
91
103
  "eslint-config-seek": "^11.3.1",
92
104
  "husky": "^8.0.2",
93
105
  "jest": "^29.3.1",
@@ -115,19 +127,19 @@
115
127
  "cypress:verify": "cypress verify",
116
128
  "start:basic": "./bin/cli.cjs start --config cypress/projects/basic/playroom.config.js",
117
129
  "build:basic": "./bin/cli.cjs build --config cypress/projects/basic/playroom.config.js",
118
- "serve:basic": "PORT=9000 serve --no-request-logging cypress/projects/basic/dist",
130
+ "serve:basic": "PORT=9000 serve --config ../serve.json --no-request-logging cypress/projects/basic/dist",
119
131
  "start:themed": "./bin/cli.cjs start --config cypress/projects/themed/playroom.config.js",
120
132
  "build:themed": "./bin/cli.cjs build --config cypress/projects/themed/playroom.config.js",
121
133
  "serve:themed": "PORT=9001 serve --config ../serve.json --no-request-logging cypress/projects/themed/dist",
122
134
  "start:typescript": "./bin/cli.cjs start --config cypress/projects/typescript/playroom.config.js",
123
135
  "build:typescript": "./bin/cli.cjs build --config cypress/projects/typescript/playroom.config.js",
124
- "serve:typescript": "PORT=9002 serve --no-request-logging cypress/projects/typescript/dist",
136
+ "serve:typescript": "PORT=9002 serve --config ../serve.json --no-request-logging cypress/projects/typescript/dist",
125
137
  "start:all": "concurrently 'npm:start:*(!all)'",
126
138
  "build:all": "concurrently 'npm:build:*(!all)'",
127
139
  "serve:all": "concurrently 'npm:serve:*(!all)'",
128
140
  "build-and-serve:all": "pnpm build:all && pnpm serve:all",
129
141
  "lint": "concurrently 'npm:lint:*'",
130
- "lint:eslint": "eslint --cache .",
142
+ "lint:eslint": "NODE_OPTIONS=--max_old_space_size=8192 eslint --cache .",
131
143
  "lint:prettier": "prettier --list-different '**/*.{js,md,ts,tsx}'",
132
144
  "lint:tsc": "tsc --noEmit",
133
145
  "lint:cypress": "tsc --project cypress/tsconfig.json",
@@ -0,0 +1,33 @@
1
+ import clsx, { type ClassValue } from 'clsx';
2
+ import type { AllHTMLAttributes, ElementType } from 'react';
3
+ import { sprinkles, type Sprinkles } from '../sprinkles.css';
4
+
5
+ interface BoxProps
6
+ extends Omit<
7
+ AllHTMLAttributes<HTMLElement>,
8
+ 'width' | 'height' | 'className' | 'data'
9
+ >,
10
+ Sprinkles {
11
+ className?: ClassValue;
12
+ component?: ElementType;
13
+ }
14
+
15
+ export const Box = ({
16
+ component = 'div',
17
+ className,
18
+ ...restProps
19
+ }: BoxProps) => {
20
+ const atomProps: Record<string, unknown> = {};
21
+
22
+ for (const key in restProps) {
23
+ if (sprinkles.properties.has(key as keyof Sprinkles)) {
24
+ atomProps[key] = restProps[key as keyof typeof restProps];
25
+ delete restProps[key as keyof typeof restProps];
26
+ }
27
+ }
28
+
29
+ const classes = clsx(className, sprinkles({ ...atomProps }));
30
+ const Component = component;
31
+
32
+ return <Component className={classes} {...restProps} />;
33
+ };
@@ -1,6 +1,7 @@
1
1
  import { style, createVar } from '@vanilla-extract/css';
2
2
  import { calc } from '@vanilla-extract/css-utils';
3
- import { sprinkles, vars, colorPaletteVars } from '../sprinkles.css';
3
+ import { sprinkles, colorPaletteVars } from '../sprinkles.css';
4
+ import { vars } from '../vars.css';
4
5
 
5
6
  export const reset = style([
6
7
  sprinkles({
@@ -78,7 +79,7 @@ export const positive = style({
78
79
  });
79
80
 
80
81
  export const iconContainer = style([
81
- sprinkles({ position: 'relative', paddingLeft: 'medium' }),
82
+ sprinkles({ position: 'relative', paddingLeft: 'small' }),
82
83
  {
83
84
  top: '1px',
84
85
  },
@@ -7,7 +7,6 @@ interface BaseProps {
7
7
  as?: ElementType;
8
8
  tone?: 'positive';
9
9
  icon?: ReactElement;
10
- 'data-testid'?: string;
11
10
  }
12
11
 
13
12
  interface ButtonProps
@@ -1,5 +1,6 @@
1
1
  import { style, globalStyle, keyframes, createVar } from '@vanilla-extract/css';
2
- import { vars, colorPaletteVars, sprinkles } from '../sprinkles.css';
2
+ import { colorPaletteVars, sprinkles } from '../sprinkles.css';
3
+ import { vars } from '../vars.css';
3
4
  import { toolbarItemSize } from '../ToolbarItem/ToolbarItem.css';
4
5
 
5
6
  const minimumLineNumberWidth = '50px';
@@ -296,9 +297,9 @@ globalStyle('.CodeMirror-dialog button', {
296
297
  appearance: 'none',
297
298
  font: vars.font.scale.standard,
298
299
  fontFamily: vars.font.family.standard,
299
- marginLeft: vars.space.medium,
300
- paddingTop: vars.space.medium,
301
- paddingBottom: vars.space.medium,
300
+ marginLeft: vars.space.small,
301
+ paddingTop: vars.space.small,
302
+ paddingBottom: vars.space.small,
302
303
  paddingLeft: vars.space.large,
303
304
  paddingRight: vars.space.large,
304
305
  alignSelf: 'center',
@@ -1,50 +1,29 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { sprinkles } from '../sprinkles.css';
3
3
 
4
- export const root = style([
5
- sprinkles({
6
- height: 'full',
7
- width: 'full',
8
- whiteSpace: 'nowrap',
9
- display: 'flex',
10
- boxSizing: 'border-box',
11
- paddingY: 'gutter',
12
- paddingLeft: 'gutter',
13
- textAlign: 'center',
14
- }),
15
- {
16
- overflowX: 'auto',
17
- overflowY: 'hidden',
18
- // // Simulate centering when fewer frames than viewport width.
19
- '::before': {
20
- content: '""',
21
- flex: 1,
22
- },
23
- '::after': {
24
- content: '""',
25
- flex: 1,
26
- },
27
- },
28
- ]);
4
+ export const root = sprinkles({
5
+ height: 'full',
6
+ boxSizing: 'border-box',
7
+ display: 'flex',
8
+ padding: 'gutter',
9
+ textAlign: 'center',
10
+ overflow: 'auto',
11
+ });
29
12
 
30
- export const frameContainer = style([
31
- sprinkles({
32
- position: 'relative',
33
- height: 'full',
34
- textAlign: 'left',
35
- display: 'flex',
36
- flexDirection: 'column',
37
- paddingRight: 'gutter',
38
- }),
39
- {},
40
- ]);
13
+ export const frameContainer = sprinkles({
14
+ position: 'relative',
15
+ height: 'full',
16
+ textAlign: 'left',
17
+ display: 'flex',
18
+ flexDirection: 'column',
19
+ });
41
20
 
42
- export const frame = style([
43
- sprinkles({ position: 'relative', height: 'full', border: 0 }),
44
- {
45
- flexGrow: 1,
46
- },
47
- ]);
21
+ export const frame = sprinkles({
22
+ position: 'relative',
23
+ height: 'full',
24
+ border: 0,
25
+ flexGrow: 1,
26
+ });
48
27
 
49
28
  export const frameBorder = style([
50
29
  sprinkles({
@@ -9,6 +9,7 @@ import playroomConfig from '../../config';
9
9
  import frameSrc from './frameSrc';
10
10
 
11
11
  import * as styles from './Frames.css';
12
+ import { Box } from '../Box/Box';
12
13
 
13
14
  interface FramesProps {
14
15
  code: string;
@@ -34,36 +35,38 @@ export default function Frames({ code, themes, widths }: FramesProps) {
34
35
 
35
36
  return (
36
37
  <div ref={scrollingPanelRef} className={styles.root}>
37
- {frames.map((frame) => (
38
- <div
39
- key={`${frame.theme}_${frame.width}`}
40
- className={styles.frameContainer}
41
- >
42
- <div className={styles.frame}>
43
- <div className={styles.frameBorder} />
44
- <Iframe
45
- intersectionRootRef={scrollingPanelRef}
46
- src={frameSrc(
47
- { themeName: frame.theme, code: renderCode.current },
48
- playroomConfig
38
+ <Box display="flex" gap="gutter" marginX="auto">
39
+ {frames.map((frame) => (
40
+ <div
41
+ key={`${frame.theme}_${frame.width}`}
42
+ className={styles.frameContainer}
43
+ >
44
+ <div className={styles.frame}>
45
+ <div className={styles.frameBorder} />
46
+ <Iframe
47
+ intersectionRootRef={scrollingPanelRef}
48
+ src={frameSrc(
49
+ { themeName: frame.theme, code: renderCode.current },
50
+ playroomConfig
51
+ )}
52
+ className={styles.frame}
53
+ style={{ width: frame.width }}
54
+ data-testid="previewFrame"
55
+ />
56
+ </div>
57
+ <div className={styles.frameName} data-testid="frameName">
58
+ {frame.theme === '__PLAYROOM__NO_THEME__' ? (
59
+ <Text weight="strong">{frame.widthName}</Text>
60
+ ) : (
61
+ <Text>
62
+ <Strong>{frame.theme}</Strong>
63
+ {` \u2013 ${frame.widthName}`}
64
+ </Text>
49
65
  )}
50
- className={styles.frame}
51
- style={{ width: frame.width }}
52
- data-testid="previewFrame"
53
- />
66
+ </div>
54
67
  </div>
55
- <div className={styles.frameName} data-testid="frameName">
56
- {frame.theme === '__PLAYROOM__NO_THEME__' ? (
57
- <Text weight="strong">{frame.widthName}</Text>
58
- ) : (
59
- <Text>
60
- <Strong>{frame.theme}</Strong>
61
- {` \u2013 ${frame.widthName}`}
62
- </Text>
63
- )}
64
- </div>
65
- </div>
66
- ))}
68
+ ))}
69
+ </Box>
67
70
  </div>
68
71
  );
69
72
  }
@@ -1,20 +1,14 @@
1
1
  import { calc } from '@vanilla-extract/css-utils';
2
2
  import { globalStyle, style } from '@vanilla-extract/css';
3
- import { colorPaletteVars, sprinkles, vars } from '../sprinkles.css';
4
-
5
- export const title = sprinkles({
6
- display: 'flex',
7
- alignItems: 'center',
8
- justifyContent: 'space-between',
9
- marginBottom: 'medium',
10
- });
3
+ import { colorPaletteVars, sprinkles } from '../sprinkles.css';
4
+ import { vars } from '../vars.css';
11
5
 
12
6
  export const reset = style([
13
7
  sprinkles({
14
8
  position: 'relative',
15
9
  font: 'small',
16
10
  border: 0,
17
- padding: 'medium',
11
+ padding: 'small',
18
12
  appearance: 'none',
19
13
  }),
20
14
  {
@@ -22,7 +16,7 @@ export const reset = style([
22
16
  backgroundColor: 'transparent',
23
17
  outline: 'none',
24
18
  textDecoration: 'underline',
25
- margin: calc(vars.space.medium).negate().toString(),
19
+ margin: calc(vars.space.small).negate().toString(),
26
20
  '::before': {
27
21
  content: '""',
28
22
  position: 'absolute',
@@ -46,18 +40,9 @@ export const reset = style([
46
40
  },
47
41
  ]);
48
42
 
49
- export const label = style([
50
- sprinkles({
51
- position: 'relative',
52
- display: 'flex',
53
- alignItems: 'center',
54
- cursor: 'pointer',
55
- userSelect: 'none',
56
- }),
57
- {
58
- height: calc(vars.grid).multiply(9).toString(),
59
- },
60
- ]);
43
+ export const label = sprinkles({
44
+ cursor: 'pointer',
45
+ });
61
46
 
62
47
  const checkboxSize = '20px';
63
48
  export const checkbox = style([
@@ -67,7 +52,6 @@ export const checkbox = style([
67
52
  left: 0,
68
53
  right: 0,
69
54
  opacity: 0,
70
- pointerEvents: 'none',
71
55
  }),
72
56
  {
73
57
  height: checkboxSize,
@@ -83,8 +67,8 @@ export const fakeCheckbox = style([
83
67
  justifyContent: 'center',
84
68
  position: 'relative',
85
69
  borderRadius: 'large',
86
- marginRight: 'large',
87
70
  padding: checkboxPadding,
71
+ pointerEvents: 'none',
88
72
  }),
89
73
  {
90
74
  flexGrow: 0,