@tarsis/toolkit 0.7.3 → 0.7.4
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/dat.gui.module-C-Oxsf3K.cjs +2198 -0
- package/dist/dat.gui.module-DscbDI-N.js +2198 -0
- package/dist/hooks.cjs +18 -32
- package/dist/hooks.d.ts +0 -290
- package/dist/hooks.js +19 -33
- package/dist/index.cjs +62 -2247
- package/dist/index.d.ts +0 -2587
- package/dist/index.js +62 -2247
- package/dist/layout.d.ts +0 -44
- package/dist/primitives.d.ts +0 -177
- package/dist/server.d.ts +0 -69
- package/dist/styles.css +483 -483
- package/dist/tokens.d.ts +0 -435
- package/dist/utils.d.ts +0 -164
- package/package.json +1 -1
- /package/dist/{gl-B0NhVYRl.cjs → gl-CyEFDXce.cjs} +0 -0
- /package/dist/{gl-BipoEx9s.js → gl-D6wtjXIm.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -766,31 +766,31 @@ var BubblyParticlesButton = () => {
|
|
|
766
766
|
});
|
|
767
767
|
};
|
|
768
768
|
var BurningButton_module_default = {
|
|
769
|
-
root: "
|
|
770
|
-
button: "
|
|
771
|
-
p: "
|
|
772
|
-
text: "
|
|
773
|
-
rise1: "
|
|
774
|
-
rise2: "
|
|
775
|
-
rise3: "
|
|
776
|
-
rise4: "
|
|
777
|
-
rise5: "
|
|
778
|
-
rise6: "
|
|
779
|
-
rise7: "
|
|
780
|
-
rise8: "
|
|
781
|
-
rise9: "
|
|
782
|
-
rise10: "
|
|
783
|
-
rise11: "
|
|
784
|
-
rise12: "
|
|
785
|
-
rise13: "
|
|
786
|
-
rise14: "
|
|
787
|
-
rise15: "
|
|
788
|
-
rise16: "
|
|
789
|
-
rise17: "
|
|
790
|
-
rise18: "
|
|
791
|
-
rise19: "
|
|
792
|
-
rise20: "
|
|
793
|
-
effects: "
|
|
769
|
+
root: "_root_12t1b_1",
|
|
770
|
+
button: "_button_12t1b_11",
|
|
771
|
+
p: "_p_12t1b_24",
|
|
772
|
+
text: "_text_12t1b_24",
|
|
773
|
+
rise1: "_rise1_12t1b_1",
|
|
774
|
+
rise2: "_rise2_12t1b_1",
|
|
775
|
+
rise3: "_rise3_12t1b_1",
|
|
776
|
+
rise4: "_rise4_12t1b_1",
|
|
777
|
+
rise5: "_rise5_12t1b_1",
|
|
778
|
+
rise6: "_rise6_12t1b_1",
|
|
779
|
+
rise7: "_rise7_12t1b_1",
|
|
780
|
+
rise8: "_rise8_12t1b_1",
|
|
781
|
+
rise9: "_rise9_12t1b_1",
|
|
782
|
+
rise10: "_rise10_12t1b_1",
|
|
783
|
+
rise11: "_rise11_12t1b_1",
|
|
784
|
+
rise12: "_rise12_12t1b_1",
|
|
785
|
+
rise13: "_rise13_12t1b_1",
|
|
786
|
+
rise14: "_rise14_12t1b_1",
|
|
787
|
+
rise15: "_rise15_12t1b_1",
|
|
788
|
+
rise16: "_rise16_12t1b_1",
|
|
789
|
+
rise17: "_rise17_12t1b_1",
|
|
790
|
+
rise18: "_rise18_12t1b_1",
|
|
791
|
+
rise19: "_rise19_12t1b_1",
|
|
792
|
+
rise20: "_rise20_12t1b_1",
|
|
793
|
+
effects: "_effects_12t1b_238"
|
|
794
794
|
};
|
|
795
795
|
//#endregion
|
|
796
796
|
//#region src/components/Buttons/BurningButton/BurningButton.tsx
|
|
@@ -3842,10 +3842,10 @@ var NeonButton = ({ className, ...rest }) => {
|
|
|
3842
3842
|
});
|
|
3843
3843
|
};
|
|
3844
3844
|
var NoisyButton_module_default = {
|
|
3845
|
-
root: "
|
|
3846
|
-
i: "
|
|
3847
|
-
noise: "
|
|
3848
|
-
text: "
|
|
3845
|
+
root: "_root_gsvfv_2",
|
|
3846
|
+
i: "_i_gsvfv_22",
|
|
3847
|
+
noise: "_noise_gsvfv_1",
|
|
3848
|
+
text: "_text_gsvfv_482"
|
|
3849
3849
|
};
|
|
3850
3850
|
//#endregion
|
|
3851
3851
|
//#region src/components/Buttons/NoisyButton/NoisyButton.tsx
|
|
@@ -4822,12 +4822,14 @@ function MacCursor() {
|
|
|
4822
4822
|
var scale$2 = (number, inMin, inMax, outMin, outMax) => {
|
|
4823
4823
|
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
4824
4824
|
};
|
|
4825
|
+
var CAMERA_WIDTH = 600;
|
|
4826
|
+
var CAMERA_HEIGHT = 600;
|
|
4825
4827
|
function getDefaultReflectiveButtonVideoConstraints() {
|
|
4826
4828
|
return {
|
|
4827
4829
|
audio: false,
|
|
4828
4830
|
video: {
|
|
4829
|
-
width: { ideal:
|
|
4830
|
-
height: { ideal:
|
|
4831
|
+
width: { ideal: CAMERA_WIDTH },
|
|
4832
|
+
height: { ideal: CAMERA_HEIGHT },
|
|
4831
4833
|
facingMode: "user"
|
|
4832
4834
|
}
|
|
4833
4835
|
};
|
|
@@ -13277,7 +13279,7 @@ var EndlessLoader = ({ container }) => {
|
|
|
13277
13279
|
return;
|
|
13278
13280
|
}
|
|
13279
13281
|
try {
|
|
13280
|
-
const GLModule = await Promise.resolve().then(() => require("./gl-
|
|
13282
|
+
const GLModule = await Promise.resolve().then(() => require("./gl-CyEFDXce.cjs"));
|
|
13281
13283
|
if (!isActiveRef.current) return;
|
|
13282
13284
|
const glInstance = new GLModule.GL(capturedContainer);
|
|
13283
13285
|
glInstance.init();
|
|
@@ -19747,12 +19749,12 @@ var ScrambledText = ({ children, reveal = false }) => {
|
|
|
19747
19749
|
});
|
|
19748
19750
|
};
|
|
19749
19751
|
var ScramblingLetters_module_default = {
|
|
19750
|
-
root: "
|
|
19751
|
-
line: "
|
|
19752
|
-
word: "
|
|
19753
|
-
link: "
|
|
19754
|
-
letter: "
|
|
19755
|
-
wobble: "
|
|
19752
|
+
root: "_root_18941_1",
|
|
19753
|
+
line: "_line_18941_9",
|
|
19754
|
+
word: "_word_18941_14",
|
|
19755
|
+
link: "_link_18941_18",
|
|
19756
|
+
letter: "_letter_18941_22",
|
|
19757
|
+
wobble: "_wobble_18941_1"
|
|
19756
19758
|
};
|
|
19757
19759
|
//#endregion
|
|
19758
19760
|
//#region src/components/Texts/ScramblingLetters/ScramblingLetters.tsx
|
|
@@ -23177,2203 +23179,6 @@ var CircleParticles = () => {
|
|
|
23177
23179
|
children: particles
|
|
23178
23180
|
});
|
|
23179
23181
|
};
|
|
23180
|
-
//#endregion
|
|
23181
|
-
//#region node_modules/dat.gui/build/dat.gui.module.js
|
|
23182
|
-
/**
|
|
23183
|
-
* dat-gui JavaScript Controller Library
|
|
23184
|
-
* https://github.com/dataarts/dat.gui
|
|
23185
|
-
*
|
|
23186
|
-
* Copyright 2011 Data Arts Team, Google Creative Lab
|
|
23187
|
-
*
|
|
23188
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23189
|
-
* you may not use this file except in compliance with the License.
|
|
23190
|
-
* You may obtain a copy of the License at
|
|
23191
|
-
*
|
|
23192
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23193
|
-
*/
|
|
23194
|
-
function ___$insertStyle(css) {
|
|
23195
|
-
if (!css) return;
|
|
23196
|
-
if (typeof window === "undefined") return;
|
|
23197
|
-
var style = document.createElement("style");
|
|
23198
|
-
style.setAttribute("type", "text/css");
|
|
23199
|
-
style.innerHTML = css;
|
|
23200
|
-
document.head.appendChild(style);
|
|
23201
|
-
return css;
|
|
23202
|
-
}
|
|
23203
|
-
function colorToString(color, forceCSSHex) {
|
|
23204
|
-
var colorFormat = color.__state.conversionName.toString();
|
|
23205
|
-
var r = Math.round(color.r);
|
|
23206
|
-
var g = Math.round(color.g);
|
|
23207
|
-
var b = Math.round(color.b);
|
|
23208
|
-
var a = color.a;
|
|
23209
|
-
var h = Math.round(color.h);
|
|
23210
|
-
var s = color.s.toFixed(1);
|
|
23211
|
-
var v = color.v.toFixed(1);
|
|
23212
|
-
if (forceCSSHex || colorFormat === "THREE_CHAR_HEX" || colorFormat === "SIX_CHAR_HEX") {
|
|
23213
|
-
var str = color.hex.toString(16);
|
|
23214
|
-
while (str.length < 6) str = "0" + str;
|
|
23215
|
-
return "#" + str;
|
|
23216
|
-
} else if (colorFormat === "CSS_RGB") return "rgb(" + r + "," + g + "," + b + ")";
|
|
23217
|
-
else if (colorFormat === "CSS_RGBA") return "rgba(" + r + "," + g + "," + b + "," + a + ")";
|
|
23218
|
-
else if (colorFormat === "HEX") return "0x" + color.hex.toString(16);
|
|
23219
|
-
else if (colorFormat === "RGB_ARRAY") return "[" + r + "," + g + "," + b + "]";
|
|
23220
|
-
else if (colorFormat === "RGBA_ARRAY") return "[" + r + "," + g + "," + b + "," + a + "]";
|
|
23221
|
-
else if (colorFormat === "RGB_OBJ") return "{r:" + r + ",g:" + g + ",b:" + b + "}";
|
|
23222
|
-
else if (colorFormat === "RGBA_OBJ") return "{r:" + r + ",g:" + g + ",b:" + b + ",a:" + a + "}";
|
|
23223
|
-
else if (colorFormat === "HSV_OBJ") return "{h:" + h + ",s:" + s + ",v:" + v + "}";
|
|
23224
|
-
else if (colorFormat === "HSVA_OBJ") return "{h:" + h + ",s:" + s + ",v:" + v + ",a:" + a + "}";
|
|
23225
|
-
return "unknown format";
|
|
23226
|
-
}
|
|
23227
|
-
var ARR_EACH = Array.prototype.forEach;
|
|
23228
|
-
var ARR_SLICE = Array.prototype.slice;
|
|
23229
|
-
var Common = {
|
|
23230
|
-
BREAK: {},
|
|
23231
|
-
extend: function extend(target) {
|
|
23232
|
-
this.each(ARR_SLICE.call(arguments, 1), function(obj) {
|
|
23233
|
-
(this.isObject(obj) ? Object.keys(obj) : []).forEach(function(key) {
|
|
23234
|
-
if (!this.isUndefined(obj[key])) target[key] = obj[key];
|
|
23235
|
-
}.bind(this));
|
|
23236
|
-
}, this);
|
|
23237
|
-
return target;
|
|
23238
|
-
},
|
|
23239
|
-
defaults: function defaults(target) {
|
|
23240
|
-
this.each(ARR_SLICE.call(arguments, 1), function(obj) {
|
|
23241
|
-
(this.isObject(obj) ? Object.keys(obj) : []).forEach(function(key) {
|
|
23242
|
-
if (this.isUndefined(target[key])) target[key] = obj[key];
|
|
23243
|
-
}.bind(this));
|
|
23244
|
-
}, this);
|
|
23245
|
-
return target;
|
|
23246
|
-
},
|
|
23247
|
-
compose: function compose() {
|
|
23248
|
-
var toCall = ARR_SLICE.call(arguments);
|
|
23249
|
-
return function() {
|
|
23250
|
-
var args = ARR_SLICE.call(arguments);
|
|
23251
|
-
for (var i = toCall.length - 1; i >= 0; i--) args = [toCall[i].apply(this, args)];
|
|
23252
|
-
return args[0];
|
|
23253
|
-
};
|
|
23254
|
-
},
|
|
23255
|
-
each: function each(obj, itr, scope) {
|
|
23256
|
-
if (!obj) return;
|
|
23257
|
-
if (ARR_EACH && obj.forEach && obj.forEach === ARR_EACH) obj.forEach(itr, scope);
|
|
23258
|
-
else if (obj.length === obj.length + 0) {
|
|
23259
|
-
var key = void 0;
|
|
23260
|
-
var l = void 0;
|
|
23261
|
-
for (key = 0, l = obj.length; key < l; key++) if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) return;
|
|
23262
|
-
} else for (var _key in obj) if (itr.call(scope, obj[_key], _key) === this.BREAK) return;
|
|
23263
|
-
},
|
|
23264
|
-
defer: function defer(fnc) {
|
|
23265
|
-
setTimeout(fnc, 0);
|
|
23266
|
-
},
|
|
23267
|
-
debounce: function debounce(func, threshold, callImmediately) {
|
|
23268
|
-
var timeout = void 0;
|
|
23269
|
-
return function() {
|
|
23270
|
-
var obj = this;
|
|
23271
|
-
var args = arguments;
|
|
23272
|
-
function delayed() {
|
|
23273
|
-
timeout = null;
|
|
23274
|
-
if (!callImmediately) func.apply(obj, args);
|
|
23275
|
-
}
|
|
23276
|
-
var callNow = callImmediately || !timeout;
|
|
23277
|
-
clearTimeout(timeout);
|
|
23278
|
-
timeout = setTimeout(delayed, threshold);
|
|
23279
|
-
if (callNow) func.apply(obj, args);
|
|
23280
|
-
};
|
|
23281
|
-
},
|
|
23282
|
-
toArray: function toArray(obj) {
|
|
23283
|
-
if (obj.toArray) return obj.toArray();
|
|
23284
|
-
return ARR_SLICE.call(obj);
|
|
23285
|
-
},
|
|
23286
|
-
isUndefined: function isUndefined(obj) {
|
|
23287
|
-
return obj === void 0;
|
|
23288
|
-
},
|
|
23289
|
-
isNull: function isNull(obj) {
|
|
23290
|
-
return obj === null;
|
|
23291
|
-
},
|
|
23292
|
-
isNaN: function(_isNaN) {
|
|
23293
|
-
function isNaN(_x) {
|
|
23294
|
-
return _isNaN.apply(this, arguments);
|
|
23295
|
-
}
|
|
23296
|
-
isNaN.toString = function() {
|
|
23297
|
-
return _isNaN.toString();
|
|
23298
|
-
};
|
|
23299
|
-
return isNaN;
|
|
23300
|
-
}(function(obj) {
|
|
23301
|
-
return isNaN(obj);
|
|
23302
|
-
}),
|
|
23303
|
-
isArray: Array.isArray || function(obj) {
|
|
23304
|
-
return obj.constructor === Array;
|
|
23305
|
-
},
|
|
23306
|
-
isObject: function isObject(obj) {
|
|
23307
|
-
return obj === Object(obj);
|
|
23308
|
-
},
|
|
23309
|
-
isNumber: function isNumber(obj) {
|
|
23310
|
-
return obj === obj + 0;
|
|
23311
|
-
},
|
|
23312
|
-
isString: function isString(obj) {
|
|
23313
|
-
return obj === obj + "";
|
|
23314
|
-
},
|
|
23315
|
-
isBoolean: function isBoolean(obj) {
|
|
23316
|
-
return obj === false || obj === true;
|
|
23317
|
-
},
|
|
23318
|
-
isFunction: function isFunction(obj) {
|
|
23319
|
-
return obj instanceof Function;
|
|
23320
|
-
}
|
|
23321
|
-
};
|
|
23322
|
-
var INTERPRETATIONS = [
|
|
23323
|
-
{
|
|
23324
|
-
litmus: Common.isString,
|
|
23325
|
-
conversions: {
|
|
23326
|
-
THREE_CHAR_HEX: {
|
|
23327
|
-
read: function read(original) {
|
|
23328
|
-
var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
|
|
23329
|
-
if (test === null) return false;
|
|
23330
|
-
return {
|
|
23331
|
-
space: "HEX",
|
|
23332
|
-
hex: parseInt("0x" + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + test[3].toString() + test[3].toString(), 0)
|
|
23333
|
-
};
|
|
23334
|
-
},
|
|
23335
|
-
write: colorToString
|
|
23336
|
-
},
|
|
23337
|
-
SIX_CHAR_HEX: {
|
|
23338
|
-
read: function read(original) {
|
|
23339
|
-
var test = original.match(/^#([A-F0-9]{6})$/i);
|
|
23340
|
-
if (test === null) return false;
|
|
23341
|
-
return {
|
|
23342
|
-
space: "HEX",
|
|
23343
|
-
hex: parseInt("0x" + test[1].toString(), 0)
|
|
23344
|
-
};
|
|
23345
|
-
},
|
|
23346
|
-
write: colorToString
|
|
23347
|
-
},
|
|
23348
|
-
CSS_RGB: {
|
|
23349
|
-
read: function read(original) {
|
|
23350
|
-
var test = original.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
|
|
23351
|
-
if (test === null) return false;
|
|
23352
|
-
return {
|
|
23353
|
-
space: "RGB",
|
|
23354
|
-
r: parseFloat(test[1]),
|
|
23355
|
-
g: parseFloat(test[2]),
|
|
23356
|
-
b: parseFloat(test[3])
|
|
23357
|
-
};
|
|
23358
|
-
},
|
|
23359
|
-
write: colorToString
|
|
23360
|
-
},
|
|
23361
|
-
CSS_RGBA: {
|
|
23362
|
-
read: function read(original) {
|
|
23363
|
-
var test = original.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
|
|
23364
|
-
if (test === null) return false;
|
|
23365
|
-
return {
|
|
23366
|
-
space: "RGB",
|
|
23367
|
-
r: parseFloat(test[1]),
|
|
23368
|
-
g: parseFloat(test[2]),
|
|
23369
|
-
b: parseFloat(test[3]),
|
|
23370
|
-
a: parseFloat(test[4])
|
|
23371
|
-
};
|
|
23372
|
-
},
|
|
23373
|
-
write: colorToString
|
|
23374
|
-
}
|
|
23375
|
-
}
|
|
23376
|
-
},
|
|
23377
|
-
{
|
|
23378
|
-
litmus: Common.isNumber,
|
|
23379
|
-
conversions: { HEX: {
|
|
23380
|
-
read: function read(original) {
|
|
23381
|
-
return {
|
|
23382
|
-
space: "HEX",
|
|
23383
|
-
hex: original,
|
|
23384
|
-
conversionName: "HEX"
|
|
23385
|
-
};
|
|
23386
|
-
},
|
|
23387
|
-
write: function write(color) {
|
|
23388
|
-
return color.hex;
|
|
23389
|
-
}
|
|
23390
|
-
} }
|
|
23391
|
-
},
|
|
23392
|
-
{
|
|
23393
|
-
litmus: Common.isArray,
|
|
23394
|
-
conversions: {
|
|
23395
|
-
RGB_ARRAY: {
|
|
23396
|
-
read: function read(original) {
|
|
23397
|
-
if (original.length !== 3) return false;
|
|
23398
|
-
return {
|
|
23399
|
-
space: "RGB",
|
|
23400
|
-
r: original[0],
|
|
23401
|
-
g: original[1],
|
|
23402
|
-
b: original[2]
|
|
23403
|
-
};
|
|
23404
|
-
},
|
|
23405
|
-
write: function write(color) {
|
|
23406
|
-
return [
|
|
23407
|
-
color.r,
|
|
23408
|
-
color.g,
|
|
23409
|
-
color.b
|
|
23410
|
-
];
|
|
23411
|
-
}
|
|
23412
|
-
},
|
|
23413
|
-
RGBA_ARRAY: {
|
|
23414
|
-
read: function read(original) {
|
|
23415
|
-
if (original.length !== 4) return false;
|
|
23416
|
-
return {
|
|
23417
|
-
space: "RGB",
|
|
23418
|
-
r: original[0],
|
|
23419
|
-
g: original[1],
|
|
23420
|
-
b: original[2],
|
|
23421
|
-
a: original[3]
|
|
23422
|
-
};
|
|
23423
|
-
},
|
|
23424
|
-
write: function write(color) {
|
|
23425
|
-
return [
|
|
23426
|
-
color.r,
|
|
23427
|
-
color.g,
|
|
23428
|
-
color.b,
|
|
23429
|
-
color.a
|
|
23430
|
-
];
|
|
23431
|
-
}
|
|
23432
|
-
}
|
|
23433
|
-
}
|
|
23434
|
-
},
|
|
23435
|
-
{
|
|
23436
|
-
litmus: Common.isObject,
|
|
23437
|
-
conversions: {
|
|
23438
|
-
RGBA_OBJ: {
|
|
23439
|
-
read: function read(original) {
|
|
23440
|
-
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b) && Common.isNumber(original.a)) return {
|
|
23441
|
-
space: "RGB",
|
|
23442
|
-
r: original.r,
|
|
23443
|
-
g: original.g,
|
|
23444
|
-
b: original.b,
|
|
23445
|
-
a: original.a
|
|
23446
|
-
};
|
|
23447
|
-
return false;
|
|
23448
|
-
},
|
|
23449
|
-
write: function write(color) {
|
|
23450
|
-
return {
|
|
23451
|
-
r: color.r,
|
|
23452
|
-
g: color.g,
|
|
23453
|
-
b: color.b,
|
|
23454
|
-
a: color.a
|
|
23455
|
-
};
|
|
23456
|
-
}
|
|
23457
|
-
},
|
|
23458
|
-
RGB_OBJ: {
|
|
23459
|
-
read: function read(original) {
|
|
23460
|
-
if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b)) return {
|
|
23461
|
-
space: "RGB",
|
|
23462
|
-
r: original.r,
|
|
23463
|
-
g: original.g,
|
|
23464
|
-
b: original.b
|
|
23465
|
-
};
|
|
23466
|
-
return false;
|
|
23467
|
-
},
|
|
23468
|
-
write: function write(color) {
|
|
23469
|
-
return {
|
|
23470
|
-
r: color.r,
|
|
23471
|
-
g: color.g,
|
|
23472
|
-
b: color.b
|
|
23473
|
-
};
|
|
23474
|
-
}
|
|
23475
|
-
},
|
|
23476
|
-
HSVA_OBJ: {
|
|
23477
|
-
read: function read(original) {
|
|
23478
|
-
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v) && Common.isNumber(original.a)) return {
|
|
23479
|
-
space: "HSV",
|
|
23480
|
-
h: original.h,
|
|
23481
|
-
s: original.s,
|
|
23482
|
-
v: original.v,
|
|
23483
|
-
a: original.a
|
|
23484
|
-
};
|
|
23485
|
-
return false;
|
|
23486
|
-
},
|
|
23487
|
-
write: function write(color) {
|
|
23488
|
-
return {
|
|
23489
|
-
h: color.h,
|
|
23490
|
-
s: color.s,
|
|
23491
|
-
v: color.v,
|
|
23492
|
-
a: color.a
|
|
23493
|
-
};
|
|
23494
|
-
}
|
|
23495
|
-
},
|
|
23496
|
-
HSV_OBJ: {
|
|
23497
|
-
read: function read(original) {
|
|
23498
|
-
if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v)) return {
|
|
23499
|
-
space: "HSV",
|
|
23500
|
-
h: original.h,
|
|
23501
|
-
s: original.s,
|
|
23502
|
-
v: original.v
|
|
23503
|
-
};
|
|
23504
|
-
return false;
|
|
23505
|
-
},
|
|
23506
|
-
write: function write(color) {
|
|
23507
|
-
return {
|
|
23508
|
-
h: color.h,
|
|
23509
|
-
s: color.s,
|
|
23510
|
-
v: color.v
|
|
23511
|
-
};
|
|
23512
|
-
}
|
|
23513
|
-
}
|
|
23514
|
-
}
|
|
23515
|
-
}
|
|
23516
|
-
];
|
|
23517
|
-
var result = void 0;
|
|
23518
|
-
var toReturn = void 0;
|
|
23519
|
-
var interpret = function interpret() {
|
|
23520
|
-
toReturn = false;
|
|
23521
|
-
var original = arguments.length > 1 ? Common.toArray(arguments) : arguments[0];
|
|
23522
|
-
Common.each(INTERPRETATIONS, function(family) {
|
|
23523
|
-
if (family.litmus(original)) {
|
|
23524
|
-
Common.each(family.conversions, function(conversion, conversionName) {
|
|
23525
|
-
result = conversion.read(original);
|
|
23526
|
-
if (toReturn === false && result !== false) {
|
|
23527
|
-
toReturn = result;
|
|
23528
|
-
result.conversionName = conversionName;
|
|
23529
|
-
result.conversion = conversion;
|
|
23530
|
-
return Common.BREAK;
|
|
23531
|
-
}
|
|
23532
|
-
});
|
|
23533
|
-
return Common.BREAK;
|
|
23534
|
-
}
|
|
23535
|
-
});
|
|
23536
|
-
return toReturn;
|
|
23537
|
-
};
|
|
23538
|
-
var tmpComponent = void 0;
|
|
23539
|
-
var ColorMath = {
|
|
23540
|
-
hsv_to_rgb: function hsv_to_rgb(h, s, v) {
|
|
23541
|
-
var hi = Math.floor(h / 60) % 6;
|
|
23542
|
-
var f = h / 60 - Math.floor(h / 60);
|
|
23543
|
-
var p = v * (1 - s);
|
|
23544
|
-
var q = v * (1 - f * s);
|
|
23545
|
-
var t = v * (1 - (1 - f) * s);
|
|
23546
|
-
var c = [
|
|
23547
|
-
[
|
|
23548
|
-
v,
|
|
23549
|
-
t,
|
|
23550
|
-
p
|
|
23551
|
-
],
|
|
23552
|
-
[
|
|
23553
|
-
q,
|
|
23554
|
-
v,
|
|
23555
|
-
p
|
|
23556
|
-
],
|
|
23557
|
-
[
|
|
23558
|
-
p,
|
|
23559
|
-
v,
|
|
23560
|
-
t
|
|
23561
|
-
],
|
|
23562
|
-
[
|
|
23563
|
-
p,
|
|
23564
|
-
q,
|
|
23565
|
-
v
|
|
23566
|
-
],
|
|
23567
|
-
[
|
|
23568
|
-
t,
|
|
23569
|
-
p,
|
|
23570
|
-
v
|
|
23571
|
-
],
|
|
23572
|
-
[
|
|
23573
|
-
v,
|
|
23574
|
-
p,
|
|
23575
|
-
q
|
|
23576
|
-
]
|
|
23577
|
-
][hi];
|
|
23578
|
-
return {
|
|
23579
|
-
r: c[0] * 255,
|
|
23580
|
-
g: c[1] * 255,
|
|
23581
|
-
b: c[2] * 255
|
|
23582
|
-
};
|
|
23583
|
-
},
|
|
23584
|
-
rgb_to_hsv: function rgb_to_hsv(r, g, b) {
|
|
23585
|
-
var min = Math.min(r, g, b);
|
|
23586
|
-
var max = Math.max(r, g, b);
|
|
23587
|
-
var delta = max - min;
|
|
23588
|
-
var h = void 0;
|
|
23589
|
-
var s = void 0;
|
|
23590
|
-
if (max !== 0) s = delta / max;
|
|
23591
|
-
else return {
|
|
23592
|
-
h: NaN,
|
|
23593
|
-
s: 0,
|
|
23594
|
-
v: 0
|
|
23595
|
-
};
|
|
23596
|
-
if (r === max) h = (g - b) / delta;
|
|
23597
|
-
else if (g === max) h = 2 + (b - r) / delta;
|
|
23598
|
-
else h = 4 + (r - g) / delta;
|
|
23599
|
-
h /= 6;
|
|
23600
|
-
if (h < 0) h += 1;
|
|
23601
|
-
return {
|
|
23602
|
-
h: h * 360,
|
|
23603
|
-
s,
|
|
23604
|
-
v: max / 255
|
|
23605
|
-
};
|
|
23606
|
-
},
|
|
23607
|
-
rgb_to_hex: function rgb_to_hex(r, g, b) {
|
|
23608
|
-
var hex = this.hex_with_component(0, 2, r);
|
|
23609
|
-
hex = this.hex_with_component(hex, 1, g);
|
|
23610
|
-
hex = this.hex_with_component(hex, 0, b);
|
|
23611
|
-
return hex;
|
|
23612
|
-
},
|
|
23613
|
-
component_from_hex: function component_from_hex(hex, componentIndex) {
|
|
23614
|
-
return hex >> componentIndex * 8 & 255;
|
|
23615
|
-
},
|
|
23616
|
-
hex_with_component: function hex_with_component(hex, componentIndex, value) {
|
|
23617
|
-
return value << (tmpComponent = componentIndex * 8) | hex & ~(255 << tmpComponent);
|
|
23618
|
-
}
|
|
23619
|
-
};
|
|
23620
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
23621
|
-
return typeof obj;
|
|
23622
|
-
} : function(obj) {
|
|
23623
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
23624
|
-
};
|
|
23625
|
-
var classCallCheck = function(instance, Constructor) {
|
|
23626
|
-
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
23627
|
-
};
|
|
23628
|
-
var createClass = function() {
|
|
23629
|
-
function defineProperties(target, props) {
|
|
23630
|
-
for (var i = 0; i < props.length; i++) {
|
|
23631
|
-
var descriptor = props[i];
|
|
23632
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
23633
|
-
descriptor.configurable = true;
|
|
23634
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
23635
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
23636
|
-
}
|
|
23637
|
-
}
|
|
23638
|
-
return function(Constructor, protoProps, staticProps) {
|
|
23639
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
23640
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
|
23641
|
-
return Constructor;
|
|
23642
|
-
};
|
|
23643
|
-
}();
|
|
23644
|
-
var get = function get(object, property, receiver) {
|
|
23645
|
-
if (object === null) object = Function.prototype;
|
|
23646
|
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
23647
|
-
if (desc === void 0) {
|
|
23648
|
-
var parent = Object.getPrototypeOf(object);
|
|
23649
|
-
if (parent === null) return;
|
|
23650
|
-
else return get(parent, property, receiver);
|
|
23651
|
-
} else if ("value" in desc) return desc.value;
|
|
23652
|
-
else {
|
|
23653
|
-
var getter = desc.get;
|
|
23654
|
-
if (getter === void 0) return;
|
|
23655
|
-
return getter.call(receiver);
|
|
23656
|
-
}
|
|
23657
|
-
};
|
|
23658
|
-
var inherits = function(subClass, superClass) {
|
|
23659
|
-
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
23660
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
23661
|
-
value: subClass,
|
|
23662
|
-
enumerable: false,
|
|
23663
|
-
writable: true,
|
|
23664
|
-
configurable: true
|
|
23665
|
-
} });
|
|
23666
|
-
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
23667
|
-
};
|
|
23668
|
-
var possibleConstructorReturn = function(self, call) {
|
|
23669
|
-
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
23670
|
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
23671
|
-
};
|
|
23672
|
-
var Color = function() {
|
|
23673
|
-
function Color() {
|
|
23674
|
-
classCallCheck(this, Color);
|
|
23675
|
-
this.__state = interpret.apply(this, arguments);
|
|
23676
|
-
if (this.__state === false) throw new Error("Failed to interpret color arguments");
|
|
23677
|
-
this.__state.a = this.__state.a || 1;
|
|
23678
|
-
}
|
|
23679
|
-
createClass(Color, [
|
|
23680
|
-
{
|
|
23681
|
-
key: "toString",
|
|
23682
|
-
value: function toString() {
|
|
23683
|
-
return colorToString(this);
|
|
23684
|
-
}
|
|
23685
|
-
},
|
|
23686
|
-
{
|
|
23687
|
-
key: "toHexString",
|
|
23688
|
-
value: function toHexString() {
|
|
23689
|
-
return colorToString(this, true);
|
|
23690
|
-
}
|
|
23691
|
-
},
|
|
23692
|
-
{
|
|
23693
|
-
key: "toOriginal",
|
|
23694
|
-
value: function toOriginal() {
|
|
23695
|
-
return this.__state.conversion.write(this);
|
|
23696
|
-
}
|
|
23697
|
-
}
|
|
23698
|
-
]);
|
|
23699
|
-
return Color;
|
|
23700
|
-
}();
|
|
23701
|
-
function defineRGBComponent(target, component, componentHexIndex) {
|
|
23702
|
-
Object.defineProperty(target, component, {
|
|
23703
|
-
get: function get$$1() {
|
|
23704
|
-
if (this.__state.space === "RGB") return this.__state[component];
|
|
23705
|
-
Color.recalculateRGB(this, component, componentHexIndex);
|
|
23706
|
-
return this.__state[component];
|
|
23707
|
-
},
|
|
23708
|
-
set: function set$$1(v) {
|
|
23709
|
-
if (this.__state.space !== "RGB") {
|
|
23710
|
-
Color.recalculateRGB(this, component, componentHexIndex);
|
|
23711
|
-
this.__state.space = "RGB";
|
|
23712
|
-
}
|
|
23713
|
-
this.__state[component] = v;
|
|
23714
|
-
}
|
|
23715
|
-
});
|
|
23716
|
-
}
|
|
23717
|
-
function defineHSVComponent(target, component) {
|
|
23718
|
-
Object.defineProperty(target, component, {
|
|
23719
|
-
get: function get$$1() {
|
|
23720
|
-
if (this.__state.space === "HSV") return this.__state[component];
|
|
23721
|
-
Color.recalculateHSV(this);
|
|
23722
|
-
return this.__state[component];
|
|
23723
|
-
},
|
|
23724
|
-
set: function set$$1(v) {
|
|
23725
|
-
if (this.__state.space !== "HSV") {
|
|
23726
|
-
Color.recalculateHSV(this);
|
|
23727
|
-
this.__state.space = "HSV";
|
|
23728
|
-
}
|
|
23729
|
-
this.__state[component] = v;
|
|
23730
|
-
}
|
|
23731
|
-
});
|
|
23732
|
-
}
|
|
23733
|
-
Color.recalculateRGB = function(color, component, componentHexIndex) {
|
|
23734
|
-
if (color.__state.space === "HEX") color.__state[component] = ColorMath.component_from_hex(color.__state.hex, componentHexIndex);
|
|
23735
|
-
else if (color.__state.space === "HSV") Common.extend(color.__state, ColorMath.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v));
|
|
23736
|
-
else throw new Error("Corrupted color state");
|
|
23737
|
-
};
|
|
23738
|
-
Color.recalculateHSV = function(color) {
|
|
23739
|
-
var result = ColorMath.rgb_to_hsv(color.r, color.g, color.b);
|
|
23740
|
-
Common.extend(color.__state, {
|
|
23741
|
-
s: result.s,
|
|
23742
|
-
v: result.v
|
|
23743
|
-
});
|
|
23744
|
-
if (!Common.isNaN(result.h)) color.__state.h = result.h;
|
|
23745
|
-
else if (Common.isUndefined(color.__state.h)) color.__state.h = 0;
|
|
23746
|
-
};
|
|
23747
|
-
Color.COMPONENTS = [
|
|
23748
|
-
"r",
|
|
23749
|
-
"g",
|
|
23750
|
-
"b",
|
|
23751
|
-
"h",
|
|
23752
|
-
"s",
|
|
23753
|
-
"v",
|
|
23754
|
-
"hex",
|
|
23755
|
-
"a"
|
|
23756
|
-
];
|
|
23757
|
-
defineRGBComponent(Color.prototype, "r", 2);
|
|
23758
|
-
defineRGBComponent(Color.prototype, "g", 1);
|
|
23759
|
-
defineRGBComponent(Color.prototype, "b", 0);
|
|
23760
|
-
defineHSVComponent(Color.prototype, "h");
|
|
23761
|
-
defineHSVComponent(Color.prototype, "s");
|
|
23762
|
-
defineHSVComponent(Color.prototype, "v");
|
|
23763
|
-
Object.defineProperty(Color.prototype, "a", {
|
|
23764
|
-
get: function get$$1() {
|
|
23765
|
-
return this.__state.a;
|
|
23766
|
-
},
|
|
23767
|
-
set: function set$$1(v) {
|
|
23768
|
-
this.__state.a = v;
|
|
23769
|
-
}
|
|
23770
|
-
});
|
|
23771
|
-
Object.defineProperty(Color.prototype, "hex", {
|
|
23772
|
-
get: function get$$1() {
|
|
23773
|
-
if (this.__state.space !== "HEX") {
|
|
23774
|
-
this.__state.hex = ColorMath.rgb_to_hex(this.r, this.g, this.b);
|
|
23775
|
-
this.__state.space = "HEX";
|
|
23776
|
-
}
|
|
23777
|
-
return this.__state.hex;
|
|
23778
|
-
},
|
|
23779
|
-
set: function set$$1(v) {
|
|
23780
|
-
this.__state.space = "HEX";
|
|
23781
|
-
this.__state.hex = v;
|
|
23782
|
-
}
|
|
23783
|
-
});
|
|
23784
|
-
var Controller = function() {
|
|
23785
|
-
function Controller(object, property) {
|
|
23786
|
-
classCallCheck(this, Controller);
|
|
23787
|
-
this.initialValue = object[property];
|
|
23788
|
-
this.domElement = document.createElement("div");
|
|
23789
|
-
this.object = object;
|
|
23790
|
-
this.property = property;
|
|
23791
|
-
this.__onChange = void 0;
|
|
23792
|
-
this.__onFinishChange = void 0;
|
|
23793
|
-
}
|
|
23794
|
-
createClass(Controller, [
|
|
23795
|
-
{
|
|
23796
|
-
key: "onChange",
|
|
23797
|
-
value: function onChange(fnc) {
|
|
23798
|
-
this.__onChange = fnc;
|
|
23799
|
-
return this;
|
|
23800
|
-
}
|
|
23801
|
-
},
|
|
23802
|
-
{
|
|
23803
|
-
key: "onFinishChange",
|
|
23804
|
-
value: function onFinishChange(fnc) {
|
|
23805
|
-
this.__onFinishChange = fnc;
|
|
23806
|
-
return this;
|
|
23807
|
-
}
|
|
23808
|
-
},
|
|
23809
|
-
{
|
|
23810
|
-
key: "setValue",
|
|
23811
|
-
value: function setValue(newValue) {
|
|
23812
|
-
this.object[this.property] = newValue;
|
|
23813
|
-
if (this.__onChange) this.__onChange.call(this, newValue);
|
|
23814
|
-
this.updateDisplay();
|
|
23815
|
-
return this;
|
|
23816
|
-
}
|
|
23817
|
-
},
|
|
23818
|
-
{
|
|
23819
|
-
key: "getValue",
|
|
23820
|
-
value: function getValue() {
|
|
23821
|
-
return this.object[this.property];
|
|
23822
|
-
}
|
|
23823
|
-
},
|
|
23824
|
-
{
|
|
23825
|
-
key: "updateDisplay",
|
|
23826
|
-
value: function updateDisplay() {
|
|
23827
|
-
return this;
|
|
23828
|
-
}
|
|
23829
|
-
},
|
|
23830
|
-
{
|
|
23831
|
-
key: "isModified",
|
|
23832
|
-
value: function isModified() {
|
|
23833
|
-
return this.initialValue !== this.getValue();
|
|
23834
|
-
}
|
|
23835
|
-
}
|
|
23836
|
-
]);
|
|
23837
|
-
return Controller;
|
|
23838
|
-
}();
|
|
23839
|
-
var EVENT_MAP = {
|
|
23840
|
-
HTMLEvents: ["change"],
|
|
23841
|
-
MouseEvents: [
|
|
23842
|
-
"click",
|
|
23843
|
-
"mousemove",
|
|
23844
|
-
"mousedown",
|
|
23845
|
-
"mouseup",
|
|
23846
|
-
"mouseover"
|
|
23847
|
-
],
|
|
23848
|
-
KeyboardEvents: ["keydown"]
|
|
23849
|
-
};
|
|
23850
|
-
var EVENT_MAP_INV = {};
|
|
23851
|
-
Common.each(EVENT_MAP, function(v, k) {
|
|
23852
|
-
Common.each(v, function(e) {
|
|
23853
|
-
EVENT_MAP_INV[e] = k;
|
|
23854
|
-
});
|
|
23855
|
-
});
|
|
23856
|
-
var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/;
|
|
23857
|
-
function cssValueToPixels(val) {
|
|
23858
|
-
if (val === "0" || Common.isUndefined(val)) return 0;
|
|
23859
|
-
var match = val.match(CSS_VALUE_PIXELS);
|
|
23860
|
-
if (!Common.isNull(match)) return parseFloat(match[1]);
|
|
23861
|
-
return 0;
|
|
23862
|
-
}
|
|
23863
|
-
var dom = {
|
|
23864
|
-
makeSelectable: function makeSelectable(elem, selectable) {
|
|
23865
|
-
if (elem === void 0 || elem.style === void 0) return;
|
|
23866
|
-
elem.onselectstart = selectable ? function() {
|
|
23867
|
-
return false;
|
|
23868
|
-
} : function() {};
|
|
23869
|
-
elem.style.MozUserSelect = selectable ? "auto" : "none";
|
|
23870
|
-
elem.style.KhtmlUserSelect = selectable ? "auto" : "none";
|
|
23871
|
-
elem.unselectable = selectable ? "on" : "off";
|
|
23872
|
-
},
|
|
23873
|
-
makeFullscreen: function makeFullscreen(elem, hor, vert) {
|
|
23874
|
-
var vertical = vert;
|
|
23875
|
-
var horizontal = hor;
|
|
23876
|
-
if (Common.isUndefined(horizontal)) horizontal = true;
|
|
23877
|
-
if (Common.isUndefined(vertical)) vertical = true;
|
|
23878
|
-
elem.style.position = "absolute";
|
|
23879
|
-
if (horizontal) {
|
|
23880
|
-
elem.style.left = 0;
|
|
23881
|
-
elem.style.right = 0;
|
|
23882
|
-
}
|
|
23883
|
-
if (vertical) {
|
|
23884
|
-
elem.style.top = 0;
|
|
23885
|
-
elem.style.bottom = 0;
|
|
23886
|
-
}
|
|
23887
|
-
},
|
|
23888
|
-
fakeEvent: function fakeEvent(elem, eventType, pars, aux) {
|
|
23889
|
-
var params = pars || {};
|
|
23890
|
-
var className = EVENT_MAP_INV[eventType];
|
|
23891
|
-
if (!className) throw new Error("Event type " + eventType + " not supported.");
|
|
23892
|
-
var evt = document.createEvent(className);
|
|
23893
|
-
switch (className) {
|
|
23894
|
-
case "MouseEvents":
|
|
23895
|
-
var clientX = params.x || params.clientX || 0;
|
|
23896
|
-
var clientY = params.y || params.clientY || 0;
|
|
23897
|
-
evt.initMouseEvent(eventType, params.bubbles || false, params.cancelable || true, window, params.clickCount || 1, 0, 0, clientX, clientY, false, false, false, false, 0, null);
|
|
23898
|
-
break;
|
|
23899
|
-
case "KeyboardEvents":
|
|
23900
|
-
var init = evt.initKeyboardEvent || evt.initKeyEvent;
|
|
23901
|
-
Common.defaults(params, {
|
|
23902
|
-
cancelable: true,
|
|
23903
|
-
ctrlKey: false,
|
|
23904
|
-
altKey: false,
|
|
23905
|
-
shiftKey: false,
|
|
23906
|
-
metaKey: false,
|
|
23907
|
-
keyCode: void 0,
|
|
23908
|
-
charCode: void 0
|
|
23909
|
-
});
|
|
23910
|
-
init(eventType, params.bubbles || false, params.cancelable, window, params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, params.keyCode, params.charCode);
|
|
23911
|
-
break;
|
|
23912
|
-
default:
|
|
23913
|
-
evt.initEvent(eventType, params.bubbles || false, params.cancelable || true);
|
|
23914
|
-
break;
|
|
23915
|
-
}
|
|
23916
|
-
Common.defaults(evt, aux);
|
|
23917
|
-
elem.dispatchEvent(evt);
|
|
23918
|
-
},
|
|
23919
|
-
bind: function bind(elem, event, func, newBool) {
|
|
23920
|
-
var bool = newBool || false;
|
|
23921
|
-
if (elem.addEventListener) elem.addEventListener(event, func, bool);
|
|
23922
|
-
else if (elem.attachEvent) elem.attachEvent("on" + event, func);
|
|
23923
|
-
return dom;
|
|
23924
|
-
},
|
|
23925
|
-
unbind: function unbind(elem, event, func, newBool) {
|
|
23926
|
-
var bool = newBool || false;
|
|
23927
|
-
if (elem.removeEventListener) elem.removeEventListener(event, func, bool);
|
|
23928
|
-
else if (elem.detachEvent) elem.detachEvent("on" + event, func);
|
|
23929
|
-
return dom;
|
|
23930
|
-
},
|
|
23931
|
-
addClass: function addClass(elem, className) {
|
|
23932
|
-
if (elem.className === void 0) elem.className = className;
|
|
23933
|
-
else if (elem.className !== className) {
|
|
23934
|
-
var classes = elem.className.split(/ +/);
|
|
23935
|
-
if (classes.indexOf(className) === -1) {
|
|
23936
|
-
classes.push(className);
|
|
23937
|
-
elem.className = classes.join(" ").replace(/^\s+/, "").replace(/\s+$/, "");
|
|
23938
|
-
}
|
|
23939
|
-
}
|
|
23940
|
-
return dom;
|
|
23941
|
-
},
|
|
23942
|
-
removeClass: function removeClass(elem, className) {
|
|
23943
|
-
if (className) if (elem.className === className) elem.removeAttribute("class");
|
|
23944
|
-
else {
|
|
23945
|
-
var classes = elem.className.split(/ +/);
|
|
23946
|
-
var index = classes.indexOf(className);
|
|
23947
|
-
if (index !== -1) {
|
|
23948
|
-
classes.splice(index, 1);
|
|
23949
|
-
elem.className = classes.join(" ");
|
|
23950
|
-
}
|
|
23951
|
-
}
|
|
23952
|
-
else elem.className = void 0;
|
|
23953
|
-
return dom;
|
|
23954
|
-
},
|
|
23955
|
-
hasClass: function hasClass(elem, className) {
|
|
23956
|
-
return new RegExp("(?:^|\\s+)" + className + "(?:\\s+|$)").test(elem.className) || false;
|
|
23957
|
-
},
|
|
23958
|
-
getWidth: function getWidth(elem) {
|
|
23959
|
-
var style = getComputedStyle(elem);
|
|
23960
|
-
return cssValueToPixels(style["border-left-width"]) + cssValueToPixels(style["border-right-width"]) + cssValueToPixels(style["padding-left"]) + cssValueToPixels(style["padding-right"]) + cssValueToPixels(style.width);
|
|
23961
|
-
},
|
|
23962
|
-
getHeight: function getHeight(elem) {
|
|
23963
|
-
var style = getComputedStyle(elem);
|
|
23964
|
-
return cssValueToPixels(style["border-top-width"]) + cssValueToPixels(style["border-bottom-width"]) + cssValueToPixels(style["padding-top"]) + cssValueToPixels(style["padding-bottom"]) + cssValueToPixels(style.height);
|
|
23965
|
-
},
|
|
23966
|
-
getOffset: function getOffset(el) {
|
|
23967
|
-
var elem = el;
|
|
23968
|
-
var offset = {
|
|
23969
|
-
left: 0,
|
|
23970
|
-
top: 0
|
|
23971
|
-
};
|
|
23972
|
-
if (elem.offsetParent) do {
|
|
23973
|
-
offset.left += elem.offsetLeft;
|
|
23974
|
-
offset.top += elem.offsetTop;
|
|
23975
|
-
elem = elem.offsetParent;
|
|
23976
|
-
} while (elem);
|
|
23977
|
-
return offset;
|
|
23978
|
-
},
|
|
23979
|
-
isActive: function isActive(elem) {
|
|
23980
|
-
return elem === document.activeElement && (elem.type || elem.href);
|
|
23981
|
-
}
|
|
23982
|
-
};
|
|
23983
|
-
var BooleanController = function(_Controller) {
|
|
23984
|
-
inherits(BooleanController, _Controller);
|
|
23985
|
-
function BooleanController(object, property) {
|
|
23986
|
-
classCallCheck(this, BooleanController);
|
|
23987
|
-
var _this2 = possibleConstructorReturn(this, (BooleanController.__proto__ || Object.getPrototypeOf(BooleanController)).call(this, object, property));
|
|
23988
|
-
var _this = _this2;
|
|
23989
|
-
_this2.__prev = _this2.getValue();
|
|
23990
|
-
_this2.__checkbox = document.createElement("input");
|
|
23991
|
-
_this2.__checkbox.setAttribute("type", "checkbox");
|
|
23992
|
-
function onChange() {
|
|
23993
|
-
_this.setValue(!_this.__prev);
|
|
23994
|
-
}
|
|
23995
|
-
dom.bind(_this2.__checkbox, "change", onChange, false);
|
|
23996
|
-
_this2.domElement.appendChild(_this2.__checkbox);
|
|
23997
|
-
_this2.updateDisplay();
|
|
23998
|
-
return _this2;
|
|
23999
|
-
}
|
|
24000
|
-
createClass(BooleanController, [{
|
|
24001
|
-
key: "setValue",
|
|
24002
|
-
value: function setValue(v) {
|
|
24003
|
-
var toReturn = get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), "setValue", this).call(this, v);
|
|
24004
|
-
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
24005
|
-
this.__prev = this.getValue();
|
|
24006
|
-
return toReturn;
|
|
24007
|
-
}
|
|
24008
|
-
}, {
|
|
24009
|
-
key: "updateDisplay",
|
|
24010
|
-
value: function updateDisplay() {
|
|
24011
|
-
if (this.getValue() === true) {
|
|
24012
|
-
this.__checkbox.setAttribute("checked", "checked");
|
|
24013
|
-
this.__checkbox.checked = true;
|
|
24014
|
-
this.__prev = true;
|
|
24015
|
-
} else {
|
|
24016
|
-
this.__checkbox.checked = false;
|
|
24017
|
-
this.__prev = false;
|
|
24018
|
-
}
|
|
24019
|
-
return get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), "updateDisplay", this).call(this);
|
|
24020
|
-
}
|
|
24021
|
-
}]);
|
|
24022
|
-
return BooleanController;
|
|
24023
|
-
}(Controller);
|
|
24024
|
-
var OptionController = function(_Controller) {
|
|
24025
|
-
inherits(OptionController, _Controller);
|
|
24026
|
-
function OptionController(object, property, opts) {
|
|
24027
|
-
classCallCheck(this, OptionController);
|
|
24028
|
-
var _this2 = possibleConstructorReturn(this, (OptionController.__proto__ || Object.getPrototypeOf(OptionController)).call(this, object, property));
|
|
24029
|
-
var options = opts;
|
|
24030
|
-
var _this = _this2;
|
|
24031
|
-
_this2.__select = document.createElement("select");
|
|
24032
|
-
if (Common.isArray(options)) {
|
|
24033
|
-
var map = {};
|
|
24034
|
-
Common.each(options, function(element) {
|
|
24035
|
-
map[element] = element;
|
|
24036
|
-
});
|
|
24037
|
-
options = map;
|
|
24038
|
-
}
|
|
24039
|
-
Common.each(options, function(value, key) {
|
|
24040
|
-
var opt = document.createElement("option");
|
|
24041
|
-
opt.innerHTML = key;
|
|
24042
|
-
opt.setAttribute("value", value);
|
|
24043
|
-
_this.__select.appendChild(opt);
|
|
24044
|
-
});
|
|
24045
|
-
_this2.updateDisplay();
|
|
24046
|
-
dom.bind(_this2.__select, "change", function() {
|
|
24047
|
-
var desiredValue = this.options[this.selectedIndex].value;
|
|
24048
|
-
_this.setValue(desiredValue);
|
|
24049
|
-
});
|
|
24050
|
-
_this2.domElement.appendChild(_this2.__select);
|
|
24051
|
-
return _this2;
|
|
24052
|
-
}
|
|
24053
|
-
createClass(OptionController, [{
|
|
24054
|
-
key: "setValue",
|
|
24055
|
-
value: function setValue(v) {
|
|
24056
|
-
var toReturn = get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), "setValue", this).call(this, v);
|
|
24057
|
-
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
24058
|
-
return toReturn;
|
|
24059
|
-
}
|
|
24060
|
-
}, {
|
|
24061
|
-
key: "updateDisplay",
|
|
24062
|
-
value: function updateDisplay() {
|
|
24063
|
-
if (dom.isActive(this.__select)) return this;
|
|
24064
|
-
this.__select.value = this.getValue();
|
|
24065
|
-
return get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), "updateDisplay", this).call(this);
|
|
24066
|
-
}
|
|
24067
|
-
}]);
|
|
24068
|
-
return OptionController;
|
|
24069
|
-
}(Controller);
|
|
24070
|
-
var StringController = function(_Controller) {
|
|
24071
|
-
inherits(StringController, _Controller);
|
|
24072
|
-
function StringController(object, property) {
|
|
24073
|
-
classCallCheck(this, StringController);
|
|
24074
|
-
var _this2 = possibleConstructorReturn(this, (StringController.__proto__ || Object.getPrototypeOf(StringController)).call(this, object, property));
|
|
24075
|
-
var _this = _this2;
|
|
24076
|
-
function onChange() {
|
|
24077
|
-
_this.setValue(_this.__input.value);
|
|
24078
|
-
}
|
|
24079
|
-
function onBlur() {
|
|
24080
|
-
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
24081
|
-
}
|
|
24082
|
-
_this2.__input = document.createElement("input");
|
|
24083
|
-
_this2.__input.setAttribute("type", "text");
|
|
24084
|
-
dom.bind(_this2.__input, "keyup", onChange);
|
|
24085
|
-
dom.bind(_this2.__input, "change", onChange);
|
|
24086
|
-
dom.bind(_this2.__input, "blur", onBlur);
|
|
24087
|
-
dom.bind(_this2.__input, "keydown", function(e) {
|
|
24088
|
-
if (e.keyCode === 13) this.blur();
|
|
24089
|
-
});
|
|
24090
|
-
_this2.updateDisplay();
|
|
24091
|
-
_this2.domElement.appendChild(_this2.__input);
|
|
24092
|
-
return _this2;
|
|
24093
|
-
}
|
|
24094
|
-
createClass(StringController, [{
|
|
24095
|
-
key: "updateDisplay",
|
|
24096
|
-
value: function updateDisplay() {
|
|
24097
|
-
if (!dom.isActive(this.__input)) this.__input.value = this.getValue();
|
|
24098
|
-
return get(StringController.prototype.__proto__ || Object.getPrototypeOf(StringController.prototype), "updateDisplay", this).call(this);
|
|
24099
|
-
}
|
|
24100
|
-
}]);
|
|
24101
|
-
return StringController;
|
|
24102
|
-
}(Controller);
|
|
24103
|
-
function numDecimals(x) {
|
|
24104
|
-
var _x = x.toString();
|
|
24105
|
-
if (_x.indexOf(".") > -1) return _x.length - _x.indexOf(".") - 1;
|
|
24106
|
-
return 0;
|
|
24107
|
-
}
|
|
24108
|
-
var NumberController = function(_Controller) {
|
|
24109
|
-
inherits(NumberController, _Controller);
|
|
24110
|
-
function NumberController(object, property, params) {
|
|
24111
|
-
classCallCheck(this, NumberController);
|
|
24112
|
-
var _this = possibleConstructorReturn(this, (NumberController.__proto__ || Object.getPrototypeOf(NumberController)).call(this, object, property));
|
|
24113
|
-
var _params = params || {};
|
|
24114
|
-
_this.__min = _params.min;
|
|
24115
|
-
_this.__max = _params.max;
|
|
24116
|
-
_this.__step = _params.step;
|
|
24117
|
-
if (Common.isUndefined(_this.__step)) if (_this.initialValue === 0) _this.__impliedStep = 1;
|
|
24118
|
-
else _this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(_this.initialValue)) / Math.LN10)) / 10;
|
|
24119
|
-
else _this.__impliedStep = _this.__step;
|
|
24120
|
-
_this.__precision = numDecimals(_this.__impliedStep);
|
|
24121
|
-
return _this;
|
|
24122
|
-
}
|
|
24123
|
-
createClass(NumberController, [
|
|
24124
|
-
{
|
|
24125
|
-
key: "setValue",
|
|
24126
|
-
value: function setValue(v) {
|
|
24127
|
-
var _v = v;
|
|
24128
|
-
if (this.__min !== void 0 && _v < this.__min) _v = this.__min;
|
|
24129
|
-
else if (this.__max !== void 0 && _v > this.__max) _v = this.__max;
|
|
24130
|
-
if (this.__step !== void 0 && _v % this.__step !== 0) _v = Math.round(_v / this.__step) * this.__step;
|
|
24131
|
-
return get(NumberController.prototype.__proto__ || Object.getPrototypeOf(NumberController.prototype), "setValue", this).call(this, _v);
|
|
24132
|
-
}
|
|
24133
|
-
},
|
|
24134
|
-
{
|
|
24135
|
-
key: "min",
|
|
24136
|
-
value: function min(minValue) {
|
|
24137
|
-
this.__min = minValue;
|
|
24138
|
-
return this;
|
|
24139
|
-
}
|
|
24140
|
-
},
|
|
24141
|
-
{
|
|
24142
|
-
key: "max",
|
|
24143
|
-
value: function max(maxValue) {
|
|
24144
|
-
this.__max = maxValue;
|
|
24145
|
-
return this;
|
|
24146
|
-
}
|
|
24147
|
-
},
|
|
24148
|
-
{
|
|
24149
|
-
key: "step",
|
|
24150
|
-
value: function step(stepValue) {
|
|
24151
|
-
this.__step = stepValue;
|
|
24152
|
-
this.__impliedStep = stepValue;
|
|
24153
|
-
this.__precision = numDecimals(stepValue);
|
|
24154
|
-
return this;
|
|
24155
|
-
}
|
|
24156
|
-
}
|
|
24157
|
-
]);
|
|
24158
|
-
return NumberController;
|
|
24159
|
-
}(Controller);
|
|
24160
|
-
function roundToDecimal(value, decimals) {
|
|
24161
|
-
var tenTo = Math.pow(10, decimals);
|
|
24162
|
-
return Math.round(value * tenTo) / tenTo;
|
|
24163
|
-
}
|
|
24164
|
-
var NumberControllerBox = function(_NumberController) {
|
|
24165
|
-
inherits(NumberControllerBox, _NumberController);
|
|
24166
|
-
function NumberControllerBox(object, property, params) {
|
|
24167
|
-
classCallCheck(this, NumberControllerBox);
|
|
24168
|
-
var _this2 = possibleConstructorReturn(this, (NumberControllerBox.__proto__ || Object.getPrototypeOf(NumberControllerBox)).call(this, object, property, params));
|
|
24169
|
-
_this2.__truncationSuspended = false;
|
|
24170
|
-
var _this = _this2;
|
|
24171
|
-
var prevY = void 0;
|
|
24172
|
-
function onChange() {
|
|
24173
|
-
var attempted = parseFloat(_this.__input.value);
|
|
24174
|
-
if (!Common.isNaN(attempted)) _this.setValue(attempted);
|
|
24175
|
-
}
|
|
24176
|
-
function onFinish() {
|
|
24177
|
-
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
24178
|
-
}
|
|
24179
|
-
function onBlur() {
|
|
24180
|
-
onFinish();
|
|
24181
|
-
}
|
|
24182
|
-
function onMouseDrag(e) {
|
|
24183
|
-
var diff = prevY - e.clientY;
|
|
24184
|
-
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
|
24185
|
-
prevY = e.clientY;
|
|
24186
|
-
}
|
|
24187
|
-
function onMouseUp() {
|
|
24188
|
-
dom.unbind(window, "mousemove", onMouseDrag);
|
|
24189
|
-
dom.unbind(window, "mouseup", onMouseUp);
|
|
24190
|
-
onFinish();
|
|
24191
|
-
}
|
|
24192
|
-
function onMouseDown(e) {
|
|
24193
|
-
dom.bind(window, "mousemove", onMouseDrag);
|
|
24194
|
-
dom.bind(window, "mouseup", onMouseUp);
|
|
24195
|
-
prevY = e.clientY;
|
|
24196
|
-
}
|
|
24197
|
-
_this2.__input = document.createElement("input");
|
|
24198
|
-
_this2.__input.setAttribute("type", "text");
|
|
24199
|
-
dom.bind(_this2.__input, "change", onChange);
|
|
24200
|
-
dom.bind(_this2.__input, "blur", onBlur);
|
|
24201
|
-
dom.bind(_this2.__input, "mousedown", onMouseDown);
|
|
24202
|
-
dom.bind(_this2.__input, "keydown", function(e) {
|
|
24203
|
-
if (e.keyCode === 13) {
|
|
24204
|
-
_this.__truncationSuspended = true;
|
|
24205
|
-
this.blur();
|
|
24206
|
-
_this.__truncationSuspended = false;
|
|
24207
|
-
onFinish();
|
|
24208
|
-
}
|
|
24209
|
-
});
|
|
24210
|
-
_this2.updateDisplay();
|
|
24211
|
-
_this2.domElement.appendChild(_this2.__input);
|
|
24212
|
-
return _this2;
|
|
24213
|
-
}
|
|
24214
|
-
createClass(NumberControllerBox, [{
|
|
24215
|
-
key: "updateDisplay",
|
|
24216
|
-
value: function updateDisplay() {
|
|
24217
|
-
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
|
|
24218
|
-
return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), "updateDisplay", this).call(this);
|
|
24219
|
-
}
|
|
24220
|
-
}]);
|
|
24221
|
-
return NumberControllerBox;
|
|
24222
|
-
}(NumberController);
|
|
24223
|
-
function map(v, i1, i2, o1, o2) {
|
|
24224
|
-
return o1 + (o2 - o1) * ((v - i1) / (i2 - i1));
|
|
24225
|
-
}
|
|
24226
|
-
var NumberControllerSlider = function(_NumberController) {
|
|
24227
|
-
inherits(NumberControllerSlider, _NumberController);
|
|
24228
|
-
function NumberControllerSlider(object, property, min, max, step) {
|
|
24229
|
-
classCallCheck(this, NumberControllerSlider);
|
|
24230
|
-
var _this2 = possibleConstructorReturn(this, (NumberControllerSlider.__proto__ || Object.getPrototypeOf(NumberControllerSlider)).call(this, object, property, {
|
|
24231
|
-
min,
|
|
24232
|
-
max,
|
|
24233
|
-
step
|
|
24234
|
-
}));
|
|
24235
|
-
var _this = _this2;
|
|
24236
|
-
_this2.__background = document.createElement("div");
|
|
24237
|
-
_this2.__foreground = document.createElement("div");
|
|
24238
|
-
dom.bind(_this2.__background, "mousedown", onMouseDown);
|
|
24239
|
-
dom.bind(_this2.__background, "touchstart", onTouchStart);
|
|
24240
|
-
dom.addClass(_this2.__background, "slider");
|
|
24241
|
-
dom.addClass(_this2.__foreground, "slider-fg");
|
|
24242
|
-
function onMouseDown(e) {
|
|
24243
|
-
document.activeElement.blur();
|
|
24244
|
-
dom.bind(window, "mousemove", onMouseDrag);
|
|
24245
|
-
dom.bind(window, "mouseup", onMouseUp);
|
|
24246
|
-
onMouseDrag(e);
|
|
24247
|
-
}
|
|
24248
|
-
function onMouseDrag(e) {
|
|
24249
|
-
e.preventDefault();
|
|
24250
|
-
var bgRect = _this.__background.getBoundingClientRect();
|
|
24251
|
-
_this.setValue(map(e.clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
|
24252
|
-
return false;
|
|
24253
|
-
}
|
|
24254
|
-
function onMouseUp() {
|
|
24255
|
-
dom.unbind(window, "mousemove", onMouseDrag);
|
|
24256
|
-
dom.unbind(window, "mouseup", onMouseUp);
|
|
24257
|
-
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
24258
|
-
}
|
|
24259
|
-
function onTouchStart(e) {
|
|
24260
|
-
if (e.touches.length !== 1) return;
|
|
24261
|
-
dom.bind(window, "touchmove", onTouchMove);
|
|
24262
|
-
dom.bind(window, "touchend", onTouchEnd);
|
|
24263
|
-
onTouchMove(e);
|
|
24264
|
-
}
|
|
24265
|
-
function onTouchMove(e) {
|
|
24266
|
-
var clientX = e.touches[0].clientX;
|
|
24267
|
-
var bgRect = _this.__background.getBoundingClientRect();
|
|
24268
|
-
_this.setValue(map(clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
|
|
24269
|
-
}
|
|
24270
|
-
function onTouchEnd() {
|
|
24271
|
-
dom.unbind(window, "touchmove", onTouchMove);
|
|
24272
|
-
dom.unbind(window, "touchend", onTouchEnd);
|
|
24273
|
-
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.getValue());
|
|
24274
|
-
}
|
|
24275
|
-
_this2.updateDisplay();
|
|
24276
|
-
_this2.__background.appendChild(_this2.__foreground);
|
|
24277
|
-
_this2.domElement.appendChild(_this2.__background);
|
|
24278
|
-
return _this2;
|
|
24279
|
-
}
|
|
24280
|
-
createClass(NumberControllerSlider, [{
|
|
24281
|
-
key: "updateDisplay",
|
|
24282
|
-
value: function updateDisplay() {
|
|
24283
|
-
var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
|
|
24284
|
-
this.__foreground.style.width = pct * 100 + "%";
|
|
24285
|
-
return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), "updateDisplay", this).call(this);
|
|
24286
|
-
}
|
|
24287
|
-
}]);
|
|
24288
|
-
return NumberControllerSlider;
|
|
24289
|
-
}(NumberController);
|
|
24290
|
-
var FunctionController = function(_Controller) {
|
|
24291
|
-
inherits(FunctionController, _Controller);
|
|
24292
|
-
function FunctionController(object, property, text) {
|
|
24293
|
-
classCallCheck(this, FunctionController);
|
|
24294
|
-
var _this2 = possibleConstructorReturn(this, (FunctionController.__proto__ || Object.getPrototypeOf(FunctionController)).call(this, object, property));
|
|
24295
|
-
var _this = _this2;
|
|
24296
|
-
_this2.__button = document.createElement("div");
|
|
24297
|
-
_this2.__button.innerHTML = text === void 0 ? "Fire" : text;
|
|
24298
|
-
dom.bind(_this2.__button, "click", function(e) {
|
|
24299
|
-
e.preventDefault();
|
|
24300
|
-
_this.fire();
|
|
24301
|
-
return false;
|
|
24302
|
-
});
|
|
24303
|
-
dom.addClass(_this2.__button, "button");
|
|
24304
|
-
_this2.domElement.appendChild(_this2.__button);
|
|
24305
|
-
return _this2;
|
|
24306
|
-
}
|
|
24307
|
-
createClass(FunctionController, [{
|
|
24308
|
-
key: "fire",
|
|
24309
|
-
value: function fire() {
|
|
24310
|
-
if (this.__onChange) this.__onChange.call(this);
|
|
24311
|
-
this.getValue().call(this.object);
|
|
24312
|
-
if (this.__onFinishChange) this.__onFinishChange.call(this, this.getValue());
|
|
24313
|
-
}
|
|
24314
|
-
}]);
|
|
24315
|
-
return FunctionController;
|
|
24316
|
-
}(Controller);
|
|
24317
|
-
var ColorController = function(_Controller) {
|
|
24318
|
-
inherits(ColorController, _Controller);
|
|
24319
|
-
function ColorController(object, property) {
|
|
24320
|
-
classCallCheck(this, ColorController);
|
|
24321
|
-
var _this2 = possibleConstructorReturn(this, (ColorController.__proto__ || Object.getPrototypeOf(ColorController)).call(this, object, property));
|
|
24322
|
-
_this2.__color = new Color(_this2.getValue());
|
|
24323
|
-
_this2.__temp = new Color(0);
|
|
24324
|
-
var _this = _this2;
|
|
24325
|
-
_this2.domElement = document.createElement("div");
|
|
24326
|
-
dom.makeSelectable(_this2.domElement, false);
|
|
24327
|
-
_this2.__selector = document.createElement("div");
|
|
24328
|
-
_this2.__selector.className = "selector";
|
|
24329
|
-
_this2.__saturation_field = document.createElement("div");
|
|
24330
|
-
_this2.__saturation_field.className = "saturation-field";
|
|
24331
|
-
_this2.__field_knob = document.createElement("div");
|
|
24332
|
-
_this2.__field_knob.className = "field-knob";
|
|
24333
|
-
_this2.__field_knob_border = "2px solid ";
|
|
24334
|
-
_this2.__hue_knob = document.createElement("div");
|
|
24335
|
-
_this2.__hue_knob.className = "hue-knob";
|
|
24336
|
-
_this2.__hue_field = document.createElement("div");
|
|
24337
|
-
_this2.__hue_field.className = "hue-field";
|
|
24338
|
-
_this2.__input = document.createElement("input");
|
|
24339
|
-
_this2.__input.type = "text";
|
|
24340
|
-
_this2.__input_textShadow = "0 1px 1px ";
|
|
24341
|
-
dom.bind(_this2.__input, "keydown", function(e) {
|
|
24342
|
-
if (e.keyCode === 13) onBlur.call(this);
|
|
24343
|
-
});
|
|
24344
|
-
dom.bind(_this2.__input, "blur", onBlur);
|
|
24345
|
-
dom.bind(_this2.__selector, "mousedown", function() {
|
|
24346
|
-
dom.addClass(this, "drag").bind(window, "mouseup", function() {
|
|
24347
|
-
dom.removeClass(_this.__selector, "drag");
|
|
24348
|
-
});
|
|
24349
|
-
});
|
|
24350
|
-
dom.bind(_this2.__selector, "touchstart", function() {
|
|
24351
|
-
dom.addClass(this, "drag").bind(window, "touchend", function() {
|
|
24352
|
-
dom.removeClass(_this.__selector, "drag");
|
|
24353
|
-
});
|
|
24354
|
-
});
|
|
24355
|
-
var valueField = document.createElement("div");
|
|
24356
|
-
Common.extend(_this2.__selector.style, {
|
|
24357
|
-
width: "122px",
|
|
24358
|
-
height: "102px",
|
|
24359
|
-
padding: "3px",
|
|
24360
|
-
backgroundColor: "#222",
|
|
24361
|
-
boxShadow: "0px 1px 3px rgba(0,0,0,0.3)"
|
|
24362
|
-
});
|
|
24363
|
-
Common.extend(_this2.__field_knob.style, {
|
|
24364
|
-
position: "absolute",
|
|
24365
|
-
width: "12px",
|
|
24366
|
-
height: "12px",
|
|
24367
|
-
border: _this2.__field_knob_border + (_this2.__color.v < .5 ? "#fff" : "#000"),
|
|
24368
|
-
boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
|
|
24369
|
-
borderRadius: "12px",
|
|
24370
|
-
zIndex: 1
|
|
24371
|
-
});
|
|
24372
|
-
Common.extend(_this2.__hue_knob.style, {
|
|
24373
|
-
position: "absolute",
|
|
24374
|
-
width: "15px",
|
|
24375
|
-
height: "2px",
|
|
24376
|
-
borderRight: "4px solid #fff",
|
|
24377
|
-
zIndex: 1
|
|
24378
|
-
});
|
|
24379
|
-
Common.extend(_this2.__saturation_field.style, {
|
|
24380
|
-
width: "100px",
|
|
24381
|
-
height: "100px",
|
|
24382
|
-
border: "1px solid #555",
|
|
24383
|
-
marginRight: "3px",
|
|
24384
|
-
display: "inline-block",
|
|
24385
|
-
cursor: "pointer"
|
|
24386
|
-
});
|
|
24387
|
-
Common.extend(valueField.style, {
|
|
24388
|
-
width: "100%",
|
|
24389
|
-
height: "100%",
|
|
24390
|
-
background: "none"
|
|
24391
|
-
});
|
|
24392
|
-
linearGradient(valueField, "top", "rgba(0,0,0,0)", "#000");
|
|
24393
|
-
Common.extend(_this2.__hue_field.style, {
|
|
24394
|
-
width: "15px",
|
|
24395
|
-
height: "100px",
|
|
24396
|
-
border: "1px solid #555",
|
|
24397
|
-
cursor: "ns-resize",
|
|
24398
|
-
position: "absolute",
|
|
24399
|
-
top: "3px",
|
|
24400
|
-
right: "3px"
|
|
24401
|
-
});
|
|
24402
|
-
hueGradient(_this2.__hue_field);
|
|
24403
|
-
Common.extend(_this2.__input.style, {
|
|
24404
|
-
outline: "none",
|
|
24405
|
-
textAlign: "center",
|
|
24406
|
-
color: "#fff",
|
|
24407
|
-
border: 0,
|
|
24408
|
-
fontWeight: "bold",
|
|
24409
|
-
textShadow: _this2.__input_textShadow + "rgba(0,0,0,0.7)"
|
|
24410
|
-
});
|
|
24411
|
-
dom.bind(_this2.__saturation_field, "mousedown", fieldDown);
|
|
24412
|
-
dom.bind(_this2.__saturation_field, "touchstart", fieldDown);
|
|
24413
|
-
dom.bind(_this2.__field_knob, "mousedown", fieldDown);
|
|
24414
|
-
dom.bind(_this2.__field_knob, "touchstart", fieldDown);
|
|
24415
|
-
dom.bind(_this2.__hue_field, "mousedown", fieldDownH);
|
|
24416
|
-
dom.bind(_this2.__hue_field, "touchstart", fieldDownH);
|
|
24417
|
-
function fieldDown(e) {
|
|
24418
|
-
setSV(e);
|
|
24419
|
-
dom.bind(window, "mousemove", setSV);
|
|
24420
|
-
dom.bind(window, "touchmove", setSV);
|
|
24421
|
-
dom.bind(window, "mouseup", fieldUpSV);
|
|
24422
|
-
dom.bind(window, "touchend", fieldUpSV);
|
|
24423
|
-
}
|
|
24424
|
-
function fieldDownH(e) {
|
|
24425
|
-
setH(e);
|
|
24426
|
-
dom.bind(window, "mousemove", setH);
|
|
24427
|
-
dom.bind(window, "touchmove", setH);
|
|
24428
|
-
dom.bind(window, "mouseup", fieldUpH);
|
|
24429
|
-
dom.bind(window, "touchend", fieldUpH);
|
|
24430
|
-
}
|
|
24431
|
-
function fieldUpSV() {
|
|
24432
|
-
dom.unbind(window, "mousemove", setSV);
|
|
24433
|
-
dom.unbind(window, "touchmove", setSV);
|
|
24434
|
-
dom.unbind(window, "mouseup", fieldUpSV);
|
|
24435
|
-
dom.unbind(window, "touchend", fieldUpSV);
|
|
24436
|
-
onFinish();
|
|
24437
|
-
}
|
|
24438
|
-
function fieldUpH() {
|
|
24439
|
-
dom.unbind(window, "mousemove", setH);
|
|
24440
|
-
dom.unbind(window, "touchmove", setH);
|
|
24441
|
-
dom.unbind(window, "mouseup", fieldUpH);
|
|
24442
|
-
dom.unbind(window, "touchend", fieldUpH);
|
|
24443
|
-
onFinish();
|
|
24444
|
-
}
|
|
24445
|
-
function onBlur() {
|
|
24446
|
-
var i = interpret(this.value);
|
|
24447
|
-
if (i !== false) {
|
|
24448
|
-
_this.__color.__state = i;
|
|
24449
|
-
_this.setValue(_this.__color.toOriginal());
|
|
24450
|
-
} else this.value = _this.__color.toString();
|
|
24451
|
-
}
|
|
24452
|
-
function onFinish() {
|
|
24453
|
-
if (_this.__onFinishChange) _this.__onFinishChange.call(_this, _this.__color.toOriginal());
|
|
24454
|
-
}
|
|
24455
|
-
_this2.__saturation_field.appendChild(valueField);
|
|
24456
|
-
_this2.__selector.appendChild(_this2.__field_knob);
|
|
24457
|
-
_this2.__selector.appendChild(_this2.__saturation_field);
|
|
24458
|
-
_this2.__selector.appendChild(_this2.__hue_field);
|
|
24459
|
-
_this2.__hue_field.appendChild(_this2.__hue_knob);
|
|
24460
|
-
_this2.domElement.appendChild(_this2.__input);
|
|
24461
|
-
_this2.domElement.appendChild(_this2.__selector);
|
|
24462
|
-
_this2.updateDisplay();
|
|
24463
|
-
function setSV(e) {
|
|
24464
|
-
if (e.type.indexOf("touch") === -1) e.preventDefault();
|
|
24465
|
-
var fieldRect = _this.__saturation_field.getBoundingClientRect();
|
|
24466
|
-
var _ref = e.touches && e.touches[0] || e, clientX = _ref.clientX, clientY = _ref.clientY;
|
|
24467
|
-
var s = (clientX - fieldRect.left) / (fieldRect.right - fieldRect.left);
|
|
24468
|
-
var v = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
|
24469
|
-
if (v > 1) v = 1;
|
|
24470
|
-
else if (v < 0) v = 0;
|
|
24471
|
-
if (s > 1) s = 1;
|
|
24472
|
-
else if (s < 0) s = 0;
|
|
24473
|
-
_this.__color.v = v;
|
|
24474
|
-
_this.__color.s = s;
|
|
24475
|
-
_this.setValue(_this.__color.toOriginal());
|
|
24476
|
-
return false;
|
|
24477
|
-
}
|
|
24478
|
-
function setH(e) {
|
|
24479
|
-
if (e.type.indexOf("touch") === -1) e.preventDefault();
|
|
24480
|
-
var fieldRect = _this.__hue_field.getBoundingClientRect();
|
|
24481
|
-
var h = 1 - ((e.touches && e.touches[0] || e).clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
|
|
24482
|
-
if (h > 1) h = 1;
|
|
24483
|
-
else if (h < 0) h = 0;
|
|
24484
|
-
_this.__color.h = h * 360;
|
|
24485
|
-
_this.setValue(_this.__color.toOriginal());
|
|
24486
|
-
return false;
|
|
24487
|
-
}
|
|
24488
|
-
return _this2;
|
|
24489
|
-
}
|
|
24490
|
-
createClass(ColorController, [{
|
|
24491
|
-
key: "updateDisplay",
|
|
24492
|
-
value: function updateDisplay() {
|
|
24493
|
-
var i = interpret(this.getValue());
|
|
24494
|
-
if (i !== false) {
|
|
24495
|
-
var mismatch = false;
|
|
24496
|
-
Common.each(Color.COMPONENTS, function(component) {
|
|
24497
|
-
if (!Common.isUndefined(i[component]) && !Common.isUndefined(this.__color.__state[component]) && i[component] !== this.__color.__state[component]) {
|
|
24498
|
-
mismatch = true;
|
|
24499
|
-
return {};
|
|
24500
|
-
}
|
|
24501
|
-
}, this);
|
|
24502
|
-
if (mismatch) Common.extend(this.__color.__state, i);
|
|
24503
|
-
}
|
|
24504
|
-
Common.extend(this.__temp.__state, this.__color.__state);
|
|
24505
|
-
this.__temp.a = 1;
|
|
24506
|
-
var flip = this.__color.v < .5 || this.__color.s > .5 ? 255 : 0;
|
|
24507
|
-
var _flip = 255 - flip;
|
|
24508
|
-
Common.extend(this.__field_knob.style, {
|
|
24509
|
-
marginLeft: 100 * this.__color.s - 7 + "px",
|
|
24510
|
-
marginTop: 100 * (1 - this.__color.v) - 7 + "px",
|
|
24511
|
-
backgroundColor: this.__temp.toHexString(),
|
|
24512
|
-
border: this.__field_knob_border + "rgb(" + flip + "," + flip + "," + flip + ")"
|
|
24513
|
-
});
|
|
24514
|
-
this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + "px";
|
|
24515
|
-
this.__temp.s = 1;
|
|
24516
|
-
this.__temp.v = 1;
|
|
24517
|
-
linearGradient(this.__saturation_field, "left", "#fff", this.__temp.toHexString());
|
|
24518
|
-
this.__input.value = this.__color.toString();
|
|
24519
|
-
Common.extend(this.__input.style, {
|
|
24520
|
-
backgroundColor: this.__color.toHexString(),
|
|
24521
|
-
color: "rgb(" + flip + "," + flip + "," + flip + ")",
|
|
24522
|
-
textShadow: this.__input_textShadow + "rgba(" + _flip + "," + _flip + "," + _flip + ",.7)"
|
|
24523
|
-
});
|
|
24524
|
-
}
|
|
24525
|
-
}]);
|
|
24526
|
-
return ColorController;
|
|
24527
|
-
}(Controller);
|
|
24528
|
-
var vendors = [
|
|
24529
|
-
"-moz-",
|
|
24530
|
-
"-o-",
|
|
24531
|
-
"-webkit-",
|
|
24532
|
-
"-ms-",
|
|
24533
|
-
""
|
|
24534
|
-
];
|
|
24535
|
-
function linearGradient(elem, x, a, b) {
|
|
24536
|
-
elem.style.background = "";
|
|
24537
|
-
Common.each(vendors, function(vendor) {
|
|
24538
|
-
elem.style.cssText += "background: " + vendor + "linear-gradient(" + x + ", " + a + " 0%, " + b + " 100%); ";
|
|
24539
|
-
});
|
|
24540
|
-
}
|
|
24541
|
-
function hueGradient(elem) {
|
|
24542
|
-
elem.style.background = "";
|
|
24543
|
-
elem.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";
|
|
24544
|
-
elem.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
24545
|
-
elem.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
24546
|
-
elem.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
24547
|
-
elem.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
|
|
24548
|
-
}
|
|
24549
|
-
var css = {
|
|
24550
|
-
load: function load(url, indoc) {
|
|
24551
|
-
var doc = indoc || document;
|
|
24552
|
-
var link = doc.createElement("link");
|
|
24553
|
-
link.type = "text/css";
|
|
24554
|
-
link.rel = "stylesheet";
|
|
24555
|
-
link.href = url;
|
|
24556
|
-
doc.getElementsByTagName("head")[0].appendChild(link);
|
|
24557
|
-
},
|
|
24558
|
-
inject: function inject(cssContent, indoc) {
|
|
24559
|
-
var doc = indoc || document;
|
|
24560
|
-
var injected = document.createElement("style");
|
|
24561
|
-
injected.type = "text/css";
|
|
24562
|
-
injected.innerHTML = cssContent;
|
|
24563
|
-
var head = doc.getElementsByTagName("head")[0];
|
|
24564
|
-
try {
|
|
24565
|
-
head.appendChild(injected);
|
|
24566
|
-
} catch (e) {}
|
|
24567
|
-
}
|
|
24568
|
-
};
|
|
24569
|
-
var saveDialogContents = "<div id=\"dg-save\" class=\"dg dialogue\">\n\n Here's the new load parameter for your <code>GUI</code>'s constructor:\n\n <textarea id=\"dg-new-constructor\"></textarea>\n\n <div id=\"dg-save-locally\">\n\n <input id=\"dg-local-storage\" type=\"checkbox\"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id=\"dg-local-explain\">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>";
|
|
24570
|
-
var ControllerFactory = function ControllerFactory(object, property) {
|
|
24571
|
-
var initialValue = object[property];
|
|
24572
|
-
if (Common.isArray(arguments[2]) || Common.isObject(arguments[2])) return new OptionController(object, property, arguments[2]);
|
|
24573
|
-
if (Common.isNumber(initialValue)) {
|
|
24574
|
-
if (Common.isNumber(arguments[2]) && Common.isNumber(arguments[3])) {
|
|
24575
|
-
if (Common.isNumber(arguments[4])) return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]);
|
|
24576
|
-
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
|
24577
|
-
}
|
|
24578
|
-
if (Common.isNumber(arguments[4])) return new NumberControllerBox(object, property, {
|
|
24579
|
-
min: arguments[2],
|
|
24580
|
-
max: arguments[3],
|
|
24581
|
-
step: arguments[4]
|
|
24582
|
-
});
|
|
24583
|
-
return new NumberControllerBox(object, property, {
|
|
24584
|
-
min: arguments[2],
|
|
24585
|
-
max: arguments[3]
|
|
24586
|
-
});
|
|
24587
|
-
}
|
|
24588
|
-
if (Common.isString(initialValue)) return new StringController(object, property);
|
|
24589
|
-
if (Common.isFunction(initialValue)) return new FunctionController(object, property, "");
|
|
24590
|
-
if (Common.isBoolean(initialValue)) return new BooleanController(object, property);
|
|
24591
|
-
return null;
|
|
24592
|
-
};
|
|
24593
|
-
function requestAnimationFrame$1(callback) {
|
|
24594
|
-
setTimeout(callback, 1e3 / 60);
|
|
24595
|
-
}
|
|
24596
|
-
var requestAnimationFrame$1$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame$1;
|
|
24597
|
-
var CenteredDiv = function() {
|
|
24598
|
-
function CenteredDiv() {
|
|
24599
|
-
classCallCheck(this, CenteredDiv);
|
|
24600
|
-
this.backgroundElement = document.createElement("div");
|
|
24601
|
-
Common.extend(this.backgroundElement.style, {
|
|
24602
|
-
backgroundColor: "rgba(0,0,0,0.8)",
|
|
24603
|
-
top: 0,
|
|
24604
|
-
left: 0,
|
|
24605
|
-
display: "none",
|
|
24606
|
-
zIndex: "1000",
|
|
24607
|
-
opacity: 0,
|
|
24608
|
-
WebkitTransition: "opacity 0.2s linear",
|
|
24609
|
-
transition: "opacity 0.2s linear"
|
|
24610
|
-
});
|
|
24611
|
-
dom.makeFullscreen(this.backgroundElement);
|
|
24612
|
-
this.backgroundElement.style.position = "fixed";
|
|
24613
|
-
this.domElement = document.createElement("div");
|
|
24614
|
-
Common.extend(this.domElement.style, {
|
|
24615
|
-
position: "fixed",
|
|
24616
|
-
display: "none",
|
|
24617
|
-
zIndex: "1001",
|
|
24618
|
-
opacity: 0,
|
|
24619
|
-
WebkitTransition: "-webkit-transform 0.2s ease-out, opacity 0.2s linear",
|
|
24620
|
-
transition: "transform 0.2s ease-out, opacity 0.2s linear"
|
|
24621
|
-
});
|
|
24622
|
-
document.body.appendChild(this.backgroundElement);
|
|
24623
|
-
document.body.appendChild(this.domElement);
|
|
24624
|
-
var _this = this;
|
|
24625
|
-
dom.bind(this.backgroundElement, "click", function() {
|
|
24626
|
-
_this.hide();
|
|
24627
|
-
});
|
|
24628
|
-
}
|
|
24629
|
-
createClass(CenteredDiv, [
|
|
24630
|
-
{
|
|
24631
|
-
key: "show",
|
|
24632
|
-
value: function show() {
|
|
24633
|
-
var _this = this;
|
|
24634
|
-
this.backgroundElement.style.display = "block";
|
|
24635
|
-
this.domElement.style.display = "block";
|
|
24636
|
-
this.domElement.style.opacity = 0;
|
|
24637
|
-
this.domElement.style.webkitTransform = "scale(1.1)";
|
|
24638
|
-
this.layout();
|
|
24639
|
-
Common.defer(function() {
|
|
24640
|
-
_this.backgroundElement.style.opacity = 1;
|
|
24641
|
-
_this.domElement.style.opacity = 1;
|
|
24642
|
-
_this.domElement.style.webkitTransform = "scale(1)";
|
|
24643
|
-
});
|
|
24644
|
-
}
|
|
24645
|
-
},
|
|
24646
|
-
{
|
|
24647
|
-
key: "hide",
|
|
24648
|
-
value: function hide() {
|
|
24649
|
-
var _this = this;
|
|
24650
|
-
var hide = function hide() {
|
|
24651
|
-
_this.domElement.style.display = "none";
|
|
24652
|
-
_this.backgroundElement.style.display = "none";
|
|
24653
|
-
dom.unbind(_this.domElement, "webkitTransitionEnd", hide);
|
|
24654
|
-
dom.unbind(_this.domElement, "transitionend", hide);
|
|
24655
|
-
dom.unbind(_this.domElement, "oTransitionEnd", hide);
|
|
24656
|
-
};
|
|
24657
|
-
dom.bind(this.domElement, "webkitTransitionEnd", hide);
|
|
24658
|
-
dom.bind(this.domElement, "transitionend", hide);
|
|
24659
|
-
dom.bind(this.domElement, "oTransitionEnd", hide);
|
|
24660
|
-
this.backgroundElement.style.opacity = 0;
|
|
24661
|
-
this.domElement.style.opacity = 0;
|
|
24662
|
-
this.domElement.style.webkitTransform = "scale(1.1)";
|
|
24663
|
-
}
|
|
24664
|
-
},
|
|
24665
|
-
{
|
|
24666
|
-
key: "layout",
|
|
24667
|
-
value: function layout() {
|
|
24668
|
-
this.domElement.style.left = window.innerWidth / 2 - dom.getWidth(this.domElement) / 2 + "px";
|
|
24669
|
-
this.domElement.style.top = window.innerHeight / 2 - dom.getHeight(this.domElement) / 2 + "px";
|
|
24670
|
-
}
|
|
24671
|
-
}
|
|
24672
|
-
]);
|
|
24673
|
-
return CenteredDiv;
|
|
24674
|
-
}();
|
|
24675
|
-
var styleSheet = ___$insertStyle(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");
|
|
24676
|
-
css.inject(styleSheet);
|
|
24677
|
-
var CSS_NAMESPACE = "dg";
|
|
24678
|
-
var HIDE_KEY_CODE = 72;
|
|
24679
|
-
var CLOSE_BUTTON_HEIGHT = 20;
|
|
24680
|
-
var DEFAULT_DEFAULT_PRESET_NAME = "Default";
|
|
24681
|
-
var SUPPORTS_LOCAL_STORAGE = function() {
|
|
24682
|
-
try {
|
|
24683
|
-
return !!window.localStorage;
|
|
24684
|
-
} catch (e) {
|
|
24685
|
-
return false;
|
|
24686
|
-
}
|
|
24687
|
-
}();
|
|
24688
|
-
var SAVE_DIALOGUE = void 0;
|
|
24689
|
-
var autoPlaceVirgin = true;
|
|
24690
|
-
var autoPlaceContainer = void 0;
|
|
24691
|
-
var hide = false;
|
|
24692
|
-
var hideableGuis = [];
|
|
24693
|
-
var GUI = function GUI(pars) {
|
|
24694
|
-
var _this = this;
|
|
24695
|
-
var params = pars || {};
|
|
24696
|
-
this.domElement = document.createElement("div");
|
|
24697
|
-
this.__ul = document.createElement("ul");
|
|
24698
|
-
this.domElement.appendChild(this.__ul);
|
|
24699
|
-
dom.addClass(this.domElement, CSS_NAMESPACE);
|
|
24700
|
-
this.__folders = {};
|
|
24701
|
-
this.__controllers = [];
|
|
24702
|
-
this.__rememberedObjects = [];
|
|
24703
|
-
this.__rememberedObjectIndecesToControllers = [];
|
|
24704
|
-
this.__listening = [];
|
|
24705
|
-
params = Common.defaults(params, {
|
|
24706
|
-
closeOnTop: false,
|
|
24707
|
-
autoPlace: true,
|
|
24708
|
-
width: GUI.DEFAULT_WIDTH
|
|
24709
|
-
});
|
|
24710
|
-
params = Common.defaults(params, {
|
|
24711
|
-
resizable: params.autoPlace,
|
|
24712
|
-
hideable: params.autoPlace
|
|
24713
|
-
});
|
|
24714
|
-
if (!Common.isUndefined(params.load)) {
|
|
24715
|
-
if (params.preset) params.load.preset = params.preset;
|
|
24716
|
-
} else params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME };
|
|
24717
|
-
if (Common.isUndefined(params.parent) && params.hideable) hideableGuis.push(this);
|
|
24718
|
-
params.resizable = Common.isUndefined(params.parent) && params.resizable;
|
|
24719
|
-
if (params.autoPlace && Common.isUndefined(params.scrollable)) params.scrollable = true;
|
|
24720
|
-
var useLocalStorage = SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(this, "isLocal")) === "true";
|
|
24721
|
-
var saveToLocalStorage = void 0;
|
|
24722
|
-
var titleRow = void 0;
|
|
24723
|
-
Object.defineProperties(this, {
|
|
24724
|
-
parent: { get: function get$$1() {
|
|
24725
|
-
return params.parent;
|
|
24726
|
-
} },
|
|
24727
|
-
scrollable: { get: function get$$1() {
|
|
24728
|
-
return params.scrollable;
|
|
24729
|
-
} },
|
|
24730
|
-
autoPlace: { get: function get$$1() {
|
|
24731
|
-
return params.autoPlace;
|
|
24732
|
-
} },
|
|
24733
|
-
closeOnTop: { get: function get$$1() {
|
|
24734
|
-
return params.closeOnTop;
|
|
24735
|
-
} },
|
|
24736
|
-
preset: {
|
|
24737
|
-
get: function get$$1() {
|
|
24738
|
-
if (_this.parent) return _this.getRoot().preset;
|
|
24739
|
-
return params.load.preset;
|
|
24740
|
-
},
|
|
24741
|
-
set: function set$$1(v) {
|
|
24742
|
-
if (_this.parent) _this.getRoot().preset = v;
|
|
24743
|
-
else params.load.preset = v;
|
|
24744
|
-
setPresetSelectIndex(this);
|
|
24745
|
-
_this.revert();
|
|
24746
|
-
}
|
|
24747
|
-
},
|
|
24748
|
-
width: {
|
|
24749
|
-
get: function get$$1() {
|
|
24750
|
-
return params.width;
|
|
24751
|
-
},
|
|
24752
|
-
set: function set$$1(v) {
|
|
24753
|
-
params.width = v;
|
|
24754
|
-
setWidth(_this, v);
|
|
24755
|
-
}
|
|
24756
|
-
},
|
|
24757
|
-
name: {
|
|
24758
|
-
get: function get$$1() {
|
|
24759
|
-
return params.name;
|
|
24760
|
-
},
|
|
24761
|
-
set: function set$$1(v) {
|
|
24762
|
-
params.name = v;
|
|
24763
|
-
if (titleRow) titleRow.innerHTML = params.name;
|
|
24764
|
-
}
|
|
24765
|
-
},
|
|
24766
|
-
closed: {
|
|
24767
|
-
get: function get$$1() {
|
|
24768
|
-
return params.closed;
|
|
24769
|
-
},
|
|
24770
|
-
set: function set$$1(v) {
|
|
24771
|
-
params.closed = v;
|
|
24772
|
-
if (params.closed) dom.addClass(_this.__ul, GUI.CLASS_CLOSED);
|
|
24773
|
-
else dom.removeClass(_this.__ul, GUI.CLASS_CLOSED);
|
|
24774
|
-
this.onResize();
|
|
24775
|
-
if (_this.__closeButton) _this.__closeButton.innerHTML = v ? GUI.TEXT_OPEN : GUI.TEXT_CLOSED;
|
|
24776
|
-
}
|
|
24777
|
-
},
|
|
24778
|
-
load: { get: function get$$1() {
|
|
24779
|
-
return params.load;
|
|
24780
|
-
} },
|
|
24781
|
-
useLocalStorage: {
|
|
24782
|
-
get: function get$$1() {
|
|
24783
|
-
return useLocalStorage;
|
|
24784
|
-
},
|
|
24785
|
-
set: function set$$1(bool) {
|
|
24786
|
-
if (SUPPORTS_LOCAL_STORAGE) {
|
|
24787
|
-
useLocalStorage = bool;
|
|
24788
|
-
if (bool) dom.bind(window, "unload", saveToLocalStorage);
|
|
24789
|
-
else dom.unbind(window, "unload", saveToLocalStorage);
|
|
24790
|
-
localStorage.setItem(getLocalStorageHash(_this, "isLocal"), bool);
|
|
24791
|
-
}
|
|
24792
|
-
}
|
|
24793
|
-
}
|
|
24794
|
-
});
|
|
24795
|
-
if (Common.isUndefined(params.parent)) {
|
|
24796
|
-
this.closed = params.closed || false;
|
|
24797
|
-
dom.addClass(this.domElement, GUI.CLASS_MAIN);
|
|
24798
|
-
dom.makeSelectable(this.domElement, false);
|
|
24799
|
-
if (SUPPORTS_LOCAL_STORAGE) {
|
|
24800
|
-
if (useLocalStorage) {
|
|
24801
|
-
_this.useLocalStorage = true;
|
|
24802
|
-
var savedGui = localStorage.getItem(getLocalStorageHash(this, "gui"));
|
|
24803
|
-
if (savedGui) params.load = JSON.parse(savedGui);
|
|
24804
|
-
}
|
|
24805
|
-
}
|
|
24806
|
-
this.__closeButton = document.createElement("div");
|
|
24807
|
-
this.__closeButton.innerHTML = GUI.TEXT_CLOSED;
|
|
24808
|
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BUTTON);
|
|
24809
|
-
if (params.closeOnTop) {
|
|
24810
|
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_TOP);
|
|
24811
|
-
this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0]);
|
|
24812
|
-
} else {
|
|
24813
|
-
dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BOTTOM);
|
|
24814
|
-
this.domElement.appendChild(this.__closeButton);
|
|
24815
|
-
}
|
|
24816
|
-
dom.bind(this.__closeButton, "click", function() {
|
|
24817
|
-
_this.closed = !_this.closed;
|
|
24818
|
-
});
|
|
24819
|
-
} else {
|
|
24820
|
-
if (params.closed === void 0) params.closed = true;
|
|
24821
|
-
var titleRowName = document.createTextNode(params.name);
|
|
24822
|
-
dom.addClass(titleRowName, "controller-name");
|
|
24823
|
-
titleRow = addRow(_this, titleRowName);
|
|
24824
|
-
var onClickTitle = function onClickTitle(e) {
|
|
24825
|
-
e.preventDefault();
|
|
24826
|
-
_this.closed = !_this.closed;
|
|
24827
|
-
return false;
|
|
24828
|
-
};
|
|
24829
|
-
dom.addClass(this.__ul, GUI.CLASS_CLOSED);
|
|
24830
|
-
dom.addClass(titleRow, "title");
|
|
24831
|
-
dom.bind(titleRow, "click", onClickTitle);
|
|
24832
|
-
if (!params.closed) this.closed = false;
|
|
24833
|
-
}
|
|
24834
|
-
if (params.autoPlace) {
|
|
24835
|
-
if (Common.isUndefined(params.parent)) {
|
|
24836
|
-
if (autoPlaceVirgin) {
|
|
24837
|
-
autoPlaceContainer = document.createElement("div");
|
|
24838
|
-
dom.addClass(autoPlaceContainer, CSS_NAMESPACE);
|
|
24839
|
-
dom.addClass(autoPlaceContainer, GUI.CLASS_AUTO_PLACE_CONTAINER);
|
|
24840
|
-
document.body.appendChild(autoPlaceContainer);
|
|
24841
|
-
autoPlaceVirgin = false;
|
|
24842
|
-
}
|
|
24843
|
-
autoPlaceContainer.appendChild(this.domElement);
|
|
24844
|
-
dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
|
|
24845
|
-
}
|
|
24846
|
-
if (!this.parent) setWidth(_this, params.width);
|
|
24847
|
-
}
|
|
24848
|
-
this.__resizeHandler = function() {
|
|
24849
|
-
_this.onResizeDebounced();
|
|
24850
|
-
};
|
|
24851
|
-
dom.bind(window, "resize", this.__resizeHandler);
|
|
24852
|
-
dom.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler);
|
|
24853
|
-
dom.bind(this.__ul, "transitionend", this.__resizeHandler);
|
|
24854
|
-
dom.bind(this.__ul, "oTransitionEnd", this.__resizeHandler);
|
|
24855
|
-
this.onResize();
|
|
24856
|
-
if (params.resizable) addResizeHandle(this);
|
|
24857
|
-
saveToLocalStorage = function saveToLocalStorage() {
|
|
24858
|
-
if (SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(_this, "isLocal")) === "true") localStorage.setItem(getLocalStorageHash(_this, "gui"), JSON.stringify(_this.getSaveObject()));
|
|
24859
|
-
};
|
|
24860
|
-
this.saveToLocalStorageIfPossible = saveToLocalStorage;
|
|
24861
|
-
function resetWidth() {
|
|
24862
|
-
var root = _this.getRoot();
|
|
24863
|
-
root.width += 1;
|
|
24864
|
-
Common.defer(function() {
|
|
24865
|
-
root.width -= 1;
|
|
24866
|
-
});
|
|
24867
|
-
}
|
|
24868
|
-
if (!params.parent) resetWidth();
|
|
24869
|
-
};
|
|
24870
|
-
GUI.toggleHide = function() {
|
|
24871
|
-
hide = !hide;
|
|
24872
|
-
Common.each(hideableGuis, function(gui) {
|
|
24873
|
-
gui.domElement.style.display = hide ? "none" : "";
|
|
24874
|
-
});
|
|
24875
|
-
};
|
|
24876
|
-
GUI.CLASS_AUTO_PLACE = "a";
|
|
24877
|
-
GUI.CLASS_AUTO_PLACE_CONTAINER = "ac";
|
|
24878
|
-
GUI.CLASS_MAIN = "main";
|
|
24879
|
-
GUI.CLASS_CONTROLLER_ROW = "cr";
|
|
24880
|
-
GUI.CLASS_TOO_TALL = "taller-than-window";
|
|
24881
|
-
GUI.CLASS_CLOSED = "closed";
|
|
24882
|
-
GUI.CLASS_CLOSE_BUTTON = "close-button";
|
|
24883
|
-
GUI.CLASS_CLOSE_TOP = "close-top";
|
|
24884
|
-
GUI.CLASS_CLOSE_BOTTOM = "close-bottom";
|
|
24885
|
-
GUI.CLASS_DRAG = "drag";
|
|
24886
|
-
GUI.DEFAULT_WIDTH = 245;
|
|
24887
|
-
GUI.TEXT_CLOSED = "Close Controls";
|
|
24888
|
-
GUI.TEXT_OPEN = "Open Controls";
|
|
24889
|
-
GUI._keydownHandler = function(e) {
|
|
24890
|
-
if (document.activeElement.type !== "text" && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) GUI.toggleHide();
|
|
24891
|
-
};
|
|
24892
|
-
dom.bind(window, "keydown", GUI._keydownHandler, false);
|
|
24893
|
-
Common.extend(GUI.prototype, {
|
|
24894
|
-
add: function add(object, property) {
|
|
24895
|
-
return _add(this, object, property, { factoryArgs: Array.prototype.slice.call(arguments, 2) });
|
|
24896
|
-
},
|
|
24897
|
-
addColor: function addColor(object, property) {
|
|
24898
|
-
return _add(this, object, property, { color: true });
|
|
24899
|
-
},
|
|
24900
|
-
remove: function remove(controller) {
|
|
24901
|
-
this.__ul.removeChild(controller.__li);
|
|
24902
|
-
this.__controllers.splice(this.__controllers.indexOf(controller), 1);
|
|
24903
|
-
var _this = this;
|
|
24904
|
-
Common.defer(function() {
|
|
24905
|
-
_this.onResize();
|
|
24906
|
-
});
|
|
24907
|
-
},
|
|
24908
|
-
destroy: function destroy() {
|
|
24909
|
-
if (this.parent) throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");
|
|
24910
|
-
if (this.autoPlace) autoPlaceContainer.removeChild(this.domElement);
|
|
24911
|
-
var _this = this;
|
|
24912
|
-
Common.each(this.__folders, function(subfolder) {
|
|
24913
|
-
_this.removeFolder(subfolder);
|
|
24914
|
-
});
|
|
24915
|
-
dom.unbind(window, "keydown", GUI._keydownHandler, false);
|
|
24916
|
-
removeListeners(this);
|
|
24917
|
-
},
|
|
24918
|
-
addFolder: function addFolder(name) {
|
|
24919
|
-
if (this.__folders[name] !== void 0) throw new Error("You already have a folder in this GUI by the name \"" + name + "\"");
|
|
24920
|
-
var newGuiParams = {
|
|
24921
|
-
name,
|
|
24922
|
-
parent: this
|
|
24923
|
-
};
|
|
24924
|
-
newGuiParams.autoPlace = this.autoPlace;
|
|
24925
|
-
if (this.load && this.load.folders && this.load.folders[name]) {
|
|
24926
|
-
newGuiParams.closed = this.load.folders[name].closed;
|
|
24927
|
-
newGuiParams.load = this.load.folders[name];
|
|
24928
|
-
}
|
|
24929
|
-
var gui = new GUI(newGuiParams);
|
|
24930
|
-
this.__folders[name] = gui;
|
|
24931
|
-
var li = addRow(this, gui.domElement);
|
|
24932
|
-
dom.addClass(li, "folder");
|
|
24933
|
-
return gui;
|
|
24934
|
-
},
|
|
24935
|
-
removeFolder: function removeFolder(folder) {
|
|
24936
|
-
this.__ul.removeChild(folder.domElement.parentElement);
|
|
24937
|
-
delete this.__folders[folder.name];
|
|
24938
|
-
if (this.load && this.load.folders && this.load.folders[folder.name]) delete this.load.folders[folder.name];
|
|
24939
|
-
removeListeners(folder);
|
|
24940
|
-
var _this = this;
|
|
24941
|
-
Common.each(folder.__folders, function(subfolder) {
|
|
24942
|
-
folder.removeFolder(subfolder);
|
|
24943
|
-
});
|
|
24944
|
-
Common.defer(function() {
|
|
24945
|
-
_this.onResize();
|
|
24946
|
-
});
|
|
24947
|
-
},
|
|
24948
|
-
open: function open() {
|
|
24949
|
-
this.closed = false;
|
|
24950
|
-
},
|
|
24951
|
-
close: function close() {
|
|
24952
|
-
this.closed = true;
|
|
24953
|
-
},
|
|
24954
|
-
hide: function hide() {
|
|
24955
|
-
this.domElement.style.display = "none";
|
|
24956
|
-
},
|
|
24957
|
-
show: function show() {
|
|
24958
|
-
this.domElement.style.display = "";
|
|
24959
|
-
},
|
|
24960
|
-
onResize: function onResize() {
|
|
24961
|
-
var root = this.getRoot();
|
|
24962
|
-
if (root.scrollable) {
|
|
24963
|
-
var top = dom.getOffset(root.__ul).top;
|
|
24964
|
-
var h = 0;
|
|
24965
|
-
Common.each(root.__ul.childNodes, function(node) {
|
|
24966
|
-
if (!(root.autoPlace && node === root.__save_row)) h += dom.getHeight(node);
|
|
24967
|
-
});
|
|
24968
|
-
if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) {
|
|
24969
|
-
dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
|
|
24970
|
-
root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + "px";
|
|
24971
|
-
} else {
|
|
24972
|
-
dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
|
|
24973
|
-
root.__ul.style.height = "auto";
|
|
24974
|
-
}
|
|
24975
|
-
}
|
|
24976
|
-
if (root.__resize_handle) Common.defer(function() {
|
|
24977
|
-
root.__resize_handle.style.height = root.__ul.offsetHeight + "px";
|
|
24978
|
-
});
|
|
24979
|
-
if (root.__closeButton) root.__closeButton.style.width = root.width + "px";
|
|
24980
|
-
},
|
|
24981
|
-
onResizeDebounced: Common.debounce(function() {
|
|
24982
|
-
this.onResize();
|
|
24983
|
-
}, 50),
|
|
24984
|
-
remember: function remember() {
|
|
24985
|
-
if (Common.isUndefined(SAVE_DIALOGUE)) {
|
|
24986
|
-
SAVE_DIALOGUE = new CenteredDiv();
|
|
24987
|
-
SAVE_DIALOGUE.domElement.innerHTML = saveDialogContents;
|
|
24988
|
-
}
|
|
24989
|
-
if (this.parent) throw new Error("You can only call remember on a top level GUI.");
|
|
24990
|
-
var _this = this;
|
|
24991
|
-
Common.each(Array.prototype.slice.call(arguments), function(object) {
|
|
24992
|
-
if (_this.__rememberedObjects.length === 0) addSaveMenu(_this);
|
|
24993
|
-
if (_this.__rememberedObjects.indexOf(object) === -1) _this.__rememberedObjects.push(object);
|
|
24994
|
-
});
|
|
24995
|
-
if (this.autoPlace) setWidth(this, this.width);
|
|
24996
|
-
},
|
|
24997
|
-
getRoot: function getRoot() {
|
|
24998
|
-
var gui = this;
|
|
24999
|
-
while (gui.parent) gui = gui.parent;
|
|
25000
|
-
return gui;
|
|
25001
|
-
},
|
|
25002
|
-
getSaveObject: function getSaveObject() {
|
|
25003
|
-
var toReturn = this.load;
|
|
25004
|
-
toReturn.closed = this.closed;
|
|
25005
|
-
if (this.__rememberedObjects.length > 0) {
|
|
25006
|
-
toReturn.preset = this.preset;
|
|
25007
|
-
if (!toReturn.remembered) toReturn.remembered = {};
|
|
25008
|
-
toReturn.remembered[this.preset] = getCurrentPreset(this);
|
|
25009
|
-
}
|
|
25010
|
-
toReturn.folders = {};
|
|
25011
|
-
Common.each(this.__folders, function(element, key) {
|
|
25012
|
-
toReturn.folders[key] = element.getSaveObject();
|
|
25013
|
-
});
|
|
25014
|
-
return toReturn;
|
|
25015
|
-
},
|
|
25016
|
-
save: function save() {
|
|
25017
|
-
if (!this.load.remembered) this.load.remembered = {};
|
|
25018
|
-
this.load.remembered[this.preset] = getCurrentPreset(this);
|
|
25019
|
-
markPresetModified(this, false);
|
|
25020
|
-
this.saveToLocalStorageIfPossible();
|
|
25021
|
-
},
|
|
25022
|
-
saveAs: function saveAs(presetName) {
|
|
25023
|
-
if (!this.load.remembered) {
|
|
25024
|
-
this.load.remembered = {};
|
|
25025
|
-
this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true);
|
|
25026
|
-
}
|
|
25027
|
-
this.load.remembered[presetName] = getCurrentPreset(this);
|
|
25028
|
-
this.preset = presetName;
|
|
25029
|
-
addPresetOption(this, presetName, true);
|
|
25030
|
-
this.saveToLocalStorageIfPossible();
|
|
25031
|
-
},
|
|
25032
|
-
revert: function revert(gui) {
|
|
25033
|
-
Common.each(this.__controllers, function(controller) {
|
|
25034
|
-
if (!this.getRoot().load.remembered) controller.setValue(controller.initialValue);
|
|
25035
|
-
else recallSavedValue(gui || this.getRoot(), controller);
|
|
25036
|
-
if (controller.__onFinishChange) controller.__onFinishChange.call(controller, controller.getValue());
|
|
25037
|
-
}, this);
|
|
25038
|
-
Common.each(this.__folders, function(folder) {
|
|
25039
|
-
folder.revert(folder);
|
|
25040
|
-
});
|
|
25041
|
-
if (!gui) markPresetModified(this.getRoot(), false);
|
|
25042
|
-
},
|
|
25043
|
-
listen: function listen(controller) {
|
|
25044
|
-
var init = this.__listening.length === 0;
|
|
25045
|
-
this.__listening.push(controller);
|
|
25046
|
-
if (init) updateDisplays(this.__listening);
|
|
25047
|
-
},
|
|
25048
|
-
updateDisplay: function updateDisplay() {
|
|
25049
|
-
Common.each(this.__controllers, function(controller) {
|
|
25050
|
-
controller.updateDisplay();
|
|
25051
|
-
});
|
|
25052
|
-
Common.each(this.__folders, function(folder) {
|
|
25053
|
-
folder.updateDisplay();
|
|
25054
|
-
});
|
|
25055
|
-
}
|
|
25056
|
-
});
|
|
25057
|
-
function addRow(gui, newDom, liBefore) {
|
|
25058
|
-
var li = document.createElement("li");
|
|
25059
|
-
if (newDom) li.appendChild(newDom);
|
|
25060
|
-
if (liBefore) gui.__ul.insertBefore(li, liBefore);
|
|
25061
|
-
else gui.__ul.appendChild(li);
|
|
25062
|
-
gui.onResize();
|
|
25063
|
-
return li;
|
|
25064
|
-
}
|
|
25065
|
-
function removeListeners(gui) {
|
|
25066
|
-
dom.unbind(window, "resize", gui.__resizeHandler);
|
|
25067
|
-
if (gui.saveToLocalStorageIfPossible) dom.unbind(window, "unload", gui.saveToLocalStorageIfPossible);
|
|
25068
|
-
}
|
|
25069
|
-
function markPresetModified(gui, modified) {
|
|
25070
|
-
var opt = gui.__preset_select[gui.__preset_select.selectedIndex];
|
|
25071
|
-
if (modified) opt.innerHTML = opt.value + "*";
|
|
25072
|
-
else opt.innerHTML = opt.value;
|
|
25073
|
-
}
|
|
25074
|
-
function augmentController(gui, li, controller) {
|
|
25075
|
-
controller.__li = li;
|
|
25076
|
-
controller.__gui = gui;
|
|
25077
|
-
Common.extend(controller, {
|
|
25078
|
-
options: function options(_options) {
|
|
25079
|
-
if (arguments.length > 1) {
|
|
25080
|
-
var nextSibling = controller.__li.nextElementSibling;
|
|
25081
|
-
controller.remove();
|
|
25082
|
-
return _add(gui, controller.object, controller.property, {
|
|
25083
|
-
before: nextSibling,
|
|
25084
|
-
factoryArgs: [Common.toArray(arguments)]
|
|
25085
|
-
});
|
|
25086
|
-
}
|
|
25087
|
-
if (Common.isArray(_options) || Common.isObject(_options)) {
|
|
25088
|
-
var _nextSibling = controller.__li.nextElementSibling;
|
|
25089
|
-
controller.remove();
|
|
25090
|
-
return _add(gui, controller.object, controller.property, {
|
|
25091
|
-
before: _nextSibling,
|
|
25092
|
-
factoryArgs: [_options]
|
|
25093
|
-
});
|
|
25094
|
-
}
|
|
25095
|
-
},
|
|
25096
|
-
name: function name(_name) {
|
|
25097
|
-
controller.__li.firstElementChild.firstElementChild.innerHTML = _name;
|
|
25098
|
-
return controller;
|
|
25099
|
-
},
|
|
25100
|
-
listen: function listen() {
|
|
25101
|
-
controller.__gui.listen(controller);
|
|
25102
|
-
return controller;
|
|
25103
|
-
},
|
|
25104
|
-
remove: function remove() {
|
|
25105
|
-
controller.__gui.remove(controller);
|
|
25106
|
-
return controller;
|
|
25107
|
-
}
|
|
25108
|
-
});
|
|
25109
|
-
if (controller instanceof NumberControllerSlider) {
|
|
25110
|
-
var box = new NumberControllerBox(controller.object, controller.property, {
|
|
25111
|
-
min: controller.__min,
|
|
25112
|
-
max: controller.__max,
|
|
25113
|
-
step: controller.__step
|
|
25114
|
-
});
|
|
25115
|
-
Common.each([
|
|
25116
|
-
"updateDisplay",
|
|
25117
|
-
"onChange",
|
|
25118
|
-
"onFinishChange",
|
|
25119
|
-
"step",
|
|
25120
|
-
"min",
|
|
25121
|
-
"max"
|
|
25122
|
-
], function(method) {
|
|
25123
|
-
var pc = controller[method];
|
|
25124
|
-
var pb = box[method];
|
|
25125
|
-
controller[method] = box[method] = function() {
|
|
25126
|
-
var args = Array.prototype.slice.call(arguments);
|
|
25127
|
-
pb.apply(box, args);
|
|
25128
|
-
return pc.apply(controller, args);
|
|
25129
|
-
};
|
|
25130
|
-
});
|
|
25131
|
-
dom.addClass(li, "has-slider");
|
|
25132
|
-
controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild);
|
|
25133
|
-
} else if (controller instanceof NumberControllerBox) {
|
|
25134
|
-
var r = function r(returned) {
|
|
25135
|
-
if (Common.isNumber(controller.__min) && Common.isNumber(controller.__max)) {
|
|
25136
|
-
var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
|
|
25137
|
-
var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
|
|
25138
|
-
controller.remove();
|
|
25139
|
-
var newController = _add(gui, controller.object, controller.property, {
|
|
25140
|
-
before: controller.__li.nextElementSibling,
|
|
25141
|
-
factoryArgs: [
|
|
25142
|
-
controller.__min,
|
|
25143
|
-
controller.__max,
|
|
25144
|
-
controller.__step
|
|
25145
|
-
]
|
|
25146
|
-
});
|
|
25147
|
-
newController.name(oldName);
|
|
25148
|
-
if (wasListening) newController.listen();
|
|
25149
|
-
return newController;
|
|
25150
|
-
}
|
|
25151
|
-
return returned;
|
|
25152
|
-
};
|
|
25153
|
-
controller.min = Common.compose(r, controller.min);
|
|
25154
|
-
controller.max = Common.compose(r, controller.max);
|
|
25155
|
-
} else if (controller instanceof BooleanController) {
|
|
25156
|
-
dom.bind(li, "click", function() {
|
|
25157
|
-
dom.fakeEvent(controller.__checkbox, "click");
|
|
25158
|
-
});
|
|
25159
|
-
dom.bind(controller.__checkbox, "click", function(e) {
|
|
25160
|
-
e.stopPropagation();
|
|
25161
|
-
});
|
|
25162
|
-
} else if (controller instanceof FunctionController) {
|
|
25163
|
-
dom.bind(li, "click", function() {
|
|
25164
|
-
dom.fakeEvent(controller.__button, "click");
|
|
25165
|
-
});
|
|
25166
|
-
dom.bind(li, "mouseover", function() {
|
|
25167
|
-
dom.addClass(controller.__button, "hover");
|
|
25168
|
-
});
|
|
25169
|
-
dom.bind(li, "mouseout", function() {
|
|
25170
|
-
dom.removeClass(controller.__button, "hover");
|
|
25171
|
-
});
|
|
25172
|
-
} else if (controller instanceof ColorController) {
|
|
25173
|
-
dom.addClass(li, "color");
|
|
25174
|
-
controller.updateDisplay = Common.compose(function(val) {
|
|
25175
|
-
li.style.borderLeftColor = controller.__color.toString();
|
|
25176
|
-
return val;
|
|
25177
|
-
}, controller.updateDisplay);
|
|
25178
|
-
controller.updateDisplay();
|
|
25179
|
-
}
|
|
25180
|
-
controller.setValue = Common.compose(function(val) {
|
|
25181
|
-
if (gui.getRoot().__preset_select && controller.isModified()) markPresetModified(gui.getRoot(), true);
|
|
25182
|
-
return val;
|
|
25183
|
-
}, controller.setValue);
|
|
25184
|
-
}
|
|
25185
|
-
function recallSavedValue(gui, controller) {
|
|
25186
|
-
var root = gui.getRoot();
|
|
25187
|
-
var matchedIndex = root.__rememberedObjects.indexOf(controller.object);
|
|
25188
|
-
if (matchedIndex !== -1) {
|
|
25189
|
-
var controllerMap = root.__rememberedObjectIndecesToControllers[matchedIndex];
|
|
25190
|
-
if (controllerMap === void 0) {
|
|
25191
|
-
controllerMap = {};
|
|
25192
|
-
root.__rememberedObjectIndecesToControllers[matchedIndex] = controllerMap;
|
|
25193
|
-
}
|
|
25194
|
-
controllerMap[controller.property] = controller;
|
|
25195
|
-
if (root.load && root.load.remembered) {
|
|
25196
|
-
var presetMap = root.load.remembered;
|
|
25197
|
-
var preset = void 0;
|
|
25198
|
-
if (presetMap[gui.preset]) preset = presetMap[gui.preset];
|
|
25199
|
-
else if (presetMap[DEFAULT_DEFAULT_PRESET_NAME]) preset = presetMap[DEFAULT_DEFAULT_PRESET_NAME];
|
|
25200
|
-
else return;
|
|
25201
|
-
if (preset[matchedIndex] && preset[matchedIndex][controller.property] !== void 0) {
|
|
25202
|
-
var value = preset[matchedIndex][controller.property];
|
|
25203
|
-
controller.initialValue = value;
|
|
25204
|
-
controller.setValue(value);
|
|
25205
|
-
}
|
|
25206
|
-
}
|
|
25207
|
-
}
|
|
25208
|
-
}
|
|
25209
|
-
function _add(gui, object, property, params) {
|
|
25210
|
-
if (object[property] === void 0) throw new Error("Object \"" + object + "\" has no property \"" + property + "\"");
|
|
25211
|
-
var controller = void 0;
|
|
25212
|
-
if (params.color) controller = new ColorController(object, property);
|
|
25213
|
-
else {
|
|
25214
|
-
var factoryArgs = [object, property].concat(params.factoryArgs);
|
|
25215
|
-
controller = ControllerFactory.apply(gui, factoryArgs);
|
|
25216
|
-
}
|
|
25217
|
-
if (params.before instanceof Controller) params.before = params.before.__li;
|
|
25218
|
-
recallSavedValue(gui, controller);
|
|
25219
|
-
dom.addClass(controller.domElement, "c");
|
|
25220
|
-
var name = document.createElement("span");
|
|
25221
|
-
dom.addClass(name, "property-name");
|
|
25222
|
-
name.innerHTML = controller.property;
|
|
25223
|
-
var container = document.createElement("div");
|
|
25224
|
-
container.appendChild(name);
|
|
25225
|
-
container.appendChild(controller.domElement);
|
|
25226
|
-
var li = addRow(gui, container, params.before);
|
|
25227
|
-
dom.addClass(li, GUI.CLASS_CONTROLLER_ROW);
|
|
25228
|
-
if (controller instanceof ColorController) dom.addClass(li, "color");
|
|
25229
|
-
else dom.addClass(li, _typeof(controller.getValue()));
|
|
25230
|
-
augmentController(gui, li, controller);
|
|
25231
|
-
gui.__controllers.push(controller);
|
|
25232
|
-
return controller;
|
|
25233
|
-
}
|
|
25234
|
-
function getLocalStorageHash(gui, key) {
|
|
25235
|
-
return document.location.href + "." + key;
|
|
25236
|
-
}
|
|
25237
|
-
function addPresetOption(gui, name, setSelected) {
|
|
25238
|
-
var opt = document.createElement("option");
|
|
25239
|
-
opt.innerHTML = name;
|
|
25240
|
-
opt.value = name;
|
|
25241
|
-
gui.__preset_select.appendChild(opt);
|
|
25242
|
-
if (setSelected) gui.__preset_select.selectedIndex = gui.__preset_select.length - 1;
|
|
25243
|
-
}
|
|
25244
|
-
function showHideExplain(gui, explain) {
|
|
25245
|
-
explain.style.display = gui.useLocalStorage ? "block" : "none";
|
|
25246
|
-
}
|
|
25247
|
-
function addSaveMenu(gui) {
|
|
25248
|
-
var div = gui.__save_row = document.createElement("li");
|
|
25249
|
-
dom.addClass(gui.domElement, "has-save");
|
|
25250
|
-
gui.__ul.insertBefore(div, gui.__ul.firstChild);
|
|
25251
|
-
dom.addClass(div, "save-row");
|
|
25252
|
-
var gears = document.createElement("span");
|
|
25253
|
-
gears.innerHTML = " ";
|
|
25254
|
-
dom.addClass(gears, "button gears");
|
|
25255
|
-
var button = document.createElement("span");
|
|
25256
|
-
button.innerHTML = "Save";
|
|
25257
|
-
dom.addClass(button, "button");
|
|
25258
|
-
dom.addClass(button, "save");
|
|
25259
|
-
var button2 = document.createElement("span");
|
|
25260
|
-
button2.innerHTML = "New";
|
|
25261
|
-
dom.addClass(button2, "button");
|
|
25262
|
-
dom.addClass(button2, "save-as");
|
|
25263
|
-
var button3 = document.createElement("span");
|
|
25264
|
-
button3.innerHTML = "Revert";
|
|
25265
|
-
dom.addClass(button3, "button");
|
|
25266
|
-
dom.addClass(button3, "revert");
|
|
25267
|
-
var select = gui.__preset_select = document.createElement("select");
|
|
25268
|
-
if (gui.load && gui.load.remembered) Common.each(gui.load.remembered, function(value, key) {
|
|
25269
|
-
addPresetOption(gui, key, key === gui.preset);
|
|
25270
|
-
});
|
|
25271
|
-
else addPresetOption(gui, DEFAULT_DEFAULT_PRESET_NAME, false);
|
|
25272
|
-
dom.bind(select, "change", function() {
|
|
25273
|
-
for (var index = 0; index < gui.__preset_select.length; index++) gui.__preset_select[index].innerHTML = gui.__preset_select[index].value;
|
|
25274
|
-
gui.preset = this.value;
|
|
25275
|
-
});
|
|
25276
|
-
div.appendChild(select);
|
|
25277
|
-
div.appendChild(gears);
|
|
25278
|
-
div.appendChild(button);
|
|
25279
|
-
div.appendChild(button2);
|
|
25280
|
-
div.appendChild(button3);
|
|
25281
|
-
if (SUPPORTS_LOCAL_STORAGE) {
|
|
25282
|
-
var explain = document.getElementById("dg-local-explain");
|
|
25283
|
-
var localStorageCheckBox = document.getElementById("dg-local-storage");
|
|
25284
|
-
var saveLocally = document.getElementById("dg-save-locally");
|
|
25285
|
-
saveLocally.style.display = "block";
|
|
25286
|
-
if (localStorage.getItem(getLocalStorageHash(gui, "isLocal")) === "true") localStorageCheckBox.setAttribute("checked", "checked");
|
|
25287
|
-
showHideExplain(gui, explain);
|
|
25288
|
-
dom.bind(localStorageCheckBox, "change", function() {
|
|
25289
|
-
gui.useLocalStorage = !gui.useLocalStorage;
|
|
25290
|
-
showHideExplain(gui, explain);
|
|
25291
|
-
});
|
|
25292
|
-
}
|
|
25293
|
-
var newConstructorTextArea = document.getElementById("dg-new-constructor");
|
|
25294
|
-
dom.bind(newConstructorTextArea, "keydown", function(e) {
|
|
25295
|
-
if (e.metaKey && (e.which === 67 || e.keyCode === 67)) SAVE_DIALOGUE.hide();
|
|
25296
|
-
});
|
|
25297
|
-
dom.bind(gears, "click", function() {
|
|
25298
|
-
newConstructorTextArea.innerHTML = JSON.stringify(gui.getSaveObject(), void 0, 2);
|
|
25299
|
-
SAVE_DIALOGUE.show();
|
|
25300
|
-
newConstructorTextArea.focus();
|
|
25301
|
-
newConstructorTextArea.select();
|
|
25302
|
-
});
|
|
25303
|
-
dom.bind(button, "click", function() {
|
|
25304
|
-
gui.save();
|
|
25305
|
-
});
|
|
25306
|
-
dom.bind(button2, "click", function() {
|
|
25307
|
-
var presetName = prompt("Enter a new preset name.");
|
|
25308
|
-
if (presetName) gui.saveAs(presetName);
|
|
25309
|
-
});
|
|
25310
|
-
dom.bind(button3, "click", function() {
|
|
25311
|
-
gui.revert();
|
|
25312
|
-
});
|
|
25313
|
-
}
|
|
25314
|
-
function addResizeHandle(gui) {
|
|
25315
|
-
var pmouseX = void 0;
|
|
25316
|
-
gui.__resize_handle = document.createElement("div");
|
|
25317
|
-
Common.extend(gui.__resize_handle.style, {
|
|
25318
|
-
width: "6px",
|
|
25319
|
-
marginLeft: "-3px",
|
|
25320
|
-
height: "200px",
|
|
25321
|
-
cursor: "ew-resize",
|
|
25322
|
-
position: "absolute"
|
|
25323
|
-
});
|
|
25324
|
-
function drag(e) {
|
|
25325
|
-
e.preventDefault();
|
|
25326
|
-
gui.width += pmouseX - e.clientX;
|
|
25327
|
-
gui.onResize();
|
|
25328
|
-
pmouseX = e.clientX;
|
|
25329
|
-
return false;
|
|
25330
|
-
}
|
|
25331
|
-
function dragStop() {
|
|
25332
|
-
dom.removeClass(gui.__closeButton, GUI.CLASS_DRAG);
|
|
25333
|
-
dom.unbind(window, "mousemove", drag);
|
|
25334
|
-
dom.unbind(window, "mouseup", dragStop);
|
|
25335
|
-
}
|
|
25336
|
-
function dragStart(e) {
|
|
25337
|
-
e.preventDefault();
|
|
25338
|
-
pmouseX = e.clientX;
|
|
25339
|
-
dom.addClass(gui.__closeButton, GUI.CLASS_DRAG);
|
|
25340
|
-
dom.bind(window, "mousemove", drag);
|
|
25341
|
-
dom.bind(window, "mouseup", dragStop);
|
|
25342
|
-
return false;
|
|
25343
|
-
}
|
|
25344
|
-
dom.bind(gui.__resize_handle, "mousedown", dragStart);
|
|
25345
|
-
dom.bind(gui.__closeButton, "mousedown", dragStart);
|
|
25346
|
-
gui.domElement.insertBefore(gui.__resize_handle, gui.domElement.firstElementChild);
|
|
25347
|
-
}
|
|
25348
|
-
function setWidth(gui, w) {
|
|
25349
|
-
gui.domElement.style.width = w + "px";
|
|
25350
|
-
if (gui.__save_row && gui.autoPlace) gui.__save_row.style.width = w + "px";
|
|
25351
|
-
if (gui.__closeButton) gui.__closeButton.style.width = w + "px";
|
|
25352
|
-
}
|
|
25353
|
-
function getCurrentPreset(gui, useInitialValues) {
|
|
25354
|
-
var toReturn = {};
|
|
25355
|
-
Common.each(gui.__rememberedObjects, function(val, index) {
|
|
25356
|
-
var savedValues = {};
|
|
25357
|
-
var controllerMap = gui.__rememberedObjectIndecesToControllers[index];
|
|
25358
|
-
Common.each(controllerMap, function(controller, property) {
|
|
25359
|
-
savedValues[property] = useInitialValues ? controller.initialValue : controller.getValue();
|
|
25360
|
-
});
|
|
25361
|
-
toReturn[index] = savedValues;
|
|
25362
|
-
});
|
|
25363
|
-
return toReturn;
|
|
25364
|
-
}
|
|
25365
|
-
function setPresetSelectIndex(gui) {
|
|
25366
|
-
for (var index = 0; index < gui.__preset_select.length; index++) if (gui.__preset_select[index].value === gui.preset) gui.__preset_select.selectedIndex = index;
|
|
25367
|
-
}
|
|
25368
|
-
function updateDisplays(controllerArray) {
|
|
25369
|
-
if (controllerArray.length !== 0) requestAnimationFrame$1$1.call(window, function() {
|
|
25370
|
-
updateDisplays(controllerArray);
|
|
25371
|
-
});
|
|
25372
|
-
Common.each(controllerArray, function(c) {
|
|
25373
|
-
c.updateDisplay();
|
|
25374
|
-
});
|
|
25375
|
-
}
|
|
25376
|
-
var GUI$1 = GUI;
|
|
25377
23182
|
var Counter_module_default = {
|
|
25378
23183
|
root: "_root_9xpag_1",
|
|
25379
23184
|
h2: "_h2_9xpag_192",
|
|
@@ -25469,7 +23274,10 @@ var Counter = () => {
|
|
|
25469
23274
|
const valueController = (0, react.useRef)(null);
|
|
25470
23275
|
const easeController = (0, react.useRef)(null);
|
|
25471
23276
|
(0, react.useEffect)(() => {
|
|
23277
|
+
let ctrl = null;
|
|
23278
|
+
let isCancelled = false;
|
|
25472
23279
|
const UPDATE = () => {
|
|
23280
|
+
if (!valueController.current || typeof document === "undefined") return;
|
|
25473
23281
|
valueController.current.max(CONFIG.max);
|
|
25474
23282
|
valueController.current.min(CONFIG.min);
|
|
25475
23283
|
valueController.current.step(CONFIG.step);
|
|
@@ -25479,19 +23287,26 @@ var Counter = () => {
|
|
|
25479
23287
|
document.documentElement.style.setProperty("--transition", String(CONFIG.transition));
|
|
25480
23288
|
document.documentElement.style.setProperty("--ease", `var(--${CONFIG.ease})`);
|
|
25481
23289
|
};
|
|
25482
|
-
const
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
23290
|
+
const initialize = async () => {
|
|
23291
|
+
if (typeof window === "undefined") return;
|
|
23292
|
+
const { GUI } = await Promise.resolve().then(() => require("./dat.gui.module-C-Oxsf3K.cjs"));
|
|
23293
|
+
if (isCancelled) return;
|
|
23294
|
+
ctrl = new GUI({
|
|
23295
|
+
width: 320,
|
|
23296
|
+
closed: true
|
|
23297
|
+
});
|
|
23298
|
+
const valueFolder = ctrl.addFolder("Config");
|
|
23299
|
+
padController.current = valueFolder.add(CONFIG, "pad").name("Pad").onChange(UPDATE);
|
|
23300
|
+
currencyController.current = valueFolder.add(CONFIG, "currency", CONFIG.currencyOptions).name("Currency").onChange(UPDATE);
|
|
23301
|
+
transitionController.current = ctrl.add(CONFIG, "transition", 0, 5, .05).name("Transition (s)").onChange(UPDATE);
|
|
23302
|
+
easeController.current = ctrl.add(CONFIG, "ease", CONFIG.easeOptions).name("Easing").onChange(UPDATE);
|
|
23303
|
+
valueController.current = ctrl.add(CONFIG, "value", CONFIG.min, CONFIG.max, CONFIG.step).name("Value").onChange(UPDATE);
|
|
23304
|
+
UPDATE();
|
|
23305
|
+
};
|
|
23306
|
+
initialize();
|
|
25493
23307
|
return () => {
|
|
25494
|
-
|
|
23308
|
+
isCancelled = true;
|
|
23309
|
+
ctrl?.destroy();
|
|
25495
23310
|
};
|
|
25496
23311
|
}, []);
|
|
25497
23312
|
const padCount = pad ? CONFIG.max.toFixed(2).toString().length - value.toString().length : 0;
|