p5 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +2 -2
  3. package/{src → dist}/accessibility/gridOutput.js +2 -2
  4. package/dist/accessibility/index.js +60 -0
  5. package/{src → dist}/accessibility/outputs.js +2 -2
  6. package/{src → dist}/accessibility/textOutput.js +2 -2
  7. package/dist/app.js +120 -0
  8. package/{src → dist}/color/color_conversion.js +48 -10
  9. package/{src → dist}/color/color_spaces/hsb.js +3 -1
  10. package/dist/color/creating_reading.js +3 -0
  11. package/dist/color/index.js +13 -0
  12. package/dist/color/p5.Color.culori.js +1 -0
  13. package/dist/color/p5.Color.js +3 -0
  14. package/{src → dist}/color/setting.js +9 -6
  15. package/{src/core/constants.js → dist/constants-C-g_eAdC.js} +266 -130
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +7 -6
  19. package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
  20. package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
  21. package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
  22. package/dist/core/friendly_errors/index.js +23 -0
  23. package/dist/core/friendly_errors/param_validator.js +5455 -0
  24. package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
  25. package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
  26. package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
  27. package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
  28. package/{src → dist}/core/helpers.js +9 -6
  29. package/dist/core/init.js +105 -0
  30. package/dist/core/internationalization.js +302 -0
  31. package/dist/core/legacy.js +73 -0
  32. package/dist/core/main.js +44 -0
  33. package/dist/core/noop.js +3 -0
  34. package/dist/core/p5.Graphics.js +40 -0
  35. package/dist/core/p5.Renderer.js +11 -0
  36. package/dist/core/p5.Renderer2D.js +44 -0
  37. package/dist/core/reference.js +1 -0
  38. package/dist/core/rendering.js +40 -0
  39. package/{src → dist}/core/structure.js +3 -3
  40. package/{src → dist}/core/transform.js +2 -2
  41. package/{src/color/creating_reading.js → dist/creating_reading-D4AAKRbx.js} +841 -13
  42. package/{src → dist}/data/index.js +3 -1
  43. package/{src → dist}/data/local_storage.js +2 -8
  44. package/{src → dist}/dom/dom.js +11 -5
  45. package/dist/dom/index.js +18 -0
  46. package/{src → dist}/dom/p5.Element.js +14 -12
  47. package/{src → dist}/dom/p5.File.js +4 -4
  48. package/{src → dist}/dom/p5.MediaElement.js +10 -4
  49. package/{src → dist}/events/acceleration.js +2 -2
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -11
  52. package/{src → dist}/events/pointer.js +16 -17
  53. package/dist/image/const.js +9 -0
  54. package/{src → dist}/image/filterRenderer2D.js +57 -37
  55. package/{src → dist}/image/filters.js +1 -3
  56. package/dist/image/image.js +40 -0
  57. package/dist/image/index.js +51 -0
  58. package/dist/image/loading_displaying.js +40 -0
  59. package/dist/image/p5.Image.js +11 -0
  60. package/{src → dist}/image/pixels.js +4 -3
  61. package/{src → dist}/io/csv.js +72 -70
  62. package/dist/io/files.js +40 -0
  63. package/dist/io/index.js +51 -0
  64. package/{src → dist}/io/p5.Table.js +6 -6
  65. package/{src → dist}/io/p5.TableRow.js +3 -4
  66. package/{src → dist}/io/p5.XML.js +2 -5
  67. package/{src → dist}/io/utilities.js +1 -1
  68. package/{src/core/p5.Renderer2D.js → dist/main-s72KWcUy.js} +735 -57
  69. package/{src → dist}/math/Matrices/Matrix.js +10 -8
  70. package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
  71. package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
  72. package/{src → dist}/math/calculation.js +2 -2
  73. package/{src → dist}/math/index.js +6 -3
  74. package/{src → dist}/math/math.js +2 -2
  75. package/{src → dist}/math/noise.js +2 -2
  76. package/{src → dist}/math/p5.Matrix.js +7 -4
  77. package/{src → dist}/math/p5.Vector.js +6 -6
  78. package/{src → dist}/math/random.js +2 -2
  79. package/{src → dist}/math/trigonometry.js +16 -15
  80. package/{src/image/p5.Image.js → dist/p5.Renderer-CwAYZOC2.js} +390 -19
  81. package/dist/rendering--aAe5aq3.js +24925 -0
  82. package/{src → dist}/shape/2d_primitives.js +18 -17
  83. package/{src → dist}/shape/attributes.js +18 -17
  84. package/{src → dist}/shape/curves.js +2 -2
  85. package/{src → dist}/shape/custom_shapes.js +44 -64
  86. package/{src → dist}/shape/index.js +10 -2
  87. package/{src → dist}/shape/vertex.js +2 -3
  88. package/dist/type/index.js +25 -0
  89. package/{src → dist}/type/lib/Typr.js +76 -94
  90. package/{src → dist}/type/p5.Font.js +37 -61
  91. package/{src → dist}/type/textCore.js +34 -57
  92. package/{src → dist}/type/unicodeRanges.js +3 -1
  93. package/{src → dist}/utilities/conversion.js +2 -2
  94. package/{src → dist}/utilities/index.js +3 -1
  95. package/{src → dist}/utilities/time_date.js +6 -7
  96. package/{src → dist}/utilities/utility_functions.js +2 -2
  97. package/dist/webgl/3d_primitives.js +40 -0
  98. package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
  99. package/{src → dist}/webgl/GeometryBuilder.js +12 -8
  100. package/{src → dist}/webgl/ShaderGenerator.js +79 -82
  101. package/{src → dist}/webgl/ShapeBuilder.js +26 -23
  102. package/dist/webgl/index.js +76 -0
  103. package/{src → dist}/webgl/interaction.js +7 -6
  104. package/dist/webgl/light.js +40 -0
  105. package/{src → dist}/webgl/loading.js +45 -12
  106. package/dist/webgl/material.js +40 -0
  107. package/dist/webgl/p5.Camera.js +40 -0
  108. package/{src → dist}/webgl/p5.DataArray.js +3 -5
  109. package/dist/webgl/p5.Framebuffer.js +40 -0
  110. package/{src → dist}/webgl/p5.Geometry.js +12 -15
  111. package/{src → dist}/webgl/p5.Quat.js +5 -4
  112. package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
  113. package/dist/webgl/p5.RendererGL.js +40 -0
  114. package/dist/webgl/p5.Shader.js +40 -0
  115. package/dist/webgl/p5.Texture.js +40 -0
  116. package/{src → dist}/webgl/text.js +51 -9
  117. package/lib/p5.esm.js +102 -48
  118. package/lib/p5.js +102 -48
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -16
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/src/README.md +0 -27
  124. package/src/accessibility/index.js +0 -13
  125. package/src/app.js +0 -61
  126. package/src/color/index.js +0 -9
  127. package/src/color/p5.Color.culori.js +0 -66
  128. package/src/color/p5.Color.js +0 -851
  129. package/src/core/README.md +0 -91
  130. package/src/core/friendly_errors/index.js +0 -13
  131. package/src/core/friendly_errors/param_validator.js +0 -561
  132. package/src/core/init.js +0 -58
  133. package/src/core/internationalization.js +0 -195
  134. package/src/core/legacy.js +0 -29
  135. package/src/core/main.js +0 -689
  136. package/src/core/noop.js +0 -1
  137. package/src/core/p5.Graphics.js +0 -696
  138. package/src/core/p5.Renderer.js +0 -408
  139. package/src/core/reference.js +0 -2060
  140. package/src/core/rendering.js +0 -697
  141. package/src/dom/index.js +0 -11
  142. package/src/image/const.js +0 -6
  143. package/src/image/image.js +0 -731
  144. package/src/image/index.js +0 -15
  145. package/src/image/loading_displaying.js +0 -1431
  146. package/src/io/files.js +0 -2210
  147. package/src/io/index.js +0 -11
  148. package/src/math/README.md +0 -40
  149. package/src/type/index.js +0 -9
  150. package/src/webgl/3d_primitives.js +0 -2741
  151. package/src/webgl/index.js +0 -37
  152. package/src/webgl/light.js +0 -1851
  153. package/src/webgl/material.js +0 -3854
  154. package/src/webgl/p5.Camera.js +0 -4010
  155. package/src/webgl/p5.Framebuffer.js +0 -1865
  156. package/src/webgl/p5.RendererGL.js +0 -2867
  157. package/src/webgl/p5.Shader.js +0 -1505
  158. package/src/webgl/p5.Texture.js +0 -541
  159. package/src/webgl/shaders/basic.frag +0 -6
  160. package/src/webgl/shaders/filters/base.frag +0 -22
  161. package/src/webgl/shaders/filters/base.vert +0 -19
  162. package/src/webgl/shaders/filters/blur.frag +0 -60
  163. package/src/webgl/shaders/filters/default.vert +0 -18
  164. package/src/webgl/shaders/filters/dilate.frag +0 -39
  165. package/src/webgl/shaders/filters/erode.frag +0 -39
  166. package/src/webgl/shaders/filters/gray.frag +0 -16
  167. package/src/webgl/shaders/filters/invert.frag +0 -15
  168. package/src/webgl/shaders/filters/opaque.frag +0 -12
  169. package/src/webgl/shaders/filters/posterize.frag +0 -29
  170. package/src/webgl/shaders/filters/threshold.frag +0 -23
  171. package/src/webgl/shaders/font.frag +0 -216
  172. package/src/webgl/shaders/font.vert +0 -44
  173. package/src/webgl/shaders/imageLight.vert +0 -33
  174. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  175. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  176. package/src/webgl/shaders/light.vert +0 -37
  177. package/src/webgl/shaders/light_texture.frag +0 -26
  178. package/src/webgl/shaders/lighting.glsl +0 -227
  179. package/src/webgl/shaders/line.frag +0 -74
  180. package/src/webgl/shaders/line.vert +0 -294
  181. package/src/webgl/shaders/normal.frag +0 -6
  182. package/src/webgl/shaders/normal.vert +0 -72
  183. package/src/webgl/shaders/phong.frag +0 -84
  184. package/src/webgl/shaders/phong.vert +0 -87
  185. package/src/webgl/shaders/point.frag +0 -29
  186. package/src/webgl/shaders/point.vert +0 -19
  187. package/src/webgl/shaders/sphereMapping.frag +0 -26
  188. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,47 +1,25 @@
1
- /**
2
- * @module Typography
3
- */
4
-
5
- import { textCoreConstants } from './textCore';
6
- import * as constants from '../core/constants';
1
+ import { textCoreConstants } from './textCore.js';
2
+ import { C as CENTER, R as RIGHT, a as RADIUS } from '../constants-C-g_eAdC.js';
7
3
  import { UnicodeRange } from '@japont/unicode-range';
8
- import { unicodeRanges } from './unicodeRanges';
9
-
10
- /*
11
- API:
12
- loadFont("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap")
13
- loadFont("@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: <weight> font-style: normal; font-variation-settings: "wdth" 100; });
14
- loadFont({
15
- fontFamily: '"Bricolage Grotesque", serif';
16
- fontOpticalSizing: 'auto';
17
- fontWeight: '<weight>';
18
- fontStyle: 'normal';
19
- fontVariationSettings: '"wdth" 100';
20
- });
21
- loadFont("https://fonts.gstatic.com/s/bricolagegrotesque/v1/pxiAZBhjZQIdd8jGnEotWQ.woff2");
22
- loadFont("./path/to/localFont.ttf");
23
- loadFont("system-font-name");
24
-
25
-
26
- NEXT:
27
- extract axes from font file
28
-
29
- TEST:
30
- const font = new FontFace("Inter", "url(./fonts/inter-latin-variable-full-font.woff2)", {
31
- style: "oblique 0deg 10deg",
32
- weight: "100 900",
33
- display: 'fallback'
34
- });
35
- */
4
+ import { unicodeRanges } from './unicodeRanges.js';
5
+ import Typr from './lib/Typr.js';
6
+ import { createFromCommands } from '@davepagurek/bezier-path';
7
+ import '../p5.Renderer-CwAYZOC2.js';
8
+ import '../creating_reading-D4AAKRbx.js';
9
+ import 'colorjs.io/fn';
10
+ import '../color/color_spaces/hsb.js';
11
+ import '../image/filters.js';
12
+ import '../math/p5.Vector.js';
13
+ import '../shape/custom_shapes.js';
14
+ import '../core/States.js';
15
+ import '../io/utilities.js';
16
+ import 'file-saver';
17
+ import 'pako';
36
18
 
37
- /*
38
- This module defines the <a href="#/p5.Font">p5.Font</a> class and p5 methods for
39
- loading fonts from files and urls, and extracting points from their paths.
19
+ /**
20
+ * @module Typography
40
21
  */
41
22
 
42
- import Typr from './lib/Typr.js';
43
-
44
- import { createFromCommands } from '@davepagurek/bezier-path';
45
23
 
46
24
  const pathArgCounts = { M: 2, L: 2, C: 6, Q: 4 };
47
25
  const validFontTypes = ['ttf', 'otf', 'woff'];//, 'woff2'];
@@ -52,7 +30,7 @@ const fontFaceVariations = ['weight', 'stretch', 'style'];
52
30
 
53
31
 
54
32
  let nextId = 0;
55
- export class Font {
33
+ class Font {
56
34
  constructor(p, fontFace, name, path, data) {
57
35
  if (!(fontFace instanceof FontFace)) {
58
36
  throw Error('FontFace is required');
@@ -723,7 +701,7 @@ export class Font {
723
701
  subdivide(pts, pt1, middle, md);
724
702
  subdivide(pts, middle, pt2, md);
725
703
  }
726
- }
704
+ };
727
705
 
728
706
  // a point for each path-command plus line subdivisions
729
707
  let pts = [];
@@ -733,7 +711,7 @@ export class Font {
733
711
  for (let i = 0; i < cmds.length; i++) {
734
712
  let { type, data: d } = cmds[i];
735
713
  if (type !== 'Z') {
736
- let pt = { x: d[d.length - 2], y: d[d.length - 1] }
714
+ let pt = { x: d[d.length - 2], y: d[d.length - 1] };
737
715
  if (type === 'L' && pts.length && !options?.nodivide > 0) {
738
716
  subdivide(pts, pts[pts.length - 1], pt, maxDist);
739
717
  }
@@ -767,26 +745,26 @@ export class Font {
767
745
  let x = bounds.x;
768
746
  let y = bounds.y + (i * textLeading) + ascent;
769
747
  let lineWidth = renderer._fontWidthSingle(text);
770
- if (textAlign === constants.CENTER) {
748
+ if (textAlign === CENTER) {
771
749
  x += (bounds.w - lineWidth) / 2;
772
750
  }
773
- else if (textAlign === constants.RIGHT) {
751
+ else if (textAlign === RIGHT) {
774
752
  x += (bounds.w - lineWidth);
775
753
  }
776
754
  if (typeof width !== 'undefined') {
777
755
  switch (renderer.states.rectMode) {
778
- case constants.CENTER:
756
+ case CENTER:
779
757
  x -= width / 2;
780
758
  y -= height / 2;
781
759
  break;
782
- case constants.RADIUS:
760
+ case RADIUS:
783
761
  x -= width;
784
762
  y -= height;
785
763
  break;
786
764
  }
787
765
  }
788
766
  return { text, x, y };
789
- }
767
+ };
790
768
 
791
769
  return lines.map(coordify);
792
770
  }
@@ -1023,8 +1001,7 @@ function extractFontName(font, path) {
1023
1001
  }
1024
1002
 
1025
1003
  return result;
1026
- };
1027
-
1004
+ }
1028
1005
  function pathToPoints(cmds, options, font) {
1029
1006
 
1030
1007
  const parseOpts = (options, defaults) => {
@@ -1038,12 +1015,12 @@ function pathToPoints(cmds, options, font) {
1038
1015
  }
1039
1016
  }
1040
1017
  return options;
1041
- }
1018
+ };
1042
1019
 
1043
1020
  const at = (v, i) => {
1044
1021
  const s = v.length;
1045
1022
  return v[i < 0 ? i % s + s : i % s];
1046
- }
1023
+ };
1047
1024
 
1048
1025
  const simplify = (pts, angle) => {
1049
1026
  angle = angle || 0;
@@ -1055,7 +1032,7 @@ function pathToPoints(cmds, options, font) {
1055
1032
  }
1056
1033
  }
1057
1034
  return num;
1058
- }
1035
+ };
1059
1036
 
1060
1037
  const path = createFromCommands(arrayCommandsToObjects(cmds));
1061
1038
  let opts = parseOpts(options, {
@@ -1359,7 +1336,7 @@ function font(p5, fn) {
1359
1336
  if (urlMatch) {
1360
1337
  let url = urlMatch[1];
1361
1338
  if (/^['"]/.exec(url) && url.at(0) === url.at(-1)) {
1362
- url = url.slice(1, -1)
1339
+ url = url.slice(1, -1);
1363
1340
  }
1364
1341
  fontData = await fn.parseFontData(url);
1365
1342
  }
@@ -1416,7 +1393,7 @@ function font(p5, fn) {
1416
1393
  descriptorOverlap > closestDescriptorOverlap ||
1417
1394
  (descriptorOverlap === closestDescriptorOverlap && rangeOverlap >= closestRangeOverlap)
1418
1395
  ) {
1419
- closestDescriptorOverlap = descriptorOverlap
1396
+ closestDescriptorOverlap = descriptorOverlap;
1420
1397
  closestRangeOverlap = rangeOverlap;
1421
1398
  closestMatch = font;
1422
1399
  }
@@ -1462,11 +1439,10 @@ function font(p5, fn) {
1462
1439
  if (success) return success(pfont);
1463
1440
 
1464
1441
  return pfont;
1465
- }
1466
- };
1467
-
1442
+ };
1443
+ }
1468
1444
  // Convert arrays to named objects
1469
- export const arrayCommandsToObjects = (commands) => commands.map((command) => {
1445
+ const arrayCommandsToObjects = (commands) => commands.map((command) => {
1470
1446
  const type = command[0];
1471
1447
  switch (type) {
1472
1448
  case 'Z': {
@@ -1491,8 +1467,8 @@ export const arrayCommandsToObjects = (commands) => commands.map((command) => {
1491
1467
  }
1492
1468
  });
1493
1469
 
1494
- export default font;
1495
-
1496
1470
  if (typeof p5 !== 'undefined') {
1497
1471
  font(p5, p5.prototype);
1498
1472
  }
1473
+
1474
+ export { Font, arrayCommandsToObjects, font as default };
@@ -1,11 +1,22 @@
1
+ import { R as Renderer } from '../p5.Renderer-CwAYZOC2.js';
2
+ import '../creating_reading-D4AAKRbx.js';
3
+ import 'colorjs.io/fn';
4
+ import '../color/color_spaces/hsb.js';
5
+ import '../constants-C-g_eAdC.js';
6
+ import '../image/filters.js';
7
+ import '../math/p5.Vector.js';
8
+ import '../shape/custom_shapes.js';
9
+ import '../core/States.js';
10
+ import '../io/utilities.js';
11
+ import 'file-saver';
12
+
1
13
  /**
2
14
  * @module Typography
3
15
  * @requires core
4
16
  */
5
17
 
6
- import { Renderer } from '../core/p5.Renderer';
7
18
 
8
- export const textCoreConstants = {
19
+ const textCoreConstants = {
9
20
  IDEOGRAPHIC: 'ideographic',
10
21
  RIGHT_TO_LEFT: 'rtl',
11
22
  LEFT_TO_RIGHT: 'ltr',
@@ -15,7 +26,7 @@ export const textCoreConstants = {
15
26
  HANGING: 'hanging',
16
27
  START: 'start',
17
28
  END: 'end',
18
- }
29
+ };
19
30
 
20
31
  function textCore(p5, fn) {
21
32
  const LeadingScale = 1.275;
@@ -1571,7 +1582,7 @@ function textCore(p5, fn) {
1571
1582
 
1572
1583
  Renderer.prototype._currentTextFont = function () {
1573
1584
  return this.states.textFont.font || this.states.textFont.family;
1574
- }
1585
+ };
1575
1586
 
1576
1587
  /**
1577
1588
  * Set the font and [size] and [options] for rendering text
@@ -1628,7 +1639,7 @@ function textCore(p5, fn) {
1628
1639
  }
1629
1640
 
1630
1641
  return this._applyTextProperties();
1631
- }
1642
+ };
1632
1643
 
1633
1644
  Renderer.prototype._directSetFontString = function (font, debug = 0) {
1634
1645
  if (debug) console.log('_directSetFontString"' + font + '"');
@@ -1647,7 +1658,7 @@ function textCore(p5, fn) {
1647
1658
  });
1648
1659
 
1649
1660
  return { family: style.fontFamily, size: style.fontSize };
1650
- }
1661
+ };
1651
1662
 
1652
1663
  Renderer.prototype.textLeading = function (leading) {
1653
1664
  // the setter
@@ -1658,7 +1669,7 @@ function textCore(p5, fn) {
1658
1669
  }
1659
1670
  // the getter
1660
1671
  return this.states.textLeading;
1661
- }
1672
+ };
1662
1673
 
1663
1674
  Renderer.prototype.textWeight = function (weight) {
1664
1675
  // the setter
@@ -1676,7 +1687,7 @@ function textCore(p5, fn) {
1676
1687
  }
1677
1688
  // the getter
1678
1689
  return this.states.fontWeight;
1679
- }
1690
+ };
1680
1691
 
1681
1692
  /**
1682
1693
  * @param {*} size - the size of the text, can be a number or a css-style string
@@ -1691,7 +1702,7 @@ function textCore(p5, fn) {
1691
1702
  }
1692
1703
  // the getter
1693
1704
  return this.states.textSize;
1694
- }
1705
+ };
1695
1706
 
1696
1707
  Renderer.prototype.textStyle = function (style) {
1697
1708
 
@@ -1702,7 +1713,7 @@ function textCore(p5, fn) {
1702
1713
  }
1703
1714
  // the getter
1704
1715
  return this.states.fontStyle;
1705
- }
1716
+ };
1706
1717
 
1707
1718
  Renderer.prototype.textWrap = function (wrapStyle) {
1708
1719
 
@@ -1818,7 +1829,7 @@ function textCore(p5, fn) {
1818
1829
 
1819
1830
  Renderer.prototype._currentTextFont = function () {
1820
1831
  return this.states.textFont.font || this.states.textFont.family;
1821
- }
1832
+ };
1822
1833
 
1823
1834
  /*
1824
1835
  Compute the bounds for a block of text based on the specified
@@ -1868,13 +1879,6 @@ function textCore(p5, fn) {
1868
1879
  }
1869
1880
  }
1870
1881
 
1871
- if (0 && opts?.ignoreRectMode) boxes.forEach((b, i) => { // draw bounds for debugging
1872
- let ss = context.strokeStyle;
1873
- context.strokeStyle = 'green';
1874
- context.strokeRect(bounds.x, bounds.y, bounds.w, bounds.h);
1875
- context.strokeStyle = ss;
1876
- });
1877
-
1878
1882
  context.textBaseline = setBaseline; // restore baseline
1879
1883
 
1880
1884
  return { bounds, lines };
@@ -1901,7 +1905,7 @@ function textCore(p5, fn) {
1901
1905
  }
1902
1906
  }
1903
1907
  return { x, y, width, height };
1904
- }
1908
+ };
1905
1909
 
1906
1910
  /*
1907
1911
  Attempts to set a property directly on the canvas.style object
@@ -1922,14 +1926,7 @@ function textCore(p5, fn) {
1922
1926
  this.textCanvas().style[opt] = value;
1923
1927
 
1924
1928
  // check if the value was set successfully
1925
- if (this.textCanvas().style[opt] !== value) {
1926
-
1927
- // fails on precision for floating points, also quotes and spaces
1928
-
1929
- if (0) console.warn(`Unable to set '${opt}' property` // FES?
1930
- + ' on canvas.style. It may not be supported. Expected "'
1931
- + value + '" but got: "' + this.textCanvas().style[opt] + "'");
1932
- }
1929
+ if (this.textCanvas().style[opt] !== value) ;
1933
1930
  };
1934
1931
 
1935
1932
  /*
@@ -1958,25 +1955,6 @@ function textCore(p5, fn) {
1958
1955
  if (this.states.fontWeight !== val) this.textWeight(val);
1959
1956
  return val;
1960
1957
  case 'wdth':
1961
- if (0) { // attempt to map font-stretch to allowed keywords
1962
- const FontStretchMap = {
1963
- "ultra-condensed": 50,
1964
- "extra-condensed": 62.5,
1965
- "condensed": 75,
1966
- "semi-condensed": 87.5,
1967
- "normal": 100,
1968
- "semi-expanded": 112.5,
1969
- "expanded": 125,
1970
- "extra-expanded": 150,
1971
- "ultra-expanded": 200,
1972
- };
1973
- let values = Object.values(FontStretchMap);
1974
- const indexArr = values.map(function (k) { return Math.abs(k - val) })
1975
- const min = Math.min.apply(Math, indexArr)
1976
- let idx = indexArr.indexOf(min);
1977
- let stretch = Object.keys(FontStretchMap)[idx];
1978
- this.states.setValue('fontStretch', stretch);
1979
- }
1980
1958
  break;
1981
1959
  case 'ital':
1982
1960
  if (debug) console.log('setting font-style=' + (val ? 'italic' : 'normal'));
@@ -2085,7 +2063,7 @@ function textCore(p5, fn) {
2085
2063
  cachedDiv = ele;
2086
2064
  }
2087
2065
  return cachedDiv;
2088
- }
2066
+ };
2089
2067
 
2090
2068
 
2091
2069
  /*
@@ -2180,7 +2158,7 @@ function textCore(p5, fn) {
2180
2158
  default:
2181
2159
  return 0;
2182
2160
  }
2183
- }
2161
+ };
2184
2162
 
2185
2163
  /*
2186
2164
  Align the bounding box based on the current rectMode setting
@@ -2206,7 +2184,7 @@ function textCore(p5, fn) {
2206
2184
  }
2207
2185
  return bb;
2208
2186
  }
2209
- }
2187
+ };
2210
2188
 
2211
2189
  Renderer.prototype._rectModeAlignRevert = function (bb, width, height) {
2212
2190
  if (typeof width !== 'undefined') {
@@ -2229,7 +2207,7 @@ function textCore(p5, fn) {
2229
2207
  }
2230
2208
  return bb;
2231
2209
  }
2232
- }
2210
+ };
2233
2211
 
2234
2212
  /*
2235
2213
  Get the (tight) width of a single line of text
@@ -2270,8 +2248,7 @@ function textCore(p5, fn) {
2270
2248
  let asc = metrics.fontBoundingBoxAscent;
2271
2249
  let desc = metrics.fontBoundingBoxDescent;
2272
2250
  x -= this._xAlignOffset(this.states.textAlign, metrics.width);
2273
- return { x, y: y - asc, w: metrics.width, h: asc + desc };;
2274
- };
2251
+ return { x, y: y - asc, w: metrics.width, h: asc + desc }; };
2275
2252
 
2276
2253
  /*
2277
2254
  Set the textSize property in `this.states` if it has changed
@@ -2401,7 +2378,7 @@ function textCore(p5, fn) {
2401
2378
  }
2402
2379
  }
2403
2380
  return true;
2404
- }
2381
+ };
2405
2382
 
2406
2383
  /*
2407
2384
  Apply the text properties in `this.states` to the `this.textDrawingContext()`
@@ -2539,7 +2516,7 @@ function textCore(p5, fn) {
2539
2516
  }
2540
2517
  dataArr.forEach(ele => ele.y += yOff);
2541
2518
  return dataArr;
2542
- }
2519
+ };
2543
2520
  }
2544
2521
 
2545
2522
  if (p5.RendererGL) {
@@ -2627,12 +2604,12 @@ function textCore(p5, fn) {
2627
2604
  yOff += this.states.textFont.font?._verticalAlign(textSize) || 0; // Does this function exist?
2628
2605
  dataArr.forEach(ele => ele.y += yOff);
2629
2606
  return dataArr;
2630
- }
2607
+ };
2631
2608
  }
2632
2609
  }
2633
2610
 
2634
- export default textCore;
2635
-
2636
2611
  if (typeof p5 !== 'undefined') {
2637
2612
  textCore(p5, p5.prototype);
2638
2613
  }
2614
+
2615
+ export { textCore as default, textCoreConstants };
@@ -1,7 +1,7 @@
1
1
  // From https://github.com/radiovisual/unicode-range-json,
2
2
  // with decimal ranges removed to save space, and with category
3
3
  // names converted to lowercase ahead of time
4
- export const unicodeRanges = [
4
+ const unicodeRanges = [
5
5
  {
6
6
  category: "control character",
7
7
  hexrange: ["0000", "001f"],
@@ -1319,3 +1319,5 @@ export const unicodeRanges = [
1319
1319
  hexrange: ["100000", "10ffff"],
1320
1320
  },
1321
1321
  ];
1322
+
1323
+ export { unicodeRanges };
@@ -1043,8 +1043,8 @@ function conversion(p5, fn){
1043
1043
  };
1044
1044
  }
1045
1045
 
1046
- export default conversion;
1047
-
1048
1046
  if(typeof p5 !== 'undefined'){
1049
1047
  conversion(p5, p5.prototype);
1050
1048
  }
1049
+
1050
+ export { conversion as default };
@@ -2,8 +2,10 @@ import conversion from './conversion.js';
2
2
  import utilityFunctions from './utility_functions.js';
3
3
  import timeDate from './time_date.js';
4
4
 
5
- export default function(p5){
5
+ function utilities(p5){
6
6
  p5.registerAddon(conversion);
7
7
  p5.registerAddon(utilityFunctions);
8
8
  p5.registerAddon(timeDate);
9
9
  }
10
+
11
+ export { utilities as default };
@@ -117,11 +117,10 @@ function timeDate(p5, fn){
117
117
  *
118
118
  * If a sketch has a
119
119
  * <a href="#/p5/setup">setup()</a> function, then `millis()` begins tracking
120
- * time before the code in <a href="#/p5/setup">setup()</a> runs. If a
121
- * sketch includes a <a href="#/p5/preload">preload()</a> function, then
122
- * `millis()` begins tracking time as soon as the code in
123
- * <a href="#/p5/preload">preload()</a> starts running.
124
- *
120
+ * time before the code in <a href="#/p5/setup">setup()</a> runs. If a
121
+ * sketch includes asynchronous loading using `async`/`await`, then
122
+ * `millis()` begins tracking time as soon as the asynchronous code
123
+ * starts running.
125
124
  * @method millis
126
125
  * @return {Number} number of milliseconds since starting the sketch.
127
126
  *
@@ -339,8 +338,8 @@ function timeDate(p5, fn){
339
338
  };
340
339
  }
341
340
 
342
- export default timeDate;
343
-
344
341
  if(typeof p5 !== 'undefined'){
345
342
  timeDate(p5, p5.prototype);
346
343
  }
344
+
345
+ export { timeDate as default };
@@ -778,8 +778,8 @@ function utilityFunctions(p5, fn){
778
778
  };
779
779
  }
780
780
 
781
- export default utilityFunctions;
782
-
783
781
  if(typeof p5 !== 'undefined'){
784
782
  utilityFunctions(p5, p5.prototype);
785
783
  }
784
+
785
+ export { utilityFunctions as default };
@@ -0,0 +1,40 @@
1
+ import '../constants-C-g_eAdC.js';
2
+ export { p as default } from '../rendering--aAe5aq3.js';
3
+ import '../math/p5.Vector.js';
4
+ import './p5.Geometry.js';
5
+ import '../math/p5.Matrix.js';
6
+ import '../math/Matrices/Matrix.js';
7
+ import '../creating_reading-D4AAKRbx.js';
8
+ import 'colorjs.io/fn';
9
+ import '../color/color_spaces/hsb.js';
10
+ import '../dom/p5.Element.js';
11
+ import '../dom/p5.File.js';
12
+ import '../io/p5.XML.js';
13
+ import '../p5.Renderer-CwAYZOC2.js';
14
+ import '../image/filters.js';
15
+ import '../shape/custom_shapes.js';
16
+ import '../core/States.js';
17
+ import '../io/utilities.js';
18
+ import 'file-saver';
19
+ import '../dom/p5.MediaElement.js';
20
+ import '../shape/2d_primitives.js';
21
+ import '../core/helpers.js';
22
+ import '../shape/attributes.js';
23
+ import '../shape/curves.js';
24
+ import '../shape/vertex.js';
25
+ import '../color/setting.js';
26
+ import 'omggif';
27
+ import '../io/csv.js';
28
+ import 'gifenc';
29
+ import '../image/pixels.js';
30
+ import '../core/transform.js';
31
+ import './GeometryBuilder.js';
32
+ import '../math/Matrices/MatrixInterface.js';
33
+ import './p5.DataArray.js';
34
+ import './p5.Quat.js';
35
+ import './p5.RenderBuffer.js';
36
+ import './ShapeBuilder.js';
37
+ import 'libtess';
38
+ import './GeometryBufferCache.js';
39
+ import '../image/const.js';
40
+ import '../math/trigonometry.js';
@@ -1,4 +1,4 @@
1
- export class GeometryBufferCache {
1
+ class GeometryBufferCache {
2
2
  constructor(renderer) {
3
3
  this.renderer = renderer;
4
4
  this.cache = {};
@@ -107,3 +107,5 @@ export class GeometryBufferCache {
107
107
  freeBuffers(this.renderer.buffers.user);
108
108
  }
109
109
  }
110
+
111
+ export { GeometryBufferCache };
@@ -1,6 +1,10 @@
1
- import * as constants from '../core/constants';
2
- import { Matrix } from '../math/p5.Matrix';
3
- import { Geometry } from './p5.Geometry';
1
+ import { r as TRIANGLE_STRIP, s as QUAD_STRIP, q as TRIANGLE_FAN } from '../constants-C-g_eAdC.js';
2
+ import '../math/p5.Matrix.js';
3
+ import { Geometry } from './p5.Geometry.js';
4
+ import { Matrix } from '../math/Matrices/Matrix.js';
5
+ import '../math/p5.Vector.js';
6
+ import '../math/Matrices/MatrixInterface.js';
7
+ import './p5.DataArray.js';
4
8
 
5
9
  /**
6
10
  * @private
@@ -69,7 +73,7 @@ class GeometryBuilder {
69
73
  if (propName in inputUserVertexProps){
70
74
  continue;
71
75
  }
72
- const prop = builtUserVertexProps[propName]
76
+ const prop = builtUserVertexProps[propName];
73
77
  const size = prop.getDataSize();
74
78
  const numMissingValues = size * input.vertices.length;
75
79
  const missingValues = Array(numMissingValues).fill(0);
@@ -113,8 +117,8 @@ class GeometryBuilder {
113
117
 
114
118
  if (this.renderer.states.fillColor) {
115
119
  if (
116
- shapeMode === constants.TRIANGLE_STRIP ||
117
- shapeMode === constants.QUAD_STRIP
120
+ shapeMode === TRIANGLE_STRIP ||
121
+ shapeMode === QUAD_STRIP
118
122
  ) {
119
123
  for (let i = 2; i < geometry.vertices.length; i++) {
120
124
  if (i % 2 === 0) {
@@ -123,7 +127,7 @@ class GeometryBuilder {
123
127
  faces.push([i, i - 2, i - 1]);
124
128
  }
125
129
  }
126
- } else if (shapeMode === constants.TRIANGLE_FAN) {
130
+ } else if (shapeMode === TRIANGLE_FAN) {
127
131
  for (let i = 2; i < geometry.vertices.length; i++) {
128
132
  faces.push([0, i - 1, i]);
129
133
  }
@@ -161,4 +165,4 @@ class GeometryBuilder {
161
165
  */
162
166
  GeometryBuilder.nextGeometryId = 0;
163
167
 
164
- export default GeometryBuilder;
168
+ export { GeometryBuilder as default };