@pareto-engineering/design-system 4.0.0-alpha.4 → 4.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/cjs/a/AnimatedBlobs/AnimatedBlobs.js +90 -0
  2. package/dist/cjs/a/AnimatedBlobs/index.js +13 -0
  3. package/dist/cjs/a/AnimatedBlobs/styles.scss +87 -0
  4. package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +56 -0
  5. package/dist/cjs/a/AnimatedGradient/index.js +13 -0
  6. package/dist/cjs/a/AnimatedGradient/styles.scss +14 -0
  7. package/dist/cjs/a/AnimatedGradient/webGIRenderer.js +528 -0
  8. package/dist/cjs/a/ContentTree/ContentTree.js +2 -2
  9. package/dist/cjs/a/Conversation/Conversation.js +1 -1
  10. package/dist/cjs/a/DotInfo/DotInfo.js +1 -1
  11. package/dist/cjs/a/Figure/Figure.js +1 -1
  12. package/dist/cjs/a/HamburgerButton/HamburgerButton.js +1 -1
  13. package/dist/cjs/a/IconList/IconList.js +1 -1
  14. package/dist/cjs/a/Label/Label.js +13 -5
  15. package/dist/cjs/a/Label/styles.scss +1 -1
  16. package/dist/cjs/a/LoadingCircle/LoadingCircle.js +1 -1
  17. package/dist/cjs/a/MetaCard/MetaCard.js +60 -0
  18. package/dist/cjs/a/MetaCard/index.js +13 -0
  19. package/dist/cjs/a/MetaCard/styles.scss +28 -0
  20. package/dist/cjs/a/People/People.js +1 -1
  21. package/dist/cjs/a/Popover/Popover.js +2 -2
  22. package/dist/cjs/a/ProgressBar/ProgressBar.js +1 -1
  23. package/dist/cjs/a/Quote/Quote.js +1 -1
  24. package/dist/cjs/a/SVG/SVG.js +1 -1
  25. package/dist/cjs/a/SnapScroller/SnapScroller.js +1 -1
  26. package/dist/cjs/a/SnapScroller/styles.scss +18 -10
  27. package/dist/cjs/a/Spinner/Spinner.js +1 -1
  28. package/dist/cjs/a/TextSteps/TextSteps.js +70 -0
  29. package/dist/cjs/a/TextSteps/index.js +13 -0
  30. package/dist/cjs/a/TextSteps/styles.scss +29 -0
  31. package/dist/cjs/a/Timestamp/Timestamp.js +1 -1
  32. package/dist/cjs/a/Tip/Tip.js +72 -0
  33. package/dist/cjs/a/Tip/index.js +13 -0
  34. package/dist/cjs/a/Tip/styles.scss +22 -0
  35. package/dist/cjs/a/index.js +36 -1
  36. package/dist/cjs/b/Button/Button.js +2 -1
  37. package/dist/cjs/b/Button/styles.scss +2 -0
  38. package/dist/cjs/b/Card/Card.js +74 -0
  39. package/dist/cjs/b/Card/common/Group/Group.js +73 -0
  40. package/dist/cjs/b/Card/common/Group/index.js +13 -0
  41. package/dist/cjs/b/Card/common/Group/styles.scss +42 -0
  42. package/dist/cjs/b/Card/common/Section/Section.js +59 -0
  43. package/dist/cjs/b/Card/common/Section/index.js +13 -0
  44. package/dist/cjs/b/Card/common/index.js +19 -0
  45. package/dist/cjs/b/Card/index.js +13 -0
  46. package/dist/cjs/b/Card/styles.scss +46 -0
  47. package/dist/cjs/b/Logo/Logo.js +1 -1
  48. package/dist/cjs/b/Page/Page.js +10 -3
  49. package/dist/cjs/b/Page/common/Section/Section.js +6 -1
  50. package/dist/cjs/b/Page/styles.scss +22 -4
  51. package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +1 -1
  52. package/dist/cjs/b/SocialMediaButton/styles.scss +1 -1
  53. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +1 -1
  54. package/dist/cjs/b/Title/Title.js +4 -1
  55. package/dist/cjs/b/index.js +8 -1
  56. package/dist/cjs/c/ContentSlides/ContentSlides.js +2 -2
  57. package/dist/cjs/c/Modal/Modal.js +1 -1
  58. package/dist/cjs/c/Modal/styles.scss +2 -1
  59. package/dist/cjs/c/Shortener/Shortener.js +1 -1
  60. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -1
  61. package/dist/cjs/f/FormInput/FormInput.js +1 -1
  62. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  63. package/dist/cjs/f/common/Description/Description.js +1 -1
  64. package/dist/cjs/f/common/Label/Label.js +1 -1
  65. package/dist/cjs/f/fields/Checkbox/Checkbox.js +1 -1
  66. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +16 -8
  67. package/dist/cjs/f/fields/ChoicesInput/styles.scss +21 -33
  68. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +1 -1
  69. package/dist/cjs/f/fields/QueryCombobox/styles.scss +5 -4
  70. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +1 -1
  71. package/dist/cjs/f/fields/SelectInput/SelectInput.js +3 -3
  72. package/dist/cjs/f/fields/SelectInput/styles.scss +31 -21
  73. package/dist/cjs/f/fields/TextInput/TextInput.js +5 -3
  74. package/dist/cjs/f/fields/TextInput/styles.scss +26 -17
  75. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -1
  76. package/dist/es/a/AnimatedBlobs/AnimatedBlobs.js +82 -0
  77. package/dist/es/a/AnimatedBlobs/index.js +1 -0
  78. package/dist/es/a/AnimatedBlobs/styles.scss +87 -0
  79. package/dist/es/a/AnimatedGradient/AnimatedGradient.js +48 -0
  80. package/dist/es/a/AnimatedGradient/index.js +1 -0
  81. package/dist/es/a/AnimatedGradient/styles.scss +14 -0
  82. package/dist/es/a/AnimatedGradient/webGIRenderer.js +492 -0
  83. package/dist/es/a/ContentTree/ContentTree.js +3 -3
  84. package/dist/es/a/Conversation/Conversation.js +2 -2
  85. package/dist/es/a/DotInfo/DotInfo.js +2 -2
  86. package/dist/es/a/Figure/Figure.js +2 -2
  87. package/dist/es/a/HamburgerButton/HamburgerButton.js +2 -2
  88. package/dist/es/a/IconList/IconList.js +2 -2
  89. package/dist/es/a/Label/Label.js +14 -6
  90. package/dist/es/a/Label/styles.scss +1 -1
  91. package/dist/es/a/LoadingCircle/LoadingCircle.js +2 -2
  92. package/dist/es/a/MetaCard/MetaCard.js +52 -0
  93. package/dist/es/a/MetaCard/index.js +1 -0
  94. package/dist/es/a/MetaCard/styles.scss +28 -0
  95. package/dist/es/a/People/People.js +2 -2
  96. package/dist/es/a/Popover/Popover.js +3 -3
  97. package/dist/es/a/ProgressBar/ProgressBar.js +2 -2
  98. package/dist/es/a/Quote/Quote.js +2 -2
  99. package/dist/es/a/SVG/SVG.js +2 -2
  100. package/dist/es/a/SnapScroller/SnapScroller.js +2 -2
  101. package/dist/es/a/SnapScroller/styles.scss +18 -10
  102. package/dist/es/a/Spinner/Spinner.js +2 -2
  103. package/dist/es/a/TextSteps/TextSteps.js +61 -0
  104. package/dist/es/a/TextSteps/index.js +1 -0
  105. package/dist/es/a/TextSteps/styles.scss +29 -0
  106. package/dist/es/a/Timestamp/Timestamp.js +2 -2
  107. package/dist/es/a/Tip/Tip.js +64 -0
  108. package/dist/es/a/Tip/index.js +2 -0
  109. package/dist/es/a/Tip/styles.scss +22 -0
  110. package/dist/es/a/index.js +6 -1
  111. package/dist/es/b/Button/Button.js +2 -1
  112. package/dist/es/b/Button/styles.scss +2 -0
  113. package/dist/es/b/Card/Card.js +66 -0
  114. package/dist/es/b/Card/common/Group/Group.js +65 -0
  115. package/dist/es/b/Card/common/Group/index.js +1 -0
  116. package/dist/es/b/Card/common/Group/styles.scss +42 -0
  117. package/dist/es/b/Card/common/Section/Section.js +48 -0
  118. package/dist/es/b/Card/common/Section/index.js +1 -0
  119. package/dist/es/b/Card/common/index.js +2 -0
  120. package/dist/es/b/Card/index.js +1 -0
  121. package/dist/es/b/Card/styles.scss +46 -0
  122. package/dist/es/b/Logo/Logo.js +2 -2
  123. package/dist/es/b/Page/Page.js +11 -4
  124. package/dist/es/b/Page/common/Section/Section.js +6 -1
  125. package/dist/es/b/Page/styles.scss +22 -4
  126. package/dist/es/b/SocialMediaButton/SocialMediaButton.js +2 -2
  127. package/dist/es/b/SocialMediaButton/styles.scss +1 -1
  128. package/dist/es/b/ThemeSelector/ThemeSelector.js +2 -2
  129. package/dist/es/b/Title/Title.js +18 -12
  130. package/dist/es/b/index.js +2 -1
  131. package/dist/es/c/ContentSlides/ContentSlides.js +3 -3
  132. package/dist/es/c/Modal/Modal.js +2 -2
  133. package/dist/es/c/Modal/styles.scss +2 -1
  134. package/dist/es/c/Shortener/Shortener.js +2 -2
  135. package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +2 -2
  136. package/dist/es/f/FormInput/FormInput.js +2 -2
  137. package/dist/es/f/common/Debugger/Debugger.js +2 -2
  138. package/dist/es/f/common/Description/Description.js +2 -2
  139. package/dist/es/f/common/Label/Label.js +2 -2
  140. package/dist/es/f/fields/Checkbox/Checkbox.js +2 -2
  141. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +18 -10
  142. package/dist/es/f/fields/ChoicesInput/styles.scss +21 -33
  143. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +2 -2
  144. package/dist/es/f/fields/QueryCombobox/styles.scss +5 -4
  145. package/dist/es/f/fields/RatingsInput/RatingsInput.js +2 -2
  146. package/dist/es/f/fields/SelectInput/SelectInput.js +4 -4
  147. package/dist/es/f/fields/SelectInput/styles.scss +31 -21
  148. package/dist/es/f/fields/TextInput/TextInput.js +6 -4
  149. package/dist/es/f/fields/TextInput/styles.scss +26 -17
  150. package/dist/es/f/fields/TextareaInput/TextareaInput.js +2 -2
  151. package/package.json +16 -16
  152. package/src/stories/a/MetaCard.stories.jsx +35 -0
  153. package/src/stories/a/TextSteps.stories.jsx +19 -0
  154. package/src/stories/a/Tip.stories.jsx +28 -0
  155. package/src/stories/b/Card/Card.stories.jsx +59 -0
  156. package/src/stories/b/Card/Group.stories.jsx +59 -0
  157. package/src/stories/b/Page.stories.jsx +19 -3
  158. package/src/stories/f/SelectInput.stories.jsx +7 -0
  159. package/src/stories/f/TextInput.stories.jsx +4 -4
  160. package/src/ui/a/AnimatedBlobs/AnimatedBlobs.jsx +102 -0
  161. package/src/ui/a/AnimatedBlobs/index.js +1 -0
  162. package/src/ui/a/AnimatedBlobs/styles.scss +87 -0
  163. package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +69 -0
  164. package/src/ui/a/AnimatedGradient/index.js +1 -0
  165. package/src/ui/a/AnimatedGradient/styles.scss +14 -0
  166. package/src/ui/a/AnimatedGradient/webGIRenderer.js +541 -0
  167. package/src/ui/a/ContentTree/ContentTree.jsx +3 -3
  168. package/src/ui/a/Conversation/Conversation.jsx +2 -2
  169. package/src/ui/a/DotInfo/DotInfo.jsx +2 -2
  170. package/src/ui/a/Figure/Figure.jsx +2 -2
  171. package/src/ui/a/HamburgerButton/HamburgerButton.jsx +2 -2
  172. package/src/ui/a/IconList/IconList.jsx +2 -2
  173. package/src/ui/a/Label/Label.jsx +13 -4
  174. package/src/ui/a/Label/styles.scss +1 -1
  175. package/src/ui/a/LoadingCircle/LoadingCircle.jsx +2 -2
  176. package/src/ui/a/MetaCard/MetaCard.jsx +74 -0
  177. package/src/ui/a/MetaCard/index.js +1 -0
  178. package/src/ui/a/MetaCard/styles.scss +28 -0
  179. package/src/ui/a/People/People.jsx +2 -2
  180. package/src/ui/a/Popover/Popover.jsx +3 -3
  181. package/src/ui/a/ProgressBar/ProgressBar.jsx +2 -2
  182. package/src/ui/a/Quote/Quote.jsx +2 -2
  183. package/src/ui/a/SVG/SVG.jsx +2 -2
  184. package/src/ui/a/SnapScroller/SnapScroller.jsx +2 -2
  185. package/src/ui/a/SnapScroller/styles.scss +18 -10
  186. package/src/ui/a/Spinner/Spinner.jsx +2 -2
  187. package/src/ui/a/TextSteps/TextSteps.jsx +87 -0
  188. package/src/ui/a/TextSteps/index.js +1 -0
  189. package/src/ui/a/TextSteps/styles.scss +29 -0
  190. package/src/ui/a/Timestamp/Timestamp.jsx +2 -2
  191. package/src/ui/a/Tip/Tip.jsx +88 -0
  192. package/src/ui/a/Tip/index.js +2 -0
  193. package/src/ui/a/Tip/styles.scss +22 -0
  194. package/src/ui/a/index.js +5 -0
  195. package/src/ui/b/Button/Button.jsx +2 -1
  196. package/src/ui/b/Button/styles.scss +2 -0
  197. package/src/ui/b/Card/Card.jsx +94 -0
  198. package/src/ui/b/Card/common/Group/Group.jsx +91 -0
  199. package/src/ui/b/Card/common/Group/index.js +1 -0
  200. package/src/ui/b/Card/common/Group/styles.scss +42 -0
  201. package/src/ui/b/Card/common/Section/Section.jsx +70 -0
  202. package/src/ui/b/Card/common/Section/index.js +1 -0
  203. package/src/ui/b/Card/common/index.js +2 -0
  204. package/src/ui/b/Card/index.js +1 -0
  205. package/src/ui/b/Card/styles.scss +46 -0
  206. package/src/ui/b/Logo/Logo.jsx +2 -2
  207. package/src/ui/b/Page/Page.jsx +9 -3
  208. package/src/ui/b/Page/common/Section/Section.jsx +8 -0
  209. package/src/ui/b/Page/styles.scss +22 -4
  210. package/src/ui/b/SocialMediaButton/SocialMediaButton.jsx +2 -2
  211. package/src/ui/b/SocialMediaButton/styles.scss +1 -1
  212. package/src/ui/b/ThemeSelector/ThemeSelector.jsx +2 -2
  213. package/src/ui/b/Title/Title.jsx +30 -23
  214. package/src/ui/b/index.js +1 -0
  215. package/src/ui/c/ContentSlides/ContentSlides.jsx +3 -3
  216. package/src/ui/c/Modal/Modal.jsx +2 -2
  217. package/src/ui/c/Modal/styles.scss +2 -1
  218. package/src/ui/c/Shortener/Shortener.jsx +2 -2
  219. package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +2 -2
  220. package/src/ui/f/FormInput/FormInput.jsx +2 -2
  221. package/src/ui/f/common/Debugger/Debugger.jsx +2 -2
  222. package/src/ui/f/common/Description/Description.jsx +2 -2
  223. package/src/ui/f/common/Label/Label.jsx +2 -2
  224. package/src/ui/f/fields/Checkbox/Checkbox.jsx +2 -2
  225. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +12 -7
  226. package/src/ui/f/fields/ChoicesInput/styles.scss +21 -33
  227. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +2 -2
  228. package/src/ui/f/fields/QueryCombobox/styles.scss +5 -4
  229. package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +2 -2
  230. package/src/ui/f/fields/SelectInput/SelectInput.jsx +4 -4
  231. package/src/ui/f/fields/SelectInput/styles.scss +31 -21
  232. package/src/ui/f/fields/TextInput/TextInput.jsx +13 -11
  233. package/src/ui/f/fields/TextInput/styles.scss +26 -17
  234. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +2 -2
  235. package/tests/__snapshots__/Storyshots.test.js.snap +1049 -485
@@ -0,0 +1,528 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Gradient = void 0;
7
+ /* eslint-disable */
8
+ /*
9
+ * Stripe WebGl Gradient Animation
10
+ * All Credits to Stripe.com
11
+ * ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
12
+ * commented out for now.
13
+ * https://kevinhufnagl.com
14
+ */
15
+
16
+ // Converting colors to proper format
17
+ function normalizeColor(hexCode) {
18
+ return [(hexCode >> 16 & 255) / 255, (hexCode >> 8 & 255) / 255, (255 & hexCode) / 255];
19
+ }
20
+ ['SCREEN', 'LINEAR_LIGHT'].reduce((hexCode, t, n) => Object.assign(hexCode, {
21
+ [t]: n
22
+ }), {});
23
+
24
+ // Essential functionality of WebGl
25
+ // t = width
26
+ // n = height
27
+ class MiniGl {
28
+ constructor(canvas, width, height) {
29
+ let debug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
30
+ const _miniGl = this;
31
+ const debug_output = document.location.search.toLowerCase().indexOf('debug=webgl') !== -1;
32
+ _miniGl.canvas = canvas, _miniGl.gl = _miniGl.canvas.getContext('webgl', {
33
+ antialias: true
34
+ }), _miniGl.meshes = [];
35
+ const context = _miniGl.gl;
36
+ width && height && this.setSize(width, height), _miniGl.lastDebugMsg, _miniGl.debug = debug && debug_output ? function (e) {
37
+ const t = new Date();
38
+ t - _miniGl.lastDebugMsg > 1e3 && console.log('---'), console.log(`${t.toLocaleTimeString() + Array(Math.max(0, 32 - e.length)).join(' ') + e}: `, ...Array.from(arguments).slice(1)), _miniGl.lastDebugMsg = t;
39
+ } : () => {}, Object.defineProperties(_miniGl, {
40
+ Material: {
41
+ enumerable: false,
42
+ value: class {
43
+ constructor(vertexShaders, fragments) {
44
+ let uniforms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
45
+ const material = this;
46
+ function getShaderByType(type, source) {
47
+ const shader = context.createShader(type);
48
+ return context.shaderSource(shader, source), context.compileShader(shader), context.getShaderParameter(shader, context.COMPILE_STATUS) || console.error(context.getShaderInfoLog(shader)), _miniGl.debug('Material.compileShaderSource', {
49
+ source
50
+ }), shader;
51
+ }
52
+ function getUniformVariableDeclarations(uniforms, type) {
53
+ return Object.entries(uniforms).map(_ref => {
54
+ let [uniform, value] = _ref;
55
+ return value.getDeclaration(uniform, type);
56
+ }).join('\n');
57
+ }
58
+ material.uniforms = uniforms, material.uniformInstances = [];
59
+ const prefix = '\n precision highp float;\n ';
60
+ material.vertexSource = `\n ${prefix}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${getUniformVariableDeclarations(_miniGl.commonUniforms, 'vertex')}\n ${getUniformVariableDeclarations(uniforms, 'vertex')}\n ${vertexShaders}\n `, material.Source = `\n ${prefix}\n ${getUniformVariableDeclarations(_miniGl.commonUniforms, 'fragment')}\n ${getUniformVariableDeclarations(uniforms, 'fragment')}\n ${fragments}\n `, material.vertexShader = getShaderByType(context.VERTEX_SHADER, material.vertexSource), material.fragmentShader = getShaderByType(context.FRAGMENT_SHADER, material.Source), material.program = context.createProgram(), context.attachShader(material.program, material.vertexShader), context.attachShader(material.program, material.fragmentShader), context.linkProgram(material.program), context.getProgramParameter(material.program, context.LINK_STATUS) || console.error(context.getProgramInfoLog(material.program)), context.useProgram(material.program), material.attachUniforms(void 0, _miniGl.commonUniforms), material.attachUniforms(void 0, material.uniforms);
61
+ }
62
+
63
+ // t = uniform
64
+ attachUniforms(name, uniforms) {
65
+ // n = material
66
+ const material = this;
67
+ void 0 === name ? Object.entries(uniforms).forEach(_ref2 => {
68
+ let [name, uniform] = _ref2;
69
+ material.attachUniforms(name, uniform);
70
+ }) : uniforms.type == 'array' ? uniforms.value.forEach((uniform, i) => material.attachUniforms(`${name}[${i}]`, uniform)) : uniforms.type == 'struct' ? Object.entries(uniforms.value).forEach(_ref3 => {
71
+ let [uniform, i] = _ref3;
72
+ return material.attachUniforms(`${name}.${uniform}`, i);
73
+ }) : (_miniGl.debug('Material.attachUniforms', {
74
+ name,
75
+ uniform: uniforms
76
+ }), material.uniformInstances.push({
77
+ uniform: uniforms,
78
+ location: context.getUniformLocation(material.program, name)
79
+ }));
80
+ }
81
+ }
82
+ },
83
+ Uniform: {
84
+ enumerable: !1,
85
+ value: class {
86
+ constructor(e) {
87
+ this.type = 'float', Object.assign(this, e);
88
+ this.typeFn = {
89
+ float: '1f',
90
+ int: '1i',
91
+ vec2: '2fv',
92
+ vec3: '3fv',
93
+ vec4: '4fv',
94
+ mat4: 'Matrix4fv'
95
+ }[this.type] || '1f', this.update();
96
+ }
97
+ update(value) {
98
+ void 0 !== this.value && context[`uniform${this.typeFn}`](value, this.typeFn.indexOf('Matrix') === 0 ? this.transpose : this.value, this.typeFn.indexOf('Matrix') === 0 ? this.value : null);
99
+ }
100
+
101
+ // e - name
102
+ // t - type
103
+ // n - length
104
+ getDeclaration(name, type, length) {
105
+ const uniform = this;
106
+ if (uniform.excludeFrom !== type) {
107
+ if (uniform.type === 'array') return `${uniform.value[0].getDeclaration(name, type, uniform.value.length)}\nconst int ${name}_length = ${uniform.value.length};`;
108
+ if (uniform.type === 'struct') {
109
+ let name_no_prefix = name.replace('u_', '');
110
+ return name_no_prefix = name_no_prefix.charAt(0).toUpperCase() + name_no_prefix.slice(1), `uniform struct ${name_no_prefix}
111
+ {\n${Object.entries(uniform.value).map(_ref4 => {
112
+ let [name, uniform] = _ref4;
113
+ return uniform.getDeclaration(name, type).replace(/^uniform/, '');
114
+ }).join('')}\n} ${name}${length > 0 ? `[${length}]` : ''};`;
115
+ }
116
+ return `uniform ${uniform.type} ${name}${length > 0 ? `[${length}]` : ''};`;
117
+ }
118
+ }
119
+ }
120
+ },
121
+ PlaneGeometry: {
122
+ enumerable: !1,
123
+ value: class {
124
+ constructor(width, height, n, i, orientation) {
125
+ context.createBuffer(), this.attributes = {
126
+ position: new _miniGl.Attribute({
127
+ target: context.ARRAY_BUFFER,
128
+ size: 3
129
+ }),
130
+ uv: new _miniGl.Attribute({
131
+ target: context.ARRAY_BUFFER,
132
+ size: 2
133
+ }),
134
+ uvNorm: new _miniGl.Attribute({
135
+ target: context.ARRAY_BUFFER,
136
+ size: 2
137
+ }),
138
+ index: new _miniGl.Attribute({
139
+ target: context.ELEMENT_ARRAY_BUFFER,
140
+ size: 3,
141
+ type: context.UNSIGNED_SHORT
142
+ })
143
+ }, this.setTopology(n, i), this.setSize(width, height, orientation);
144
+ }
145
+ setTopology() {
146
+ let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
147
+ let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
148
+ const n = this;
149
+ n.xSegCount = e, n.ySegCount = t, n.vertexCount = (n.xSegCount + 1) * (n.ySegCount + 1), n.quadCount = n.xSegCount * n.ySegCount * 2, n.attributes.uv.values = new Float32Array(2 * n.vertexCount), n.attributes.uvNorm.values = new Float32Array(2 * n.vertexCount), n.attributes.index.values = new Uint16Array(3 * n.quadCount);
150
+ for (let e = 0; e <= n.ySegCount; e++) {
151
+ for (let t = 0; t <= n.xSegCount; t++) {
152
+ const i = e * (n.xSegCount + 1) + t;
153
+ if (n.attributes.uv.values[2 * i] = t / n.xSegCount, n.attributes.uv.values[2 * i + 1] = 1 - e / n.ySegCount, n.attributes.uvNorm.values[2 * i] = t / n.xSegCount * 2 - 1, n.attributes.uvNorm.values[2 * i + 1] = 1 - e / n.ySegCount * 2, t < n.xSegCount && e < n.ySegCount) {
154
+ const s = e * n.xSegCount + t;
155
+ n.attributes.index.values[6 * s] = i, n.attributes.index.values[6 * s + 1] = i + 1 + n.xSegCount, n.attributes.index.values[6 * s + 2] = i + 1, n.attributes.index.values[6 * s + 3] = i + 1, n.attributes.index.values[6 * s + 4] = i + 1 + n.xSegCount, n.attributes.index.values[6 * s + 5] = i + 2 + n.xSegCount;
156
+ }
157
+ }
158
+ }
159
+ n.attributes.uv.update(), n.attributes.uvNorm.update(), n.attributes.index.update(), _miniGl.debug('Geometry.setTopology', {
160
+ uv: n.attributes.uv,
161
+ uvNorm: n.attributes.uvNorm,
162
+ index: n.attributes.index
163
+ });
164
+ }
165
+ setSize() {
166
+ let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
167
+ let height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
168
+ let orientation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'xz';
169
+ const geometry = this;
170
+ geometry.width = width, geometry.height = height, geometry.orientation = orientation, geometry.attributes.position.values && geometry.attributes.position.values.length === 3 * geometry.vertexCount || (geometry.attributes.position.values = new Float32Array(3 * geometry.vertexCount));
171
+ const o = width / -2;
172
+ const r = height / -2;
173
+ const segment_width = width / geometry.xSegCount;
174
+ const segment_height = height / geometry.ySegCount;
175
+ for (let yIndex = 0; yIndex <= geometry.ySegCount; yIndex++) {
176
+ const t = r + yIndex * segment_height;
177
+ for (let xIndex = 0; xIndex <= geometry.xSegCount; xIndex++) {
178
+ const r = o + xIndex * segment_width;
179
+ const l = yIndex * (geometry.xSegCount + 1) + xIndex;
180
+ geometry.attributes.position.values[3 * l + 'xyz'.indexOf(orientation[0])] = r, geometry.attributes.position.values[3 * l + 'xyz'.indexOf(orientation[1])] = -t;
181
+ }
182
+ }
183
+ geometry.attributes.position.update(), _miniGl.debug('Geometry.setSize', {
184
+ position: geometry.attributes.position
185
+ });
186
+ }
187
+ }
188
+ },
189
+ Mesh: {
190
+ enumerable: !1,
191
+ value: class {
192
+ constructor(geometry, material) {
193
+ const mesh = this;
194
+ mesh.geometry = geometry, mesh.material = material, mesh.wireframe = !1, mesh.attributeInstances = [], Object.entries(mesh.geometry.attributes).forEach(_ref5 => {
195
+ let [e, attribute] = _ref5;
196
+ mesh.attributeInstances.push({
197
+ attribute,
198
+ location: attribute.attach(e, mesh.material.program)
199
+ });
200
+ }), _miniGl.meshes.push(mesh), _miniGl.debug('Mesh.constructor', {
201
+ mesh
202
+ });
203
+ }
204
+ draw() {
205
+ context.useProgram(this.material.program), this.material.uniformInstances.forEach(_ref6 => {
206
+ let {
207
+ uniform: e,
208
+ location: t
209
+ } = _ref6;
210
+ return e.update(t);
211
+ }), this.attributeInstances.forEach(_ref7 => {
212
+ let {
213
+ attribute: e,
214
+ location: t
215
+ } = _ref7;
216
+ return e.use(t);
217
+ }), context.drawElements(this.wireframe ? context.LINES : context.TRIANGLES, this.geometry.attributes.index.values.length, context.UNSIGNED_SHORT, 0);
218
+ }
219
+ remove() {
220
+ _miniGl.meshes = _miniGl.meshes.filter(e => e != this);
221
+ }
222
+ }
223
+ },
224
+ Attribute: {
225
+ enumerable: !1,
226
+ value: class {
227
+ constructor(e) {
228
+ this.type = context.FLOAT, this.normalized = !1, this.buffer = context.createBuffer(), Object.assign(this, e), this.update();
229
+ }
230
+ update() {
231
+ void 0 !== this.values && (context.bindBuffer(this.target, this.buffer), context.bufferData(this.target, this.values, context.STATIC_DRAW));
232
+ }
233
+ attach(e, t) {
234
+ const n = context.getAttribLocation(t, e);
235
+ return this.target === context.ARRAY_BUFFER && (context.enableVertexAttribArray(n), context.vertexAttribPointer(n, this.size, this.type, this.normalized, 0, 0)), n;
236
+ }
237
+ use(e) {
238
+ context.bindBuffer(this.target, this.buffer), this.target === context.ARRAY_BUFFER && (context.enableVertexAttribArray(e), context.vertexAttribPointer(e, this.size, this.type, this.normalized, 0, 0));
239
+ }
240
+ }
241
+ }
242
+ });
243
+ const a = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
244
+ _miniGl.commonUniforms = {
245
+ projectionMatrix: new _miniGl.Uniform({
246
+ type: 'mat4',
247
+ value: a
248
+ }),
249
+ modelViewMatrix: new _miniGl.Uniform({
250
+ type: 'mat4',
251
+ value: a
252
+ }),
253
+ resolution: new _miniGl.Uniform({
254
+ type: 'vec2',
255
+ value: [1, 1]
256
+ }),
257
+ aspectRatio: new _miniGl.Uniform({
258
+ type: 'float',
259
+ value: 1
260
+ })
261
+ };
262
+ }
263
+ setSize() {
264
+ let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 640;
265
+ let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 480;
266
+ this.width = e, this.height = t, this.canvas.width = e, this.canvas.height = t, this.gl.viewport(0, 0, e, t), this.commonUniforms.resolution.value = [e, t], this.commonUniforms.aspectRatio.value = e / t, this.debug('MiniGL.setSize', {
267
+ width: e,
268
+ height: t
269
+ });
270
+ }
271
+
272
+ // left, right, top, bottom, near, far
273
+ setOrthographicCamera() {
274
+ let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
275
+ let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
276
+ let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
277
+ let i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -2e3;
278
+ let s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2e3;
279
+ this.commonUniforms.projectionMatrix.value = [2 / this.width, 0, 0, 0, 0, 2 / this.height, 0, 0, 0, 0, 2 / (i - s), 0, e, t, n, 1], this.debug('setOrthographicCamera', this.commonUniforms.projectionMatrix.value);
280
+ }
281
+ render() {
282
+ this.gl.clearColor(0, 0, 0, 0), this.gl.clearDepth(1), this.meshes.forEach(e => e.draw());
283
+ }
284
+ }
285
+
286
+ // Sets initial properties
287
+ function e(object, propertyName, val) {
288
+ return propertyName in object ? Object.defineProperty(object, propertyName, {
289
+ value: val,
290
+ enumerable: !0,
291
+ configurable: !0,
292
+ writable: !0
293
+ }) : object[propertyName] = val, object;
294
+ }
295
+
296
+ // Gradient object
297
+ class Gradient {
298
+ constructor() {
299
+ e(this, 'el', void 0), e(this, 'cssVarRetries', 0), e(this, 'maxCssVarRetries', 200), e(this, 'angle', 0), e(this, 'isLoadedClass', !1), e(this, 'isScrolling', !1), /* e(this, "isStatic", o.disableAmbientAnimations()), */e(this, 'scrollingTimeout', void 0), e(this, 'scrollingRefreshDelay', 200), e(this, 'isIntersecting', !1), e(this, 'shaderFiles', void 0), e(this, 'vertexShader', void 0), e(this, 'sectionColors', void 0), e(this, 'computedCanvasStyle', void 0), e(this, 'conf', void 0), e(this, 'uniforms', void 0), e(this, 't', 1253106), e(this, 'last', 0), e(this, 'width', void 0), e(this, 'minWidth', 1111), e(this, 'height', 600), e(this, 'xSegCount', void 0), e(this, 'ySegCount', void 0), e(this, 'mesh', void 0), e(this, 'material', void 0), e(this, 'geometry', void 0), e(this, 'minigl', void 0), e(this, 'scrollObserver', void 0), e(this, 'amp', 320), e(this, 'seed', 5), e(this, 'freqX', 14e-5), e(this, 'freqY', 29e-5), e(this, 'freqDelta', 1e-5), e(this, 'activeColors', [1, 1, 1, 1]), e(this, 'isMetaKey', !1), e(this, 'isGradientLegendVisible', !1), e(this, 'isMouseDown', !1), e(this, 'handleScroll', () => {
300
+ clearTimeout(this.scrollingTimeout), this.scrollingTimeout = setTimeout(this.handleScrollEnd, this.scrollingRefreshDelay), this.isGradientLegendVisible && this.hideGradientLegend(), this.conf.playing && (this.isScrolling = !0, this.pause());
301
+ }), e(this, 'handleScrollEnd', () => {
302
+ this.isScrolling = !1, this.isIntersecting && this.play();
303
+ }), e(this, 'resize', () => {
304
+ this.width = window.innerWidth, this.minigl.setSize(this.width, this.height), this.minigl.setOrthographicCamera(), this.xSegCount = Math.ceil(this.width * this.conf.density[0]), this.ySegCount = Math.ceil(this.height * this.conf.density[1]), this.mesh.geometry.setTopology(this.xSegCount, this.ySegCount), this.mesh.geometry.setSize(this.width, this.height), this.mesh.material.uniforms.u_shadow_power.value = this.width < 600 ? 5 : 6;
305
+ }), e(this, 'handleMouseDown', e => {
306
+ this.isGradientLegendVisible && (this.isMetaKey = e.metaKey, this.isMouseDown = !0, !1 === this.conf.playing && requestAnimationFrame(this.animate));
307
+ }), e(this, 'handleMouseUp', () => {
308
+ this.isMouseDown = !1;
309
+ }), e(this, 'animate', e => {
310
+ if (!this.shouldSkipFrame(e) || this.isMouseDown) {
311
+ if (this.t += Math.min(e - this.last, 1e3 / 15), this.last = e, this.isMouseDown) {
312
+ let e = 160;
313
+ this.isMetaKey && (e = -160), this.t += e;
314
+ }
315
+ this.mesh.material.uniforms.u_time.value = this.t, this.minigl.render();
316
+ }
317
+ if (this.last !== 0 && this.isStatic) return this.minigl.render(), void this.disconnect();
318
+ ( /* this.isIntersecting && */this.conf.playing || this.isMouseDown) && requestAnimationFrame(this.animate);
319
+ }), e(this, 'addIsLoadedClass', () => {
320
+ /* this.isIntersecting && */!this.isLoadedClass && (this.isLoadedClass = !0, this.el.classList.add('isLoaded'), setTimeout(() => {
321
+ this.el.parentElement.classList.add('isLoaded');
322
+ }, 3e3));
323
+ }), e(this, 'pause', () => {
324
+ this.conf.playing = false;
325
+ }), e(this, 'play', () => {
326
+ requestAnimationFrame(this.animate), this.conf.playing = true;
327
+ }), e(this, 'initGradient', selector => {
328
+ this.el = document.querySelector(selector);
329
+ this.connect();
330
+ return this;
331
+ });
332
+ }
333
+ async connect() {
334
+ this.shaderFiles = {
335
+ vertex: 'varying vec3 v_color;\n\nvoid main() {\n float time = u_time * u_global.noiseSpeed;\n\n vec2 noiseCoord = resolution * uvNorm * u_global.noiseFreq;\n\n vec2 st = 1. - uvNorm.xy;\n\n //\n // Tilting the plane\n //\n\n // Front-to-back tilt\n float tilt = resolution.y / 2.0 * uvNorm.y;\n\n // Left-to-right angle\n float incline = resolution.x * uvNorm.x / 2.0 * u_vertDeform.incline;\n\n // Up-down shift to offset incline\n float offset = resolution.x / 2.0 * u_vertDeform.incline * mix(u_vertDeform.offsetBottom, u_vertDeform.offsetTop, uv.y);\n\n //\n // Vertex noise\n //\n\n float noise = snoise(vec3(\n noiseCoord.x * u_vertDeform.noiseFreq.x + time * u_vertDeform.noiseFlow,\n noiseCoord.y * u_vertDeform.noiseFreq.y,\n time * u_vertDeform.noiseSpeed + u_vertDeform.noiseSeed\n )) * u_vertDeform.noiseAmp;\n\n // Fade noise to zero at edges\n noise *= 1.0 - pow(abs(uvNorm.y), 2.0);\n\n // Clamp to 0\n noise = max(0.0, noise);\n\n vec3 pos = vec3(\n position.x,\n position.y + tilt + incline + noise - offset,\n position.z\n );\n\n //\n // Vertex color, to be passed to fragment shader\n //\n\n if (u_active_colors[0] == 1.) {\n v_color = u_baseColor;\n }\n\n for (int i = 0; i < u_waveLayers_length; i++) {\n if (u_active_colors[i + 1] == 1.) {\n WaveLayers layer = u_waveLayers[i];\n\n float noise = smoothstep(\n layer.noiseFloor,\n layer.noiseCeil,\n snoise(vec3(\n noiseCoord.x * layer.noiseFreq.x + time * layer.noiseFlow,\n noiseCoord.y * layer.noiseFreq.y,\n time * layer.noiseSpeed + layer.noiseSeed\n )) / 2.0 + 0.5\n );\n\n v_color = blendNormal(v_color, layer.color, pow(noise, 4.));\n }\n }\n\n //\n // Finish\n //\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n}',
336
+ noise: '//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n// First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n// Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n// Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n// Gradients: 7x7 points over a square, mapped onto an octahedron.\n// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n//Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n// Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n}',
337
+ blend: '//\n// https://github.com/jamieowen/glsl-blend\n//\n\n// Normal\n\nvec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Screen\n\nfloat blendScreen(float base, float blend) {\n\treturn 1.0-((1.0-base)*(1.0-blend));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend) {\n\treturn vec3(blendScreen(base.r,blend.r),blendScreen(base.g,blend.g),blendScreen(base.b,blend.b));\n}\n\nvec3 blendScreen(vec3 base, vec3 blend, float opacity) {\n\treturn (blendScreen(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Multiply\n\nvec3 blendMultiply(vec3 base, vec3 blend) {\n\treturn base*blend;\n}\n\nvec3 blendMultiply(vec3 base, vec3 blend, float opacity) {\n\treturn (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Overlay\n\nfloat blendOverlay(float base, float blend) {\n\treturn base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend) {\n\treturn vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));\n}\n\nvec3 blendOverlay(vec3 base, vec3 blend, float opacity) {\n\treturn (blendOverlay(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Hard light\n\nvec3 blendHardLight(vec3 base, vec3 blend) {\n\treturn blendOverlay(blend,base);\n}\n\nvec3 blendHardLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendHardLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Soft light\n\nfloat blendSoftLight(float base, float blend) {\n\treturn (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend) {\n\treturn vec3(blendSoftLight(base.r,blend.r),blendSoftLight(base.g,blend.g),blendSoftLight(base.b,blend.b));\n}\n\nvec3 blendSoftLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendSoftLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color dodge\n\nfloat blendColorDodge(float base, float blend) {\n\treturn (blend==1.0)?blend:min(base/(1.0-blend),1.0);\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend) {\n\treturn vec3(blendColorDodge(base.r,blend.r),blendColorDodge(base.g,blend.g),blendColorDodge(base.b,blend.b));\n}\n\nvec3 blendColorDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Color burn\n\nfloat blendColorBurn(float base, float blend) {\n\treturn (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend) {\n\treturn vec3(blendColorBurn(base.r,blend.r),blendColorBurn(base.g,blend.g),blendColorBurn(base.b,blend.b));\n}\n\nvec3 blendColorBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendColorBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Vivid Light\n\nfloat blendVividLight(float base, float blend) {\n\treturn (blend<0.5)?blendColorBurn(base,(2.0*blend)):blendColorDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend) {\n\treturn vec3(blendVividLight(base.r,blend.r),blendVividLight(base.g,blend.g),blendVividLight(base.b,blend.b));\n}\n\nvec3 blendVividLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendVividLight(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Lighten\n\nfloat blendLighten(float base, float blend) {\n\treturn max(blend,base);\n}\n\nvec3 blendLighten(vec3 base, vec3 blend) {\n\treturn vec3(blendLighten(base.r,blend.r),blendLighten(base.g,blend.g),blendLighten(base.b,blend.b));\n}\n\nvec3 blendLighten(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLighten(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear burn\n\nfloat blendLinearBurn(float base, float blend) {\n\t// Note : Same implementation as BlendSubtractf\n\treturn max(base+blend-1.0,0.0);\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendSubtract\n\treturn max(base+blend-vec3(1.0),vec3(0.0));\n}\n\nvec3 blendLinearBurn(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearBurn(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear dodge\n\nfloat blendLinearDodge(float base, float blend) {\n\t// Note : Same implementation as BlendAddf\n\treturn min(base+blend,1.0);\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend) {\n\t// Note : Same implementation as BlendAdd\n\treturn min(base+blend,vec3(1.0));\n}\n\nvec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearDodge(base, blend) * opacity + base * (1.0 - opacity));\n}\n\n// Linear light\n\nfloat blendLinearLight(float base, float blend) {\n\treturn blend<0.5?blendLinearBurn(base,(2.0*blend)):blendLinearDodge(base,(2.0*(blend-0.5)));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend) {\n\treturn vec3(blendLinearLight(base.r,blend.r),blendLinearLight(base.g,blend.g),blendLinearLight(base.b,blend.b));\n}\n\nvec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n\treturn (blendLinearLight(base, blend) * opacity + base * (1.0 - opacity));\n}',
338
+ fragment: 'varying vec3 v_color;\n\nvoid main() {\n vec3 color = v_color;\n if (u_darken_top == 1.0) {\n vec2 st = gl_FragCoord.xy/resolution.xy;\n color.g -= pow(st.y + sin(-12.0) * st.x, u_shadow_power) * 0.4;\n }\n gl_FragColor = vec4(color, 1.0);\n}'
339
+ }, this.conf = {
340
+ presetName: '',
341
+ wireframe: false,
342
+ density: [0.06, 0.16],
343
+ zoom: 1,
344
+ rotation: 0,
345
+ playing: true
346
+ }, document.querySelectorAll('canvas').length < 1 ? console.log('DID NOT LOAD HERO STRIPE CANVAS') : (this.minigl = new MiniGl(this.el, null, null, !0), requestAnimationFrame(() => {
347
+ this.el && (this.computedCanvasStyle = getComputedStyle(this.el), this.waitForCssVars());
348
+ })
349
+ /*
350
+ this.scrollObserver = await s.create(.1, !1),
351
+ this.scrollObserver.observe(this.el),
352
+ this.scrollObserver.onSeparate(() => {
353
+ window.removeEventListener("scroll", this.handleScroll), window.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("mouseup", this.handleMouseUp), window.removeEventListener("keydown", this.handleKeyDown), this.isIntersecting = !1, this.conf.playing && this.pause()
354
+ }),
355
+ this.scrollObserver.onIntersect(() => {
356
+ window.addEventListener("scroll", this.handleScroll), window.addEventListener("mousedown", this.handleMouseDown), window.addEventListener("mouseup", this.handleMouseUp), window.addEventListener("keydown", this.handleKeyDown), this.isIntersecting = !0, this.addIsLoadedClass(), this.play()
357
+ }) */);
358
+ }
359
+
360
+ disconnect() {
361
+ this.scrollObserver && (window.removeEventListener('scroll', this.handleScroll), window.removeEventListener('mousedown', this.handleMouseDown), window.removeEventListener('mouseup', this.handleMouseUp), window.removeEventListener('keydown', this.handleKeyDown), this.scrollObserver.disconnect()), window.removeEventListener('resize', this.resize);
362
+ }
363
+ initMaterial() {
364
+ this.uniforms = {
365
+ u_time: new this.minigl.Uniform({
366
+ value: 0
367
+ }),
368
+ u_shadow_power: new this.minigl.Uniform({
369
+ value: 5
370
+ }),
371
+ u_darken_top: new this.minigl.Uniform({
372
+ value: this.el.dataset.jsDarkenTop === '' ? 1 : 0
373
+ }),
374
+ u_active_colors: new this.minigl.Uniform({
375
+ value: this.activeColors,
376
+ type: 'vec4'
377
+ }),
378
+ u_global: new this.minigl.Uniform({
379
+ value: {
380
+ noiseFreq: new this.minigl.Uniform({
381
+ value: [this.freqX, this.freqY],
382
+ type: 'vec2'
383
+ }),
384
+ noiseSpeed: new this.minigl.Uniform({
385
+ value: 5e-6
386
+ })
387
+ },
388
+ type: 'struct'
389
+ }),
390
+ u_vertDeform: new this.minigl.Uniform({
391
+ value: {
392
+ incline: new this.minigl.Uniform({
393
+ value: Math.sin(this.angle) / Math.cos(this.angle)
394
+ }),
395
+ offsetTop: new this.minigl.Uniform({
396
+ value: -0.5
397
+ }),
398
+ offsetBottom: new this.minigl.Uniform({
399
+ value: -0.5
400
+ }),
401
+ noiseFreq: new this.minigl.Uniform({
402
+ value: [3, 4],
403
+ type: 'vec2'
404
+ }),
405
+ noiseAmp: new this.minigl.Uniform({
406
+ value: this.amp
407
+ }),
408
+ noiseSpeed: new this.minigl.Uniform({
409
+ value: 10
410
+ }),
411
+ noiseFlow: new this.minigl.Uniform({
412
+ value: 3
413
+ }),
414
+ noiseSeed: new this.minigl.Uniform({
415
+ value: this.seed
416
+ })
417
+ },
418
+ type: 'struct',
419
+ excludeFrom: 'fragment'
420
+ }),
421
+ u_baseColor: new this.minigl.Uniform({
422
+ value: this.sectionColors[0],
423
+ type: 'vec3',
424
+ excludeFrom: 'fragment'
425
+ }),
426
+ u_waveLayers: new this.minigl.Uniform({
427
+ value: [],
428
+ excludeFrom: 'fragment',
429
+ type: 'array'
430
+ })
431
+ };
432
+ for (let e = 1; e < this.sectionColors.length; e += 1) {
433
+ this.uniforms.u_waveLayers.value.push(new this.minigl.Uniform({
434
+ value: {
435
+ color: new this.minigl.Uniform({
436
+ value: this.sectionColors[e],
437
+ type: 'vec3'
438
+ }),
439
+ noiseFreq: new this.minigl.Uniform({
440
+ value: [2 + e / this.sectionColors.length, 3 + e / this.sectionColors.length],
441
+ type: 'vec2'
442
+ }),
443
+ noiseSpeed: new this.minigl.Uniform({
444
+ value: 11 + 0.3 * e
445
+ }),
446
+ noiseFlow: new this.minigl.Uniform({
447
+ value: 6.5 + 0.3 * e
448
+ }),
449
+ noiseSeed: new this.minigl.Uniform({
450
+ value: this.seed + 10 * e
451
+ }),
452
+ noiseFloor: new this.minigl.Uniform({
453
+ value: 0.1
454
+ }),
455
+ noiseCeil: new this.minigl.Uniform({
456
+ value: 0.63 + 0.07 * e
457
+ })
458
+ },
459
+ type: 'struct'
460
+ }));
461
+ }
462
+ return this.vertexShader = [this.shaderFiles.noise, this.shaderFiles.blend, this.shaderFiles.vertex].join('\n\n'), new this.minigl.Material(this.vertexShader, this.shaderFiles.fragment, this.uniforms);
463
+ }
464
+ initMesh() {
465
+ this.material = this.initMaterial(), this.geometry = new this.minigl.PlaneGeometry(), this.mesh = new this.minigl.Mesh(this.geometry, this.material);
466
+ }
467
+ shouldSkipFrame(e) {
468
+ return !!window.document.hidden || !this.conf.playing || parseInt(e, 10) % 2 == 0 || void 0;
469
+ }
470
+ updateFrequency(e) {
471
+ this.freqX += e, this.freqY += e;
472
+ }
473
+ toggleColor(index) {
474
+ this.activeColors[index] = this.activeColors[index] === 0 ? 1 : 0;
475
+ }
476
+ showGradientLegend() {
477
+ this.width > this.minWidth && (this.isGradientLegendVisible = !0, document.body.classList.add('isGradientLegendVisible'));
478
+ }
479
+ hideGradientLegend() {
480
+ this.isGradientLegendVisible = !1, document.body.classList.remove('isGradientLegendVisible');
481
+ }
482
+ init() {
483
+ this.initGradientColors(), this.initMesh(), this.resize(), requestAnimationFrame(this.animate), window.addEventListener('resize', this.resize);
484
+ }
485
+
486
+ /*
487
+ * Waiting for the css variables to become available, usually on page load before we can continue.
488
+ * Using default colors assigned below if no variables have been found after maxCssVarRetries
489
+ */
490
+ waitForCssVars() {
491
+ if (this.computedCanvasStyle && this.computedCanvasStyle.getPropertyValue('--gradient-color-1').indexOf('#') !== -1) this.init(), this.addIsLoadedClass();else {
492
+ if (this.cssVarRetries += 1, this.cssVarRetries > this.maxCssVarRetries) {
493
+ return this.sectionColors = [16711680, 16711680, 16711935, 65280, 255], void this.init();
494
+ }
495
+ requestAnimationFrame(() => this.waitForCssVars());
496
+ }
497
+ }
498
+
499
+ /*
500
+ * Initializes the four section colors by retrieving them from css variables.
501
+ */
502
+ initGradientColors() {
503
+ this.sectionColors = ['--gradient-color-1', '--gradient-color-2', '--gradient-color-3', '--gradient-color-4'].map(cssPropertyName => {
504
+ let hex = this.computedCanvasStyle.getPropertyValue(cssPropertyName).trim();
505
+ // Check if shorthand hex value was used and double the length so the conversion in normalizeColor will work.
506
+ if (hex.length === 4) {
507
+ const hexTemp = hex.substr(1).split('').map(hexTemp => hexTemp + hexTemp).join('');
508
+ hex = `#${hexTemp}`;
509
+ }
510
+ return hex && `0x${hex.substr(1)}`;
511
+ }).filter(Boolean).map(normalizeColor);
512
+ }
513
+ }
514
+
515
+ /*
516
+ *Finally initializing the Gradient class, assigning a canvas to it and calling Gradient.connect() which initializes everything,
517
+ * Use Gradient.pause() and Gradient.play() for controls.
518
+ *
519
+ * Here are some default property values you can change anytime:
520
+ * Amplitude: Gradient.amp = 0
521
+ * Colors: Gradient.sectionColors (if you change colors, use normalizeColor(#hexValue)) before you assign it.
522
+ *
523
+ *
524
+ * Useful functions
525
+ * Gradient.toggleColor(index)
526
+ * Gradient.updateFrequency(freq)
527
+ */
528
+ exports.Gradient = Gradient;
@@ -26,7 +26,7 @@ const ContentTree = _ref => {
26
26
  selectors
27
27
  // ...otherProps
28
28
  } = _ref;
29
- (0, React.useLayoutEffect)(() => {
29
+ (0, React.useInsertionEffect)(() => {
30
30
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
31
31
  }, []);
32
32
  const contentTree = (0, _common.useContentTree)(target, selectors);
@@ -60,7 +60,7 @@ ContentTree.propTypes = {
60
60
  * The reference to the parent element.
61
61
  */
62
62
  target: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
63
- current: _propTypes.default.instanceOf(Element)
63
+ current: _propTypes.default.node
64
64
  })])
65
65
  };
66
66
  ContentTree.defaultProps = {
@@ -30,7 +30,7 @@ const Conversation = _ref => {
30
30
  hasTriangle
31
31
  // ...otherProps
32
32
  } = _ref;
33
- (0, React.useLayoutEffect)(() => {
33
+ (0, React.useInsertionEffect)(() => {
34
34
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
35
35
  }, []);
36
36
  return /*#__PURE__*/React.createElement(_Context.default.Provider, {
@@ -30,7 +30,7 @@ const DotInfo = _ref => {
30
30
  colorEmpty
31
31
  // ...otherProps
32
32
  } = _ref;
33
- (0, React.useLayoutEffect)(() => {
33
+ (0, React.useInsertionEffect)(() => {
34
34
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
35
35
  }, []);
36
36
  return /*#__PURE__*/React.createElement("div", {
@@ -27,7 +27,7 @@ const Figure = _ref => {
27
27
  alt,
28
28
  caption
29
29
  } = _ref;
30
- (0, React.useLayoutEffect)(() => {
30
+ (0, React.useInsertionEffect)(() => {
31
31
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
32
32
  }, []);
33
33
  return /*#__PURE__*/React.createElement("div", {
@@ -31,7 +31,7 @@ const HamburgerButton = _ref => {
31
31
  color,
32
32
  ...otherProps
33
33
  } = _ref;
34
- (0, React.useLayoutEffect)(() => {
34
+ (0, React.useInsertionEffect)(() => {
35
35
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
36
36
  }, []);
37
37
  return /*#__PURE__*/React.createElement("button", _extends({
@@ -30,7 +30,7 @@ const IconList = _ref => {
30
30
  iconHover,
31
31
  ...otherProps
32
32
  } = _ref;
33
- (0, React.useLayoutEffect)(() => {
33
+ (0, React.useInsertionEffect)(() => {
34
34
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
35
35
  }, []);
36
36
  return /*#__PURE__*/React.createElement("ul", _extends({