├── .babelrc
├── .gitignore
├── README.md
├── assets
└── logo.png
├── design-catalogue
├── designs-core
│ ├── animations
│ │ └── Rotation.js
│ ├── designs
│ │ ├── AbstractPoly.js
│ │ ├── Checks.js
│ │ ├── Circles.js
│ │ ├── DoublyTriangle.js
│ │ ├── Sottsass.js
│ │ ├── Star.js
│ │ ├── WavePatternLines.js
│ │ └── createDesign.js
│ ├── renderer
│ │ └── flush.js
│ ├── src
│ │ └── index.js
│ └── utils
│ │ └── index.js
├── public
│ └── index.html
├── src
│ ├── components
│ │ ├── ErrorBoundary.js
│ │ ├── Footer.js
│ │ ├── Heading.js
│ │ ├── Home.js
│ │ ├── Info.js
│ │ ├── Placeholders.js
│ │ ├── Player.js
│ │ └── details
│ │ │ ├── ChecksDetails.js
│ │ │ ├── CirclesDetails.js
│ │ │ ├── DetailContainer.js
│ │ │ └── StarFractalDetails.js
│ ├── index.js
│ ├── primitives
│ │ ├── BackButton.js
│ │ ├── Button.js
│ │ ├── Canvas.js
│ │ ├── DownloadButton.js
│ │ └── Slider.js
│ └── utils
│ │ ├── designs.js
│ │ ├── downloadDesign.js
│ │ ├── globalStyles.js
│ │ ├── hoc.js
│ │ └── lazyLoad.js
└── vendor
│ ├── react-art.development.js
│ ├── react-art.production.min.js
│ ├── react-dom-server.browser.development.js
│ ├── react-dom-server.browser.production.min.js
│ ├── react-dom-test-utils.development.js
│ ├── react-dom-test-utils.production.min.js
│ ├── react-dom-unstable-native-dependencies.development.js
│ ├── react-dom-unstable-native-dependencies.production.min.js
│ ├── react-dom.development.js
│ ├── react-dom.production.min.js
│ ├── react-is.development.js
│ ├── react-is.production.min.js
│ ├── react-scheduler.development.js
│ ├── react-scheduler.production.min.js
│ ├── react-test-renderer-shallow.development.js
│ ├── react-test-renderer-shallow.production.min.js
│ ├── react-test-renderer.development.js
│ ├── react-test-renderer.production.min.js
│ ├── react.development.js
│ └── react.production.min.js
├── package.json
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env", "react"],
3 | "plugins": [
4 | "transform-object-rest-spread",
5 | "transform-class-properties"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .cache
2 | .vscode
3 | dist
4 | node_modules
5 | build
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Generative-design
2 |
3 | > A collection of interactive generative designs.
4 |
5 |
6 |
7 |
8 |
9 | This repository contains a collection of generative design React components with which you can play and change parameters to transform the design.
10 |
11 | > **This project will continue to evolve as I add more designs**
12 |
13 | ## Designs
14 |
15 | All the designs can be found at [https://generative-design.surge.sh](https://generative-design.surge.sh)
16 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nitin42/generative-designs/8c7e80363c8386474be3a0df56d5b2ec25e0f190/assets/logo.png
--------------------------------------------------------------------------------
/design-catalogue/designs-core/animations/Rotation.js:
--------------------------------------------------------------------------------
1 | export function startRotation(objects, props) {
2 | objects.forEach(object => {
3 | this.TwoJS.bind('update', frames => {
4 | // This is called every 2N frames
5 | if (this.TwoJS.playing) {
6 | if (frames % 2 === 0) {
7 | if (object.scale > 0.9999) {
8 | object.scale = object.rotation = 0
9 | }
10 |
11 | const t = (1 - object.scale) * props.scaleOffset
12 |
13 | object.scale += t
14 | object.rotation += t * props.rotationOffset * Math.PI
15 | }
16 | }
17 | })
18 | })
19 | }
20 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/AbstractPoly.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 | import { startRotation } from '../animations/Rotation'
3 |
4 | function drawOddHex(instance, len, y) {
5 | let count = 0
6 | const renderedHex = []
7 |
8 | for (let x = len + 25; x <= instance.width - 40; x += 50) {
9 | if (count % 2 === 0) {
10 | const poly = instance.makePolygon(x, y, 10, 6)
11 | poly.fill = 'pink'
12 | poly.stroke = 'pink'
13 |
14 | renderedHex.push(poly)
15 | } else {
16 | const poly = instance.makePolygon(x, y, 10, 6)
17 | poly.fill = '#86cece'
18 | poly.stroke = '#86cece'
19 | renderedHex.push(poly)
20 | }
21 | count++
22 | }
23 |
24 | return renderedHex
25 | }
26 |
27 | function drawEvenHex(instance, len, y) {
28 | let count = 0
29 | const renderedHex = []
30 |
31 | for (let x = len + 25; x <= instance.width - 70; x += 50) {
32 | if (count % 2 === 0) {
33 | const poly = instance.makePolygon(x, y, 10, 6)
34 | poly.fill = '#ea8e6c'
35 | poly.stroke = '#ea8e6c'
36 |
37 | renderedHex.push(poly)
38 | } else {
39 | const poly = instance.makePolygon(x, y, 10, 6)
40 | poly.fill = '#b8d9d0'
41 | poly.stroke = '#b8d9d0'
42 |
43 | renderedHex.push(poly)
44 | }
45 | count++
46 | }
47 |
48 | return renderedHex
49 | }
50 |
51 | function drawPolygon(instance, props) {
52 | let renderedHex = []
53 |
54 | for (let x = 30; x <= instance.height; x += 40) {
55 | renderedHex.push(drawOddHex(instance, 20, x))
56 | x += 40
57 | renderedHex.push(drawEvenHex(instance, 45, x))
58 | }
59 |
60 | return renderedHex
61 | }
62 |
63 | function sketch() {
64 | const polys = drawPolygon(this.TwoJS, this.props)
65 |
66 | polys.forEach(poly => startRotation.call(this, poly, this.props))
67 | }
68 |
69 | const AbstractPoly = createDesign(sketch)
70 |
71 | AbstractPoly.defaultProps = {
72 | callback: ctrl => {},
73 | scaleOffset: 0.0245,
74 | rotationOffset: 4,
75 | width: 480,
76 | height: 430
77 | }
78 |
79 | export { AbstractPoly }
80 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/Checks.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 | import { startRotation } from '../animations/Rotation'
3 |
4 | function drawChecks(instance, props) {
5 | const renderedLines = []
6 |
7 | for (let x = -15; x <= instance.width; x += props.horizontalGap) {
8 | for (let y = -15; y <= instance.height; y += props.verticalGap) {
9 | const line = instance.makeLine(x, y, x + 50, y)
10 | line.stroke = '#babcc0'
11 |
12 | renderedLines.push(line)
13 | }
14 | }
15 |
16 | for (let x = -15; x <= instance.width; x += props.horizontalGap) {
17 | for (let y = -15; y <= instance.height; y += props.verticalGap) {
18 | const line = instance.makeLine(x, y, x, y + 50)
19 | line.stroke = '#babcc0'
20 |
21 | renderedLines.push(line)
22 | }
23 | }
24 |
25 | return renderedLines
26 | }
27 |
28 | function sketch() {
29 | const checks = drawChecks(this.TwoJS, this.props)
30 | startRotation.call(this, checks, this.props)
31 | }
32 |
33 | const Checks = createDesign(sketch)
34 |
35 | Checks.defaultProps = {
36 | callback: inst => {},
37 | scaleOffset: 0.1,
38 | rotationOffset: 1.5,
39 | width: 300,
40 | height: 300,
41 | verticalGap: 20,
42 | horizontalGap: 20
43 | }
44 |
45 | Checks.displayName = 'Checks'
46 |
47 | export { Checks }
48 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/Circles.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 | import { startRotation } from '../animations/Rotation'
3 |
4 | import { random } from '../utils/index'
5 |
6 | const colors = {
7 | CIRCLE_ONE: '#ff4444',
8 | CIRCLE_TWO: '#000000',
9 | CIRCLE_THREE: '#b8bdc1'
10 | }
11 |
12 | function drawCircle(offset, color, instance) {
13 | const circles = []
14 |
15 | for (let x = 20; x <= instance.width; x += 15) {
16 | const circle = instance.makeCircle(offset, x, random(0, 10))
17 | circle.fill = color
18 | circle.noStroke()
19 |
20 | circles.push(circle)
21 | }
22 |
23 | return circles
24 | }
25 |
26 | function drawPattern(instance, props) {
27 | let renderedCircles = []
28 |
29 | for (let x = 10; x <= instance.width; x += props.positionOffsetOne) {
30 | renderedCircles.push(drawCircle(x, colors.CIRCLE_ONE, instance))
31 | x += props.positionOffsetTwo
32 |
33 | renderedCircles.push(drawCircle(x, colors.CIRCLE_TWO, instance))
34 | x += props.positionOffsetThree
35 |
36 | renderedCircles.push(drawCircle(x, colors.CIRCLE_THREE, instance))
37 | }
38 |
39 | return renderedCircles
40 | }
41 |
42 | function sketch() {
43 | const circles = drawPattern(this.TwoJS, this.props)
44 |
45 | circles.forEach(objects => {
46 | startRotation.call(this, objects, this.props)
47 | })
48 | }
49 |
50 | const Circles = createDesign(sketch)
51 |
52 | Circles.defaultProps = {
53 | callback: ctrl => {},
54 | scaleOffset: 0.0245,
55 | rotationOffset: 4,
56 | width: 400,
57 | height: 300,
58 | positionOffsetOne: 20,
59 | positionOffsetTwo: 30,
60 | positionOffsetThree: 40
61 | }
62 |
63 | export { Circles }
64 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/DoublyTriangle.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 | import { startRotation } from '../animations/Rotation'
3 | import { random } from '../utils/index'
4 |
5 | function drawTriangle(instance, props) {
6 | const triangles = []
7 |
8 | for (let x = 0; x <= 120; x += 10) {
9 | for (let y = 0; y <= 120; y += 10) {
10 | const triangle = instance.makePolygon(x, y, random(0, 1.2), 3)
11 | triangle.fill = 'mistyrose'
12 | triangle.noStroke()
13 | const group = instance.makeGroup(triangle)
14 | group.scale = 2.7
15 |
16 | triangles.push(triangle)
17 | }
18 | }
19 |
20 | return triangles
21 | }
22 |
23 | function drawLines(instance, props) {
24 | const renderedLines = []
25 |
26 | for (let y = 0; y <= 120; y += 5) {
27 | for (let x = 0; x <= 120; x += 5) {
28 | if (x % 10 == 0) {
29 | const x1 = random(x, x + 1)
30 | const x2 = random(x, x + 3)
31 | const y2 = random(y, y - 4)
32 |
33 | const lineUp = instance.makeLine(x1, y, x2, y2)
34 | lineUp.stroke = props.strokeUp
35 | lineUp.linewidth = 0.3
36 |
37 | const group = instance.makeGroup(lineUp)
38 | group.scale = 2.9
39 |
40 | renderedLines.push(lineUp)
41 |
42 | const lineUp2 = instance.makeLine(x1 + 10, y + 10, x2 + 10, y2 + 10)
43 | lineUp2.stroke = props.strokeUp
44 | lineUp2.linewidth = 0.3
45 |
46 | const group2 = instance.makeGroup(lineUp2)
47 | group2.scale = 2.9
48 |
49 | renderedLines.push(lineUp2)
50 | } else {
51 | const y1 = random(y, y + 2)
52 | const x2 = random(x, x + 3)
53 | const y2 = random(y, y + 3)
54 | const lineDown = instance.makeLine(x, y1, x2, y2)
55 | lineDown.stroke = props.strokeDown
56 | lineDown.linewidth = 0.3
57 |
58 | const group = instance.makeGroup(lineDown)
59 | group.scale = 2.9
60 |
61 | renderedLines.push(lineDown)
62 |
63 | const lineDown2 = instance.makeLine(x + 10, y1 + 10, x2 + 10, y2 + 10)
64 | lineDown2.stroke = props.strokeDown
65 | lineDown2.linewidth = 0.3
66 |
67 | const group2 = instance.makeGroup(lineDown2)
68 | group2.scale = 2.9
69 |
70 | renderedLines.push(lineDown2)
71 | }
72 | }
73 | }
74 |
75 | return renderedLines
76 | }
77 |
78 | function sketch() {
79 | const triangles = drawTriangle(this.TwoJS, this.props)
80 | const lines = drawLines(this.TwoJS, this.props)
81 |
82 | startRotation.call(this, triangles, this.props)
83 | startRotation.call(this, lines, this.props)
84 | }
85 |
86 | const DoublyTriangle = createDesign(sketch)
87 |
88 | DoublyTriangle.displayName = 'DoublyTriangle'
89 |
90 | DoublyTriangle.defaultProps = {
91 | callback: ctrl => {},
92 | scaleOffset: 0.05,
93 | rotationOffset: 2,
94 | strokeUp: '#ffc0cb',
95 | strokeDown: '#c6e2ff',
96 | width: 300,
97 | height: 300
98 | }
99 |
100 | export { DoublyTriangle }
101 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/Sottsass.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 | import { random } from '../utils/index'
3 | import { startRotation } from '../animations/Rotation'
4 |
5 | function drawLines(instance, props) {
6 | const renderedLines = []
7 |
8 | for (let y = 0; y <= 200; y += 5) {
9 | for (let x = 0; x <= 200; x += 5) {
10 | if (x % 10 == 0) {
11 | const lineUp = instance.makeLine(
12 | random(x, x + 1),
13 | y,
14 | random(x, x + 3),
15 | random(y, y - 4)
16 | )
17 | lineUp.stroke = props.strokeUp
18 | lineUp.linewidth = 0.3
19 |
20 | const group = instance.makeGroup(lineUp)
21 | group.scale = 3
22 |
23 | renderedLines.push(lineUp)
24 | } else {
25 | const lineDown = instance.makeLine(
26 | x,
27 | random(y, y + 2),
28 | random(x, x + 3),
29 | random(y, y + 3)
30 | )
31 | lineDown.stroke = props.strokeDown
32 | lineDown.linewidth = 0.3
33 |
34 | const group = instance.makeGroup(lineDown)
35 | group.scale = 3
36 |
37 | renderedLines.push(lineDown)
38 | }
39 | }
40 | }
41 |
42 | return renderedLines
43 | }
44 |
45 | function drawCircles(instance, props) {
46 | const renderedCircles = []
47 |
48 | for (let y = 0; y <= 100; y += 4) {
49 | for (let x = 0; x <= 100; x += 4) {
50 | const circle = instance.makeCircle(x, y, random(0, 1.1))
51 | circle.noStroke()
52 | circle.fill = '#ffd700'
53 | circle.opacity = 0.3
54 | circle.linewidth = 0.5
55 |
56 | const group = instance.makeGroup(circle)
57 | group.scale = 3
58 |
59 | renderedCircles.push(circle)
60 | }
61 | }
62 |
63 | return renderedCircles
64 | }
65 |
66 | function sketch() {
67 | const circles = drawCircles(this.TwoJS, this.props)
68 | const lines = drawLines(this.TwoJS, this.props)
69 |
70 | // Rotate lines and circles
71 | startRotation.call(this, circles, this.props)
72 | startRotation.call(this, lines, this.props)
73 | }
74 |
75 | const SottsassPattern = createDesign(sketch)
76 |
77 | SottsassPattern.defaultProps = {
78 | callback: () => {},
79 | strokeUp: '#ffc0cb',
80 | strokeDown: '#c6e2ff',
81 | scaleOffset: 0.02,
82 | rotationOffset: 4,
83 | width: 300,
84 | height: 300
85 | }
86 |
87 | SottsassPattern.displayName = 'Sottsass Pattern'
88 |
89 | export { SottsassPattern }
90 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/Star.js:
--------------------------------------------------------------------------------
1 | import { createDesign } from './createDesign'
2 |
3 | // This is required for generating different stars
4 | function createSubStars(instance, x, y, radius, sides, props) {
5 | const star = instance.makeStar(x, y, radius, radius - 30, sides)
6 |
7 | star.fill = props.fill
8 | star.stroke = props.stroke
9 |
10 | if (radius > 12) {
11 | createSubStars(
12 | instance,
13 | x + radius / props.innerRadiusOffset,
14 | y,
15 | radius / props.innerRadiusOffset,
16 | sides,
17 | props
18 | )
19 | createSubStars(
20 | instance,
21 | x - radius / props.innerRadiusOffset,
22 | y,
23 | radius / props.innerRadiusOffset,
24 | sides,
25 | props
26 | )
27 | createSubStars(
28 | instance,
29 | x,
30 | y + radius / props.innerRadiusOffset,
31 | radius / props.innerRadiusOffset,
32 | sides,
33 | props
34 | )
35 | createSubStars(
36 | instance,
37 | x,
38 | y - radius / props.innerRadiusOffset,
39 | radius / props.innerRadiusOffset,
40 | sides,
41 | props
42 | )
43 | }
44 | }
45 |
46 | function createStar(instance, x, y, props) {
47 | const { length: radius, sides, stroke, fill } = props
48 |
49 | const star = instance.makeStar(x, y, radius, radius - 30, sides)
50 |
51 | star.fill = fill
52 | star.stroke = stroke
53 |
54 | if (radius > 12) {
55 | createSubStars(
56 | instance,
57 | x + radius / props.outerRadiusOffset,
58 | y,
59 | radius / props.outerRadiusOffset,
60 | sides,
61 | props
62 | )
63 | createSubStars(
64 | instance,
65 | x - radius / props.outerRadiusOffset,
66 | y,
67 | radius / props.outerRadiusOffset,
68 | sides,
69 | props
70 | )
71 | createSubStars(
72 | instance,
73 | x,
74 | y + radius / props.outerRadiusOffset,
75 | radius / props.outerRadiusOffset,
76 | sides,
77 | props
78 | )
79 | createSubStars(
80 | instance,
81 | x,
82 | y - radius / props.outerRadiusOffset,
83 | radius / props.outerRadiusOffset,
84 | sides,
85 | props
86 | )
87 | }
88 | }
89 |
90 | function drawStarFractal(instance, props) {
91 | createStar(instance, instance.width / 2, instance.height / 2, props)
92 | }
93 |
94 | function sketch() {
95 | drawStarFractal(this.TwoJS, this.props)
96 | }
97 |
98 | const StarFractal = createDesign(sketch)
99 |
100 | StarFractal.displayName = 'StarFractal'
101 |
102 | StarFractal.defaultProps = {
103 | // Length of the fractal
104 | length: 120,
105 | height: 400,
106 | width: 400,
107 | // Number of sides of star
108 | sides: 8,
109 | stroke: 'mistyrose',
110 | fill: 'pink',
111 | outerRadiusOffset: 2,
112 | innerRadiusOffset: 2,
113 | callback: instance => {}
114 | }
115 |
116 | export { StarFractal }
117 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/WavePatternLines.js:
--------------------------------------------------------------------------------
1 | import { startRotation } from '../animations/Rotation'
2 | import { createDesign } from './createDesign'
3 |
4 | // Draw wave line pattern
5 | function drawWavyLines(instance, props) {
6 | const renderedLines = []
7 |
8 | for (let y = 20; y <= 90; y += 5) {
9 | for (let x = 20; x <= 80; x += 5) {
10 | if (x % 10 == 0) {
11 | const lineUp = instance.makeLine(x, y, x + 3, y - 3)
12 | lineUp.stroke = props.strokeUp
13 | lineUp.linewidth = 0.7
14 |
15 | const group = instance.makeGroup(lineUp)
16 | group.scale = props.scale
17 |
18 | renderedLines.push(lineUp)
19 | } else {
20 | const lineDown = instance.makeLine(x, y, x + 3, y + 3)
21 | lineDown.stroke = props.strokeDown
22 | lineDown.linewidth = 0.7
23 |
24 | const group = instance.makeGroup(lineDown)
25 | group.scale = props.scale
26 |
27 | renderedLines.push(lineDown)
28 | }
29 | }
30 | }
31 |
32 | return renderedLines
33 | }
34 |
35 | function sketch() {
36 | const renderedLines = drawWavyLines(this.TwoJS, this.props)
37 | startRotation.call(this, renderedLines, this.props)
38 | }
39 |
40 | const WavyLines = createDesign(sketch)
41 |
42 | WavyLines.defaultProps = {
43 | width: 260,
44 | height: 250,
45 | strokeUp: '#FFEBE1',
46 | strokeDown: 'pink',
47 | scaleOffset: 0.08,
48 | rotationOffset: 4,
49 | scale: 2.5,
50 | callback: instance => {}
51 | }
52 |
53 | WavyLines.displayName = 'WavyLines'
54 |
55 | export { WavyLines }
56 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/designs/createDesign.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Two from 'two.js'
3 | import { css } from 'emotion'
4 |
5 | import { flush } from '../renderer/flush'
6 |
7 | // Takes a sketch function, and renders Two.js graphics
8 | export function createDesign(sketch) {
9 | return class extends React.Component {
10 | // Two.js instance
11 | TwoJS = null
12 |
13 | componentDidMount() {
14 | // Get the main container element
15 | const container = document.getElementById(this.props.id)
16 |
17 | // Two.js params
18 | const params = { width: this.props.width, height: this.props.height }
19 |
20 | // Append Two.js base to our container
21 | this.TwoJS = new Two(params).appendTo(container)
22 |
23 | // Do some extra work with the Two.js instance (play/pause the animations, create custom curves etc)
24 | this.props.callback(this.TwoJS)
25 |
26 | // Render the graphics
27 | flush.call(this, { shouldDequeue: false }, sketch)
28 | }
29 |
30 | componentDidUpdate() {
31 | // Clear the previously rendered Two.js objects, and start rendering from scratch (otherwise we end up with an array of old objects along with the new objects)
32 | flush.call(this, { shouldDequeue: true }, sketch)
33 | }
34 |
35 | render() {
36 | return (
37 |
51 | )
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/renderer/flush.js:
--------------------------------------------------------------------------------
1 | // Flush Two.js graphics
2 | // It takes a flag to determine whether to clear the current batch and restart, and a callback to perform work.
3 | export function flush({ shouldDequeue }, work) {
4 | // Clear the current batch of lines and restart from scratch
5 | if (shouldDequeue) {
6 | this.TwoJS && this.TwoJS.clear()
7 | }
8 |
9 | work.call(this)
10 |
11 | this.TwoJS.update()
12 | }
13 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/src/index.js:
--------------------------------------------------------------------------------
1 | import { StarFractal } from '../designs/Star'
2 | import { WavyLines } from '../designs/WavePatternLines'
3 | import { Circles } from '../designs/Circles'
4 | import { SottsassPattern } from '../designs/Sottsass'
5 | import { DoublyTriangle } from '../designs/DoublyTriangle'
6 | import { Checks } from '../designs/Checks'
7 | import { AbstractPoly } from '../designs/AbstractPoly'
8 | import { createDesign } from '../designs/createDesign'
9 |
10 | import { startRotation } from '../animations/Rotation'
11 |
12 | // Generative designs
13 | export {
14 | StarFractal,
15 | WavyLines,
16 | Circles,
17 | SottsassPattern,
18 | DoublyTriangle,
19 | Checks,
20 | AbstractPoly,
21 | createDesign,
22 | startRotation
23 | }
24 |
--------------------------------------------------------------------------------
/design-catalogue/designs-core/utils/index.js:
--------------------------------------------------------------------------------
1 | export const random = (max, min) =>
2 | Math.floor(Math.random() * (max - min) + min)
3 |
--------------------------------------------------------------------------------
/design-catalogue/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Generative Design
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/ErrorBoundary.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export class ErrorBoundary extends React.Component {
4 | state = { hasError: false }
5 |
6 | componentDidCatch(error, info) {
7 | console.clear()
8 | this.setState({ hasError: true })
9 | }
10 |
11 | render() {
12 | if (this.state.hasError) {
13 | return {this.props.fallbackUI}
14 | }
15 | return this.props.children
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Footer.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled from 'react-emotion'
3 |
4 | const StyledFooter = styled('footer')`
5 | display: flex;
6 | justify-content: center;
7 | font-size: 20px;
8 | `
9 |
10 | const StyledLink = styled('a')`
11 | text-decoration: none;
12 | color: #4f4f4f;
13 | font-weight: bold;
14 | `
15 |
16 | export const Footer = props => (
17 |
18 |
19 | Made with ❤️ by{' '}
20 |
21 | Nitin Tulswani
22 |
23 |
24 |
25 | )
26 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Heading.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled, { css } from 'react-emotion'
3 |
4 | const Title = styled('h1')`
5 | font-size: 4em;
6 | display: inline-block;
7 |
8 | @media screen and (max-device-width: 480px) {
9 | font-size: 2.4em;
10 | }
11 | `
12 |
13 | export const Heading = props => (
14 |
15 |
Generative Design
16 |
17 | )
18 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled, { css } from 'react-emotion'
3 |
4 | import { Heading } from './Heading'
5 | import { Footer } from './Footer'
6 | import { Player } from './Player'
7 | import { Info as InfoModal } from './Info'
8 |
9 | import {
10 | ChecksDesign,
11 | StarFractal,
12 | PolygonDesign,
13 | WavyLines,
14 | Circles,
15 | DoublyTriangle,
16 | SottsassPattern
17 | } from '../utils/lazyLoad'
18 |
19 | const Catalogue = styled('div')`
20 | display: grid;
21 | grid-template-columns: repeat(auto-fill, 300px);
22 | justify-content: center;
23 | grid-gap: 40px;
24 | margin-left: 20px;
25 |
26 | @media screen and (max-device-width: 480px) {
27 | grid-template-columns: 300px;
28 | grid-gap: 20px;
29 | margin-left: 5px;
30 | }
31 | `
32 |
33 | const Info = props => (
34 |
50 |
Hello 👋
51 |
52 | You will find a collection of generative designs on the home page.
53 | Interact with a design by clicking on the play icon.
54 |
55 |
Parameterization
56 |
57 | To be able to create a bridge between transformation and visualization,
58 | you can click on some of the designs to open the details page. On the
59 | details page, you will find a list of controls to change the parameters of
60 | the design. Optionally, you can also save the transformed design.
61 |
62 |
63 | The source code for all the designs is available on{' '}
64 |
72 | GitHub
73 |
74 | .
75 |
76 |
Have fun!
77 |
78 | )
79 |
80 | export const Home = props => (
81 |
82 |
83 |
84 |
85 |
86 |
87 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | )
105 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Info.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { css } from 'emotion'
3 | import Modal from 'react-responsive-modal'
4 |
5 | export class Info extends React.Component {
6 | state = { open: false }
7 |
8 | toggleModal = e => this.setState(state => ({ open: !state.open }))
9 |
10 | render() {
11 | return (
12 |
13 |
21 |
22 |
23 |
24 | {this.props.children}
25 |
26 |
27 | )
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Placeholders.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled, { keyframes } from 'react-emotion'
3 |
4 | const PLACEHOLDER_BACKGROUND = {
5 | POLYGON: '#fff1f8',
6 | SOTTSASS: '#ff7eba',
7 | DTDESIGN: '#ff68af',
8 | WAVES: '#cd6090'
9 | }
10 |
11 | const StyledPlaceholder = styled('div')`
12 | -webkit-box-shadow: 10px 10px 40px -23px rgba(194, 194, 194, 1);
13 | -moz-box-shadow: 10px 10px 40px -23px rgba(194, 194, 194, 1);
14 | box-shadow: 10px 10px 40px -23px rgba(194, 194, 194, 1);
15 | cursor: pointer;
16 | width: 300px;
17 | height: 300px;
18 | display: flex;
19 | justify-content: center;
20 | aligns-items: center;
21 | background: ${props => props.bg};
22 | `
23 |
24 | // Copied from http://tobiasahlin.com/spinkit/
25 |
26 | const skRotate = keyframes`
27 | 100% { transform: rotate(360deg); -webkit-transform: rotate(360deg) }
28 | `
29 |
30 | const skBounce = keyframes`
31 | 0%, 100% {
32 | transform: scale(0.0);
33 | -webkit-transform: scale(0.0);
34 | } 50% {
35 | transform: scale(1.0);
36 | -webkit-transform: scale(1.0);
37 | }
38 | `
39 |
40 | const Spinner = styled('div')`
41 | margin: 100px auto;
42 | width: 40px;
43 | height: 40px;
44 | position: relative;
45 | text-align: center;
46 |
47 | -webkit-animation: ${skRotate} 2s infinite linear;
48 | animation: ${skRotate} 2s infinite linear;
49 | `
50 |
51 | const DotOne = styled('div')`
52 | width: 60%;
53 | height: 60%;
54 | display: inline-block;
55 | position: absolute;
56 | top: 0;
57 | background-color: ${props => props.color};
58 | border-radius: 100%;
59 |
60 | -webkit-animation: ${skBounce}2s infinite ease-in-out;
61 | animation: ${skBounce}2s infinite ease-in-out;
62 | `
63 |
64 | const DotTwo = styled('div')`
65 | width: 60%;
66 | height: 60%;
67 | display: inline-block;
68 | position: absolute;
69 | top: 0;
70 | background-color: ${props => props.color};
71 | border-radius: 100%;
72 | -webkit-animation: ${skBounce} 2s infinite ease-in-out;
73 | animation: ${skBounce} 2s infinite ease-in-out;
74 | top: auto;
75 | bottom: 0;
76 | -webkit-animation-delay: -1s;
77 | animation-delay: -1s;
78 | `
79 |
80 | const createPlaceholder = (bg, loaderColor) => (
81 |
82 |
83 |
84 |
85 |
86 |
87 | )
88 |
89 | export const ChecksDesignPlaceholder = loaderColor =>
90 | createPlaceholder(undefined, loaderColor)
91 |
92 | export const PolygonDesignPlaceholder = loaderColor =>
93 | createPlaceholder(PLACEHOLDER_BACKGROUND.POLYGON, loaderColor)
94 |
95 | export const SottsassDesignPlaceholder = loaderColor =>
96 | createPlaceholder(PLACEHOLDER_BACKGROUND.SOTTSASS, loaderColor)
97 |
98 | export const DTDesignPlaceholder = loaderColor =>
99 | createPlaceholder(PLACEHOLDER_BACKGROUND.DTDESIGN, loaderColor)
100 |
101 | export const WaveLinesDesignPlaceholder = loaderColor =>
102 | createPlaceholder(PLACEHOLDER_BACKGROUND.WAVES, loaderColor)
103 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/Player.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled from 'react-emotion'
3 |
4 | const Icon = styled('div')`
5 | display: flex;
6 | justify-content: center;
7 | align-items: center;
8 | margin-top: 20px;
9 | `
10 |
11 | export class Player extends React.Component {
12 | state = {
13 | playing: this.props.instance && this.props.instance.playing
14 | }
15 |
16 | handlePlayer = action => {
17 | this.setState(state => ({ playing: !state.playing }))
18 | this.props.instance[action]()
19 | }
20 |
21 | render() {
22 | return (
23 |
24 | {this.state.playing ? (
25 | this.handlePlayer('pause')}
28 | />
29 | ) : (
30 | this.handlePlayer('play')} />
31 | )}
32 |
33 | )
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/details/ChecksDetails.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { Checks } from '../../../designs-core/src'
4 |
5 | import { DetailContainer } from './DetailContainer'
6 |
7 | import { Player } from '../Player'
8 |
9 | import { RangeSlider } from '../../primitives/Slider'
10 | import { BackButton } from '../../primitives/BackButton'
11 | import { DownloadButton } from '../../primitives/DownloadButton'
12 | import { ShadowCanvas } from '../../primitives/Canvas'
13 |
14 | export class ChecksDetails extends React.Component {
15 | state = {
16 | instance: null,
17 | rotationOffset: 4,
18 | scaleOffset: 0.14,
19 | verticalGap: 20,
20 | horizontalGap: 20
21 | }
22 |
23 | componentDidMount() {
24 | window.scrollTo({
25 | top: 0,
26 | behavior: 'smooth'
27 | })
28 | }
29 |
30 | updateState = (e, prop) => this.setState({ [prop]: parseInt(e.target.value) })
31 |
32 | render() {
33 | return (
34 |
35 |
36 |
37 | this.setState({ instance })}
40 | rotationOffset={this.state.rotationOffset}
41 | scaleOffset={this.state.scaleOffset}
42 | verticalGap={this.state.verticalGap}
43 | horizontalGap={this.state.horizontalGap}
44 | width={window.innerWidth < 480 ? 320 : 500}
45 | height={window.innerWidth < 480 ? 320 : 500}
46 | className="animated zoomIn"
47 | />
48 |
49 |
50 |
51 | Scale offset:
52 | this.setState({ scaleOffset: e.target.value })}
58 | />
59 |
60 |
61 | Rotation offset:
62 |
67 | this.setState({ rotationOffset: parseInt(e.target.value) })
68 | }
69 | />
70 |
71 |
72 | Vertical space:
73 |
78 | this.setState({ verticalGap: parseInt(e.target.value) })
79 | }
80 | />
81 |
82 |
83 | Horizontal space:
84 |
89 | this.setState({ horizontalGap: parseInt(e.target.value) })
90 | }
91 | />
92 |
93 |
94 |
95 |
99 |
100 |
101 | )
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/details/CirclesDetails.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { Circles } from '../../../designs-core/src'
4 | import { DetailContainer } from './DetailContainer'
5 |
6 | import { Player } from '../Player'
7 |
8 | import { RangeSlider } from '../../primitives/Slider'
9 | import { BackButton } from '../../primitives/BackButton'
10 | import { DownloadButton } from '../../primitives/DownloadButton'
11 | import { ShadowCanvas } from '../../primitives/Canvas'
12 |
13 | export class CirclesDetails extends React.Component {
14 | state = {
15 | instance: null,
16 | positionOffsetOne: 20,
17 | positionOffsetTwo: 30,
18 | positionOffsetThree: 40
19 | }
20 |
21 | componentDidMount() {
22 | window.scrollTo({
23 | top: 0,
24 | behavior: 'smooth'
25 | })
26 | }
27 |
28 | render() {
29 | return (
30 |
31 |
32 |
33 |
34 | this.setState({ instance })}
43 | />
44 |
45 |
46 |
47 | Offset red:
48 |
53 | this.setState({ positionOffsetOne: parseInt(e.target.value) })
54 | }
55 | />
56 |
57 |
58 | Offset black:
59 |
64 | this.setState({ positionOffsetTwo: parseInt(e.target.value) })
65 | }
66 | />
67 |
68 |
69 | Offset grey:
70 |
75 | this.setState({
76 | positionOffsetThree: parseInt(e.target.value)
77 | })
78 | }
79 | />
80 |
81 |
82 |
83 |
87 |
88 |
89 | )
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/details/DetailContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled from 'react-emotion'
3 |
4 | const Container = styled('div')`
5 | display: flex;
6 | justify-content: center;
7 | align-items: center;
8 | flex-direction: column;
9 | margin-top: 20px;
10 | `
11 |
12 | export const DetailContainer = props => {props.children}
13 |
--------------------------------------------------------------------------------
/design-catalogue/src/components/details/StarFractalDetails.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { css } from 'emotion'
3 | import { Link } from 'react-router-dom'
4 |
5 | import { StarFractal } from '../../../designs-core/src'
6 | import { DetailContainer } from './DetailContainer'
7 | import { ErrorBoundary } from '../ErrorBoundary'
8 | import { Info as InfoModal } from '../Info'
9 | import { RangeSlider } from '../../primitives/Slider'
10 | import { Button } from '../../primitives/Button'
11 | import { ShadowCanvas } from '../../primitives/Canvas'
12 | import { DownloadButton } from '../../primitives/DownloadButton'
13 | import { BackButton } from '../../primitives/BackButton'
14 |
15 | // This is required because radius offsets can overload the stack size because generating a design involves recursive computations
16 | const FallbackUI = () => (
17 |
18 |
34 | It seems like you are changing the inner radius or outer radius offset too
35 | fast or too often. Changing the radius enqueues a recursive computation
36 | which generates the design. Changing the radius too often may result in
37 | exceeding the call stack size limit. In order to avoid such scenarios,
38 | updates to the design are not applied. Reload the design to start again!
39 |
40 | window.location.reload(true)}>Reload design
41 |
42 | )
43 |
44 | const Info = props => (
45 |
61 |
Star Fractal
62 |
63 | A fractal is a geometric shape that can be split into parts, each of which
64 | is self-similar. This fractal uses recursion and star shape to construct a
65 | stochastic fractal, which means it is built on probability and randomness.
66 |
67 |
68 | By changing the parameters like length , sides , and{' '}
69 | radius offsets , you can generate different designs of this fractal.
70 |
71 |
Try changing the parameters and see how it transforms the fractal.
72 |
73 | )
74 |
75 | export class StarFractalDetails extends React.Component {
76 | state = {
77 | length: 80,
78 | sides: 4,
79 | outerRadiusOffset: 2,
80 | innerRadiusOffset: 2
81 | }
82 |
83 | componentDidMount() {
84 | window.scrollTo({
85 | top: 0,
86 | behavior: 'smooth'
87 | })
88 | }
89 |
90 | updateState = (e, prop) => this.setState({ [prop]: parseInt(e.target.value) })
91 |
92 | render() {
93 | return (
94 |
95 |
96 |
97 |
98 |
99 |
100 | }>
101 |
114 |
115 |
116 | Length:
117 | this.updateState(e, 'length')}
123 | />
124 |
125 |
126 | Sides:
127 | this.updateState(e, 'sides')}
133 | />
134 |
135 |
136 | Inner radius offset:
137 | this.updateState(e, 'innerRadiusOffset')}
143 | />
144 |
145 |
146 | Outer radius offset:
147 | this.updateState(e, 'outerRadiusOffset')}
153 | />
154 |
155 |
156 |
157 |
161 |
162 |
163 |
164 | )
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/design-catalogue/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import { injectGlobal } from 'react-emotion'
4 | import { BrowserRouter as Router, Route } from 'react-router-dom'
5 |
6 | import { Home } from './components/Home'
7 |
8 | import { ChecksDetails } from './components/details/ChecksDetails'
9 | import { StarFractalDetails } from './components/details/StarFractalDetails'
10 | import { CirclesDetails } from './components/details/CirclesDetails'
11 |
12 | import './utils/globalStyles'
13 |
14 | const App = () => (
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | )
24 |
25 | ReactDOM.render( , document.getElementById('root'))
26 |
--------------------------------------------------------------------------------
/design-catalogue/src/primitives/BackButton.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'react-router-dom'
3 |
4 | export const BackButton = () => (
5 |
6 |
7 |
8 | )
9 |
--------------------------------------------------------------------------------
/design-catalogue/src/primitives/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { css } from 'emotion'
3 |
4 | export const Button = ({ children, ...rest }) => (
5 |
25 | {children}
26 |
27 | )
28 |
--------------------------------------------------------------------------------
/design-catalogue/src/primitives/Canvas.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | // This is required to paint the svg onto the canvas and then make an octet stream using `toDataURI()` on the canvas element for downloading the design
4 | export const ShadowCanvas = ({ id }) => (
5 |
6 | )
7 |
--------------------------------------------------------------------------------
/design-catalogue/src/primitives/DownloadButton.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { Button } from './Button'
4 |
5 | import { downloadDesign } from '../utils/downloadDesign'
6 |
7 | export const DownloadButton = props => (
8 |
13 | downloadDesign(props.canvasId)}>
14 | Save design
15 |
16 |
17 | )
18 |
--------------------------------------------------------------------------------
/design-catalogue/src/primitives/Slider.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export const RangeSlider = props => (
4 |
14 | )
15 |
--------------------------------------------------------------------------------
/design-catalogue/src/utils/designs.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'react-router-dom'
3 |
4 | import {
5 | Checks,
6 | Circles,
7 | AbstractPoly,
8 | DoublyTriangle,
9 | FriederLines,
10 | SottsassPattern,
11 | MemphisDots,
12 | WavyLines
13 | } from '../../designs-core/src'
14 |
15 | import { hoc } from './hoc'
16 |
17 | export const ChecksDesign = hoc(props => (
18 |
19 |
26 |
27 | ))
28 |
29 | export const CirclesDesign = hoc(props => (
30 |
31 |
38 |
39 | ))
40 |
41 | export const PolygonDesign = hoc(props => (
42 |
49 | ))
50 |
51 | export const WaveLinesDesign = hoc(props => (
52 |
60 | ))
61 |
62 | export const SottsassDesign = hoc(props => (
63 |
70 | ))
71 |
72 | export const DoubleTriangleDesign = hoc(props => (
73 |
80 | ))
81 |
--------------------------------------------------------------------------------
/design-catalogue/src/utils/downloadDesign.js:
--------------------------------------------------------------------------------
1 | // Click handler to download the edited design
2 | export const downloadDesign = canvasId => {
3 | // Serialize the svg to a string and draw it as image on the canvas.
4 | window.canvg(
5 | canvasId,
6 | new XMLSerializer().serializeToString(document.querySelector('svg'))
7 | )
8 |
9 | const download = document.getElementById('download-design')
10 |
11 | // Get the data url of the image drawn on the canvas and replace it with octet stream so that the image binary can be downloaded
12 | const image = document
13 | .getElementById(canvasId)
14 | .toDataURL('image/png')
15 | .replace('image/png', 'image/octet-stream')
16 |
17 | // Set the image link
18 | download.setAttribute('href', image)
19 | }
20 |
--------------------------------------------------------------------------------
/design-catalogue/src/utils/globalStyles.js:
--------------------------------------------------------------------------------
1 | import { injectGlobal } from 'react-emotion'
2 |
3 | injectGlobal`
4 | body {
5 | color: #4f4f4f;
6 | background: #fffcfc;
7 | }
8 |
9 | i {
10 | cursor: pointer;
11 | }
12 |
13 | label {
14 | display: inline-block;
15 | width: 125px;
16 | position: relative;
17 | }
18 |
19 | .slider {
20 | -webkit-appearance: none;
21 | width: 320px;
22 | height: 8px;
23 | border-radius: 5px;
24 | background: #e4e4e4;
25 | outline: none;
26 | opacity: 0.7;
27 | -webkit-transition: .2s;
28 | transition: opacity .2s;
29 | }
30 |
31 | .slider::-webkit-slider-thumb {
32 | -webkit-appearance: none;
33 | appearance: none;
34 | width: 25px;
35 | height: 25px;
36 | border-radius: 50%;
37 | background: #222334;
38 | cursor: pointer;
39 | }
40 |
41 | .slider::-moz-range-thumb {
42 | width: 25px;
43 | height: 25px;
44 | border-radius: 50%;
45 | background: #222334;
46 | cursor: pointer;
47 | }
48 |
49 | ul {
50 | list-style: none;
51 | font-size: 1em;
52 | text-align: left;
53 | }
54 |
55 | li {
56 | margin: 10px;
57 | padding: 10px;
58 | }
59 |
60 | a {
61 | text-decoration: none;
62 | color: #4f4f4f;
63 | }
64 |
65 | @media screen and (max-device-width: 480px) {
66 | .slider {
67 | width: 260px;
68 | height: 4px;
69 | }
70 |
71 | .slider::-webkit-slider-thumb {
72 | width: 15px;
73 | height: 15px;
74 | }
75 |
76 | .slider::-moz-range-thumb {
77 | width: 15px;
78 | height: 15px;
79 | }
80 | }
81 | `
82 |
--------------------------------------------------------------------------------
/design-catalogue/src/utils/hoc.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { Player } from '../components/Player'
4 |
5 | // This high order function is generic, i.e it takes any design component,
6 | // and passes a callback prop to it. The callback prop is used to update the
7 | // state with an instance of currently rendered design.
8 | export const hoc = Design => {
9 | class GenericDesign extends React.Component {
10 | // The instance property of the state refers to the instance of design. This is used to play and pause
11 | // the animations for the currently rendered design.
12 | state = { designInstance: null }
13 |
14 | render() {
15 | return (
16 |
17 |
this.setState({ designInstance })} />
18 |
19 |
20 | )
21 | }
22 | }
23 |
24 | return GenericDesign
25 | }
26 |
--------------------------------------------------------------------------------
/design-catalogue/src/utils/lazyLoad.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { createCache, createResource } from 'simple-cache-provider'
3 | import { Link } from 'react-router-dom'
4 |
5 | import {
6 | ChecksDesignPlaceholder,
7 | PolygonDesignPlaceholder,
8 | DTDesignPlaceholder,
9 | WaveLinesDesignPlaceholder,
10 | SottsassDesignPlaceholder
11 | } from '../components/Placeholders'
12 |
13 | const LOADER_COLOR = {
14 | MEMPHIS: '#ffe5f1',
15 | CHECKS: '#babcc0',
16 | POLYGON: '#e5d8df',
17 | FRIEDER: '#ffd8ea',
18 | TRIANGLE: '#7f3457',
19 | WAVES: '#e6afc7',
20 | SOTTSASS: '#e6afc7',
21 | CIRCLES: '#ff7f7f'
22 | }
23 |
24 | // We are using suspense here to suspend rendering while the design gets resolved, in other words, suspend rendering while the designs are being computed.
25 | // Synchronously rendering all the designs is computationally heavy because it involves a lot of computational overhead, which includes applying operations such as translation, rotation and rendering the svg path
26 | // This solution is still far from perfect but atleast it doesn't degrade the UX by flashing all the computed design at once on each refresh
27 |
28 | const DEFAULT_DELAY = 1500
29 |
30 | const SLEEP_TIMEOUT = 1000
31 |
32 | const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
33 |
34 | const cache = createCache()
35 |
36 | const createDesignResource = createResource(
37 | () => sleep(SLEEP_TIMEOUT).then(() => import('./designs').then(mod => mod)),
38 | t => t
39 | )
40 | const createFractalResource = createResource(
41 | () =>
42 | sleep(SLEEP_TIMEOUT).then(() =>
43 | import('../../designs-core/src').then(mod => mod)
44 | ),
45 | t => t
46 | )
47 |
48 | const getDesignComponent = designName => props => {
49 | const designs = createDesignResource.read(cache, props)
50 | const Design = designs[designName]
51 |
52 | return
53 | }
54 |
55 | const withPlaceholder = (
56 | delay,
57 | fallbackComponent,
58 | DesignComponent
59 | ) => props => (
60 |
61 |
62 |
63 | )
64 |
65 | export const StarFractal = withPlaceholder(
66 | DEFAULT_DELAY,
67 | ChecksDesignPlaceholder('mistyrose'),
68 | props => {
69 | const Fractal = createFractalResource.read(cache, props)
70 |
71 | return (
72 |
73 |
74 |
75 | )
76 | }
77 | )
78 | export const ChecksDesign = withPlaceholder(
79 | DEFAULT_DELAY,
80 | ChecksDesignPlaceholder(LOADER_COLOR.CHECKS),
81 | getDesignComponent('ChecksDesign')
82 | )
83 | export const PolygonDesign = withPlaceholder(
84 | DEFAULT_DELAY,
85 | PolygonDesignPlaceholder(LOADER_COLOR.POLYGON),
86 | getDesignComponent('PolygonDesign')
87 | )
88 |
89 | export const WavyLines = withPlaceholder(
90 | DEFAULT_DELAY,
91 | WaveLinesDesignPlaceholder(LOADER_COLOR.WAVES),
92 | getDesignComponent('WaveLinesDesign')
93 | )
94 | export const Circles = withPlaceholder(
95 | DEFAULT_DELAY,
96 | ChecksDesignPlaceholder(LOADER_COLOR.CIRCLES),
97 | getDesignComponent('CirclesDesign')
98 | )
99 | export const DoublyTriangle = withPlaceholder(
100 | DEFAULT_DELAY,
101 | DTDesignPlaceholder(LOADER_COLOR.TRIANGLE),
102 | getDesignComponent('DoubleTriangleDesign')
103 | )
104 |
105 | export const SottsassPattern = withPlaceholder(
106 | DEFAULT_DELAY,
107 | SottsassDesignPlaceholder(LOADER_COLOR.SOTTSASS),
108 | getDesignComponent('SottsassDesign')
109 | )
110 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-dom-server.browser.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-dom-server.browser.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(t, w) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? (module.exports = w(require('react')))
13 | : 'function' === typeof define && define.amd
14 | ? define(['react'], w)
15 | : (t.ReactDOMServer = w(t.React))
16 | })(this, function(t) {
17 | function w(a, b, d, c, k, f, h, m) {
18 | if (!a) {
19 | a = void 0
20 | if (void 0 === b)
21 | a = Error(
22 | 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
23 | )
24 | else {
25 | var l = [d, c, k, f, h, m],
26 | p = 0
27 | a = Error(
28 | b.replace(/%s/g, function() {
29 | return l[p++]
30 | })
31 | )
32 | a.name = 'Invariant Violation'
33 | }
34 | a.framesToPop = 1
35 | throw a
36 | }
37 | }
38 | function u(a) {
39 | for (
40 | var b = arguments.length - 1,
41 | d = 'https://reactjs.org/docs/error-decoder.html?invariant=' + a,
42 | c = 0;
43 | c < b;
44 | c++
45 | )
46 | d += '&args[]=' + encodeURIComponent(arguments[c + 1])
47 | w(
48 | !1,
49 | 'Minified React error #' +
50 | a +
51 | '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ',
52 | d
53 | )
54 | }
55 | function H(a) {
56 | if (null == a) return null
57 | if ('function' === typeof a) return a.displayName || a.name || null
58 | if ('string' === typeof a) return a
59 | switch (a) {
60 | case I:
61 | return 'AsyncMode'
62 | case B:
63 | return 'Fragment'
64 | case J:
65 | return 'Portal'
66 | case K:
67 | return 'Profiler'
68 | case L:
69 | return 'StrictMode'
70 | case X:
71 | return 'Placeholder'
72 | }
73 | if ('object' === typeof a)
74 | switch (a.$$typeof) {
75 | case M:
76 | return 'Context.Consumer'
77 | case D:
78 | return 'Context.Provider'
79 | case N:
80 | return (
81 | (a = a.render),
82 | (a = a.displayName || a.name || ''),
83 | '' !== a ? 'ForwardRef(' + a + ')' : 'ForwardRef'
84 | )
85 | }
86 | return null
87 | }
88 | function Y(a) {
89 | if (O.hasOwnProperty(a)) return !0
90 | if (P.hasOwnProperty(a)) return !1
91 | if (Z.test(a)) return (O[a] = !0)
92 | P[a] = !0
93 | return !1
94 | }
95 | function aa(a, b, d, c) {
96 | if (null !== d && 0 === d.type) return !1
97 | switch (typeof b) {
98 | case 'function':
99 | case 'symbol':
100 | return !0
101 | case 'boolean':
102 | if (c) return !1
103 | if (null !== d) return !d.acceptsBooleans
104 | a = a.toLowerCase().slice(0, 5)
105 | return 'data-' !== a && 'aria-' !== a
106 | default:
107 | return !1
108 | }
109 | }
110 | function ba(a, b, d, c) {
111 | if (null === b || 'undefined' === typeof b || aa(a, b, d, c)) return !0
112 | if (c) return !1
113 | if (null !== d)
114 | switch (d.type) {
115 | case 3:
116 | return !b
117 | case 4:
118 | return !1 === b
119 | case 5:
120 | return isNaN(b)
121 | case 6:
122 | return isNaN(b) || 1 > b
123 | }
124 | return !1
125 | }
126 | function q(a, b, d, c, k) {
127 | this.acceptsBooleans = 2 === b || 3 === b || 4 === b
128 | this.attributeName = c
129 | this.attributeNamespace = k
130 | this.mustUseProperty = d
131 | this.propertyName = a
132 | this.type = b
133 | }
134 | function z(a) {
135 | if ('boolean' === typeof a || 'number' === typeof a) return '' + a
136 | a = '' + a
137 | var b = ca.exec(a)
138 | if (b) {
139 | var d = '',
140 | c,
141 | k = 0
142 | for (c = b.index; c < a.length; c++) {
143 | switch (a.charCodeAt(c)) {
144 | case 34:
145 | b = '"'
146 | break
147 | case 38:
148 | b = '&'
149 | break
150 | case 39:
151 | b = '''
152 | break
153 | case 60:
154 | b = '<'
155 | break
156 | case 62:
157 | b = '>'
158 | break
159 | default:
160 | continue
161 | }
162 | k !== c && (d += a.substring(k, c))
163 | k = c + 1
164 | d += b
165 | }
166 | a = k !== c ? d + a.substring(k, c) : d
167 | }
168 | return a
169 | }
170 | function Q(a) {
171 | switch (a) {
172 | case 'svg':
173 | return 'http://www.w3.org/2000/svg'
174 | case 'math':
175 | return 'http://www.w3.org/1998/Math/MathML'
176 | default:
177 | return 'http://www.w3.org/1999/xhtml'
178 | }
179 | }
180 | function da(a) {
181 | if (void 0 === a || null === a) return a
182 | var b = ''
183 | t.Children.forEach(a, function(a) {
184 | null == a || ('string' !== typeof a && 'number' !== typeof a) || (b += a)
185 | })
186 | return b
187 | }
188 | function ea(a, b) {
189 | if ((a = a.contextTypes)) {
190 | var d = {},
191 | c
192 | for (c in a) d[c] = b[c]
193 | b = d
194 | } else b = R
195 | return b
196 | }
197 | function S(a, b) {
198 | void 0 === a && u('152', H(b) || 'Component')
199 | }
200 | function fa(a, b) {
201 | function d(c, k) {
202 | var d = ea(k, b),
203 | f = [],
204 | h = !1,
205 | g = {
206 | isMounted: function(a) {
207 | return !1
208 | },
209 | enqueueForceUpdate: function(a) {
210 | if (null === f) return null
211 | },
212 | enqueueReplaceState: function(a, b) {
213 | h = !0
214 | f = [b]
215 | },
216 | enqueueSetState: function(a, b) {
217 | if (null === f) return null
218 | f.push(b)
219 | }
220 | },
221 | e = void 0
222 | if (k.prototype && k.prototype.isReactComponent) {
223 | if (
224 | ((e = new k(c.props, d, g)),
225 | 'function' === typeof k.getDerivedStateFromProps)
226 | ) {
227 | var l = k.getDerivedStateFromProps.call(null, c.props, e.state)
228 | null != l && (e.state = x({}, e.state, l))
229 | }
230 | } else if (((e = k(c.props, d, g)), null == e || null == e.render)) {
231 | a = e
232 | S(a, k)
233 | return
234 | }
235 | e.props = c.props
236 | e.context = d
237 | e.updater = g
238 | g = e.state
239 | void 0 === g && (e.state = g = null)
240 | if (
241 | 'function' === typeof e.UNSAFE_componentWillMount ||
242 | 'function' === typeof e.componentWillMount
243 | )
244 | if (
245 | ('function' === typeof e.componentWillMount &&
246 | 'function' !== typeof k.getDerivedStateFromProps &&
247 | e.componentWillMount(),
248 | 'function' === typeof e.UNSAFE_componentWillMount &&
249 | 'function' !== typeof k.getDerivedStateFromProps &&
250 | e.UNSAFE_componentWillMount(),
251 | f.length)
252 | ) {
253 | g = f
254 | var p = h
255 | f = null
256 | h = !1
257 | if (p && 1 === g.length) e.state = g[0]
258 | else {
259 | l = p ? g[0] : e.state
260 | var n = !0
261 | for (p = p ? 1 : 0; p < g.length; p++) {
262 | var r = g[p]
263 | r = 'function' === typeof r ? r.call(e, l, c.props, d) : r
264 | null != r && (n ? ((n = !1), (l = x({}, l, r))) : x(l, r))
265 | }
266 | e.state = l
267 | }
268 | } else f = null
269 | a = e.render()
270 | S(a, k)
271 | c = void 0
272 | if (
273 | 'function' === typeof e.getChildContext &&
274 | ((d = k.childContextTypes), 'object' === typeof d)
275 | ) {
276 | c = e.getChildContext()
277 | for (var q in c) q in d ? void 0 : u('108', H(k) || 'Unknown', q)
278 | }
279 | c && (b = x({}, b, c))
280 | }
281 | for (; t.isValidElement(a); ) {
282 | var c = a,
283 | k = c.type
284 | if ('function' !== typeof k) break
285 | d(c, k)
286 | }
287 | return { child: a, context: b }
288 | }
289 | var x = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,
290 | l = 'function' === typeof Symbol && Symbol.for,
291 | J = l ? Symbol.for('react.portal') : 60106,
292 | B = l ? Symbol.for('react.fragment') : 60107,
293 | L = l ? Symbol.for('react.strict_mode') : 60108,
294 | K = l ? Symbol.for('react.profiler') : 60114,
295 | D = l ? Symbol.for('react.provider') : 60109,
296 | M = l ? Symbol.for('react.context') : 60110,
297 | I = l ? Symbol.for('react.async_mode') : 60111,
298 | N = l ? Symbol.for('react.forward_ref') : 60112,
299 | X = l ? Symbol.for('react.placeholder') : 60113,
300 | Z = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,
301 | P = {},
302 | O = {},
303 | p = {}
304 | 'children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style'
305 | .split(' ')
306 | .forEach(function(a) {
307 | p[a] = new q(a, 0, !1, a, null)
308 | })
309 | ;[
310 | ['acceptCharset', 'accept-charset'],
311 | ['className', 'class'],
312 | ['htmlFor', 'for'],
313 | ['httpEquiv', 'http-equiv']
314 | ].forEach(function(a) {
315 | var b = a[0]
316 | p[b] = new q(b, 1, !1, a[1], null)
317 | })
318 | ;['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function(a) {
319 | p[a] = new q(a, 2, !1, a.toLowerCase(), null)
320 | })
321 | ;['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(
322 | function(a) {
323 | p[a] = new q(a, 2, !1, a, null)
324 | }
325 | )
326 | 'allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope'
327 | .split(' ')
328 | .forEach(function(a) {
329 | p[a] = new q(a, 3, !1, a.toLowerCase(), null)
330 | })
331 | ;['checked', 'multiple', 'muted', 'selected'].forEach(function(a) {
332 | p[a] = new q(a, 3, !0, a.toLowerCase(), null)
333 | })
334 | ;['capture', 'download'].forEach(function(a) {
335 | p[a] = new q(a, 4, !1, a.toLowerCase(), null)
336 | })
337 | ;['cols', 'rows', 'size', 'span'].forEach(function(a) {
338 | p[a] = new q(a, 6, !1, a.toLowerCase(), null)
339 | })
340 | ;['rowSpan', 'start'].forEach(function(a) {
341 | p[a] = new q(a, 5, !1, a.toLowerCase(), null)
342 | })
343 | var E = /[\-:]([a-z])/g,
344 | F = function(a) {
345 | return a[1].toUpperCase()
346 | }
347 | 'accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height'
348 | .split(' ')
349 | .forEach(function(a) {
350 | var b = a.replace(E, F)
351 | p[b] = new q(b, 1, !1, a, null)
352 | })
353 | 'xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type'
354 | .split(' ')
355 | .forEach(function(a) {
356 | var b = a.replace(E, F)
357 | p[b] = new q(b, 1, !1, a, 'http://www.w3.org/1999/xlink')
358 | })
359 | ;['xml:base', 'xml:lang', 'xml:space'].forEach(function(a) {
360 | var b = a.replace(E, F)
361 | p[b] = new q(b, 1, !1, a, 'http://www.w3.org/XML/1998/namespace')
362 | })
363 | p.tabIndex = new q('tabIndex', 1, !1, 'tabindex', null)
364 | var ca = /["'&<>]/,
365 | T = {
366 | area: !0,
367 | base: !0,
368 | br: !0,
369 | col: !0,
370 | embed: !0,
371 | hr: !0,
372 | img: !0,
373 | input: !0,
374 | keygen: !0,
375 | link: !0,
376 | meta: !0,
377 | param: !0,
378 | source: !0,
379 | track: !0,
380 | wbr: !0
381 | },
382 | ha = x({ menuitem: !0 }, T),
383 | C = {
384 | animationIterationCount: !0,
385 | borderImageOutset: !0,
386 | borderImageSlice: !0,
387 | borderImageWidth: !0,
388 | boxFlex: !0,
389 | boxFlexGroup: !0,
390 | boxOrdinalGroup: !0,
391 | columnCount: !0,
392 | columns: !0,
393 | flex: !0,
394 | flexGrow: !0,
395 | flexPositive: !0,
396 | flexShrink: !0,
397 | flexNegative: !0,
398 | flexOrder: !0,
399 | gridRow: !0,
400 | gridRowEnd: !0,
401 | gridRowSpan: !0,
402 | gridRowStart: !0,
403 | gridColumn: !0,
404 | gridColumnEnd: !0,
405 | gridColumnSpan: !0,
406 | gridColumnStart: !0,
407 | fontWeight: !0,
408 | lineClamp: !0,
409 | lineHeight: !0,
410 | opacity: !0,
411 | order: !0,
412 | orphans: !0,
413 | tabSize: !0,
414 | widows: !0,
415 | zIndex: !0,
416 | zoom: !0,
417 | fillOpacity: !0,
418 | floodOpacity: !0,
419 | stopOpacity: !0,
420 | strokeDasharray: !0,
421 | strokeDashoffset: !0,
422 | strokeMiterlimit: !0,
423 | strokeOpacity: !0,
424 | strokeWidth: !0
425 | },
426 | ia = ['Webkit', 'ms', 'Moz', 'O']
427 | Object.keys(C).forEach(function(a) {
428 | ia.forEach(function(b) {
429 | b = b + a.charAt(0).toUpperCase() + a.substring(1)
430 | C[b] = C[a]
431 | })
432 | })
433 | var ja = /([A-Z])/g,
434 | ka = /^ms-/,
435 | y = t.Children.toArray,
436 | la = { listing: !0, pre: !0, textarea: !0 },
437 | ma = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,
438 | U = {},
439 | G = {},
440 | R = {},
441 | na = {
442 | children: null,
443 | dangerouslySetInnerHTML: null,
444 | suppressContentEditableWarning: null,
445 | suppressHydrationWarning: null
446 | },
447 | V = (function() {
448 | function a(b, d) {
449 | if (!(this instanceof a))
450 | throw new TypeError('Cannot call a class as a function')
451 | t.isValidElement(b)
452 | ? b.type !== B
453 | ? (b = [b])
454 | : ((b = b.props.children), (b = t.isValidElement(b) ? [b] : y(b)))
455 | : (b = y(b))
456 | this.stack = [
457 | {
458 | type: null,
459 | domNamespace: 'http://www.w3.org/1999/xhtml',
460 | children: b,
461 | childIndex: 0,
462 | context: R,
463 | footer: ''
464 | }
465 | ]
466 | this.exhausted = !1
467 | this.currentSelectValue = null
468 | this.previousWasTextNode = !1
469 | this.makeStaticMarkup = d
470 | this.contextIndex = -1
471 | this.contextStack = []
472 | this.contextValueStack = []
473 | }
474 | a.prototype.pushProvider = function(a) {
475 | var b = ++this.contextIndex,
476 | c = a.type._context,
477 | k = c._currentValue
478 | this.contextStack[b] = c
479 | this.contextValueStack[b] = k
480 | c._currentValue = a.props.value
481 | }
482 | a.prototype.popProvider = function(a) {
483 | a = this.contextIndex
484 | var b = this.contextStack[a],
485 | c = this.contextValueStack[a]
486 | this.contextStack[a] = null
487 | this.contextValueStack[a] = null
488 | this.contextIndex--
489 | b._currentValue = c
490 | }
491 | a.prototype.read = function(a) {
492 | if (this.exhausted) return null
493 | for (var b = ''; b.length < a; ) {
494 | if (0 === this.stack.length) {
495 | this.exhausted = !0
496 | break
497 | }
498 | var c = this.stack[this.stack.length - 1]
499 | if (c.childIndex >= c.children.length) {
500 | var k = c.footer
501 | b += k
502 | '' !== k && (this.previousWasTextNode = !1)
503 | this.stack.pop()
504 | 'select' === c.type
505 | ? (this.currentSelectValue = null)
506 | : null != c.type &&
507 | null != c.type.type &&
508 | c.type.type.$$typeof === D &&
509 | this.popProvider(c.type)
510 | } else
511 | (k = c.children[c.childIndex++]),
512 | (b += this.render(k, c.context, c.domNamespace))
513 | }
514 | return b
515 | }
516 | a.prototype.render = function(a, d, c) {
517 | if ('string' === typeof a || 'number' === typeof a) {
518 | c = '' + a
519 | if ('' === c) return ''
520 | if (this.makeStaticMarkup) return z(c)
521 | if (this.previousWasTextNode) return '\x3c!-- --\x3e' + z(c)
522 | this.previousWasTextNode = !0
523 | return z(c)
524 | }
525 | d = fa(a, d)
526 | a = d.child
527 | d = d.context
528 | if (null === a || !1 === a) return ''
529 | if (!t.isValidElement(a)) {
530 | if (null != a && null != a.$$typeof) {
531 | var b = a.$$typeof
532 | b === J ? u('257') : void 0
533 | u('258', b.toString())
534 | }
535 | a = y(a)
536 | this.stack.push({
537 | type: null,
538 | domNamespace: c,
539 | children: a,
540 | childIndex: 0,
541 | context: d,
542 | footer: ''
543 | })
544 | return ''
545 | }
546 | b = a.type
547 | if ('string' === typeof b) return this.renderDOM(a, d, c)
548 | switch (b) {
549 | case L:
550 | case I:
551 | case K:
552 | case B:
553 | return (
554 | (a = y(a.props.children)),
555 | this.stack.push({
556 | type: null,
557 | domNamespace: c,
558 | children: a,
559 | childIndex: 0,
560 | context: d,
561 | footer: ''
562 | }),
563 | ''
564 | )
565 | }
566 | if ('object' === typeof b && null !== b)
567 | switch (b.$$typeof) {
568 | case N:
569 | return (
570 | (a = y(b.render(a.props, a.ref))),
571 | this.stack.push({
572 | type: null,
573 | domNamespace: c,
574 | children: a,
575 | childIndex: 0,
576 | context: d,
577 | footer: ''
578 | }),
579 | ''
580 | )
581 | case D:
582 | return (
583 | (b = y(a.props.children)),
584 | (c = {
585 | type: a,
586 | domNamespace: c,
587 | children: b,
588 | childIndex: 0,
589 | context: d,
590 | footer: ''
591 | }),
592 | this.pushProvider(a),
593 | this.stack.push(c),
594 | ''
595 | )
596 | case M:
597 | return (
598 | (b = y(a.props.children(a.type._currentValue))),
599 | this.stack.push({
600 | type: a,
601 | domNamespace: c,
602 | children: b,
603 | childIndex: 0,
604 | context: d,
605 | footer: ''
606 | }),
607 | ''
608 | )
609 | }
610 | u('130', null == b ? b : typeof b, '')
611 | }
612 | a.prototype.renderDOM = function(a, d, c) {
613 | var b = a.type.toLowerCase()
614 | 'http://www.w3.org/1999/xhtml' === c && Q(b)
615 | U.hasOwnProperty(b) || (ma.test(b) ? void 0 : u('65', b), (U[b] = !0))
616 | var f = a.props
617 | if ('input' === b)
618 | f = x({ type: void 0 }, f, {
619 | defaultChecked: void 0,
620 | defaultValue: void 0,
621 | value: null != f.value ? f.value : f.defaultValue,
622 | checked: null != f.checked ? f.checked : f.defaultChecked
623 | })
624 | else if ('textarea' === b) {
625 | var h = f.value
626 | if (null == h) {
627 | h = f.defaultValue
628 | var m = f.children
629 | null != m &&
630 | (null != h ? u('92') : void 0,
631 | Array.isArray(m) &&
632 | (1 >= m.length ? void 0 : u('93'), (m = m[0])),
633 | (h = '' + m))
634 | null == h && (h = '')
635 | }
636 | f = x({}, f, { value: void 0, children: '' + h })
637 | } else if ('select' === b)
638 | (this.currentSelectValue =
639 | null != f.value ? f.value : f.defaultValue),
640 | (f = x({}, f, { value: void 0 }))
641 | else if ('option' === b) {
642 | m = this.currentSelectValue
643 | var l = da(f.children)
644 | if (null != m) {
645 | var q = null != f.value ? f.value + '' : l
646 | h = !1
647 | if (Array.isArray(m))
648 | for (var g = 0; g < m.length; g++) {
649 | if ('' + m[g] === q) {
650 | h = !0
651 | break
652 | }
653 | }
654 | else h = '' + m === q
655 | f = x({ selected: void 0, children: void 0 }, f, {
656 | selected: h,
657 | children: l
658 | })
659 | }
660 | }
661 | if ((h = f))
662 | ha[b] &&
663 | (null != h.children || null != h.dangerouslySetInnerHTML
664 | ? u('137', b, '')
665 | : void 0),
666 | null != h.dangerouslySetInnerHTML &&
667 | (null != h.children ? u('60') : void 0,
668 | 'object' === typeof h.dangerouslySetInnerHTML &&
669 | '__html' in h.dangerouslySetInnerHTML
670 | ? void 0
671 | : u('61')),
672 | null != h.style && 'object' !== typeof h.style
673 | ? u('62', '')
674 | : void 0
675 | h = f
676 | m = this.makeStaticMarkup
677 | l = 1 === this.stack.length
678 | q = '<' + a.type
679 | for (v in h)
680 | if (h.hasOwnProperty(v)) {
681 | var e = h[v]
682 | if (null != e) {
683 | if ('style' === v) {
684 | g = void 0
685 | var t = '',
686 | w = ''
687 | for (g in e)
688 | if (e.hasOwnProperty(g)) {
689 | var n = 0 === g.indexOf('--'),
690 | r = e[g]
691 | if (null != r) {
692 | var A = g
693 | if (G.hasOwnProperty(A)) A = G[A]
694 | else {
695 | var B = A.replace(ja, '-$1')
696 | .toLowerCase()
697 | .replace(ka, '-ms-')
698 | A = G[A] = B
699 | }
700 | t += w + A + ':'
701 | w = g
702 | n =
703 | null == r || 'boolean' === typeof r || '' === r
704 | ? ''
705 | : n ||
706 | 'number' !== typeof r ||
707 | 0 === r ||
708 | (C.hasOwnProperty(w) && C[w])
709 | ? ('' + r).trim()
710 | : r + 'px'
711 | t += n
712 | w = ';'
713 | }
714 | }
715 | e = t || null
716 | }
717 | g = null
718 | b: if (((n = b), (r = h), -1 === n.indexOf('-')))
719 | n = 'string' === typeof r.is
720 | else
721 | switch (n) {
722 | case 'annotation-xml':
723 | case 'color-profile':
724 | case 'font-face':
725 | case 'font-face-src':
726 | case 'font-face-uri':
727 | case 'font-face-format':
728 | case 'font-face-name':
729 | case 'missing-glyph':
730 | n = !1
731 | break b
732 | default:
733 | n = !0
734 | }
735 | if (n)
736 | na.hasOwnProperty(v) ||
737 | ((g = v),
738 | (g = Y(g) && null != e ? g + '=' + ('"' + z(e) + '"') : ''))
739 | else {
740 | n = v
741 | g = e
742 | e = p.hasOwnProperty(n) ? p[n] : null
743 | if ((r = 'style' !== n))
744 | r =
745 | null !== e
746 | ? 0 === e.type
747 | : !(2 < n.length) ||
748 | ('o' !== n[0] && 'O' !== n[0]) ||
749 | ('n' !== n[1] && 'N' !== n[1])
750 | ? !1
751 | : !0
752 | r || ba(n, g, e, !1)
753 | ? (g = '')
754 | : null !== e
755 | ? ((n = e.attributeName),
756 | (e = e.type),
757 | (g =
758 | 3 === e || (4 === e && !0 === g)
759 | ? n + '=""'
760 | : n + '=' + ('"' + z(g) + '"')))
761 | : (g = n + '=' + ('"' + z(g) + '"'))
762 | }
763 | g && (q += ' ' + g)
764 | }
765 | }
766 | m || (l && (q += ' data-reactroot=""'))
767 | var v = q
768 | h = ''
769 | T.hasOwnProperty(b)
770 | ? (v += '/>')
771 | : ((v += '>'), (h = '' + a.type + '>'))
772 | a: {
773 | m = f.dangerouslySetInnerHTML
774 | if (null != m) {
775 | if (null != m.__html) {
776 | m = m.__html
777 | break a
778 | }
779 | } else if (
780 | ((m = f.children), 'string' === typeof m || 'number' === typeof m)
781 | ) {
782 | m = z(m)
783 | break a
784 | }
785 | m = null
786 | }
787 | null != m
788 | ? ((f = []), la[b] && '\n' === m.charAt(0) && (v += '\n'), (v += m))
789 | : (f = y(f.children))
790 | a = a.type
791 | c =
792 | null == c || 'http://www.w3.org/1999/xhtml' === c
793 | ? Q(a)
794 | : 'http://www.w3.org/2000/svg' === c && 'foreignObject' === a
795 | ? 'http://www.w3.org/1999/xhtml'
796 | : c
797 | this.stack.push({
798 | domNamespace: c,
799 | type: b,
800 | children: f,
801 | childIndex: 0,
802 | context: d,
803 | footer: h
804 | })
805 | this.previousWasTextNode = !1
806 | return v
807 | }
808 | return a
809 | })()
810 | l = {
811 | renderToString: function(a) {
812 | return new V(a, !1).read(Infinity)
813 | },
814 | renderToStaticMarkup: function(a) {
815 | return new V(a, !0).read(Infinity)
816 | },
817 | renderToNodeStream: function() {
818 | u('207')
819 | },
820 | renderToStaticNodeStream: function() {
821 | u('208')
822 | },
823 | version: '16.4.1'
824 | }
825 | var W = { default: l }
826 | l = (W && l) || W
827 | return l.default ? l.default : l
828 | })
829 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-dom-test-utils.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-dom-test-utils.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(k, n) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? (module.exports = n(require('react'), require('react-dom')))
13 | : 'function' === typeof define && define.amd
14 | ? define(['react', 'react-dom'], n)
15 | : (k.ReactTestUtils = n(k.React, k.ReactDOM))
16 | })(this, function(k, n) {
17 | function B(a, b, c, e, d, f, g, h) {
18 | if (!a) {
19 | a = void 0
20 | if (void 0 === b)
21 | a = Error(
22 | 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
23 | )
24 | else {
25 | var L = [c, e, d, f, g, h],
26 | k = 0
27 | a = Error(
28 | b.replace(/%s/g, function() {
29 | return L[k++]
30 | })
31 | )
32 | a.name = 'Invariant Violation'
33 | }
34 | a.framesToPop = 1
35 | throw a
36 | }
37 | }
38 | function m(a) {
39 | for (
40 | var b = arguments.length - 1,
41 | c = 'https://reactjs.org/docs/error-decoder.html?invariant=' + a,
42 | e = 0;
43 | e < b;
44 | e++
45 | )
46 | c += '&args[]=' + encodeURIComponent(arguments[e + 1])
47 | B(
48 | !1,
49 | 'Minified React error #' +
50 | a +
51 | '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ',
52 | c
53 | )
54 | }
55 | function C(a) {
56 | var b = a
57 | if (a.alternate) for (; b.return; ) b = b.return
58 | else {
59 | if (0 !== (b.effectTag & 2)) return 1
60 | for (; b.return; ) if (((b = b.return), 0 !== (b.effectTag & 2))) return 1
61 | }
62 | return 3 === b.tag ? 2 : 3
63 | }
64 | function D(a) {
65 | 2 !== C(a) ? m('188') : void 0
66 | }
67 | function M(a) {
68 | var b = a.alternate
69 | if (!b) return (b = C(a)), 3 === b ? m('188') : void 0, 1 === b ? null : a
70 | for (var c = a, e = b; ; ) {
71 | var d = c.return,
72 | f = d ? d.alternate : null
73 | if (!d || !f) break
74 | if (d.child === f.child) {
75 | for (var g = d.child; g; ) {
76 | if (g === c) return D(d), a
77 | if (g === e) return D(d), b
78 | g = g.sibling
79 | }
80 | m('188')
81 | }
82 | if (c.return !== e.return) (c = d), (e = f)
83 | else {
84 | g = !1
85 | for (var h = d.child; h; ) {
86 | if (h === c) {
87 | g = !0
88 | c = d
89 | e = f
90 | break
91 | }
92 | if (h === e) {
93 | g = !0
94 | e = d
95 | c = f
96 | break
97 | }
98 | h = h.sibling
99 | }
100 | if (!g) {
101 | for (h = f.child; h; ) {
102 | if (h === c) {
103 | g = !0
104 | c = f
105 | e = d
106 | break
107 | }
108 | if (h === e) {
109 | g = !0
110 | e = f
111 | c = d
112 | break
113 | }
114 | h = h.sibling
115 | }
116 | g ? void 0 : m('189')
117 | }
118 | }
119 | c.alternate !== e ? m('190') : void 0
120 | }
121 | 3 !== c.tag ? m('188') : void 0
122 | return c.stateNode.current === c ? a : b
123 | }
124 | function v() {
125 | return !0
126 | }
127 | function w() {
128 | return !1
129 | }
130 | function r(a, b, c, e) {
131 | this.dispatchConfig = a
132 | this._targetInst = b
133 | this.nativeEvent = c
134 | a = this.constructor.Interface
135 | for (var d in a)
136 | a.hasOwnProperty(d) &&
137 | ((b = a[d])
138 | ? (this[d] = b(c))
139 | : 'target' === d
140 | ? (this.target = e)
141 | : (this[d] = c[d]))
142 | this.isDefaultPrevented = (null != c.defaultPrevented
143 | ? c.defaultPrevented
144 | : !1 === c.returnValue)
145 | ? v
146 | : w
147 | this.isPropagationStopped = w
148 | return this
149 | }
150 | function N(a, b, c, e) {
151 | if (this.eventPool.length) {
152 | var d = this.eventPool.pop()
153 | this.call(d, a, b, c, e)
154 | return d
155 | }
156 | return new this(a, b, c, e)
157 | }
158 | function O(a) {
159 | a instanceof this
160 | ? void 0
161 | : B(
162 | !1,
163 | 'Trying to release an event instance into a pool of a different type.'
164 | )
165 | a.destructor()
166 | 10 > this.eventPool.length && this.eventPool.push(a)
167 | }
168 | function E(a) {
169 | a.eventPool = []
170 | a.getPooled = N
171 | a.release = O
172 | }
173 | function x(a, b) {
174 | var c = {}
175 | c[a.toLowerCase()] = b.toLowerCase()
176 | c['Webkit' + a] = 'webkit' + b
177 | c['Moz' + a] = 'moz' + b
178 | return c
179 | }
180 | function y(a) {
181 | if (z[a]) return z[a]
182 | if (!p[a]) return a
183 | var b = p[a],
184 | c
185 | for (c in b) if (b.hasOwnProperty(c) && c in F) return (z[a] = b[c])
186 | return a
187 | }
188 | function G(a) {}
189 | function P(a, b) {
190 | if (!a) return []
191 | a = M(a)
192 | if (!a) return []
193 | for (var c = a, e = []; ; ) {
194 | if (5 === c.tag || 6 === c.tag || 2 === c.tag || 1 === c.tag) {
195 | var d = c.stateNode
196 | b(d) && e.push(d)
197 | }
198 | if (c.child) (c.child.return = c), (c = c.child)
199 | else {
200 | if (c === a) return e
201 | for (; !c.sibling; ) {
202 | if (!c.return || c.return === a) return e
203 | c = c.return
204 | }
205 | c.sibling.return = c.return
206 | c = c.sibling
207 | }
208 | }
209 | }
210 | function Q(a) {
211 | return function(b, c) {
212 | k.isValidElement(b) ? m('228') : void 0
213 | f.isCompositeComponent(b) ? m('229') : void 0
214 | var e = H.eventNameDispatchConfigs[a],
215 | d = new G()
216 | d.target = b
217 | d.type = a.toLowerCase()
218 | var l = R.getInstanceFromNode(b),
219 | g = new r(e, l, d, b)
220 | g.persist()
221 | t(g, c)
222 | e.phasedRegistrationNames
223 | ? I.accumulateTwoPhaseDispatches(g)
224 | : I.accumulateDirectDispatches(g)
225 | n.unstable_batchedUpdates(function() {
226 | J.enqueueStateRestore(b)
227 | u.runEventsInBatch(g, !0)
228 | })
229 | J.restoreStateIfNeeded()
230 | }
231 | }
232 | function A() {
233 | f.Simulate = {}
234 | var a = void 0
235 | for (a in H.eventNameDispatchConfigs) f.Simulate[a] = Q(a)
236 | }
237 | function S(a, b) {
238 | return function(c, e) {
239 | var d = new G(a)
240 | t(d, e)
241 | f.isDOMComponent(c)
242 | ? ((c = T(c)), (d.target = c), K.dispatchEvent(b, d))
243 | : c.tagName && ((d.target = c), K.dispatchEvent(b, d))
244 | }
245 | }
246 | var t = k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign
247 | t(r.prototype, {
248 | preventDefault: function() {
249 | this.defaultPrevented = !0
250 | var a = this.nativeEvent
251 | a &&
252 | (a.preventDefault
253 | ? a.preventDefault()
254 | : 'unknown' !== typeof a.returnValue && (a.returnValue = !1),
255 | (this.isDefaultPrevented = v))
256 | },
257 | stopPropagation: function() {
258 | var a = this.nativeEvent
259 | a &&
260 | (a.stopPropagation
261 | ? a.stopPropagation()
262 | : 'unknown' !== typeof a.cancelBubble && (a.cancelBubble = !0),
263 | (this.isPropagationStopped = v))
264 | },
265 | persist: function() {
266 | this.isPersistent = v
267 | },
268 | isPersistent: w,
269 | destructor: function() {
270 | var a = this.constructor.Interface,
271 | b
272 | for (b in a) this[b] = null
273 | this.nativeEvent = this._targetInst = this.dispatchConfig = null
274 | this.isPropagationStopped = this.isDefaultPrevented = w
275 | this._dispatchInstances = this._dispatchListeners = null
276 | }
277 | })
278 | r.Interface = {
279 | type: null,
280 | target: null,
281 | currentTarget: function() {
282 | return null
283 | },
284 | eventPhase: null,
285 | bubbles: null,
286 | cancelable: null,
287 | timeStamp: function(a) {
288 | return a.timeStamp || Date.now()
289 | },
290 | defaultPrevented: null,
291 | isTrusted: null
292 | }
293 | r.extend = function(a) {
294 | function b() {
295 | return c.apply(this, arguments)
296 | }
297 | var c = this,
298 | e = function() {}
299 | e.prototype = c.prototype
300 | e = new e()
301 | t(e, b.prototype)
302 | b.prototype = e
303 | b.prototype.constructor = b
304 | b.Interface = t({}, c.Interface, a)
305 | b.extend = c.extend
306 | E(b)
307 | return b
308 | }
309 | E(r)
310 | var l = !(
311 | 'undefined' === typeof window ||
312 | !window.document ||
313 | !window.document.createElement
314 | ),
315 | p = {
316 | animationend: x('Animation', 'AnimationEnd'),
317 | animationiteration: x('Animation', 'AnimationIteration'),
318 | animationstart: x('Animation', 'AnimationStart'),
319 | transitionend: x('Transition', 'TransitionEnd')
320 | },
321 | z = {},
322 | F = {}
323 | l &&
324 | ((F = document.createElement('div').style),
325 | 'AnimationEvent' in window ||
326 | (delete p.animationend.animation,
327 | delete p.animationiteration.animation,
328 | delete p.animationstart.animation),
329 | 'TransitionEvent' in window || delete p.transitionend.transition)
330 | l = y('animationend')
331 | var U = y('animationiteration'),
332 | V = y('animationstart'),
333 | W = y('transitionend'),
334 | T = n.findDOMNode,
335 | q = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
336 | u = q.EventPluginHub,
337 | H = q.EventPluginRegistry,
338 | I = q.EventPropagators,
339 | J = q.ReactControlledComponent,
340 | R = q.ReactDOMComponentTree,
341 | K = q.ReactDOMEventListener,
342 | f = {
343 | renderIntoDocument: function(a) {
344 | var b = document.createElement('div')
345 | return n.render(a, b)
346 | },
347 | isElement: function(a) {
348 | return k.isValidElement(a)
349 | },
350 | isElementOfType: function(a, b) {
351 | return k.isValidElement(a) && a.type === b
352 | },
353 | isDOMComponent: function(a) {
354 | return !(!a || 1 !== a.nodeType || !a.tagName)
355 | },
356 | isDOMComponentElement: function(a) {
357 | return !!(a && k.isValidElement(a) && a.tagName)
358 | },
359 | isCompositeComponent: function(a) {
360 | return f.isDOMComponent(a)
361 | ? !1
362 | : null != a &&
363 | 'function' === typeof a.render &&
364 | 'function' === typeof a.setState
365 | },
366 | isCompositeComponentWithType: function(a, b) {
367 | return f.isCompositeComponent(a) ? a._reactInternalFiber.type === b : !1
368 | },
369 | findAllInRenderedTree: function(a, b) {
370 | if (!a) return []
371 | f.isCompositeComponent(a) ? void 0 : m('10')
372 | return P(a._reactInternalFiber, b)
373 | },
374 | scryRenderedDOMComponentsWithClass: function(a, b) {
375 | return f.findAllInRenderedTree(a, function(a) {
376 | if (f.isDOMComponent(a)) {
377 | var c = a.className
378 | 'string' !== typeof c && (c = a.getAttribute('class') || '')
379 | var d = c.split(/\s+/)
380 | Array.isArray(b) ||
381 | (void 0 === b ? m('11') : void 0, (b = b.split(/\s+/)))
382 | return b.every(function(a) {
383 | return -1 !== d.indexOf(a)
384 | })
385 | }
386 | return !1
387 | })
388 | },
389 | findRenderedDOMComponentWithClass: function(a, b) {
390 | a = f.scryRenderedDOMComponentsWithClass(a, b)
391 | if (1 !== a.length)
392 | throw Error(
393 | 'Did not find exactly one match (found: ' +
394 | a.length +
395 | ') for class:' +
396 | b
397 | )
398 | return a[0]
399 | },
400 | scryRenderedDOMComponentsWithTag: function(a, b) {
401 | return f.findAllInRenderedTree(a, function(a) {
402 | return (
403 | f.isDOMComponent(a) && a.tagName.toUpperCase() === b.toUpperCase()
404 | )
405 | })
406 | },
407 | findRenderedDOMComponentWithTag: function(a, b) {
408 | a = f.scryRenderedDOMComponentsWithTag(a, b)
409 | if (1 !== a.length)
410 | throw Error(
411 | 'Did not find exactly one match (found: ' +
412 | a.length +
413 | ') for tag:' +
414 | b
415 | )
416 | return a[0]
417 | },
418 | scryRenderedComponentsWithType: function(a, b) {
419 | return f.findAllInRenderedTree(a, function(a) {
420 | return f.isCompositeComponentWithType(a, b)
421 | })
422 | },
423 | findRenderedComponentWithType: function(a, b) {
424 | a = f.scryRenderedComponentsWithType(a, b)
425 | if (1 !== a.length)
426 | throw Error(
427 | 'Did not find exactly one match (found: ' +
428 | a.length +
429 | ') for componentType:' +
430 | b
431 | )
432 | return a[0]
433 | },
434 | mockComponent: function(a, b) {
435 | b = b || a.mockTagName || 'div'
436 | a.prototype.render.mockImplementation(function() {
437 | return k.createElement(b, null, this.props.children)
438 | })
439 | return this
440 | },
441 | nativeTouchData: function(a, b) {
442 | return { touches: [{ pageX: a, pageY: b }] }
443 | },
444 | Simulate: null,
445 | SimulateNative: {}
446 | },
447 | X = u.injection.injectEventPluginOrder
448 | u.injection.injectEventPluginOrder = function() {
449 | X.apply(this, arguments)
450 | A()
451 | }
452 | var Y = u.injection.injectEventPluginsByName
453 | u.injection.injectEventPluginsByName = function() {
454 | Y.apply(this, arguments)
455 | A()
456 | }
457 | A()
458 | ;[
459 | ['abort', 'abort'],
460 | [l, 'animationEnd'],
461 | [U, 'animationIteration'],
462 | [V, 'animationStart'],
463 | ['blur', 'blur'],
464 | ['canplaythrough', 'canPlayThrough'],
465 | ['canplay', 'canPlay'],
466 | ['cancel', 'cancel'],
467 | ['change', 'change'],
468 | ['click', 'click'],
469 | ['close', 'close'],
470 | ['compositionend', 'compositionEnd'],
471 | ['compositionstart', 'compositionStart'],
472 | ['compositionupdate', 'compositionUpdate'],
473 | ['contextmenu', 'contextMenu'],
474 | ['copy', 'copy'],
475 | ['cut', 'cut'],
476 | ['dblclick', 'doubleClick'],
477 | ['dragend', 'dragEnd'],
478 | ['dragenter', 'dragEnter'],
479 | ['dragexit', 'dragExit'],
480 | ['dragleave', 'dragLeave'],
481 | ['dragover', 'dragOver'],
482 | ['dragstart', 'dragStart'],
483 | ['drag', 'drag'],
484 | ['drop', 'drop'],
485 | ['durationchange', 'durationChange'],
486 | ['emptied', 'emptied'],
487 | ['encrypted', 'encrypted'],
488 | ['ended', 'ended'],
489 | ['error', 'error'],
490 | ['focus', 'focus'],
491 | ['input', 'input'],
492 | ['keydown', 'keyDown'],
493 | ['keypress', 'keyPress'],
494 | ['keyup', 'keyUp'],
495 | ['loadstart', 'loadStart'],
496 | ['loadstart', 'loadStart'],
497 | ['load', 'load'],
498 | ['loadeddata', 'loadedData'],
499 | ['loadedmetadata', 'loadedMetadata'],
500 | ['mousedown', 'mouseDown'],
501 | ['mousemove', 'mouseMove'],
502 | ['mouseout', 'mouseOut'],
503 | ['mouseover', 'mouseOver'],
504 | ['mouseup', 'mouseUp'],
505 | ['paste', 'paste'],
506 | ['pause', 'pause'],
507 | ['play', 'play'],
508 | ['playing', 'playing'],
509 | ['progress', 'progress'],
510 | ['ratechange', 'rateChange'],
511 | ['scroll', 'scroll'],
512 | ['seeked', 'seeked'],
513 | ['seeking', 'seeking'],
514 | ['selectionchange', 'selectionChange'],
515 | ['stalled', 'stalled'],
516 | ['suspend', 'suspend'],
517 | ['textInput', 'textInput'],
518 | ['timeupdate', 'timeUpdate'],
519 | ['toggle', 'toggle'],
520 | ['touchcancel', 'touchCancel'],
521 | ['touchend', 'touchEnd'],
522 | ['touchmove', 'touchMove'],
523 | ['touchstart', 'touchStart'],
524 | [W, 'transitionEnd'],
525 | ['volumechange', 'volumeChange'],
526 | ['waiting', 'waiting'],
527 | ['wheel', 'wheel']
528 | ].forEach(function(a) {
529 | var b = a[1]
530 | f.SimulateNative[b] = S(b, a[0])
531 | })
532 | l = ((l = { default: f }), f) || l
533 | return l.default ? l.default : l
534 | })
535 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-dom-unstable-native-dependencies.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-dom-unstable-native-dependencies.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(x, n) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? (module.exports = n(require('react-dom'), require('react')))
13 | : 'function' === typeof define && define.amd
14 | ? define(['react-dom', 'react'], n)
15 | : (x.ReactDOMUnstableNativeDependencies = n(x.ReactDOM, x.React))
16 | })(this, function(x, n) {
17 | function M(a, b, c, f, e, d, g, h) {
18 | if (!a) {
19 | a = void 0
20 | if (void 0 === b)
21 | a = Error(
22 | 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
23 | )
24 | else {
25 | var k = [c, f, e, d, g, h],
26 | m = 0
27 | a = Error(
28 | b.replace(/%s/g, function() {
29 | return k[m++]
30 | })
31 | )
32 | a.name = 'Invariant Violation'
33 | }
34 | a.framesToPop = 1
35 | throw a
36 | }
37 | }
38 | function y(a) {
39 | for (
40 | var b = arguments.length - 1,
41 | c = 'https://reactjs.org/docs/error-decoder.html?invariant=' + a,
42 | f = 0;
43 | f < b;
44 | f++
45 | )
46 | c += '&args[]=' + encodeURIComponent(arguments[f + 1])
47 | M(
48 | !1,
49 | 'Minified React error #' +
50 | a +
51 | '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ',
52 | c
53 | )
54 | }
55 | function N(a) {
56 | var b = a._dispatchListeners,
57 | c = a._dispatchInstances
58 | Array.isArray(b) ? y('103') : void 0
59 | a.currentTarget = b ? O(c) : null
60 | b = b ? b(a) : null
61 | a.currentTarget = null
62 | a._dispatchListeners = null
63 | a._dispatchInstances = null
64 | return b
65 | }
66 | function r(a) {
67 | do a = a.return
68 | while (a && 5 !== a.tag)
69 | return a ? a : null
70 | }
71 | function P(a, b, c) {
72 | for (var f = []; a; ) f.push(a), (a = r(a))
73 | for (a = f.length; 0 < a--; ) b(f[a], 'captured', c)
74 | for (a = 0; a < f.length; a++) b(f[a], 'bubbled', c)
75 | }
76 | function C(a, b) {
77 | null == b ? y('30') : void 0
78 | if (null == a) return b
79 | if (Array.isArray(a)) {
80 | if (Array.isArray(b)) return a.push.apply(a, b), a
81 | a.push(b)
82 | return a
83 | }
84 | return Array.isArray(b) ? [a].concat(b) : [a, b]
85 | }
86 | function u(a, b, c) {
87 | Array.isArray(a) ? a.forEach(b, c) : a && b.call(c, a)
88 | }
89 | function Q(a, b) {
90 | var c = a.stateNode
91 | if (!c) return null
92 | var f = R(c)
93 | if (!f) return null
94 | c = f[b]
95 | a: switch (b) {
96 | case 'onClick':
97 | case 'onClickCapture':
98 | case 'onDoubleClick':
99 | case 'onDoubleClickCapture':
100 | case 'onMouseDown':
101 | case 'onMouseDownCapture':
102 | case 'onMouseMove':
103 | case 'onMouseMoveCapture':
104 | case 'onMouseUp':
105 | case 'onMouseUpCapture':
106 | ;(f = !f.disabled) ||
107 | ((a = a.type),
108 | (f = !(
109 | 'button' === a ||
110 | 'input' === a ||
111 | 'select' === a ||
112 | 'textarea' === a
113 | )))
114 | a = !f
115 | break a
116 | default:
117 | a = !1
118 | }
119 | if (a) return null
120 | c && 'function' !== typeof c ? y('231', b, typeof c) : void 0
121 | return c
122 | }
123 | function S(a, b, c) {
124 | if ((b = Q(a, c.dispatchConfig.phasedRegistrationNames[b])))
125 | (c._dispatchListeners = C(c._dispatchListeners, b)),
126 | (c._dispatchInstances = C(c._dispatchInstances, a))
127 | }
128 | function Z(a) {
129 | a && a.dispatchConfig.phasedRegistrationNames && P(a._targetInst, S, a)
130 | }
131 | function aa(a) {
132 | if (a && a.dispatchConfig.phasedRegistrationNames) {
133 | var b = a._targetInst
134 | b = b ? r(b) : null
135 | P(b, S, a)
136 | }
137 | }
138 | function w(a) {
139 | if (a && a.dispatchConfig.registrationName) {
140 | var b = a._targetInst
141 | if (b && a && a.dispatchConfig.registrationName) {
142 | var c = Q(b, a.dispatchConfig.registrationName)
143 | c &&
144 | ((a._dispatchListeners = C(a._dispatchListeners, c)),
145 | (a._dispatchInstances = C(a._dispatchInstances, b)))
146 | }
147 | }
148 | }
149 | function D() {
150 | return !0
151 | }
152 | function E() {
153 | return !1
154 | }
155 | function z(a, b, c, f) {
156 | this.dispatchConfig = a
157 | this._targetInst = b
158 | this.nativeEvent = c
159 | a = this.constructor.Interface
160 | for (var e in a)
161 | a.hasOwnProperty(e) &&
162 | ((b = a[e])
163 | ? (this[e] = b(c))
164 | : 'target' === e
165 | ? (this.target = f)
166 | : (this[e] = c[e]))
167 | this.isDefaultPrevented = (null != c.defaultPrevented
168 | ? c.defaultPrevented
169 | : !1 === c.returnValue)
170 | ? D
171 | : E
172 | this.isPropagationStopped = E
173 | return this
174 | }
175 | function ba(a, b, c, f) {
176 | if (this.eventPool.length) {
177 | var e = this.eventPool.pop()
178 | this.call(e, a, b, c, f)
179 | return e
180 | }
181 | return new this(a, b, c, f)
182 | }
183 | function ca(a) {
184 | a instanceof this
185 | ? void 0
186 | : M(
187 | !1,
188 | 'Trying to release an event instance into a pool of a different type.'
189 | )
190 | a.destructor()
191 | 10 > this.eventPool.length && this.eventPool.push(a)
192 | }
193 | function T(a) {
194 | a.eventPool = []
195 | a.getPooled = ba
196 | a.release = ca
197 | }
198 | function A(a) {
199 | return 'touchstart' === a || 'mousedown' === a
200 | }
201 | function F(a) {
202 | return 'touchmove' === a || 'mousemove' === a
203 | }
204 | function G(a) {
205 | return 'touchend' === a || 'touchcancel' === a || 'mouseup' === a
206 | }
207 | function l(a) {
208 | return a.timeStamp || a.timestamp
209 | }
210 | function J(a) {
211 | a = a.identifier
212 | null == a ? y('138') : void 0
213 | return a
214 | }
215 | function da(a) {
216 | var b = J(a),
217 | c = p[b]
218 | c
219 | ? ((c.touchActive = !0),
220 | (c.startPageX = a.pageX),
221 | (c.startPageY = a.pageY),
222 | (c.startTimeStamp = l(a)),
223 | (c.currentPageX = a.pageX),
224 | (c.currentPageY = a.pageY),
225 | (c.currentTimeStamp = l(a)),
226 | (c.previousPageX = a.pageX),
227 | (c.previousPageY = a.pageY),
228 | (c.previousTimeStamp = l(a)))
229 | : ((c = {
230 | touchActive: !0,
231 | startPageX: a.pageX,
232 | startPageY: a.pageY,
233 | startTimeStamp: l(a),
234 | currentPageX: a.pageX,
235 | currentPageY: a.pageY,
236 | currentTimeStamp: l(a),
237 | previousPageX: a.pageX,
238 | previousPageY: a.pageY,
239 | previousTimeStamp: l(a)
240 | }),
241 | (p[b] = c))
242 | q.mostRecentTimeStamp = l(a)
243 | }
244 | function ea(a) {
245 | var b = p[J(a)]
246 | b
247 | ? ((b.touchActive = !0),
248 | (b.previousPageX = b.currentPageX),
249 | (b.previousPageY = b.currentPageY),
250 | (b.previousTimeStamp = b.currentTimeStamp),
251 | (b.currentPageX = a.pageX),
252 | (b.currentPageY = a.pageY),
253 | (b.currentTimeStamp = l(a)),
254 | (q.mostRecentTimeStamp = l(a)))
255 | : console.error(
256 | 'Cannot record touch move without a touch start.\nTouch Move: %s\n',
257 | 'Touch Bank: %s',
258 | U(a),
259 | V()
260 | )
261 | }
262 | function fa(a) {
263 | var b = p[J(a)]
264 | b
265 | ? ((b.touchActive = !1),
266 | (b.previousPageX = b.currentPageX),
267 | (b.previousPageY = b.currentPageY),
268 | (b.previousTimeStamp = b.currentTimeStamp),
269 | (b.currentPageX = a.pageX),
270 | (b.currentPageY = a.pageY),
271 | (b.currentTimeStamp = l(a)),
272 | (q.mostRecentTimeStamp = l(a)))
273 | : console.error(
274 | 'Cannot record touch end without a touch start.\nTouch End: %s\n',
275 | 'Touch Bank: %s',
276 | U(a),
277 | V()
278 | )
279 | }
280 | function U(a) {
281 | return JSON.stringify({
282 | identifier: a.identifier,
283 | pageX: a.pageX,
284 | pageY: a.pageY,
285 | timestamp: l(a)
286 | })
287 | }
288 | function V() {
289 | var a = JSON.stringify(p.slice(0, 20))
290 | 20 < p.length && (a += ' (original size: ' + p.length + ')')
291 | return a
292 | }
293 | function B(a, b) {
294 | null == b ? y('29') : void 0
295 | return null == a
296 | ? b
297 | : Array.isArray(a)
298 | ? a.concat(b)
299 | : Array.isArray(b)
300 | ? [a].concat(b)
301 | : [a, b]
302 | }
303 | var R = null,
304 | W = null,
305 | O = null,
306 | K = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign
307 | K(z.prototype, {
308 | preventDefault: function() {
309 | this.defaultPrevented = !0
310 | var a = this.nativeEvent
311 | a &&
312 | (a.preventDefault
313 | ? a.preventDefault()
314 | : 'unknown' !== typeof a.returnValue && (a.returnValue = !1),
315 | (this.isDefaultPrevented = D))
316 | },
317 | stopPropagation: function() {
318 | var a = this.nativeEvent
319 | a &&
320 | (a.stopPropagation
321 | ? a.stopPropagation()
322 | : 'unknown' !== typeof a.cancelBubble && (a.cancelBubble = !0),
323 | (this.isPropagationStopped = D))
324 | },
325 | persist: function() {
326 | this.isPersistent = D
327 | },
328 | isPersistent: E,
329 | destructor: function() {
330 | var a = this.constructor.Interface,
331 | b
332 | for (b in a) this[b] = null
333 | this.nativeEvent = this._targetInst = this.dispatchConfig = null
334 | this.isPropagationStopped = this.isDefaultPrevented = E
335 | this._dispatchInstances = this._dispatchListeners = null
336 | }
337 | })
338 | z.Interface = {
339 | type: null,
340 | target: null,
341 | currentTarget: function() {
342 | return null
343 | },
344 | eventPhase: null,
345 | bubbles: null,
346 | cancelable: null,
347 | timeStamp: function(a) {
348 | return a.timeStamp || Date.now()
349 | },
350 | defaultPrevented: null,
351 | isTrusted: null
352 | }
353 | z.extend = function(a) {
354 | function b() {
355 | return c.apply(this, arguments)
356 | }
357 | var c = this,
358 | f = function() {}
359 | f.prototype = c.prototype
360 | f = new f()
361 | K(f, b.prototype)
362 | b.prototype = f
363 | b.prototype.constructor = b
364 | b.Interface = K({}, c.Interface, a)
365 | b.extend = c.extend
366 | T(b)
367 | return b
368 | }
369 | T(z)
370 | var v = z.extend({
371 | touchHistory: function(a) {
372 | return null
373 | }
374 | })
375 | n = ['touchstart', 'mousedown']
376 | var X = ['touchmove', 'mousemove'],
377 | Y = ['touchcancel', 'touchend', 'mouseup'],
378 | p = [],
379 | q = {
380 | touchBank: p,
381 | numberActiveTouches: 0,
382 | indexOfSingleActiveTouch: -1,
383 | mostRecentTimeStamp: 0
384 | },
385 | t = {
386 | recordTouchTrack: function(a, b) {
387 | if (F(a)) b.changedTouches.forEach(ea)
388 | else if (A(a))
389 | b.changedTouches.forEach(da),
390 | (q.numberActiveTouches = b.touches.length),
391 | 1 === q.numberActiveTouches &&
392 | (q.indexOfSingleActiveTouch = b.touches[0].identifier)
393 | else if (
394 | G(a) &&
395 | (b.changedTouches.forEach(fa),
396 | (q.numberActiveTouches = b.touches.length),
397 | 1 === q.numberActiveTouches)
398 | )
399 | for (a = 0; a < p.length; a++)
400 | if (((b = p[a]), null != b && b.touchActive)) {
401 | q.indexOfSingleActiveTouch = a
402 | break
403 | }
404 | },
405 | touchHistory: q
406 | },
407 | k = null,
408 | H = 0,
409 | L = function(a, b) {
410 | var c = k
411 | k = a
412 | if (null !== I.GlobalResponderHandler)
413 | I.GlobalResponderHandler.onChange(c, a, b)
414 | },
415 | m = {
416 | startShouldSetResponder: {
417 | phasedRegistrationNames: {
418 | bubbled: 'onStartShouldSetResponder',
419 | captured: 'onStartShouldSetResponderCapture'
420 | },
421 | dependencies: n
422 | },
423 | scrollShouldSetResponder: {
424 | phasedRegistrationNames: {
425 | bubbled: 'onScrollShouldSetResponder',
426 | captured: 'onScrollShouldSetResponderCapture'
427 | },
428 | dependencies: ['scroll']
429 | },
430 | selectionChangeShouldSetResponder: {
431 | phasedRegistrationNames: {
432 | bubbled: 'onSelectionChangeShouldSetResponder',
433 | captured: 'onSelectionChangeShouldSetResponderCapture'
434 | },
435 | dependencies: ['selectionchange']
436 | },
437 | moveShouldSetResponder: {
438 | phasedRegistrationNames: {
439 | bubbled: 'onMoveShouldSetResponder',
440 | captured: 'onMoveShouldSetResponderCapture'
441 | },
442 | dependencies: X
443 | },
444 | responderStart: { registrationName: 'onResponderStart', dependencies: n },
445 | responderMove: { registrationName: 'onResponderMove', dependencies: X },
446 | responderEnd: {
447 | registrationName: 'onResponderEnd',
448 | dependencies: Y
449 | },
450 | responderRelease: {
451 | registrationName: 'onResponderRelease',
452 | dependencies: Y
453 | },
454 | responderTerminationRequest: {
455 | registrationName: 'onResponderTerminationRequest',
456 | dependencies: []
457 | },
458 | responderGrant: {
459 | registrationName: 'onResponderGrant',
460 | dependencies: []
461 | },
462 | responderReject: {
463 | registrationName: 'onResponderReject',
464 | dependencies: []
465 | },
466 | responderTerminate: {
467 | registrationName: 'onResponderTerminate',
468 | dependencies: []
469 | }
470 | },
471 | I = {
472 | _getResponder: function() {
473 | return k
474 | },
475 | eventTypes: m,
476 | extractEvents: function(a, b, c, f) {
477 | if (A(a)) H += 1
478 | else if (G(a))
479 | if (0 <= H) --H
480 | else
481 | return (
482 | console.error(
483 | 'Ended a touch event which was not counted in `trackedTouchCount`.'
484 | ),
485 | null
486 | )
487 | t.recordTouchTrack(a, c)
488 | if (
489 | b &&
490 | (('scroll' === a && !c.responderIgnoreScroll) ||
491 | (0 < H && 'selectionchange' === a) ||
492 | A(a) ||
493 | F(a))
494 | ) {
495 | var e = A(a)
496 | ? m.startShouldSetResponder
497 | : F(a)
498 | ? m.moveShouldSetResponder
499 | : 'selectionchange' === a
500 | ? m.selectionChangeShouldSetResponder
501 | : m.scrollShouldSetResponder
502 | if (k)
503 | b: {
504 | var d = k
505 | for (var g = 0, h = d; h; h = r(h)) g++
506 | h = 0
507 | for (var l = b; l; l = r(l)) h++
508 | for (; 0 < g - h; ) (d = r(d)), g--
509 | for (; 0 < h - g; ) (b = r(b)), h--
510 | for (; g--; ) {
511 | if (d === b || d === b.alternate) break b
512 | d = r(d)
513 | b = r(b)
514 | }
515 | d = null
516 | }
517 | else d = b
518 | b = d === k
519 | d = v.getPooled(e, d, c, f)
520 | d.touchHistory = t.touchHistory
521 | b ? u(d, aa) : u(d, Z)
522 | b: {
523 | e = d._dispatchListeners
524 | b = d._dispatchInstances
525 | if (Array.isArray(e))
526 | for (g = 0; g < e.length && !d.isPropagationStopped(); g++) {
527 | if (e[g](d, b[g])) {
528 | e = b[g]
529 | break b
530 | }
531 | }
532 | else if (e && e(d, b)) {
533 | e = b
534 | break b
535 | }
536 | e = null
537 | }
538 | d._dispatchInstances = null
539 | d._dispatchListeners = null
540 | d.isPersistent() || d.constructor.release(d)
541 | e && e !== k
542 | ? ((d = void 0),
543 | (b = v.getPooled(m.responderGrant, e, c, f)),
544 | (b.touchHistory = t.touchHistory),
545 | u(b, w),
546 | (g = !0 === N(b)),
547 | k
548 | ? ((h = v.getPooled(m.responderTerminationRequest, k, c, f)),
549 | (h.touchHistory = t.touchHistory),
550 | u(h, w),
551 | (l = !h._dispatchListeners || N(h)),
552 | h.isPersistent() || h.constructor.release(h),
553 | l
554 | ? ((h = v.getPooled(m.responderTerminate, k, c, f)),
555 | (h.touchHistory = t.touchHistory),
556 | u(h, w),
557 | (d = B(d, [b, h])),
558 | L(e, g))
559 | : ((e = v.getPooled(m.responderReject, e, c, f)),
560 | (e.touchHistory = t.touchHistory),
561 | u(e, w),
562 | (d = B(d, e))))
563 | : ((d = B(d, b)), L(e, g)),
564 | (e = d))
565 | : (e = null)
566 | } else e = null
567 | d = k && A(a)
568 | b = k && F(a)
569 | g = k && G(a)
570 | if (
571 | (d = d
572 | ? m.responderStart
573 | : b
574 | ? m.responderMove
575 | : g
576 | ? m.responderEnd
577 | : null)
578 | )
579 | (d = v.getPooled(d, k, c, f)),
580 | (d.touchHistory = t.touchHistory),
581 | u(d, w),
582 | (e = B(e, d))
583 | d = k && 'touchcancel' === a
584 | if ((a = k && !d && G(a)))
585 | a: {
586 | if ((a = c.touches) && 0 !== a.length)
587 | for (b = 0; b < a.length; b++)
588 | if (
589 | ((g = a[b].target), null !== g && void 0 !== g && 0 !== g)
590 | ) {
591 | h = W(g)
592 | b: {
593 | for (g = k; h; ) {
594 | if (g === h || g === h.alternate) {
595 | g = !0
596 | break b
597 | }
598 | h = r(h)
599 | }
600 | g = !1
601 | }
602 | if (g) {
603 | a = !1
604 | break a
605 | }
606 | }
607 | a = !0
608 | }
609 | if ((a = d ? m.responderTerminate : a ? m.responderRelease : null))
610 | (c = v.getPooled(a, k, c, f)),
611 | (c.touchHistory = t.touchHistory),
612 | u(c, w),
613 | (e = B(e, c)),
614 | L(null)
615 | return e
616 | },
617 | GlobalResponderHandler: null,
618 | injection: {
619 | injectGlobalResponderHandler: function(a) {
620 | I.GlobalResponderHandler = a
621 | }
622 | }
623 | }
624 | n = function(a) {
625 | R = a.getFiberCurrentPropsFromNode
626 | W = a.getInstanceFromNode
627 | O = a.getNodeFromInstance
628 | }
629 | n(x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree)
630 | return {
631 | injectComponentTree: n,
632 | ResponderEventPlugin: I,
633 | ResponderTouchHistoryStore: t
634 | }
635 | })
636 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-is.development.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-is.development.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 |
10 | 'use strict'
11 | ;(function(global, factory) {
12 | typeof exports === 'object' && typeof module !== 'undefined'
13 | ? factory(exports)
14 | : typeof define === 'function' && define.amd
15 | ? define(['exports'], factory)
16 | : factory((global.ReactIs = {}))
17 | })(this, function(exports) {
18 | 'use strict'
19 |
20 | // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
21 | // nor polyfill, then a plain number is used for performance.
22 | var hasSymbol = typeof Symbol === 'function' && Symbol.for
23 |
24 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7
25 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca
26 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb
27 | var REACT_STRICT_MODE_TYPE = hasSymbol
28 | ? Symbol.for('react.strict_mode')
29 | : 0xeacc
30 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2
31 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd
32 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace
33 | var REACT_ASYNC_MODE_TYPE = hasSymbol
34 | ? Symbol.for('react.async_mode')
35 | : 0xeacf
36 | var REACT_FORWARD_REF_TYPE = hasSymbol
37 | ? Symbol.for('react.forward_ref')
38 | : 0xead0
39 | var REACT_PLACEHOLDER_TYPE = hasSymbol
40 | ? Symbol.for('react.placeholder')
41 | : 0xead1
42 |
43 | function isValidElementType(type) {
44 | return (
45 | typeof type === 'string' ||
46 | typeof type === 'function' ||
47 | // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
48 | type === REACT_FRAGMENT_TYPE ||
49 | type === REACT_ASYNC_MODE_TYPE ||
50 | type === REACT_PROFILER_TYPE ||
51 | type === REACT_STRICT_MODE_TYPE ||
52 | type === REACT_PLACEHOLDER_TYPE ||
53 | (typeof type === 'object' &&
54 | type !== null &&
55 | (type.$$typeof === REACT_PROVIDER_TYPE ||
56 | type.$$typeof === REACT_CONTEXT_TYPE ||
57 | type.$$typeof === REACT_FORWARD_REF_TYPE))
58 | )
59 | }
60 |
61 | function typeOf(object) {
62 | if (typeof object === 'object' && object !== null) {
63 | var $$typeof = object.$$typeof
64 |
65 | switch ($$typeof) {
66 | case REACT_ELEMENT_TYPE:
67 | var type = object.type
68 |
69 | switch (type) {
70 | case REACT_ASYNC_MODE_TYPE:
71 | case REACT_FRAGMENT_TYPE:
72 | case REACT_PROFILER_TYPE:
73 | case REACT_STRICT_MODE_TYPE:
74 | return type
75 | default:
76 | var $$typeofType = type && type.$$typeof
77 |
78 | switch ($$typeofType) {
79 | case REACT_CONTEXT_TYPE:
80 | case REACT_FORWARD_REF_TYPE:
81 | case REACT_PROVIDER_TYPE:
82 | return $$typeofType
83 | default:
84 | return $$typeof
85 | }
86 | }
87 | case REACT_PORTAL_TYPE:
88 | return $$typeof
89 | }
90 | }
91 |
92 | return undefined
93 | }
94 |
95 | var AsyncMode = REACT_ASYNC_MODE_TYPE
96 | var ContextConsumer = REACT_CONTEXT_TYPE
97 | var ContextProvider = REACT_PROVIDER_TYPE
98 | var Element = REACT_ELEMENT_TYPE
99 | var ForwardRef = REACT_FORWARD_REF_TYPE
100 | var Fragment = REACT_FRAGMENT_TYPE
101 | var Profiler = REACT_PROFILER_TYPE
102 | var Portal = REACT_PORTAL_TYPE
103 | var StrictMode = REACT_STRICT_MODE_TYPE
104 |
105 | function isAsyncMode(object) {
106 | return typeOf(object) === REACT_ASYNC_MODE_TYPE
107 | }
108 | function isContextConsumer(object) {
109 | return typeOf(object) === REACT_CONTEXT_TYPE
110 | }
111 | function isContextProvider(object) {
112 | return typeOf(object) === REACT_PROVIDER_TYPE
113 | }
114 | function isElement(object) {
115 | return (
116 | typeof object === 'object' &&
117 | object !== null &&
118 | object.$$typeof === REACT_ELEMENT_TYPE
119 | )
120 | }
121 | function isForwardRef(object) {
122 | return typeOf(object) === REACT_FORWARD_REF_TYPE
123 | }
124 | function isFragment(object) {
125 | return typeOf(object) === REACT_FRAGMENT_TYPE
126 | }
127 | function isProfiler(object) {
128 | return typeOf(object) === REACT_PROFILER_TYPE
129 | }
130 | function isPortal(object) {
131 | return typeOf(object) === REACT_PORTAL_TYPE
132 | }
133 | function isStrictMode(object) {
134 | return typeOf(object) === REACT_STRICT_MODE_TYPE
135 | }
136 |
137 | exports.typeOf = typeOf
138 | exports.AsyncMode = AsyncMode
139 | exports.ContextConsumer = ContextConsumer
140 | exports.ContextProvider = ContextProvider
141 | exports.Element = Element
142 | exports.ForwardRef = ForwardRef
143 | exports.Fragment = Fragment
144 | exports.Profiler = Profiler
145 | exports.Portal = Portal
146 | exports.StrictMode = StrictMode
147 | exports.isValidElementType = isValidElementType
148 | exports.isAsyncMode = isAsyncMode
149 | exports.isContextConsumer = isContextConsumer
150 | exports.isContextProvider = isContextProvider
151 | exports.isElement = isElement
152 | exports.isForwardRef = isForwardRef
153 | exports.isFragment = isFragment
154 | exports.isProfiler = isProfiler
155 | exports.isPortal = isPortal
156 | exports.isStrictMode = isStrictMode
157 |
158 | Object.defineProperty(exports, '__esModule', { value: true })
159 | })
160 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-is.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-is.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(b, c) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? c(exports)
13 | : 'function' === typeof define && define.amd
14 | ? define(['exports'], c)
15 | : c((b.ReactIs = {}))
16 | })(this, function(b) {
17 | function c(a) {
18 | if ('object' === typeof a && null !== a) {
19 | var b = a.$$typeof
20 | switch (b) {
21 | case n:
22 | switch (((a = a.type), a)) {
23 | case e:
24 | case f:
25 | case g:
26 | case h:
27 | return a
28 | default:
29 | switch (((a = a && a.$$typeof), a)) {
30 | case k:
31 | case l:
32 | case m:
33 | return a
34 | default:
35 | return b
36 | }
37 | }
38 | case p:
39 | return b
40 | }
41 | }
42 | }
43 | var d = 'function' === typeof Symbol && Symbol.for,
44 | n = d ? Symbol.for('react.element') : 60103,
45 | p = d ? Symbol.for('react.portal') : 60106,
46 | f = d ? Symbol.for('react.fragment') : 60107,
47 | h = d ? Symbol.for('react.strict_mode') : 60108,
48 | g = d ? Symbol.for('react.profiler') : 60114,
49 | m = d ? Symbol.for('react.provider') : 60109,
50 | k = d ? Symbol.for('react.context') : 60110,
51 | e = d ? Symbol.for('react.async_mode') : 60111,
52 | l = d ? Symbol.for('react.forward_ref') : 60112,
53 | q = d ? Symbol.for('react.placeholder') : 60113
54 | b.typeOf = c
55 | b.AsyncMode = e
56 | b.ContextConsumer = k
57 | b.ContextProvider = m
58 | b.Element = n
59 | b.ForwardRef = l
60 | b.Fragment = f
61 | b.Profiler = g
62 | b.Portal = p
63 | b.StrictMode = h
64 | b.isValidElementType = function(a) {
65 | return (
66 | 'string' === typeof a ||
67 | 'function' === typeof a ||
68 | a === f ||
69 | a === e ||
70 | a === g ||
71 | a === h ||
72 | a === q ||
73 | ('object' === typeof a &&
74 | null !== a &&
75 | (a.$$typeof === m || a.$$typeof === k || a.$$typeof === l))
76 | )
77 | }
78 | b.isAsyncMode = function(a) {
79 | return c(a) === e
80 | }
81 | b.isContextConsumer = function(a) {
82 | return c(a) === k
83 | }
84 | b.isContextProvider = function(a) {
85 | return c(a) === m
86 | }
87 | b.isElement = function(a) {
88 | return 'object' === typeof a && null !== a && a.$$typeof === n
89 | }
90 | b.isForwardRef = function(a) {
91 | return c(a) === l
92 | }
93 | b.isFragment = function(a) {
94 | return c(a) === f
95 | }
96 | b.isProfiler = function(a) {
97 | return c(a) === g
98 | }
99 | b.isPortal = function(a) {
100 | return c(a) === p
101 | }
102 | b.isStrictMode = function(a) {
103 | return c(a) === h
104 | }
105 | Object.defineProperty(b, '__esModule', { value: !0 })
106 | })
107 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-scheduler.development.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-scheduler.development.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 |
10 | 'use strict'
11 | ;(function(global, factory) {
12 | typeof exports === 'object' && typeof module !== 'undefined'
13 | ? factory(exports)
14 | : typeof define === 'function' && define.amd
15 | ? define(['exports'], factory)
16 | : factory((global.ReactScheduler = {}))
17 | })(this, function(exports) {
18 | 'use strict'
19 |
20 | var canUseDOM = !!(
21 | typeof window !== 'undefined' &&
22 | window.document &&
23 | window.document.createElement
24 | )
25 |
26 | /**
27 | * A scheduling library to allow scheduling work with more granular priority and
28 | * control than requestAnimationFrame and requestIdleCallback.
29 | * Current TODO items:
30 | * X- Pull out the scheduleWork polyfill built into React
31 | * X- Initial test coverage
32 | * X- Support for multiple callbacks
33 | * - Support for two priorities; serial and deferred
34 | * - Better test coverage
35 | * - Better docblock
36 | * - Polish documentation, API
37 | */
38 |
39 | // This is a built-in polyfill for requestIdleCallback. It works by scheduling
40 | // a requestAnimationFrame, storing the time for the start of the frame, then
41 | // scheduling a postMessage which gets scheduled after paint. Within the
42 | // postMessage handler do as much work as possible until time + frame rate.
43 | // By separating the idle call into a separate event tick we ensure that
44 | // layout, paint and other browser work is counted against the available time.
45 | // The frame rate is dynamically adjusted.
46 |
47 | // We capture a local reference to any global, in case it gets polyfilled after
48 | // this module is initially evaluated.
49 | // We want to be using a consistent implementation.
50 | var localDate = Date
51 |
52 | // This initialization code may run even on server environments
53 | // if a component just imports ReactDOM (e.g. for findDOMNode).
54 | // Some environments might not have setTimeout or clearTimeout.
55 | // However, we always expect them to be defined on the client.
56 | // https://github.com/facebook/react/pull/13088
57 | var localSetTimeout =
58 | typeof setTimeout === 'function' ? setTimeout : undefined
59 | var localClearTimeout =
60 | typeof clearTimeout === 'function' ? clearTimeout : undefined
61 |
62 | // We don't expect either of these to necessarily be defined,
63 | // but we will error later if they are missing on the client.
64 | var localRequestAnimationFrame =
65 | typeof requestAnimationFrame === 'function'
66 | ? requestAnimationFrame
67 | : undefined
68 | var localCancelAnimationFrame =
69 | typeof cancelAnimationFrame === 'function'
70 | ? cancelAnimationFrame
71 | : undefined
72 |
73 | var hasNativePerformanceNow =
74 | typeof performance === 'object' && typeof performance.now === 'function'
75 |
76 | exports.now = void 0
77 | if (hasNativePerformanceNow) {
78 | var Performance = performance
79 | exports.now = function() {
80 | return Performance.now()
81 | }
82 | } else {
83 | exports.now = function() {
84 | return localDate.now()
85 | }
86 | }
87 |
88 | exports.scheduleWork = void 0
89 | exports.cancelScheduledWork = void 0
90 |
91 | if (!canUseDOM) {
92 | var timeoutIds = new Map()
93 |
94 | exports.scheduleWork = function(callback, options) {
95 | // keeping return type consistent
96 | var callbackConfig = {
97 | scheduledCallback: callback,
98 | timeoutTime: 0,
99 | next: null,
100 | prev: null
101 | }
102 | var timeoutId = localSetTimeout(function() {
103 | callback({
104 | timeRemaining: function() {
105 | return Infinity
106 | },
107 |
108 | didTimeout: false
109 | })
110 | })
111 | timeoutIds.set(callback, timeoutId)
112 | return callbackConfig
113 | }
114 | exports.cancelScheduledWork = function(callbackId) {
115 | var callback = callbackId.scheduledCallback
116 | var timeoutId = timeoutIds.get(callback)
117 | timeoutIds.delete(callbackId)
118 | localClearTimeout(timeoutId)
119 | }
120 | } else {
121 | {
122 | if (typeof console !== 'undefined') {
123 | if (typeof localRequestAnimationFrame !== 'function') {
124 | console.error(
125 | "This browser doesn't support requestAnimationFrame. " +
126 | 'Make sure that you load a ' +
127 | 'polyfill in older browsers. https://fb.me/react-polyfills'
128 | )
129 | }
130 | if (typeof localCancelAnimationFrame !== 'function') {
131 | console.error(
132 | "This browser doesn't support cancelAnimationFrame. " +
133 | 'Make sure that you load a ' +
134 | 'polyfill in older browsers. https://fb.me/react-polyfills'
135 | )
136 | }
137 | }
138 | }
139 |
140 | var headOfPendingCallbacksLinkedList = null
141 | var tailOfPendingCallbacksLinkedList = null
142 |
143 | // We track what the next soonest timeoutTime is, to be able to quickly tell
144 | // if none of the scheduled callbacks have timed out.
145 | var nextSoonestTimeoutTime = -1
146 |
147 | var isIdleScheduled = false
148 | var isAnimationFrameScheduled = false
149 |
150 | // requestAnimationFrame does not run when the tab is in the background.
151 | // if we're backgrounded we prefer for that work to happen so that the page
152 | // continues to load in the background.
153 | // so we also schedule a 'setTimeout' as a fallback.
154 | var animationFrameTimeout = 100
155 | var rafID = void 0
156 | var timeoutID = void 0
157 | var scheduleAnimationFrameWithFallbackSupport = function(callback) {
158 | // schedule rAF and also a setTimeout
159 | rafID = localRequestAnimationFrame(function(timestamp) {
160 | // cancel the setTimeout
161 | localClearTimeout(timeoutID)
162 | callback(timestamp)
163 | })
164 | timeoutID = localSetTimeout(function() {
165 | // cancel the requestAnimationFrame
166 | localCancelAnimationFrame(rafID)
167 | callback(exports.now())
168 | }, animationFrameTimeout)
169 | }
170 |
171 | var frameDeadline = 0
172 | // We start out assuming that we run at 30fps but then the heuristic tracking
173 | // will adjust this value to a faster fps if we get more frequent animation
174 | // frames.
175 | var previousFrameTime = 33
176 | var activeFrameTime = 33
177 |
178 | var frameDeadlineObject = {
179 | didTimeout: false,
180 | timeRemaining: function() {
181 | var remaining = frameDeadline - exports.now()
182 | return remaining > 0 ? remaining : 0
183 | }
184 | }
185 |
186 | /**
187 | * Handles the case where a callback errors:
188 | * - don't catch the error, because this changes debugging behavior
189 | * - do start a new postMessage callback, to call any remaining callbacks,
190 | * - but only if there is an error, so there is not extra overhead.
191 | */
192 | var callUnsafely = function(callbackConfig, arg) {
193 | var callback = callbackConfig.scheduledCallback
194 | var finishedCalling = false
195 | try {
196 | callback(arg)
197 | finishedCalling = true
198 | } finally {
199 | // always remove it from linked list
200 | exports.cancelScheduledWork(callbackConfig)
201 |
202 | if (!finishedCalling) {
203 | // an error must have been thrown
204 | isIdleScheduled = true
205 | window.postMessage(messageKey, '*')
206 | }
207 | }
208 | }
209 |
210 | /**
211 | * Checks for timed out callbacks, runs them, and then checks again to see if
212 | * any more have timed out.
213 | * Keeps doing this until there are none which have currently timed out.
214 | */
215 | var callTimedOutCallbacks = function() {
216 | if (headOfPendingCallbacksLinkedList === null) {
217 | return
218 | }
219 |
220 | var currentTime = exports.now()
221 | // TODO: this would be more efficient if deferred callbacks are stored in
222 | // min heap.
223 | // Or in a linked list with links for both timeoutTime order and insertion
224 | // order.
225 | // For now an easy compromise is the current approach:
226 | // Keep a pointer to the soonest timeoutTime, and check that first.
227 | // If it has not expired, we can skip traversing the whole list.
228 | // If it has expired, then we step through all the callbacks.
229 | if (
230 | nextSoonestTimeoutTime === -1 ||
231 | nextSoonestTimeoutTime > currentTime
232 | ) {
233 | // We know that none of them have timed out yet.
234 | return
235 | }
236 | // NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
237 | // after successfully calling any timed out callbacks.
238 | // If a timed out callback throws an error, we could get stuck in a state
239 | // where the nextSoonestTimeoutTime was set wrong.
240 | var updatedNextSoonestTimeoutTime = -1 // we will update nextSoonestTimeoutTime below
241 | var timedOutCallbacks = []
242 |
243 | // iterate once to find timed out callbacks and find nextSoonestTimeoutTime
244 | var currentCallbackConfig = headOfPendingCallbacksLinkedList
245 | while (currentCallbackConfig !== null) {
246 | var _timeoutTime = currentCallbackConfig.timeoutTime
247 | if (_timeoutTime !== -1 && _timeoutTime <= currentTime) {
248 | // it has timed out!
249 | timedOutCallbacks.push(currentCallbackConfig)
250 | } else {
251 | if (
252 | _timeoutTime !== -1 &&
253 | (updatedNextSoonestTimeoutTime === -1 ||
254 | _timeoutTime < updatedNextSoonestTimeoutTime)
255 | ) {
256 | updatedNextSoonestTimeoutTime = _timeoutTime
257 | }
258 | }
259 | currentCallbackConfig = currentCallbackConfig.next
260 | }
261 |
262 | if (timedOutCallbacks.length > 0) {
263 | frameDeadlineObject.didTimeout = true
264 | for (var i = 0, len = timedOutCallbacks.length; i < len; i++) {
265 | callUnsafely(timedOutCallbacks[i], frameDeadlineObject)
266 | }
267 | }
268 |
269 | // NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
270 | // after successfully calling any timed out callbacks.
271 | nextSoonestTimeoutTime = updatedNextSoonestTimeoutTime
272 | }
273 |
274 | // We use the postMessage trick to defer idle work until after the repaint.
275 | var messageKey =
276 | '__reactIdleCallback$' +
277 | Math.random()
278 | .toString(36)
279 | .slice(2)
280 | var idleTick = function(event) {
281 | if (event.source !== window || event.data !== messageKey) {
282 | return
283 | }
284 | isIdleScheduled = false
285 |
286 | if (headOfPendingCallbacksLinkedList === null) {
287 | return
288 | }
289 |
290 | // First call anything which has timed out, until we have caught up.
291 | callTimedOutCallbacks()
292 |
293 | var currentTime = exports.now()
294 | // Next, as long as we have idle time, try calling more callbacks.
295 | while (
296 | frameDeadline - currentTime > 0 &&
297 | headOfPendingCallbacksLinkedList !== null
298 | ) {
299 | var latestCallbackConfig = headOfPendingCallbacksLinkedList
300 | frameDeadlineObject.didTimeout = false
301 | // callUnsafely will remove it from the head of the linked list
302 | callUnsafely(latestCallbackConfig, frameDeadlineObject)
303 | currentTime = exports.now()
304 | }
305 | if (headOfPendingCallbacksLinkedList !== null) {
306 | if (!isAnimationFrameScheduled) {
307 | // Schedule another animation callback so we retry later.
308 | isAnimationFrameScheduled = true
309 | scheduleAnimationFrameWithFallbackSupport(animationTick)
310 | }
311 | }
312 | }
313 | // Assumes that we have addEventListener in this environment. Might need
314 | // something better for old IE.
315 | window.addEventListener('message', idleTick, false)
316 |
317 | var animationTick = function(rafTime) {
318 | isAnimationFrameScheduled = false
319 | var nextFrameTime = rafTime - frameDeadline + activeFrameTime
320 | if (
321 | nextFrameTime < activeFrameTime &&
322 | previousFrameTime < activeFrameTime
323 | ) {
324 | if (nextFrameTime < 8) {
325 | // Defensive coding. We don't support higher frame rates than 120hz.
326 | // If we get lower than that, it is probably a bug.
327 | nextFrameTime = 8
328 | }
329 | // If one frame goes long, then the next one can be short to catch up.
330 | // If two frames are short in a row, then that's an indication that we
331 | // actually have a higher frame rate than what we're currently optimizing.
332 | // We adjust our heuristic dynamically accordingly. For example, if we're
333 | // running on 120hz display or 90hz VR display.
334 | // Take the max of the two in case one of them was an anomaly due to
335 | // missed frame deadlines.
336 | activeFrameTime =
337 | nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime
338 | } else {
339 | previousFrameTime = nextFrameTime
340 | }
341 | frameDeadline = rafTime + activeFrameTime
342 | if (!isIdleScheduled) {
343 | isIdleScheduled = true
344 | window.postMessage(messageKey, '*')
345 | }
346 | }
347 |
348 | exports.scheduleWork = function(
349 | callback,
350 | options
351 | ) /* CallbackConfigType */ {
352 | var timeoutTime = -1
353 | if (options != null && typeof options.timeout === 'number') {
354 | timeoutTime = exports.now() + options.timeout
355 | }
356 | if (
357 | nextSoonestTimeoutTime === -1 ||
358 | (timeoutTime !== -1 && timeoutTime < nextSoonestTimeoutTime)
359 | ) {
360 | nextSoonestTimeoutTime = timeoutTime
361 | }
362 |
363 | var scheduledCallbackConfig = {
364 | scheduledCallback: callback,
365 | timeoutTime: timeoutTime,
366 | prev: null,
367 | next: null
368 | }
369 | if (headOfPendingCallbacksLinkedList === null) {
370 | // Make this callback the head and tail of our list
371 | headOfPendingCallbacksLinkedList = scheduledCallbackConfig
372 | tailOfPendingCallbacksLinkedList = scheduledCallbackConfig
373 | } else {
374 | // Add latest callback as the new tail of the list
375 | scheduledCallbackConfig.prev = tailOfPendingCallbacksLinkedList
376 | // renaming for clarity
377 | var oldTailOfPendingCallbacksLinkedList = tailOfPendingCallbacksLinkedList
378 | if (oldTailOfPendingCallbacksLinkedList !== null) {
379 | oldTailOfPendingCallbacksLinkedList.next = scheduledCallbackConfig
380 | }
381 | tailOfPendingCallbacksLinkedList = scheduledCallbackConfig
382 | }
383 |
384 | if (!isAnimationFrameScheduled) {
385 | // If rAF didn't already schedule one, we need to schedule a frame.
386 | // TODO: If this rAF doesn't materialize because the browser throttles, we
387 | // might want to still have setTimeout trigger scheduleWork as a backup to ensure
388 | // that we keep performing work.
389 | isAnimationFrameScheduled = true
390 | scheduleAnimationFrameWithFallbackSupport(animationTick)
391 | }
392 | return scheduledCallbackConfig
393 | }
394 |
395 | exports.cancelScheduledWork = function(
396 | callbackConfig /* CallbackConfigType */
397 | ) {
398 | if (
399 | callbackConfig.prev === null &&
400 | headOfPendingCallbacksLinkedList !== callbackConfig
401 | ) {
402 | // this callbackConfig has already been cancelled.
403 | // cancelScheduledWork should be idempotent, a no-op after first call.
404 | return
405 | }
406 |
407 | /**
408 | * There are four possible cases:
409 | * - Head/nodeToRemove/Tail -> null
410 | * In this case we set Head and Tail to null.
411 | * - Head -> ... middle nodes... -> Tail/nodeToRemove
412 | * In this case we point the middle.next to null and put middle as the new
413 | * Tail.
414 | * - Head/nodeToRemove -> ...middle nodes... -> Tail
415 | * In this case we point the middle.prev at null and move the Head to
416 | * middle.
417 | * - Head -> ... ?some nodes ... -> nodeToRemove -> ... ?some nodes ... -> Tail
418 | * In this case we point the Head.next to the Tail and the Tail.prev to
419 | * the Head.
420 | */
421 | var next = callbackConfig.next
422 | var prev = callbackConfig.prev
423 | callbackConfig.next = null
424 | callbackConfig.prev = null
425 | if (next !== null) {
426 | // we have a next
427 |
428 | if (prev !== null) {
429 | // we have a prev
430 |
431 | // callbackConfig is somewhere in the middle of a list of 3 or more nodes.
432 | prev.next = next
433 | next.prev = prev
434 | return
435 | } else {
436 | // there is a next but not a previous one;
437 | // callbackConfig is the head of a list of 2 or more other nodes.
438 | next.prev = null
439 | headOfPendingCallbacksLinkedList = next
440 | return
441 | }
442 | } else {
443 | // there is no next callback config; this must the tail of the list
444 |
445 | if (prev !== null) {
446 | // we have a prev
447 |
448 | // callbackConfig is the tail of a list of 2 or more other nodes.
449 | prev.next = null
450 | tailOfPendingCallbacksLinkedList = prev
451 | return
452 | } else {
453 | // there is no previous callback config;
454 | // callbackConfig is the only thing in the linked list,
455 | // so both head and tail point to it.
456 | headOfPendingCallbacksLinkedList = null
457 | tailOfPendingCallbacksLinkedList = null
458 | return
459 | }
460 | }
461 | }
462 | }
463 |
464 | Object.defineProperty(exports, '__esModule', { value: true })
465 | })
466 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-scheduler.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-scheduler.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(d, f) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? f(exports)
13 | : 'function' === typeof define && define.amd
14 | ? define(['exports'], f)
15 | : f((d.ReactScheduler = {}))
16 | })(this, function(d) {
17 | var f = !(
18 | 'undefined' === typeof window ||
19 | !window.document ||
20 | !window.document.createElement
21 | ),
22 | C = Date,
23 | v = 'function' === typeof setTimeout ? setTimeout : void 0,
24 | w = 'function' === typeof clearTimeout ? clearTimeout : void 0,
25 | D =
26 | 'function' === typeof requestAnimationFrame
27 | ? requestAnimationFrame
28 | : void 0,
29 | E =
30 | 'function' === typeof cancelAnimationFrame
31 | ? cancelAnimationFrame
32 | : void 0,
33 | F = 'object' === typeof performance && 'function' === typeof performance.now
34 | d.now = void 0
35 | if (F) {
36 | var G = performance
37 | d.now = function() {
38 | return G.now()
39 | }
40 | } else
41 | d.now = function() {
42 | return C.now()
43 | }
44 | d.scheduleWork = void 0
45 | d.cancelScheduledWork = void 0
46 | if (f) {
47 | var e = null,
48 | m = null,
49 | h = -1,
50 | n = !1,
51 | k = !1,
52 | x = void 0,
53 | y = void 0,
54 | z = function(a) {
55 | x = D(function(b) {
56 | w(y)
57 | a(b)
58 | })
59 | y = v(function() {
60 | E(x)
61 | a(d.now())
62 | }, 100)
63 | },
64 | p = 0,
65 | q = 33,
66 | l = 33,
67 | r = {
68 | didTimeout: !1,
69 | timeRemaining: function() {
70 | var a = p - d.now()
71 | return 0 < a ? a : 0
72 | }
73 | },
74 | A = function(a, b) {
75 | var c = a.scheduledCallback,
76 | e = !1
77 | try {
78 | c(b), (e = !0)
79 | } finally {
80 | d.cancelScheduledWork(a), e || ((n = !0), window.postMessage(t, '*'))
81 | }
82 | },
83 | t =
84 | '__reactIdleCallback$' +
85 | Math.random()
86 | .toString(36)
87 | .slice(2)
88 | window.addEventListener(
89 | 'message',
90 | function(a) {
91 | if (a.source === window && a.data === t && ((n = !1), null !== e)) {
92 | if (null !== e) {
93 | var b = d.now()
94 | if (!(-1 === h || h > b)) {
95 | a = -1
96 | for (var c = [], g = e; null !== g; ) {
97 | var f = g.timeoutTime
98 | ;-1 !== f && f <= b
99 | ? c.push(g)
100 | : -1 !== f && (-1 === a || f < a) && (a = f)
101 | g = g.next
102 | }
103 | if (0 < c.length)
104 | for (r.didTimeout = !0, b = 0, g = c.length; b < g; b++)
105 | A(c[b], r)
106 | h = a
107 | }
108 | }
109 | for (a = d.now(); 0 < p - a && null !== e; )
110 | (a = e), (r.didTimeout = !1), A(a, r), (a = d.now())
111 | null === e || k || ((k = !0), z(B))
112 | }
113 | },
114 | !1
115 | )
116 | var B = function(a) {
117 | k = !1
118 | var b = a - p + l
119 | b < l && q < l ? (8 > b && (b = 8), (l = b < q ? q : b)) : (q = b)
120 | p = a + l
121 | n || ((n = !0), window.postMessage(t, '*'))
122 | }
123 | d.scheduleWork = function(a, b) {
124 | var c = -1
125 | null != b && 'number' === typeof b.timeout && (c = d.now() + b.timeout)
126 | if (-1 === h || (-1 !== c && c < h)) h = c
127 | a = { scheduledCallback: a, timeoutTime: c, prev: null, next: null }
128 | null === e ? (e = a) : ((b = a.prev = m), null !== b && (b.next = a))
129 | m = a
130 | k || ((k = !0), z(B))
131 | return a
132 | }
133 | d.cancelScheduledWork = function(a) {
134 | if (null !== a.prev || e === a) {
135 | var b = a.next,
136 | c = a.prev
137 | a.next = null
138 | a.prev = null
139 | null !== b
140 | ? null !== c
141 | ? ((c.next = b), (b.prev = c))
142 | : ((b.prev = null), (e = b))
143 | : null !== c
144 | ? ((c.next = null), (m = c))
145 | : (m = e = null)
146 | }
147 | }
148 | } else {
149 | var u = new Map()
150 | d.scheduleWork = function(a, b) {
151 | b = { scheduledCallback: a, timeoutTime: 0, next: null, prev: null }
152 | var c = v(function() {
153 | a({
154 | timeRemaining: function() {
155 | return Infinity
156 | },
157 | didTimeout: !1
158 | })
159 | })
160 | u.set(a, c)
161 | return b
162 | }
163 | d.cancelScheduledWork = function(a) {
164 | var b = u.get(a.scheduledCallback)
165 | u.delete(a)
166 | w(b)
167 | }
168 | }
169 | Object.defineProperty(d, '__esModule', { value: !0 })
170 | })
171 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-test-renderer-shallow.development.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-test-renderer-shallow.development.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 |
10 | 'use strict'
11 | ;(function(global, factory) {
12 | typeof exports === 'object' && typeof module !== 'undefined'
13 | ? (module.exports = factory(require('react')))
14 | : typeof define === 'function' && define.amd
15 | ? define(['react'], factory)
16 | : (global.ReactShallowRenderer = factory(global.React))
17 | })(this, function(React) {
18 | 'use strict'
19 |
20 | var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
21 |
22 | var _assign = ReactInternals.assign
23 |
24 | /**
25 | * Use invariant() to assert state which your program assumes to be true.
26 | *
27 | * Provide sprintf-style format (only %s is supported) and arguments
28 | * to provide information about what broke and what you were
29 | * expecting.
30 | *
31 | * The invariant message will be stripped in production, but the invariant
32 | * will remain to ensure logic does not differ in production.
33 | */
34 |
35 | var validateFormat = function() {}
36 |
37 | {
38 | validateFormat = function(format) {
39 | if (format === undefined) {
40 | throw new Error('invariant requires an error message argument')
41 | }
42 | }
43 | }
44 |
45 | function invariant(condition, format, a, b, c, d, e, f) {
46 | validateFormat(format)
47 |
48 | if (!condition) {
49 | var error = void 0
50 | if (format === undefined) {
51 | error = new Error(
52 | 'Minified exception occurred; use the non-minified dev environment ' +
53 | 'for the full error message and additional helpful warnings.'
54 | )
55 | } else {
56 | var args = [a, b, c, d, e, f]
57 | var argIndex = 0
58 | error = new Error(
59 | format.replace(/%s/g, function() {
60 | return args[argIndex++]
61 | })
62 | )
63 | error.name = 'Invariant Violation'
64 | }
65 |
66 | error.framesToPop = 1 // we don't care about invariant's own frame
67 | throw error
68 | }
69 | }
70 |
71 | // Relying on the `invariant()` implementation lets us
72 | // have preserve the format and params in the www builds.
73 |
74 | // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
75 | // nor polyfill, then a plain number is used for performance.
76 | var hasSymbol = typeof Symbol === 'function' && Symbol.for
77 |
78 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7
79 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca
80 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb
81 | var REACT_STRICT_MODE_TYPE = hasSymbol
82 | ? Symbol.for('react.strict_mode')
83 | : 0xeacc
84 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2
85 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd
86 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace
87 | var REACT_ASYNC_MODE_TYPE = hasSymbol
88 | ? Symbol.for('react.async_mode')
89 | : 0xeacf
90 | var REACT_FORWARD_REF_TYPE = hasSymbol
91 | ? Symbol.for('react.forward_ref')
92 | : 0xead0
93 | var REACT_PLACEHOLDER_TYPE = hasSymbol
94 | ? Symbol.for('react.placeholder')
95 | : 0xead1
96 |
97 | function typeOf(object) {
98 | if (typeof object === 'object' && object !== null) {
99 | var $$typeof = object.$$typeof
100 |
101 | switch ($$typeof) {
102 | case REACT_ELEMENT_TYPE:
103 | var type = object.type
104 |
105 | switch (type) {
106 | case REACT_ASYNC_MODE_TYPE:
107 | case REACT_FRAGMENT_TYPE:
108 | case REACT_PROFILER_TYPE:
109 | case REACT_STRICT_MODE_TYPE:
110 | return type
111 | default:
112 | var $$typeofType = type && type.$$typeof
113 |
114 | switch ($$typeofType) {
115 | case REACT_CONTEXT_TYPE:
116 | case REACT_FORWARD_REF_TYPE:
117 | case REACT_PROVIDER_TYPE:
118 | return $$typeofType
119 | default:
120 | return $$typeof
121 | }
122 | }
123 | case REACT_PORTAL_TYPE:
124 | return $$typeof
125 | }
126 | }
127 |
128 | return undefined
129 | }
130 |
131 | function isForwardRef(object) {
132 | return typeOf(object) === REACT_FORWARD_REF_TYPE
133 | }
134 |
135 | var describeComponentFrame = function(name, source, ownerName) {
136 | return (
137 | '\n in ' +
138 | (name || 'Unknown') +
139 | (source
140 | ? ' (at ' +
141 | source.fileName.replace(/^.*[\\\/]/, '') +
142 | ':' +
143 | source.lineNumber +
144 | ')'
145 | : ownerName
146 | ? ' (created by ' + ownerName + ')'
147 | : '')
148 | )
149 | }
150 |
151 | /**
152 | * Similar to invariant but only logs a warning if the condition is not met.
153 | * This can be used to log issues in development environments in critical
154 | * paths. Removing the logging code for production environments will keep the
155 | * same logic and follow the same code paths.
156 | */
157 |
158 | var warningWithoutStack = function() {}
159 |
160 | {
161 | warningWithoutStack = function(condition, format) {
162 | for (
163 | var _len = arguments.length,
164 | args = Array(_len > 2 ? _len - 2 : 0),
165 | _key = 2;
166 | _key < _len;
167 | _key++
168 | ) {
169 | args[_key - 2] = arguments[_key]
170 | }
171 |
172 | if (format === undefined) {
173 | throw new Error(
174 | '`warningWithoutStack(condition, format, ...args)` requires a warning ' +
175 | 'message argument'
176 | )
177 | }
178 | if (condition) {
179 | return
180 | }
181 | if (typeof console !== 'undefined') {
182 | var _console
183 | ;(_console = console).error.apply(
184 | _console,
185 | ['Warning: ' + format].concat(args)
186 | )
187 | }
188 | try {
189 | // --- Welcome to debugging React ---
190 | // This error was thrown as a convenience so that you can use this stack
191 | // to find the callsite that caused this warning to fire.
192 | var argIndex = 0
193 | var message =
194 | 'Warning: ' +
195 | format.replace(/%s/g, function() {
196 | return args[argIndex++]
197 | })
198 | throw new Error(message)
199 | } catch (x) {}
200 | }
201 | }
202 |
203 | var warningWithoutStack$1 = warningWithoutStack
204 |
205 | function getComponentName(type) {
206 | if (type == null) {
207 | // Host root, text node or just invalid type.
208 | return null
209 | }
210 | {
211 | if (typeof type.tag === 'number') {
212 | warningWithoutStack$1(
213 | false,
214 | 'Received an unexpected object in getComponentName(). ' +
215 | 'This is likely a bug in React. Please file an issue.'
216 | )
217 | }
218 | }
219 | if (typeof type === 'function') {
220 | return type.displayName || type.name || null
221 | }
222 | if (typeof type === 'string') {
223 | return type
224 | }
225 | switch (type) {
226 | case REACT_ASYNC_MODE_TYPE:
227 | return 'AsyncMode'
228 | case REACT_FRAGMENT_TYPE:
229 | return 'Fragment'
230 | case REACT_PORTAL_TYPE:
231 | return 'Portal'
232 | case REACT_PROFILER_TYPE:
233 | return 'Profiler'
234 | case REACT_STRICT_MODE_TYPE:
235 | return 'StrictMode'
236 | case REACT_PLACEHOLDER_TYPE:
237 | return 'Placeholder'
238 | }
239 | if (typeof type === 'object') {
240 | switch (type.$$typeof) {
241 | case REACT_CONTEXT_TYPE:
242 | return 'Context.Consumer'
243 | case REACT_PROVIDER_TYPE:
244 | return 'Context.Provider'
245 | case REACT_FORWARD_REF_TYPE:
246 | var renderFn = type.render
247 | var functionName = renderFn.displayName || renderFn.name || ''
248 | return functionName !== ''
249 | ? 'ForwardRef(' + functionName + ')'
250 | : 'ForwardRef'
251 | }
252 | }
253 | return null
254 | }
255 |
256 | /*eslint-disable no-self-compare */
257 |
258 | var hasOwnProperty = Object.prototype.hasOwnProperty
259 |
260 | /**
261 | * inlined Object.is polyfill to avoid requiring consumers ship their own
262 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
263 | */
264 | function is(x, y) {
265 | // SameValue algorithm
266 | if (x === y) {
267 | // Steps 1-5, 7-10
268 | // Steps 6.b-6.e: +0 != -0
269 | // Added the nonzero y check to make Flow happy, but it is redundant
270 | return x !== 0 || y !== 0 || 1 / x === 1 / y
271 | } else {
272 | // Step 6.a: NaN == NaN
273 | return x !== x && y !== y
274 | }
275 | }
276 |
277 | /**
278 | * Performs equality by iterating through keys on an object and returning false
279 | * when any key has values which are not strictly equal between the arguments.
280 | * Returns true when the values of all keys are strictly equal.
281 | */
282 | function shallowEqual(objA, objB) {
283 | if (is(objA, objB)) {
284 | return true
285 | }
286 |
287 | if (
288 | typeof objA !== 'object' ||
289 | objA === null ||
290 | typeof objB !== 'object' ||
291 | objB === null
292 | ) {
293 | return false
294 | }
295 |
296 | var keysA = Object.keys(objA)
297 | var keysB = Object.keys(objB)
298 |
299 | if (keysA.length !== keysB.length) {
300 | return false
301 | }
302 |
303 | // Test for A's keys different from B.
304 | for (var i = 0; i < keysA.length; i++) {
305 | if (
306 | !hasOwnProperty.call(objB, keysA[i]) ||
307 | !is(objA[keysA[i]], objB[keysA[i]])
308 | ) {
309 | return false
310 | }
311 | }
312 |
313 | return true
314 | }
315 |
316 | /**
317 | * Copyright (c) 2013-present, Facebook, Inc.
318 | *
319 | * This source code is licensed under the MIT license found in the
320 | * LICENSE file in the root directory of this source tree.
321 | */
322 |
323 | var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
324 |
325 | var ReactPropTypesSecret_1 = ReactPropTypesSecret$1
326 |
327 | /**
328 | * Copyright (c) 2013-present, Facebook, Inc.
329 | *
330 | * This source code is licensed under the MIT license found in the
331 | * LICENSE file in the root directory of this source tree.
332 | */
333 |
334 | var printWarning = function() {}
335 |
336 | {
337 | var ReactPropTypesSecret = ReactPropTypesSecret_1
338 | var loggedTypeFailures = {}
339 |
340 | printWarning = function(text) {
341 | var message = 'Warning: ' + text
342 | if (typeof console !== 'undefined') {
343 | console.error(message)
344 | }
345 | try {
346 | // --- Welcome to debugging React ---
347 | // This error was thrown as a convenience so that you can use this stack
348 | // to find the callsite that caused this warning to fire.
349 | throw new Error(message)
350 | } catch (x) {}
351 | }
352 | }
353 |
354 | /**
355 | * Assert that the values match with the type specs.
356 | * Error messages are memorized and will only be shown once.
357 | *
358 | * @param {object} typeSpecs Map of name to a ReactPropType
359 | * @param {object} values Runtime values that need to be type-checked
360 | * @param {string} location e.g. "prop", "context", "child context"
361 | * @param {string} componentName Name of the component for error messages.
362 | * @param {?Function} getStack Returns the component stack.
363 | * @private
364 | */
365 | function checkPropTypes(
366 | typeSpecs,
367 | values,
368 | location,
369 | componentName,
370 | getStack
371 | ) {
372 | {
373 | for (var typeSpecName in typeSpecs) {
374 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
375 | var error
376 | // Prop type validation may throw. In case they do, we don't want to
377 | // fail the render phase where it didn't fail before. So we log it.
378 | // After these have been cleaned up, we'll let them throw.
379 | try {
380 | // This is intentionally an invariant that gets caught. It's the same
381 | // behavior as without this statement except with a better message.
382 | if (typeof typeSpecs[typeSpecName] !== 'function') {
383 | var err = Error(
384 | (componentName || 'React class') +
385 | ': ' +
386 | location +
387 | ' type `' +
388 | typeSpecName +
389 | '` is invalid; ' +
390 | 'it must be a function, usually from the `prop-types` package, but received `' +
391 | typeof typeSpecs[typeSpecName] +
392 | '`.'
393 | )
394 | err.name = 'Invariant Violation'
395 | throw err
396 | }
397 | error = typeSpecs[typeSpecName](
398 | values,
399 | typeSpecName,
400 | componentName,
401 | location,
402 | null,
403 | ReactPropTypesSecret
404 | )
405 | } catch (ex) {
406 | error = ex
407 | }
408 | if (error && !(error instanceof Error)) {
409 | printWarning(
410 | (componentName || 'React class') +
411 | ': type specification of ' +
412 | location +
413 | ' `' +
414 | typeSpecName +
415 | '` is invalid; the type checker ' +
416 | 'function must return `null` or an `Error` but returned a ' +
417 | typeof error +
418 | '. ' +
419 | 'You may have forgotten to pass an argument to the type checker ' +
420 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
421 | 'shape all require an argument).'
422 | )
423 | }
424 | if (
425 | error instanceof Error &&
426 | !(error.message in loggedTypeFailures)
427 | ) {
428 | // Only monitor this failure once because there tends to be a lot of the
429 | // same error.
430 | loggedTypeFailures[error.message] = true
431 |
432 | var stack = getStack ? getStack() : ''
433 |
434 | printWarning(
435 | 'Failed ' +
436 | location +
437 | ' type: ' +
438 | error.message +
439 | (stack != null ? stack : '')
440 | )
441 | }
442 | }
443 | }
444 | }
445 | }
446 |
447 | var checkPropTypes_1 = checkPropTypes
448 |
449 | function _classCallCheck(instance, Constructor) {
450 | if (!(instance instanceof Constructor)) {
451 | throw new TypeError('Cannot call a class as a function')
452 | }
453 | }
454 |
455 | var emptyObject = {}
456 | {
457 | Object.freeze(emptyObject)
458 | }
459 |
460 | var ReactShallowRenderer = (function() {
461 | function ReactShallowRenderer() {
462 | _classCallCheck(this, ReactShallowRenderer)
463 |
464 | this._context = null
465 | this._element = null
466 | this._instance = null
467 | this._newState = null
468 | this._rendered = null
469 | this._rendering = false
470 | this._forcedUpdate = false
471 | this._updater = new Updater(this)
472 | }
473 |
474 | ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {
475 | return this._instance
476 | }
477 |
478 | ReactShallowRenderer.prototype.getRenderOutput = function getRenderOutput() {
479 | return this._rendered
480 | }
481 |
482 | ReactShallowRenderer.prototype.render = function render(element) {
483 | var context =
484 | arguments.length > 1 && arguments[1] !== undefined
485 | ? arguments[1]
486 | : emptyObject
487 |
488 | !React.isValidElement(element)
489 | ? invariant(
490 | false,
491 | 'ReactShallowRenderer render(): Invalid component element.%s',
492 | typeof element === 'function'
493 | ? ' Instead of passing a component class, make sure to instantiate ' +
494 | 'it by passing it to React.createElement.'
495 | : ''
496 | )
497 | : void 0
498 | // Show a special message for host elements since it's a common case.
499 | !(typeof element.type !== 'string')
500 | ? invariant(
501 | false,
502 | 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.',
503 | element.type
504 | )
505 | : void 0
506 | !(isForwardRef(element) || typeof element.type === 'function')
507 | ? invariant(
508 | false,
509 | 'ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `%s`.',
510 | Array.isArray(element.type)
511 | ? 'array'
512 | : element.type === null
513 | ? 'null'
514 | : typeof element.type
515 | )
516 | : void 0
517 |
518 | if (this._rendering) {
519 | return
520 | }
521 |
522 | this._rendering = true
523 | this._element = element
524 | this._context = getMaskedContext(element.type.contextTypes, context)
525 |
526 | if (this._instance) {
527 | this._updateClassComponent(element, this._context)
528 | } else {
529 | if (isForwardRef(element)) {
530 | this._rendered = element.type.render(element.props, element.ref)
531 | } else if (shouldConstruct(element.type)) {
532 | this._instance = new element.type(
533 | element.props,
534 | this._context,
535 | this._updater
536 | )
537 |
538 | this._updateStateFromStaticLifecycle(element.props)
539 |
540 | if (element.type.hasOwnProperty('contextTypes')) {
541 | currentlyValidatingElement = element
542 |
543 | checkPropTypes_1(
544 | element.type.contextTypes,
545 | this._context,
546 | 'context',
547 | getName(element.type, this._instance),
548 | getStackAddendum
549 | )
550 |
551 | currentlyValidatingElement = null
552 | }
553 |
554 | this._mountClassComponent(element, this._context)
555 | } else {
556 | this._rendered = element.type.call(
557 | undefined,
558 | element.props,
559 | this._context
560 | )
561 | }
562 | }
563 |
564 | this._rendering = false
565 | this._updater._invokeCallbacks()
566 |
567 | return this.getRenderOutput()
568 | }
569 |
570 | ReactShallowRenderer.prototype.unmount = function unmount() {
571 | if (this._instance) {
572 | if (typeof this._instance.componentWillUnmount === 'function') {
573 | this._instance.componentWillUnmount()
574 | }
575 | }
576 |
577 | this._context = null
578 | this._element = null
579 | this._newState = null
580 | this._rendered = null
581 | this._instance = null
582 | }
583 |
584 | ReactShallowRenderer.prototype._mountClassComponent = function _mountClassComponent(
585 | element,
586 | context
587 | ) {
588 | this._instance.context = context
589 | this._instance.props = element.props
590 | this._instance.state = this._instance.state || null
591 | this._instance.updater = this._updater
592 |
593 | if (
594 | typeof this._instance.UNSAFE_componentWillMount === 'function' ||
595 | typeof this._instance.componentWillMount === 'function'
596 | ) {
597 | var beforeState = this._newState
598 |
599 | // In order to support react-lifecycles-compat polyfilled components,
600 | // Unsafe lifecycles should not be invoked for components using the new APIs.
601 | if (
602 | typeof element.type.getDerivedStateFromProps !== 'function' &&
603 | typeof this._instance.getSnapshotBeforeUpdate !== 'function'
604 | ) {
605 | if (typeof this._instance.componentWillMount === 'function') {
606 | this._instance.componentWillMount()
607 | }
608 | if (typeof this._instance.UNSAFE_componentWillMount === 'function') {
609 | this._instance.UNSAFE_componentWillMount()
610 | }
611 | }
612 |
613 | // setState may have been called during cWM
614 | if (beforeState !== this._newState) {
615 | this._instance.state = this._newState || emptyObject
616 | }
617 | }
618 |
619 | this._rendered = this._instance.render()
620 | // Intentionally do not call componentDidMount()
621 | // because DOM refs are not available.
622 | }
623 |
624 | ReactShallowRenderer.prototype._updateClassComponent = function _updateClassComponent(
625 | element,
626 | context
627 | ) {
628 | var props = element.props,
629 | type = element.type
630 |
631 | var oldState = this._instance.state || emptyObject
632 | var oldProps = this._instance.props
633 |
634 | if (oldProps !== props) {
635 | // In order to support react-lifecycles-compat polyfilled components,
636 | // Unsafe lifecycles should not be invoked for components using the new APIs.
637 | if (
638 | typeof element.type.getDerivedStateFromProps !== 'function' &&
639 | typeof this._instance.getSnapshotBeforeUpdate !== 'function'
640 | ) {
641 | if (typeof this._instance.componentWillReceiveProps === 'function') {
642 | this._instance.componentWillReceiveProps(props, context)
643 | }
644 | if (
645 | typeof this._instance.UNSAFE_componentWillReceiveProps ===
646 | 'function'
647 | ) {
648 | this._instance.UNSAFE_componentWillReceiveProps(props, context)
649 | }
650 | }
651 | }
652 | this._updateStateFromStaticLifecycle(props)
653 |
654 | // Read state after cWRP in case it calls setState
655 | var state = this._newState || oldState
656 |
657 | var shouldUpdate = true
658 | if (this._forcedUpdate) {
659 | shouldUpdate = true
660 | this._forcedUpdate = false
661 | } else if (typeof this._instance.shouldComponentUpdate === 'function') {
662 | shouldUpdate = !!this._instance.shouldComponentUpdate(
663 | props,
664 | state,
665 | context
666 | )
667 | } else if (type.prototype && type.prototype.isPureReactComponent) {
668 | shouldUpdate =
669 | !shallowEqual(oldProps, props) || !shallowEqual(oldState, state)
670 | }
671 |
672 | if (shouldUpdate) {
673 | // In order to support react-lifecycles-compat polyfilled components,
674 | // Unsafe lifecycles should not be invoked for components using the new APIs.
675 | if (
676 | typeof element.type.getDerivedStateFromProps !== 'function' &&
677 | typeof this._instance.getSnapshotBeforeUpdate !== 'function'
678 | ) {
679 | if (typeof this._instance.componentWillUpdate === 'function') {
680 | this._instance.componentWillUpdate(props, state, context)
681 | }
682 | if (typeof this._instance.UNSAFE_componentWillUpdate === 'function') {
683 | this._instance.UNSAFE_componentWillUpdate(props, state, context)
684 | }
685 | }
686 | }
687 |
688 | this._instance.context = context
689 | this._instance.props = props
690 | this._instance.state = state
691 |
692 | if (shouldUpdate) {
693 | this._rendered = this._instance.render()
694 | }
695 | // Intentionally do not call componentDidUpdate()
696 | // because DOM refs are not available.
697 | }
698 |
699 | ReactShallowRenderer.prototype._updateStateFromStaticLifecycle = function _updateStateFromStaticLifecycle(
700 | props
701 | ) {
702 | var type = this._element.type
703 |
704 | if (typeof type.getDerivedStateFromProps === 'function') {
705 | var oldState = this._newState || this._instance.state
706 | var partialState = type.getDerivedStateFromProps.call(
707 | null,
708 | props,
709 | oldState
710 | )
711 |
712 | if (partialState != null) {
713 | var newState = _assign({}, oldState, partialState)
714 | this._instance.state = this._newState = newState
715 | }
716 | }
717 | }
718 |
719 | return ReactShallowRenderer
720 | })()
721 |
722 | ReactShallowRenderer.createRenderer = function() {
723 | return new ReactShallowRenderer()
724 | }
725 |
726 | var Updater = (function() {
727 | function Updater(renderer) {
728 | _classCallCheck(this, Updater)
729 |
730 | this._renderer = renderer
731 | this._callbacks = []
732 | }
733 |
734 | Updater.prototype._enqueueCallback = function _enqueueCallback(
735 | callback,
736 | publicInstance
737 | ) {
738 | if (typeof callback === 'function' && publicInstance) {
739 | this._callbacks.push({
740 | callback: callback,
741 | publicInstance: publicInstance
742 | })
743 | }
744 | }
745 |
746 | Updater.prototype._invokeCallbacks = function _invokeCallbacks() {
747 | var callbacks = this._callbacks
748 | this._callbacks = []
749 |
750 | callbacks.forEach(function(_ref) {
751 | var callback = _ref.callback,
752 | publicInstance = _ref.publicInstance
753 |
754 | callback.call(publicInstance)
755 | })
756 | }
757 |
758 | Updater.prototype.isMounted = function isMounted(publicInstance) {
759 | return !!this._renderer._element
760 | }
761 |
762 | Updater.prototype.enqueueForceUpdate = function enqueueForceUpdate(
763 | publicInstance,
764 | callback,
765 | callerName
766 | ) {
767 | this._enqueueCallback(callback, publicInstance)
768 | this._renderer._forcedUpdate = true
769 | this._renderer.render(this._renderer._element, this._renderer._context)
770 | }
771 |
772 | Updater.prototype.enqueueReplaceState = function enqueueReplaceState(
773 | publicInstance,
774 | completeState,
775 | callback,
776 | callerName
777 | ) {
778 | this._enqueueCallback(callback, publicInstance)
779 | this._renderer._newState = completeState
780 | this._renderer.render(this._renderer._element, this._renderer._context)
781 | }
782 |
783 | Updater.prototype.enqueueSetState = function enqueueSetState(
784 | publicInstance,
785 | partialState,
786 | callback,
787 | callerName
788 | ) {
789 | this._enqueueCallback(callback, publicInstance)
790 | var currentState = this._renderer._newState || publicInstance.state
791 |
792 | if (typeof partialState === 'function') {
793 | partialState = partialState.call(
794 | publicInstance,
795 | currentState,
796 | publicInstance.props
797 | )
798 | }
799 |
800 | // Null and undefined are treated as no-ops.
801 | if (partialState === null || partialState === undefined) {
802 | return
803 | }
804 |
805 | this._renderer._newState = _assign({}, currentState, partialState)
806 |
807 | this._renderer.render(this._renderer._element, this._renderer._context)
808 | }
809 |
810 | return Updater
811 | })()
812 |
813 | var currentlyValidatingElement = null
814 |
815 | function getDisplayName(element) {
816 | if (element == null) {
817 | return '#empty'
818 | } else if (typeof element === 'string' || typeof element === 'number') {
819 | return '#text'
820 | } else if (typeof element.type === 'string') {
821 | return element.type
822 | } else {
823 | return element.type.displayName || element.type.name || 'Unknown'
824 | }
825 | }
826 |
827 | function getStackAddendum() {
828 | var stack = ''
829 | if (currentlyValidatingElement) {
830 | var name = getDisplayName(currentlyValidatingElement)
831 | var owner = currentlyValidatingElement._owner
832 | stack += describeComponentFrame(
833 | name,
834 | currentlyValidatingElement._source,
835 | owner && getComponentName(owner.type)
836 | )
837 | }
838 | return stack
839 | }
840 |
841 | function getName(type, instance) {
842 | var constructor = instance && instance.constructor
843 | return (
844 | type.displayName ||
845 | (constructor && constructor.displayName) ||
846 | type.name ||
847 | (constructor && constructor.name) ||
848 | null
849 | )
850 | }
851 |
852 | function shouldConstruct(Component) {
853 | return !!(Component.prototype && Component.prototype.isReactComponent)
854 | }
855 |
856 | function getMaskedContext(contextTypes, unmaskedContext) {
857 | if (!contextTypes) {
858 | return emptyObject
859 | }
860 | var context = {}
861 | for (var key in contextTypes) {
862 | context[key] = unmaskedContext[key]
863 | }
864 | return context
865 | }
866 |
867 | var ReactShallowRenderer$2 = Object.freeze({
868 | default: ReactShallowRenderer
869 | })
870 |
871 | var ReactShallowRenderer$3 =
872 | (ReactShallowRenderer$2 && ReactShallowRenderer) || ReactShallowRenderer$2
873 |
874 | // TODO: decide on the top-level export form.
875 | // This is hacky but makes it work with both Rollup and Jest.
876 | var shallow = ReactShallowRenderer$3.default
877 | ? ReactShallowRenderer$3.default
878 | : ReactShallowRenderer$3
879 |
880 | return shallow
881 | })
882 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react-test-renderer-shallow.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react-test-renderer-shallow.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(g, f) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? (module.exports = f(require('react')))
13 | : 'function' === typeof define && define.amd
14 | ? define(['react'], f)
15 | : (g.ReactShallowRenderer = f(g.React))
16 | })(this, function(g) {
17 | function f(a, b, d, c, e, h, g, x) {
18 | if (!a) {
19 | a = void 0
20 | if (void 0 === b)
21 | a = Error(
22 | 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
23 | )
24 | else {
25 | var w = [d, c, e, h, g, x],
26 | f = 0
27 | a = Error(
28 | b.replace(/%s/g, function() {
29 | return w[f++]
30 | })
31 | )
32 | a.name = 'Invariant Violation'
33 | }
34 | a.framesToPop = 1
35 | throw a
36 | }
37 | }
38 | function n(a) {
39 | for (
40 | var b = arguments.length - 1,
41 | d = 'https://reactjs.org/docs/error-decoder.html?invariant=' + a,
42 | c = 0;
43 | c < b;
44 | c++
45 | )
46 | d += '&args[]=' + encodeURIComponent(arguments[c + 1])
47 | f(
48 | !1,
49 | 'Minified React error #' +
50 | a +
51 | '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ',
52 | d
53 | )
54 | }
55 | function q(a) {
56 | if ('object' === typeof a && null !== a) {
57 | var b = a.$$typeof
58 | switch (b) {
59 | case y:
60 | switch (((a = a.type), a)) {
61 | case z:
62 | case A:
63 | case B:
64 | case C:
65 | return a
66 | default:
67 | switch (((a = a && a.$$typeof), a)) {
68 | case D:
69 | case p:
70 | case E:
71 | return a
72 | default:
73 | return b
74 | }
75 | }
76 | case F:
77 | return b
78 | }
79 | }
80 | }
81 | function r(a, b) {
82 | return a === b ? 0 !== a || 0 !== b || 1 / a === 1 / b : a !== a && b !== b
83 | }
84 | function t(a, b) {
85 | if (r(a, b)) return !0
86 | if (
87 | 'object' !== typeof a ||
88 | null === a ||
89 | 'object' !== typeof b ||
90 | null === b
91 | )
92 | return !1
93 | var d = Object.keys(a),
94 | c = Object.keys(b)
95 | if (d.length !== c.length) return !1
96 | for (c = 0; c < d.length; c++)
97 | if (!G.call(b, d[c]) || !r(a[d[c]], b[d[c]])) return !1
98 | return !0
99 | }
100 | function u(a, b) {
101 | if (!(a instanceof b))
102 | throw new TypeError('Cannot call a class as a function')
103 | }
104 | var v = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,
105 | e = 'function' === typeof Symbol && Symbol.for,
106 | y = e ? Symbol.for('react.element') : 60103,
107 | F = e ? Symbol.for('react.portal') : 60106,
108 | A = e ? Symbol.for('react.fragment') : 60107,
109 | C = e ? Symbol.for('react.strict_mode') : 60108,
110 | B = e ? Symbol.for('react.profiler') : 60114,
111 | E = e ? Symbol.for('react.provider') : 60109,
112 | D = e ? Symbol.for('react.context') : 60110,
113 | z = e ? Symbol.for('react.async_mode') : 60111,
114 | p = e ? Symbol.for('react.forward_ref') : 60112
115 | e && Symbol.for('react.placeholder')
116 | var G = Object.prototype.hasOwnProperty,
117 | l = {},
118 | m = (function() {
119 | function a() {
120 | u(this, a)
121 | this._rendered = this._newState = this._instance = this._element = this._context = null
122 | this._forcedUpdate = this._rendering = !1
123 | this._updater = new H(this)
124 | }
125 | a.prototype.getMountedInstance = function() {
126 | return this._instance
127 | }
128 | a.prototype.getRenderOutput = function() {
129 | return this._rendered
130 | }
131 | a.prototype.render = function(b) {
132 | var a =
133 | 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : l
134 | g.isValidElement(b)
135 | ? void 0
136 | : n(
137 | '12',
138 | 'function' === typeof b
139 | ? ' Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.'
140 | : ''
141 | )
142 | 'string' === typeof b.type ? n('13', b.type) : void 0
143 | q(b) !== p && 'function' !== typeof b.type
144 | ? n(
145 | '249',
146 | Array.isArray(b.type)
147 | ? 'array'
148 | : null === b.type
149 | ? 'null'
150 | : typeof b.type
151 | )
152 | : void 0
153 | if (!this._rendering) {
154 | this._rendering = !0
155 | this._element = b
156 | var c = b.type.contextTypes
157 | if (c) {
158 | var e = {},
159 | h
160 | for (h in c) e[h] = a[h]
161 | a = e
162 | } else a = l
163 | this._context = a
164 | this._instance
165 | ? this._updateClassComponent(b, this._context)
166 | : q(b) === p
167 | ? (this._rendered = b.type.render(b.props, b.ref))
168 | : ((a = b.type),
169 | a.prototype && a.prototype.isReactComponent
170 | ? ((this._instance = new b.type(
171 | b.props,
172 | this._context,
173 | this._updater
174 | )),
175 | this._updateStateFromStaticLifecycle(b.props),
176 | b.type.hasOwnProperty('contextTypes'),
177 | this._mountClassComponent(b, this._context))
178 | : (this._rendered = b.type.call(
179 | void 0,
180 | b.props,
181 | this._context
182 | )))
183 | this._rendering = !1
184 | this._updater._invokeCallbacks()
185 | return this.getRenderOutput()
186 | }
187 | }
188 | a.prototype.unmount = function() {
189 | this._instance &&
190 | 'function' === typeof this._instance.componentWillUnmount &&
191 | this._instance.componentWillUnmount()
192 | this._instance = this._rendered = this._newState = this._element = this._context = null
193 | }
194 | a.prototype._mountClassComponent = function(b, a) {
195 | this._instance.context = a
196 | this._instance.props = b.props
197 | this._instance.state = this._instance.state || null
198 | this._instance.updater = this._updater
199 | if (
200 | 'function' === typeof this._instance.UNSAFE_componentWillMount ||
201 | 'function' === typeof this._instance.componentWillMount
202 | )
203 | (a = this._newState),
204 | 'function' !== typeof b.type.getDerivedStateFromProps &&
205 | 'function' !== typeof this._instance.getSnapshotBeforeUpdate &&
206 | ('function' === typeof this._instance.componentWillMount &&
207 | this._instance.componentWillMount(),
208 | 'function' === typeof this._instance.UNSAFE_componentWillMount &&
209 | this._instance.UNSAFE_componentWillMount()),
210 | a !== this._newState && (this._instance.state = this._newState || l)
211 | this._rendered = this._instance.render()
212 | }
213 | a.prototype._updateClassComponent = function(b, a) {
214 | var c = b.props,
215 | d = b.type,
216 | e = this._instance.state || l,
217 | g = this._instance.props
218 | g !== c &&
219 | 'function' !== typeof b.type.getDerivedStateFromProps &&
220 | 'function' !== typeof this._instance.getSnapshotBeforeUpdate &&
221 | ('function' === typeof this._instance.componentWillReceiveProps &&
222 | this._instance.componentWillReceiveProps(c, a),
223 | 'function' ===
224 | typeof this._instance.UNSAFE_componentWillReceiveProps &&
225 | this._instance.UNSAFE_componentWillReceiveProps(c, a))
226 | this._updateStateFromStaticLifecycle(c)
227 | var f = this._newState || e,
228 | k = !0
229 | this._forcedUpdate
230 | ? ((k = !0), (this._forcedUpdate = !1))
231 | : 'function' === typeof this._instance.shouldComponentUpdate
232 | ? (k = !!this._instance.shouldComponentUpdate(c, f, a))
233 | : d.prototype &&
234 | d.prototype.isPureReactComponent &&
235 | (k = !t(g, c) || !t(e, f))
236 | k &&
237 | 'function' !== typeof b.type.getDerivedStateFromProps &&
238 | 'function' !== typeof this._instance.getSnapshotBeforeUpdate &&
239 | ('function' === typeof this._instance.componentWillUpdate &&
240 | this._instance.componentWillUpdate(c, f, a),
241 | 'function' === typeof this._instance.UNSAFE_componentWillUpdate &&
242 | this._instance.UNSAFE_componentWillUpdate(c, f, a))
243 | this._instance.context = a
244 | this._instance.props = c
245 | this._instance.state = f
246 | k && (this._rendered = this._instance.render())
247 | }
248 | a.prototype._updateStateFromStaticLifecycle = function(b) {
249 | var a = this._element.type
250 | if ('function' === typeof a.getDerivedStateFromProps) {
251 | var c = this._newState || this._instance.state
252 | b = a.getDerivedStateFromProps.call(null, b, c)
253 | null != b &&
254 | ((c = v({}, c, b)), (this._instance.state = this._newState = c))
255 | }
256 | }
257 | return a
258 | })()
259 | m.createRenderer = function() {
260 | return new m()
261 | }
262 | var H = (function() {
263 | function a(b) {
264 | u(this, a)
265 | this._renderer = b
266 | this._callbacks = []
267 | }
268 | a.prototype._enqueueCallback = function(a, d) {
269 | 'function' === typeof a &&
270 | d &&
271 | this._callbacks.push({ callback: a, publicInstance: d })
272 | }
273 | a.prototype._invokeCallbacks = function() {
274 | var a = this._callbacks
275 | this._callbacks = []
276 | a.forEach(function(a) {
277 | a.callback.call(a.publicInstance)
278 | })
279 | }
280 | a.prototype.isMounted = function(a) {
281 | return !!this._renderer._element
282 | }
283 | a.prototype.enqueueForceUpdate = function(a, d, c) {
284 | this._enqueueCallback(d, a)
285 | this._renderer._forcedUpdate = !0
286 | this._renderer.render(this._renderer._element, this._renderer._context)
287 | }
288 | a.prototype.enqueueReplaceState = function(a, d, c, e) {
289 | this._enqueueCallback(c, a)
290 | this._renderer._newState = d
291 | this._renderer.render(this._renderer._element, this._renderer._context)
292 | }
293 | a.prototype.enqueueSetState = function(a, d, c, e) {
294 | this._enqueueCallback(c, a)
295 | c = this._renderer._newState || a.state
296 | 'function' === typeof d && (d = d.call(a, c, a.props))
297 | null !== d &&
298 | void 0 !== d &&
299 | ((this._renderer._newState = v({}, c, d)),
300 | this._renderer.render(this._renderer._element, this._renderer._context))
301 | }
302 | return a
303 | })()
304 | e = ((e = { default: m }), m) || e
305 | return e.default ? e.default : e
306 | })
307 |
--------------------------------------------------------------------------------
/design-catalogue/vendor/react.production.min.js:
--------------------------------------------------------------------------------
1 | /** @license React v16.4.1
2 | * react.production.min.js
3 | *
4 | * Copyright (c) 2013-present, Facebook, Inc.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 | 'use strict'
10 | ;(function(r, n) {
11 | 'object' === typeof exports && 'undefined' !== typeof module
12 | ? (module.exports = n())
13 | : 'function' === typeof define && define.amd
14 | ? define(n)
15 | : (r.React = n())
16 | })(this, function() {
17 | function r(a, b, d, c, e, g, k, f) {
18 | if (!a) {
19 | a = void 0
20 | if (void 0 === b)
21 | a = Error(
22 | 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
23 | )
24 | else {
25 | var h = [d, c, e, g, k, f],
26 | l = 0
27 | a = Error(
28 | b.replace(/%s/g, function() {
29 | return h[l++]
30 | })
31 | )
32 | a.name = 'Invariant Violation'
33 | }
34 | a.framesToPop = 1
35 | throw a
36 | }
37 | }
38 | function n(a) {
39 | for (
40 | var b = arguments.length - 1,
41 | d = 'https://reactjs.org/docs/error-decoder.html?invariant=' + a,
42 | c = 0;
43 | c < b;
44 | c++
45 | )
46 | d += '&args[]=' + encodeURIComponent(arguments[c + 1])
47 | r(
48 | !1,
49 | 'Minified React error #' +
50 | a +
51 | '; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ',
52 | d
53 | )
54 | }
55 | function p(a, b, d) {
56 | this.props = a
57 | this.context = b
58 | this.refs = E
59 | this.updater = d || F
60 | }
61 | function G() {}
62 | function v(a, b, d) {
63 | this.props = a
64 | this.context = b
65 | this.refs = E
66 | this.updater = d || F
67 | }
68 | function H(a, b, d) {
69 | var c = void 0,
70 | e = {},
71 | g = null,
72 | k = null
73 | if (null != b)
74 | for (c in (void 0 !== b.ref && (k = b.ref),
75 | void 0 !== b.key && (g = '' + b.key),
76 | b))
77 | I.call(b, c) && !J.hasOwnProperty(c) && (e[c] = b[c])
78 | var f = arguments.length - 2
79 | if (1 === f) e.children = d
80 | else if (1 < f) {
81 | for (var h = Array(f), l = 0; l < f; l++) h[l] = arguments[l + 2]
82 | e.children = h
83 | }
84 | if (a && a.defaultProps)
85 | for (c in ((f = a.defaultProps), f)) void 0 === e[c] && (e[c] = f[c])
86 | return { $$typeof: q, type: a, key: g, ref: k, props: e, _owner: t.current }
87 | }
88 | function P(a, b) {
89 | return {
90 | $$typeof: q,
91 | type: a.type,
92 | key: b,
93 | ref: a.ref,
94 | props: a.props,
95 | _owner: a._owner
96 | }
97 | }
98 | function w(a) {
99 | return 'object' === typeof a && null !== a && a.$$typeof === q
100 | }
101 | function Q(a) {
102 | var b = { '=': '=0', ':': '=2' }
103 | return (
104 | '$' +
105 | ('' + a).replace(/[=:]/g, function(a) {
106 | return b[a]
107 | })
108 | )
109 | }
110 | function K(a, b, d, c) {
111 | if (u.length) {
112 | var e = u.pop()
113 | e.result = a
114 | e.keyPrefix = b
115 | e.func = d
116 | e.context = c
117 | e.count = 0
118 | return e
119 | }
120 | return { result: a, keyPrefix: b, func: d, context: c, count: 0 }
121 | }
122 | function L(a) {
123 | a.result = null
124 | a.keyPrefix = null
125 | a.func = null
126 | a.context = null
127 | a.count = 0
128 | 10 > u.length && u.push(a)
129 | }
130 | function x(a, b, d, c) {
131 | var e = typeof a
132 | if ('undefined' === e || 'boolean' === e) a = null
133 | var g = !1
134 | if (null === a) g = !0
135 | else
136 | switch (e) {
137 | case 'string':
138 | case 'number':
139 | g = !0
140 | break
141 | case 'object':
142 | switch (a.$$typeof) {
143 | case q:
144 | case R:
145 | g = !0
146 | }
147 | }
148 | if (g) return d(c, a, '' === b ? '.' + y(a, 0) : b), 1
149 | g = 0
150 | b = '' === b ? '.' : b + ':'
151 | if (Array.isArray(a))
152 | for (var k = 0; k < a.length; k++) {
153 | e = a[k]
154 | var f = b + y(e, k)
155 | g += x(e, f, d, c)
156 | }
157 | else if (
158 | (null === a || 'undefined' === typeof a
159 | ? (f = null)
160 | : ((f = (M && a[M]) || a['@@iterator']),
161 | (f = 'function' === typeof f ? f : null)),
162 | 'function' === typeof f)
163 | )
164 | for (a = f.call(a), k = 0; !(e = a.next()).done; )
165 | (e = e.value), (f = b + y(e, k++)), (g += x(e, f, d, c))
166 | else
167 | 'object' === e &&
168 | ((d = '' + a),
169 | n(
170 | '31',
171 | '[object Object]' === d
172 | ? 'object with keys {' + Object.keys(a).join(', ') + '}'
173 | : d,
174 | ''
175 | ))
176 | return g
177 | }
178 | function z(a, b, d) {
179 | return null == a ? 0 : x(a, '', b, d)
180 | }
181 | function y(a, b) {
182 | return 'object' === typeof a && null !== a && null != a.key
183 | ? Q(a.key)
184 | : b.toString(36)
185 | }
186 | function S(a, b, d) {
187 | a.func.call(a.context, b, a.count++)
188 | }
189 | function T(a, b, d) {
190 | var c = a.result,
191 | e = a.keyPrefix
192 | a = a.func.call(a.context, b, a.count++)
193 | Array.isArray(a)
194 | ? A(a, c, d, function(a) {
195 | return a
196 | })
197 | : null != a &&
198 | (w(a) &&
199 | (a = P(
200 | a,
201 | e +
202 | (!a.key || (b && b.key === a.key)
203 | ? ''
204 | : ('' + a.key).replace(N, '$&/') + '/') +
205 | d
206 | )),
207 | c.push(a))
208 | }
209 | function A(a, b, d, c, e) {
210 | var g = ''
211 | null != d && (g = ('' + d).replace(N, '$&/') + '/')
212 | b = K(b, g, c, e)
213 | z(a, T, b)
214 | L(b)
215 | }
216 | function U(a, b) {
217 | var d = t.currentDispatcher
218 | null === d
219 | ? r(
220 | !1,
221 | 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.'
222 | )
223 | : void 0
224 | return d.readContext(a, b)
225 | }
226 | var h = 'function' === typeof Symbol && Symbol.for,
227 | q = h ? Symbol.for('react.element') : 60103,
228 | R = h ? Symbol.for('react.portal') : 60106,
229 | m = h ? Symbol.for('react.fragment') : 60107,
230 | B = h ? Symbol.for('react.strict_mode') : 60108,
231 | V = h ? Symbol.for('react.profiler') : 60114,
232 | W = h ? Symbol.for('react.provider') : 60109,
233 | X = h ? Symbol.for('react.context') : 60110,
234 | Y = h ? Symbol.for('react.async_mode') : 60111,
235 | Z = h ? Symbol.for('react.forward_ref') : 60112
236 | h = h ? Symbol.for('react.placeholder') : 60113
237 | var M = 'function' === typeof Symbol && Symbol.iterator,
238 | O = Object.getOwnPropertySymbols,
239 | aa = Object.prototype.hasOwnProperty,
240 | ba = Object.prototype.propertyIsEnumerable,
241 | C = (function() {
242 | try {
243 | if (!Object.assign) return !1
244 | var a = new String('abc')
245 | a[5] = 'de'
246 | if ('5' === Object.getOwnPropertyNames(a)[0]) return !1
247 | var b = {}
248 | for (a = 0; 10 > a; a++) b['_' + String.fromCharCode(a)] = a
249 | if (
250 | '0123456789' !==
251 | Object.getOwnPropertyNames(b)
252 | .map(function(a) {
253 | return b[a]
254 | })
255 | .join('')
256 | )
257 | return !1
258 | var d = {}
259 | 'abcdefghijklmnopqrst'.split('').forEach(function(a) {
260 | d[a] = a
261 | })
262 | return 'abcdefghijklmnopqrst' !==
263 | Object.keys(Object.assign({}, d)).join('')
264 | ? !1
265 | : !0
266 | } catch (c) {
267 | return !1
268 | }
269 | })()
270 | ? Object.assign
271 | : function(a, b) {
272 | if (null === a || void 0 === a)
273 | throw new TypeError(
274 | 'Object.assign cannot be called with null or undefined'
275 | )
276 | var d = Object(a)
277 | for (var c, e = 1; e < arguments.length; e++) {
278 | var g = Object(arguments[e])
279 | for (var k in g) aa.call(g, k) && (d[k] = g[k])
280 | if (O) {
281 | c = O(g)
282 | for (var f = 0; f < c.length; f++)
283 | ba.call(g, c[f]) && (d[c[f]] = g[c[f]])
284 | }
285 | }
286 | return d
287 | },
288 | F = {
289 | isMounted: function(a) {
290 | return !1
291 | },
292 | enqueueForceUpdate: function(a, b, d) {},
293 | enqueueReplaceState: function(a, b, d, c) {},
294 | enqueueSetState: function(a, b, d, c) {}
295 | },
296 | E = {}
297 | p.prototype.isReactComponent = {}
298 | p.prototype.setState = function(a, b) {
299 | 'object' !== typeof a && 'function' !== typeof a && null != a
300 | ? n('85')
301 | : void 0
302 | this.updater.enqueueSetState(this, a, b, 'setState')
303 | }
304 | p.prototype.forceUpdate = function(a) {
305 | this.updater.enqueueForceUpdate(this, a, 'forceUpdate')
306 | }
307 | G.prototype = p.prototype
308 | var D = (v.prototype = new G())
309 | D.constructor = v
310 | C(D, p.prototype)
311 | D.isPureReactComponent = !0
312 | var t = { current: null, currentDispatcher: null },
313 | I = Object.prototype.hasOwnProperty,
314 | J = { key: !0, ref: !0, __self: !0, __source: !0 },
315 | N = /\/+/g,
316 | u = []
317 | m = {
318 | Children: {
319 | map: function(a, b, d) {
320 | if (null == a) return a
321 | var c = []
322 | A(a, c, null, b, d)
323 | return c
324 | },
325 | forEach: function(a, b, d) {
326 | if (null == a) return a
327 | b = K(null, null, b, d)
328 | z(a, S, b)
329 | L(b)
330 | },
331 | count: function(a) {
332 | return z(
333 | a,
334 | function() {
335 | return null
336 | },
337 | null
338 | )
339 | },
340 | toArray: function(a) {
341 | var b = []
342 | A(a, b, null, function(a) {
343 | return a
344 | })
345 | return b
346 | },
347 | only: function(a) {
348 | w(a) ? void 0 : n('143')
349 | return a
350 | }
351 | },
352 | createRef: function() {
353 | return { current: null }
354 | },
355 | Component: p,
356 | PureComponent: v,
357 | createContext: function(a, b) {
358 | void 0 === b && (b = null)
359 | a = {
360 | $$typeof: X,
361 | _calculateChangedBits: b,
362 | _defaultValue: a,
363 | _currentValue: a,
364 | _currentValue2: a,
365 | _changedBits: 0,
366 | _changedBits2: 0,
367 | Provider: null,
368 | Consumer: null,
369 | unstable_read: null
370 | }
371 | a.Provider = {
372 | $$typeof: W,
373 | _context: a
374 | }
375 | a.Consumer = a
376 | a.unstable_read = U.bind(null, a)
377 | return a
378 | },
379 | forwardRef: function(a) {
380 | return { $$typeof: Z, render: a }
381 | },
382 | Fragment: m,
383 | StrictMode: B,
384 | unstable_AsyncMode: Y,
385 | unstable_Profiler: V,
386 | createElement: H,
387 | cloneElement: function(a, b, d) {
388 | null === a || void 0 === a ? n('267', a) : void 0
389 | var c = void 0,
390 | e = C({}, a.props),
391 | g = a.key,
392 | k = a.ref,
393 | f = a._owner
394 | if (null != b) {
395 | void 0 !== b.ref && ((k = b.ref), (f = t.current))
396 | void 0 !== b.key && (g = '' + b.key)
397 | var h = void 0
398 | a.type && a.type.defaultProps && (h = a.type.defaultProps)
399 | for (c in b)
400 | I.call(b, c) &&
401 | !J.hasOwnProperty(c) &&
402 | (e[c] = void 0 === b[c] && void 0 !== h ? h[c] : b[c])
403 | }
404 | c = arguments.length - 2
405 | if (1 === c) e.children = d
406 | else if (1 < c) {
407 | h = Array(c)
408 | for (var l = 0; l < c; l++) h[l] = arguments[l + 2]
409 | e.children = h
410 | }
411 | return { $$typeof: q, type: a.type, key: g, ref: k, props: e, _owner: f }
412 | },
413 | createFactory: function(a) {
414 | var b = H.bind(null, a)
415 | b.type = a
416 | return b
417 | },
418 | isValidElement: w,
419 | version: '16.4.1',
420 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
421 | ReactCurrentOwner: t,
422 | assign: C
423 | }
424 | }
425 | m.Placeholder = h
426 | m = ((B = { default: m }), m) || B
427 | return m.default ? m.default : m
428 | })
429 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "generative-design",
3 | "description": "Catalogue of generative art",
4 | "author": "Nitin Tulswani",
5 | "license": "MIT",
6 | "dependencies": {
7 | "emotion": "^9.2.6",
8 | "react-emotion": "^9.2.6",
9 | "react-responsive-modal": "^3.2.0",
10 | "react-router-dom": "^4.3.1",
11 | "simple-cache-provider": "^0.7.0",
12 | "svg-to-image": "^1.1.3",
13 | "two.js": "^0.7.0-alpha.1"
14 | },
15 | "devDependencies": {
16 | "babel-core": "^6.26.3",
17 | "babel-plugin-external-helpers": "^6.22.0",
18 | "babel-plugin-syntax-dynamic-import": "^6.18.0",
19 | "babel-plugin-transform-class-properties": "^6.24.1",
20 | "babel-plugin-transform-object-rest-spread": "^6.26.0",
21 | "babel-preset-env": "^1.7.0",
22 | "babel-preset-react": "^6.24.1",
23 | "babel-preset-react-app": "^3.1.2",
24 | "husky": "^1.0.0-rc.13",
25 | "lerna": "^3.1.4",
26 | "lint-staged": "^7.2.0",
27 | "parcel-bundler": "^1.9.7",
28 | "prettier": "^1.14.2"
29 | },
30 | "scripts": {
31 | "start": "parcel ./design-catalogue/public/index.html",
32 | "build": "NODE_ENV=production parcel build ./design-catalogue/src/index.js",
33 | "deploy": "yarn build && surge"
34 | },
35 | "husky": {
36 | "hooks": {
37 | "pre-commit": "lint-staged"
38 | }
39 | },
40 | "lint-staged": {
41 | "*.{js,json,css,md}": [
42 | "./node_modules/.bin/prettier --write --no-semi --single-quote",
43 | "git add"
44 | ]
45 | },
46 | "alias": {
47 | "react": "./design-catalogue/vendor/react.production.min.js",
48 | "react-dom": "./design-catalogue/vendor/react-dom.production.min.js"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------