@p4ulcristian/iris-layout 0.2.0 → 0.2.2
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.
- package/dist/cljs-runtime/cljs.core.js +38746 -0
- package/dist/cljs-runtime/cljs.core.js.map +1 -0
- package/dist/cljs-runtime/cljs.pprint.js +8400 -0
- package/dist/cljs-runtime/cljs.pprint.js.map +1 -0
- package/dist/cljs-runtime/cljs.stacktrace.js +561 -0
- package/dist/cljs-runtime/cljs.stacktrace.js.map +1 -0
- package/dist/cljs-runtime/cljs_env.js +1286 -0
- package/dist/cljs-runtime/clojure.data.js +295 -0
- package/dist/cljs-runtime/clojure.data.js.map +1 -0
- package/dist/cljs-runtime/clojure.set.js +382 -0
- package/dist/cljs-runtime/clojure.set.js.map +1 -0
- package/dist/cljs-runtime/clojure.string.js +480 -0
- package/dist/cljs-runtime/clojure.string.js.map +1 -0
- package/dist/cljs-runtime/clojure.walk.js +132 -0
- package/dist/cljs-runtime/clojure.walk.js.map +1 -0
- package/dist/cljs-runtime/devtools.async.js +90 -0
- package/dist/cljs-runtime/devtools.async.js.map +1 -0
- package/dist/cljs-runtime/devtools.context.js +11 -0
- package/dist/cljs-runtime/devtools.context.js.map +1 -0
- package/dist/cljs-runtime/devtools.core.js +175 -0
- package/dist/cljs-runtime/devtools.core.js.map +1 -0
- package/dist/cljs-runtime/devtools.defaults.js +20 -0
- package/dist/cljs-runtime/devtools.defaults.js.map +1 -0
- package/dist/cljs-runtime/devtools.format.js +631 -0
- package/dist/cljs-runtime/devtools.format.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.budgeting.js +182 -0
- package/dist/cljs-runtime/devtools.formatters.budgeting.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.core.js +220 -0
- package/dist/cljs-runtime/devtools.formatters.core.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.helpers.js +228 -0
- package/dist/cljs-runtime/devtools.formatters.helpers.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.js +261 -0
- package/dist/cljs-runtime/devtools.formatters.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.markup.js +1174 -0
- package/dist/cljs-runtime/devtools.formatters.markup.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.printing.js +313 -0
- package/dist/cljs-runtime/devtools.formatters.printing.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.state.js +325 -0
- package/dist/cljs-runtime/devtools.formatters.state.js.map +1 -0
- package/dist/cljs-runtime/devtools.formatters.templating.js +666 -0
- package/dist/cljs-runtime/devtools.formatters.templating.js.map +1 -0
- package/dist/cljs-runtime/devtools.hints.js +193 -0
- package/dist/cljs-runtime/devtools.hints.js.map +1 -0
- package/dist/cljs-runtime/devtools.munging.js +1058 -0
- package/dist/cljs-runtime/devtools.munging.js.map +1 -0
- package/dist/cljs-runtime/devtools.prefs.js +87 -0
- package/dist/cljs-runtime/devtools.prefs.js.map +1 -0
- package/dist/cljs-runtime/devtools.preload.js +11 -0
- package/dist/cljs-runtime/devtools.preload.js.map +1 -0
- package/dist/cljs-runtime/devtools.protocols.js +98 -0
- package/dist/cljs-runtime/devtools.protocols.js.map +1 -0
- package/dist/cljs-runtime/devtools.reporter.js +81 -0
- package/dist/cljs-runtime/devtools.reporter.js.map +1 -0
- package/dist/cljs-runtime/devtools.toolbox.js +141 -0
- package/dist/cljs-runtime/devtools.toolbox.js.map +1 -0
- package/dist/cljs-runtime/devtools.util.js +517 -0
- package/dist/cljs-runtime/devtools.util.js.map +1 -0
- package/dist/cljs-runtime/devtools.version.js +9 -0
- package/dist/cljs-runtime/devtools.version.js.map +1 -0
- package/dist/cljs-runtime/goog.array.array.js +659 -0
- package/dist/cljs-runtime/goog.array.array.js.map +9 -0
- package/dist/cljs-runtime/goog.asserts.asserts.js +133 -0
- package/dist/cljs-runtime/goog.asserts.asserts.js.map +9 -0
- package/dist/cljs-runtime/goog.asserts.dom.js +90 -0
- package/dist/cljs-runtime/goog.asserts.dom.js.map +9 -0
- package/dist/cljs-runtime/goog.async.nexttick.js +93 -0
- package/dist/cljs-runtime/goog.async.nexttick.js.map +9 -0
- package/dist/cljs-runtime/goog.base.js +1261 -0
- package/dist/cljs-runtime/goog.base.js.map +9 -0
- package/dist/cljs-runtime/goog.collections.maps.js +82 -0
- package/dist/cljs-runtime/goog.collections.maps.js.map +9 -0
- package/dist/cljs-runtime/goog.debug.entrypointregistry.js +44 -0
- package/dist/cljs-runtime/goog.debug.entrypointregistry.js.map +9 -0
- package/dist/cljs-runtime/goog.debug.error.js +30 -0
- package/dist/cljs-runtime/goog.debug.error.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.asserts.js +40 -0
- package/dist/cljs-runtime/goog.dom.asserts.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.browserfeature.js +21 -0
- package/dist/cljs-runtime/goog.dom.browserfeature.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.dom.js +1087 -0
- package/dist/cljs-runtime/goog.dom.dom.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.element.js +69 -0
- package/dist/cljs-runtime/goog.dom.element.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.htmlelement.js +7 -0
- package/dist/cljs-runtime/goog.dom.htmlelement.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.nodetype.js +6 -0
- package/dist/cljs-runtime/goog.dom.nodetype.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.safe.js +277 -0
- package/dist/cljs-runtime/goog.dom.safe.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.tagname.js +147 -0
- package/dist/cljs-runtime/goog.dom.tagname.js.map +9 -0
- package/dist/cljs-runtime/goog.dom.tags.js +10 -0
- package/dist/cljs-runtime/goog.dom.tags.js.map +9 -0
- package/dist/cljs-runtime/goog.flags.flags.js +12 -0
- package/dist/cljs-runtime/goog.flags.flags.js.map +9 -0
- package/dist/cljs-runtime/goog.fs.blob.js +38 -0
- package/dist/cljs-runtime/goog.fs.blob.js.map +9 -0
- package/dist/cljs-runtime/goog.fs.url.js +37 -0
- package/dist/cljs-runtime/goog.fs.url.js.map +9 -0
- package/dist/cljs-runtime/goog.functions.functions.js +211 -0
- package/dist/cljs-runtime/goog.functions.functions.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safehtml.js +321 -0
- package/dist/cljs-runtime/goog.html.safehtml.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safescript.js +65 -0
- package/dist/cljs-runtime/goog.html.safescript.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safestyle.js +175 -0
- package/dist/cljs-runtime/goog.html.safestyle.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safestylesheet.js +99 -0
- package/dist/cljs-runtime/goog.html.safestylesheet.js.map +9 -0
- package/dist/cljs-runtime/goog.html.safeurl.js +231 -0
- package/dist/cljs-runtime/goog.html.safeurl.js.map +9 -0
- package/dist/cljs-runtime/goog.html.trustedresourceurl.js +123 -0
- package/dist/cljs-runtime/goog.html.trustedresourceurl.js.map +9 -0
- package/dist/cljs-runtime/goog.html.trustedtypes.js +16 -0
- package/dist/cljs-runtime/goog.html.trustedtypes.js.map +9 -0
- package/dist/cljs-runtime/goog.html.uncheckedconversions.js +52 -0
- package/dist/cljs-runtime/goog.html.uncheckedconversions.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.browser.js +352 -0
- package/dist/cljs-runtime/goog.labs.useragent.browser.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.engine.js +73 -0
- package/dist/cljs-runtime/goog.labs.useragent.engine.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js +14 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js +74 -0
- package/dist/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.platform.js +147 -0
- package/dist/cljs-runtime/goog.labs.useragent.platform.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.useragent.js +21 -0
- package/dist/cljs-runtime/goog.labs.useragent.useragent.js.map +9 -0
- package/dist/cljs-runtime/goog.labs.useragent.util.js +81 -0
- package/dist/cljs-runtime/goog.labs.useragent.util.js.map +9 -0
- package/dist/cljs-runtime/goog.math.coordinate.js +97 -0
- package/dist/cljs-runtime/goog.math.coordinate.js.map +9 -0
- package/dist/cljs-runtime/goog.math.integer.js +445 -0
- package/dist/cljs-runtime/goog.math.integer.js.map +9 -0
- package/dist/cljs-runtime/goog.math.long.js +437 -0
- package/dist/cljs-runtime/goog.math.long.js.map +9 -0
- package/dist/cljs-runtime/goog.math.math.js +158 -0
- package/dist/cljs-runtime/goog.math.math.js.map +9 -0
- package/dist/cljs-runtime/goog.math.size.js +76 -0
- package/dist/cljs-runtime/goog.math.size.js.map +9 -0
- package/dist/cljs-runtime/goog.object.object.js +284 -0
- package/dist/cljs-runtime/goog.object.object.js.map +9 -0
- package/dist/cljs-runtime/goog.reflect.reflect.js +32 -0
- package/dist/cljs-runtime/goog.reflect.reflect.js.map +9 -0
- package/dist/cljs-runtime/goog.string.const.js +35 -0
- package/dist/cljs-runtime/goog.string.const.js.map +9 -0
- package/dist/cljs-runtime/goog.string.internal.js +119 -0
- package/dist/cljs-runtime/goog.string.internal.js.map +9 -0
- package/dist/cljs-runtime/goog.string.string.js +462 -0
- package/dist/cljs-runtime/goog.string.string.js.map +9 -0
- package/dist/cljs-runtime/goog.string.stringbuffer.js +32 -0
- package/dist/cljs-runtime/goog.string.stringbuffer.js.map +9 -0
- package/dist/cljs-runtime/goog.string.typedstring.js +9 -0
- package/dist/cljs-runtime/goog.string.typedstring.js.map +9 -0
- package/dist/cljs-runtime/goog.structs.structs.js +199 -0
- package/dist/cljs-runtime/goog.structs.structs.js.map +9 -0
- package/dist/cljs-runtime/goog.uri.uri.js +628 -0
- package/dist/cljs-runtime/goog.uri.uri.js.map +9 -0
- package/dist/cljs-runtime/goog.uri.utils.js +326 -0
- package/dist/cljs-runtime/goog.uri.utils.js.map +9 -0
- package/dist/cljs-runtime/goog.useragent.useragent.js +139 -0
- package/dist/cljs-runtime/goog.useragent.useragent.js.map +9 -0
- package/dist/cljs-runtime/iris_layout.components.entity_card_group.js +202 -0
- package/dist/cljs-runtime/iris_layout.components.entity_card_group.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile.js +295 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js +33 -0
- package/dist/cljs-runtime/iris_layout.components.entity_tile_group.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.resizer.js +91 -0
- package/dist/cljs-runtime/iris_layout.components.resizer.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js +399 -0
- package/dist/cljs-runtime/iris_layout.components.touch_drag.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.core.js +1372 -0
- package/dist/cljs-runtime/iris_layout.core.js.map +1 -0
- package/dist/cljs-runtime/iris_layout.layout.js +328 -0
- package/dist/cljs-runtime/iris_layout.layout.js.map +1 -0
- package/dist/cljs-runtime/reagent.core.js +993 -0
- package/dist/cljs-runtime/reagent.core.js.map +1 -0
- package/dist/cljs-runtime/reagent.debug.js +75 -0
- package/dist/cljs-runtime/reagent.debug.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.batching.js +270 -0
- package/dist/cljs-runtime/reagent.impl.batching.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.component.js +758 -0
- package/dist/cljs-runtime/reagent.impl.component.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.input.js +175 -0
- package/dist/cljs-runtime/reagent.impl.input.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.protocols.js +99 -0
- package/dist/cljs-runtime/reagent.impl.protocols.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.template.js +660 -0
- package/dist/cljs-runtime/reagent.impl.template.js.map +1 -0
- package/dist/cljs-runtime/reagent.impl.util.js +748 -0
- package/dist/cljs-runtime/reagent.impl.util.js.map +1 -0
- package/dist/cljs-runtime/reagent.ratom.js +1668 -0
- package/dist/cljs-runtime/reagent.ratom.js.map +1 -0
- package/dist/cljs-runtime/shadow.esm.esm_import$react.js +5 -0
- package/dist/cljs-runtime/shadow.module.iris-layout.append.js +2 -0
- package/dist/cljs-runtime/shadow.module.iris-layout.prepend.js +2 -0
- package/dist/iris-layout.js +375 -355
- package/dist/styles.css +287 -9
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
import "./goog.asserts.asserts.js";
|
|
3
|
+
goog.provide("goog.math");
|
|
4
|
+
goog.require("goog.asserts");
|
|
5
|
+
goog.math.randomInt = function(a) {
|
|
6
|
+
return Math.floor(Math.random() * a);
|
|
7
|
+
};
|
|
8
|
+
goog.math.uniformRandom = function(a, b) {
|
|
9
|
+
return a + Math.random() * (b - a);
|
|
10
|
+
};
|
|
11
|
+
goog.math.clamp = function(value, min, max) {
|
|
12
|
+
return Math.min(Math.max(value, min), max);
|
|
13
|
+
};
|
|
14
|
+
goog.math.modulo = function(a, b) {
|
|
15
|
+
var r = a % b;
|
|
16
|
+
return r * b < 0 ? r + b : r;
|
|
17
|
+
};
|
|
18
|
+
goog.math.lerp = function(a, b, x) {
|
|
19
|
+
return a + x * (b - a);
|
|
20
|
+
};
|
|
21
|
+
goog.math.nearlyEquals = function(a, b, opt_tolerance) {
|
|
22
|
+
return Math.abs(a - b) <= (opt_tolerance || 0.000001);
|
|
23
|
+
};
|
|
24
|
+
goog.math.standardAngle = function(angle) {
|
|
25
|
+
return goog.math.modulo(angle, 360);
|
|
26
|
+
};
|
|
27
|
+
goog.math.standardAngleInRadians = function(angle) {
|
|
28
|
+
return goog.math.modulo(angle, 2 * Math.PI);
|
|
29
|
+
};
|
|
30
|
+
goog.math.toRadians = function(angleDegrees) {
|
|
31
|
+
return angleDegrees * Math.PI / 180;
|
|
32
|
+
};
|
|
33
|
+
goog.math.toDegrees = function(angleRadians) {
|
|
34
|
+
return angleRadians * 180 / Math.PI;
|
|
35
|
+
};
|
|
36
|
+
goog.math.angleDx = function(degrees, radius) {
|
|
37
|
+
return radius * Math.cos(goog.math.toRadians(degrees));
|
|
38
|
+
};
|
|
39
|
+
goog.math.angleDy = function(degrees, radius) {
|
|
40
|
+
return radius * Math.sin(goog.math.toRadians(degrees));
|
|
41
|
+
};
|
|
42
|
+
goog.math.angle = function(x1, y1, x2, y2) {
|
|
43
|
+
return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(y2 - y1, x2 - x1)));
|
|
44
|
+
};
|
|
45
|
+
goog.math.angleDifference = function(startAngle, endAngle) {
|
|
46
|
+
var d = goog.math.standardAngle(endAngle) - goog.math.standardAngle(startAngle);
|
|
47
|
+
if (d > 180) {
|
|
48
|
+
d = d - 360;
|
|
49
|
+
} else if (d <= -180) {
|
|
50
|
+
d = 360 + d;
|
|
51
|
+
}
|
|
52
|
+
return d;
|
|
53
|
+
};
|
|
54
|
+
goog.math.sign = function(x) {
|
|
55
|
+
if (x > 0) {
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
if (x < 0) {
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
return x;
|
|
62
|
+
};
|
|
63
|
+
goog.math.longestCommonSubsequence = function(array1, array2, opt_compareFn, opt_collectorFn) {
|
|
64
|
+
var compare = opt_compareFn || function(a, b) {
|
|
65
|
+
return a == b;
|
|
66
|
+
};
|
|
67
|
+
var collect = opt_collectorFn || function(i1, i2) {
|
|
68
|
+
return array1[i1];
|
|
69
|
+
};
|
|
70
|
+
var length1 = array1.length;
|
|
71
|
+
var length2 = array2.length;
|
|
72
|
+
var arr = [];
|
|
73
|
+
var i = 0;
|
|
74
|
+
for (; i < length1 + 1; i++) {
|
|
75
|
+
arr[i] = [];
|
|
76
|
+
arr[i][0] = 0;
|
|
77
|
+
}
|
|
78
|
+
var j = 0;
|
|
79
|
+
for (; j < length2 + 1; j++) {
|
|
80
|
+
arr[0][j] = 0;
|
|
81
|
+
}
|
|
82
|
+
i = 1;
|
|
83
|
+
for (; i <= length1; i++) {
|
|
84
|
+
j = 1;
|
|
85
|
+
for (; j <= length2; j++) {
|
|
86
|
+
if (compare(array1[i - 1], array2[j - 1])) {
|
|
87
|
+
arr[i][j] = arr[i - 1][j - 1] + 1;
|
|
88
|
+
} else {
|
|
89
|
+
arr[i][j] = Math.max(arr[i - 1][j], arr[i][j - 1]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
var result = [];
|
|
94
|
+
i = length1;
|
|
95
|
+
j = length2;
|
|
96
|
+
for (; i > 0 && j > 0;) {
|
|
97
|
+
if (compare(array1[i - 1], array2[j - 1])) {
|
|
98
|
+
result.unshift(collect(i - 1, j - 1));
|
|
99
|
+
i--;
|
|
100
|
+
j--;
|
|
101
|
+
} else {
|
|
102
|
+
if (arr[i - 1][j] > arr[i][j - 1]) {
|
|
103
|
+
i--;
|
|
104
|
+
} else {
|
|
105
|
+
j--;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
};
|
|
111
|
+
goog.math.sum = function(var_args) {
|
|
112
|
+
return Array.prototype.reduce.call(arguments, function(sum, value) {
|
|
113
|
+
return sum + value;
|
|
114
|
+
}, 0);
|
|
115
|
+
};
|
|
116
|
+
goog.math.average = function(var_args) {
|
|
117
|
+
return goog.math.sum.apply(null, arguments) / arguments.length;
|
|
118
|
+
};
|
|
119
|
+
goog.math.sampleVariance = function(var_args) {
|
|
120
|
+
var sampleSize = arguments.length;
|
|
121
|
+
if (sampleSize < 2) {
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
var mean = goog.math.average.apply(null, arguments);
|
|
125
|
+
var variance = goog.math.sum.apply(null, Array.prototype.map.call(arguments, function(val) {
|
|
126
|
+
return Math.pow(val - mean, 2);
|
|
127
|
+
})) / (sampleSize - 1);
|
|
128
|
+
return variance;
|
|
129
|
+
};
|
|
130
|
+
goog.math.standardDeviation = function(var_args) {
|
|
131
|
+
return Math.sqrt(goog.math.sampleVariance.apply(null, arguments));
|
|
132
|
+
};
|
|
133
|
+
goog.math.isInt = function(num) {
|
|
134
|
+
return isFinite(num) && num % 1 == 0;
|
|
135
|
+
};
|
|
136
|
+
goog.math.isFiniteNumber = function(num) {
|
|
137
|
+
return isFinite(num);
|
|
138
|
+
};
|
|
139
|
+
goog.math.isNegativeZero = function(num) {
|
|
140
|
+
return num == 0 && 1 / num < 0;
|
|
141
|
+
};
|
|
142
|
+
goog.math.log10Floor = function(num) {
|
|
143
|
+
if (num > 0) {
|
|
144
|
+
var x = Math.round(Math.log(num) * Math.LOG10E);
|
|
145
|
+
return x - (parseFloat("1e" + x) > num ? 1 : 0);
|
|
146
|
+
}
|
|
147
|
+
return num == 0 ? -Infinity : NaN;
|
|
148
|
+
};
|
|
149
|
+
goog.math.safeFloor = function(num, opt_epsilon) {
|
|
150
|
+
goog.asserts.assert(opt_epsilon === undefined || opt_epsilon > 0);
|
|
151
|
+
return Math.floor(num + (opt_epsilon || 2e-15));
|
|
152
|
+
};
|
|
153
|
+
goog.math.safeCeil = function(num, opt_epsilon) {
|
|
154
|
+
goog.asserts.assert(opt_epsilon === undefined || opt_epsilon > 0);
|
|
155
|
+
return Math.ceil(num - (opt_epsilon || 2e-15));
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=goog.math.math.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version":3,
|
|
3
|
+
"file":"goog.math.math.js",
|
|
4
|
+
"lineCount":155,
|
|
5
|
+
"mappings":"AAUAA,IAAKC,CAAAA,OAAL,CAAa,WAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,cAAb,CAAA;AAQAF,IAAKG,CAAAA,IAAKC,CAAAA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+
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Additional mathematical functions.\n */\n\ngoog.provide('goog.math');\n\ngoog.require('goog.asserts');\n\n\n/**\n * Returns a random integer greater than or equal to 0 and less than `a`.\n * @param {number} a The upper bound for the random integer (exclusive).\n * @return {number} A random integer N such that 0 <= N < a.\n */\ngoog.math.randomInt = function(a) {\n 'use strict';\n return Math.floor(Math.random() * a);\n};\n\n\n/**\n * Returns a random number greater than or equal to `a` and less than\n * `b`.\n * @param {number} a The lower bound for the random number (inclusive).\n * @param {number} b The upper bound for the random number (exclusive).\n * @return {number} A random number N such that a <= N < b.\n */\ngoog.math.uniformRandom = function(a, b) {\n 'use strict';\n return a + Math.random() * (b - a);\n};\n\n\n/**\n * Takes a number and clamps it to within the provided bounds.\n * @param {number} value The input number.\n * @param {number} min The minimum value to return.\n * @param {number} max The maximum value to return.\n * @return {number} The input number if it is within bounds, or the nearest\n * number within the bounds.\n */\ngoog.math.clamp = function(value, min, max) {\n 'use strict';\n return Math.min(Math.max(value, min), max);\n};\n\n\n/**\n * The % operator in JavaScript returns the remainder of a / b, but differs from\n * some other languages in that the result will have the same sign as the\n * dividend. For example, -1 % 8 == -1, whereas in some other languages\n * (such as Python) the result would be 7. This function emulates the more\n * correct modulo behavior, which is useful for certain applications such as\n * calculating an offset index in a circular list.\n *\n * @param {number} a The dividend.\n * @param {number} b The divisor.\n * @return {number} a % b where the result is between 0 and b (either 0 <= x < b\n * or b < x <= 0, depending on the sign of b).\n */\ngoog.math.modulo = function(a, b) {\n 'use strict';\n var r = a % b;\n // If r and b differ in sign, add b to wrap the result to the correct sign.\n return (r * b < 0) ? r + b : r;\n};\n\n\n/**\n * Performs linear interpolation between values a and b. Returns the value\n * between a and b proportional to x (when x is between 0 and 1. When x is\n * outside this range, the return value is a linear extrapolation).\n * @param {number} a A number.\n * @param {number} b A number.\n * @param {number} x The proportion between a and b.\n * @return {number} The interpolated value between a and b.\n */\ngoog.math.lerp = function(a, b, x) {\n 'use strict';\n return a + x * (b - a);\n};\n\n\n/**\n * Tests whether the two values are equal to each other, within a certain\n * tolerance to adjust for floating point errors.\n * @param {number} a A number.\n * @param {number} b A number.\n * @param {number=} opt_tolerance Optional tolerance range. Defaults\n * to 0.000001. If specified, should be greater than 0.\n * @return {boolean} Whether `a` and `b` are nearly equal.\n */\ngoog.math.nearlyEquals = function(a, b, opt_tolerance) {\n 'use strict';\n return Math.abs(a - b) <= (opt_tolerance || 0.000001);\n};\n\n\n// TODO(user): Rename to normalizeAngle, retaining old name as deprecated\n// alias.\n/**\n * Normalizes an angle to be in range [0-360). Angles outside this range will\n * be normalized to be the equivalent angle with that range.\n * @param {number} angle Angle in degrees.\n * @return {number} Standardized angle.\n */\ngoog.math.standardAngle = function(angle) {\n 'use strict';\n return goog.math.modulo(angle, 360);\n};\n\n\n/**\n * Normalizes an angle to be in range [0-2*PI). Angles outside this range will\n * be normalized to be the equivalent angle with that range.\n * @param {number} angle Angle in radians.\n * @return {number} Standardized angle.\n */\ngoog.math.standardAngleInRadians = function(angle) {\n 'use strict';\n return goog.math.modulo(angle, 2 * Math.PI);\n};\n\n\n/**\n * Converts degrees to radians.\n * @param {number} angleDegrees Angle in degrees.\n * @return {number} Angle in radians.\n */\ngoog.math.toRadians = function(angleDegrees) {\n 'use strict';\n return angleDegrees * Math.PI / 180;\n};\n\n\n/**\n * Converts radians to degrees.\n * @param {number} angleRadians Angle in radians.\n * @return {number} Angle in degrees.\n */\ngoog.math.toDegrees = function(angleRadians) {\n 'use strict';\n return angleRadians * 180 / Math.PI;\n};\n\n\n/**\n * For a given angle and radius, finds the X portion of the offset.\n * @param {number} degrees Angle in degrees (zero points in +X direction).\n * @param {number} radius Radius.\n * @return {number} The x-distance for the angle and radius.\n */\ngoog.math.angleDx = function(degrees, radius) {\n 'use strict';\n return radius * Math.cos(goog.math.toRadians(degrees));\n};\n\n\n/**\n * For a given angle and radius, finds the Y portion of the offset.\n * @param {number} degrees Angle in degrees (zero points in +X direction).\n * @param {number} radius Radius.\n * @return {number} The y-distance for the angle and radius.\n */\ngoog.math.angleDy = function(degrees, radius) {\n 'use strict';\n return radius * Math.sin(goog.math.toRadians(degrees));\n};\n\n\n/**\n * Computes the angle between two points (x1,y1) and (x2,y2).\n * Angle zero points in the +X direction, 90 degrees points in the +Y\n * direction (down) and from there we grow clockwise towards 360 degrees.\n * @param {number} x1 x of first point.\n * @param {number} y1 y of first point.\n * @param {number} x2 x of second point.\n * @param {number} y2 y of second point.\n * @return {number} Standardized angle in degrees of the vector from\n * x1,y1 to x2,y2.\n */\ngoog.math.angle = function(x1, y1, x2, y2) {\n 'use strict';\n return goog.math.standardAngle(\n goog.math.toDegrees(Math.atan2(y2 - y1, x2 - x1)));\n};\n\n\n/**\n * Computes the difference between startAngle and endAngle (angles in degrees).\n * @param {number} startAngle Start angle in degrees.\n * @param {number} endAngle End angle in degrees.\n * @return {number} The number of degrees that when added to\n * startAngle will result in endAngle. Positive numbers mean that the\n * direction is clockwise. Negative numbers indicate a counter-clockwise\n * direction.\n * The shortest route (clockwise vs counter-clockwise) between the angles\n * is used.\n * When the difference is 180 degrees, the function returns 180 (not -180)\n * angleDifference(30, 40) is 10, and angleDifference(40, 30) is -10.\n * angleDifference(350, 10) is 20, and angleDifference(10, 350) is -20.\n */\ngoog.math.angleDifference = function(startAngle, endAngle) {\n 'use strict';\n var d =\n goog.math.standardAngle(endAngle) - goog.math.standardAngle(startAngle);\n if (d > 180) {\n d = d - 360;\n } else if (d <= -180) {\n d = 360 + d;\n }\n return d;\n};\n\n\n/**\n * Returns the sign of a number as per the \"sign\" or \"signum\" function.\n * @param {number} x The number to take the sign of.\n * @return {number} -1 when negative, 1 when positive, 0 when 0. Preserves\n * signed zeros and NaN.\n */\ngoog.math.sign = function(x) {\n 'use strict';\n if (x > 0) {\n return 1;\n }\n if (x < 0) {\n return -1;\n }\n return x; // Preserves signed zeros and NaN.\n};\n\n\n/**\n * JavaScript implementation of Longest Common Subsequence problem.\n * http://en.wikipedia.org/wiki/Longest_common_subsequence\n *\n * Returns the longest possible array that is subarray of both of given arrays.\n *\n * @param {IArrayLike<S>} array1 First array of objects.\n * @param {IArrayLike<T>} array2 Second array of objects.\n * @param {Function=} opt_compareFn Function that acts as a custom comparator\n * for the array ojects. Function should return true if objects are equal,\n * otherwise false.\n * @param {Function=} opt_collectorFn Function used to decide what to return\n * as a result subsequence. It accepts 2 arguments: index of common element\n * in the first array and index in the second. The default function returns\n * element from the first array.\n * @return {!Array<S|T>} A list of objects that are common to both arrays\n * such that there is no common subsequence with size greater than the\n * length of the list.\n * @template S,T\n */\ngoog.math.longestCommonSubsequence = function(\n array1, array2, opt_compareFn, opt_collectorFn) {\n 'use strict';\n var compare = opt_compareFn || function(a, b) {\n 'use strict';\n return a == b;\n };\n\n var collect = opt_collectorFn || function(i1, i2) {\n 'use strict';\n return array1[i1];\n };\n\n var length1 = array1.length;\n var length2 = array2.length;\n\n var arr = [];\n for (var i = 0; i < length1 + 1; i++) {\n arr[i] = [];\n arr[i][0] = 0;\n }\n\n for (var j = 0; j < length2 + 1; j++) {\n arr[0][j] = 0;\n }\n\n for (i = 1; i <= length1; i++) {\n for (j = 1; j <= length2; j++) {\n if (compare(array1[i - 1], array2[j - 1])) {\n arr[i][j] = arr[i - 1][j - 1] + 1;\n } else {\n arr[i][j] = Math.max(arr[i - 1][j], arr[i][j - 1]);\n }\n }\n }\n\n // Backtracking\n var result = [];\n var i = length1, j = length2;\n while (i > 0 && j > 0) {\n if (compare(array1[i - 1], array2[j - 1])) {\n result.unshift(collect(i - 1, j - 1));\n i--;\n j--;\n } else {\n if (arr[i - 1][j] > arr[i][j - 1]) {\n i--;\n } else {\n j--;\n }\n }\n }\n\n return result;\n};\n\n\n/**\n * Returns the sum of the arguments.\n * @param {...number} var_args Numbers to add.\n * @return {number} The sum of the arguments (0 if no arguments were provided,\n * `NaN` if any of the arguments is not a valid number).\n */\ngoog.math.sum = function(var_args) {\n 'use strict';\n return /** @type {number} */ (\n Array.prototype.reduce.call(arguments, function(sum, value) {\n 'use strict';\n return sum + value;\n }, 0));\n};\n\n\n/**\n * Returns the arithmetic mean of the arguments.\n * @param {...number} var_args Numbers to average.\n * @return {number} The average of the arguments (`NaN` if no arguments\n * were provided or any of the arguments is not a valid number).\n */\ngoog.math.average = function(var_args) {\n 'use strict';\n return goog.math.sum.apply(null, arguments) / arguments.length;\n};\n\n\n/**\n * Returns the unbiased sample variance of the arguments. For a definition,\n * see e.g. http://en.wikipedia.org/wiki/Variance\n * @param {...number} var_args Number samples to analyze.\n * @return {number} The unbiased sample variance of the arguments (0 if fewer\n * than two samples were provided, or `NaN` if any of the samples is\n * not a valid number).\n */\ngoog.math.sampleVariance = function(var_args) {\n 'use strict';\n var sampleSize = arguments.length;\n if (sampleSize < 2) {\n return 0;\n }\n\n var mean = goog.math.average.apply(null, arguments);\n var variance = goog.math.sum.apply(\n null,\n Array.prototype.map.call(\n arguments,\n function(val) {\n 'use strict';\n return Math.pow(val - mean, 2);\n })) /\n (sampleSize - 1);\n\n return variance;\n};\n\n\n/**\n * Returns the sample standard deviation of the arguments. For a definition of\n * sample standard deviation, see e.g.\n * http://en.wikipedia.org/wiki/Standard_deviation\n * @param {...number} var_args Number samples to analyze.\n * @return {number} The sample standard deviation of the arguments (0 if fewer\n * than two samples were provided, or `NaN` if any of the samples is\n * not a valid number).\n */\ngoog.math.standardDeviation = function(var_args) {\n 'use strict';\n return Math.sqrt(goog.math.sampleVariance.apply(null, arguments));\n};\n\n\n/**\n * Returns whether the supplied number represents an integer, i.e. that is has\n * no fractional component. No range-checking is performed on the number.\n * @param {number} num The number to test.\n * @return {boolean} Whether `num` is an integer.\n */\ngoog.math.isInt = function(num) {\n 'use strict';\n return isFinite(num) && num % 1 == 0;\n};\n\n\n/**\n * Returns whether the supplied number is finite and not NaN.\n * @param {number} num The number to test.\n * @return {boolean} Whether `num` is a finite number.\n * @deprecated Use {@link isFinite} instead.\n */\ngoog.math.isFiniteNumber = function(num) {\n 'use strict';\n return isFinite(num);\n};\n\n\n/**\n * @param {number} num The number to test.\n * @return {boolean} Whether it is negative zero.\n */\ngoog.math.isNegativeZero = function(num) {\n 'use strict';\n return num == 0 && 1 / num < 0;\n};\n\n\n/**\n * Returns the precise value of floor(log10(num)).\n * Simpler implementations didn't work because of floating point rounding\n * errors. For example\n * <ul>\n * <li>Math.floor(Math.log(num) / Math.LN10) is off by one for num == 1e+3.\n * <li>Math.floor(Math.log(num) * Math.LOG10E) is off by one for num == 1e+15.\n * <li>Math.floor(Math.log10(num)) is off by one for num == 1e+15 - 1.\n * </ul>\n * @param {number} num A floating point number.\n * @return {number} Its logarithm to base 10 rounded down to the nearest\n * integer if num > 0. -Infinity if num == 0. NaN if num < 0.\n */\ngoog.math.log10Floor = function(num) {\n 'use strict';\n if (num > 0) {\n var x = Math.round(Math.log(num) * Math.LOG10E);\n return x - (parseFloat('1e' + x) > num ? 1 : 0);\n }\n return num == 0 ? -Infinity : NaN;\n};\n\n\n/**\n * A tweaked variant of `Math.floor` which tolerates if the passed number\n * is infinitesimally smaller than the closest integer. It often happens with\n * the results of floating point calculations because of the finite precision\n * of the intermediate results. For example {@code Math.floor(Math.log(1000) /\n * Math.LN10) == 2}, not 3 as one would expect.\n * @param {number} num A number.\n * @param {number=} opt_epsilon An infinitesimally small positive number, the\n * rounding error to tolerate.\n * @return {number} The largest integer less than or equal to `num`.\n */\ngoog.math.safeFloor = function(num, opt_epsilon) {\n 'use strict';\n goog.asserts.assert(opt_epsilon === undefined || opt_epsilon > 0);\n return Math.floor(num + (opt_epsilon || 2e-15));\n};\n\n\n/**\n * A tweaked variant of `Math.ceil`. See `goog.math.safeFloor` for\n * details.\n * @param {number} num A number.\n * @param {number=} opt_epsilon An infinitesimally small positive number, the\n * rounding error to tolerate.\n * @return {number} The smallest integer greater than or equal to `num`.\n */\ngoog.math.safeCeil = function(num, opt_epsilon) {\n 'use strict';\n goog.asserts.assert(opt_epsilon === undefined || opt_epsilon > 0);\n return Math.ceil(num - (opt_epsilon || 2e-15));\n};\n"],
|
|
8
|
+
"names":["goog","provide","require","math","randomInt","goog.math.randomInt","a","Math","floor","random","uniformRandom","goog.math.uniformRandom","b","clamp","goog.math.clamp","value","min","max","modulo","goog.math.modulo","r","lerp","goog.math.lerp","x","nearlyEquals","goog.math.nearlyEquals","opt_tolerance","abs","standardAngle","goog.math.standardAngle","angle","standardAngleInRadians","goog.math.standardAngleInRadians","PI","toRadians","goog.math.toRadians","angleDegrees","toDegrees","goog.math.toDegrees","angleRadians","angleDx","goog.math.angleDx","degrees","radius","cos","angleDy","goog.math.angleDy","sin","goog.math.angle","x1","y1","x2","y2","atan2","angleDifference","goog.math.angleDifference","startAngle","endAngle","d","sign","goog.math.sign","longestCommonSubsequence","goog.math.longestCommonSubsequence","array1","array2","opt_compareFn","opt_collectorFn","compare","collect","i1","i2","length1","length","length2","arr","i","j","result","unshift","sum","goog.math.sum","var_args","Array","prototype","reduce","call","arguments","average","goog.math.average","apply","sampleVariance","goog.math.sampleVariance","sampleSize","mean","variance","map","val","pow","standardDeviation","goog.math.standardDeviation","sqrt","isInt","goog.math.isInt","num","isFinite","isFiniteNumber","goog.math.isFiniteNumber","isNegativeZero","goog.math.isNegativeZero","log10Floor","goog.math.log10Floor","round","log","LOG10E","parseFloat","Infinity","NaN","safeFloor","goog.math.safeFloor","opt_epsilon","asserts","assert","undefined","safeCeil","goog.math.safeCeil","ceil"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
|
|
3
|
+
goog.provide("goog.math.Size");
|
|
4
|
+
goog.math.Size = function(width, height) {
|
|
5
|
+
this.width = width;
|
|
6
|
+
this.height = height;
|
|
7
|
+
};
|
|
8
|
+
goog.math.Size.equals = function(a, b) {
|
|
9
|
+
if (a == b) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (!a || !b) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return a.width == b.width && a.height == b.height;
|
|
16
|
+
};
|
|
17
|
+
goog.math.Size.prototype.clone = function() {
|
|
18
|
+
return new goog.math.Size(this.width, this.height);
|
|
19
|
+
};
|
|
20
|
+
if (goog.DEBUG) {
|
|
21
|
+
goog.math.Size.prototype.toString = function() {
|
|
22
|
+
return "(" + this.width + " x " + this.height + ")";
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
goog.math.Size.prototype.getLongest = function() {
|
|
26
|
+
return Math.max(this.width, this.height);
|
|
27
|
+
};
|
|
28
|
+
goog.math.Size.prototype.getShortest = function() {
|
|
29
|
+
return Math.min(this.width, this.height);
|
|
30
|
+
};
|
|
31
|
+
goog.math.Size.prototype.area = function() {
|
|
32
|
+
return this.width * this.height;
|
|
33
|
+
};
|
|
34
|
+
goog.math.Size.prototype.perimeter = function() {
|
|
35
|
+
return (this.width + this.height) * 2;
|
|
36
|
+
};
|
|
37
|
+
goog.math.Size.prototype.aspectRatio = function() {
|
|
38
|
+
return this.width / this.height;
|
|
39
|
+
};
|
|
40
|
+
goog.math.Size.prototype.isEmpty = function() {
|
|
41
|
+
return !this.area();
|
|
42
|
+
};
|
|
43
|
+
goog.math.Size.prototype.ceil = function() {
|
|
44
|
+
this.width = Math.ceil(this.width);
|
|
45
|
+
this.height = Math.ceil(this.height);
|
|
46
|
+
return this;
|
|
47
|
+
};
|
|
48
|
+
goog.math.Size.prototype.fitsInside = function(target) {
|
|
49
|
+
return this.width <= target.width && this.height <= target.height;
|
|
50
|
+
};
|
|
51
|
+
goog.math.Size.prototype.floor = function() {
|
|
52
|
+
this.width = Math.floor(this.width);
|
|
53
|
+
this.height = Math.floor(this.height);
|
|
54
|
+
return this;
|
|
55
|
+
};
|
|
56
|
+
goog.math.Size.prototype.round = function() {
|
|
57
|
+
this.width = Math.round(this.width);
|
|
58
|
+
this.height = Math.round(this.height);
|
|
59
|
+
return this;
|
|
60
|
+
};
|
|
61
|
+
goog.math.Size.prototype.scale = function(sx, opt_sy) {
|
|
62
|
+
const sy = typeof opt_sy === "number" ? opt_sy : sx;
|
|
63
|
+
this.width *= sx;
|
|
64
|
+
this.height *= sy;
|
|
65
|
+
return this;
|
|
66
|
+
};
|
|
67
|
+
goog.math.Size.prototype.scaleToCover = function(target) {
|
|
68
|
+
const s = this.aspectRatio() <= target.aspectRatio() ? target.width / this.width : target.height / this.height;
|
|
69
|
+
return this.scale(s);
|
|
70
|
+
};
|
|
71
|
+
goog.math.Size.prototype.scaleToFit = function(target) {
|
|
72
|
+
const s = this.aspectRatio() > target.aspectRatio() ? target.width / this.width : target.height / this.height;
|
|
73
|
+
return this.scale(s);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=goog.math.size.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version":3,
|
|
3
|
+
"file":"goog.math.size.js",
|
|
4
|
+
"lineCount":73,
|
|
5
|
+
"mappings":"AAWAA,IAAKC,CAAAA,OAAL,CAAa,gBAAb,CAAA;AAYAD,IAAKE,CAAAA,IAAKC,CAAAA,IAAV,GAAiBC,QAAQ,CAACC,KAAD,EAAQC,MAAR,CAAgB;AAMvC,MAAKD,CAAAA,KAAL,GAAaA,KAAb;AAMA,MAAKC,CAAAA,MAAL,GAAcA,MAAd;AAZuC,CAAzC;AAuBAN,IAAKE,CAAAA,IAAKC,CAAAA,IAAKI,CAAAA,MAAf,GAAwBC,QAAQ,CAACC,CAAD,EAAIC,CAAJ,CAAO;AAErC,MAAID,CAAJ,IAASC,CAAT;AACE,WAAO,IAAP;AADF;AAGA,MAAI,CAACD,CAAL,IAAU,CAACC,CAAX;AACE,WAAO,KAAP;AADF;AAGA,SAAOD,CAAEJ,CAAAA,KAAT,IAAkBK,CAAEL,CAAAA,KAApB,IAA6BI,CAAEH,CAAAA,MAA/B,IAAyCI,CAAEJ,CAAAA,MAA3C;AARqC,CAAvC;AAeAN,IAAKE,C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FD,GAEU,IAAKA,CAAAA,MAFzB;AAIA,SAAO,IAAKmC,CAAAA,KAAL,CAAWO,CAAX,CAAP;AANqD,CAAvD;;",
|
|
6
|
+
"sources":["goog/math/size.js"],
|
|
7
|
+
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview A utility class for representing two-dimensional sizes.\n */\n\n\ngoog.provide('goog.math.Size');\n\n\n\n/**\n * Class for representing sizes consisting of a width and height. Undefined\n * width and height support is deprecated and results in compiler warning.\n * @param {number} width Width.\n * @param {number} height Height.\n * @struct\n * @constructor\n */\ngoog.math.Size = function(width, height) {\n 'use strict';\n /**\n * Width\n * @type {number}\n */\n this.width = width;\n\n /**\n * Height\n * @type {number}\n */\n this.height = height;\n};\n\n\n/**\n * Compares sizes for equality.\n * @param {goog.math.Size} a A Size.\n * @param {goog.math.Size} b A Size.\n * @return {boolean} True iff the sizes have equal widths and equal\n * heights, or if both are null.\n */\ngoog.math.Size.equals = function(a, b) {\n 'use strict';\n if (a == b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.width == b.width && a.height == b.height;\n};\n\n\n/**\n * @return {!goog.math.Size} A new copy of the Size.\n */\ngoog.math.Size.prototype.clone = function() {\n 'use strict';\n return new goog.math.Size(this.width, this.height);\n};\n\n\nif (goog.DEBUG) {\n /**\n * Returns a nice string representing size.\n * @return {string} In the form (50 x 73).\n * @override\n */\n goog.math.Size.prototype.toString = function() {\n 'use strict';\n return '(' + this.width + ' x ' + this.height + ')';\n };\n}\n\n\n/**\n * @return {number} The longer of the two dimensions in the size.\n */\ngoog.math.Size.prototype.getLongest = function() {\n 'use strict';\n return Math.max(this.width, this.height);\n};\n\n\n/**\n * @return {number} The shorter of the two dimensions in the size.\n */\ngoog.math.Size.prototype.getShortest = function() {\n 'use strict';\n return Math.min(this.width, this.height);\n};\n\n\n/**\n * @return {number} The area of the size (width * height).\n */\ngoog.math.Size.prototype.area = function() {\n 'use strict';\n return this.width * this.height;\n};\n\n\n/**\n * @return {number} The perimeter of the size (width + height) * 2.\n */\ngoog.math.Size.prototype.perimeter = function() {\n 'use strict';\n return (this.width + this.height) * 2;\n};\n\n\n/**\n * @return {number} The ratio of the size's width to its height.\n */\ngoog.math.Size.prototype.aspectRatio = function() {\n 'use strict';\n return this.width / this.height;\n};\n\n\n/**\n * @return {boolean} True if the size has zero area, false if both dimensions\n * are non-zero numbers.\n */\ngoog.math.Size.prototype.isEmpty = function() {\n 'use strict';\n return !this.area();\n};\n\n\n/**\n * Clamps the width and height parameters upward to integer values.\n * @return {!goog.math.Size} This size with ceil'd components.\n */\ngoog.math.Size.prototype.ceil = function() {\n 'use strict';\n this.width = Math.ceil(this.width);\n this.height = Math.ceil(this.height);\n return this;\n};\n\n\n/**\n * @param {!goog.math.Size} target The target size.\n * @return {boolean} True if this Size is the same size or smaller than the\n * target size in both dimensions.\n */\ngoog.math.Size.prototype.fitsInside = function(target) {\n 'use strict';\n return this.width <= target.width && this.height <= target.height;\n};\n\n\n/**\n * Clamps the width and height parameters downward to integer values.\n * @return {!goog.math.Size} This size with floored components.\n */\ngoog.math.Size.prototype.floor = function() {\n 'use strict';\n this.width = Math.floor(this.width);\n this.height = Math.floor(this.height);\n return this;\n};\n\n\n/**\n * Rounds the width and height parameters to integer values.\n * @return {!goog.math.Size} This size with rounded components.\n */\ngoog.math.Size.prototype.round = function() {\n 'use strict';\n this.width = Math.round(this.width);\n this.height = Math.round(this.height);\n return this;\n};\n\n\n/**\n * Scales this size by the given scale factors. The width and height are scaled\n * by `sx` and `opt_sy` respectively. If `opt_sy` is not\n * given, then `sx` is used for both the width and height.\n * @param {number} sx The scale factor to use for the width.\n * @param {number=} opt_sy The scale factor to use for the height.\n * @return {!goog.math.Size} This Size object after scaling.\n */\ngoog.math.Size.prototype.scale = function(sx, opt_sy) {\n 'use strict';\n const sy = (typeof opt_sy === 'number') ? opt_sy : sx;\n this.width *= sx;\n this.height *= sy;\n return this;\n};\n\n\n/**\n * Uniformly scales the size to perfectly cover the dimensions of a given size.\n * If the size is already larger than the target, it will be scaled down to the\n * minimum size at which it still covers the entire target. The original aspect\n * ratio will be preserved.\n *\n * This function assumes that both Sizes contain strictly positive dimensions.\n * @param {!goog.math.Size} target The target size.\n * @return {!goog.math.Size} This Size object, after optional scaling.\n */\ngoog.math.Size.prototype.scaleToCover = function(target) {\n 'use strict';\n const s = this.aspectRatio() <= target.aspectRatio() ?\n target.width / this.width :\n target.height / this.height;\n\n return this.scale(s);\n};\n\n\n/**\n * Uniformly scales the size to fit inside the dimensions of a given size. The\n * original aspect ratio will be preserved.\n *\n * This function assumes that both Sizes contain strictly positive dimensions.\n * @param {!goog.math.Size} target The target size.\n * @return {!goog.math.Size} This Size object, after optional scaling.\n */\ngoog.math.Size.prototype.scaleToFit = function(target) {\n 'use strict';\n const s = this.aspectRatio() > target.aspectRatio() ?\n target.width / this.width :\n target.height / this.height;\n\n return this.scale(s);\n};\n"],
|
|
8
|
+
"names":["goog","provide","math","Size","goog.math.Size","width","height","equals","goog.math.Size.equals","a","b","prototype","clone","goog.math.Size.prototype.clone","DEBUG","toString","goog.math.Size.prototype.toString","getLongest","goog.math.Size.prototype.getLongest","Math","max","getShortest","goog.math.Size.prototype.getShortest","min","area","goog.math.Size.prototype.area","perimeter","goog.math.Size.prototype.perimeter","aspectRatio","goog.math.Size.prototype.aspectRatio","isEmpty","goog.math.Size.prototype.isEmpty","ceil","goog.math.Size.prototype.ceil","fitsInside","goog.math.Size.prototype.fitsInside","target","floor","goog.math.Size.prototype.floor","round","goog.math.Size.prototype.round","scale","goog.math.Size.prototype.scale","sx","opt_sy","sy","scaleToCover","goog.math.Size.prototype.scaleToCover","s","scaleToFit","goog.math.Size.prototype.scaleToFit"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import "./cljs_env.js";
|
|
2
|
+
|
|
3
|
+
goog.loadModule(function(exports) {
|
|
4
|
+
function forEach(obj, f, opt_obj) {
|
|
5
|
+
for (const key in obj) {
|
|
6
|
+
f.call(opt_obj, obj[key], key, obj);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function filter(obj, f, opt_obj) {
|
|
10
|
+
const res = {};
|
|
11
|
+
for (const key in obj) {
|
|
12
|
+
if (f.call(opt_obj, obj[key], key, obj)) {
|
|
13
|
+
res[key] = obj[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return res;
|
|
17
|
+
}
|
|
18
|
+
function map(obj, f, opt_obj) {
|
|
19
|
+
const res = {};
|
|
20
|
+
for (const key in obj) {
|
|
21
|
+
res[key] = f.call(opt_obj, obj[key], key, obj);
|
|
22
|
+
}
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
function some(obj, f, opt_obj) {
|
|
26
|
+
for (const key in obj) {
|
|
27
|
+
if (f.call(opt_obj, obj[key], key, obj)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
function every(obj, f, opt_obj) {
|
|
34
|
+
for (const key in obj) {
|
|
35
|
+
if (!f.call(opt_obj, obj[key], key, obj)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
function getCount(obj) {
|
|
42
|
+
let rv = 0;
|
|
43
|
+
for (const key in obj) {
|
|
44
|
+
rv++;
|
|
45
|
+
}
|
|
46
|
+
return rv;
|
|
47
|
+
}
|
|
48
|
+
function getAnyKey(obj) {
|
|
49
|
+
for (const key in obj) {
|
|
50
|
+
return key;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getAnyValue(obj) {
|
|
54
|
+
for (const key in obj) {
|
|
55
|
+
return obj[key];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function contains(obj, val) {
|
|
59
|
+
return containsValue(obj, val);
|
|
60
|
+
}
|
|
61
|
+
function getValues(obj) {
|
|
62
|
+
const res = [];
|
|
63
|
+
let i = 0;
|
|
64
|
+
for (const key in obj) {
|
|
65
|
+
res[i++] = obj[key];
|
|
66
|
+
}
|
|
67
|
+
return res;
|
|
68
|
+
}
|
|
69
|
+
function getKeys(obj) {
|
|
70
|
+
const res = [];
|
|
71
|
+
let i = 0;
|
|
72
|
+
for (const key in obj) {
|
|
73
|
+
res[i++] = key;
|
|
74
|
+
}
|
|
75
|
+
return res;
|
|
76
|
+
}
|
|
77
|
+
function getValueByKeys(obj, var_args) {
|
|
78
|
+
const isArrayLike = goog.isArrayLike(var_args);
|
|
79
|
+
const keys = isArrayLike ? var_args : arguments;
|
|
80
|
+
for (let i = isArrayLike ? 0 : 1; i < keys.length; i++) {
|
|
81
|
+
if (obj == null) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
obj = obj[keys[i]];
|
|
85
|
+
}
|
|
86
|
+
return obj;
|
|
87
|
+
}
|
|
88
|
+
function containsKey(obj, key) {
|
|
89
|
+
return obj !== null && key in obj;
|
|
90
|
+
}
|
|
91
|
+
function containsValue(obj, val) {
|
|
92
|
+
for (const key in obj) {
|
|
93
|
+
if (obj[key] == val) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
function findKey(obj, f, thisObj = undefined) {
|
|
100
|
+
for (const key in obj) {
|
|
101
|
+
if (f.call(thisObj, obj[key], key, obj)) {
|
|
102
|
+
return key;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
function findValue(obj, f, thisObj = undefined) {
|
|
108
|
+
const key = findKey(obj, f, thisObj);
|
|
109
|
+
return key && obj[key];
|
|
110
|
+
}
|
|
111
|
+
function isEmpty(obj) {
|
|
112
|
+
for (const key in obj) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
function clear(obj) {
|
|
118
|
+
for (const i in obj) {
|
|
119
|
+
delete obj[i];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function remove(obj, key) {
|
|
123
|
+
let rv;
|
|
124
|
+
if (rv = key in obj) {
|
|
125
|
+
delete obj[key];
|
|
126
|
+
}
|
|
127
|
+
return rv;
|
|
128
|
+
}
|
|
129
|
+
function add(obj, key, val) {
|
|
130
|
+
if (obj !== null && key in obj) {
|
|
131
|
+
throw new Error(`The object already contains the key "${key}"`);
|
|
132
|
+
}
|
|
133
|
+
set(obj, key, val);
|
|
134
|
+
}
|
|
135
|
+
function get(obj, key, val = undefined) {
|
|
136
|
+
if (obj !== null && key in obj) {
|
|
137
|
+
return obj[key];
|
|
138
|
+
}
|
|
139
|
+
return val;
|
|
140
|
+
}
|
|
141
|
+
function set(obj, key, value) {
|
|
142
|
+
obj[key] = value;
|
|
143
|
+
}
|
|
144
|
+
function setIfUndefined(obj, key, value) {
|
|
145
|
+
return key in obj ? obj[key] : obj[key] = value;
|
|
146
|
+
}
|
|
147
|
+
function setWithReturnValueIfNotSet(obj, key, f) {
|
|
148
|
+
if (key in obj) {
|
|
149
|
+
return obj[key];
|
|
150
|
+
}
|
|
151
|
+
const val = f();
|
|
152
|
+
obj[key] = val;
|
|
153
|
+
return val;
|
|
154
|
+
}
|
|
155
|
+
function equals(a, b) {
|
|
156
|
+
for (const k in a) {
|
|
157
|
+
if (!(k in b) || a[k] !== b[k]) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
for (const k in b) {
|
|
162
|
+
if (!(k in a)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
function clone(obj) {
|
|
169
|
+
const res = {};
|
|
170
|
+
for (const key in obj) {
|
|
171
|
+
res[key] = obj[key];
|
|
172
|
+
}
|
|
173
|
+
return res;
|
|
174
|
+
}
|
|
175
|
+
function unsafeClone(obj) {
|
|
176
|
+
if (!obj || typeof obj !== "object") {
|
|
177
|
+
return obj;
|
|
178
|
+
}
|
|
179
|
+
if (typeof obj.clone === "function") {
|
|
180
|
+
return obj.clone();
|
|
181
|
+
}
|
|
182
|
+
if (typeof Map !== "undefined" && obj instanceof Map) {
|
|
183
|
+
return new Map(obj);
|
|
184
|
+
} else if (typeof Set !== "undefined" && obj instanceof Set) {
|
|
185
|
+
return new Set(obj);
|
|
186
|
+
} else if (obj instanceof Date) {
|
|
187
|
+
return new Date(obj.getTime());
|
|
188
|
+
}
|
|
189
|
+
const clone = Array.isArray(obj) ? [] : typeof ArrayBuffer === "function" && typeof ArrayBuffer.isView === "function" && ArrayBuffer.isView(obj) && !(obj instanceof DataView) ? new obj.constructor(obj.length) : {};
|
|
190
|
+
for (const key in obj) {
|
|
191
|
+
clone[key] = unsafeClone(obj[key]);
|
|
192
|
+
}
|
|
193
|
+
return clone;
|
|
194
|
+
}
|
|
195
|
+
function transpose(obj) {
|
|
196
|
+
const transposed = {};
|
|
197
|
+
for (const key in obj) {
|
|
198
|
+
transposed[obj[key]] = key;
|
|
199
|
+
}
|
|
200
|
+
return transposed;
|
|
201
|
+
}
|
|
202
|
+
function extend(target, var_args) {
|
|
203
|
+
let key;
|
|
204
|
+
let source;
|
|
205
|
+
for (let i = 1; i < arguments.length; i++) {
|
|
206
|
+
source = arguments[i];
|
|
207
|
+
for (key in source) {
|
|
208
|
+
target[key] = source[key];
|
|
209
|
+
}
|
|
210
|
+
for (let j = 0; j < PROTOTYPE_FIELDS.length; j++) {
|
|
211
|
+
key = PROTOTYPE_FIELDS[j];
|
|
212
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
213
|
+
target[key] = source[key];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function create(var_args) {
|
|
219
|
+
const argLength = arguments.length;
|
|
220
|
+
if (argLength == 1 && Array.isArray(arguments[0])) {
|
|
221
|
+
return create.apply(null, arguments[0]);
|
|
222
|
+
}
|
|
223
|
+
if (argLength % 2) {
|
|
224
|
+
throw new Error("Uneven number of arguments");
|
|
225
|
+
}
|
|
226
|
+
const rv = {};
|
|
227
|
+
for (let i = 0; i < argLength; i = i + 2) {
|
|
228
|
+
rv[arguments[i]] = arguments[i + 1];
|
|
229
|
+
}
|
|
230
|
+
return rv;
|
|
231
|
+
}
|
|
232
|
+
function createSet(var_args) {
|
|
233
|
+
const argLength = arguments.length;
|
|
234
|
+
if (argLength == 1 && Array.isArray(arguments[0])) {
|
|
235
|
+
return createSet.apply(null, arguments[0]);
|
|
236
|
+
}
|
|
237
|
+
const rv = {};
|
|
238
|
+
for (let i = 0; i < argLength; i++) {
|
|
239
|
+
rv[arguments[i]] = true;
|
|
240
|
+
}
|
|
241
|
+
return rv;
|
|
242
|
+
}
|
|
243
|
+
function createImmutableView(obj) {
|
|
244
|
+
let result = obj;
|
|
245
|
+
if (Object.isFrozen && !Object.isFrozen(obj)) {
|
|
246
|
+
result = Object.create(obj);
|
|
247
|
+
Object.freeze(result);
|
|
248
|
+
}
|
|
249
|
+
return result;
|
|
250
|
+
}
|
|
251
|
+
function isImmutableView(obj) {
|
|
252
|
+
return !!Object.isFrozen && Object.isFrozen(obj);
|
|
253
|
+
}
|
|
254
|
+
function getAllPropertyNames(obj, includeObjectPrototype = undefined, includeFunctionPrototype = undefined) {
|
|
255
|
+
if (!obj) {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
|
|
259
|
+
return getKeys(obj);
|
|
260
|
+
}
|
|
261
|
+
const visitedSet = {};
|
|
262
|
+
let proto = obj;
|
|
263
|
+
for (; proto && (proto !== Object.prototype || !!includeObjectPrototype) && (proto !== Function.prototype || !!includeFunctionPrototype);) {
|
|
264
|
+
const names = Object.getOwnPropertyNames(proto);
|
|
265
|
+
for (let i = 0; i < names.length; i++) {
|
|
266
|
+
visitedSet[names[i]] = true;
|
|
267
|
+
}
|
|
268
|
+
proto = Object.getPrototypeOf(proto);
|
|
269
|
+
}
|
|
270
|
+
return getKeys(visitedSet);
|
|
271
|
+
}
|
|
272
|
+
function getSuperClass(constructor) {
|
|
273
|
+
const proto = Object.getPrototypeOf(constructor.prototype);
|
|
274
|
+
return proto && proto.constructor;
|
|
275
|
+
}
|
|
276
|
+
"use strict";
|
|
277
|
+
goog.module("goog.object");
|
|
278
|
+
goog.module.declareLegacyNamespace();
|
|
279
|
+
const PROTOTYPE_FIELDS = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
|
|
280
|
+
exports = {add, clear, clone, contains, containsKey, containsValue, create, createImmutableView, createSet, equals, every, extend, filter, findKey, findValue, forEach, get, getAllPropertyNames, getAnyKey, getAnyValue, getCount, getKeys, getSuperClass, getValueByKeys, getValues, isEmpty, isImmutableView, map, remove, set, setIfUndefined, setWithReturnValueIfNotSet, some, transpose, unsafeClone};
|
|
281
|
+
return exports;
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
//# sourceMappingURL=goog.object.object.js.map
|