Переглянути джерело

Stubs tests. Updates types for controls.

main
Steve Ruiz 4 роки тому
джерело
коміт
85dc3028b4

+ 0
- 3
.babelrc Переглянути файл

@@ -1,3 +0,0 @@
1
-{
2
-  "presets": ["next/babel"]
3
-}

+ 3
- 7
__tests__/__snapshots__/project.test.ts.snap Переглянути файл

@@ -13270,13 +13270,9 @@ Object {
13270 13270
       "code": "
13271 13271
 const draw = new Draw({
13272 13272
   points: [
13273
-    [0, 0],
13274
-    [0, 50],
13275
-    [20, 80],
13276
-    [56, 56],
13277
-    [52, 52],
13278
-    [80, 20],
13279
-    [90, 90],
13273
+    ...Utils.getPointsBetween([0, 0], [20, 50]),
13274
+    ...Utils.getPointsBetween([20, 50], [100, 20], 3),
13275
+    ...Utils.getPointsBetween([100, 20], [100, 100], 10),
13280 13276
     [100, 100],
13281 13277
   ],
13282 13278
 })

+ 69
- 0
__tests__/code.test.ts Переглянути файл

@@ -0,0 +1,69 @@
1
+import state from 'state'
2
+import { generateFromCode } from 'state/code/generate'
3
+import { getShapes } from 'utils'
4
+import * as json from './__mocks__/document.json'
5
+
6
+jest.useRealTimers()
7
+
8
+state.reset()
9
+state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
10
+state.send('CLEARED_PAGE')
11
+
12
+describe('selection', () => {
13
+  it('opens and closes the code panel', () => {
14
+    expect(state.data.settings.isCodeOpen).toBe(false)
15
+    state.send('TOGGLED_CODE_PANEL_OPEN')
16
+    expect(state.data.settings.isCodeOpen).toBe(true)
17
+    state.send('TOGGLED_CODE_PANEL_OPEN')
18
+    expect(state.data.settings.isCodeOpen).toBe(false)
19
+  })
20
+
21
+  it('saves changes to code', () => {
22
+    expect(getShapes(state.data).length).toBe(0)
23
+
24
+    const code = `// hello world!`
25
+
26
+    state.send('SAVED_CODE', { code })
27
+
28
+    expect(state.data.document.code[state.data.currentCodeFileId].code).toBe(
29
+      code
30
+    )
31
+  })
32
+
33
+  it('generates shapes', async () => {
34
+    const code = `
35
+    const rectangle = new Rectangle({
36
+      name: 'Test Rectangle',
37
+      point: [100, 100],
38
+      size: [200, 200],
39
+      style: {
40
+        size: SizeStyle.Medium,
41
+        color: ColorStyle.Red,
42
+        dash: DashStyle.Dotted,
43
+      },
44
+    })
45
+    `
46
+
47
+    const { controls, shapes } = await generateFromCode(state.data, code)
48
+    state.send('GENERATED_FROM_CODE', { controls, shapes })
49
+    expect(getShapes(state.data).length).toBe(1)
50
+  })
51
+
52
+  it('creates a code control', () => {
53
+    null
54
+  })
55
+
56
+  it('updates a code control', () => {
57
+    null
58
+  })
59
+
60
+  it('updates a code control', () => {
61
+    null
62
+  })
63
+
64
+  /* -------------------- Readonly -------------------- */
65
+
66
+  it('does not saves changes to code when readonly', () => {
67
+    null
68
+  })
69
+})

+ 24
- 0
__tests__/create.test.ts Переглянути файл

@@ -0,0 +1,24 @@
1
+import state from 'state'
2
+import * as json from './__mocks__/document.json'
3
+
4
+state.reset()
5
+state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
6
+state.send('CLEARED_PAGE')
7
+
8
+describe('arrow shape', () => {
9
+  it('creates a shape', () => {
10
+    null
11
+  })
12
+
13
+  it('cancels shape while creating', () => {
14
+    null
15
+  })
16
+
17
+  it('removes shape on undo and restores it on redo', () => {
18
+    null
19
+  })
20
+
21
+  it('does not create shape when readonly', () => {
22
+    null
23
+  })
24
+})

+ 68
- 0
__tests__/shapes/arrow.test.ts Переглянути файл

@@ -0,0 +1,68 @@
1
+import state from 'state'
2
+import * as json from '../__mocks__/document.json'
3
+
4
+state.reset()
5
+state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
6
+state.send('CLEARED_PAGE')
7
+
8
+describe('arrow shape', () => {
9
+  it('creates shape', () => {
10
+    null
11
+  })
12
+
13
+  it('cancels shape while creating', () => {
14
+    null
15
+  })
16
+
17
+  it('moves shape', () => {
18
+    null
19
+  })
20
+
21
+  it('rotates shape', () => {
22
+    null
23
+  })
24
+
25
+  it('measures bounds', () => {
26
+    null
27
+  })
28
+
29
+  it('measures rotated bounds', () => {
30
+    null
31
+  })
32
+
33
+  it('transforms single', () => {
34
+    null
35
+  })
36
+
37
+  it('transforms in a group', () => {
38
+    null
39
+  })
40
+
41
+  /* -------------------- Specific -------------------- */
42
+
43
+  it('creates compass-aligned shape with shift key', () => {
44
+    null
45
+  })
46
+
47
+  it('changes start handle', () => {
48
+    null
49
+  })
50
+
51
+  it('changes end handle', () => {
52
+    null
53
+  })
54
+
55
+  it('changes bend handle', () => {
56
+    null
57
+  })
58
+
59
+  it('resets bend handle when double-pointed', () => {
60
+    null
61
+  })
62
+
63
+  /* -------------------- Readonly -------------------- */
64
+
65
+  it('does not create shape when readonly', () => {
66
+    null
67
+  })
68
+})

+ 8
- 0
__tests__/test-utils.ts Переглянути файл

@@ -46,3 +46,11 @@ export function idsAreSelected(
46 46
     ids.every((id) => selectedIds.has(id))
47 47
   )
48 48
 }
49
+
50
+export async function asyncDelay<T>(fn: () => T): Promise<T> {
51
+  return new Promise((resolve) => {
52
+    setTimeout(() => {
53
+      resolve(fn())
54
+    }, 100)
55
+  })
56
+}

+ 3
- 0
babel.config.js Переглянути файл

@@ -0,0 +1,3 @@
1
+module.exports = {
2
+  presets: ['next/babel'],
3
+}

+ 5
- 2
components/code-panel/code-panel.tsx Переглянути файл

@@ -82,8 +82,11 @@ export default function CodePanel(): JSX.Element {
82 82
         let error = null
83 83
 
84 84
         try {
85
-          const { shapes, controls } = generateFromCode(state.data, data.code)
86
-          state.send('GENERATED_FROM_CODE', { shapes, controls })
85
+          generateFromCode(state.data, data.code).then(
86
+            ({ shapes, controls }) => {
87
+              state.send('GENERATED_FROM_CODE', { shapes, controls })
88
+            }
89
+          )
87 90
         } catch (e) {
88 91
           console.error('Got an error!', e)
89 92
           error = { message: e.message, ...getErrorLineAndColumn(e) }

+ 944
- 926
components/code-panel/types-import.ts
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 20
- 13
components/controls-panel/control.tsx Переглянути файл

@@ -50,14 +50,21 @@ function NumberControl({ id, min, max, step, value }: NumberCodeControl) {
50 50
   )
51 51
 }
52 52
 
53
-function VectorControl({ id, value, isNormalized }: VectorCodeControl) {
53
+function VectorControl({
54
+  id,
55
+  value,
56
+  min = -Infinity,
57
+  max = Infinity,
58
+  step = 0.01,
59
+  isNormalized = false,
60
+}: VectorCodeControl) {
54 61
   return (
55 62
     <Inputs>
56 63
       <input
57 64
         type="range"
58
-        min={isNormalized ? -1 : -Infinity}
59
-        max={isNormalized ? 1 : Infinity}
60
-        step={0.01}
65
+        min={isNormalized ? -1 : min}
66
+        max={isNormalized ? 1 : max}
67
+        step={step}
61 68
         value={value[0]}
62 69
         onChange={(e) =>
63 70
           state.send('CHANGED_CODE_CONTROL', {
@@ -67,9 +74,9 @@ function VectorControl({ id, value, isNormalized }: VectorCodeControl) {
67 74
       />
68 75
       <input
69 76
         type="number"
70
-        min={isNormalized ? -1 : -Infinity}
71
-        max={isNormalized ? 1 : Infinity}
72
-        step={0.01}
77
+        min={isNormalized ? -1 : min}
78
+        max={isNormalized ? 1 : max}
79
+        step={step}
73 80
         value={value[0]}
74 81
         onChange={(e) =>
75 82
           state.send('CHANGED_CODE_CONTROL', {
@@ -79,9 +86,9 @@ function VectorControl({ id, value, isNormalized }: VectorCodeControl) {
79 86
       />
80 87
       <input
81 88
         type="range"
82
-        min={isNormalized ? -1 : -Infinity}
83
-        max={isNormalized ? 1 : Infinity}
84
-        step={0.01}
89
+        min={isNormalized ? -1 : min}
90
+        max={isNormalized ? 1 : max}
91
+        step={step}
85 92
         value={value[1]}
86 93
         onChange={(e) =>
87 94
           state.send('CHANGED_CODE_CONTROL', {
@@ -91,9 +98,9 @@ function VectorControl({ id, value, isNormalized }: VectorCodeControl) {
91 98
       />
92 99
       <input
93 100
         type="number"
94
-        min={isNormalized ? -1 : -Infinity}
95
-        max={isNormalized ? 1 : Infinity}
96
-        step={0.01}
101
+        min={isNormalized ? -1 : min}
102
+        max={isNormalized ? 1 : max}
103
+        step={step}
97 104
         value={value[1]}
98 105
         onChange={(e) =>
99 106
           state.send('CHANGED_CODE_CONTROL', {

+ 6
- 1
components/controls-panel/controls-panel.tsx Переглянути файл

@@ -17,7 +17,12 @@ export default function ControlPanel(): JSX.Element {
17 17
   const isOpen = useSelector((s) => Object.keys(s.data.codeControls).length > 0)
18 18
 
19 19
   return (
20
-    <Panel.Root data-bp-desktop ref={rContainer} isOpen={isOpen}>
20
+    <Panel.Root
21
+      data-bp-desktop
22
+      ref={rContainer}
23
+      isOpen={isOpen}
24
+      variant="controls"
25
+    >
21 26
       {isOpen ? (
22 27
         <Panel.Layout>
23 28
           <Panel.Header>

+ 2
- 0
components/editor.tsx Переглянути файл

@@ -7,6 +7,7 @@ import StylePanel from './style-panel/style-panel'
7 7
 import styled from 'styles'
8 8
 import PagePanel from './page-panel/page-panel'
9 9
 import CodePanel from './code-panel/code-panel'
10
+import ControlsPanel from './controls-panel/controls-panel'
10 11
 
11 12
 export default function Editor(): JSX.Element {
12 13
   useKeyboardEvents()
@@ -16,6 +17,7 @@ export default function Editor(): JSX.Element {
16 17
     <Layout>
17 18
       <CodePanel />
18 19
       <PagePanel />
20
+      <ControlsPanel />
19 21
       <Spacer />
20 22
       <StylePanel />
21 23
       <Canvas />

+ 4
- 0
components/panel.tsx Переглянути файл

@@ -18,6 +18,10 @@ export const Root = styled('div', {
18 18
     },
19 19
     variant: {
20 20
       code: {},
21
+      controls: {
22
+        position: 'absolute',
23
+        right: 156,
24
+      },
21 25
     },
22 26
     isOpen: {
23 27
       true: {},

+ 2
- 4
jest.config.js Переглянути файл

@@ -1,9 +1,7 @@
1 1
 module.exports = {
2
-  roots: ['<rootDir>'],
3 2
   testEnvironment: 'jsdom',
4
-  moduleFileExtensions: ['ts', 'tsx', 'mjs', 'js', 'json', 'jsx'],
5
-  testPathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|.next)[/\\\\]'],
6
-  transformIgnorePatterns: ['node_modules/(?!(browser-fs-access)/)'],
3
+  testPathIgnorePatterns: ['node_modules', '.next'],
4
+  transformIgnorePatterns: ['node_modules/(?!(sucrase|browser-fs-access)/)'],
7 5
   transform: {
8 6
     '^.+\\.(ts|tsx|mjs)$': 'babel-jest',
9 7
   },

+ 6
- 6
package.json Переглянути файл

@@ -8,12 +8,12 @@
8 8
     "dev": "next dev",
9 9
     "format": "prettier --write .",
10 10
     "lint": "eslint . --ext ts --ext tsx --ext js",
11
-    "scripts": "node scripts/type-gen && yarn format",
11
+    "scripts": "node scripts/type-gen && prettier --write './components/code-panel/types-import.ts'",
12 12
     "start": "next start",
13 13
     "test-all": "yarn lint && yarn type-check && yarn test",
14 14
     "test:update": "jest --updateSnapshot",
15 15
     "test:watch": "jest --watchAll",
16
-    "test": "jest",
16
+    "test": "jest --watchAll=false",
17 17
     "type-check": "tsc --pretty --noEmit"
18 18
   },
19 19
   "husky": {
@@ -53,7 +53,7 @@
53 53
     "idb-keyval": "^5.0.6",
54 54
     "ismobilejs": "^1.1.1",
55 55
     "monaco-editor": "^0.25.2",
56
-    "next": "latest",
56
+    "next": "^11.0.1",
57 57
     "next-auth": "^3.27.0",
58 58
     "next-pwa": "^5.2.21",
59 59
     "perfect-freehand": "^0.4.9",
@@ -66,8 +66,7 @@
66 66
     "uuid": "^8.3.2"
67 67
   },
68 68
   "devDependencies": {
69
-    "@testing-library/react": "^11.2.5",
70
-    "@testing-library/user-event": "^13.1.9",
69
+    "@babel/core": "^7.14.6",
71 70
     "@types/jest": "^26.0.23",
72 71
     "@types/node": "^14.14.25",
73 72
     "@types/react": "^17.0.1",
@@ -80,7 +79,8 @@
80 79
     "eslint-plugin-react": "^7.19.0",
81 80
     "husky": "^4.2.3",
82 81
     "identity-obj-proxy": "^3.0.0",
83
-    "jest": "^27.0.4",
82
+    "jest": "^27.0.5",
83
+    "jest-esm-transformer": "^1.0.0",
84 84
     "jest-watch-typeahead": "^0.6.1",
85 85
     "lint-staged": "^10.0.10",
86 86
     "prettier": "^2.3.1",

+ 57
- 59
scripts/type-gen.js Переглянути файл

@@ -1,52 +1,36 @@
1 1
 // @ts-check
2 2
 
3 3
 /*
4
-Type gen script
4
+This script will generate TypeScript content for the code editor. It inlines 
5
+the content of several files into one large string which can be passed to the
6
+Monaco editor as an extraLib.
5 7
 
6
-This script will generate TypeScript declarations for the code editor. It reads
7
-the global types, as well as all of the code classes, and writes them into a
8
-single file as a string. This string is fed into the Monaco editor as an extraLib. 
8
+Important notes:
9
+
10
+- Files must include the "Start Copy Here" comment indicated below. 
11
+
12
+- This comment must be placed BELOW any import statements.
13
+
14
+Run the script with `yarn scripts`.
9 15
 */
10 16
 
11 17
 const fs = require('fs/promises')
18
+const root = process.cwd()
19
+
20
+async function inlineFileContents(path) {
21
+  console.log(`📄 Inlining contents of ${path}`)
22
+  const text = await fs.readFile(`${root}${path}`, 'utf-8')
23
+  return text
24
+    .match(
25
+      /\/\* ----------------- Start Copy Here ---------------- \*\/(.|\n)*$/g
26
+    )[0]
27
+    .replaceAll('/* ----------------- Start Copy Here ---------------- */', '')
28
+    .replaceAll('export default', '')
29
+    .replaceAll('export ', '')
30
+}
12 31
 
13 32
 async function copyTypesToFile() {
14
-  const types = await fs.readFile(__dirname + '/../types.ts', 'utf8')
15
-  const codeIndex = await fs.readFile(
16
-    __dirname + '/../state/code/index.ts',
17
-    'utf8'
18
-  )
19
-  const codeDot = await fs.readFile(__dirname + '/../state/code/dot.ts', 'utf8')
20
-  const codeEllipse = await fs.readFile(
21
-    __dirname + '/../state/code/ellipse.ts',
22
-    'utf8'
23
-  )
24
-  const codeLine = await fs.readFile(
25
-    __dirname + '/../state/code/line.ts',
26
-    'utf8'
27
-  )
28
-  const codePolyline = await fs.readFile(
29
-    __dirname + '/../state/code/polyline.ts',
30
-    'utf8'
31
-  )
32
-  const codeRay = await fs.readFile(__dirname + '/../state/code/ray.ts', 'utf8')
33
-  const codeArrow = await fs.readFile(
34
-    __dirname + '/../state/code/arrow.ts',
35
-    'utf8'
36
-  )
37
-  const codeDraw = await fs.readFile(
38
-    __dirname + '/../state/code/draw.ts',
39
-    'utf8'
40
-  )
41
-  const codeRectangle = await fs.readFile(
42
-    __dirname + '/../state/code/rectangle.ts',
43
-    'utf8'
44
-  )
45
-  const codeVector = await fs.readFile(__dirname + '/../utils/vec.ts', 'utf8')
46
-  const codeUtils = await fs.readFile(
47
-    __dirname + '/../state/code/utils.ts',
48
-    'utf8'
49
-  )
33
+  console.log('⚙️  Generating types-import.ts')
50 34
 
51 35
   const content =
52 36
     `
@@ -57,30 +41,44 @@ async function copyTypesToFile() {
57 41
 export default {` +
58 42
     `
59 43
     name: "types.ts",
60
-    content: \`    
61
-
62
-${types}
63
-
64
-${codeIndex.match(/export default(.|\n)*$/g)[0]}
65
-${codeDot.match(/\/\*\*(.|\n)*$/g)[0]}
66
-${codeEllipse.match(/\/\*\*(.|\n)*$/g)[0]}
67
-${codeLine.match(/\/\*\*(.|\n)*$/g)[0]}
68
-${codePolyline.match(/\/\*\*(.|\n)*$/g)[0]}
69
-${codeRay.match(/\/\*\*(.|\n)*$/g)[0]}
70
-${codeRectangle.match(/\/\*\*(.|\n)*$/g)[0]}
71
-${codeArrow.match(/\/\*\*(.|\n)*$/g)[0]}
72
-${codeDraw.match(/\/\*\*(.|\n)*$/g)[0]}
73
-${codeUtils.match(/\/\*\*(.|\n)*$/g)[0]}
74
-${codeVector}
75
-\`
76
-  }`
77
-      .replaceAll('export default', '')
78
-      .replaceAll('export ', '')
44
+    content: \`
45
+    
46
+
47
+${await inlineFileContents('/types.ts')}
48
+
49
+${await inlineFileContents('/utils/vec.ts')}
50
+
51
+${await inlineFileContents('/state/code/utils.ts')}
52
+
53
+${await inlineFileContents('/state/code/index.ts')}
54
+
55
+${await inlineFileContents('/state/code/dot.ts')}
56
+
57
+${await inlineFileContents('/state/code/ellipse.ts')}
58
+
59
+${await inlineFileContents('/state/code/line.ts')}
60
+
61
+${await inlineFileContents('/state/code/polyline.ts')}
62
+
63
+${await inlineFileContents('/state/code/ray.ts')}
64
+
65
+${await inlineFileContents('/state/code/arrow.ts')}
66
+
67
+${await inlineFileContents('/state/code/draw.ts')}
68
+
69
+${await inlineFileContents('/state/code/rectangle.ts')}
70
+
71
+${await inlineFileContents('/state/code/control.ts')}
72
+
73
+declare const controls: {[key:string]: any} = {}
74
+\`}`
79 75
 
80 76
   await fs.writeFile(
81 77
     __dirname + '/../components/code-panel/types-import.ts',
82 78
     content
83 79
   )
80
+
81
+  console.log('✅ Process complete')
84 82
 }
85 83
 
86 84
 // Kickoff

+ 2
- 3
state/code/arrow.ts Переглянути файл

@@ -5,9 +5,8 @@ import { defaultStyle } from 'state/shape-styles'
5 5
 import { getShapeUtils } from 'state/shape-utils'
6 6
 import Vec from 'utils/vec'
7 7
 
8
-/**
9
- * ## Draw
10
- */
8
+/* ----------------- Start Copy Here ---------------- */
9
+
11 10
 export default class Arrow extends CodeShape<ArrowShape> {
12 11
   constructor(
13 12
     props = {} as ShapeProps<ArrowShape> & { start: number[]; end: number[] }

+ 18
- 4
state/code/control.ts Переглянути файл

@@ -10,6 +10,8 @@ export const controls: Record<string, any> = {}
10 10
 
11 11
 export const codeControls = new Set<CodeControl>([])
12 12
 
13
+/* ----------------- Start Copy Here ---------------- */
14
+
13 15
 export class Control<T extends CodeControl> {
14 16
   control: T
15 17
 
@@ -29,14 +31,25 @@ export class Control<T extends CodeControl> {
29 31
     codeControls.delete(this.control)
30 32
     delete controls[this.control.label]
31 33
   }
34
+
35
+  get value(): T['value'] {
36
+    return this.control.value
37
+  }
38
+
39
+  set value(value: T['value']) {
40
+    this.control.value = value
41
+  }
32 42
 }
33 43
 
44
+type ControlProps<T extends CodeControl> = Omit<Partial<T>, 'id' | 'type'>
45
+
34 46
 export class NumberControl extends Control<NumberCodeControl> {
35
-  constructor(options: Omit<NumberCodeControl, 'id' | 'type'>) {
36
-    const { value = 0, step = 1 } = options
47
+  constructor(options: ControlProps<NumberCodeControl>) {
48
+    const { label = 'Number', value = 0, step = 1 } = options
37 49
     super({
38 50
       type: ControlType.Number,
39 51
       ...options,
52
+      label,
40 53
       value,
41 54
       step,
42 55
     })
@@ -44,11 +57,12 @@ export class NumberControl extends Control<NumberCodeControl> {
44 57
 }
45 58
 
46 59
 export class VectorControl extends Control<VectorCodeControl> {
47
-  constructor(options: Omit<VectorCodeControl, 'id' | 'type'>) {
48
-    const { value = [0, 0], isNormalized = false } = options
60
+  constructor(options: ControlProps<VectorCodeControl>) {
61
+    const { label = 'Vector', value = [0, 0], isNormalized = false } = options
49 62
     super({
50 63
       type: ControlType.Vector,
51 64
       ...options,
65
+      label,
52 66
       value,
53 67
       isNormalized,
54 68
     })

+ 2
- 3
state/code/dot.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { DotShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Dot
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Dot extends CodeShape<DotShape> {
10 9
   constructor(props = {} as ShapeProps<DotShape>) {
11 10
     super({

+ 3
- 4
state/code/draw.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { DrawShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Draw
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Draw extends CodeShape<DrawShape> {
10 9
   constructor(props = {} as ShapeProps<DrawShape>) {
11 10
     super({
@@ -13,8 +12,8 @@ export default class Draw extends CodeShape<DrawShape> {
13 12
       seed: Math.random(),
14 13
       type: ShapeType.Draw,
15 14
       isGenerated: false,
15
+      parentId: (window as any).currentPageId,
16 16
       name: 'Draw',
17
-      parentId: 'page1',
18 17
       childIndex: 0,
19 18
       point: [0, 0],
20 19
       points: [],

+ 2
- 3
state/code/ellipse.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { EllipseShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Ellipse
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Ellipse extends CodeShape<EllipseShape> {
10 9
   constructor(props = {} as ShapeProps<EllipseShape>) {
11 10
     super({

+ 35
- 17
state/code/generate.ts Переглянути файл

@@ -44,13 +44,13 @@ const baseScope = {
44 44
  * collected shapes as an array.
45 45
  * @param code
46 46
  */
47
-export function generateFromCode(
47
+export async function generateFromCode(
48 48
   data: Data,
49 49
   code: string
50
-): {
50
+): Promise<{
51 51
   shapes: Shape[]
52 52
   controls: CodeControl[]
53
-} {
53
+}> {
54 54
   codeControls.clear()
55 55
   codeShapes.clear()
56 56
   ;(window as any).isUpdatingCode = false
@@ -59,7 +59,9 @@ export function generateFromCode(
59 59
   const { currentPageId } = data
60 60
   const scope = { ...baseScope, controls, currentPageId }
61 61
 
62
-  const transformed = transform(code, { transforms: ['typescript'] }).code
62
+  const transformed = transform(code, {
63
+    transforms: ['typescript'],
64
+  }).code
63 65
 
64 66
   new Function(...Object.keys(scope), `${transformed}`)(...Object.values(scope))
65 67
 
@@ -87,34 +89,50 @@ export function generateFromCode(
87 89
  * collected shapes as an array.
88 90
  * @param code
89 91
  */
90
-export function updateFromCode(
92
+export async function updateFromCode(
91 93
   data: Data,
92 94
   code: string
93
-): {
95
+): Promise<{
94 96
   shapes: Shape[]
95
-} {
97
+}> {
96 98
   codeShapes.clear()
97 99
   ;(window as any).isUpdatingCode = true
98 100
   ;(window as any).currentPageId = data.currentPageId
99 101
 
100 102
   const { currentPageId } = data
101 103
 
104
+  const newControls = Object.fromEntries(
105
+    Object.entries(data.codeControls).map(([_, control]) => [
106
+      control.label,
107
+      control.value,
108
+    ])
109
+  )
110
+
102 111
   const scope = {
103 112
     ...baseScope,
104 113
     currentPageId,
105
-    controls: Object.fromEntries(
106
-      Object.entries(controls).map(([_, control]) => [
107
-        control.label,
108
-        control.value,
109
-      ])
110
-    ),
114
+    controls: newControls,
111 115
   }
112 116
 
113
-  new Function(...Object.keys(scope), `${code}`)(...Object.values(scope))
117
+  const startingChildIndex =
118
+    getShapes(data)
119
+      .filter((shape) => shape.parentId === data.currentPageId)
120
+      .sort((a, b) => a.childIndex - b.childIndex)[0]?.childIndex || 1
114 121
 
115
-  const generatedShapes = Array.from(codeShapes.values()).map(
116
-    (instance) => instance.shape
117
-  )
122
+  const transformed = transform(code, {
123
+    transforms: ['typescript'],
124
+  }).code
125
+
126
+  new Function(...Object.keys(scope), `${transformed}`)(...Object.values(scope))
127
+
128
+  const generatedShapes = Array.from(codeShapes.values())
129
+    .sort((a, b) => a.shape.childIndex - b.shape.childIndex)
130
+    .map((instance, i) => ({
131
+      ...instance.shape,
132
+      isGenerated: true,
133
+      parentId: getPage(data).id,
134
+      childIndex: startingChildIndex + i,
135
+    }))
118 136
 
119 137
   return { shapes: generatedShapes }
120 138
 }

+ 3
- 0
state/code/index.ts Переглянути файл

@@ -21,6 +21,9 @@ function getOrderedShapes() {
21 21
  * A base class for code shapes. Note that creating a shape adds it to the
22 22
  * shape map, while deleting it removes it from the collected shapes set
23 23
  */
24
+
25
+/* ----------------- Start Copy Here ---------------- */
26
+
24 27
 export default class CodeShape<T extends Shape> {
25 28
   private _shape: Mutable<T>
26 29
   private utils: ShapeUtility<T>

+ 2
- 3
state/code/line.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { LineShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Line
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Line extends CodeShape<LineShape> {
10 9
   constructor(props = {} as ShapeProps<LineShape>) {
11 10
     super({

+ 6
- 4
state/code/polyline.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { PolylineShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Polyline
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Polyline extends CodeShape<PolylineShape> {
10 9
   constructor(props = {} as ShapeProps<PolylineShape>) {
11 10
     super({
@@ -22,8 +21,11 @@ export default class Polyline extends CodeShape<PolylineShape> {
22 21
       isAspectRatioLocked: false,
23 22
       isLocked: false,
24 23
       isHidden: false,
25
-      style: defaultStyle,
26 24
       ...props,
25
+      style: {
26
+        ...defaultStyle,
27
+        ...props.style,
28
+      },
27 29
     })
28 30
   }
29 31
 

+ 2
- 3
state/code/ray.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { RayShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Ray
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Ray extends CodeShape<RayShape> {
10 9
   constructor(props = {} as ShapeProps<RayShape>) {
11 10
     super({

+ 6
- 4
state/code/rectangle.ts Переглянути файл

@@ -3,9 +3,8 @@ import { uniqueId } from 'utils'
3 3
 import { RectangleShape, ShapeProps, ShapeType } from 'types'
4 4
 import { defaultStyle } from 'state/shape-styles'
5 5
 
6
-/**
7
- * ## Rectangle
8
- */
6
+/* ----------------- Start Copy Here ---------------- */
7
+
9 8
 export default class Rectangle extends CodeShape<RectangleShape> {
10 9
   constructor(props = {} as ShapeProps<RectangleShape>) {
11 10
     super({
@@ -24,7 +23,10 @@ export default class Rectangle extends CodeShape<RectangleShape> {
24 23
       isLocked: false,
25 24
       isHidden: false,
26 25
       ...props,
27
-      style: { ...defaultStyle, ...props.style },
26
+      style: {
27
+        ...defaultStyle,
28
+        ...props.style,
29
+      },
28 30
     })
29 31
   }
30 32
 

+ 2
- 3
state/code/utils.ts Переглянути файл

@@ -1,9 +1,8 @@
1 1
 import { Bounds } from 'types'
2 2
 import vec from 'utils/vec'
3 3
 
4
-/**
5
- * ## Utils
6
- */
4
+/* ----------------- Start Copy Here ---------------- */
5
+
7 6
 export default class Utils {
8 7
   /**
9 8
    * Linear interpolation betwen two numbers.

+ 2
- 3
state/code/vector.ts Переглянути файл

@@ -1,3 +1,5 @@
1
+/* ----------------- Start Copy Here ---------------- */
2
+
1 3
 export interface VectorOptions {
2 4
   x: number
3 5
   y: number
@@ -8,9 +10,6 @@ export interface Point {
8 10
   y: number
9 11
 }
10 12
 
11
-/**
12
- * ## Vector
13
- */
14 13
 export default class Vector {
15 14
   x = 0
16 15
   y = 0

+ 4
- 6
state/state.ts Переглянути файл

@@ -268,11 +268,11 @@ const state = createState({
268 268
           do: ['setCodeControls', 'setGeneratedShapes'],
269 269
         },
270 270
         UNDO: {
271
-          unless: 'isInSession',
271
+          unless: ['isReadOnly', 'isInSession'],
272 272
           do: 'undo',
273 273
         },
274 274
         REDO: {
275
-          unless: 'isInSession',
275
+          unless: ['isReadOnly', 'isInSession'],
276 276
           do: 'redo',
277 277
         },
278 278
         SAVED: {
@@ -1763,12 +1763,10 @@ const state = createState({
1763 1763
       setSelectedIds(data, [])
1764 1764
 
1765 1765
       try {
1766
-        const { shapes } = updateFromCode(
1766
+        updateFromCode(
1767 1767
           data,
1768 1768
           data.document.code[data.currentCodeFileId].code
1769
-        )
1770
-
1771
-        commands.generate(data, shapes)
1769
+        ).then(({ shapes }) => commands.generate(data, shapes))
1772 1770
       } catch (e) {
1773 1771
         console.error(e)
1774 1772
       }

+ 8
- 3
types.ts Переглянути файл

@@ -57,6 +57,8 @@ export interface PageState {
57 57
   }
58 58
 }
59 59
 
60
+/* ----------------- Start Copy Here ---------------- */
61
+
60 62
 export enum ShapeType {
61 63
   Dot = 'dot',
62 64
   Ellipse = 'ellipse',
@@ -383,17 +385,20 @@ export interface BaseCodeControl {
383 385
 
384 386
 export interface NumberCodeControl extends BaseCodeControl {
385 387
   type: ControlType.Number
388
+  value: number
386 389
   min?: number
387 390
   max?: number
388
-  value: number
389
-  step: number
391
+  step?: number
390 392
   format?: (value: number) => number
391 393
 }
392 394
 
393 395
 export interface VectorCodeControl extends BaseCodeControl {
394 396
   type: ControlType.Vector
395 397
   value: number[]
396
-  isNormalized: boolean
398
+  min?: number
399
+  max?: number
400
+  step?: number
401
+  isNormalized?: boolean
397 402
   format?: (value: number[]) => number[]
398 403
 }
399 404
 

+ 2
- 0
utils/vec.ts Переглянути файл

@@ -1,5 +1,7 @@
1 1
 // A big collection of vector utilities. Collected into a class to improve logging / packaging.
2 2
 
3
+/* ----------------- Start Copy Here ---------------- */
4
+
3 5
 export default class Vec {
4 6
   /**
5 7
    * Clamp a value into a range.

+ 35
- 71
yarn.lock Переглянути файл

@@ -21,7 +21,7 @@
21 21
   resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.7.tgz#7b047d7a3a89a67d2258dc61f604f098f1bc7e08"
22 22
   integrity sha512-nS6dZaISCXJ3+518CWiBfEr//gHyMO02uDxBkXTKZDN5POruCnOZ1N4YBRZDCabwF8nZMWBpRxIicmXtBs+fvw==
23 23
 
24
-"@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.7.2", "@babel/core@^7.7.5":
24
+"@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.14.6", "@babel/core@^7.4.4", "@babel/core@^7.7.2", "@babel/core@^7.7.5":
25 25
   version "7.14.6"
26 26
   resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.6.tgz#e0814ec1a950032ff16c13a2721de39a8416fcab"
27 27
   integrity sha512-gJnOEWSqTk96qG5BoIrl5bVtc23DCycmIePPYnamY9RboYdI4nFy5vAQMSl81O5K/W0sLDWfGysnOECC+KUUCA==
@@ -637,7 +637,7 @@
637 637
     "@babel/helper-plugin-utils" "^7.14.5"
638 638
     babel-plugin-dynamic-import-node "^2.3.3"
639 639
 
640
-"@babel/plugin-transform-modules-commonjs@^7.14.5":
640
+"@babel/plugin-transform-modules-commonjs@^7.14.5", "@babel/plugin-transform-modules-commonjs@^7.4.4":
641 641
   version "7.14.5"
642 642
   resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.14.5.tgz#7aaee0ea98283de94da98b28f8c35701429dad97"
643 643
   integrity sha512-en8GfBtgnydoao2PS+87mKyw62k02k7kJ9ltbKe0fXTHrQmG6QZZflYuGI1VVG7sVpx4E1n7KBpNlPb8m78J+A==
@@ -1238,25 +1238,25 @@
1238 1238
     require_optional "^1.0.1"
1239 1239
     typeorm "^0.2.30"
1240 1240
 
1241
-"@next/env@11.0.0":
1242
-  version "11.0.0"
1243
-  resolved "https://registry.yarnpkg.com/@next/env/-/env-11.0.0.tgz#bdd306a45e88ba3e4e7a36aa91806f6486bb61d0"
1244
-  integrity sha512-VKpmDvTYeCpEQjREg3J4pCmVs/QjEzoLmkM8shGFK6e9AmFd0G9QXOL8HGA8qKhy/XmNb7dHeMqrcMiBua4OgA==
1241
+"@next/env@11.0.1":
1242
+  version "11.0.1"
1243
+  resolved "https://registry.yarnpkg.com/@next/env/-/env-11.0.1.tgz#6dc96ac76f1663ab747340e907e8933f190cc8fd"
1244
+  integrity sha512-yZfKh2U6R9tEYyNUrs2V3SBvCMufkJ07xMH5uWy8wqcl5gAXoEw6A/1LDqwX3j7pUutF9d1ZxpdGDA3Uag+aQQ==
1245 1245
 
1246 1246
 "@next/eslint-plugin-next@11.0.0":
1247 1247
   version "11.0.0"
1248 1248
   resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-11.0.0.tgz#e6fb93a00bdaba371904f2b2698b184e6278d369"
1249 1249
   integrity sha512-fPZ0904yY1box6bRpR9rJqIkNxJdvzzxH7doXS+cdjyBAdptMR7wj3mcx1hEikBHzWduU8BOXBvRg2hWc09YDQ==
1250 1250
 
1251
-"@next/polyfill-module@11.0.0":
1252
-  version "11.0.0"
1253
-  resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-11.0.0.tgz#cb2f46b323bbe7f8a337ccd80fb82314d4039403"
1254
-  integrity sha512-gydtFzRqsT549U8+sY8382I/f4HFcelD8gdUGnAofQJa/jEU1jkxmjCHC8tmEiyeMLidl7iDZgchfSCpmMzzUg==
1251
+"@next/polyfill-module@11.0.1":
1252
+  version "11.0.1"
1253
+  resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-11.0.1.tgz#ca2a110c1c44672cbcff6c2b983f0c0549d87291"
1254
+  integrity sha512-Cjs7rrKCg4CF4Jhri8PCKlBXhszTfOQNl9AjzdNy4K5jXFyxyoSzuX2rK4IuoyE+yGp5A3XJCBEmOQ4xbUp9Mg==
1255 1255
 
1256
-"@next/react-dev-overlay@11.0.0":
1257
-  version "11.0.0"
1258
-  resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-11.0.0.tgz#6befb4d00d952551db1b3909023074eb5778ac5d"
1259
-  integrity sha512-q+Wp+eStEMThe77zxdeJ/nbuODkHR6P+/dfUqYXZSqbLf6x5c5xwLBauwwVbkCYFZpAlDuL8Jk8QSAH1OsqC2w==
1256
+"@next/react-dev-overlay@11.0.1":
1257
+  version "11.0.1"
1258
+  resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-11.0.1.tgz#3c481e83347255abd466dcf7e59ac8a79a0d7fd6"
1259
+  integrity sha512-lvUjMVpLsgzADs9Q8wtC5LNqvfdN+M0BDMSrqr04EDWAyyX0vURHC9hkvLbyEYWyh+WW32pwjKBXdkMnJhoqMg==
1260 1260
   dependencies:
1261 1261
     "@babel/code-frame" "7.12.11"
1262 1262
     anser "1.4.9"
@@ -1270,10 +1270,10 @@
1270 1270
     stacktrace-parser "0.1.10"
1271 1271
     strip-ansi "6.0.0"
1272 1272
 
1273
-"@next/react-refresh-utils@11.0.0":
1274
-  version "11.0.0"
1275
-  resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-11.0.0.tgz#cb671723c50b904eaa44b4b45c0845476ecd8825"
1276
-  integrity sha512-hi5eY+KBn4QGtUv7VL2OptdM33fI2hxhd7+omOFmAK+S0hDWhg1uqHqqGJk0W1IfqlWEzzL10WvTJDPRAtDugQ==
1273
+"@next/react-refresh-utils@11.0.1":
1274
+  version "11.0.1"
1275
+  resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-11.0.1.tgz#a7509f22b6f70c13101a26573afd295295f1c020"
1276
+  integrity sha512-K347DM6Z7gBSE+TfUaTTceWvbj0B6iNAsFZXbFZOlfg3uyz2sbKpzPYYFocCc27yjLaS8OfR8DEdS2mZXi8Saw==
1277 1277
 
1278 1278
 "@nodelib/fs.scandir@2.1.5":
1279 1279
   version "2.1.5"
@@ -1932,45 +1932,11 @@
1932 1932
     ejs "^2.6.1"
1933 1933
     magic-string "^0.25.0"
1934 1934
 
1935
-"@testing-library/dom@^7.28.1":
1936
-  version "7.31.2"
1937
-  resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.31.2.tgz#df361db38f5212b88555068ab8119f5d841a8c4a"
1938
-  integrity sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==
1939
-  dependencies:
1940
-    "@babel/code-frame" "^7.10.4"
1941
-    "@babel/runtime" "^7.12.5"
1942
-    "@types/aria-query" "^4.2.0"
1943
-    aria-query "^4.2.2"
1944
-    chalk "^4.1.0"
1945
-    dom-accessibility-api "^0.5.6"
1946
-    lz-string "^1.4.4"
1947
-    pretty-format "^26.6.2"
1948
-
1949
-"@testing-library/react@^11.2.5":
1950
-  version "11.2.7"
1951
-  resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.2.7.tgz#b29e2e95c6765c815786c0bc1d5aed9cb2bf7818"
1952
-  integrity sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==
1953
-  dependencies:
1954
-    "@babel/runtime" "^7.12.5"
1955
-    "@testing-library/dom" "^7.28.1"
1956
-
1957
-"@testing-library/user-event@^13.1.9":
1958
-  version "13.1.9"
1959
-  resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-13.1.9.tgz#29e49a42659ac3c1023565ff56819e0153a82e99"
1960
-  integrity sha512-NZr0zL2TMOs2qk+dNlqrAdbaRW5dAmYwd1yuQ4r7HpkVEOj0MWuUjDWwKhcLd/atdBy8ZSMHSKp+kXSQe47ezg==
1961
-  dependencies:
1962
-    "@babel/runtime" "^7.12.5"
1963
-
1964 1935
 "@tootallnate/once@1":
1965 1936
   version "1.1.2"
1966 1937
   resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
1967 1938
   integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
1968 1939
 
1969
-"@types/aria-query@^4.2.0":
1970
-  version "4.2.1"
1971
-  resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.1.tgz#78b5433344e2f92e8b306c06a5622c50c245bf6b"
1972
-  integrity sha512-S6oPal772qJZHoRZLFc/XoZW2gFvwXusYUmXPXkgxJLuEk2vOt7jc4Yo6z/vtI0EBkbPBVrJJ0B+prLIKiWqHg==
1973
-
1974 1940
 "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14":
1975 1941
   version "7.1.14"
1976 1942
   resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.14.tgz#faaeefc4185ec71c389f4501ee5ec84b170cc402"
@@ -3422,11 +3388,6 @@ doctrine@^3.0.0:
3422 3388
   dependencies:
3423 3389
     esutils "^2.0.2"
3424 3390
 
3425
-dom-accessibility-api@^0.5.6:
3426
-  version "0.5.6"
3427
-  resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz#3f5d43b52c7a3bd68b5fb63fa47b4e4c1fdf65a9"
3428
-  integrity sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw==
3429
-
3430 3391
 domain-browser@4.19.0:
3431 3392
   version "4.19.0"
3432 3393
   resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-4.19.0.tgz#1093e17c0a17dbd521182fe90d49ac1370054af1"
@@ -4906,6 +4867,14 @@ jest-environment-node@^27.0.5:
4906 4867
     jest-mock "^27.0.3"
4907 4868
     jest-util "^27.0.2"
4908 4869
 
4870
+jest-esm-transformer@^1.0.0:
4871
+  version "1.0.0"
4872
+  resolved "https://registry.yarnpkg.com/jest-esm-transformer/-/jest-esm-transformer-1.0.0.tgz#b6c58f496aa48194f96361a52f5c578fd2209726"
4873
+  integrity sha512-FoPgeMMwy1/CEsc8tBI41i83CEO3x85RJuZi5iAMmWoARXhfgk6Jd7y+4d+z+HCkTKNVDvSWKGRhwjzU9PUbrw==
4874
+  dependencies:
4875
+    "@babel/core" "^7.4.4"
4876
+    "@babel/plugin-transform-modules-commonjs" "^7.4.4"
4877
+
4909 4878
 jest-get-type@^26.3.0:
4910 4879
   version "26.3.0"
4911 4880
   resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0"
@@ -5210,7 +5179,7 @@ jest-worker@^27.0.2:
5210 5179
     merge-stream "^2.0.0"
5211 5180
     supports-color "^8.0.0"
5212 5181
 
5213
-jest@^27.0.4:
5182
+jest@^27.0.5:
5214 5183
   version "27.0.5"
5215 5184
   resolved "https://registry.yarnpkg.com/jest/-/jest-27.0.5.tgz#141825e105514a834cc8d6e44670509e8d74c5f2"
5216 5185
   integrity sha512-4NlVMS29gE+JOZvgmSAsz3eOjkSsHqjTajlIsah/4MVSmKvf3zFP/TvgcLoWe2UVHiE9KF741sReqhF0p4mqbQ==
@@ -5626,11 +5595,6 @@ lru_map@^0.3.3:
5626 5595
   resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
5627 5596
   integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=
5628 5597
 
5629
-lz-string@^1.4.4:
5630
-  version "1.4.4"
5631
-  resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
5632
-  integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
5633
-
5634 5598
 magic-string@^0.25.0, magic-string@^0.25.7:
5635 5599
   version "0.25.7"
5636 5600
   resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
@@ -5814,17 +5778,17 @@ next-pwa@^5.2.21:
5814 5778
     workbox-webpack-plugin "^6.1.5"
5815 5779
     workbox-window "^6.1.5"
5816 5780
 
5817
-next@latest:
5818
-  version "11.0.0"
5819
-  resolved "https://registry.yarnpkg.com/next/-/next-11.0.0.tgz#866b833f192f5a94ddb3267d5cc0f4b0ce405ac7"
5820
-  integrity sha512-1OA0ccCTwVtdLats/1v7ReiBVx+Akya0UVhHo9IBr8ZkpDI3/SGNcaruJBp5agy8ROF97VDKkZamoUXxRB9NUA==
5781
+next@^11.0.1:
5782
+  version "11.0.1"
5783
+  resolved "https://registry.yarnpkg.com/next/-/next-11.0.1.tgz#b8e3914d153aaf7143cb98c09bcd3c8230eeb17a"
5784
+  integrity sha512-yR7be7asNbvpVNpi6xxEg28wZ7Gqmj1nOt0sABH9qORmF3+pms2KZ7Cng33oK5nqPIzEEFJD0pp2PCe3/ueMIg==
5821 5785
   dependencies:
5822 5786
     "@babel/runtime" "7.12.5"
5823 5787
     "@hapi/accept" "5.0.2"
5824
-    "@next/env" "11.0.0"
5825
-    "@next/polyfill-module" "11.0.0"
5826
-    "@next/react-dev-overlay" "11.0.0"
5827
-    "@next/react-refresh-utils" "11.0.0"
5788
+    "@next/env" "11.0.1"
5789
+    "@next/polyfill-module" "11.0.1"
5790
+    "@next/react-dev-overlay" "11.0.1"
5791
+    "@next/react-refresh-utils" "11.0.1"
5828 5792
     assert "2.0.0"
5829 5793
     ast-types "0.13.2"
5830 5794
     browserify-zlib "0.2.0"

Завантаження…
Відмінити
Зберегти