@scratch/scratch-render 11.1.0 → 11.2.0-cla.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.
@@ -1,3 +1,338 @@
1
1
  /* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
2
  Available via the MIT license.
3
3
  see: http://github.com/greggman/twgl.js for details */
4
+
5
+ /*!
6
+ * decimal.js v10.5.0
7
+ * An arbitrary-precision Decimal type for JavaScript.
8
+ * https://github.com/MikeMcl/decimal.js
9
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
10
+ * MIT Licence
11
+ */
12
+
13
+ /*!
14
+ * Copyright (c) 2015-2020, Salesforce.com, Inc.
15
+ * All rights reserved.
16
+ *
17
+ * Redistribution and use in source and binary forms, with or without
18
+ * modification, are permitted provided that the following conditions are met:
19
+ *
20
+ * 1. Redistributions of source code must retain the above copyright notice,
21
+ * this list of conditions and the following disclaimer.
22
+ *
23
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
24
+ * this list of conditions and the following disclaimer in the documentation
25
+ * and/or other materials provided with the distribution.
26
+ *
27
+ * 3. Neither the name of Salesforce.com nor the names of its contributors may
28
+ * be used to endorse or promote products derived from this software without
29
+ * specific prior written permission.
30
+ *
31
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
35
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41
+ * POSSIBILITY OF SUCH DAMAGE.
42
+ */
43
+
44
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
45
+
46
+ /**
47
+ * @description Calculate deltaE OK which is the simple root sum of squares
48
+ * @param {number[]} reference - Array of OKLab values: L as 0..1, a and b as -1..1
49
+ * @param {number[]} sample - Array of OKLab values: L as 0..1, a and b as -1..1
50
+ * @return {number} How different a color sample is from reference
51
+ *
52
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
53
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
54
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
55
+ */
56
+
57
+ /**
58
+ * @license MIT https://github.com/facelessuser/coloraide/blob/main/LICENSE.md
59
+ */
60
+
61
+ /**
62
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
63
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
64
+ *
65
+ * XYZ <-> LMS matrices recalculated for consistent reference white
66
+ * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484
67
+ */
68
+
69
+ /**
70
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
71
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
72
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
73
+ */
74
+
75
+ /**
76
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
77
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
78
+ */
79
+
80
+ /**
81
+ * @param {number} hue - Hue as degrees 0..360
82
+ * @param {number} white - Whiteness as percentage 0..100
83
+ * @param {number} black - Blackness as percentage 0..100
84
+ * @return {number[]} Array of RGB components 0..1
85
+ *
86
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
87
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
88
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js
89
+ */
90
+
91
+ /**
92
+ * @param {number} hue - Hue as degrees 0..360
93
+ * @param {number} sat - Saturation as percentage 0..100
94
+ * @param {number} light - Lightness as percentage 0..100
95
+ * @return {number[]} Array of sRGB components; in-gamut colors in range [0..1]
96
+ *
97
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
98
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
99
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js
100
+ */
101
+
102
+ /**
103
+ * Assuming XYZ is relative to D50, convert to CIE Lab
104
+ * from CIE standard, which now defines these as a rational fraction
105
+ *
106
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
107
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
108
+ */
109
+
110
+ /**
111
+ * Bradford chromatic adaptation from D50 to D65
112
+ *
113
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
114
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
115
+ */
116
+
117
+ /**
118
+ * Bradford chromatic adaptation from D65 to D50
119
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
120
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
121
+ * @see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
122
+ */
123
+
124
+ /**
125
+ * Character class utilities for XML NS 1.0 edition 3.
126
+ *
127
+ * @author Louis-Dominique Dubeau
128
+ * @license MIT
129
+ * @copyright Louis-Dominique Dubeau
130
+ */
131
+
132
+ /**
133
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
134
+ *
135
+ * @author Louis-Dominique Dubeau
136
+ * @license MIT
137
+ * @copyright Louis-Dominique Dubeau
138
+ */
139
+
140
+ /**
141
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
142
+ *
143
+ * @author Louis-Dominique Dubeau
144
+ * @license MIT
145
+ * @copyright Louis-Dominique Dubeau
146
+ */
147
+
148
+ /**
149
+ * Convert D50 XYZ to linear-light prophoto-rgb
150
+ *
151
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
152
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
153
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
154
+ */
155
+
156
+ /**
157
+ * Convert Lab to D50-adapted XYZ
158
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
159
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
160
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
161
+ */
162
+
163
+ /**
164
+ * Convert XYZ to linear-light P3
165
+ *
166
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
167
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
168
+ */
169
+
170
+ /**
171
+ * Convert XYZ to linear-light rec2020
172
+ *
173
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
174
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
175
+ */
176
+
177
+ /**
178
+ * Convert an array of a98-rgb values in the range 0.0 - 1.0
179
+ * to linear light (un-companded) form. Negative values are also now accepted
180
+ *
181
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
182
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
183
+ */
184
+
185
+ /**
186
+ * Convert an array of display-p3 RGB values in the range 0.0 - 1.0
187
+ * to linear light (un-companded) form.
188
+ *
189
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
190
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
191
+ */
192
+
193
+ /**
194
+ * Convert an array of gamma-corrected sRGB values in the 0.0 to 1.0 range to HSL.
195
+ *
196
+ * @param {Color} RGB [r, g, b]
197
+ * - Red component 0..1
198
+ * - Green component 0..1
199
+ * - Blue component 0..1
200
+ * @return {number[]} Array of HSL values: Hue as degrees 0..360, Saturation and Lightness as percentages 0..100
201
+ *
202
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
203
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
204
+ *
205
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/better-rgbToHsl.js
206
+ */
207
+
208
+ /**
209
+ * Convert an array of linear-light a98-rgb in the range 0.0-1.0
210
+ * to gamma corrected form. Negative values are also now accepted
211
+ *
212
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
213
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
214
+ */
215
+
216
+ /**
217
+ * Convert an array of linear-light a98-rgb values to CIE XYZ
218
+ * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
219
+ * has greater numerical precision than section 4.3.5.3 of
220
+ * https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
221
+ * but the values below were calculated from first principles
222
+ * from the chromaticity coordinates of R G B W
223
+ *
224
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
225
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
226
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
227
+ * @see https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
228
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/matrixmaker.html
229
+ */
230
+
231
+ /**
232
+ * Convert an array of linear-light display-p3 RGB in the range 0.0-1.0
233
+ * to gamma corrected form
234
+ *
235
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
236
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
237
+ */
238
+
239
+ /**
240
+ * Convert an array of linear-light display-p3 values to CIE XYZ
241
+ * using D65 (no chromatic adaptation)
242
+ *
243
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
244
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
245
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
246
+ */
247
+
248
+ /**
249
+ * Convert an array of linear-light prophoto-rgb in the range 0.0-1.0
250
+ * to gamma corrected form.
251
+ * Transfer curve is gamma 1.8 with a small linear portion.
252
+ *
253
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
254
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
255
+ */
256
+
257
+ /**
258
+ * Convert an array of linear-light prophoto-rgb values to CIE D50 XYZ.
259
+ * Matrix cannot be expressed in rational form, but is calculated to 64 bit accuracy.
260
+ *
261
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
262
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
263
+ * @see see https://github.com/w3c/csswg-drafts/issues/7675
264
+ */
265
+
266
+ /**
267
+ * Convert an array of linear-light rec2020 RGB in the range 0.0-1.0
268
+ * to gamma corrected form ITU-R BT.2020-2 p.4
269
+ *
270
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
271
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
272
+ */
273
+
274
+ /**
275
+ * Convert an array of linear-light rec2020 values to CIE XYZ
276
+ * using D65 (no chromatic adaptation)
277
+ *
278
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
279
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
280
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
281
+ */
282
+
283
+ /**
284
+ * Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form
285
+ * Extended transfer function:
286
+ * For negative values, linear portion extends on reflection
287
+ * of axis, then uses reflected pow below that
288
+ *
289
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
290
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
291
+ * @see https://en.wikipedia.org/wiki/SRGB
292
+ */
293
+
294
+ /**
295
+ * Convert an array of linear-light sRGB values to CIE XYZ
296
+ * using sRGB's own white, D65 (no chromatic adaptation)
297
+ *
298
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
299
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
300
+ */
301
+
302
+ /**
303
+ * Convert an array of of sRGB values where in-gamut values are in the range
304
+ * [0 - 1] to linear light (un-companded) form.
305
+ * Extended transfer function:
306
+ * For negative values, linear portion is extended on reflection of axis,
307
+ * then reflected power function is used.
308
+ *
309
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
310
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
311
+ * @see https://en.wikipedia.org/wiki/SRGB
312
+ */
313
+
314
+ /**
315
+ * Convert an array of prophoto-rgb values where in-gamut Colors are in the
316
+ * range [0.0 - 1.0] to linear light (un-companded) form. Transfer curve is
317
+ * gamma 1.8 with a small linear portion. Extended transfer function
318
+ *
319
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
320
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
321
+ */
322
+
323
+ /**
324
+ * Convert an array of rec2020 RGB values in the range 0.0 - 1.0
325
+ * to linear light (un-companded) form.
326
+ * ITU-R BT.2020-2 p.4
327
+ *
328
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
329
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
330
+ */
331
+
332
+ /**
333
+ * Given OKLab, convert to XYZ relative to D65
334
+ *
335
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
336
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
337
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
338
+ */